diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 52f1fdef..e69a6411 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -7,7 +7,7 @@ name = "napi-derive-backend" readme = "README.md" repository = "https://github.com/napi-rs/napi-rs" rust-version = "1.80" -version = "2.0.0-alpha.26" +version = "2.0.0-alpha.27" [package.metadata.workspaces] independent = true diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 76afa4d0..dc7cacbe 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -8,7 +8,7 @@ name = "napi-derive" readme = "README.md" repository = "https://github.com/napi-rs/napi-rs" rust-version = "1.80" -version = "3.0.0-alpha.26" +version = "3.0.0-alpha.27" [package.metadata.workspaces] independent = true @@ -23,7 +23,7 @@ type-def = ["napi-derive-backend/type-def"] [dependencies] convert_case = "0.7" -napi-derive-backend = { version = "2.0.0-alpha.26", path = "../backend" } +napi-derive-backend = { version = "2.0.0-alpha.27", path = "../backend" } proc-macro2 = "1" quote = "1" syn = { version = "2", features = ["fold", "full", "extra-traits"] } diff --git a/crates/napi/Cargo.toml b/crates/napi/Cargo.toml index 0b88e91f..8d6a0644 100644 --- a/crates/napi/Cargo.toml +++ b/crates/napi/Cargo.toml @@ -8,7 +8,7 @@ name = "napi" readme = "README.md" repository = "https://github.com/napi-rs/napi-rs" rust-version = "1.80" -version = "3.0.0-alpha.28" +version = "3.0.0-alpha.29" [lib] doctest = false diff --git a/crates/napi/src/bindgen_runtime/module_register.rs b/crates/napi/src/bindgen_runtime/module_register.rs index 353b202d..ddd986aa 100644 --- a/crates/napi/src/bindgen_runtime/module_register.rs +++ b/crates/napi/src/bindgen_runtime/module_register.rs @@ -428,6 +428,10 @@ pub unsafe extern "C" fn napi_register_module_v1( #[cfg(feature = "napi4")] let current_thread_id = std::thread::current().id(); + #[cfg(feature = "napi4")] + let wrapped_object = Box::into_raw(Box::new(current_thread_id)).cast(); + #[cfg(not(feature = "napi4"))] + let wrapped_object = Box::into_raw(Box::new(())).cast(); // attach cleanup hook to the `module` object // we don't use the `napi_add_env_cleanup_hook` because it's required napi3 @@ -437,7 +441,7 @@ pub unsafe extern "C" fn napi_register_module_v1( sys::napi_wrap( env, exports, - Box::into_raw(Box::new(current_thread_id)).cast(), + wrapped_object, Some(thread_cleanup), ptr::null_mut(), ptr::null_mut(),