Other languages
Any language works when it builds a WASI preview 1 program: a module with a _start function that imports nothing but wasi_snapshot_preview1, and uses only WebAssembly 2.0 (no GC, no exception handling, no threads). Load it and $wasm.modules() says at once whether it runs: a module that needs anything else shows an error that says what.
The languages below weren't tried for these docs. What's said of each is what its own tools document.
| Language | Fits? | Notes |
|---|---|---|
| Swift | Yes | The Swift SDK for WASI (swift build --swift-sdk wasm32-unknown-wasi) builds WASI preview 1 programs. Foundation makes modules several MB, so a first call compiles for a long time and every call holds more memory. |
| C# / .NET | Likely too big | .NET's WASI build carries its runtime: tens of MB, over the default MaxModulesMB. |
| Nim, Odin, D | Through C or LLVM | Each can target wasm32-wasi, through C (zig cc) or its own LLVM backend. |
| Grain, MoonBit | Check the target | Both build WebAssembly; a module runs here only if their WASI output is preview 1 with no other imports. |
| Kotlin/Wasm, Dart, Java (WasmGC) | No | They need WebAssembly GC. |
| Python, Ruby, JavaScript | Not as interpreters | An interpreter built for WASI (CPython, Ruby, QuickJS) needs its standard library as files, and no folder is mounted. A tool that bundles the script and interpreter into one preview 1 program (Javy's static mode for JavaScript) can work, at a few MB per module. For JS, your page code is already JavaScript. |
To check a module without an app, run it with the wazero CLI, which runs it with the same engine:
wazero run mymodule.wasm --describe
echo '{"text":"hi"}' | wazero run mymodule.wasm run
Then copy it to pb_hooks/<name>.pb.wasm and look at $wasm.modules(): a module that can't run says why there.
Questions and comments
Comments are a GitHub Discussions thread; sign in with GitHub to post.