-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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(npm): implement Node API #13633
Conversation
cli/napi/napi_set_instance_data.rs
Outdated
shared.data_finalize = if !(finalize_cb as *const c_void).is_null() { | ||
Some(finalize_cb) | ||
} else { | ||
None | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finialize_cb
should just be a Option<napi_finalize>
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/denoland/deno/runs/5127562468?check_suite_focus=true#step:34:2786 The WASM streaming tests are failing, it seems to be using the default V8 WASM streaming callback instead of what Deno defines using Deno.core.setWasmStreamingCallback()
EDIT: Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you @DjDeveloperr and @bartlomieju for the help! |
Changes introduced in #13633 have broken the ability to compile for linux/aarch64 - specifically the use of a `i8` as a char type, which is an `u8` on linux/aarch64. This PR: - Replaces instances of `i8` with the architecture-aware wrapper type `c_char` - Skips the use of `--export-dynamic-symbol` on linux-aarch64, because the target environments often rely on older libc/binutils versions
Changes introduced in #13633 have broken the ability to compile for linux/aarch64 - specifically the use of a `i8` as a char type, which is an `u8` on linux/aarch64. This PR: - Replaces instances of `i8` with the architecture-aware wrapper type `c_char` - Skips the use of `--export-dynamic-symbol` on linux-aarch64, because the target environments often rely on older libc/binutils versions
This commit removes the libuv pollyfills introduced with Node-API support. It is too much Node-specific. Most Node-API modules that depend on libuv are already giving up the benefits of Node-API. We should rather encourage modules to use `ThreadSafeFunction` or `AsyncWork` to interface with the event loop. Relevant discussion a few months ago: #13633 (comment) cc @bartlomieju
This commit removes the libuv pollyfills introduced with Node-API support. It is too much Node-specific. Most Node-API modules that depend on libuv are already giving up the benefits of Node-API. We should rather encourage modules to use `ThreadSafeFunction` or `AsyncWork` to interface with the event loop. Relevant discussion a few months ago: #13633 (comment) cc @bartlomieju
This PR implements the NAPI for loading native modules into Deno.
Closes #15717
Feature tracking
napi_set_instance_data
napi_get_instance_data
napi_status
napi_extended_error_info
napi_env
napi_value
napi_threadsafe_function
napi_threadsafe_function_release_mode
napi_threadsafe_function_call_mode
napi_handle_scope
napi_escapable_handle_scope
napi_ref
napi_type_tag
napi_async_cleanup_hook_handle
napi_callback_info
napi_callback
napi_finalize
napi_async_execute_callback
napi_async_complete_callback
napi_threadsafe_function_call_js
napi_async_cleanup_hook
napi_get_last_error_info
napi_throw
napi_throw_error
napi_throw_type_error
napi_throw_range_error
node_api_throw_syntax_error
napi_create_error
napi_create_type_error
napi_create_range_error
node_api_create_syntax_error
napi_get_and_clear_last_exception
napi_is_exception_pending
(stubbed)napi_fatal_exception
napi_fatal_error
napi_open_handle_scope
napi_close_handle_scope
napi_open_escapable_handle_scope
(stubbed)napi_close_escapable_handle_scope
(stubbed)napi_escape_handle
(stubbed)napi_create_reference
(stubbed) Weak handles and finalizers rusty_v8#895napi_delete_reference
(stubbed) Weak handles and finalizers rusty_v8#895napi_reference_ref
(stubbed) Weak handles and finalizers rusty_v8#895napi_reference_unref
(stubbed) Weak handles and finalizers rusty_v8#895napi_get_reference_value
(stubbed) Weak handles and finalizers rusty_v8#895napi_add_env_cleanup_hook
(stubbed)napi_remove_env_cleanup_hook
(stubbed)napi_add_async_cleanup_hook
napi_remove_async_cleanup_hook
napi_module_register
napi_key_collection_mode
napi_key_filter
napi_key_conversion
napi_valuetype
napi_typedarray_type
napi_create_array
napi_create_array_with_length
napi_create_arraybuffer
napi_create_buffer
napi_create_buffer_copy
napi_create_date
napi_create_external
napi_create_external_arraybuffer
napi_create_external_buffer
napi_create_object
napi_create_symbol
napi_create_typedarray
napi_create_dataview
napi_create_int32
napi_create_uint32
napi_create_int64
napi_create_double
napi_create_bigint_int64
napi_create_bigint_uint64
napi_create_bigint_words
napi_create_string_latin1
napi_create_string_utf16
napi_create_string_utf8
napi_get_array_length
napi_get_arraybuffer_info
napi_get_buffer_info
napi_get_prototype
napi_get_typedarray_info
napi_get_dataview_info
napi_get_date_value
napi_get_value_bool
napi_get_value_double
napi_get_value_bigint_int64
napi_get_value_bigint_uint64
napi_get_value_bigint_words
napi_get_value_external
napi_get_value_int32
napi_get_value_int64
napi_get_value_string_latin1
napi_get_value_string_utf8
napi_get_value_string_utf16
napi_get_value_uint32
napi_get_boolean
napi_get_global
napi_get_null
napi_get_undefined
napi_coerce_to_bool
napi_coerce_to_number
napi_coerce_to_object
napi_coerce_to_string
napi_typeof
napi_instanceof
(Add v8::Value::InstanceOf bindings rusty_v8#879)napi_is_array
napi_is_arraybuffer
napi_is_buffer
napi_is_date
napi_is_error
napi_is_typedarray
napi_is_dataview
napi_strict_equals
napi_detach_arraybuffer
napi_is_detached_arraybuffer
napi_property_attributes
napi_property_descriptor
napi_get_property_names
napi_get_all_property_names
(needs v8 binding)napi_set_property
napi_get_property
napi_has_property
napi_delete_property
napi_has_own_property
Add v8::Object::HasOwnProperty bindings rusty_v8#897napi_set_named_property
napi_get_named_property
napi_has_named_property
napi_set_element
napi_get_element
napi_has_element
napi_delete_element
napi_define_properties
(incomplete)napi_object_freeze
napi_object_seal
napi_call_function
napi_create_function
napi_get_cb_info
napi_get_new_target
Add v8::FunctionCallbackInfo::NewTarget bindings rusty_v8#898napi_new_instance
napi_define_class
(TODO: proper getter/setters)napi_wrap
napi_unwrap
napi_remove_wrap
napi_type_tag_object
napi_check_object_type_tag
napi_add_finalizer
Weak handles and finalizers rusty_v8#895napi_create_async_work
napi_delete_async_work
napi_queue_async_work
napi_cancel_async_work
napi_async_init
napi_async_destroy
napi_make_callback
napi_open_callback_scope
napi_close_callback_scope
napi_get_node_version
napi_get_version
napi_adjust_external_memory
Add v8::Isolate:AdjustAmountOfExternalAllocatedMemory bindings rusty_v8#880napi_create_promise
napi_resolve_deferred
napi_reject_deferred
napi_is_promise
napi_run_script
napi_get_uv_event_loop
napi_call_threadsafe_function
napi_create_threadsafe_function
napi_get_threadsafe_function_context
napi_acquire_threadsafe_function
napi_release_threadsafe_function
napi_ref_threadsafe_function
napi_unref_threadsafe_function
node_api_get_module_file_name