Skip to content

Commit fc29c08

Browse files
author
Gabriel Schulhof
committed
n-api: mark version 5 N-APIs as stable
PR-URL: nodejs#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 4f41e4f commit fc29c08

File tree

6 files changed

+16
-21
lines changed

6 files changed

+16
-21
lines changed

doc/api/n-api.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,8 +1475,6 @@ added: REPLACEME
14751475
napiVersion: 4
14761476
-->
14771477

1478-
> Stability: 1 - Experimental
1479-
14801478
```C
14811479
napi_status napi_create_date(napi_env env,
14821480
double time,
@@ -2120,8 +2118,6 @@ added: REPLACEME
21202118
napiVersion: 4
21212119
-->
21222120

2123-
> Stability: 1 - Experimental
2124-
21252121
```C
21262122
napi_status napi_get_date_value(napi_env env,
21272123
napi_value value,
@@ -2729,8 +2725,6 @@ added: REPLACEME
27292725
napiVersion: 4
27302726
-->
27312727

2732-
> Stability: 1 - Experimental
2733-
27342728
```C
27352729
napi_status napi_is_date(napi_env env, napi_value value, bool* result)
27362730
```
@@ -3822,8 +3816,6 @@ JavaScript object becomes garbage-collected.
38223816

38233817
### napi_add_finalizer
38243818

3825-
> Stability: 1 - Experimental
3826-
38273819
<!-- YAML
38283820
added: v8.0.0
38293821
napiVersion: 1

src/node_api.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#define NAPI_VERSION 2147483647
1111
#else
1212
// The baseline version for N-API
13-
#define NAPI_VERSION 4
13+
#define NAPI_VERSION 5
1414
#endif
1515
#endif
1616

@@ -674,7 +674,7 @@ napi_ref_threadsafe_function(napi_env env, napi_threadsafe_function func);
674674

675675
#endif // NAPI_VERSION >= 4
676676

677-
#ifdef NAPI_EXPERIMENTAL
677+
#if NAPI_VERSION >= 5
678678

679679
// Dates
680680
NAPI_EXTERN napi_status napi_create_date(napi_env env,
@@ -689,6 +689,18 @@ NAPI_EXTERN napi_status napi_get_date_value(napi_env env,
689689
napi_value value,
690690
double* result);
691691

692+
// Add finalizer for pointer
693+
NAPI_EXTERN napi_status napi_add_finalizer(napi_env env,
694+
napi_value js_object,
695+
void* native_object,
696+
napi_finalize finalize_cb,
697+
void* finalize_hint,
698+
napi_ref* result);
699+
700+
#endif // NAPI_VERSION >= 5
701+
702+
#ifdef NAPI_EXPERIMENTAL
703+
692704
// BigInt
693705
NAPI_EXTERN napi_status napi_create_bigint_int64(napi_env env,
694706
int64_t value,
@@ -714,12 +726,6 @@ NAPI_EXTERN napi_status napi_get_value_bigint_words(napi_env env,
714726
int* sign_bit,
715727
size_t* word_count,
716728
uint64_t* words);
717-
NAPI_EXTERN napi_status napi_add_finalizer(napi_env env,
718-
napi_value js_object,
719-
void* native_object,
720-
napi_finalize finalize_cb,
721-
void* finalize_hint,
722-
napi_ref* result);
723729
#endif // NAPI_EXPERIMENTAL
724730

725731
EXTERN_C_END

src/node_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,6 @@
114114
#define NODE_MODULE_VERSION 64
115115

116116
// the NAPI_VERSION provided by this version of the runtime
117-
#define NAPI_VERSION 4
117+
#define NAPI_VERSION 5
118118

119119
#endif // SRC_NODE_VERSION_H_

test/addons-napi/test_date/test_date.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#define NAPI_EXPERIMENTAL
2-
31
#include <node_api.h>
42
#include "../common.h"
53

test/addons-napi/test_general/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ assert.notStrictEqual(test_general.testGetPrototype(baseObject),
3434

3535
// test version management functions
3636
// expected version is currently 4
37-
assert.strictEqual(test_general.testGetVersion(), 4);
37+
assert.strictEqual(test_general.testGetVersion(), 5);
3838

3939
const [ major, minor, patch, release ] = test_general.testGetNodeVersion();
4040
assert.strictEqual(process.version.split('-')[0],

test/addons-napi/test_general/test_general.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#define NAPI_EXPERIMENTAL
21
#include <node_api.h>
32
#include <stdlib.h>
43
#include "../common.h"

0 commit comments

Comments
 (0)