Skip to content

Update napi-rs: @napi-rs/cli 3.10.8 and latest napi crates in ferric-example - #479

Open
kraenhansen wants to merge 3 commits into
nextfrom
ferric/update-napi-rs
Open

kraenhansen wants to merge 3 commits into
nextfrom
ferric/update-napi-rs

Conversation

@kraenhansen

Copy link
Copy Markdown
Collaborator

Summary

  • ferric-cli: bump @napi-rs/cli from ~3.0.3 to ~3.10.8 (+ patch changeset). ferric_example.d.ts regenerated with the new CLI — the only difference is a blank line after the /* eslint-disable */ header.
  • ferric-example: bump napi =3.4.0 → 3.14.2, napi-derive 3.3.0 → 3.6.12, napi-build 2.2.4 → 2.6.0, and drop the direct napi-sys = "=3.0.1" pin added for Ferric doesn't support napi-sys > 3.0.1 / napi > 3.4.0 #331.

Why the #331 pin can go

#331 was caused by napi-sys' dyn-symbols feature, which resolves Node-API functions from the host process via libloading instead of linking them, so weak-node-api can't provide them. In napi 3.14.x, napi depends on napi-sys with default-features = false and only turns on dyn-symbols through its own default features, which ferric-example already disables. Verified with cargo tree -e features -i napi-sys (no dyn-symbols), and a host release build's .so imports 28 napi_* symbols directly with no dlopen/dlsym.

This doesn't fully close #331: crates that keep napi's default features still hit it.

Why this targets next rather than main

These commits briefly landed on main directly (since reverted by a force-push). There, CI's Test app (iOS) crashed as soon as the ferric-example suite loaded the addon:

Node-API function 'napi_add_env_cleanup_hook' called before it was injected!

napi 3.14 calls napi_add_env_cleanup_hook during module registration (bindgen_runtime/module_register.rs). On main, the host injector only forwards engine functions plus a 12-entry IMPLEMENTED_RUNTIME_FUNCTIONS allowlist, which doesn't include it. On next, the injector forwards every Node-API function to Hermes' own implementation, so this should work there. That's the main thing the iOS/Android runs on this PR need to confirm.

Notes

  • @napi-rs/cli 3.10.8 depends directly on typescript@6.0.3. pnpm now also uses it for @react-native-community/cli's optional typescript peer, which explains the extra peer-suffix churn in pnpm-lock.yaml.
  • Lockfile regenerated with pnpm install --lockfile-only on top of next's lockfile, not merged by hand.
  • Ran locally (Linux): build, Prettier, lint, ferric build --dts-only, host cargo build --release. No device testing.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GR8DCQmcDBsRJFfDwhy9qx


Generated by Claude Code

Bump @napi-rs/cli from ~3.0.3 to ~3.10.8 and regenerate the
ferric-example TypeScript declarations with the new version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GR8DCQmcDBsRJFfDwhy9qx
Bump napi to 3.14.2, napi-derive to 3.6.12 and napi-build to 2.6.0,
and remove the direct napi-sys =3.0.1 pin added for #331.

napi now depends on napi-sys with default-features = false and only
enables its dyn-symbols feature through napi's own default features,
which this crate already disables. The addon therefore links the
Node-API symbols at link time (resolved by weak-node-api) rather than
loading them from the host process.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GR8DCQmcDBsRJFfDwhy9qx
@kraenhansen kraenhansen added Apple 🍎 Anything related to the Apple platform (iOS, macOS, Cocoapods, Xcode, XCFrameworks, etc.) Android 🤖 Anything related to the Android platform (Gradle, NDK, Android SDK) Ferric 🦀 labels Oct 13, 2026 — with Claude
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GR8DCQmcDBsRJFfDwhy9qx

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Android 🤖 Anything related to the Android platform (Gradle, NDK, Android SDK) Apple 🍎 Anything related to the Apple platform (iOS, macOS, Cocoapods, Xcode, XCFrameworks, etc.) Ferric 🦀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ferric doesn't support napi-sys > 3.0.1 / napi > 3.4.0

2 participants