mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
feat(unstable): enable isolatedModules by default (#7327)
This commit is contained in:
parent
241d228104
commit
6ff9395532
2 changed files with 18 additions and 2 deletions
|
@ -621,6 +621,8 @@ impl TsCompiler {
|
|||
"esModuleInterop": true,
|
||||
"incremental": true,
|
||||
"inlineSourceMap": true,
|
||||
// TODO(lucacasonato): enable this by default in 1.5.0
|
||||
"isolatedModules": unstable,
|
||||
"jsx": "react",
|
||||
"lib": lib,
|
||||
"module": "esnext",
|
||||
|
@ -1252,6 +1254,8 @@ pub async fn runtime_compile(
|
|||
"allowNonTsExtensions": true,
|
||||
"checkJs": false,
|
||||
"esModuleInterop": true,
|
||||
// TODO(lucacasonato): enable this by default in 1.5.0
|
||||
"isolatedModules": unstable,
|
||||
"jsx": "react",
|
||||
"module": "esnext",
|
||||
"sourceMap": true,
|
||||
|
|
|
@ -878,6 +878,13 @@ delete Object.prototype.__proto__;
|
|||
7016,
|
||||
];
|
||||
|
||||
const IGNORED_COMPILE_DIAGNOSTICS = [
|
||||
// TS1208: All files must be modules when the '--isolatedModules' flag is
|
||||
// provided. We can ignore because we guarantuee that all files are
|
||||
// modules.
|
||||
1208,
|
||||
];
|
||||
|
||||
const stats = [];
|
||||
let statsStart = 0;
|
||||
|
||||
|
@ -1162,7 +1169,9 @@ delete Object.prototype.__proto__;
|
|||
...program.getSemanticDiagnostics(),
|
||||
];
|
||||
diagnostics = diagnostics.filter(
|
||||
({ code }) => !IGNORED_DIAGNOSTICS.includes(code),
|
||||
({ code }) =>
|
||||
!IGNORED_DIAGNOSTICS.includes(code) &&
|
||||
!IGNORED_COMPILE_DIAGNOSTICS.includes(code),
|
||||
);
|
||||
|
||||
// We will only proceed with the emit if there are no diagnostics.
|
||||
|
@ -1333,7 +1342,10 @@ delete Object.prototype.__proto__;
|
|||
|
||||
const diagnostics = ts
|
||||
.getPreEmitDiagnostics(program)
|
||||
.filter(({ code }) => !IGNORED_DIAGNOSTICS.includes(code));
|
||||
.filter(({ code }) =>
|
||||
!IGNORED_DIAGNOSTICS.includes(code) &&
|
||||
!IGNORED_COMPILE_DIAGNOSTICS.includes(code)
|
||||
);
|
||||
|
||||
const emitResult = program.emit();
|
||||
assert(emitResult.emitSkipped === false, "Unexpected skip of the emit.");
|
||||
|
|
Loading…
Reference in a new issue