npm / @napi-rs/cli
@napi-rs/cli
What changed in @napi-rs/cli 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
16 breaking1 deprecations7 new APIs and options1 performance2 behavior and defaults7 tooling19 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@napi-rs/cli 353 changes
Breaking changes 16
Conversion depth is bounded at 128 levels, preventing excessively deep serde_json::Value conversions.
The build now fails when a --pipe post-process command exits non-zero.
Replace --cargo-cwd with --manifest-path pointing to the crate's Cargo.toml.
The --cargo-flags option is removed; pass Cargo flags after --, where they are forwarded to cargo build.
In v3, build path flags are resolved relative to --cwd or process.cwd(), rather than --cargo-cwd or process.cwd().
This replaces create-npm-dir; the notes recommend creating npm/* directories in CI instead of committing them.
Use napi_derive::module_init instead of napi::module_init.
This new macro replaces the #[module_exports] macro from compat-mode.
This replaces the napi universal command.
Use napi.binaryName instead of napi.name to configure the binary name.
Use napi.packageName instead of the old nested napi.package.name field, which v3 does not read.
Set a flat targets array listing every target explicitly, including targets that were previously defaults.
The new CLI requires Node.js ^20.17.0 || ^22.13.0 || >=23.5.0 at build time; this does not change the addon's runtime support.
NAPI-RS neither supports nor recommends npm as a package manager, citing unresolved native-addon issues in npm 10.
New owned/scoped types replace the listed JsValues, which are behind compat-mode because they are not safe.
Rust 1.88 or newer is required.
Deprecations 1
The CLI still reads napi.triples for compatibility, but new projects should use napi.targets.
New APIs and options 7
The CLI can resolve the command from the provided arguments.
NapiCli exposes a programmatic build API that accepts build options and returns a task and abort handle.
Enable this feature to keep using deprecated types while migrating incrementally; those types have known safety issues.
The new flag enables cross compilation for the listed Linux targets, with all supported targets reaching GLIBC 2.17.
JavaScript infrastructure can integrate NAPI-RS tools programmatically through NapiCli; all napi commands have corresponding APIs.
A pnpm package template is supported in V3.
Projects can be compiled to WebAssembly with almost no code changes, including targets that support Rust features such as std::thread and tokio in the browser.
Performance 1
Type definition generation is parallelized deterministically.
Behavior and default changes 2
The threaded WASI worker pool is preloaded from the loader.
New projects now apply enableTypeDef when generating project files.
Tooling 7
The CLI now supports powerpc64 FreeBSD targets.
The CLI recognizes the aarch64-unknown-freebsd target.
Generated JSON, TOML, YAML,
.d.ts, and JS/WASI loader files now share a house style; regenerating bindings may produce noisy diffs without behavior changes.The interactive new-project prompt now includes napi9.
The CLI is compatible with the latest wasi-sdk toolchain.
The CLI integrates cargo-xwin so developers can build many different targets on a single machine.
The CLI integrates cargo-zigbuild so developers can build many different targets on a single machine.
Fixes and other changes 19
The CLI resolves null when the incarnation probe's spawn throws synchronously.
The CLI takes over the WASI flavor of a binding swapped in by a postbuild fallback.
The CLI now resolves zigbuild artifacts under the base target triple.
The CLI keeps a WASI-managed root entry when it differs from package main.
On Android, generated Node loaders preopen the current working directory instead of
/, which Termux cannot open.Builds now select the matching emnapi archive and avoid double-linking _initialize on current WASI toolchains.
The variable now activates only when set to 'true' or 'error'.
Worker error messages are now received correctly.
New non-WASI projects no longer retain stale browser metadata.
WASI package generation preserves stricter Node engine ranges.
Generated class methods are preserved.
Pre-publish preserves existing optionalDependencies.
universalize resolves an absolute packageJsonPath correctly.
The pre-publish git log lookup now uses the target working directory.
Renaming a project now preserves its repository.
The CLI now uses jsPackageName from CLI options.
The CommonJS binding no longer uses createRequire.
Corrects how the CLI detects the OpenHarmony SDK path.
The package no longer invokes process.report on Windows.