GeezerVison is showing github.com — node-api: define version 9 · nodejs/node@a94f87e
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 +4-8Lines changed: 4 additions & 8 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1220,10 +1220,9 @@ This API throws a JavaScript `RangeError` with the text provided. | 1220 | 1220 | added: | 1221 | 1221 | - v17.2.0 | 1222 | 1222 | - v16.14.0 | | 1223 | +napiVersion: 9 | 1223 | 1224 | --> | 1224 | 1225 |
| 1225 | | -> Stability: 1 - Experimental | 1226 | | - | 1227 | 1226 | ```c | 1228 | 1227 | NAPI_EXTERN napi_status node_api_throw_syntax_error(napi_env env, | 1229 | 1228 | const char* code, | @@ -1341,10 +1340,9 @@ This API returns a JavaScript `RangeError` with the text provided. | 1341 | 1340 | added: | 1342 | 1341 | - v17.2.0 | 1343 | 1342 | - v16.14.0 | | 1343 | +napiVersion: 9 | 1344 | 1344 | --> | 1345 | 1345 |
| 1346 | | -> Stability: 1 - Experimental | 1347 | | - | 1348 | 1346 | ```c | 1349 | 1347 | NAPI_EXTERN napi_status node_api_create_syntax_error(napi_env env, | 1350 | 1348 | napi_value code, | @@ -2592,10 +2590,9 @@ of the ECMAScript Language Specification. | 2592 | 2590 | added: | 2593 | 2591 | - v17.5.0 | 2594 | 2592 | - v16.15.0 | | 2593 | +napiVersion: 9 | 2595 | 2594 | --> | 2596 | 2595 |
| 2597 | | -> Stability: 1 - Experimental | 2598 | | - | 2599 | 2596 | ```c | 2600 | 2597 | napi_status node_api_symbol_for(napi_env env, | 2601 | 2598 | const char* utf8description, | @@ -6348,10 +6345,9 @@ added: | 6348 | 6345 | - v15.9.0 | 6349 | 6346 | - v14.18.0 | 6350 | 6347 | - v12.22.0 | | 6348 | +napiVersion: 9 | 6351 | 6349 | --> | 6352 | 6350 |
| 6353 | | -> Stability: 1 - Experimental | 6354 | | - | 6355 | 6351 | ```c | 6356 | 6352 | NAPI_EXTERN napi_status | 6357 | 6353 | node_api_get_module_file_name(napi_env env, const char** result); | |
Collapse file Copy file name to clipboardExpand all lines: src/js_native_api.h +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -95,13 +95,13 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_create_string_utf16(napi_env env, | 95 | 95 | NAPI_EXTERN napi_status NAPI_CDECL napi_create_symbol(napi_env env, | 96 | 96 | napi_value description, | 97 | 97 | napi_value* result); | 98 | | -#ifdef NAPI_EXPERIMENTAL | | 98 | +#if NAPI_VERSION >= 9 | 99 | 99 | NAPI_EXTERN napi_status NAPI_CDECL | 100 | 100 | node_api_symbol_for(napi_env env, | 101 | 101 | const char* utf8description, | 102 | 102 | size_t length, | 103 | 103 | napi_value* result); | 104 | | -#endif // NAPI_EXPERIMENTAL | | 104 | +#endif // NAPI_VERSION >= 9 | 105 | 105 | NAPI_EXTERN napi_status NAPI_CDECL napi_create_function(napi_env env, | 106 | 106 | const char* utf8name, | 107 | 107 | size_t length, | @@ -120,10 +120,10 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_create_range_error(napi_env env, | 120 | 120 | napi_value code, | 121 | 121 | napi_value msg, | 122 | 122 | napi_value* result); | 123 | | -#ifdef NAPI_EXPERIMENTAL | | 123 | +#if NAPI_VERSION >= 9 | 124 | 124 | NAPI_EXTERN napi_status NAPI_CDECL node_api_create_syntax_error( | 125 | 125 | napi_env env, napi_value code, napi_value msg, napi_value* result); | 126 | | -#endif // NAPI_EXPERIMENTAL | | 126 | +#endif // NAPI_VERSION >= 9 | 127 | 127 |
| 128 | 128 | // Methods to get the native napi_value from Primitive type | 129 | 129 | NAPI_EXTERN napi_status NAPI_CDECL napi_typeof(napi_env env, | @@ -378,11 +378,11 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_throw_type_error(napi_env env, | 378 | 378 | NAPI_EXTERN napi_status NAPI_CDECL napi_throw_range_error(napi_env env, | 379 | 379 | const char* code, | 380 | 380 | const char* msg); | 381 | | -#ifdef NAPI_EXPERIMENTAL | | 381 | +#if NAPI_VERSION >= 9 | 382 | 382 | NAPI_EXTERN napi_status NAPI_CDECL node_api_throw_syntax_error(napi_env env, | 383 | 383 | const char* code, | 384 | 384 | const char* msg); | 385 | | -#endif // NAPI_EXPERIMENTAL | | 385 | +#endif // NAPI_VERSION >= 9 | 386 | 386 | NAPI_EXTERN napi_status NAPI_CDECL napi_is_error(napi_env env, | 387 | 387 | napi_value value, | 388 | 388 | bool* result); | |
Collapse file Copy file name to clipboardExpand all lines: src/node_api.cc +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -673,11 +673,13 @@ node::addon_context_register_func get_node_api_context_register_func( | 673 | 673 | const char* module_name, | 674 | 674 | int32_t module_api_version) { | 675 | 675 | static_assert( | 676 | | - NAPI_VERSION == 8, | | 676 | + NAPI_VERSION == 9, | 677 | 677 | "New version of Node-API requires adding another else-if statement below " | 678 | 678 | "for the new version and updating this assert condition."); | 679 | 679 | if (module_api_version <= NODE_API_DEFAULT_MODULE_API_VERSION) { | 680 | 680 | return node_api_context_register_func<NODE_API_DEFAULT_MODULE_API_VERSION>; | | 681 | + } else if (module_api_version == 9) { | | 682 | + return node_api_context_register_func<9>; | 681 | 683 | } else if (module_api_version == NAPI_VERSION_EXPERIMENTAL) { | 682 | 684 | return node_api_context_register_func<NAPI_VERSION_EXPERIMENTAL>; | 683 | 685 | } else { | |
Collapse file Copy file name to clipboardExpand all lines: src/node_api.h +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -248,12 +248,12 @@ napi_remove_async_cleanup_hook(napi_async_cleanup_hook_handle remove_handle); | 248 | 248 |
| 249 | 249 | #endif // NAPI_VERSION >= 8 | 250 | 250 |
| 251 | | -#ifdef NAPI_EXPERIMENTAL | | 251 | +#if NAPI_VERSION >= 9 | 252 | 252 |
| 253 | 253 | NAPI_EXTERN napi_status NAPI_CDECL | 254 | 254 | node_api_get_module_file_name(napi_env env, const char** result); | 255 | 255 |
| 256 | | -#endif // NAPI_EXPERIMENTAL | | 256 | +#endif // NAPI_VERSION >= 9 | 257 | 257 |
| 258 | 258 | EXTERN_C_END | 259 | 259 |
| |
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 8 | | 96 | +#define NAPI_VERSION 9 | 97 | 97 |
| 98 | 98 | // Node API modules use NAPI_VERSION 8 by default if it is not explicitly | 99 | 99 | // specified. It must be always 8. | |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_error/test_error.c +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#define NAPI_EXPERIMENTAL | | 1 | +#define NAPI_VERSION 9 | 2 | 2 | #include <js_native_api.h> | 3 | 3 | #include "../common.h" | 4 | 4 |
| |
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(), 8); | | 36 | +assert.strictEqual(test_general.testGetVersion(), 9); | 37 | 37 |
| 38 | 38 | [ | 39 | 39 | 123, | |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_properties/test_properties.c +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#define NAPI_EXPERIMENTAL | | 1 | +#define NAPI_VERSION 9 | 2 | 2 | #include <js_native_api.h> | 3 | 3 | #include "../common.h" | 4 | 4 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_reference/test_reference.c +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#define NAPI_EXPERIMENTAL | | 1 | +#define NAPI_VERSION 9 | 2 | 2 | #include <stdlib.h> | 3 | 3 | #include <assert.h> | 4 | 4 | #include <js_native_api.h> | |
Collapse file Copy file name to clipboardExpand all lines: test/node-api/test_general/test_general.c +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#define NAPI_EXPERIMENTAL | | 1 | +#define NAPI_VERSION 9 | 2 | 2 | // we define NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED here to validate that it can | 3 | 3 | // be used as a form of test itself. It is | 4 | 4 | // not related to any of the other tests | |
|