Skip to content
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

feat: update headers from nodejs/node tag v23.6.0 #57

Merged
merged 1 commit into from
Jan 9, 2025
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
7 changes: 6 additions & 1 deletion def/js_native_api.def
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
8 changes: 7 additions & 1 deletion def/node_api.def
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
26 changes: 25 additions & 1 deletion include/js_native_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 9 additions & 3 deletions include/node_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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,
Expand Down
18 changes: 17 additions & 1 deletion symbols.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -237,5 +252,6 @@ module.exports = {
v6,
v7,
v8,
v9
v9,
v10
}