To me it sounds like you could implement some parts of the WASI in JavaScript, so a WASM module depending on WASI doesn’t preclude it from running in the browser or a browser-like runtime. Instead of a bespoke shim generated by the compiler, you could use a standardized shim that provides a known subset of WASI.
On the other hand relying on JS shims means a lot of guaranteed copying to/from the JS heap, which is a very annoying speed tax compared to… not.
I wonder why browsers don’t allow direct WebIDL-based APIs direct from WASM to browser APIs
Wasmer's one in theory works in the browser but I've yet to have it work. You have to polyfill some stuff like Buffer and even then you run into some annoying runtime Wasm errors.
On the other hand relying on JS shims means a lot of guaranteed copying to/from the JS heap, which is a very annoying speed tax compared to… not.
I wonder why browsers don’t allow direct WebIDL-based APIs direct from WASM to browser APIs