unstale

cargo / napi

napi

What changed in napi 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-23.

21 breaking8 security1 deprecations16 new APIs and options8 behavior and defaults3 tooling59 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

napi 3116 changes

Breaking changes 21

  • Builds without type tags now reject a value of another class.

    3.15.0release notes

  • Conversion depth is bounded at 128 levels.

    3.14.2release notes

  • Addons with live native code are no longer unloaded.

    3.12.1release notes

  • The Rust version requirement is bumped.

    3.4.0release notes

  • The new @napi-rs/cli requires Node.js ^20.17.0 || ^22.13.0 || >=23.5.0 at build time; this does not change the runtime support of the shipped addon.

    3.0.0upgrade guide

  • The compat-mode module_exports macro is replaced by #[napi(module_exports)].

    3.0.0upgrade guide

  • Path flags are now resolved relative to --cwd or process.cwd(), rather than --cargo-cwd or process.cwd().

    3.0.0upgrade guide

  • The --cargo-cwd flag is removed; use --manifest-path to point to the crate's Cargo.toml.

    3.0.0upgrade guide

  • The --cargo-flags option is removed; pass Cargo flags after -- instead.

    3.0.0upgrade guide

  • Use --manifest-path to point at the crate's Cargo.toml in place of --cargo-cwd.

    3.0.0upgrade guide

  • Arguments after -- are forwarded to cargo build, allowing Cargo flags such as --locked to be passed through.

    3.0.0upgrade guide

  • The command is renamed to napi create-npm-dirs.

    3.0.0upgrade guide

  • Use napi_derive::module_init in place of napi::module_init.

    3.0.0upgrade guide

  • Use this macro in place of the compat-mode module_exports macro; it accepts the documented signature.

    3.0.0upgrade guide

  • The module_init macro moved from napi to napi_derive.

    3.0.0upgrade guide

  • The command is renamed to napi universalize.

    3.0.0upgrade guide

  • Use napi universalize in place of napi universal.

    3.0.0upgrade guide

  • Move the package name from napi.package.name to napi.packageName; v3 does not read the old nested field.

    3.0.0upgrade guide

  • Use a flat targets array listing every target explicitly, including targets formerly supplied by defaults.

    3.0.0upgrade guide

  • Rust 1.88 or newer is required for the v3 migration.

    3.0.0upgrade guide

  • ThreadsafeFunction has been rewritten, replacing its ref-count lifecycle with ownership-based behavior.

    3.0.0upgrade guide

Security 8

  • Native payload provenance is now validated for External and instance data.

    3.13.0release notes

  • External-buffer slices now point at the engine-owned copy after finalization reclaims the source; this also affects TypedArraySlice::from_external, Uint8ClampedSlice::from_external, and compat-mode Env::create_arraybuffer_with_borrowed_data.

    3.12.4release notes

  • Wrapped payload provenance is validated before dereferencing in Object::unwrap and Object::remove_wrapped, and the deprecated Env::unwrap and Env::drop_wrapped, preventing out-of-bounds memory access.

    3.12.4release notes

  • Unexpected JavaScript value shapes now return errors instead of reaching unreachable!() and aborting the process.

    3.12.4release notes

  • Fixes a memory safety issue in PromiseRaw callbacks.

    3.12.2release notes

  • Fixes a WASI double-free involving zero-copy external strings.

    3.9.1release notes

  • Prevents async iterator use-after-free during garbage collection.

    3.8.3release notes

  • JsObject and the listed legacy JsValue types are behind compat-mode; migrate to the new APIs because these APIs are not safe.

    3.0.0upgrade guide

Deprecations 1

  • The triples configuration is replaced by napi.targets; v3 still reads triples for compatibility, but new projects should not use it.

    3.0.0upgrade guide

New APIs and options 16

  • Class members can use symbol_for keys.

    3.16.0release notes

  • Class members can use well-known symbol keys.

    3.16.0release notes

  • A ReadableStream can now be canceled through its Reader.

    3.15.0release notes

  • The MultiThread flavor is now available on wasm32-wasip1-threads.

    3.13.0release notes

  • Adds support for a pluggable async runtime backend.

    3.11.0release notes

  • Implementations are available for OsString, OsStr, Path and PathBuf, enabling conversions between these Rust types and napi values.

    3.10.0release notes

  • Adds a method to handle errors in callback functions.

    3.9.0release notes

  • Adds the #[napi(async_iterator)] macro attribute.

    3.8.0release notes

  • ArrayBuffer now provides unsafe as_mut, allowing mutable access to its contents.

    3.7.0release notes

  • Promise.resolve and Promise.reject are now supported.

    3.7.0release notes

  • Adds Eq and PartialEq trait implementations to BigInt.

    3.6.0release notes

  • Adds support for using node_api_create_object_with_properties for enum creation.

    3.6.0release notes

  • The napi-derive tracing feature enables debug logging of NAPI function calls.

    3.6.0release notes

  • Adds on_abort support for AbortSignal.

    3.4.0release notes

  • Enable the compat-mode feature to keep using deprecated types during an incremental migration; it is not recommended as a permanent state because those types have known safety issues.

    3.0.0upgrade guide

  • Use napi.binaryName instead of napi.name for the binary name; napi.name remains readable for compatibility, but new projects should use binaryName.

    3.0.0upgrade guide

