Releases: rustwasm/wasm-pack
βοΈ 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.
-
-
π οΈ Maintenance
- Consolidate wasm-opt installation into existing binary install logic - ashleygwilliams, issue/685 pull/687
π₯οΈ 0.9.0
-
β¨ Features
-
Adding in
--quiet
and--log-level
flags to control the console output - Pauan, pull/694The
--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:
wasm-pack --log-level error build wasm-pack --quiet build
-
Wrap
cargo-generate
withwasm-pack new
- ashleygwilliams, issue/373 pull/623One of the first steps in getting started with
wasm-pack
is tocargo install cargo-generate
to bootstrap some project templates. This can take a while and is an extra burden on users just getting started withwasm-pack
.wasm-pack new
usescargo-generate
to bootstrap new projects, removing the need to install the tool on your own. You can read more about this feature here. -
Allow
wasm-pack
to be run from subdirectories - gameldar, issue/620 pull/624If a crate path is not specified when running
wasm-pack
and there is noCargo.toml
in the current working directory,wasm-pack
will walk up the directory structure to find aCargo.toml
. -
Automatically execute
wasm-opt
on produced binaries - alexcrichton, issue/159 pull/625When
wasm-pack
builds binaries in released and profiling modes, it will executewasm-opt
on the binary, making the result smaller and more performant. -
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 towasm-bindgen
whenwasm-pack build --target web
is run. Before, if the user had an old version ofwasm-bindgen
in their dependencies, they would receive a cryptic error message. Now they will be notified that they need to update theirwasm-bindgen
dependency if they want to build for theweb
target. -
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 on NPM, and more about this feature in our docs.
-
-
π€ 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. -
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. -
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, whenwasm-pack
performs an API request to crates.io, it sendsUser-Agent: wasm-pack/0.9.0
. -
Make
sideEffects
in generatedpackage.json
a boolean instead of a string - rhysd, pull/649 -
Don't warn if license-file is present - ashleygwilliams, issue/692 pull/693
Previously,
wasm-pack
would warn that thelicense
field was missing if thelicense-file
field was used instead. This warning is now only surfaced if bothlicense
andlicense-field
are absent from aCargo.toml
. -
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. -
Only run node tests on
wasm-pack test --node
- alexcrichton, 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. -
Clean up
cargo test
warnings - ashleygwilliams, issue/752 pull/753Tests now use
std::sync::Once::new()
instead of the deprecatedstd::sync::ONCE_INIT
-
-
π Documentation
-
Update help message for
build
andpublish
subcommands - ibaryshnikov, issue/636 pull/640wasm-bindgen
recently changed the default target frombrowser
tobundler
and deprecatedbrowser
. This change is now reflected in the help message forwasm-pack build
. -
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 inRELEASE_CHECKLIST.md
.
π οΈ 0.8.1
-
π€ Fixes
-
Check for "rustup" rather than ".rustup" when checking for wasm32 - drager, issue/613
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.
-
π€οΈ 0.8.0
-
β¨ Features
-
Give user's ability to customize generated filenames with
--out-name
flag - ibaryshnikov, issue/596 pull/599When running
wasm-pack build
, several files are generated. These files are named based on the name of the crate, as per yourCargo.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 calleddom
, 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
-
-
π€ Fixes
-
Fix panics in
build mode --no-install
- alexcrichton, pull/598This commit fixes the
wasm-pack build --mode no-install
command from unconditionally panicking as well as--mode force
. These steps were calling anunwrap()
on an internalOption<T>
which was supposed to be set duringstep_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. -
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. -
Improve error message when
wasm32-unknown-unknown
is missing - drager, issue/579 pull/602For 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.
-
-
π Documentation
-
Document
--out-dir
flag - ashleygwilliams, issue/592 pull/593Recently, someone asked on Discord about customizing the name of the directory that contains the assets built by
wasm-pack
. We've had theout-dir
flag for a while, but it wasn't documented! Now it is. -
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
wasm-pack-template
. Additionally, there were some broken links in the documentation. We've updated the docs for the new template and fixed the broken links!
-
-
π οΈ Maintenance
-
Move
binary-install
to its own repo - drager, issue/500 pull/600binary-install
is a crate that holds the abstractions for howwasm-pack
downloads and caches pre-built binaries for the tools it wraps. It was originally part of thewasm-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!
-
π€οΈ 0.7.0
-
β¨ Features
-
Non
rustup
environment support - [drager], pull/552Before now,
wasm-pack
had a hard requirement thatrustup
had to be in the PATH. While most Rust users userustup
there are variety reasons to have an environment that doesn't userustup
. With this PR, we'll now support folks who are using a non-rustup
environment! -
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).
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 yourwasm-pack
and take it for a spin! -
Add support for
--target web
- [alexcrichton], pull/567Recently,
wasm-bindgen
add a new target-web
. This new target is similar to theno-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 theno-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!
-
Support passing arbitrary arguments to
cargo test
viawasm-pack test
- chinedufn, issue/525 pull/530wasm-pack test
is an awesome command that wrapscargo 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 ofcargo test
by passing arguments that haven't been re-exported by thewasm-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, thewasm-pack test
interface did not!wasm-pack test
now accepts passing and arbitrary set of arguments that it will forward along to itscargo test
call by allowing users to use--
after anywasm-pack test
arguments, followed by the set of arguments you'd like to pass tocargo 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! -
Support
homepage
field ofCargo.toml
andpackage.json
- rhysd, pull/531Both
Cargo.toml
andpackage.json
support ahomepage
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! -
Support
license-file
field inCargo.toml
- rhysd, pull/527Sometimes, 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 alicense-file
field instead. You can read more about this in thecargo
manifest documentation.In an npm package, this translates to
"license": "SEE LICENSE IN <filename>"
in yourpackage.json
. You can read more about this in the npmpackage.json
documentation.We previously only supported using SPDX standard licenses, by only supporting the
"license"
key in yourCargo.toml
- but now we'll allow you to leverage thelicense-file
key as well, and will translate it correctly into yourpackage.json
!
-
-
π€ Fixes
-
wasm-pack-init (1).exe
should work - [ashleygwilliams], issue/518 pull/550Several users noted that when downloading a new version of
wasm-pack
their browser named the executable filewasm-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 withwasm-pack-init
and will still execute files with these additional, extraneous characters in the filename. Thanks so much to Mblkolo and [danwilhelm] for filing the issue and the excellent discussion! -
Fix chromedriver error and message on Windows for
wasm-pack test
- jscheffner, issue/535 pull/537When 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.
-
Correct look up location for
wasm-bindgen
when it's installed viacargo install
- [fitzgen], pull/504Sometimes, when a
wasm-bindgen
binary is not available, or ifwasm-pack
is being run on an architecture thatwasm-bindgen
doesn't produce binaries for, instead of downloading a pre-built binary,wasm-pack
will installwasm-bindgen
usingcargo 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 forwasm-bindgen
in the appropriate location. As a result, this led to a bug wherewasm-pack
would panic.We've fixed the lookup for the
cargo install
'dwasm-bindgen
by moving thecargo-install
'd version to global cache location forwasm-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! -
Only print
cargo test
output the once - [fitzgen], issue/511 pull/521Due 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!
-
-
π οΈ Maintenance
-
Fix
clippy
warnings - [mstallmo], issue/477 pull/478clippy
is an awesome utilty that helps lint your Rust code for common optimizations and idioms. at the beginning ofwasm-pack
development,clippy
had not yet stablized, but it has since 1.0'd and it was high time we leveraged it inwasm-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! -
Run
clippy
check on Travis - [drager], pull/502Now that
wasm-pack
has been clippified- we want to keep it that way! Now in addition tocargo fmt
andcargo test
, we'll also runcargo clippy
on all incoming PRs! -
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 ofwasm-pack
. Now we've ported over to using this great library!
-
π 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 runwasm-pack
when they were ready to publish a wasm package. As a result,wasm-pack
always rancargo 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 runcargo build
indev
mode, which trades faster compilation speed for a lack of optimizations. We've renamed this flag to--dev
to matchcargo
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 thecargo profile
documentation.This PR also introduces a way to configure
wasm-pack
in yourCargo.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. It leverages the
package.metadata.wasm-pack
key in yourCagol.toml
, and looks like this:# 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!
-
DEPRECATION: Rename
--debug
to--dev
to matchcargo
- fitzgen, pull/439See the discussion of the build profiles feature above. This is a strict renaming of the previous
--debug
flag, which will now warn as deprecated. -
Add an option to pass an arbitrary set of arguments to
cargo build
- torkve, issue/455 pull/461As 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 iscargo
.cargo
has a wide array of features and flags, and we couldn't reasonably expect to implement them all as first class features ofwasm-pack
. As a result, we've created the option to allow users to pass an arbitrary number of additional flags towasm-pack
by appending them to thewasm-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 tocargo build
. This feature is documented here. -
Pre-build before wasm-pack publish - csmoe, issue/438 pull/444
Previously, if you ran
wasm-pack publish
before you had successfully runwasm-pack build
,
you'd receive an error that a package could not be found- because there would be nopkg
or
out-directory containing apackage.json
.In this situation, you would hope that
wasm-pack
would build your package for you when you
ranwasm-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 namedpkg
.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: -
Generate self-.gitignore as part of pkg folder - RReverser, pull/453
Since
wasm-pack
was first published, thepkg
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 bywasm-pack
, however.Now, when building your package,
wasm-pack
will also generate a.gitignore
file so that thepkg
, 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! -
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 fortarget
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! -
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. Howwasm-pack
does this has evolved significantly since it's early versions. In the last version, abin
directory was created to house the tool binaries thatwasm-pack
needed to build our project, but this had several limitations. Firstly, it created abin
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 abin
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 thedirs
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, forwasm-pack
users with multiple projects, should speed up build times.
-
-
π€ Fixes
-
Fix
pack
,login
, andpublish
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 ofwasm-pack
was well noticed by our community - and thanks to the efforts ofdanwilhelm
is now fix...
-
π 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 bywasm-pack
. Ever sat at a long prompt fromwasm-pack
and
wondered what was happening? No longer! Didwasm-pack
eat your test output- no more! -
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. -
Add
exit_status
to CLI errors - konstin, issue/291 pull/387We'd been hiding these- but we shouldn't have been!
-
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 thewasm-pack test
PR, and missed a few as a result! This removes all
lingering forced nightly, which only affected thewasm-pack test
command. -
Fix
wasm-bindgen-test
dependency error message - fitzgen, issue/377 pull/378The error message about missing the
wasm-bindgen-test
dependency errantly stated
that the user was missing awasm-bindgen
dependency! We've fixed it to correctly
state the missing dependency now.
-
-
π οΈ Maintenance
βοΈ 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!
-
π± Module Support
-
BREAKING: use correct
package.json
keys for generated JavaScript - ashleygwilliams, issue/309 pull/312This 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 usingpackage.json
.With this release, we will do the following:
-
--target broswer
: By default, we generate JS that is an ES6 module. We used to put
this in themain
field. Now we put it in themodule
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 themain
key. -
--target no-modules
: This is a new target. For this target we generate bare JavaScript.
This code is put in abrowser
field.
You can see the structs that represent each target's expected
package.json
here.Thanks so much to bterlson for his help in sorting this out for us!
-
-
-
π οΈ New Commands
-
wasm-pack init
is nowwasm-pack build
- csmoe, issue/188 pull/216When 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 version0.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. -
add new command:
wasm-pack test
- fitzgen, pull/271This is an experimental new command that will run your tests in Node.js or a headless
browser usingwasm-pack test
. Check out this tutorial
to learn more! -
add 2FA support to
wasm-pack publish
- [mstallmo], issue/257 pull/282We've been wrapping the
npm login
andnpm publish
commands aswasm-pack login
andwasm-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!)
-
-
π New Flags
-
New target, bare JavaScript:
--target no-modules
- ashleygwilliams, issue/317 pull/327wasm-bindgen
offers ano-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! -
--access
flag forwasm-pack
publish - ashleygwilliams, issue/297 pull/299Many 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
towasm-pack publish
and publish scoped packages
publicly.
-
-
β 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 thenightly
channel of Rust have moved tobeta
- we don't need to enforcenightly
.As of this release, we will check that your Rust version is above
1.30.0
. You can be on
either thenightly
orbeta
channel and all ofwasm-pack
s calls tocargo
will
respect that.Really hate this? You can pass
--mode force
towasm-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 thewasm-bindgen
CLI application whichwasm-pack
runs for you. This became such an issue that we opted to force installwasm-bindgen
to ensure
that everywasm-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 acargo install
ofwasm-bindgen
on every run, and that means downloading
and compilingwasm-bindgen
everytime you want to runwasm-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 yourCargo.lock
to find the version of
wasm-bindgen
you are using in your local project. We will attempt to fetch a binary version
ofwasm-bindgen
that matches your local version. We place that binary local to your project,
and use it when you runwasm-pack build
. The next time you runwasm-pack build
we'll use
that binary, instead of fetching a new one. We still fall back tocargo 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
-
enforce
cargo build
with--lib
- ashleygwilliams, issue/303 pull/330Right now,
wasm-pack
only works on Rust library projects. But sometimes, if you're
new to Rust, you might end up having amain.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 usewasm-pack
!
-
-
Installers and Releases
- **Appveyor Windows Pre-Built binaries - [alexcrichton], [...
-
β¨ 0.4.2
-
π€ Fixes
-
recognize
[dependencies.wasm-bindgen]
during dep check ininit
- ashleygwilliams, issue/221 pull/224When 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 usefeatures = ["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"]
withwasm-bindgen
actually does? It's awesome:It's possible to pass data from Rust to JS not explicitly supported in the Feature Reference by serializing via Serde.
Read the Passing arbitrary data to JS docs to learn more!
-
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 runpack
orpublish
. This was pretty crummy! Thankfully, Mackiovello swooped in with a fix, that you can find documented in the pack and publish docs! -
use
PathBuf
instead ofString
for paths - Mackiovello, pull/220This 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.
-
-
π 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 :)
-
β 0.4.1
-
π€ Fixes
-
fix
files
key value for projects build fornodejs
target - ashleygwilliams, issue/199 pull/205We became aware that the
files
key inpackage.json
did not include the additional_bg.js
file thatwasm-bindgen
generates for projects being built for thenodejs
target. This resulted in the file not being included in the published package and resulted in aModule 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.
-
-
π οΈ Maintenance
-
clean up
quicli
remnants - SoryRawyer, pull/193In v0.3.0 we removed the
quicli
dependency, however there were a few remnants left behind. They are now removed!
-
-
π 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! -
fix README code example - steveklabnik, pull/195
The code example in our
README.md
was missing a criticalpub
. It's there now! -
fix README markup - Hywan, pull/202
There was an errant
`
- it's gone now!
-