GeezerVison is showing github.com — n-api: define release 6 · btd/node@c0c81ed
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: doc/api/n-api.md +12-20Lines changed: 12 additions & 20 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -374,6 +374,7 @@ tied to the life cycle of the Agent. | 374 | 374 | ### napi_set_instance_data | 375 | 375 | <!-- YAML | 376 | 376 | added: v12.8.0 | | 377 | +napiVersion: 6 | 377 | 378 | --> | 378 | 379 |
| 379 | 380 | ```C | @@ -401,6 +402,7 @@ by the previous call, it will not be called. | 401 | 402 | ### napi_get_instance_data | 402 | 403 | <!-- YAML | 403 | 404 | added: v12.8.0 | | 405 | +napiVersion: 6 | 404 | 406 | --> | 405 | 407 |
| 406 | 408 | ```C | @@ -1663,10 +1665,9 @@ the `napi_value` in question is of the JavaScript type expected by the API. | 1663 | 1665 | #### napi_key_collection_mode | 1664 | 1666 | <!-- YAML | 1665 | 1667 | added: v13.7.0 | | 1668 | +napiVersion: 6 | 1666 | 1669 | --> | 1667 | 1670 |
| 1668 | | -> Stability: 1 - Experimental | 1669 | | - | 1670 | 1671 | ```C | 1671 | 1672 | typedef enum { | 1672 | 1673 | napi_key_include_prototypes, | @@ -1685,10 +1686,9 @@ of the objects's prototype chain as well. | 1685 | 1686 | #### napi_key_filter | 1686 | 1687 | <!-- YAML | 1687 | 1688 | added: v13.7.0 | | 1689 | +napiVersion: 6 | 1688 | 1690 | --> | 1689 | 1691 |
| 1690 | | -> Stability: 1 - Experimental | 1691 | | - | 1692 | 1692 | ```C | 1693 | 1693 | typedef enum { | 1694 | 1694 | napi_key_all_properties = 0, | @@ -1705,10 +1705,9 @@ Property filter bits. They can be or'ed to build a composite filter. | 1705 | 1705 | #### napi_key_conversion | 1706 | 1706 | <!-- YAML | 1707 | 1707 | added: v13.7.0 | | 1708 | +napiVersion: 6 | 1708 | 1709 | --> | 1709 | 1710 |
| 1710 | | -> Stability: 1 - Experimental | 1711 | | - | 1712 | 1711 | ```C | 1713 | 1712 | typedef enum { | 1714 | 1713 | napi_key_keep_numbers, | @@ -2262,10 +2261,9 @@ The JavaScript `Number` type is described in | 2262 | 2261 | #### napi_create_bigint_int64 | 2263 | 2262 | <!-- YAML | 2264 | 2263 | added: v10.7.0 | | 2264 | +napiVersion: 6 | 2265 | 2265 | --> | 2266 | 2266 |
| 2267 | | -> Stability: 1 - Experimental | 2268 | | - | 2269 | 2267 | ```C | 2270 | 2268 | napi_status napi_create_bigint_int64(napi_env env, | 2271 | 2269 | int64_t value, | @@ -2283,10 +2281,9 @@ This API converts the C `int64_t` type to the JavaScript `BigInt` type. | 2283 | 2281 | #### napi_create_bigint_uint64 | 2284 | 2282 | <!-- YAML | 2285 | 2283 | added: v10.7.0 | | 2284 | +napiVersion: 6 | 2286 | 2285 | --> | 2287 | 2286 |
| 2288 | | -> Stability: 1 - Experimental | 2289 | | - | 2290 | 2287 | ```C | 2291 | 2288 | napi_status napi_create_bigint_uint64(napi_env env, | 2292 | 2289 | uint64_t value, | @@ -2304,10 +2301,9 @@ This API converts the C `uint64_t` type to the JavaScript `BigInt` type. | 2304 | 2301 | #### napi_create_bigint_words | 2305 | 2302 | <!-- YAML | 2306 | 2303 | added: v10.7.0 | | 2304 | +napiVersion: 6 | 2307 | 2305 | --> | 2308 | 2306 |
| 2309 | | -> Stability: 1 - Experimental | 2310 | | - | 2311 | 2307 | ```C | 2312 | 2308 | napi_status napi_create_bigint_words(napi_env env, | 2313 | 2309 | int sign_bit, | @@ -2653,10 +2649,9 @@ This API returns the C double primitive equivalent of the given JavaScript | 2653 | 2649 | #### napi_get_value_bigint_int64 | 2654 | 2650 | <!-- YAML | 2655 | 2651 | added: v10.7.0 | | 2652 | +napiVersion: 6 | 2656 | 2653 | --> | 2657 | 2654 |
| 2658 | | -> Stability: 1 - Experimental | 2659 | | - | 2660 | 2655 | ```C | 2661 | 2656 | napi_status napi_get_value_bigint_int64(napi_env env, | 2662 | 2657 | napi_value value, | @@ -2680,10 +2675,9 @@ This API returns the C `int64_t` primitive equivalent of the given JavaScript | 2680 | 2675 | #### napi_get_value_bigint_uint64 | 2681 | 2676 | <!-- YAML | 2682 | 2677 | added: v10.7.0 | | 2678 | +napiVersion: 6 | 2683 | 2679 | --> | 2684 | 2680 |
| 2685 | | -> Stability: 1 - Experimental | 2686 | | - | 2687 | 2681 | ```C | 2688 | 2682 | napi_status napi_get_value_bigint_uint64(napi_env env, | 2689 | 2683 | napi_value value, | @@ -2707,10 +2701,9 @@ This API returns the C `uint64_t` primitive equivalent of the given JavaScript | 2707 | 2701 | #### napi_get_value_bigint_words | 2708 | 2702 | <!-- YAML | 2709 | 2703 | added: v10.7.0 | | 2704 | +napiVersion: 6 | 2710 | 2705 | --> | 2711 | 2706 |
| 2712 | | -> Stability: 1 - Experimental | 2713 | | - | 2714 | 2707 | ```C | 2715 | 2708 | napi_status napi_get_value_bigint_words(napi_env env, | 2716 | 2709 | napi_value value, | @@ -3595,10 +3588,9 @@ included. | 3595 | 3588 | #### napi_get_all_property_names | 3596 | 3589 | <!-- YAML | 3597 | 3590 | added: v13.7.0 | | 3591 | +napiVersion: 6 | 3598 | 3592 | --> | 3599 | 3593 |
| 3600 | | -> Stability: 1 - Experimental | 3601 | | - | 3602 | 3594 | ```C | 3603 | 3595 | napi_get_all_property_names(napi_env env, | 3604 | 3596 | napi_value object, | |
Collapse file Copy file name to clipboardExpand all lines: src/js_native_api.h +6-3Lines changed: 6 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 4 | 4 | // This file needs to be compatible with C compilers. | 5 | 5 | #include <stddef.h> // NOLINT(modernize-deprecated-headers) | 6 | 6 | #include <stdbool.h> // NOLINT(modernize-deprecated-headers) | 7 | | -#include "js_native_api_types.h" | 8 | 7 |
| 9 | 8 | // Use INT_MAX, this should only be consumed by the pre-processor anyway. | 10 | 9 | #define NAPI_VERSION_EXPERIMENTAL 2147483647 | | 18 | 17 | // functions available in a new version of N-API that is not yet ported in all | 19 | 18 | // LTS versions, they can set NAPI_VERSION knowing that they have specifically | 20 | 19 | // depended on that version. | 21 | | -#define NAPI_VERSION 5 | | 20 | +#define NAPI_VERSION 6 | 22 | 21 | #endif | 23 | 22 | #endif | 24 | 23 |
| | 24 | +#include "js_native_api_types.h" | | 25 | + | 25 | 26 | // If you need __declspec(dllimport), either include <node_api.h> instead, or | 26 | 27 | // define NAPI_EXTERN as __declspec(dllimport) on the compiler's command line. | 27 | 28 | #ifndef NAPI_EXTERN | @@ -478,7 +479,7 @@ NAPI_EXTERN napi_status napi_add_finalizer(napi_env env, | 478 | 479 |
| 479 | 480 | #endif // NAPI_VERSION >= 5 | 480 | 481 |
| 481 | | -#ifdef NAPI_EXPERIMENTAL | | 482 | +#if NAPI_VERSION >= 6 | 482 | 483 |
| 483 | 484 | // BigInt | 484 | 485 | NAPI_EXTERN napi_status napi_create_bigint_int64(napi_env env, | @@ -523,7 +524,9 @@ NAPI_EXTERN napi_status napi_set_instance_data(napi_env env, | 523 | 524 |
| 524 | 525 | NAPI_EXTERN napi_status napi_get_instance_data(napi_env env, | 525 | 526 | void** data); | | 527 | +#endif // NAPI_VERSION >= 6 | 526 | 528 |
| | 529 | +#ifdef NAPI_EXPERIMENTAL | 527 | 530 | // ArrayBuffer detaching | 528 | 531 | NAPI_EXTERN napi_status napi_detach_arraybuffer(napi_env env, | 529 | 532 | napi_value arraybuffer); | |
Collapse file Copy file name to clipboardExpand all lines: src/js_native_api_types.h +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -115,7 +115,7 @@ typedef struct { | 115 | 115 | napi_status error_code; | 116 | 116 | } napi_extended_error_info; | 117 | 117 |
| 118 | | -#ifdef NAPI_EXPERIMENTAL | | 118 | +#if NAPI_VERSION >= 6 | 119 | 119 | typedef enum { | 120 | 120 | napi_key_include_prototypes, | 121 | 121 | napi_key_own_only | @@ -134,6 +134,6 @@ typedef enum { | 134 | 134 | napi_key_keep_numbers, | 135 | 135 | napi_key_numbers_to_strings | 136 | 136 | } napi_key_conversion; | 137 | | -#endif | | 137 | +#endif // NAPI_VERSION >= 6 | 138 | 138 |
| 139 | 139 | #endif // SRC_JS_NATIVE_API_TYPES_H_ |
Collapse file Copy file name to clipboardExpand all lines: src/node_version.h +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 93 | 93 |
| 94 | 94 | // The NAPI_VERSION provided by this version of the runtime. This is the version | 95 | 95 | // which the Node binary being built supports. | 96 | | -#define NAPI_VERSION 5 | | 96 | +#define NAPI_VERSION 6 | 97 | 97 |
| 98 | 98 | #endif // SRC_NODE_VERSION_H_ |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_bigint/test_bigint.c -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#define NAPI_EXPERIMENTAL | 2 | | - | 3 | 1 | #include <inttypes.h> | 4 | 2 | #include <stdio.h> | 5 | 3 | #include <js_native_api.h> | |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_general/test.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -33,7 +33,7 @@ assert.notStrictEqual(test_general.testGetPrototype(baseObject), | 33 | 33 | test_general.testGetPrototype(extendedObject)); | 34 | 34 |
| 35 | 35 | // Test version management functions. The expected version is currently 4. | 36 | | -assert.strictEqual(test_general.testGetVersion(), 5); | | 36 | +assert.strictEqual(test_general.testGetVersion(), 6); | 37 | 37 |
| 38 | 38 | [ | 39 | 39 | 123, | |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_instance_data/test_instance_data.c -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | #include <stdio.h> | 2 | 2 | #include <stdlib.h> | 3 | | -#define NAPI_EXPERIMENTAL | 4 | 3 | #include <js_native_api.h> | 5 | 4 | #include "../common.h" | 6 | 5 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_object/test_null.c -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#define NAPI_EXPERIMENTAL | 2 | 1 | #include <js_native_api.h> | 3 | 2 |
| 4 | 3 | #include "../common.h" | |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_object/test_object.c -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#define NAPI_EXPERIMENTAL | 2 | | - | 3 | 1 | #include <js_native_api.h> | 4 | 2 | #include "../common.h" | 5 | 3 | #include <string.h> | |
Collapse file Copy file name to clipboardExpand all lines: test/node-api/test_general/test_general.c -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#define NAPI_EXPERIMENTAL | 2 | 1 | #include <node_api.h> | 3 | 2 | #include <stdlib.h> | 4 | 3 | #include "../../js-native-api/common.h" | |
|