Showing preview only (520K chars total). Download the full file or copy to clipboard to get everything.
Repository: drager/wasm-pack
Branch: master
Commit: 87db09d0f6e5
Files: 128
Total size: 486.6 KB
Directory structure:
gitextract_7ickrjy7/
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ └── feature_request.md
│ ├── PULL_REQUEST_TEMPLATE.md
│ └── workflows/
│ ├── approve.yml
│ ├── book.yml
│ ├── release.yml
│ └── test.yml
├── .gitignore
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Cargo.toml
├── LICENSE-APACHE
├── LICENSE-MIT
├── README.md
├── RELEASE_CHECKLIST.md
├── clippy.toml
├── docs/
│ ├── _installer/
│ │ ├── build-installer.rs
│ │ ├── index.html
│ │ ├── init.sh
│ │ └── wasm-pack.js
│ ├── _theme/
│ │ └── header.hbs
│ ├── book.toml
│ ├── browserconfig.xml
│ ├── index.html
│ ├── public/
│ │ └── custom.css
│ ├── site.webmanifest
│ └── src/
│ ├── SUMMARY.md
│ ├── cargo-toml-configuration.md
│ ├── commands/
│ │ ├── build.md
│ │ ├── index.md
│ │ ├── init.md
│ │ ├── new.md
│ │ ├── pack-and-publish.md
│ │ └── test.md
│ ├── contributing.md
│ ├── introduction.md
│ ├── prerequisites/
│ │ ├── considerations.md
│ │ ├── index.md
│ │ ├── non-rustup-setups.md
│ │ └── npm.md
│ ├── quickstart.md
│ └── tutorials/
│ ├── hybrid-applications-with-webpack/
│ │ ├── getting-started.md
│ │ ├── index.md
│ │ └── using-your-library.md
│ ├── index.md
│ ├── npm-browser-packages/
│ │ ├── building-your-project.md
│ │ ├── getting-started/
│ │ │ └── manual-setup.md
│ │ ├── getting-started.md
│ │ ├── index.md
│ │ ├── packaging-and-publishing.md
│ │ ├── template-deep-dive/
│ │ │ ├── building-your-project.md
│ │ │ ├── cargo-toml.md
│ │ │ ├── index.md
│ │ │ ├── src-lib-rs.md
│ │ │ ├── src-utils-rs.md
│ │ │ ├── tests-web-rs.md
│ │ │ └── wee_alloc.md
│ │ ├── testing-your-project.md
│ │ └── using-your-library.md
│ └── standalone-wasm-binaries/
│ └── index.md
├── npm/
│ ├── .gitignore
│ ├── README.md
│ ├── binary.js
│ ├── install.js
│ ├── package.json
│ └── run.js
├── src/
│ ├── bindgen.rs
│ ├── build/
│ │ ├── mod.rs
│ │ └── wasm_target.rs
│ ├── cache.rs
│ ├── child.rs
│ ├── command/
│ │ ├── build.rs
│ │ ├── generate.rs
│ │ ├── login.rs
│ │ ├── mod.rs
│ │ ├── pack.rs
│ │ ├── publish/
│ │ │ ├── access.rs
│ │ │ └── mod.rs
│ │ ├── test.rs
│ │ └── utils.rs
│ ├── emoji.rs
│ ├── generate.rs
│ ├── install/
│ │ ├── arch.rs
│ │ ├── krate.rs
│ │ ├── mod.rs
│ │ ├── mode.rs
│ │ ├── os.rs
│ │ └── tool.rs
│ ├── installer.rs
│ ├── lib.rs
│ ├── license.rs
│ ├── lockfile.rs
│ ├── main.rs
│ ├── manifest/
│ │ ├── mod.rs
│ │ └── npm/
│ │ ├── commonjs.rs
│ │ ├── esmodules.rs
│ │ ├── mod.rs
│ │ ├── nomodules.rs
│ │ └── repository.rs
│ ├── npm.rs
│ ├── progressbar.rs
│ ├── readme.rs
│ ├── stamps.rs
│ ├── target.rs
│ ├── test/
│ │ ├── mod.rs
│ │ ├── webdriver/
│ │ │ ├── chromedriver.rs
│ │ │ ├── geckodriver.rs
│ │ │ └── safaridriver.rs
│ │ └── webdriver.rs
│ └── wasm_opt.rs
└── tests/
└── all/
├── build.rs
├── download.rs
├── generate.rs
├── license.rs
├── lockfile.rs
├── log_level.rs
├── main.rs
├── manifest.rs
├── readme.rs
├── stamps.rs
├── test.rs
├── utils/
│ ├── file.rs
│ ├── fixture.rs
│ ├── manifest.rs
│ └── mod.rs
├── wasm_opt.rs
└── webdriver.rs
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug Report 🐛
about: Did something not work as expected?
---
## 🐛 Bug description
Describe your issue in detail.
#### 🤔 Expected Behavior
What should have happened?
#### 👟 Steps to reproduce
Clear steps describing how to reproduce the issue, including commands and flags run. If you are seeing an error, please include the full error message and stack trace.
#### 🌍 Your environment
Include the relevant details of your environment.
wasm-pack version:
rustc version:
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature Request 💡
about: Suggest a new idea for wasm-pack
---
## 💡 Feature description
Brief explanation of the requested feature.
#### 💻 Basic example
Include a basic code example if possible. Omit this section if not applicable.
================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
Make sure these boxes are checked! 📦✅
- [ ] You have the latest version of `rustfmt` installed
```bash
$ rustup component add rustfmt
```
- [ ] You ran `cargo fmt` on the code base before submitting
- [ ] You reference which issue is being closed in the PR text
✨✨ 😄 Thanks so much for contributing to wasm-pack! 😄 ✨✨
================================================
FILE: .github/workflows/approve.yml
================================================
name: Automatic Approve
permissions:
contents: read
pull-requests: write
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
automatic-approve:
name: Automatic Approve
runs-on: ubuntu-latest
steps:
- name: Automatic Approve
uses: mheap/automatic-approve-action@v1.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
workflows: "test.yml"
================================================
FILE: .github/workflows/book.yml
================================================
name: Build and deploy documentation book
on:
push:
pull_request:
jobs:
book:
permissions:
contents: write
name: Build and deploy book
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Cache dependencies
uses: actions/cache@v3
env:
cache-name: cache-mdbook
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
key: ${{ runner.os }}-build-${{ env.cache-name }}-0.3 }}
- name: Install mdbook
run: |
(test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update)
(test -x $HOME/.cargo/bin/mdbook || cargo install --vers "^0.4" mdbook)
cargo install-update -a
- name: Build book
run: |
mdbook --version
(cd docs && mv _theme theme && mdbook build)
rustc ./docs/_installer/build-installer.rs
./build-installer
- name: Deploy book
uses: JamesIves/github-pages-deploy-action@v4.4.1
if: ${{ github.ref == 'refs/heads/master' }}
with:
branch: gh-pages
folder: docs
token: ${{ secrets.GITHUB_TOKEN }}
single-commit: true
================================================
FILE: .github/workflows/release.yml
================================================
on:
push:
tags:
- 'v*' # Run when tag matches v*, i.e. v1.0, v20.15.10
name: Release
permissions:
contents: read
env:
RELEASE_BIN: wasm-pack
RELEASE_DIR: artifacts
GITHUB_REF: '${{ github.ref }}'
WINDOWS_TARGET: x86_64-pc-windows-msvc
MACOS_AMD64_TARGET: x86_64-apple-darwin
MACOS_ARM64_TARGET: aarch64-apple-darwin
LINUX_AMD64_TARGET: x86_64-unknown-linux-musl
LINUX_ARM64_TARGET: aarch64-unknown-linux-musl
# Space separated paths to include in the archive.
RELEASE_ADDS: README.md LICENSE-APACHE LICENSE-MIT
jobs:
build:
name: Build artifacts
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
rust: stable
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
rust: stable
- target: x86_64-apple-darwin
os: macos-latest
rust: stable
- target: aarch64-apple-darwin
os: macos-latest
rust: stable
- target: x86_64-pc-windows-msvc
os: windows-latest
rust: stable
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
targets: wasm32-unknown-unknown
- name: Query version number
id: get_version
shell: bash
run: |
echo "using version tag ${GITHUB_REF:10}"
echo ::set-output name=version::"${GITHUB_REF:10}"
- name: Install C compilation tooling (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update -y
sudo apt-get install clang gcc-aarch64-linux-gnu musl-tools -y
- name: Install p7zip (MacOS)
if: matrix.os == 'macos-latest'
run: brew install p7zip
- name: Add rustup target
run: rustup target add ${{ matrix.target }}
- uses: taiki-e/install-action@v2
with:
tool: cross
- name: Build
run: cross build --release --target ${{ matrix.target }}
- name: Set RUSTFLAGS (Windows)
if: matrix.os == 'windows-latest'
run: echo "RUSTFLAGS=-Ctarget-feature=+crt-static" >> $GITHUB_ENV
- name: Create artifact directory
run: |
mkdir ${{ env.RELEASE_DIR }}
mkdir -p ${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}
- name: Move binaries (Linux/MacOS)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: |
mv ./target/${{ matrix.target }}/release/${{ env.RELEASE_BIN }} ${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}/${{ env.RELEASE_BIN }}
mv ${{ env.RELEASE_ADDS }} ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}
- name: Move binaries (Windows)
if: matrix.os == 'windows-latest'
shell: bash
run: |
cp ./target/${{ matrix.target }}/release/${{ env.RELEASE_BIN }}.exe ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}/${{ env.RELEASE_BIN }}.exe
cp ./target/${{ matrix.target }}/release/${{ env.RELEASE_BIN }}.exe wasm-pack-init.exe
mv ${{ env.RELEASE_ADDS }} ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}
mv wasm-pack-init.exe ${{ env.RELEASE_DIR }}
- name: Create tarball
shell: bash
run: 7z a -ttar -so -an ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }} | 7z a -si ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}.tar.gz
- name: Upload Zip
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: ./${{ env.RELEASE_DIR }}
release:
name: GitHub Release
needs: build
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Query version number
id: get_version
shell: bash
run: |
echo "using version tag ${GITHUB_REF:10}"
echo ::set-output name=version::"${GITHUB_REF:10}"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: ${{ steps.get_version.outputs.VERSION }}
- name: Download Linux amd64 tarball
uses: actions/download-artifact@v4.1.7
with:
name: ${{ env.LINUX_AMD64_TARGET }}
- name: Download Linux arm64 tarball
uses: actions/download-artifact@v4.1.7
with:
name: ${{ env.LINUX_ARM64_TARGET }}
- name: Download Windows tarball
uses: actions/download-artifact@v4.1.7
with:
name: ${{ env.WINDOWS_TARGET }}
- name: Download ARM64 MacOS tarball
uses: actions/download-artifact@v4.1.7
with:
name: ${{ env.MACOS_ARM64_TARGET }}
- name: Download AMD64 MacOS tarball
uses: actions/download-artifact@v4.1.7
with:
name: ${{ env.MACOS_AMD64_TARGET }}
- name: Release Linux amd64 tarball
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_AMD64_TARGET }}.tar.gz
asset_content_type: application/gzip
asset_name: wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_AMD64_TARGET }}.tar.gz
- name: Release Linux arm64 tarball
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_ARM64_TARGET }}.tar.gz
asset_content_type: application/gzip
asset_name: wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_ARM64_TARGET }}.tar.gz
- name: Release Windows tarball
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS_TARGET }}.tar.gz
asset_content_type: application/gzip
asset_name: wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS_TARGET }}.tar.gz
- name: Release Windows init exe
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./wasm-pack-init.exe
asset_content_type: application/vnd.microsoft.portable-executable
asset_name: wasm-pack-init.exe
- name: Release AMD64 MacOS tarball
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_AMD64_TARGET }}.tar.gz
asset_content_type: application/gzip
asset_name: wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_AMD64_TARGET }}.tar.gz
- name: Release ARM64 MacOS tarball
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_ARM64_TARGET }}.tar.gz
asset_content_type: application/gzip
asset_name: wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_ARM64_TARGET }}.tar.gz
================================================
FILE: .github/workflows/test.yml
================================================
name: Tests
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
name: Test
permissions:
contents: read
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux-stable, macos-stable, windows-stable]
include:
- build: linux-stable
os: ubuntu-latest
rust: stable
- build: macos-stable
os: macos-latest
rust: stable
- build: windows-stable
os: windows-latest
rust: stable
steps:
- uses: actions/checkout@v4
- uses: nanasess/setup-chromedriver@master
- if: matrix.os == 'macos-latest'
run: brew install --cask firefox
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
targets: wasm32-unknown-unknown
- uses: actions/setup-node@v3
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
target
key: ${{ runner.os }}-build-${{ hashFiles('Cargo.lock') }}
- name: Run Tests
run: cargo test --all --locked
env:
RUST_BACKTRACE: 1
- name: Clippy
run: cargo clippy
- name: Cargo fmt
run: cargo fmt --all -- --check
================================================
FILE: .gitignore
================================================
target/
**/*.rs.bk
tests/.crates.toml
tests/bin
/build-installer
docs/book
docs/installer
.idea
================================================
FILE: CHANGELOG.md
================================================
# Changelog
## 🤍 Unreleased
## 🌻 0.14.0
- ### ✨ Features
- **Support arbitrary wasm targets (WASI support) - [RReverser], [pull/1524]**
Allows building for targets other than wasm32-unknown-unknown, enabling WASI and other custom wasm targets.
[pull/1524]: https://github.com/drager/wasm-pack/pull/1524
[RReverser]: https://github.com/RReverser
- **macOS ARM (aarch64-apple-darwin) build support - [kaleidawave], [pull/1529]**
Adds native Apple Silicon support in release builds and NPM package.
[pull/1529]: https://github.com/drager/wasm-pack/pull/1529
[kaleidawave]: https://github.com/kaleidawave
- **Allow `--split-linked-modules` flag for wasm-bindgen - [codeart1st], [pull/1443]**
[pull/1443]: https://github.com/drager/wasm-pack/pull/1443
[codeart1st]: https://github.com/codeart1st
- **Custom build profile support - [rafaelbeckel], [pull/1428]**
Allows using custom cargo profiles via `--profile`.
[pull/1428]: https://github.com/drager/wasm-pack/pull/1428
[rafaelbeckel]: https://github.com/rafaelbeckel
- ### 🤕 Fixes
- **Fix NPM package download URL - [qinyuhang], [pull/1543]**
[pull/1543]: https://github.com/drager/wasm-pack/pull/1543
[qinyuhang]: https://github.com/qinyuhang
- **Filter build artifacts to only .wasm files - [drager], [pull/1535]**
[pull/1535]: https://github.com/drager/wasm-pack/pull/1535
- **Handle undefined VERSION in installer script - [BrianHung], [pull/1512]**
[pull/1512]: https://github.com/drager/wasm-pack/pull/1512
[BrianHung]: https://github.com/BrianHung
- **Fix it_gets_wasm_bindgen_version test - [mshroyer], [pull/1509]**
[pull/1509]: https://github.com/drager/wasm-pack/pull/1509
[mshroyer]: https://github.com/mshroyer
- ### 🛠️ Maintenance
- **Update dependencies to latest versions - [drager], [pull/1536]**
[pull/1536]: https://github.com/drager/wasm-pack/pull/1536
- **Security workflow permissions fixes - [drager]**
- **Bump ring from 0.17.8 to 0.17.14 - [dependabot], [pull/1516]**
[pull/1516]: https://github.com/drager/wasm-pack/pull/1516
- **Bump brace-expansion from 1.1.11 to 1.1.12 in /npm - [dependabot], [pull/1515]**
[pull/1515]: https://github.com/drager/wasm-pack/pull/1515
- **Bump rustls from 0.23.16 to 0.23.18 - [dependabot], [pull/1451]**
[pull/1451]: https://github.com/drager/wasm-pack/pull/1451
[dependabot]: https://github.com/apps/dependabot
- **Fix tar vulnerability (CVE-2026-23745) in npm package**
Override tar dependency to ^7.5.3 to fix arbitrary file overwrite and symlink poisoning vulnerability ([GHSA-8qq5-rm4j-mr97]).
[GHSA-8qq5-rm4j-mr97]: https://github.com/advisories/GHSA-8qq5-rm4j-mr97
- **Fix axios vulnerabilities in npm package**
Override axios dependency to ^0.30.0 to fix SSRF/credential leakage via absolute URL and XSRF-TOKEN leakage (CSRF) vulnerabilities.
- ### 📖 Documentation
- **Update documentation links to drager's repo - [yutannihilation], [pull/1513]**
[pull/1513]: https://github.com/drager/wasm-pack/pull/1513
[yutannihilation]: https://github.com/yutannihilation
- **Document prerequisites for webdriver tests - [mshroyer], [pull/1509]**
## ☀️ 0.13.1
- ### ✨ Features
- **Requests using proxy settings from env - [jjyr], [pull/1438]**
This enables ureq to use proxy settings from env, it solves lots of pain in network restricted environments.
[pull/1438]: https://github.com/rustwasm/wasm-pack/pull/1438
[jjyr]: https://github.com/jjyr
- ### 🤕 Fixes
- **Update binary-install to v0.4.1 - [drager], [pull/1407]**
Release v0.4.0 of binary-install introduced a regression that caused failures on some platforms. This release fixes that regression.
[pull/1407]: https://github.com/rustwasm/wasm-pack/pull/1407
[drager]: https://github.com/drager
- ** Allow npm binary upgrades - [net], [pull/1439]**
Fixes an issue where upgrading `wasm-pack` via NPM would not update the underlying binary.
Previously, the binary was stored in the `binary-install` package's directory without versioning, causing version upgrades to silently fail as the old binary continued to be used.
The binary is now stored in `node_modules/wasm-pack/binary/`, ensuring proper version updates when upgrading the package.
**Before:** Upgrading from `0.12.1` to `0.13.0` would continue using the `0.12.1` binary
**After:** Each `wasm-pack` version manages its own binary, enabling proper version upgrades
[pull/1439]: https://github.com/rustwasm/wasm-pack/pull/1439
[net]: https://github.com/net
- ### 🛠️ Maintenance
- ** Remove unmaintained dependency atty in favor of stdlib - [mariusvniekerk], [pull/1436]**
[pull/1436]: https://github.com/rustwasm/wasm-pack/pull/1436
[mariusvniekerk]: https://github.com/mariusvniekerk
## ☀️ 0.13.0
- ### ✨ Features
- **Add option to skip optimization with wasm-opt - [sisou], [pull/1321]**
This feature introduces the `--no-opt` option to wasm-pack, providing a significant improvement in build efficiency for projects requiring multiple wasm-pack executions.
[pull/1321]: https://github.com/rustwasm/wasm-pack/pull/1321
[sisou]: https://github.com/sisou
- **Add support geckodriver for linux-aarch64 - [EstebanBorai], [pull/1371]**
Introduces support to download Geckodriver in Linux aarch64.
[pull/1371]: https://github.com/rustwasm/wasm-pack/pull/1371
[EstebanBorai]: https://github.com/EstebanBorai
- **Add wasm-opt linux aarch64 condition - [dkristia], [issue/1392], [pull/1393]**
A linux aarch64 build for wasm-opt exists in the newest binaryen versions.
[issue/1392]: https://github.com/rustwasm/wasm-pack/issues/1392
[pull/1393]: https://github.com/rustwasm/wasm-pack/pull/1393
[dkristia]: https://github.com/dkristia
- ### 🤕 Fixes
- **Fix passing relative paths to cargo - [dfaust], [issue/704], [issue/1156], [issue/1252], [pull/1331]**
When building a crate located in a sub-directory, relative paths, passed as extra options to cargo (like `--target-dir`), are now handled correctly.
[issue/704]: https://github.com/rustwasm/wasm-pack/issues/704
[issue/1156]: https://github.com/rustwasm/wasm-pack/issues/1156
[issue/1252]: https://github.com/rustwasm/wasm-pack/issues/1252
[pull/1331]: https://github.com/rustwasm/wasm-pack/pull/1331
[dfaust]: https://github.com/dfaust
- **Rewrite wasm_target to use target-libdir - [daidoji], [issue/1342], [pull/1343]**
Rewritten wasm_target to use target libdir from the rustc tool rather than looking through sysroot. This is to accomodate non-rustup installations.
[issue/1342]: https://github.com/rustwasm/wasm-pack/issues/1342
[pull/1343]: https://github.com/rustwasm/wasm-pack/pull/1343
[daidoji]: https://github.com/daidoji
- **Declare ES module in package.json - [gthb], [issue/1039], [pull/1061]**
In bundler mode, generate package.json with "type": "module" and use the "main" attribute instead of the "module" attribute.
This change makes the built ES module palatable to Node.js (when run with --experimental-vm-modules --experimental-wasm-modules),
while it remains also palatable to webpack as illustrated in webpack/webpack#14313
(where the pkg subfolder is generated with wasm-pack built with this change).
This resolves the headache of using a wasm-pack-built package in a library that one needs to both run directly in Node and include in a webpack build.
[issue/1039]: https://github.com/rustwasm/wasm-pack/issues/1039
[pull/1061]: https://github.com/rustwasm/wasm-pack/pull/1061
[gthb]: https://github.com/gthb
- **Use new chromdriver endpoint and fix CI - [Myriad-Dreamin], [kade-robertson], [issue/1315], [issue/1390], [pull/1325], [pull/1391]**
[issue/1315]: https://github.com/rustwasm/wasm-pack/issues/1315
[issue/1390]: https://github.com/rustwasm/wasm-pack/issues/1390
[pull/1325]: https://github.com/rustwasm/wasm-pack/pull/1325
[pull/1391]: https://github.com/rustwasm/wasm-pack/pull/1391
[Myriad-Dreamin]: https://github.com/Myriad-Dreamin
[kade-robertson]: https://github.com/kade-robertson
- **Add mingw support to npm package - [nathaniel-daniel], [issue/1354], [issue/1359], [pull/1363]**
Fixes the NPM package's platform detection for mingw.
[issue/1354]: https://github.com/rustwasm/wasm-pack/issues/1354
[issue/1359]: https://github.com/rustwasm/wasm-pack/issues/1359
[pull/1363]: https://github.com/rustwasm/wasm-pack/pull/1363
[nathaniel-daniel]: https://github.com/nathaniel-daniel
- **pkg-dir option for pack and publish commands - [danielronnkvist], [issue/1369], [pull/1370]**
To be able to use these commands when the output directory option to the build command isn't the default pkg.
[issue/1369]: https://github.com/rustwasm/wasm-pack/issues/1369
[pull/1370]: https://github.com/rustwasm/wasm-pack/pull/1370
[danielronnkvist]: https://github.com/danielronnkvist
- **Optimize out-dir display - [ahaoboy], [issue/1395], [pull/1396]**
Optimize out-dir display.
from:
`[INFO]: 📦 Your wasm pkg is ready to publish at /root/code/fib-wasm/fib-rs/../fib-wasm/wasm.`
to:
`[INFO]: 📦 Your wasm pkg is ready to publish at /root/code/fib-wasm/fib-wasm/wasm.`
[issue/1395]: https://github.com/rustwasm/wasm-pack/issues/1395
[pull/1396]: https://github.com/rustwasm/wasm-pack/pull/1396
[ahaoboy]: https://github.com/ahaoboy
- ### 🛠️ Maintenance
- **Fix error and warnings in install script - [lucashorward], [issue/1159], [issue/1217], [issue/1283], [pull/1320]**
[issue/1159]: https://github.com/rustwasm/wasm-pack/issues/1159
[issue/1217]: https://github.com/rustwasm/wasm-pack/issues/1217
[issue/1283]: https://github.com/rustwasm/wasm-pack/issues/1283
[pull/1320]: https://github.com/rustwasm/wasm-pack/pull/1320
[lucashorward]: https://github.com/lucashorward
- **Bump follow-redirects from 1.14.9 to 1.15.6 in /npm - [dependabot], [pull/1375]**
[pull/1375]: https://github.com/rustwasm/wasm-pack/pull/1375
- **Bump rustls-webpki from 0.100.1 to 0.100.2 - [dependabot], [pull/1323]**
[pull/1341]: https://github.com/rustwasm/wasm-pack/pull/1341
- **Bump rustix from 0.37.20 to 0.37.25 - [dependabot], [pull/1341]**
[pull/1323]: https://github.com/rustwasm/wasm-pack/pull/1323
[dependabot]: https://github.com/apps/dependabot
- **Bump rustls from 0.21.9 to 0.21.11 - [dependabot], [pull/1385]**
[pull/1385]: https://github.com/rustwasm/wasm-pack/pull/1385
[dependabot]: https://github.com/apps/dependabot
- **Bump tar from 6.1.11 to 6.2.1 in /npm - [dependabot], [pull/1379]**
[pull/1379]: https://github.com/rustwasm/wasm-pack/pull/1379
[dependabot]: https://github.com/apps/dependabot
- ### 📖 Documentation
- **Fix typo in README - [Lionelf329], [pull/1368]**
[pull/1268]: https://github.com/rustwasm/wasm-pack/pull/1368
[Lionelf329]: https://github.com/Lionelf329
- **Add a description of build --target deno - [puxiao], [pull/1344]**
[pull/1344]: https://github.com/rustwasm/wasm-pack/pull/1344
[puxiao]: https://github.com/puxiao
- **Document deno in build target - [sigmaSd], [pull/1348]**
[pull/1348]: https://github.com/rustwasm/wasm-pack/pull/1348
[sigmaSd]: https://github.com/sigmaSd
- **Fix local navigation backing one step too far in docs - [SamuSoft], [pull/1387]**
[pull/1387]: https://github.com/rustwasm/wasm-pack/pull/1387
[SamuSoft]: https://github.com/SamuSoft
- **Add --target web to quick start build command - [josephrocca], [pull/1367]**
[pull/1367]: https://github.com/rustwasm/wasm-pack/pull/1367
[josephrocca]: https://github.com/josephrocca
## ☀️ 0.12.1
- ### 🤕 Fixes
- **Restore --version command - [lynn], [issue/1301], [pull/1305]**
The --version command got lost in space in v0.12.0. It's now brought back!
[issue/1301]: https://github.com/rustwasm/wasm-pack/issues/1301
[pull/1305]: https://github.com/rustwasm/wasm-pack/pull/1305
[lynn]: https://github.com/lynn
- **Fix value parser for Option<PathBuf> - [Myriad-Dreamin], [issue/1304], [pull/1307]**
A value parser for OsString cannot parse a command line argument for Option<PathBuf>,
which let it failed to specify paths for pack, publish and test commands, this faulty behavior
was introduced in v0.12.0.
[issue/1304]: https://github.com/rustwasm/wasm-pack/issues/1304
[pull/1307]: https://github.com/rustwasm/wasm-pack/pull/1307
[Myriad-Dreamin]: https://github.com/Myriad-Dreamin
## ☀️ 0.12.0
- ### ✨ Features
- **Add --no-pack flag to build command - [hamza1311], [ashleygwilliams], [issue/691], [issue/811], [pull/695], [pull/1291]**
When calling wasm-pack build a user can optionally pass --no-pack and wasm-pack will build your wasm, generate js, and not build a package.json.
[issue/691]: https://github.com/rustwasm/wasm-pack/issues/691
[issue/811]: https://github.com/rustwasm/wasm-pack/issues/811
[pull/695]: https://github.com/rustwasm/wasm-pack/pull/695
[pull/1291]: https://github.com/rustwasm/wasm-pack/pull/1291
[ashleygwilliams]: https://github.com/ashleygwilliams
- **Add wasmbindgen option: omit_default_module_path - [matthiasgeihs], [pull/1272]**
Adds an option to call wasm-bindgen with --omit_default_module_path.
[pull/1272]: https://github.com/rustwasm/wasm-pack/pull/1272
[matthiasgeihs]: https://github.com/matthiasgeihs
- ### 🤕 Fixes
- **Add HTTP header USER-AGENT - [LeviticusNelson], [issue/1266], [pull/1285]**
We encountered some issues when we didn't send an User-Agent. This is now fixed.
[issue/1266]: https://github.com/rustwasm/wasm-pack/issues/1266
[pull/1285]: https://github.com/rustwasm/wasm-pack/pull/1285
[LeviticusNelson]: https://github.com/LeviticusNelson
- **Replace curl with ureq - [hamza1311], [issue/650], [issue/823], [issue/997], [issue/1079], [issue/1203], [issue/1234], [issue/1281], [pull/1290]**
The HTTP client is now pure Rust. Removes the dependency of openssl which have caused a lot of issues for people using wasm-pack on various distributions.
[issue/650]: https://github.com/rustwasm/wasm-pack/issues/650
[issue/823]: https://github.com/rustwasm/wasm-pack/issues/823
[issue/997]: https://github.com/rustwasm/wasm-pack/issues/997
[issue/1079]: https://github.com/rustwasm/wasm-pack/issues/1079
[issue/1203]: https://github.com/rustwasm/wasm-pack/issues/1203
[issue/1234]: https://github.com/rustwasm/wasm-pack/issues/1234
[issue/1281]: https://github.com/rustwasm/wasm-pack/issues/1281
[pull/1290]: https://github.com/rustwasm/wasm-pack/pull/1290
[hamza1311]: https://github.com/hamza1311
- **Update binary-install to 0.2.0. binary-install replaced curl with ureq - [drager]**
See [PR](https://github.com/rustwasm/binary-install/pull/24) in binary-install repo for more information.
[drager]: https://github.com/drager
- **Remove --always-auth from npm login - [EstebanBorai], [pull/1288]**
npm login doesn't support --always-auth anymore, instead it is under the adduser subcommand.
[pull/1288]: https://github.com/rustwasm/wasm-pack/pull/1288
[EstebanBorai]: https://github.com/EstebanBorai
- **Turn off cargo colors during log level test - [dtolnay], [pull/1294]**
[pull/1294]: https://github.com/rustwasm/wasm-pack/pull/1294
[dtolnay]: https://github.com/dtolnay
- **Fix getting the target-dir in wasm_bindgen_build - [tomasol], [issue/1278], [pull/1279]**
Fixes a wasm-pack panic if --target-dir was supplied (and arguments are not sorted).
[issue/1278]: https://github.com/rustwasm/wasm-pack/issues/1278
[pull/1279]: https://github.com/rustwasm/wasm-pack/pull/1279
[tomasol]: https://github.com/tomasol
- **Respect package.readme in Cargo.toml - [heaths], [issue/1215], [pull/1298], [pull/1216]**
wasm-pack now respects specifying readme=false:
```toml
[package]
readme = false
```
[issue/1215]: https://github.com/rustwasm/wasm-pack/issues/1215
[pull/1298]: https://github.com/rustwasm/wasm-pack/pull/1298
[pull/1216]: https://github.com/rustwasm/wasm-pack/pull/1216
[heaths]: https://github.com/heaths
- ### 📖 Documentation
- **Don't hide install options behind link - [oyamauchi], [issue/355], [pull/1242]**
[issue/355]: https://github.com/rustwasm/wasm-pack/issues/355
[pull/1242]: https://github.com/rustwasm/wasm-pack/issues/1242
[oyamauchi]: https://github.com/oyamauchi
- ### 🛠️ Maintenance
- **Bump cargo-generate version to 0.18.2 - [sassman], [issue/1245] [pull/1269]**
[issue/1245]: https://github.com/rustwasm/wasm-pack/issues/1245
[pull/1269]: https://github.com/rustwasm/wasm-pack/pull/1269
[sassman]: https://github.com/sassman
- **Replace unmaintained actions-rs/toolchain action in CI workflows - [striezel], [pull/1246]**
Now we are using https://github.com/dtolnay/rust-toolchain instead.
[pull/1246]: https://github.com/rustwasm/wasm-pack/pull/1246
[striezel]: https://github.com/striezel
- **Update several dependencies - [hamza1311], [pull/1292]**
Updated clap, toml, predicates and serial_test to their latest versions.
[pull/1292]: https://github.com/rustwasm/wasm-pack/pull/1292
## 🌦️ 0.11.1
- ### 🤕 Fixes
- **Fix discovery of locally installed `wasm-opt` - [Liamolucko], [issue/1247], [pull/1257]**
[issue/1247]: https://github.com/rustwasm/wasm-pack/issues/1247
[pull/1257]: https://github.com/rustwasm/wasm-pack/pull/1257
[Liamolucko]: https://github.com/Liamolucko
- **Fix wasm-pack bin script entry - [ahippler], [issue/1248], [pull/1250]**
[issue/1248]: https://github.com/rustwasm/wasm-pack/issues/1248
[pull/1250]: https://github.com/rustwasm/wasm-pack/pull/1250
[ahippler]: https://github.com/ahippler
- ### 🛠️ Maintenance
- **bump openssl from 0.10.46 to 0.10.48 - [pull/1254]**
[pull/1254]: https://github.com/rustwasm/wasm-pack/pull/1254
## 🌦️ 0.11.0
- ### ✨ Features
- **Make Deno target available - [egfx-notifications], [issue/672], [issue/879], [pull/1117]**
[issue/672]: https://github.com/rustwasm/wasm-pack/issues/672
[issue/879]: https://github.com/rustwasm/wasm-pack/issues/879
[pull/1117]: https://github.com/rustwasm/wasm-pack/pull/1117
[egfx-notifications]: https://github.com/egfx-notifications
- **Add support for more platforms to installer script - [omninonsense], [issue/1064], [issue/952], [issue/1125], [pull/1122]**
This makes the installation script work on M1 macs, as well as inside docker (especially when combined with buildx) for aarch64/arm64 architectures.
[issue/1064]: https://github.com/rustwasm/wasm-pack/issues/1064
[issue/952]: https://github.com/rustwasm/wasm-pack/issues/952
[issue/1125]: https://github.com/rustwasm/wasm-pack/issues/1125
[pull/1122]: https://github.com/rustwasm/wasm-pack/pull/1122
[omninonsense]: https://github.com/omninonsense
- **Add Linux arm64 support - [nnelgxorz], [issue/1169], [pull/1170]**
[issue/1169]: https://github.com/rustwasm/wasm-pack/issues/1169
[pull/1170]: https://github.com/rustwasm/wasm-pack/pull/1170
[nnelgxorz]: https://github.com/nnelgxorz
- **Add support for workspace inheritance - [printfn], [issue/1180], [pull/1185]**
[issue/1180]: https://github.com/rustwasm/wasm-pack/issues/1180
[pull/1185]: https://github.com/rustwasm/wasm-pack/pull/1185
- ### 🤕 Fixes
- **--target-dir as extra option is now considered as expected - [sassman], [issue/1076], [pull/1082]**
[issue/1076]: https://github.com/rustwasm/wasm-pack/issues/1076
[pull/1082]: https://github.com/rustwasm/wasm-pack/pull/1082
[sassman]: https://github.com/sassman
- **Pass through --weak-refs --reference-types flags to bindgen - [serprex], [issue/930], [pull/937]**
[issue/930]: https://github.com/rustwasm/wasm-pack/issues/930
[pull/937]: https://github.com/rustwasm/wasm-pack/pull/937
[serprex]: https://github.com/serprex
- **Fix binaryen URL and use updated binary-install to fix installation on macOS - [matheus23], [printfn], [pull/1188]**
Use the updated binary-install crate (rustwasm/binary-install#21), switches from failure to anyhow to match what binary-install uses, and fixes wasm-opt installation on macOS.
[pull/1188]: https://github.com/rustwasm/wasm-pack/pull/1188
[matheus23]: https://github.com/matheus23
[printfn]: https://github.com/printfn
[rustwasm/binary-install#21]: https://github.com/rustwasm/binary-install/pull/21
- **Mark snippets and the bundler target's main file as having side effects - [Liamolucko], [issue/972], [rustwasm/wasm-bindgen/3276], [pull/1224]**
[issue/972]: https://github.com/rustwasm/wasm-pack/issues/972
[rustwasm/wasm-bindgen/3276]: https://github.com/rustwasm/wasm-bindgen/issues/3276
[pull/1224]: https://github.com/rustwasm/wasm-pack/pull/1224
[Liamolucko]: https://github.com/Liamolucko
- ### 📖 Documentation
- **Fix typos in non-rustup-setups.md - [dallasbrittany], [issue/1141], [pull/1142]**
[issue/1141]: https://github.com/rustwasm/wasm-pack/issues/1141
[pull/1142]: https://github.com/rustwasm/wasm-pack/issues/1141
[dallasbrittany]: https://github.com/dallasbrittany
- **Fix typos in considerations.md - [lhjt], [pull/1066]**
[pull/1066]: https://github.com/rustwasm/wasm-pack/pull/1066
[lhjt]: https://github.com/lhjt
- **Grammar and typo fixes - [helixbass], [pull/1143]**
[pull/1143]: https://github.com/rustwasm/wasm-pack/pull/1143
[helixbass]: https://github.com/helixbass
- **Replace two mentions of wasm-pack init with wasm-pack build in the docs - [mstange], [pull/1086]**
[pull/1086]: https://github.com/rustwasm/wasm-pack/pull/1086
[mstange]: https://github.com/mstange
- **Update npm installation link - [benediktwerner], [pull/1227]**
[pull/1227]: https://github.com/rustwasm/wasm-pack/pull/1227
[benediktwerner]: https://github.com/benediktwerner
- ### 🛠️ Maintenance
- **Bump wasm-opt to version 108 - [MichaelMauderer], [issue/1135] [pull/1136]**
[pull/1136]: https://github.com/rustwasm/wasm-pack/pull/1136
[issue/1135]: https://github.com/rustwasm/wasm-pack/issues/1135
[MichaelMauderer]: https://github.com/MichaelMauderer
- **Update binary-install to v1.0.1 - [EverlastingBugstopper], [pull/1130]**
[pull/1130]: https://github.com/rustwasm/wasm-pack/pull/1130
- **Add back run.js to npm installer - [EverlastingBugstopper], [pull/1149]**
[pull/1149]: https://github.com/rustwasm/wasm-pack/pull/1149
- **Fix some typos in the codebase - [striezel], [pull/1220]**
[pull/1220]: https://github.com/rustwasm/wasm-pack/pull/1220
[striezel]: https://github.com/striezel
- **Update actions/checkout in GitHub Actions workflows to v3 - [striezel], [pull/1221]**
[pull/1221]: https://github.com/rustwasm/wasm-pack/pull/1221
- **Update actions/cache in GitHub Actions workflows to v3 - [striezel], [pull/1222]**
[pull/1222]: https://github.com/rustwasm/wasm-pack/pull/1222
- **Update JamesIves/github-pages-deploy-action in GHA workflow to v4.4.1 - [striezel], [pull/1223]**
[pull/1223]: https://github.com/rustwasm/wasm-pack/pull/1223
## 🌦️ 0.10.3
- ### 🤕 Fixes
- **Use bash to create release tarballs - [nasso], [issue/1097] [pull/1144]**
Fixes Windows installer failure due to malformatted tar.
[pull/1144]: https://github.com/rustwasm/wasm-pack/pull/1144
[issue/1097]: https://github.com/rustwasm/wasm-pack/issues/1097
[nasso]: https://github.com/nasso
- **Clean up package.json from previous runs - [main--], [issue/1110-comment] [pull/1119]**
Remove the package.json file from previous runs to avoid crashes.
[pull/1119]: https://github.com/rustwasm/wasm-pack/pull/1119
[issue/1110-comment]: https://github.com/rustwasm/wasm-pack/pull/1110#issuecomment-1059008962
[main--]: https://github.com/main--
- **Do not remove the pkg directory - [huntc], [issue/1099] [pull/1110]**
A recent change ensured that the pkg directory was removed as the first step of attempting to create it.
Unfortunately, this caused a problem for webpack when watching the pkg directory.
Webpack was unable to recover its watching and so any watch server must be restarted,
which is a blocker when using it. This PR and release fixes this.
[pull/1110]: https://github.com/rustwasm/wasm-pack/pull/1110
[issue/1099]: https://github.com/rustwasm/wasm-pack/issues/1099
[huntc]: https://github.com/huntc
- **Bump regex from 1.5.4 to 1.5.6 - [dependabot], [pull/1147]**
Version 1.5.5 of the regex crate fixed a security bug in the regex compiler.
[pull/1147]: https://github.com/rustwasm/wasm-pack/pull/1147
- **Bump openssl-src from 111.17.0+1.1.1m to 111.20.0+1.1.1o - [dependabot], [pull/1146]**
Bring in bug fixes from the new version of openssl-src.
[pull/1146]: https://github.com/rustwasm/wasm-pack/pull/1146
[dependabot]: https://github.com/apps/dependabot
## 🌦️ 0.10.2
- ### ✨ Features
- **Implement support for RFC 8, transitive NPM dependencies - [jpgneves], [issue/606] [pull/986]**
[pull/986]: https://github.com/rustwasm/wasm-pack/pull/986
[issue/606]: https://github.com/rustwasm/wasm-pack/issues/606
[jpgneves]: https://github.com/jpgneves
- ### 🤕 Fixes
- **Add support for macos aarch64 - [d3lm], [issue/913] [pull/1088]**
This fixes aarch64 for MacOS and will download x86_64-apple-darwin.
[pull/1088]: https://github.com/rustwasm/wasm-pack/pull/1088
[issue/913]: https://github.com/rustwasm/wasm-pack/issues/913
[d3lm]: https://github.com/d3lm
- **Add linux/arm64 to release workflow - [nacardin], [issue/1064] [pull/1065]**
[pull/1065]: https://github.com/rustwasm/wasm-pack/pull/1065
[issue/1064]: https://github.com/rustwasm/wasm-pack/issues/1064
[nacardin]: https://github.com/nacardin
- **Force axios version - [drager], [pull/1094]**
Forces npm package `axios` to version `0.21.2` in order to get security fix for a security vulnerability present in axios
before version `0.21.2`.
[pull/1094]: https://github.com/rustwasm/wasm-pack/pull/1094
- ### 📖 Documentation
- **Update docs for how to pass extra options to cargo - [FrankenApps], [issue/1059] [pull/1073]**
[FrankenApps]: https://github.com/FrankenApps
[pull/1073]: https://github.com/rustwasm/wasm-pack/pull/1073
[issue/1059]: https://github.com/rustwasm/wasm-pack/issues/1059
## 🌦️ 0.10.1
- ### 🤕 Fixes
- **Add exe to binary name if windows - [drager], [issue/1038] [pull/1055]**
[pull/1055]: https://github.com/rustwasm/wasm-pack/pull/1055
[issue/1038]: https://github.com/rustwasm/wasm-pack/issues/1038
## 🌦️ 0.10.0
- ### ✨ Features
- **Added keywords - [lucashorward], [issue/707] [pull/838]**
`package.json` files usually contain a keywords array so that npm can make searching easier.
This PR extracts keywords from `Cargo.toml` and puts them into `package.json`.
[lucashorward]: https://github.com/lucashorward
[pull/838]: https://github.com/rustwasm/wasm-pack/pull/838
[issue/707]: https://github.com/rustwasm/wasm-pack/issues/707
- ### 🤕 Fixes
- **Update binary-install to get fix for axios security vulnerability - [simlay], [Rizary], [issue/958] [pull/973] [pull/1012]**
Updates `binary-install` npm package to version `^0.1.0` in order to get security fix for a security vulnerability in axios.
[simlay]: https://github.com/simlay
[rizary]: https://github.com/Rizary
[pull/973]: https://github.com/rustwasm/wasm-pack/pull/973
[pull/1012]: https://github.com/rustwasm/wasm-pack/pull/1012
[issue/958]: https://github.com/rustwasm/wasm-pack/issues/958
- **Fix cargo-generate installation - [bradyjoslin], [issue/975] [issue/907] [pull/983]**
`wasm-pack new hello-wasm` didn't work due to a bad link when trying to install `cargo-generate`.
This PR points the installation to the correct place and makes `wasm-pack new` working again!
[bradyjoslin]: https://github.com/bradyjoslin
[pull/983]: https://github.com/rustwasm/wasm-pack/pull/983
[issue/975]: https://github.com/rustwasm/wasm-pack/issues/975
[issue/907]: https://github.com/rustwasm/wasm-pack/issues/907
- **Pass through extra options when building tests - [azriel91], [issue/698] [pull/851]**
`wasm-pack test` accepts extra options to pass through to `cargo` when running tests.
Under the hood, this runs `cargo build` before `cargo test`, and the additional options were only passed through to the `test` command. This meant that crates that enabled native features by default could not be built using `wasm-pack`, as it would attempt to build tests for the `wasm32-unknown-unknown` target with the native features enabled.
This PR passes through the extra options to `cargo` when building the tests as well.
[azriel91]: https://github.com/azriel91
[pull/851]: https://github.com/rustwasm/wasm-pack/pull/851
[issue/698]: https://github.com/rustwasm/wasm-pack/issues/698
- **Corrected files included in package.json for bundler / no target - [lucashorward], [issue/837] [pull/839]**
`wasm-pack build` and `wasm-pack build --target bundler` generates a \_bg.js file, but it was not added to the `package.json`.
The file that is added, \*.js will however reference the \_bg.js, so when the package was distributed (both through pack or publish) it is not usable.
This PR includes that \_bg.js file in `package.json`.
[pull/839]: https://github.com/rustwasm/wasm-pack/pull/839
[issue/837]: https://github.com/rustwasm/wasm-pack/issues/837
- **Find the main package if multiple packages have the same name - [ghost], [pull/830]**
If there were 2 packages with the same name, `wasm-pack` would sometimes use the wrong one and errored.
[ghost]: https://github.com/ghost
[pull/830]: https://github.com/rustwasm/wasm-pack/pull/830
[issue/829]: https://github.com/rustwasm/wasm-pack/issues/829
- ### 📖 Documentation
- **Remove duplicated "is" in the wee_alloc tutorial- [pione30], [issue/1003] [pull/1004]**
[pione30]: https://github.com/pione30
[pull/1004]: https://github.com/rustwasm/wasm-pack/pull/1004
[issue/1003]: https://github.com/rustwasm/wasm-pack/issues/1003
- **Fix TOC links - [Swaagie], [pull/1007]**
[swaagie]: https://github.com/Swaagie
[pull/1007]: https://github.com/rustwasm/wasm-pack/pull/1007
- **Remove outdated TOC heading- [gthb], [pull/1011]**
[gthb]: https://github.com/gthb
[pull/1011]: https://github.com/rustwasm/wasm-pack/pull/1011
- **Add link to template repo - [milahu], [pull/942]**
[milahu]: https://github.com/milahu
[pull/942]: https://github.com/rustwasm/wasm-pack/pull/942
- **Remove greenkeeper reference - [cdvv7788], [crotwell], [issue/1001] [pull/844] [pull/1002]**
[cdvv7788]: https://github.com/cdvv7788
[crotwell]: https://github.com/crotwell
[pull/844]: https://github.com/rustwasm/wasm-pack/pull/844
[pull/1002]: https://github.com/rustwasm/wasm-pack/pull/1002
[issue/1001]: https://github.com/rustwasm/wasm-pack/issues/1001
- ### 🛠️ Maintenance
- **Fix CI. Remove appveyor and travis and use Github actions - [ashleygwilliams], [drager], [issue/594] [issue/979] [pull/947]**
[pull/947]: https://github.com/rustwasm/wasm-pack/pull/947
[issue/594]: https://github.com/rustwasm/wasm-pack/issues/594
[issue/979]: https://github.com/rustwasm/wasm-pack/issues/979
- **Cargo update - [ashleygwilliams], [pull/800]**
[ashleygwilliams]: https://github.com/ashleygwilliams
[pull/800]: https://github.com/rustwasm/wasm-pack/pull/800
- **Remove dirs dependency - [brightly-salty], [issue/943] [pull/944]**
[brightly-salty]: https://github.com/brightly-salty
[pull/944]: https://github.com/rustwasm/wasm-pack/pull/944
[issue/943]: https://github.com/rustwasm/wasm-pack/issues/943
- **Fix logs for uniformity - [petosorus], [issue/716] [pull/723]**
[petosorus]: https://github.com/petosorus
[pull/723]: https://github.com/rustwasm/wasm-pack/pull/723
[issue/716]: https://github.com/rustwasm/wasm-pack/issues/716
- **Fixing build error - [Pauan], [pull/841]**
[pull/841]: https://github.com/rustwasm/wasm-pack/pull/841
## ☁️ 0.9.1
- ### 🤕 Fixes
- **Bump binaryen to version_90 - [ashleygwilliams], [issue/781] [issue/782] [pull/687]**
Previously, wasm-pack was hardcoded to install and attempt to execute wasm-opt on every build
using binaryen version 78. This version had various issues on Unix/Linux and caused broken CI
builds for many folks (we're so sorry!).
This PR updates the binaryen version to 90, which should fix the issues folks were having.
Long-term, we'd like to create an auto-updating mechanism so that we can install and use the
latest release of binaryen as we do for other binaries we orchestrate.
[ashleygwilliams]: https://github.com/ashleygwilliams
[pull/687]: https://github.com/rustwasm/wasm-pack/pull/687
[issue/782]: https://github.com/rustwasm/wasm-pack/issues/782
[issue/781]: https://github.com/rustwasm/wasm-pack/issues/781
- ### 🛠️ Maintenance
- **Consolidate wasm-opt installation into existing binary install logic - [ashleygwilliams], [issue/685] [pull/687]**
[ashleygwilliams]: https://github.com/ashleygwilliams
[pull/687]: https://github.com/rustwasm/wasm-pack/pull/687
[issue/685]: https://github.com/rustwasm/wasm-pack/issues/685
## 🌥️ 0.9.0
- ### ✨ Features
- **Adding in `--quiet` and `--log-level` flags to control the console output - [Pauan], [pull/694]**
The `--verbose` flag has long existed as a way to get more console output, but now there are two flags to get _less_ console output:
- `--quiet` will silence _all_ stdout, so only errors will be displayed.
- `--log-level` can be used to silence `[INFO]` or `[WARN]` output from wasm-pack.
You can cause it to display even _more_ information by using `--verbose`, or you can silence _all_ stdout by using `--quiet`.
You can also use `--log-level` to have fine-grained control over wasm-pack's log output:
- `--log-level info` is the default, it causes all messages to be logged.
- `--log-level warn` causes warnings and errors to be displayed, but not info.
- `--log-level error` causes only errors to be displayed.
These flags are global flags, so they can be used with every command, and they must come _before_ the command:
```sh
wasm-pack --log-level error build
wasm-pack --quiet build
```
[Pauan]: https://github.com/Pauan
[pull/694]: https://github.com/rustwasm/wasm-pack/pull/694
- **Wrap `cargo-generate` with `wasm-pack new` - [ashleygwilliams], [issue/373] [pull/623]**
One of the first steps in getting started with `wasm-pack` is to `cargo install cargo-generate` to bootstrap some project templates. This can take a while and is an extra burden on users just getting started with `wasm-pack`. `wasm-pack new` uses `cargo-generate` to bootstrap new projects, removing the need to install the tool on your own. You can read more about this feature [here](https://github.com/rustwasm/wasm-pack/blob/master/docs/src/commands/new.md).
[ashleygwilliams]: https://github.com/ashleygwilliams
[pull/623]: https://github.com/rustwasm/wasm-pack/pull/623
[issue/373]: https://github.com/rustwasm/wasm-pack/issues/373
- **Allow `wasm-pack` to be run from subdirectories - [gameldar], [issue/620] [pull/624]**
If a crate path is not specified when running `wasm-pack` and there is no `Cargo.toml` in the current working directory, `wasm-pack` will walk up the directory structure to find a `Cargo.toml`.
[gameldar]: https://github.com/gameldar
[pull/624]: https://github.com/rustwasm/wasm-pack/pull/624
[issue/620]: https://github.com/rustwasm/wasm-pack/issues/620
- **Automatically execute `wasm-opt` on produced binaries - [alexcrichton], [issue/159] [pull/625]**
When `wasm-pack` builds binaries in released and profiling modes, it will execute `wasm-opt` on the binary, making the result smaller and more performant.
[alexcrichton]: https://github.com/alexcrichton
[pull/625]: https://github.com/rustwasm/wasm-pack/pull/625
[issue/159]: https://github.com/rustwasm/wasm-pack/issues/159
- **Helpful error message when wasm-bindgen fails because of an old version - [gameldar], [ashleygwilliams], [issue/627] [pull/633]**
`wasm-pack` will pass a `--web` flag to `wasm-bindgen` when `wasm-pack build --target web` is run. Before, if the user had an old version of `wasm-bindgen` in their dependencies, they would receive a cryptic error message. Now they will be notified that they need to update their `wasm-bindgen` dependency if they want to build for the `web` target.
[gameldar]: https://github.com/gameldar
[pull/633]: https://github.com/rustwasm/wasm-pack/pull/633
[issue/627]: https://github.com/rustwasm/wasm-pack/issues/627
- **Publish releases by tag to npm - [Tarnadas], [pull/690]**
You can now use `wasm-pack publish` to publish tagged releases with the optional `--tag` argument. You can read more about [distribution tags](https://docs.npmjs.com/cli/dist-tag) on NPM, and more about this feature in [our docs](https://github.com/Tarnadas/wasm-pack/blob/master/docs/src/commands/pack-and-publish.md#publishing-tagged-releases).
[Tarnadas]: https://github.com/Tarnadas
[pull/690]: https://github.com/rustwasm/wasm-pack/pull/690
- ### 🤕 Fixes
- **Only use exactly v0.24.0 geckodriver on Windows - [ashleygwilliams], [issue/770] [pull/774]**
`wasm-pack test` is a great way to test your web Wasm modules- and it very nicely sets up and configures
the necessary browser engine drivers to do so!
For the v0.25.0 release of geckodriver, the team switched their build environment- which introduced a new
surprise runtime dependency, Visual C++ redistributable package, to their windows binaries. You can read
more about the issue here, [mozilla/geckodriver/issue/1617].
Becuase the introduction of this runtime dependency is considered a bug, and should be eventually fixed,
the team decided that the least invasive solution would be to hold geckodriver binaries, on Windows, at
v0.24.0, and to disable the auto-update logic, until the bug is fixed.
[ashleygwilliams]: https://github.com/ashleygwilliams
[issue/770]: https://github.com/rustwasm/wasm-pack/issues/770
[pull/774]: https://github.com/rustwasm/wasm-pack/pull/774
[mozilla/geckodriver/issue/1617]: https://github.com/mozilla/geckodriver/issues/1617#issuecomment-532168958
- **Handle version check failures - [drager], [issue/652], [issue/653] [pull/660]**
Every day, `wasm-pack` checks the crates.io API for the latest version number and lets the user know if their installation is out of date. Now, when these API calls fail, `wasm-pack` alerts the user of the failure and waits until the next day to make another call to crates.io.
[drager]: https://github.com/drager
[pull/660]: https://github.com/rustwasm/wasm-pack/pull/660
[issue/652]: https://github.com/rustwasm/wasm-pack/issues/652
[issue/653]: https://github.com/rustwasm/wasm-pack/issues/653
- **Add user agent for version check - [drager], [issue/651] [pull/658]**
crates.io requires tools to set a version check `User-Agent` header when requesting the latest version. Now, when `wasm-pack` performs an API request to crates.io, it sends `User-Agent: wasm-pack/0.9.0`.
[drager]: https://github.com/drager
[pull/658]: https://github.com/rustwasm/wasm-pack/pull/658
[issue/651]: https://github.com/rustwasm/wasm-pack/issues/651
- **Remove broken link from the README - [drager], [pull/635]**
[drager]: https://github.com/drager
[pull/635]: https://github.com/rustwasm/wasm-pack/pull/635
- **Make `sideEffects` in generated `package.json` a boolean instead of a string - [rhysd], [pull/649]**
[rhysd]: https://github.com/rhysd
[pull/649]: https://github.com/rustwasm/wasm-pack/pull/649
- **Don't warn if license-file is present - [ashleygwilliams], [issue/692] [pull/693]**
Previously, `wasm-pack` would warn that the `license` field was missing if the `license-file` field was used instead. This warning is now only surfaced if both `license` and `license-field` are absent from a `Cargo.toml`.
[ashleygwilliams]: https://github.com/ashleygwilliams
[pull/693]: https://github.com/rustwasm/wasm-pack/pull/693
[issue/692]: https://github.com/rustwasm/wasm-pack/issues/692
- **Select correct webdriver version - [MartinKavik], [issue/611] [pull/706]**
`wasm-pack` used to install a pinned version of the Chrome, Gecko, and Safari drivers. Now when a driver needs to be installed, `wasm-pack` will pull the latest version from the API and install that instead.
[MartinKavik]: https://github.com/MartinKavik
[pull/706]: https://github.com/rustwasm/wasm-pack/pull/706
[issue/611]: https://github.com/rustwasm/wasm-pack/issues/611
- **Only run node tests on `wasm-pack test --node` - [alexcrichton], [pull/630]**
[alexcrichton]: https://github.com/alexcrichton
[pull/630]: https://github.com/rustwasm/wasm-pack/pull/630
- **Fix npm installs for Windows Users - [EverlastingBugstopper], [issue/757] [pull/759]**
We recently published `wasm-pack` on the npm registry but forgot to test on Windows! `npm install -g wasm-pack` now works on Windows machines.
[EverlastingBugstopper]: https://github.com/EverlastingBugstopper
[pull/759]: https://github.com/rustwasm/wasm-pack/pull/759
[issue/757]: https://github.com/rustwasm/wasm-pack/issues/757
- **Clean up `cargo test` warnings - [ashleygwilliams], [issue/752] [pull/753]**
Tests now use `std::sync::Once::new()` instead of the deprecated `std::sync::ONCE_INIT`
[ashleygwilliams]: https://github.com/ashleygwilliams
[pull/753]: https://github.com/rustwasm/wasm-pack/pull/753
[issue/752]: https://github.com/rustwasm/wasm-pack/issues/752
- ### 📖 Documentation
- **Document npm installer - [drager], [issue/751] [pull/767]**
[drager]: https://github.com/drager
[issue/751]: https://github.com/rustwasm/wasm-pack/issues/751
[pull/767]: https://github.com/rustwasm/wasm-pack/pull/767
- **Update help message for `build` and `publish` subcommands - [ibaryshnikov], [issue/636] [pull/640]**
`wasm-bindgen` recently changed the default target from `browser` to `bundler` and deprecated `browser`. This change is now reflected in the help message for `wasm-pack build`.
[ibaryshnikov]: https://github.com/ibaryshnikov
[pull/640]: https://github.com/rustwasm/wasm-pack/pull/640
[issue/636]: https://github.com/rustwasm/wasm-pack/issues/636
- **Add Release Checklist - [ashleygwilliams], [issue/370] [pull/626]**
While we try to automate releases of `wasm-pack` as much as possible, there are still some manual steps that need to be completed when releasing a new version (like writing a changelog 😉). These steps now live in [`RELEASE_CHECKLIST.md`](https://github.com/rustwasm/wasm-pack/blob/master/RELEASE_CHECKLIST.md).
[ashleygwilliams]: https://github.com/ashleygwilliams
[pull/626]: https://github.com/rustwasm/wasm-pack/pull/626
[issue/370]: https://github.com/rustwasm/wasm-pack/issues/370
- ### 🛠️ Maintenance
- **Ensure that `wasm-bindgen` generates move assertions - [fitzgen], [issue/677] [pull/683]**
`wasm-pack` now creates `wasm-bindgen` test fixtures that must generate move assertions for both free functions and methods.
[fitzgen]: https://github.com/fitzgen
[pull/683]: https://github.com/rustwasm/wasm-pack/pull/683
[issue/677]: https://github.com/rustwasm/wasm-pack/issues/677
- **Update `cargo_metadata` to v0.8.0 - [ThomasdenH], [pull/670]**
[ThomasdenH]: https://github.com/ThomasdenH
[pull/670]: https://github.com/rustwasm/wasm-pack/pull/670
- **Update `rustfmt` install snippet in PR template` - [data-pup], [issue/639] [pull/664]**
`rustfmt` is now available on Rust's stable channel so now the `wasm-pack` PR template recommends installing the stable version instead of the nightly version.
[data-pup]: https://github.com/data-pup
[pull/664]: https://github.com/rustwasm/wasm-pack/pull/664
[issue/639]: https://github.com/rustwasm/wasm-pack/issues/639
## 🛠️ 0.8.1
- ### 🤕 Fixes
- **Check for "rustup" rather than ".rustup" when checking for wasm32 - [drager], [issue/613][pull/616]**
When we introduced support for non-rustup setups we did a check if the user was
using rustup or not. However, this check was too constrained and only covered
the most common cases, but it did not work for Docker setups.
This PR addresses that and it now covers Docker setups as well!
When doing this fix we also found two other small issues which this PR also addresses.
The first is that we did not print the helpful error message when the wasm32 target
was not found and the other one was that it linked to the wrong section of the documentation.
[issue/613]: https://github.com/rustwasm/wasm-pack/issues/613
[pull/616]: https://github.com/rustwasm/wasm-pack/pull/616
## 🌤️ 0.8.0
- ### ✨ Features
- **Give user's ability to customize generated filenames with `--out-name` flag - [ibaryshnikov], [issue/596] [pull/599]**
When running `wasm-pack build`, several files are generated. These files
are named based on the name of the crate, as per your `Cargo.toml` file.
Sometimes- that's not the name you'd like your files to have!
You can now specify a custom name for the generated files using a new
flag, `--out-name`. Given a project called `dom`, here's a comparison of
the default and custom generated filenames:
```
wasm-pack build
# will produce files
# dom.d.ts dom.js dom_bg.d.ts dom_bg.wasm package.json README.md
wasm-pack build --out-name index
# will produce files
# index.d.ts index.js index_bg.d.ts index_bg.wasm package.json README.md
```
[ibaryshnikov]: https://github.com/ibaryshnikov
[issue/596]: https://github.com/rustwasm/wasm-pack/issues/596
[pull/599]: https://github.com/rustwasm/wasm-pack/pull/599
- ### 🤕 Fixes
- **Fix panics in `build mode --no-install` - [alexcrichton], [pull/598]**
This commit fixes the `wasm-pack build --mode no-install` command from
unconditionally panicking as well as `--mode force`. These steps were
calling an `unwrap()` on an internal `Option<T>` which was supposed to
be set during `step_install_wasm_bindgen`, but that step wasn't run in
these modes. The mode configuration of steps has been refactored
slightly to ensure that more steps are shared between these modes to
reduce duplication.
[pull/598]: https://github.com/rustwasm/wasm-pack/pull/598
- **Print unexpected panics to standard error - [drager], [issue/562] [pull/601]**
Unexpected panics are unfortunate but they're currently covered up and written
out to an auxiliary file. This makes panics in CI difficult to debug,
especially at a glance, as CI builders are likely not uploading those files.
This PR will print to standard error for unexpected panics and then let
`human_panic` handle panics, just like before.
[issue/562]: https://github.com/rustwasm/wasm-pack/issues/562
[pull/601]: https://github.com/rustwasm/wasm-pack/pull/601
- **Improve error message when `wasm32-unknown-unknown` is missing - [drager], [issue/579] [pull/602]**
For folks with non-rustup environments (which we only started supporting in
0.7.0!), we were giving a missing target error that was not helpful!
We've updated the error message to include more information, and we've added
some documentation to help explain how you can remedy the error by manually
installing the target on your specific rust setup- including the fact that
it may _not_ be possible to add the target to some setups.
Check out the docs [here](https://drager.github.io/wasm-pack/book/prerequisites/non-rustup-setups.html).
[issue/579]: https://github.com/rustwasm/wasm-pack/issues/579
[pull/602]: https://github.com/rustwasm/wasm-pack/pull/602
- ### 📖 Documentation
- **Document `--out-dir` flag - [ashleygwilliams], [issue/592] [pull/593]**
Recently, someone asked on Discord about customizing the name of the directory
that contains the assets built by `wasm-pack`. We've had the `out-dir` flag for
a while, but it wasn't documented! Now it is.
[issue/592]: https://github.com/rustwasm/wasm-pack/issues/592
[pull/593]: https://github.com/rustwasm/wasm-pack/pull/593
- **Fix broken links in docs and update for template changes - [drager], [ashleygwilliams], [issue/609] [pull/612] [pull/614]**
Recently, some improvements were made to the [`wasmpack-template`]. Additionally,
there were some broken links in the documentation. We've updated the docs for the
new template and fixed the broken links!
[issue/609]: https://github.com/rustwasm/wasm-pack/issues/609
[pull/612]: https://github.com/rustwasm/wasm-pack/pull/612
[pull/614]: https://github.com/rustwasm/wasm-pack/pull/614
- ### 🛠️ Maintenance
- **Move `binary-install` to its own repo - [drager], [issue/500] [pull/600]**
`binary-install` is a crate that holds the abstractions for how `wasm-pack` downloads
and caches pre-built binaries for the tools it wraps. It was originally part of the
`wasm-pack` code, then moved into a workspace as an independent crate. Now that we
believe it's stable, we've moved it into its own [repo](https://github.com/rustwasm/binary-install)!
[issue/500]: https://github.com/rustwasm/wasm-pack/issues/500
[pull/600]: https://github.com/rustwasm/wasm-pack/pull/600
## 🌤️ 0.7.0
- ### ✨ Features
- **Non `rustup` environment support - [drager], [pull/552]**
Before now, `wasm-pack` had a hard requirement that `rustup` had to be in the PATH. While most Rust users use
`rustup` there are variety reasons to have an environment that doesn't use `rustup`. With this PR, we'll now
support folks who are using a non-`rustup` environment!
[pull/552]: https://github.com/rustwasm/wasm-pack/pull/552
- **Improved CLI Output - [alexcrichton], [pull/547]**
It's hard to decide if this is a fix or a feature, but let's keep it positive! This PR moves `wasm-pack`'s CLI
output strategy closer to the desired standard we have for 1.0. This is important as it fixes many small bugs
that are distributed across a diveristy of terminals and difficult to test for locally.
This strategy was first introduced as a mini RFC in [issue/298], and then was discussed in a session at the Rust
All Hands ([notes](https://gist.github.com/fitzgen/23a62ebbd67574b9f6f72e5ac8eaeb67#file-road-to-wasm-pack-1-0-md)).
You'll notice that the spinner is gone- we eventually want to have one, but we'd like one that doesn't cause bugs!
If you have feedback about terminal support or an output bug, please [file an issue]! We want to hear from you!
Check out the new output in the `README` demo- or update your `wasm-pack` and take it for a spin!
[file an issue]: https://github.com/rustwasm/wasm-pack/issues/new/choose
[pull/547]: https://github.com/rustwasm/wasm-pack/pull/547
[issue/298]: https://github.com/rustwasm/wasm-pack/issues/298
- **Add support for `--target web` - [alexcrichton], [pull/567]**
Recently, `wasm-bindgen` add a new target- `web`. This new target is similar to the `no-modules` target, in that
it is designed to generate code that should be loaded directly in a browser, without the need of a bundler. As
opposed to the `no-modules` target, which produces an IIFE (Immediately Invoked Function Expression), this target
produces code that is an ES6 module.
You can use this target by running:
```
wasm-pack build --target web
```
Learn more about how to use this target by [checking out the docs!](https://drager.github.io/wasm-pack/book/commands/build.html#target)
[pull/567]: https://github.com/rustwasm/wasm-pack/pull/567
- **Support passing arbitrary arguments to `cargo test` via `wasm-pack test` - [chinedufn], [issue/525] [pull/530]**
`wasm-pack test` is an awesome command that wraps `cargo test` in a way that helps provide you some nice out of the
box configuration and setup. However, you may find yourself wanting to leverage the full funcationality of `cargo test`
by passing arguments that haven't been re-exported by the `wasm-pack test` interface.
For example, if you have a large test suite, it can be nice to simply run one test, or a subset of your tests.
`cargo test` supports this, however up until now, the `wasm-pack test` interface did not!
`wasm-pack test` now accepts passing and arbitrary set of arguments that it will forward along to its `cargo test` call
by allowing users to use `--` after any `wasm-pack test` arguments, followed by the set of arguments you'd like to pass
to `cargo test`.
For example:
```
# Anything after `--` gets passed to the `cargo test`
wasm-pack test --firefox --headless -- --package my-workspace-crate my_test_name --color=always
```
This will just run the `my_test_name` test and will output using color!
[See the `test` docs here!](https://rustwasm.github.io/docs/wasm-pack/commands/test.html)
[chinedufn]: https://github.com/chinedufn
[issue/525]: https://github.com/rustwasm/wasm-pack/issues/525
[pull/530]: https://github.com/rustwasm/wasm-pack/pull/530
- **Support `homepage` field of `Cargo.toml` and `package.json` - [rhysd], [pull/531]**
Both `Cargo.toml` and `package.json` support a `homepage` field that allow you to specify a website for
your project. We didn't support it previously (purely an accidental omission) - but now we do!
[pull/531]: https://github.com/rustwasm/wasm-pack/pull/531
- **Support `license-file` field in `Cargo.toml` - [rhysd], [pull/527]**
Sometimes, you want to provide a custom license, or specific license file that doesn't map to SPDX standard
licenses. In Rust/Cargo, you accomplish this by omitting the `license` field and including a `license-file`
field instead. You can read more about this in the [`cargo` manifest documentation].
In an npm package, this translates to `"license": "SEE LICENSE IN <filename>"` in your `package.json`. You can
read more about this in the [npm `package.json` documentation].
We previously only supported using SPDX standard licenses, by only supporting the `"license"` key in your
`Cargo.toml`- but now we'll allow you to leverage the `license-file` key as well, and will translate it
correctly into your `package.json`!
[`cargo` manifest documentation]: https://doc.rust-lang.org/cargo/reference/manifest.html
[npm `package.json` documentation]: https://docs.npmjs.com/files/package.json#license
[rhysd]: https://github.com/rhysd
[pull/527]: https://github.com/rustwasm/wasm-pack/pull/527
- ### 🤕 Fixes
- **`wasm-pack-init (1).exe` should work - [ashleygwilliams], [issue/518] [pull/550]**
Several users noted that when downloading a new version of `wasm-pack` their browser named the executable
file `wasm-pack-init (1).exe`. When named this way, the file didn't show the init instructions on execution.
This happened because the installation logic was requiring an exact match on filename. We've loosened that
restriction so that the filename must _start_ with `wasm-pack-init` and will still execute files with these
additional, extraneous charaters in the filename. Thanks so much to [Mblkolo] and [danwilhelm] for filing the
issue and the excellent discussion!
[issue/518]: https://github.com/rustwasm/wasm-pack/issues/518
[pull/550]: https://github.com/rustwasm/wasm-pack/pull/550
[Mblkolo]: https://github.com/Mblkolo
- **Fix chromedriver error and message on Windows for `wasm-pack test` - [jscheffner], [issue/535] [pull/537]**
When running `wasm-pack test` on a 64-bit Windows machine, users would receive an error:
`geckodriver binaries are unavailable for this target`. This error message had two issues- firstly, it accidentally
said "geckodriver" instead of "chromedriver", secondly, it threw an error instead of using the available 32-bit
chromedriver distribution. Chromedriver does not do a specific disribution for Windows 64-bit!
We've fixed the error message and have also ensured that 64-bit Windows users won't encounter an error, and will
appropriately fallback to the 32-bit Windows chromedriver.
[jscheffner]: https://github.com/jscheffner
[issue/535]: https://github.com/rustwasm/wasm-pack/issues/535
[pull/537]: https://github.com/rustwasm/wasm-pack/pull/537
- **Correct look up location for `wasm-bindgen` when it's installed via `cargo install` - [fitzgen], [pull/504]**
Sometimes, when a `wasm-bindgen` binary is not available, or if `wasm-pack` is being run on an architecture that
`wasm-bindgen` doesn't produce binaries for, instead of downloading a pre-built binary, `wasm-pack` will install
`wasm-bindgen` using `cargo install`. This is a great and flexible back up!
However, due to the last release's recent refactor to use a global cache, we overlooked the `cargo install` case
and did not look for `wasm-bindgen` in the appropriate location. As a result, this led to a bug where `wasm-pack`
would panic.
We've fixed the lookup for the `cargo install`'d `wasm-bindgen` by moving the `cargo-install`'d version to global
cache location for `wasm-pack` once it's successfully built. We also eliminated the panic in favor of
propagating an error. Thanks for your bug reports and sorry about the mistake!
[pull/504]: https://github.com/rustwasm/wasm-pack/pull/504
- **Only print `cargo test` output the once - [fitzgen], [issue/511] [pull/521]**
Due to some technical debt and churn in the part of the codebase that handles output, we were accidentally
printing the output of `cargo test` twice. Now we ensure that we print it only one time!
[issue/511]: https://github.com/rustwasm/wasm-pack/issues/511
[pull/521]: https://github.com/rustwasm/wasm-pack/pull/521
- ### 🛠️ Maintenance
- **Fix `clippy` warnings - [mstallmo], [issue/477] [pull/478]**
[`clippy`] is an awesome utilty that helps lint your Rust code for common optimizations and idioms. at the
beginning of `wasm-pack` development, `clippy` had not yet stablized, but it has since 1.0'd and it was
high time we leveraged it in `wasm-pack`. We still aren't _completely_ fixed, but we're working on it, and
we've already dervived a ton of value from the tool!
[`clippy`]: https://github.com/rust-lang/rust-clippy
[issue/477]: https://github.com/rustwasm/wasm-pack/issues/477
[pull/478]: https://github.com/rustwasm/wasm-pack/pull/478
- **Run `clippy` check on Travis - [drager], [pull/502]**
Now that `wasm-pack` has been clippified- we want to keep it that way! Now in addition to `cargo fmt` and
`cargo test`, we'll also run `cargo clippy` on all incoming PRs!
[pull/502]: https://github.com/rustwasm/wasm-pack/pull/502
- **Port tests to use `assert-cmd` - [fitzgen], [pull/522]**
[`assert_cmd`] is a great utility for testing CLI applications that is supported by the [CLI WG]. `wasm-pack`
development began before this library existed- so we were using a much less pleasant and efficient strategy
to test the CLI functionality of `wasm-pack`. Now we've ported over to using this great library!
[CLI WG]: https://www.rust-lang.org/what/cli
[`assert_cmd`]: https://crates.io/crates/assert_cmd
[pull/522]: https://github.com/rustwasm/wasm-pack/pull/522
- **Add initial tests for `binary-install` crate - [drager], [pull/517]**
In the last release, we separated some of our binary install logic into a new crate, `binary-install`.
However, that's about all we did... move the logic! In an effort to move the crate into true open source
status, [drager] has done some excellent work adding tests to the crate. This was trickier than it looked
and involved creating a test server! Thanks for all the efforts [drager], and the great review work [fitzgen]
and [lfairy]!
[pull/517]: https://github.com/rustwasm/wasm-pack/pull/517
[lfairy]: https://github.com/lfairy
- **Update tests `wasm-bindgen` version - [huangjj27], [issue/519] [issue/417] [pull/526]**
Our tests use fixtures that reference `wasm-bindgen` often, but the versions were not consistent or up to
date. As a result, the test suite leverage many version of `wasm-bindgen` which meant that they took a while
to run as they couldn't use the cached version of `wasm-bindgen` because the cached versions we slightly
different! Now they are up to date and consistent so the tests can perform better!
[pull/526]: https://github.com/rustwasm/wasm-pack/pull/526
[issue/519]: https://github.com/rustwasm/wasm-pack/issues/519
[issue/417]: https://github.com/rustwasm/wasm-pack/issues/417
- ### 📖 Documentation
- **Flag gh-pages docs as unpublished - [alexcrichton] [pull/565]**
Recently, [DebugSteven] made a PR to merge all the documentation for the rustwasm toolchain into a
[single location]. This is going to make discovering and using tools from the entire organization easier
for new and seasoned folks alike. This also has the feature of displaying documentation that is related
to the current published version of each tool- unlike before, where the only accessible documentation was
for the tools at current master (which may or may not be currently published!)
If you like reading the current master's documentation- fear not, each tool will still publish the
documentation generated from the master branch on their individual `gh-pages`
([See `wasm-pack's` master docs here]). To avoid confusion, we've added a flash message that let's you know
which documentation you are reading- and provides a link to documentation of the published version- just
in case that's what you're looking for!
[DebugSteve]: https://github.com/DebugSteven
[single location]: https://rustwasm.github.io/docs.html
[See `wasm-pack's` master docs here]: https://drager.github.io/wasm-pack/book/
[pull/565]: https://github.com/rustwasm/wasm-pack/pull/565
- **Add new QuickStart guide for "Hybrid Applications with Webpack" - [DebugSteven] [pull/536]**
Since `wasm-pack` was first published, we've focused on a workflow where a user writes a library and then
publishes it to npm, where anyone can use it like any npm package in their JavaScript or Node.js application.
Shortly after `wasm-pack` appeared, some RustWASM teammates created a template for a similar workflow- building
a RustWASM package _alongside_ an application. They did this by leveraging Webpack plugins, and it's a really
lovely user experience!
[This template] hasn't gotten as much attention because we've lacked a quickstart guide for folks to discover
and follow- now we've got one!
Check out the guide [here](https://drager.github.io/wasm-pack/book/tutorials/hybrid-applications-with-webpack/index.html)!
[This temaplte]: https://github.com/rustwasm/rust-webpack-template
[DebugSteven]: https://github.com/DebugSteven
[pull/536]: https://github.com/rustwasm/wasm-pack/pull/536
- **Add `wee_alloc` deepdive - [surma], [pull/542]**
`wee_alloc` is a useful utility that deserved more attention and explanation than our previous docs addressed.
This was partially because the `wasm-pack` template has an explanatory comment that helps explain its use.
However, for folks who don't use the template, `wee_alloc` is something important to know about- so now we have
given it its own section!
Check out the deepdive [here](https://drager.github.io/wasm-pack/book/tutorials/npm-browser-packages/template-deep-dive/wee_alloc.html)!
[surma]: https://github.com/surma
[pull/542]: https://github.com/rustwasm/wasm-pack/pull/542
- **Update prerequisite documentation - [alexcrichton], [pull/569]**
Many folks are using `wasm-pack` without publishing to npm- as a result, we've updated the documentation to
clearly indicate that npm is an optional requirement, only required for specific targets and workflows.
Additionally, since the 2018 Edition landed, `nightly` Rust is no longer a requirement. We've removed those
instructions and have consolidated the documentation so it is shorter and more efficient at getting you
started!
[pull/569]: https://github.com/rustwasm/wasm-pack/pull/569
- **Clarify what kind of account `login` adds - [killercup], [pull/539]**
Previously, when view `--help`, the command description for `login` showed:
`👤 Add a registry user account!` This could be confusing for folks, so now it's been updated to read:
`👤 Add an npm registry user account!`, which is much clearer!
[killercup]: https://github.com/killercup
[pull/539]: https://github.com/rustwasm/wasm-pack/pull/539
- **Wasm is a contraction, not an acronym - [fitzgen], [pull/555]**
Ever wonder how you're _actually_ supposed to refer to WebAssembly in short-form? WASM? wasm? For the pedants
out there, the correct usage is "Wasm" because Wasm is a _contraction_ of the words Web and Assembly. We've
updated our doucmentation to consistently refer to WebAssembly as Wasm in the shortform.
_The more you know!_
[pull/555]: https://github.com/rustwasm/wasm-pack/pull/555
- **Fix links and Rust highlightning - [drager], [issue/513] [pull/514] [pull/516]**
We had some broken links and missing Rust syntax highlighting in a few sections of the docs. This fixes that!
[issue/513]: https://github.com/rustwasm/wasm-pack/issues/513
[pull/514]: https://github.com/rustwasm/wasm-pack/pull/514
[pull/516]: https://github.com/rustwasm/wasm-pack/pull/516
## 🌅 0.6.0
- ### ✨ Features
- **Add three build profiles and infrastructure for their toml config - [fitzgen], [issue/153] [issue/160] [pull/440]**
When originally conceived, `wasm-pack` was exclusively a packaging and publishing tool, which naively assumed
that the crate author would simply run `wasm-pack` when they were ready to publish a wasm package. As a result,
`wasm-pack` always ran `cargo build` in `--release` mode. Since then, `wasm-pack` has grown into an integrated build
tool used at all stages of development, from idea conception to publishing, and as such has developed new needs.
In previous releases, we've supported a flag called `--debug` which will run `cargo build` in `dev` mode, which
trades faster compilation speed for a lack of optimizations. We've renamed this flag to `--dev` to match `cargo`
and added an additional flag, representing a third, intermediary, build profile, called `--profiling` which
is useful for investigating performance issues. You can see all three flags and their uses in the table below:
| Profile | Debug Assertions | Debug Info | Optimizations | Notes |
| ------------- | ---------------- | ---------- | ------------- | ----------------------------------------------------------- |
| `--dev` | Yes | Yes | No | Useful for development and debugging. |
| `--profiling` | No | Yes | Yes | Useful when profiling and investigating performance issues. |
| `--release` | No | No | Yes | Useful for shipping to production. |
The meaning of these flags will evolve as the platform grows, and always be tied to the behavior of these flags
in `cargo`. You can learn more about these in the [`cargo profile` documentation].
This PR also introduces a way to configure `wasm-pack` in your `Cargo.toml` file that we intend to use much more
in the future. As a largely convention-based tool, `wasm-pack` will never require that you configure it manually,
however, as our community and their projects mature alongside the tool, it became clear that allowing folks the
ability to drop down and configure things was something we needed to do to meet their needs.
Currently, you can only configure things related to the above-mentioned build profiles. To learn more,
[check out the documentation][profile-config-docs]. It leverages the `package.metadata.wasm-pack` key in your
`Cargo.toml`, and looks like this:
```toml
# Cargo.toml
[package.metadata.wasm-pack.profile.dev.wasm-bindgen]
# Should we enable wasm-bindgen's debug assertions in its generated JS glue?
debug-js-glue = true
# Should wasm-bindgen demangle the symbols in the "name" custom section?
demangle-name-section = true
# Should we emit the DWARF debug info custom sections?
dwarf-debug-info = false
```
As always- there are defaults for you to use, but if you love to configure (or have a project that requires it),
get excited, as your options have grown now and will continue to!
[profile-config-docs]: https://drager.github.io/wasm-pack/book/cargo-toml-configuration.html
[`cargo profile` documentation]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-profile-sections
[issue/153]: https://github.com/rustwasm/wasm-pack/issues/153
[issue/160]: https://github.com/rustwasm/wasm-pack/issues/160
[pull/440]: https://github.com/rustwasm/wasm-pack/pull/440
- **DEPRECATION: Rename `--debug` to `--dev` to match `cargo` - [fitzgen], [pull/439]**
See the discussion of the build profiles feature above. This is a strict renaming of the previous `--debug` flag,
which will now warn as deprecated.
[pull/439]: https://github.com/rustwasm/wasm-pack/pull/439
- **Add an option to pass an arbitrary set of arguments to `cargo build` - [torkve], [issue/455] [pull/461]**
As an integrated build tool, `wasm-pack` orchestrates many secondary command line tools to build your package
in a single command. Notably, one of these tools is `cargo`. `cargo` has a wide array of features and flags, and
we couldn't reasonably expect to implement them all as first class features of `wasm-pack`. As a result, we've
created the option to allow users to pass an arbitrary number of additional flags to `wasm-pack` by appending them
to the `wasm-pack build` command, after passing `--`. For example:
```
wasm-pack build examples/js-hello-world --mode no-install -- -Z offline
```
In the above example, the flag `-Z offline` will be passed to `cargo build`. This feature is documented
[here][cargo opts docs].
[cargo opts docs]: https://drager.github.io/wasm-pack/book/commands/build.html#extra-options
[torkve]: https://github.com/torkve
[issue/455]: https://github.com/rustwasm/wasm-pack/issues/455
[pull/461]: https://github.com/rustwasm/wasm-pack/pull/461
- **Pre-build before wasm-pack publish - [csmoe], [issue/438] [pull/444]**
Previously, if you ran `wasm-pack publish` before you had successfully run `wasm-pack build`,
you'd receive an error that a package could not be found- because there would be no `pkg` or
out-directory containing a `package.json`.
In this situation, you would hope that `wasm-pack` would build your package for you when you
ran `wasm-pack publish`. This is slightly complicated by the fact that not everyone wants to
build their package to the default target or to a directory named `pkg`.
To solve this, running `wasm-pack publish` before a successful build will give you an interactive
prompt to build your package- allowing you to specify your out directory as well as the target you'd
like to build to. Check it out in the gif below:

[issue/438]: https://github.com/rustwasm/wasm-pack/issues/438
[pull/444]: https://github.com/rustwasm/wasm-pack/pull/444
- **Generate self-.gitignore as part of pkg folder - [RReverser], [pull/453]**
Since `wasm-pack` was first published, the `pkg` directory was intended to be treated as a
build artifact, and as such should never be published to version control. This was
never enforced by any assets generated by `wasm-pack`, however.
Now, when building your package, `wasm-pack` will also generate a `.gitignore` file so that the
`pkg`, or out-directory, will be ignored.
If you use another version control tool, you'll need to still create or edit your own ignore file-
pull requests to support other version control tools are welcome!
If you require editing of the generated `package.json` or add additonal assets to your package
before publishing, you'll want to remove the `.gitignore` file and commit to version control. We
intend to have a solution that makes this workflow significantly easier in upcoming releases!
[RReverser]: https://github.com/RReverser
[pull/453]: https://github.com/rustwasm/wasm-pack/pull/453
- **Support cargo workspaces - [fitzgen], [issue/252] [issue/305] [pull/430]**
Workspaces are a well-liked and used feature of cargo that allow you to build multiple crates
in a single cargo project. Because of how `wasm-pack` handled paths for `target` and out-directories,
we did not support cargo workspaces out of the box. Now they should work well and the feature is
well guarded by tests!
[issue/252]: https://github.com/rustwasm/wasm-pack/issues/252
[issue/305]: https://github.com/rustwasm/wasm-pack/issues/305
[pull/430]: https://github.com/rustwasm/wasm-pack/pull/430
- **Use a global cache for all downloaded binaries - [alexcrichton], [pull/426]**
`wasm-pack` is an integrated build tool that orchestrates several other command line tools to build
your wasm project for you. How `wasm-pack` does this has evolved significantly since it's early versions.
In the last version, a `bin` directory was created to house the tool binaries that `wasm-pack` needed to
build our project, but this had several limitations. Firstly, it created a `bin` directory in your project's
root, which could be confusing. Secondly, it meant that sharing these tools across multiple projects was
not possible. We did this because it gaves us the fine-grained control over the version of these tools that
you used.
Now, `wasm-pack` will not generate a `bin` directory, but rather will use a global cache. We retain the
fine-grained control over the versions of these tools that are used, but allow multiple projects that use
the same tools at the same versions to share the already installed asset. Your global cache will generally
be in your user's home directory- we use the [`dirs` crate] to determine where to place this global cache.
This is not currently customizable but is something we intend to look into doing!
This feature ensures that `wasm-pack` users are downloading a minimal number of binaries from the network,
which, for `wasm-pack` users with multiple projects, should speed up build times.
[`dirs` crate]: https://docs.rs/dirs/1.0.4/dirs/fn.cache_dir.html
[pull/426]: https://github.com/rustwasm/wasm-pack/pull/426
- ### 🤕 Fixes
- **Fix `pack`, `login`, and `publish` for Windows users - [danwilhelm], [issue/277] [pull/489]**
Rust's behavior for spawning processes on some Windows targets introduced an interesting case where
Rust would fail unless the command was explicitly spawned with a prepended `cmd /c`. This failure
of `wasm-pack` was well noticed by our community - and thanks to the efforts of `danwilhelm` is now
fixed! You can read more on the background of this issue in [rust-lang/rust issue/44542].
[rust-lang/rust issue/44542]: https://github.com/rust-lang/rust/pull/44542
[issue/277]: https://github.com/rustwasm/wasm-pack/issues/277
[pull/489]: https://github.com/rustwasm/wasm-pack/pull/489
- **Validate `--target` argument - [csmoe], [issue/483] [pull/484]**
For a few releases now, `wasm-pack` has supported allowing users to specifying the target module system
they'd like their package built for- `browser`, `nodejs`, and `no-modules`. We did not however, validate
this input, and so if a user made even a slight mistake, e.g. `node`, `wasm-pack` would not catch the
error and would build your project using the default, `browser`. This is of course, surprising, and
unpleasant behavior and so now we'll error out with a message containing the supported target names.
[issue/483]: https://github.com/rustwasm/wasm-pack/issues/483
[pull/484]: https://github.com/rustwasm/wasm-pack/pull/484
- **Fix login - [danwilhelm], [issue/486] [pull/487]**
[danwilhelm]: https://github.com/danwilhelm
[issue/486]: https://github.com/rustwasm/wasm-pack/issues/486
[pull/487]: https://github.com/rustwasm/wasm-pack/pull/487
- **Eliminate unecessary escaping in build success terminal output - [huangjj27], [issue/390] [pull/396]**
Previously, on some systems, a successful `wasm-pack build` would print a unfortunate looking string:
```
| :-) Your wasm pkg is ready to publish at "\\\\?\\C:\\Users\\Ferris\\tmp\\wasm-bug\\pkg".
```
We've updated this to make sure the path to your project is well-formed, and most importantly,
human-readable.
[issue/390]: https://github.com/rustwasm/wasm-pack/issues/390
[pull/396]: https://github.com/rustwasm/wasm-pack/pull/396
- **Copy license file(s) to out directory - [mstallmo], [issue/407] [pull/411]**
Since `wasm-pack` was first published, we've copied over your `Cargo.toml` license definition over to
your `package.json`. However, we overlooked copying the actual `LICENSE` files over! Now we do!
[issue/407]: https://github.com/rustwasm/wasm-pack/issues/407
[pull/411]: https://github.com/rustwasm/wasm-pack/pull/411
- **Don't require cdylib crate-type for testing - [alexcrichton], [pull/442]**
`wasm-pack` was unecssarily checking `Cargo.toml` for the `cdylib` crate type during calls to `wasm-pack test`.
The `cdylib` output isn't necessary for the `wasm-pack test` stage because `wasm-bindgen` isn't being run over
a wasm file during testing. This check is now removed!
[pull/442]: https://github.com/rustwasm/wasm-pack/pull/442
- **Fix wasm-bindgen if lib is renamed via `lib.name` - [alexcrichton], [issue/339] [pull/435]**
In some circumstances, a library author may wish to specify a `name` in the `[package]` portion of their
`Cargo.toml`, as well as a different `name` in the `[lib]` portion, e.g.:
```toml
[package]
name = "hello-wasm"
[lib]
name = "wasm-lib"
```
This would cause the `wasm-bindgen` build stage of `wasm-pack` to error out because `wasm-pack` would attempt
to run `wasm-bindgen-cli` on a path using the `[package]` name, which wouldn't exist (because it would be using
the `[lib]` name). Now it works- thanks to more usage of [`cargo_metadata`] in `wasm-pack` internals!
[`cargo_metadata`]: https://crates.io/crates/cargo_metadata
[issue/339]: https://github.com/rustwasm/wasm-pack/issues/339
[pull/435]: https://github.com/rustwasm/wasm-pack/pull/435
- **Print standard error only once for failing commands - [fitzgen], [issue/422] [pull/424]**
Previously, `wasm-pack` may have printed `stderr` twice in some circumstances. This was both confusing and not
a pleasant experience, so now we've ensued that `wasm-pack` prints `stderr` exactly once! (It's hard enough to have
errors, you don't want `wasm-pack` rubbing it in, right?)
[issue/422]: https://github.com/rustwasm/wasm-pack/issues/422
[pull/424]: https://github.com/rustwasm/wasm-pack/pull/424
- **Add no-modules to --target flag's help text - [fitzgen], [issue/416] [pull/417]**
This is an interesting one! `fitzgen` very reasonably filed an issue asking to add `wasm-bindgen`'s
`--target no-modules` feature to `wasm-pack`. This was confusing as this feature was indeed already implemented,
and documented- BUT, notably missing from the `wasm-pack --help` text. We've fixed that now- and it was an omission
so glaring we definitely considered it a bug!
[issue/416]: https://github.com/rustwasm/wasm-pack/issues/416
[pull/417]: https://github.com/rustwasm/wasm-pack/pull/417
- ### 🛠️ Maintenance
- **Replace `slog` with `log` - [alexcrichton], [issue/425] [pull/434]**
For internal maintenance reasons, as well as several end-user ones, we've migrated away from the `slog` family
of crates, and are now using the `log` crate plus `env_logger`. Now, `wasm-pack` won't create a `wasm-pack.log`.
Additionally, enabling logging will now be done through `RUST_LOG=wasm_pack` instead of `-v` flags.
[issue/425]: https://github.com/rustwasm/wasm-pack/issues/425
[pull/434]: https://github.com/rustwasm/wasm-pack/pull/434
- **Move binary installation to its own crate - [drager], [issue/384] [pull/415]**
In `wasm-pack 0.5.0`, we move away from `cargo install`ing many of the tools that `wasm-pack` orchestrates. Because
we used `cargo install`, this required an end user to sit through the compilation of each tool, which was a
prohibitively long time. We moved, instead, to building, and then installing, binaries of the tools. This sped up
build times dramatically!
This pattern has been very beneficial to `wasm-pack` and is potentially something that could be beneficial to other
projects! As a result, we've refactored it out into a crate and have published it as it's own crate, [`binary-install`].
[`binary-install`]: https://crates.io/crates/binary-install
[drager]: https://github.com/drager
[issue/384]: https://github.com/rustwasm/wasm-pack/issues/384
[pull/415]: https://github.com/rustwasm/wasm-pack/pull/415
- **Replace internal `Error` with `failure::Error` - [alexcrichton], [pull/436]**
The story of error message handling in `wasm-pack` has not been the prettiest. We originally were manually implementing
errors, adding the [`failure` crate] at one point, but not fully updating the entire codebase. With this PR, we are
nearly completely handling errors with `failure`, bringing the code into a much more maintainable and
pleasant-to-work-on place.
[`failure` crate]: https://crates.io/crates/failure
[pull/436]: https://github.com/rustwasm/wasm-pack/pull/436
- **Update `mdbook` version used by Travis - [fitzgen], [pull/433]**
[pull/433]: https://github.com/rustwasm/wasm-pack/pull/433
- **Read the `Cargo.toml` file only once - [fitzgen], [issue/25] [pull/431]**
This is a very fun one since it fixes one of the original issues filed by `ag_dubs` at the very beginning of `wasm-pack`
development. In a rush to implement a POC tool, `ag_dubs` noted for posterity that the `Cargo.toml` was being read
multiple times (twice), when it did not need to be. Thanks to `fitzgen` now it's read only once! A minor performance
improvement in the scheme of things, but a nice one :)
[issue/25]: https://github.com/rustwasm/wasm-pack/issues/25
[pull/431]: https://github.com/rustwasm/wasm-pack/pull/431
- **Use `name` field for Travis CI jobs - [fitzgen], [pull/432]**
[pull/432]: https://github.com/rustwasm/wasm-pack/pull/432
- **Add a test for build command - [huangjj27], [pull/408]**
[huangjj27]: https://github.com/huangjj27
[pull/408]: https://github.com/rustwasm/wasm-pack/pull/408
- **Test paths on Windows - [xmclark], [issue/380] [pull/389]**
[xmclark]: https://github.com/xmclark
[issue/380]: https://github.com/rustwasm/wasm-pack/issues/380
[pull/389]: https://github.com/rustwasm/wasm-pack/pull/389
- **Fix typo in test function name for copying the README - [mstallmo], [pull/412]**
[pull/412]: https://github.com/rustwasm/wasm-pack/pull/412
- ### 📖 Documentation
- **Complete template deep dive docs - [danwilhelm], [issue/345] [issue/346] [pull/490]**
In a rush to publish a release, `ag_dubs` left some "Coming soon!" comments on most pages
of the "Template Deep Dive" docs. These docs help walk new users through the boilerplate
that using the `wasm-pack` template generates for you. Thanks so much to `danwilhem` for
picking this up and doing an excellent job!
[issue/345]: https://github.com/rustwasm/wasm-pack/issues/345
[issue/346]: https://github.com/rustwasm/wasm-pack/issues/346
[pull/490]: https://github.com/rustwasm/wasm-pack/pull/490
- **Minor docs updates - [fitzgen], [issue/473] [pull/485]**
[issue/473]: https://github.com/rustwasm/wasm-pack/issues/473
[pull/485]: https://github.com/rustwasm/wasm-pack/pull/485
## 🌄 0.5.1
- ### 🤕 Fixes
- **Child Process and output management - [fitzgen], [issue/287] [pull/392]**
Not exactly a "fix", but definitely a huge improvment in how child processes and their
output are handled by `wasm-pack`. Ever sat at a long prompt from `wasm-pack` and
wondered what was happening? No longer! Did `wasm-pack` eat your test output- no more!
[issue/287]: https://github.com/rustwasm/wasm-pack/issues/287
[pull/392]: https://github.com/rustwasm/wasm-pack/pull/392
- **Less scary missing field messages - [mstallmo], [issue/393] [pull/394]**
After watching a livestream of someone using `wasm-pack`, [fitzgen] noted that folks
seemed pretty alarmed by the loud warning about missing optional manifest fields.
As a result, we are now downgrading those messages from WARN to INFO, and consolidating
them on a single line.
[issue/393]: https://github.com/rustwasm/wasm-pack/issues/393
[pull/394]: https://github.com/rustwasm/wasm-pack/pull/394
- **Add `exit_status` to CLI errors - [konstin], [issue/291] [pull/387]**
We'd been hiding these- but we shouldn't have been!
[konstin]: https://github.com/konstin
[issue/291]: https://github.com/rustwasm/wasm-pack/issues/291
[pull/387]: https://github.com/rustwasm/wasm-pack/pull/387
- **Remove lingering forced nightly usage - [alexcrichton], [pull/383]**
In 0.5.0 we removed all forced nightly usage as we depend on `~1.30` which is now
available on both nightly and beta channels! We had a bit of a race condition with
that PR and the `wasm-pack test` PR, and missed a few as a result! This removes all
lingering forced nightly, which only affected the `wasm-pack test` command.
[pull/383]: https://github.com/rustwasm/wasm-pack/pull/383
- **Fix `wasm-bindgen-test` dependency error message - [fitzgen], [issue/377] [pull/378]**
The error message about missing the `wasm-bindgen-test` dependency errantly stated
that the user was missing a `wasm-bindgen` dependency! We've fixed it to correctly
state the missing dependency now.
[issue/377]: https://github.com/rustwasm/wasm-pack/issues/377
[pull/378]: https://github.com/rustwasm/wasm-pack/pull/378
- **Fix prerequisites links in docs - [fitzgen], [pull/376]**
[pull/376]: https://github.com/rustwasm/wasm-pack/pull/376
- ### 🛠️ Maintenance
- **Leverage `failure::Error` consistently - [drager], [issue/280] [pull/401]**
This PR finally makes it so that `wasm-pack` is handling errors in a consistent
way across the codebase.
[drager]: https://github.com/drager
[issue/280]: https://github.com/rustwasm/wasm-pack/issues/280
[pull/401]: https://github.com/rustwasm/wasm-pack/pull/401
## ☀️ 0.5.0
- ### ✨ Features
- #### **Website!** - [ashleygwilliams], [pull/246]
We have a website now. It has the installer and links to documentation. In the future,
we hope to have calls to action for folks first coming to the site who are looking to
do specific things- these will help them find the docs and tutorials they need to.
This PR also has a complete rework of our documentation.
Check it out [here](https://drager.github.io/wasm-pack/)!
- #### 🍱 Module Support
- **BREAKING: use correct `package.json` keys for generated JavaScript - [ashleygwilliams], [issue/309] [pull/312]**
This is marked as potentially breaking because it changes the `package.json` keys that
are generated by the project.
Previously, we generated a JavaScript file and placed it in the `main` key, regardless
of what you were targeting, ES6 and Node.js alike.
We have received a lot of requests for `wasm-pack` to generate "isomorphic" packages,
that contain assets that could work on both Node.js and ES6, and this led to us
looking more closely at how we are using `package.json`.
With this release, we will do the following:
- `--target browser`: By default, we generate JS that is an ES6 module. We used to put
this in the `main` field. Now we put it in the `module` field. We also add
`sideEffects: false` so that bundlers that want to tree shake can.
- `--target nodejs`: This target doesn't change. We put generated JS that is a
CommonJS module in the `main` key.
- `--target no-modules`: This is a new target. For this target we generate bare JavaScript.
This code is put in a `browser` field.
You can see the structs that represent each target's expected `package.json` [here](https://github.com/rustwasm/wasm-pack/tree/master/src/manifest/npm).
Thanks so much to [bterlson] for his help in sorting this out for us!
[bterlson]: https://github.com/bterlson
[issue/309]: https://github.com/rustwasm/wasm-pack/issues/309
[pull/312]: https://github.com/rustwasm/wasm-pack/pull/312
- #### 🛠️ New Commands
- **`wasm-pack init` is now `wasm-pack build` - [csmoe], [issue/188] [pull/216]**
When this project was first conceived, we imagined it would be simply a way to package
up generate wasm and js and publish it to npm. Here we are at version `0.5.0` and we
have become much more- an integrated build tool!
As a result, the original command `init` does a lot more than that these days. We've
renamed the command to better reflect the work it's actually doing. `init` will still
work, but is deprecated now, and we will eventually remove it.
[csmoe]: https://github.com/csmoe
[issue/188]: https://github.com/rustwasm/wasm-pack/issues/188
[pull/216]: https://github.com/rustwasm/wasm-pack/pull/216
- **add new command: `wasm-pack test` - [fitzgen], [pull/271]**
This is an experimental new command that will run your tests in Node.js or a headless
browser using `wasm-pack test`. Check out this [tutorial](https://rustwasm.github.io/wasm-bindgen/wasm-bindgen-test/index.html)
to learn more!
[pull/271]: https://github.com/rustwasm/wasm-pack/pull/271
- **add 2FA support to `wasm-pack publish` - [mstallmo], [issue/257] [pull/282]**
We've been wrapping the `npm login` and `npm publish` commands as `wasm-pack login`
and `wasm-pack publish` for a while now- but we didn't fully support two factor
authentication. Now we do! (Be safe out there! 2FA is good for everyone!)
[issue/257]: https://github.com/rustwasm/wasm-pack/issues/257
[pull/282]: https://github.com/rustwasm/wasm-pack/pull/282
- #### 🎏 New Flags
- **New target, bare JavaScript: `--target no-modules` - [ashleygwilliams], [issue/317] [pull/327]**
`wasm-bindgen` offers a `no-modules` flag that until now, we didn't support. This flag
produces bare, no modules JavaScript. So if that's your thing, this target is for you!
[issue/317]: https://github.com/rustwasm/wasm-pack/issues/317
[pull/327]: https://github.com/rustwasm/wasm-pack/pull/327
- **`--access` flag for `wasm-pack` publish - [ashleygwilliams], [issue/297] [pull/299]**
Many of our tutorials use scopes to help prevent folks from attempting to publish
packages that will lead to npm Registry errors because the package name already exists.
However, by default, scoped packages are assumed by the npm registry to be private, and
the ability to publish private packages to the npm registry is a paid feature. Worry not!
Now you can pass `--access public` to `wasm-pack publish` and publish scoped packages
publicly.
[issue/297]: https://github.com/rustwasm/wasm-pack/issues/297
[pull/299]: https://github.com/rustwasm/wasm-pack/pull/299
- #### ✅ New Checks
- **rustc version check - [ashleygwilliams], [issue/351] [pull/353]**
Now that we have a new fangled installer, there's a chance that folks might install `wasm-pack`
and not have Rust installed. Additionally, now that the features we required from the `nightly`
channel of Rust have moved to `beta`- we don't need to enforce `nightly`.
As of this release, we will check that your Rust version is above `1.30.0`. You can be on
either the `nightly` or `beta` channel and all of `wasm-pack`s calls to `cargo` will
respect that.
Really hate this? You can pass `--mode force` to `wasm-pack` to skip this check. I hope you know
what you're doing!
- **coordinating wasm-bindgen versions and installing from binaries for improved speed - [datapup], [issue/146] [pull/244] [pull/324]**
This is the true gem of this release. Have you been frustrated by how long `wasm-pack` takes to
run? Overusing `--mode no-install`? This is the release you're looking for.
Many releases back we realized that folks were struggling to keep the `wasm-bindgen` library
that their project used in sync with the `wasm-bindgen` CLI application which `wasm-pack`
runs for you. This became such an issue that we opted to force install `wasm-bindgen` to ensure
that every `wasm-pack` user had the latest version.
Like many technical solutions, this solved our original problem, but caused a new one. Now, we
we are forcing a `cargo install` of `wasm-bindgen` on every run, and that means downloading
and compiling `wasm-bindgen` everytime you want to run `wasm-pack`. That's unacceptable!
We're happy to announce that we have a pretty great solution, and several more planned for
future releases. As of this release, we will read your `Cargo.lock` to find the version of
`wasm-bindgen` you are using in your local project. We will attempt to fetch a binary version
of `wasm-bindgen` that matches your local version. We place that binary local to your project,
and use it when you run `wasm-pack build`. The next time you run `wasm-pack build` we'll use
that binary, instead of fetching a new one. We still fall back to `cargo install` for
less common architectures but this is a huge speed improvement. Check out these benchmarks!
##### `wasm-pack` v0.4.2
```
$ time wasm-pack init # fresh build
real 1m58.802s
user 14m49.679s
sys 0m24.957s
$ time wasm-pack init # re-build
real 0m56.953s
user 11m12.075s
sys 0m18.835s
$ time wasm-pack init -m no-install # re-build with no-install
real 0m0.091s
user 0m0.052s
sys 0m0.042s
```
##### `wasm-pack` v0.5.0
```
$ time wasm-pack build # fresh build
real 1m3.350s
user 3m46.912s
sys 0m6.057s
$ time wasm-pack build # re-build
real 0m0.230s
user 0m0.185s
sys 0m0.047s
$ time wasm-pack build -m no-install # re-build with no-install
real 0m0.104s
user 0m0.066s
sys 0m0.041s
```
[datapup]: https://github.com/datapup
[issue/146]: https://github.com/rustwasm/wasm-pack/issues/146
[pull/244]: https://github.com/rustwasm/wasm-pack/pull/244
[pull/324]: https://github.com/rustwasm/wasm-pack/pull/324
- **enforce `cargo build` with `--lib` - [ashleygwilliams], [issue/303] [pull/330]**
Right now, `wasm-pack` only works on Rust library projects. But sometimes, if you're
new to Rust, you might end up having a `main.rs` in your project, just by mistake.
Some folks ran into this and realized that it can cause issues!
As a result, we are enforcing that `cargo build` only build the library at this time.
Want to use `wasm-pack` on a binary application? We're interested in hearing from you!
Checkout [issue/326] and please comment! We want to support binary applicaitons in
the future and are always happy and curious to hear about how folks use `wasm-pack`!
[issue/326]: https://github.com/rustwasm/wasm-pack/issues/326
[issue/303]: https://github.com/rustwasm/wasm-pack/issues/303
[pull/330]: https://github.com/rustwasm/wasm-pack/pull/330
- #### Installers and Releases
- **Appveyor Windows Pre-Built binaries - [alexcrichton], [issue/147] [pull/301]**
We finally got Appveyor to publish pre-built binaries to GitHub releases.
Aside: I really wish there were an easier way to test and debug this stuff.
[alexcrichton]: https://github.com/alexcrichton
[issue/147]: https://github.com/rustwasm/wasm-pack/issues/147
[pull/301]: https://github.com/rustwasm/wasm-pack/pull/301
- **new experimental installer - [alexcrichton], [pull/307]**
Whew, this one is exciting. Up until now, `wasm-pack` has been distributed using
`cargo install`. This is not ideal for several reasons. Updating is confusing,
and every time it's installed the user has to wait for it to compile- right at the
moment they just want to hurry up and use it already.
Say hello to the new `wasm-pack` installer- we have an executable for Windows
and a `curl` script for \*nix users. Not pleased with that? File an issue for your
preferred distribution method and we'll do our best to get it working!
This is experimental- so please try it out and file issues as you run into things!
You'll always be able to use `cargo install` as a backup.
Checkout the new installer [here](https://drager.github.io/wasm-pack/installer/)!
[pull/307]: https://github.com/rustwasm/wasm-pack/pull/307
- ### 🛠️ Maintenance
- **testing fixture strategy improvements - [fitzgen], [pull/211] [pull/323]**
[pull/211]: https://github.com/rustwasm/wasm-pack/pull/211
[pull/323]: https://github.com/rustwasm/wasm-pack/pull/323
- **split testing utils into separate files - [csmoe], [issue/231] [pull/216]**
[issue/231]: https://github.com/rustwasm/wasm-pack/issues/231
[pull/216]: https://github.com/rustwasm/wasm-pack/pull/216
- **update dependencies - [ashleygwilliams], [issue/319] [pull/320]**
[issue/319]: https://github.com/rustwasm/wasm-pack/issues/319
[pull/320]: https://github.com/rustwasm/wasm-pack/pull/320
- ### 📖 Documentation
- **improve readability of warnings about missing optional fields - [twilco], [pull/296]**
A little punctuation goes a long way. Error message improvement PRs are the best.
[twilco]: https://github.com/twilco
[pull/296]: https://github.com/rustwasm/wasm-pack/pull/296
- **update links in README - [alexcrichton], [pull/300]**
We had a real dicey documentation situation for a while. Sorry about that, and thank
you SO MUCH to all the folks who filed PRs to fix it.
[pull/300]: https://github.com/rustwasm/wasm-pack/pull/300
- **fix broken links in book by using relative paths - [mstallmo], [issue/325] [pull/328]**
[mstallmo]: https://github.com/mstallmo
[issue/325]: https://github.com/rustwasm/wasm-pack/issues/325
[pull/328]: https://github.com/rustwasm/wasm-pack/pull/328
## ✨ 0.4.2
- #### 🤕 Fixes
- **recognize `[dependencies.wasm-bindgen]` during dep check in `init` - [ashleygwilliams], [issue/221] [pull/224]**
When we originally implemented the dependency check in `wasm-pack init` we naively only checked for the
"simple" dependency declaration, `[dependencies] wasm-bindgen="0.2"`. However! This is not the only way
to declare this dependency, and it's not the ideal way to do it if you want to specify features from the
crate. Now that a bunch of folks want to use `features = ["serde-serialize"]` we ran into a bunch of folks
having issues with our naive dependency checker! Thanks so much to [turboladen] for filing the very detailed
issue that helped us solve this quickly!
PSSSST! Curious what `features = ["serde-serialize"]` with `wasm-bindgen` actually does? It's awesome:
> It's possible to pass data from Rust to JS not explicitly supported in the [Feature Reference](./feature-reference.md) by serializing via [Serde](https://github.com/serde-rs/serde).
Read the [Passing arbitrary data to JS docs] to learn more!
[Passing arbitrary data to JS docs]: https://github.com/rustwasm/wasm-bindgen/blob/master/guide/src/reference/arbitrary-data-with-serde.md
[turboladen]: https://github.com/turboladen
[issue/221]: https://github.com/rustwasm/wasm-pack/issues/221
[pull/224]: https://github.com/rustwasm/wasm-pack/pull/224
- **improve UX of publish and pack commands - [Mackiovello], [pull/198]**
Previous to this fix, you would need to be in the parent directory of the `/pkg` dir to successfully run
`pack` or `publish`. This was pretty crummy! Thankfully, [Mackiovello] swooped in with a fix, that you can
find documented in the [pack and publish docs]!
[Mackiovello]: https://github.com/Mackiovello
[pull/198]: https://github.com/rustwasm/wasm-pack/pull/198
[pack and publish docs]: https://github.com/rustwasm/wasm-pack/blob/05e4743c22b57f4c4a1bfff1df1d2cc1a595f523/docs/pack-and-publish.md
- **use `PathBuf` instead of `String` for paths - [Mackiovello], [pull/220]**
This is mostly a maintenance PR but does fix one very small bug- depending on if you add a trailing slash to
a path that you pass to `init`, you might have seen an extra `/`! Now that we're using a proper Type to
handle this, that's much better, and in general, all the operations using paths are more robust now.
[pull/220]: https://github.com/rustwasm/wasm-pack/pull/220
- #### 📖 Documentation
- **update docs and tests to eliminate no longer necessary feature flags - [ashleygwilliams], [pull/226]**
The Rust 2018 edition marches on and we are seeing feature flags drop like flies :) Instead of a whole slew
of feature flags, we now only need one, `#![feature(use_extern_macros)]`, and that one is also not long for
this world :)
[pull/226]: https://github.com/rustwasm/wasm-pack/pull/226
## ⭐ 0.4.1
- #### 🤕 Fixes
- **fix `files` key value for projects build for `nodejs` target - [ashleygwilliams], [issue/199] [pull/205]**
We became aware that the `files` key in `package.json` did not include the additional `_bg.js` file that
`wasm-bindgen` generates for projects being built for the `nodejs` target. This resulted in the file not
being included in the published package and resulted in a `Module Not Found` error for folks.
This was a group effort from [mciantyre] with [pull/200] and [Brooooooklyn] with [pull/197]. Thank you so
much for your diligence and patience while we sorted through it.
[mciantyre]: https://github.com/mciantyre
[Brooooooklyn]: https://github.com/Brooooooklyn
[issue/199]: https://github.com/rustwasm/wasm-pack/issues/199
[pull/205]: https://github.com/rustwasm/wasm-pack/pull/205
[pull/197]: https://github.com/rustwasm/wasm-pack/pull/197
[pull/200]: https://github.com/rustwasm/wasm-pack/pull/200
- #### 🛠️ Maintenance
- **clean up `quicli` remnants - [SoryRawyer], [pull/193]**
In [v0.3.0] we removed the `quicli` dependency, however there were a few remnants
left behind. They are now removed!
[SoryRawyer]: https://github.com/SoryRawyer
[pull/193]: https://github.com/rustwasm/wasm-pack/pull/193
[v0.3.0]: https://github.com/rustwasm/wasm-pack/blob/master/CHANGELOG.md#-030
- #### 📖 Documentation
- **DOCUMENT EVERYTHING!! and deny missing docs for all future development - [fitzgen], [pull/208]**
The `wasm-pack` team has worked hard on tutorial documentation and keeping the codebase as self-explanatory
as possible, but we have been slowly accruing a documentation debt. This amazing PR, landed just moments
before this point release and was just too good not to include. Thank you so much, [fitzgen]!
[fitzgen]: https://github.com/fitzgen
[pull/208]: https://github.com/rustwasm/wasm-pack/pull/208
- **fix README code example - [steveklabnik], [pull/195]**
The code example in our `README.md` was missing a critical `pub`. It's there now!
[pull/195]: https://github.com/rustwasm/wasm-pack/pull/195/files
- **fix README markup - [Hywan], [pull/202]**
There was an errant `` ` `` - it's gone now!
[Hywan]: https://github.com/Hywan
[pull/202]: https://github.com/rustwasm/wasm-pack/pull/202
## 🌟 0.4.0
This release has a ton of awesome things in it, but the best thing is that
almost all of this awesome work is brought to you by a **new** contributor
to `wasm-pack`. Welcome ya'll! We're so glad to have you!
### ✨ Features
- #### 🎏 New Flags
- **`--mode` flag for skipping steps when calling `init` - [ashleygwilliams], [pull/186]**
After teaching and working with `wasm-pack` for some time, it's clear that people would
like the flexibility to run some of the steps included in the `init` command and not others.
This release introduces a `--mode` flag that you can pass to `init`. The two modes currently
available are `skip-build` and `no-installs` and they are explained below. In the future,
we are looking to change the `init` interface, and potentially to split it into two commands.
If you have thoughts or opinions on this, please weigh in on [issue/188]!
[issue/188]: https://github.com/ashleygwilliams/wasm-pack/issues/188
[pull/186]: https://github.com/ashleygwilliams/wasm-pack/pull/186
- **`skip-build` mode - [kohensu], [pull/151]**
```
wasm-pack init --mode skip-build
```
Sometimes you want to run some of the shorter meta-data steps that
`wasm-pack init` does for you without all the longer build steps. Now
you can! Additionally, this PR was a fantastic refactor that allows even
more custom build configurations will be simple to implement!
[kohensu]: https://github.com/kohensu
[pull/151]: https://github.com/ashleygwilliams/wasm-pack/pull/151
- **`no-installs` mode - [ashleygwilliams], [pull/186]**
```
wasm-pack init --mode no-installs
```
Sometimes you want to run `wasm-pack` and not have it modify your global
env by installing stuff! Or maybe you are just in a hurry and trust your
env is set up correctly- now the `--mode no-install` option allows you to
do this.
- **`--debug` - [clanehin], [pull/127]**
```
wasm-pack init --debug
```
Find yourself needing to compile your Rust in `development` mode? You can now
pass the `--debug` flag to do so! Thanks so much to [clanehin] for filing
[issue/126] for this feature... and then implementing it!
[pull/127]: https://github.com/ashleygwilliams/wasm-pack/pull/127
[issue/126]: https://github.com/ashleygwilliams/wasm-pack/issues/126
[clanehin]: https://github.com/clanehin
- #### ✅ New Checks
- **ensure you have `cdylib` crate type - [kendromelon], [pull/150]**
One of the biggest mistakes we've seen beginners make is forgetting to declare
the `cdylib` crate type in their `Cargo.toml` before running `wasm-pack init`.
This PR fixes that, and comes from someone who ran into this exact issue learning
about `wasm-pack` at [JSConfEU]! Love when it works out like this.
[JSConfEU]: https://2018.jsconf.eu/
[kendromelon]: https://github.com/kedromelon
[pull/150]: https://github.com/ashleygwilliams/wasm-pack/pull/150
- **ensure you have declared wasm-bindgen as a dep - [robertohuertasm], [pull/162]**
Another easy mistake to make is to forget to declare `wasm-bindgen` as a
dependency in your `Cargo.toml`. Now `wasm-pack` will check and make sure you
have it set before doing a bunch of long build steps :)
[robertohuertasm]: https://github.com/robertohuertasm
[pull/162]: https://github.com/ashleygwilliams/wasm-pack/pull/162
- **ensure you are running `nightly` - [FreeMasen], [pull/172]**
`wasm-pack` currently requires that you run it with `nightly` Rust. Now, `wasm-pack`
will make sure you have `nightly` installed and will ensure that `cargo build` is run
with `nightly`. Thanks so much to [FreeMasen] for filing [issue/171] and fixing it!
[FreeMasen]: https://github.com/FreeMasen
[issue/171]: https://github.com/ashleygwilliams/wasm-pack/issues/171
[pull/172]: https://github.com/ashleygwilliams/wasm-pack/pull/172
### 🤕 Fixes
- **fixed broken progress bar spinner - [migerh], [pull/164]**
Oh no! We broke the progress bar spinner in version 0.3.0. Thankfully, it's
fixed now- with a thoughtful refactor that also makes the underlying code
sounder overall.
[migerh]: https://github.com/migerh
[pull/164]: https://github.com/ashleygwilliams/wasm-pack/pull/164
### 🛠️ Maintenance
- **WIP bot - [ashleygwilliams] & [mgattozzi], [issue/170]**
We've got a lot of work happening on `wasm-pack` so it's good to have a bit
of protection from accidentally merging a Work In Progress. As a result, we
now have the [WIP Github App] set up on `wasm-pack`. Great suggestion [mgattozzi]!
[WIP Github App]: https://github.com/wip/app
[issue/170]: https://github.com/ashleygwilliams/wasm-pack/issues/170
- **modularize `command.rs` - [ashleygwilliams], [pull/182]**
Thanks to the growth of `wasm-pack`, `command.rs` was getting pretty long.
We've broken it out into per command modules now, to help make it easier to
read and maintain!
[pull/182]: https://github.com/ashleygwilliams/wasm-pack/pull/182
- **improve PoisonError conversion - [migerh], [pull/187]**
As part of the awesome progress bar spinner fix in [pull/164], [migerh] introduced
a small concern with an `unwrap` due to an outstanding need to convert `PoisonError`
into `wasm-pack`'s custom `Error`. Though not a critical concern, [migerh] mitigated
this right away by replacing `std::sync::RwLock` with the [`parking_lot` crate]!
This cleaned up the code even more than the previous patch!
[`parking_lot` crate]: https://github.com/Amanieu/parking_lot
[pull/187]: https://github.com/ashleygwilliams/wasm-pack/pull/187
- **wasm category for crates.io discovery- [TomasHubelbauer], [pull/149]**
[crates.io] has [categories] to help folks discover crates, be we weren't
leveraging it! Now- if you explore the [`wasm` category] on [crates.io]
you'll see `wasm-pack`!
[crates.io]: https://crates.io/
[categories]: https://crates.io/categories
[`wasm` category]: https://crates.io/categories/wasm
[TomasHubelbauer]: https://github.com/TomasHubelbauer
[pull/149]: https://github.com/ashleygwilliams/wasm-pack/pull/149
- **human panic is now 1.0.0 - [spacekookie], [pull/156]**
Congrats friends! We like what you do.
[pull/156]: https://github.com/ashleygwilliams/wasm-pack/pull/156
[spacekookie]: https://github.com/spacekookie
### 📖 Documentation
- **cleaned up the README - [ashleygwilliams], [pull/155]**
Our `README` was struggling with a common problem- doing too much at once.
More specifically, it wasn't clear who the audience was, contributers or
end users? We've cleaned up our README and created a document specifically
to help contributors get up and running.
[pull/155]: https://github.com/ashleygwilliams/wasm-pack/pull/155
## 🌠 0.3.1
Babby's first point release! Are we a real project now?
### 🤕 Fixes
- **fixed `init` `Is a Directory` error - [ashleygwilliams], [pull/139]**
Our new logging feature accidentally introduced a regression into 0.3.0. When
calling `wasm-pack init`, if a directory was not passed, a user would receive
a "Is a Directory" Error. Sorry about that! Thanks to [jbolila] for filing
[issue/136]!
[pull/139]: https://github.com/ashleygwilliams/wasm-pack/pull/139
[issue/136]: https://github.com/ashleygwilliams/wasm-pack/issues/136
[jbolila]: https://github.com/jbolila
- **typescript files were not included in published package - [danreeves], [pull/138]**
Generating Typescript type files by default was a pretty rad feature in
0.3.0 but we accidentally forgot to ensure they were included in the
published package. Thanks so much to [danreeves] for catching this issue
and fixing it for us!
[danreeves]: https://github.com/danreeves
[pull/138]: https://github.com/ashleygwilliams/wasm-pack/pull/138
## 💫 0.3.0
### ✨ Features
- **Logging - [mgattozzi], [pull/134]**
Up until now, we've forced folks to rely on emoji-jammed console output to debug
errors. While emojis are fun, this is often not the most pleasant experience. Now
we'll generate a `wasm-pack.log` file if `wasm-pack` errors on you, and you can
customize the log verbosity using the (previously unimplemented) verbosity flag.
[pull/134]: https://github.com/ashleygwilliams/wasm-pack/pull/134
- **`--target` flag - [djfarly], [pull/132]**
`wasm-bindgen-cli` is able to generate a JS module wrapper for generated wasm files
for both ES6 modules and CommonJS. Up until now, we only used wasm-bindgen's default
behavior, ES6 modules. You can now pass a `--target` flag with either `nodejs` or
`browser` to generate the type of module you want to use. Defaults to `browser` if not
passed.
[djfarly]: https://github.com/djfarly
[pull/132]: https://github.com/ashleygwilliams/wasm-pack/pull/132
- **human readable panics - [yoshuawuyts], [pull/118]**
Panics aren't always the most friendly situation ever. While we never want to panic on ya,
if we do- we'll do it in a way that's a little more readable now.
[pull/118]: https://github.com/ashleygwilliams/wasm-pack/pull/118
- **typescript support by default - [kwonoj], [pull/109]**
`wasm-bindgen` now generates typescript type files by default. To suppress generating
the type file you can pass the `--no-typescript` flag. The type file is useful for more
than just typescript folks- many IDEs use it for completion!
[kwonoj]: https://github.com/kwonoj
[pull/109]: https://github.com/ashleygwilliams/wasm-pack/pull/109
- **wrap `npm login` command - [djfarly], [pull/100]**
In order to publish a package to npm, you need to be logged in. You can now use
`wasm-pack login` to login to the npm (or any other) registry.
[pull/100]: https://github.com/ashleygwilliams/wasm-pack/pull/100
- **exit early on failure - [mgattozzi], [pull/90]**
Until now, `wasm-pack` would continue to run tasks, even if a task failed. Now- if something
fails, we'll exit so you don't have to wait to fix the error.
[pull/90]: https://github.com/ashleygwilliams/wasm-pack/pull/90
### 🤕 Fixes
- **force install wasm-bindgen - [ashleygwilliams], [pull/133]**
Using an out of date version of `wasm-bindgen` can run you into a bunch of trouble. This
very small change should fix the large number of bug reports we received from users using
an out of date `wasm-bindgen-cli` by force installing `wasm-bindgen-cli` to ensure the user
always has the latest version. We don't expect this to be a forever solution (it's a bit
slow!) but it should help those who are getting started have a less rough time.
[pull/133]: https://github.com/ashleygwilliams/wasm-pack/pull/133
- **fix CI release builds - [ashleygwilliams], [pull/135]**
This was not working! But now it is! You can always use `cargo install` to install
wasm-pack, but now you can find pre-built Linux and Mac binaries in the [Releases]
tab of our GitHub repo.
[Releases]: https://github.com/ashleygwilliams/wasm-pack/releases
[pull/135]: https://github.com/ashleygwilliams/wasm-pack/pull/135
### 🛠️ Maintenance
- **remove `quicli` dependency - [mgattozzi], [pull/131]**
While `quicli` is a great way to get started writing a CLI app in Rust- it's not meant for
large, mature applications. Now that `wasm-pack` is bigger and has many active users, we've
removed this dependency to unblock further development on the tool.
[pull/131]: https://github.com/ashleygwilliams/wasm-pack/pull/131
- **update rustfmt CI test - [djfarly], [pull/128]**
Since 0.2.0 how one should call `rustfmt` changed! We've kept it up to date so we can continue
to maintain conventional style in the codebase.
[pull/128]: https://github.com/ashleygwilliams/wasm-pack/pull/128
- **custom module for errors - [mgattozzi], [pull/120]**
Thanks to the `failure` crate, we've been playing fast and loose with errors for a bit. We're
finally getting serious about error handling - by organizing all of our specific errors in a
specific module. This will make it easier to communicate these errors out and handle new error
cases from future features.
[pull/120]: https://github.com/ashleygwilliams/wasm-pack/pull/120
### 📖 Documentation
Special thanks to [data-pup] who continues to be our documentation champion! In case you missed it,
check out the guides in the [docs directory!](docs)!
## 🌌 0.2.0
This release focuses on filling out all commands and improving stderr/out
handling for improved user experience!
### ✨ Features
- **`pack` and `publish` - [jamiebuilds], [pull/67]**
You can now run `wasm-pack pack` to generate a tarball of your generated package,
as well as run `wasm-pack publish` to publish your package to the npm registry.
Both commands require that you have npm installed, and the `publish` command requires
that you be logged in to the npm client. We're working on wrapping the `npm login`
command so that you can also login directly from `wasm-pack`, see [pull/100] for more
details.
[jamiebuilds]: https://github.com/jamiebuilds
[pull/67]: https://github.com/ashleygwilliams/wasm-pack/pull/67
[pull/100]: https://github.com/ashleygwilliams/wasm-pack/pull/100
- **`package.json` is pretty printed now - [yoshuawuyts], [pull/70]**
Previously, `package.json` was not very human readable. Now it is pretty printed!
- **`collaborators` - [yoshuawuyts], [pull/70]**
`wasm-pack` now will fill out the `collaborators` field in your `package.json` for
you based on your `Cargo.toml` `authors` data. For more discussion on how we decided
on this v.s. other types of `author` fields in `package.json`, see [issues/2].
[yoshuawuyts]: https://github.com/yoshuawuyts
[pull/70]: https://github.com/ashleygwilliams/wasm-pack/pull/70
[issues/2]: https://github.com/ashleygwilliams/wasm-pack/issues/2
- **Release binaries built with CI - [ashleygwilliams], [pull/103]**
[ashleygwilliams]: https://github.com/ashleygwilliams
[pull/103]: https://github.com/ashleygwilliams/wasm-pack/pull/103
### 🤕 Fixes
- **Optional `package.json` fields warn instead of failing - [mgattozzi], [pull/65]**
[pull/65]: https://github.com/ashleygwilliams/wasm-pack/pull/65
- **Program doesn't swallow stout and sterr - [mgattozzi], [pull/90]**
[mgattozzi]: https://github.com/mgattozzi
[pull/90]: https://github.com/ashleygwilliams/wasm-pack/pull/90
### 🛠️ Maintenance and 📖 Documentation
Thanks so much to [mgattozzi], [data-pup], [sendilkumarn], [Andy-Bell],
[steveklabnik], [jasondavies], and [edsrzf] for all the awesome refactoring,
documentation, typo-fixing, and testing work. We appreciate it so much!
[data-pup]: https://github.com/data-pup
[sendilkumarn]: https://github.com/sendilkumarn
[Andy-Bell]: https://github.com/Andy-Bell
[steveklabnik]: https://github.com/steveklabnik
[jasondavies]: https://github.com/jasondavies
[edsrzf]: https://github.com/edsrzf
## 💥 0.1.0
- First release!
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# The Rust Code of Conduct
A version of this document [can be found online](https://www.rust-lang.org/conduct.html).
## Conduct
**Contact**: [rust-mods@rust-lang.org](mailto:rust-mods@rust-lang.org)
* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.
* On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and welcoming environment for all.
* Please be kind and courteous. There's no need to be mean or rude.
* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.
* Please keep unstructured critique to a minimum. If you have solid ideas you want to experiment with, make a fork and see how it works.
* We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behavior. We interpret the term "harassment" as including the definition in the <a href="http://citizencodeofconduct.org/">Citizen Code of Conduct</a>; if you have any lack of clarity about what might be included in that concept, please read their definition. In particular, we don't tolerate behavior that excludes people in socially marginalized groups.
* Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or made uncomfortable by a community member, please contact one of the channel ops or any of the [Rust moderation team][mod_team] immediately. Whether you're a regular contributor or a newcomer, we care about making this community a safe place for you and we've got your back.
* Likewise any spamming, trolling, flaming, baiting or other attention-stealing behavior is not welcome.
## Moderation
These are the policies for upholding our community's standards of conduct. If you feel that a thread needs moderation, please contact the [Rust moderation team][mod_team].
1. Remarks that violate the Rust standards of conduct, including hateful, hurtful, oppressive, or exclusionary remarks, are not allowed. (Cursing is allowed, but never targeting another user, and never in a hateful manner.)
2. Remarks that moderators find inappropriate, whether listed in the code of conduct or not, are also not allowed.
3. Moderators will first respond to such remarks with a warning.
4. If the warning is unheeded, the user will be "kicked," i.e., kicked out of the communication channel to cool off.
5. If the user comes back and continues to make trouble, they will be banned, i.e., indefinitely excluded.
6. Moderators may choose at their discretion to un-ban the user if it was a first offense and they offer the offended party a genuine apology.
7. If a moderator bans someone and you think it was unjustified, please take it up with that moderator, or with a different moderator, **in private**. Complaints about bans in-channel are not allowed.
8. Moderators are held to a higher standard than other community members. If a moderator creates an inappropriate situation, they should expect less leeway than others.
In the Rust community we strive to go the extra step to look out for each other. Don't just aim to be technically unimpeachable, try to be your best self. In particular, avoid flirting with offensive or sensitive issues, particularly if they're off-topic; this all too often leads to unnecessary fights, hurt feelings, and damaged trust; worse, it can drive people away from the community entirely.
And if someone takes issue with something you said or did, resist the urge to be defensive. Just stop doing what it was they complained about and apologize. Even if you feel you were misinterpreted or unfairly accused, chances are good there was something you could've communicated better — remember that it's your responsibility to make your fellow Rustaceans comfortable. Everyone wants to get along and we are all here first and foremost because we want to talk about cool technology. You will find that people will be eager to assume good intent and forgive as long as you earn their trust.
The enforcement policies listed above apply to all official Rust venues; including official IRC channels (#rust, #rust-internals, #rust-tools, #rust-libs, #rustc, #rust-beginners, #rust-docs, #rust-community, #rust-lang, and #cargo); GitHub repositories under rust-lang, rust-lang-nursery, and rust-lang-deprecated; and all forums under rust-lang.org (users.rust-lang.org, internals.rust-lang.org). For other projects adopting the Rust Code of Conduct, please contact the maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion.
*Adapted from the [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).*
[mod_team]: https://www.rust-lang.org/team.html#Moderation-team
================================================
FILE: CONTRIBUTING.md
================================================
# Contributing
## Filing an Issue
If you are trying to use `wasm-pack` and run into an issue- please file an
issue! We'd love to get you up and running, even if the issue you have might
not be directly related to the code in `wasm-pack`. This tool seeks to make
it easy for developers to get going, so there's a good chance we can do
something to alleviate the issue by making `wasm-pack` better documented or
more robust to different developer environments.
When filing an issue, do your best to be as specific as possible. Include
the version of rust you are using (`rustc --version`) and your operating
system and version. The faster was can reproduce your issue, the faster we
can fix it for you!
## Submitting a PR
If you are considering filing a pull request, make sure that there's an issue
filed for the work you'd like to do. There might be some discussion required!
Filing an issue first will help ensure that the work you put into your pull
request will get merged :)
Before you submit your pull request, check that you have completed all of the
steps mentioned in the pull request template. Link the issue that your pull
request is responding to, and format your code using [rustfmt][rustfmt].
### Configuring rustfmt
Before submitting code in a PR, make sure that you have formatted the codebase
using [rustfmt][rustfmt]. `rustfmt` is a tool for formatting Rust code, which
helps keep style consistent across the project. If you have not used `rustfmt`
before, it is not too difficult.
If you have not already configured `rustfmt` for the
nightly toolchain, it can be done using the following steps:
**1. Use Nightly Toolchain**
Use the `rustup override` command to make sure that you are using the nightly
toolchain. Run this command in the `wasm-pack` directory you cloned.
```sh
rustup override set nightly
```
**2. Add the rustfmt component**
Install the most recent version of `rustfmt` using this command:
```sh
rustup component add rustfmt-preview --toolchain nightly
```
**3. Running rustfmt**
To run `rustfmt`, use this command:
```sh
cargo +nightly fmt
```
[rustfmt]: https://github.com/rust-lang-nursery/rustfmt
### IDE Configuration files
Machine specific configuration files may be generaged by your IDE while working on the project. Please make sure to add these files to a global .gitignore so they are kept from accidentally being commited to the project and causing issues for other contributors.
Some examples of these files are the `.idea` folder created by JetBrains products (WebStorm, IntelliJ, etc) as well as `.vscode` created by Visual Studio Code for workspace specific settings.
For help setting up a global .gitignore check out this [GitHub article]!
[GitHub article]: https://help.github.com/articles/ignoring-files/#create-a-global-gitignore
## Running tests
Some of this project's tests run in the browser with webdriver. macOS users
may need to first run:
```
safaridriver --enable
```
## Conduct
As mentioned in the readme file, this project is a part of the [`rust-wasm` working group],
an official working group of the Rust project. We follow the Rust [Code of Conduct and enforcement policies].
[`rust-wasm` working group]: https://github.com/rustwasm/team
[Code of Conduct and enforcement policies]: CODE_OF_CONDUCT.md
================================================
FILE: Cargo.toml
================================================
[package]
name = "wasm-pack"
description = "📦✨ your favorite rust -> wasm workflow tool!"
version = "0.14.0"
authors = ["Ashley Williams <ashley666ashley@gmail.com>", "Jesper Håkansson <jesper@jesperh.se>"]
repository = "https://github.com/drager/wasm-pack.git"
license = "MIT OR Apache-2.0"
edition = "2021"
readme = "README.md"
categories = ["wasm"]
documentation = "https://drager.github.io/wasm-pack/"
[dependencies]
anyhow = "1.0.100"
binary-install = "0.4.1"
cargo_metadata = "0.23.1"
chrono = "0.4.42"
console = "0.16.1"
dialoguer = "0.12.0"
env_logger = { version = "0.11.8", default-features = false }
glob = "0.3.3"
human-panic = "2.0.4"
log = "0.4.28"
parking_lot = "0.12.5"
semver = "1.0.27"
serde = "1.0.228"
serde_derive = "1.0.228"
serde_ignored = "0.1.14"
serde_json = "1.0.145"
siphasher = "1.0.1"
strsim = "0.11.1"
clap = { version = "4.2.5", features = ["derive"] }
toml = "0.9.8"
ureq = { version = "2.12.1", features = ["json", "socks-proxy"] }
walkdir = "2.5.0"
which = "8.0.0"
path-clean = "1.0.1"
[dev-dependencies]
assert_cmd = "2.1.1"
lazy_static = "1.5.0"
predicates = "3.1.3"
serial_test = "3.2.0"
tempfile = "3.23.0"
================================================
FILE: LICENSE-APACHE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: LICENSE-MIT
================================================
Copyright (c) 2018 Ashley Williams
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
================================================
FILE: README.md
================================================
<div align="center">
<h1>📦✨ wasm-pack</h1>
<p>
<strong>Your favorite Rust → Wasm workflow tool!</strong>
</p>
<p>
<a href="https://github.com/drager/wasm-pack/actions/workflows/test.yml"><img alt="Build Status" src="https://github.com/drager/wasm-pack/actions/workflows/test.yml/badge.svg?branch=master"/></a>
<a href="https://crates.io/crates/wasm-pack"><img alt="crates.io" src="https://img.shields.io/crates/v/wasm-pack"/></a>
</p>
<h3>
<a href="https://drager.github.io/wasm-pack/book">Docs</a>
<span> | </span>
<a href="https://github.com/drager/wasm-pack/blob/master/CONTRIBUTING.md">Contributing</a>
<span> | </span>
<a href="https://discordapp.com/channels/442252698964721669/443151097398296587">Chat</a>
</h3>
</div>
## 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].
[webpack]: https://webpack.js.org/

## 🔮 Prerequisites
This project requires Rust 1.30.0 or later.
- [Development Environment](https://drager.github.io/wasm-pack/book/prerequisites/index.html)
- [Installation](https://drager.github.io/wasm-pack/installer)
## ⚡ Quickstart Guide
Visit the [quickstart guide] in our documentation.
[quickstart guide]: https://drager.github.io/wasm-pack/book/quickstart.html
## 🎙️ Commands
- [`new`](https://drager.github.io/wasm-pack/book/commands/new.html): Generate a new RustWasm project using a template
- [`build`](https://drager.github.io/wasm-pack/book/commands/build.html): Generate an npm wasm pkg from a rustwasm crate
- [`test`](https://drager.github.io/wasm-pack/book/commands/test.html): Run browser tests
- [`pack` and `publish`](https://drager.github.io/wasm-pack/book/commands/pack-and-publish.html): 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
```
[`env_logger`]: https://crates.io/crates/env_logger
## 👯 Contributing
Read our [guide] on getting up and running for developing `wasm-pack`, and
check out our [contribution policy].
[guide]: https://drager.github.io/wasm-pack/book/contributing.html
[contribution policy]: CONTRIBUTING.md
## 🤹♀️ Governance
This project was started by [ashleygwilliams] and is maintained by [drager].
[ashleygwilliams]: https://github.com/ashleygwilliams
[drager]: https://github.com/drager
================================================
FILE: RELEASE_CHECKLIST.md
================================================
# Release Checklist
This is a list of the things that need to happen during a release.
1. Open the associated milestone. All issues and PRs should be closed. If
they are not you should reassign all open issues and PRs to future
milestones.
1. Go through the commit history since last release. Ensure that all PRs
that have landed are marked with the milestone. You can use this to
show all the PRs that are merged on or after YYY-MM-DD:
`https://github.com/issues?utf8=%E2%9C%93&q=repo%3Arustwasm%2Fwasm-pack+merged%3A%3E%3DYYYY-MM-DD`
1. Go through the closed PRs in the milestone. Each should have a changelog
label indicating if the change is docs, fix, feature, or maintenance. If
there is a missing label, please add one.
1. Choose an emoji for the release. Try to make it some sort of transition
from the previous releases emoji (point releases can be a little weirder).
1. Create a new branch "#.#.#" where "#.#.#" is the release's version.
1. Add this release to the `CHANGELOG.md`. Use the structure of previous
entries.
1. Update `DEFAULT_CHROMEDRIVER_VERSION` in `chromedriver.rs`.
Version is the response of `https://chromedriver.storage.googleapis.com/LATEST_RELEASE`.
1. Update `DEFAULT_GECKODRIVER_VERSION` in `geckodriver.rs`.
Version is the name of the latest tag - `https://github.com/mozilla/geckodriver/releases/latest`.
1. Update the version in `Cargo.toml`.
1. Update the version number and date in `docs/index.html`.
1. Run `cargo update`.
1. Run `cargo test`.
1. Run `cargo build`.
1. Copy `README.md` to `npm/README.md`
1. Bump the version number in `npm/package.json`
1. `cd npm && npm install`
1. Push up a commit with the `Cargo.toml`, `Cargo.lock`, `docs/index.html`,
and `CHANGELOG.md` changes. The commit message can just be "#.#.#".
1. Request review from `@ashleygwilliams` and `@drager`.
1. `git commit --amend` all changes into the single commit.
1. Once ready to merge, tag the commit with the tag `v#.#.#`.
1. Wait for the CI to go green.
1. The CI will build the release binaries. Take the `CHANGELOG.md` release
entry and cut and paste it into the release body.
1. Be sure to add any missing link definitions to the release.
1. Hit the big green Merge button.
1. `git checkout master` and `git pull --rebase origin master`
1. Run `cargo test`.
1. `cargo publish`
1. `cd npm && npm publish`
1. Tweet.
================================================
FILE: clippy.toml
================================================
too-many-arguments-threshold = 8
================================================
FILE: docs/_installer/build-installer.rs
================================================
use std::fs;
fn main() {
fs::create_dir_all("docs/installer").unwrap();
fs::copy(
"docs/_installer/wasm-pack.js",
"docs/installer/wasm-pack.js",
).unwrap();
let index = fs::read_to_string("docs/_installer/index.html").unwrap();
fs::write(
"docs/installer/index.html",
fixup(&index),
).unwrap();
let init = fs::read_to_string("docs/_installer/init.sh").unwrap();
fs::write(
"docs/installer/init.sh",
fixup(&init),
).unwrap();
}
fn fixup(input: &str) -> String {
let manifest = fs::read_to_string("Cargo.toml").unwrap();
let version = manifest.lines()
.find(|line| line.starts_with("version ="))
.unwrap();
let version = &version[version.find('"').unwrap() + 1..version.rfind('"').unwrap()];
input.replace("$VERSION", &format!("v{}", version))
}
================================================
FILE: docs/_installer/index.html
================================================
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<title>wasm-pack</title>
<link
href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css"
rel="stylesheet"
/>
<link rel="stylesheet" href="../public/custom.css" />
<style>
.winlink {
display: block;
}
</style>
<link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png" />
<link rel="manifest" href="../site.webmanifest" />
<link rel="mask-icon" href="../safari-pinned-tab.svg" color="#5bbad5" />
<meta name="msapplication-TileColor" content="#00aba9" />
<meta name="theme-color" content="#ffffff" />
</head>
<body>
<nav class="navbar">
<div class="container">
<ul class="navbar-list">
<li class="navbar-logo">
<a href="/wasm-pack">
<img src="../public/img/rustwasm.png" />
</a>
</li>
<li class="navbar-item">
<a href="https://github.com/drager/wasm-pack/issues/new/choose"
>File an Issue</a
>
</li>
<li class="navbar-item">
<a href="/wasm-pack/book">Documentation</a>
</li>
<li class="navbar-item">
<a href="/wasm-pack/installer">Install</a>
</li>
</ul>
</div>
</nav>
<section id="installer">
<img src="../public/img/wasm-ferris.png" />
<h1>Install <code>wasm-pack</code></h1>
<div class="container">
<div id="platform-instructions-unix" style="display: none">
<p>
You appear to be running a *nix system (Unix, Linux, MacOS). Install
by running:
</p>
<pre class="primary">
curl https://drager.github.io/wasm-pack/installer/init.sh -sSf | sh</pre
>
<p>
If you're not on *nix, or you don't like installing from <b>curl</b>,
follow the alternate instructions below.
</p>
</div>
<div id="platform-instructions-win64" style="display: none">
<p>
You appear to be running Windows 64-bit. Download and run
<a
class="winlink"
href="https://github.com/drager/wasm-pack/releases/download/$VERSION/wasm-pack-init.exe"
>wasm-pack-init.exe</a
>
then follow the onscreen instructions.
</p>
<hr />
<p>
If you're a Windows Subsystem for Linux user, run the following in
your terminal, then follow the onscreen instructions to install
wasm-pack.
</p>
<pre class="primary">
curl https://drager.github.io/wasm-pack/installer/init.sh -sSf | sh</pre
>
<p>
If you're not on Windows 64-bit, follow the alternate instructions
below.
</p>
</div>
<div id="platform-instructions-unknown" style="display: none">
<p>I don't recognize your platform.</p>
<p>
We would appreciate it if you
<a href="https://github.com/drager/wasm-pack/issues/new"
>reported an issue</a
>, along with the following values:
</p>
<div>
<div>navigator.platform:</div>
<div id="nav-plat"></div>
<div>navigator.appVersion:</div>
<div id="nav-app"></div>
</div>
</div>
<hr />
<div id="generic-instructions">
<p>To install from source on any platform:</p>
<p><code>cargo install wasm-pack</code></p>
<p>
On supported platforms, you can also use <b>npm</b> or <b>yarn</b> to
download a precompiled binary:
</p>
<p>
<code>npm install -g wasm-pack</code> or
<code>yarn global add wasm-pack</code>
</p>
</div>
</div>
</section>
<script type="text/javascript" src="wasm-pack.js"></script>
</body>
================================================
FILE: docs/_installer/init.sh
================================================
#!/bin/bash
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.
# This is just a little script that can be downloaded from the internet to
# install wasm-pack. It just does platform detection, downloads the installer
# and runs it.
set -u
# Parse VERSION from environment or --version argument, default to "latest"
if [ -z "${VERSION:-}" ]; then
VERSION=""
ORIG_ARGS=("$@")
while [ $# -gt 0 ]; do
case $1 in
--version)
VERSION="$2"
shift 2
;;
*)
shift
;;
esac
done
set -- "${ORIG_ARGS[@]}"
if [ -z "$VERSION" ]; then
VERSION="latest"
fi
fi
# Resolve "latest" to actual version number
if [ "$VERSION" = "latest" ]; then
VERSION=$(curl -s https://api.github.com/repos/drager/wasm-pack/releases/latest | grep '"tag_name"' | sed -E 's/.*"v?([^"]+)".*/\1/')
if [ -z "$VERSION" ]; then
err "failed to fetch latest version from GitHub API"
fi
fi
# Normalize version format for download URL
case "$VERSION" in
v*) ;;
*) VERSION="v$VERSION" ;;
esac
UPDATE_ROOT="https://github.com/drager/wasm-pack/releases/download/$VERSION"
main() {
downloader --check
need_cmd uname
need_cmd mktemp
need_cmd chmod
need_cmd mkdir
need_cmd rm
need_cmd rmdir
need_cmd tar
need_cmd which
need_cmd dirname
get_architecture || return 1
local _arch="$RETVAL"
assert_nz "$_arch" "arch"
local _ext=""
case "$_arch" in
*windows*)
_ext=".exe"
;;
esac
which rustup > /dev/null 2>&1
need_ok "failed to find Rust installation, is rustup installed?"
local _rustup=$(which rustup)
local _tardir="wasm-pack-$VERSION-${_arch}"
local _url="$UPDATE_ROOT/${_tardir}.tar.gz"
local _dir="$(mktemp -d 2>/dev/null || ensure mktemp -d -t wasm-pack)"
local _file="$_dir/input.tar.gz"
local _wasmpack="$_dir/wasm-pack$_ext"
local _wasmpackinit="$_dir/wasm-pack-init$_ext"
printf '%s\n' 'info: downloading wasm-pack' 1>&2
ensure mkdir -p "$_dir"
downloader "$_url" "$_file"
if [ $? != 0 ]; then
say "failed to download $_url"
say "this may be a standard network error, but it may also indicate"
say "that wasm-pack's release process is not working. When in doubt"
say "please feel free to open an issue!"
exit 1
fi
ensure tar xf "$_file" --strip-components 1 -C "$_dir"
mv "$_wasmpack" "$_wasmpackinit"
# The installer may want to ask for confirmation on stdin for various
# operations. We were piped through `sh` though so we probably don't have
# access to a tty naturally. If it looks like we're attached to a terminal
# (`-t 1`) then pass the tty down to the installer explicitly.
if [ -t 1 ]; then
"$_wasmpackinit" "$@" < /dev/tty
else
"$_wasmpackinit" "$@"
fi
local _retval=$?
ignore rm -rf "$_dir"
return "$_retval"
}
get_architecture() {
local _ostype="$(uname -s)"
local _cputype="$(uname -m)"
# This is when installing inside docker, or can be useful to side-step
# the script's built-in platform detection heuristic (if it drifts again in the future)
set +u
if [ -n "$TARGETOS" ]; then
_ostype="$TARGETOS" # probably always linux
fi
if [ -n "$TARGETARCH" ]; then
_cputype="$TARGETARCH"
fi
set -u
if [ "$_ostype" = Darwin ] && [ "$_cputype" = i386 ]; then
# Darwin `uname -s` lies
if sysctl hw.optional.x86_64 | grep -q ': 1'; then
local _cputype=x86_64
fi
fi
case "$_ostype" in
Linux | linux)
local _ostype=unknown-linux-musl
;;
Darwin)
local _ostype=apple-darwin
;;
MINGW* | MSYS* | CYGWIN*)
local _ostype=pc-windows-msvc
;;
*)
err "no precompiled binaries available for OS: $_ostype"
;;
esac
case "$_cputype" in
x86_64 | x86-64 | x64 | amd64)
local _cputype=x86_64
;;
arm64 | aarch64)
local _cputype=aarch64
;;
*)
err "no precompiled binaries available for CPU architecture: $_cputype"
esac
# See https://github.com/drager/wasm-pack/pull/1088
if [ "$_cputype" = "aarch64" ] && [ "$_ostype" = "apple-darwin" ]; then
_cputype="x86_64"
fi
local _arch="$_cputype-$_ostype"
RETVAL="$_arch"
}
say() {
echo "wasm-pack-init: $1"
}
err() {
say "$1" >&2
exit 1
}
need_cmd() {
if ! check_cmd "$1"
then err "need '$1' (command not found)"
fi
}
check_cmd() {
command -v "$1" > /dev/null 2>&1
return $?
}
need_ok() {
if [ $? != 0 ]; then err "$1"; fi
}
assert_nz() {
if [ -z "$1" ]; then err "assert_nz $2"; fi
}
# Run a command that should never fail. If the command fails execution
# will immediately terminate with an error showing the failing
# command.
ensure() {
"$@"
need_ok "command failed: $*"
}
# This is just for indicating that commands' results are being
# intentionally ignored. Usually, because it's being executed
# as part of error handling.
ignore() {
"$@"
}
# This wraps curl or wget. Try curl first, if not installed,
# use wget instead.
downloader() {
if check_cmd curl
then _dld=curl
elif check_cmd wget
then _dld=wget
else _dld='curl or wget' # to be used in error message of need_cmd
fi
if [ "$1" = --check ]
then need_cmd "$_dld"
elif [ "$_dld" = curl ]
then curl -sSfL "$1" -o "$2"
elif [ "$_dld" = wget ]
then wget "$1" -O "$2"
else err "Unknown downloader" # should not reach here
fi
}
main "$@" || exit 1
================================================
FILE: docs/_installer/wasm-pack.js
================================================
var platforms = ["unknown", "win64", "unix"];
var platform_override = null;
function detect_platform() {
"use strict";
if (platform_override !== null) {
return platforms[platform_override];
}
var os = "unknown";
if (navigator.platform == "Linux x86_64") {os = "unix";}
if (navigator.platform == "Linux i686") {os = "unix";}
if (navigator.platform == "Linux i686 on x86_64") {os = "unix";}
if (navigator.platform == "Linux aarch64") {os = "unix";}
if (navigator.platform == "Linux armv6l") {os = "unix";}
if (navigator.platform == "Linux armv7l") {os = "unix";}
if (navigator.platform == "Linux armv8l") {os = "unix";}
if (navigator.platform == "Linux ppc64") {os = "unix";}
if (navigator.platform == "Linux mips") {os = "unix";}
if (navigator.platform == "Linux mips64") {os = "unix";}
if (navigator.platform == "Mac") {os = "unix";}
// if (navigator.platform == "Win32") {os = "win32";}
if (navigator.platform == "Win64" ||
navigator.userAgent.indexOf("WOW64") != -1 ||
navigator.userAgent.indexOf("Win64") != -1) { os = "win64"; }
if (navigator.platform == "FreeBSD x86_64") {os = "unix";}
if (navigator.platform == "FreeBSD amd64") {os = "unix";}
if (navigator.platform == "NetBSD x86_64") {os = "unix";}
if (navigator.platform == "NetBSD amd64") {os = "unix";}
// I wish I knew by now, but I don't. Try harder.
if (os == "unknown") {
// if (navigator.appVersion.indexOf("Win")!=-1) {os = "win32";}
if (navigator.appVersion.indexOf("Mac")!=-1) {os = "unix";}
// rust-www/#692 - FreeBSD epiphany!
if (navigator.appVersion.indexOf("FreeBSD")!=-1) {os = "unix";}
}
// Firefox Quantum likes to hide platform and appVersion but oscpu works
if (navigator.oscpu) {
// if (navigator.oscpu.indexOf("Win32")!=-1) {os = "win32";}
if (navigator.oscpu.indexOf("Win64")!=-1) {os = "win64";}
if (navigator.oscpu.indexOf("Mac")!=-1) {os = "unix";}
if (navigator.oscpu.indexOf("Linux")!=-1) {os = "unix";}
if (navigator.oscpu.indexOf("FreeBSD")!=-1) {os = "unix";}
if (navigator.oscpu.indexOf("NetBSD")!=-1) {os = "unix";}
}
return os;
}
function adjust_for_platform() {
"use strict";
var platform = detect_platform();
platforms.forEach(function (platform_elem) {
var platform_div = document.getElementById("platform-instructions-" + platform_elem);
platform_div.style.display = "none";
if (platform === platform_elem) {
platform_div.style.display = "block";
}
});
}
function fill_in_bug_report_values() {
var nav_plat = document.getElementById("nav-plat");
var nav_app = document.getElementById("nav-app");
nav_plat.textContent = navigator.platform;
nav_app.textContent = navigator.appVersion;
}
(function () {
adjust_for_platform();
fill_in_bug_report_values();
}());
================================================
FILE: docs/_theme/header.hbs
================================================
<style>
header.warning {
background-color: rgb(242, 222, 222);
border-bottom-color: rgb(238, 211, 215);
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom-style: solid;
border-bottom-width: 0.666667px;
border-image-outset: 0 0 0 0;
border-image-repeat: stretch stretch;
border-image-slice: 100% 100% 100% 100%;
border-image-source: none;
border-image-width: 1 1 1 1;
border-left-color: rgb(238, 211, 215);
border-left-style: solid;
border-left-width: 0.666667px;
border-right-color: rgb(238, 211, 215);
border-right-style: solid;
border-right-width: 0.666667px;
border-top-color: rgb(238, 211, 215);
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-top-style: solid;
border-top-width: 0.666667px;
color: rgb(185, 74, 72);
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
margin-top: 30px;
padding-bottom: 8px;
padding-left: 14px;
padding-right: 35px;
padding-top: 8px;
text-align: center;
}
</style>
<header class='warning'>
<p>
This is the <strong>unpublished</strong> documentation of
<code>wasm-pack</code>, the published documentation is available
<a href="https://drager.github.io/wasm-pack/">
on the main Rust and WebAssembly documentation site
</a>. Features documented here may not be available in released versions of
<code>wasm-pack</code>.
</p>
</header>
================================================
FILE: docs/book.toml
================================================
[book]
authors = ["Ashley Williams"]
src = "src"
title = "Hello wasm-pack!"
================================================
FILE: docs/browserconfig.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/mstile-150x150.png"/>
<TileColor>#00aba9</TileColor>
</tile>
</msapplication>
</browserconfig>
================================================
FILE: docs/index.html
================================================
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>wasm-pack</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css" rel="stylesheet">
<link rel="stylesheet" href="./public/custom.css" />
<link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="./favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="./favicon-16x16.png">
<link rel="manifest" href="./site.webmanifest">
<link rel="mask-icon" href="./safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#00aba9">
<meta name="theme-color" content="#ffffff">
</head>
<body>
<nav class="navbar">
<div class="container">
<ul class="navbar-list">
<li class="navbar-logo">
<a href="/wasm-pack">
<img src="./public/img/rustwasm.png">
</a>
</a>
<li class="navbar-item">
<a href="https://github.com/drager/wasm-pack/issues/new/choose">File an Issue</a>
</li>
<li class="navbar-item">
<a href="/wasm-pack/book">Documentation</a>
</li>
<li class="navbar-item">
<a href="/wasm-pack/installer">Install</a>
</li>
</ul>
</div>
</nav>
<header>
<div class="container">
<div class="row">
<div class="seven columns" id="logo">
<img src="./public/img/wasm-ferris.png"alt="wasm ferris logo" />
<h1><code>wasm-pack</code></h1>
<h2>📦✨ your favorite rust -> wasm workflow tool!</h2>
</div>
<div class="five columns" id="installer">
<a class="button button-primary" href="/wasm-pack/installer">✨ Install wasm-pack 0.14.0 ✨</a>
<p>20 Jan 2026 |
<a href="https://github.com/drager/wasm-pack/releases/tag/v0.14.0">
Release Notes
</a>
</p>
</div>
</div>
</header>
</div>
</div>
<script type="text/javascript" src="installer/wasm-pack.js"></script>
</body>
================================================
FILE: docs/public/custom.css
================================================
@import url('https://fonts.googleapis.com/css?family=Raleway');
.navbar {
display: block;
width: 100%;
height: 6.5rem;
background: #fff;
z-index: 99;
border-bottom: 1px solid #eee;
}
.navbar-list {
list-style: none;
margin-bottom: 0;
}
.navbar-item {
position: relative;
float: right;
margin-bottom: 0;
}
.navbar-logo {
position: relative;
float: left;
margin-bottom: 0;
bottom: -5px;
}
.navbar-logo a img {
width: 50px;
}
.navbar-item a {
text-transform: uppercase;
font-size: 11px;
font-weight: 600;
letter-spacing: .2rem;
margin-right: 35px;
text-decoration: none;
line-height: 6.5rem;
color: #222;
}
#logo, #installer {
text-align: center;
}
#logo {
padding: 50px;
}
#logo img {
width: 80%;
}
#logo h1, h2 {
text-align: center;
}
#logo h2 {
font-size: 1.8rem;
letter-spacing: 0.01rem;
color: #222;
}
#installer a.button {
width: 100%;
height: 20%;
font-size: 1.8rem;
padding: 1.8rem;
margin: 10rem 0 1.8rem 0;
background-color: #6556EC;
border-color: #6556EC;
}
#installer img {
padding: 50px;
width: 20%;
}
pre.primary {
margin: 0 auto 2.5rem auto;
width: fit-content;
padding: 20px;
font-size: 2rem;
background-color: #000;
color: #fff;
}
a {
color: #6556EC;
}
================================================
FILE: docs/site.webmanifest
================================================
{
"name": "wasm-pack ",
"short_name": "wasm-pack ",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-384x384.png",
"sizes": "384x384",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
================================================
FILE: docs/src/SUMMARY.md
================================================
# Summary
- [Introduction](./introduction.md)
- [Quickstart](./quickstart.md)
- [Prerequisites](./prerequisites/index.md)
- [npm (optional)](./prerequisites/npm.md)
- [considerations](./prerequisites/considerations.md)
- [Non-`rustup` setups](./prerequisites/non-rustup-setups.md)
- [Commands](./commands/index.md)
- [`new`](./commands/new.md)
- [`build`](./commands/build.md)
- [`test`](./commands/test.md)
- [`pack` and `publish`](./commands/pack-and-publish.md)
- [`init` (DEPRECATED)](./commands/init.md)
- [Tutorials](./tutorials/index.md)
- [Hybrid applications with Webpack](./tutorials/hybrid-applications-with-webpack/index.md)
- [Getting started](./tutorials/hybrid-applications-with-webpack/getting-started.md)
- [Using your library](./tutorials/hybrid-applications-with-webpack/using-your-library.md)
- [npm browser packages](./tutorials/npm-browser-packages/index.md)
- [Getting started](./tutorials/npm-browser-packages/getting-started.md)
- [Manual Setup](./tutorials/npm-browser-packages/getting-started/manual-setup.md)
- [Template deep dive](./tutorials/npm-browser-packages/template-deep-dive/index.md)
- [`Cargo.toml`](./tutorials/npm-browser-packages/template-deep-dive/cargo-toml.md)
- [`src/lib.rs`](./tutorials/npm-browser-packages/template-deep-dive/src-lib-rs.md)
- [`src/utils.rs`](./tutorials/npm-browser-packages/template-deep-dive/src-utils-rs.md)
- [`wee_alloc`](./tutorials/npm-browser-packages/template-deep-dive/wee_alloc.md)
- [`tests/web.rs`](./tutorials/npm-browser-packages/template-deep-dive/tests-web-rs.md)
- [Building your project](./tutorials/npm-browser-packages/building-your-project.md)
- [Testing your project](./tutorials/npm-browser-packages/testing-your-project.md)
- [Packaging and publishing](./tutorials/npm-browser-packages/packaging-and-publishing.md)
- [Using your library](./tutorials/npm-browser-packages/using-your-library.md)
- [`Cargo.toml` Configuration](./cargo-toml-configuration.md)
- [Contributing](./contributing.md)
================================================
FILE: docs/src/cargo-toml-configuration.md
================================================
# `Cargo.toml` Configuration
`wasm-pack` can be configured via the `package.metadata.wasm-pack` key in
`Cargo.toml`. Every option has a default, and is not required.
There are three profiles: `dev`, `profiling`, and `release`. These correspond to
the `--dev`, `--profiling`, and `--release` flags passed to `wasm-pack build`.
The available configuration options and their default values are shown below:
```toml
[package.metadata.wasm-pack.profile.dev]
# Should `wasm-opt` be used to further optimize the wasm binary generated after
# the Rust compiler has finished? Using `wasm-opt` can often further decrease
# binary size or do clever tricks that haven't made their way into LLVM yet.
#
# Configuration is set to `false` by default for the dev profile, but it can
# be set to an array of strings which are explicit arguments to pass to
# `wasm-opt`. For example `['-Os']` would optimize for size while `['-O4']`
# would execute very expensive optimizations passes
#
# In most cases, the `-O[X]` flag is enough. However, if you require extreme
# optimizations, see the full list of `wasm-opt` optimization flags
# https://github.com/WebAssembly/binaryen/blob/version_117/test/lit/help/wasm-opt.test
wasm-opt = ['-O']
[package.metadata.wasm-pack.profile.dev.wasm-bindgen]
# Should we enable wasm-bindgen's debug assertions in its generated JS glue?
debug-js-glue = true
# Should wasm-bindgen demangle the symbols in the "name" custom section?
demangle-name-section = true
# Should we emit the DWARF debug info custom sections?
dwarf-debug-info = false
# Should we omit the default import path?
omit-default-module-path = false
# Controls whether wasm-bindgen will split linked modules out into their own files. Enabling this is recommended, because it allows lazy-loading the linked modules and setting a stricter Content Security Policy. Only available in wasm-bindgen 0.2.95 and later.
split-linked-modules = false
[package.metadata.wasm-pack.profile.profiling]
wasm-opt = ['-O']
[package.metadata.wasm-pack.profile.profiling.wasm-bindgen]
debug-js-glue = false
demangle-name-section = true
dwarf-debug-info = false
omit-default-module-path = false
# `wasm-opt` is on by default in for the release profile, but it can be
# disabled by setting it to `false`
[package.metadata.wasm-pack.profile.release]
wasm-opt = false
[package.metadata.wasm-pack.profile.release.wasm-bindgen]
debug-js-glue = false
demangle-name-section = true
dwarf-debug-info = false
omit-default-module-path = false
```
================================================
FILE: docs/src/commands/build.md
================================================
# wasm-pack build
The `wasm-pack build` command creates the files necessary for JavaScript
interoperability and for publishing a package to npm. This involves compiling
your code to wasm and generating a pkg folder. This pkg folder will contain the
wasm binary, a JS wrapper file, your `README`, and a `package.json` file.
The `pkg` directory is automatically `.gitignore`d by default, since it contains
build artifacts which are not intended to be checked into version
control.<sup>[0](#footnote-0)</sup>
## Path
The `wasm-pack build` command can be given an optional path argument, e.g.:
```
wasm-pack build examples/js-hello-world
```
This path should point to a directory that contains a `Cargo.toml` file. If no
path is given, the `build` command will run in the current directory.
## Output Directory
By default, `wasm-pack` will generate a directory for its build output called `pkg`.
If you'd like to customize this you can use the `--out-dir` flag.
```
wasm-pack build --out-dir out
```
The above command will put your build artifacts in a directory called `out`, instead
of the default `pkg`.
## Generated file names
Flag `--out-name` sets the prefix for output file names. If not provided, package name is used instead.
Usage examples, assuming our crate is named `dom`:
```
wasm-pack build
# will produce files
# dom.d.ts dom.js dom_bg.d.ts dom_bg.wasm package.json README.md
wasm-pack build --out-name index
# will produce files
# index.d.ts index.js index_bg.d.ts index_bg.wasm package.json README.md
```
## Profile
The `build` command accepts an optional profile argument: one of `--dev`,
`--profiling`, or `--release`. If none is supplied, then `--release` is used.
This controls whether debug assertions are enabled, debug info is generated, and
which (if any) optimizations are enabled.
| Profile | Debug Assertions | Debug Info | Optimizations | Notes |
|---------------|------------------|------------|---------------|---------------------------------------|
| `--dev` | Yes | Yes | No | Useful for development and debugging. |
| `--profiling` | No | Yes | Yes | Useful when profiling and investigating performance issues. |
| `--release` | No | No | Yes | Useful for shipping to production. |
The `--dev` profile will build the output package using cargo's [default
non-release profile][cargo-profile-sections-documentation]. Building this way is
faster but applies few optimizations to the output, and enables debug assertions
and other runtime correctness checks. The `--profiling` and `--release` profiles
use cargo's release profile, but the former enables debug info as well, which
helps when investigating performance issues in a profiler.
The exact meaning of the profile flags may evolve as the platform matures.
[cargo-profile-sections-documentation]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-profile-sections
## Target
The `build` command accepts a `--target` argument. This will customize the JS
that is emitted and how the WebAssembly files are instantiated and loaded. For
more documentation on the various strategies here, see the [documentation on
using the compiled output][deploy].
```
wasm-pack build --target nodejs
```
| Option | Usage | Description |
|-----------|------------|-----------------------------------------------------------------------------------------------------|
| *not specified* or `bundler` | [Bundler][bundlers] | Outputs JS that is suitable for interoperation with a Bundler like Webpack. You'll `import` the JS and the `module` key is specified in `package.json`. `sideEffects: false` is by default. |
| `nodejs` | [Node.js][deploy-nodejs] | Outputs JS that uses CommonJS modules, for use with a `require` statement. `main` key in `package.json`. |
| `web` | [Native in browser][deploy-web] | Outputs JS that can be natively imported as an ES module in a browser, but the WebAssembly must be manually instantiated and loaded. |
| `no-modules` | [Native in browser][deploy-web] | Same as `web`, except the JS is included on a page and modifies global state, and doesn't support as many `wasm-bindgen` features as `web` |
| `deno` | [Deno][deploy-deno] | Outputs JS that can be natively imported as an ES module in deno. |
[deploy]: https://wasm-bindgen.github.io/wasm-bindgen/reference/deployment.html
[bundlers]: https://wasm-bindgen.github.io/wasm-bindgen/reference/deployment.html#bundlers
[deploy-nodejs]: https://wasm-bindgen.github.io/wasm-bindgen/reference/deployment.html#nodejs
[deploy-web]: https://wasm-bindgen.github.io/wasm-bindgen/reference/deployment.html#without-a-bundler
[deploy-deno]: https://wasm-bindgen.github.io/wasm-bindgen/reference/deployment.html#deno
## Scope
The `build` command also accepts an optional `--scope` argument. This will scope
your package name, which is useful if your package name might conflict with
something in the public registry. For example:
```
wasm-pack build examples/js-hello-world --scope test
```
This command would create a `package.json` file for a package called
`@test/js-hello-world`. For more information about scoping, you can refer to
the npm documentation [here][npm-scope-documentation].
[npm-scope-documentation]: https://docs.npmjs.com/misc/scope
## Mode
The `build` command accepts an optional `--mode` argument.
```
wasm-pack build examples/js-hello-world --mode no-install
```
| Option | Description |
|---------------|------------------------------------------------------------------------------------------|
| `no-install` | `wasm-pack build` implicitly and create wasm binding without installing `wasm-bindgen`. |
| `normal` | do all the stuffs of `no-install` with installed `wasm-bindgen`. |
## Extra options
The `build` command can pass extra options straight to `cargo build` even if
they are not supported in wasm-pack. To use them simply add the extra arguments
at the very end of your command, just as you would for `cargo build`. For
example, to build the previous example using cargo's offline feature:
```
wasm-pack build examples/js-hello-world --mode no-install -- --offline
```
<hr style="font-size: 1.5em; margin-top: 2.5em"/>
<sup id="footnote-0">0</sup> If you need to include additional assets in the pkg
directory and your NPM package, we intend to have a solution for your use case
soon. [↩](#wasm-pack-build)
================================================
FILE: docs/src/commands/index.md
================================================
# Commands
`wasm-pack` has several commands to help you during the process of building
a Rust-generated WebAssembly project.
- `new`: This command generates a new project for you using a template. [Learn more][new]
- `build`: This command builds a `pkg` directory for you with compiled wasm and generated JS. [Learn more][build]
- `pack` and `publish`: These commands will create a tarball, and optionally publish it to a registry, such as npm. [Learn more][pack-pub]
### Deprecated Commands
- `init`: This command has been deprecated in favor of `build`.
[new]: ./new.html
[build]: ./build.html
[pack-pub]: ./pack-and-publish.html
### Log levels
By default `wasm-pack` displays a lot of useful information.
You can cause it to display even *more* information by using `--verbose`, or you can silence *all* stdout by using `--quiet`.
You can also use `--log-level` to have fine-grained control over wasm-pack's log output:
* `--log-level info` is the default, it causes all messages to be logged.
* `--log-level warn` causes warnings and errors to be displayed, but not info.
* `--log-level error` causes only errors to be displayed.
These flags are global flags, so they can be used with every command, and they must come *before* the command:
```sh
wasm-pack --log-level error build
wasm-pack --quiet build
wasm-pack --verbose build
```
================================================
FILE: docs/src/commands/init.md
================================================
# wasm-pack init (DEPRECATED)
This command has been deprecated in favor of `build`, which does the same thing, but is
a much more representative name for the command. [Read the docs for `build`.][build]
[build]: ./build.html
================================================
FILE: docs/src/commands/new.md
================================================
# wasm-pack new
The `wasm-pack new` command creates a new RustWasm project for you,
using [`cargo-generate`] under the hood.
It takes 3 parameters, name, template, and mode:
```
wasm-pack new <name> --template <template> --mode <normal|noinstall|force>
```
The default template is [`drager/wasm-pack-template`](https://github.com/drager/wasm-pack-template).
## Name
The `wasm-pack new` command must be given a name argument, e.g.:
```
wasm-pack new myproject
```
## Template
The `wasm-pack new` command can be given an optional template argument, e.g.:
```
wasm-pack new myproject --template https://github.com/drager/wasm-pack-template
```
The template can be an address to a git repo that contains a [`cargo-generate`]
template.
[`cargo-generate`]: https://github.com/ashleygwilliams/cargo-generate
## Mode
The `wasm-pack new` command can be given an optional mode argument, e.g.:
```
wasm-pack new myproject --mode noinstall
```
The mode passed can be either "normal", "noinstall", or "force". "normal" is passed by
default.
`noinstall` means that wasm-pack should not attempt to install any underlying tools.
If a necessary tool cannot be found, the command will error.
`force` means that wasm-pack should not check the local Rust version. If a local Rust
is an unacceptable Rust version, the command will error.
================================================
FILE: docs/src/commands/pack-and-publish.md
================================================
# pack and publish
The `publish` and `pack` commands interact with the pkg directory that's
created when you run `wasm-pack build`. The `pack` command creates a tarball
from the pkg directory and the `publish` command creates a tarball from the
pkg directory **and** publishes it to the NPM registry.
Underneath, these commands use `npm pack` and `npm publish`. You can read
more about these in the NPM documentation:
- [`npm pack`](https://docs.npmjs.com/cli/pack)
- [`npm publish`](https://docs.npmjs.com/cli/publish)
Both these commands take the path to the pkg directory as the first argument.
You can either set the argument directly to the pkg directory or to the parent
of the pkg directory:
```
$ wasm-pack pack myproject/pkg
| 🎒 packed up your package!
$ wasm-pack pack myproject
| 🎒 packed up your package!
```
If you try to call `pack` or `publish` on another directory, you get an error:
```
$ wasm-pac
gitextract_7ickrjy7/
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ └── feature_request.md
│ ├── PULL_REQUEST_TEMPLATE.md
│ └── workflows/
│ ├── approve.yml
│ ├── book.yml
│ ├── release.yml
│ └── test.yml
├── .gitignore
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Cargo.toml
├── LICENSE-APACHE
├── LICENSE-MIT
├── README.md
├── RELEASE_CHECKLIST.md
├── clippy.toml
├── docs/
│ ├── _installer/
│ │ ├── build-installer.rs
│ │ ├── index.html
│ │ ├── init.sh
│ │ └── wasm-pack.js
│ ├── _theme/
│ │ └── header.hbs
│ ├── book.toml
│ ├── browserconfig.xml
│ ├── index.html
│ ├── public/
│ │ └── custom.css
│ ├── site.webmanifest
│ └── src/
│ ├── SUMMARY.md
│ ├── cargo-toml-configuration.md
│ ├── commands/
│ │ ├── build.md
│ │ ├── index.md
│ │ ├── init.md
│ │ ├── new.md
│ │ ├── pack-and-publish.md
│ │ └── test.md
│ ├── contributing.md
│ ├── introduction.md
│ ├── prerequisites/
│ │ ├── considerations.md
│ │ ├── index.md
│ │ ├── non-rustup-setups.md
│ │ └── npm.md
│ ├── quickstart.md
│ └── tutorials/
│ ├── hybrid-applications-with-webpack/
│ │ ├── getting-started.md
│ │ ├── index.md
│ │ └── using-your-library.md
│ ├── index.md
│ ├── npm-browser-packages/
│ │ ├── building-your-project.md
│ │ ├── getting-started/
│ │ │ └── manual-setup.md
│ │ ├── getting-started.md
│ │ ├── index.md
│ │ ├── packaging-and-publishing.md
│ │ ├── template-deep-dive/
│ │ │ ├── building-your-project.md
│ │ │ ├── cargo-toml.md
│ │ │ ├── index.md
│ │ │ ├── src-lib-rs.md
│ │ │ ├── src-utils-rs.md
│ │ │ ├── tests-web-rs.md
│ │ │ └── wee_alloc.md
│ │ ├── testing-your-project.md
│ │ └── using-your-library.md
│ └── standalone-wasm-binaries/
│ └── index.md
├── npm/
│ ├── .gitignore
│ ├── README.md
│ ├── binary.js
│ ├── install.js
│ ├── package.json
│ └── run.js
├── src/
│ ├── bindgen.rs
│ ├── build/
│ │ ├── mod.rs
│ │ └── wasm_target.rs
│ ├── cache.rs
│ ├── child.rs
│ ├── command/
│ │ ├── build.rs
│ │ ├── generate.rs
│ │ ├── login.rs
│ │ ├── mod.rs
│ │ ├── pack.rs
│ │ ├── publish/
│ │ │ ├── access.rs
│ │ │ └── mod.rs
│ │ ├── test.rs
│ │ └── utils.rs
│ ├── emoji.rs
│ ├── generate.rs
│ ├── install/
│ │ ├── arch.rs
│ │ ├── krate.rs
│ │ ├── mod.rs
│ │ ├── mode.rs
│ │ ├── os.rs
│ │ └── tool.rs
│ ├── installer.rs
│ ├── lib.rs
│ ├── license.rs
│ ├── lockfile.rs
│ ├── main.rs
│ ├── manifest/
│ │ ├── mod.rs
│ │ └── npm/
│ │ ├── commonjs.rs
│ │ ├── esmodules.rs
│ │ ├── mod.rs
│ │ ├── nomodules.rs
│ │ └── repository.rs
│ ├── npm.rs
│ ├── progressbar.rs
│ ├── readme.rs
│ ├── stamps.rs
│ ├── target.rs
│ ├── test/
│ │ ├── mod.rs
│ │ ├── webdriver/
│ │ │ ├── chromedriver.rs
│ │ │ ├── geckodriver.rs
│ │ │ └── safaridriver.rs
│ │ └── webdriver.rs
│ └── wasm_opt.rs
└── tests/
└── all/
├── build.rs
├── download.rs
├── generate.rs
├── license.rs
├── lockfile.rs
├── log_level.rs
├── main.rs
├── manifest.rs
├── readme.rs
├── stamps.rs
├── test.rs
├── utils/
│ ├── file.rs
│ ├── fixture.rs
│ ├── manifest.rs
│ └── mod.rs
├── wasm_opt.rs
└── webdriver.rs
SYMBOL INDEX (397 symbols across 60 files)
FILE: docs/_installer/build-installer.rs
function main (line 3) | fn main() {
function fixup (line 22) | fn fixup(input: &str) -> String {
FILE: docs/_installer/wasm-pack.js
function detect_platform (line 4) | function detect_platform() {
function adjust_for_platform (line 54) | function adjust_for_platform() {
function fill_in_bug_report_values (line 68) | function fill_in_bug_report_values() {
FILE: src/bindgen.rs
function wasm_bindgen_build (line 14) | pub fn wasm_bindgen_build(
function supports_web_target (line 83) | fn supports_web_target(cli_path: &Path) -> Result<bool> {
function supports_dash_dash_target (line 93) | fn supports_dash_dash_target(cli_path: &Path) -> Result<bool> {
function build_target_arg (line 102) | fn build_target_arg(target: Target, cli_path: &Path) -> Result<String> {
function build_target_arg_legacy (line 110) | fn build_target_arg_legacy(target: Target, cli_path: &Path) -> Result<St...
FILE: src/build/mod.rs
type WasmPackVersion (line 19) | pub struct WasmPackVersion {
function check_rustc_version (line 28) | pub fn check_rustc_version() -> Result<String> {
function rustc_minor_version (line 46) | fn rustc_minor_version() -> Option<u32> {
function check_wasm_pack_versions (line 65) | pub fn check_wasm_pack_versions() -> Result<WasmPackVersion> {
function wasm_pack_local_version (line 72) | fn wasm_pack_local_version() -> Option<String> {
function cargo_build_wasm (line 78) | pub fn cargo_build_wasm(
function cargo_build_wasm_tests (line 195) | pub fn cargo_build_wasm_tests(path: &Path, debug: bool, extra_options: &...
FILE: src/build/wasm_target.rs
type Wasm32Check (line 13) | struct Wasm32Check<'target> {
function fmt (line 22) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
function check_for_wasm_target (line 55) | pub fn check_for_wasm_target(target: &str) -> Result<()> {
function get_rustc_sysroot (line 68) | fn get_rustc_sysroot() -> Result<PathBuf> {
function get_rustc_target_libdir (line 84) | fn get_rustc_target_libdir(target: &str) -> Result<PathBuf> {
function does_target_libdir_exist (line 99) | fn does_target_libdir_exist(target: &str) -> bool {
function check_target (line 119) | fn check_target(target: &'_ str) -> Result<Wasm32Check<'_>> {
function rustup_add_wasm_target (line 156) | fn rustup_add_wasm_target(target: &str) -> Result<()> {
FILE: src/cache.rs
function get_wasm_pack_cache (line 9) | pub fn get_wasm_pack_cache() -> Result<Cache> {
FILE: src/child.rs
function new_command (line 11) | pub fn new_command(program: &str) -> Command {
function run (line 27) | pub fn run(mut command: Command, command_name: &str) -> Result<()> {
function run_capture_stdout (line 45) | pub fn run_capture_stdout(
FILE: src/command/build.rs
type Build (line 27) | pub struct Build {
method try_from_opts (line 219) | pub fn try_from_opts(mut build_opts: BuildOptions) -> Result<Self> {
method set_cache (line 286) | pub fn set_cache(&mut self, cache: Cache) {
method run (line 291) | pub fn run(&mut self) -> Result<()> {
method get_process_steps (line 317) | fn get_process_steps(
method step_check_rustc_version (line 366) | fn step_check_rustc_version(&mut self) -> Result<()> {
method step_check_crate_config (line 374) | fn step_check_crate_config(&mut self) -> Result<()> {
method step_check_for_wasm_target (line 381) | fn step_check_for_wasm_target(&mut self) -> Result<()> {
method step_build_wasm (line 388) | fn step_build_wasm(&mut self) -> Result<()> {
method step_create_dir (line 397) | fn step_create_dir(&mut self) -> Result<()> {
method step_create_json (line 404) | fn step_create_json(&mut self) -> Result<()> {
method step_copy_readme (line 418) | fn step_copy_readme(&mut self) -> Result<()> {
method step_copy_license (line 425) | fn step_copy_license(&mut self) -> Result<()> {
method step_install_wasm_bindgen (line 432) | fn step_install_wasm_bindgen(&mut self) -> Result<()> {
method step_run_wasm_bindgen (line 448) | fn step_run_wasm_bindgen(&mut self) -> Result<()> {
method step_run_wasm_opt (line 466) | fn step_run_wasm_opt(&mut self) -> Result<()> {
type Target (line 51) | pub enum Target {
method fmt (line 77) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
method default (line 71) | fn default() -> Target {
type Err (line 90) | type Err = Error;
method from_str (line 91) | fn from_str(s: &str) -> Result<Self> {
type BuildProfile (line 106) | pub enum BuildProfile {
type BuildOptions (line 120) | pub struct BuildOptions {
method default (line 192) | fn default() -> Self {
type BuildStep (line 215) | type BuildStep = fn(&mut Build) -> Result<()>;
FILE: src/command/generate.rs
function generate (line 10) | pub fn generate(template: String, name: String, install_permitted: bool)...
FILE: src/command/login.rs
function login (line 6) | pub fn login(
FILE: src/command/mod.rs
type Command (line 26) | pub enum Command {
function run_wasm_pack (line 116) | pub fn run_wasm_pack(command: Command) -> Result<()> {
FILE: src/command/pack.rs
function pack (line 10) | pub fn pack(path: Option<PathBuf>, pkg_directory: PathBuf) -> Result<()> {
FILE: src/command/publish/access.rs
type Access (line 7) | pub enum Access {
method fmt (line 28) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
type Err (line 15) | type Err = Error;
method from_str (line 17) | fn from_str(s: &str) -> Result<Self> {
FILE: src/command/publish/mod.rs
function publish (line 17) | pub fn publish(
FILE: src/command/test.rs
type TestOptions (line 22) | pub struct TestOptions {
type Test (line 86) | pub struct Test {
method try_from_opts (line 108) | pub fn try_from_opts(test_opts: TestOptions) -> Result<Self> {
method set_cache (line 172) | pub fn set_cache(&mut self, cache: Cache) {
method run (line 177) | pub fn run(mut self) -> Result<()> {
method get_process_steps (line 190) | fn get_process_steps(&self) -> Vec<(&'static str, TestStep)> {
method step_check_rustc_version (line 245) | fn step_check_rustc_version(&mut self) -> Result<()> {
method step_check_for_wasm_target (line 252) | fn step_check_for_wasm_target(&mut self) -> Result<()> {
method step_build_tests (line 259) | fn step_build_tests(&mut self) -> Result<()> {
method step_install_wasm_bindgen (line 276) | fn step_install_wasm_bindgen(&mut self) -> Result<()> {
method step_test_node (line 311) | fn step_test_node(&mut self) -> Result<()> {
method step_get_chromedriver (line 330) | fn step_get_chromedriver(&mut self) -> Result<()> {
method step_test_chrome (line 340) | fn step_test_chrome(&mut self) -> Result<()> {
method step_get_geckodriver (line 355) | fn step_get_geckodriver(&mut self) -> Result<()> {
method step_test_firefox (line 365) | fn step_test_firefox(&mut self) -> Result<()> {
method step_get_safaridriver (line 380) | fn step_get_safaridriver(&mut self) -> Result<()> {
method step_test_safari (line 387) | fn step_test_safari(&mut self) -> Result<()> {
method webdriver_env (line 402) | fn webdriver_env(&self) -> Vec<(&'static str, &str)> {
type TestStep (line 104) | type TestStep = fn(&mut Test) -> Result<()>;
FILE: src/command/utils.rs
function get_crate_path (line 12) | pub fn get_crate_path(path: Option<PathBuf>) -> Result<PathBuf> {
function find_manifest_from_cwd (line 22) | fn find_manifest_from_cwd() -> Result<PathBuf> {
function create_pkg_dir (line 39) | pub fn create_pkg_dir(out_dir: &Path) -> Result<()> {
function find_pkg_directory (line 48) | pub fn find_pkg_directory(path: &Path, pkg_directory: &Path) -> Option<P...
function is_pkg_directory (line 59) | fn is_pkg_directory(path: &Path, pkg_directory: &Path) -> bool {
function elapsed (line 64) | pub fn elapsed(duration: Duration) -> String {
FILE: src/generate.rs
function generate (line 11) | pub fn generate(template: &str, name: &str, install_status: &install::St...
FILE: src/install/arch.rs
type Arch (line 8) | pub enum Arch {
method get (line 19) | pub fn get() -> Result<Self> {
method fmt (line 33) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
FILE: src/install/krate.rs
constant VERSION (line 4) | const VERSION: Option<&str> = option_env!("CARGO_PKG_VERSION");
type Krate (line 7) | pub struct Krate {
method new (line 18) | pub fn new(name: &Tool) -> Result<Krate> {
type KrateResponse (line 12) | pub struct KrateResponse {
FILE: src/install/mod.rs
type Status (line 29) | pub enum Status {
function get_tool_path (line 39) | pub fn get_tool_path(status: &Status, tool: Tool) -> Result<&Download> {
function download_prebuilt_or_cargo_install (line 55) | pub fn download_prebuilt_or_cargo_install(
function check_version (line 92) | pub fn check_version(tool: &Tool, path: &Path, expected_version: &str) -...
function get_cli_version (line 109) | pub fn get_cli_version(tool: &Tool, path: &Path) -> Result<String> {
function download_prebuilt (line 121) | pub fn download_prebuilt(
function prebuilt_url (line 167) | fn prebuilt_url(tool: &Tool, version: &str) -> Result<String> {
function prebuilt_url_for (line 174) | pub fn prebuilt_url_for(tool: &Tool, version: &str, arch: &Arch, os: &Os...
function cargo_install (line 216) | pub fn cargo_install(
FILE: src/install/mode.rs
type InstallMode (line 7) | pub enum InstallMode {
method install_permitted (line 37) | pub fn install_permitted(self) -> bool {
method default (line 18) | fn default() -> InstallMode {
type Err (line 24) | type Err = Error;
method from_str (line 25) | fn from_str(s: &str) -> Result<Self> {
FILE: src/install/os.rs
type Os (line 8) | pub enum Os {
method get (line 19) | pub fn get() -> Result<Self> {
method fmt (line 33) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
FILE: src/install/tool.rs
type Tool (line 4) | pub enum Tool {
method fmt (line 14) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
FILE: src/installer.rs
function install (line 29) | pub fn install() -> ! {
function do_install (line 50) | fn do_install() -> Result<()> {
function confirm_can_overwrite (line 88) | fn confirm_can_overwrite(dst: &Path) -> Result<()> {
FILE: src/lib.rs
type Cli (line 54) | pub struct Cli {
FILE: src/license.rs
function glob_license_files (line 11) | fn glob_license_files(path: &Path) -> Result<Vec<String>> {
function copy_from_crate (line 40) | pub fn copy_from_crate(crate_data: &CrateData, path: &Path, out_dir: &Pa...
FILE: src/lockfile.rs
type Lockfile (line 15) | pub struct Lockfile {
method new (line 28) | pub fn new(crate_data: &CrateData) -> Result<Lockfile> {
method wasm_bindgen_version (line 38) | pub fn wasm_bindgen_version(&self) -> Option<&str> {
method require_wasm_bindgen (line 44) | pub fn require_wasm_bindgen(&self) -> Result<&str> {
method wasm_bindgen_test_version (line 56) | pub fn wasm_bindgen_test_version(&self) -> Option<&str> {
method get_package_version (line 60) | fn get_package_version(&self, package: &str) -> Option<&str> {
type Package (line 21) | struct Package {
function get_lockfile_path (line 70) | fn get_lockfile_path(crate_data: &CrateData) -> Result<PathBuf> {
FILE: src/main.rs
function background_check_for_updates (line 25) | fn background_check_for_updates() -> mpsc::Receiver<Result<WasmPackVersi...
function main (line 46) | fn main() {
function run (line 60) | fn run() -> Result<()> {
function setup_panic_hooks (line 103) | fn setup_panic_hooks() {
FILE: src/manifest/mod.rs
constant WASM_PACK_METADATA_KEY (line 31) | const WASM_PACK_METADATA_KEY: &str = "package.metadata.wasm-pack";
constant WASM_PACK_VERSION (line 32) | const WASM_PACK_VERSION: Option<&'static str> = option_env!("CARGO_PKG_V...
constant WASM_PACK_REPO_URL (line 33) | const WASM_PACK_REPO_URL: &str = "https://github.com/drager/wasm-pack";
type CrateData (line 36) | pub struct CrateData {
method new (line 440) | pub fn new(crate_path: &Path, out_name: Option<String>) -> Result<Crat...
method is_same_path (line 475) | fn is_same_path(path1: &Path, path2: &Path) -> bool {
method parse_crate_data (line 491) | pub fn parse_crate_data(manifest_path: &Path) -> Result<ManifestAndUnu...
method warn_for_unused_keys (line 524) | pub fn warn_for_unused_keys(manifest_and_keys: &ManifestAndUnusedKeys) {
method configured_profile (line 534) | pub fn configured_profile(&self, profile: BuildProfile) -> &CargoWasmP...
method check_crate_config (line 544) | pub fn check_crate_config(&self) -> Result<()> {
method check_crate_type (line 549) | fn check_crate_type(&self) -> Result<()> {
method pkg (line 567) | fn pkg(&self) -> &cargo_metadata::Package {
method crate_name (line 572) | pub fn crate_name(&self) -> String {
method name_prefix (line 585) | pub fn name_prefix(&self) -> String {
method crate_readme (line 593) | pub fn crate_readme(&self) -> Option<String> {
method crate_license (line 601) | pub fn crate_license(&self) -> &Option<String> {
method crate_license_file (line 606) | pub fn crate_license_file(&self) -> Option<String> {
method target_directory (line 615) | pub fn target_directory(&self) -> &Path {
method workspace_root (line 620) | pub fn workspace_root(&self) -> &Path {
method write_package_json (line 625) | pub fn write_package_json(
method npm_data (line 659) | fn npm_data(
method license (line 719) | fn license(&self) -> Option<String> {
method to_commonjs (line 728) | fn to_commonjs(
method to_esmodules (line 759) | fn to_esmodules(
method to_web (line 792) | fn to_web(
method to_nomodules (line 825) | fn to_nomodules(
method check_optional_fields (line 856) | fn check_optional_fields(&self) {
type CargoManifest (line 45) | pub struct CargoManifest {
type CargoPackage (line 50) | struct CargoPackage {
type CargoMetadata (line 58) | struct CargoMetadata {
type CargoWasmPack (line 64) | struct CargoWasmPack {
type CargoWasmPackProfiles (line 70) | struct CargoWasmPackProfiles {
method default (line 97) | fn default() -> CargoWasmPackProfiles {
type CargoWasmPackProfile (line 110) | pub struct CargoWasmPackProfile {
method default_dev (line 282) | fn default_dev() -> Self {
method default_release (line 295) | fn default_release() -> Self {
method default_profiling (line 308) | fn default_profiling() -> Self {
method default_custom (line 321) | fn default_custom() -> Self {
method deserialize_dev (line 334) | fn deserialize_dev<'de, D>(deserializer: D) -> Result<Self, D::Error>
method deserialize_release (line 343) | fn deserialize_release<'de, D>(deserializer: D) -> Result<Self, D::Error>
method deserialize_profiling (line 352) | fn deserialize_profiling<'de, D>(deserializer: D) -> Result<Self, D::E...
method deserialize_custom (line 361) | fn deserialize_custom<'de, D>(deserializer: D) -> Result<Self, D::Error>
method update_with_defaults (line 370) | fn update_with_defaults(&mut self, defaults: &Self) {
method wasm_bindgen_debug_js_glue (line 388) | pub fn wasm_bindgen_debug_js_glue(&self) -> bool {
method wasm_bindgen_demangle_name_section (line 393) | pub fn wasm_bindgen_demangle_name_section(&self) -> bool {
method wasm_bindgen_dwarf_debug_info (line 398) | pub fn wasm_bindgen_dwarf_debug_info(&self) -> bool {
method wasm_bindgen_omit_default_module_path (line 403) | pub fn wasm_bindgen_omit_default_module_path(&self) -> bool {
method wasm_bindgen_split_linked_modules (line 408) | pub fn wasm_bindgen_split_linked_modules(&self) -> bool {
method wasm_opt_args (line 413) | pub fn wasm_opt_args(&self) -> Option<Vec<String>> {
type CargoWasmPackProfileWasmBindgen (line 118) | struct CargoWasmPackProfileWasmBindgen {
type Crate (line 137) | pub struct Crate {
method return_wasm_pack_latest_version (line 149) | pub fn return_wasm_pack_latest_version() -> Result<Option<String>> {
method return_api_call_result (line 172) | fn return_api_call_result(current_time: DateTime<offset::Local>) -> Re...
method override_stamp_file (line 187) | fn override_stamp_file(
method return_wasm_pack_file (line 212) | fn return_wasm_pack_file() -> Option<String> {
method return_latest_wasm_pack_version (line 222) | fn return_latest_wasm_pack_version() -> Result<String> {
method return_stamp_file_value (line 227) | fn return_stamp_file_value(file: &str, word: &str) -> Option<String> {
method check_wasm_pack_latest_version (line 237) | fn check_wasm_pack_latest_version() -> Result<Crate> {
type CrateInformation (line 143) | struct CrateInformation {
type CargoWasmPackProfileWasmOpt (line 270) | enum CargoWasmPackProfileWasmOpt {
method default (line 276) | fn default() -> Self {
type NpmData (line 422) | struct NpmData {
type ManifestAndUnusedKeys (line 432) | pub struct ManifestAndUnusedKeys {
FILE: src/manifest/npm/commonjs.rs
type CommonJSPackage (line 6) | pub struct CommonJSPackage {
FILE: src/manifest/npm/esmodules.rs
type ESModulesPackage (line 6) | pub struct ESModulesPackage {
FILE: src/manifest/npm/mod.rs
type NpmPackage (line 12) | pub enum NpmPackage {
FILE: src/manifest/npm/nomodules.rs
type NoModulesPackage (line 6) | pub struct NoModulesPackage {
FILE: src/manifest/npm/repository.rs
type Repository (line 2) | pub struct Repository {
FILE: src/npm.rs
constant DEFAULT_NPM_REGISTRY (line 9) | pub const DEFAULT_NPM_REGISTRY: &str = "https://registry.npmjs.org/";
function npm_pack (line 12) | pub fn npm_pack(path: &str) -> Result<()> {
function npm_publish (line 20) | pub fn npm_publish(path: &str, access: Option<Access>, tag: Option<Strin...
function npm_login (line 35) | pub fn npm_login(registry: &str, scope: &Option<String>, auth_type: &Opt...
FILE: src/progressbar.rs
type LogLevel (line 13) | pub enum LogLevel {
type Err (line 23) | type Err = Error;
method from_str (line 24) | fn from_str(s: &str) -> Result<Self> {
type ProgressOutput (line 35) | pub struct ProgressOutput {
method new (line 42) | pub const fn new() -> Self {
method message (line 50) | fn message(&self, message: &str) {
method quiet (line 55) | pub fn quiet(&self) -> bool {
method set_quiet (line 60) | pub fn set_quiet(&self, quiet: bool) {
method is_log_enabled (line 65) | pub fn is_log_enabled(&self, level: LogLevel) -> bool {
method set_log_level (line 70) | pub fn set_log_level(&self, log_level: LogLevel) {
method info (line 75) | pub fn info(&self, message: &str) {
method warn (line 83) | pub fn warn(&self, message: &str) {
method error (line 96) | pub fn error(&self, message: &str) {
method default (line 110) | fn default() -> Self {
FILE: src/readme.rs
function copy_from_crate (line 11) | pub fn copy_from_crate(crate_data: &CrateData, path: &Path, out_dir: &Pa...
FILE: src/stamps.rs
function get_stamp_value (line 9) | pub fn get_stamp_value(key: impl AsRef<str>, json: &serde_json::Value) -...
function save_stamp_value (line 16) | pub fn save_stamp_value(key: impl Into<String>, value: impl AsRef<str>) ...
function get_stamps_file_path (line 30) | pub fn get_stamps_file_path() -> Result<PathBuf> {
function read_stamps_file_to_json (line 38) | pub fn read_stamps_file_to_json() -> Result<serde_json::Value> {
function write_to_stamps_file (line 47) | fn write_to_stamps_file(json: serde_json::Value) -> Result<()> {
FILE: src/target.rs
constant LINUX (line 8) | pub const LINUX: bool = cfg!(target_os = "linux");
constant MACOS (line 9) | pub const MACOS: bool = cfg!(target_os = "macos");
constant WINDOWS (line 10) | pub const WINDOWS: bool = cfg!(target_os = "windows");
constant x86_64 (line 13) | pub const x86_64: bool = cfg!(target_arch = "x86_64");
constant x86 (line 15) | pub const x86: bool = cfg!(target_arch = "x86");
constant aarch64 (line 17) | pub const aarch64: bool = cfg!(target_arch = "aarch64");
FILE: src/test/mod.rs
function cargo_test_wasm (line 14) | pub fn cargo_test_wasm<I, K, V>(
FILE: src/test/webdriver.rs
function get_and_notify (line 20) | fn get_and_notify(
FILE: src/test/webdriver/chromedriver.rs
constant DEFAULT_CHROMEDRIVER_VERSION (line 13) | const DEFAULT_CHROMEDRIVER_VERSION: &str = "143.0.7499.192";
constant CHROMEDRIVER_LAST_UPDATED_STAMP (line 15) | const CHROMEDRIVER_LAST_UPDATED_STAMP: &str = "chromedriver_last_updated";
constant CHROMEDRIVER_VERSION_STAMP (line 16) | const CHROMEDRIVER_VERSION_STAMP: &str = "chromedriver_version";
function get_or_install_chromedriver (line 20) | pub fn get_or_install_chromedriver(cache: &Cache, mode: InstallMode) -> ...
function install_chromedriver (line 28) | pub fn install_chromedriver(cache: &Cache, installation_allowed: bool) -...
function get_chromedriver_url (line 71) | fn get_chromedriver_url(target: &str) -> String {
function save_chromedriver_version (line 99) | fn save_chromedriver_version(version: String) -> Result<String> {
function should_load_chromedriver_version_from_stamp (line 108) | fn should_load_chromedriver_version_from_stamp(json: &serde_json::Value)...
type ChannelInfo (line 124) | struct ChannelInfo {
type GoodLatestVersions (line 130) | struct GoodLatestVersions {
function fetch_chromedriver_version (line 136) | fn fetch_chromedriver_version() -> Result<String> {
function assemble_chromedriver_url (line 158) | fn assemble_chromedriver_url(chromedriver_version: &str, target: &str) -...
FILE: src/test/webdriver/geckodriver.rs
constant DEFAULT_GECKODRIVER_VERSION (line 12) | const DEFAULT_GECKODRIVER_VERSION: &str = "v0.36.0";
constant DEFAULT_WINDOWS_GECKODRIVER_VERSION (line 13) | const DEFAULT_WINDOWS_GECKODRIVER_VERSION: &str = "v0.24.0";
constant GECKODRIVER_LAST_UPDATED_STAMP (line 15) | const GECKODRIVER_LAST_UPDATED_STAMP: &str = "geckodriver_last_updated";
constant GECKODRIVER_VERSION_STAMP (line 16) | const GECKODRIVER_VERSION_STAMP: &str = "geckodriver_version";
function get_or_install_geckodriver (line 20) | pub fn get_or_install_geckodriver(cache: &Cache, mode: InstallMode) -> R...
function install_geckodriver (line 38) | pub fn install_geckodriver(cache: &Cache, installation_allowed: bool) ->...
function get_geckodriver_url (line 81) | fn get_geckodriver_url(target: &str, ext: &str) -> String {
function save_geckodriver_version (line 120) | fn save_geckodriver_version(version: String) -> Result<String> {
function should_load_geckodriver_version_from_stamp (line 129) | fn should_load_geckodriver_version_from_stamp(json: &serde_json::Value) ...
function fetch_latest_geckodriver_tag_json (line 143) | fn fetch_latest_geckodriver_tag_json() -> Result<String> {
function get_version_from_json (line 157) | fn get_version_from_json(json: serde_json::Value) -> Result<String> {
function assemble_geckodriver_url (line 163) | fn assemble_geckodriver_url(tag: &str, target: &str, ext: &str) -> String {
FILE: src/test/webdriver/safaridriver.rs
function get_safaridriver (line 9) | pub fn get_safaridriver() -> Result<PathBuf> {
FILE: src/wasm_opt.rs
function run (line 14) | pub fn run(cache: &Cache, out_dir: &Path, args: &[String], install_permi...
function find_wasm_opt (line 47) | pub fn find_wasm_opt(cache: &Cache, install_permitted: bool) -> Result<O...
FILE: tests/all/build.rs
function build_in_non_crate_directory_doesnt_panic (line 7) | fn build_in_non_crate_directory_doesnt_panic() {
function it_should_build_js_hello_world_example (line 19) | fn it_should_build_js_hello_world_example() {
function it_should_not_make_a_pkg_json_if_passed_no_pack (line 25) | fn it_should_not_make_a_pkg_json_if_passed_no_pack() {
function it_should_build_js_hello_world_example_with_custom_target_dir (line 41) | fn it_should_build_js_hello_world_example_with_custom_target_dir() {
function it_should_build_crates_in_a_workspace (line 55) | fn it_should_build_crates_in_a_workspace() {
function renamed_crate_name_works (line 103) | fn renamed_crate_name_works() {
function dash_dash_web_target_has_error_on_old_bindgen (line 138) | fn dash_dash_web_target_has_error_on_old_bindgen() {
function it_should_build_nested_project_with_transitive_dependencies (line 187) | fn it_should_build_nested_project_with_transitive_dependencies() {
function build_different_profiles (line 199) | fn build_different_profiles() {
function build_custom_profile (line 217) | fn build_custom_profile() {
function build_with_and_without_wasm_bindgen_debug (line 232) | fn build_with_and_without_wasm_bindgen_debug() {
function build_with_arbitrary_cargo_options (line 307) | fn build_with_arbitrary_cargo_options() {
function build_no_install (line 319) | fn build_no_install() {
function build_force (line 332) | fn build_force() {
function build_from_new (line 345) | fn build_from_new() {
function build_crates_with_same_names (line 359) | fn build_crates_with_same_names() {
FILE: tests/all/download.rs
function can_download_prebuilt_wasm_bindgen (line 9) | fn can_download_prebuilt_wasm_bindgen() {
function downloading_prebuilt_wasm_bindgen_handles_http_errors (line 28) | fn downloading_prebuilt_wasm_bindgen_handles_http_errors() {
function can_download_prebuilt_cargo_generate (line 46) | fn can_download_prebuilt_cargo_generate() {
function can_download_prebuilt_wasm_opt (line 65) | fn can_download_prebuilt_wasm_opt() {
function all_latest_tool_download_urls_valid (line 78) | fn all_latest_tool_download_urls_valid() {
FILE: tests/all/generate.rs
function new_with_no_name_errors (line 5) | fn new_with_no_name_errors() {
function new_with_name_succeeds (line 12) | fn new_with_name_succeeds() {
FILE: tests/all/license.rs
function it_copies_a_license_default_path (line 11) | fn it_copies_a_license_default_path() {
function it_copies_a_license_provided_path (line 36) | fn it_copies_a_license_provided_path() {
function it_copies_all_licenses_default_path (line 59) | fn it_copies_all_licenses_default_path() {
function it_copies_all_licenses_provided_path (line 94) | fn it_copies_all_licenses_provided_path() {
function it_copies_a_non_standard_license_provided_path (line 129) | fn it_copies_a_non_standard_license_provided_path() {
FILE: tests/all/lockfile.rs
function it_gets_wasm_bindgen_version (line 7) | fn it_gets_wasm_bindgen_version() {
function it_gets_wasm_bindgen_test_version (line 16) | fn it_gets_wasm_bindgen_test_version() {
function it_gets_wasm_bindgen_version_in_crate_inside_workspace (line 26) | fn it_gets_wasm_bindgen_version_in_crate_inside_workspace() {
function it_gets_wasm_bindgen_version_from_dependencies (line 71) | fn it_gets_wasm_bindgen_version_from_dependencies() {
FILE: tests/all/log_level.rs
function matches_info (line 9) | fn matches_info() -> impl Predicate<str> + PredicateReflection {
function matches_cargo (line 18) | fn matches_cargo() -> impl Predicate<str> + PredicateReflection {
function quiet (line 25) | fn quiet() {
function log_level_info (line 39) | fn log_level_info() {
function log_level_warn (line 54) | fn log_level_warn() {
function log_level_error (line 69) | fn log_level_error() {
FILE: tests/all/manifest.rs
function it_gets_the_crate_name_default_path (line 11) | fn it_gets_the_crate_name_default_path() {
function it_gets_the_crate_name_provided_path (line 19) | fn it_gets_the_crate_name_provided_path() {
function it_gets_the_default_name_prefix (line 26) | fn it_gets_the_default_name_prefix() {
function it_gets_the_name_prefix_passed_from_cli (line 34) | fn it_gets_the_name_prefix_passed_from_cli() {
function it_checks_has_cdylib_default_path (line 42) | fn it_checks_has_cdylib_default_path() {
function it_checks_has_cdylib_provided_path (line 51) | fn it_checks_has_cdylib_provided_path() {
function it_checks_has_cdylib_wrong_crate_type (line 60) | fn it_checks_has_cdylib_wrong_crate_type() {
function it_recognizes_a_map_during_depcheck (line 67) | fn it_recognizes_a_map_during_depcheck() {
function it_creates_a_package_json_default_path (line 76) | fn it_creates_a_package_json_default_path() {
function it_creates_a_package_json_provided_path (line 116) | fn it_creates_a_package_json_provided_path() {
function it_creates_a_package_json_provided_path_with_scope (line 146) | fn it_creates_a_package_json_provided_path_with_scope() {
function it_creates_a_pkg_json_with_correct_files_on_node (line 176) | fn it_creates_a_pkg_json_with_correct_files_on_node() {
function it_creates_a_pkg_json_with_correct_files_on_nomodules (line 210) | fn it_creates_a_pkg_json_with_correct_files_on_nomodules() {
function it_creates_a_package_json_with_correct_files_when_out_name_is_provided (line 244) | fn it_creates_a_package_json_with_correct_files_when_out_name_is_provide...
function it_creates_a_pkg_json_in_out_dir (line 277) | fn it_creates_a_pkg_json_in_out_dir() {
function it_creates_a_package_json_with_correct_keys_when_types_are_skipped (line 292) | fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() {
function it_creates_a_package_json_with_npm_dependencies_provided_by_wasm_bindgen (line 340) | fn it_creates_a_package_json_with_npm_dependencies_provided_by_wasm_bind...
function it_errors_when_wasm_bindgen_is_not_declared (line 388) | fn it_errors_when_wasm_bindgen_is_not_declared() {
function it_sets_homepage_field_if_available_in_cargo_toml (line 395) | fn it_sets_homepage_field_if_available_in_cargo_toml() {
function it_sets_keywords_field_if_available_in_cargo_toml (line 450) | fn it_sets_keywords_field_if_available_in_cargo_toml() {
function it_does_not_error_when_wasm_bindgen_is_declared (line 507) | fn it_does_not_error_when_wasm_bindgen_is_declared() {
function configure_wasm_bindgen_debug_incorrectly_is_error (line 516) | fn configure_wasm_bindgen_debug_incorrectly_is_error() {
function parse_crate_data_returns_unused_keys_in_cargo_toml (line 548) | fn parse_crate_data_returns_unused_keys_in_cargo_toml() {
function it_lists_license_files_in_files_field_of_package_json (line 589) | fn it_lists_license_files_in_files_field_of_package_json() {
function it_recurses_up_the_path_to_find_cargo_toml (line 619) | fn it_recurses_up_the_path_to_find_cargo_toml() {
function it_doesnt_recurse_up_the_path_to_find_cargo_toml_when_default (line 641) | fn it_doesnt_recurse_up_the_path_to_find_cargo_toml_when_default() {
FILE: tests/all/readme.rs
function it_copies_a_readme_default_path (line 13) | fn it_copies_a_readme_default_path() {
function it_copies_a_readme_provided_path (line 38) | fn it_copies_a_readme_provided_path() {
function it_ignores_a_disabled_readme (line 99) | fn it_ignores_a_disabled_readme() {
FILE: tests/all/stamps.rs
function run_test (line 4) | fn run_test<T>(test: T) -> ()
function before (line 14) | fn before() {
function after (line 18) | fn after() {
function remove_stamps_file (line 22) | fn remove_stamps_file() {
function load_stamp_from_non_existent_file (line 32) | fn load_stamp_from_non_existent_file() {
function load_stamp (line 42) | fn load_stamp() {
function update_stamp (line 58) | fn update_stamp() {
FILE: tests/all/test.rs
function it_can_run_node_tests (line 7) | fn it_can_run_node_tests() {
function it_can_run_tests_with_different_wbg_test_and_wbg_versions (line 20) | fn it_can_run_tests_with_different_wbg_test_and_wbg_versions() {
function it_can_run_browser_tests (line 40) | fn it_can_run_browser_tests() {
function it_can_run_failing_tests (line 89) | fn it_can_run_failing_tests() {
function it_can_find_a_webdriver_on_path (line 113) | fn it_can_find_a_webdriver_on_path() {
function it_requires_node_or_a_browser (line 137) | fn it_requires_node_or_a_browser() {
function the_headless_flag_requires_a_browser (line 150) | fn the_headless_flag_requires_a_browser() {
function complains_about_missing_wasm_bindgen_test_dependency (line 165) | fn complains_about_missing_wasm_bindgen_test_dependency() {
function renamed_crate_name_works (line 207) | fn renamed_crate_name_works() {
function cdylib_not_required (line 251) | fn cdylib_not_required() {
function test_output_is_printed_once_in_both_stdout_and_failures (line 299) | fn test_output_is_printed_once_in_both_stdout_and_failures() {
function extra_options_is_passed_to_cargo_when_building_tests (line 339) | fn extra_options_is_passed_to_cargo_when_building_tests() {
FILE: tests/all/utils/file.rs
function read_file (line 7) | pub fn read_file(path: &Path) -> Result<String> {
FILE: tests/all/utils/fixture.rs
type Fixture (line 15) | pub struct Fixture {
method new (line 25) | pub fn new() -> Fixture {
method file (line 51) | pub fn file<P: AsRef<Path>, C: AsRef<[u8]>>(&self, path: P, contents: ...
method readme (line 62) | pub fn readme(&self) -> &Self {
method license (line 73) | pub fn license(&self) -> &Self {
method wtfpl_license (line 83) | pub fn wtfpl_license(&self) -> &Self {
method mit_license (line 105) | pub fn mit_license(&self) -> &Self {
method cargo_toml (line 125) | pub fn cargo_toml(&self, name: &str) -> &Self {
method cargo_toml_with_custom_profile (line 163) | pub fn cargo_toml_with_custom_profile(&self, name: &str, profile_name:...
method cargo_toml_with_license_file (line 206) | pub fn cargo_toml_with_license_file(&self, name: &str, license_file: &...
method hello_world_src_lib (line 234) | pub fn hello_world_src_lib(&self) -> &Self {
method install_local_wasm_bindgen (line 261) | pub fn install_local_wasm_bindgen(&self) -> PathBuf {
method install_wasm_opt (line 292) | pub fn install_wasm_opt(&self) {
method install_local_cargo_generate (line 305) | pub fn install_local_cargo_generate(&self) -> PathBuf {
method install_local_geckodriver (line 335) | pub fn install_local_geckodriver(&self) -> PathBuf {
method install_local_chromedriver (line 350) | pub fn install_local_chromedriver(&self) -> PathBuf {
method cache_dir (line 361) | pub fn cache_dir(&self) -> PathBuf {
method cache (line 367) | pub fn cache(&self) -> Cache {
method cargo_check (line 377) | pub fn cargo_check(&self) -> &Self {
method wasm_pack (line 392) | pub fn wasm_pack(&self) -> Command {
method lock (line 406) | pub fn lock(&self) -> MutexGuard<'static, ()> {
method drop (line 416) | fn drop(&mut self) {
function bad_cargo_toml (line 423) | pub fn bad_cargo_toml() -> Fixture {
function js_hello_world (line 443) | pub fn js_hello_world() -> Fixture {
function js_hello_world_with_custom_profile (line 452) | pub fn js_hello_world_with_custom_profile(profile_name: &str) -> Fixture {
function no_cdylib (line 461) | pub fn no_cdylib() -> Fixture {
function not_a_crate (line 487) | pub fn not_a_crate() -> Fixture {
function serde_feature (line 493) | pub fn serde_feature() -> Fixture {
function wbg_test_diff_versions (line 514) | pub fn wbg_test_diff_versions() -> Fixture {
function wbg_test_browser (line 566) | pub fn wbg_test_browser() -> Fixture {
function wbg_test_fail (line 589) | pub fn wbg_test_fail() -> Fixture {
function wbg_test_node (line 610) | pub fn wbg_test_node() -> Fixture {
function transitive_dependencies (line 631) | pub fn transitive_dependencies() -> Fixture {
function single_license (line 784) | pub fn single_license() -> Fixture {
function dual_license (line 794) | pub fn dual_license() -> Fixture {
function non_standard_license (line 805) | pub fn non_standard_license(license_file: &str) -> Fixture {
FILE: tests/all/utils/manifest.rs
type NpmPackage (line 9) | pub struct NpmPackage {
function default_none (line 33) | fn default_none() -> String {
type Repository (line 38) | pub struct Repository {
function read_package_json (line 44) | pub fn read_package_json(path: &Path, out_dir: &Path) -> Result<NpmPacka...
function create_wbg_package_json (line 53) | pub fn create_wbg_package_json(out_dir: &Path, contents: &str) -> Result...
FILE: tests/all/wasm_opt.rs
function off_in_dev (line 6) | fn off_in_dev() {
function on_in_release (line 22) | fn on_in_release() {
function disable_in_release (line 37) | fn disable_in_release() {
function enable_in_dev (line 75) | fn enable_in_dev() {
function custom_args (line 116) | fn custom_args() {
function misconfigured (line 154) | fn misconfigured() {
FILE: tests/all/webdriver.rs
function can_install_chromedriver (line 12) | fn can_install_chromedriver() {
function can_install_geckodriver (line 28) | fn can_install_geckodriver() {
Condensed preview — 128 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (524K chars).
[
{
"path": ".github/ISSUE_TEMPLATE/bug_report.md",
"chars": 479,
"preview": "---\nname: Bug Report 🐛\nabout: Did something not work as expected?\n---\n\n## 🐛 Bug description\nDescribe your issue in detai"
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.md",
"chars": 242,
"preview": "---\nname: Feature Request 💡\nabout: Suggest a new idea for wasm-pack\n---\n\n## 💡 Feature description\nBrief explanation of t"
},
{
"path": ".github/PULL_REQUEST_TEMPLATE.md",
"chars": 320,
"preview": "Make sure these boxes are checked! 📦✅\n\n- [ ] You have the latest version of `rustfmt` installed\n```bash\n$ rustup compone"
},
{
"path": ".github/workflows/approve.yml",
"chars": 407,
"preview": "name: Automatic Approve\npermissions:\n contents: read\n pull-requests: write\non:\n schedule: \n - cron: \"0 0 * * *\"\n "
},
{
"path": ".github/workflows/book.yml",
"chars": 1427,
"preview": "name: Build and deploy documentation book\n\non:\n push:\n pull_request: \n\njobs:\n book:\n permissions:\n content"
},
{
"path": ".github/workflows/release.yml",
"chars": 8387,
"preview": "on:\n push:\n tags:\n - 'v*' # Run when tag matches v*, i.e. v1.0, v20.15.10\n\nname: Release\npermissions:\n content"
},
{
"path": ".github/workflows/test.yml",
"chars": 1479,
"preview": "name: Tests\non:\n push:\n branches:\n - master\n pull_request:\n branches:\n - master\njobs:\n test:\n name"
},
{
"path": ".gitignore",
"chars": 97,
"preview": "target/\n**/*.rs.bk\ntests/.crates.toml\ntests/bin\n/build-installer\ndocs/book\ndocs/installer\n\n.idea\n"
},
{
"path": "CHANGELOG.md",
"chars": 121164,
"preview": "# Changelog\n\n## 🤍 Unreleased\n\n## 🌻 0.14.0\n\n- ### ✨ Features\n\n - **Support arbitrary wasm targets (WASI support) - [RRev"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 5277,
"preview": "# The Rust Code of Conduct\n\nA version of this document [can be found online](https://www.rust-lang.org/conduct.html).\n\n#"
},
{
"path": "CONTRIBUTING.md",
"chars": 3299,
"preview": "# Contributing\n\n## Filing an Issue\n\nIf you are trying to use `wasm-pack` and run into an issue- please file an\nissue! We"
},
{
"path": "Cargo.toml",
"chars": 1149,
"preview": "[package]\nname = \"wasm-pack\"\ndescription = \"📦✨ your favorite rust -> wasm workflow tool!\"\nversion = \"0.14.0\"\nauthors = ["
},
{
"path": "LICENSE-APACHE",
"chars": 10850,
"preview": " Apache License\n Version 2.0, January 2004\n http"
},
{
"path": "LICENSE-MIT",
"chars": 1059,
"preview": "Copyright (c) 2018 Ashley Williams\n\nPermission is hereby granted, free of charge, to any\nperson obtaining a copy of this"
},
{
"path": "README.md",
"chars": 2810,
"preview": "<div align=\"center\">\n\n <h1>📦✨ wasm-pack</h1>\n\n <p>\n <strong>Your favorite Rust → Wasm workflow tool!</strong>\n </p"
},
{
"path": "RELEASE_CHECKLIST.md",
"chars": 2371,
"preview": "# Release Checklist\n\nThis is a list of the things that need to happen during a release.\n\n1. Open the associated mileston"
},
{
"path": "clippy.toml",
"chars": 32,
"preview": "too-many-arguments-threshold = 8"
},
{
"path": "docs/_installer/build-installer.rs",
"chars": 864,
"preview": "use std::fs;\n\nfn main() {\n fs::create_dir_all(\"docs/installer\").unwrap();\n fs::copy(\n \"docs/_installer/wasm"
},
{
"path": "docs/_installer/index.html",
"chars": 3974,
"preview": "<!DOCTYPE html>\n<head>\n <meta charset=\"utf-8\" />\n <title>wasm-pack</title>\n <link\n href=\"https://cdnjs.cloudflare."
},
{
"path": "docs/_installer/init.sh",
"chars": 6234,
"preview": "#!/bin/bash\n# Copyright 2016 The Rust Project Developers. See the COPYRIGHT\n# file at the top-level directory of this di"
},
{
"path": "docs/_installer/wasm-pack.js",
"chars": 2968,
"preview": "var platforms = [\"unknown\", \"win64\", \"unix\"];\nvar platform_override = null;\n\nfunction detect_platform() {\n \"use stric"
},
{
"path": "docs/_theme/header.hbs",
"chars": 1481,
"preview": "<style>\n header.warning {\n background-color: rgb(242, 222, 222);\n border-bottom-color: rgb(238, 211, 215);\n bo"
},
{
"path": "docs/book.toml",
"chars": 76,
"preview": "[book]\nauthors = [\"Ashley Williams\"]\nsrc = \"src\"\ntitle = \"Hello wasm-pack!\"\n"
},
{
"path": "docs/browserconfig.xml",
"chars": 246,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<browserconfig>\n <msapplication>\n <tile>\n <square150x150logo"
},
{
"path": "docs/index.html",
"chars": 2069,
"preview": "<!DOCTYPE html>\n<head>\n <meta charset=\"utf-8\">\n <title>wasm-pack</title>\n <link href=\"https://cdnjs.cloudflare.com/aj"
},
{
"path": "docs/public/custom.css",
"chars": 1277,
"preview": "@import url('https://fonts.googleapis.com/css?family=Raleway');\n\n.navbar {\n display: block;\n width: 100%;\n height: 6."
},
{
"path": "docs/site.webmanifest",
"chars": 446,
"preview": "{\n \"name\": \"wasm-pack \",\n \"short_name\": \"wasm-pack \",\n \"icons\": [\n {\n \"src\": \"/android-chrome"
},
{
"path": "docs/src/SUMMARY.md",
"chars": 2073,
"preview": "# Summary\n\n- [Introduction](./introduction.md)\n- [Quickstart](./quickstart.md)\n- [Prerequisites](./prerequisites/index.m"
},
{
"path": "docs/src/cargo-toml-configuration.md",
"chars": 2502,
"preview": "# `Cargo.toml` Configuration\n\n`wasm-pack` can be configured via the `package.metadata.wasm-pack` key in\n`Cargo.toml`. Ev"
},
{
"path": "docs/src/commands/build.md",
"chars": 6700,
"preview": "# wasm-pack build\n\nThe `wasm-pack build` command creates the files necessary for JavaScript\ninteroperability and for pub"
},
{
"path": "docs/src/commands/index.md",
"chars": 1351,
"preview": "# Commands\n\n`wasm-pack` has several commands to help you during the process of building\na Rust-generated WebAssembly pro"
},
{
"path": "docs/src/commands/init.md",
"chars": 227,
"preview": "# wasm-pack init (DEPRECATED)\n\nThis command has been deprecated in favor of `build`, which does the same thing, but is\na"
},
{
"path": "docs/src/commands/new.md",
"chars": 1335,
"preview": "# wasm-pack new\n\nThe `wasm-pack new` command creates a new RustWasm project for you,\nusing [`cargo-generate`] under the "
},
{
"path": "docs/src/commands/pack-and-publish.md",
"chars": 1542,
"preview": "# pack and publish\n\nThe `publish` and `pack` commands interact with the pkg directory that's\ncreated when you run `wasm-"
},
{
"path": "docs/src/commands/test.md",
"chars": 2676,
"preview": "# wasm-pack test\n\nThe `wasm-pack test` command wraps the [wasm-bindgen-test-runner](https://wasm-bindgen.github.io/wasm-"
},
{
"path": "docs/src/contributing.md",
"chars": 1029,
"preview": "# Contributing\n\n## Prerequisites\n\nThe technical prerequisites for contributing to this project are the same as for\nusing"
},
{
"path": "docs/src/introduction.md",
"chars": 653,
"preview": "\n\n<h1 style=\"text-align: center;\">Welcome t"
},
{
"path": "docs/src/prerequisites/considerations.md",
"chars": 1018,
"preview": "# nodejs\n\nCurrently, `wasm-pack` generated npm modules require us to you have [fetch] polyfill in your node project.\n\nIf"
},
{
"path": "docs/src/prerequisites/index.md",
"chars": 844,
"preview": "# Prerequisites\n\nFirst you'll want to [install the `wasm-pack` CLI][wasm-pack], and `wasm-pack\n-V` should print the vers"
},
{
"path": "docs/src/prerequisites/non-rustup-setups.md",
"chars": 3480,
"preview": "# Non-Rustup setups\n`wasm-pack` compiles your code using the `wasm32-unknown-unknown` target. `wasm-pack` will automatic"
},
{
"path": "docs/src/prerequisites/npm.md",
"chars": 984,
"preview": "# npm\n\nCurrently, `wasm-pack` requires that you have npm installed to pack and publish your\npackage. Longterm, this will"
},
{
"path": "docs/src/quickstart.md",
"chars": 587,
"preview": "# Quickstart\n\n1. Install `rust` using [`rustup`].\n1. [Install this tool.]\n1. Run `wasm-pack new hello-wasm`.\n1. `cd hell"
},
{
"path": "docs/src/tutorials/hybrid-applications-with-webpack/getting-started.md",
"chars": 447,
"preview": "# Getting Started\n\nYou can create a new Rust-WebAssembly webpack project by using the [rustwasm webpack-template].\n\nRun:"
},
{
"path": "docs/src/tutorials/hybrid-applications-with-webpack/index.md",
"chars": 585,
"preview": "# Hybrid Applications with Webpack\n\nThe goal of this tutorial is to introduce you to the [`rust-webpack-template`]\nand t"
},
{
"path": "docs/src/tutorials/hybrid-applications-with-webpack/using-your-library.md",
"chars": 2782,
"preview": "# Run The Code\n\nThe Rust Webpack template is designed for creating monorepo-style Web applications with\nRust-generated W"
},
{
"path": "docs/src/tutorials/index.md",
"chars": 414,
"preview": "# Tutorials\n\nWe have two tutorials that help you get started with `wasm-pack`:\n\n- If you want to create and publish a pa"
},
{
"path": "docs/src/tutorials/npm-browser-packages/building-your-project.md",
"chars": 618,
"preview": "# Building your project\n\nWe've written our code so now we need to build it.\n\nWe are writing a crate that should be used "
},
{
"path": "docs/src/tutorials/npm-browser-packages/getting-started/manual-setup.md",
"chars": 2389,
"preview": "# Manual Setup\n\n⚠️ This is not the recommended way to start a `wasm-pack` project! If you ended up\nhere by mistake, go c"
},
{
"path": "docs/src/tutorials/npm-browser-packages/getting-started.md",
"chars": 808,
"preview": "# Getting Started\n\nYou can create a new Rust-WebAssembly project by using the [rustwasm wasm-pack-template].\n\nTo so do, "
},
{
"path": "docs/src/tutorials/npm-browser-packages/index.md",
"chars": 748,
"preview": "# npm Browser Package Tutorial\n\nThe goal of this tutorial is to introduce you to the `wasm-pack` workflow by building a "
},
{
"path": "docs/src/tutorials/npm-browser-packages/packaging-and-publishing.md",
"chars": 1324,
"preview": "# Package Code for npm\n\nWe've made our code so now we need to package it all up. In your project directory run the follo"
},
{
"path": "docs/src/tutorials/npm-browser-packages/template-deep-dive/building-your-project.md",
"chars": 24,
"preview": "# Building your project\n"
},
{
"path": "docs/src/tutorials/npm-browser-packages/template-deep-dive/cargo-toml.md",
"chars": 4828,
"preview": "# Cargo.toml\n\n`Cargo.toml` is the manifest file for Rust's package manager, [`cargo`]. This file contains\nmetadata such "
},
{
"path": "docs/src/tutorials/npm-browser-packages/template-deep-dive/index.md",
"chars": 809,
"preview": "# Template Deep Dive\n\n⚠️ This section is a deep dive into the contents of the files of a \"Hello, World\" project,\nspecifi"
},
{
"path": "docs/src/tutorials/npm-browser-packages/template-deep-dive/src-lib-rs.md",
"chars": 4734,
"preview": "# src/lib.rs\n\n`lib.rs` is the template's main source file. The name `lib.rs` commonly implies that this Rust project wil"
},
{
"path": "docs/src/tutorials/npm-browser-packages/template-deep-dive/src-utils-rs.md",
"chars": 2406,
"preview": "# src/utils.rs\n\nThe purpose of `utils.rs` is to define the `utils` module, which contains a single function `set_panic_h"
},
{
"path": "docs/src/tutorials/npm-browser-packages/template-deep-dive/tests-web-rs.md",
"chars": 2416,
"preview": "# tests/web.rs\n\n`web.rs` is an integration test [defined with Cargo][cargo-tests] that is\nintended to be run in a headle"
},
{
"path": "docs/src/tutorials/npm-browser-packages/template-deep-dive/wee_alloc.md",
"chars": 1860,
"preview": "# wee_alloc\n\n1. [What is `wee_alloc`?](#what-is-wee_alloc)\n2. [Enabling `wee_alloc`](#enabling-wee_alloc)\n\n## What is `w"
},
{
"path": "docs/src/tutorials/npm-browser-packages/testing-your-project.md",
"chars": 1376,
"preview": "# Testing your project\n\nNow after writing and building code, let's actually execute it! You can execute\ntests with:\n\n```"
},
{
"path": "docs/src/tutorials/npm-browser-packages/using-your-library.md",
"chars": 2399,
"preview": "# Run The Code From npm\n\nThis portion of the tutorial will help you create a [Webpack] JavaScript project that will\nrun "
},
{
"path": "docs/src/tutorials/standalone-wasm-binaries/index.md",
"chars": 27,
"preview": "# Standalone WASM Binaries\n"
},
{
"path": "npm/.gitignore",
"chars": 12,
"preview": "node_modules"
},
{
"path": "npm/README.md",
"chars": 2810,
"preview": "<div align=\"center\">\n\n <h1>📦✨ wasm-pack</h1>\n\n <p>\n <strong>Your favorite Rust → Wasm workflow tool!</strong>\n </p"
},
{
"path": "npm/binary.js",
"chars": 1489,
"preview": "const { Binary } = require(\"binary-install\");\nconst { join } = require(\"path\");\nconst os = require(\"os\");\n\nconst windows"
},
{
"path": "npm/install.js",
"chars": 73,
"preview": "#!/usr/bin/env node\n\nconst { install } = require(\"./binary\");\ninstall();\n"
},
{
"path": "npm/package.json",
"chars": 796,
"preview": "{\n \"name\": \"wasm-pack\",\n \"version\": \"0.14.0\",\n \"description\": \"📦✨ your favorite rust -> wasm workflow tool!\",\n \"main"
},
{
"path": "npm/run.js",
"chars": 65,
"preview": "#!/usr/bin/env node\n\nconst { run } = require(\"./binary\");\nrun();\n"
},
{
"path": "src/bindgen.rs",
"chars": 3888,
"preview": "//! Functionality related to running `wasm-bindgen`.\n\nuse crate::child;\nuse crate::command::build::{BuildProfile, Target"
},
{
"path": "src/build/mod.rs",
"chars": 7404,
"preview": "//! Building a Rust crate into a `.wasm` binary.\n\nuse crate::child;\nuse crate::command::build::BuildProfile;\nuse crate::"
},
{
"path": "src/build/wasm_target.rs",
"chars": 4852,
"preview": "//! Checking for the wasm32 target\n\nuse crate::child;\nuse crate::emoji;\nuse crate::PBAR;\nuse anyhow::{anyhow, bail, Cont"
},
{
"path": "src/cache.rs",
"chars": 365,
"preview": "//! Getting and configuring wasm-pack's binary cache.\n\nuse anyhow::Result;\nuse binary_install::Cache;\nuse std::env;\nuse "
},
{
"path": "src/child.rs",
"chars": 1792,
"preview": "//! Utilities for managing child processes.\n//!\n//! This module helps us ensure that all child processes that we spawn g"
},
{
"path": "src/command/build.rs",
"chars": 15648,
"preview": "//! Implementation of the `wasm-pack build` command.\n\nuse crate::bindgen;\nuse crate::build;\nuse crate::cache;\nuse crate:"
},
{
"path": "src/command/generate.rs",
"chars": 731,
"preview": "use crate::cache;\nuse crate::generate;\nuse crate::install::{self, Tool};\nuse crate::PBAR;\nuse anyhow::Result;\nuse log::i"
},
{
"path": "src/command/login.rs",
"chars": 619,
"preview": "use crate::npm;\nuse crate::PBAR;\nuse anyhow::Result;\nuse log::info;\n\npub fn login(\n registry: Option<String>,\n sco"
},
{
"path": "src/command/mod.rs",
"chars": 5745,
"preview": "//! CLI command structures, parsing, and execution.\n#![allow(clippy::redundant_closure)]\n\npub mod build;\nmod generate;\nm"
},
{
"path": "src/command/pack.rs",
"chars": 944,
"preview": "use crate::command::utils::{find_pkg_directory, get_crate_path};\nuse crate::npm;\nuse crate::PBAR;\nuse anyhow::{anyhow, R"
},
{
"path": "src/command/publish/access.rs",
"chars": 1118,
"preview": "use anyhow::{bail, Error, Result};\nuse std::fmt;\nuse std::str::FromStr;\n\n/// Represents access level for the to-be publi"
},
{
"path": "src/command/publish/mod.rs",
"chars": 3000,
"preview": "/// Data structure to represent published package access level.\npub mod access;\n\nuse self::access::Access;\nuse crate::co"
},
{
"path": "src/command/test.rs",
"chars": 14421,
"preview": "//! Implementation of the `wasm-pack test` command.\n\nuse crate::build;\nuse crate::cache;\nuse crate::command::utils::get_"
},
{
"path": "src/command/utils.rs",
"chars": 2315,
"preview": "//! Utility functions for commands.\n#![allow(clippy::redundant_closure)]\n\nuse anyhow::Result;\nuse std::fs;\nuse std::path"
},
{
"path": "src/emoji.rs",
"chars": 1166,
"preview": "//! Emoji constants used by `wasm-pack`.\n//!\n//! For the woefully unfamiliar:\n//!\n//! > Emoji are ideograms and smileys "
},
{
"path": "src/generate.rs",
"chars": 854,
"preview": "//! Functionality related to running `cargo-generate`.\n\nuse crate::child;\nuse crate::emoji;\nuse crate::install::{self, T"
},
{
"path": "src/install/arch.rs",
"chars": 871,
"preview": "use anyhow::{bail, Result};\nuse std::fmt;\n\nuse crate::target;\n\n/// An enum representing supported architectures\n#[derive"
},
{
"path": "src/install/krate.rs",
"chars": 832,
"preview": "use crate::install::Tool;\nuse anyhow::Result;\nuse serde::Deserialize;\nconst VERSION: Option<&str> = option_env!(\"CARGO_P"
},
{
"path": "src/install/mod.rs",
"chars": 10824,
"preview": "//! Functionality related to installing prebuilt binaries and/or running cargo install.\n\nuse self::krate::Krate;\nuse cra"
},
{
"path": "src/install/mode.rs",
"chars": 1230,
"preview": "use anyhow::{bail, Error, Result};\nuse std::str::FromStr;\n\n/// The `InstallMode` determines which mode of initialization"
},
{
"path": "src/install/os.rs",
"chars": 903,
"preview": "use anyhow::{bail, Result};\nuse std::fmt;\n\nuse crate::target;\n\n/// An enum representing supported operating systems\n#[de"
},
{
"path": "src/install/tool.rs",
"chars": 529,
"preview": "use std::fmt;\n\n/// Represents the set of CLI tools wasm-pack uses\npub enum Tool {\n /// cargo-generate CLI tool\n Ca"
},
{
"path": "src/installer.rs",
"chars": 4100,
"preview": "//! Self-installation of `wasm-pack`\n//!\n//! This module contains one public function which will self-install the\n//! cu"
},
{
"path": "src/lib.rs",
"chars": 1691,
"preview": "//! Your favorite rust -> wasm workflow tool!\n\n#![deny(missing_docs)]\n\nextern crate anyhow;\nextern crate cargo_metadata;"
},
{
"path": "src/license.rs",
"chars": 3022,
"preview": "//! Copy `LICENSE` file(s) for the packaged wasm.\n\nuse anyhow::{anyhow, Result};\nuse std::fs;\nuse std::path::Path;\n\nuse "
},
{
"path": "src/lockfile.rs",
"chars": 2649,
"preview": "//! Reading Cargo.lock lock file.\n\n#![allow(clippy::new_ret_no_self)]\n\nuse std::fs;\nuse std::path::PathBuf;\n\nuse crate::"
},
{
"path": "src/main.rs",
"chars": 3464,
"preview": "#![allow(clippy::redundant_closure, clippy::redundant_pattern_matching)]\n\nextern crate anyhow;\nextern crate clap;\nextern"
},
{
"path": "src/manifest/mod.rs",
"chars": 29481,
"preview": "//! Reading and writing Cargo.toml and package.json manifests.\n\n#![allow(\n clippy::new_ret_no_self,\n clippy::needl"
},
{
"path": "src/manifest/npm/commonjs.rs",
"chars": 1019,
"preview": "use std::collections::HashMap;\n\nuse crate::manifest::npm::repository::Repository;\n\n#[derive(Serialize)]\npub struct Commo"
},
{
"path": "src/manifest/npm/esmodules.rs",
"chars": 1142,
"preview": "use std::collections::HashMap;\n\nuse crate::manifest::npm::repository::Repository;\n\n#[derive(Serialize)]\npub struct ESMod"
},
{
"path": "src/manifest/npm/mod.rs",
"chars": 375,
"preview": "mod commonjs;\nmod esmodules;\nmod nomodules;\npub mod repository;\n\npub use self::commonjs::CommonJSPackage;\npub use self::"
},
{
"path": "src/manifest/npm/nomodules.rs",
"chars": 1023,
"preview": "use std::collections::HashMap;\n\nuse crate::manifest::npm::repository::Repository;\n\n#[derive(Serialize)]\npub struct NoMod"
},
{
"path": "src/manifest/npm/repository.rs",
"chars": 118,
"preview": "#[derive(Serialize)]\npub struct Repository {\n #[serde(rename = \"type\")]\n pub ty: String,\n pub url: String,\n}\n"
},
{
"path": "src/npm.rs",
"chars": 1793,
"preview": "//! Functionality related to publishing to npm.\n\nuse crate::child;\nuse crate::command::publish::access::Access;\nuse anyh"
},
{
"path": "src/progressbar.rs",
"chars": 3013,
"preview": "//! Fancy progress bar functionality.\n\nuse crate::emoji;\nuse anyhow::{bail, Error, Result};\nuse console::style;\nuse std:"
},
{
"path": "src/readme.rs",
"chars": 985,
"preview": "//! Generating `README` files for the packaged wasm.\n\nuse anyhow::{Context, Result};\nuse std::fs;\nuse std::path::Path;\n\n"
},
{
"path": "src/stamps.rs",
"chars": 2056,
"preview": "//! Key-value store in `*.stamps` file.\n\nuse anyhow::{anyhow, Context, Result};\nuse std::{env, fs, path::PathBuf};\n\n/// "
},
{
"path": "src/target.rs",
"chars": 621,
"preview": "//! Information about the target wasm-pack is currently being compiled for.\n//!\n//! That is, whether we are building was"
},
{
"path": "src/test/mod.rs",
"chars": 994,
"preview": "//! Testing a Rust crate compiled to wasm.\n\npub mod webdriver;\n\nuse crate::child;\nuse crate::PBAR;\nuse anyhow::{Context,"
},
{
"path": "src/test/webdriver/chromedriver.rs",
"chars": 5797,
"preview": "use super::get_and_notify;\nuse crate::install::InstallMode;\nuse crate::stamps;\nuse crate::target;\nuse anyhow::{bail, Con"
},
{
"path": "src/test/webdriver/geckodriver.rs",
"chars": 6434,
"preview": "use super::get_and_notify;\nuse crate::install::InstallMode;\nuse crate::stamps;\nuse crate::target;\nuse anyhow::{anyhow, b"
},
{
"path": "src/test/webdriver/safaridriver.rs",
"chars": 481,
"preview": "use anyhow::{bail, Result};\nuse std::path::PathBuf;\n\n/// Get the path to an existing `safaridriver`.\n///\n/// We can't in"
},
{
"path": "src/test/webdriver.rs",
"chars": 900,
"preview": "//! Getting WebDriver client binaries.\n\nmod chromedriver;\nmod geckodriver;\nmod safaridriver;\n\nuse crate::PBAR;\nuse anyho"
},
{
"path": "src/wasm_opt.rs",
"chars": 2422,
"preview": "//! Support for downloading and executing `wasm-opt`\n\nuse crate::child;\nuse crate::install;\nuse crate::PBAR;\nuse anyhow:"
},
{
"path": "tests/all/build.rs",
"chars": 11247,
"preview": "use crate::utils;\nuse assert_cmd::prelude::*;\nuse std::fs;\nuse std::path::Path;\n\n#[test]\nfn build_in_non_crate_directory"
},
{
"path": "tests/all/download.rs",
"chars": 3905,
"preview": "use wasm_pack::install::{self, Arch, Os, Tool};\n\n#[test]\n#[cfg(any(\n all(target_os = \"linux\", target_arch = \"x86_64\")"
},
{
"path": "tests/all/generate.rs",
"chars": 483,
"preview": "use crate::utils;\nuse assert_cmd::prelude::*;\n\n#[test]\nfn new_with_no_name_errors() {\n let fixture = utils::fixture::"
},
{
"path": "tests/all/license.rs",
"chars": 5887,
"preview": "extern crate anyhow;\nextern crate wasm_pack;\n\nuse std::fs;\n\nuse crate::utils::{self, fixture};\nuse wasm_pack::license;\nu"
},
{
"path": "tests/all/lockfile.rs",
"chars": 4038,
"preview": "use crate::utils::fixture;\nuse semver::{Version, VersionReq};\nuse wasm_pack::lockfile::Lockfile;\nuse wasm_pack::manifest"
},
{
"path": "tests/all/log_level.rs",
"chars": 2400,
"preview": "use crate::utils;\nuse assert_cmd::prelude::*;\nuse predicates::boolean::PredicateBooleanExt;\nuse predicates::prelude::pre"
},
{
"path": "tests/all/main.rs",
"chars": 466,
"preview": "extern crate anyhow;\nextern crate assert_cmd;\nextern crate lazy_static;\nextern crate predicates;\n#[macro_use]\nextern cra"
},
{
"path": "tests/all/manifest.rs",
"chars": 22876,
"preview": "use crate::utils::{self, fixture};\nuse assert_cmd::prelude::*;\nuse std::collections::{HashMap, HashSet};\nuse std::fs;\nus"
},
{
"path": "tests/all/readme.rs",
"chars": 4513,
"preview": "extern crate anyhow;\nextern crate wasm_pack;\n\nuse std::fs;\n\nuse crate::utils::{self, fixture};\nuse assert_cmd::prelude::"
},
{
"path": "tests/all/stamps.rs",
"chars": 1511,
"preview": "use std::{fs, panic};\nuse wasm_pack::stamps;\n\nfn run_test<T>(test: T) -> ()\nwhere\n T: FnOnce() -> () + panic::UnwindS"
},
{
"path": "tests/all/test.rs",
"chars": 10495,
"preview": "use crate::utils::fixture;\nuse assert_cmd::prelude::*;\nuse predicates::prelude::*;\nuse std::env;\n\n#[test]\nfn it_can_run_"
},
{
"path": "tests/all/utils/file.rs",
"chars": 268,
"preview": "use std::fs::File;\nuse std::io::Read;\nuse std::path::Path;\n\nuse anyhow::Result;\n\npub fn read_file(path: &Path) -> Result"
},
{
"path": "tests/all/utils/fixture.rs",
"chars": 25567,
"preview": "use binary_install::Cache;\nuse lazy_static::lazy_static;\nuse std::env;\nuse std::fs;\nuse std::mem::ManuallyDrop;\nuse std:"
},
{
"path": "tests/all/utils/manifest.rs",
"chars": 1577,
"preview": "use std::io::prelude::*;\nuse std::path::Path;\nuse std::{collections::HashMap, fs::File};\n\nuse anyhow::Result;\nuse serde_"
},
{
"path": "tests/all/utils/mod.rs",
"chars": 49,
"preview": "pub mod file;\npub mod fixture;\npub mod manifest;\n"
},
{
"path": "tests/all/wasm_opt.rs",
"chars": 4538,
"preview": "use crate::utils;\nuse assert_cmd::prelude::*;\nuse predicates::prelude::*;\n\n#[test]\nfn off_in_dev() {\n let fixture = u"
},
{
"path": "tests/all/webdriver.rs",
"chars": 1103,
"preview": "use crate::utils::fixture;\nuse binary_install::Cache;\nuse wasm_pack::test::webdriver;\n\n#[test]\n#[cfg(any(\n all(target"
}
]
About this extraction
This page contains the full source code of the drager/wasm-pack GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 128 files (486.6 KB), approximately 130.0k tokens, and a symbol index with 397 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.