Skip to content

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) share class accessor trampolines (#3364)
  • optimize object field raw property access (#3365)

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) share class accessor trampolines (#3364)
  • optimize object field raw property access (#3365)

napi-v3.10.0

7/1/2026

Added

  • (napi) implement To/FromNapiValue for OsString, OsStr, Path and PathBuf (#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/FromNapiValue for OsString, OsStr, Path and PathBuf (#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_catch to 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) skip duplicate validation (#3268)
  • (napi) clarify unsafe function invariants (#3267)

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

  • (deps) update rust crate ctor to v0.8.0 (#3170)
  • (deps) update rust crate ctor to v0.7.0 (#3169)

napi-v3.8.3

2/14/2026

Fixed

  • (napi) prevent async iterator use-after-free during GC (#3120)

Other

  • replace BufferRef mention with BufferSlice (#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

  • (deps) update rust crate convert_case to 0.11 (#3114)
  • (napi-derive) escape * in comments (#3109)

napi-v3.8.2

1/8/2026

Fixed

  • (napi) memory leak in async fn (#3089)
  • (napi) implement TypeName for ArrayBuffer (#3087)

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) provide unsafe as_mut on ArrayBuffer (#3055)
  • (napi) support Promise.resolve/reject (#3053)

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

  • (napi) bigInt comparison (#3039)
  • (napi) shutdown runtime at env cleanup on windows (#3026)

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_case to 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_case to allow changing case of discriminant (#2960)

Fixed

  • (napi) stop ref error object in wasm targets (#2975)

Other

  • (napi) bump rust-version (#2966)
  • (napi-derive) make typegen easier to read (#2956)

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.cause support to napi::Error (#2829)

Fixed

  • (napi) user_defined_rt can only be used once (#2841)

napi-derive-v3.2.0

8/7/2025

Added

  • (napi) add ScopeGenerator trait (#2831)
  • make generator an iterator (#2784)

napi-derive-backend-v2.1.0

8/7/2025

Added

  • make generator an iterator (#2784)

napi-v3.1.6

8/1/2025

Fixed

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

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

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

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

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

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

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

New Contributors

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

New Contributors

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

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

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

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

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

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

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

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

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

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

New Contributors

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

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

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

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

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

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

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

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

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

New Contributors

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

New Contributors

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

New Contributors

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

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

New Contributors

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

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

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

New Contributors

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

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

New Contributors

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

New Contributors

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

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

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

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

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

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 CString before call napi_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

New Contributors

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

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

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

New Contributors

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

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

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

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

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

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

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

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

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

New Contributors

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

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

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

New Contributors

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

New Contributors

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::Serialize for Either by @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

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

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

New Contributors

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

New Contributors

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

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

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

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

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

New Contributors

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

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

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

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

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

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

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

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

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

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

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

New Contributors

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

New Contributors

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

New Contributors

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

New Contributors

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

New Contributors

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

New Contributors

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

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

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

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

New Contributors

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

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

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

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

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

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

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

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

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

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

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

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

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

New Contributors

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

napi-derive@2.14.0

11/7/2023

What's Changed

napi@2.13.3

8/16/2023

What's Changed

New Contributors

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

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

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

New Contributors

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

New Contributors

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

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

New Contributors

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

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

New Contributors

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

New Contributors

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

rust
#[napi(string_enum)]
pub enum Status {
  Pristine,
  Loading,
  Ready,
}

⬇️⬇️⬇️⬇️⬇️

ts
export const enum Status {
  Pristine = 'Pristine',
  Loading = 'Loading',
  Ready = 'Ready'
}

What's Changed

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

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

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

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

New Contributors

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

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

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

New Contributors

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

New Contributors

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

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

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

rust
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"))
}
ts
test('custom status code in Error', (t) => {
  t.throws(() => customStatusCode(), {
    code: 'Panic',
  })
})

What's Changed

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

rust
#[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,
    );
  });
}

⬇️⬇️⬇️⬇️⬇️⬇️⬇️

ts
export function acceptThreadsafeFunctionTupleArgs(func: (err: Error | null, arg0: number, arg1: boolean, arg2: string) => any): void

What's Changed

New Contributors

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

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

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

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

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

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

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

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

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

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

rust
#[napi]
pub fn accept_callback(callback: ThreadsafeFunction<u32>) {
  std::thread::spawn(move || {
    callback.call(200);
  });
}

⬇️⬇️⬇️⬇️⬇️

js
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.

rust
#[napi(object, object_to_js = false)]
pub struct Options {
  pub enable_jsx: bool,
  pub on_data: ThreadsafeFunction<Vec<u8>>,
}

What's Changed

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

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

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

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

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

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

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

New Contributors

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

New Contributors

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

New Contributors

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

New Contributors

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

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

New Contributors

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

New Contributors

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

New Contributors

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

New Contributors

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

New Contributors

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.

rust
#[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.

rust
  #[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:

rust
#[napi]
pub fn return_f32() -> f32 {
  3.14
}

What's Changed

New Contributors

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

New Contributors

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

rust
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

rust
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

rust
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)
}
js
import { NativeClass, isNativeClassInstance } from './index.js'

const nc = new NativeClass()
console.log(isNativeClassInstance(nc)) // true
console.log(isNativeClassInstance(1)) // false

What's Changed

New Contributors

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

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:

rust
#[napi]
pub struct NativeClass  {}

#[napi]
impl NativeClass {
  #[napi]
  pub fn hello(&self) {
    println!("hello");
  }
}

Before:

js
const instance = new NativeClass()
instance.hello = function() {} // Cannot assign to read only property \'hello\' of object \'#<NativeClass>\'

After:

js
const instance = new NativeClass()
instance.hello = function() {} // Just fine

You can also configure the Property attribute via #[napi]:

rust
#[napi]
pub struct NativeClass  {}

#[napi]
impl NativeClass {
  #[napi(configurable = false, writable = false, enumerable = false)]
  pub fn hello(&self) {
    println!("hello");
  }
}

What's Changed

New Contributors

napi-derive@2.7.0

8/7/2022

What's Changed

napi@2.6.3

7/11/2022

What's Changed

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

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

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

New Contributors

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

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

New Contributors

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

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

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

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

Experimental

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

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

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

New Contributors

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

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

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

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

Experimental

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

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

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

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

New Contributors

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

New Contributors

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_unknown method 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 & Sync safe @Brooooooklyn
  • feat(napi): redesign the Reference API (#1118) @Brooooooklyn
  • Revert "chore: unset CARGO_BUILD_TARGET in debian.Dockerfile" @Brooooooklyn
  • chore: unset CARGO_BUILD_TARGET in 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

rust
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()
  }
}
js
const repo = new JsRepo('.')
t.is(repo.remote().name(), 'origin')

New Contributors

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 Reference API to keep class reference alive with JavaScript instance.
  • Allow injecting Reference into parameters like Env.
  • Add tests to ensure no memory leak happened in the new Reference API.
  • Buffer now can be used in struct which is implemented Task trait.
rust
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()
  }
}
js
const repo = new JsRepo('.')
t.is(repo.remote().name(), 'origin')

napi@2.2.0

3/6/2022

What's Changed

New Contributors

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

New Contributors

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

New Contributors

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

New Contributors

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

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

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

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

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

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

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

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

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

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

New Contributors

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

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

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

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

New Contributors

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

napi-derive@2.0.0-beta.5

12/8/2021

Bugfix

napi-derive@2.0.0-beta.4

12/8/2021

Feature

This feature is useful for sharing code between Node.js native addon and wasm

napi@2.0.0-beta.4

12/7/2021

Feature

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

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

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

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

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

napi@2.0.0-beta.0

12/2/2021

What's Changed

rs
#[napi]
fn convert_u32_array(input: Uint32Array) -> Vec<u32> {
  // AsRef<[u32]>, AsMut<[u32]>, Deref<[u32]>, DerefMut<u32>
  input.to_vec()
}

↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

ts
export function convertU32Array(input: Uint32Array): Array<number>

New Contributors

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

napi@1.8.0

11/29/2021

Features

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_function related types now is under the napi4 feature flag @Brooooooklyn
  • Add experimental flag and node_api_get_module_file_name function @Brooooooklyn

napi-derive@2.0.0-alpha.10

11/29/2021

Features

  • Output Rust doc comments in definitions as jsdoc comments #885 @timfish
rust
/// `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
  }
}

⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️

ts
/**
 * `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
rust
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()
}

⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️

ts
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

rust
#[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
  }
}

⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️

ts
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

rust
#[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
  }
}

⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️

ts
export class ClassWithFactory {
  name: string
  static withName(name: string): ClassWithFactory
  setName(name: string): this
}

New Contributors

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

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

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

rust
#[napi]
pub const DEFAULT_COST: u32 = 12;

⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️

ts
export const DEFAULT_COST: number

⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️

ts
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

rust
#[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)
}

⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️

ts
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>

⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️

ts
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

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

napi@2.0.0-alpha.4

11/16/2021

What's Changed

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

  • Bigint is renamed into BigInt
  • ValueType::Bigint is renamed into ValueType::BigInt
  • Deprecate creating Error from fields, Error must be created from Error::new/Error::from, Error::from_reason

Highlight features 🚀

await JavaScript Promise in Rust

This feature requires napi4 and tokio_rt features.

rust
#[napi]
pub async fn async_plus_100(p: Promise<u32>) -> Result<u32> {
  let v = p.await?;
  Ok(v + 100)
}

Resolve value

ts
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

ts
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

New Contributors

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 types from Rust Option
rust
#[napi]
fn map_option(val: Option<u32>) -> Option<u32> {
  val.map(|v| v + 1)
}
ts
export function mapOption(val?: number | undefined | null): number | undefined | null
rust
#[napi]
pub struct Context {
  data: String,
  pub maybe_need: Option<bool>,
}
ts
export class Context {
  maybeNeed?: boolean | undefined | null
}
rust
#[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();
}
ts
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

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

napi-derive@2.0.0-alpha.3

11/10/2021

Bugfix

napi@1.7.8

11/6/2021

Features

  • feat(napi): implement Env::throw to throw any JsValue #839 @Brooooooklyn

Throw SyntaxError:

rs
#[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.

diff
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:

rs
#[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,
    },
  }
}

⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️

ts
interface Obj {
  v: string | number
}
export function either4(input: string | number | boolean | Obj): number

AsyncTask with AbortSignal support #831 @Brooooooklyn

carbon(5)

carbon(3)

Static Factory function for Class #834 @Brooooooklyn

Env::throw to throw any JavaScript Value e0671fe @Brooooooklyn

Throw SyntaxError:

rs
#[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

async-rust

⬇️⬇️⬇️⬇️⬇️⬇️


async-ts

Throw JavaScript Error @forehalo

⬇️⬇️⬇️⬇️⬇️⬇️

Better serde integrate @forehalo

Better TypeScript .d.ts generation @forehalo

  • The return type of Vec<u8> now will be generated as Buffer
  • Utf16String and Latin1String now will be generated as string correctly
  • Option<T> now will be generated as T | null instead of T | 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

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 ureq to support windows arm64 #587

napi-build@1.1.0-beta.0

6/2/2021

Feature

  • feat(build): remove ureq to 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 AsRef and AsMut for TypedArray #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_array and napi_biguint64_array should be behind the napi6 feature flag

napi@1.6.1

4/29/2021

Chore

  • chore(napi): upgrade once_cell

napi@1.6.0

4/21/2021

Feature

napi8 feature added into napi crate.

Chore

  • Node.js@10 and Node.js@15 removed from CI.

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

napi-derive@1.1.0

4/1/2021

Feature

napi@1.3.4

3/31/2021

Bugfix

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 JsFunction 4aba159

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

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 Copy and Clone trait for JavaScript Primitive types. c121537

Bugfix

  • Remove unexpected into_*_ref from JsString. e24738a

napi@1.1.0

1/5/2021

  • Implement Env::create_arraybuffer_with_borrowed_data for FFI scenario.

napi@1.0.1

1/4/2021

Fix

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:

rust
register_module!(test_module, init);

fn init(module: &mut Module) -> Result<()> {
  // ....
  Ok(())
}

The new way:

rust
#[module_exports]
fn init(mut exports: JsObject) -> Result<()> {
  // ...
  Ok(())
}

or

rust
#[module_exports]
fn init(mut exports: JsObject, env: Env) -> Result<()> {
  // ...
  Ok(())
}

Task

diff
- 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)
+   }
}