From 1f5a85dbb07b0b2fcb282c8151b48a0080e01ab9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 14 Jun 2023 10:49:36 +0200 Subject: [PATCH] Update headers from nodejs/node tag v20.3.0 (#30) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- def/js_native_api.def | 5 ++++- def/node_api.def | 6 +++++- include/js_native_api.h | 16 ++++++++++++++++ include/js_native_api_types.h | 3 ++- include/node_api.h | 6 ++++++ symbols.js | 16 +++++++++++++++- 6 files changed, 48 insertions(+), 4 deletions(-) diff --git a/def/js_native_api.def b/def/js_native_api.def index ba2b5c0..dc0d9d5 100644 --- a/def/js_native_api.def +++ b/def/js_native_api.def @@ -114,4 +114,7 @@ napi_is_detached_arraybuffer napi_check_object_type_tag napi_object_freeze napi_object_seal -napi_type_tag_object \ No newline at end of file +napi_type_tag_object +node_api_create_syntax_error +node_api_symbol_for +node_api_throw_syntax_error \ No newline at end of file diff --git a/def/node_api.def b/def/node_api.def index 3e3cc23..81c7d35 100644 --- a/def/node_api.def +++ b/def/node_api.def @@ -144,4 +144,8 @@ napi_remove_async_cleanup_hook napi_check_object_type_tag napi_object_freeze napi_object_seal -napi_type_tag_object \ No newline at end of file +napi_type_tag_object +node_api_get_module_file_name +node_api_create_syntax_error +node_api_symbol_for +node_api_throw_syntax_error \ No newline at end of file diff --git a/include/js_native_api.h b/include/js_native_api.h index 14d6bc5..e06bdc8 100644 --- a/include/js_native_api.h +++ b/include/js_native_api.h @@ -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, @@ -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, @@ -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); diff --git a/include/js_native_api_types.h b/include/js_native_api_types.h index 5176149..005382f 100644 --- a/include/js_native_api_types.h +++ b/include/js_native_api_types.h @@ -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()' diff --git a/include/node_api.h b/include/node_api.h index 43872a9..0345468 100644 --- a/include/node_api.h +++ b/include/node_api.h @@ -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 diff --git a/symbols.js b/symbols.js index d8d6af8..855526a 100644 --- a/symbols.js +++ b/symbols.js @@ -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, @@ -223,5 +236,6 @@ module.exports = { v5, v6, v7, - v8 + v8, + v9 }