diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 8c02d418bf4eb9..c0cdd9d23dd578 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -1758,8 +1758,6 @@ structure, in most cases using a `TypedArray` will suffice. added: v11.11.0 --> -> Stability: 1 - Experimental - ```C napi_status napi_create_date(napi_env env, double time, @@ -2420,8 +2418,6 @@ This API returns various properties of a `DataView`. added: v11.11.0 --> -> Stability: 1 - Experimental - ```C napi_status napi_get_date_value(napi_env env, napi_value value, @@ -3048,8 +3044,6 @@ This API checks if the `Object` passed in is a buffer. added: v11.11.0 --> -> Stability: 1 - Experimental - ```C napi_status napi_is_date(napi_env env, napi_value value, bool* result) ``` @@ -4186,8 +4180,6 @@ JavaScript object becomes garbage-collected. ### napi_add_finalizer -> Stability: 1 - Experimental - diff --git a/doc/api/process.md b/doc/api/process.md index bac396dfe89913..7922c36c2889bf 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -679,7 +679,7 @@ An example of the possible output looks like: variables: { host_arch: 'x64', - napi_build_version: 4, + napi_build_version: 5, node_install_npm: 'true', node_prefix: '', node_shared_cares: 'false', diff --git a/src/js_native_api.h b/src/js_native_api.h index 22cbf4ee30612c..162c816517c388 100644 --- a/src/js_native_api.h +++ b/src/js_native_api.h @@ -18,7 +18,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 4 +#define NAPI_VERSION 5 #endif #endif @@ -453,7 +453,7 @@ NAPI_EXTERN napi_status napi_adjust_external_memory(napi_env env, int64_t change_in_bytes, int64_t* adjusted_value); -#ifdef NAPI_EXPERIMENTAL +#if NAPI_VERSION >= 5 // Dates NAPI_EXTERN napi_status napi_create_date(napi_env env, @@ -468,6 +468,18 @@ NAPI_EXTERN napi_status napi_get_date_value(napi_env env, napi_value value, double* result); +// Add finalizer for pointer +NAPI_EXTERN napi_status napi_add_finalizer(napi_env env, + napi_value js_object, + void* native_object, + napi_finalize finalize_cb, + void* finalize_hint, + napi_ref* result); + +#endif // NAPI_VERSION >= 5 + +#ifdef NAPI_EXPERIMENTAL + // BigInt NAPI_EXTERN napi_status napi_create_bigint_int64(napi_env env, int64_t value, @@ -493,12 +505,6 @@ NAPI_EXTERN napi_status napi_get_value_bigint_words(napi_env env, int* sign_bit, size_t* word_count, uint64_t* words); -NAPI_EXTERN napi_status napi_add_finalizer(napi_env env, - napi_value js_object, - void* native_object, - napi_finalize finalize_cb, - void* finalize_hint, - napi_ref* result); // Instance data NAPI_EXTERN napi_status napi_set_instance_data(napi_env env, diff --git a/src/node_version.h b/src/node_version.h index 9ba3a668ee0b49..1531f210184f91 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 4 +#define NAPI_VERSION 5 #endif // SRC_NODE_VERSION_H_ diff --git a/test/js-native-api/test_date/test_date.c b/test/js-native-api/test_date/test_date.c index 13de450079ff3b..7ac5008cb9b288 100644 --- a/test/js-native-api/test_date/test_date.c +++ b/test/js-native-api/test_date/test_date.c @@ -1,5 +1,3 @@ -#define NAPI_EXPERIMENTAL - #include #include "../common.h" diff --git a/test/js-native-api/test_general/test.js b/test/js-native-api/test_general/test.js index 44b672cdc1f77f..09c0300f85eae7 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(), 4); +assert.strictEqual(test_general.testGetVersion(), 5); [ 123, diff --git a/test/js-native-api/test_general/test_general.c b/test/js-native-api/test_general/test_general.c index 0e717e46ec604f..a7453e42f7456b 100644 --- a/test/js-native-api/test_general/test_general.c +++ b/test/js-native-api/test_general/test_general.c @@ -1,4 +1,3 @@ -#define NAPI_EXPERIMENTAL #include #include #include "../common.h" diff --git a/test/node-api/test_make_callback/binding.c b/test/node-api/test_make_callback/binding.c index 5731e28a5b2597..782cf0f6fb8f54 100644 --- a/test/node-api/test_make_callback/binding.c +++ b/test/node-api/test_make_callback/binding.c @@ -1,4 +1,3 @@ -#define NAPI_EXPERIMENTAL // napi_add_finalizer #include #include #include "../../js-native-api/common.h"