Skip to content

Commit 50d7c39

Browse files
Gabriel Schulhoftargos
Gabriel Schulhof
authored andcommitted
n-api: mark version 5 N-APIs as stable
PR-URL: #29401 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 2f81d59 commit 50d7c39

File tree

8 files changed

+17
-23
lines changed

8 files changed

+17
-23
lines changed

doc/api/n-api.md

-8
Original file line numberDiff line numberDiff line change
@@ -1758,8 +1758,6 @@ structure, in most cases using a `TypedArray` will suffice.
17581758
added: v11.11.0
17591759
-->
17601760

1761-
> Stability: 1 - Experimental
1762-
17631761
```C
17641762
napi_status napi_create_date(napi_env env,
17651763
double time,
@@ -2420,8 +2418,6 @@ This API returns various properties of a `DataView`.
24202418
added: v11.11.0
24212419
-->
24222420

2423-
> Stability: 1 - Experimental
2424-
24252421
```C
24262422
napi_status napi_get_date_value(napi_env env,
24272423
napi_value value,
@@ -3048,8 +3044,6 @@ This API checks if the `Object` passed in is a buffer.
30483044
added: v11.11.0
30493045
-->
30503046

3051-
> Stability: 1 - Experimental
3052-
30533047
```C
30543048
napi_status napi_is_date(napi_env env, napi_value value, bool* result)
30553049
```
@@ -4186,8 +4180,6 @@ JavaScript object becomes garbage-collected.
41864180

41874181
### napi_add_finalizer
41884182

4189-
> Stability: 1 - Experimental
4190-
41914183
<!-- YAML
41924184
added: v8.0.0
41934185
-->

doc/api/process.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ An example of the possible output looks like:
679679
variables:
680680
{
681681
host_arch: 'x64',
682-
napi_build_version: 4,
682+
napi_build_version: 5,
683683
node_install_npm: 'true',
684684
node_prefix: '',
685685
node_shared_cares: 'false',

src/js_native_api.h

+14-8
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// functions available in a new version of N-API that is not yet ported in all
1919
// LTS versions, they can set NAPI_VERSION knowing that they have specifically
2020
// depended on that version.
21-
#define NAPI_VERSION 4
21+
#define NAPI_VERSION 5
2222
#endif
2323
#endif
2424

@@ -453,7 +453,7 @@ NAPI_EXTERN napi_status napi_adjust_external_memory(napi_env env,
453453
int64_t change_in_bytes,
454454
int64_t* adjusted_value);
455455

456-
#ifdef NAPI_EXPERIMENTAL
456+
#if NAPI_VERSION >= 5
457457

458458
// Dates
459459
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,
468468
napi_value value,
469469
double* result);
470470

471+
// Add finalizer for pointer
472+
NAPI_EXTERN napi_status napi_add_finalizer(napi_env env,
473+
napi_value js_object,
474+
void* native_object,
475+
napi_finalize finalize_cb,
476+
void* finalize_hint,
477+
napi_ref* result);
478+
479+
#endif // NAPI_VERSION >= 5
480+
481+
#ifdef NAPI_EXPERIMENTAL
482+
471483
// BigInt
472484
NAPI_EXTERN napi_status napi_create_bigint_int64(napi_env env,
473485
int64_t value,
@@ -493,12 +505,6 @@ NAPI_EXTERN napi_status napi_get_value_bigint_words(napi_env env,
493505
int* sign_bit,
494506
size_t* word_count,
495507
uint64_t* words);
496-
NAPI_EXTERN napi_status napi_add_finalizer(napi_env env,
497-
napi_value js_object,
498-
void* native_object,
499-
napi_finalize finalize_cb,
500-
void* finalize_hint,
501-
napi_ref* result);
502508

503509
// Instance data
504510
NAPI_EXTERN napi_status napi_set_instance_data(napi_env env,

src/node_version.h

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

9898
#endif // SRC_NODE_VERSION_H_

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

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

test/js-native-api/test_general/test.js

+1-1
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(), 4);
36+
assert.strictEqual(test_general.testGetVersion(), 5);
3737

3838
[
3939
123,

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

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#define NAPI_EXPERIMENTAL
21
#include <js_native_api.h>
32
#include <stdlib.h>
43
#include "../common.h"

test/node-api/test_make_callback/binding.c

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#define NAPI_EXPERIMENTAL // napi_add_finalizer
21
#include <node_api.h>
32
#include <assert.h>
43
#include "../../js-native-api/common.h"

0 commit comments

Comments
 (0)