summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schulhof <gabriel.schulhof@intel.com>2020-03-02 16:53:06 -0800
committerGabriel Schulhof <gabriel.schulhof@intel.com>2020-03-09 11:58:51 -0700
commitc0c81ed204b08c264f235234ab35a490f6d147ea (patch)
treecb97b664ce4ba08760d5089ecdae9e8af630849c
parentd368dcc63af2eb75d5dbef5c6669e5e8ab3be5d2 (diff)
downloadnode-new-c0c81ed204b08c264f235234ab35a490f6d147ea.tar.gz
n-api: define release 6
Mark all N-APIs that have been added since version 5 as stable. PR-URL: https://github.com/nodejs/node/pull/32058 Fixes: https://github.com/nodejs/abi-stable-node/issues/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>
-rw-r--r--doc/api/n-api.md32
-rw-r--r--src/js_native_api.h9
-rw-r--r--src/js_native_api_types.h4
-rw-r--r--src/node_version.h2
-rw-r--r--test/js-native-api/test_bigint/test_bigint.c2
-rw-r--r--test/js-native-api/test_general/test.js2
-rw-r--r--test/js-native-api/test_instance_data/test_instance_data.c1
-rw-r--r--test/js-native-api/test_object/test_null.c1
-rw-r--r--test/js-native-api/test_object/test_object.c2
-rw-r--r--test/node-api/test_general/test_general.c1
-rw-r--r--test/node-api/test_instance_data/addon.c1
-rw-r--r--test/node-api/test_instance_data/test_instance_data.c1
-rw-r--r--test/node-api/test_instance_data/test_ref_then_set.c1
-rw-r--r--test/node-api/test_instance_data/test_set_then_ref.c1
14 files changed, 22 insertions, 38 deletions
diff --git a/doc/api/n-api.md b/doc/api/n-api.md
index 9ccfeb9cb7..2b322968c1 100644
--- a/doc/api/n-api.md
+++ b/doc/api/n-api.md
@@ -374,6 +374,7 @@ tied to the life cycle of the Agent.
### napi_set_instance_data
<!-- YAML
added: v12.8.0
+napiVersion: 6
-->
```C
@@ -401,6 +402,7 @@ by the previous call, it will not be called.
### napi_get_instance_data
<!-- YAML
added: v12.8.0
+napiVersion: 6
-->
```C
@@ -1663,10 +1665,9 @@ the `napi_value` in question is of the JavaScript type expected by the API.
#### napi_key_collection_mode
<!-- YAML
added: v13.7.0
+napiVersion: 6
-->
-> Stability: 1 - Experimental
-
```C
typedef enum {
napi_key_include_prototypes,
@@ -1685,10 +1686,9 @@ of the objects's prototype chain as well.
#### napi_key_filter
<!-- YAML
added: v13.7.0
+napiVersion: 6
-->
-> Stability: 1 - Experimental
-
```C
typedef enum {
napi_key_all_properties = 0,
@@ -1705,10 +1705,9 @@ Property filter bits. They can be or'ed to build a composite filter.
#### napi_key_conversion
<!-- YAML
added: v13.7.0
+napiVersion: 6
-->
-> Stability: 1 - Experimental
-
```C
typedef enum {
napi_key_keep_numbers,
@@ -2262,10 +2261,9 @@ The JavaScript `Number` type is described in
#### napi_create_bigint_int64
<!-- YAML
added: v10.7.0
+napiVersion: 6
-->
-> Stability: 1 - Experimental
-
```C
napi_status napi_create_bigint_int64(napi_env env,
int64_t value,
@@ -2283,10 +2281,9 @@ This API converts the C `int64_t` type to the JavaScript `BigInt` type.
#### napi_create_bigint_uint64
<!-- YAML
added: v10.7.0
+napiVersion: 6
-->
-> Stability: 1 - Experimental
-
```C
napi_status napi_create_bigint_uint64(napi_env env,
uint64_t value,
@@ -2304,10 +2301,9 @@ This API converts the C `uint64_t` type to the JavaScript `BigInt` type.
#### napi_create_bigint_words
<!-- YAML
added: v10.7.0
+napiVersion: 6
-->
-> Stability: 1 - Experimental
-
```C
napi_status napi_create_bigint_words(napi_env env,
int sign_bit,
@@ -2653,10 +2649,9 @@ This API returns the C double primitive equivalent of the given JavaScript
#### napi_get_value_bigint_int64
<!-- YAML
added: v10.7.0
+napiVersion: 6
-->
-> Stability: 1 - Experimental
-
```C
napi_status napi_get_value_bigint_int64(napi_env env,
napi_value value,
@@ -2680,10 +2675,9 @@ This API returns the C `int64_t` primitive equivalent of the given JavaScript
#### napi_get_value_bigint_uint64
<!-- YAML
added: v10.7.0
+napiVersion: 6
-->
-> Stability: 1 - Experimental
-
```C
napi_status napi_get_value_bigint_uint64(napi_env env,
napi_value value,
@@ -2707,10 +2701,9 @@ This API returns the C `uint64_t` primitive equivalent of the given JavaScript
#### napi_get_value_bigint_words
<!-- YAML
added: v10.7.0
+napiVersion: 6
-->
-> Stability: 1 - Experimental
-
```C
napi_status napi_get_value_bigint_words(napi_env env,
napi_value value,
@@ -3595,10 +3588,9 @@ included.
#### napi_get_all_property_names
<!-- YAML
added: v13.7.0
+napiVersion: 6
-->
-> Stability: 1 - Experimental
-
```C
napi_get_all_property_names(napi_env env,
napi_value object,
diff --git a/src/js_native_api.h b/src/js_native_api.h
index cb69fde5d1..2675da505c 100644
--- a/src/js_native_api.h
+++ b/src/js_native_api.h
@@ -4,7 +4,6 @@
// This file needs to be compatible with C compilers.
#include <stddef.h> // NOLINT(modernize-deprecated-headers)
#include <stdbool.h> // NOLINT(modernize-deprecated-headers)
-#include "js_native_api_types.h"
// Use INT_MAX, this should only be consumed by the pre-processor anyway.
#define NAPI_VERSION_EXPERIMENTAL 2147483647
@@ -18,10 +17,12 @@
// functions available in a new version of N-API that is not yet ported in all
// LTS versions, they can set NAPI_VERSION knowing that they have specifically
// depended on that version.
-#define NAPI_VERSION 5
+#define NAPI_VERSION 6
#endif
#endif
+#include "js_native_api_types.h"
+
// If you need __declspec(dllimport), either include <node_api.h> instead, or
// define NAPI_EXTERN as __declspec(dllimport) on the compiler's command line.
#ifndef NAPI_EXTERN
@@ -478,7 +479,7 @@ NAPI_EXTERN napi_status napi_add_finalizer(napi_env env,
#endif // NAPI_VERSION >= 5
-#ifdef NAPI_EXPERIMENTAL
+#if NAPI_VERSION >= 6
// BigInt
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,
NAPI_EXTERN napi_status napi_get_instance_data(napi_env env,
void** data);
+#endif // NAPI_VERSION >= 6
+#ifdef NAPI_EXPERIMENTAL
// ArrayBuffer detaching
NAPI_EXTERN napi_status napi_detach_arraybuffer(napi_env env,
napi_value arraybuffer);
diff --git a/src/js_native_api_types.h b/src/js_native_api_types.h
index ef44dd457d..7a49fc9f71 100644
--- a/src/js_native_api_types.h
+++ b/src/js_native_api_types.h
@@ -115,7 +115,7 @@ typedef struct {
napi_status error_code;
} napi_extended_error_info;
-#ifdef NAPI_EXPERIMENTAL
+#if NAPI_VERSION >= 6
typedef enum {
napi_key_include_prototypes,
napi_key_own_only
@@ -134,6 +134,6 @@ typedef enum {
napi_key_keep_numbers,
napi_key_numbers_to_strings
} napi_key_conversion;
-#endif
+#endif // NAPI_VERSION >= 6
#endif // SRC_JS_NATIVE_API_TYPES_H_
diff --git a/src/node_version.h b/src/node_version.h
index ebd3cff606..8f14c6dbfa 100644
--- a/src/node_version.h
+++ b/src/node_version.h
@@ -93,6 +93,6 @@
// The NAPI_VERSION provided by this version of the runtime. This is the version
// which the Node binary being built supports.
-#define NAPI_VERSION 5
+#define NAPI_VERSION 6
#endif // SRC_NODE_VERSION_H_
diff --git a/test/js-native-api/test_bigint/test_bigint.c b/test/js-native-api/test_bigint/test_bigint.c
index 4befc171ba..c62a0a6a6c 100644
--- a/test/js-native-api/test_bigint/test_bigint.c
+++ b/test/js-native-api/test_bigint/test_bigint.c
@@ -1,5 +1,3 @@
-#define NAPI_EXPERIMENTAL
-
#include <inttypes.h>
#include <stdio.h>
#include <js_native_api.h>
diff --git a/test/js-native-api/test_general/test.js b/test/js-native-api/test_general/test.js
index 9b847f4f33..a4b3df5535 100644
--- a/test/js-native-api/test_general/test.js
+++ b/test/js-native-api/test_general/test.js
@@ -33,7 +33,7 @@ assert.notStrictEqual(test_general.testGetPrototype(baseObject),
test_general.testGetPrototype(extendedObject));
// Test version management functions. The expected version is currently 4.
-assert.strictEqual(test_general.testGetVersion(), 5);
+assert.strictEqual(test_general.testGetVersion(), 6);
[
123,
diff --git a/test/js-native-api/test_instance_data/test_instance_data.c b/test/js-native-api/test_instance_data/test_instance_data.c
index a64ebec0c1..5255c3e4a0 100644
--- a/test/js-native-api/test_instance_data/test_instance_data.c
+++ b/test/js-native-api/test_instance_data/test_instance_data.c
@@ -1,6 +1,5 @@
#include <stdio.h>
#include <stdlib.h>
-#define NAPI_EXPERIMENTAL
#include <js_native_api.h>
#include "../common.h"
diff --git a/test/js-native-api/test_object/test_null.c b/test/js-native-api/test_object/test_null.c
index 523217f3c0..b6bf4df31c 100644
--- a/test/js-native-api/test_object/test_null.c
+++ b/test/js-native-api/test_object/test_null.c
@@ -1,4 +1,3 @@
-#define NAPI_EXPERIMENTAL
#include <js_native_api.h>
#include "../common.h"
diff --git a/test/js-native-api/test_object/test_object.c b/test/js-native-api/test_object/test_object.c
index 9d9589238d..08f619bf7f 100644
--- a/test/js-native-api/test_object/test_object.c
+++ b/test/js-native-api/test_object/test_object.c
@@ -1,5 +1,3 @@
-#define NAPI_EXPERIMENTAL
-
#include <js_native_api.h>
#include "../common.h"
#include <string.h>
diff --git a/test/node-api/test_general/test_general.c b/test/node-api/test_general/test_general.c
index 05bccaf5c2..be805f782b 100644
--- a/test/node-api/test_general/test_general.c
+++ b/test/node-api/test_general/test_general.c
@@ -1,4 +1,3 @@
-#define NAPI_EXPERIMENTAL
#include <node_api.h>
#include <stdlib.h>
#include "../../js-native-api/common.h"
diff --git a/test/node-api/test_instance_data/addon.c b/test/node-api/test_instance_data/addon.c
index 928b4dfaf8..7cf27bf28a 100644
--- a/test/node-api/test_instance_data/addon.c
+++ b/test/node-api/test_instance_data/addon.c
@@ -1,6 +1,5 @@
#include <stdio.h>
#include <stdlib.h>
-#define NAPI_EXPERIMENTAL
#include <node_api.h>
static void addon_free(napi_env env, void* data, void* hint) {
diff --git a/test/node-api/test_instance_data/test_instance_data.c b/test/node-api/test_instance_data/test_instance_data.c
index 1a814e91c0..24fd502e83 100644
--- a/test/node-api/test_instance_data/test_instance_data.c
+++ b/test/node-api/test_instance_data/test_instance_data.c
@@ -1,6 +1,5 @@
#include <stdlib.h>
#include <uv.h>
-#define NAPI_EXPERIMENTAL
#include <node_api.h>
#include "../../js-native-api/common.h"
diff --git a/test/node-api/test_instance_data/test_ref_then_set.c b/test/node-api/test_instance_data/test_ref_then_set.c
index a0df1e5b9f..10c779d324 100644
--- a/test/node-api/test_instance_data/test_ref_then_set.c
+++ b/test/node-api/test_instance_data/test_ref_then_set.c
@@ -1,6 +1,5 @@
#include <stdio.h>
#include <stdlib.h>
-#define NAPI_EXPERIMENTAL
#include <node_api.h>
napi_value addon_new(napi_env env, napi_value exports, bool ref_first);
diff --git a/test/node-api/test_instance_data/test_set_then_ref.c b/test/node-api/test_instance_data/test_set_then_ref.c
index 6ebed2d1e8..9a1b31aeed 100644
--- a/test/node-api/test_instance_data/test_set_then_ref.c
+++ b/test/node-api/test_instance_data/test_set_then_ref.c
@@ -1,6 +1,5 @@
#include <stdio.h>
#include <stdlib.h>
-#define NAPI_EXPERIMENTAL
#include <node_api.h>
napi_value addon_new(napi_env env, napi_value exports, bool ref_first);