README.md

June 12, 2026 ยท View on GitHub

componentize-js, rebooted

This project generates WebAssembly Components from JavaScript code. It is intended to be a reboot of the existing ComponentizeJS project, using wit-dylib instead of generating JS code to handle Component Model ABI details, which should reduce the amount of code to maintain and provide a modest performance boost. It also uses the mozjs Rust wrapper around SpiderMonkey, making it easier to extend the runtime using Rust instead of C++.

Status

Note that this project is ultimately intended to become an integral part of StarlingMonkey, and so some of the below to-do items may be addressed after that integration happens, and possibly at a higher level of abstraction outside of this crate.

  • support sync and async imports and exports
  • support streams and futures
  • support imported and exported resources
  • support arbitrary WIT types
  • add a license (Apache 2 + LLVM exception)
  • move JS code generation out of guest code to minimize snapshot bloat
  • make codegen match existing ComponentizeJS output
  • resource/stream/future disposal using Symbol.dispose
  • add a CLI interface
  • add example(s)
  • resource/stream/future finalization
  • integrate with StarlingMonkey for Web and Node API support
  • lint and run tests (including examples) in CI
  • generate (and validate in CI) TypeScript bindings (possibly reuse existing ComponentizeJS code)
  • make streams (and futures?) more idiomatic (e.g. ReadableStream and WritableStream)
  • investigate options (e.g. GC pinning?) for zero-copy ArrayBuffer reads and writes

Building and Running

First, install Rust stable, including the wasm32-wasip2 target, if you don't already have it.

rustup update
rustup target add wasm32-wasip2

Next, install WASI-SDK 30 and point WASI_SDK_PATH to wherever you installed it. Replace arm64-linux with x86_64-linux, arm64-macos, x86_64-macos, arm64-windows, or x86_64-windows below depending on your architecture and OS, if necessary.

curl -LO https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-30/wasi-sdk-30.0-arm64-linux.tar.gz
tar xf wasi-sdk-30.0-arm64-linux.tar.gz
export WASI_SDK_PATH=$(pwd)/wasi-sdk-30.0-arm64-linux

Note: on Ubuntu 24.04, you may need to apt install libclang-20-dev as well.

Finally, build and run:

cargo run --release -- --help

See the examples folder for examples of how to create and run components.