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

[v10.x] n-api: create N-API version 7 #35336

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
6 changes: 2 additions & 4 deletions doc/api/n-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2951,10 +2951,9 @@ of the ECMAScript Language Specification.
### napi_detach_arraybuffer
<!-- YAML
added: v10.22.0
napiVersion: 7
-->

> Stability: 1 - Experimental

```C
napi_status napi_detach_arraybuffer(napi_env env,
napi_value arraybuffer)
Expand All @@ -2977,10 +2976,9 @@ defined in [Section 24.1.1.3][] of the ECMAScript Language Specification.
### napi_is_detached_arraybuffer
<!-- YAML
added: v10.22.0
napiVersion: 7
-->

> Stability: 1 - Experimental

```C
napi_status napi_is_detached_arraybuffer(napi_env env,
napi_value arraybuffer,
Expand Down
6 changes: 3 additions & 3 deletions src/node_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define NAPI_VERSION 2147483647
#else
// The baseline version for N-API
#define NAPI_VERSION 6
#define NAPI_VERSION 7
#endif
#endif

Expand Down Expand Up @@ -747,7 +747,7 @@ napi_get_all_property_names(napi_env env,

#endif // NAPI_VERSION >= 6

#ifdef NAPI_EXPERIMENTAL
#if NAPI_VERSION >= 7
// ArrayBuffer detaching
NAPI_EXTERN napi_status
napi_detach_arraybuffer(napi_env env,
Expand All @@ -757,7 +757,7 @@ NAPI_EXTERN napi_status
napi_is_detached_arraybuffer(napi_env env,
napi_value value,
bool* result);
#endif // NAPI_EXPERIMENTAL
#endif // NAPI_VERSION >= 7

EXTERN_C_END

Expand Down
2 changes: 1 addition & 1 deletion src/node_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@

// The NAPI_VERSION provided by this version of the runtime. This is the version
// which the Node binary being built supports.
#define NAPI_VERSION 6
#define NAPI_VERSION 7

#endif // SRC_NODE_VERSION_H_
2 changes: 1 addition & 1 deletion test/addons-napi/test_general/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ assert.notStrictEqual(test_general.testGetPrototype(baseObject),

// test version management functions
// expected version is currently 4
assert.strictEqual(test_general.testGetVersion(), 6);
assert.strictEqual(test_general.testGetVersion(), 7);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the comment above should've also been changed but since this is a backport it's fine like this.


const [ major, minor, patch, release ] = test_general.testGetNodeVersion();
assert.strictEqual(process.version.split('-')[0],
Expand Down
1 change: 0 additions & 1 deletion test/addons-napi/test_typedarray/test_typedarray.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#define NAPI_EXPERIMENTAL
#include <node_api.h>
#include <string.h>
#include "../common.h"
Expand Down