napi
napi-v3.10.3
7/4/2026
Fixed
- (napi) preserve the JS error object when cloning an Error off-thread (#3375)
napi-v3.10.2
7/4/2026
Fixed
- (napi) keep message and cause when cloning a JS-exception Error off-thread (#3373)
napi-v3.10.1
7/3/2026
Fixed
- (napi) release Error's exception reference via the custom GC when dropped off-thread. (#3370)
- (napi) stop ref exception object in ThreadsafeFunction sync-throw path on wasm targets (#3369)
Other
napi-derive-v3.5.9
7/3/2026
Other
- updated the following local packages: napi-derive-backend
napi-derive-backend-v5.1.1
7/3/2026
Other
napi-v3.10.0
7/1/2026
Added
- (napi) implement
To/FromNapiValueforOsString,OsStr,PathandPathBuf(#3339)
Fixed
- (napi) route custom-GC Buffer/TypedArray cross-thread drops through the owning isolate (#3357) (#3360)
napi-derive-v3.5.8
7/1/2026
Other
- updated the following local packages: napi-derive-backend
napi-derive-backend-v5.1.0
7/1/2026
Added
- (napi) implement
To/FromNapiValueforOsString,OsStr,PathandPathBuf(#3339)
napi-v3.9.4
6/24/2026
Other
- (napi-derive) outline #[napi(object)] field-error decoration (#3338)
napi-derive-v3.5.7
6/24/2026
Other
- updated the following local packages: napi-derive-backend
napi-derive-backend-v5.0.5
6/24/2026
Other
- (napi-derive) outline #[napi(object)] field-error decoration (#3338)
napi-v3.9.3
6/18/2026
Fixed
- (napi) sync referred flag when creating a weak ThreadsafeFunction (#3337)
Other
- (napi) outline non-generic core of ThreadsafeFunction::create (#3334)
napi-v3.9.2
6/14/2026
Fixed
- (napi) ReadableStream Reader loses chunks and aborts on errored streams (#3328)
napi-v3.9.1
6/10/2026
Fixed
- (napi) unify Reference finalize callbacks on Arc (Rc/Arc type confusion) (#3313)
- (napi) zero-copy external strings, fix WASI double-free (#3308)
- (napi) experimental node_api_create_object_with_properties (#3304)
napi-sys-v3.2.2
6/10/2026
Fixed
- (sys) restore napi_create_object_with_properties as compat alias (#3321)
- (napi) experimental node_api_create_object_with_properties (#3304)
napi-v3.9.0
5/13/2026
Added
- (napi) add
ThreadsafeFunction::call_async_catchto handle errors in callback functions (#3291)
Fixed
- (deps) update rust crate ctor to v1 (#3276)
- (deps) update rust crate ctor to 0.13.0 (#3275)
- (deps) update rust crate ctor to 0.12.0 (#3271)
napi-derive-v3.5.6
5/13/2026
Fixed
- (napi) invalid TypeScript generic syntax for type aliases (#3289)
- (deps) update rust crate ctor to v1 (#3276)
- (deps) update rust crate ctor to 0.13.0 (#3275)
- (deps) update rust crate ctor to 0.12.0 (#3271)
napi-build-v2.3.2
5/13/2026
Fixed
- (build) on openbsd, work around local thread storage destructor crash after DSO unloading using '-z, nodelete' linker flag (#3274)
napi-v3.8.6
4/29/2026
Fixed
- (deps) update rust crate ctor to 0.11.0 (#3270)
- (napi) Convert #[ctor] calls to declarative form to remove all features (#3257)
Other
napi-derive-v3.5.5
4/29/2026
Fixed
- (deps) update rust crate ctor to 0.11.0 (#3270)
- (napi) Convert #[ctor] calls to declarative form to remove all features (#3257)
napi-derive-backend-v5.0.4
4/29/2026
Fixed
- (napi-derive) only FnArgs unpacks tuple to variadic params (#3264)
- (napi) Convert #[ctor] calls to declarative form to remove all features (#3257)
napi-v3.8.5
4/15/2026
Fixed
- (napi) preserve generator class methods (#3231)
- (deps) update rust crate ctor to v0.10.0 (#3224)
- (deps) disable ctor priority feature (#3209)
- (deps) update rust crate ctor to v0.9.1 (#3204)
- (napi) handle ThreadsafeFunction callback errors gracefully during shutdown (#3188)
- (napi) populate Error::cause from ThreadsafeFunction callee-handled callbacks (#3162)
- correct typo in Either error message ("non" → "none") (#3183)
napi-derive-v3.5.4
4/15/2026
Fixed
- (deps) update rust crate ctor to v0.10.0 (#3224)
- (deps) disable ctor priority feature (#3209)
- (deps) update rust crate ctor to v0.9.1 (#3204)
napi-derive-backend-v5.0.3
4/15/2026
Fixed
- (napi) preserve generator class methods (#3231)
napi-v3.8.4
3/28/2026
Fixed
- (deps) update rust crate ctor to v0.8.0 (#3170)
- (deps) update rust crate ctor to v0.7.0 (#3169)
- (napi) check for null error_message in ExtendedErrorInfo::try_from (#3158)
- (napi) skip nullish error causes when converting from Unknown (#3143)
napi-derive-v3.5.3
3/28/2026
Fixed
napi-v3.8.3
2/14/2026
Fixed
- (napi) prevent async iterator use-after-free during GC (#3120)
Other
- replace
BufferRefmention withBufferSlice(#3112)
napi-derive-v3.5.2
2/14/2026
Fixed
- (deps) update rust crate convert_case to 0.11 (#3114)
napi-derive-backend-v5.0.2
2/14/2026
Fixed
napi-v3.8.2
1/8/2026
Fixed
napi-derive-v3.5.1
1/8/2026
Other
- updated the following local packages: napi-derive-backend
napi-derive-backend-v5.0.1
1/8/2026
Fixed
- (napi) memory leak in async fn (#3089)
napi-v3.8.1
12/30/2025
Fixed
- (napi) wasi debug compile error (#3081)
napi-v3.8.0
12/30/2025
Added
- (napi) support any object types in Stream(#2854)
- (napi-derive) add #[napi(async_iterator)] macro attribute (#3072)
Fixed
- (napi) validate status before copying data in env arraybuffer fallback (#3077)
- (napi) validate status before copying in remaining TypedArray fallback paths (#3076)
- (napi) validate status before copying in TypedArray owned ToNapiValue fallback (#3080)
- (napi) validate status before copying in ArrayBuffer ToNapiValue fallback (#3079)
- (napi) skip debug buffer tracking on wasm targets (#3078)
napi-derive-v3.5.0
12/30/2025
Added
- (napi-derive) add #[napi(async_iterator)] macro attribute (#3072)
napi-derive-backend-v5.0.0
12/30/2025
Added
- (napi-derive) add #[napi(async_iterator)] macro attribute (#3072)
napi-v3.7.1
12/19/2025
Other
- clippy fix for Rust 1.92.0 (#3058)
napi-derive-v3.4.1
12/19/2025
Other
- clippy fix for Rust 1.92.0 (#3058)
napi-derive-backend-v4.0.1
12/19/2025
Fixed
- (napi-derive) class setter param can't be optional (#3066)
napi-v3.7.0
12/9/2025
Added
napi-v3.6.1
12/2/2025
Other
- updated the following local packages: napi-sys
napi-v3.6.0
12/2/2025
Added
- (napi-derive) add tracing feature for debug logging NAPI function calls (#3041)
- (napi) add node_api_create_object_with_properties support for enum creation (#2990)
Fixed
Other
- (napi) add back pub NODE_VERSION_* (#3046)
- (sys) add back non dyn-symbols behavior (#3045)
- (napi) add Eq and PartialEq trait to BigInt (#3033)
- update MSRV in README.md (#3023)
napi-sys-v3.2.1
12/2/2025
Fixed
- (sys) always require libloading because of msvc (#3047)
napi-sys-v3.2.0
12/2/2025
Added
- (napi) add node_api_create_object_with_properties support for enum creation (#2990)
Other
- (sys) add back non dyn-symbols behavior (#3045)
napi-derive-v3.4.0
12/2/2025
Added
- (napi-derive) add tracing feature for debug logging NAPI function calls (#3041)
Fixed
- (deps) update rust crate convert_case to 0.10 (#3031)
napi-derive-backend-v4.0.0
12/2/2025
Added
- (napi-derive) add tracing feature for debug logging NAPI function calls (#3041)
- (napi) add node_api_create_object_with_properties support for enum creation (#2990)
Fixed
- (napi-derive) add paren for function types (#3044)
- (deps) update rust crate convert_case to 0.10 (#3031)
napi-v3.5.2
11/10/2025
Other
- updated the following local packages: napi-build
napi-derive-v3.3.3
11/10/2025
Fixed
- (deps) update rust crate convert_case to 0.9 (#3001)
Other
- (napi) fix tsdown config (#3010)
napi-derive-backend-v3.0.2
11/10/2025
Fixed
- (deps) update rust crate convert_case to 0.9 (#3001)
Other
- (napi) fix tsdown config (#3010)
napi-build-v2.3.1
11/10/2025
Fixed
- (build) add back undefined symbols lookup behavior (#3015)
napi-v3.5.1
11/7/2025
Fixed
- (napi) TypedArraySlice creation (#3004)
Other
- (napi) Promise and ThreadsafeFunction::call_async don't require tokio (#2998)
napi-sys-v3.1.1
11/7/2025
Other
- (napi) Promise and ThreadsafeFunction::call_async don't require tokio (#2998)
napi-derive-v3.3.2
11/7/2025
Other
- updated the following local packages: napi-derive-backend
napi-derive-v3.3.1
11/7/2025
Other
- (napi) Promise and ThreadsafeFunction::call_async don't require tokio (#2998)
napi-derive-backend-v3.0.1
11/7/2025
Fixed
- (napi-derive) TypedArray typegen (#3005)
napi-v3.5.0
11/6/2025
Added
- (sys) use libloading to load napi symbols at runtime on all platform (#2996)
Fixed
- (napi) memory leak in PromiseRaw cleanup callback (#2995)
Other
- (napi) mark tsfn data as pub and split SendableResolver to indent file (#2992)
- (napi) mark SendableResolver and PromiseRaw as pub (#2981)
- add sponsors
napi-sys-v3.1.0
11/6/2025
Added
- (sys) use libloading to load napi symbols at runtime on all platform (#2996)
napi-build-v2.3.0
11/6/2025
Added
- (sys) use libloading to load napi symbols at runtime on all platform (#2996)
napi-v3.4.0
10/24/2025
Added
- (napi) add on_abort for AbortSignal (#2942)
- (cli) add support for loongarch64-unknown-linux-gnu (#2887)
Fixed
- (napi) stop ref error object in wasm targets (#2975)
- (deps) update rust crate ctor to v0.6.0 (#2951)
- (napi) cleanup memory issues (#2949)
- (napi) node_api_create_external_string_utf16 on wasm (#2912)
Other
- (napi) bump rust-version (#2966)
napi-sys-v3.0.1
10/24/2025
Other
- (napi) bump rust-version (#2966)
napi-derive-v3.3.0
10/24/2025
Added
- (napi-derive) add
discriminant_caseto allow changing case of discriminant (#2960)
Fixed
- (deps) update rust crate ctor to v0.6.0 (#2951)
Other
- (napi) bump rust-version (#2966)
napi-derive-backend-v3.0.0
10/24/2025
Added
- (napi-derive) add
discriminant_caseto allow changing case of discriminant (#2960)
Fixed
- (napi) stop ref error object in wasm targets (#2975)
Other
napi-build-v2.2.4
10/24/2025
Fixed
- (build) export
emnapi_thread_crashed(#2920)
Other
- (napi) bump rust-version (#2966)
napi-v3.3.0
9/8/2025
Added
- (napi) implement from_static on JsStringLatin1 and JsStringUtf16 (#2908)
- (napi) support external JsStringLatin1 and JsStringUtf16 (#2898)
Fixed
- (napi) JsStringUtf8 memory leak (#2911)
Other
- (cli) show NAPI options on new command (#2892)
napi-derive-v3.2.5
9/8/2025
Other
- updated the following local packages: napi-derive-backend
napi-derive-backend-v2.2.0
9/8/2025
Added
- (napi) support external JsStringLatin1 and JsStringUtf16 (#2898)
napi-v3.2.4
8/16/2025
Other
- (napi) extends the Set types interoperability (#2875)
napi-derive-v3.2.4
8/16/2025
Other
- updated the following local packages: napi-derive-backend
napi-derive-backend-v2.1.4
8/16/2025
Fixed
- (napi-derive) codegen issue for &'env [u8] param (#2881)
Other
- (napi) extends the Set types interoperability (#2875)
napi-v3.2.3
8/13/2025
Fixed
- (napi) link issue on cargo test --features noop (#2872)
- (deps) update rust crate ctor to v0.5.0 (#2865)
napi-derive-v3.2.3
8/13/2025
Fixed
- (napi) link issue on cargo test --features noop (#2872)
- (deps) update rust crate ctor to v0.5.0 (#2865)
napi-derive-backend-v2.1.3
8/13/2025
Fixed
- (napi) link issue on cargo test --features noop (#2872)
napi-derive-v3.2.2
8/9/2025
Other
- updated the following local packages: napi-derive-backend
napi-derive-backend-v2.1.2
8/9/2025
Fixed
- (napi-derive) comments idents regression (#2857)
napi-v3.2.2
8/8/2025
Fixed
- (napi) no need to cleanup thread_local stuff (#2851)
napi-v3.2.1
8/8/2025
Fixed
- (napi) ensure tokio runtime is initialized for dlopen (#2850)
- (napi) handle the return_if_invalid for Array param (#2846)
napi-derive-v3.2.1
8/8/2025
Other
- updated the following local packages: napi-derive-backend
napi-derive-backend-v2.1.1
8/8/2025
Fixed
- (napi) handle the return_if_invalid for Array param (#2846)
napi-v3.2.0
8/7/2025
Added
- (napi) add ScopeGenerator trait (#2831)
- make generator an iterator (#2784)
- (napi) add
Error.causesupport tonapi::Error(#2829)
Fixed
- (napi) user_defined_rt can only be used once (#2841)
napi-derive-v3.2.0
8/7/2025
Added
napi-derive-backend-v2.1.0
8/7/2025
Added
- make generator an iterator (#2784)
napi-v3.1.6
8/1/2025
Fixed
- (napi) async task finally is not called (#2824) This was introduced in https://github.com/napi-rs/napi-rs/pull/2786, released in 3.1.0
napi-v3.1.5
7/31/2025
Fixed
- (napi) relax the lifetime restriction in PromiseRaw callbacks (#2819)
napi-v3.1.4
7/30/2025
Fixed
- (napi) the generic trait rectiction of Env::spawn should be ScopedTask (#2817)
napi-derive-v3.1.2
7/30/2025
Other
- updated the following local packages: napi-derive-backend
napi-derive-backend-v2.0.3
7/30/2025
Fixed
- (napi-derive) generate types for threadsafe_function with WEAK=true correctly (#2813)
napi-v3.1.3
7/24/2025
Other
- (napi) optimize HashMap allocation in FromNapiValue implementation for HashMap (#2796)
napi-build-v2.2.3
7/24/2025
Other
- (cli) setjmp link path (#2808)
napi-v3.1.2
7/22/2025
Other
- (napi) use Vec with_capacity in FromNapiValue (#2793)
napi-derive-v3.1.1
7/22/2025
Other
- updated the following local packages: napi-derive-backend
napi-derive-backend-v2.0.2
7/22/2025
Fixed
- (napi-derive) lifetime codegen issue (#2794)
napi-v3.1.1
7/21/2025
Other
- Revert "fix(napi): callback should be Fn rather than FnOnce" (#2791)
napi-v3.1.0
7/21/2025
Added
- (napi) provide ScopedTask to resolve JsValue with lifetime (#2786)
Other
- (napi) add UnwindSafe and RefUnwindSafe back to AbortSignal and AsyncWorkPromise (#2789)
- pin release-plz action
napi-derive-v3.1.0
7/21/2025
Added
- (napi) provide ScopedTask to resolve JsValue with lifetime (#2786)
Other
- pin release-plz action
napi-derive-backend-v2.0.1
7/21/2025
Other
- pin release-plz action
napi@3.0.0
7/17/2025
NAPI-RS v3
https://napi.rs/blog/announce-v3
napi@3.0.0-beta.12
7/4/2025
What's Changed
- feat(napi): add napi_ref impl for Object Symbol and External by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2754
- fix(napi): drop SymbolRef and ObjectRef properly by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2755
- perf(napi): sender in Promise does not need to be Arc by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2756
- perf: use
Cell<bool>to replaceAtomicBoolby @SyMind in https://github.com/napi-rs/napi-rs/pull/2506 - feat!(napi): create function from #[napi] fn by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2757
- feat(napi): support c string for object apis by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2759
- feat(napi): support untyped TypedArray slice by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2762
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-beta.11...napi@3.0.0-beta.12
napi-derive@3.0.0-beta.12
7/4/2025
What's Changed
- feat(napi): add napi_ref impl for Object Symbol and External by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2754
- feat(napi): support untyped TypedArray slice by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2762
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-beta.11...napi-derive@3.0.0-beta.12
napi-build@2.2.2
6/30/2025
What's Changed
- fix(build): increase wasi stack size by @CPunisher in https://github.com/napi-rs/napi-rs/pull/2748
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-beta.10...napi-build@2.2.2
napi@3.0.0-beta.11
6/30/2025
What's Changed
- fix(napi): callback should be Fn rather than FnOnce by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2749
- fix(napi): remove DerefMut impl for all TypedArray types by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2750
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-beta.10...napi@3.0.0-beta.11
napi-derive@3.0.0-beta.11
6/30/2025
What's Changed
- fix(napi-derive): generate object key types properly by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2752
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-beta.10...napi-derive@3.0.0-beta.11
napi@3.0.0-beta.10
6/25/2025
What's Changed
- fix(napi): create external TypedArray in Electron env by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2740
- style: run clippy on nightly Rust by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2744
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.0.0-alpha.91...napi@3.0.0-beta.10
napi-derive@3.0.0-beta.10
6/25/2025
What's Changed
- fix(napi-derive): single parentheses arg is provided in ThreadsafeFunction by @camc314 in https://github.com/napi-rs/napi-rs/pull/2742
- style: run clippy on nightly Rust by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2744
New Contributors
- @camc314 made their first contribution in https://github.com/napi-rs/napi-rs/pull/2742
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.0.0-alpha.91...napi-derive@3.0.0-beta.10
napi@3.0.0-beta.9
6/24/2025
What's Changed
- fix(napi): avoid add finalizer if properties is empty by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2711
- fix(napi): avoid allocate empty Box if closures is empty by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2712
- fix(napi): set AbortError name by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2713
- perf(napi): remove unnecessary wrap in Task by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2714
- fix(napi): wrong drop impl for TypedArray::with_external_data by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2724
- fix(napi): prevent panic in ThreadsafeFunctionHandle::drop if ThreadsafeFunction::create fail by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2731
- test(napi): add complex pub type fixture by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2732
- test(napi): add fixture for re-export complex class by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2733
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-beta.8...napi@3.0.0-beta.9
napi-derive@3.0.0-beta.9
6/24/2025 Version bump only
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.0.0-alpha.90...napi-derive@3.0.0-beta.9
napi@3.0.0-beta.8
6/8/2025
What's Changed
- feat(napi): support
build_threadsafe_functionvariant with error status by @h-a-n-a in https://github.com/napi-rs/napi-rs/pull/2694 - feat(napi): support setting
error_statusofThreadsafeFunctionBuilderby @h-a-n-a in https://github.com/napi-rs/napi-rs/pull/2695 - fix(napi): memory leak in Object Property by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2699
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-beta.7...napi@3.0.0-beta.8
napi-derive@3.0.0-beta.8
6/8/2025
What's Changed
- fix(napi-derive): using js_name generating wrong type defs by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2700
- fix(napi-derive): panic while creating type definition when Rust comment contains escape syntax by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2701
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-beta.6...napi-derive@3.0.0-beta.8
napi-build@2.2.1
6/4/2025
What's Changed
No significant change, add environment change detection for napi-derive beta versions
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-beta.5...napi-build@2.2.1
napi@3.0.0-beta.5
6/4/2025
What's Changed
- perf(napi): PersistedPerInstanceHashMap can be thread local by @SyMind in https://github.com/napi-rs/napi-rs/pull/2681
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-beta.4...napi@3.0.0-beta.5
napi-derive@3.0.0-beta.5
6/4/2025
What's Changed
- fix: revalidate shared libs if type def not found by @forehalo in https://github.com/napi-rs/napi-rs/pull/2689
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-beta.4...napi-derive@3.0.0-beta.5
napi@3.0.0-beta.4
6/3/2025
What's Changed
- feat!(napi): define propertes support symbol as name by @SyMind in https://github.com/napi-rs/napi-rs/pull/2673
- perf(napi): hash map by fx hash and no hash hasher by @SyMind in https://github.com/napi-rs/napi-rs/pull/2671
- feat!(napi): support custom tsfn error status by @h-a-n-a in https://github.com/napi-rs/napi-rs/pull/2672
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-beta.3...napi@3.0.0-beta.4
napi-sys@3.0.0-alpha.3
6/3/2025
What's Changed
- fix(sys): napi10 types by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2682
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-sys@3.0.0-alpha.2...napi-sys@3.0.0-alpha.3
napi-derive@3.0.0-beta.4
6/3/2025
What's Changed
- fix(napi-derive):
Either<f64, u32>should generate number ts type by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2683 - fix: type generation for shared libs by @forehalo in https://github.com/napi-rs/napi-rs/pull/2684
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-beta.3...napi-derive@3.0.0-beta.4
napi@3.0.0-beta.3
5/29/2025
What's Changed
- feat(napi): serialize BigInt to serde::Value by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2659
- fix(napi): use Arc in Reference because it is Send by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2668
- feat(napi): add into_unknown on ToNapiValue by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2669
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-beta.2...napi@3.0.0-beta.3
napi-sys@3.0.0-alpha.2
5/29/2025
What's Changed
- feat(sys): sync Node-API version changes by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2661
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-beta.2...napi-sys@3.0.0-alpha.2
napi-derive@3.0.0-beta.3
5/29/2025
What's Changed
Bump version only
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-beta.2...napi-derive@3.0.0-beta.3
napi@3.0.0-beta.2
5/22/2025
What's Changed
- fix: ClassInstance as_object lifecycle by @SyMind in https://github.com/napi-rs/napi-rs/pull/2655
- fix(napi): wrong error status in ThreadsafeFunction callback by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2656
- feat(napi): set Error::reason to error message and stack in async context by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2657
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-beta.1...napi@3.0.0-beta.2
napi-derive@3.0.0-beta.2
5/22/2025
What's Changed
Version bump only
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-beta.1...napi-derive@3.0.0-beta.2
napi@3.0.0-beta.1
5/19/2025
What's Changed
- fix(napi): cleanup inner Stream when complete by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2643
- fix!(napi): unsound issues in Error by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2644
- chore(napi): make Object::from_raw pub by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2645
- fix(napi): reuse issue on AbortSignal by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2646
- refactor!(napi): move JsObjectValue into bindgen_runtime by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2649
- feat(napi): new handle scope API by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2650
- feat(napi): EscapableHandleScope API by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2652
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-build@2.2.0...napi@3.0.0-beta.1
napi-derive@3.0.0-beta.1
5/19/2025
What's Changed
- fix(napi-derive): #[cfg_attr(feature = "xxx", napi)] by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2640
- style(napi-derive): clippy fix by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2647
- fix(napi-derive): disallow JsValue assign to napi class as a field by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2648
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-beta.0...napi-derive@3.0.0-beta.1
napi-build@2.2.0
5/16/2025
What's Changed
- feat: auto invalid type gen by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2638
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-build@2.1.6...napi-build@2.2.0
napi@3.0.0-beta.0
5/16/2025
What's Changed
- feat(napi): serde value ref to napi_value by @SyMind in https://github.com/napi-rs/napi-rs/pull/2550
- feat(napi): impl
into_unknownfor External by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2598 - refactor!(napi): add lifetime to Array by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2599
- test: fix flaky by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2601
- feat(napi): add from_napi_value for
Ref<T: FromNapiValue>by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2603 - refactor!(napi): introduce JsValue and JsObjectValue trait by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2606
- refactor!(napi): add lifetime for JsNumber by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2609
- refactor!(napi): add lifetime for JsSymbol by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2610
- refactor!(napi): add lifetime to Unkonwn by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2611
- refactor!(napi): move depracated types behind compat-mode feature flag by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2612
- refactor!(napi): move JsBigint behind compat-mode feature by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2613
- refactor!(napi): add lifetime to JsString by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2614
- refactor!(napi): add lifetime to Object by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2619
- fix(napi): unused warning on JsString::from_raw by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2622
- fix(napi): reference leak in DeferredTrace by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2624
- fix(napi): nested Either and Promise validate logic by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2625
- feat(napi): impl full Uint8ClampedSlice type by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2626
- feat(napi): add create_ref on JsObjectValue by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2627
- fix(napi): JsObjectValue::get_property signature by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2628
- feat(napi): support #[napi(module_exports)] by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2631
- fix(napi): module_exports binding by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2632
New Contributors
- @sxzz made their first contribution in https://github.com/napi-rs/napi-rs/pull/2560
- @inakineitor made their first contribution in https://github.com/napi-rs/napi-rs/pull/2605
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-build@2.1.6...napi@3.0.0-beta.0
napi-derive@3.0.0-beta.0
5/16/2025
What's Changed
- fix(napi-derive): make_ref with
Vec<&S>cases by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2589 - feat(napi-derive): auto invalid type gen by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2638
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-build@2.1.6...napi-derive@3.0.0-beta.0
napi@2.16.17
3/22/2025
What's Changed
- fix: backport BigInt changes from #2028 & #2356 by @Wodann in https://github.com/napi-rs/napi-rs/pull/2524
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.16...napi@2.16.17
napi-build@2.1.6
3/22/2025
What's Changed
- perf(build): remove
--export-dynamicflag in wasi compilation by @CPunisher in https://github.com/napi-rs/napi-rs/pull/2523
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.33...napi-build@2.1.6
napi@3.0.0-alpha.33
3/17/2025
What's Changed
- fix(napi): re-create async runtime by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2519
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.29...napi@3.0.0-alpha.33
napi@3.0.0-alpha.32
3/16/2025
What's Changed
- fix(deps): update rust crate ctor to 0.4.0 by @renovate in https://github.com/napi-rs/napi-rs/pull/2482
- feat(napi): tokio multi-thread mode on wasi by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2501
- fix(napi): js call callback in ThreadsafeFunction should not be Send by @SyMind in https://github.com/napi-rs/napi-rs/pull/2510
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.31...napi@3.0.0-alpha.32
napi-derive@3.0.0-alpha.29
3/16/2025
What's Changed
- fix(deps): update rust crate ctor to 0.4.0 by @renovate in https://github.com/napi-rs/napi-rs/pull/2482
- fix(deps): update rust crate convert_case to 0.8 by @renovate in https://github.com/napi-rs/napi-rs/pull/2483
- fix(napi-derive): add
object_from_jsandobject_to_jssupport for enum by @CPunisher in https://github.com/napi-rs/napi-rs/pull/2489
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.31...napi-derive@3.0.0-alpha.29
napi-build@2.1.5
2/25/2025
What's Changed
- refactor: link crt1-reactor.o as poor man's wasi-exec-model=reactor by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2480
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.30...napi-build@2.1.5
napi@3.0.0-alpha.31
2/25/2025
What's Changed
- fix(napi): compile error on noop feature by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2478
- refactor!(napi): link crt1-reactor.o as poor man's wasi-exec-model=reactor by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2480
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.30...napi@3.0.0-alpha.31
napi@3.0.0-alpha.30
2/24/2025
What's Changed
- fix(napi): compatible with Rust 1.85 by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2477
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.29...napi@3.0.0-alpha.30
napi@3.0.0-alpha.29
2/21/2025
What's Changed
- chore(napi): merge thread cleanup by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2469
- chore(napi): remove thread_local! in REFERENCE_MAP by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2470
- fix!(napi): upgrade to ctor 0.3.6 by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2472
New Contributors
- @sigmaSd made their first contribution in https://github.com/napi-rs/napi-rs/pull/2471
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.28...napi@3.0.0-alpha.29
napi@2.16.16
2/11/2025
What Changed
- fix(napi): add back tokio runtime reference count on macOS, close https://github.com/napi-rs/napi-rs/issues/2460 by @Brooooooklyn
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.15...napi@2.16.16
napi@3.0.0-alpha.28
2/11/2025
What's Changed
- chore(napi): expose functions which turn raw pointer into External by @zackradisic in https://github.com/napi-rs/napi-rs/pull/2449
- feat(napi-derive): impl #[napi(array)] by @lghuahua in https://github.com/napi-rs/napi-rs/pull/2459
- refactor!(napi): TypedArray API surfaces by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2462
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.0.0-alpha.67...napi@3.0.0-alpha.28
napi-derive@3.0.0-alpha.26
2/11/2025
What's Changed
- fix(napi-derive): enable tuple fields to support js_name attribute by @lghuahua in https://github.com/napi-rs/napi-rs/pull/2439
- feat(napi-derive): impl #[napi(array)] by @lghuahua in https://github.com/napi-rs/napi-rs/pull/2459
- refactor!(napi): TypedArray API surfaces by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2462
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.0.0-alpha.67...napi-derive@3.0.0-alpha.26
napi@2.16.15
2/4/2025
What's Changed
- fix(napi): Update
from_rawmethods onExternal<T>by @zackradisic in https://github.com/napi-rs/napi-rs/pull/2453
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.14...napi@2.16.15
napi@2.16.14
2/3/2025
What Changed
- chore(napi): expose functions which turn raw pointer into External by @zackradisic (https://github.com/napi-rs/napi-rs/pull/2449)
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.16.13...napi@2.16.14
napi@3.0.0-alpha.27
1/12/2025
What's Changed
- fix(napi): add back Buffer/TypedArray custom gc on wasi by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2421
- feat(napi): allow create ReadableStream from polyfill by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2424
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.25...napi@3.0.0-alpha.27
napi-derive@3.0.0-alpha.25
1/12/2025
What's Changed
- fix(napi-derive): hide the lifetime recursively in codegen by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2426
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.24...napi-derive@3.0.0-alpha.25
napi-derive@3.0.0-alpha.24
1/12/2025
What's Changed
- fix(deps): update rust crate convert_case to 0.7 by @renovate in https://github.com/napi-rs/napi-rs/pull/2422
- feat(napi): allow create ReadableStream from polyfill by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2424
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.25...napi-derive@3.0.0-alpha.24
napi@3.0.0-alpha.25
1/4/2025
What's Changed
- perf(napi): JsStringUtf8 take & into_owned & as_str fn by @SyMind in https://github.com/napi-rs/napi-rs/pull/2404
- refactor!(napi): arguments tuple behavior by @adespawn in https://github.com/napi-rs/napi-rs/pull/2401
- fix(napi): Function call with empty tuple should generate empty arguments by @richerfu in https://github.com/napi-rs/napi-rs/pull/2407
- feat(napi): add get and try_get for FunctionCallContext by @richerfu in https://github.com/napi-rs/napi-rs/pull/2409
- feat(napi): impl ReadableStream and AsyncGenerator by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2418
New Contributors
- @ganthern made their first contribution in https://github.com/napi-rs/napi-rs/pull/2402
- @lghuahua made their first contribution in https://github.com/napi-rs/napi-rs/pull/2416
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.23...napi@3.0.0-alpha.25
napi-derive@3.0.0-alpha.23
1/4/2025
What's Changed
- refactor!(napi): arguments tuple behavior by @adespawn in https://github.com/napi-rs/napi-rs/pull/2401
- fix(napi): Function call with empty tuple should generate empty arguments by @richerfu in https://github.com/napi-rs/napi-rs/pull/2407
- feat(napi): add get and try_get for FunctionCallContext by @richerfu in https://github.com/napi-rs/napi-rs/pull/2409
- feat(napi-derive): support type on #[napi] by @lghuahua in https://github.com/napi-rs/napi-rs/pull/2416
- feat(napi): impl ReadableStream and AsyncGenerator by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2418
New Contributors
- @ganthern made their first contribution in https://github.com/napi-rs/napi-rs/pull/2402
- @lghuahua made their first contribution in https://github.com/napi-rs/napi-rs/pull/2416
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.23...napi-derive@3.0.0-alpha.23
napi@3.0.0-alpha.23
12/10/2024
What's Changed
- fix(napi): delete error reference with raw Error by @underfin in https://github.com/napi-rs/napi-rs/pull/2388
New Contributors
- @underfin made their first contribution in https://github.com/napi-rs/napi-rs/pull/2388
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.21...napi@3.0.0-alpha.23
napi-derive@2.16.13
12/3/2024
What Changed
- fix(napi-derive): undefined feature flags in expanded macro by @Brooooooklyn https://github.com/napi-rs/napi-rs/commit/9581f785e02fd08a2be70d064e6eb167ea729176
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.13...napi-derive@2.16.13
napi@3.0.0-alpha.22
12/3/2024
What's Changed
- fix(napi): handle nul byte in object key by @hi-ogawa in https://github.com/napi-rs/napi-rs/pull/2385
New Contributors
- @hi-ogawa made their first contribution in https://github.com/napi-rs/napi-rs/pull/2385
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.21...napi@3.0.0-alpha.22
napi-derive@3.0.0-alpha.21
12/3/2024
What's Changed
- fix(napi-derive): generate correct types for HashMap with RandomState argument by @sapphi-red in https://github.com/napi-rs/napi-rs/pull/2384
- fix(napi-derive): object_from_js / object_to_js for transparent was swapped by @sapphi-red in https://github.com/napi-rs/napi-rs/pull/2382
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.21...napi-derive@3.0.0-alpha.21
napi@3.0.0-alpha.21
11/30/2024
What's Changed
- feat(napi): allow us to create nest function from closure by @richerfu in https://github.com/napi-rs/napi-rs/pull/2360
- feat(napi): implement
ValidateNapiValuefor HashMap with any hasher by @sapphi-red in https://github.com/napi-rs/napi-rs/pull/2374 - feat(napi): implement
ValidateNapiValuefor HashSet with any hasher by @sapphi-red in https://github.com/napi-rs/napi-rs/pull/2377
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.20...napi@3.0.0-alpha.21
napi-derive@3.0.0-alpha.20
11/30/2024
What's Changed
- fix(backend): fix type when function as object field by @richerfu in https://github.com/napi-rs/napi-rs/pull/2359
- feat(napi-derive): allow ts_type in napi fn attrs by @Frank-III in https://github.com/napi-rs/napi-rs/pull/2362
- feat(napi-derive): implement
#[napi(transparent)]by @sapphi-red in https://github.com/napi-rs/napi-rs/pull/2376 - chore: Rust 1.83.0 clippy fix by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2378
New Contributors
- @Frank-III made their first contribution in https://github.com/napi-rs/napi-rs/pull/2362
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.19...napi-derive@3.0.0-alpha.20
napi-derive@3.0.0-alpha.19
11/13/2024
What's Changed
- fix(napi-derive): object lifetime compile issue by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2351
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.18...napi-derive@3.0.0-alpha.19
napi@3.0.0-alpha.20
11/7/2024
What's Changed
- chore(napi): remove Read from Uint8Array by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2346
- chore(napi): deprecate Env::create_reference by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2347
- fix(napi): memory leak in PromiseRaw callbacks by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2348
New Contributors
- @Adjective-Object made their first contribution in https://github.com/napi-rs/napi-rs/pull/2344
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.17...napi@3.0.0-alpha.20
napi-derive@3.0.0-alpha.18
11/7/2024
What's Changed
- chore(napi-derive): remove unused dependency
regexfromnapi-derive-backendby @Adjective-Object in https://github.com/napi-rs/napi-rs/pull/2344
New Contributors
- @Adjective-Object made their first contribution in https://github.com/napi-rs/napi-rs/pull/2344
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.17...napi-derive@3.0.0-alpha.18
napi@3.0.0-alpha.18
10/31/2024
What's Changed
- feat(napi): impl
io::ReadforUint8Arrayby @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2336 - feat(napi): introduce
AsyncBlockto let user dispose resources after future done by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2338
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.17...napi@3.0.0-alpha.18
napi-derive@3.0.0-alpha.17
10/31/2024
What's Changed
- feat(napi): introduce AsyncBlock to let user dispose resources after future done by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2338
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-sys@3.0.0-alpha.0...napi-derive@3.0.0-alpha.17
napi@3.0.0-alpha.17
10/28/2024
What's Changed
- feat(napi): implmenet Set by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2330
- fix!(sys): Node-API accept
NAPI_AUTO_LENGTHparameter type should beisizerather thanusizeby @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2331 - feat(napi): support return
*const c_charto JavaScript directly by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2332
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.15...napi@3.0.0-alpha.17
napi-sys@3.0.0-alpha.0
10/28/2024
What's Changed
- fix!(sys): Node-API accept
NAPI_AUTO_LENGTHparameter type should beisizerather thanusizeby @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2331
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.15...napi-sys@3.0.0-alpha.0
napi-derive@3.0.0-alpha.16
10/28/2024
What's Changed
- fix(napi-derive): ra warning on Rust 1.82 by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2329
- feat(napi): implmenet Set by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2330
- feat(napi): support return *const c_char to JavaScript directly by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2332
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.15...napi-derive@3.0.0-alpha.16
napi@2.16.13
10/21/2024
What Changed
- fix(napi): needless cast to
CStringbefore callnapi_create_string_utf8
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.12...napi@2.16.13
napi@3.0.0-alpha.16
10/21/2024
What's Changed
- chore(napi): display the real info for TypedArray by @richerfu in https://github.com/napi-rs/napi-rs/pull/2310
- fix(napi): before using from_raw_parts should check if data is null by @richerfu in https://github.com/napi-rs/napi-rs/pull/2311
- fix(napi): TypedArray is not ArrayBuffer in Deno by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2314
- fix(napi): needless cast to CString before call napi_create_string_utf8 by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2321
- docs: update n-api version matrix docs url by @selfisekai in https://github.com/napi-rs/napi-rs/pull/2319
- chore(deps): update dependency oxlint to ^0.10.0 by @renovate in https://github.com/napi-rs/napi-rs/pull/2318
- refactor!(napi): remove &str FromNapiValue by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2323
New Contributors
- @selfisekai made their first contribution in https://github.com/napi-rs/napi-rs/pull/2319
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.15...napi@3.0.0-alpha.16
napi-derive@3.0.0-alpha.15
10/21/2024
What's Changed
- refactor!(napi): remove &str FromNapiValue by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2323
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.14...napi-derive@3.0.0-alpha.15
napi@3.0.0-alpha.15
10/14/2024
What's Changed
- refactor!(napi): Ref::unref accept &mut self instead of self by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2308
- refactor!(napi): pass self to Task::finally instread of &mut self by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2309
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.14...napi@3.0.0-alpha.15
napi@2.16.12
10/13/2024
What Changed
- fix(napi): data maybe null in custom_gc #2304
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.11...napi@2.16.12
napi@3.0.0-alpha.14
10/13/2024
What's Changed
- chore(napi): env doesn't need to be mut by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2292
- refactor!(napi): remove clone fn on ThreadsafeFunction by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2291
- feat(napi,napi-derive): allow lifetime in Class by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2298
- fix(napi): data maybe null in custom_gc by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2304
- feat(napi): support arraybuffer for de by @richerfu in https://github.com/napi-rs/napi-rs/pull/2296
New Contributors
- @jackyzha0 made their first contribution in https://github.com/napi-rs/napi-rs/pull/2297
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.13...napi@3.0.0-alpha.14
napi-derive@3.0.0-alpha.14
10/13/2024
What's Changed
- feat(napi,napi-derive): allow lifetime in Class by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2298
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.13...napi-derive@3.0.0-alpha.14
napi@3.0.0-alpha.13
10/2/2024
What's Changed
- refactor!(napi,napi-derive): add lifetime to ClassInstance by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2286
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.12...napi@3.0.0-alpha.13
napi-derive@3.0.0-alpha.13
10/2/2024
What's Changed
- fix(napi-derive-backend): should respect origin name for class factory by @richerfu in https://github.com/napi-rs/napi-rs/pull/2280
- refactor!(napi,napi-derive): add lifetime to ClassInstance by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2286
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.12...napi-derive@3.0.0-alpha.13
napi@3.0.0-alpha.12
9/23/2024
What's Changed
- feat(napi): mark create_buffer as deprecated & use BufferSlice to replace JsBuffer for ser by @richerfu in https://github.com/napi-rs/napi-rs/pull/2267
- chore(deps): update dependency esbuild to ^0.24.0 by @renovate in https://github.com/napi-rs/napi-rs/pull/2268
- chore(example): use BufferSlice to replace JsBuffer by @richerfu in https://github.com/napi-rs/napi-rs/pull/2269
- feat(napi-derive): add async_runtime attribute by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2270
- chore(napi): remove once_cell by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2271
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.11...napi@3.0.0-alpha.12
napi-derive@3.0.0-alpha.12
9/23/2024
What's Changed
- feat(napi-derive): add async_runtime attribute by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2270
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.11...napi-derive@3.0.0-alpha.12
napi-derive@3.0.0-alpha.11
9/21/2024
What's Changed
- feat(napi-derive): allow napi fn with lifetime by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2266
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.11...napi-derive@3.0.0-alpha.11
napi@3.0.0-alpha.11
9/20/2024
What's Changed
- refactor(napi-derive): expand order by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2265
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.9...napi@3.0.0-alpha.11
napi-derive@3.0.0-alpha.10
9/20/2024
What's Changed
- refactor(napi-derive): expand order by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2265
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.9...napi-derive@3.0.0-alpha.10
napi@2.16.11
9/19/2024
What Changed
- fix(napi): nullptr handling in TypedArrays #2258 @Xanewok
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.10...napi@2.16.11
napi@3.0.0-alpha.10
9/19/2024
What's Changed
- fix(napi): nullptr handling in
TypedArrays by @Xanewok in https://github.com/napi-rs/napi-rs/pull/2258 - chore: enable corepack in Debian base Dockerfile by @stevefan1999-personal in https://github.com/napi-rs/napi-rs/pull/2252
- refactor(napi): allow create BufferSlice from external data by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2263
New Contributors
- @Xanewok made their first contribution in https://github.com/napi-rs/napi-rs/pull/2258
- @stevefan1999-personal made their first contribution in https://github.com/napi-rs/napi-rs/pull/2252
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.8...napi@3.0.0-alpha.10
napi-derive@3.0.0-alpha.9
9/19/2024
What's Changed
- fix(derive): fix clippy warning with newer rust version by @richerfu in https://github.com/napi-rs/napi-rs/pull/2262
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.8...napi-derive@3.0.0-alpha.9
napi@2.16.10
9/12/2024
What Changed
- fix(napi,napi-derive): ffi lifetime and pointer sound issues https://github.com/napi-rs/napi-rs/pull/2216 @cathy-sjh
- chore(napi): mark JsArraybufferValue's value pub https://github.com/napi-rs/napi-rs/pull/2226 @richerfu
- fix(napi): use error_ref should checkout it at first https://github.com/napi-rs/napi-rs/pull/2235 @richerfu
- fix(napi): windows function registration timing https://github.com/napi-rs/napi-rs/pull/2248 @Brooooooklyn
- perf(napi): remove unnecessary checks for strings from napi_get_value_string_utf8 #2247 @SyMind
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.9...napi@2.16.10
napi-derive@2.16.12
9/12/2024
What Changed
- fix(napi-derive): string enum validate logic #2213 @Brooooooklyn
- fix(napi-derive): warning in empty enum codegen #2214 @Brooooooklyn
- fix(napi,napi-derive): ffi lifetime and pointer sound issues #2216 @cathy-sjh
- fix(napi-derive): replace self when function returns
Result#2224 @CPunisher - perf(macro): constructor don't support asynchronous function #2239 @richerfu
- fix(napi-derive): call flush on the BufWriter #2242 @richerfu
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.16.10...napi-derive@2.16.12
napi@3.0.0-alpha.9
9/12/2024
What's Changed
- test: skip unstable test in WASI env by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2196
- fix(napi): allow ThreadsafeFunction in Either by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2204
- chore: implement serde::Serialize for Either by @lbarthon in https://github.com/napi-rs/napi-rs/pull/2209
- ci: fix Address Sanitizer check by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2212
- fix(napi,napi-derive): ffi lifetime and pointer sound issues by @cathy-sjh in https://github.com/napi-rs/napi-rs/pull/2216
- feat: support structured enum with discriminated unions by @CPunisher in https://github.com/napi-rs/napi-rs/pull/2222
- feat(napi): mark JsArraybufferValue's value pub by @richerfu in https://github.com/napi-rs/napi-rs/pull/2226
- fix(napi): use error_ref should checkout it at first by @richerfu in https://github.com/napi-rs/napi-rs/pull/2235
- fix(napi): windows function registration timing by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2248
- perf(napi): remove unnecessary checks for strings from napi_get_value_string_utf8 by @SyMind in https://github.com/napi-rs/napi-rs/pull/2247
- refactor!(napi): Ref should not hold the value ptr by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2243
New Contributors
- @CPunisher made their first contribution in https://github.com/napi-rs/napi-rs/pull/2210
- @cathy-sjh made their first contribution in https://github.com/napi-rs/napi-rs/pull/2216
- @markovalenko made their first contribution in https://github.com/napi-rs/napi-rs/pull/2220
- @DonIsaac made their first contribution in https://github.com/napi-rs/napi-rs/pull/2233
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.7...napi@3.0.0-alpha.9
napi-derive@3.0.0-alpha.8
9/12/2024
What's Changed
- fix: missing impl for FromNapiValue due to object_from_js being false by @SyMind in https://github.com/napi-rs/napi-rs/pull/2197
- fix(napi-derive): add more cases for typegen of function args by @CPunisher in https://github.com/napi-rs/napi-rs/pull/2210
- fix(napi-derive): string enum validate logic by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2213
- fix(napi-derive): warning in empty enum codegen by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2214
- fix(napi,napi-derive): ffi lifetime and pointer sound issues by @cathy-sjh in https://github.com/napi-rs/napi-rs/pull/2216
- fix(napi-derive): replace self when function returns
Resultby @CPunisher in https://github.com/napi-rs/napi-rs/pull/2224 - feat: support structured enum with discriminated unions by @CPunisher in https://github.com/napi-rs/napi-rs/pull/2222
- fix(napi-derive): tuple object and enum by @CPunisher in https://github.com/napi-rs/napi-rs/pull/2227
- perf(macro): constructor don't support asynchronous function by @richerfu in https://github.com/napi-rs/napi-rs/pull/2239
- fix(napi-derive): call flush on the BufWriter by @richerfu in https://github.com/napi-rs/napi-rs/pull/2242
New Contributors
- @CPunisher made their first contribution in https://github.com/napi-rs/napi-rs/pull/2210
- @cathy-sjh made their first contribution in https://github.com/napi-rs/napi-rs/pull/2216
- @markovalenko made their first contribution in https://github.com/napi-rs/napi-rs/pull/2220
- @DonIsaac made their first contribution in https://github.com/napi-rs/napi-rs/pull/2233
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.7...napi-derive@3.0.0-alpha.8
napi@2.16.9
8/10/2024
What Changed
- chore: implement
serde::SerializeforEitherby @lbarthon #2209
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.8...napi@2.16.9
napi-derive@2.16.11
8/10/2024
What Changed
- fix(napi-derive): add more cases for typegen of function args by @CPunisher #2210
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.16.10...napi-derive@2.16.11
napi-derive@2.16.10
7/23/2024
What Changed
- fix(napi-derive): call flush on the BufWriter by @lbarthon in https://github.com/napi-rs/napi-rs/pull/2195
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.16.9...napi-derive@2.16.10
napi-derive@3.0.0-alpha.7
7/23/2024
What's Changed
- fix(napi-derive): call flush on the BufWriter by @lbarthon in https://github.com/napi-rs/napi-rs/pull/2195
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.6...napi-derive@3.0.0-alpha.7
napi-derive@2.16.9
7/16/2024
What's Changed
- fix: napi getter macros by @SyMind in https://github.com/napi-rs/napi-rs/pull/2188
New Contributors
- @SyMind made their first contribution in https://github.com/napi-rs/napi-rs/pull/2188
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.16.8...napi-derive@2.16.9
napi-derive@3.0.0-alpha.6
7/16/2024
What's Changed
- fix: napi getter macros by @SyMind in https://github.com/napi-rs/napi-rs/pull/2188
New Contributors
- @SyMind made their first contribution in https://github.com/napi-rs/napi-rs/pull/2188
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.0.0-alpha.59...napi-derive@3.0.0-alpha.6
napi@3.0.0-alpha.6
7/7/2024
What's Changed
- refactor(napi): simplify Promise implementation by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2171
- fix(napi): Promise callbacks should require static lifetime by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2172
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.5...napi@3.0.0-alpha.6
napi@3.0.0-alpha.5
7/6/2024
What's Changed
- feat(napi): impl from_string for Uint8Array by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2167
- feat(napi): provide PromiseRaw for non-await scenario by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2168
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.0.0-alpha.56...napi@3.0.0-alpha.5
napi-derive@2.16.8
7/1/2024
What changed
- fix(napi-derive): missing declare keyword for function
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.16.7...napi-derive@2.16.8
napi-derive@3.0.0-alpha.3
7/1/2024
What's Changed
- fix(napi-derive): class constructor and factory should support custom error status by @richerfu in https://github.com/napi-rs/napi-rs/pull/2161
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@3.0.0-alpha.2...napi-derive@3.0.0-alpha.3
napi@2.16.8
6/27/2024
What Changed
- feat(napi): support chrono datetime with timezones by @naskya (https://github.com/napi-rs/napi-rs/pull/2074)
- chore(napi): let docs.rs generate all documentation by @Gentle #2160
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.7...napi@2.16.8
napi@3.0.0-alpha.3
7/1/2024
What's Changed
- docs(cli): fix typo by @naskya in https://github.com/napi-rs/napi-rs/pull/2108
- chore(deps): update dependency sinon to v18 by @renovate in https://github.com/napi-rs/napi-rs/pull/2112
- chore(napi): allow value attribute on enum variants by @lbarthon in https://github.com/napi-rs/napi-rs/pull/2115
- feat(napi): Function build_thfn support calledhandled mode by @richerfu in https://github.com/napi-rs/napi-rs/pull/2114
- fix(typegen): add missing
declarekeyword by @magic-akari in https://github.com/napi-rs/napi-rs/pull/2117 - fix(deps): update dependency emnapi to v1.2.0 by @renovate in https://github.com/napi-rs/napi-rs/pull/2118
- chore(deps): update dependency vite-plugin-node-polyfills to ^0.22.0 by @renovate in https://github.com/napi-rs/napi-rs/pull/2119
- feat(napi): implement ToNapiValue for Ref as required by TSFN by @richerfu in https://github.com/napi-rs/napi-rs/pull/2122
- feat(napi): support External for compact mode by @richerfu in https://github.com/napi-rs/napi-rs/pull/2125
- chore(example): remove JsFunction from example by @richerfu in https://github.com/napi-rs/napi-rs/pull/2123
- chore(napi): make Ser and De public by @Gentle in https://github.com/napi-rs/napi-rs/pull/2131
- chore(deps): update dependency @rollup/plugin-commonjs to v26 by @renovate in https://github.com/napi-rs/napi-rs/pull/2132
- Add windows gnu target by @Kreijstal in https://github.com/napi-rs/napi-rs/pull/2026
- chore(deps): lock file maintenance by @renovate in https://github.com/napi-rs/napi-rs/pull/2129
- chore(deps): update dependency oxlint to ^0.4.0 by @renovate in https://github.com/napi-rs/napi-rs/pull/2126
- chore(deps): update yarn to v4.3.0 by @renovate in https://github.com/napi-rs/napi-rs/pull/2135
- fix(cli): rename env CC to TARGET_CC avoid proc-macro build failed by @richerfu in https://github.com/napi-rs/napi-rs/pull/2137
- chore(deps): update dependency electron to v31 by @renovate in https://github.com/napi-rs/napi-rs/pull/2136
- chore(deps): update dependency c8 to v10 by @renovate in https://github.com/napi-rs/napi-rs/pull/2134
- fix(napi): JsString should respect \0 character to align with String by @richerfu in https://github.com/napi-rs/napi-rs/pull/2138
- feat(error): print anyhow error in debug mode to show trace by @ozgrakkurt in https://github.com/napi-rs/napi-rs/pull/2140
- chore: clippy fix by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2144
- chore(deps): update docker/build-push-action action to v6 by @renovate in https://github.com/napi-rs/napi-rs/pull/2142
- Reduce monomorphization load of various functions by @seritools in https://github.com/napi-rs/napi-rs/pull/2143
- fix(deps): update dependency @octokit/rest to v21 by @renovate in https://github.com/napi-rs/napi-rs/pull/2149
- chore(deps): update yarn to v4.3.1 by @renovate in https://github.com/napi-rs/napi-rs/pull/2150
- chore(deps): update oven-sh/setup-bun action to v2 by @renovate in https://github.com/napi-rs/napi-rs/pull/2153
- test(napi): spwan thread in thread by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2139
- chore(napi): remove stale tokio feature by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2155
- chore(napi): exclude libuv api on wasm targets by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2156
- let docs.rs generate all documentation by @Gentle in https://github.com/napi-rs/napi-rs/pull/2160
- chore(deps): update dependency oxlint to ^0.5.0 by @renovate in https://github.com/napi-rs/napi-rs/pull/2159
New Contributors
- @magic-akari made their first contribution in https://github.com/napi-rs/napi-rs/pull/2117
- @Gentle made their first contribution in https://github.com/napi-rs/napi-rs/pull/2131
- @Kreijstal made their first contribution in https://github.com/napi-rs/napi-rs/pull/2026
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.0.0-alpha.55...napi@3.0.0-alpha.3
napi@2.16.7
6/26/2024
What changed
- feat(napi): implement ToNapiValue for Ref as required by TSFN by @richerfu #2122
- feat(napi): support External for compact mode by @richerfu #2125
- chore(napi): make Ser and De public by @Gentle #2131
- fix(napi): JsString should respect \0 character to align with String by @richerfu #2138
- feat(error): print anyhow error in debug mode to show trace by @ozgrakkurt #2140
- chore(napi): reduce monomorphization load of various functions by @seritools #2143
- chore(napi): remove stale tokio feature by @Brooooooklyn #2155
- chore(napi): exclude libuv api on wasm targets by @Brooooooklyn #2156
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.6...napi@2.16.7
napi@2.16.6
5/7/2024
What's Changed
- fix(napi): panic when deserializing empty buffer with Rust 1.78 by @mischnic in https://github.com/napi-rs/napi-rs/pull/2094
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.5...napi@2.16.6
napi@2.16.5
5/6/2024
What's Changed
- Fix panic in JsArrayBufferValue as_ref/as_mut with Rust 1.78 by @tronical in https://github.com/napi-rs/napi-rs/pull/2083
- fix(napi): make sure env without exception pending before throw error by @southorange0929 in https://github.com/napi-rs/napi-rs/pull/2092
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.4...napi@2.16.5
napi-derive@2.16.4
5/6/2024
What's Changed
- style: fix clippy errors by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2090
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.16.3...napi-derive@2.16.4
napi@2.16.4
4/18/2024
What changed
- feat(napi): allow user defined tokio runtime by @Brooooooklyn #2040
- fix(napi): handle panic in async block by @Brooooooklyn (https://github.com/napi-rs/napi-rs/pull/2050)
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.2...napi@2.16.4
napi-derive@2.16.3
4/18/2024
What Changed
- fix(napi-derive): bail the unexpected factory directive by @Brooooooklyn #2051
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.4...napi-derive@2.16.3
napi@3.0.0-alpha.2
4/15/2024
What's Changed
- feat(napi): allow
&Externalto be created from napi value by @sapphi-red in https://github.com/napi-rs/napi-rs/pull/2037 - fix(napi): ensure CalleeHandled works as expected by @lbarthon in https://github.com/napi-rs/napi-rs/pull/2039
- feat(napi): allow user defined tokio runtime by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2040
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.1...napi@3.0.0-alpha.2
napi@2.16.2
4/10/2024
What Changed
- fix(napi): create_bigint_from_*128 returned incorrect word_count by @sapphi-red in https://github.com/napi-rs/napi-rs/pull/2024
- fix(napi): napi_adjust_external_memory should be hidden with wasm target by @southorange0929 in https://github.com/napi-rs/napi-rs/pull/2031
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.1...napi@2.16.2
napi-sys@2.4.0
4/10/2024
What's Changed
- feat(napi-sys): support load Node-API symbols dynamically by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2014
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.1...napi-sys@2.4.0
napi-derive@2.16.2
4/10/2024
What's Changed
- feat(napi-derive): enhance the error messages in object validator by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2034
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.16.1...napi-derive@2.16.2
napi@3.0.0-alpha.1
4/10/2024
What's Changed
- chore(wasm-runtime): upgrade emnapi by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2008
- fix(napi): no panic when caller stops listening by @lbarthon in https://github.com/napi-rs/napi-rs/pull/2010
- style: clippy fix by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2012
- fix(napi): External should impl FromNapiRef rather than FromNapiValue by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2013
- feat(napi-sys): support load Node-API symbols dynamically by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2014
- fix(cli): wasi Node.js worker template by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2015
- fix(deps): update dependency emnapi to v1.1.1 by @renovate in https://github.com/napi-rs/napi-rs/pull/2017
- chore(deps-dev): bump vite from 5.1.4 to 5.1.7 by @dependabot in https://github.com/napi-rs/napi-rs/pull/2025
- fix:
create_bigint_from_*128returned incorrect word_count by @sapphi-red in https://github.com/napi-rs/napi-rs/pull/2024 - feat(target): add support for armv7-unknown-linux-muslebihf by @sapphi-red in https://github.com/napi-rs/napi-rs/pull/2019
- feat(target): add support for powerpc64le-unknown-linux-gnu by @sapphi-red in https://github.com/napi-rs/napi-rs/pull/2023
- feat(target): add support for s390x-unknown-linux-gnu by @sapphi-red in https://github.com/napi-rs/napi-rs/pull/2028
- docs: update platform support in README by @sapphi-red in https://github.com/napi-rs/napi-rs/pull/2029
- chore(deps): lock file maintenance by @renovate in https://github.com/napi-rs/napi-rs/pull/2018
- feat(cli): support wasm32-wasipxx targets by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2030
- chore: use oxlint by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2032
- fix(napi): napi_adjust_external_memory should be hidden with wasm target by @southorange0929 in https://github.com/napi-rs/napi-rs/pull/2031
- ci: fix flaky tests by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2033
- feat(napi-derive): enhance the error messages in object validator by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2034
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@3.0.0-alpha.0...napi@3.0.0-alpha.1
napi@2.16.1
3/26/2024
What's Changed
- fix(napi): remove useless FromNapiValue bound check for ValidateNapiValue by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1999
- feat(napi): support to use tuple with either by @h-a-n-a in https://github.com/napi-rs/napi-rs/pull/1993
- feat(napi): implement
From StringforBufferby @lbarthon in https://github.com/napi-rs/napi-rs/pull/2002
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.0...napi@2.16.1
napi-derive@2.16.1
3/26/2024
What's Changed
- feat(napi-derive): add optional enum_string case conversion by @andrewtoth in https://github.com/napi-rs/napi-rs/pull/1995
New Contributors
- @andrewtoth made their first contribution in https://github.com/napi-rs/napi-rs/pull/1995
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.16.0...napi-derive@2.16.1
napi@3.0.0-alpha.0
3/20/2024
What's Changed
- fix(napi): remove useless FromNapiValue bound check for ValidateNapiValue by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1999
- feat(napi-derive): add optional enum_string case conversion by @andrewtoth in https://github.com/napi-rs/napi-rs/pull/1995
- feat(napi): support to use tuple with either by @h-a-n-a in https://github.com/napi-rs/napi-rs/pull/1993
- feat(napi): implement
From StringforBufferby @lbarthon in https://github.com/napi-rs/napi-rs/pull/2002 - feat(napi): support
Returngeneric of ThreadsafeFunction by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1997 - chore(napi): add Send and Sync to Reference by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/2007
New Contributors
- @andrewtoth made their first contribution in https://github.com/napi-rs/napi-rs/pull/1995
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.16.0...napi@3.0.0-alpha.0
napi@2.16.0
2/28/2024
What's Changed
- feat(napi): allow Reference as a class method param by @lbarthon in https://github.com/napi-rs/napi-rs/pull/1966
- fix(napi): remove useless create_reference in slice => TypedArray impl by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1975
- feat(napi): impl chained Into for TypedArray types by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1978
- feat(napi): impl BufferSlice and Uint8ClampedSlice by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1979
- fix(napi): add back the typecheck logic that was accidentally removed in Object::get_named_property by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1982
New Contributors
- @sup39 made their first contribution in https://github.com/napi-rs/napi-rs/pull/1971
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.15.4...napi@2.16.0
napi-derive@2.16.0
2/28/2024
What's Changed
- feat(napi-derive): add use_nullable attribute by @sup39 in https://github.com/napi-rs/napi-rs/pull/1971
- style(napi-derive): clippy fix by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1976
- fix(napi-derive): HashMap/IndexMap and slice generated types by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1977
- fix(napi-derive): wrong dependency condition by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1980
New Contributors
- @sup39 made their first contribution in https://github.com/napi-rs/napi-rs/pull/1971
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.15.4...napi-derive@2.16.0
napi@2.15.4
2/22/2024
What's Changed
- fix(napi): no hard fail on ThreadsafeFunction::call_async by @lbarthon in https://github.com/napi-rs/napi-rs/pull/1970
- fix(napi): JsObject.add_finalizer callback being allowed to reference non-static things by @tomb-msft in https://github.com/napi-rs/napi-rs/pull/1968
New Contributors
- @tomb-msft made their first contribution in https://github.com/napi-rs/napi-rs/pull/1968
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.15.3...napi@2.15.4
napi@2.15.3
2/21/2024
What's Changed
- fix: remove outdated rustdoc about tokio channels by @lbarthon in https://github.com/napi-rs/napi-rs/pull/1961
- fix(Buffer): prevent memory leak when Custom GC is used by @lbarthon in https://github.com/napi-rs/napi-rs/pull/1963
New Contributors
- @lbarthon made their first contribution in https://github.com/napi-rs/napi-rs/pull/1961
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-build@2.1.1...napi@2.15.3
napi-build@2.1.1
2/18/2024
What's Changed
- feat(cli,build): support setjmp.h by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1958
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.15.2...napi-build@2.1.1
napi@2.15.2
2/17/2024
What's Changed
- feat(napi): extends the Map types interoperability by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1950
- feat(napi): accept slice as TypedArray by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1951
- style: apply clippy fix by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1953
- fix(napi): memory leak while using Reference by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1954
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.0.0-alpha.38...napi@2.15.2
napi-derive@2.15.1
2/8/2024
What's Changed
- fix(napi-derive): serde Number typing by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1941
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.15.1...napi-derive@2.15.1
napi@2.15.1
2/1/2024
What's Changed
- fix(napi): Fix buffer corruption and soundness issues by @Janrupf in https://github.com/napi-rs/napi-rs/pull/1923
- fix(napi): in "Object::get", return null values wrapped in a "Some" by @jkomyno in https://github.com/napi-rs/napi-rs/pull/1934
New Contributors
- @Janrupf made their first contribution in https://github.com/napi-rs/napi-rs/pull/1923
- @jkomyno made their first contribution in https://github.com/napi-rs/napi-rs/pull/1934
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.15.0...napi@2.15.1
napi@2.15.0
1/26/2024
What's Changed
- fix(napi): callback in execute_tokio_future does not need to be Send by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1917
- feat(napi): new Function/FunctionRef API by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1913
- chore(napi): delete unwrap_from_ref API because it was never work by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1915
- fix(napi): memory issue while creating external buffer on electron by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1921
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.14.4...napi@2.15.0
napi-derive@2.15.0
1/26/2024
What's Changed
- feat(napi): new Function/FunctionRef API by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1913
- fix(napi-derive): JsArrayBuffer generated type by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1922
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.14.6...napi-derive@2.15.0
napi@2.14.4
1/24/2024
What's changed
- fix(napi): future in block_on do not need to be send @Brooooooklyn https://github.com/napi-rs/napi-rs/commit/e3322706981414dbdbde0a5021cab1d5f9144620
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.14.3...napi@2.14.4
napi@2.14.3
1/24/2024
What's Changed
- fix(napi): block_on type by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1911
- chore(napi): expose spawn_blocking on tokio runtime by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1912
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.0.0-alpha.35...napi@2.14.3
napi@2.14.2
12/31/2023
What's Changed
- test(napi): decrease the worker sizes on Linux x64 musl platform by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1823
- fix(napi): apply clippy suggestions by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1878
- chore(napi): add status to error messages in AsyncWork by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1880
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.14.1...napi@2.14.2
napi-derive@2.14.6
12/27/2023
What's Changed
- fix(napi-derive): proc-macro crash on enum by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1870
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.14.5...napi-derive@2.14.6
napi-derive@2.14.5
12/27/2023
What's Changed
- fix(napi-derive): catch_unwind on constructor by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1869
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.0.0-alpha.24...napi-derive@2.14.5
napi-derive@2.14.4
12/13/2023
What's Changed
- fix(napi-derive): upgrade syn by @forehalo in https://github.com/napi-rs/napi-rs/pull/1849
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.14.3...napi-derive@2.14.4
napi-derive@2.14.3
12/11/2023
What's Changed
- fix(napi-derive,cli): register function cross crates by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1848
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.0.0-alpha.15...napi-derive@2.14.3
napi@2.14.1
11/20/2023
What's Changed
- style(napi): clippy fix by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1815
- fix(napi): cargo doc build by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1819
- fix(napi): compile error for wasm32-unknown-unknown target by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1822
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.14.0...napi@2.14.1
napi-derive@2.14.2
11/20/2023
What's Changed
- fix(napi-derive): compile warning by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1820
- fix(napi): compile error for wasm32-unknown-unknown target by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1822
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.14.1...napi-derive@2.14.2
napi-derive@2.14.1
11/8/2023
What's Changed
- fix(napi-derive): async task void output type by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1795
- fix(napi-derive): async task optional output type by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1796
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-sys@2.3.0...napi-derive@2.14.1
napi@2.14.0
11/7/2023
What's Changed
- throw is not a valid identifier when generating getters and setters by @yoogoc in https://github.com/napi-rs/napi-rs/pull/1701
- style: clippy fix by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1711
- feat(napi,sys): implement Symbol.for by @tom-sherman in https://github.com/napi-rs/napi-rs/pull/1721
- build: Docker arm64 platform by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1731
- test: aginst bun by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1730
- chore(napi): make napi_register_module_v1 pub by @MarkusJx in https://github.com/napi-rs/napi-rs/pull/1747
- feat: bump msrv to 1.65 by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1755
- chore(cli): update ci template by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1771
- test: reduce memory usage while testing aginst worker thread by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1769
- Integrate with emnapi by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1669
- fix(napi): potential double free issue by @kuzeyardabulut in https://github.com/napi-rs/napi-rs/pull/1679
- feat(napi): impl Default for Buffer by @ozgrakkurt in https://github.com/napi-rs/napi-rs/pull/1734
- fix(napi-derive): import FromNapiValue and ToNapiValue from napi::bindgen_prelude when generating an enum by @jzeuzs in https://github.com/napi-rs/napi-rs/pull/1713
- fix(napi): asan caught memory safety issue by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1776
- feat(napi): support async class factory by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1779
- feat(napi,sys): sync to napi9 by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1781
- feat: add experimental Env::get_module_file_name method by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1783
- test(napi): add tests for napi9 features by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1784
- style(napi): fix compile warning by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1785
- style(napi): as ptr => ptr::cast by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1786
- fix(napi): add tokio cleanup hook for more platforms by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1790
- fix(build): rerun if cli version changed by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1789
- feat(napi): pass the rest of async tests by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1792
New Contributors
- @yoogoc made their first contribution in https://github.com/napi-rs/napi-rs/pull/1701
- @tom-sherman made their first contribution in https://github.com/napi-rs/napi-rs/pull/1721
- @kuzeyardabulut made their first contribution in https://github.com/napi-rs/napi-rs/pull/1679
- @RaphaelDarley made their first contribution in https://github.com/napi-rs/napi-rs/pull/1716
- @ozgrakkurt made their first contribution in https://github.com/napi-rs/napi-rs/pull/1734
- @jzeuzs made their first contribution in https://github.com/napi-rs/napi-rs/pull/1713
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.13.3...napi@2.14.0
napi-sys@2.3.0
11/7/2023
What's Changed
- fix(napi-sys): missing napi9 load on Windows by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1780
- feat(napi,sys): sync to napi9 by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1781
napi-derive@2.14.0
11/7/2023
What's Changed
- fix(napi-derive): throw is not a valid identifier when generating getters and setters by @yoogoc in https://github.com/napi-rs/napi-rs/pull/1701
- feat: integrate with emnapi, support wasm32-wasi-preview1-threads target by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1669
napi@2.13.3
8/16/2023
What's Changed
- Fix promise resolve error by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1664
- feat(napi): impl FromNapiValue for HashMap with custom hasher by @arucil in https://github.com/napi-rs/napi-rs/pull/1682
New Contributors
- @H4ad made their first contribution in https://github.com/napi-rs/napi-rs/pull/1660
- @arucil made their first contribution in https://github.com/napi-rs/napi-rs/pull/1682
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.0.0-alpha.5...napi@2.13.3
napi@2.13.2
6/14/2023
What's Changed
- docs(README): update platform support status by @kxxt in https://github.com/napi-rs/napi-rs/pull/1607
- chore(deps): update dependency electron to v25 by @renovate in https://github.com/napi-rs/napi-rs/pull/1610
- chore(deps): lock file maintenance by @renovate in https://github.com/napi-rs/napi-rs/pull/1612
- chore(deps): update yarn to v3.6.0 by @renovate in https://github.com/napi-rs/napi-rs/pull/1614
- chore: remove extra #[cfg] attribute by @aqrln in https://github.com/napi-rs/napi-rs/pull/1616
- chore(deps): update dependency electron to v25.1.0 by @renovate in https://github.com/napi-rs/napi-rs/pull/1617
- fix(napi): impl send + sync for ThreadsafeFunction by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1622
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.13.1...napi@2.13.2
napi@2.13.1
5/27/2023
What's Changed
- fix(napi): missing ValidateNapiValue for JsObject by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1606
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.13.0...napi@2.13.1
napi@2.13.0
5/27/2023
What's Changed
- feat(target): add support for riscv64gc-unknown-linux-gnu by @kxxt in https://github.com/napi-rs/napi-rs/pull/1599
- feat(napi): support chrono::NaiveDateTime by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1601
- feat(cli): detect Cargo --profile argument by @lucasfernog in https://github.com/napi-rs/napi-rs/pull/1598
New Contributors
- @kxxt made their first contribution in https://github.com/napi-rs/napi-rs/pull/1599
- @lucasfernog made their first contribution in https://github.com/napi-rs/napi-rs/pull/1598
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.12.7...napi@2.13.0
napi@2.12.7
5/20/2023
What's Changed
- chore(deps): update dependency electron to v24.1.3 by @renovate in https://github.com/napi-rs/napi-rs/pull/1578
- chore(deps): update yarn to v3.5.1 by @renovate in https://github.com/napi-rs/napi-rs/pull/1579
- chore(deps): update dependency electron to v24.2.0 by @renovate in https://github.com/napi-rs/napi-rs/pull/1580
- feat(cli): add --use-cross command for building with
crossby @Boshen in https://github.com/napi-rs/napi-rs/pull/1584 - chore(deps): update dependency @rollup/plugin-commonjs to v25 by @renovate in https://github.com/napi-rs/napi-rs/pull/1588
- chore(deps): update dependency electron to v24.3.0 by @renovate in https://github.com/napi-rs/napi-rs/pull/1587
- chore(example): add callback return promise by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1590
- chore(deps): update dependency electron to v24.3.1 by @renovate in https://github.com/napi-rs/napi-rs/pull/1593
- feat(napi): Bigint deserialization by @JanisGailis in https://github.com/napi-rs/napi-rs/pull/1592
New Contributors
- @Boshen made their first contribution in https://github.com/napi-rs/napi-rs/pull/1584
- @JanisGailis made their first contribution in https://github.com/napi-rs/napi-rs/pull/1592
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.12.5...napi@2.12.7
napi-derive@2.12.5
4/26/2023
What's Changed
- fix(napi-derive): increase initial ref count in async fn by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1577
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.12.4...napi-derive@2.12.5
napi@2.12.6
4/25/2023
What's Changed
- chore(napi): adds support for
Rc / Arc / Mutexby @arcanis in https://github.com/napi-rs/napi-rs/pull/1573
New Contributors
- @arcanis made their first contribution in https://github.com/napi-rs/napi-rs/pull/1573
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.12.5...napi@2.12.6
napi-derive@2.12.4
4/25/2023
What's Changed
- feat: clean napi-derive noop feature code path by @forehalo in https://github.com/napi-rs/napi-rs/pull/1571
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.12.5...napi-derive@2.12.4
napi@2.12.5
4/16/2023
What's Changed
- fix(deps): update rust crate libloading to 0.8 by @renovate in https://github.com/napi-rs/napi-rs/pull/1563
- fix(napi): thread safe issue while creating class instance by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1561
- chore(deps): update dependency electron to v24.1.2 by @renovate in https://github.com/napi-rs/napi-rs/pull/1562
- fix(napi): do nothing in deferred if thread is destroyed by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1568
- test(napi): skip worker tests in slow Docker env by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1569
New Contributors
- @renovate made their first contribution in https://github.com/napi-rs/napi-rs/pull/1563
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.12.4...napi@2.12.5
napi@2.12.4
4/11/2023
What's Changed
- chore: fix js binding template style by @suyanhanx in https://github.com/napi-rs/napi-rs/pull/1550
- fix(napi): access violation in property getter/setter closure by @MarkusJx in https://github.com/napi-rs/napi-rs/pull/1552
- fix: prevent crashing when
napi_register_module_v1is called twice by @aqrln in https://github.com/napi-rs/napi-rs/pull/1554 - ci: remove deprecated action by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1555
- fix(napi): re-throw error in
ThreadsafeFunctioncallback if we could by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1556 - chore(napi): add
noopfeature in napi crate by @gaoquanzero in https://github.com/napi-rs/napi-rs/pull/1546 - chore: upgrade npm dependencies by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1557
- fix(napi):
noopfeature by @Brooooooklyn https://github.com/napi-rs/napi-rs/commit/070230079d75fd72b661208a45eaecaa0ce0a43f
New Contributors
- @aqrln made their first contribution in https://github.com/napi-rs/napi-rs/pull/1554
- @gaoquanzero made their first contribution in https://github.com/napi-rs/napi-rs/pull/1546
- @suyanhanx made their first contribution in https://github.com/napi-rs/napi-rs/pull/1550
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.12.2...napi@2.12.4
napi-derive@2.12.3
4/11/2023
Core features
#[napi(string_enum)]
pub enum Status {
Pristine,
Loading,
Ready,
}
⬇️⬇️⬇️⬇️⬇️
export const enum Status {
Pristine = 'Pristine',
Loading = 'Loading',
Ready = 'Ready'
}
What's Changed
- feat(napi-derive): add support for string enums by @nebarf in https://github.com/napi-rs/napi-rs/pull/1551
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.12.2...napi-derive@2.12.3
napi@2.12.2
3/30/2023
What's Changed
- Ensure
tokioruntime exists when registering the module by @meowtec in https://github.com/napi-rs/napi-rs/pull/1542 - Ensure that
napi_call_threadsafe_functioncannot be called after abort by @meowtec in https://github.com/napi-rs/napi-rs/pull/1533 - test(napi): update test case for checking electron renderer crash by @meowtec in https://github.com/napi-rs/napi-rs/pull/1547
- fix(napi): use
ptr::copyto createTypedArrayin electron fallback mode by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1548 - fix(napi): free buffer in the current thread if env is available by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1549
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.12.1...napi@2.12.2
napi@2.12.1
3/23/2023
What's Changed
- fix(napi): big numbers losing precision on serde_json::Value by @ceifa in https://github.com/napi-rs/napi-rs/pull/1538
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.12.2...napi@2.12.1
napi-derive@2.12.2
3/22/2023
What's Changed
- fix(cli,napi-derive): backward compatible with older cli with #1531 by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1536
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.12.1...napi-derive@2.12.2
napi@2.12.0
3/21/2023
What's Changed
- chore(napi): upgrade bitflags to v2 by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1518
- fix(napi): use weak arc for passing
thread_finalize_databy @meowtec in https://github.com/napi-rs/napi-rs/pull/1525 - fix(napi):
ThreadsafeFunctionHandlenever being dropped by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1530 - feat: export registers in wasm32 target by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1529
- feat(napi): property getter and setter with closure by @victorteokw in https://github.com/napi-rs/napi-rs/pull/1526
New Contributors
- @meowtec made their first contribution in https://github.com/napi-rs/napi-rs/pull/1525
- @nebarf made their first contribution in https://github.com/napi-rs/napi-rs/pull/1527
- @victorteokw made their first contribution in https://github.com/napi-rs/napi-rs/pull/1526
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.11.4...napi@2.12.0
napi-derive@2.12.1
3/21/2023
What's Changed
- fix(cli,napi-derive): re-export types from shared crate by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1531
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.12.0...napi-derive@2.12.1
napi-derive@2.12.0
3/21/2023
What's Changed
- feat: export registers in wasm32 target by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1529
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.11.4...napi-derive@2.12.0
napi@2.11.4
3/14/2023
What's Changed
- fix(napi): prevent access to tsfn-raw after env's destroyed(#1514) by @HotQ in https://github.com/napi-rs/napi-rs/pull/1515
New Contributors
- @HotQ made their first contribution in https://github.com/napi-rs/napi-rs/pull/1515
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.11.3...napi@2.11.4
napi@2.11.3
3/14/2023
What's Changed
- fix(napi): display should be implemented on error generics with
Debugby @h-a-n-a in https://github.com/napi-rs/napi-rs/pull/1497 - feat(napi): expose
uv_runby @MarkusJx in https://github.com/napi-rs/napi-rs/pull/1499 - test(napi): tests for custom gc in worker_threads by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1505
- chore(napi): remove thread_local from dependenies by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1506
- build: add libc++ in aarch64-linux-gnu Docker by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1511
- chore: ci components upgrade by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1512
- fix(napi): panic when
Promisecallbacks trigger after Promise is dropped by @pose in https://github.com/napi-rs/napi-rs/pull/1516
New Contributors
- @MarkusJx made their first contribution in https://github.com/napi-rs/napi-rs/pull/1499
- @pose made their first contribution in https://github.com/napi-rs/napi-rs/pull/1516
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.11.1...napi@2.11.3
napi-derive@2.11.2
3/14/2023
What's Changed
- chore(napi-derive): remove thread_local from dependenies by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1506
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.11.1...napi-derive@2.11.2
napi@2.11.2
2/18/2023
What's Changed
- fix(napi): error should be
Send Syncconditionally by @h-a-n-a in https://github.com/napi-rs/napi-rs/pull/1487
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.11.1...napi@2.11.2
napi-derive@2.11.1
2/18/2023
Changes
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@2.14.8...napi-derive@2.11.1
napi@2.11.1
2/9/2023
Error::new API enhancement
Error::new now support passing status: AsRef<str> and message: ToString
pub enum CustomError {
NapiError(Error<Status>),
Panic,
}
impl AsRef<str> for CustomError {
fn as_ref(&self) -> &str {
match self {
CustomError::Panic => "Panic",
CustomError::NapiError(e) => e.status.as_ref(),
}
}
}
#[napi]
pub fn custom_status_code() -> Result<(), CustomError> {
Err(Error::new(CustomError::Panic, "don't panic"))
}
test('custom status code in Error', (t) => {
t.throws(() => customStatusCode(), {
code: 'Panic',
})
})
What's Changed
- fix(napi): support custom status in Error by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1486
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.11.0...napi@2.11.1
napi@2.11.0
2/8/2023
Spread tuple arguments in ThreadsafeFunction
#[napi]
pub fn accept_threadsafe_function_tuple_args(func: ThreadsafeFunction<(u32, bool, String)>) {
thread::spawn(move || {
func.call(
Ok((1, false, "NAPI-RS".into())),
ThreadsafeFunctionCallMode::NonBlocking,
);
});
}
⬇️⬇️⬇️⬇️⬇️⬇️⬇️
export function acceptThreadsafeFunctionTupleArgs(func: (err: Error | null, arg0: number, arg1: boolean, arg2: string) => any): void
What's Changed
- feat(napi): convert
ToNapiValuetuple to variadic tsfn by @h-a-n-a #1475 - fix(napi): convert u64 to u32 in serialization by @m1212e in https://github.com/napi-rs/napi-rs/pull/1478
New Contributors
- @m1212e made their first contribution in https://github.com/napi-rs/napi-rs/pull/1478
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.10.17...napi@2.11.0
napi@2.10.17
2/8/2023
What's Changed
- fix(napi): impl Send Sync to External by @Brooooooklyn
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.10.16...napi@2.10.17
napi@2.10.16
2/7/2023
What's Changed
- fix(napi): dropping Error should not call sys if feature is set to noop by @h-a-n-a in https://github.com/napi-rs/napi-rs/pull/1477
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.10.15...napi@2.10.16
napi@2.10.15
2/5/2023
What's Changed
- build(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 by @dependabot in https://github.com/napi-rs/napi-rs/pull/1472
- chore(napi): enhance the error messages while converting types failed by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1473
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@2.14.6...napi@2.10.15
napi@2.10.14
1/31/2023
What's Changed
- fix(napi): run_script return type by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1467
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.10.13...napi@2.10.14
napi-derive@2.10.1
1/31/2023
What's Changed
- fix(napi-derive): incorrect Task output type in some cases by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1466
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.10.0...napi-derive@2.10.1
napi@2.10.13
1/28/2023
What's Changed
- fix(napi): also apply electron external data fallback to lowlevel APIs by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1458
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.10.12...napi@2.10.13
napi@2.10.12
1/28/2023
What's Changed
- fix(napi): add missing NoExternalBuffersAllowed by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1457
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.10.11...napi@2.10.12
napi@2.10.11
1/25/2023
What's Changed
- fix(napi): fallback to copy arraybuffer if zero copy is not allowed by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1455
Background
Electron disallowed the create_external_xxx API since electron@21: https://www.electronjs.org/blog/v8-memory-cage
NAPI-RS will fallback to use create_buffer_copy if napi_create_external_buffer return the napi_no_external_buffers_allowed status.
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.10.10...napi@2.10.11
napi@2.10.10
1/24/2023
What's Changed
- chore(napi): implement FromNapiValue for ThreadsafeFunction by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1447
- fix(napi): throw fatal error if cast return value failed by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1450
- fix(napi): add UnknownReturnValue to use in call_async scenario by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1451
- fix(napi): unhandled promise rejection while using
EitherN<Promise<..>>by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1452
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@2.14.4...napi@2.10.10
napi-derive@2.10.0
1/24/2023
Highlights
ThreadsafeFunction as params and object fields
#[napi]
pub fn accept_callback(callback: ThreadsafeFunction<u32>) {
std::thread::spawn(move || {
callback.call(200);
});
}
⬇️⬇️⬇️⬇️⬇️
export function acceptCallback(callback: (err: Error | null, value: number) -> any)
Disable ToNapiValue for Object
With the object_to_js = false filed, the ThreadsafeFunction could be set as an Object field.
#[napi(object, object_to_js = false)]
pub struct Options {
pub enable_jsx: bool,
pub on_data: ThreadsafeFunction<Vec<u8>>,
}
What's Changed
- feat(napi-derive): generate ThreadsafeFunction types by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1449
- feat(napi-derive): allow partial implement From/To Napivalue for Object by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1448
- chore(napi-derive): allow unsafe async &mut self by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1453
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@2.14.4...napi-derive@2.10.0
napi@2.10.9
1/19/2023
What's Changed
- fix(napi): fallback to copy buffer if zero-copy is not allowed by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1445
Background
Electron disallowed the create_external_xxx API since electron@21: https://www.electronjs.org/blog/v8-memory-cage
NAPI-RS will fallback to use create_buffer_copy if napi_create_external_buffer return the napi_no_external_buffers_allowed status.
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.10.8...napi@2.10.9
napi-sys@2.2.3
1/19/2023
What's Changed
- chore(sys): add
napi_no_external_buffers_allowedtoStatusby @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1445
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.10.8...napi-sys@2.2.3
napi@2.10.8
1/18/2023
What's Changed
- fix(napi): remove useless aquire while creating ThreadsafeFunction by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1442
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.10.7...napi@2.10.8
napi@2.10.7
1/16/2023
What's Changed
- fix(napi): missing From implementation for Bigint by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1440
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.9.5...napi@2.10.7
napi-derive@2.9.5
1/14/2023
What's Changed
- fix(napi-derive): fix union type generation for ts function notation by @h-a-n-a in https://github.com/napi-rs/napi-rs/pull/1439
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@2.14.3...napi-derive@2.9.5
napi-derive@2.9.4
1/13/2023
What's Changed
- fix(napi-derive): remove ts type on field attrs for feature
noopby @h-a-n-a in https://github.com/napi-rs/napi-rs/pull/1436
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.10.6...napi-derive@2.9.4
napi@2.10.6
1/11/2023
What's Changed
- fix(napi): delete reference should be after global custom gc by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1433
- feat(napi): refactor ThreadsafeFunction to allow get return value of it by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1427
- fix(napi): should correctly return while dropping Buffer by @iheyunfei in https://github.com/napi-rs/napi-rs/pull/1434
New Contributors
- @iheyunfei made their first contribution in https://github.com/napi-rs/napi-rs/pull/1434
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@2.14.2...napi@2.10.6
napi@2.10.5
1/9/2023
What's Changed
- build(deps): bump json5 from 1.0.1 to 1.0.2 by @dependabot in https://github.com/napi-rs/napi-rs/pull/1418
- Fix ArrayBuffer memory leak by @overlookmotel in https://github.com/napi-rs/napi-rs/pull/1420
- test(napi): remove outdated assersion by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1423
- fix(napi): array buffer drop notify never be called in cloned buffer by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1424
New Contributors
- @overlookmotel made their first contribution in https://github.com/napi-rs/napi-rs/pull/1420
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.10.4...napi@2.10.5
napi@2.10.4
12/29/2022
What's Changed
- test: Memory leak reproduction for futures by @SevInf in https://github.com/napi-rs/napi-rs/pull/1413
- Fix promise leak by @xiaopengli89 in https://github.com/napi-rs/napi-rs/pull/1403
- Delete reference by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1414
New Contributors
- @SevInf made their first contribution in https://github.com/napi-rs/napi-rs/pull/1413
- @xiaopengli89 made their first contribution in https://github.com/napi-rs/napi-rs/pull/1403
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@2.14.0...napi@2.10.4
napi@2.10.3
12/19/2022
What's Changed
- fix(napi): napi_create_async_work incorrect argument (napi-rs#1392) by @patrickpilch in https://github.com/napi-rs/napi-rs/pull/1396
- chore(napi): add "run_script" for "Env" by @F001 in https://github.com/napi-rs/napi-rs/pull/1393
- chore(napi): reduce Mutex usage while loading addon by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1395
- fix(napi): add back custom gc for Send Buffer by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1399
New Contributors
- @patrickpilch made their first contribution in https://github.com/napi-rs/napi-rs/pull/1396
- @F001 made their first contribution in https://github.com/napi-rs/napi-rs/pull/1393
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.10.2...napi@2.10.3
napi-derive@2.9.3
12/9/2022
What's Changed
- Better error message for
#[napi(catch_unwind)]by @simonvandel in https://github.com/napi-rs/napi-rs/pull/1383
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.9.2...napi-derive@2.9.3
napi@2.10.2
12/8/2022
What's Changed
- build: focal->jammy, llvm-14->llvm-15 by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1369
- Fixes #1338 use after free with async, and fixes #1340 by @Xaeroxe in https://github.com/napi-rs/napi-rs/pull/1339
- chore(napi-derive): make_ref tweaks by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1371
- Bug fix: typed arrays ref shouldn't use offset. by @nihohit in https://github.com/napi-rs/napi-rs/pull/1376
New Contributors
- @nihohit made their first contribution in https://github.com/napi-rs/napi-rs/pull/1376
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@2.13.0...napi@2.10.2
napi@2.10.1
11/12/2022
What's Changed
- fix(napi): BigInt::get_u64 lossless check by @Wodann in https://github.com/napi-rs/napi-rs/pull/1348
- chore(napi): including type message in error message by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1350
- fix(cli): support help command by @ahaoboy in https://github.com/napi-rs/napi-rs/pull/1355
- ci: test for zig 0.10 by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1360
New Contributors
- @ahaoboy made their first contribution in https://github.com/napi-rs/napi-rs/pull/1355
- @SASUKE40 made their first contribution in https://github.com/napi-rs/napi-rs/pull/1364
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.10.0...napi@2.10.1
napi@2.10.0
10/4/2022
What's Changed
- chore: fix ci for forked repo by @h-a-n-a in https://github.com/napi-rs/napi-rs/pull/1302
- ci: add arm64 macOS CI by @messense in https://github.com/napi-rs/napi-rs/pull/1313
- fix(napi): improve error propagation by @devongovett in https://github.com/napi-rs/napi-rs/pull/1303
- fix(napi): propagation error in function call by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1315
- fix(napi): should also delete the reference while dropping the Buffer by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1331
- fix(napi): make Buffer/ArrayBuffer truely Send/Sync safe by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1332
- feat(napi): add threadsafe deferred values by @devongovett in https://github.com/napi-rs/napi-rs/pull/1306
New Contributors
- @Wodann made their first contribution in https://github.com/napi-rs/napi-rs/pull/1300
- @usrtax made their first contribution in https://github.com/napi-rs/napi-rs/pull/1317
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.9.1...napi@2.10.0
napi@2.9.1
9/8/2022
What's Changed
- fix(napi): remove previous reference if value_ref existed by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1290
- fix(napi): some of the unsoundness in
Bufferby @seritools in https://github.com/napi-rs/napi-rs/pull/1294
New Contributors
- @mat-if made their first contribution in https://github.com/napi-rs/napi-rs/pull/1293
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.9.0...napi@2.9.1
napi-derive@2.9.1
9/8/2022
What's Changed
- fix(napi-derive): should not generate this types for Constructor/Getter/Setter by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1291
- pin minimum usable version of dependency syn by @mat-if in https://github.com/napi-rs/napi-rs/pull/1293
New Contributors
- @mat-if made their first contribution in https://github.com/napi-rs/napi-rs/pull/1293
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.9.0...napi-derive@2.9.1
napi@2.9.0
8/23/2022
Core changes
as_object for ClassInstance
You can use the ClassInstance as Object on the Rust side and manipulate it.
#[napi]
impl CanvasElement {
#[napi(constructor)]
pub fn new(mut env: Env, mut this: This, width: u32, height: u32) -> Result<Self> {
let ctx = CanvasRenderingContext2D::into_instance(
CanvasRenderingContext2D {
context: Context::new(width, height, ColorSpace::default())?,
},
env,
)?;
ctx.as_object(env).define_properties(&[
Property::new(FILL_STYLE_HIDDEN_NAME)?
.with_value(&env.create_string("#000")?)
.with_property_attributes(PropertyAttributes::Writable | PropertyAttributes::Configurable),
Property::new(STROKE_STYLE_HIDDEN_NAME)?
.with_value(&env.create_string("#000")?)
.with_property_attributes(PropertyAttributes::Writable | PropertyAttributes::Configurable),
])?;
env.adjust_external_memory((width * height * 4) as i64)?;
this.define_properties(&[Property::new("ctx")?
.with_value(&ctx)
.with_property_attributes(PropertyAttributes::Default)])?;
Ok(Self { width, height, ctx })
}
}
as_unknown for Either types
For the scenario that preserves original JavaScript values in Either types and sets them into object property, and retrieves it back in the other place.
#[napi(getter)]
pub fn get_fill_style(&self, this: This) -> Result<Unknown> {
this.get_named_property_unchecked(FILL_STYLE_HIDDEN_NAME)
}
#[napi(setter, return_if_invalid)]
pub fn set_fill_style(
&mut self,
env: Env,
mut this: This,
fill_style: Either3<JsString, ClassInstance<CanvasGradient>, ClassInstance<CanvasPattern>>,
) -> Result<()> {
// ... some logic
let raw_fill_style = fill_style.as_unknown(env);
this.set(FILL_STYLE_HIDDEN_NAME, &raw_fill_style)?;
Ok(())
}
ToNapiValue for f32
You can use f32 as the return type:
#[napi]
pub fn return_f32() -> f32 {
3.14
}
What's Changed
- fix(napi): segfault when
ThreadsafeFunction's callback closure captures data by @messense in https://github.com/napi-rs/napi-rs/pull/1281 - feat(napi): implement as_object and validate for ClassInstance by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1284
- feat(napi): implement as_unknown and validate for Either types by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1285
- feat(napi): implement ToNapiValue for f32 by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1286
New Contributors
- @JSerFeng made their first contribution in https://github.com/napi-rs/napi-rs/pull/1278
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.8.0...napi@2.9.0
napi-derive@2.9.0
8/23/2022
What's Changed
- fix(napi-derive): fix macro expansion naming shadow by @JSerFeng in https://github.com/napi-rs/napi-rs/pull/1278
- feat(napi-derive): catch_unwind attribute by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1280
New Contributors
- @JSerFeng made their first contribution in https://github.com/napi-rs/napi-rs/pull/1278
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.8.0...napi-derive@2.9.0
napi@2.8.0
8/17/2022
Core changes
Custom finalize trait
https://napi.rs/docs/concepts/class#custom-finalize-logic
use napi::bindgen_prelude::*;
use napi_derive::napi;
#[napi(custom_finalize)]
pub struct CustomFinalize {
width: u32,
height: u32,
inner: Vec<u8>,
}
#[napi]
impl CustomFinalize {
#[napi(constructor)]
pub fn new(mut env: Env, width: u32, height: u32) -> Result<Self> {
let inner = vec![0; (width * height * 4) as usize];
let inner_size = inner.len();
env.adjust_external_memory(inner_size as i64)?;
Ok(Self {
width,
height,
inner,
})
}
}
impl ObjectFinalize for CustomFinalize {
fn finalize(self, mut env: Env) -> Result<()> {
env.adjust_external_memory(-(self.inner.len() as i64))?;
Ok(())
}
}
Inject This in functions
https://napi.rs/docs/concepts/inject-this
use napi::bindgen_prelude::*;
use napi_derive::napi;
#[napi(constructor)]
pub struct Width {
pub value: i32,
}
#[napi]
pub fn plus_one(this: This<&Width>) -> i32 {
this.value + 1
}
instance of
https://napi.rs/docs/concepts/class#instance-of
use napi::bindgen_prelude::*;
use napi_derive::napi;
#[napi]
pub struct NativeClass {}
#[napi]
pub fn is_native_class_instance(env: Env, value: Unknown) -> Result<bool> {
NativeClass::instance_of(env, value)
}
import { NativeClass, isNativeClassInstance } from './index.js'
const nc = new NativeClass()
console.log(isNativeClassInstance(nc)) // true
console.log(isNativeClassInstance(1)) // false
What's Changed
- feat(napi): allow implement custom finalize logic for Class by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1270
- feat(napi): add get and get_mut method on
WeakReferenceby @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1274 - feat(napi):
error_anyhowfeature by @i-user-link in https://github.com/napi-rs/napi-rs/pull/1275
New Contributors
- @i-user-link made their first contribution in https://github.com/napi-rs/napi-rs/pull/1275
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.7.0...napi@2.8.0
napi-derive@2.8.0
8/17/2022
What's Changed
- feat(napi-derive): implement instance_of for Class by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1272
- feat(napi-derive): support inject
This<Value>into raw function by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1273
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.7.0...napi-derive@2.8.0
napi@2.7.0
8/7/2022
Core features
Set property attribute in napi macro
The Object property attribute in objects and Class created by NAPI-RS is Writable & Configurable & Enumerable by default now.
For NativeClass:
#[napi]
pub struct NativeClass {}
#[napi]
impl NativeClass {
#[napi]
pub fn hello(&self) {
println!("hello");
}
}
Before:
const instance = new NativeClass()
instance.hello = function() {} // Cannot assign to read only property \'hello\' of object \'#<NativeClass>\'
After:
const instance = new NativeClass()
instance.hello = function() {} // Just fine
You can also configure the Property attribute via #[napi]:
#[napi]
pub struct NativeClass {}
#[napi]
impl NativeClass {
#[napi(configurable = false, writable = false, enumerable = false)]
pub fn hello(&self) {
println!("hello");
}
}
What's Changed
- feat(napi): add some useful derived traits for the Null type by @Xaeroxe in https://github.com/napi-rs/napi-rs/pull/1241
- ci: fix self testing for Android platforms by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1248
- feat(napi): add derived traits to
ThreadsafeFunctionCallModeby @seritools in https://github.com/napi-rs/napi-rs/pull/1243 - feat(napi): Call sync functions within tokio runtime by @Xaeroxe in https://github.com/napi-rs/napi-rs/pull/1242
- fix(napi): either for #[napi(object)] types by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1258
New Contributors
- @amrbashir made their first contribution in https://github.com/napi-rs/napi-rs/pull/1251
- @seritools made their first contribution in https://github.com/napi-rs/napi-rs/pull/1243
napi-derive@2.7.0
8/7/2022
What's Changed
- feat(napi-derive): support set property attribute in napi macro by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1257
- feat(napi-derive): Support
#[napi(strict)]on&Tand&mut Tby @Hywan in https://github.com/napi-rs/napi-rs/pull/1238
napi@2.6.3
7/11/2022
What's Changed
- fix(napi): use Mutex instead of Atomic in ThreadsafeFunction by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1234
- fix(napi): memory leak in Buffer/ArrayBuffer by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1235
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.6.2...napi@2.6.3
napi@2.6.2
7/8/2022
What's Changed
- fix(napi)
undefinedis recognized as a validNoneforOption<T>by @Hywan in https://github.com/napi-rs/napi-rs/pull/1228 - fix(napi): memory leak in ThreadsafeFunction by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1230
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.6.1...napi@2.6.2
napi@2.6.1
7/6/2022
What's Changed
- fix(napi): drop buffer inner data only when Reference count is 0 by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1227
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.6.0...napi@2.6.1
napi@2.6.0
7/6/2022
What's Changed
- chore(napi): replace lazy_static with once_cell by @jplatte in https://github.com/napi-rs/napi-rs/pull/1213
- feat(napi) Implement
Either3toEither26. by @Hywan in https://github.com/napi-rs/napi-rs/pull/1200 - fix(napi): validate fn for
Option<T>by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1223 - feat(napi): clone reference for TypedArray/Buffer by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1224
New Contributors
- @jplatte made their first contribution in https://github.com/napi-rs/napi-rs/pull/1213
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@2.10.0...@napi-rs/cli@2.10.1
napi-derive@2.6.0
7/6/2022
What's Changed
- feat(napi-derive): support return_if_invalid by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1219
- feat(napi-derive): allow injecting this in class method by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1221
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.5.0...napi-derive@2.6.0
napi@2.5.0
6/10/2022
What's Changed
- Add
rust-versionfield toCargo.tomls by @messense in https://github.com/napi-rs/napi-rs/pull/1190 - feat(napi) Implement
ToNapiValuefor 8 and 16-bits numbers by @Hywan in https://github.com/napi-rs/napi-rs/pull/1195 - feat(napi) implement
From<Infallible>fornapi::Errorby @sunli829 in https://github.com/napi-rs/napi-rs/pull/1197 - feat(napi) Extend #1195 to
Vec. by @Hywan in https://github.com/napi-rs/napi-rs/pull/1198 - feat(napi): support into_instance in class struct by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1201
New Contributors
- @Hywan made their first contribution in https://github.com/napi-rs/napi-rs/pull/1195
- @sunli829 made their first contribution in https://github.com/napi-rs/napi-rs/pull/1197
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.4.3...napi@2.5.0
napi-derive@2.5.0
6/10/2022
What's Changed
- Add
rust-versionfield toCargo.tomls by @messense in https://github.com/napi-rs/napi-rs/pull/1190 - feat(napi-derive): add ts_arg_type attribute to override individual args on functions by @jose-acevedoflores in https://github.com/napi-rs/napi-rs/pull/1192
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.4.1...napi-derive@2.5.0
napi-build@2.0.1
6/10/2022
What's Changed
- fix: android builds broken by actions default ndk version bump by @forehalo in https://github.com/napi-rs/napi-rs/pull/1207
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-build@2.0.0...napi-build@2.0.1
napi@2.4.3
5/12/2022
What's Changed
- fix(napi): type constraint for either types by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1178
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.4.2...napi@2.4.3
napi@2.4.2
5/10/2022
What's Changed
- refactor(napi): remove
thread_local!usage by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1176 - test(napi): add electron test by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1176
- fix(napi): missing iterator implementation from class factory by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1177
Experimental
- feat(napi): add support for weak references by @devongovett in https://github.com/napi-rs/napi-rs/pull/1172
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.4.1...napi@2.4.2
napi-sys@2.2.2
5/10/2022
What's Changed
- fix(napi-sys): don't panic if
napi_*is failed to load by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1176
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-sys@2.2.1...napi-sys@2.2.2
napi@2.4.1
5/7/2022
What's Changed
- fix(napi): load Node-API symbols manually on Windows by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1169
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-sys@2.2.0...napi@2.4.1
napi@2.4.0
5/7/2022
What's Changed
- feat(napi): make Error::from_reason() generic by @bnoordhuis in https://github.com/napi-rs/napi-rs/pull/1159
- fix(napi): crash when process exits due to reference by @devongovett in https://github.com/napi-rs/napi-rs/pull/1161
- feat(napi):
IteratorSupport by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1166 - refactor(napi): use
libloadingon Windows by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1167
New Contributors
- @bnoordhuis made their first contribution in https://github.com/napi-rs/napi-rs/pull/1159
- @devongovett made their first contribution in https://github.com/napi-rs/napi-rs/pull/1161
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.3.3...napi@2.4.0
napi-sys@2.2.1
5/7/2022
What's Changed
- fix(napi-sys): load Node-API symbols manually on Windows by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1169
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-sys@2.2.0...napi-sys@2.2.1
napi-sys@2.2.0
5/7/2022
What's Changed
- Use
libloadingon Windows to avoid Windows i686 compiling issues and reduce crate size by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1167
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.3.3...napi-sys@2.2.0
napi-build@2.0.0
5/7/2022
What's Changed
BREAKING
- Use
libloadingon Windows, removenode-{arch}.libfiles innapi-buildby @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1167
You must use napi 2.4+ with the napi-build@2
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.3.3...napi-build@2.0.0
napi@2.3.3
4/27/2022
What's Changed
- fix(napi): use create_buffer/arrary_buffer if provided data is empty by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1147
- chore: upgrade dependencies by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1151
- chore: drop node 17, add node 18 by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1152
- chore(napi): upgrade windows crate by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1153
Experimental
- feat(napi): support return Reference on class instance by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1150
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.3.2...napi@2.3.3
napi-derive@2.3.3
4/27/2022
What's Changed
- fix(napi-derive): invalid TypeScript return type by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1155
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.3.2...napi-derive@2.3.3
napi-derive@2.3.2
4/27/2022
What's Changed
- fix(napi-derive): should transform struct case on Impl by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1148
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.3.1...napi-derive@2.3.2
napi@2.3.2
4/25/2022
What's Changed
- fix(napi): use null pointer for empty buffers by @mischnic in https://github.com/napi-rs/napi-rs/pull/1144
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.3.1...napi@2.3.2
napi-derive@2.3.1
4/25/2022
What's Changed
- Add build option to not include the header in dts file by @ceifa in https://github.com/napi-rs/napi-rs/pull/1140
- Simplify the optional values in generated declaration file by @ceifa in https://github.com/napi-rs/napi-rs/pull/1141
- Add u64 to BigInt conversion through From trait by @ceifa in https://github.com/napi-rs/napi-rs/pull/1143
New Contributors
- @ceifa made their first contribution in https://github.com/napi-rs/napi-rs/pull/1140
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.3.1...napi-derive@2.3.1
napi@2.3.1
4/15/2022
What's Changed
- fix(napi):
cannot find trait ToNapiValueerror by @U-C-S in https://github.com/napi-rs/napi-rs/pull/1136 - ci: check all napi features by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1137
New Contributors
- @U-C-S made their first contribution in https://github.com/napi-rs/napi-rs/pull/1136
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.3.0...napi@2.3.1
napi@2.3.0
4/15/2022
What's Changed
- docs: add return Promise callback function @Brooooooklyn
- feat(napi): relax the value type on ThreadSafeFunction @Brooooooklyn
- feat(napi-derive): support generic types on fn @Brooooooklyn
- fix(napi-derive): JsUnknown should be unknown type @Brooooooklyn
- feat(napi): add
from_unknownmethod on FromNapiValue @Brooooooklyn - fix(napi): typo unrwap -> unwrap @waltonseymour
- chore(napi): show tips if create different buffers with same data @Brooooooklyn
- test(napi): add memory tests for
Reference@Brooooooklyn - fix(napi): make buffer
Send&Syncsafe @Brooooooklyn - feat(napi): redesign the Reference API (#1118) @Brooooooklyn
- Revert "chore: unset CARGO_BUILD_TARGET in debian.Dockerfile" @Brooooooklyn
- chore: unset
CARGO_BUILD_TARGETin debian.Dockerfile @Brooooooklyn - build: migrate debian image to messense/manylinux2014-cross @Brooooooklyn
- feat(napi): experimental class reference API @Brooooooklyn
- fix(napi): remove CString::from_vec_with_nul_unchecked @Brooooooklyn
- feat(napi): allow empty enums @antoniomuso
- ci: add binary build check @messense
- fix(napi): double allocation in create_buffer @Brooooooklyn
Reference API
use napi::bindgen_prelude::*;
pub struct Repository {
dir: String,
}
impl Repository {
fn remote(&self) -> Remote {
Remote { inner: self }
}
}
pub struct Remote<'repo> {
inner: &'repo Repository,
}
impl<'repo> Remote<'repo> {
fn name(&self) -> String {
"origin".to_owned()
}
}
#[napi]
pub struct JsRepo {
inner: Repository,
}
#[napi]
impl JsRepo {
#[napi(constructor)]
pub fn new(dir: String) -> Self {
JsRepo {
inner: Repository { dir },
}
}
#[napi]
pub fn remote(&self, reference: Reference<JsRepo>, env: Env) -> Result<JsRemote> {
Ok(JsRemote {
inner: reference.share_with(env, |repo| Ok(repo.inner.remote()))?,
})
}
}
#[napi]
pub struct JsRemote {
inner: SharedReference<JsRepo, Remote<'static>>,
}
#[napi]
impl JsRemote {
#[napi]
pub fn name(&self) -> String {
self.inner.name()
}
}
const repo = new JsRepo('.')
t.is(repo.remote().name(), 'origin')
New Contributors
- @waltonseymour made their first contribution in https://github.com/napi-rs/napi-rs/pull/1133
- @antoniomuso made their first contribution in https://github.com/napi-rs/napi-rs/pull/1089
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@2.2.0...napi@2.3.0
napi@2.3.0-alpha.1
4/7/2022
Features
- Provide
ReferenceAPI to keep class reference alive with JavaScript instance. - Allow injecting
Referenceinto parameters likeEnv. - Add tests to ensure no memory leak happened in the new
ReferenceAPI. Buffernow can be used in struct which is implementedTasktrait.
use napi::bindgen_prelude::*;
pub struct Repository {
dir: String,
}
impl Repository {
fn remote(&self) -> Remote {
Remote { inner: self }
}
}
pub struct Remote<'repo> {
inner: &'repo Repository,
}
impl<'repo> Remote<'repo> {
fn name(&self) -> String {
"origin".to_owned()
}
}
#[napi]
pub struct JsRepo {
inner: Repository,
}
#[napi]
impl JsRepo {
#[napi(constructor)]
pub fn new(dir: String) -> Self {
JsRepo {
inner: Repository { dir },
}
}
#[napi]
pub fn remote(&self, reference: Reference<JsRepo>, env: Env) -> Result<JsRemote> {
Ok(JsRemote {
inner: reference.share_with(env, |repo| Ok(repo.inner.remote()))?,
})
}
}
#[napi]
pub struct JsRemote {
inner: SharedReference<JsRepo, Remote<'static>>,
}
#[napi]
impl JsRemote {
#[napi]
pub fn name(&self) -> String {
self.inner.name()
}
}
const repo = new JsRepo('.')
t.is(repo.remote().name(), 'origin')
napi@2.2.0
3/6/2022
What's Changed
- feat(napi): Add support for
Date <-> chrono::DateTime<Utc>by @simonvandel in https://github.com/napi-rs/napi-rs/pull/1069 - fix(napi): cleanup registered hook upon unloading module with tokio_rt by @martinjlowm in https://github.com/napi-rs/napi-rs/pull/1075
- style(napi): fix
clippy::needless_late_initlint by @messense in https://github.com/napi-rs/napi-rs/pull/1080 - fix(napi): race issues with Node.js worker_thread by @Brooooooklyn @janpio in https://github.com/napi-rs/napi-rs/pull/1081
- fix(napi): Buffer value lifetime should align the Rust lifetime by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1079
- fix(napi): missing ValidateNapiValue trait for types by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1088
New Contributors
- @simonvandel made their first contribution in https://github.com/napi-rs/napi-rs/pull/1069
- @martinjlowm made their first contribution in https://github.com/napi-rs/napi-rs/pull/1075
- @stephank made their first contribution in https://github.com/napi-rs/napi-rs/pull/1084
- @janpio made their first contribution in https://github.com/napi-rs/napi-rs/pull/1081
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.1.0...napi@2.2.0
napi@2.1.0
2/9/2022
What's Changed
- feat(napi):
get_js_functionby @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1048 - feat(napi): re-export tokio and features by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1048
- fix(napi):
Stringroundtrip with interior nul bytes by @messense in https://github.com/napi-rs/napi-rs/pull/1056 - fix(napi):
BigIntissue with zero value by @messense in https://github.com/napi-rs/napi-rs/pull/1058 - style: apply clippy suggestion by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1063
- feat(napi): impl
FromNapiValueforserde_json::Number, fix it forNull, throw for impossible types by @AlCalzone in https://github.com/napi-rs/napi-rs/pull/1052 - feat(napi):
with_valuemethod onPropertyby @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1064 - fix(napi): re-export
JsDateasDatein prelude by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1065 - fix(napi): deref from
Uint8ClampedArrayby @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1066
New Contributors
- @JoostK made their first contribution in https://github.com/napi-rs/napi-rs/pull/1043
- @AlCalzone made their first contribution in https://github.com/napi-rs/napi-rs/pull/1052
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.0.4...napi@2.1.0
napi-derive@2.1.0
2/9/2022
What's Changed
- feat(napi-derive): add
ts_typeattribute to override typescript type for fields in structs by @jose-acevedoflores in https://github.com/napi-rs/napi-rs/pull/1041 - fix(napi-derive): an
Optionin front of a required parameter is no … by @JoostK in https://github.com/napi-rs/napi-rs/pull/1043 - feat(napi-derive):
get_js_functionby @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1048
New Contributors
- @JoostK made their first contribution in https://github.com/napi-rs/napi-rs/pull/1043
- @AlCalzone made their first contribution in https://github.com/napi-rs/napi-rs/pull/1052
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.0.8...napi-derive@2.1.0
napi@2.0.4
1/18/2022
What's Changed
- fix(napi): abort threadsafe functions upon env cleanup by @dceddia in https://github.com/napi-rs/napi-rs/pull/1020
- fix(napi): clippy error on 1.58 by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1029
- Add 'coerce_to_object' method to Array by @jose-acevedoflores in https://github.com/napi-rs/napi-rs/pull/1038
New Contributors
- @dceddia made their first contribution in https://github.com/napi-rs/napi-rs/pull/1020
- @jose-acevedoflores made their first contribution in https://github.com/napi-rs/napi-rs/pull/1038
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.0.3...napi@2.0.4
napi-derive@2.0.8
1/18/2022
What's Changed
- Correctly escape backslash in type definition doc comments by @timfish in https://github.com/napi-rs/napi-rs/pull/1034
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.0.7...napi-derive@2.0.8
napi@2.0.3
1/13/2022
What's Changed
- fix(napi): invalid memory address in FromNapiValue for &str by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1023
- chore: forbid unsafe_op_in_unsafe_fn by @messense in https://github.com/napi-rs/napi-rs/pull/1024
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.0.7...napi@2.0.3
napi-derive@2.0.7
1/7/2022
What's Changed
- fix(napi-derive): BigInt in TypeScript should be bigint by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1015
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.0.6...napi-derive@2.0.7
napi-derive@2.0.6
1/6/2022
What's Changed
- fix(napi-derive): should throw rather than panic if object mismatched by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1010
- fix(napi-derive): implement missing trait for JsClass reference by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1011
- chore(napi-derive): update convert_case by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/1012
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.0.5...napi-derive@2.0.6
napi-derive@2.0.5
1/4/2022
What's Changed
- Unraw rust identifiers before sending it to js. by @fluxxu in https://github.com/napi-rs/napi-rs/pull/987
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.0.4...napi-derive@2.0.5
napi-derive@2.0.4
12/24/2021
What's Changed
- fix(napi-derive): missing wrap in NAPI-RS created class instance by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/967
- fix(napi-derive): ignore warnings on generated fn by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/969
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.0.3...napi-derive@2.0.4
napi-derive@2.0.3
12/24/2021
What's Changed
- Fix return instance from non-default constructor
Classby @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/966
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.0.2...napi-derive@2.0.3
napi-derive@2.0.2
12/23/2021
What's Changed
- fix(napi-derive): return
Class instanceinfnby @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/964
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.0.1...napi-derive@2.0.2
napi@2.0.2
12/22/2021
What's Changed
- fix(napi): compile issue without compat mode by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/961
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.0.1...napi@2.0.2
napi@2.0.1
12/21/2021
What's Changed
- fix(napi): refine return type by @liulinboyi in https://github.com/napi-rs/napi-rs/pull/938
- fix(napi): impl
From<Buffer>forVec<u8>by @forehalo in https://github.com/napi-rs/napi-rs/pull/939 - test(napi): add tests for hashmap from/to object by @mischnic in https://github.com/napi-rs/napi-rs/pull/946
- chore(napi): upgrade windows crate to 0.29 by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/950
- fix(napi) undefined module in worker_threads by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/960
New Contributors
- @liulinboyi made their first contribution in https://github.com/napi-rs/napi-rs/pull/938
- @mischnic made their first contribution in https://github.com/napi-rs/napi-rs/pull/946
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.0.0...napi@2.0.1
napi-derive@2.0.1
12/21/2021
What's Changed
- fix(napi-derive-backend): Null and Undefined return type by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/940
- Add
skip_typescriptattribute for macro by @h-a-n-a in https://github.com/napi-rs/napi-rs/pull/947
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.0.0...napi-derive@2.0.1
napi-build@1.2.1
12/21/2021
What's Changed
- fix: keep
.d.tsand.jsuntouched if native doesn't change by @forehalo in https://github.com/napi-rs/napi-rs/pull/941
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.0.0...napi-build@1.2.1
napi@2.0.0
12/17/2021 https://napi.rs/blog/announce-v2 @Brooooooklyn
Special thanks to @forehalo for the initial version of NAPI-RS v2
And @timfish @h-a-n-a @joaomoreno @yisibl @idan-at @sam3d for contributing.
napi@2.0.0-beta.7
12/14/2021
What's Changed
- fix(napi):
ThreadsafeFunctionwithErrorStrategy::Fatalshould throw fatal exception by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/929
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.0.0-beta.6...napi@2.0.0-beta.7
napi@2.0.0-beta.6
12/13/2021
What's Changed
- feat(napi): support external deref by @h-a-n-a in https://github.com/napi-rs/napi-rs/pull/919
New Contributors
- @h-a-n-a made their first contribution in https://github.com/napi-rs/napi-rs/pull/919
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@2.0.0-beta.5...napi@2.0.0-beta.6
napi@2.0.0-beta.5
12/8/2021
Feature
- throw error on non constructable class https://github.com/napi-rs/napi-rs/commit/74704073065409f0ee91945c50082b00db212867 @Brooooooklyn
napi-derive@2.0.0-beta.5
12/8/2021
Bugfix
- Missing crate prefix in generated
classhttps://github.com/napi-rs/napi-rs/commit/cd7c7a342f1c74f9a31a3499aac98dd8303d6d10 @Brooooooklyn
napi-derive@2.0.0-beta.4
12/8/2021
Feature
- Add
noopfeature to disable codegen of#[napi]@Brooooooklyn
This feature is useful for sharing code between Node.js native addon and wasm
napi@2.0.0-beta.4
12/7/2021
Feature
- create
Arrayfrom&Vechttps://github.com/napi-rs/napi-rs/pull/917 @Brooooooklyn
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.0.0-beta.3...napi@2.0.0-beta.4
napi@2.0.0-beta.3
12/7/2021
What's Changed
- Impl
FromNapiValuefor&str@Brooooooklyn https://github.com/napi-rs/napi-rs/commit/00be6e5e0ceaf9263662363f559feb4302d47ba7
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.0.0-beta.2...napi@2.0.0-beta.3
napi-derive@2.0.0-beta.3
12/7/2021
What's Changed
- Skip set object property if it is
Nonehttps://github.com/napi-rs/napi-rs/pull/917 @Brooooooklyn
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.0.0-beta.3...napi-derive@2.0.0-beta.3
napi-derive@2.0.0-beta.2
12/6/2021
What's Changed
- fix(napi-derive): disable register logic in rust test by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/906
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.0.0-beta.1...napi-derive@2.0.0-beta.2
napi@2.0.0-beta.2
12/3/2021
What's Changed
- Re-export
ctorasmodule_init@Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/904 TypeNameandToNapiValueshould apply to anyHashMap@Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/904
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.0.0-beta.1...napi@2.0.0-beta.2
napi-sys@2.1.0
12/2/2021
Features
- Enable node_api syntax error experimental functions #897 @idan-at
napi-build@1.2.0
12/2/2021
Features
- Update Windows x64 and Windows x86 lib file to
Node.js@17.2.0
⚠️ There is no official Node.js build for Windows ARM64 for now: https://github.com/nodejs/build/issues/2450
So if you want build library for Windows ARM64, you can not use experimental features for now.
napi@2.0.0-beta.1
12/2/2021
Bugfix
- Return
Noneif the return type ofObject.getisValueType::Nullhttps://github.com/napi-rs/napi-rs/pull/902/commits/6d4b4af36f9c37ed1cff694f2a267668a1b843de @Brooooooklyn
napi@2.0.0-beta.0
12/2/2021
What's Changed
- TypedArray support by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/899
#[napi]
fn convert_u32_array(input: Uint32Array) -> Vec<u32> {
// AsRef<[u32]>, AsMut<[u32]>, Deref<[u32]>, DerefMut<u32>
input.to_vec()
}
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
export function convertU32Array(input: Uint32Array): Array<number>
- Android armv7 by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/901
- Enable node_api syntax error experimental functions by @idan-at in https://github.com/napi-rs/napi-rs/pull/897
New Contributors
- @idan-at made their first contribution in https://github.com/napi-rs/napi-rs/pull/897
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.0.0-alpha.8...napi@2.0.0-beta.0
napi-derive@2.0.0-beta.1
12/2/2021
Bugfix
- Correct the aliased type generation https://github.com/napi-rs/napi-rs/pull/902/commits/b2fea4d5b3aef4a4df4ccecca7cf7f5a30659e40 @Brooooooklyn
- Do not unwrap
Optionvalue in object getter if the type of field is Optionhttps://github.com/napi-rs/napi-rs/pull/902/commits/6d4b4af36f9c37ed1cff694f2a267668a1b843de @Brooooooklyn
napi@1.8.0
11/29/2021
Features
- Allow create reference with initial ref count https://github.com/napi-rs/napi-rs/commit/12df7e0159c1f8a9d0340ece7299391f71192420 @Brooooooklyn
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@1.7.11...napi@1.8.0
napi-sys@2.0.0
11/29/2021
Breaking Changes
- Remove rust enum to avoid compatible issue #887 @Brooooooklyn
threadsafe_functionrelated types now is under thenapi4feature flag @Brooooooklyn- Add
experimentalflag andnode_api_get_module_file_namefunction @Brooooooklyn
napi-derive@2.0.0-alpha.10
11/29/2021
Features
- Output Rust doc comments in definitions as jsdoc comments #885 @timfish
/// `constructor` option for `struct` requires all fields to be public,
/// otherwise tag impl fn as constructor
/// #[napi(constructor)]
#[napi]
pub struct Animal {
#[napi(readonly)]
/// Kind of animal
pub kind: Kind,
name: String,
}
#[napi]
impl Animal {
/// This is the constructor
#[napi(constructor)]
pub fn new(kind: Kind, name: String) -> Self {
Animal { kind, name }
}
/// This is a factory method
#[napi(factory)]
pub fn with_kind(kind: Kind) -> Self {
Animal {
kind,
name: "Default".to_owned(),
}
}
#[napi(getter)]
pub fn get_name(&self) -> &str {
self.name.as_str()
}
#[napi(setter)]
pub fn set_name(&mut self, name: String) {
self.name = name;
}
/// This is a
/// multi-line comment
/// with an emoji 🚀
#[napi]
pub fn whoami(&self) -> String {
match self.kind {
Kind::Dog => {
format!("Dog: {}", self.name)
}
Kind::Cat => format!("Cat: {}", self.name),
Kind::Duck => format!("Duck: {}", self.name),
}
}
#[napi]
/// This is static...
pub fn get_dog_kind() -> Kind {
Kind::Dog
}
}
⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
/**
* `constructor` option for `struct` requires all fields to be public,
* otherwise tag impl fn as constructor
* #[napi(constructor)]
*/
export class Animal {
/** Kind of animal */
readonly kind: Kind
/** This is the constructor */
constructor(kind: Kind, name: string)
/** This is a factory method */
static withKind(kind: Kind): Animal
get name(): string
set name(name: string)
/**
* This is a
* multi-line comment
* with an emoji 🚀
*/
whoami(): string
/** This is static... */
static getDogKind(): Kind
}
napi-derive@2.0.0-alpha.9
11/26/2021
Features
- Support rename function args and return type #884 @Brooooooklyn
use napi::bindgen_prelude::*;
use napi_derive::napi;
#[napi(ts_args_type = "a: { foo: number }", ts_return_type = "string[]")]
fn ts_rename(a: Object) -> Result<Object> {
a.get_property_names()
}
⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
export function tsRename(a: { foo: number }): string[]
napi-build@1.1.2
11/25/2021
Bugfix
- Fix cargo:rerun-if commands #871 @sam3d
napi@2.0.0-alpha.7
11/25/2021
What's Changed
Support export rust mod as JavaScript Object
#[napi]
mod xxh3 {
use napi::bindgen_prelude::{BigInt, Buffer};
#[napi]
pub const ALIGNMENT: u32 = 16;
#[napi(js_name = "xxh3_64")]
pub fn xxh64(input: Buffer) -> u64 {
let mut h: u64 = 0;
for i in input.as_ref() {
h = h.wrapping_add(*i as u64);
}
h
}
}
⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
export namespace xxh3 {
export const ALIGNMENT: number
export function xxh3_64(input: Buffer): BigInt
export function xxh128(input: Buffer): BigInt
}
Support return &Self for method chain
#[napi]
pub struct ClassWithFactory {
pub name: String,
}
#[napi]
impl ClassWithFactory {
#[napi(factory)]
pub fn with_name(name: String) -> Self {
Self { name }
}
#[napi]
pub fn set_name(&mut self, name: String) -> &Self {
self.name = name;
self
}
}
⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
export class ClassWithFactory {
name: string
static withName(name: string): ClassWithFactory
setName(name: string): this
}
New Contributors
- @sam3d made their first contribution in https://github.com/napi-rs/napi-rs/pull/871
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.0.0-alpha.6...napi@2.0.0-alpha.7
napi@1.7.11
11/21/2021
Bugfix
- missing coerce_to_bool on JsValue https://github.com/napi-rs/napi-rs/commit/5d32a54d6c2a01d7114f1eafdf86889e15efdb8f @Brooooooklyn
- freeze and seal should be methods of JsObject https://github.com/napi-rs/napi-rs/commit/bc952929fc7157dbb1c423eb4b636b45cfeba124 @Brooooooklyn
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@1.7.10...napi@1.7.11
napi@2.0.0-alpha.6
11/21/2021
Bugfix
- missing coerce_to_bool on JsValue https://github.com/napi-rs/napi-rs/commit/4aa56a148cbbd10169285a39231c35070bcb7db5 @Brooooooklyn
- freeze and seal should be methods of JsObject https://github.com/napi-rs/napi-rs/commit/e8cfa0b467d71a560c868cdf27f356f77d7cbbb1 @Brooooooklyn
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@2.0.0-alpha.10...napi@2.0.0-alpha.6
napi@2.0.0-alpha.5
11/21/2021
Features 🎉
feat(napi-derive): support const export by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/863
#[napi]
pub const DEFAULT_COST: u32 = 12;
⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
export const DEFAULT_COST: number
⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
import { DEFAULT_COST } from './index.js'
console.log(DEFAULT_COST) // 12
feat(napi): implement external value by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/868
#[napi]
pub fn create_external(size: u32) -> External<u32> {
External::new(size)
}
#[napi]
pub fn get_external(external: External<u32>) -> u32 {
*external.as_ref()
}
#[napi]
pub fn mutate_external(mut external: External<u32>, new_val: u32) {
*external.as_mut() = new_val;
}
#[napi]
pub fn create_external_string(content: String) -> External<String> {
External::new(content)
}
⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
export class ExternalObject<T> {
private readonly __type: unique symbol;
[val: unique symbol]: T
}
export function createExternal(size: number): ExternalObject<number>
export function getExternal(external: ExternalObject<number>): number
export function mutateExternal(external: ExternalObject<number>, newVal: number): void
export function createExternalString(content: string): ExternalObject<string>
⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
import test from 'ava'
import { createExternal, getExternal, mutateExternal } from './index.js'
test('external', (t) => {
const FX = 42
const ext = createExternal(FX)
t.is(getExternal(ext), FX)
mutateExternal(ext, FX + 1)
t.is(getExternal(ext), FX + 1)
// Can not pass non `ExternalObject` type to functions accept `ExternalObject`
// @ts-expect-error
t.throws(() => getExternal({}))
const ext2 = createExternalString('wtf')
// Can not assign `ExternalObject<string>` to `ExternalObject<number>`
// @ts-expect-error
const e = t.throws(() => getExternal(ext2))
t.is(e.message, 'T on `get_value_external` is not the type of wrapped object')
})
Bugfix
- fix(napi): allow ErrorStrategy to be specified while creating TSFN by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/867
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi@2.0.0-alpha.4...napi@2.0.0-alpha.5
napi@1.7.10
11/20/2021
Bugfix
set_propertyonJsObjectshould accept anyJsValueas key https://github.com/napi-rs/napi-rs/commit/bfbe2c0d915789d986594d9a5a4d4805d0083745 @Brooooooklyn
napi@2.0.0-alpha.4
11/16/2021
What's Changed
- feat(napi): switch to
windowscrate fromwinapiby @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/861
Full Changelog: https://github.com/napi-rs/napi-rs/compare/@napi-rs/cli@2.0.0-alpha.5...napi@2.0.0-alpha.4
napi@2.0.0-alpha.3
11/16/2021
Breaking changes
Bigintis renamed intoBigIntValueType::Bigintis renamed intoValueType::BigInt- Deprecate creating
Errorfrom fields,Errormust be created fromError::new/Error::from,Error::from_reason
Highlight features 🚀
await JavaScript Promise in Rust
This feature requires
napi4andtokio_rtfeatures.
#[napi]
pub async fn async_plus_100(p: Promise<u32>) -> Result<u32> {
let v = p.await?;
Ok(v + 100)
}
Resolve value
test('await Promise in rust', async (t) => {
const fx = 20
const result = await asyncPlus100(
new Promise((resolve) => {
setTimeout(() => resolve(fx), 50)
}),
)
t.is(result, fx + 100)
})
Reject error
test('Promise should reject raw error in rust', async (t) => {
const fxError = new Error('What is Happy Planet')
const err = await t.throwsAsync(() => asyncPlus100(Promise.reject(fxError)))
t.is(err, fxError)
})
What's Changed
- feat(napi): BigInt codegen support by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/846
- fix(napi-derive-backend): typegen issue when arg is mut by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/847
- feat(napi): create ThreadsafeFunction from JsFunction by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/848
- Fully qualify all types in generated code by @timfish in https://github.com/napi-rs/napi-rs/pull/851
- feat(napi): await Promise
in async fn by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/849 - feat(napi): support JsGlobal in
Envby @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/852 - feat(napi): improve symbol support by @Brooooooklyn in https://github.com/napi-rs/napi-rs/pull/853
New Contributors
- @timfish made their first contribution in https://github.com/napi-rs/napi-rs/pull/851
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.0.0-alpha.3...napi@2.0.0-alpha.3
napi-derive@2.0.0-alpha.6
11/16/2021
What's Changed
- Generate TypeScript
optional typesfrom RustOption
#[napi]
fn map_option(val: Option<u32>) -> Option<u32> {
val.map(|v| v + 1)
}
export function mapOption(val?: number | undefined | null): number | undefined | null
#[napi]
pub struct Context {
data: String,
pub maybe_need: Option<bool>,
}
export class Context {
maybeNeed?: boolean | undefined | null
}
#[napi]
fn read_file<T: Fn(Result<()>, Option<String>) -> Result<()>>(callback: T) {
match read_file_content() {
Ok(s) => callback(Ok(()), Some(s)),
Err(e) => callback(Err(e), None),
}
.unwrap();
}
export function readFile(callback: (arg0: Error | undefined, arg1?: string | undefined | null) => void): void
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.0.0-alpha.5...napi-derive@2.0.0-alpha.6
napi-derive@2.0.0-alpha.5
11/16/2021
What's Changed
- fix(napi-derive-backend): JsBuffer should map to Buffer type https://github.com/napi-rs/napi-rs/commit/b8bcdd9c0459cbaf255387da2c2373216dc8cd87 @Brooooooklyn
Full Changelog: https://github.com/napi-rs/napi-rs/compare/napi-derive@2.0.0-alpha.4...napi-derive@2.0.0-alpha.5
napi@1.7.9
11/15/2021
Bugfix
- Wrong
CStringusage #854 @Brooooooklyn
napi-derive@2.0.0-alpha.3
11/10/2021
Bugfix
- fix(napi-derive-backend): wrong restrict on Result return type 413a555 @Brooooooklyn
napi@1.7.8
11/6/2021
Features
- feat(napi): implement Env::throw to throw any JsValue #839 @Brooooooklyn
Throw SyntaxError:
#[js_function(1)]
pub fn throw_syntax_error(ctx: CallContext) -> Result<JsUndefined> {
let message: JsString = ctx.get(0)?;
let syntax_error = ctx
.env
.get_global()?
.get_named_property::<JsFunction>("SyntaxError")?;
ctx.env.throw(syntax_error.new(&[message])?)?;
ctx.env.get_undefined()
}
napi@2.0.0-alpha.2
11/6/2021
🚧 Breaking Changes
Task
resolve and reject now take &mut self instead of self. Add new fn finally to excute after resolve or reject:
Ref
unref now takes &mut self instead of self.
struct BufferLength(Ref<JsBufferValue>);
impl Task for BufferLength {
type Output = usize;
type JsValue = JsNumber;
fn compute(&mut self) -> Result<Self::Output> {
Ok(self.0.len() + 1)
}
- fn resolve(self, env: Env, output: Self::Output) -> Result<Self::JsValue> {
- self.0.unref(env)?;
+ fn resolve(&mut self, env: Env, output: Self::Output) -> Result<Self::JsValue> {
env.create_uint32(output as u32)
}
- fn reject(self, err: Error) -> Result<Self::JsValue> {
- self.0.unref(env)?;
- Err(err)
- }
+ fn finally(&mut self, env: Env) -> Result<()> {
+ self.0.unref(env)?;
+ Ok(())
+ }
}
Features
Either type #823 @Brooooooklyn
Either types could be passed in as arguments or as return types:
#[napi]
fn either4(input: Either4<String, u32, bool, Obj>) -> u32 {
match input {
Either4::A(s) => s.len() as u32,
Either4::B(n) => n,
Either4::C(b) => {
if b {
1
} else {
0
}
}
Either4::D(f) => match f.v {
Either::A(s) => s.len() as u32,
Either::B(n) => n,
},
}
}
⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
interface Obj {
v: string | number
}
export function either4(input: string | number | boolean | Obj): number
AsyncTask with AbortSignal support #831 @Brooooooklyn


Static Factory function for Class #834 @Brooooooklyn
Env::throw to throw any JavaScript Value e0671fe @Brooooooklyn
Throw SyntaxError:
#[js_function(1)]
pub fn throw_syntax_error(ctx: CallContext) -> Result<JsUndefined> {
let message: JsString = ctx.get(0)?;
let syntax_error = ctx
.env
.get_global()?
.get_named_property::<JsFunction>("SyntaxError")?;
ctx.env.throw(syntax_error.new(&[message])?)?;
ctx.env.get_undefined()
}
napi@2.0.0-alpha.1
10/31/2021
napi@2.0.0-alpha.1
Async with Tokio @forehalo
⬇️⬇️⬇️⬇️⬇️⬇️
Throw JavaScript Error @forehalo
⬇️⬇️⬇️⬇️⬇️⬇️
Better serde integrate @forehalo
Better TypeScript .d.ts generation @forehalo
- The return type of
Vec<u8>now will be generated asBuffer Utf16StringandLatin1Stringnow will be generated asstringcorrectlyOption<T>now will be generated asT | nullinstead ofT | undefined
Misc
- perf(napi): ignore callback info while no arguments #769 @Brooooooklyn
- feat(napi): impl from/to NapiValue for JsUnkown #817 @Brooooooklyn
- feat(cli): refactor workflow generated by cli #814 @Brooooooklyn
- ci: make sure CI fails if yarn test fails #818 @joaomoreno
napi-derive-backend@1.0.1
10/1/2021
Perf
- ignore callback info while no arguments e69a763
napi@1.7.7
9/10/2021
Bugfix
- fix(napi):
drop_wrappedimplementation https://github.com/napi-rs/napi-rs/commit/5fe8003f9c9cc2d80f40a1af0364b41335a0495b
napi@1.7.6
8/13/2021
Bugfix
- fix(napi): utf16 value should not contains 0 terminate #697
Performance
- perf(napi): make FuturePromise static dispatch #621
napi@1.7.5
6/2/2021
Perf
- perf(napi): reduce tokio future execution overhead #597
napi@1.7.4
6/2/2021
Chore
- chore(napi): remove useless build dependencies
napi-build@1.1.0
6/7/2021
Feature
- feat(build): remove
ureqto support windows arm64 #587
napi-build@1.1.0-beta.0
6/2/2021
Feature
- feat(build): remove
ureqto support windows arm64
napi@1.7.3
5/28/2021
Bugfix
- fix(napi): JsString* leak in from_js_value #584
napi@1.7.2
5/28/2021
Bugfix
- Allow dropping of string&buffer values when converting #582
napi@1.7.1
5/27/2021
Bugfix
- fix(napi): wrong memory location of data in future resolved callback #579
napi@1.7.0
5/25/2021
Feature
- feat(napi): impl more types
AsRefandAsMutforTypedArray#578
Refactor
- refactor(napi): change more generic constraint from
NapiValue=>NapiRaw#565
napi-sys@1.1.1
5/25/2021
Fix
- fix(sys):
napi_bigint64_arrayandnapi_biguint64_arrayshould be behind thenapi6feature flag
napi@1.6.1
4/29/2021
Chore
- chore(napi): upgrade
once_cell
napi@1.6.0
4/21/2021
Feature
-
Support N-API version 8 features:
napi8 feature added into napi crate.
Chore
Node.js@10andNode.js@15removed fromCI.
napi@1.5.0
4/15/2021
Feature
- feat(napi): expose create_string_from_c_char for C ffi scenario d1bcecc
Fix
- fix(napi): memory ordering issues in tsfn 5a21bbe
napi@1.4.0
4/1/2021
Feature
- refactor(napi): split NapiRaw trait from NapiValue https://github.com/napi-rs/napi-rs/pull/524
napi-derive@1.1.0
4/1/2021
Feature
- refactor(napi): split NapiRaw trait from NapiValue https://github.com/napi-rs/napi-rs/pull/524
napi@1.3.4
3/31/2021
Bugfix
- fix(napi): do not call release tsfn in Drop when ref count is 0 https://github.com/napi-rs/napi-rs/pull/522
napi@1.3.3
3/22/2021
Bugfix
- fix(napi): finalizer maybe_ref pointer value f45f1ae
- Add a way to convert stateful (Rust) closures into
JsFunction4aba159
Docs
napi@1.3.2
3/12/2021
Bugfix
- fix(napi): napi_adjust_external_memory issue on wini686. 1e3290c
napi@1.3.1
3/11/2021
Bugfix
- fix(napi): InvalidArg error when create_external with size hint. 50f207f
napi@1.3.0
3/11/2021
Feature
- Add a way to opt out of error handling for
ThreadsafeFunctionhttps://github.com/napi-rs/napi-rs/pull/500
napi@1.2.0
2/26/2021
Feature
- feat(napi): unwrap &'static value from Ref object e622d96
- feat(napi): add back clone trait to ThreadsafeFunction 071dcff
napi@1.1.3
2/1/2021
- chore: upgrade tokio to v1.1
napi@1.1.2
1/25/2021
Bugfix
- fix(napi): throw JavaScript error in tsfn rather than rust thread panic f46aa1f
napi@1.1.1
1/7/2021
Feature
- Implement
CopyandClonetrait for JavaScript Primitive types. c121537
Bugfix
- Remove unexpected
into_*_reffromJsString. e24738a
napi@1.1.0
1/5/2021
- Implement
Env::create_arraybuffer_with_borrowed_dataforFFIscenario.
napi@1.0.1
1/4/2021
Fix
- enable
napi4feature whentokio_rtenabled - Remove unexpected
napi_acquire_threadsafe_functioninexecute_tokio_futurewhich would prevent NodeJS process to exit: https://github.com/napi-rs/napi-rs/issues/397
napi-build@1.0.1
1/4/2021
Chore
- Upgrade ureq to 2.0
1.0.0
3/11/2021
Breaking changes
Module register
The old way:
register_module!(test_module, init);
fn init(module: &mut Module) -> Result<()> {
// ....
Ok(())
}
The new way:
#[module_exports]
fn init(mut exports: JsObject) -> Result<()> {
// ...
Ok(())
}
or
#[module_exports]
fn init(mut exports: JsObject, env: Env) -> Result<()> {
// ...
Ok(())
}
Task
- pub trait Task: Send {
+ pub trait Task: Send + Sized {
type Output: Send + Sized + 'static;
type JsValue: NapiValue;
- fn compute(&self) -> Result<Self::Output>;
+ fn compute(&mut self) -> Result<Self::Output>;
- fn resolve(&self, env: &mut Env, output: Self::Output) -> Result<Self::JsValue>;
+ fn resolve(self, env: Env, output: Self::Output) -> Result<Self::JsValue>;
+ fn reject(self, _env: Env, err: Error) -> Result<Self::JsValue> {
+ Err(err)
+ }
}