From 643d7918f3832d723f1d284d627cc90ebeb465a4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 00:18:10 +0000 Subject: [PATCH] feat: update headers from nodejs/node tag v23.6.0 --- def/js_native_api.def | 7 ++++++- def/node_api.def | 8 +++++++- include/js_native_api.h | 26 +++++++++++++++++++++++++- include/node_api.h | 12 +++++++++--- symbols.js | 18 +++++++++++++++++- 5 files changed, 64 insertions(+), 7 deletions(-) diff --git a/def/js_native_api.def b/def/js_native_api.def index dc0d9d5..99a5422 100644 --- a/def/js_native_api.def +++ b/def/js_native_api.def @@ -117,4 +117,9 @@ napi_object_seal napi_type_tag_object node_api_create_syntax_error node_api_symbol_for -node_api_throw_syntax_error \ No newline at end of file +node_api_throw_syntax_error +node_api_create_external_string_latin1 +node_api_create_external_string_utf16 +node_api_create_property_key_latin1 +node_api_create_property_key_utf16 +node_api_create_property_key_utf8 \ No newline at end of file diff --git a/def/node_api.def b/def/node_api.def index 81c7d35..1c53ce0 100644 --- a/def/node_api.def +++ b/def/node_api.def @@ -148,4 +148,10 @@ 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 +node_api_throw_syntax_error +node_api_create_buffer_from_arraybuffer +node_api_create_external_string_latin1 +node_api_create_external_string_utf16 +node_api_create_property_key_latin1 +node_api_create_property_key_utf16 +node_api_create_property_key_utf8 \ No newline at end of file diff --git a/include/js_native_api.h b/include/js_native_api.h index b4d349e..e1d27a8 100644 --- a/include/js_native_api.h +++ b/include/js_native_api.h @@ -88,7 +88,31 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_create_string_utf16(napi_env env, const char16_t* str, size_t length, napi_value* result); - +#if NAPI_VERSION >= 10 +NAPI_EXTERN napi_status NAPI_CDECL node_api_create_external_string_latin1( + napi_env env, + char* str, + size_t length, + node_api_basic_finalize finalize_callback, + void* finalize_hint, + napi_value* result, + bool* copied); +NAPI_EXTERN napi_status NAPI_CDECL +node_api_create_external_string_utf16(napi_env env, + char16_t* str, + size_t length, + node_api_basic_finalize finalize_callback, + void* finalize_hint, + napi_value* result, + bool* copied); + +NAPI_EXTERN napi_status NAPI_CDECL node_api_create_property_key_latin1( + napi_env env, const char* str, size_t length, napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL node_api_create_property_key_utf8( + napi_env env, const char* str, size_t length, napi_value* result); +NAPI_EXTERN napi_status NAPI_CDECL node_api_create_property_key_utf16( + napi_env env, const char16_t* str, size_t length, napi_value* result); +#endif // NAPI_VERSION >= 10 NAPI_EXTERN napi_status NAPI_CDECL napi_create_symbol(napi_env env, napi_value description, diff --git a/include/node_api.h b/include/node_api.h index 80a0f45..35e5c3e 100644 --- a/include/node_api.h +++ b/include/node_api.h @@ -90,9 +90,6 @@ EXTERN_C_START // Deprecated. Replaced by symbol-based registration defined by NAPI_MODULE // and NAPI_MODULE_INIT macros. -#if defined(__cplusplus) && __cplusplus >= 201402L -[[deprecated]] -#endif NAPI_EXTERN void NAPI_CDECL napi_module_register(napi_module* mod); @@ -136,6 +133,15 @@ napi_create_external_buffer(napi_env env, napi_value* result); #endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED +#if NAPI_VERSION >= 10 + +NAPI_EXTERN napi_status NAPI_CDECL +node_api_create_buffer_from_arraybuffer(napi_env env, + napi_value arraybuffer, + size_t byte_offset, + size_t byte_length, + napi_value* result); +#endif // NAPI_VERSION >= 10 NAPI_EXTERN napi_status NAPI_CDECL napi_create_buffer_copy(napi_env env, size_t length, diff --git a/symbols.js b/symbols.js index 855526a..3cf6b4e 100644 --- a/symbols.js +++ b/symbols.js @@ -228,6 +228,21 @@ const v9 = { ] } +const v10 = { + js_native_api_symbols: [ + ...v9.js_native_api_symbols, + 'node_api_create_external_string_latin1', + 'node_api_create_external_string_utf16', + 'node_api_create_property_key_latin1', + 'node_api_create_property_key_utf16', + 'node_api_create_property_key_utf8' + ], + node_api_symbols: [ + ...v9.node_api_symbols, + 'node_api_create_buffer_from_arraybuffer' + ] +} + module.exports = { v1, v2, @@ -237,5 +252,6 @@ module.exports = { v6, v7, v8, - v9 + v9, + v10 }