Skip to content

Commit 7d2bc52

Browse files
committed
src: include node_api_types.h instead of node_api.h in node.h
Including `node.h` should not result in all of Node-API also being available to callers. Users who want `node_api.h` contents should explicitly include that header. We currently include it specifically for `napi_addon_register_func`; by moving that into `node_api_types.h` and including that instead, we can reduce unintentionally included API surface a lot. Refs: #60345 (comment) PR-URL: #60496 Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
1 parent 36c082b commit 7d2bc52

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/node.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
#include "v8-platform.h" // NOLINT(build/include_order)
7777
#include "node_version.h" // NODE_MODULE_VERSION
7878

79-
#include "node_api.h"
79+
#include "node_api_types.h" // napi_addon_register_func
8080

8181
#include <functional>
8282
#include <memory>
@@ -124,6 +124,7 @@
124124

125125
// Forward-declare libuv loop
126126
struct uv_loop_s;
127+
struct napi_module;
127128

128129
// Forward-declare these functions now to stop MSVS from becoming
129130
// terminally confused when it's done in node_internals.h

0 commit comments

Comments
 (0)