Skip to content

Commit 8e3e5bf

Browse files
authored
move dataviewSharedArrayBuffer gate out of experimentalFeatures (#62)
Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
1 parent 7ed8b4d commit 8e3e5bf

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export default defineConfig([
102102
gc: 'readonly',
103103
gcUntil: 'readonly',
104104
experimentalFeatures: 'readonly',
105+
runtimeFeatures: 'readonly',
105106
onUncaughtException: 'readonly',
106107
napiVersion: 'readonly',
107108
skipTest: 'readonly',

implementors/node/features.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
// Declares which experimental Node-API features this runtime supports.
2-
// Each key corresponds to a NODE_API_EXPERIMENTAL_HAS_* compile-time macro.
1+
// Declares which Node-API features this runtime supports, for tests to gate on.
32
// Other implementors should set unsupported features to false or omit them.
43

54
const [major, minor, patch] = process.version.slice(1).split('.').map(Number);
65

6+
// Experimental features behind the NAPI_EXPERIMENTAL define. Each key
7+
// corresponds to a NODE_API_EXPERIMENTAL_HAS_* compile-time macro.
78
globalThis.experimentalFeatures = {
89
// node_api_is_sharedarraybuffer and node_api_create_sharedarraybuffer were
910
// added in Node.js v24.9.0. Earlier versions do not export these symbols,
@@ -12,6 +13,10 @@ globalThis.experimentalFeatures = {
1213
createObjectWithProperties: true,
1314
setPrototype: true,
1415
postFinalizer: true,
16+
};
17+
18+
// Version-dependent behaviors of stable (non-experimental) Node-API.
19+
globalThis.runtimeFeatures = {
1520
// napi_create_dataview accepts a SharedArrayBuffer-backed buffer only since
1621
// Node.js v24.13.1 and v25.4.0 (nodejs/node#60473). It was not backported to
1722
// v20.x or v22.x, where such calls fail with "invalid argument".

tests/js-native-api/test_dataview/test_sharedarraybuffer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// napi_create_dataview accepts a SharedArrayBuffer-backed buffer only on newer
44
// Node.js releases (see implementors/node/features.js).
5-
if (!experimentalFeatures.dataviewSharedArrayBuffer) {
5+
if (!runtimeFeatures.dataviewSharedArrayBuffer) {
66
skipTest();
77
}
88

0 commit comments

Comments
 (0)