Skip to content

Commit

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

Co-authored-by: Daniel Rosenwasser <[email protected]>
Co-authored-by: typescript-bot <[email protected]>
  • Loading branch information
3 people authored Mar 14, 2023
1 parent 9a8badd commit 6e59874
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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.

Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -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;
Loading

0 comments on commit 6e59874

Please sign in to comment.