-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(api) Merge js-api
into api
#2489
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This patch takes the entire `wasmer-js` crate and merges it into the `wasmer` crate. Inside the `lib/api/src/` directory, there are 2 new directories: 1. a new `sys` directory, which contains the usual `wasmer` crate implementation, 2. a new directory `js`, which contains the implementation of `wasmer-js`. The `Cargo.toml` file is still compatible. The `default` feature fallbacks to `sys-default`, which enables the `sys` feature. All features related to compilers or engines or anything else prior this patch, activates the `sys` feature. Parallel to that, there is a `js-default` and `js` features. The `Cargo.toml` file is extensively documented to explain what are dependencies, dev-dependencies, features and other sections related to `sys` or to `js`. There is a bug with `wasm_bindgen_test` where it doesn't compile or look for tests in `tests/*/<test>.rs`. The hack is to name files `tests/js_<test>.rs`. Ugly, but it works.
Hywan
added
🎉 enhancement
New feature!
🧪 tests
I love tests
📚 documentation
Do you like to read?
📦 lib-api
About wasmer
labels
Jul 23, 2021
bors try |
tryBuild failed: |
bors try |
tryBuild failed: |
bors try |
syrusakbary
approved these changes
Jul 23, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
📚 documentation
Do you like to read?
🎉 enhancement
New feature!
📦 lib-api
About wasmer
🧪 tests
I love tests
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This patch takes the entire
wasmer-js
crate and merges it into thewasmer
crate.Inside the
lib/api/src/
directory, there are 2 new directories:sys
directory, which contains the usualwasmer
crateimplementation,
js
, which contains the implementation ofwasmer-js
.The
Cargo.toml
file is still compatible. Thedefault
featurefallbacks to
sys-default
, which enables thesys
feature. Allfeatures related to compilers or engines or anything else prior this
patch, activates the
sys
feature.Parallel to that, there is a
js-default
andjs
features.The
Cargo.toml
file is extensively documented to explain what aredependencies, dev-dependencies, features and other sections related to
sys
or tojs
.There is a bug with
wasm_bindgen_test
where it doesn't compile orlook for tests in
tests/*/<test>.rs
. The hack is to name filestests/js_<test>.rs
. Ugly, but it works.How to review?
I think browsing https://github.com/wasmerio/wasmer/tree/js-api-into-api/lib/api/src can provide a nice overview.
Then the biggest contribution of this patch is the new
Cargo.toml
, https://github.com/wasmerio/wasmer/blob/js-api-into-api/lib/api/Cargo.toml. The trick iswasmer/lib/api/Cargo.toml
Lines 43 to 47 in 9a5a10f
to avoid conflicts with
wasm-bindgen
. Dependencies are grouped in 3 categories: Shared, ones forsys
, ones forjs
.The second biggest contribution is the
lib.rs
, https://github.com/wasmerio/wasmer/blob/js-api-into-api/lib/api/src/lib.rs. The trick to supportwasm-bindgen
correctly, is to declare the crate-type programmatically inlib.rs
rather than inCargo.toml
as such:wasmer/lib/api/src/lib.rs
Lines 29 to 30 in 9a5a10f
Then, there is compiler errors that are raised if some features aren't correctly used, like:
wasmer/lib/api/src/lib.rs
Lines 458 to 461 in 9a5a10f
The rest is only moving files.
Next steps
As soon as this PR is merged, and probably as soon as #2460 is merged, then we could imagine refactoring
lib/api/
to remove duplicated code. Now it is possible :-).