GeezerVison is showing github.com — node-api: define version 8 · nodejs/node@a86334f
File treeExpand file treeCollapse file tree Open diff view settings node-api/test_async_cleanup_hook
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: doc/api/n-api.md +6-12Lines changed: 6 additions & 12 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -689,6 +689,7 @@ For more details, review the [Object lifetime management][]. | 689 | 689 | added: | 690 | 690 | - v14.8.0 | 691 | 691 | - v12.19.0 | | 692 | +napiVersion: 8 | 692 | 693 | --> | 693 | 694 |
| 694 | 695 | A 128-bit value stored as two unsigned 64-bit integers. It serves as a UUID | @@ -1703,6 +1704,7 @@ with `napi_add_env_cleanup_hook`, otherwise the process will abort. | 1703 | 1704 | added: | 1704 | 1705 | - v14.8.0 | 1705 | 1706 | - v12.19.0 | | 1707 | +napiVersion: 8 | 1706 | 1708 | changes: | 1707 | 1709 | - version: | 1708 | 1710 | - v14.10.0 | @@ -1711,8 +1713,6 @@ changes: | 1711 | 1713 | description: Changed signature of the `hook` callback. | 1712 | 1714 | --> | 1713 | 1715 |
| 1714 | | -> Stability: 1 - Experimental | 1715 | | - | 1716 | 1716 | ```c | 1717 | 1717 | NAPI_EXTERN napi_status napi_add_async_cleanup_hook( | 1718 | 1718 | napi_env env, | @@ -1754,8 +1754,6 @@ changes: | 1754 | 1754 | description: Removed `env` parameter. | 1755 | 1755 | --> | 1756 | 1756 |
| 1757 | | -> Stability: 1 - Experimental | 1758 | | - | 1759 | 1757 | ```c | 1760 | 1758 | NAPI_EXTERN napi_status napi_remove_async_cleanup_hook( | 1761 | 1759 | napi_async_cleanup_hook_handle remove_handle); | @@ -4211,10 +4209,9 @@ specification). | 4211 | 4209 | #### napi_object_freeze | 4212 | 4210 | <!-- YAML | 4213 | 4211 | added: v14.14.0 | | 4212 | +napiVersion: 8 | 4214 | 4213 | --> | 4215 | 4214 |
| 4216 | | -> Stability: 1 - Experimental | 4217 | | - | 4218 | 4215 | ```c | 4219 | 4216 | napi_status napi_object_freeze(napi_env env, | 4220 | 4217 | napi_value object); | @@ -4236,10 +4233,9 @@ ECMA-262 specification. | 4236 | 4233 | #### napi_object_seal | 4237 | 4234 | <!-- YAML | 4238 | 4235 | added: v14.14.0 | | 4236 | +napiVersion: 8 | 4239 | 4237 | --> | 4240 | 4238 |
| 4241 | | -> Stability: 1 - Experimental | 4242 | | - | 4243 | 4239 | ```c | 4244 | 4240 | napi_status napi_object_seal(napi_env env, | 4245 | 4241 | napi_value object); | @@ -4901,10 +4897,9 @@ JavaScript object becomes garbage-collected. | 4901 | 4897 | added: | 4902 | 4898 | - v14.8.0 | 4903 | 4899 | - v12.19.0 | | 4900 | +napiVersion: 8 | 4904 | 4901 | --> | 4905 | 4902 |
| 4906 | | -> Stability: 1 - Experimental | 4907 | | - | 4908 | 4903 | ```c | 4909 | 4904 | napi_status napi_type_tag_object(napi_env env, | 4910 | 4905 | napi_value js_object, | @@ -4930,10 +4925,9 @@ If the object already has an associated type tag, this API will return | 4930 | 4925 | added: | 4931 | 4926 | - v14.8.0 | 4932 | 4927 | - v12.19.0 | | 4928 | +napiVersion: 8 | 4933 | 4929 | --> | 4934 | 4930 |
| 4935 | | -> Stability: 1 - Experimental | 4936 | | - | 4937 | 4931 | ```c | 4938 | 4932 | napi_status napi_check_object_type_tag(napi_env env, | 4939 | 4933 | napi_value js_object, | |
Collapse file Copy file name to clipboardExpand all lines: src/js_native_api.h +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 17 | 17 | // functions available in a new version of N-API that is not yet ported in all | 18 | 18 | // LTS versions, they can set NAPI_VERSION knowing that they have specifically | 19 | 19 | // depended on that version. | 20 | | -#define NAPI_VERSION 7 | | 20 | +#define NAPI_VERSION 8 | 21 | 21 | #endif | 22 | 22 | #endif | 23 | 23 |
| @@ -539,7 +539,7 @@ NAPI_EXTERN napi_status napi_is_detached_arraybuffer(napi_env env, | 539 | 539 | bool* result); | 540 | 540 | #endif // NAPI_VERSION >= 7 | 541 | 541 |
| 542 | | -#ifdef NAPI_EXPERIMENTAL | | 542 | +#if NAPI_VERSION >= 8 | 543 | 543 | // Type tagging | 544 | 544 | NAPI_EXTERN napi_status napi_type_tag_object(napi_env env, | 545 | 545 | napi_value value, | @@ -554,7 +554,7 @@ NAPI_EXTERN napi_status napi_object_freeze(napi_env env, | 554 | 554 | napi_value object); | 555 | 555 | NAPI_EXTERN napi_status napi_object_seal(napi_env env, | 556 | 556 | napi_value object); | 557 | | -#endif // NAPI_EXPERIMENTAL | | 557 | +#endif // NAPI_VERSION >= 8 | 558 | 558 |
| 559 | 559 | EXTERN_C_END | 560 | 560 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/js_native_api_types.h +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -31,15 +31,15 @@ typedef enum { | 31 | 31 | // from instance properties. Ignored by napi_define_properties. | 32 | 32 | napi_static = 1 << 10, | 33 | 33 |
| 34 | | -#ifdef NAPI_EXPERIMENTAL | | 34 | +#if NAPI_VERSION >= 8 | 35 | 35 | // Default for class methods. | 36 | 36 | napi_default_method = napi_writable | napi_configurable, | 37 | 37 |
| 38 | 38 | // Default for object properties, like in JS obj[prop]. | 39 | 39 | napi_default_jsproperty = napi_writable | | 40 | 40 | napi_enumerable | | 41 | 41 | napi_configurable, | 42 | | -#endif // NAPI_EXPERIMENTAL | | 42 | +#endif // NAPI_VERSION >= 8 | 43 | 43 | } napi_property_attributes; | 44 | 44 |
| 45 | 45 | typedef enum { | @@ -150,11 +150,11 @@ typedef enum { | 150 | 150 | } napi_key_conversion; | 151 | 151 | #endif // NAPI_VERSION >= 6 | 152 | 152 |
| 153 | | -#ifdef NAPI_EXPERIMENTAL | | 153 | +#if NAPI_VERSION >= 8 | 154 | 154 | typedef struct { | 155 | 155 | uint64_t lower; | 156 | 156 | uint64_t upper; | 157 | 157 | } napi_type_tag; | 158 | | -#endif // NAPI_EXPERIMENTAL | | 158 | +#endif // NAPI_VERSION >= 8 | 159 | 159 |
| 160 | 160 | #endif // SRC_JS_NATIVE_API_TYPES_H_ |
Collapse file Copy file name to clipboardExpand all lines: src/node_api.h +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -250,7 +250,7 @@ napi_ref_threadsafe_function(napi_env env, napi_threadsafe_function func); | 250 | 250 |
| 251 | 251 | #endif // NAPI_VERSION >= 4 | 252 | 252 |
| 253 | | -#ifdef NAPI_EXPERIMENTAL | | 253 | +#if NAPI_VERSION >= 8 | 254 | 254 |
| 255 | 255 | NAPI_EXTERN napi_status napi_add_async_cleanup_hook( | 256 | 256 | napi_env env, | @@ -261,6 +261,10 @@ NAPI_EXTERN napi_status napi_add_async_cleanup_hook( | 261 | 261 | NAPI_EXTERN napi_status napi_remove_async_cleanup_hook( | 262 | 262 | napi_async_cleanup_hook_handle remove_handle); | 263 | 263 |
| | 264 | +#endif // NAPI_VERSION >= 8 | | 265 | + | | 266 | +#ifdef NAPI_EXPERIMENTAL | | 267 | + | 264 | 268 | NAPI_EXTERN napi_status | 265 | 269 | node_api_get_module_file_name(napi_env env, const char** result); | 266 | 270 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/node_api_types.h +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -41,10 +41,10 @@ typedef struct { | 41 | 41 | const char* release; | 42 | 42 | } napi_node_version; | 43 | 43 |
| 44 | | -#ifdef NAPI_EXPERIMENTAL | | 44 | +#if NAPI_VERSION >= 8 | 45 | 45 | typedef struct napi_async_cleanup_hook_handle__* napi_async_cleanup_hook_handle; | 46 | 46 | typedef void (*napi_async_cleanup_hook)(napi_async_cleanup_hook_handle handle, | 47 | 47 | void* data); | 48 | | -#endif // NAPI_EXPERIMENTAL | | 48 | +#endif // NAPI_VERSION >= 8 | 49 | 49 |
| 50 | 50 | #endif // SRC_NODE_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 7 | | 96 | +#define NAPI_VERSION 8 | 97 | 97 |
| 98 | 98 | #endif // SRC_NODE_VERSION_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 | 36 | | -assert.strictEqual(test_general.testGetVersion(), 7); | | 36 | +assert.strictEqual(test_general.testGetVersion(), 8); | 37 | 37 |
| 38 | 38 | [ | 39 | 39 | 123, | |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_object/test_object.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 | #include "../common.h" | 4 | 3 | #include <string.h> | |
Collapse file Copy file name to clipboardExpand all lines: test/node-api/test_async_cleanup_hook/binding.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 "assert.h" | 4 | 3 | #include "uv.h" | |
|