From 719a0f11f3f993d05d11f05135ce640be0eb2dc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=A6n=20Hansen?= Date: Sat, 31 Oct 2026 19:52:43 +0100 Subject: [PATCH 1/3] docs(weak-node-api): update outdated rationale in README Co-Authored-By: Claude Opus 5.5 (1M context) --- packages/weak-node-api/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/weak-node-api/README.md b/packages/weak-node-api/README.md index 073c9121..e9b4e2d1 100644 --- a/packages/weak-node-api/README.md +++ b/packages/weak-node-api/README.md @@ -6,14 +6,14 @@ This package is part of the [Node-API for React Native](https://github.com/calls ## Why is this needed? -Android's dynamic linker restricts access to global symbols—dynamic libraries must explicitly declare dependencies as `DT_NEEDED` to access symbols. In the context of React Native, the Node-API implementation is split between Hermes and a host runtime, native addons built for Android would otherwise need to explicitly link against both - which is not ideal for multiple reasons. +Android's dynamic linker restricts access to global symbols—dynamic libraries must explicitly declare dependencies as `DT_NEEDED` to access symbols. In the context of React Native, Node-API is implemented by Hermes, but native addons are compiled independently of any app, so they have no specific Hermes to link against. This library provides a solution by: - Exposing only Node-API functions without implementation -- Allowing runtime injection of the actual implementation by the host +- Allowing runtime injection of the actual implementation by the host, which is also how the host's `napi_fatal_error` override, logging to logcat on Android, reaches addons - Eliminating the need for addons to suppress undefined symbol errors ## Is this usable in the context of Node.js? -While originally designed for React Native's split Node-API implementation, this approach could potentially be adapted for Node.js scenarios where addons need to link with undefined symbols allowed. Usage patterns and examples for Node.js contexts are being explored and this pattern could eventually be upstreamed to Node.js itself, benefiting the broader Node-API ecosystem. +While originally designed for React Native's then-split Node-API implementation, this approach could potentially be adapted for Node.js scenarios where addons need to link with undefined symbols allowed. Usage patterns and examples for Node.js contexts are being explored and this pattern could eventually be upstreamed to Node.js itself, benefiting the broader Node-API ecosystem. From 086660b2c5f393954bfb958fcd01d002f59522b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=A6n=20Hansen?= Date: Sat, 31 Oct 2026 19:53:11 +0100 Subject: [PATCH 2/3] ci: trigger checks with weak-node-api label Co-Authored-By: Claude Opus 5.5 (1M context) From f80fff11c5fd9a7b5ee955b9e16a334ab383d2f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=A6n=20Hansen?= Date: Sat, 31 Oct 2026 19:58:40 +0100 Subject: [PATCH 3/3] docs(weak-node-api): link the vtable proposal as the long-term solution Co-Authored-By: Claude Opus 5.5 (1M context) --- packages/weak-node-api/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/weak-node-api/README.md b/packages/weak-node-api/README.md index e9b4e2d1..e4780706 100644 --- a/packages/weak-node-api/README.md +++ b/packages/weak-node-api/README.md @@ -14,6 +14,8 @@ This library provides a solution by: - Allowing runtime injection of the actual implementation by the host, which is also how the host's `napi_fatal_error` override, logging to logcat on Android, reaches addons - Eliminating the need for addons to suppress undefined symbol errors +[nodejs/node#60916](https://github.com/nodejs/node/pull/60916) proposes a better long-term solution: the runtime exposes Node-API through vtables reachable from `napi_env`, so an addon links against nothing and this library is no longer needed. + ## Is this usable in the context of Node.js? While originally designed for React Native's then-split Node-API implementation, this approach could potentially be adapted for Node.js scenarios where addons need to link with undefined symbols allowed. Usage patterns and examples for Node.js contexts are being explored and this pattern could eventually be upstreamed to Node.js itself, benefiting the broader Node-API ecosystem.