n-api: define release 6 · nodejs/node@710c905 · GitHub
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 <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 4d5981b commit 710c905

14 files changed

Lines changed: 22 additions & 38 deletions

File tree

doc/api/n-api.md

Lines changed: 12 additions & 20 deletions

src/js_native_api.h

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

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

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

9898
#endif // SRC_NODE_VERSION_H_

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

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

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. 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

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

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

43
#include "../common.h"

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

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

Lines changed: 0 additions & 1 deletion

0 commit comments

Comments
 (0)