Fixes#1215 by honoring how package.readme is authored in Cargo.toml, if authored. This could be a path or a boolean to disable searching for the path.
Also fixes the existing `it_copies_a_readme_provided_path` test which was an exact copy - just with fewer empty lines - of `it_copies_a_readme_default_path` and wasn't honoring any authored path since there was no way to get the authored path.
Fixes#1215 by honoring how package.readme is authored in Cargo.toml, if authored. This could be a path or a boolean to disable searching for the path.
Also fixes the existing `it_copies_a_readme_provided_path` test which was an exact copy - just with fewer empty lines - of `it_copies_a_readme_default_path` and wasn't honoring any authored path since there was no way to get the authored path.
This is a less extreme version of #1208, which only marks snippets and the main file on the bundler target as having side effects instead of all files.
This means that the shim file which contains the vast majority of the JS code is still properly marked as having no side effects, allowing bundlers to get rid of things like unused `new TextEncoder` calls which could theoretically have side effects but don't.
Fixes#972.
`wasm-bindgen` regressed and only generates move assertions for free functions,
not methods. While `wasm-bindgen` is fixing that regression, we are changing
this test fixture to be of the shape that will still generate move assertions.
Fixes#677.
* Renamed set_crate_path to get_crate_path
* If the path isn't specified in the call then use the current_dir and walk up the path try to find the manifest file.
* Specify the cwd for the build test so it doesn't walk up the path. The test needs to specify the path to build, otherwise because fixtures are run in a subdirectory of the source tree it will find the Cargo.toml from the wasm-pack source repository.
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