feat(napi-derive): add noop feature to skip napi function register
This commit is contained in:
parent
454711981b
commit
b2e71b5e03
6 changed files with 9 additions and 7 deletions
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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),*]);
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue