From 9bc0910a6bc7c80fdded1b727b32dde90e9142ca Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Fri, 23 Jul 2021 12:30:08 +0200 Subject: [PATCH] feat(api) Remove all references to `wasmer-js`. --- Makefile | 4 ++-- lib/api/src/js/cell.rs | 6 +++--- lib/api/src/js/env.rs | 4 ++-- lib/api/src/js/exports.rs | 4 ++-- lib/api/src/js/externals/function.rs | 28 ++++++++++++++-------------- lib/api/src/js/externals/global.rs | 18 +++++++++--------- lib/api/src/js/externals/memory.rs | 16 ++++++++-------- lib/api/src/js/import_object.rs | 10 +++++----- lib/api/src/js/instance.rs | 2 +- lib/api/src/js/module.rs | 12 ++++++------ lib/api/src/js/ptr.rs | 10 +++++----- 11 files changed, 57 insertions(+), 57 deletions(-) diff --git a/Makefile b/Makefile index 3cd96fb15a6..f0d1a1fb813 100644 --- a/Makefile +++ b/Makefile @@ -148,7 +148,7 @@ ifneq ($(ENABLE_LLVM), 0) endif endif -exclude_tests := --exclude wasmer-c-api --exclude wasmer-cli --exclude wasmer-js +exclude_tests := --exclude wasmer-c-api --exclude wasmer-cli # Is failing to compile in Linux for some reason exclude_tests += --exclude wasmer-wasi-experimental-io-devices # We run integration tests separately (it requires building the c-api) @@ -501,7 +501,7 @@ test-packages: cargo test --manifest-path lib/cli/Cargo.toml $(compiler_features) --release test-js: - cd lib/js-api && wasm-pack test --node -- --features=wat + cd lib/api && wasm-pack test --node -- --no-default-features --features js-default,wat ##### diff --git a/lib/api/src/js/cell.rs b/lib/api/src/js/cell.rs index fdcd62709c1..b8c41507928 100644 --- a/lib/api/src/js/cell.rs +++ b/lib/api/src/js/cell.rs @@ -75,7 +75,7 @@ impl<'a, T> WasmCell<'a, T> { /// /// ``` /// use std::cell::Cell; - /// use wasmer_js::WasmCell; + /// use wasmer::WasmCell; /// /// let cell = Cell::new(5); /// let wasm_cell = WasmCell::new(&cell); @@ -96,7 +96,7 @@ impl<'a, T: Copy> WasmCell<'a, T> { /// /// ``` /// use std::cell::Cell; - /// use wasmer_js::WasmCell; + /// use wasmer::WasmCell; /// /// let cell = Cell::new(5); /// let wasm_cell = WasmCell::new(&cell); @@ -123,7 +123,7 @@ impl WasmCell<'_, T> { /// /// ``` /// use std::cell::Cell; - /// use wasmer_js::WasmCell; + /// use wasmer::WasmCell; /// /// let cell = Cell::new(5); /// let wasm_cell = WasmCell::new(&cell); diff --git a/lib/api/src/js/env.rs b/lib/api/src/js/env.rs index 6f624f317ec..30db0fb3c83 100644 --- a/lib/api/src/js/env.rs +++ b/lib/api/src/js/env.rs @@ -28,7 +28,7 @@ impl From for HostEnvInitError { /// This trait can be derived like so: /// /// ``` -/// use wasmer_js::{WasmerEnv, LazyInit, Memory, NativeFunc}; +/// use wasmer::{WasmerEnv, LazyInit, Memory, NativeFunc}; /// /// #[derive(WasmerEnv, Clone)] /// pub struct MyEnvWithNoInstanceData { @@ -63,7 +63,7 @@ impl From for HostEnvInitError { /// /// This trait may also be implemented manually: /// ``` -/// # use wasmer_js::{WasmerEnv, LazyInit, Memory, Instance, HostEnvInitError}; +/// # use wasmer::{WasmerEnv, LazyInit, Memory, Instance, HostEnvInitError}; /// #[derive(Clone)] /// pub struct MyEnv { /// memory: LazyInit, diff --git a/lib/api/src/js/exports.rs b/lib/api/src/js/exports.rs index 906a8043271..98cca5f9d62 100644 --- a/lib/api/src/js/exports.rs +++ b/lib/api/src/js/exports.rs @@ -19,7 +19,7 @@ use thiserror::Error; /// ## Incompatible export type /// /// ```should_panic -/// # use wasmer_js::{imports, wat2wasm, Function, Instance, Module, Store, Type, Value, ExportError}; +/// # use wasmer::{imports, wat2wasm, Function, Instance, Module, Store, Type, Value, ExportError}; /// # let store = Store::default(); /// # let wasm_bytes = wat2wasm(r#" /// # (module @@ -36,7 +36,7 @@ use thiserror::Error; /// ## Missing export /// /// ```should_panic -/// # use wasmer_js::{imports, wat2wasm, Function, Instance, Module, Store, Type, Value, ExportError}; +/// # use wasmer::{imports, wat2wasm, Function, Instance, Module, Store, Type, Value, ExportError}; /// # let store = Store::default(); /// # let wasm_bytes = wat2wasm("(module)".as_bytes()).unwrap(); /// # let module = Module::new(&store, wasm_bytes).unwrap(); diff --git a/lib/api/src/js/externals/function.rs b/lib/api/src/js/externals/function.rs index fee12ca6434..d9ccea88be4 100644 --- a/lib/api/src/js/externals/function.rs +++ b/lib/api/src/js/externals/function.rs @@ -71,7 +71,7 @@ impl Function { /// # Examples /// /// ``` - /// # use wasmer_js::{Function, FunctionType, Type, Store, Value}; + /// # use wasmer::{Function, FunctionType, Type, Store, Value}; /// # let store = Store::default(); /// # /// let signature = FunctionType::new(vec![Type::I32, Type::I32], vec![Type::I32]); @@ -85,7 +85,7 @@ impl Function { /// With constant signature: /// /// ``` - /// # use wasmer_js::{Function, FunctionType, Type, Store, Value}; + /// # use wasmer::{Function, FunctionType, Type, Store, Value}; /// # let store = Store::default(); /// # /// const I32_I32_TO_I32: ([Type; 2], [Type; 1]) = ([Type::I32, Type::I32], [Type::I32]); @@ -161,7 +161,7 @@ impl Function { /// # Examples /// /// ``` - /// # use wasmer_js::{Function, FunctionType, Type, Store, Value, WasmerEnv}; + /// # use wasmer::{Function, FunctionType, Type, Store, Value, WasmerEnv}; /// # let store = Store::default(); /// # /// #[derive(WasmerEnv, Clone)] @@ -181,7 +181,7 @@ impl Function { /// With constant signature: /// /// ``` - /// # use wasmer_js::{Function, FunctionType, Type, Store, Value, WasmerEnv}; + /// # use wasmer::{Function, FunctionType, Type, Store, Value, WasmerEnv}; /// # let store = Store::default(); /// const I32_I32_TO_I32: ([Type; 2], [Type; 1]) = ([Type::I32, Type::I32], [Type::I32]); /// @@ -274,7 +274,7 @@ impl Function { /// # Example /// /// ``` - /// # use wasmer_js::{Store, Function}; + /// # use wasmer::{Store, Function}; /// # let store = Store::default(); /// # /// fn sum(a: i32, b: i32) -> i32 { @@ -315,7 +315,7 @@ impl Function { /// # Example /// /// ``` - /// # use wasmer_js::{Store, Function, WasmerEnv}; + /// # use wasmer::{Store, Function, WasmerEnv}; /// # let store = Store::default(); /// # /// #[derive(WasmerEnv, Clone)] @@ -364,7 +364,7 @@ impl Function { /// # Example /// /// ``` - /// # use wasmer_js::{Function, Store, Type}; + /// # use wasmer::{Function, Store, Type}; /// # let store = Store::default(); /// # /// fn sum(a: i32, b: i32) -> i32 { @@ -390,7 +390,7 @@ impl Function { /// # Example /// /// ``` - /// # use wasmer_js::{Function, Store, Type}; + /// # use wasmer::{Function, Store, Type}; /// # let store = Store::default(); /// # /// fn sum(a: i32, b: i32) -> i32 { @@ -410,7 +410,7 @@ impl Function { /// # Example /// /// ``` - /// # use wasmer_js::{Function, Store, Type}; + /// # use wasmer::{Function, Store, Type}; /// # let store = Store::default(); /// # /// fn sum(a: i32, b: i32) -> i32 { @@ -436,7 +436,7 @@ impl Function { /// # Examples /// /// ``` - /// # use wasmer_js::{imports, wat2wasm, Function, Instance, Module, Store, Type, Value}; + /// # use wasmer::{imports, wat2wasm, Function, Instance, Module, Store, Type, Value}; /// # let store = Store::default(); /// # let wasm_bytes = wat2wasm(r#" /// # (module @@ -495,7 +495,7 @@ impl Function { /// # Examples /// /// ``` - /// # use wasmer_js::{imports, wat2wasm, Function, Instance, Module, Store, Type, Value}; + /// # use wasmer::{imports, wat2wasm, Function, Instance, Module, Store, Type, Value}; /// # let store = Store::default(); /// # let wasm_bytes = wat2wasm(r#" /// # (module @@ -521,7 +521,7 @@ impl Function { /// an error will be raised: /// /// ```should_panic - /// # use wasmer_js::{imports, wat2wasm, Function, Instance, Module, Store, Type, Value}; + /// # use wasmer::{imports, wat2wasm, Function, Instance, Module, Store, Type, Value}; /// # let store = Store::default(); /// # let wasm_bytes = wat2wasm(r#" /// # (module @@ -545,7 +545,7 @@ impl Function { /// an error will be raised: /// /// ```should_panic - /// # use wasmer_js::{imports, wat2wasm, Function, Instance, Module, Store, Type, Value}; + /// # use wasmer::{imports, wat2wasm, Function, Instance, Module, Store, Type, Value}; /// # let store = Store::default(); /// # let wasm_bytes = wat2wasm(r#" /// # (module @@ -654,7 +654,7 @@ mod inner { #[cfg(feature = "experimental-reference-types-extern-ref")] pub use wasmer_types::{ExternRef, VMExternRef}; use wasmer_types::{FunctionType, NativeWasmType, Type}; - // use wasmer_js::{raise_user_trap, resume_panic}; + // use wasmer::{raise_user_trap, resume_panic}; /// A trait to convert a Rust value to a `WasmNativeType` value, /// or to convert `WasmNativeType` value to a Rust value. diff --git a/lib/api/src/js/externals/global.rs b/lib/api/src/js/externals/global.rs index 0fc7e4fe38f..431547129a2 100644 --- a/lib/api/src/js/externals/global.rs +++ b/lib/api/src/js/externals/global.rs @@ -28,7 +28,7 @@ impl Global { /// # Example /// /// ``` - /// # use wasmer_js::{Global, Mutability, Store, Value}; + /// # use wasmer::{Global, Mutability, Store, Value}; /// # let store = Store::default(); /// # /// let g = Global::new(&store, Value::I32(1)); @@ -45,7 +45,7 @@ impl Global { /// # Example /// /// ``` - /// # use wasmer_js::{Global, Mutability, Store, Value}; + /// # use wasmer::{Global, Mutability, Store, Value}; /// # let store = Store::default(); /// # /// let g = Global::new_mut(&store, Value::I32(1)); @@ -94,7 +94,7 @@ impl Global { /// # Example /// /// ``` - /// # use wasmer_js::{Global, Mutability, Store, Type, Value, GlobalType}; + /// # use wasmer::{Global, Mutability, Store, Type, Value, GlobalType}; /// # let store = Store::default(); /// # /// let c = Global::new(&store, Value::I32(1)); @@ -112,7 +112,7 @@ impl Global { /// # Example /// /// ``` - /// # use wasmer_js::{Global, Store, Value}; + /// # use wasmer::{Global, Store, Value}; /// # let store = Store::default(); /// # /// let g = Global::new(&store, Value::I32(1)); @@ -128,7 +128,7 @@ impl Global { /// # Example /// /// ``` - /// # use wasmer_js::{Global, Store, Value}; + /// # use wasmer::{Global, Store, Value}; /// # let store = Store::default(); /// # /// let g = Global::new(&store, Value::I32(1)); @@ -150,7 +150,7 @@ impl Global { /// # Example /// /// ``` - /// # use wasmer_js::{Global, Store, Value}; + /// # use wasmer::{Global, Store, Value}; /// # let store = Store::default(); /// # /// let g = Global::new_mut(&store, Value::I32(1)); @@ -167,7 +167,7 @@ impl Global { /// Trying to mutate a immutable global will raise an error: /// /// ```should_panic - /// # use wasmer_js::{Global, Store, Value}; + /// # use wasmer::{Global, Store, Value}; /// # let store = Store::default(); /// # /// let g = Global::new(&store, Value::I32(1)); @@ -178,7 +178,7 @@ impl Global { /// Trying to set a value of a incompatible type will raise an error: /// /// ```should_panic - /// # use wasmer_js::{Global, Store, Value}; + /// # use wasmer::{Global, Store, Value}; /// # let store = Store::default(); /// # /// let g = Global::new(&store, Value::I32(1)); @@ -216,7 +216,7 @@ impl Global { /// # Example /// /// ``` - /// # use wasmer_js::{Global, Store, Value}; + /// # use wasmer::{Global, Store, Value}; /// # let store = Store::default(); /// # /// let g = Global::new(&store, Value::I32(1)); diff --git a/lib/api/src/js/externals/memory.rs b/lib/api/src/js/externals/memory.rs index 72776d30f90..4dc868d1fbf 100644 --- a/lib/api/src/js/externals/memory.rs +++ b/lib/api/src/js/externals/memory.rs @@ -88,7 +88,7 @@ impl Memory { /// # Example /// /// ``` - /// # use wasmer_js::{Memory, MemoryType, Pages, Store, Type, Value}; + /// # use wasmer::{Memory, MemoryType, Pages, Store, Type, Value}; /// # let store = Store::default(); /// # /// let m = Memory::new(&store, MemoryType::new(1, None, false)).unwrap(); @@ -116,7 +116,7 @@ impl Memory { /// # Example /// /// ``` - /// # use wasmer_js::{Memory, MemoryType, Pages, Store, Type, Value}; + /// # use wasmer::{Memory, MemoryType, Pages, Store, Type, Value}; /// # let store = Store::default(); /// # /// let mt = MemoryType::new(1, None, false); @@ -135,7 +135,7 @@ impl Memory { /// # Example /// /// ``` - /// # use wasmer_js::{Memory, MemoryType, Pages, Store, Type, Value}; + /// # use wasmer::{Memory, MemoryType, Pages, Store, Type, Value}; /// # let store = Store::default(); /// # /// let m = Memory::new(&store, MemoryType::new(1, None, false)).unwrap(); @@ -189,7 +189,7 @@ impl Memory { /// # Example /// /// ``` - /// # use wasmer_js::{Memory, MemoryType, Pages, Store, Type, Value}; + /// # use wasmer::{Memory, MemoryType, Pages, Store, Type, Value}; /// # let store = Store::default(); /// # /// let m = Memory::new(&store, MemoryType::new(1, None, false)).unwrap(); @@ -210,7 +210,7 @@ impl Memory { /// # Example /// /// ``` - /// # use wasmer_js::{Memory, MemoryType, Pages, Store, Type, Value, WASM_MAX_PAGES}; + /// # use wasmer::{Memory, MemoryType, Pages, Store, Type, Value, WASM_MAX_PAGES}; /// # let store = Store::default(); /// # /// let m = Memory::new(&store, MemoryType::new(1, Some(3), false)).unwrap(); @@ -226,7 +226,7 @@ impl Memory { /// of pages. /// /// ```should_panic - /// # use wasmer_js::{Memory, MemoryType, Pages, Store, Type, Value, WASM_MAX_PAGES}; + /// # use wasmer::{Memory, MemoryType, Pages, Store, Type, Value, WASM_MAX_PAGES}; /// # let store = Store::default(); /// # /// let m = Memory::new(&store, MemoryType::new(1, Some(1), false)).unwrap(); @@ -268,7 +268,7 @@ impl Memory { /// # Usage: /// /// ``` - /// # use wasmer_js::{Memory, MemoryView}; + /// # use wasmer::{Memory, MemoryView}; /// # use std::{cell::Cell, sync::atomic::Ordering}; /// # fn view_memory(memory: Memory) { /// // Without synchronization. @@ -305,7 +305,7 @@ impl Memory { /// # Example /// /// ``` - /// # use wasmer_js::{Memory, MemoryType, Store, Value}; + /// # use wasmer::{Memory, MemoryType, Store, Value}; /// # let store = Store::default(); /// # /// let m = Memory::new(&store, MemoryType::new(1, None, false)).unwrap(); diff --git a/lib/api/src/js/import_object.rs b/lib/api/src/js/import_object.rs index 0fd8eef2dff..63bb41d50f6 100644 --- a/lib/api/src/js/import_object.rs +++ b/lib/api/src/js/import_object.rs @@ -28,7 +28,7 @@ pub trait LikeNamespace { /// /// # Usage: /// ```ignore -/// use wasmer_js::{Exports, ImportObject, Function}; +/// use wasmer::{Exports, ImportObject, Function}; /// /// let mut import_object = ImportObject::new(); /// let mut env = Exports::new(); @@ -55,7 +55,7 @@ impl ImportObject { /// /// # Usage /// ```ignore - /// # use wasmer_js::{ImportObject, Instance, Namespace}; + /// # use wasmer::{ImportObject, Instance, Namespace}; /// let mut import_object = ImportObject::new(); /// import_object.get_export("module", "name"); /// ``` @@ -78,7 +78,7 @@ impl ImportObject { /// /// # Usage: /// ```ignore - /// # use wasmer_js::{ImportObject, Instance, Namespace}; + /// # use wasmer::{ImportObject, Instance, Namespace}; /// let mut import_object = ImportObject::new(); /// /// import_object.register("namespace0", instance); @@ -188,9 +188,9 @@ impl fmt::Debug for ImportObject { /// # Usage /// /// ``` -/// # use wasmer_js::{Function, Store}; +/// # use wasmer::{Function, Store}; /// # let store = Store::default(); -/// use wasmer_js::imports; +/// use wasmer::imports; /// /// let import_object = imports! { /// "env" => { diff --git a/lib/api/src/js/instance.rs b/lib/api/src/js/instance.rs index 3a4a947bc85..c7e155adc33 100644 --- a/lib/api/src/js/instance.rs +++ b/lib/api/src/js/instance.rs @@ -71,7 +71,7 @@ impl Instance { /// [`ImportObject`]: crate::js::ImportObject /// /// ``` - /// # use wasmer_js::{imports, Store, Module, Global, Value, Instance}; + /// # use wasmer::{imports, Store, Module, Global, Value, Instance}; /// # fn main() -> anyhow::Result<()> { /// let store = Store::default(); /// let module = Module::new(&store, "(module)")?; diff --git a/lib/api/src/js/module.rs b/lib/api/src/js/module.rs index 3cee90429b6..fb02c27b9a2 100644 --- a/lib/api/src/js/module.rs +++ b/lib/api/src/js/module.rs @@ -89,7 +89,7 @@ impl Module { /// Reading from a WAT file. /// /// ``` - /// use wasmer_js::*; + /// use wasmer::*; /// # fn main() -> anyhow::Result<()> { /// # let store = Store::default(); /// let wat = "(module)"; @@ -101,7 +101,7 @@ impl Module { /// Reading from bytes: /// /// ``` - /// use wasmer_js::*; + /// use wasmer::*; /// # fn main() -> anyhow::Result<()> { /// # let store = Store::default(); /// // The following is the same as: @@ -261,7 +261,7 @@ impl Module { /// # Example /// /// ``` - /// # use wasmer_js::*; + /// # use wasmer::*; /// # fn main() -> anyhow::Result<()> { /// # let store = Store::default(); /// let wat = "(module $moduleName)"; @@ -285,7 +285,7 @@ impl Module { /// # Example /// /// ``` - /// # use wasmer_js::*; + /// # use wasmer::*; /// # fn main() -> anyhow::Result<()> { /// # let store = Store::default(); /// let wat = "(module)"; @@ -320,7 +320,7 @@ impl Module { /// # Example /// /// ``` - /// # use wasmer_js::*; + /// # use wasmer::*; /// # fn main() -> anyhow::Result<()> { /// # let store = Store::default(); /// let wat = r#"(module @@ -418,7 +418,7 @@ impl Module { /// # Example /// /// ``` - /// # use wasmer_js::*; + /// # use wasmer::*; /// # fn main() -> anyhow::Result<()> { /// # let store = Store::default(); /// let wat = r#"(module diff --git a/lib/api/src/js/ptr.rs b/lib/api/src/js/ptr.rs index 0d68f6e8b1a..e5c0c471b90 100644 --- a/lib/api/src/js/ptr.rs +++ b/lib/api/src/js/ptr.rs @@ -23,8 +23,8 @@ pub struct Item; /// /// This type can be used directly in the host function arguments: /// ``` -/// # use wasmer_js::Memory; -/// # use wasmer_js::WasmPtr; +/// # use wasmer::Memory; +/// # use wasmer::WasmPtr; /// pub fn host_import(memory: Memory, ptr: WasmPtr) { /// let derefed_ptr = ptr.deref(&memory).expect("pointer in bounds"); /// let inner_val: u32 = derefed_ptr.get(); @@ -37,9 +37,9 @@ pub struct Item; /// This type can also be used with primitive-filled structs, but be careful of /// guarantees required by `ValueType`. /// ``` -/// # use wasmer_js::Memory; -/// # use wasmer_js::WasmPtr; -/// # use wasmer_js::ValueType; +/// # use wasmer::Memory; +/// # use wasmer::WasmPtr; +/// # use wasmer::ValueType; /// /// #[derive(Copy, Clone, Debug)] /// #[repr(C)]