Skip to content

Conversation

@legendecas
Copy link
Member

Including node.h should not enable NAPI_EXPERIMENTAL by default.

Fixes: #60311

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Oct 21, 2025
@legendecas legendecas added the node-api Issues and PRs related to the Node-API. label Oct 21, 2025
@codecov
Copy link

codecov bot commented Oct 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.58%. Comparing base (2fb82c8) to head (a31d17e).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #60345      +/-   ##
==========================================
- Coverage   88.59%   88.58%   -0.01%     
==========================================
  Files         704      704              
  Lines      208474   208398      -76     
  Branches    40067    40064       -3     
==========================================
- Hits       184696   184618      -78     
+ Misses      15805    15798       -7     
- Partials     7973     7982       +9     
Files with missing lines Coverage Δ
src/js_native_api_v8.cc 76.50% <ø> (ø)
src/node.h 92.30% <ø> (ø)
src/node_api.cc 75.25% <ø> (ø)
src/node_api_internals.h 100.00% <ø> (ø)

... and 44 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ... this is technically semver-major, right?

I'd honestly try to remove the #include "node_api.h" as well, that's a header you should explicitly include if you want it to be available

@legendecas
Copy link
Member Author

legendecas commented Oct 22, 2025

I'd honestly try to remove the #include "node_api.h" as well, that's a header you should explicitly include if you want it to be available

The napi_addon_register_func is defined in node_api.h:

node/src/node.h

Lines 1310 to 1314 in f46d501

NODE_EXTERN void AddLinkedBinding(
Environment* env,
const char* name,
napi_addon_register_func fn,
int32_t module_api_version = NODE_API_DEFAULT_MODULE_API_VERSION);

We may duplicate it in node.h but I'm not convinced yet it is worthwhile to do so...

@legendecas
Copy link
Member Author

legendecas commented Oct 22, 2025

this is technically semver-major, right?

Technically, addons using experimental node-apis are expected to define NAPI_EXPERIMENTAL as documented. Pure Node-API addons should use node_api.h only and should not include node.h so they are not affected by this change. This change only affects embedders who use experimental Node-APIs.

I'd find it leaning towards a bug fix. Do you feel strongly that this should be a semver-major?

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

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. node-api Issues and PRs related to the Node-API.

Projects

Status: Need Triage

Development

Successfully merging this pull request may close these issues.

"NAPI_EXPERIMENTAL is enabled" when building addons against node v25.0.0

5 participants