Skip to content

Commit 93dd799

Browse files
gabrielschulhofrichardlau
authored andcommitted
node-api: define version 8
Mark as stable the APIs that define Node-API version 8. PR-URL: #37652 Backport-PR-URL: #37796 Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]>
1 parent 1872625 commit 93dd799

File tree

9 files changed

+22
-26
lines changed

9 files changed

+22
-26
lines changed

doc/api/n-api.md

+6-12
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,7 @@ For more details, review the [Object lifetime management][].
608608
#### napi_type_tag
609609
<!-- YAML
610610
added: v12.19.0
611+
napiVersion: 8
611612
-->
612613

613614
A 128-bit value stored as two unsigned 64-bit integers. It serves as a UUID
@@ -1620,10 +1621,9 @@ changes:
16201621
- version: v12.19.0
16211622
pr-url: https://github.com./nodejs/node/pull/34819
16221623
description: Changed signature of the `hook` callback.
1624+
napiVersion: 8
16231625
-->
16241626

1625-
> Stability: 1 - Experimental
1626-
16271627
```c
16281628
NAPI_EXTERN napi_status napi_add_async_cleanup_hook(
16291629
napi_env env,
@@ -1661,8 +1661,6 @@ changes:
16611661
description: Removed `env` parameter.
16621662
-->
16631663

1664-
> Stability: 1 - Experimental
1665-
16661664
```c
16671665
NAPI_EXTERN napi_status napi_remove_async_cleanup_hook(
16681666
napi_async_cleanup_hook_handle remove_handle);
@@ -4095,10 +4093,9 @@ specification).
40954093
#### napi_object_freeze
40964094
<!-- YAML
40974095
added: v12.20.0
4096+
napiVersion: 8
40984097
-->
40994098

4100-
> Stability: 1 - Experimental
4101-
41024099
```c
41034100
napi_status napi_object_freeze(napi_env env,
41044101
napi_value object);
@@ -4120,10 +4117,9 @@ ECMA-262 specification.
41204117
#### napi_object_seal
41214118
<!-- YAML
41224119
added: v12.20.0
4120+
napiVersion: 8
41234121
-->
41244122

4125-
> Stability: 1 - Experimental
4126-
41274123
```c
41284124
napi_status napi_object_seal(napi_env env,
41294125
napi_value object);
@@ -4776,10 +4772,9 @@ JavaScript object becomes garbage-collected.
47764772
### napi_type_tag_object
47774773
<!-- YAML
47784774
added: v12.19.0
4775+
napiVersion: 8
47794776
-->
47804777

