diff options
author | 2022-10-07 19:44:41 +0200 | |
---|---|---|
committer | 2022-11-05 19:41:14 +0100 | |
commit | abe176d0888c0fdcc803ddafe71a5cee9f4b63a0 (patch) | |
tree | ea7d5722c8e981ba540e648fbacbfd0e4a55768a /.yarn/sdks/typescript/lib/tsserverlibrary.js | |
parent | fix: test and lint failures (diff) | |
download | refinery-abe176d0888c0fdcc803ddafe71a5cee9f4b63a0.tar.gz refinery-abe176d0888c0fdcc803ddafe71a5cee9f4b63a0.tar.zst refinery-abe176d0888c0fdcc803ddafe71a5cee9f4b63a0.zip |
refactor(frontend): improve HMR experience
Use a HMR acceptor as in
https://github.com/vitejs/vite/issues/10227#issuecomment-1256969751
Also updates frontend tooling to the latest version
(yarn now support typescript 4.8.4)
Diffstat (limited to '.yarn/sdks/typescript/lib/tsserverlibrary.js')
-rw-r--r-- | .yarn/sdks/typescript/lib/tsserverlibrary.js | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/.yarn/sdks/typescript/lib/tsserverlibrary.js b/.yarn/sdks/typescript/lib/tsserverlibrary.js index 0d70146a..e7033a81 100644 --- a/.yarn/sdks/typescript/lib/tsserverlibrary.js +++ b/.yarn/sdks/typescript/lib/tsserverlibrary.js | |||
@@ -1,13 +1,13 @@ | |||
1 | #!/usr/bin/env node | 1 | #!/usr/bin/env node |
2 | 2 | ||
3 | const {existsSync} = require(`fs`); | 3 | const {existsSync} = require(`fs`); |
4 | const {createRequire, createRequireFromPath} = require(`module`); | 4 | const {createRequire} = require(`module`); |
5 | const {resolve} = require(`path`); | 5 | const {resolve} = require(`path`); |
6 | 6 | ||
7 | const relPnpApiPath = "../../../../.pnp.cjs"; | 7 | const relPnpApiPath = "../../../../.pnp.cjs"; |
8 | 8 | ||
9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); |
10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); | 10 | const absRequire = createRequire(absPnpApiPath); |
11 | 11 | ||
12 | const moduleWrapper = tsserver => { | 12 | const moduleWrapper = tsserver => { |
13 | if (!process.versions.pnp) { | 13 | if (!process.versions.pnp) { |
@@ -61,14 +61,30 @@ const moduleWrapper = tsserver => { | |||
61 | // | 61 | // |
62 | // Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910 | 62 | // Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910 |
63 | // | 63 | // |
64 | // Update Oct 8 2021: VSCode changed their format in 1.61. | 64 | // 2021-10-08: VSCode changed the format in 1.61. |
65 | // Before | ^zip:/c:/foo/bar.zip/package.json | 65 | // Before | ^zip:/c:/foo/bar.zip/package.json |
66 | // After | ^/zip//c:/foo/bar.zip/package.json | 66 | // After | ^/zip//c:/foo/bar.zip/package.json |
67 | // | 67 | // |
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 | // | ||
68 | case `vscode <1.61`: { | 76 | case `vscode <1.61`: { |
69 | str = `^zip:${str}`; | 77 | str = `^zip:${str}`; |
70 | } break; | 78 | } break; |
71 | 79 | ||
80 | case `vscode <1.66`: { | ||
81 | str = `^/zip/${str}`; | ||
82 | } break; | ||
83 | |||
84 | case `vscode <1.68`: { | ||
85 | str = `^/zip${str}`; | ||
86 | } break; | ||
87 | |||
72 | case `vscode`: { | 88 | case `vscode`: { |
73 | str = `^/zip/${str}`; | 89 | str = `^/zip/${str}`; |
74 | } break; | 90 | } break; |
@@ -119,9 +135,7 @@ const moduleWrapper = tsserver => { | |||
119 | 135 | ||
120 | case `vscode`: | 136 | case `vscode`: |
121 | default: { | 137 | default: { |
122 | return process.platform === `win32` | 138 | return str.replace(/^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, process.platform === `win32` ? `` : `/`) |
123 | ? str.replace(/^\^?(zip:|\/zip)\/+/, ``) | ||
124 | : str.replace(/^\^?(zip:|\/zip)\/+/, `/`); | ||
125 | } break; | 139 | } break; |
126 | } | 140 | } |
127 | } | 141 | } |
@@ -160,8 +174,21 @@ const moduleWrapper = tsserver => { | |||
160 | typeof parsedMessage.arguments.hostInfo === `string` | 174 | typeof parsedMessage.arguments.hostInfo === `string` |
161 | ) { | 175 | ) { |
162 | hostInfo = parsedMessage.arguments.hostInfo; | 176 | 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)\./)) { | 177 | if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) { |
164 | hostInfo += ` <1.61`; | 178 | const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match( |
179 | // The RegExp from https://semver.org/ but without the caret at the start | ||
180 | /(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-]+)*))?$/ | ||
181 | ) ?? []).map(Number) | ||
182 | |||
183 | if (major === 1) { | ||
184 | if (minor < 61) { | ||
185 | hostInfo += ` <1.61`; | ||
186 | } else if (minor < 66) { | ||
187 | hostInfo += ` <1.66`; | ||
188 | } else if (minor < 68) { | ||
189 | hostInfo += ` <1.68`; | ||
190 | } | ||
191 | } | ||
165 | } | 192 | } |
166 | } | 193 | } |
167 | 194 | ||