Skip to content

Update headers from nodejs/node tag v20.3.0 #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion def/js_native_api.def
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,7 @@ napi_is_detached_arraybuffer
napi_check_object_type_tag
napi_object_freeze
napi_object_seal
napi_type_tag_object
napi_type_tag_object
node_api_create_syntax_error
node_api_symbol_for
node_api_throw_syntax_error
6 changes: 5 additions & 1 deletion def/node_api.def
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,8 @@ napi_remove_async_cleanup_hook
napi_check_object_type_tag
napi_object_freeze
napi_object_seal
napi_type_tag_object
napi_type_tag_object
node_api_get_module_file_name
node_api_create_syntax_error
node_api_symbol_for
node_api_throw_syntax_error
16 changes: 16 additions & 0 deletions include/js_native_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_create_string_utf16(napi_env env,
NAPI_EXTERN napi_status NAPI_CDECL napi_create_symbol(napi_env env,
napi_value description,
napi_value* result);
#if NAPI_VERSION >= 9
NAPI_EXTERN napi_status NAPI_CDECL
node_api_symbol_for(napi_env env,
const char* utf8description,
size_t length,
napi_value* result);
#endif // NAPI_VERSION >= 9
NAPI_EXTERN napi_status NAPI_CDECL napi_create_function(napi_env env,
const char* utf8name,
size_t length,
Expand All @@ -109,6 +116,10 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_create_range_error(napi_env env,
napi_value code,
napi_value msg,
napi_value* result);
#if NAPI_VERSION >= 9
NAPI_EXTERN napi_status NAPI_CDECL node_api_create_syntax_error(
napi_env env, napi_value code, napi_value msg, napi_value* result);
#endif // NAPI_VERSION >= 9

// Methods to get the native napi_value from Primitive type
NAPI_EXTERN napi_status NAPI_CDECL napi_typeof(napi_env env,
Expand Down Expand Up @@ -363,6 +374,11 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_throw_type_error(napi_env env,
NAPI_EXTERN napi_status NAPI_CDECL napi_throw_range_error(napi_env env,
const char* code,
const char* msg);
#if NAPI_VERSION >= 9
NAPI_EXTERN napi_status NAPI_CDECL node_api_throw_syntax_error(napi_env env,
const char* code,
const char* msg);
#endif // NAPI_VERSION >= 9
NAPI_EXTERN napi_status NAPI_CDECL napi_is_error(napi_env env,
napi_value value,
bool* result);
Expand Down
3 changes: 2 additions & 1 deletion include/js_native_api_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ typedef enum {
napi_arraybuffer_expected,
napi_detachable_arraybuffer_expected,
napi_would_deadlock, // unused
napi_no_external_buffers_allowed
napi_no_external_buffers_allowed,
napi_cannot_run_js,
} napi_status;
// Note: when adding a new enum value to `napi_status`, please also update
// * `const int last_status` in the definition of `napi_get_last_error_info()'
Expand Down
6 changes: 6 additions & 0 deletions include/node_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,12 @@ napi_remove_async_cleanup_hook(napi_async_cleanup_hook_handle remove_handle);

#endif // NAPI_VERSION >= 8

#if NAPI_VERSION >= 9

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

#endif // NAPI_VERSION >= 9

EXTERN_C_END

Expand Down
16 changes: 15 additions & 1 deletion symbols.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,19 @@ const v8 = {
]
}

const v9 = {
js_native_api_symbols: [
...v8.js_native_api_symbols,
'node_api_create_syntax_error',
'node_api_symbol_for',
'node_api_throw_syntax_error'
],
node_api_symbols: [
...v8.node_api_symbols,
'node_api_get_module_file_name'
]
}

module.exports = {
v1,
v2,
Expand All @@ -223,5 +236,6 @@ module.exports = {
v5,
v6,
v7,
v8
v8,
v9
}