Upgrade typescript to v5.5 (#16388)

This commit is contained in:
fisker Cheung authored and GitHub committed 2024-06-13 09:13:41 +08:00
1 parent 32c4cd3fdb
commit 3f5a4c9fe5
9 files changed
+1249 -75

No files matched your search

+14
View File
@@ -54,6 +54,20 @@ function getEsbuildOptions({ file, files, shouldCollectLicenses, cliOptions }) {
module: "*",
process: transform,
},
// Transform `require("typescript")` to `import`
{
module: "*",
process(text, file) {
text = text.replaceAll(
/(?:const|let|var) (\w+) = (?:__importStar\(require\("typescript"\)\)|require\("typescript"\));/g,
'import * as $1 from "typescript";',
);
if (/require\(["']typescript["']\)/.test(text)) {
throw new Error(`Unexpected \`require("typescript")\` in ${file}.`);
}
return text;
},
},
// #12493, not sure what the problem is, but replace the cjs version with esm version seems fix it
{
module: require.resolve("tslib"),