unstale

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

@unstale/cli on npm

@napi-rs/cli 353 changes

Breaking changes 16

  • Conversion depth is bounded at 128 levels, preventing excessively deep serde_json::Value conversions.

    3.10.8release notes

  • The build now fails when a --pipe post-process command exits non-zero.

    3.6.2release notes

  • Replace --cargo-cwd with --manifest-path pointing to the crate's Cargo.toml.

    3.0.0upgrade guide

  • The --cargo-flags option is removed; pass Cargo flags after --, where they are forwarded to cargo build.

    3.0.0upgrade guide

  • In v3, build path flags are resolved relative to --cwd or process.cwd(), rather than --cargo-cwd or process.cwd().

    3.0.0upgrade guide

  • This replaces create-npm-dir; the notes recommend creating npm/* directories in CI instead of committing them.

    3.0.0upgrade guide

  • Use napi_derive::module_init instead of napi::module_init.

    3.0.0upgrade guide

  • This new macro replaces the #[module_exports] macro from compat-mode.

    3.0.0upgrade guide

  • This replaces the napi universal command.

    3.0.0upgrade guide

  • Use napi.binaryName instead of napi.name to configure the binary name.

    3.0.0upgrade guide

  • Use napi.packageName instead of the old nested napi.package.name field, which v3 does not read.

    3.0.0upgrade guide

  • Set a flat targets array listing every target explicitly, including targets that were previously defaults.

    3.0.0upgrade guide

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

    3.0.0upgrade guide

  • NAPI-RS neither supports nor recommends npm as a package manager, citing unresolved native-addon issues in npm 10.

    3.0.0upgrade guide

  • New owned/scoped types replace the listed JsValues, which are behind compat-mode because they are not safe.

    3.0.0upgrade guide

  • Rust 1.88 or newer is required.

    3.0.0upgrade guide

Deprecations 1

  • The CLI still reads napi.triples for compatibility, but new projects should use napi.targets.

    3.0.0upgrade guide

New APIs and options 7

  • The CLI can resolve the command from the provided arguments.

    3.4.0release notes

  • NapiCli exposes a programmatic build API that accepts build options and returns a task and abort handle.

    3.0.0upgrade guide

  • Enable this feature to keep using deprecated types while migrating incrementally; those types have known safety issues.

    3.0.0upgrade guide

  • The new flag enables cross compilation for the listed Linux targets, with all supported targets reaching GLIBC 2.17.

    3.0.0upgrade guide

  • JavaScript infrastructure can integrate NAPI-RS tools programmatically through NapiCli; all napi commands have corresponding APIs.

    3.0.0upgrade guide

  • A pnpm package template is supported in V3.

    3.0.0upgrade guide

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

    3.0.0upgrade guide

Performance 1

  • Type definition generation is parallelized deterministically.

    3.6.2release notes

Behavior and default changes 2

  • The threaded WASI worker pool is preloaded from the loader.

    3.10.7release notes

  • New projects now apply enableTypeDef when generating project files.

    3.6.2release notes

Tooling 7

  • The CLI now supports powerpc64 FreeBSD targets.

    3.10.9release notes

  • The CLI recognizes the aarch64-unknown-freebsd target.

    3.10.8release notes

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

    3.9.1release notes

  • The interactive new-project prompt now includes napi9.

    3.6.2release notes

  • The CLI is compatible with the latest wasi-sdk toolchain.

    3.6.2release notes

  • The CLI integrates cargo-xwin so developers can build many different targets on a single machine.

    3.0.0upgrade guide

  • The CLI integrates cargo-zigbuild so developers can build many different targets on a single machine.

    3.0.0upgrade guide

Fixes and other changes 19

  • The CLI resolves null when the incarnation probe's spawn throws synchronously.

    3.10.9release notes

  • The CLI takes over the WASI flavor of a binding swapped in by a postbuild fallback.

    3.10.9release notes

  • The CLI now resolves zigbuild artifacts under the base target triple.

    3.10.9release notes

  • The CLI keeps a WASI-managed root entry when it differs from package main.

    3.10.8release notes

  • On Android, generated Node loaders preopen the current working directory instead of /, which Termux cannot open.

    3.9.1release notes

  • Builds now select the matching emnapi archive and avoid double-linking _initialize on current WASI toolchains.

    3.9.1release notes

  • The variable now activates only when set to 'true' or 'error'.

    3.7.1release notes

  • Worker error messages are now received correctly.

    3.7.1release notes

  • New non-WASI projects no longer retain stale browser metadata.

    3.6.2release notes

  • WASI package generation preserves stricter Node engine ranges.

    3.6.2release notes

  • Generated class methods are preserved.

    3.6.2release notes

  • Pre-publish preserves existing optionalDependencies.

    3.6.2release notes

  • universalize resolves an absolute packageJsonPath correctly.

    3.6.2release notes

  • The pre-publish git log lookup now uses the target working directory.

    3.6.2release notes

  • Renaming a project now preserves its repository.

    3.6.2release notes

  • The CLI now uses jsPackageName from CLI options.

    3.5.0release notes

  • The CommonJS binding no longer uses createRequire.

    3.4.1release notes

  • Corrects how the CLI detects the OpenHarmony SDK path.

    3.4.0release notes

  • The package no longer invokes process.report on Windows.

    3.4.0release notes