diff --git a/cli/package.json b/cli/package.json index ed634c0e..e0425714 100644 --- a/cli/package.json +++ b/cli/package.json @@ -81,12 +81,13 @@ "typanion": "^3.14.0" }, "devDependencies": { - "@emnapi/core": "0.44.0", - "@emnapi/runtime": "0.44.0", + "@emnapi/core": "^0.45.0", + "@emnapi/runtime": "^0.45.0", "@types/debug": "^4.1.12", "@types/inquirer": "^9.0.7", "@types/js-yaml": "^4.0.9", "@types/lodash-es": "^4.17.12", + "@types/node": "^20.10.5", "ava": "^6.0.0", "env-paths": "^3.0.0", "esbuild": "^0.19.8", @@ -96,9 +97,9 @@ "typescript": "^5.3.2" }, "peerDependencies": { - "@emnapi/runtime": "0.44.0", - "@tybys/wasm-util": "0.8.0", - "emnapi": "0.44.0" + "@emnapi/runtime": "^0.45.0", + "@tybys/wasm-util": "^0.8.0", + "emnapi": "^0.45.0" }, "peerDependenciesMeta": { "@emnapi/runtime": { diff --git a/cli/src/api/build.ts b/cli/src/api/build.ts index 234ed178..223ac676 100644 --- a/cli/src/api/build.ts +++ b/cli/src/api/build.ts @@ -799,7 +799,13 @@ class Builder { .join(',\n') await writeFileAsync( newPath, - createWasiBinding(name, wasiRegisterFunctions) + exportsCode + '\n', + createWasiBinding( + name, + this.config.packageName, + wasiRegisterFunctions, + ) + + exportsCode + + '\n', 'utf8', ) await writeFileAsync(workerPath, WASI_WORKER_TEMPLATE, 'utf8') diff --git a/cli/src/api/templates/js-binding.ts b/cli/src/api/templates/js-binding.ts index 596c7059..659e5fc8 100644 --- a/cli/src/api/templates/js-binding.ts +++ b/cli/src/api/templates/js-binding.ts @@ -313,14 +313,7 @@ switch (platform) { if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) { try { - localFileExisted = existsSync( - join(__dirname, '${localName}.wasm32-wasi.wasm') - ) && existsSync(join(__dirname, '${localName}.wasi.cjs')) - if (localFileExisted) { - nativeBinding = require('./${localName}.wasi.cjs') - } else { - nativeBinding = require('${pkgName}-wasm32-wasi') - } + nativeBinding = require('./${localName}.wasi.cjs') } catch { // ignore } diff --git a/cli/src/api/templates/load-wasi-template.ts b/cli/src/api/templates/load-wasi-template.ts index 56e27386..fe58db31 100644 --- a/cli/src/api/templates/load-wasi-template.ts +++ b/cli/src/api/templates/load-wasi-template.ts @@ -1,5 +1,6 @@ export const createWasiBinding = ( wasmFileName: string, + packageName: string, wasiRegisterFunctions: string[], ) => `/* eslint-disable */ /* prettier-ignore */ @@ -30,9 +31,27 @@ const __sharedMemory = new WebAssembly.Memory({ shared: true, }) -const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule } = __emnapiInstantiateNapiModuleSync(__nodeFs.readFileSync(__nodePath.join(__dirname, '${wasmFileName}.wasm')), { +let __wasmFilePath = __nodePath.join(__dirname, '${wasmFileName}.wasm') + +if (!__nodeFs.existsSync(__wasmFilePath)) { + try { + __wasmFilePath = __nodePath.resolve('${packageName}-wasm32-wasi') + } catch { + throw new Error('Cannot find ${wasmFileName}.wasm file, and ${packageName}-wasm32-wasi package is not installed.') + } +} + +const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule } = __emnapiInstantiateNapiModuleSync(__nodeFs.readFileSync(__wasmFilePath), { context: __emnapiContext, - asyncWorkPoolSize: 4, + asyncWorkPoolSize: (function() { + const threadsSizeFromEnv = Number(process.env.NAPI_RS_ASYNC_WORK_POOL_SIZE ?? process.env.UV_THREADPOOL_SIZE) + // NaN > 0 is false + if (threadsSizeFromEnv > 0) { + return threadsSizeFromEnv + } else { + return 4 + } + })(), wasi: __wasi, onCreateWorker() { return new Worker(__nodePath.join(__dirname, 'wasi-worker.mjs'), { diff --git a/examples/napi/index.wasi.cjs b/examples/napi/index.wasi.cjs index f256f35e..5e1576ed 100644 --- a/examples/napi/index.wasi.cjs +++ b/examples/napi/index.wasi.cjs @@ -27,9 +27,27 @@ const __sharedMemory = new WebAssembly.Memory({ shared: true, }) -const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule } = __emnapiInstantiateNapiModuleSync(__nodeFs.readFileSync(__nodePath.join(__dirname, 'index.wasm')), { +let __wasmFilePath = __nodePath.join(__dirname, 'index.wasm') + +if (!__nodeFs.existsSync(__wasmFilePath)) { + try { + __wasmFilePath = __nodePath.resolve('@examples/napi-wasm32-wasi') + } catch { + throw new Error('Cannot find index.wasm file, and @examples/napi-wasm32-wasi package is not installed.') + } +} + +const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule } = __emnapiInstantiateNapiModuleSync(__nodeFs.readFileSync(__wasmFilePath), { context: __emnapiContext, - asyncWorkPoolSize: 4, + asyncWorkPoolSize: (function() { + const threadsSizeFromEnv = Number(process.env.NAPI_RS_ASYNC_WORK_POOL_SIZE ?? process.env.UV_THREADPOOL_SIZE) + // NaN > 0 is false + if (threadsSizeFromEnv > 0) { + return threadsSizeFromEnv + } else { + return 4 + } + })(), wasi: __wasi, onCreateWorker() { return new Worker(__nodePath.join(__dirname, 'wasi-worker.mjs'), { @@ -110,173 +128,177 @@ function __napi_rs_initialize_modules(__napiInstance) { __napiInstance.exports['__napi_register__plus_one_90']?.() __napiInstance.exports['__napi_register__GetterSetterWithClosures_struct_91']?.() __napiInstance.exports['__napi_register__GetterSetterWithClosures_impl_93']?.() - __napiInstance.exports['__napi_register__ClassWithFactory_struct_94']?.() - __napiInstance.exports['__napi_register__ClassWithFactory_impl_99']?.() - __napiInstance.exports['__napi_register__Selector_struct_100']?.() - __napiInstance.exports['__napi_register__date_to_number_101']?.() - __napiInstance.exports['__napi_register__chrono_date_to_millis_102']?.() - __napiInstance.exports['__napi_register__chrono_date_add_1_minute_103']?.() - __napiInstance.exports['__napi_register__Dates_struct_104']?.() - __napiInstance.exports['__napi_register__chrono_native_date_time_105']?.() - __napiInstance.exports['__napi_register__chrono_native_date_time_return_106']?.() - __napiInstance.exports['__napi_register__either_string_or_number_107']?.() - __napiInstance.exports['__napi_register__return_either_108']?.() - __napiInstance.exports['__napi_register__either3_109']?.() - __napiInstance.exports['__napi_register__Obj_struct_110']?.() - __napiInstance.exports['__napi_register__either4_111']?.() - __napiInstance.exports['__napi_register__JsClassForEither_struct_112']?.() - __napiInstance.exports['__napi_register__JsClassForEither_impl_114']?.() - __napiInstance.exports['__napi_register__AnotherClassForEither_struct_115']?.() - __napiInstance.exports['__napi_register__AnotherClassForEither_impl_117']?.() - __napiInstance.exports['__napi_register__receive_class_or_number_118']?.() - __napiInstance.exports['__napi_register__receive_mut_class_or_number_119']?.() - __napiInstance.exports['__napi_register__receive_different_class_120']?.() - __napiInstance.exports['__napi_register__return_either_class_121']?.() - __napiInstance.exports['__napi_register__either_from_option_122']?.() - __napiInstance.exports['__napi_register__A_struct_123']?.() - __napiInstance.exports['__napi_register__B_struct_124']?.() - __napiInstance.exports['__napi_register__C_struct_125']?.() - __napiInstance.exports['__napi_register__either_from_objects_126']?.() - __napiInstance.exports['__napi_register__either_bool_or_function_127']?.() - __napiInstance.exports['__napi_register__promise_in_either_128']?.() - __napiInstance.exports['__napi_register__Kind_129']?.() - __napiInstance.exports['__napi_register__Empty_130']?.() - __napiInstance.exports['__napi_register__Status_131']?.() - __napiInstance.exports['__napi_register__CustomNumEnum_132']?.() - __napiInstance.exports['__napi_register__enum_to_i32_133']?.() - __napiInstance.exports['__napi_register__SkippedEnums_134']?.() - __napiInstance.exports['__napi_register__run_script_135']?.() - __napiInstance.exports['__napi_register__get_module_file_name_136']?.() - __napiInstance.exports['__napi_register__throw_syntax_error_137']?.() - __napiInstance.exports['__napi_register__throw_error_138']?.() - __napiInstance.exports['__napi_register__panic_139']?.() - __napiInstance.exports['__napi_register__receive_string_140']?.() - __napiInstance.exports['__napi_register__custom_status_code_141']?.() - __napiInstance.exports['__napi_register__throw_async_error_142']?.() - __napiInstance.exports['__napi_register__create_external_143']?.() - __napiInstance.exports['__napi_register__create_external_string_144']?.() - __napiInstance.exports['__napi_register__get_external_145']?.() - __napiInstance.exports['__napi_register__mutate_external_146']?.() - __napiInstance.exports['__napi_register__validate_array_147']?.() - __napiInstance.exports['__napi_register__validate_buffer_148']?.() - __napiInstance.exports['__napi_register__validate_typed_array_149']?.() - __napiInstance.exports['__napi_register__validate_bigint_150']?.() - __napiInstance.exports['__napi_register__validate_boolean_151']?.() - __napiInstance.exports['__napi_register__validate_date_152']?.() - __napiInstance.exports['__napi_register__validate_date_time_153']?.() - __napiInstance.exports['__napi_register__validate_external_154']?.() - __napiInstance.exports['__napi_register__validate_function_155']?.() - __napiInstance.exports['__napi_register__validate_hash_map_156']?.() - __napiInstance.exports['__napi_register__validate_null_157']?.() - __napiInstance.exports['__napi_register__validate_undefined_158']?.() - __napiInstance.exports['__napi_register__validate_number_159']?.() - __napiInstance.exports['__napi_register__validate_promise_160']?.() - __napiInstance.exports['__napi_register__validate_string_161']?.() - __napiInstance.exports['__napi_register__validate_symbol_162']?.() - __napiInstance.exports['__napi_register__validate_optional_163']?.() - __napiInstance.exports['__napi_register__return_undefined_if_invalid_164']?.() - __napiInstance.exports['__napi_register__return_undefined_if_invalid_promise_165']?.() - __napiInstance.exports['__napi_register__ts_rename_166']?.() - __napiInstance.exports['__napi_register__override_individual_arg_on_function_167']?.() - __napiInstance.exports['__napi_register__override_individual_arg_on_function_with_cb_arg_168']?.() - __napiInstance.exports['__napi_register__Fib_struct_169']?.() - __napiInstance.exports['__napi_register__Fib_impl_170']?.() - __napiInstance.exports['__napi_register__Fib_impl_172']?.() - __napiInstance.exports['__napi_register__Fib2_struct_173']?.() - __napiInstance.exports['__napi_register__Fib2_impl_174']?.() - __napiInstance.exports['__napi_register__Fib2_impl_176']?.() - __napiInstance.exports['__napi_register__Fib3_struct_177']?.() - __napiInstance.exports['__napi_register__Fib3_impl_178']?.() - __napiInstance.exports['__napi_register__ALIGNMENT_179']?.() - __napiInstance.exports['__napi_register__xxh64_180']?.() - __napiInstance.exports['__napi_register__xxh128_181']?.() - __napiInstance.exports['__napi_register__Xxh3_struct_182']?.() - __napiInstance.exports['__napi_register__Xxh3_impl_186']?.() - __napiInstance.exports['__napi_register__xxh2_plus_187']?.() - __napiInstance.exports['__napi_register__xxh3_xxh64_alias_188']?.() - __napiInstance.exports['__napi_register__xxh64_alias_189']?.() - __napiInstance.exports['__napi_register__get_mapping_190']?.() - __napiInstance.exports['__napi_register__sum_mapping_191']?.() - __napiInstance.exports['__napi_register__map_option_192']?.() - __napiInstance.exports['__napi_register__return_null_193']?.() - __napiInstance.exports['__napi_register__return_undefined_194']?.() - __napiInstance.exports['__napi_register__add_195']?.() - __napiInstance.exports['__napi_register__fibonacci_196']?.() - __napiInstance.exports['__napi_register__list_obj_keys_197']?.() - __napiInstance.exports['__napi_register__create_obj_198']?.() - __napiInstance.exports['__napi_register__get_global_199']?.() - __napiInstance.exports['__napi_register__get_undefined_200']?.() - __napiInstance.exports['__napi_register__get_null_201']?.() - __napiInstance.exports['__napi_register__AllOptionalObject_struct_202']?.() - __napiInstance.exports['__napi_register__receive_all_optional_object_203']?.() - __napiInstance.exports['__napi_register__AliasedEnum_204']?.() - __napiInstance.exports['__napi_register__StructContainsAliasedEnum_struct_205']?.() - __napiInstance.exports['__napi_register__fn_received_aliased_206']?.() - __napiInstance.exports['__napi_register__StrictObject_struct_207']?.() - __napiInstance.exports['__napi_register__receive_strict_object_208']?.() - __napiInstance.exports['__napi_register__get_str_from_object_209']?.() - __napiInstance.exports['__napi_register__TsTypeChanged_struct_210']?.() - __napiInstance.exports['__napi_register__create_obj_with_property_211']?.() - __napiInstance.exports['__napi_register__getter_from_obj_212']?.() - __napiInstance.exports['__napi_register__ObjectOnlyFromJs_struct_213']?.() - __napiInstance.exports['__napi_register__receive_object_only_from_js_214']?.() - __napiInstance.exports['__napi_register__async_plus_100_215']?.() - __napiInstance.exports['__napi_register__JsRepo_struct_216']?.() - __napiInstance.exports['__napi_register__JsRepo_impl_219']?.() - __napiInstance.exports['__napi_register__JsRemote_struct_220']?.() - __napiInstance.exports['__napi_register__JsRemote_impl_222']?.() - __napiInstance.exports['__napi_register__CSSRuleList_struct_223']?.() - __napiInstance.exports['__napi_register__CSSRuleList_impl_227']?.() - __napiInstance.exports['__napi_register__CSSStyleSheet_struct_228']?.() - __napiInstance.exports['__napi_register__AnotherCSSStyleSheet_struct_229']?.() - __napiInstance.exports['__napi_register__AnotherCSSStyleSheet_impl_231']?.() - __napiInstance.exports['__napi_register__CSSStyleSheet_impl_235']?.() - __napiInstance.exports['__napi_register__PackageJson_struct_236']?.() - __napiInstance.exports['__napi_register__read_package_json_237']?.() - __napiInstance.exports['__napi_register__get_package_json_name_238']?.() - __napiInstance.exports['__napi_register__test_serde_roundtrip_239']?.() - __napiInstance.exports['__napi_register__test_serde_big_number_precision_240']?.() - __napiInstance.exports['__napi_register__return_from_shared_crate_241']?.() - __napiInstance.exports['__napi_register__contains_242']?.() - __napiInstance.exports['__napi_register__concat_str_243']?.() - __napiInstance.exports['__napi_register__concat_utf16_244']?.() - __napiInstance.exports['__napi_register__concat_latin1_245']?.() - __napiInstance.exports['__napi_register__roundtrip_str_246']?.() - __napiInstance.exports['__napi_register__set_symbol_in_obj_247']?.() - __napiInstance.exports['__napi_register__create_symbol_248']?.() - __napiInstance.exports['__napi_register__create_symbol_for_249']?.() - __napiInstance.exports['__napi_register__DelaySum_impl_250']?.() - __napiInstance.exports['__napi_register__without_abort_controller_251']?.() - __napiInstance.exports['__napi_register__with_abort_controller_252']?.() - __napiInstance.exports['__napi_register__AsyncTaskVoidReturn_impl_253']?.() - __napiInstance.exports['__napi_register__async_task_void_return_254']?.() - __napiInstance.exports['__napi_register__AsyncTaskOptionalReturn_impl_255']?.() - __napiInstance.exports['__napi_register__async_task_optional_return_256']?.() - __napiInstance.exports['__napi_register__call_threadsafe_function_257']?.() - __napiInstance.exports['__napi_register__call_long_threadsafe_function_258']?.() - __napiInstance.exports['__napi_register__threadsafe_function_throw_error_259']?.() - __napiInstance.exports['__napi_register__threadsafe_function_fatal_mode_260']?.() - __napiInstance.exports['__napi_register__threadsafe_function_fatal_mode_error_261']?.() - __napiInstance.exports['__napi_register__threadsafe_function_closure_capture_262']?.() - __napiInstance.exports['__napi_register__tsfn_call_with_callback_263']?.() - __napiInstance.exports['__napi_register__tsfn_async_call_264']?.() - __napiInstance.exports['__napi_register__accept_threadsafe_function_265']?.() - __napiInstance.exports['__napi_register__accept_threadsafe_function_fatal_266']?.() - __napiInstance.exports['__napi_register__accept_threadsafe_function_tuple_args_267']?.() - __napiInstance.exports['__napi_register__tsfn_return_promise_268']?.() - __napiInstance.exports['__napi_register__tsfn_return_promise_timeout_269']?.() - __napiInstance.exports['__napi_register__tsfn_throw_from_js_270']?.() - __napiInstance.exports['__napi_register__get_buffer_271']?.() - __napiInstance.exports['__napi_register__append_buffer_272']?.() - __napiInstance.exports['__napi_register__get_empty_buffer_273']?.() - __napiInstance.exports['__napi_register__convert_u32_array_274']?.() - __napiInstance.exports['__napi_register__create_external_typed_array_275']?.() - __napiInstance.exports['__napi_register__mutate_typed_array_276']?.() - __napiInstance.exports['__napi_register__deref_uint8_array_277']?.() - __napiInstance.exports['__napi_register__buffer_pass_through_278']?.() - __napiInstance.exports['__napi_register__array_buffer_pass_through_279']?.() - __napiInstance.exports['__napi_register__AsyncBuffer_impl_280']?.() - __napiInstance.exports['__napi_register__async_reduce_buffer_281']?.() + __napiInstance.exports['__napi_register__CatchOnConstructor_struct_94']?.() + __napiInstance.exports['__napi_register__CatchOnConstructor_impl_96']?.() + __napiInstance.exports['__napi_register__CatchOnConstructor2_struct_97']?.() + __napiInstance.exports['__napi_register__CatchOnConstructor2_impl_99']?.() + __napiInstance.exports['__napi_register__ClassWithFactory_struct_100']?.() + __napiInstance.exports['__napi_register__ClassWithFactory_impl_105']?.() + __napiInstance.exports['__napi_register__Selector_struct_106']?.() + __napiInstance.exports['__napi_register__date_to_number_107']?.() + __napiInstance.exports['__napi_register__chrono_date_to_millis_108']?.() + __napiInstance.exports['__napi_register__chrono_date_add_1_minute_109']?.() + __napiInstance.exports['__napi_register__Dates_struct_110']?.() + __napiInstance.exports['__napi_register__chrono_native_date_time_111']?.() + __napiInstance.exports['__napi_register__chrono_native_date_time_return_112']?.() + __napiInstance.exports['__napi_register__either_string_or_number_113']?.() + __napiInstance.exports['__napi_register__return_either_114']?.() + __napiInstance.exports['__napi_register__either3_115']?.() + __napiInstance.exports['__napi_register__Obj_struct_116']?.() + __napiInstance.exports['__napi_register__either4_117']?.() + __napiInstance.exports['__napi_register__JsClassForEither_struct_118']?.() + __napiInstance.exports['__napi_register__JsClassForEither_impl_120']?.() + __napiInstance.exports['__napi_register__AnotherClassForEither_struct_121']?.() + __napiInstance.exports['__napi_register__AnotherClassForEither_impl_123']?.() + __napiInstance.exports['__napi_register__receive_class_or_number_124']?.() + __napiInstance.exports['__napi_register__receive_mut_class_or_number_125']?.() + __napiInstance.exports['__napi_register__receive_different_class_126']?.() + __napiInstance.exports['__napi_register__return_either_class_127']?.() + __napiInstance.exports['__napi_register__either_from_option_128']?.() + __napiInstance.exports['__napi_register__A_struct_129']?.() + __napiInstance.exports['__napi_register__B_struct_130']?.() + __napiInstance.exports['__napi_register__C_struct_131']?.() + __napiInstance.exports['__napi_register__either_from_objects_132']?.() + __napiInstance.exports['__napi_register__either_bool_or_function_133']?.() + __napiInstance.exports['__napi_register__promise_in_either_134']?.() + __napiInstance.exports['__napi_register__Kind_135']?.() + __napiInstance.exports['__napi_register__Empty_136']?.() + __napiInstance.exports['__napi_register__Status_137']?.() + __napiInstance.exports['__napi_register__CustomNumEnum_138']?.() + __napiInstance.exports['__napi_register__enum_to_i32_139']?.() + __napiInstance.exports['__napi_register__SkippedEnums_140']?.() + __napiInstance.exports['__napi_register__run_script_141']?.() + __napiInstance.exports['__napi_register__get_module_file_name_142']?.() + __napiInstance.exports['__napi_register__throw_syntax_error_143']?.() + __napiInstance.exports['__napi_register__throw_error_144']?.() + __napiInstance.exports['__napi_register__panic_145']?.() + __napiInstance.exports['__napi_register__receive_string_146']?.() + __napiInstance.exports['__napi_register__custom_status_code_147']?.() + __napiInstance.exports['__napi_register__throw_async_error_148']?.() + __napiInstance.exports['__napi_register__create_external_149']?.() + __napiInstance.exports['__napi_register__create_external_string_150']?.() + __napiInstance.exports['__napi_register__get_external_151']?.() + __napiInstance.exports['__napi_register__mutate_external_152']?.() + __napiInstance.exports['__napi_register__validate_array_153']?.() + __napiInstance.exports['__napi_register__validate_buffer_154']?.() + __napiInstance.exports['__napi_register__validate_typed_array_155']?.() + __napiInstance.exports['__napi_register__validate_bigint_156']?.() + __napiInstance.exports['__napi_register__validate_boolean_157']?.() + __napiInstance.exports['__napi_register__validate_date_158']?.() + __napiInstance.exports['__napi_register__validate_date_time_159']?.() + __napiInstance.exports['__napi_register__validate_external_160']?.() + __napiInstance.exports['__napi_register__validate_function_161']?.() + __napiInstance.exports['__napi_register__validate_hash_map_162']?.() + __napiInstance.exports['__napi_register__validate_null_163']?.() + __napiInstance.exports['__napi_register__validate_undefined_164']?.() + __napiInstance.exports['__napi_register__validate_number_165']?.() + __napiInstance.exports['__napi_register__validate_promise_166']?.() + __napiInstance.exports['__napi_register__validate_string_167']?.() + __napiInstance.exports['__napi_register__validate_symbol_168']?.() + __napiInstance.exports['__napi_register__validate_optional_169']?.() + __napiInstance.exports['__napi_register__return_undefined_if_invalid_170']?.() + __napiInstance.exports['__napi_register__return_undefined_if_invalid_promise_171']?.() + __napiInstance.exports['__napi_register__ts_rename_172']?.() + __napiInstance.exports['__napi_register__override_individual_arg_on_function_173']?.() + __napiInstance.exports['__napi_register__override_individual_arg_on_function_with_cb_arg_174']?.() + __napiInstance.exports['__napi_register__Fib_struct_175']?.() + __napiInstance.exports['__napi_register__Fib_impl_176']?.() + __napiInstance.exports['__napi_register__Fib_impl_178']?.() + __napiInstance.exports['__napi_register__Fib2_struct_179']?.() + __napiInstance.exports['__napi_register__Fib2_impl_180']?.() + __napiInstance.exports['__napi_register__Fib2_impl_182']?.() + __napiInstance.exports['__napi_register__Fib3_struct_183']?.() + __napiInstance.exports['__napi_register__Fib3_impl_184']?.() + __napiInstance.exports['__napi_register__ALIGNMENT_185']?.() + __napiInstance.exports['__napi_register__xxh64_186']?.() + __napiInstance.exports['__napi_register__xxh128_187']?.() + __napiInstance.exports['__napi_register__Xxh3_struct_188']?.() + __napiInstance.exports['__napi_register__Xxh3_impl_192']?.() + __napiInstance.exports['__napi_register__xxh2_plus_193']?.() + __napiInstance.exports['__napi_register__xxh3_xxh64_alias_194']?.() + __napiInstance.exports['__napi_register__xxh64_alias_195']?.() + __napiInstance.exports['__napi_register__get_mapping_196']?.() + __napiInstance.exports['__napi_register__sum_mapping_197']?.() + __napiInstance.exports['__napi_register__map_option_198']?.() + __napiInstance.exports['__napi_register__return_null_199']?.() + __napiInstance.exports['__napi_register__return_undefined_200']?.() + __napiInstance.exports['__napi_register__add_201']?.() + __napiInstance.exports['__napi_register__fibonacci_202']?.() + __napiInstance.exports['__napi_register__list_obj_keys_203']?.() + __napiInstance.exports['__napi_register__create_obj_204']?.() + __napiInstance.exports['__napi_register__get_global_205']?.() + __napiInstance.exports['__napi_register__get_undefined_206']?.() + __napiInstance.exports['__napi_register__get_null_207']?.() + __napiInstance.exports['__napi_register__AllOptionalObject_struct_208']?.() + __napiInstance.exports['__napi_register__receive_all_optional_object_209']?.() + __napiInstance.exports['__napi_register__AliasedEnum_210']?.() + __napiInstance.exports['__napi_register__StructContainsAliasedEnum_struct_211']?.() + __napiInstance.exports['__napi_register__fn_received_aliased_212']?.() + __napiInstance.exports['__napi_register__StrictObject_struct_213']?.() + __napiInstance.exports['__napi_register__receive_strict_object_214']?.() + __napiInstance.exports['__napi_register__get_str_from_object_215']?.() + __napiInstance.exports['__napi_register__TsTypeChanged_struct_216']?.() + __napiInstance.exports['__napi_register__create_obj_with_property_217']?.() + __napiInstance.exports['__napi_register__getter_from_obj_218']?.() + __napiInstance.exports['__napi_register__ObjectOnlyFromJs_struct_219']?.() + __napiInstance.exports['__napi_register__receive_object_only_from_js_220']?.() + __napiInstance.exports['__napi_register__async_plus_100_221']?.() + __napiInstance.exports['__napi_register__JsRepo_struct_222']?.() + __napiInstance.exports['__napi_register__JsRepo_impl_225']?.() + __napiInstance.exports['__napi_register__JsRemote_struct_226']?.() + __napiInstance.exports['__napi_register__JsRemote_impl_228']?.() + __napiInstance.exports['__napi_register__CSSRuleList_struct_229']?.() + __napiInstance.exports['__napi_register__CSSRuleList_impl_233']?.() + __napiInstance.exports['__napi_register__CSSStyleSheet_struct_234']?.() + __napiInstance.exports['__napi_register__AnotherCSSStyleSheet_struct_235']?.() + __napiInstance.exports['__napi_register__AnotherCSSStyleSheet_impl_237']?.() + __napiInstance.exports['__napi_register__CSSStyleSheet_impl_241']?.() + __napiInstance.exports['__napi_register__PackageJson_struct_242']?.() + __napiInstance.exports['__napi_register__read_package_json_243']?.() + __napiInstance.exports['__napi_register__get_package_json_name_244']?.() + __napiInstance.exports['__napi_register__test_serde_roundtrip_245']?.() + __napiInstance.exports['__napi_register__test_serde_big_number_precision_246']?.() + __napiInstance.exports['__napi_register__return_from_shared_crate_247']?.() + __napiInstance.exports['__napi_register__contains_248']?.() + __napiInstance.exports['__napi_register__concat_str_249']?.() + __napiInstance.exports['__napi_register__concat_utf16_250']?.() + __napiInstance.exports['__napi_register__concat_latin1_251']?.() + __napiInstance.exports['__napi_register__roundtrip_str_252']?.() + __napiInstance.exports['__napi_register__set_symbol_in_obj_253']?.() + __napiInstance.exports['__napi_register__create_symbol_254']?.() + __napiInstance.exports['__napi_register__create_symbol_for_255']?.() + __napiInstance.exports['__napi_register__DelaySum_impl_256']?.() + __napiInstance.exports['__napi_register__without_abort_controller_257']?.() + __napiInstance.exports['__napi_register__with_abort_controller_258']?.() + __napiInstance.exports['__napi_register__AsyncTaskVoidReturn_impl_259']?.() + __napiInstance.exports['__napi_register__async_task_void_return_260']?.() + __napiInstance.exports['__napi_register__AsyncTaskOptionalReturn_impl_261']?.() + __napiInstance.exports['__napi_register__async_task_optional_return_262']?.() + __napiInstance.exports['__napi_register__call_threadsafe_function_263']?.() + __napiInstance.exports['__napi_register__call_long_threadsafe_function_264']?.() + __napiInstance.exports['__napi_register__threadsafe_function_throw_error_265']?.() + __napiInstance.exports['__napi_register__threadsafe_function_fatal_mode_266']?.() + __napiInstance.exports['__napi_register__threadsafe_function_fatal_mode_error_267']?.() + __napiInstance.exports['__napi_register__threadsafe_function_closure_capture_268']?.() + __napiInstance.exports['__napi_register__tsfn_call_with_callback_269']?.() + __napiInstance.exports['__napi_register__tsfn_async_call_270']?.() + __napiInstance.exports['__napi_register__accept_threadsafe_function_271']?.() + __napiInstance.exports['__napi_register__accept_threadsafe_function_fatal_272']?.() + __napiInstance.exports['__napi_register__accept_threadsafe_function_tuple_args_273']?.() + __napiInstance.exports['__napi_register__tsfn_return_promise_274']?.() + __napiInstance.exports['__napi_register__tsfn_return_promise_timeout_275']?.() + __napiInstance.exports['__napi_register__tsfn_throw_from_js_276']?.() + __napiInstance.exports['__napi_register__get_buffer_277']?.() + __napiInstance.exports['__napi_register__append_buffer_278']?.() + __napiInstance.exports['__napi_register__get_empty_buffer_279']?.() + __napiInstance.exports['__napi_register__convert_u32_array_280']?.() + __napiInstance.exports['__napi_register__create_external_typed_array_281']?.() + __napiInstance.exports['__napi_register__mutate_typed_array_282']?.() + __napiInstance.exports['__napi_register__deref_uint8_array_283']?.() + __napiInstance.exports['__napi_register__buffer_pass_through_284']?.() + __napiInstance.exports['__napi_register__array_buffer_pass_through_285']?.() + __napiInstance.exports['__napi_register__AsyncBuffer_impl_286']?.() + __napiInstance.exports['__napi_register__async_reduce_buffer_287']?.() } module.exports.Animal = __napiModule.exports.Animal, module.exports.AnimalWithDefaultConstructor = __napiModule.exports.AnimalWithDefaultConstructor, @@ -292,6 +314,8 @@ module.exports.Blake2BHasher = __napiModule.exports.Blake2BHasher, module.exports.Blake2bHasher = __napiModule.exports.Blake2bHasher, module.exports.Blake2BKey = __napiModule.exports.Blake2BKey, module.exports.Blake2bKey = __napiModule.exports.Blake2bKey, +module.exports.CatchOnConstructor = __napiModule.exports.CatchOnConstructor, +module.exports.CatchOnConstructor2 = __napiModule.exports.CatchOnConstructor2, module.exports.ClassWithFactory = __napiModule.exports.ClassWithFactory, module.exports.Context = __napiModule.exports.Context, module.exports.CssRuleList = __napiModule.exports.CssRuleList, diff --git a/examples/napi/package.json b/examples/napi/package.json index c1652dba..67c3bc03 100644 --- a/examples/napi/package.json +++ b/examples/napi/package.json @@ -31,7 +31,7 @@ "timeout": "10m" }, "dependencies": { - "@emnapi/core": "0.44.0", + "@emnapi/core": "0.45.0", "@tybys/wasm-util": "^0.8.0", "@types/lodash": "^4.14.202", "lodash": "^4.17.21", diff --git a/triples/package.json b/triples/package.json index b1ec4360..c9916cb7 100644 --- a/triples/package.json +++ b/triples/package.json @@ -47,6 +47,7 @@ "build": "node --loader ts-node/esm/transpile-only ./generate-triple-list.ts && prettier --write ./index.cjs" }, "devDependencies": { + "@types/node": "^20.10.5", "lodash-es": "^4.17.21", "ts-node": "^10.9.1", "typescript": "^5.3.2" diff --git a/yarn.lock b/yarn.lock index a14a3bc8..f3baa656 100644 --- a/yarn.lock +++ b/yarn.lock @@ -126,21 +126,21 @@ __metadata: languageName: node linkType: hard -"@emnapi/core@npm:0.44.0": - version: 0.44.0 - resolution: "@emnapi/core@npm:0.44.0" +"@emnapi/core@npm:0.45.0, @emnapi/core@npm:^0.45.0": + version: 0.45.0 + resolution: "@emnapi/core@npm:0.45.0" dependencies: tslib: "npm:^2.4.0" - checksum: 554ad897ae5d6e49471f1922113e60f74ecdc7617ea83ba070b022e7878d7f35160b26d42da98f692f915ba89ccc8900a57ee1afeafbe9fc225c0b92db5772f4 + checksum: 26071cfe32a5a15068483ed36a152c03add319166c30e6cb81f0d6eb2614e69f836daa2d69af5af2e00fc2b8335f172e5ce2ee91f1819b3e689c908a7883433f languageName: node linkType: hard -"@emnapi/runtime@npm:0.44.0": - version: 0.44.0 - resolution: "@emnapi/runtime@npm:0.44.0" +"@emnapi/runtime@npm:^0.45.0": + version: 0.45.0 + resolution: "@emnapi/runtime@npm:0.45.0" dependencies: tslib: "npm:^2.4.0" - checksum: 68133f288a5f413787610232c90194ab0b692b859a130866f4869483217d94f71ac3fd23aacfb428e0eb438e4882d0e04874690a1f06386b7b35ebae330e698a + checksum: c83052b05efb7147c256bfbb69214c9642fef1dce8d7d901e0314a7b2d2dcd14e1cd75502c6565004847e552658e9913a7e58889c7dca92e240173032f1db5d5 languageName: node linkType: hard @@ -354,7 +354,7 @@ __metadata: version: 0.0.0-use.local resolution: "@examples/napi@workspace:examples/napi" dependencies: - "@emnapi/core": "npm:0.44.0" + "@emnapi/core": "npm:0.45.0" "@napi-rs/cli": "workspace:*" "@tybys/wasm-util": "npm:^0.8.0" "@types/lodash": "npm:^4.14.201" @@ -573,8 +573,8 @@ __metadata: version: 0.0.0-use.local resolution: "@napi-rs/cli@workspace:cli" dependencies: - "@emnapi/core": "npm:0.44.0" - "@emnapi/runtime": "npm:0.44.0" + "@emnapi/core": "npm:^0.45.0" + "@emnapi/runtime": "npm:^0.45.0" "@napi-rs/cross-toolchain": "npm:^0.0.14" "@octokit/rest": "npm:^20.0.2" "@tybys/wasm-util": "npm:0.8.0" @@ -582,6 +582,7 @@ __metadata: "@types/inquirer": "npm:^9.0.7" "@types/js-yaml": "npm:^4.0.9" "@types/lodash-es": "npm:^4.17.12" + "@types/node": "npm:^20.10.5" ava: "npm:^6.0.0" clipanion: "npm:^3.2.1" colorette: "npm:^2.0.20" @@ -599,9 +600,9 @@ __metadata: typanion: "npm:^3.14.0" typescript: "npm:^5.3.2" peerDependencies: - "@emnapi/runtime": 0.44.0 - "@tybys/wasm-util": 0.8.0 - emnapi: 0.44.0 + "@emnapi/runtime": ^0.45.0 + "@tybys/wasm-util": ^0.8.0 + emnapi: ^0.45.0 peerDependenciesMeta: "@emnapi/runtime": optional: true @@ -928,6 +929,7 @@ __metadata: version: 0.0.0-use.local resolution: "@napi-rs/triples@workspace:triples" dependencies: + "@types/node": "npm:^20.10.5" lodash-es: "npm:^4.17.21" ts-node: "npm:^10.9.1" typescript: "npm:^5.3.2" @@ -1889,12 +1891,12 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:^20.10.3": - version: 20.10.3 - resolution: "@types/node@npm:20.10.3" +"@types/node@npm:*, @types/node@npm:^20.10.3, @types/node@npm:^20.10.5": + version: 20.10.5 + resolution: "@types/node@npm:20.10.5" dependencies: undici-types: "npm:~5.26.4" - checksum: 7c8a0327a29d68a0bb152ae30e8c4738638515dd599064821c9d0c1884a1efa103021cd8f8c91e690cd56b0602bb6fe0e6651a5df2337bdc85e0c0f66054b2ce + checksum: be30609aae0bfe492097815f166ccc07f465220cb604647fa4e5ec05a1d16c012a41b82b5f11ecfe2485cbb479d4d20384b95b809ca0bcff6d94d5bbafa645bb languageName: node linkType: hard