Skip to content

Commit f93d03d

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 <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]>
1 parent 55e522c commit f93d03d

File tree

9 files changed

+28
-28
lines changed

9 files changed

+28
-28
lines changed

doc/api/n-api.md

Lines changed: 12 additions & 14 deletions
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);
@@ -4210,11 +4208,12 @@ specification).
42104208

42114209
#### napi_object_freeze
42124210
<!-- YAML
4213-
added: v14.14.0
4211+
added:
4212+
- v14.14.0
4213+
- v12.20.0
4214+
napiVersion: 8
42144215
-->
42154216

4216-
> Stability: 1 - Experimental
4217-
42184217
```c
42194218
napi_status napi_object_freeze(napi_env env,
42204219
napi_value object);
@@ -4235,11 +4234,12 @@ ECMA-262 specification.
42354234

42364235
#### napi_object_seal
42374236
<!-- YAML
4238-
added: v14.14.0
4237+
added:
4238+
- v14.14.0
4239+
- v12.20.0
4240+
napiVersion: 8
42394241
-->
42404242

4241-
> Stability: 1 - Experimental
4242-
42434243
```c
42444244
napi_status napi_object_seal(napi_env env,
42454245
napi_value object);
@@ -4901,10 +4901,9 @@ JavaScript object becomes garbage-collected.
49014901
added:
49024902
- v14.8.0
49034903
- v12.19.0
4904+
napiVersion: 8
49044905
-->
49054906

4906-
> Stability: 1 - Experimental
4907-
49084907
```c
49094908
napi_status napi_type_tag_object(napi_env env,
49104909
napi_value js_object,
@@ -4930,10 +4929,9 @@ If the object already has an associated type tag, this API will return
49304929
added:
49314930
- v14.8.0
49324931
- v12.19.0
4932+
napiVersion: 8
49334933
-->
49344934

4935-
> Stability: 1 - Experimental
4936-
49374935
```c
49384936
napi_status napi_check_object_type_tag(napi_env env,
49394937
napi_value js_object,

src/js_native_api.h

Lines changed: 3 additions & 3 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 5 additions & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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)