Skip to content

Commit eebedc2

Browse files
authored
[chore] Update TypeScript to 5.0.4, fix breakage (#1386)
Summary: Does the following: - Updates esbuild and Webpack to versions that support TypeScript 5.x. - Re-runs `yarn dlx @yarnpkg/sdks` so that VS Code can still resolve dependencies normally. - Bumps required Node version to LTS 18.16.0, to fix Jest hanging. Type of change: /kind cleanup Test Plan: Run `yarn lint`, `yarn test`, `yarn run build_prod`, and `yarn dev`. All should still function normally, though a hair faster. --------- Signed-off-by: Nick Lanam <nlanam@pixielabs.ai>
1 parent e4917a6 commit eebedc2

File tree

13 files changed

+628
-646
lines changed

13 files changed

+628
-646
lines changed

src/ui/.yarn/sdks/eslint/bin/eslint.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire, createRequireFromPath} = require(`module`);
4+
const {createRequire} = require(`module`);
55
const {resolve} = require(`path`);
66

77
const relPnpApiPath = "../../../../.pnp.cjs";
88

99
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10-
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
10+
const absRequire = createRequire(absPnpApiPath);
1111

1212
if (existsSync(absPnpApiPath)) {
1313
if (!process.versions.pnp) {

src/ui/.yarn/sdks/eslint/lib/api.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire, createRequireFromPath} = require(`module`);
4+
const {createRequire} = require(`module`);
55
const {resolve} = require(`path`);
66

77
const relPnpApiPath = "../../../../.pnp.cjs";
88

99
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10-
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
10+
const absRequire = createRequire(absPnpApiPath);
1111

1212
if (existsSync(absPnpApiPath)) {
1313
if (!process.versions.pnp) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint",
3-
"version": "8.6.0-sdk",
3+
"version": "8.41.0-sdk",
44
"main": "./lib/api.js",
55
"type": "commonjs"
66
}

src/ui/.yarn/sdks/prettier/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire, createRequireFromPath} = require(`module`);
4+
const {createRequire} = require(`module`);
55
const {resolve} = require(`path`);
66

77
const relPnpApiPath = "../../../.pnp.cjs";
88

99
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10-
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
10+
const absRequire = createRequire(absPnpApiPath);
1111

1212
if (existsSync(absPnpApiPath)) {
1313
if (!process.versions.pnp) {

src/ui/.yarn/sdks/typescript/bin/tsc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire, createRequireFromPath} = require(`module`);
4+
const {createRequire} = require(`module`);
55
const {resolve} = require(`path`);
66

77
const relPnpApiPath = "../../../../.pnp.cjs";
88

99
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10-
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
10+
const absRequire = createRequire(absPnpApiPath);
1111

1212
if (existsSync(absPnpApiPath)) {
1313
if (!process.versions.pnp) {

src/ui/.yarn/sdks/typescript/bin/tsserver

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire, createRequireFromPath} = require(`module`);
4+
const {createRequire} = require(`module`);
55
const {resolve} = require(`path`);
66

77
const relPnpApiPath = "../../../../.pnp.cjs";
88

99
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10-
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
10+
const absRequire = createRequire(absPnpApiPath);
1111

1212
if (existsSync(absPnpApiPath)) {
1313
if (!process.versions.pnp) {

src/ui/.yarn/sdks/typescript/lib/tsc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire, createRequireFromPath} = require(`module`);
4+
const {createRequire} = require(`module`);
55
const {resolve} = require(`path`);
66

77
const relPnpApiPath = "../../../../.pnp.cjs";
88

99
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10-
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
10+
const absRequire = createRequire(absPnpApiPath);
1111

1212
if (existsSync(absPnpApiPath)) {
1313
if (!process.versions.pnp) {

src/ui/.yarn/sdks/typescript/lib/tsserver.js

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire, createRequireFromPath} = require(`module`);
4+
const {createRequire} = require(`module`);
55
const {resolve} = require(`path`);
66

77
const relPnpApiPath = "../../../../.pnp.cjs";
88

99
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10-
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
10+
const absRequire = createRequire(absPnpApiPath);
1111

1212
const moduleWrapper = tsserver => {
1313
if (!process.versions.pnp) {
@@ -61,14 +61,30 @@ const moduleWrapper = tsserver => {
6161
//
6262
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
6363
//
64-
// Update Oct 8 2021: VSCode changed their format in 1.61.
64+
// 2021-10-08: VSCode changed the format in 1.61.
6565
// Before | ^zip:/c:/foo/bar.zip/package.json
6666
// After | ^/zip//c:/foo/bar.zip/package.json
6767
//
68+
// 2022-04-06: VSCode changed the format in 1.66.
69+
// Before | ^/zip//c:/foo/bar.zip/package.json
70+
// After | ^/zip/c:/foo/bar.zip/package.json
71+
//
72+
// 2022-05-06: VSCode changed the format in 1.68
73+
// Before | ^/zip/c:/foo/bar.zip/package.json
74+
// After | ^/zip//c:/foo/bar.zip/package.json
75+
//
6876
case `vscode <1.61`: {
6977
str = `^zip:${str}`;
7078
} break;
7179

80+
case `vscode <1.66`: {
81+
str = `^/zip/${str}`;
82+
} break;
83+
84+
case `vscode <1.68`: {
85+
str = `^/zip${str}`;
86+
} break;
87+
7288
case `vscode`: {
7389
str = `^/zip/${str}`;
7490
} break;
@@ -93,6 +109,8 @@ const moduleWrapper = tsserver => {
93109
str = `zip:${str}`;
94110
} break;
95111
}
112+
} else {
113+
str = str.replace(/^\/?/, process.platform === `win32` ? `` : `/`);
96114
}
97115
}
98116

@@ -119,9 +137,7 @@ const moduleWrapper = tsserver => {
119137

120138
case `vscode`:
121139
default: {
122-
return process.platform === `win32`
123-
? str.replace(/^\^?(zip:|\/zip)\/+/, ``)
124-
: str.replace(/^\^?(zip:|\/zip)\/+/, `/`);
140+
return str.replace(/^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, process.platform === `win32` ? `` : `/`)
125141
} break;
126142
}
127143
}
@@ -160,8 +176,21 @@ const moduleWrapper = tsserver => {
160176
typeof parsedMessage.arguments.hostInfo === `string`
161177
) {
162178
hostInfo = parsedMessage.arguments.hostInfo;
163-
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK && process.env.VSCODE_IPC_HOOK.match(/Code\/1\.([1-5][0-9]|60)\./)) {
164-
hostInfo += ` <1.61`;
179+
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) {
180+
const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match(
181+
// The RegExp from https://semver.org/ but without the caret at the start
182+
/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
183+
) ?? []).map(Number)
184+
185+
if (major === 1) {
186+
if (minor < 61) {
187+
hostInfo += ` <1.61`;
188+
} else if (minor < 66) {
189+
hostInfo += ` <1.66`;
190+
} else if (minor < 68) {
191+
hostInfo += ` <1.68`;
192+
}
193+
}
165194
}
166195
}
167196

src/ui/.yarn/sdks/typescript/lib/tsserverlibrary.js

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire, createRequireFromPath} = require(`module`);
4+
const {createRequire} = require(`module`);
55
const {resolve} = require(`path`);
66

