Alex Crichton
35fe250d09
Fix wasm-bindgen if lib is renamed via `lib.name`
...
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
7 years ago
Nick Fitzgerald
8abedfebbe
Run `cargo fmt`
7 years ago
Nick Fitzgerald
e7145e585f
Add a test for building a wasm crate in a workspace
...
Fixes #252
7 years ago
Nick Fitzgerald
098eb33cea
Run cargo fmt
7 years ago
Nick Fitzgerald
6d3e9dfebb
Refactor: make `check_crate_config` a method of `CargoManifest`
7 years ago
Nick Fitzgerald
25490301e0
Refactor: make `get_crate_name` a method of `CargoManifest`
7 years ago
Nick Fitzgerald
0e09b3fd3c
Refactor: make `write_package_json` a method on `CargoManifest`
7 years ago
Nick Fitzgerald
511e6c29a0
Refactor: replace `manifest::read_cargo_toml` with a constructor
7 years ago
Nick Fitzgerald
4e6abcfd1d
Only read the `Cargo.toml` manifest once
...
And then keep reusing what we read, instead of re-reading it again.
Fixes #25
7 years ago
Alex Crichton
f986edf4c7
Move test synchronization to tests, not in `wasm-pack`
...
In `wasm-pack` it can't do cross-process synchronization, and in tests
there's now multiple processes which need to be synchronized.
7 years ago
Alex Crichton
110d930351
Assert not only an error happens but the right error happens
...
Add message assertions to the various assertions in `test.rs`
7 years ago
Alex Crichton
c664cfddd1
Use a global cache for all downloaded binaries
...
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
7 years ago
Jesper Håkansson
65d060cfc4
chore: Run latest rustfmt
7 years ago
Nick Fitzgerald
182c3931c3
Run cargo fmt
7 years ago
huangjj27
ee9116d2e0
bugfix(bindgen-target-dir): use PathBuf to join
...
the old code are hard coded path with "/", which may cause error
on windows, thus changing to use PathBuf.join.
fixing #414
7 years ago
Jesper Håkansson
a4b29a9293
refactor: Move binary installation to it's own crate
7 years ago
Mason Stallmo
6426e23cbe
Fix typo in test function name for copying the README
7 years ago
huangjj27
ad62870f40
useing local wasm-bindgen
7 years ago
huangjj27
40a5fa2b74
test(command/build): add a test for build command
7 years ago
Nick Fitzgerald
2fa961d97d
Use `child::run` for spawning child processes everywhere
7 years ago
Nick Fitzgerald
4fd08dcbd2
test: Add a utility for creating null loggers for tests
7 years ago
Alex Crichton
17b385060f
Remove lingering forced nightly usages
...
These look to have been removed elsewhere, so seem to be left in by
mistake!
7 years ago
Nick Fitzgerald
e1c8ca825d
cargo fmt
7 years ago
Nick Fitzgerald
15defe9038
test: fix crate dependency suggestion
...
Fixes #377
7 years ago
Ashley Williams
66ffe1df96
fix(style): appease cargo fmt
7 years ago
Ashley Williams
d3f8264ef7
feat(buildmode): allow --mode force to skip rustc check
7 years ago
Ashley Williams
3856db20b9
fix(style): appease cargo fmt
7 years ago
Alex Crichton
9b24dcb259
Execute `cargo metadata` at most once
...
This can be somewhat expensive, so make sure we don't have to chew
through too much!
7 years ago
Alex Crichton
3d1f528fc9
Make tests more future-proof with wasm-bindgen
...
This way when future wasm-bindgen version are published the tests will
continue working!
7 years ago
data-pup
dd87211323
feat(lockfiles): Use `Cargo.lock` to identify wasm-bindgen versions
...
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.
7 years ago
Ashley Williams
286bed9c27
test(no-modules): no-modules works
7 years ago
Nick Fitzgerald
fa61f90909
tests: Make tests run faster by using Fixture builders
...
Instead of copying directories, just build the fixtures directly in the
temporary directory.
7 years ago
Ashley Williams
069f7ede2e
fix(manifest:esm): snakecase to remove warning, test for sideeffects field
7 years ago
Ashley Williams
354f038a1a
fix(style): remove printlns and appease cargo fmt
7 years ago
Ashley Williams
fc7c2d1593
test(manifest): update tests to reflect new pkgjsons
7 years ago
Nick Fitzgerald
577d1b33e6
feature(test): Add a `wasm-pack test` subcommand
...
This uses `wasm-bindgen-test` under the hood.
Fixes #248
7 years ago
Alex Crichton
0381aa627a
Add listing for precompiled Windows binaries
...
They're fixed on wasm-bindgen's CI, so let's download/install them!
7 years ago
Mackenzie Clark
40b0291715
add out dir cli parameter
7 years ago
Nick Fitzgerald
7ab7a3f2cb
feature: Use pre-built `wasm-bindgen` CLIs from Github releases
...
Implements downloading tarballs from `wasm-bindgen`'s GitHub releases page and
using them if the current target has pre-built binaries.
7 years ago
Nick Fitzgerald
16acfd38c3
tests: Only invoke `copy_dir` once at a time
...
I don't understand why at all, but doing many `copy_dir`s at once makes my whole
machine freeze up.
7 years ago
Nick Fitzgerald
b480674df4
fix: Handle both underscores and hypthens as separators in "wasm-bindgen" dependencies
7 years ago
Nick Fitzgerald
7fff2b6a15
Better error message when running wasm-pack in a non-crate directory
7 years ago
Nick Fitzgerald
e2e3e49f50
test: Add a failing test case for #242
7 years ago
csmoe
15fdec2c0b
Split fixture, rename readme to file
7 years ago
csmoe
bd3b5177a9
Split utils into submods
7 years ago
csmoe
022b787a2f
cmd(init/build): deprecate init
7 years ago
Nick Fitzgerald
61f1abbc58
tests: add extended logging and assertions to readme tests
7 years ago
Nick Fitzgerald
50eaa8c04d
tests: Use the `tempfile` crate instead of the deprecated `tempdir`
...
The `tempdir` crate is deprecated and its functionality has been folded into the
`tempfile` crate.
7 years ago
Nick Fitzgerald
ccd8edbae1
tests: Copy fixtures into unique temporary directories
...
If a test is going to do a potentially destructive operation, instead of
mutating shared fixtures, it should copy the fixture to its own unique directory
and then mutate that copy (doesn't this sound like Rust's borrowing and
ownership rules?! ^.^)
7 years ago