Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5f95dca

Browse filesBrowse files
gabrielschulhofRafaelGSS
authored andcommitted
node-api: introduce experimental feature flags
Add a flag for each experimental feature to indicate its presence. That way, if we compile with `NAPI_EXPERIMENTAL` turned on, we'll be able to distinguish between what `NAPI_EXPERIMENTAL` used to mean on an old version of the headers when compiling against such an old version, and what it means on a new version of Node.js. PR-URL: #50991 Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent c0e5e74 commit 5f95dca
Copy full SHA for 5f95dca

File tree

Expand file treeCollapse file tree

3 files changed

+8
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+8
-0
lines changed
Open diff view settings
Collapse file

‎doc/contributing/adding-new-napi-api.md‎

Copy file name to clipboardExpand all lines: doc/contributing/adding-new-napi-api.md
+4Lines changed: 4 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ Node-API.
3434
* Experimental APIs **must** be documented as such.
3535
* Experimental APIs **must** require an explicit compile-time flag
3636
(`#define`) to be set to opt-in.
37+
* A feature flag of the form `NODE_API_EXPERIMENTAL_HAS_<FEATURE>` **must**
38+
be added with each experimental feature in order to allow code to
39+
distinguish between experimental features as present in one version of
40+
Node.js versus another.
3741
* Experimental APIs **must** be considered for backport.
3842
* Experimental status exit criteria **must** involve at least the
3943
following:
Collapse file

‎doc/contributing/releases-node-api.md‎

Copy file name to clipboardExpand all lines: doc/contributing/releases-node-api.md
+2Lines changed: 2 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ and update the define version guards with the release version:
100100
+ #endif // NAPI_VERSION >= 10
101101
```
102102
103+
Remove any feature flags of the form `NODE_API_EXPERIMENTAL_HAS_<FEATURE>`.
104+
103105
Also, update the Node-API version value of the `napi_get_version` test in
104106
`test/js-native-api/test_general/test.js` with the release version `x`:
105107
Collapse file

‎src/js_native_api.h‎

Copy file name to clipboardExpand all lines: src/js_native_api.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_create_string_utf16(napi_env env,
9393
size_t length,
9494
napi_value* result);
9595
#ifdef NAPI_EXPERIMENTAL
96+
#define NODE_API_EXPERIMENTAL_HAS_EXTERNAL_STRINGS
9697
NAPI_EXTERN napi_status NAPI_CDECL
9798
node_api_create_external_string_latin1(napi_env env,
9899
char* str,
@@ -518,6 +519,7 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_add_finalizer(napi_env env,
518519
#endif // NAPI_VERSION >= 5
519520

520521
#ifdef NAPI_EXPERIMENTAL
522+
#define NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER
521523

522524
NAPI_EXTERN napi_status NAPI_CDECL
523525
node_api_post_finalizer(napi_env env,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.