4781-
> Stability: 1 - Experimental
4782-
47834778
```c
47844779
napi_status napi_type_tag_object(napi_env env,
47854780
napi_value js_object,
@@ -4803,10 +4798,9 @@ If the object already has an associated type tag, this API will return
48034798
### napi_check_object_type_tag
48044799
<!-- YAML
48054800
added: v12.19.0
4801+
napiVersion: 8
48064802
-->
48074803

4808-
> Stability: 1 - Experimental
4809-
48104804
```c
48114805
napi_status napi_check_object_type_tag(napi_env env,
48124806
napi_value js_object,

src/js_native_api.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// functions available in a new version of N-API that is not yet ported in all
1818
// LTS versions, they can set NAPI_VERSION knowing that they have specifically
1919
// depended on that version.
20-
#define NAPI_VERSION 7
20+
#define NAPI_VERSION 8
2121
#endif
2222
#endif
2323

@@ -539,7 +539,7 @@ NAPI_EXTERN napi_status napi_is_detached_arraybuffer(napi_env env,
539539
bool* result);
540540
#endif // NAPI_VERSION >= 7
541541

542-
#ifdef NAPI_EXPERIMENTAL
542+
#if NAPI_VERSION >= 8
543543
// Type tagging
544544
NAPI_EXTERN napi_status napi_type_tag_object(napi_env env,
545545
napi_value value,
@@ -554,7 +554,7 @@ NAPI_EXTERN napi_status napi_object_freeze(napi_env env,
554554
napi_value object);
555555
NAPI_EXTERN napi_status napi_object_seal(napi_env env,
556556
napi_value object);
557-
#endif // NAPI_EXPERIMENTAL
557+
#endif // NAPI_VERSION >= 8
558558

559559
EXTERN_C_END
560560

src/js_native_api_types.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ typedef enum {
3131
// from instance properties. Ignored by napi_define_properties.
3232
napi_static = 1 << 10,
3333

34-
#ifdef NAPI_EXPERIMENTAL
34+
#if NAPI_VERSION >= 8
3535
// Default for class methods.
3636
napi_default_method = napi_writable | napi_configurable,
3737

3838
// Default for object properties, like in JS obj[prop].
3939
napi_default_jsproperty = napi_writable |
4040
napi_enumerable |
4141
napi_configurable,
42-
#endif // NAPI_EXPERIMENTAL
42+
#endif // NAPI_VERSION >= 8
4343
} napi_property_attributes;
4444

4545
typedef enum {
@@ -146,11 +146,11 @@ typedef enum {
146146
} napi_key_conversion;
147147
#endif // NAPI_VERSION >= 6
148148

149-
#ifdef NAPI_EXPERIMENTAL
149+
#if NAPI_VERSION >= 8
150150
typedef struct {
151151
uint64_t lower;
152152
uint64_t upper;
153153
} napi_type_tag;
154-
#endif // NAPI_EXPERIMENTAL
154+
#endif // NAPI_VERSION >= 8
155155

156156
#endif // SRC_JS_NATIVE_API_TYPES_H_

src/node_api.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ napi_ref_threadsafe_function(napi_env env, napi_threadsafe_function func);
250250

251251
#endif // NAPI_VERSION >= 4
252252

253-
#ifdef NAPI_EXPERIMENTAL
253+
#if NAPI_VERSION >= 8
254254

255255
NAPI_EXTERN napi_status napi_add_async_cleanup_hook(
256256
napi_env env,
@@ -261,6 +261,10 @@ NAPI_EXTERN napi_status napi_add_async_cleanup_hook(
261261
NAPI_EXTERN napi_status napi_remove_async_cleanup_hook(
262262
napi_async_cleanup_hook_handle remove_handle);
263263

264+
#endif // NAPI_VERSION >= 8
265+
266+
#ifdef NAPI_EXPERIMENTAL
267+
264268
NAPI_EXTERN napi_status
265269
node_api_get_module_file_name(napi_env env, const char** result);
266270

src/node_api_types.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ typedef struct {
4141
const char* release;
4242
} napi_node_version;
4343

44-
#ifdef NAPI_EXPERIMENTAL
44+
#if NAPI_VERSION >= 8
4545
typedef struct napi_async_cleanup_hook_handle__* napi_async_cleanup_hook_handle;
4646
typedef void (*napi_async_cleanup_hook)(napi_async_cleanup_hook_handle handle,
4747
void* data);
48-
#endif // NAPI_EXPERIMENTAL
48+
#endif // NAPI_VERSION >= 8
4949

5050
#endif // SRC_NODE_API_TYPES_H_

src/node_version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,6 @@
9393

9494
// The NAPI_VERSION provided by this version of the runtime. This is the version
9595
// which the Node binary being built supports.
96-
#define NAPI_VERSION 7
96+
#define NAPI_VERSION 8
9797

9898
#endif // SRC_NODE_VERSION_H_

test/js-native-api/test_general/test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ assert.notStrictEqual(test_general.testGetPrototype(baseObject),
3333
test_general.testGetPrototype(extendedObject));
3434

3535
// Test version management functions
36-
assert.strictEqual(test_general.testGetVersion(), 7);
36+
assert.strictEqual(test_general.testGetVersion(), 8);
3737

3838
[
3939
123,

test/js-native-api/test_object/test_object.c

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#define NAPI_EXPERIMENTAL
21
#include <js_native_api.h>
32
#include "../common.h"
43
#include <string.h>

test/node-api/test_async_cleanup_hook/binding.c

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#define NAPI_EXPERIMENTAL
21
#include "node_api.h"
32
#include "assert.h"
43
#include "uv.h"

0 commit comments

Comments
 (0)