- Category
- Developer Tools
- Rank
- No. 805Tools index
- Pricing
- Open Source
- Type
- TOOL
- Builder
- denoland
- GitHub
- 354 stars
- Latest release
- 0.22.0
- Date
About
Build tool that lets you use Rust code from Deno and the browser via WebAssembly.
What it does
It automates the awkward middle of a WebAssembly build. The command compiles a selected Cargo crate, produces JavaScript bindings and type declarations, formats the generated code, and can optimize or inline the resulting module.
Why it's ranked here
Wasmbuild is a focused, practical choice when a Deno project owns Rust components. Scaffolding, workspace selection, typed output, optimization, and CI freshness checks form a coherent workflow. Strict dependency version matching and substantial toolchain requirements narrow its appeal.
What's good
The freshness check hashes Rust sources and generated supporting modules, making stale committed output detectable in CI. Cargo feature controls pass through the command line. It supports workspace crate selection, configurable output and JavaScript extensions, debug builds, optional inlining, and optional optimization.
Tradeoffs
The build expects Cargo and the WebAssembly Rust target, while the command requests environment, process, read, and write permissions. It requires exact supported versions of several Rust dependencies. Default output uses WebAssembly imports, which most browsers do not support, and optimization may download a Binaryen executable.
How to use it well
Use it for Deno-centered repositories that maintain a Rust WebAssembly crate and want generated bindings committed or checked during CI. Select the intended crate in larger workspaces and inline output for broader runtime support. It does not replace the Rust toolchain or a general application bundler.
Technical notes+
main.ts exposes new, build, check, and help command paths and requests env, run, read, and write permissions. lib/pre_build.ts invokes Cargo for wasm32-unknown-unknown, remaps build paths, formats generated bindings, and computes a source hash. lib/manifest.ts reads Cargo metadata and accepts only cdylib targets. lib/versions.ts enforces exact wasm-bindgen ecosystem versions. lib/bindgen.ts normally calls the bundled generate_bindgen export from lib/wasmbuild.js, with an external wasm-bindgen CLI path reserved for self-build upgrades. lib/wasmopt.ts caches a downloaded Binaryen wasm-opt binary and runs -Oz; its OS mapping covers Linux, macOS, and Windows.
Observed
- License
- MIT license, stated in source headers.
- Primary implementation
- TypeScript command-line tool with a Rust workspace and generated WebAssembly bindings.
- Packaging
- Published as the JSR package @deno/wasmbuild and installable through Deno.
- Interface
- Command-line interface with scaffolding, build, check, and help operations.
- Output support
- Generates JavaScript bindings, TypeScript declarations, and WebAssembly output, with an inline mode for environments lacking WebAssembly imports.
- Optimizer platforms
- Binaryen download logic covers Linux, macOS, and Windows, with x86_64 and aarch64 architecture mappings.
- Tests
- Repository text includes Deno tests for argument parsing and dependency version validation, plus task-driven integration tests.
Read from README.md, deno.json, Cargo.toml, main.ts, lib/args.ts, lib/bindgen.ts, lib/wasmopt.ts, lib/manifest.ts, lib/versions.ts, lib/args.test.ts, lib/pre_build.ts, lib/wasmbuild.js, lib/wasmbuild.d.ts, lib/wasmbuild_bg.js, lib/versions.test.ts.
What it can do
Compile Rust code to WebAssembly
Rust source code → WebAssembly binary (.wasm file)
Generate JavaScript bindings for WebAssembly modules
Compiled WebAssembly module → JavaScript wrapper code
Enable Rust code execution in Deno runtime
Rust functions and WebAssembly module → Deno-compatible module
Enable Rust code execution in web browsers
Rust functions and WebAssembly module → Browser-compatible JavaScript module
Build optimized WebAssembly packages
Rust project configuration → Optimized WebAssembly bundle
Generate TypeScript type definitions
Rust function signatures → TypeScript declaration files (.d.ts)
Tags
Tech Stack
Media
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.
