Possibly a silly question here, but:
I already know that it's possible to write a webassembly component and use jco transpile
to generate a core wasm with bindings that can easily be executed in the browser.
Would it also be possible to compile wasmtime itself to a core wasm, execute it in the browser, and then have the embedded wasmtime run wasm components directly without transpilation? If so, would that be a way to take advantage of wasmtime's support for component-model features (e.g. futures/streams) that presumably will arrive before support comes in the native browser wasm runtimes?
While theoretically possible Wasmtime is definitely not built for this today and it would require quite a lot of surgery to get this working. It's probaby safe to say that jco is your best bet for now. One thing of note is that you can embed jco itself on a web page and effectively eval
the output which is more-or-less what loading wasmtime would look like
It's probaby safe to say that jco is your best bet for now.
If I am understanding correctly, then there is still a downside to doing it that way, though - for example, when futures and streams are first supported in preview3, I assume BCA runtimes like wasmtime will be the first to support it. But if I'm only executing my transpiled components in a native browser runtime, then I will have to wait until each browser runtime adds support. Is this correct?
jco is a bytecode alliance project. support for futures/streams/preview 3 is just a glimmer in our eyes, its not a real thing that exists anywhere yet, but when it does it will be rolled out in both wasmtime and jco by the time it is production ready
if you want to run things in a js engine, use jco. if you want to run things on windows, linux, or mac, use wasmtime.
Yeah was just using futures/streams as a proxy for "when new features come out" (although I am specifically looking forward to async support).
Ok, for some reason I was thinking transpiling with jco would limit me in some way with what wasm features I could use. I'll look more into jco.
Ah yes no it's intended that jco is at feature parity with wasmtime and any difference is just a temporary resourcing thing. The "official run in the browser" recommendation is definitely jco
Last updated: Nov 22 2024 at 17:03 UTC