Skip to content

Commit cdb0f4e

Browse files
committed
Support resolving links to WebAssembly namespace
Resolves #28
1 parent 4b58c62 commit cdb0f4e

10 files changed

Lines changed: 314 additions & 23 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
node: ["18", "20", "22"]
14+
node: ["20", "22", "24"]
1515
name: Node ${{ matrix.node }}
1616
steps:
1717
- name: Checkout repository

‎.github/workflows/generateWebApiIndex.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ jobs:
1818
- name: Setup Node
1919
uses: actions/setup-node@v4
2020
with:
21-
node-version: "20"
21+
node-version: "22"
2222
- name: Install pnpm
2323
run: npm install -g pnpm@10
2424
- name: Install
2525
run: pnpm install
2626
- name: Update @mdn/browser-compat-data
27-
run: pnpm update @mdn/browser-compat-data@6.x.x
27+
run: pnpm update @mdn/browser-compat-data@7.x.x
2828
- name: Execute Generation Script
2929
run: |
3030
pnpm generateWebApiIndex

‎.github/workflows/publish.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
if: steps.check.outputs.changed == 'true'
3030
uses: actions/setup-node@v4
3131
with:
32-
node-version: "20"
32+
node-version: "22"
3333
- name: Upgrade npm # Hack to deal with needing a new version for OIDC
3434
if: steps.check.outputs.changed == 'true'
3535
run: npm install -g npm@11

‎CHANGELOG.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
- Updated MDN API index with @mdn/browser-compat-data version 7.2.4
6+
- Support links to the WebAssembly namespace, #28
7+
38
## v5.0.10 (2025-10-11)
49

510
- No behavior changes, migrated release workflow to use trusted publishing.

‎data/web-api.json‎

Lines changed: 268 additions & 11 deletions
Large diffs are not rendered by default.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "module",
66
"license": "MIT",
77
"devDependencies": {
8-
"@mdn/browser-compat-data": "^6.1.5",
8+
"@mdn/browser-compat-data": "7.x.x",
99
"@types/node": "^22.16.0",
1010
"@webgpu/types": "^0.1.63",
1111
"dprint": "^0.49.1",

‎pnpm-lock.yaml‎

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎scripts/generateWebApiIndex.js‎

100644100755
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#!/usr/bin/env node
12
// @ts-check
2-
import bcd from "@mdn/browser-compat-data/forLegacyNode";
3+
import bcd from "@mdn/browser-compat-data" with { type: "json" };
34
import { writeFileSync } from "node:fs";
45
import { join, resolve } from "node:path";
56
import { fileURLToPath } from "node:url";
@@ -65,6 +66,7 @@ for (const key in bcd.api) {
6566
for (const key in bcd.javascript.builtins) {
6667
addResults(results, key, bcd.javascript.builtins[key]);
6768
}
69+
addResults(results, "WebAssembly", bcd.webassembly.api);
6870

6971
console.log("There are", Object.keys(results).length, "root entries.");
7072
writeFileSync(

‎src/test/plugin.test.ts‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ describe("Statically defined names", () => {
197197
expect(ref.externalUrl).toBeUndefined();
198198
});
199199

200-
test("Handles links to Iterator types", () => {
200+
test("Handles links to Iterator types #22", () => {
201201
const refl = project.getChildByName("GH22");
202202
expect(refl).toBeInstanceOf(DeclarationReflection);
203203
const tags = (
@@ -226,4 +226,25 @@ describe("Statically defined names", () => {
226226
},
227227
]);
228228
});
229+
230+
test("Handles links to WebAssembly types #28", () => {
231+
const refl = project.getChildByName("GH28");
232+
expect(refl).toBeInstanceOf(DeclarationReflection);
233+
const tags = (
234+
refl?.comment?.summary.filter(
235+
(f) => f.kind === "inline-tag",
236+
) as InlineTagDisplayPart[]
237+
).map((part) => ({ target: part.target, text: part.text }));
238+
239+
expect(tags).toEqual([
240+
{
241+
target: "https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/instantiateStreaming_static",
242+
text: "stream",
243+
},
244+
{
245+
target: "https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Module",
246+
text: "Module",
247+
},
248+
]);
249+
});
229250
});

‎src/testdata/links.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,9 @@ export const commentTsResolution = true;
4747
* {@link Object.entries | entries}
4848
*/
4949
export const GH22 = 1;
50+
51+
/**
52+
* {@link WebAssembly.instantiateStreaming | stream}
53+
* {@link WebAssembly.Module | Module}
54+
*/
55+
export const GH28 = 1

0 commit comments

Comments
 (0)