Throwaway prototypes for Sausage v3. Plan and decisions: ~/research/sausage-v3/PLAN.md. Results and evidence: the spike READMEs.
62 lines
2.6 KiB
Markdown
62 lines
2.6 KiB
Markdown
# S6: esbuild in WASI
|
|
|
|
This spike builds unpatched esbuild v0.27.7 for `wasip1/wasm`.
|
|
Status: BLOCKED. The module bundles and renders, but both tested adapters trap.
|
|
The test requires a bundle through both the module and the adapted component.
|
|
Node executes each minified bundle with LinkeDOM and checks the rendered elements.
|
|
The test also requires byte-identical output from native esbuild.
|
|
|
|
From the repository root:
|
|
|
|
```sh
|
|
nix develop -c nu spikes/s6-esbuild/build.nu
|
|
nix develop -c nu spikes/s6-esbuild/test.nu
|
|
```
|
|
|
|
Requirements: Go, Node, npm, Nushell, Git, curl, wasm-tools, and Wasmtime 49.0.2.
|
|
The repository devshell supplies wasm-tools and Wasmtime.
|
|
The recipe downloads the command adapter from the Wasmtime v49.0.2 release.
|
|
Both the shared adapter and the v49.0.2 adapter fail with this Go build.
|
|
The recipe stores sources, dependencies, binaries, and bundles in `/tmp/s6-esbuild/`.
|
|
It fetches npm dependencies natively, not inside WASI.
|
|
|
|
The benchmark reports process wall times, not internal compiler times.
|
|
It measures a first invocation and five repetitions with precompiled artifacts.
|
|
The first invocation can use Wasmtime's existing compilation cache.
|
|
The precompiled measurements exclude Cranelift compilation but include process startup and guest initialization.
|
|
Only use the locally generated `.cwasm` files with `--allow-precompiled`.
|
|
|
|
The WASI preopen maps the fixture to `/` with `--dir .::/`.
|
|
A relative guest preopen (`--dir .`) fails with Go's path resolution.
|
|
|
|
After the component blocker is resolved, probe optional CLI modes after the test:
|
|
|
|
```sh
|
|
nix develop -c nu spikes/s6-esbuild/limitations.nu
|
|
```
|
|
|
|
This fixture verifies a single entry point and no custom plugins.
|
|
It does not verify a browser, the Sausage VFS, dependency installation in WASI, or TypeScript type checks.
|
|
See `.board/T6.report.md` for measured limitations and results.
|
|
|
|
## Rework 1
|
|
|
|
The clock probe succeeds with clock IDs 0 and 1 at precision 0.
|
|
The Go probe also succeeds, even with additional initialization and allocation.
|
|
Run both probes with:
|
|
|
|
```sh
|
|
nix develop -c nu spikes/s6-esbuild/diagnose.nu
|
|
```
|
|
|
|
The adapter assertion checks a state-memory sentinel, not clock support.
|
|
An unstripped esbuild build also fails that assertion through `fd_write`.
|
|
This evidence suggests memory corruption rather than an unsupported clock ID.
|
|
It does not identify the writer.
|
|
|
|
`eager-state.experimental.patch` records an unverified adapter experiment.
|
|
The patch reserves adapter state before the guest starts.
|
|
Two attempts to build the adapter failed because of the local Rust target setup.
|
|
The recipe does not apply this patch.
|
|
The component bundle test and the precompiled benchmark remain blocked.
|