Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-api: introduce experimental feature flags #50991

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/contributing/adding-new-napi-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ Node-API.
* Experimental APIs **must** be documented as such.
* Experimental APIs **must** require an explicit compile-time flag
(`#define`) to be set to opt-in.
* A feature flag of the form `NODE_API_EXPERIMENTAL_HAS_<FEATURE>` **must**
be added with each experimental feature in order to allow code to
distinguish between experimental features as present in one version of
Node.js versus another.
* Experimental APIs **must** be considered for backport.
* Experimental status exit criteria **must** involve at least the
following:
Expand Down
2 changes: 2 additions & 0 deletions doc/contributing/releases-node-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ and update the define version guards with the release version:
+ #endif // NAPI_VERSION >= 10
```

Remove any feature flags of the form `NODE_API_EXPERIMENTAL_HAS_<FEATURE>`.

Also, update the Node-API version value of the `napi_get_version` test in
`test/js-native-api/test_general/test.js` with the release version `x`:

Expand Down
2 changes: 2 additions & 0 deletions src/js_native_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_create_string_utf16(napi_env env,
size_t length,
napi_value* result);
#ifdef NAPI_EXPERIMENTAL
#define NODE_API_EXPERIMENTAL_HAS_EXTERNAL_STRINGS
NAPI_EXTERN napi_status NAPI_CDECL
node_api_create_external_string_latin1(napi_env env,
char* str,
Expand Down Expand Up @@ -518,6 +519,7 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_add_finalizer(napi_env env,
#endif // NAPI_VERSION >= 5

#ifdef NAPI_EXPERIMENTAL
#define NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER

NAPI_EXTERN napi_status NAPI_CDECL
node_api_post_finalizer(napi_env env,
Expand Down
Loading