From 8f5d7e52748d63b0bf71f0060aa398601ec68d0b Mon Sep 17 00:00:00 2001 From: LongYinan Date: Wed, 17 Apr 2024 23:34:47 +0800 Subject: [PATCH] fix(napi): handle panic in async block (#2050) - Close https://github.com/napi-rs/napi-rs/issues/2047 --- crates/napi/src/js_values/deferred.rs | 19 +- crates/napi/src/tokio_runtime.rs | 25 +- .../__snapshots__/typegen.spec.ts.md | 2 + .../__snapshots__/typegen.spec.ts.snap | Bin 4858 -> 4864 bytes examples/napi/__tests__/values.spec.ts | 7 + examples/napi/example.wasi-browser.js | 532 +++++++++--------- examples/napi/example.wasi.cjs | 532 +++++++++--------- examples/napi/index.cjs | 1 + examples/napi/index.d.cts | 2 + examples/napi/src/async.rs | 5 + examples/napi/src/lib.rs | 1 + 11 files changed, 591 insertions(+), 535 deletions(-) diff --git a/crates/napi/src/js_values/deferred.rs b/crates/napi/src/js_values/deferred.rs index 0e32e812..b4dd4230 100644 --- a/crates/napi/src/js_values/deferred.rs +++ b/crates/napi/src/js_values/deferred.rs @@ -18,6 +18,7 @@ use crate::{NapiRaw, NapiValue}; /// See this issue for more details: /// https://github.com/nodejs/node-addon-api/issues/595 #[repr(transparent)] +#[derive(Clone)] struct DeferredTrace(sys::napi_ref); #[cfg(feature = "deferred_trace")] @@ -94,13 +95,29 @@ struct DeferredData Result> { } pub struct JsDeferred Result> { - tsfn: sys::napi_threadsafe_function, + pub(crate) tsfn: sys::napi_threadsafe_function, #[cfg(feature = "deferred_trace")] trace: DeferredTrace, _data: PhantomData, _resolver: PhantomData, } +// A trick to send the resolver into the `panic` handler +// Do not use clone in the other place besides the `fn execute_tokio_future` +impl Result> Clone + for JsDeferred +{ + fn clone(&self) -> Self { + Self { + tsfn: self.tsfn, + #[cfg(feature = "deferred_trace")] + trace: self.trace.clone(), + _data: PhantomData, + _resolver: PhantomData, + } + } +} + unsafe impl Result> Send for JsDeferred { diff --git a/crates/napi/src/tokio_runtime.rs b/crates/napi/src/tokio_runtime.rs index b612ddb4..b5437781 100644 --- a/crates/napi/src/tokio_runtime.rs +++ b/crates/napi/src/tokio_runtime.rs @@ -3,7 +3,7 @@ use std::{future::Future, marker::PhantomData, sync::RwLock}; use once_cell::sync::{Lazy, OnceCell}; use tokio::runtime::Runtime; -use crate::{sys, JsDeferred, JsUnknown, NapiValue, Result}; +use crate::{sys, Error, JsDeferred, JsUnknown, NapiValue, Result}; fn create_runtime() -> Option { #[cfg(not(target_family = "wasm"))] @@ -158,10 +158,11 @@ pub fn execute_tokio_future< resolver: Resolver, ) -> Result { let (deferred, promise) = JsDeferred::new(env)?; - + #[cfg(not(target_family = "wasm"))] + let deferred_for_panic = deferred.clone(); let sendable_resolver = SendableResolver::new(resolver); - let inner = async { + let inner = async move { match fut.await { Ok(v) => deferred.resolve(move |env| { sendable_resolver @@ -173,7 +174,23 @@ pub fn execute_tokio_future< }; #[cfg(not(target_family = "wasm"))] - spawn(inner); + { + let jh = spawn(inner); + spawn(async move { + if let Err(err) = jh.await { + if let Ok(reason) = err.try_into_panic() { + if let Some(s) = reason.downcast_ref::<&str>() { + deferred_for_panic.reject(Error::new(crate::Status::GenericFailure, s)); + } else { + deferred_for_panic.reject(Error::new( + crate::Status::GenericFailure, + "Panic in async function", + )); + } + } + } + }); + } #[cfg(target_family = "wasm")] { diff --git a/examples/napi/__tests__/__snapshots__/typegen.spec.ts.md b/examples/napi/__tests__/__snapshots__/typegen.spec.ts.md index 1d0ffc52..f67fab42 100644 --- a/examples/napi/__tests__/__snapshots__/typegen.spec.ts.md +++ b/examples/napi/__tests__/__snapshots__/typegen.spec.ts.md @@ -561,6 +561,8 @@ Generated by [AVA](https://avajs.dev). ␊ export function panic(): void␊ ␊ + export function panicInAsync(): Promise␊ + ␊ export function plusOne(this: Width): number␊ ␊ export function promiseInEither(input: number | Promise): Promise␊ diff --git a/examples/napi/__tests__/__snapshots__/typegen.spec.ts.snap b/examples/napi/__tests__/__snapshots__/typegen.spec.ts.snap index 54ed56dcf22362860185521beddbbc1b39ee3cd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-S%mqh*jRjP1kAW8u1=X~jNZz5LxA%6v%RG^lsd=X{@IrJ^tF3-#AVI(szT>AJJCH%L+3 zxI@j`BJuQ`b%uZz7XKs)IAWGHTYF&^kBX_-$eO&)leCQ_J)%_$Vil66wKXv{Bx=sy zf!lK9vCN%hTGMs6Phc#TEwTbRh;9TFPE6EEY`uKt`};jT!0VsM^~JH($9A2_@>rUU ziqmW31pb|t@eGFWZ?dF3jzPqHpVbYCU<*}BRI?}Qq0fop0^n5iS)&iS+uJ4BChYyG z>86STMY}K7XkY+F{}~GpvOWA{tK&mLFW}=JIw|?&r{!^8^Zo%J^oO-7X>WsHHS&X< zS^r}^8e0EtCk>hZrKc(>%G1R65nDhQ<}_s!^*7y0@%H%j>C5x8 { t.is(name, '@examples/napi') await t.throwsAsync(() => readFileAsync('some_nonexist_path.file')) + + if (!process.env.SKIP_UNWIND_TEST) { + await t.throwsAsync(() => panicInAsync(), { + message: 'panic in async function', + }) + } }) test('async move', async (t) => { diff --git a/examples/napi/example.wasi-browser.js b/examples/napi/example.wasi-browser.js index c988e544..896db5fc 100644 --- a/examples/napi/example.wasi-browser.js +++ b/examples/napi/example.wasi-browser.js @@ -70,331 +70,332 @@ function __napi_rs_initialize_modules(__napiInstance) { __napiInstance.exports['__napi_register__get_nested_num_arr_7']?.() __napiInstance.exports['__napi_register__read_file_async_8']?.() __napiInstance.exports['__napi_register__async_multi_two_9']?.() - __napiInstance.exports['__napi_register__bigint_add_10']?.() - __napiInstance.exports['__napi_register__create_big_int_11']?.() - __napiInstance.exports['__napi_register__create_big_int_i64_12']?.() - __napiInstance.exports['__napi_register__bigint_get_u64_as_string_13']?.() - __napiInstance.exports['__napi_register__bigint_from_i64_14']?.() - __napiInstance.exports['__napi_register__bigint_from_i128_15']?.() - __napiInstance.exports['__napi_register__get_cwd_16']?.() - __napiInstance.exports['__napi_register__option_end_17']?.() - __napiInstance.exports['__napi_register__option_start_18']?.() - __napiInstance.exports['__napi_register__option_start_end_19']?.() - __napiInstance.exports['__napi_register__option_only_20']?.() - __napiInstance.exports['__napi_register__read_file_21']?.() - __napiInstance.exports['__napi_register__return_js_function_22']?.() - __napiInstance.exports['__napi_register__callback_return_promise_23']?.() + __napiInstance.exports['__napi_register__panic_in_async_10']?.() + __napiInstance.exports['__napi_register__bigint_add_11']?.() + __napiInstance.exports['__napi_register__create_big_int_12']?.() + __napiInstance.exports['__napi_register__create_big_int_i64_13']?.() + __napiInstance.exports['__napi_register__bigint_get_u64_as_string_14']?.() + __napiInstance.exports['__napi_register__bigint_from_i64_15']?.() + __napiInstance.exports['__napi_register__bigint_from_i128_16']?.() + __napiInstance.exports['__napi_register__get_cwd_17']?.() + __napiInstance.exports['__napi_register__option_end_18']?.() + __napiInstance.exports['__napi_register__option_start_19']?.() + __napiInstance.exports['__napi_register__option_start_end_20']?.() + __napiInstance.exports['__napi_register__option_only_21']?.() + __napiInstance.exports['__napi_register__read_file_22']?.() + __napiInstance.exports['__napi_register__return_js_function_23']?.() + __napiInstance.exports['__napi_register__callback_return_promise_24']?.() __napiInstance.exports[ - '__napi_register__callback_return_promise_and_spawn_24' + '__napi_register__callback_return_promise_and_spawn_25' ]?.() - __napiInstance.exports['__napi_register__capture_error_in_callback_25']?.() - __napiInstance.exports['__napi_register__Animal_struct_26']?.() - __napiInstance.exports['__napi_register__Animal_impl_38']?.() - __napiInstance.exports['__napi_register__Dog_struct_39']?.() - __napiInstance.exports['__napi_register__Bird_struct_40']?.() - __napiInstance.exports['__napi_register__Bird_impl_45']?.() - __napiInstance.exports['__napi_register__Blake2bHasher_struct_46']?.() - __napiInstance.exports['__napi_register__Blake2bHasher_impl_48']?.() - __napiInstance.exports['__napi_register__Blake2bHasher_impl_50']?.() - __napiInstance.exports['__napi_register__Blake2bKey_struct_51']?.() - __napiInstance.exports['__napi_register__Context_struct_52']?.() - __napiInstance.exports['__napi_register__Context_impl_57']?.() + __napiInstance.exports['__napi_register__capture_error_in_callback_26']?.() + __napiInstance.exports['__napi_register__Animal_struct_27']?.() + __napiInstance.exports['__napi_register__Animal_impl_39']?.() + __napiInstance.exports['__napi_register__Dog_struct_40']?.() + __napiInstance.exports['__napi_register__Bird_struct_41']?.() + __napiInstance.exports['__napi_register__Bird_impl_46']?.() + __napiInstance.exports['__napi_register__Blake2bHasher_struct_47']?.() + __napiInstance.exports['__napi_register__Blake2bHasher_impl_49']?.() + __napiInstance.exports['__napi_register__Blake2bHasher_impl_51']?.() + __napiInstance.exports['__napi_register__Blake2bKey_struct_52']?.() + __napiInstance.exports['__napi_register__Context_struct_53']?.() + __napiInstance.exports['__napi_register__Context_impl_58']?.() __napiInstance.exports[ - '__napi_register__AnimalWithDefaultConstructor_struct_58' + '__napi_register__AnimalWithDefaultConstructor_struct_59' ]?.() - __napiInstance.exports['__napi_register__NinjaTurtle_struct_59']?.() - __napiInstance.exports['__napi_register__NinjaTurtle_impl_66']?.() - __napiInstance.exports['__napi_register__JsAssets_struct_67']?.() - __napiInstance.exports['__napi_register__JsAssets_impl_70']?.() - __napiInstance.exports['__napi_register__JsAsset_struct_71']?.() - __napiInstance.exports['__napi_register__JsAsset_impl_74']?.() - __napiInstance.exports['__napi_register__Optional_struct_75']?.() - __napiInstance.exports['__napi_register__Optional_impl_80']?.() + __napiInstance.exports['__napi_register__NinjaTurtle_struct_60']?.() + __napiInstance.exports['__napi_register__NinjaTurtle_impl_67']?.() + __napiInstance.exports['__napi_register__JsAssets_struct_68']?.() + __napiInstance.exports['__napi_register__JsAssets_impl_71']?.() + __napiInstance.exports['__napi_register__JsAsset_struct_72']?.() + __napiInstance.exports['__napi_register__JsAsset_impl_75']?.() + __napiInstance.exports['__napi_register__Optional_struct_76']?.() + __napiInstance.exports['__napi_register__Optional_impl_81']?.() __napiInstance.exports[ - '__napi_register__ObjectFieldClassInstance_struct_81' + '__napi_register__ObjectFieldClassInstance_struct_82' ]?.() __napiInstance.exports[ - '__napi_register__create_object_with_class_field_82' + '__napi_register__create_object_with_class_field_83' ]?.() __napiInstance.exports[ - '__napi_register__receive_object_with_class_field_83' + '__napi_register__receive_object_with_class_field_84' ]?.() - __napiInstance.exports['__napi_register__NotWritableClass_struct_84']?.() - __napiInstance.exports['__napi_register__NotWritableClass_impl_86']?.() - __napiInstance.exports['__napi_register__CustomFinalize_struct_87']?.() - __napiInstance.exports['__napi_register__CustomFinalize_impl_89']?.() - __napiInstance.exports['__napi_register__Width_struct_90']?.() - __napiInstance.exports['__napi_register__plus_one_91']?.() + __napiInstance.exports['__napi_register__NotWritableClass_struct_85']?.() + __napiInstance.exports['__napi_register__NotWritableClass_impl_87']?.() + __napiInstance.exports['__napi_register__CustomFinalize_struct_88']?.() + __napiInstance.exports['__napi_register__CustomFinalize_impl_90']?.() + __napiInstance.exports['__napi_register__Width_struct_91']?.() + __napiInstance.exports['__napi_register__plus_one_92']?.() __napiInstance.exports[ - '__napi_register__GetterSetterWithClosures_struct_92' + '__napi_register__GetterSetterWithClosures_struct_93' ]?.() __napiInstance.exports[ - '__napi_register__GetterSetterWithClosures_impl_94' + '__napi_register__GetterSetterWithClosures_impl_95' ]?.() - __napiInstance.exports['__napi_register__CatchOnConstructor_struct_95']?.() - __napiInstance.exports['__napi_register__CatchOnConstructor_impl_97']?.() - __napiInstance.exports['__napi_register__CatchOnConstructor2_struct_98']?.() - __napiInstance.exports['__napi_register__CatchOnConstructor2_impl_100']?.() - __napiInstance.exports['__napi_register__ClassWithFactory_struct_101']?.() - __napiInstance.exports['__napi_register__ClassWithFactory_impl_106']?.() - __napiInstance.exports['__napi_register__Selector_struct_107']?.() - __napiInstance.exports['__napi_register__date_to_number_108']?.() - __napiInstance.exports['__napi_register__chrono_date_to_millis_109']?.() - __napiInstance.exports['__napi_register__chrono_date_add_1_minute_110']?.() - __napiInstance.exports['__napi_register__Dates_struct_111']?.() - __napiInstance.exports['__napi_register__chrono_native_date_time_112']?.() + __napiInstance.exports['__napi_register__CatchOnConstructor_struct_96']?.() + __napiInstance.exports['__napi_register__CatchOnConstructor_impl_98']?.() + __napiInstance.exports['__napi_register__CatchOnConstructor2_struct_99']?.() + __napiInstance.exports['__napi_register__CatchOnConstructor2_impl_101']?.() + __napiInstance.exports['__napi_register__ClassWithFactory_struct_102']?.() + __napiInstance.exports['__napi_register__ClassWithFactory_impl_107']?.() + __napiInstance.exports['__napi_register__Selector_struct_108']?.() + __napiInstance.exports['__napi_register__date_to_number_109']?.() + __napiInstance.exports['__napi_register__chrono_date_to_millis_110']?.() + __napiInstance.exports['__napi_register__chrono_date_add_1_minute_111']?.() + __napiInstance.exports['__napi_register__Dates_struct_112']?.() + __napiInstance.exports['__napi_register__chrono_native_date_time_113']?.() __napiInstance.exports[ - '__napi_register__chrono_native_date_time_return_113' + '__napi_register__chrono_native_date_time_return_114' ]?.() - __napiInstance.exports['__napi_register__either_string_or_number_114']?.() - __napiInstance.exports['__napi_register__return_either_115']?.() - __napiInstance.exports['__napi_register__either3_116']?.() - __napiInstance.exports['__napi_register__Obj_struct_117']?.() - __napiInstance.exports['__napi_register__either4_118']?.() - __napiInstance.exports['__napi_register__JsClassForEither_struct_119']?.() - __napiInstance.exports['__napi_register__JsClassForEither_impl_121']?.() + __napiInstance.exports['__napi_register__either_string_or_number_115']?.() + __napiInstance.exports['__napi_register__return_either_116']?.() + __napiInstance.exports['__napi_register__either3_117']?.() + __napiInstance.exports['__napi_register__Obj_struct_118']?.() + __napiInstance.exports['__napi_register__either4_119']?.() + __napiInstance.exports['__napi_register__JsClassForEither_struct_120']?.() + __napiInstance.exports['__napi_register__JsClassForEither_impl_122']?.() __napiInstance.exports[ - '__napi_register__AnotherClassForEither_struct_122' + '__napi_register__AnotherClassForEither_struct_123' ]?.() - __napiInstance.exports['__napi_register__AnotherClassForEither_impl_124']?.() - __napiInstance.exports['__napi_register__receive_class_or_number_125']?.() - __napiInstance.exports['__napi_register__receive_mut_class_or_number_126']?.() - __napiInstance.exports['__napi_register__receive_different_class_127']?.() - __napiInstance.exports['__napi_register__return_either_class_128']?.() - __napiInstance.exports['__napi_register__either_from_option_129']?.() - __napiInstance.exports['__napi_register__A_struct_130']?.() - __napiInstance.exports['__napi_register__B_struct_131']?.() - __napiInstance.exports['__napi_register__C_struct_132']?.() - __napiInstance.exports['__napi_register__either_from_objects_133']?.() - __napiInstance.exports['__napi_register__either_bool_or_function_134']?.() - __napiInstance.exports['__napi_register__promise_in_either_135']?.() - __napiInstance.exports['__napi_register__either_bool_or_tuple_136']?.() - __napiInstance.exports['__napi_register__Kind_137']?.() - __napiInstance.exports['__napi_register__Empty_138']?.() - __napiInstance.exports['__napi_register__Status_139']?.() - __napiInstance.exports['__napi_register__StringEnum_140']?.() - __napiInstance.exports['__napi_register__CustomNumEnum_141']?.() - __napiInstance.exports['__napi_register__enum_to_i32_142']?.() - __napiInstance.exports['__napi_register__SkippedEnums_143']?.() - __napiInstance.exports['__napi_register__run_script_144']?.() - __napiInstance.exports['__napi_register__get_module_file_name_145']?.() - __napiInstance.exports['__napi_register__throw_syntax_error_146']?.() - __napiInstance.exports['__napi_register__throw_error_147']?.() - __napiInstance.exports['__napi_register__panic_148']?.() - __napiInstance.exports['__napi_register__receive_string_149']?.() - __napiInstance.exports['__napi_register__custom_status_code_150']?.() - __napiInstance.exports['__napi_register__throw_async_error_151']?.() - __napiInstance.exports['__napi_register__create_external_152']?.() - __napiInstance.exports['__napi_register__create_external_string_153']?.() - __napiInstance.exports['__napi_register__get_external_154']?.() - __napiInstance.exports['__napi_register__mutate_external_155']?.() - __napiInstance.exports['__napi_register__create_optional_external_156']?.() - __napiInstance.exports['__napi_register__get_optional_external_157']?.() - __napiInstance.exports['__napi_register__mutate_optional_external_158']?.() - __napiInstance.exports['__napi_register__validate_array_159']?.() - __napiInstance.exports['__napi_register__validate_buffer_160']?.() - __napiInstance.exports['__napi_register__validate_typed_array_161']?.() - __napiInstance.exports['__napi_register__validate_typed_array_slice_162']?.() + __napiInstance.exports['__napi_register__AnotherClassForEither_impl_125']?.() + __napiInstance.exports['__napi_register__receive_class_or_number_126']?.() + __napiInstance.exports['__napi_register__receive_mut_class_or_number_127']?.() + __napiInstance.exports['__napi_register__receive_different_class_128']?.() + __napiInstance.exports['__napi_register__return_either_class_129']?.() + __napiInstance.exports['__napi_register__either_from_option_130']?.() + __napiInstance.exports['__napi_register__A_struct_131']?.() + __napiInstance.exports['__napi_register__B_struct_132']?.() + __napiInstance.exports['__napi_register__C_struct_133']?.() + __napiInstance.exports['__napi_register__either_from_objects_134']?.() + __napiInstance.exports['__napi_register__either_bool_or_function_135']?.() + __napiInstance.exports['__napi_register__promise_in_either_136']?.() + __napiInstance.exports['__napi_register__either_bool_or_tuple_137']?.() + __napiInstance.exports['__napi_register__Kind_138']?.() + __napiInstance.exports['__napi_register__Empty_139']?.() + __napiInstance.exports['__napi_register__Status_140']?.() + __napiInstance.exports['__napi_register__StringEnum_141']?.() + __napiInstance.exports['__napi_register__CustomNumEnum_142']?.() + __napiInstance.exports['__napi_register__enum_to_i32_143']?.() + __napiInstance.exports['__napi_register__SkippedEnums_144']?.() + __napiInstance.exports['__napi_register__run_script_145']?.() + __napiInstance.exports['__napi_register__get_module_file_name_146']?.() + __napiInstance.exports['__napi_register__throw_syntax_error_147']?.() + __napiInstance.exports['__napi_register__throw_error_148']?.() + __napiInstance.exports['__napi_register__panic_149']?.() + __napiInstance.exports['__napi_register__receive_string_150']?.() + __napiInstance.exports['__napi_register__custom_status_code_151']?.() + __napiInstance.exports['__napi_register__throw_async_error_152']?.() + __napiInstance.exports['__napi_register__create_external_153']?.() + __napiInstance.exports['__napi_register__create_external_string_154']?.() + __napiInstance.exports['__napi_register__get_external_155']?.() + __napiInstance.exports['__napi_register__mutate_external_156']?.() + __napiInstance.exports['__napi_register__create_optional_external_157']?.() + __napiInstance.exports['__napi_register__get_optional_external_158']?.() + __napiInstance.exports['__napi_register__mutate_optional_external_159']?.() + __napiInstance.exports['__napi_register__validate_array_160']?.() + __napiInstance.exports['__napi_register__validate_buffer_161']?.() + __napiInstance.exports['__napi_register__validate_typed_array_162']?.() + __napiInstance.exports['__napi_register__validate_typed_array_slice_163']?.() __napiInstance.exports[ - '__napi_register__validate_uint8_clamped_slice_163' + '__napi_register__validate_uint8_clamped_slice_164' ]?.() - __napiInstance.exports['__napi_register__validate_buffer_slice_164']?.() - __napiInstance.exports['__napi_register__validate_bigint_165']?.() - __napiInstance.exports['__napi_register__validate_boolean_166']?.() - __napiInstance.exports['__napi_register__validate_date_167']?.() - __napiInstance.exports['__napi_register__validate_date_time_168']?.() - __napiInstance.exports['__napi_register__validate_external_169']?.() - __napiInstance.exports['__napi_register__validate_function_170']?.() - __napiInstance.exports['__napi_register__validate_hash_map_171']?.() - __napiInstance.exports['__napi_register__validate_null_172']?.() - __napiInstance.exports['__napi_register__validate_undefined_173']?.() - __napiInstance.exports['__napi_register__validate_number_174']?.() - __napiInstance.exports['__napi_register__validate_promise_175']?.() - __napiInstance.exports['__napi_register__validate_string_176']?.() - __napiInstance.exports['__napi_register__validate_symbol_177']?.() - __napiInstance.exports['__napi_register__validate_optional_178']?.() - __napiInstance.exports['__napi_register__return_undefined_if_invalid_179']?.() + __napiInstance.exports['__napi_register__validate_buffer_slice_165']?.() + __napiInstance.exports['__napi_register__validate_bigint_166']?.() + __napiInstance.exports['__napi_register__validate_boolean_167']?.() + __napiInstance.exports['__napi_register__validate_date_168']?.() + __napiInstance.exports['__napi_register__validate_date_time_169']?.() + __napiInstance.exports['__napi_register__validate_external_170']?.() + __napiInstance.exports['__napi_register__validate_function_171']?.() + __napiInstance.exports['__napi_register__validate_hash_map_172']?.() + __napiInstance.exports['__napi_register__validate_null_173']?.() + __napiInstance.exports['__napi_register__validate_undefined_174']?.() + __napiInstance.exports['__napi_register__validate_number_175']?.() + __napiInstance.exports['__napi_register__validate_promise_176']?.() + __napiInstance.exports['__napi_register__validate_string_177']?.() + __napiInstance.exports['__napi_register__validate_symbol_178']?.() + __napiInstance.exports['__napi_register__validate_optional_179']?.() + __napiInstance.exports['__napi_register__return_undefined_if_invalid_180']?.() __napiInstance.exports[ - '__napi_register__return_undefined_if_invalid_promise_180' + '__napi_register__return_undefined_if_invalid_promise_181' ]?.() - __napiInstance.exports['__napi_register__ts_rename_181']?.() + __napiInstance.exports['__napi_register__ts_rename_182']?.() __napiInstance.exports[ - '__napi_register__override_individual_arg_on_function_182' + '__napi_register__override_individual_arg_on_function_183' ]?.() __napiInstance.exports[ - '__napi_register__override_individual_arg_on_function_with_cb_arg_183' + '__napi_register__override_individual_arg_on_function_with_cb_arg_184' ]?.() - __napiInstance.exports['__napi_register__call0_184']?.() - __napiInstance.exports['__napi_register__call1_185']?.() - __napiInstance.exports['__napi_register__call2_186']?.() - __napiInstance.exports['__napi_register__apply0_187']?.() - __napiInstance.exports['__napi_register__apply1_188']?.() - __napiInstance.exports['__napi_register__call_function_189']?.() - __napiInstance.exports['__napi_register__call_function_with_arg_190']?.() + __napiInstance.exports['__napi_register__call0_185']?.() + __napiInstance.exports['__napi_register__call1_186']?.() + __napiInstance.exports['__napi_register__call2_187']?.() + __napiInstance.exports['__napi_register__apply0_188']?.() + __napiInstance.exports['__napi_register__apply1_189']?.() + __napiInstance.exports['__napi_register__call_function_190']?.() + __napiInstance.exports['__napi_register__call_function_with_arg_191']?.() __napiInstance.exports[ - '__napi_register__create_reference_on_function_191' + '__napi_register__create_reference_on_function_192' ]?.() __napiInstance.exports[ - '__napi_register__call_function_with_arg_and_ctx_192' + '__napi_register__call_function_with_arg_and_ctx_193' ]?.() - __napiInstance.exports['__napi_register__reference_as_callback_193']?.() + __napiInstance.exports['__napi_register__reference_as_callback_194']?.() __napiInstance.exports[ - '__napi_register__build_threadsafe_function_from_function_194' + '__napi_register__build_threadsafe_function_from_function_195' ]?.() - __napiInstance.exports['__napi_register__Fib_struct_195']?.() - __napiInstance.exports['__napi_register__Fib_impl_196']?.() - __napiInstance.exports['__napi_register__Fib_impl_198']?.() - __napiInstance.exports['__napi_register__Fib2_struct_199']?.() - __napiInstance.exports['__napi_register__Fib2_impl_200']?.() - __napiInstance.exports['__napi_register__Fib2_impl_202']?.() - __napiInstance.exports['__napi_register__Fib3_struct_203']?.() - __napiInstance.exports['__napi_register__Fib3_impl_204']?.() - __napiInstance.exports['__napi_register__ALIGNMENT_205']?.() - __napiInstance.exports['__napi_register__xxh64_206']?.() - __napiInstance.exports['__napi_register__xxh128_207']?.() - __napiInstance.exports['__napi_register__Xxh3_struct_208']?.() - __napiInstance.exports['__napi_register__Xxh3_impl_212']?.() - __napiInstance.exports['__napi_register__xxh2_plus_213']?.() - __napiInstance.exports['__napi_register__xxh3_xxh64_alias_214']?.() - __napiInstance.exports['__napi_register__xxh64_alias_215']?.() - __napiInstance.exports['__napi_register__get_mapping_216']?.() - __napiInstance.exports['__napi_register__sum_mapping_217']?.() - __napiInstance.exports['__napi_register__get_btree_mapping_218']?.() - __napiInstance.exports['__napi_register__sum_btree_mapping_219']?.() - __napiInstance.exports['__napi_register__get_index_mapping_220']?.() - __napiInstance.exports['__napi_register__sum_index_mapping_221']?.() - __napiInstance.exports['__napi_register__indexmap_passthrough_222']?.() - __napiInstance.exports['__napi_register__map_option_223']?.() - __napiInstance.exports['__napi_register__return_null_224']?.() - __napiInstance.exports['__napi_register__return_undefined_225']?.() - __napiInstance.exports['__napi_register__UseNullableStruct_struct_226']?.() - __napiInstance.exports['__napi_register__NotUseNullableStruct_struct_227']?.() + __napiInstance.exports['__napi_register__Fib_struct_196']?.() + __napiInstance.exports['__napi_register__Fib_impl_197']?.() + __napiInstance.exports['__napi_register__Fib_impl_199']?.() + __napiInstance.exports['__napi_register__Fib2_struct_200']?.() + __napiInstance.exports['__napi_register__Fib2_impl_201']?.() + __napiInstance.exports['__napi_register__Fib2_impl_203']?.() + __napiInstance.exports['__napi_register__Fib3_struct_204']?.() + __napiInstance.exports['__napi_register__Fib3_impl_205']?.() + __napiInstance.exports['__napi_register__ALIGNMENT_206']?.() + __napiInstance.exports['__napi_register__xxh64_207']?.() + __napiInstance.exports['__napi_register__xxh128_208']?.() + __napiInstance.exports['__napi_register__Xxh3_struct_209']?.() + __napiInstance.exports['__napi_register__Xxh3_impl_213']?.() + __napiInstance.exports['__napi_register__xxh2_plus_214']?.() + __napiInstance.exports['__napi_register__xxh3_xxh64_alias_215']?.() + __napiInstance.exports['__napi_register__xxh64_alias_216']?.() + __napiInstance.exports['__napi_register__get_mapping_217']?.() + __napiInstance.exports['__napi_register__sum_mapping_218']?.() + __napiInstance.exports['__napi_register__get_btree_mapping_219']?.() + __napiInstance.exports['__napi_register__sum_btree_mapping_220']?.() + __napiInstance.exports['__napi_register__get_index_mapping_221']?.() + __napiInstance.exports['__napi_register__sum_index_mapping_222']?.() + __napiInstance.exports['__napi_register__indexmap_passthrough_223']?.() + __napiInstance.exports['__napi_register__map_option_224']?.() + __napiInstance.exports['__napi_register__return_null_225']?.() + __napiInstance.exports['__napi_register__return_undefined_226']?.() + __napiInstance.exports['__napi_register__UseNullableStruct_struct_227']?.() + __napiInstance.exports['__napi_register__NotUseNullableStruct_struct_228']?.() __napiInstance.exports[ - '__napi_register__DefaultUseNullableStruct_struct_228' + '__napi_register__DefaultUseNullableStruct_struct_229' ]?.() - __napiInstance.exports['__napi_register__UseNullableClass_struct_229']?.() - __napiInstance.exports['__napi_register__NotUseNullableClass_struct_230']?.() + __napiInstance.exports['__napi_register__UseNullableClass_struct_230']?.() + __napiInstance.exports['__napi_register__NotUseNullableClass_struct_231']?.() __napiInstance.exports[ - '__napi_register__DefaultUseNullableClass_struct_231' + '__napi_register__DefaultUseNullableClass_struct_232' ]?.() - __napiInstance.exports['__napi_register__add_232']?.() - __napiInstance.exports['__napi_register__fibonacci_233']?.() - __napiInstance.exports['__napi_register__list_obj_keys_234']?.() - __napiInstance.exports['__napi_register__create_obj_235']?.() - __napiInstance.exports['__napi_register__get_global_236']?.() - __napiInstance.exports['__napi_register__get_undefined_237']?.() - __napiInstance.exports['__napi_register__get_null_238']?.() - __napiInstance.exports['__napi_register__AllOptionalObject_struct_239']?.() - __napiInstance.exports['__napi_register__receive_all_optional_object_240']?.() - __napiInstance.exports['__napi_register__AliasedEnum_241']?.() + __napiInstance.exports['__napi_register__add_233']?.() + __napiInstance.exports['__napi_register__fibonacci_234']?.() + __napiInstance.exports['__napi_register__list_obj_keys_235']?.() + __napiInstance.exports['__napi_register__create_obj_236']?.() + __napiInstance.exports['__napi_register__get_global_237']?.() + __napiInstance.exports['__napi_register__get_undefined_238']?.() + __napiInstance.exports['__napi_register__get_null_239']?.() + __napiInstance.exports['__napi_register__AllOptionalObject_struct_240']?.() + __napiInstance.exports['__napi_register__receive_all_optional_object_241']?.() + __napiInstance.exports['__napi_register__AliasedEnum_242']?.() __napiInstance.exports[ - '__napi_register__StructContainsAliasedEnum_struct_242' + '__napi_register__StructContainsAliasedEnum_struct_243' ]?.() - __napiInstance.exports['__napi_register__fn_received_aliased_243']?.() - __napiInstance.exports['__napi_register__StrictObject_struct_244']?.() - __napiInstance.exports['__napi_register__receive_strict_object_245']?.() - __napiInstance.exports['__napi_register__get_str_from_object_246']?.() - __napiInstance.exports['__napi_register__TsTypeChanged_struct_247']?.() - __napiInstance.exports['__napi_register__create_obj_with_property_248']?.() - __napiInstance.exports['__napi_register__getter_from_obj_249']?.() - __napiInstance.exports['__napi_register__ObjectOnlyFromJs_struct_250']?.() - __napiInstance.exports['__napi_register__receive_object_only_from_js_251']?.() + __napiInstance.exports['__napi_register__fn_received_aliased_244']?.() + __napiInstance.exports['__napi_register__StrictObject_struct_245']?.() + __napiInstance.exports['__napi_register__receive_strict_object_246']?.() + __napiInstance.exports['__napi_register__get_str_from_object_247']?.() + __napiInstance.exports['__napi_register__TsTypeChanged_struct_248']?.() + __napiInstance.exports['__napi_register__create_obj_with_property_249']?.() + __napiInstance.exports['__napi_register__getter_from_obj_250']?.() + __napiInstance.exports['__napi_register__ObjectOnlyFromJs_struct_251']?.() + __napiInstance.exports['__napi_register__receive_object_only_from_js_252']?.() __napiInstance.exports[ - '__napi_register__object_get_named_property_should_perform_typecheck_252' + '__napi_register__object_get_named_property_should_perform_typecheck_253' ]?.() - __napiInstance.exports['__napi_register__ObjectOnlyToJs_struct_253']?.() - __napiInstance.exports['__napi_register__return_object_only_to_js_254']?.() - __napiInstance.exports['__napi_register__async_plus_100_255']?.() - __napiInstance.exports['__napi_register__JsRepo_struct_256']?.() - __napiInstance.exports['__napi_register__JsRepo_impl_259']?.() - __napiInstance.exports['__napi_register__JsRemote_struct_260']?.() - __napiInstance.exports['__napi_register__JsRemote_impl_263']?.() - __napiInstance.exports['__napi_register__CSSRuleList_struct_264']?.() - __napiInstance.exports['__napi_register__CSSRuleList_impl_268']?.() - __napiInstance.exports['__napi_register__CSSStyleSheet_struct_269']?.() - __napiInstance.exports['__napi_register__AnotherCSSStyleSheet_struct_270']?.() - __napiInstance.exports['__napi_register__AnotherCSSStyleSheet_impl_272']?.() - __napiInstance.exports['__napi_register__CSSStyleSheet_impl_276']?.() - __napiInstance.exports['__napi_register__PackageJson_struct_277']?.() - __napiInstance.exports['__napi_register__read_package_json_278']?.() - __napiInstance.exports['__napi_register__get_package_json_name_279']?.() - __napiInstance.exports['__napi_register__test_serde_roundtrip_280']?.() + __napiInstance.exports['__napi_register__ObjectOnlyToJs_struct_254']?.() + __napiInstance.exports['__napi_register__return_object_only_to_js_255']?.() + __napiInstance.exports['__napi_register__async_plus_100_256']?.() + __napiInstance.exports['__napi_register__JsRepo_struct_257']?.() + __napiInstance.exports['__napi_register__JsRepo_impl_260']?.() + __napiInstance.exports['__napi_register__JsRemote_struct_261']?.() + __napiInstance.exports['__napi_register__JsRemote_impl_264']?.() + __napiInstance.exports['__napi_register__CSSRuleList_struct_265']?.() + __napiInstance.exports['__napi_register__CSSRuleList_impl_269']?.() + __napiInstance.exports['__napi_register__CSSStyleSheet_struct_270']?.() + __napiInstance.exports['__napi_register__AnotherCSSStyleSheet_struct_271']?.() + __napiInstance.exports['__napi_register__AnotherCSSStyleSheet_impl_273']?.() + __napiInstance.exports['__napi_register__CSSStyleSheet_impl_277']?.() + __napiInstance.exports['__napi_register__PackageJson_struct_278']?.() + __napiInstance.exports['__napi_register__read_package_json_279']?.() + __napiInstance.exports['__napi_register__get_package_json_name_280']?.() + __napiInstance.exports['__napi_register__test_serde_roundtrip_281']?.() __napiInstance.exports[ - '__napi_register__test_serde_big_number_precision_281' + '__napi_register__test_serde_big_number_precision_282' ]?.() - __napiInstance.exports['__napi_register__return_from_shared_crate_282']?.() - __napiInstance.exports['__napi_register__contains_283']?.() - __napiInstance.exports['__napi_register__concat_str_284']?.() - __napiInstance.exports['__napi_register__concat_utf16_285']?.() - __napiInstance.exports['__napi_register__concat_latin1_286']?.() - __napiInstance.exports['__napi_register__roundtrip_str_287']?.() - __napiInstance.exports['__napi_register__set_symbol_in_obj_288']?.() - __napiInstance.exports['__napi_register__create_symbol_289']?.() - __napiInstance.exports['__napi_register__create_symbol_for_290']?.() - __napiInstance.exports['__napi_register__DelaySum_impl_291']?.() - __napiInstance.exports['__napi_register__without_abort_controller_292']?.() - __napiInstance.exports['__napi_register__with_abort_controller_293']?.() - __napiInstance.exports['__napi_register__AsyncTaskVoidReturn_impl_294']?.() - __napiInstance.exports['__napi_register__async_task_void_return_295']?.() + __napiInstance.exports['__napi_register__return_from_shared_crate_283']?.() + __napiInstance.exports['__napi_register__contains_284']?.() + __napiInstance.exports['__napi_register__concat_str_285']?.() + __napiInstance.exports['__napi_register__concat_utf16_286']?.() + __napiInstance.exports['__napi_register__concat_latin1_287']?.() + __napiInstance.exports['__napi_register__roundtrip_str_288']?.() + __napiInstance.exports['__napi_register__set_symbol_in_obj_289']?.() + __napiInstance.exports['__napi_register__create_symbol_290']?.() + __napiInstance.exports['__napi_register__create_symbol_for_291']?.() + __napiInstance.exports['__napi_register__DelaySum_impl_292']?.() + __napiInstance.exports['__napi_register__without_abort_controller_293']?.() + __napiInstance.exports['__napi_register__with_abort_controller_294']?.() + __napiInstance.exports['__napi_register__AsyncTaskVoidReturn_impl_295']?.() + __napiInstance.exports['__napi_register__async_task_void_return_296']?.() __napiInstance.exports[ - '__napi_register__AsyncTaskOptionalReturn_impl_296' + '__napi_register__AsyncTaskOptionalReturn_impl_297' ]?.() - __napiInstance.exports['__napi_register__async_task_optional_return_297']?.() - __napiInstance.exports['__napi_register__call_threadsafe_function_298']?.() + __napiInstance.exports['__napi_register__async_task_optional_return_298']?.() + __napiInstance.exports['__napi_register__call_threadsafe_function_299']?.() __napiInstance.exports[ - '__napi_register__call_long_threadsafe_function_299' + '__napi_register__call_long_threadsafe_function_300' ]?.() __napiInstance.exports[ - '__napi_register__threadsafe_function_throw_error_300' + '__napi_register__threadsafe_function_throw_error_301' ]?.() __napiInstance.exports[ - '__napi_register__threadsafe_function_fatal_mode_301' + '__napi_register__threadsafe_function_fatal_mode_302' ]?.() __napiInstance.exports[ - '__napi_register__threadsafe_function_fatal_mode_error_302' + '__napi_register__threadsafe_function_fatal_mode_error_303' ]?.() __napiInstance.exports[ - '__napi_register__threadsafe_function_closure_capture_303' + '__napi_register__threadsafe_function_closure_capture_304' ]?.() - __napiInstance.exports['__napi_register__tsfn_call_with_callback_304']?.() - __napiInstance.exports['__napi_register__tsfn_async_call_305']?.() - __napiInstance.exports['__napi_register__accept_threadsafe_function_306']?.() + __napiInstance.exports['__napi_register__tsfn_call_with_callback_305']?.() + __napiInstance.exports['__napi_register__tsfn_async_call_306']?.() + __napiInstance.exports['__napi_register__accept_threadsafe_function_307']?.() __napiInstance.exports[ - '__napi_register__accept_threadsafe_function_fatal_307' + '__napi_register__accept_threadsafe_function_fatal_308' ]?.() __napiInstance.exports[ - '__napi_register__accept_threadsafe_function_tuple_args_308' + '__napi_register__accept_threadsafe_function_tuple_args_309' ]?.() - __napiInstance.exports['__napi_register__tsfn_return_promise_309']?.() - __napiInstance.exports['__napi_register__tsfn_return_promise_timeout_310']?.() - __napiInstance.exports['__napi_register__tsfn_throw_from_js_311']?.() - __napiInstance.exports['__napi_register__get_buffer_312']?.() - __napiInstance.exports['__napi_register__append_buffer_313']?.() - __napiInstance.exports['__napi_register__get_empty_buffer_314']?.() - __napiInstance.exports['__napi_register__convert_u32_array_315']?.() - __napiInstance.exports['__napi_register__create_external_typed_array_316']?.() - __napiInstance.exports['__napi_register__mutate_typed_array_317']?.() - __napiInstance.exports['__napi_register__deref_uint8_array_318']?.() - __napiInstance.exports['__napi_register__buffer_pass_through_319']?.() - __napiInstance.exports['__napi_register__array_buffer_pass_through_320']?.() - __napiInstance.exports['__napi_register__accept_slice_321']?.() - __napiInstance.exports['__napi_register__u8_array_to_array_322']?.() - __napiInstance.exports['__napi_register__i8_array_to_array_323']?.() - __napiInstance.exports['__napi_register__u16_array_to_array_324']?.() - __napiInstance.exports['__napi_register__i16_array_to_array_325']?.() - __napiInstance.exports['__napi_register__u32_array_to_array_326']?.() - __napiInstance.exports['__napi_register__i32_array_to_array_327']?.() - __napiInstance.exports['__napi_register__f32_array_to_array_328']?.() - __napiInstance.exports['__napi_register__f64_array_to_array_329']?.() - __napiInstance.exports['__napi_register__u64_array_to_array_330']?.() - __napiInstance.exports['__napi_register__i64_array_to_array_331']?.() - __napiInstance.exports['__napi_register__accept_uint8_clamped_slice_332']?.() + __napiInstance.exports['__napi_register__tsfn_return_promise_310']?.() + __napiInstance.exports['__napi_register__tsfn_return_promise_timeout_311']?.() + __napiInstance.exports['__napi_register__tsfn_throw_from_js_312']?.() + __napiInstance.exports['__napi_register__get_buffer_313']?.() + __napiInstance.exports['__napi_register__append_buffer_314']?.() + __napiInstance.exports['__napi_register__get_empty_buffer_315']?.() + __napiInstance.exports['__napi_register__convert_u32_array_316']?.() + __napiInstance.exports['__napi_register__create_external_typed_array_317']?.() + __napiInstance.exports['__napi_register__mutate_typed_array_318']?.() + __napiInstance.exports['__napi_register__deref_uint8_array_319']?.() + __napiInstance.exports['__napi_register__buffer_pass_through_320']?.() + __napiInstance.exports['__napi_register__array_buffer_pass_through_321']?.() + __napiInstance.exports['__napi_register__accept_slice_322']?.() + __napiInstance.exports['__napi_register__u8_array_to_array_323']?.() + __napiInstance.exports['__napi_register__i8_array_to_array_324']?.() + __napiInstance.exports['__napi_register__u16_array_to_array_325']?.() + __napiInstance.exports['__napi_register__i16_array_to_array_326']?.() + __napiInstance.exports['__napi_register__u32_array_to_array_327']?.() + __napiInstance.exports['__napi_register__i32_array_to_array_328']?.() + __napiInstance.exports['__napi_register__f32_array_to_array_329']?.() + __napiInstance.exports['__napi_register__f64_array_to_array_330']?.() + __napiInstance.exports['__napi_register__u64_array_to_array_331']?.() + __napiInstance.exports['__napi_register__i64_array_to_array_332']?.() + __napiInstance.exports['__napi_register__accept_uint8_clamped_slice_333']?.() __napiInstance.exports[ - '__napi_register__accept_uint8_clamped_slice_and_buffer_slice_333' + '__napi_register__accept_uint8_clamped_slice_and_buffer_slice_334' ]?.() - __napiInstance.exports['__napi_register__AsyncBuffer_impl_334']?.() - __napiInstance.exports['__napi_register__async_reduce_buffer_335']?.() - __napiInstance.exports['__napi_register__async_buffer_to_array_336']?.() + __napiInstance.exports['__napi_register__AsyncBuffer_impl_335']?.() + __napiInstance.exports['__napi_register__async_reduce_buffer_336']?.() + __napiInstance.exports['__napi_register__async_buffer_to_array_337']?.() } export const Animal = __napiModule.exports.Animal export const AnimalWithDefaultConstructor = @@ -573,6 +574,7 @@ export const overrideIndividualArgOnFunction = export const overrideIndividualArgOnFunctionWithCbArg = __napiModule.exports.overrideIndividualArgOnFunctionWithCbArg export const panic = __napiModule.exports.panic +export const panicInAsync = __napiModule.exports.panicInAsync export const plusOne = __napiModule.exports.plusOne export const promiseInEither = __napiModule.exports.promiseInEither export const readFile = __napiModule.exports.readFile diff --git a/examples/napi/example.wasi.cjs b/examples/napi/example.wasi.cjs index 9ccef9bc..a9e658e9 100644 --- a/examples/napi/example.wasi.cjs +++ b/examples/napi/example.wasi.cjs @@ -86,271 +86,272 @@ function __napi_rs_initialize_modules(__napiInstance) { __napiInstance.exports['__napi_register__get_nested_num_arr_7']?.() __napiInstance.exports['__napi_register__read_file_async_8']?.() __napiInstance.exports['__napi_register__async_multi_two_9']?.() - __napiInstance.exports['__napi_register__bigint_add_10']?.() - __napiInstance.exports['__napi_register__create_big_int_11']?.() - __napiInstance.exports['__napi_register__create_big_int_i64_12']?.() - __napiInstance.exports['__napi_register__bigint_get_u64_as_string_13']?.() - __napiInstance.exports['__napi_register__bigint_from_i64_14']?.() - __napiInstance.exports['__napi_register__bigint_from_i128_15']?.() - __napiInstance.exports['__napi_register__get_cwd_16']?.() - __napiInstance.exports['__napi_register__option_end_17']?.() - __napiInstance.exports['__napi_register__option_start_18']?.() - __napiInstance.exports['__napi_register__option_start_end_19']?.() - __napiInstance.exports['__napi_register__option_only_20']?.() - __napiInstance.exports['__napi_register__read_file_21']?.() - __napiInstance.exports['__napi_register__return_js_function_22']?.() - __napiInstance.exports['__napi_register__callback_return_promise_23']?.() - __napiInstance.exports['__napi_register__callback_return_promise_and_spawn_24']?.() - __napiInstance.exports['__napi_register__capture_error_in_callback_25']?.() - __napiInstance.exports['__napi_register__Animal_struct_26']?.() - __napiInstance.exports['__napi_register__Animal_impl_38']?.() - __napiInstance.exports['__napi_register__Dog_struct_39']?.() - __napiInstance.exports['__napi_register__Bird_struct_40']?.() - __napiInstance.exports['__napi_register__Bird_impl_45']?.() - __napiInstance.exports['__napi_register__Blake2bHasher_struct_46']?.() - __napiInstance.exports['__napi_register__Blake2bHasher_impl_48']?.() - __napiInstance.exports['__napi_register__Blake2bHasher_impl_50']?.() - __napiInstance.exports['__napi_register__Blake2bKey_struct_51']?.() - __napiInstance.exports['__napi_register__Context_struct_52']?.() - __napiInstance.exports['__napi_register__Context_impl_57']?.() - __napiInstance.exports['__napi_register__AnimalWithDefaultConstructor_struct_58']?.() - __napiInstance.exports['__napi_register__NinjaTurtle_struct_59']?.() - __napiInstance.exports['__napi_register__NinjaTurtle_impl_66']?.() - __napiInstance.exports['__napi_register__JsAssets_struct_67']?.() - __napiInstance.exports['__napi_register__JsAssets_impl_70']?.() - __napiInstance.exports['__napi_register__JsAsset_struct_71']?.() - __napiInstance.exports['__napi_register__JsAsset_impl_74']?.() - __napiInstance.exports['__napi_register__Optional_struct_75']?.() - __napiInstance.exports['__napi_register__Optional_impl_80']?.() - __napiInstance.exports['__napi_register__ObjectFieldClassInstance_struct_81']?.() - __napiInstance.exports['__napi_register__create_object_with_class_field_82']?.() - __napiInstance.exports['__napi_register__receive_object_with_class_field_83']?.() - __napiInstance.exports['__napi_register__NotWritableClass_struct_84']?.() - __napiInstance.exports['__napi_register__NotWritableClass_impl_86']?.() - __napiInstance.exports['__napi_register__CustomFinalize_struct_87']?.() - __napiInstance.exports['__napi_register__CustomFinalize_impl_89']?.() - __napiInstance.exports['__napi_register__Width_struct_90']?.() - __napiInstance.exports['__napi_register__plus_one_91']?.() - __napiInstance.exports['__napi_register__GetterSetterWithClosures_struct_92']?.() - __napiInstance.exports['__napi_register__GetterSetterWithClosures_impl_94']?.() - __napiInstance.exports['__napi_register__CatchOnConstructor_struct_95']?.() - __napiInstance.exports['__napi_register__CatchOnConstructor_impl_97']?.() - __napiInstance.exports['__napi_register__CatchOnConstructor2_struct_98']?.() - __napiInstance.exports['__napi_register__CatchOnConstructor2_impl_100']?.() - __napiInstance.exports['__napi_register__ClassWithFactory_struct_101']?.() - __napiInstance.exports['__napi_register__ClassWithFactory_impl_106']?.() - __napiInstance.exports['__napi_register__Selector_struct_107']?.() - __napiInstance.exports['__napi_register__date_to_number_108']?.() - __napiInstance.exports['__napi_register__chrono_date_to_millis_109']?.() - __napiInstance.exports['__napi_register__chrono_date_add_1_minute_110']?.() - __napiInstance.exports['__napi_register__Dates_struct_111']?.() - __napiInstance.exports['__napi_register__chrono_native_date_time_112']?.() - __napiInstance.exports['__napi_register__chrono_native_date_time_return_113']?.() - __napiInstance.exports['__napi_register__either_string_or_number_114']?.() - __napiInstance.exports['__napi_register__return_either_115']?.() - __napiInstance.exports['__napi_register__either3_116']?.() - __napiInstance.exports['__napi_register__Obj_struct_117']?.() - __napiInstance.exports['__napi_register__either4_118']?.() - __napiInstance.exports['__napi_register__JsClassForEither_struct_119']?.() - __napiInstance.exports['__napi_register__JsClassForEither_impl_121']?.() - __napiInstance.exports['__napi_register__AnotherClassForEither_struct_122']?.() - __napiInstance.exports['__napi_register__AnotherClassForEither_impl_124']?.() - __napiInstance.exports['__napi_register__receive_class_or_number_125']?.() - __napiInstance.exports['__napi_register__receive_mut_class_or_number_126']?.() - __napiInstance.exports['__napi_register__receive_different_class_127']?.() - __napiInstance.exports['__napi_register__return_either_class_128']?.() - __napiInstance.exports['__napi_register__either_from_option_129']?.() - __napiInstance.exports['__napi_register__A_struct_130']?.() - __napiInstance.exports['__napi_register__B_struct_131']?.() - __napiInstance.exports['__napi_register__C_struct_132']?.() - __napiInstance.exports['__napi_register__either_from_objects_133']?.() - __napiInstance.exports['__napi_register__either_bool_or_function_134']?.() - __napiInstance.exports['__napi_register__promise_in_either_135']?.() - __napiInstance.exports['__napi_register__either_bool_or_tuple_136']?.() - __napiInstance.exports['__napi_register__Kind_137']?.() - __napiInstance.exports['__napi_register__Empty_138']?.() - __napiInstance.exports['__napi_register__Status_139']?.() - __napiInstance.exports['__napi_register__StringEnum_140']?.() - __napiInstance.exports['__napi_register__CustomNumEnum_141']?.() - __napiInstance.exports['__napi_register__enum_to_i32_142']?.() - __napiInstance.exports['__napi_register__SkippedEnums_143']?.() - __napiInstance.exports['__napi_register__run_script_144']?.() - __napiInstance.exports['__napi_register__get_module_file_name_145']?.() - __napiInstance.exports['__napi_register__throw_syntax_error_146']?.() - __napiInstance.exports['__napi_register__throw_error_147']?.() - __napiInstance.exports['__napi_register__panic_148']?.() - __napiInstance.exports['__napi_register__receive_string_149']?.() - __napiInstance.exports['__napi_register__custom_status_code_150']?.() - __napiInstance.exports['__napi_register__throw_async_error_151']?.() - __napiInstance.exports['__napi_register__create_external_152']?.() - __napiInstance.exports['__napi_register__create_external_string_153']?.() - __napiInstance.exports['__napi_register__get_external_154']?.() - __napiInstance.exports['__napi_register__mutate_external_155']?.() - __napiInstance.exports['__napi_register__create_optional_external_156']?.() - __napiInstance.exports['__napi_register__get_optional_external_157']?.() - __napiInstance.exports['__napi_register__mutate_optional_external_158']?.() - __napiInstance.exports['__napi_register__validate_array_159']?.() - __napiInstance.exports['__napi_register__validate_buffer_160']?.() - __napiInstance.exports['__napi_register__validate_typed_array_161']?.() - __napiInstance.exports['__napi_register__validate_typed_array_slice_162']?.() - __napiInstance.exports['__napi_register__validate_uint8_clamped_slice_163']?.() - __napiInstance.exports['__napi_register__validate_buffer_slice_164']?.() - __napiInstance.exports['__napi_register__validate_bigint_165']?.() - __napiInstance.exports['__napi_register__validate_boolean_166']?.() - __napiInstance.exports['__napi_register__validate_date_167']?.() - __napiInstance.exports['__napi_register__validate_date_time_168']?.() - __napiInstance.exports['__napi_register__validate_external_169']?.() - __napiInstance.exports['__napi_register__validate_function_170']?.() - __napiInstance.exports['__napi_register__validate_hash_map_171']?.() - __napiInstance.exports['__napi_register__validate_null_172']?.() - __napiInstance.exports['__napi_register__validate_undefined_173']?.() - __napiInstance.exports['__napi_register__validate_number_174']?.() - __napiInstance.exports['__napi_register__validate_promise_175']?.() - __napiInstance.exports['__napi_register__validate_string_176']?.() - __napiInstance.exports['__napi_register__validate_symbol_177']?.() - __napiInstance.exports['__napi_register__validate_optional_178']?.() - __napiInstance.exports['__napi_register__return_undefined_if_invalid_179']?.() - __napiInstance.exports['__napi_register__return_undefined_if_invalid_promise_180']?.() - __napiInstance.exports['__napi_register__ts_rename_181']?.() - __napiInstance.exports['__napi_register__override_individual_arg_on_function_182']?.() - __napiInstance.exports['__napi_register__override_individual_arg_on_function_with_cb_arg_183']?.() - __napiInstance.exports['__napi_register__call0_184']?.() - __napiInstance.exports['__napi_register__call1_185']?.() - __napiInstance.exports['__napi_register__call2_186']?.() - __napiInstance.exports['__napi_register__apply0_187']?.() - __napiInstance.exports['__napi_register__apply1_188']?.() - __napiInstance.exports['__napi_register__call_function_189']?.() - __napiInstance.exports['__napi_register__call_function_with_arg_190']?.() - __napiInstance.exports['__napi_register__create_reference_on_function_191']?.() - __napiInstance.exports['__napi_register__call_function_with_arg_and_ctx_192']?.() - __napiInstance.exports['__napi_register__reference_as_callback_193']?.() - __napiInstance.exports['__napi_register__build_threadsafe_function_from_function_194']?.() - __napiInstance.exports['__napi_register__Fib_struct_195']?.() - __napiInstance.exports['__napi_register__Fib_impl_196']?.() - __napiInstance.exports['__napi_register__Fib_impl_198']?.() - __napiInstance.exports['__napi_register__Fib2_struct_199']?.() - __napiInstance.exports['__napi_register__Fib2_impl_200']?.() - __napiInstance.exports['__napi_register__Fib2_impl_202']?.() - __napiInstance.exports['__napi_register__Fib3_struct_203']?.() - __napiInstance.exports['__napi_register__Fib3_impl_204']?.() - __napiInstance.exports['__napi_register__ALIGNMENT_205']?.() - __napiInstance.exports['__napi_register__xxh64_206']?.() - __napiInstance.exports['__napi_register__xxh128_207']?.() - __napiInstance.exports['__napi_register__Xxh3_struct_208']?.() - __napiInstance.exports['__napi_register__Xxh3_impl_212']?.() - __napiInstance.exports['__napi_register__xxh2_plus_213']?.() - __napiInstance.exports['__napi_register__xxh3_xxh64_alias_214']?.() - __napiInstance.exports['__napi_register__xxh64_alias_215']?.() - __napiInstance.exports['__napi_register__get_mapping_216']?.() - __napiInstance.exports['__napi_register__sum_mapping_217']?.() - __napiInstance.exports['__napi_register__get_btree_mapping_218']?.() - __napiInstance.exports['__napi_register__sum_btree_mapping_219']?.() - __napiInstance.exports['__napi_register__get_index_mapping_220']?.() - __napiInstance.exports['__napi_register__sum_index_mapping_221']?.() - __napiInstance.exports['__napi_register__indexmap_passthrough_222']?.() - __napiInstance.exports['__napi_register__map_option_223']?.() - __napiInstance.exports['__napi_register__return_null_224']?.() - __napiInstance.exports['__napi_register__return_undefined_225']?.() - __napiInstance.exports['__napi_register__UseNullableStruct_struct_226']?.() - __napiInstance.exports['__napi_register__NotUseNullableStruct_struct_227']?.() - __napiInstance.exports['__napi_register__DefaultUseNullableStruct_struct_228']?.() - __napiInstance.exports['__napi_register__UseNullableClass_struct_229']?.() - __napiInstance.exports['__napi_register__NotUseNullableClass_struct_230']?.() - __napiInstance.exports['__napi_register__DefaultUseNullableClass_struct_231']?.() - __napiInstance.exports['__napi_register__add_232']?.() - __napiInstance.exports['__napi_register__fibonacci_233']?.() - __napiInstance.exports['__napi_register__list_obj_keys_234']?.() - __napiInstance.exports['__napi_register__create_obj_235']?.() - __napiInstance.exports['__napi_register__get_global_236']?.() - __napiInstance.exports['__napi_register__get_undefined_237']?.() - __napiInstance.exports['__napi_register__get_null_238']?.() - __napiInstance.exports['__napi_register__AllOptionalObject_struct_239']?.() - __napiInstance.exports['__napi_register__receive_all_optional_object_240']?.() - __napiInstance.exports['__napi_register__AliasedEnum_241']?.() - __napiInstance.exports['__napi_register__StructContainsAliasedEnum_struct_242']?.() - __napiInstance.exports['__napi_register__fn_received_aliased_243']?.() - __napiInstance.exports['__napi_register__StrictObject_struct_244']?.() - __napiInstance.exports['__napi_register__receive_strict_object_245']?.() - __napiInstance.exports['__napi_register__get_str_from_object_246']?.() - __napiInstance.exports['__napi_register__TsTypeChanged_struct_247']?.() - __napiInstance.exports['__napi_register__create_obj_with_property_248']?.() - __napiInstance.exports['__napi_register__getter_from_obj_249']?.() - __napiInstance.exports['__napi_register__ObjectOnlyFromJs_struct_250']?.() - __napiInstance.exports['__napi_register__receive_object_only_from_js_251']?.() - __napiInstance.exports['__napi_register__object_get_named_property_should_perform_typecheck_252']?.() - __napiInstance.exports['__napi_register__ObjectOnlyToJs_struct_253']?.() - __napiInstance.exports['__napi_register__return_object_only_to_js_254']?.() - __napiInstance.exports['__napi_register__async_plus_100_255']?.() - __napiInstance.exports['__napi_register__JsRepo_struct_256']?.() - __napiInstance.exports['__napi_register__JsRepo_impl_259']?.() - __napiInstance.exports['__napi_register__JsRemote_struct_260']?.() - __napiInstance.exports['__napi_register__JsRemote_impl_263']?.() - __napiInstance.exports['__napi_register__CSSRuleList_struct_264']?.() - __napiInstance.exports['__napi_register__CSSRuleList_impl_268']?.() - __napiInstance.exports['__napi_register__CSSStyleSheet_struct_269']?.() - __napiInstance.exports['__napi_register__AnotherCSSStyleSheet_struct_270']?.() - __napiInstance.exports['__napi_register__AnotherCSSStyleSheet_impl_272']?.() - __napiInstance.exports['__napi_register__CSSStyleSheet_impl_276']?.() - __napiInstance.exports['__napi_register__PackageJson_struct_277']?.() - __napiInstance.exports['__napi_register__read_package_json_278']?.() - __napiInstance.exports['__napi_register__get_package_json_name_279']?.() - __napiInstance.exports['__napi_register__test_serde_roundtrip_280']?.() - __napiInstance.exports['__napi_register__test_serde_big_number_precision_281']?.() - __napiInstance.exports['__napi_register__return_from_shared_crate_282']?.() - __napiInstance.exports['__napi_register__contains_283']?.() - __napiInstance.exports['__napi_register__concat_str_284']?.() - __napiInstance.exports['__napi_register__concat_utf16_285']?.() - __napiInstance.exports['__napi_register__concat_latin1_286']?.() - __napiInstance.exports['__napi_register__roundtrip_str_287']?.() - __napiInstance.exports['__napi_register__set_symbol_in_obj_288']?.() - __napiInstance.exports['__napi_register__create_symbol_289']?.() - __napiInstance.exports['__napi_register__create_symbol_for_290']?.() - __napiInstance.exports['__napi_register__DelaySum_impl_291']?.() - __napiInstance.exports['__napi_register__without_abort_controller_292']?.() - __napiInstance.exports['__napi_register__with_abort_controller_293']?.() - __napiInstance.exports['__napi_register__AsyncTaskVoidReturn_impl_294']?.() - __napiInstance.exports['__napi_register__async_task_void_return_295']?.() - __napiInstance.exports['__napi_register__AsyncTaskOptionalReturn_impl_296']?.() - __napiInstance.exports['__napi_register__async_task_optional_return_297']?.() - __napiInstance.exports['__napi_register__call_threadsafe_function_298']?.() - __napiInstance.exports['__napi_register__call_long_threadsafe_function_299']?.() - __napiInstance.exports['__napi_register__threadsafe_function_throw_error_300']?.() - __napiInstance.exports['__napi_register__threadsafe_function_fatal_mode_301']?.() - __napiInstance.exports['__napi_register__threadsafe_function_fatal_mode_error_302']?.() - __napiInstance.exports['__napi_register__threadsafe_function_closure_capture_303']?.() - __napiInstance.exports['__napi_register__tsfn_call_with_callback_304']?.() - __napiInstance.exports['__napi_register__tsfn_async_call_305']?.() - __napiInstance.exports['__napi_register__accept_threadsafe_function_306']?.() - __napiInstance.exports['__napi_register__accept_threadsafe_function_fatal_307']?.() - __napiInstance.exports['__napi_register__accept_threadsafe_function_tuple_args_308']?.() - __napiInstance.exports['__napi_register__tsfn_return_promise_309']?.() - __napiInstance.exports['__napi_register__tsfn_return_promise_timeout_310']?.() - __napiInstance.exports['__napi_register__tsfn_throw_from_js_311']?.() - __napiInstance.exports['__napi_register__get_buffer_312']?.() - __napiInstance.exports['__napi_register__append_buffer_313']?.() - __napiInstance.exports['__napi_register__get_empty_buffer_314']?.() - __napiInstance.exports['__napi_register__convert_u32_array_315']?.() - __napiInstance.exports['__napi_register__create_external_typed_array_316']?.() - __napiInstance.exports['__napi_register__mutate_typed_array_317']?.() - __napiInstance.exports['__napi_register__deref_uint8_array_318']?.() - __napiInstance.exports['__napi_register__buffer_pass_through_319']?.() - __napiInstance.exports['__napi_register__array_buffer_pass_through_320']?.() - __napiInstance.exports['__napi_register__accept_slice_321']?.() - __napiInstance.exports['__napi_register__u8_array_to_array_322']?.() - __napiInstance.exports['__napi_register__i8_array_to_array_323']?.() - __napiInstance.exports['__napi_register__u16_array_to_array_324']?.() - __napiInstance.exports['__napi_register__i16_array_to_array_325']?.() - __napiInstance.exports['__napi_register__u32_array_to_array_326']?.() - __napiInstance.exports['__napi_register__i32_array_to_array_327']?.() - __napiInstance.exports['__napi_register__f32_array_to_array_328']?.() - __napiInstance.exports['__napi_register__f64_array_to_array_329']?.() - __napiInstance.exports['__napi_register__u64_array_to_array_330']?.() - __napiInstance.exports['__napi_register__i64_array_to_array_331']?.() - __napiInstance.exports['__napi_register__accept_uint8_clamped_slice_332']?.() - __napiInstance.exports['__napi_register__accept_uint8_clamped_slice_and_buffer_slice_333']?.() - __napiInstance.exports['__napi_register__AsyncBuffer_impl_334']?.() - __napiInstance.exports['__napi_register__async_reduce_buffer_335']?.() - __napiInstance.exports['__napi_register__async_buffer_to_array_336']?.() + __napiInstance.exports['__napi_register__panic_in_async_10']?.() + __napiInstance.exports['__napi_register__bigint_add_11']?.() + __napiInstance.exports['__napi_register__create_big_int_12']?.() + __napiInstance.exports['__napi_register__create_big_int_i64_13']?.() + __napiInstance.exports['__napi_register__bigint_get_u64_as_string_14']?.() + __napiInstance.exports['__napi_register__bigint_from_i64_15']?.() + __napiInstance.exports['__napi_register__bigint_from_i128_16']?.() + __napiInstance.exports['__napi_register__get_cwd_17']?.() + __napiInstance.exports['__napi_register__option_end_18']?.() + __napiInstance.exports['__napi_register__option_start_19']?.() + __napiInstance.exports['__napi_register__option_start_end_20']?.() + __napiInstance.exports['__napi_register__option_only_21']?.() + __napiInstance.exports['__napi_register__read_file_22']?.() + __napiInstance.exports['__napi_register__return_js_function_23']?.() + __napiInstance.exports['__napi_register__callback_return_promise_24']?.() + __napiInstance.exports['__napi_register__callback_return_promise_and_spawn_25']?.() + __napiInstance.exports['__napi_register__capture_error_in_callback_26']?.() + __napiInstance.exports['__napi_register__Animal_struct_27']?.() + __napiInstance.exports['__napi_register__Animal_impl_39']?.() + __napiInstance.exports['__napi_register__Dog_struct_40']?.() + __napiInstance.exports['__napi_register__Bird_struct_41']?.() + __napiInstance.exports['__napi_register__Bird_impl_46']?.() + __napiInstance.exports['__napi_register__Blake2bHasher_struct_47']?.() + __napiInstance.exports['__napi_register__Blake2bHasher_impl_49']?.() + __napiInstance.exports['__napi_register__Blake2bHasher_impl_51']?.() + __napiInstance.exports['__napi_register__Blake2bKey_struct_52']?.() + __napiInstance.exports['__napi_register__Context_struct_53']?.() + __napiInstance.exports['__napi_register__Context_impl_58']?.() + __napiInstance.exports['__napi_register__AnimalWithDefaultConstructor_struct_59']?.() + __napiInstance.exports['__napi_register__NinjaTurtle_struct_60']?.() + __napiInstance.exports['__napi_register__NinjaTurtle_impl_67']?.() + __napiInstance.exports['__napi_register__JsAssets_struct_68']?.() + __napiInstance.exports['__napi_register__JsAssets_impl_71']?.() + __napiInstance.exports['__napi_register__JsAsset_struct_72']?.() + __napiInstance.exports['__napi_register__JsAsset_impl_75']?.() + __napiInstance.exports['__napi_register__Optional_struct_76']?.() + __napiInstance.exports['__napi_register__Optional_impl_81']?.() + __napiInstance.exports['__napi_register__ObjectFieldClassInstance_struct_82']?.() + __napiInstance.exports['__napi_register__create_object_with_class_field_83']?.() + __napiInstance.exports['__napi_register__receive_object_with_class_field_84']?.() + __napiInstance.exports['__napi_register__NotWritableClass_struct_85']?.() + __napiInstance.exports['__napi_register__NotWritableClass_impl_87']?.() + __napiInstance.exports['__napi_register__CustomFinalize_struct_88']?.() + __napiInstance.exports['__napi_register__CustomFinalize_impl_90']?.() + __napiInstance.exports['__napi_register__Width_struct_91']?.() + __napiInstance.exports['__napi_register__plus_one_92']?.() + __napiInstance.exports['__napi_register__GetterSetterWithClosures_struct_93']?.() + __napiInstance.exports['__napi_register__GetterSetterWithClosures_impl_95']?.() + __napiInstance.exports['__napi_register__CatchOnConstructor_struct_96']?.() + __napiInstance.exports['__napi_register__CatchOnConstructor_impl_98']?.() + __napiInstance.exports['__napi_register__CatchOnConstructor2_struct_99']?.() + __napiInstance.exports['__napi_register__CatchOnConstructor2_impl_101']?.() + __napiInstance.exports['__napi_register__ClassWithFactory_struct_102']?.() + __napiInstance.exports['__napi_register__ClassWithFactory_impl_107']?.() + __napiInstance.exports['__napi_register__Selector_struct_108']?.() + __napiInstance.exports['__napi_register__date_to_number_109']?.() + __napiInstance.exports['__napi_register__chrono_date_to_millis_110']?.() + __napiInstance.exports['__napi_register__chrono_date_add_1_minute_111']?.() + __napiInstance.exports['__napi_register__Dates_struct_112']?.() + __napiInstance.exports['__napi_register__chrono_native_date_time_113']?.() + __napiInstance.exports['__napi_register__chrono_native_date_time_return_114']?.() + __napiInstance.exports['__napi_register__either_string_or_number_115']?.() + __napiInstance.exports['__napi_register__return_either_116']?.() + __napiInstance.exports['__napi_register__either3_117']?.() + __napiInstance.exports['__napi_register__Obj_struct_118']?.() + __napiInstance.exports['__napi_register__either4_119']?.() + __napiInstance.exports['__napi_register__JsClassForEither_struct_120']?.() + __napiInstance.exports['__napi_register__JsClassForEither_impl_122']?.() + __napiInstance.exports['__napi_register__AnotherClassForEither_struct_123']?.() + __napiInstance.exports['__napi_register__AnotherClassForEither_impl_125']?.() + __napiInstance.exports['__napi_register__receive_class_or_number_126']?.() + __napiInstance.exports['__napi_register__receive_mut_class_or_number_127']?.() + __napiInstance.exports['__napi_register__receive_different_class_128']?.() + __napiInstance.exports['__napi_register__return_either_class_129']?.() + __napiInstance.exports['__napi_register__either_from_option_130']?.() + __napiInstance.exports['__napi_register__A_struct_131']?.() + __napiInstance.exports['__napi_register__B_struct_132']?.() + __napiInstance.exports['__napi_register__C_struct_133']?.() + __napiInstance.exports['__napi_register__either_from_objects_134']?.() + __napiInstance.exports['__napi_register__either_bool_or_function_135']?.() + __napiInstance.exports['__napi_register__promise_in_either_136']?.() + __napiInstance.exports['__napi_register__either_bool_or_tuple_137']?.() + __napiInstance.exports['__napi_register__Kind_138']?.() + __napiInstance.exports['__napi_register__Empty_139']?.() + __napiInstance.exports['__napi_register__Status_140']?.() + __napiInstance.exports['__napi_register__StringEnum_141']?.() + __napiInstance.exports['__napi_register__CustomNumEnum_142']?.() + __napiInstance.exports['__napi_register__enum_to_i32_143']?.() + __napiInstance.exports['__napi_register__SkippedEnums_144']?.() + __napiInstance.exports['__napi_register__run_script_145']?.() + __napiInstance.exports['__napi_register__get_module_file_name_146']?.() + __napiInstance.exports['__napi_register__throw_syntax_error_147']?.() + __napiInstance.exports['__napi_register__throw_error_148']?.() + __napiInstance.exports['__napi_register__panic_149']?.() + __napiInstance.exports['__napi_register__receive_string_150']?.() + __napiInstance.exports['__napi_register__custom_status_code_151']?.() + __napiInstance.exports['__napi_register__throw_async_error_152']?.() + __napiInstance.exports['__napi_register__create_external_153']?.() + __napiInstance.exports['__napi_register__create_external_string_154']?.() + __napiInstance.exports['__napi_register__get_external_155']?.() + __napiInstance.exports['__napi_register__mutate_external_156']?.() + __napiInstance.exports['__napi_register__create_optional_external_157']?.() + __napiInstance.exports['__napi_register__get_optional_external_158']?.() + __napiInstance.exports['__napi_register__mutate_optional_external_159']?.() + __napiInstance.exports['__napi_register__validate_array_160']?.() + __napiInstance.exports['__napi_register__validate_buffer_161']?.() + __napiInstance.exports['__napi_register__validate_typed_array_162']?.() + __napiInstance.exports['__napi_register__validate_typed_array_slice_163']?.() + __napiInstance.exports['__napi_register__validate_uint8_clamped_slice_164']?.() + __napiInstance.exports['__napi_register__validate_buffer_slice_165']?.() + __napiInstance.exports['__napi_register__validate_bigint_166']?.() + __napiInstance.exports['__napi_register__validate_boolean_167']?.() + __napiInstance.exports['__napi_register__validate_date_168']?.() + __napiInstance.exports['__napi_register__validate_date_time_169']?.() + __napiInstance.exports['__napi_register__validate_external_170']?.() + __napiInstance.exports['__napi_register__validate_function_171']?.() + __napiInstance.exports['__napi_register__validate_hash_map_172']?.() + __napiInstance.exports['__napi_register__validate_null_173']?.() + __napiInstance.exports['__napi_register__validate_undefined_174']?.() + __napiInstance.exports['__napi_register__validate_number_175']?.() + __napiInstance.exports['__napi_register__validate_promise_176']?.() + __napiInstance.exports['__napi_register__validate_string_177']?.() + __napiInstance.exports['__napi_register__validate_symbol_178']?.() + __napiInstance.exports['__napi_register__validate_optional_179']?.() + __napiInstance.exports['__napi_register__return_undefined_if_invalid_180']?.() + __napiInstance.exports['__napi_register__return_undefined_if_invalid_promise_181']?.() + __napiInstance.exports['__napi_register__ts_rename_182']?.() + __napiInstance.exports['__napi_register__override_individual_arg_on_function_183']?.() + __napiInstance.exports['__napi_register__override_individual_arg_on_function_with_cb_arg_184']?.() + __napiInstance.exports['__napi_register__call0_185']?.() + __napiInstance.exports['__napi_register__call1_186']?.() + __napiInstance.exports['__napi_register__call2_187']?.() + __napiInstance.exports['__napi_register__apply0_188']?.() + __napiInstance.exports['__napi_register__apply1_189']?.() + __napiInstance.exports['__napi_register__call_function_190']?.() + __napiInstance.exports['__napi_register__call_function_with_arg_191']?.() + __napiInstance.exports['__napi_register__create_reference_on_function_192']?.() + __napiInstance.exports['__napi_register__call_function_with_arg_and_ctx_193']?.() + __napiInstance.exports['__napi_register__reference_as_callback_194']?.() + __napiInstance.exports['__napi_register__build_threadsafe_function_from_function_195']?.() + __napiInstance.exports['__napi_register__Fib_struct_196']?.() + __napiInstance.exports['__napi_register__Fib_impl_197']?.() + __napiInstance.exports['__napi_register__Fib_impl_199']?.() + __napiInstance.exports['__napi_register__Fib2_struct_200']?.() + __napiInstance.exports['__napi_register__Fib2_impl_201']?.() + __napiInstance.exports['__napi_register__Fib2_impl_203']?.() + __napiInstance.exports['__napi_register__Fib3_struct_204']?.() + __napiInstance.exports['__napi_register__Fib3_impl_205']?.() + __napiInstance.exports['__napi_register__ALIGNMENT_206']?.() + __napiInstance.exports['__napi_register__xxh64_207']?.() + __napiInstance.exports['__napi_register__xxh128_208']?.() + __napiInstance.exports['__napi_register__Xxh3_struct_209']?.() + __napiInstance.exports['__napi_register__Xxh3_impl_213']?.() + __napiInstance.exports['__napi_register__xxh2_plus_214']?.() + __napiInstance.exports['__napi_register__xxh3_xxh64_alias_215']?.() + __napiInstance.exports['__napi_register__xxh64_alias_216']?.() + __napiInstance.exports['__napi_register__get_mapping_217']?.() + __napiInstance.exports['__napi_register__sum_mapping_218']?.() + __napiInstance.exports['__napi_register__get_btree_mapping_219']?.() + __napiInstance.exports['__napi_register__sum_btree_mapping_220']?.() + __napiInstance.exports['__napi_register__get_index_mapping_221']?.() + __napiInstance.exports['__napi_register__sum_index_mapping_222']?.() + __napiInstance.exports['__napi_register__indexmap_passthrough_223']?.() + __napiInstance.exports['__napi_register__map_option_224']?.() + __napiInstance.exports['__napi_register__return_null_225']?.() + __napiInstance.exports['__napi_register__return_undefined_226']?.() + __napiInstance.exports['__napi_register__UseNullableStruct_struct_227']?.() + __napiInstance.exports['__napi_register__NotUseNullableStruct_struct_228']?.() + __napiInstance.exports['__napi_register__DefaultUseNullableStruct_struct_229']?.() + __napiInstance.exports['__napi_register__UseNullableClass_struct_230']?.() + __napiInstance.exports['__napi_register__NotUseNullableClass_struct_231']?.() + __napiInstance.exports['__napi_register__DefaultUseNullableClass_struct_232']?.() + __napiInstance.exports['__napi_register__add_233']?.() + __napiInstance.exports['__napi_register__fibonacci_234']?.() + __napiInstance.exports['__napi_register__list_obj_keys_235']?.() + __napiInstance.exports['__napi_register__create_obj_236']?.() + __napiInstance.exports['__napi_register__get_global_237']?.() + __napiInstance.exports['__napi_register__get_undefined_238']?.() + __napiInstance.exports['__napi_register__get_null_239']?.() + __napiInstance.exports['__napi_register__AllOptionalObject_struct_240']?.() + __napiInstance.exports['__napi_register__receive_all_optional_object_241']?.() + __napiInstance.exports['__napi_register__AliasedEnum_242']?.() + __napiInstance.exports['__napi_register__StructContainsAliasedEnum_struct_243']?.() + __napiInstance.exports['__napi_register__fn_received_aliased_244']?.() + __napiInstance.exports['__napi_register__StrictObject_struct_245']?.() + __napiInstance.exports['__napi_register__receive_strict_object_246']?.() + __napiInstance.exports['__napi_register__get_str_from_object_247']?.() + __napiInstance.exports['__napi_register__TsTypeChanged_struct_248']?.() + __napiInstance.exports['__napi_register__create_obj_with_property_249']?.() + __napiInstance.exports['__napi_register__getter_from_obj_250']?.() + __napiInstance.exports['__napi_register__ObjectOnlyFromJs_struct_251']?.() + __napiInstance.exports['__napi_register__receive_object_only_from_js_252']?.() + __napiInstance.exports['__napi_register__object_get_named_property_should_perform_typecheck_253']?.() + __napiInstance.exports['__napi_register__ObjectOnlyToJs_struct_254']?.() + __napiInstance.exports['__napi_register__return_object_only_to_js_255']?.() + __napiInstance.exports['__napi_register__async_plus_100_256']?.() + __napiInstance.exports['__napi_register__JsRepo_struct_257']?.() + __napiInstance.exports['__napi_register__JsRepo_impl_260']?.() + __napiInstance.exports['__napi_register__JsRemote_struct_261']?.() + __napiInstance.exports['__napi_register__JsRemote_impl_264']?.() + __napiInstance.exports['__napi_register__CSSRuleList_struct_265']?.() + __napiInstance.exports['__napi_register__CSSRuleList_impl_269']?.() + __napiInstance.exports['__napi_register__CSSStyleSheet_struct_270']?.() + __napiInstance.exports['__napi_register__AnotherCSSStyleSheet_struct_271']?.() + __napiInstance.exports['__napi_register__AnotherCSSStyleSheet_impl_273']?.() + __napiInstance.exports['__napi_register__CSSStyleSheet_impl_277']?.() + __napiInstance.exports['__napi_register__PackageJson_struct_278']?.() + __napiInstance.exports['__napi_register__read_package_json_279']?.() + __napiInstance.exports['__napi_register__get_package_json_name_280']?.() + __napiInstance.exports['__napi_register__test_serde_roundtrip_281']?.() + __napiInstance.exports['__napi_register__test_serde_big_number_precision_282']?.() + __napiInstance.exports['__napi_register__return_from_shared_crate_283']?.() + __napiInstance.exports['__napi_register__contains_284']?.() + __napiInstance.exports['__napi_register__concat_str_285']?.() + __napiInstance.exports['__napi_register__concat_utf16_286']?.() + __napiInstance.exports['__napi_register__concat_latin1_287']?.() + __napiInstance.exports['__napi_register__roundtrip_str_288']?.() + __napiInstance.exports['__napi_register__set_symbol_in_obj_289']?.() + __napiInstance.exports['__napi_register__create_symbol_290']?.() + __napiInstance.exports['__napi_register__create_symbol_for_291']?.() + __napiInstance.exports['__napi_register__DelaySum_impl_292']?.() + __napiInstance.exports['__napi_register__without_abort_controller_293']?.() + __napiInstance.exports['__napi_register__with_abort_controller_294']?.() + __napiInstance.exports['__napi_register__AsyncTaskVoidReturn_impl_295']?.() + __napiInstance.exports['__napi_register__async_task_void_return_296']?.() + __napiInstance.exports['__napi_register__AsyncTaskOptionalReturn_impl_297']?.() + __napiInstance.exports['__napi_register__async_task_optional_return_298']?.() + __napiInstance.exports['__napi_register__call_threadsafe_function_299']?.() + __napiInstance.exports['__napi_register__call_long_threadsafe_function_300']?.() + __napiInstance.exports['__napi_register__threadsafe_function_throw_error_301']?.() + __napiInstance.exports['__napi_register__threadsafe_function_fatal_mode_302']?.() + __napiInstance.exports['__napi_register__threadsafe_function_fatal_mode_error_303']?.() + __napiInstance.exports['__napi_register__threadsafe_function_closure_capture_304']?.() + __napiInstance.exports['__napi_register__tsfn_call_with_callback_305']?.() + __napiInstance.exports['__napi_register__tsfn_async_call_306']?.() + __napiInstance.exports['__napi_register__accept_threadsafe_function_307']?.() + __napiInstance.exports['__napi_register__accept_threadsafe_function_fatal_308']?.() + __napiInstance.exports['__napi_register__accept_threadsafe_function_tuple_args_309']?.() + __napiInstance.exports['__napi_register__tsfn_return_promise_310']?.() + __napiInstance.exports['__napi_register__tsfn_return_promise_timeout_311']?.() + __napiInstance.exports['__napi_register__tsfn_throw_from_js_312']?.() + __napiInstance.exports['__napi_register__get_buffer_313']?.() + __napiInstance.exports['__napi_register__append_buffer_314']?.() + __napiInstance.exports['__napi_register__get_empty_buffer_315']?.() + __napiInstance.exports['__napi_register__convert_u32_array_316']?.() + __napiInstance.exports['__napi_register__create_external_typed_array_317']?.() + __napiInstance.exports['__napi_register__mutate_typed_array_318']?.() + __napiInstance.exports['__napi_register__deref_uint8_array_319']?.() + __napiInstance.exports['__napi_register__buffer_pass_through_320']?.() + __napiInstance.exports['__napi_register__array_buffer_pass_through_321']?.() + __napiInstance.exports['__napi_register__accept_slice_322']?.() + __napiInstance.exports['__napi_register__u8_array_to_array_323']?.() + __napiInstance.exports['__napi_register__i8_array_to_array_324']?.() + __napiInstance.exports['__napi_register__u16_array_to_array_325']?.() + __napiInstance.exports['__napi_register__i16_array_to_array_326']?.() + __napiInstance.exports['__napi_register__u32_array_to_array_327']?.() + __napiInstance.exports['__napi_register__i32_array_to_array_328']?.() + __napiInstance.exports['__napi_register__f32_array_to_array_329']?.() + __napiInstance.exports['__napi_register__f64_array_to_array_330']?.() + __napiInstance.exports['__napi_register__u64_array_to_array_331']?.() + __napiInstance.exports['__napi_register__i64_array_to_array_332']?.() + __napiInstance.exports['__napi_register__accept_uint8_clamped_slice_333']?.() + __napiInstance.exports['__napi_register__accept_uint8_clamped_slice_and_buffer_slice_334']?.() + __napiInstance.exports['__napi_register__AsyncBuffer_impl_335']?.() + __napiInstance.exports['__napi_register__async_reduce_buffer_336']?.() + __napiInstance.exports['__napi_register__async_buffer_to_array_337']?.() } module.exports.Animal = __napiModule.exports.Animal module.exports.AnimalWithDefaultConstructor = __napiModule.exports.AnimalWithDefaultConstructor @@ -504,6 +505,7 @@ module.exports.optionStartEnd = __napiModule.exports.optionStartEnd module.exports.overrideIndividualArgOnFunction = __napiModule.exports.overrideIndividualArgOnFunction module.exports.overrideIndividualArgOnFunctionWithCbArg = __napiModule.exports.overrideIndividualArgOnFunctionWithCbArg module.exports.panic = __napiModule.exports.panic +module.exports.panicInAsync = __napiModule.exports.panicInAsync module.exports.plusOne = __napiModule.exports.plusOne module.exports.promiseInEither = __napiModule.exports.promiseInEither module.exports.readFile = __napiModule.exports.readFile diff --git a/examples/napi/index.cjs b/examples/napi/index.cjs index 47552aff..ea72b660 100644 --- a/examples/napi/index.cjs +++ b/examples/napi/index.cjs @@ -513,6 +513,7 @@ module.exports.optionStartEnd = nativeBinding.optionStartEnd module.exports.overrideIndividualArgOnFunction = nativeBinding.overrideIndividualArgOnFunction module.exports.overrideIndividualArgOnFunctionWithCbArg = nativeBinding.overrideIndividualArgOnFunctionWithCbArg module.exports.panic = nativeBinding.panic +module.exports.panicInAsync = nativeBinding.panicInAsync module.exports.plusOne = nativeBinding.plusOne module.exports.promiseInEither = nativeBinding.promiseInEither module.exports.readFile = nativeBinding.readFile diff --git a/examples/napi/index.d.cts b/examples/napi/index.d.cts index 93e5500c..a08e3f2d 100644 --- a/examples/napi/index.d.cts +++ b/examples/napi/index.d.cts @@ -551,6 +551,8 @@ export interface PackageJson { export function panic(): void +export function panicInAsync(): Promise + export function plusOne(this: Width): number export function promiseInEither(input: number | Promise): Promise diff --git a/examples/napi/src/async.rs b/examples/napi/src/async.rs index 29a586d6..b0a2d879 100644 --- a/examples/napi/src/async.rs +++ b/examples/napi/src/async.rs @@ -31,3 +31,8 @@ async fn async_multi_two(arg: u32) -> Result { .await .unwrap() } + +#[napi] +async fn panic_in_async() { + panic!("panic in async function"); +} diff --git a/examples/napi/src/lib.rs b/examples/napi/src/lib.rs index 2cae0595..625d1bdf 100644 --- a/examples/napi/src/lib.rs +++ b/examples/napi/src/lib.rs @@ -5,6 +5,7 @@ #![allow(clippy::new_without_default)] #![allow(deprecated)] +#[cfg(not(target_family = "wasm"))] use napi::bindgen_prelude::create_custom_tokio_runtime; #[macro_use]