summaryrefslogtreecommitdiff
path: root/cli/tsc/99_main_compiler.js
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tsc/99_main_compiler.js')
-rw-r--r--cli/tsc/99_main_compiler.js50
1 files changed, 45 insertions, 5 deletions
diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js
index 68ff2bd39..cb844624c 100644
--- a/cli/tsc/99_main_compiler.js
+++ b/cli/tsc/99_main_compiler.js
@@ -135,7 +135,7 @@ delete Object.prototype.__proto__;
// We need to use a custom document registry in order to provide source files
// with an impliedNodeFormat to the ts language service
- /** @type {Map<string, ts.SourceFile} */
+ /** @type {Map<string, ts.SourceFile>} */
const documentRegistrySourceFileCache = new Map();
const { getKeyForCompilationSettings } = ts.createDocumentRegistry(); // reuse this code
/** @type {ts.DocumentRegistry} */
@@ -362,9 +362,6 @@ delete Object.prototype.__proto__;
// TS2688: Cannot find type definition file for '...'.
// We ignore because type defintion files can end with '.ts'.
2688,
- // TS2691: An import path cannot end with a '.ts' extension. Consider
- // importing 'bad-module' instead.
- 2691,
// TS2792: Cannot find module. Did you mean to set the 'moduleResolution'
// option to 'node', or to add aliases to the 'paths' option?
2792,
@@ -866,7 +863,10 @@ delete Object.prototype.__proto__;
case "configure": {
const { options, errors } = ts
.convertCompilerOptionsFromJson(request.compilerOptions, "");
- Object.assign(options, { allowNonTsExtensions: true });
+ Object.assign(options, {
+ allowNonTsExtensions: true,
+ allowImportingTsExtensions: true,
+ });
if (errors.length) {
debug(ts.formatDiagnostics(errors, host));
}
@@ -1213,6 +1213,46 @@ delete Object.prototype.__proto__;
ts.deno.setNodeBuiltInModuleNames(nodeBuiltInModuleNames);
+ // list of globals that should be kept in Node's globalThis
+ ts.deno.setNodeOnlyGlobalNames([
+ // when bumping the @types/node version we should check if
+ // anything needs to be updated here
+ "NodeRequire",
+ "RequireResolve",
+ "RequireResolve",
+ "process",
+ "console",
+ "__filename",
+ "__dirname",
+ "require",
+ "module",
+ "exports",
+ "gc",
+ "BufferEncoding",
+ "BufferConstructor",
+ "WithImplicitCoercion",
+ "Buffer",
+ "Console",
+ "ImportMeta",
+ "setTimeout",
+ "setInterval",
+ "setImmediate",
+ "Global",
+ "AbortController",
+ "AbortSignal",
+ "Blob",
+ "BroadcastChannel",
+ "MessageChannel",
+ "MessagePort",
+ "Event",
+ "EventTarget",
+ "performance",
+ "TextDecoder",
+ "TextEncoder",
+ "URL",
+ "URLSearchParams",
+ ]);
+
for (const lib of libs) {
const specifier = `lib.${lib}.d.ts`;
// we are using internal APIs here to "inject" our custom libraries into