77
const relPnpApiPath = "../../../../.pnp.cjs";
88

99
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10-
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
10+
const absRequire = createRequire(absPnpApiPath);
1111

1212
const moduleWrapper = tsserver => {
1313
if (!process.versions.pnp) {
@@ -61,14 +61,30 @@ const moduleWrapper = tsserver => {
6161
//
6262
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
6363
//
64-
// Update Oct 8 2021: VSCode changed their format in 1.61.
64+
// 2021-10-08: VSCode changed the format in 1.61.
6565
// Before | ^zip:/c:/foo/bar.zip/package.json
6666
// After | ^/zip//c:/foo/bar.zip/package.json
6767
//
68+
// 2022-04-06: VSCode changed the format in 1.66.
69+
// Before | ^/zip//c:/foo/bar.zip/package.json
70+
// After | ^/zip/c:/foo/bar.zip/package.json
71+
//
72+
// 2022-05-06: VSCode changed the format in 1.68
73+
// Before | ^/zip/c:/foo/bar.zip/package.json
74+
// After | ^/zip//c:/foo/bar.zip/package.json
75+
//
6876
case `vscode <1.61`: {
6977
str = `^zip:${str}`;
7078
} break;
7179

80+
case `vscode <1.66`: {
81+
str = `^/zip/${str}`;
82+
} break;
83+
84+
case `vscode <1.68`: {
85+
str = `^/zip${str}`;
86+
} break;
87+
7288
case `vscode`: {
7389
str = `^/zip/${str}`;
7490
} break;
@@ -93,6 +109,8 @@ const moduleWrapper = tsserver => {
93109
str = `zip:${str}`;
94110
} break;
95111
}
112+
} else {
113+
str = str.replace(/^\/?/, process.platform === `win32` ? `` : `/`);
96114
}
97115
}
98116

@@ -119,9 +137,7 @@ const moduleWrapper = tsserver => {
119137

120138
case `vscode`:
121139
default: {
122-
return process.platform === `win32`
123-
? str.replace(/^\^?(zip:|\/zip)\/+/, ``)
124-
: str.replace(/^\^?(zip:|\/zip)\/+/, `/`);
140+
return str.replace(/^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, process.platform === `win32` ? `` : `/`)
125141
} break;
126142
}
127143
}
@@ -160,8 +176,21 @@ const moduleWrapper = tsserver => {
160176
typeof parsedMessage.arguments.hostInfo === `string`
161177
) {
162178
hostInfo = parsedMessage.arguments.hostInfo;
163-
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK && process.env.VSCODE_IPC_HOOK.match(/Code\/1\.([1-5][0-9]|60)\./)) {
164-
hostInfo += ` <1.61`;
179+
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) {
180+
const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match(
181+
// The RegExp from https://semver.org/ but without the caret at the start
182+
/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
183+
) ?? []).map(Number)
184+
185+
if (major === 1) {
186+
if (minor < 61) {
187+
hostInfo += ` <1.61`;
188+
} else if (minor < 66) {
189+
hostInfo += ` <1.66`;
190+
} else if (minor < 68) {
191+
hostInfo += ` <1.68`;
192+
}
193+
}
165194
}
166195
}
167196

src/ui/.yarn/sdks/typescript/lib/typescript.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire, createRequireFromPath} = require(`module`);
4+
const {createRequire} = require(`module`);
55
const {resolve} = require(`path`);
66

77
const relPnpApiPath = "../../../../.pnp.cjs";
88

99
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10-
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
10+
const absRequire = createRequire(absPnpApiPath);
1111

1212
if (existsSync(absPnpApiPath)) {
1313
if (!process.versions.pnp) {

0 commit comments

Comments
 (0)