mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-07 21:28:21 +00:00
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.
25 lines
635 B
Rust
25 lines
635 B
Rust
#[cfg(all(feature = "sys", feature = "js"))]
|
|
compile_error!(
|
|
"Cannot have both `sys` and `js` features enabled at the same time. Please, pick one."
|
|
);
|
|
|
|
#[cfg(all(feature = "sys", target_arch = "wasm32"))]
|
|
compile_error!("The `sys` feature must be enabled only for non-`wasm32` target.");
|
|
|
|
#[cfg(all(feature = "js", not(target_arch = "wasm32")))]
|
|
compile_error!(
|
|
"The `js` feature must be enabled only for the `wasm32` target (either `wasm32-unknown-unknown` or `wasm32-wasi`)."
|
|
);
|
|
|
|
#[cfg(feature = "sys")]
|
|
mod sys;
|
|
|
|
#[cfg(feature = "sys")]
|
|
pub use sys::*;
|
|
|
|
#[cfg(feature = "js")]
|
|
mod js;
|
|
|
|
#[cfg(feature = "js")]
|
|
pub use js::*;
|