cargo / napi-derive
napi-derive
What changed in napi-derive 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-23.
2 breaking1 security6 new APIs and options6 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initnapi-derive 315 changes
Breaking changes 2
The Rust version requirement was bumped.
The module initialization macro moved from napi::module_init to napi_derive::module_init because of breaking changes in the upstream ctor crate.
Security 1
Classes marked with #[napi] have unforgeable identity via Node object type tags.
New APIs and options 6
Class members can use symbol_for keys.
Class members can use well-known symbol keys.
Adds the napi(async_iterator) macro attribute.
Adds a feature for debug logging NAPI function calls.
Adds
discriminant_caseto allow changing the case of a discriminant.This attribute replaces the compat-mode #[module_exports] macro, allowing use of the modern #[napi] macros without the compat-mode feature.
Fixes and other changes 6
The TS1016 issue in constructors is avoided.
Closures passed to define_class are freed.
Static flags are honoured.
AsyncTask completion is guarded against environment teardown.
Fixes invalid TypeScript generic syntax generated for type aliases.
Using ThreadsafeFunction::call_async no longer requires tokio.