This commit adds support for automatically executing the `wasm-opt`
binary from the [Binaryen project][binaryen]. By default `wasm-pack`
will now, in release and profiling modes, execute `wasm-opt -O` over the
final binary. The goal here is to enable optimizations that further
reduce binary size or improve runtime. In the long run it's expected
that `wasm-opt`'s optimizations may mostly make their way into LLVM, but
it's empirically true today that `wasm-opt` plus LLVM is the best
combination for size and speed today.
A configuration section for `wasm-opt` has been added as [previously
proposed][fitzgen], namely:
```toml
[package.metadata.wasm-pack.profile.release]
wasm-opt = ['-Os']
```
The `wasm-opt` binary is downloaded from Binaryen's [own
releases](https://github.com/webassembly/binaryen/releases). They're
available for the same platforms that we download predownloaded binaries
for `wasm-bindgen` on. We'll also opportunistically use `wasm-opt` in
`PATH` if it's available. If we're untable to run `wasm-opt`, though, a
warning diagnostic is printed informing such.
Closes#159
[binaryen]: https://github.com/webassembly/binaryen
[fitzgen]: https://github.com/rustwasm/wasm-pack/issues/159#issuecomment-454888890
* Add deep dive documentation for `tests/web.rs` of the `wasm-pack-template`
* Add docs for testing a project in addition to building
* Touch up other documentation int he deep dive and setup
* Fix a few dead links and moved pages and such
A few assorted improvements to the prerequisites documentation:
* Rust nightly/beta requirements are removed
* Wording indicating that `wasm-pack` requires `npm` has been clarified
* The dedicated Rust page was removed as it's largely just "install
Rust" nowadays
* The heading of the NPM page in the sidebar now includes `(optional)`
to clarify that it's not required.
This commit adds support for the new `--web` flag in `wasm-bindgen`
under the flag name `--target web`. To ensure that it was plubmed around
the stringly-typed `target` type was switched to an `enum Target` to
ensure that all cases it's looked at are handled appropriately for the
new `web` target.
This commit adds a header dialog to the gh-pages mdbook documentation of
this repository to indicate that it represents unpublished documentation
that may not reflect the currently published version of `wasm-pack`. The
header redirects users to https://rustwasm.github.io/docs/wasm-pack/
which has the documentation for the latest published version of
`wasm-pack`.