1
0
Fork 0
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:
Luca Casonato 2020-09-08 15:28:42 +02:00 committed by GitHub
parent 241d228104
commit 6ff9395532
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View file

@ -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,

View file

@ -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.");