Skip to content

Commit 09838cf

Browse files
committed
build: include minimal V8 headers in distribution
Because Node.js currently distributes all V8 headers, it is not clear which ones are part of our API and ABI compatibility contract. V8 may add, remove, or change headers at any time, preventing us sometimes from updating because the change could affect addons which may depend on them. Moreover, the `cppgc` library, included in V8, is exposed even though it is still in active development and doesn't have a stable API. Node.js should choose exactly which headers are exposed and part of our native API, so that it's easier to reason about changes during V8 updates and to prevent us from automatically increasing the API surface when new headers are added by V8. Instead of specifically excluding v8-inspector, only include `v8.h`, `v8-platform.h` (used in `node.h`) and `v8-profiler.h`.
1 parent 1e34df1 commit 09838cf

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

tools/install.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,17 @@ def files(action):
157157
headers(action)
158158

159159
def headers(action):
160-
def ignore_inspector_headers(files_arg, dest):
161-
inspector_headers = [
162-
'deps/v8/include/v8-inspector.h',
163-
'deps/v8/include/v8-inspector-protocol.h'
160+
def wanted_v8_headers(files_arg, dest):
161+
v8_headers = [
162+
'deps/v8/include/cppgc/common.h',
163+
'deps/v8/include/v8.h',
164+
'deps/v8/include/v8-internal.h',
165+
'deps/v8/include/v8-platform.h',
166+
'deps/v8/include/v8-profiler.h',
167+
'deps/v8/include/v8-version.h',
168+
'deps/v8/include/v8config.h',
164169
]
165-
files_arg = [name for name in files_arg if name not in inspector_headers]
170+
files_arg = [name for name in files_arg if name in v8_headers]
166171
action(files_arg, dest)
167172

168173
action([
@@ -182,7 +187,7 @@ def ignore_inspector_headers(files_arg, dest):
182187
if sys.platform.startswith('aix'):
183188
action(['out/Release/node.exp'], 'include/node/')
184189

185-
subdir_files('deps/v8/include', 'include/node/', ignore_inspector_headers)
190+
subdir_files('deps/v8/include', 'include/node/', wanted_v8_headers)
186191

187192
if 'false' == variables.get('node_shared_libuv'):
188193
subdir_files('deps/uv/include', 'include/node/', action)

0 commit comments

Comments
 (0)