Hi there!
We have a few rust libraries that target Node.js using N-API, and are currently exploring how to provide browser-compatible wasm builds, and components and jco look super promising.
I'm wondering how stable it is for projects that don't need wasi (they are isolated from the OS/runtime — e.g. one of them is a praser), but need to run both in the browser and Node.js.
The readme mentions * WASI Preview2 support in Node.js ([undergoing stabilization](https://github.com/bytecodealliance/jco/milestone/1)) & browsers (experimental).
, but is that for WASI Preview 2? Or should I read it as "the entire jco should be considered experimental when targeting browsers"?
jco is only for wasi, if you want to compile your rust code that doesn't require wasi into something browsers can run, you want wasm-bindgen
Thanks for the question, Jco's transpilation layer is stable and this is reflected in the 1.x status and the project will be following semver for all features except for jco componentize
which is still unstable. With regards to WASI support, that is also stable in Node.js, it is just the browser WASI support that is still experimental.
as an example, swc has https://swc.rs/docs/usage/core and https://swc.rs/docs/usage/wasm which are compiled from the same codebase, but one is napi and the other is wasm
@Ramon Klass , is it limited to wasi? do you include "wasm components" in your definition of what wasi is? I'm still trying to make up my mind about how to distinguish the scope of each project. I understand the difference at the technical level, but the line is fuzzy at the product (and especially docs) level
using components even without wasi (as in the set of standard interfaces), would allow us to run the components on other stacks, which is also a longer-term goal of ours
Guy Bedford said:
hanks for the question, Jco's transpilation layer is stable and this is reflected in the 1.x status and the project will be following semver for all features except for
jco componentize
which is still unstable. With regards to WASI support, that is also stable in Node.js, it is just the browser WASI support that is still experimental.
Thanks for your answer! So if transpiled component doesn't need @bytecodealliance/preview2-shim
it should be sable in the browser, right?
Just as an interesting data point to the conversation, supporting multiple platforms using N-API can be pretty annoying, so wasm components+jco can be an amazing alternative to it.
So what started as a "let's make this run in the browser" effort, is now turning into "can we do everything with wasm components?"
Thanks for your answer! So if transpiled component doesn't need
@bytecodealliance/preview2-shim
it should be sable in the browser, right?
Yes exactly. Note that WASI Preview2 is stable itself, so some users just write their own preview2 implementations as necessary to support functionality in the browser - it's only the browser implementation of preview2 that is unstable currently.
Thanks for your confirmation. And thanks a ton for your work on jco
Patricio Palladino has marked this topic as resolved.
Last updated: Nov 26 2024 at 00:12 UTC