Skip to content

node-api: rename internal NAPI_VERSION definition

The NAPI_VERSION defined in node_version.h has a different meaning than the one defined in the js_native_api.h. The one from node_version.h is identical to napi_get_version(), indicating the highest Node-API version supported by the Node.js runtime. While the NAPI_VERSION defined in js_native_api.h indicates the Node-API version required by the addon and should be lower than or equal to the NAPI_VERSION of the Node.js runtime.

Rename the one defined in node_version.h to NODE_API_SUPPORTED_VERSION_MAX. This avoids unexpected duplicated definitions of NAPI_VERSION when both node_version.h and js_native_api.h are included.

Fixes https://github.com/nodejs/node/issues/48310

Merge request reports

Loading