Behavior and default changes 8

Tooling 3

  • The CLI now supports non-threaded WASI targets.

    3.12.0release notes

  • The CLI now supports the loongarch64-unknown-linux-gnu target.

    3.4.0release notes

  • Use the renamed command to create npm/* directories in CI instead of committing those directories.

    3.0.0upgrade guide

Fixes and other changes 59

  • AsyncTask promises no longer leak.

    3.16.2release notes

  • Teardown is handled per environment for multi-load addons.

    3.16.2release notes

  • Avoids a deadlock when a worker loads the addon during block_on.

    3.16.1release notes

  • Avoids TS1016 in constructors.

    3.16.0release notes

  • Registered classes are kept when a later load fails.

    3.16.0release notes

  • Static flags are now honored when defining classes.

    3.16.0release notes

  • Borrowed class arguments are kept alive across AsyncTask and AsyncBlock.

    3.15.0release notes

  • Failed conversion now drops an unadopted class value and resets the factory flag.

    3.15.0release notes

  • The custom GC aborted flag is set before Node closes its tsfn.

    3.15.0release notes

  • Managed array inputs are now copied.

    3.15.0release notes

  • Fixed ReadableStream::cancel.

    3.15.0release notes

  • Tokio runtime threads are joined at environment teardown.

    3.15.0release notes

  • Fixed TypedArray input leaks and compat buffer copies on wasm.

    3.15.0release notes

  • Registers wasm cleanup through the environment cleanup hook.

    3.14.2release notes

  • Objects are now created with napi_define_properties on every Node version.

    3.14.1release notes

  • The allocator is locked on threaded WASI, preventing hangs after a worker crash.

    3.14.0release notes

  • AsyncTask completion is guarded against environment teardown.

    3.12.7release notes

  • Outstanding async work is drained before the WASI binding is disposed.

    3.12.6release notes

  • Fixed fatal_exception being a no-op in optimized builds.

    3.12.5release notes

  • Converting errors keeps the anyhow error cause.

    3.12.3release notes

  • Fixed Buffer detachment in threadless wasm.

    3.12.3release notes

  • Panics in closure trampolines are caught instead of causing an abort.

    3.12.3release notes

  • Fixed waker-stack deadlocks in CurrentThread.

    3.12.3release notes

  • Module registration no longer uses randomness in wasi.

    3.12.1release notes

  • Non-Error rejections are preserved.

    3.12.1release notes

  • A teardown barrier is added for wasm.

    3.12.1release notes

  • FunctionRef is released off the JS thread via the custom-GC TSFN.

    3.10.5release notes

  • The CLI aligns build and project configuration.

    3.10.4release notes

  • Preserves the JavaScript error object when cloning an Error off-thread.

    3.10.3release notes

  • Cloning a JavaScript exception Error off-thread now preserves its message and cause.

    3.10.2release notes

  • Release Error's exception reference through the custom GC when the Error is dropped off-thread.

    3.10.1release notes

  • Stop retaining the exception object in the sync-throw path on wasm targets.

    3.10.1release notes

  • Custom-GC Buffer and TypedArray drops on another thread are routed through the owning isolate.

    3.10.0release notes

  • Changes field-error decoration for napi object attributes.

    3.9.4release notes

  • Synchronizes the referred flag when creating a weak ThreadsafeFunction.

    3.9.3release notes

  • Fixed the Reader losing chunks and aborting on errored streams.

    3.9.2release notes

  • Fixes the experimental node_api_create_object_with_properties API.

    3.9.1release notes

  • Corrects the error message typo from “non” to “none.”

    3.8.5release notes

  • Error::cause is populated from ThreadsafeFunction callee-handled callbacks.

    3.8.5release notes

  • Generator class methods are preserved.

    3.8.5release notes

  • Callback errors are handled gracefully during shutdown.

    3.8.5release notes

  • Conversion now checks for a null error_message.

    3.8.4release notes

  • Conversion from Unknown now skips nullish error causes.

    3.8.4release notes

  • Implemented TypeName for ArrayBuffer.

    3.8.2release notes

  • Fixed a memory leak in async functions.

    3.8.2release notes

  • Fixed a compile error when compiling for WASI in debug mode.

    3.8.1release notes

  • Validates status before copying in the ToNapiValue fallback.

    3.8.0release notes

  • Validates status before copying data in the env arraybuffer fallback.

    3.8.0release notes

  • Validates status before copying in the owned ToNapiValue fallback.

    3.8.0release notes

  • Validates status before copying in the remaining TypedArray fallback paths.

    3.8.0release notes

  • Fixes BigInt comparison.

    3.6.0release notes

  • Makes the NODE_VERSION_* items public again.

    3.6.0release notes

  • Restores non dyn-symbols behavior.

    3.6.0release notes

  • Fixes runtime shutdown at environment cleanup on Windows.

    3.6.0release notes

  • Fixed TypedArraySlice creation.

    3.5.1release notes

  • Fixes a memory leak in the PromiseRaw cleanup callback.

    3.5.0release notes

  • Cleans up memory issues.

    3.4.0release notes

  • Fixes node_api_create_external_string_utf16 on wasm.

    3.4.0release notes

  • Stops a reference error object on wasm targets.

    3.4.0release notes