Skip to content

Commit 1172282

Browse files
committed
fix: extension fails to load with node 24
fixes #77 Signed-off-by: Gordon Smith <[email protected]>
1 parent c90a537 commit 1172282

File tree

5 files changed

+58
-203
lines changed

5 files changed

+58
-203
lines changed

.github/workflows/ci.yml

Lines changed: 56 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,62 +7,68 @@ on:
77
branches: [main]
88

99
jobs:
10-
build:
11-
runs-on: ubuntu-latest
12-
permissions:
13-
contents: read
14-
issues: write
15-
pull-requests: write
16-
steps:
17-
- uses: actions/checkout@v4
1810

19-
- uses: actions/setup-node@v3
20-
with:
21-
node-version: "22"
11+
build:
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
16+
node-version: [20, 22, 24]
17+
runs-on: ${{ matrix.os }}
18+
permissions:
19+
contents: read
20+
issues: write
21+
pull-requests: write
22+
steps:
23+
- uses: actions/checkout@v4
2224

23-
- name: Install dependencies
24-
run: npm ci
25+
- uses: actions/setup-node@v3
26+
with:
27+
node-version: ${{ matrix.node-version }}
2528

26-
- name: Run tests
27-
run: npm test
29+
- name: Install dependencies
30+
run: npm ci
2831

29-
- name: Update snapshot
30-
run: npm run update-snapshot && git add --all
32+
- name: Run tests
33+
run: npm test
3134

32-
- name: Prepare diff for comment
33-
id: diff
34-
continue-on-error: true
35-
run: |
36-
set +e
37-
body=$(git diff --exit-code --diff-filter=AM $GITHUB_SHA -- '*.snap' 2>&1)
38-
echo "exitcode=$?" >> $GITHUB_OUTPUT
39-
body="${body//'<'/'&lt;'}"
40-
body="${body//'>'/'&gt;'}"
41-
delimiter="$(openssl rand -hex 8)"
42-
echo "body<<${delimiter}" >> $GITHUB_OUTPUT
43-
echo "${body:0:64000}" >> $GITHUB_OUTPUT
44-
echo "${delimiter}" >> $GITHUB_OUTPUT
35+
- name: Update snapshot
36+
run: npm run update-snapshot && git add --all
4537

46-
- uses: marocchino/sticky-pull-request-comment@v2
47-
if: github.event_name == 'pull_request' && steps.diff.outputs.exitcode == '1'
48-
with:
49-
header: sticky-comment-for-git-diff
50-
hide_and_recreate: true
51-
hide_classify: "OUTDATED"
52-
message: |
53-
**Found changes in the snapshot tests. Please review.**
54-
<details>
55-
<summary>Diff 📖</summary>
38+
- name: Prepare diff for comment
39+
id: diff
40+
continue-on-error: true
41+
run: |
42+
set +e
43+
body=$(git diff --exit-code --diff-filter=AM $GITHUB_SHA -- '*.snap' 2>&1)
44+
echo "exitcode=$?" >> $GITHUB_OUTPUT
45+
body="${body//'<'/'&lt;'}"
46+
body="${body//'>'/'&gt;'}"
47+
delimiter="$(openssl rand -hex 8)"
48+
echo "body<<${delimiter}" >> $GITHUB_OUTPUT
49+
echo "${body:0:64000}" >> $GITHUB_OUTPUT
50+
echo "${delimiter}" >> $GITHUB_OUTPUT
5651
57-
<pre lang="diff"><code>
58-
${{ steps.diff.outputs.body }}
59-
</code></pre>
52+
- uses: marocchino/sticky-pull-request-comment@v2
53+
if: github.event_name == 'pull_request' && steps.diff.outputs.exitcode == '1'
54+
with:
55+
header: sticky-comment-for-git-diff
56+
hide_and_recreate: true
57+
hide_classify: "OUTDATED"
58+
message: |
59+
**Found changes in the snapshot tests. Please review.**
60+
<details>
61+
<summary>Diff 📖</summary>
6062
61-
</details>
63+
<pre lang="diff"><code>
64+
${{ steps.diff.outputs.body }}
65+
</code></pre>
6266
63-
- uses: marocchino/sticky-pull-request-comment@v2
64-
if: github.event_name == 'pull_request' && steps.diff.outputs.exitcode == '0'
65-
with:
66-
header: sticky-comment-for-git-diff
67-
hide: true
68-
hide_classify: "OUTDATED"
67+
</details>
68+
69+
- uses: marocchino/sticky-pull-request-comment@v2
70+
if: github.event_name == 'pull_request' && steps.diff.outputs.exitcode == '0'
71+
with:
72+
header: sticky-comment-for-git-diff
73+
hide: true
74+
hide_classify: "OUTDATED"

esbuild.mjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,6 @@ async function discoverEntryPoints() {
655655
external: ["vscode"],
656656
write: false, // Don't write to disk
657657
logLevel: "silent",
658-
inject: ["src/node-polyfills.js"],
659658
});
660659

661660
if (tempResult.outputFiles && tempResult.outputFiles.length > 0) {
@@ -721,7 +720,6 @@ async function main() {
721720
external: ["vscode"],
722721
logLevel: "silent",
723722
plugins: [resourceDiscoveryPlugin, wasmDiscoveryPlugin],
724-
inject: ["src/node-polyfills.js"],
725723
define: {
726724
// Define globals to prevent bundling issues
727725
"process.env.NODE_ENV": JSON.stringify(production ? "production" : "development"),

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"clean-full": "npm run clean-all && npm run clean-deps",
2929
"setup-wasm": "./scripts/setup-wasm.sh",
3030
"install-extension": "npm run package && code --install-extension wit-idl.vsix",
31-
"update-snapshot": "vscode-tmgrammar-snap --updateSnapshot --scope 'source.wit' 'tests/grammar/integration/*'",
32-
"test-grammar": "vscode-tmgrammar-test -c --grammar syntaxes/wit.tmLanguage.json 'tests/grammar/unit/*'",
31+
"update-snapshot": "vscode-tmgrammar-snap --updateSnapshot --scope \"source.wit\" \"tests/grammar/integration/*\"",
32+
"test-grammar": "vscode-tmgrammar-test -c --grammar syntaxes/wit.tmLanguage.json \"tests/grammar/unit/*\"",
3333
"test-unit": "vitest run",
3434
"test-unit-watch": "vitest",
3535
"test-unit-ui": "vitest --ui",

src/node-polyfills.js

Lines changed: 0 additions & 62 deletions
This file was deleted.

tests/navigator-polyfill.test.ts

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)