sunfishcode commented on issue #520:
Closing this old issue, as the JS polyfill referenced here is no longer in use.
sunfishcode closed issue #520:
Wasmtime has a JS polyfill implementation of WASI:
https://github.com/CraneStation/wasmtime/tree/polyfill/wasmtime-wasi/js-polyfill
which works by compiling wasmtime's C implementation of WASI with Emscripten, and then adding a bit of support code on top of that.
We should port the support code to work on top of wasi-common, compiled with wasm32-unknown-emscripten. In theory, all the big pieces are in place -- wasi-common provides the same functionality as Wasmtime's C implementation of WASI, Emscripten can provide the same underlying support in both cases, and the support code should roughly be the same. So the work here is in rewiring everything up in wasi.js, and porting polyfill.c to Rust, probably splitting out that
EM_ASM
into a standalone JS file.I've marked this "help wanted" -- if someone's interested in doing this port, that'd be great (and I can help mentor), but it'd even help just to have more ideas for packaging, binding, or other ways we could make the polyfill better. The current support code and shell.html is super minimal.
Last updated: Nov 22 2024 at 16:03 UTC