Skip to content

Commit 3a19309

Browse files
committed
feat: implement hermetic Node.js toolchain for documentation builds
- Apply same hermetic approach used for JavaScript components to documentation site - Replace genrule shell scripts with proper Bazel rule using jco_toolchain - Create docs_build.bzl with hermetic Node.js and npm access via jco_toolchain - Update docs-site/BUILD.bazel to use toolchain-based approach instead of system dependencies - Maintain fallback placeholder site for environments without Node.js toolchain - Follow Bazel Way principles: toolchains over system tools, rules over genrules - Fix C++ component compilation issues (file copying and clang vs clang++ usage) - Add Node.js v18.19.0 to checksum registry with SHA256 verification for all platforms - Update jco toolchain to provide proper Node.js and npm binary access - Apply pre-commit formatting fixes across codebase (buildifier, rustfmt, clippy, markdown)
1 parent 7bf891d commit 3a19309

30 files changed

+500
-211
lines changed

MODULE.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ register_toolchains("@go_toolchains//:all")
7171
# WASI WIT interface definitions
7272
wasi_wit_ext = use_extension("//wasm:extensions.bzl", "wasi_wit")
7373
wasi_wit_ext.init()
74-
use_repo(wasi_wit_ext, "wasi_io", "wasi_cli", "wasi_clocks", "wasi_filesystem", "wasi_sockets", "wasi_random", "wasi_http", "wasi_io_v020", "wasi_cli_v020", "wasi_clocks_v020") # Complete WASI ecosystem (0.2.3 + 0.2.0)
74+
use_repo(wasi_wit_ext, "wasi_cli", "wasi_cli_v020", "wasi_clocks", "wasi_clocks_v020", "wasi_filesystem", "wasi_http", "wasi_io", "wasi_io_v020", "wasi_random", "wasi_sockets") # Complete WASI ecosystem (0.2.3 + 0.2.0)
7575

7676
# WebAssembly toolchains
7777
wasm_toolchain = use_extension("//wasm:extensions.bzl", "wasm_toolchain")
@@ -165,8 +165,8 @@ use_repo(node, "nodejs_toolchains")
165165
jco = use_extension("//wasm:extensions.bzl", "jco")
166166
jco.register(
167167
name = "jco",
168-
version = "1.4.0",
169168
node_version = "18.19.0",
169+
version = "1.4.0",
170170
)
171171
use_repo(jco, "jco_toolchain")
172172

MODULE.bazel.lock

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

