summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schulhof <gabrielschulhof@gmail.com>2021-03-07 08:52:09 -0800
committerRichard Lau <rlau@redhat.com>2021-03-19 12:08:09 +0000
commit93dd799a864c420c1ce1f9d1bac2ccde7c5ede1d (patch)
tree205bdab76309bead1ff530430c92c8af748f93be
parent18726259908377cc3fbc9a046ca69aef3fa37497 (diff)
downloadnode-new-93dd799a864c420c1ce1f9d1bac2ccde7c5ede1d.tar.gz
node-api: define version 8
Mark as stable the APIs that define Node-API version 8. PR-URL: https://github.com/nodejs/node/pull/37652 Backport-PR-URL: https://github.com/nodejs/node/pull/37796 Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
-rw-r--r--doc/api/n-api.md18
-rw-r--r--src/js_native_api.h6
-rw-r--r--src/js_native_api_types.h8
-rw-r--r--src/node_api.h6
-rw-r--r--src/node_api_types.h4
-rw-r--r--src/node_version.h2
-rw-r--r--test/js-native-api/test_general/test.js2
-rw-r--r--test/js-native-api/test_object/test_object.c1
-rw-r--r--test/node-api/test_async_cleanup_hook/binding.c1
9 files changed, 22 insertions, 26 deletions
diff --git a/doc/api/n-api.md b/doc/api/n-api.md
index 600738db45..1f03937c25 100644
--- a/doc/api/n-api.md
+++ b/doc/api/n-api.md
@@ -608,6 +608,7 @@ For more details, review the [Object lifetime management][].
#### napi_type_tag
<!-- YAML
added: v12.19.0
+napiVersion: 8
-->
A 128-bit value stored as two unsigned 64-bit integers. It serves as a UUID
@@ -1620,10 +1621,9 @@ changes:
- version: v12.19.0
pr-url: https://github.com/nodejs/node/pull/34819
description: Changed signature of the `hook` callback.
+napiVersion: 8
-->
-> Stability: 1 - Experimental
-
```c
NAPI_EXTERN napi_status napi_add_async_cleanup_hook(
napi_env env,
@@ -1661,8 +1661,6 @@ changes:
description: Removed `env` parameter.
-->
-> Stability: 1 - Experimental
-
```c
NAPI_EXTERN napi_status napi_remove_async_cleanup_hook(
napi_async_cleanup_hook_handle remove_handle);
@@ -4095,10 +4093,9 @@ specification).
#### napi_object_freeze
<!-- YAML
added: v12.20.0
+napiVersion: 8
-->
-> Stability: 1 - Experimental
-
```c
napi_status napi_object_freeze(napi_env env,
napi_value object);
@@ -4120,10 +4117,9 @@ ECMA-262 specification.
#### napi_object_seal
<!-- YAML
added: v12.20.0
+napiVersion: 8
-->
-> Stability: 1 - Experimental
-
```c
napi_status napi_object_seal(napi_env env,
napi_value object);
@@ -4776,10 +4772,9 @@ JavaScript object becomes garbage-collected.
### napi_type_tag_object
<!-- YAML
added: v12.19.0
+napiVersion: 8
-->
-> Stability: 1 - Experimental
-
```c
napi_status napi_type_tag_object(napi_env env,
napi_value js_object,
@@ -4803,10 +4798,9 @@ If the object already has an associated type tag, this API will return
### napi_check_object_type_tag
<!-- YAML
added: v12.19.0
+napiVersion: 8
-->
-> Stability: 1 - Experimental
-
```c
napi_status napi_check_object_type_tag(napi_env env,
napi_value js_object,
diff --git a/src/js_native_api.h b/src/js_native_api.h
index 5daa20f904..e804d1d45d 100644
--- a/src/js_native_api.h
+++ b/src/js_native_api.h
@@ -17,7 +17,7 @@
// 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 7
+#define NAPI_VERSION 8
#endif
#endif
@@ -539,7 +539,7 @@ NAPI_EXTERN napi_status napi_is_detached_arraybuffer(napi_env env,
bool* result);
#endif // NAPI_VERSION >= 7
-#ifdef NAPI_EXPERIMENTAL
+#if NAPI_VERSION >= 8
// Type tagging
NAPI_EXTERN napi_status napi_type_tag_object(napi_env env,
napi_value value,
@@ -554,7 +554,7 @@ NAPI_EXTERN napi_status napi_object_freeze(napi_env env,
napi_value object);
NAPI_EXTERN napi_status napi_object_seal(napi_env env,
napi_value object);
-#endif // NAPI_EXPERIMENTAL
+#endif // NAPI_VERSION >= 8
EXTERN_C_END
diff --git a/src/js_native_api_types.h b/src/js_native_api_types.h
index b9eddbcba0..179428e95a 100644
--- a/src/js_native_api_types.h
+++ b/src/js_native_api_types.h
@@ -31,7 +31,7 @@ typedef enum {
// from instance properties. Ignored by napi_define_properties.
napi_static = 1 << 10,
-#ifdef NAPI_EXPERIMENTAL
+#if NAPI_VERSION >= 8
// Default for class methods.
napi_default_method = napi_writable | napi_configurable,
@@ -39,7 +39,7 @@ typedef enum {
napi_default_jsproperty = napi_writable |
napi_enumerable |
napi_configurable,
-#endif // NAPI_EXPERIMENTAL
+#endif // NAPI_VERSION >= 8
} napi_property_attributes;
typedef enum {
@@ -146,11 +146,11 @@ typedef enum {
} napi_key_conversion;
#endif // NAPI_VERSION >= 6
-#ifdef NAPI_EXPERIMENTAL
+#if NAPI_VERSION >= 8
typedef struct {
uint64_t lower;
uint64_t upper;
} napi_type_tag;
-#endif // NAPI_EXPERIMENTAL
+#endif // NAPI_VERSION >= 8
#endif // SRC_JS_NATIVE_API_TYPES_H_
diff --git a/src/node_api.h b/src/node_api.h
index fc7d2c630c..61a5404314 100644
--- a/src/node_api.h
+++ b/src/node_api.h
@@ -250,7 +250,7 @@ napi_ref_threadsafe_function(napi_env env, napi_threadsafe_function func);
#endif // NAPI_VERSION >= 4
-#ifdef NAPI_EXPERIMENTAL
+#if NAPI_VERSION >= 8
NAPI_EXTERN napi_status napi_add_async_cleanup_hook(
napi_env env,
@@ -261,6 +261,10 @@ NAPI_EXTERN napi_status napi_add_async_cleanup_hook(
NAPI_EXTERN napi_status napi_remove_async_cleanup_hook(
napi_async_cleanup_hook_handle remove_handle);
+#endif // NAPI_VERSION >= 8
+
+#ifdef NAPI_EXPERIMENTAL
+
NAPI_EXTERN napi_status
node_api_get_module_file_name(napi_env env, const char** result);
diff --git a/src/node_api_types.h b/src/node_api_types.h
index 0e400e9676..58ffc61b3a 100644
--- a/src/node_api_types.h
+++ b/src/node_api_types.h
@@ -41,10 +41,10 @@ typedef struct {
const char* release;
} napi_node_version;
-#ifdef NAPI_EXPERIMENTAL
+#if NAPI_VERSION >= 8
typedef struct napi_async_cleanup_hook_handle__* napi_async_cleanup_hook_handle;
typedef void (*napi_async_cleanup_hook)(napi_async_cleanup_hook_handle handle,
void* data);
-#endif // NAPI_EXPERIMENTAL
+#endif // NAPI_VERSION >= 8
#endif // SRC_NODE_API_TYPES_H_
diff --git a/src/node_version.h b/src/node_version.h
index b1cf038192..82e07b4db6 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 7
+#define NAPI_VERSION 8
#endif // SRC_NODE_VERSION_H_
diff --git a/test/js-native-api/test_general/test.js b/test/js-native-api/test_general/test.js
index 4dbdc37c91..76527bc81c 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
-assert.strictEqual(test_general.testGetVersion(), 7);
+assert.strictEqual(test_general.testGetVersion(), 8);
[
123,
diff --git a/test/js-native-api/test_object/test_object.c b/test/js-native-api/test_object/test_object.c
index 70a85e03c7..9a90b5689e 100644
--- a/test/js-native-api/test_object/test_object.c
+++ b/test/js-native-api/test_object/test_object.c
@@ -1,4 +1,3 @@
-#define NAPI_EXPERIMENTAL
#include <js_native_api.h>
#include "../common.h"
#include <string.h>
diff --git a/test/node-api/test_async_cleanup_hook/binding.c b/test/node-api/test_async_cleanup_hook/binding.c
index 7bbde56bb0..4e88479574 100644
--- a/test/node-api/test_async_cleanup_hook/binding.c
+++ b/test/node-api/test_async_cleanup_hook/binding.c
@@ -1,4 +1,3 @@
-#define NAPI_EXPERIMENTAL
#include "node_api.h"
#include "assert.h"
#include "uv.h"