diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 67897549..135f657d 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -6,11 +6,12 @@ license = "MIT" name = "napi-derive-backend" readme = "README.md" repository = "https://github.com/napi-rs/napi-rs" -version = "1.0.15" +version = "1.0.16" [features] strict = [] type-def = ["regex", "once_cell"] +noop = [] [dependencies] convert_case = "0.4" diff --git a/crates/backend/src/codegen/const.rs b/crates/backend/src/codegen/const.rs index 5fd14a00..9828608a 100644 --- a/crates/backend/src/codegen/const.rs +++ b/crates/backend/src/codegen/const.rs @@ -38,7 +38,7 @@ impl NapiConst { } #[allow(non_snake_case)] #[allow(clippy::all)] - #[cfg(not(test))] + #[cfg(all(not(test), not(feature = "noop")))] #[napi::bindgen_prelude::ctor] fn #register_name() { napi::bindgen_prelude::register_module_export(#js_mod_ident, #js_name_lit, #cb_name); diff --git a/crates/backend/src/codegen/enum.rs b/crates/backend/src/codegen/enum.rs index 11060823..7d16d945 100644 --- a/crates/backend/src/codegen/enum.rs +++ b/crates/backend/src/codegen/enum.rs @@ -147,7 +147,7 @@ impl NapiEnum { } #[allow(non_snake_case)] #[allow(clippy::all)] - #[cfg(not(test))] + #[cfg(all(not(test), not(feature = "noop")))] #[napi::bindgen_prelude::ctor] fn #register_name() { napi::bindgen_prelude::register_module_export(#js_mod_ident, #js_name_lit, #callback_name); diff --git a/crates/backend/src/codegen/fn.rs b/crates/backend/src/codegen/fn.rs index 7ca411fc..480a0b93 100644 --- a/crates/backend/src/codegen/fn.rs +++ b/crates/backend/src/codegen/fn.rs @@ -327,7 +327,7 @@ impl NapiFn { #[allow(clippy::all)] #[allow(non_snake_case)] - #[cfg(not(test))] + #[cfg(all(not(test), not(feature = "noop")))] #[napi::bindgen_prelude::ctor] fn #module_register_name() { napi::bindgen_prelude::register_module_export(#js_mod_ident, #js_name, #cb_name); diff --git a/crates/backend/src/codegen/struct.rs b/crates/backend/src/codegen/struct.rs index d9aa1c75..01f8ad88 100644 --- a/crates/backend/src/codegen/struct.rs +++ b/crates/backend/src/codegen/struct.rs @@ -453,7 +453,7 @@ impl NapiStruct { quote! { #[allow(non_snake_case)] #[allow(clippy::all)] - #[cfg(not(test))] + #[cfg(all(not(test), not(feature = "noop")))] #[napi::bindgen_prelude::ctor] fn #struct_register_name() { napi::bindgen_prelude::register_class(#name_str, #js_mod_ident, #js_name, vec![#(#props),*]); @@ -523,7 +523,7 @@ impl NapiImpl { use super::*; #(#methods)* - #[cfg(not(test))] + #[cfg(all(not(test), not(feature = "noop")))] #[napi::bindgen_prelude::ctor] fn #register_name() { napi::bindgen_prelude::register_class(#name_str, #js_mod_ident, #js_name, vec![#(#props),*]); diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 91ddac08..04ef30de 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT" name = "napi-derive" readme = "README.md" repository = "https://github.com/napi-rs/napi-rs" -version = "2.0.0-beta.3" +version = "2.0.0-beta.4" [features] compat-mode = [] @@ -15,6 +15,7 @@ default = ["compat-mode", "full"] full = ["type-def", "strict"] strict = ["napi-derive-backend/strict"] type-def = ["napi-derive-backend/type-def"] +noop = ["napi-derive-backend/noop"] [dependencies] convert_case = "0.4"