Skip to content

Commit a86334f

Browse files
gabrielschulhofdanielleadams
authored andcommitted
node-api: define version 8
Mark as stable the APIs that define Node-API version 8. PR-URL: #37652 Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent 55e522c commit a86334f

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
@@ -689,6 +689,7 @@ For more details, review the [Object lifetime management][].
689689
added:
690690
- v14.8.0
691691
- v12.19.0
692+
napiVersion: 8
692693
-->
693694

694695
A 128-bit value stored as two unsigned 64-bit integers. It serves as a UUID
@@ -1703,6 +1704,7 @@ with `napi_add_env_cleanup_hook`, otherwise the process will abort.
17031704
added:
17041705
- v14.8.0
17051706
- v12.19.0
1707+
napiVersion: 8
17061708
changes:
17071709
- version:
17081710
- v14.10.0
@@ -1711,8 +1713,6 @@ changes:
17111713
description: Changed signature of the `hook` callback.
17121714
-->
17131715

1714-
> Stability: 1 - Experimental
1715-
17161716
```c
17171717
NAPI_EXTERN napi_status napi_add_async_cleanup_hook(
17181718
napi_env env,
@@ -1754,8 +1754,6 @@ changes:
17541754
description: Removed `env` parameter.
17551755
-->
17561756

1757-
> Stability: 1 - Experimental
1758-
17591757
```c
17601758
NAPI_EXTERN napi_status napi_remove_async_cleanup_hook(
17611759
napi_async_cleanup_hook_handle remove_handle);
@@ -4211,10 +4209,9 @@ specification).
42114209
#### napi_object_freeze
42124210
<!-- YAML
42134211
added: v14.14.0
4212+
napiVersion: 8
42144213
-->
42154214

4216-
> Stability: 1 - Experimental
4217-
42184215
```c
42194216
napi_status napi_object_freeze(napi_env env,
42204217
napi_value object);
@@ -4236,10 +4233,9 @@ ECMA-262 specification.
42364233
#### napi_object_seal
42374234
<!-- YAML
42384235
added: v14.14.0
4236+
napiVersion: 8
42394237
-->
42404238

4241-
> Stability: 1 - Experimental
4242-
42434239
```c
42444240
napi_status napi_object_seal(napi_env env,
42454241
napi_value object);
@@ -4901,10 +4897,9 @@ JavaScript object becomes garbage-collected.
49014897
added:
49024898
- v14.8.0
49034899
- v12.19.0
4900+
napiVersion: 8
49044901
-->
49054902

4906-
> Stability: 1 - Experimental
4907-
49084903
```c
49094904
napi_status napi_type_tag_object(napi_env env,
49104905
napi_value js_object,
@@ -4930,10 +4925,9 @@ If the object already has an associated type tag, this API will return
49304925
added:
49314926
- v14.8.0
49324927
- v12.19.0
4928+
napiVersion: 8
49334929
-->
49344930

4935-
> Stability: 1 - Experimental
4936-
49374931
```c
49384932
napi_status napi_check_object_type_tag(napi_env env,
49394933
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 {
@@ -150,11 +150,11 @@ typedef enum {
150150
} napi_key_conversion;
151151
#endif // NAPI_VERSION >= 6
152152

153-
#ifdef NAPI_EXPERIMENTAL
153+
#if NAPI_VERSION >= 8
154154
typedef struct {
155155
uint64_t lower;
156156
uint64_t upper;
157157
} napi_type_tag;
158-
#endif // NAPI_EXPERIMENTAL
158+
#endif // NAPI_VERSION >= 8
159159

160160
#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)