Skip to content

Commit e22d853

Browse files
Gabriel Schulhoflegendecas
authored andcommitted
n-api: define release 6
Mark all N-APIs that have been added since version 5 as stable. Backport-PR-URL: #32482 PR-URL: #32058 Fixes: nodejs/abi-stable-node#393 Co-Authored-By: legendecas <legendecas@gmail.com> Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
1 parent 02ec03c commit e22d853

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
@@ -1662,10 +1664,9 @@ the `napi_value` in question is of the JavaScript type expected by the API.
16621664
#### napi_key_collection_mode
16631665
<!-- YAML
16641666
added: REPLACEME
1667+
napiVersion: 6
16651668
-->
16661669

1667-
> Stability: 1 - Experimental
1668-
16691670
```C
16701671
typedef enum {
16711672
napi_key_include_prototypes,
@@ -1684,10 +1685,9 @@ of the objects's prototype chain as well.
16841685
#### napi_key_filter
16851686
<!-- YAML
16861687
added: REPLACEME
1688+
napiVersion: 6
16871689
-->
16881690

1689-
> Stability: 1 - Experimental
1690-
16911691
```C
16921692
typedef enum {
16931693
napi_key_all_properties = 0,
@@ -1704,10 +1704,9 @@ Property filter bits. They can be or'ed to build a composite filter.
17041704
#### napi_key_conversion
17051705
<!-- YAML
17061706
added: REPLACEME
1707+
napiVersion: 6
17071708
-->
17081709

1709-
> Stability: 1 - Experimental
1710-
17111710
```C
17121711
typedef enum {
17131712
napi_key_keep_numbers,
@@ -2261,10 +2260,9 @@ The JavaScript `Number` type is described in
22612260
#### napi_create_bigint_int64
22622261
<!-- YAML
22632262
added: v10.7.0
2263+
napiVersion: 6
22642264
-->
22652265

2266-
> Stability: 1 - Experimental
2267-
22682266
```C
22692267
napi_status napi_create_bigint_int64(napi_env env,
22702268
int64_t value,
@@ -2282,10 +2280,9 @@ This API converts the C `int64_t` type to the JavaScript `BigInt` type.
22822280
#### napi_create_bigint_uint64
22832281
<!-- YAML
22842282
added: v10.7.0
2283+
napiVersion: 6
22852284
-->
22862285

2287-
> Stability: 1 - Experimental
2288-
22892286
```C
22902287
napi_status napi_create_bigint_uint64(napi_env env,
22912288
uint64_t value,
@@ -2303,10 +2300,9 @@ This API converts the C `uint64_t` type to the JavaScript `BigInt` type.
23032300
#### napi_create_bigint_words
23042301
<!-- YAML
23052302
added: v10.7.0
2303+
napiVersion: 6
23062304
-->
23072305

2308-
> Stability: 1 - Experimental
2309-
23102306
```C
23112307
napi_status napi_create_bigint_words(napi_env env,
23122308
int sign_bit,
@@ -2656,10 +2652,9 @@ This API returns the C double primitive equivalent of the given JavaScript
26562652
#### napi_get_value_bigint_int64
26572653
<!-- YAML
26582654
added: v10.7.0
2655+
napiVersion: 6
26592656
-->
26602657

2661-
> Stability: 1 - Experimental
2662-
26632658
```C
26642659
napi_status napi_get_value_bigint_int64(napi_env env,
26652660
napi_value value,
@@ -2683,10 +2678,9 @@ This API returns the C `int64_t` primitive equivalent of the given JavaScript
26832678
#### napi_get_value_bigint_uint64
26842679
<!-- YAML
26852680
added: v10.7.0
2681+
napiVersion: 6
26862682
-->
26872683

2688-
> Stability: 1 - Experimental
2689-
26902684
```C
26912685
napi_status napi_get_value_bigint_uint64(napi_env env,
26922686
napi_value value,
@@ -2710,10 +2704,9 @@ This API returns the C `uint64_t` primitive equivalent of the given JavaScript
27102704
#### napi_get_value_bigint_words
27112705
<!-- YAML
27122706
added: v10.7.0
2707+
napiVersion: 6
27132708
-->
27142709

2715-
> Stability: 1 - Experimental
2716-
27172710
```C
27182711
napi_status napi_get_value_bigint_words(napi_env env,
27192712
napi_value value,
@@ -3598,10 +3591,9 @@ included.
35983591
#### napi_get_all_property_names
35993592
<!-- YAML
36003593
added: REPLACEME
3594+
napiVersion: 6
36013595
-->
36023596

3603-
> Stability: 1 - Experimental
3604-
36053597
```C
36063598
napi_get_all_property_names(napi_env env,
36073599
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)