Skip to content

Commit 710c905

Browse files
Gabriel Schulhoflegendecas
authored andcommitted
n-api: define release 6
Mark all N-APIs that have been added since version 5 as stable. PR-URL: #32058 Fixes: nodejs/abi-stable-node#393 Co-Authored-By: legendecas <[email protected]> Signed-off-by: Gabriel Schulhof <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 4d5981b commit 710c905

File tree

14 files changed

+22
-38
lines changed

14 files changed

+22
-38
lines changed

doc/api/n-api.md

+12-20
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ tied to the life cycle of the Agent.
374374
### napi_set_instance_data
375375
<!-- YAML
376376
added: v12.8.0
377+
napiVersion: 6
377378
-->
378379

379380
```C
@@ -401,6 +402,7 @@ by the previous call, it will not be called.
401402
### napi_get_instance_data
402403
<!-- YAML
403404
added: v12.8.0
405+
napiVersion: 6
404406
-->
405407

406408
```C
@@ -1663,10 +1665,9 @@ the `napi_value` in question is of the JavaScript type expected by the API.
16631665
#### napi_key_collection_mode
16641666
<!-- YAML
16651667
added: v13.7.0
1668+
napiVersion: 6
16661669
-->
16671670

1668-
> Stability: 1 - Experimental
1669-
16701671
```C
16711672
typedef enum {
16721673
napi_key_include_prototypes,
@@ -1685,10 +1686,9 @@ of the objects's prototype chain as well.
16851686
#### napi_key_filter
16861687
<!-- YAML
16871688
added: v13.7.0
1689+
napiVersion: 6
16881690
-->
16891691

1690-
> Stability: 1 - Experimental
1691-
16921692
```C
16931693
typedef enum {
16941694
napi_key_all_properties = 0,
@@ -1705,10 +1705,9 @@ Property filter bits. They can be or'ed to build a composite filter.
17051705
#### napi_key_conversion
17061706
<!-- YAML
17071707
added: v13.7.0
1708+
napiVersion: 6
17081709
-->
17091710

1710-
> Stability: 1 - Experimental
1711-
17121711
```C
17131712
typedef enum {
17141713
napi_key_keep_numbers,
@@ -2262,10 +2261,9 @@ The JavaScript `Number` type is described in
22622261
#### napi_create_bigint_int64
22632262
<!-- YAML
22642263
added: v10.7.0
2264+
napiVersion: 6
22652265
-->
22662266

2267-
> Stability: 1 - Experimental
2268-
22692267
```C
22702268
napi_status napi_create_bigint_int64(napi_env env,
22712269
int64_t value,
@@ -2283,10 +2281,9 @@ This API converts the C `int64_t` type to the JavaScript `BigInt` type.
22832281
#### napi_create_bigint_uint64
22842282
<!-- YAML
22852283
added: v10.7.0
2284+
napiVersion: 6
22862285
-->
22872286

2288-
> Stability: 1 - Experimental
2289-
22902287
```C
22912288
napi_status napi_create_bigint_uint64(napi_env env,
22922289
uint64_t value,
@@ -2304,10 +2301,9 @@ This API converts the C `uint64_t` type to the JavaScript `BigInt` type.
23042301
#### napi_create_bigint_words
23052302
<!-- YAML
23062303
added: v10.7.0
2304+
napiVersion: 6
23072305
-->
23082306

2309-
> Stability: 1 - Experimental
2310-
23112307
```C
23122308
napi_status napi_create_bigint_words(napi_env env,
23132309
int sign_bit,
@@ -2653,10 +2649,9 @@ This API returns the C double primitive equivalent of the given JavaScript
26532649
#### napi_get_value_bigint_int64
26542650
<!-- YAML
26552651
added: v10.7.0
2652+
napiVersion: 6
26562653
-->
26572654

2658-
> Stability: 1 - Experimental
2659-
26602655
```C
26612656
napi_status napi_get_value_bigint_int64(napi_env env,
26622657
napi_value value,
@@ -2680,10 +2675,9 @@ This API returns the C `int64_t` primitive equivalent of the given JavaScript
26802675
#### napi_get_value_bigint_uint64
26812676
<!-- YAML
26822677
added: v10.7.0
2678+
napiVersion: 6
26832679
-->
26842680

2685-
> Stability: 1 - Experimental
2686-
26872681
```C
26882682
napi_status napi_get_value_bigint_uint64(napi_env env,
26892683
napi_value value,
@@ -2707,10 +2701,9 @@ This API returns the C `uint64_t` primitive equivalent of the given JavaScript
27072701
#### napi_get_value_bigint_words
27082702
<!-- YAML
27092703
added: v10.7.0
2704+
napiVersion: 6
27102705
-->
27112706

2712-
> Stability: 1 - Experimental
2713-
27142707
```C
27152708
napi_status napi_get_value_bigint_words(napi_env env,
27162709
napi_value value,
@@ -3595,10 +3588,9 @@ included.
35953588
#### napi_get_all_property_names
35963589
<!-- YAML
35973590
added: v13.7.0
3591+
napiVersion: 6
35983592
-->
35993593

3600-
> Stability: 1 - Experimental
3601-
36023594
```C
36033595
napi_get_all_property_names(napi_env env,
36043596
napi_value object,

src/js_native_api.h

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// This file needs to be compatible with C compilers.
55
#include <stddef.h> // NOLINT(modernize-deprecated-headers)
66
#include <stdbool.h> // NOLINT(modernize-deprecated-headers)
7-
#include "js_native_api_types.h"
87

98
// Use INT_MAX, this should only be consumed by the pre-processor anyway.
109
#define NAPI_VERSION_EXPERIMENTAL 2147483647
@@ -18,10 +17,12 @@
1817
// functions available in a new version of N-API that is not yet ported in all
1918
// LTS versions, they can set NAPI_VERSION knowing that they have specifically
2019
// depended on that version.
21-
#define NAPI_VERSION 5
20+
#define NAPI_VERSION 6
2221
#endif
2322
#endif
2423

24+
#include "js_native_api_types.h"
25+
2526
// If you need __declspec(dllimport), either include <node_api.h> instead, or
2627
// define NAPI_EXTERN as __declspec(dllimport) on the compiler's command line.
2728
#ifndef NAPI_EXTERN
@@ -478,7 +479,7 @@ NAPI_EXTERN napi_status napi_add_finalizer(napi_env env,
478479

479480
#endif // NAPI_VERSION >= 5
480481

481-
#ifdef NAPI_EXPERIMENTAL
482+
#if NAPI_VERSION >= 6
482483

483484
// BigInt
484485
NAPI_EXTERN napi_status napi_create_bigint_int64(napi_env env,
@@ -523,7 +524,9 @@ NAPI_EXTERN napi_status napi_set_instance_data(napi_env env,
523524

524525
NAPI_EXTERN napi_status napi_get_instance_data(napi_env env,
525526
void** data);
527+
#endif // NAPI_VERSION >= 6
526528

529+
#ifdef NAPI_EXPERIMENTAL
527530
// ArrayBuffer detaching
528531
NAPI_EXTERN napi_status napi_detach_arraybuffer(napi_env env,
529532
napi_value arraybuffer);

src/js_native_api_types.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ typedef struct {
115115
napi_status error_code;
116116
} napi_extended_error_info;
117117

118-
#ifdef NAPI_EXPERIMENTAL
118+
#if NAPI_VERSION >= 6
119119
typedef enum {
120120
napi_key_include_prototypes,
121121
napi_key_own_only
@@ -134,6 +134,6 @@ typedef enum {
134134
napi_key_keep_numbers,
135135
napi_key_numbers_to_strings
136136
} napi_key_conversion;
137-
#endif
137+
#endif // NAPI_VERSION >= 6
138138

139139
#endif // SRC_JS_NATIVE_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 5
96+
#define NAPI_VERSION 6
9797

9898
#endif // SRC_NODE_VERSION_H_

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

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#define NAPI_EXPERIMENTAL
2-
31
#include <inttypes.h>
42
#include <stdio.h>
53
#include <js_native_api.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. The expected version is currently 4.
36-
assert.strictEqual(test_general.testGetVersion(), 5);
36+
assert.strictEqual(test_general.testGetVersion(), 6);
3737

3838
[
3939
123,

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

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <stdio.h>
22
#include <stdlib.h>
3-
#define NAPI_EXPERIMENTAL
43
#include <js_native_api.h>
54
#include "../common.h"
65

test/js-native-api/test_object/test_null.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

43
#include "../common.h"

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

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#define NAPI_EXPERIMENTAL
2-
31
#include <js_native_api.h>
42
#include "../common.h"
53
#include <string.h>

test/node-api/test_general/test_general.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 <stdlib.h>
43
#include "../../js-native-api/common.h"

test/node-api/test_instance_data/addon.c

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <stdio.h>
22
#include <stdlib.h>
3-
#define NAPI_EXPERIMENTAL
43
#include <node_api.h>
54

65
static void addon_free(napi_env env, void* data, void* hint) {

test/node-api/test_instance_data/test_instance_data.c

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <stdlib.h>
22
#include <uv.h>
3-
#define NAPI_EXPERIMENTAL
43
#include <node_api.h>
54
#include "../../js-native-api/common.h"
65

test/node-api/test_instance_data/test_ref_then_set.c

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <stdio.h>
22
#include <stdlib.h>
3-
#define NAPI_EXPERIMENTAL
43
#include <node_api.h>
54

65
napi_value addon_new(napi_env env, napi_value exports, bool ref_first);

test/node-api/test_instance_data/test_set_then_ref.c

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <stdio.h>
22
#include <stdlib.h>
3-
#define NAPI_EXPERIMENTAL
43
#include <node_api.h>
54

65
napi_value addon_new(napi_env env, napi_value exports, bool ref_first);

0 commit comments

Comments
 (0)