Skip to content

Commit

Permalink
🤖 Pick PR microsoft#53240 (Allow 'verbatimModuleSyntax' with t...) in…
Browse files Browse the repository at this point in the history
…to release-5.0 (microsoft#53253)

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
Co-authored-by: typescript-bot <typescript@microsoft.com>
  • Loading branch information
3 people authored and dar committed Sep 14, 2023
1 parent c5c40cb commit 003cf69
Show file tree
Hide file tree
Showing 283 changed files with 1,463 additions and 75 deletions.
8 changes: 8 additions & 0 deletions lib/tsserver.js
Expand Up @@ -133402,6 +133402,11 @@ function canBeConvertedToAsync(node) {
}

// src/services/transpile.ts
var optionsRedundantWithVerbatimModuleSyntax = /* @__PURE__ */ new Set([
"isolatedModules",
"preserveValueImports",
"importsNotUsedAsValues"
]);
function transpileModule(input, transpileOptions) {
const diagnostics = [];
const options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : {};
Expand All @@ -133412,6 +133417,9 @@ function transpileModule(input, transpileOptions) {
}
}
for (const option of transpileOptionValueCompilerOptions) {
if (options.verbatimModuleSyntax && optionsRedundantWithVerbatimModuleSyntax.has(option.name)) {
continue;
}
options[option.name] = option.transpileOptionValue;
}
options.suppressOutputPathCheck = true;
Expand Down
10 changes: 9 additions & 1 deletion lib/tsserverlibrary.js
Expand Up @@ -131819,6 +131819,9 @@ ${lanes.join("\n")}
}
}
for (const option of transpileOptionValueCompilerOptions) {
if (options.verbatimModuleSyntax && optionsRedundantWithVerbatimModuleSyntax.has(option.name)) {
continue;
}
options[option.name] = option.transpileOptionValue;
}
options.suppressOutputPathCheck = true;
Expand Down Expand Up @@ -131922,11 +131925,16 @@ ${lanes.join("\n")}
}
return options;
}
var commandLineOptionsStringToEnum;
var optionsRedundantWithVerbatimModuleSyntax, commandLineOptionsStringToEnum;
var init_transpile = __esm({
"src/services/transpile.ts"() {
"use strict";
init_ts4();
optionsRedundantWithVerbatimModuleSyntax = /* @__PURE__ */ new Set([
"isolatedModules",
"preserveValueImports",
"importsNotUsedAsValues"
]);
}
});

Expand Down
10 changes: 9 additions & 1 deletion lib/typescript.js
Expand Up @@ -131833,6 +131833,9 @@ ${lanes.join("\n")}
}
}
for (const option of transpileOptionValueCompilerOptions) {
if (options.verbatimModuleSyntax && optionsRedundantWithVerbatimModuleSyntax.has(option.name)) {
continue;
}
options[option.name] = option.transpileOptionValue;
}
options.suppressOutputPathCheck = true;
Expand Down Expand Up @@ -131936,11 +131939,16 @@ ${lanes.join("\n")}
}
return options;
}
var commandLineOptionsStringToEnum;
var optionsRedundantWithVerbatimModuleSyntax, commandLineOptionsStringToEnum;
var init_transpile = __esm({
"src/services/transpile.ts"() {
"use strict";
init_ts4();
optionsRedundantWithVerbatimModuleSyntax = /* @__PURE__ */ new Set([
"isolatedModules",
"preserveValueImports",
"importsNotUsedAsValues"
]);
}
});

Expand Down
11 changes: 11 additions & 0 deletions src/services/transpile.ts
Expand Up @@ -43,6 +43,12 @@ export interface TranspileOutput {
sourceMapText?: string;
}

const optionsRedundantWithVerbatimModuleSyntax = new Set([
"isolatedModules",
"preserveValueImports",
"importsNotUsedAsValues"
]);

/*
* This function will compile source text from 'input' argument using specified compiler options.
* If not options are provided - it will use a set of default compiler options.
Expand All @@ -66,6 +72,11 @@ export function transpileModule(input: string, transpileOptions: TranspileOption
}

for (const option of transpileOptionValueCompilerOptions) {
// Do not set redundant config options if `verbatimModuleSyntax` was supplied.
if (options.verbatimModuleSyntax && optionsRedundantWithVerbatimModuleSyntax.has(option.name)) {
continue;
}

options[option.name] = option.transpileOptionValue;
}

Expand Down
251 changes: 178 additions & 73 deletions src/testRunner/unittests/services/transpile.ts

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,6 @@
error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== file.ts (0 errors) ====
import IFoo = Namespace.IFoo;export type { IFoo };

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,6 @@
error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== file.ts (0 errors) ====
import IFoo = Namespace.IFoo;export type { IFoo };

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,6 @@
error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== file.ts (0 errors) ====
import IFoo = Namespace.IFoo;export { type IFoo };

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,6 @@
error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== file.ts (0 errors) ====
import IFoo = Namespace.IFoo;export { type IFoo };

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,6 @@
error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== file.ts (0 errors) ====
var x: string = 0;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,6 @@
error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== file.ts (0 errors) ====
var x: string = 0;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,8 @@
error TS5104: Option 'isolatedModules' is redundant and cannot be specified with option 'verbatimModuleSyntax'.
error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5104: Option 'isolatedModules' is redundant and cannot be specified with option 'verbatimModuleSyntax'.
!!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== input.js (0 errors) ====
x;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,8 @@
error TS5104: Option 'isolatedModules' is redundant and cannot be specified with option 'verbatimModuleSyntax'.
error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5104: Option 'isolatedModules' is redundant and cannot be specified with option 'verbatimModuleSyntax'.
!!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== input.js (0 errors) ====
x;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,9 @@
error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== file.ts (0 errors) ====

var a;
export { a as alias };
export * as alias from './file';

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,9 @@
error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== file.ts (0 errors) ====

var a;
export { a as alias };
export * as alias from './file';

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,9 @@
error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
file.ts(1,1): error TS1434: Unexpected keyword or identifier.


!!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== file.ts (1 errors) ====
a b
~
!!! error TS1434: Unexpected keyword or identifier.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,9 @@
error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
file.ts(1,1): error TS1434: Unexpected keyword or identifier.


!!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== file.ts (1 errors) ====
a b
~
!!! error TS1434: Unexpected keyword or identifier.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,7 @@
error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== file.ts (0 errors) ====
/// <reference path="file2.ts" />
var x = 0;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,7 @@
error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== file.ts (0 errors) ====
/// <reference path="file2.ts" />
var x = 0;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,6 @@
error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== file.ts (0 errors) ====
import {a} from "module2";

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,6 @@
error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== file.ts (0 errors) ====
import {a} from "module2";

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,6 @@
error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== file.ts (0 errors) ====
var x = 0;

0 comments on commit 003cf69

Please sign in to comment.