From 9bf12651d42b96762ce2e1c3e8219d1d173ac8ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Nov 2026 18:38:41 +0000 Subject: [PATCH 1/3] Bump @bytecodealliance/preview2-shim Bumps [@bytecodealliance/preview2-shim](https://github.com/bytecodealliance/jco) from 0.25.0 to 0.31.0. - [Release notes](https://github.com/bytecodealliance/jco/releases) - [Commits](https://github.com/bytecodealliance/jco/compare/preview2-shim-v0.25.0...preview2-shim-v0.31.0) --- updated-dependencies: - dependency-name: "@bytecodealliance/preview2-shim" dependency-version: 0.30.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/wasm_sandbox/guests/javascript/package-lock.json | 8 ++++---- src/wasm_sandbox/guests/javascript/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/wasm_sandbox/guests/javascript/package-lock.json b/src/wasm_sandbox/guests/javascript/package-lock.json index cad2781..8b68542 100644 --- a/src/wasm_sandbox/guests/javascript/package-lock.json +++ b/src/wasm_sandbox/guests/javascript/package-lock.json @@ -10,7 +10,7 @@ "devDependencies": { "@bytecodealliance/componentize-js": "^0.23.0", "@bytecodealliance/jco": "^1.39.0", - "@bytecodealliance/preview2-shim": "^0.25.0" + "@bytecodealliance/preview2-shim": "^0.31.0" } }, "node_modules/@andreiltd/componentize-qjs-binding-darwin-arm64": { @@ -453,9 +453,9 @@ } }, "node_modules/@bytecodealliance/preview2-shim": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.25.0.tgz", - "integrity": "sha512-6ZSDRJ8hJc/febZepzd68z3KzLcOXyCOKtRm8LB2rgAU88xV7ykq6dMb5I4a+sBh1cuV2Yb1159gDzI1q8UsoQ==", + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.31.0.tgz", + "integrity": "sha512-9Gv4wn/DCz1NOqTZFcPSIko9jsTwmps67QZ6PPytypmmWLSz5AQf3Xn2EjItfudWwSh5d+9EPD3BrNlvqKWNtA==", "dev": true, "license": "(Apache-2.0 WITH LLVM-exception)", "dependencies": { diff --git a/src/wasm_sandbox/guests/javascript/package.json b/src/wasm_sandbox/guests/javascript/package.json index cbb922e..5f8a538 100644 --- a/src/wasm_sandbox/guests/javascript/package.json +++ b/src/wasm_sandbox/guests/javascript/package.json @@ -9,6 +9,6 @@ "devDependencies": { "@bytecodealliance/componentize-js": "^0.23.0", "@bytecodealliance/jco": "^1.39.0", - "@bytecodealliance/preview2-shim": "^0.25.0" + "@bytecodealliance/preview2-shim": "^0.31.0" } } From 7f0e17e506aff76e3256665a28f13b2e5cf79365 Mon Sep 17 00:00:00 2001 From: James Sturtevant Date: Fri, 6 Nov 2026 10:59:06 -0800 Subject: [PATCH 2/3] test: reproduce JavaScript guest build with preview2-shim Signed-off-by: James Sturtevant --- .github/workflows/ci.yml | 2 ++ Justfile | 2 +- src/wasm_sandbox/Justfile | 5 +++++ src/wasm_sandbox/guests/javascript/build.test.js | 15 +++++++++++++++ src/wasm_sandbox/guests/javascript/package.json | 3 ++- 5 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 src/wasm_sandbox/guests/javascript/build.test.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb637bf..3ba139e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,6 +63,8 @@ jobs: key: guest-bundle-${{ steps.guest-keys.outputs.guest-key }} - name: Install clang run: sudo apt-get update && sudo apt-get install -y clang + - name: Test JavaScript guest build + run: just wasm js-guest-test - name: Build guests run: just wasm guest-bundle - name: Upload guest bundle diff --git a/Justfile b/Justfile index 9e3280a..6d87c5a 100644 --- a/Justfile +++ b/Justfile @@ -32,7 +32,7 @@ fmt-check-rust: #### TESTS #### -test: wasm::test-build wasm::guest-build wasm::js-guest-build python::build python::python-test test-rust wasm::test dotnet::test-rust dotnet::test +test: wasm::test-build wasm::js-guest-test wasm::guest-build wasm::js-guest-build python::build python::python-test test-rust wasm::test dotnet::test-rust dotnet::test fuzz seconds="60": (python::python-fuzz seconds) diff --git a/src/wasm_sandbox/Justfile b/src/wasm_sandbox/Justfile index 789dc77..fbe4891 100644 --- a/src/wasm_sandbox/Justfile +++ b/src/wasm_sandbox/Justfile @@ -101,6 +101,11 @@ js-guest-build: js-guest-build-wasm js-guest-build-aot js-guest-install: uv run --no-project --python 3.14 python {{repo-root}}/scripts/guest_build.py javascript +# Test componentization against the installed JavaScript dependencies. +js-guest-test: + cd {{repo-root}}/src/wasm_sandbox/guests/javascript && npm ci + cd {{repo-root}}/src/wasm_sandbox/guests/javascript && npm test + build target=default-target: _clean-stale-wasm (guest-build target) (js-guest-build) cargo build --manifest-path {{repo-root}}/src/wasm_sandbox/Cargo.toml --profile={{ if target == "debug" {"dev"} else { target } }} diff --git a/src/wasm_sandbox/guests/javascript/build.test.js b/src/wasm_sandbox/guests/javascript/build.test.js new file mode 100644 index 0000000..d70cf33 --- /dev/null +++ b/src/wasm_sandbox/guests/javascript/build.test.js @@ -0,0 +1,15 @@ +import assert from "node:assert/strict"; +import { execFile } from "node:child_process"; +import { readFile } from "node:fs/promises"; +import { promisify } from "node:util"; +import { test } from "node:test"; + +test("builds the JavaScript component with the installed WASI shim", async () => { + const cwd = new URL(".", import.meta.url); + await promisify(execFile)(process.execPath, ["build.js"], { + cwd, + timeout: 120_000, + }); + const component = await readFile(new URL("js-sandbox.wasm", cwd)); + assert.deepEqual(component.subarray(0, 8), Buffer.from([0, 97, 115, 109, 13, 0, 1, 0])); +}); diff --git a/src/wasm_sandbox/guests/javascript/package.json b/src/wasm_sandbox/guests/javascript/package.json index 5f8a538..d71e641 100644 --- a/src/wasm_sandbox/guests/javascript/package.json +++ b/src/wasm_sandbox/guests/javascript/package.json @@ -4,7 +4,8 @@ "private": true, "type": "module", "scripts": { - "build": "node build.js" + "build": "node build.js", + "test": "node --test build.test.js" }, "devDependencies": { "@bytecodealliance/componentize-js": "^0.23.0", From b73f5653b2d263360213c7c362fea921750773ad Mon Sep 17 00:00:00 2001 From: James Sturtevant Date: Fri, 6 Nov 2026 11:00:47 -0800 Subject: [PATCH 3/3] fix: pass WIT text to the JavaScript componentizer Read the shared WIT with Node instead of relying on the preview2-shim filesystem preopens, which are empty in 0.31.0. Signed-off-by: James Sturtevant --- src/wasm_sandbox/guests/javascript/build.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wasm_sandbox/guests/javascript/build.js b/src/wasm_sandbox/guests/javascript/build.js index 2293510..79ead71 100644 --- a/src/wasm_sandbox/guests/javascript/build.js +++ b/src/wasm_sandbox/guests/javascript/build.js @@ -32,10 +32,11 @@ const outputPath = "js-sandbox.wasm"; async function build() { console.log("Reading source..."); const source = await readFile(sourcePath, "utf-8"); + const witWorld = await readFile(witPath, "utf-8"); console.log("Componentizing..."); const { component, imports } = await componentize(source, { - witPath, + witWorld, worldName: "hyperlight:sandbox/sandbox", });