Skip to content

Commit

Permalink
n-api: define release 6
Browse files Browse the repository at this point in the history
Mark all N-APIs that have been added since version 5 as stable.

PR-URL: nodejs#32058
Fixes: nodejs/abi-stable-node#393
Co-Authored-By: legendecas <[email protected]>
Signed-off-by: Gabriel Schulhof <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
Gabriel Schulhof and legendecas committed Mar 25, 2020
1 parent 07c0385 commit e1e2c2d
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 32 deletions.
32 changes: 12 additions & 20 deletions doc/api/n-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ tied to the life cycle of the Agent.
### napi_set_instance_data
<!-- YAML
added: REPLACEME
napiVersion: 6
-->

```C
Expand Down Expand Up @@ -216,6 +217,7 @@ by the previous call, it will not be called.
### napi_get_instance_data
<!-- YAML
added: REPLACEME
napiVersion: 6
-->

```C
Expand Down Expand Up @@ -1375,10 +1377,9 @@ the `napi_value` in question is of the JavaScript type expected by the API.
#### napi_key_collection_mode
<!-- YAML
added: REPLACEME
napiVersion: 6
-->

> Stability: 1 - Experimental

```C
typedef enum {
napi_key_include_prototypes,
Expand All @@ -1397,10 +1398,9 @@ of the objects's prototype chain as well.
#### napi_key_filter
<!-- YAML
added: REPLACEME
napiVersion: 6
-->

> Stability: 1 - Experimental

```C
typedef enum {
napi_key_all_properties = 0,
Expand All @@ -1417,10 +1417,9 @@ Property filter bits. They can be or'ed to build a composite filter.
#### napi_key_conversion
<!-- YAML
added: REPLACEME
napiVersion: 6
-->

> Stability: 1 - Experimental

```C
typedef enum {
napi_key_keep_numbers,
Expand Down Expand Up @@ -1940,10 +1939,9 @@ The JavaScript `Number` type is described in
#### napi_create_bigint_int64
<!-- YAML
added: v10.7.0
napiVersion: 6
-->

> Stability: 1 - Experimental

```C
napi_status napi_create_bigint_int64(napi_env env,
int64_t value,
Expand All @@ -1961,10 +1959,9 @@ This API converts the C `int64_t` type to the JavaScript `BigInt` type.
#### napi_create_bigint_uint64
<!-- YAML
added: v10.7.0
napiVersion: 6
-->

> Stability: 1 - Experimental

```C
napi_status napi_create_bigint_uint64(napi_env env,
uint64_t value,
Expand All @@ -1982,10 +1979,9 @@ This API converts the C `uint64_t` type to the JavaScript `BigInt` type.
#### napi_create_bigint_words
<!-- YAML
added: v10.7.0
napiVersion: 6
-->

> Stability: 1 - Experimental

```C
napi_status napi_create_bigint_words(napi_env env,
int sign_bit,
Expand Down Expand Up @@ -2319,10 +2315,9 @@ This API returns the C double primitive equivalent of the given JavaScript
#### napi_get_value_bigint_int64
<!-- YAML
added: v10.7.0
napiVersion: 6
-->

> Stability: 1 - Experimental

```C
napi_status napi_get_value_bigint_int64(napi_env env,
napi_value value,
Expand All @@ -2347,10 +2342,9 @@ This API returns the C `int64_t` primitive equivalent of the given JavaScript
#### napi_get_value_bigint_uint64
<!-- YAML
added: v10.7.0
napiVersion: 6
-->

> Stability: 1 - Experimental

```C
napi_status napi_get_value_bigint_uint64(napi_env env,
napi_value value,
Expand All @@ -2375,10 +2369,9 @@ This API returns the C `uint64_t` primitive equivalent of the given JavaScript
#### napi_get_value_bigint_words
<!-- YAML
added: v10.7.0
napiVersion: 6
-->

> Stability: 1 - Experimental

```C
napi_status napi_get_value_bigint_words(napi_env env,
napi_value value,
Expand Down Expand Up @@ -3189,10 +3182,9 @@ included.
#### napi_get_all_property_names
<!-- YAML
added: REPLACEME
napiVersion: 6
-->

> Stability: 1 - Experimental

```C
napi_get_all_property_names(napi_env env,
napi_value object,
Expand Down
6 changes: 3 additions & 3 deletions src/node_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define NAPI_VERSION 2147483647
#else
// The baseline version for N-API
#define NAPI_VERSION 5
#define NAPI_VERSION 6
#endif
#endif

Expand Down Expand Up @@ -699,7 +699,7 @@ NAPI_EXTERN napi_status napi_add_finalizer(napi_env env,

#endif // NAPI_VERSION >= 5

#ifdef NAPI_EXPERIMENTAL
#if NAPI_VERSION >= 6

// BigInt
NAPI_EXTERN napi_status napi_create_bigint_int64(napi_env env,
Expand Down Expand Up @@ -745,7 +745,7 @@ napi_get_all_property_names(napi_env env,
napi_key_conversion key_conversion,
napi_value* result);

#endif // NAPI_EXPERIMENTAL
#endif // NAPI_VERSION >= 6

EXTERN_C_END

Expand Down
4 changes: 2 additions & 2 deletions src/node_api_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ typedef struct {
const char* release;
} napi_node_version;

#ifdef NAPI_EXPERIMENTAL
#if NAPI_VERSION >= 6
typedef enum {
napi_key_include_prototypes,
napi_key_own_only
Expand All @@ -166,6 +166,6 @@ typedef enum {
napi_key_keep_numbers,
napi_key_numbers_to_strings
} napi_key_conversion;
#endif
#endif // NAPI_VERSION >= 6

#endif // SRC_NODE_API_TYPES_H_
5 changes: 3 additions & 2 deletions src/node_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@
*/
#define NODE_MODULE_VERSION 64

// the NAPI_VERSION provided by this version of the runtime
#define NAPI_VERSION 5
// The NAPI_VERSION provided by this version of the runtime. This is the version
// which the Node binary being built supports.
#define NAPI_VERSION 6

#endif // SRC_NODE_VERSION_H_
2 changes: 0 additions & 2 deletions test/addons-napi/test_bigint/test_bigint.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#define NAPI_EXPERIMENTAL

#include <inttypes.h>
#include <stdio.h>
#include <node_api.h>
Expand Down
2 changes: 1 addition & 1 deletion test/addons-napi/test_general/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ assert.notStrictEqual(test_general.testGetPrototype(baseObject),

// test version management functions
// expected version is currently 4
assert.strictEqual(test_general.testGetVersion(), 5);
assert.strictEqual(test_general.testGetVersion(), 6);

const [ major, minor, patch, release ] = test_general.testGetNodeVersion();
assert.strictEqual(process.version.split('-')[0],
Expand Down
1 change: 0 additions & 1 deletion test/addons-napi/test_instance_data/test_instance_data.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <uv.h>
#define NAPI_EXPERIMENTAL
#include <node_api.h>
#include "../common.h"

Expand Down
1 change: 0 additions & 1 deletion test/addons-napi/test_object/test_object.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#define NAPI_EXPERIMENTAL
#include <node_api.h>
#include "../common.h"
#include <string.h>
Expand Down

0 comments on commit e1e2c2d

Please sign in to comment.