This commit removes the internal `Error` type in favor of exclusively
using the `failure::Error` type, simplifying error construction in a
number of locations and reducing the number of error types in play.
This commit fixes an issue where if a library is renamed via the `name`
key in the `[lib]` section of the manifest then `wasm-pack` would try to
generate bindings for an noexistent wasm-file, generating an error.
The fix was to internally use `cargo_metadata` more aggressively and
move around where this data is generated. This ended up refactoring a
few locations, but this should also bring improved error messages for
`cargo metadata` as well as caching the resulting data more aggressively
to avoid recalculating it too much.
Closes#339
This commit switches wasm-pack to using a global cache for all download
binaries, living typically in a user's home directory. The intention
here is to aovid creating a `bin` folder in all wasm-pack projects and
additionally share downloads between projects to ensure that you're
downloading a minimal number of binaries from the network.
Along the way the downloading code was restructured to support a global
cache, but everything should largely be as it was before!
Closes#292
This lets us leverage `cargo` for semver finding and then ensure that we get the
exact same version of the CLI that cargo selected. It also lets us support fuzzy
dependencies like "0.2" instead of exact dependencies like "0.2.21" again.
The standard library version of an `RwLock` may get poisoned if a thread
panics that holds a write lock. The `RwLock` from parking_lot [1] does
not get poisoned it instead released the lock on a panic. This allows us
to simplify the `ProgressOutput` API since it no longer returns any
errors. No more panics can occur on `ProgressOutput::drop()`. The
`Error` enum can thus be simplified as well because there is no need to
convert `PoisonErrors` anymore.
[1] https://github.com/Amanieu/parking_lot