Skip to content

Commit 36abc18

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

File tree

9 files changed

+37
-33
lines changed

9 files changed

+37
-33
lines changed

doc/api/n-api.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,10 @@ For more details, review the [Object lifetime management][].
686686

687687
#### napi_type_tag
688688
<!-- YAML
689-
added: v14.8.0
689+
added:
690+
- v14.8.0
691+
- v12.19.0
692+
napiVersion: 8
690693
-->
691694

692695
A 128-bit value stored as two unsigned 64-bit integers. It serves as a UUID
@@ -1694,15 +1697,16 @@ with `napi_add_env_cleanup_hook`, otherwise the process will abort.
16941697

16951698
#### napi_add_async_cleanup_hook
16961699
<!-- YAML
1697-
added: v14.8.0
1700+
added:
1701+
- v14.8.0
1702+
- v12.19.0
1703+
napiVersion: 8
16981704
changes:
16991705
- version: v14.10.0
17001706
pr-url: https://github.com/nodejs/node/pull/34819
17011707
description: Changed signature of the `hook` callback.
17021708
-->
17031709

1704-
> Stability: 1 - Experimental
1705-
17061710
```c
17071711
NAPI_EXTERN napi_status napi_add_async_cleanup_hook(
17081712
napi_env env,
@@ -1740,8 +1744,6 @@ changes:
17401744
description: Removed `env` parameter.
17411745
-->
17421746

1743-
> Stability: 1 - Experimental
1744-
17451747
```c
17461748
NAPI_EXTERN napi_status napi_remove_async_cleanup_hook(
17471749
napi_async_cleanup_hook_handle remove_handle);
@@ -4196,11 +4198,12 @@ specification).
41964198

41974199
#### napi_object_freeze
41984200
<!-- YAML
4199-
added: v14.14.0
4201+
added:
4202+
- v14.14.0
4203+
- v12.20.0
4204+
napiVersion: 8
42004205
-->
42014206

4202-
> Stability: 1 - Experimental
4203-
42044207
```c
42054208
napi_status napi_object_freeze(napi_env env,
42064209
napi_value object);
@@ -4221,11 +4224,12 @@ ECMA-262 specification.
42214224

42224225
#### napi_object_seal
42234226
<!-- YAML
4224-
added: v14.14.0
4227+
added:
4228+
- v14.14.0
4229+
- v12.20.0
4230+
napiVersion: 8
42254231
-->
42264232

4227-
> Stability: 1 - Experimental
4228-
42294233
```c
42304234
napi_status napi_object_seal(napi_env env,
42314235
napi_value object);
@@ -4884,11 +4888,12 @@ JavaScript object becomes garbage-collected.
48844888

48854889
### napi_type_tag_object
48864890
<!-- YAML
4887-
added: v14.8.0
4891+
added:
4892+
- v14.8.0
4893+
- v12.19.0
4894+
napiVersion: 8
48884895
-->
48894896

4890-
> Stability: 1 - Experimental
4891-
48924897
```c
48934898
napi_status napi_type_tag_object(napi_env env,
48944899
napi_value js_object,
@@ -4911,11 +4916,12 @@ If the object already has an associated type tag, this API will return
49114916

49124917
### napi_check_object_type_tag
49134918
<!-- YAML
4914-
added: v14.8.0
4919+
added:
4920+
- v14.8.0
4921+
- v12.19.0
4922+
napiVersion: 8
49154923
-->
49164924

4917-
> Stability: 1 - Experimental
4918-
49194925
```c
49204926
napi_status napi_check_object_type_tag(napi_env env,
49214927
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: 2 additions & 2 deletions
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,7 +261,7 @@ 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_EXPERIMENTAL
264+
#endif // NAPI_VERSION >= 8
265265

266266
EXTERN_C_END
267267

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)