Tracks a focused sub-gap from #66.
Differential behavior
packages/runtime/test/test/js/bun/wasm/wasi.test.js currently reports 1 pass / 1 fail in Home. Executing hello-wasi.wasm exits 0 with empty stdout, while pinned Bun exits 0 and prints hello world\n. The separate WASI preopen security case already passes.
Root cause
Home detects a main .wasm module and stashes its bytes on globalThis.wasmSourceBytes, but returns an empty ESM source. Bun live source returns its embedded src/js/wasi-runner.js, which constructs node:wasi, compiles and instantiates the module, starts it, and exits with the WASI result.
Port
- Own the exact Bun runner as a runtime asset within Home package boundaries.
- Return it as static ESM source for main
.wasmentrypoints. - Preserve existing
.fileloader behavior for imported WebAssembly assets. - Verify the focused WASI corpus test under the memory guard.
A bounded debug build reaches whole-program code generation but is currently stopped by the fixed 3840 MB guard; the ceiling will not be raised.