Five ways of looking at Jco, Part 1
Jco, the Bytecode Alliance's JavaScript WebAssembly multi-tool, is best understood as a layered stack. StarlingMonkey (SpiderMonkey compiled to Wasm with Component Model wiring) sits at the base. componentize-js bundles JS into it and pre-initializes with Wizer so startup cost is paid at build time, and it is being rewritten on wit-dylib to remove a circular dependency. jco transpile unbundles any component into core Wasm modules plus JS glue generated by the Rust crate js-component-bindgen, so components run in Node.js or browsers without native Component Model support. WASI P2 shims supply the I/O, with P3 shims landing first for Node.js.
Related posts
- Why is WebAssembly a second-class language on the web?
Mozilla Hacks mediumAdeptWebAssembly remains second-class on the web because it can only load code and reach Web APIs through JavaScript. That forces arcane instantiation boilerplate, language-specific glue code from tools like wasm-bindgen and embind, JS-centric documentation, and real runtime overhead. A 2020 TodoMVC experiment with the Dodrio Rust framework found that removing JS glue cut DOM-update time by 45%. The esm-integration proposal, being implemented in Firefox, simplifies loading, and the WebAssembly Component Model with WIT interfaces is proposed as a standardized artifact that could let Wasm call Web APIs directly with no JavaScript in between.
- The Road to Component Model 1.0
Bytecode Alliance hardMasterComponent Model 1.0 is planned around five workstreams: a lazy ABI that replaces cabi_realloc-based eager allocation with opaque value handles and inlinable built-ins, native implementation in at least two browser engines, simpler implementation via guest and host C ABIs plus a component-smashing tool, ecosystem and tooling growth, and WIT expressivity features such as optional imports, callbacks, resource subtyping and a map type. The ABI change ships opt-in in a 0.3.x release and becomes the default at 1.0, with adapters keeping P1, P2 and P3 components working. Other planned work removes the roughly 3.5x overhead on synchronous cross-component calls and adds cooperative threads and stream splicing in WASI P3 follow-up releases. jco's "use components" marker borrows the asm.js telemetry strategy to build the case for native browser support.
- Bringing Javascript to WebAssembly for Shopify Functions
Shopify Engineering mediumAdeptShopify runs JavaScript in Shopify Functions by compiling the QuickJS interpreter to WebAssembly/WASI via Javy. JIT engines like V8 can't run inside Wasm, so QuickJS fills the gap. Embedding the engine with the user's bytecode produced modules of 800KB or more, well over the 256KB limit. Shopify got around this with an ad-hoc dynamic linking scheme built on Wasmtime's linker: a shared "javy_quickjs_provider_v1" library exposes realloc and eval_bytecode, so each function shrinks to a roughly 220-byte stub plus its bytecode, and the engine can be precompiled and patched centrally. The minimal Javy runtime adds POSIX-like stdin/stdout APIs on a Javy global and a Rust-implemented UTF-8 TextEncoder/TextDecoder, but does not yet enable the event loop.
- How Wasm components enable pluggable tooling through interposition
Bytecode Alliance mediumAdeptThe WASI 0.3 `wasi:http` middleware world (import handler, export handler) shows how Wasm component composition enables in-process service chaining and, more generally, interposition: inserting a component between any caller and callee without modifying either. Interposition addresses three limits of language-level middleware: per-language fragmentation, the assumption of a fixed HTTP request/response interface, and opaque binaries that cannot be re-wired. Because component interfaces expose full type information, a tool can adapt generic middleware such as logging, tracing, fuzzers or record/replay to arbitrary interfaces. The `splicer` research tool discovers a component's composition graph and interposes components driven by a YAML config. It currently supports passthrough and read-only adapters, with read/write adapters planned.
- WASI 0.3 Launched
Bytecode Alliance mediumAdeptWASI 0.3.0 is ratified and rebases WASI onto the Component Model's native async primitives. The canonical ABI gains `stream<T>`, `future<T>` and `async func`, which replace `wasi:io` pollables and streams. Scheduling moves to a single host-managed, completion-based event loop modeled on io_uring/IOCP, so async components can finally be composed with each other. Streams now return a separate error future, and `wasi:http` is reorganized into `service` and `middleware` worlds that allow in-process service chaining. Wasmtime 46 will enable WASI 0.3 by default, jco already supports it, and Rust and Go bindings illustrate idiomatic stackless and stackful async.