build: switch build/tsconfig.json to module: nodenext (#238426)

* build/tsconfig: switch to module: nodenext for bun compat

* build: rewrite imports for nodenext compat

* build: re-generate
This commit is contained in:
Aman Karmani
2025-01-22 11:12:39 -08:00
committed by GitHub
parent 02ea21a23d
commit e76c50f20e
122 changed files with 1907 additions and 1202 deletions

View File

@@ -3,10 +3,13 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.StaticLanguageServiceHost = void 0;
const ts = require("typescript");
const path = require("path");
const typescript_1 = __importDefault(require("typescript"));
const path_1 = __importDefault(require("path"));
class StaticLanguageServiceHost {
projectPath;
_cmdLine;
@@ -14,11 +17,11 @@ class StaticLanguageServiceHost {
constructor(projectPath) {
this.projectPath = projectPath;
const existingOptions = {};
const parsed = ts.readConfigFile(projectPath, ts.sys.readFile);
const parsed = typescript_1.default.readConfigFile(projectPath, typescript_1.default.sys.readFile);
if (parsed.error) {
throw parsed.error;
}
this._cmdLine = ts.parseJsonConfigFileContent(parsed.config, ts.sys, path.dirname(projectPath), existingOptions);
this._cmdLine = typescript_1.default.parseJsonConfigFileContent(parsed.config, typescript_1.default.sys, path_1.default.dirname(projectPath), existingOptions);
if (this._cmdLine.errors.length > 0) {
throw parsed.error;
}
@@ -38,28 +41,28 @@ class StaticLanguageServiceHost {
getScriptSnapshot(fileName) {
let result = this._scriptSnapshots.get(fileName);
if (result === undefined) {
const content = ts.sys.readFile(fileName);
const content = typescript_1.default.sys.readFile(fileName);
if (content === undefined) {
return undefined;
}
result = ts.ScriptSnapshot.fromString(content);
result = typescript_1.default.ScriptSnapshot.fromString(content);
this._scriptSnapshots.set(fileName, result);
}
return result;
}
getCurrentDirectory() {
return path.dirname(this.projectPath);
return path_1.default.dirname(this.projectPath);
}
getDefaultLibFileName(options) {
return ts.getDefaultLibFilePath(options);
return typescript_1.default.getDefaultLibFilePath(options);
}
directoryExists = ts.sys.directoryExists;
getDirectories = ts.sys.getDirectories;
fileExists = ts.sys.fileExists;
readFile = ts.sys.readFile;
readDirectory = ts.sys.readDirectory;
directoryExists = typescript_1.default.sys.directoryExists;
getDirectories = typescript_1.default.sys.getDirectories;
fileExists = typescript_1.default.sys.fileExists;
readFile = typescript_1.default.sys.readFile;
readDirectory = typescript_1.default.sys.readDirectory;
// this is necessary to make source references work.
realpath = ts.sys.realpath;
realpath = typescript_1.default.sys.realpath;
}
exports.StaticLanguageServiceHost = StaticLanguageServiceHost;
//# sourceMappingURL=staticLanguageServiceHost.js.map