- Rust 98.4%
- JavaScript 1.6%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Resolves #1576. Building for wasm64-unknown-unknown failed in two ways introduced by #1553: 1. `rustup target add wasm64-unknown-unknown` failed because wasm64 is a tier-3 target with no prebuilt artifacts. Users had to work around this with `--mode force`. 2. The bundled wasm-opt (binaryen v117) could not parse 64-bit tables; support landed in binaryen v118. The cargo target triple — declared in `.cargo/config.toml`, `CARGO_BUILD_TARGET`, or as an extra cargo argument (`-- --target wasm64-unknown-unknown`) — is the source of truth for what wasm-pack builds. The target triple resolver now follows the same precedence cargo uses (CLI > env > `.cargo/config.toml` walk-up > `$CARGO_HOME/config.toml` > default), so wasm-pack and cargo always agree on the target. For tier-3 wasm targets (currently the `wasm64-*` family) wasm-pack stays out of the cargo invocation — it does not inject `+nightly` or `-Z build-std` (those would override a project's `rust-toolchain.toml` pin or surprise users who hadn't intended a nightly build). Instead it: * verifies the active toolchain is nightly, with a helpful error pointing at `rust-toolchain.toml` and `[unstable] build-std` in `.cargo/config.toml` if it isn't, * installs the `rust-src` component for the active toolchain via rustup if missing, * skips the `rustup target add` attempt (which always fails for tier-3 targets), * passes `--enable-memory64` to wasm-opt so the optimiser accepts 64-bit memories and tables. The bundled binaryen is bumped from `version_117` to `version_129` (latest stable) so wasm-opt accepts 64-bit memories and tables. `--panic-unwind` is untouched. Tests: * New unit test `build::tests::tier3_wasm_detection` covers the triple-classification helper. * New `command::build::tests` unit tests cover the cargo-config walk-up resolution. * New `wasm_opt_prebuilt_url_is_pinned_version` test guards against regressing the binaryen version below v118 (the first release with 64-bit table support). * Existing `all_latest_tool_download_urls_valid` validates the v129 release URLs across all supported architectures. |
||
| .github | ||
| docs | ||
| npm | ||
| src | ||
| tests/all | ||
| wasm-pack-template | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CHANGELOG.md | ||
| clippy.toml | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| demo.gif | ||
| LICENSE-APACHE | ||
| LICENSE-MIT | ||
| README.md | ||
| RELEASE_CHECKLIST.md | ||
About
This tool seeks to be a one-stop shop for building and working with rust-
generated WebAssembly that you would like to interop with JavaScript, in the
browser or with Node.js. wasm-pack helps you build rust-generated
WebAssembly packages that you could publish to the npm registry, or otherwise use
alongside any javascript packages in workflows that you already use, such as webpack.
🔮 Prerequisites
This project requires Rust 1.30.0 or later.
⚡ Quickstart Guide
Visit the quickstart guide in our documentation.
🎙️ Commands
new: Generate a new RustWasm project using a templatebuild: Generate an npm wasm pkg from a rustwasm cratetest: Run browser testspackandpublish: Create a tarball of your rustwasm pkg and/or publish to a registry
📝 Logging
wasm-pack uses env_logger to produce logs when wasm-pack runs.
To configure your log level, use the RUST_LOG environment variable. For example:
RUST_LOG=info wasm-pack build
👯 Contributing
Read our guide on getting up and running for developing wasm-pack, and
check out our contribution policy.
🤹♀️ Governance
This project was started by ashleygwilliams and is maintained by drager.
