diff --git a/.github/workflows/test-release.yaml b/.github/workflows/test-release.yaml index 83f280ab..0b361c92 100644 --- a/.github/workflows/test-release.yaml +++ b/.github/workflows/test-release.yaml @@ -565,10 +565,14 @@ jobs: fail-fast: false matrix: settings: - - features: 'napi1,napi2,napi3,napi4,napi5,napi6,napi7,napi8,experimental,async,chrono_date,latin1,full' + - features: 'napi1,napi2,napi3,napi4,napi5,napi6,napi7,napi8,napi9,experimental,async,chrono_date,latin1,full' package: 'napi' - features: 'compat-mode,strict,type-def,noop,full,default' package: 'napi-derive' + - features: 'noop' + package: 'napi-examples' + - features: 'snmalloc' + package: 'napi-examples' name: stable - ubuntu-latest runs-on: ubuntu-latest @@ -581,7 +585,7 @@ jobs: toolchain: stable - name: Check build - run: cargo check -p ${{ matrix.settings.package }} -F ${{ matrix.settings.features }}\ + run: cargo check -p ${{ matrix.settings.package }} -F ${{ matrix.settings.features }} test-freebsd: runs-on: ubuntu-latest diff --git a/crates/napi/src/bindgen_runtime/module_register.rs b/crates/napi/src/bindgen_runtime/module_register.rs index c1b89557..9373590b 100644 --- a/crates/napi/src/bindgen_runtime/module_register.rs +++ b/crates/napi/src/bindgen_runtime/module_register.rs @@ -56,6 +56,7 @@ impl Default for PersistedPerInstanceHashMap { type ModuleRegisterCallback = RwLock, (&'static str, ExportRegisterCallback))>>; +#[cfg(not(feature = "noop"))] type ModuleClassProperty = PersistedPerInstanceHashMap, (&'static str, Vec)>>; @@ -112,6 +113,10 @@ pub fn register_module_exports(callback: ModuleExportsCallback) { .push(callback); } +#[cfg(feature = "noop")] +#[doc(hidden)] +pub fn register_module_exports(_: ModuleExportsCallback) {} + #[cfg(not(feature = "noop"))] #[doc(hidden)] pub fn register_module_export( @@ -125,6 +130,15 @@ pub fn register_module_export( .push((js_mod, (name, cb))); } +#[cfg(feature = "noop")] +#[doc(hidden)] +pub fn register_module_export( + _js_mod: Option<&'static str>, + _name: &'static str, + _cb: ExportRegisterCallback, +) { +} + #[doc(hidden)] pub fn register_js_function( name: &'static str, @@ -162,6 +176,17 @@ pub fn register_class( }); } +#[cfg(feature = "noop")] +#[doc(hidden)] +#[allow(unused_variables)] +pub fn register_class( + rust_type_id: TypeId, + js_mod: Option<&'static str>, + js_name: &'static str, + props: Vec, +) { +} + /// Get `C Callback` from defined Rust `fn` /// ```rust /// #[napi] diff --git a/examples/napi/Cargo.toml b/examples/napi/Cargo.toml index 664331fe..561895b2 100644 --- a/examples/napi/Cargo.toml +++ b/examples/napi/Cargo.toml @@ -12,6 +12,7 @@ crate-type = ["cdylib"] snmalloc = ["snmalloc-rs"] dyn-symbols = ["napi/dyn-symbols"] error_try_builds = [] +noop = ["napi/noop"] [dependencies] chrono = "0.4"