summaryrefslogtreecommitdiff
path: root/cli/tsc/99_main_compiler.js
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-03-21 11:46:40 -0400
committerGitHub <noreply@github.com>2023-03-21 15:46:40 +0000
commit2fcf1f14cf29bb68995f652f93a4f6e3cb55c8d7 (patch)
tree04fb972934969cb01a52f3b9b8af0a17134ef5b6 /cli/tsc/99_main_compiler.js
parent0366d6833f25b786e897ce0d6393f692507f0532 (diff)
feat: TypeScript 5.0.2 (except decorators) (#18294)
This upgrades TypeScript to 5.0.2, but does not have ES decorator support because swc does not support that yet.
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