From 85ee01c8383aba458b0388c9908ed5d92185e4e2 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 31 Oct 2025 14:59:37 +0100 Subject: [PATCH] src: move `napi_addon_register_func` to `node_api_types.h` This means that `node.h` can include only this file, instead of the entirety of `node_api.h`. Split out from https://github.com/nodejs/node/pull/60496 since it was rightfully pointed out that the breaking part of the change should not touch Node-API headers. PR-URL: https://github.com/nodejs/node/pull/60512 Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig --- src/node_api.h | 4 ---- src/node_api_types.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/node_api.h b/src/node_api.h index 35e5c3e49d..46dbb02b47 100644 --- a/src/node_api.h +++ b/src/node_api.h @@ -33,10 +33,6 @@ struct uv_loop_s; // Forward declaration. #define NAPI_NO_RETURN #endif -typedef napi_value(NAPI_CDECL* napi_addon_register_func)(napi_env env, - napi_value exports); -typedef int32_t(NAPI_CDECL* node_api_addon_get_api_version_func)(void); - // Used by deprecated registration method napi_module_register. typedef struct napi_module { int nm_version; diff --git a/src/node_api_types.h b/src/node_api_types.h index 9c2f03f4d0..2580f15c03 100644 --- a/src/node_api_types.h +++ b/src/node_api_types.h @@ -3,6 +3,10 @@ #include "js_native_api_types.h" +typedef napi_value(NAPI_CDECL* napi_addon_register_func)(napi_env env, + napi_value exports); +typedef int32_t(NAPI_CDECL* node_api_addon_get_api_version_func)(void); + typedef struct napi_callback_scope__* napi_callback_scope; typedef struct napi_async_context__* napi_async_context; typedef struct napi_async_work__* napi_async_work;