checksums/registry.bzl

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,68 @@ def _get_fallback_checksums(tool_name):
277277
},
278278
},
279279
},
280+
"nodejs": {
281+
"tool_name": "nodejs",
282+
"github_repo": "nodejs/node",
283+
"latest_version": "18.19.0",
284+
"build_type": "download",
285+
"versions": {
286+
"18.19.0": {
287+
"release_date": "2024-01-09",
288+
"platforms": {
289+
"darwin_amd64": {
290+
"sha256": "0a749fcdf5d6bf46e1c17b3ea01e050b4d1ec3f3073b14aa745527b45a759c74",
291+
"url_suffix": "darwin-x64.tar.gz",
292+
"binary_path": "node-v{}-darwin-x64/bin/node",
293+
"npm_path": "node-v{}-darwin-x64/bin/npm",
294+
},
295+
"darwin_arm64": {
296+
"sha256": "8907c42a968765b77730fb319458d63ec4ed009265f8012097c3a052407aa99b",
297+
"url_suffix": "darwin-arm64.tar.gz",
298+
"binary_path": "node-v{}-darwin-arm64/bin/node",
299+
"npm_path": "node-v{}-darwin-arm64/bin/npm",
300+
},
301+
"linux_amd64": {
302+
"sha256": "61632bb78ee828d6e8f42adc0bc2238a6b8200007093988d3927176a372281e8",
303+
"url_suffix": "linux-x64.tar.xz",
304+
"binary_path": "node-v{}-linux-x64/bin/node",
305+
"npm_path": "node-v{}-linux-x64/bin/npm",
306+
},
307+
"linux_arm64": {
308+
"sha256": "cf94ab72e45b855257545fec1c017bdf30a9e23611561382eaf64576b999e72d",
309+
"url_suffix": "linux-arm64.tar.xz",
310+
"binary_path": "node-v{}-linux-arm64/bin/node",
311+
"npm_path": "node-v{}-linux-arm64/bin/npm",
312+
},
313+
"windows_amd64": {
314+
"sha256": "5311913d45e1fcc3643c58d1e3926eb85437b180f025fe5857413c9f02403645",
315+
"url_suffix": "win-x64.zip",
316+
"binary_path": "node-v{}-win-x64/node.exe",
317+
"npm_path": "node-v{}-win-x64/npm.cmd",
318+
},
319+
},
320+
},
321+
},
322+
},
323+
"jco": {
324+
"tool_name": "jco",
325+
"github_repo": "bytecodealliance/jco",
326+
"latest_version": "1.4.0",
327+
"build_type": "npm_with_nodejs",
328+
"requires": ["nodejs"],
329+
"versions": {
330+
"1.4.0": {
331+
"release_date": "2024-11-25",
332+
"platforms": {
333+
"universal": {
334+
"npm_package": "@bytecodealliance/jco",
335+
"npm_version": "1.4.0",
336+
"dependencies": ["@bytecodealliance/componentize-js"],
337+
},
338+
},
339+
},
340+
},
341+
},
280342
}
281343

282344
return fallback_data.get(tool_name, {})
@@ -431,6 +493,8 @@ def list_available_tools():
431493
"wasmtime",
432494
"wasi-sdk",
433495
"wasmsign2",
496+
"nodejs",
497+
"jco",
434498
]
435499

436500
def validate_tool_compatibility(tools_config):
@@ -493,13 +557,17 @@ def get_recommended_versions(stability = "stable"):
493557
"wit-bindgen": "0.43.0",
494558
"wkg": "0.11.0",
495559
"wasmsign2": "0.2.6",
560+
"nodejs": "18.19.0",
561+
"jco": "1.4.0",
496562
},
497563
"latest": {
498564
"wasm-tools": "1.235.0",
499565
"wac": "0.7.0",
500566
"wit-bindgen": "0.43.0",
501567
"wkg": "0.11.0",
502568
"wasmsign2": "0.2.6",
569+
"nodejs": "18.19.0",
570+
"jco": "1.4.0",
503571
},
504572
}
505573

checksums/tools/jco.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22
"tool_name": "jco",
33
"github_repo": "bytecodealliance/jco",
44
"latest_version": "1.4.0",
5-
"last_checked": "2025-01-02T10:30:00Z",
6-
"note": "JCO is installed via npm - checksums are for npm package verification",
7-
"install_method": "npm",
5+
"last_checked": "2025-08-17T10:30:00Z",
6+
"note": "JCO is installed via hermetic Node.js + npm",
7+
"install_method": "download_nodejs_then_npm",
8+
"requires": ["nodejs"],
89
"versions": {
910
"1.4.0": {
1011
"release_date": "2024-11-25",
1112
"platforms": {
1213
"universal": {
13-
"sha256": "PLACEHOLDER_NEEDS_REAL_CHECKSUM_64_CHARS_XXXXXXXXXXXXXXXX",
1414
"npm_package": "@bytecodealliance/jco",
15-
"npm_version": "1.4.0"
15+
"npm_version": "1.4.0",
16+
"dependencies": [
17+
"@bytecodealliance/componentize-js"
18+
]
1619
}
1720
}
1821
}

checksums/tools/nodejs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@
4141
}
4242
}
4343
}
44-
}
44+
}

0 commit comments

Comments
 (0)