n-api: mark version 5 N-APIs as stable

PR-URL: https://github.com/nodejs/node/pull/29401
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit is contained in:
Gabriel Schulhof 2019-08-30 23:54:36 -07:00
parent af161f0efb
commit 4e5bb250d8
8 changed files with 17 additions and 23 deletions

View File

@ -1758,8 +1758,6 @@ structure, in most cases using a `TypedArray` will suffice.
added: v11.11.0 added: v11.11.0
--> -->
> Stability: 1 - Experimental
```C ```C
napi_status napi_create_date(napi_env env, napi_status napi_create_date(napi_env env,
double time, double time,
@ -2420,8 +2418,6 @@ This API returns various properties of a `DataView`.
added: v11.11.0 added: v11.11.0
--> -->
> Stability: 1 - Experimental
```C ```C
napi_status napi_get_date_value(napi_env env, napi_status napi_get_date_value(napi_env env,
napi_value value, napi_value value,
@ -3048,8 +3044,6 @@ This API checks if the `Object` passed in is a buffer.
added: v11.11.0 added: v11.11.0
--> -->
> Stability: 1 - Experimental
```C ```C
napi_status napi_is_date(napi_env env, napi_value value, bool* result) 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 ### napi_add_finalizer
> Stability: 1 - Experimental
<!-- YAML <!-- YAML
added: v8.0.0 added: v8.0.0
--> -->

View File

@ -679,7 +679,7 @@ An example of the possible output looks like:
variables: variables:
{ {
host_arch: 'x64', host_arch: 'x64',
napi_build_version: 4, napi_build_version: 5,
node_install_npm: 'true', node_install_npm: 'true',
node_prefix: '', node_prefix: '',
node_shared_cares: 'false', node_shared_cares: 'false',

View File

@ -18,7 +18,7 @@
// functions available in a new version of N-API that is not yet ported in all // 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 // LTS versions, they can set NAPI_VERSION knowing that they have specifically
// depended on that version. // depended on that version.
#define NAPI_VERSION 4 #define NAPI_VERSION 5
#endif #endif
#endif #endif
@ -453,7 +453,7 @@ NAPI_EXTERN napi_status napi_adjust_external_memory(napi_env env,
int64_t change_in_bytes, int64_t change_in_bytes,
int64_t* adjusted_value); int64_t* adjusted_value);
#ifdef NAPI_EXPERIMENTAL #if NAPI_VERSION >= 5
// Dates // Dates
NAPI_EXTERN napi_status napi_create_date(napi_env env, 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, napi_value value,
double* result); 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 // BigInt
NAPI_EXTERN napi_status napi_create_bigint_int64(napi_env env, NAPI_EXTERN napi_status napi_create_bigint_int64(napi_env env,
int64_t value, int64_t value,
@ -493,12 +505,6 @@ NAPI_EXTERN napi_status napi_get_value_bigint_words(napi_env env,
int* sign_bit, int* sign_bit,
size_t* word_count, size_t* word_count,
uint64_t* words); 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 // Instance data
NAPI_EXTERN napi_status napi_set_instance_data(napi_env env, NAPI_EXTERN napi_status napi_set_instance_data(napi_env env,

View File

@ -93,6 +93,6 @@
// The NAPI_VERSION provided by this version of the runtime. This is the version // The NAPI_VERSION provided by this version of the runtime. This is the version
// which the Node binary being built supports. // which the Node binary being built supports.
#define NAPI_VERSION 4 #define NAPI_VERSION 5
#endif // SRC_NODE_VERSION_H_ #endif // SRC_NODE_VERSION_H_

View File

@ -1,5 +1,3 @@
#define NAPI_EXPERIMENTAL
#include <js_native_api.h> #include <js_native_api.h>
#include "../common.h" #include "../common.h"

View File

@ -33,7 +33,7 @@ assert.notStrictEqual(test_general.testGetPrototype(baseObject),
test_general.testGetPrototype(extendedObject)); test_general.testGetPrototype(extendedObject));
// Test version management functions. The expected version is currently 4. // Test version management functions. The expected version is currently 4.
assert.strictEqual(test_general.testGetVersion(), 4); assert.strictEqual(test_general.testGetVersion(), 5);
[ [
123, 123,

View File

@ -1,4 +1,3 @@
#define NAPI_EXPERIMENTAL
#include <js_native_api.h> #include <js_native_api.h>
#include <stdlib.h> #include <stdlib.h>
#include "../common.h" #include "../common.h"

View File

@ -1,4 +1,3 @@
#define NAPI_EXPERIMENTAL // napi_add_finalizer
#include <node_api.h> #include <node_api.h>
#include <assert.h> #include <assert.h>
#include "../../js-native-api/common.h" #include "../../js-native-api/common.h"