Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ce7e6c6

Browse filesBrowse files
legendecasMoLow
authored andcommitted
node-api: define version 9
PR-URL: #48151 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Gabriel Schulhof <gabrielschulhof@gmail.com>
1 parent e049ce2 commit ce7e6c6
Copy full SHA for ce7e6c6

File tree

Expand file treeCollapse file tree

10 files changed

+21
-23
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

10 files changed

+21
-23
lines changed
Open diff view settings
Collapse file

‎doc/api/n-api.md‎

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 numberDiff line numberDiff line change
@@ -1218,10 +1218,9 @@ This API throws a JavaScript `RangeError` with the text provided.
12181218
added:
12191219
- v17.2.0
12201220
- v16.14.0
1221+
napiVersion: 9
12211222
-->
12221223

1223-
> Stability: 1 - Experimental
1224-
12251224
```c
12261225
NAPI_EXTERN napi_status node_api_throw_syntax_error(napi_env env,
12271226
const char* code,
@@ -1339,10 +1338,9 @@ This API returns a JavaScript `RangeError` with the text provided.
13391338
added:
13401339
- v17.2.0
13411340
- v16.14.0
1341+
napiVersion: 9
13421342
-->
13431343

1344-
> Stability: 1 - Experimental
1345-
13461344
```c
13471345
NAPI_EXTERN napi_status node_api_create_syntax_error(napi_env env,
13481346
napi_value code,
@@ -2588,10 +2586,9 @@ of the ECMAScript Language Specification.
25882586

25892587
<!-- YAML
25902588
added: v17.5.0
2589+
napiVersion: 9
25912590
-->
25922591

2593-
> Stability: 1 - Experimental
2594-
25952592
```c
25962593
napi_status node_api_symbol_for(napi_env env,
25972594
const char* utf8description,
@@ -6344,10 +6341,9 @@ added:
63446341
- v15.9.0
63456342
- v14.18.0
63466343
- v12.22.0
6344+
napiVersion: 9
63476345
-->
63486346

6349-
> Stability: 1 - Experimental
6350-
63516347
```c
63526348
NAPI_EXTERN napi_status
63536349
node_api_get_module_file_name(napi_env env, const char** result);
Collapse file

‎src/js_native_api.h‎

Copy file name to clipboardExpand all lines: src/js_native_api.h
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_create_string_utf16(napi_env env,
9595
NAPI_EXTERN napi_status NAPI_CDECL napi_create_symbol(napi_env env,
9696
napi_value description,
9797
napi_value* result);
98-
#ifdef NAPI_EXPERIMENTAL
98+
#if NAPI_VERSION >= 9
9999
NAPI_EXTERN napi_status NAPI_CDECL
100100
node_api_symbol_for(napi_env env,
101101
const char* utf8description,
102102
size_t length,
103103
napi_value* result);
104-
#endif // NAPI_EXPERIMENTAL
104+
#endif // NAPI_VERSION >= 9
105105
NAPI_EXTERN napi_status NAPI_CDECL napi_create_function(napi_env env,
106106
const char* utf8name,
107107
size_t length,
@@ -120,10 +120,10 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_create_range_error(napi_env env,
120120
napi_value code,
121121
napi_value msg,
122122
napi_value* result);
123-
#ifdef NAPI_EXPERIMENTAL
123+
#if NAPI_VERSION >= 9
124124
NAPI_EXTERN napi_status NAPI_CDECL node_api_create_syntax_error(
125125
napi_env env, napi_value code, napi_value msg, napi_value* result);
126-
#endif // NAPI_EXPERIMENTAL
126+
#endif // NAPI_VERSION >= 9
127127

128128
// Methods to get the native napi_value from Primitive type
129129
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,
378378
NAPI_EXTERN napi_status NAPI_CDECL napi_throw_range_error(napi_env env,
379379
const char* code,
380380
const char* msg);
381-
#ifdef NAPI_EXPERIMENTAL
381+
#if NAPI_VERSION >= 9
382382
NAPI_EXTERN napi_status NAPI_CDECL node_api_throw_syntax_error(napi_env env,
383383
const char* code,
384384
const char* msg);
385-
#endif // NAPI_EXPERIMENTAL
385+
#endif // NAPI_VERSION >= 9
386386
NAPI_EXTERN napi_status NAPI_CDECL napi_is_error(napi_env env,
387387
napi_value value,
388388
bool* result);
Collapse file

‎src/node_api.cc‎

Copy file name to clipboardExpand all lines: src/node_api.cc
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,11 +673,13 @@ node::addon_context_register_func get_node_api_context_register_func(
673673
const char* module_name,
674674
int32_t module_api_version) {
675675
static_assert(
676-
NAPI_VERSION == 8,
676+
NAPI_VERSION == 9,
677677
"New version of Node-API requires adding another else-if statement below "
678678
"for the new version and updating this assert condition.");
679679
if (module_api_version <= NODE_API_DEFAULT_MODULE_API_VERSION) {
680680
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>;
681683
} else if (module_api_version == NAPI_VERSION_EXPERIMENTAL) {
682684
return node_api_context_register_func<NAPI_VERSION_EXPERIMENTAL>;
683685
} else {
Collapse file

‎src/node_api.h‎

Copy file name to clipboardExpand all lines: src/node_api.h
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,12 @@ napi_remove_async_cleanup_hook(napi_async_cleanup_hook_handle remove_handle);
248248

249249
#endif // NAPI_VERSION >= 8
250250

251-
#ifdef NAPI_EXPERIMENTAL
251+
#if NAPI_VERSION >= 9
252252

253253
NAPI_EXTERN napi_status NAPI_CDECL
254254
node_api_get_module_file_name(napi_env env, const char** result);
255255

256-
#endif // NAPI_EXPERIMENTAL
256+
#endif // NAPI_VERSION >= 9
257257

258258
EXTERN_C_END
259259

Collapse file

‎src/node_version.h‎

Copy file name to clipboardExpand all lines: src/node_version.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393

9494
// The NAPI_VERSION provided by this version of the runtime. This is the version
9595
// which the Node binary being built supports.
96-
#define NAPI_VERSION 8
96+
#define NAPI_VERSION 9
9797

9898
// Node API modules use NAPI_VERSION 8 by default if it is not explicitly
9999
// specified. It must be always 8.
Collapse file

‎test/js-native-api/test_error/test_error.c‎

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 numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#define NAPI_EXPERIMENTAL
1+
#define NAPI_VERSION 9
22
#include <js_native_api.h>
33
#include "../common.h"
44

Collapse file

‎test/js-native-api/test_general/test.js‎

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 numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ assert.notStrictEqual(test_general.testGetPrototype(baseObject),
3333
test_general.testGetPrototype(extendedObject));
3434

3535
// Test version management functions
36-
assert.strictEqual(test_general.testGetVersion(), 8);
36+
assert.strictEqual(test_general.testGetVersion(), 9);
3737

3838
[
3939
123,
Collapse file

‎test/js-native-api/test_properties/test_properties.c‎

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 numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#define NAPI_EXPERIMENTAL
1+
#define NAPI_VERSION 9
22
#include <js_native_api.h>
33
#include "../common.h"
44

Collapse file

‎test/js-native-api/test_reference/test_reference.c‎

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 numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#define NAPI_EXPERIMENTAL
1+
#define NAPI_VERSION 9
22
#include <stdlib.h>
33
#include <assert.h>
44
#include <js_native_api.h>
Collapse file

‎test/node-api/test_general/test_general.c‎

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 numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#define NAPI_EXPERIMENTAL
1+
#define NAPI_VERSION 9
22
// we define NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED here to validate that it can
33
// be used as a form of test itself. It is
44
// not related to any of the other tests

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.