diff --git a/cli/src/api/build.ts b/cli/src/api/build.ts index 5fd46c83..348c5cfc 100644 --- a/cli/src/api/build.ts +++ b/cli/src/api/build.ts @@ -861,6 +861,8 @@ class Builder { name, this.config.packageName, wasiRegisterFunctions, + this.config.wasm.initialMemory, + this.config.wasm.maximumMemory, ) + exportsCode + '\n', @@ -868,7 +870,12 @@ class Builder { ) await writeFileAsync( browserBindingPath, - createWasiBrowserBinding(name, wasiRegisterFunctions) + + createWasiBrowserBinding( + name, + wasiRegisterFunctions, + this.config.wasm.initialMemory, + this.config.wasm.maximumMemory, + ) + idents .map( (ident) => diff --git a/cli/src/api/templates/load-wasi-template.ts b/cli/src/api/templates/load-wasi-template.ts index 209c3a2d..9592def8 100644 --- a/cli/src/api/templates/load-wasi-template.ts +++ b/cli/src/api/templates/load-wasi-template.ts @@ -1,6 +1,8 @@ export const createWasiBrowserBinding = ( wasiFilename: string, wasiRegisterFunctions: string[], + initialMemory = 4000, + maximumMemory = 65536, ) => `import { instantiateNapiModuleSync as __emnapiInstantiateNapiModuleSync, getDefaultContext as __emnapiGetDefaultContext, @@ -24,10 +26,8 @@ const __wasi = new __WASI({ const __emnapiContext = __emnapiGetDefaultContext() const __sharedMemory = new WebAssembly.Memory({ - // 1Gb - initial: 16384, - // 4Gb - maximum: 65536, + initial: ${initialMemory}, + maximum: ${maximumMemory}, shared: true, }) @@ -71,6 +71,8 @@ export const createWasiBinding = ( wasmFileName: string, packageName: string, wasiRegisterFunctions: string[], + initialMemory = 4000, + maximumMemory = 65536, ) => `/* eslint-disable */ /* prettier-ignore */ @@ -97,10 +99,8 @@ const __wasi = new __nodeWASI({ const __emnapiContext = __emnapiGetDefaultContext() const __sharedMemory = new WebAssembly.Memory({ - // 1Gb - initial: 16384, - // 4Gb - maximum: 65536, + initial: ${initialMemory}, + maximum: ${maximumMemory}, shared: true, }) diff --git a/cli/src/utils/__tests__/__snapshots__/config.spec.ts.md b/cli/src/utils/__tests__/__snapshots__/config.spec.ts.md index e3c8cc5c..4eca4920 100644 --- a/cli/src/utils/__tests__/__snapshots__/config.spec.ts.md +++ b/cli/src/utils/__tests__/__snapshots__/config.spec.ts.md @@ -48,6 +48,7 @@ Generated by [AVA](https://avajs.dev). triple: 'x86_64-apple-darwin', }, ], + wasm: {}, } ## should be able to read config from napi.json @@ -94,4 +95,5 @@ Generated by [AVA](https://avajs.dev). triple: 'aarch64-apple-darwin', }, ], + wasm: {}, } diff --git a/cli/src/utils/__tests__/__snapshots__/config.spec.ts.snap b/cli/src/utils/__tests__/__snapshots__/config.spec.ts.snap index d542d762..975c7e1d 100644 Binary files a/cli/src/utils/__tests__/__snapshots__/config.spec.ts.snap and b/cli/src/utils/__tests__/__snapshots__/config.spec.ts.snap differ diff --git a/cli/src/utils/__tests__/__snapshots__/target.spec.ts.snap b/cli/src/utils/__tests__/__snapshots__/target.spec.ts.snap index fcec5bf4..c96c0ce4 100644 Binary files a/cli/src/utils/__tests__/__snapshots__/target.spec.ts.snap and b/cli/src/utils/__tests__/__snapshots__/target.spec.ts.snap differ diff --git a/cli/src/utils/__tests__/__snapshots__/typegen.spec.ts.snap b/cli/src/utils/__tests__/__snapshots__/typegen.spec.ts.snap index 541f4d14..cad503c8 100644 Binary files a/cli/src/utils/__tests__/__snapshots__/typegen.spec.ts.snap and b/cli/src/utils/__tests__/__snapshots__/typegen.spec.ts.snap differ diff --git a/cli/src/utils/__tests__/__snapshots__/version.spec.ts.snap b/cli/src/utils/__tests__/__snapshots__/version.spec.ts.snap index 5a462fcb..a9b699be 100644 Binary files a/cli/src/utils/__tests__/__snapshots__/version.spec.ts.snap and b/cli/src/utils/__tests__/__snapshots__/version.spec.ts.snap differ diff --git a/cli/src/utils/config.ts b/cli/src/utils/config.ts index e7e2398e..acc96875 100644 --- a/cli/src/utils/config.ts +++ b/cli/src/utils/config.ts @@ -42,6 +42,21 @@ export interface UserNapiConfig { */ constEnum?: boolean + /** + * wasm compilation options + */ + wasm?: { + /** + * https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/Memory + * @default 4000 pages (256MiB) + */ + initialMemory?: number + /** + * @default 65536 pages (4GiB) + */ + maximumMemory?: number + } + /** * @deprecated binaryName instead */ @@ -101,7 +116,7 @@ export interface CommonPackageJsonFields { } export type NapiConfig = Required< - Pick + Pick > & { targets: Target[] packageJson: CommonPackageJsonFields @@ -158,6 +173,7 @@ export async function readNapiConfig( targets: [], packageJson: pkgJson, npmClient: 'npm', + wasm: {}, }, omit(userNapiConfig, 'targets'), ) diff --git a/examples/napi/example.wasi-browser.js b/examples/napi/example.wasi-browser.js index 5fd277c0..c988e544 100644 --- a/examples/napi/example.wasi-browser.js +++ b/examples/napi/example.wasi-browser.js @@ -24,8 +24,8 @@ const __wasi = new __WASI({ const __emnapiContext = __emnapiGetDefaultContext() const __sharedMemory = new WebAssembly.Memory({ - initial: 1024, - maximum: 10240, + initial: 16384, + maximum: 65536, shared: true, }) @@ -188,210 +188,213 @@ function __napi_rs_initialize_modules(__napiInstance) { __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__validate_array_156']?.() - __napiInstance.exports['__napi_register__validate_buffer_157']?.() - __napiInstance.exports['__napi_register__validate_typed_array_158']?.() - __napiInstance.exports['__napi_register__validate_typed_array_slice_159']?.() + __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_160' + '__napi_register__validate_uint8_clamped_slice_163' ]?.() - __napiInstance.exports['__napi_register__validate_buffer_slice_161']?.() - __napiInstance.exports['__napi_register__validate_bigint_162']?.() - __napiInstance.exports['__napi_register__validate_boolean_163']?.() - __napiInstance.exports['__napi_register__validate_date_164']?.() - __napiInstance.exports['__napi_register__validate_date_time_165']?.() - __napiInstance.exports['__napi_register__validate_external_166']?.() - __napiInstance.exports['__napi_register__validate_function_167']?.() - __napiInstance.exports['__napi_register__validate_hash_map_168']?.() - __napiInstance.exports['__napi_register__validate_null_169']?.() - __napiInstance.exports['__napi_register__validate_undefined_170']?.() - __napiInstance.exports['__napi_register__validate_number_171']?.() - __napiInstance.exports['__napi_register__validate_promise_172']?.() - __napiInstance.exports['__napi_register__validate_string_173']?.() - __napiInstance.exports['__napi_register__validate_symbol_174']?.() - __napiInstance.exports['__napi_register__validate_optional_175']?.() - __napiInstance.exports['__napi_register__return_undefined_if_invalid_176']?.() + __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_177' + '__napi_register__return_undefined_if_invalid_promise_180' ]?.() - __napiInstance.exports['__napi_register__ts_rename_178']?.() + __napiInstance.exports['__napi_register__ts_rename_181']?.() __napiInstance.exports[ - '__napi_register__override_individual_arg_on_function_179' + '__napi_register__override_individual_arg_on_function_182' ]?.() __napiInstance.exports[ - '__napi_register__override_individual_arg_on_function_with_cb_arg_180' + '__napi_register__override_individual_arg_on_function_with_cb_arg_183' ]?.() - __napiInstance.exports['__napi_register__call0_181']?.() - __napiInstance.exports['__napi_register__call1_182']?.() - __napiInstance.exports['__napi_register__call2_183']?.() - __napiInstance.exports['__napi_register__apply0_184']?.() - __napiInstance.exports['__napi_register__apply1_185']?.() - __napiInstance.exports['__napi_register__call_function_186']?.() - __napiInstance.exports['__napi_register__call_function_with_arg_187']?.() + __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_188' + '__napi_register__create_reference_on_function_191' ]?.() __napiInstance.exports[ - '__napi_register__call_function_with_arg_and_ctx_189' + '__napi_register__call_function_with_arg_and_ctx_192' ]?.() - __napiInstance.exports['__napi_register__reference_as_callback_190']?.() + __napiInstance.exports['__napi_register__reference_as_callback_193']?.() __napiInstance.exports[ - '__napi_register__build_threadsafe_function_from_function_191' + '__napi_register__build_threadsafe_function_from_function_194' ]?.() - __napiInstance.exports['__napi_register__Fib_struct_192']?.() - __napiInstance.exports['__napi_register__Fib_impl_193']?.() - __napiInstance.exports['__napi_register__Fib_impl_195']?.() - __napiInstance.exports['__napi_register__Fib2_struct_196']?.() - __napiInstance.exports['__napi_register__Fib2_impl_197']?.() - __napiInstance.exports['__napi_register__Fib2_impl_199']?.() - __napiInstance.exports['__napi_register__Fib3_struct_200']?.() - __napiInstance.exports['__napi_register__Fib3_impl_201']?.() - __napiInstance.exports['__napi_register__ALIGNMENT_202']?.() - __napiInstance.exports['__napi_register__xxh64_203']?.() - __napiInstance.exports['__napi_register__xxh128_204']?.() - __napiInstance.exports['__napi_register__Xxh3_struct_205']?.() - __napiInstance.exports['__napi_register__Xxh3_impl_209']?.() - __napiInstance.exports['__napi_register__xxh2_plus_210']?.() - __napiInstance.exports['__napi_register__xxh3_xxh64_alias_211']?.() - __napiInstance.exports['__napi_register__xxh64_alias_212']?.() - __napiInstance.exports['__napi_register__get_mapping_213']?.() - __napiInstance.exports['__napi_register__sum_mapping_214']?.() - __napiInstance.exports['__napi_register__get_btree_mapping_215']?.() - __napiInstance.exports['__napi_register__sum_btree_mapping_216']?.() - __napiInstance.exports['__napi_register__get_index_mapping_217']?.() - __napiInstance.exports['__napi_register__sum_index_mapping_218']?.() - __napiInstance.exports['__napi_register__indexmap_passthrough_219']?.() - __napiInstance.exports['__napi_register__map_option_220']?.() - __napiInstance.exports['__napi_register__return_null_221']?.() - __napiInstance.exports['__napi_register__return_undefined_222']?.() - __napiInstance.exports['__napi_register__UseNullableStruct_struct_223']?.() - __napiInstance.exports['__napi_register__NotUseNullableStruct_struct_224']?.() + __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_225' + '__napi_register__DefaultUseNullableStruct_struct_228' ]?.() - __napiInstance.exports['__napi_register__UseNullableClass_struct_226']?.() - __napiInstance.exports['__napi_register__NotUseNullableClass_struct_227']?.() + __napiInstance.exports['__napi_register__UseNullableClass_struct_229']?.() + __napiInstance.exports['__napi_register__NotUseNullableClass_struct_230']?.() __napiInstance.exports[ - '__napi_register__DefaultUseNullableClass_struct_228' + '__napi_register__DefaultUseNullableClass_struct_231' ]?.() - __napiInstance.exports['__napi_register__add_229']?.() - __napiInstance.exports['__napi_register__fibonacci_230']?.() - __napiInstance.exports['__napi_register__list_obj_keys_231']?.() - __napiInstance.exports['__napi_register__create_obj_232']?.() - __napiInstance.exports['__napi_register__get_global_233']?.() - __napiInstance.exports['__napi_register__get_undefined_234']?.() - __napiInstance.exports['__napi_register__get_null_235']?.() - __napiInstance.exports['__napi_register__AllOptionalObject_struct_236']?.() - __napiInstance.exports['__napi_register__receive_all_optional_object_237']?.() - __napiInstance.exports['__napi_register__AliasedEnum_238']?.() + __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_239' + '__napi_register__StructContainsAliasedEnum_struct_242' ]?.() - __napiInstance.exports['__napi_register__fn_received_aliased_240']?.() - __napiInstance.exports['__napi_register__StrictObject_struct_241']?.() - __napiInstance.exports['__napi_register__receive_strict_object_242']?.() - __napiInstance.exports['__napi_register__get_str_from_object_243']?.() - __napiInstance.exports['__napi_register__TsTypeChanged_struct_244']?.() - __napiInstance.exports['__napi_register__create_obj_with_property_245']?.() - __napiInstance.exports['__napi_register__getter_from_obj_246']?.() - __napiInstance.exports['__napi_register__ObjectOnlyFromJs_struct_247']?.() - __napiInstance.exports['__napi_register__receive_object_only_from_js_248']?.() + __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_249' + '__napi_register__object_get_named_property_should_perform_typecheck_252' ]?.() - __napiInstance.exports['__napi_register__ObjectOnlyToJs_struct_250']?.() - __napiInstance.exports['__napi_register__return_object_only_to_js_251']?.() - __napiInstance.exports['__napi_register__async_plus_100_252']?.() - __napiInstance.exports['__napi_register__JsRepo_struct_253']?.() - __napiInstance.exports['__napi_register__JsRepo_impl_256']?.() - __napiInstance.exports['__napi_register__JsRemote_struct_257']?.() - __napiInstance.exports['__napi_register__JsRemote_impl_260']?.() - __napiInstance.exports['__napi_register__CSSRuleList_struct_261']?.() - __napiInstance.exports['__napi_register__CSSRuleList_impl_265']?.() - __napiInstance.exports['__napi_register__CSSStyleSheet_struct_266']?.() - __napiInstance.exports['__napi_register__AnotherCSSStyleSheet_struct_267']?.() - __napiInstance.exports['__napi_register__AnotherCSSStyleSheet_impl_269']?.() - __napiInstance.exports['__napi_register__CSSStyleSheet_impl_273']?.() - __napiInstance.exports['__napi_register__PackageJson_struct_274']?.() - __napiInstance.exports['__napi_register__read_package_json_275']?.() - __napiInstance.exports['__napi_register__get_package_json_name_276']?.() - __napiInstance.exports['__napi_register__test_serde_roundtrip_277']?.() + __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_278' + '__napi_register__test_serde_big_number_precision_281' ]?.() - __napiInstance.exports['__napi_register__return_from_shared_crate_279']?.() - __napiInstance.exports['__napi_register__contains_280']?.() - __napiInstance.exports['__napi_register__concat_str_281']?.() - __napiInstance.exports['__napi_register__concat_utf16_282']?.() - __napiInstance.exports['__napi_register__concat_latin1_283']?.() - __napiInstance.exports['__napi_register__roundtrip_str_284']?.() - __napiInstance.exports['__napi_register__set_symbol_in_obj_285']?.() - __napiInstance.exports['__napi_register__create_symbol_286']?.() - __napiInstance.exports['__napi_register__create_symbol_for_287']?.() - __napiInstance.exports['__napi_register__DelaySum_impl_288']?.() - __napiInstance.exports['__napi_register__without_abort_controller_289']?.() - __napiInstance.exports['__napi_register__with_abort_controller_290']?.() - __napiInstance.exports['__napi_register__AsyncTaskVoidReturn_impl_291']?.() - __napiInstance.exports['__napi_register__async_task_void_return_292']?.() + __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_293' + '__napi_register__AsyncTaskOptionalReturn_impl_296' ]?.() - __napiInstance.exports['__napi_register__async_task_optional_return_294']?.() - __napiInstance.exports['__napi_register__call_threadsafe_function_295']?.() + __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_296' + '__napi_register__call_long_threadsafe_function_299' ]?.() __napiInstance.exports[ - '__napi_register__threadsafe_function_throw_error_297' + '__napi_register__threadsafe_function_throw_error_300' ]?.() __napiInstance.exports[ - '__napi_register__threadsafe_function_fatal_mode_298' + '__napi_register__threadsafe_function_fatal_mode_301' ]?.() __napiInstance.exports[ - '__napi_register__threadsafe_function_fatal_mode_error_299' + '__napi_register__threadsafe_function_fatal_mode_error_302' ]?.() __napiInstance.exports[ - '__napi_register__threadsafe_function_closure_capture_300' + '__napi_register__threadsafe_function_closure_capture_303' ]?.() - __napiInstance.exports['__napi_register__tsfn_call_with_callback_301']?.() - __napiInstance.exports['__napi_register__tsfn_async_call_302']?.() - __napiInstance.exports['__napi_register__accept_threadsafe_function_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_304' + '__napi_register__accept_threadsafe_function_fatal_307' ]?.() __napiInstance.exports[ - '__napi_register__accept_threadsafe_function_tuple_args_305' + '__napi_register__accept_threadsafe_function_tuple_args_308' ]?.() - __napiInstance.exports['__napi_register__tsfn_return_promise_306']?.() - __napiInstance.exports['__napi_register__tsfn_return_promise_timeout_307']?.() - __napiInstance.exports['__napi_register__tsfn_throw_from_js_308']?.() - __napiInstance.exports['__napi_register__get_buffer_309']?.() - __napiInstance.exports['__napi_register__append_buffer_310']?.() - __napiInstance.exports['__napi_register__get_empty_buffer_311']?.() - __napiInstance.exports['__napi_register__convert_u32_array_312']?.() - __napiInstance.exports['__napi_register__create_external_typed_array_313']?.() - __napiInstance.exports['__napi_register__mutate_typed_array_314']?.() - __napiInstance.exports['__napi_register__deref_uint8_array_315']?.() - __napiInstance.exports['__napi_register__buffer_pass_through_316']?.() - __napiInstance.exports['__napi_register__array_buffer_pass_through_317']?.() - __napiInstance.exports['__napi_register__accept_slice_318']?.() - __napiInstance.exports['__napi_register__u8_array_to_array_319']?.() - __napiInstance.exports['__napi_register__i8_array_to_array_320']?.() - __napiInstance.exports['__napi_register__u16_array_to_array_321']?.() - __napiInstance.exports['__napi_register__i16_array_to_array_322']?.() - __napiInstance.exports['__napi_register__u32_array_to_array_323']?.() - __napiInstance.exports['__napi_register__i32_array_to_array_324']?.() - __napiInstance.exports['__napi_register__f32_array_to_array_325']?.() - __napiInstance.exports['__napi_register__f64_array_to_array_326']?.() - __napiInstance.exports['__napi_register__u64_array_to_array_327']?.() - __napiInstance.exports['__napi_register__i64_array_to_array_328']?.() - __napiInstance.exports['__napi_register__accept_uint8_clamped_slice_329']?.() + __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_330' + '__napi_register__accept_uint8_clamped_slice_and_buffer_slice_333' ]?.() - __napiInstance.exports['__napi_register__AsyncBuffer_impl_331']?.() - __napiInstance.exports['__napi_register__async_reduce_buffer_332']?.() - __napiInstance.exports['__napi_register__async_buffer_to_array_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']?.() } export const Animal = __napiModule.exports.Animal export const AnimalWithDefaultConstructor = @@ -504,6 +507,8 @@ export const createObj = __napiModule.exports.createObj export const createObjectWithClassField = __napiModule.exports.createObjectWithClassField export const createObjWithProperty = __napiModule.exports.createObjWithProperty +export const createOptionalExternal = + __napiModule.exports.createOptionalExternal export const createReferenceOnFunction = __napiModule.exports.createReferenceOnFunction export const createSymbol = __napiModule.exports.createSymbol @@ -539,6 +544,7 @@ export const getNestedNumArr = __napiModule.exports.getNestedNumArr export const getNull = __napiModule.exports.getNull export const getNumArr = __napiModule.exports.getNumArr export const getNums = __napiModule.exports.getNums +export const getOptionalExternal = __napiModule.exports.getOptionalExternal export const getPackageJsonName = __napiModule.exports.getPackageJsonName export const getStrFromObject = __napiModule.exports.getStrFromObject export const getterFromObj = __napiModule.exports.getterFromObj @@ -553,6 +559,8 @@ export const Kind = __napiModule.exports.Kind export const listObjKeys = __napiModule.exports.listObjKeys export const mapOption = __napiModule.exports.mapOption export const mutateExternal = __napiModule.exports.mutateExternal +export const mutateOptionalExternal = + __napiModule.exports.mutateOptionalExternal export const mutateTypedArray = __napiModule.exports.mutateTypedArray export const objectGetNamedPropertyShouldPerformTypecheck = __napiModule.exports.objectGetNamedPropertyShouldPerformTypecheck diff --git a/examples/napi/example.wasi.cjs b/examples/napi/example.wasi.cjs index cdea31a5..e1dbf30a 100644 --- a/examples/napi/example.wasi.cjs +++ b/examples/napi/example.wasi.cjs @@ -25,7 +25,6 @@ const __emnapiContext = __emnapiGetDefaultContext() const __sharedMemory = new WebAssembly.Memory({ initial: 16384, - // 4Gb maximum: 65536, shared: true, }) @@ -184,168 +183,171 @@ function __napi_rs_initialize_modules(__napiInstance) { __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__validate_array_156']?.() - __napiInstance.exports['__napi_register__validate_buffer_157']?.() - __napiInstance.exports['__napi_register__validate_typed_array_158']?.() - __napiInstance.exports['__napi_register__validate_typed_array_slice_159']?.() - __napiInstance.exports['__napi_register__validate_uint8_clamped_slice_160']?.() - __napiInstance.exports['__napi_register__validate_buffer_slice_161']?.() - __napiInstance.exports['__napi_register__validate_bigint_162']?.() - __napiInstance.exports['__napi_register__validate_boolean_163']?.() - __napiInstance.exports['__napi_register__validate_date_164']?.() - __napiInstance.exports['__napi_register__validate_date_time_165']?.() - __napiInstance.exports['__napi_register__validate_external_166']?.() - __napiInstance.exports['__napi_register__validate_function_167']?.() - __napiInstance.exports['__napi_register__validate_hash_map_168']?.() - __napiInstance.exports['__napi_register__validate_null_169']?.() - __napiInstance.exports['__napi_register__validate_undefined_170']?.() - __napiInstance.exports['__napi_register__validate_number_171']?.() - __napiInstance.exports['__napi_register__validate_promise_172']?.() - __napiInstance.exports['__napi_register__validate_string_173']?.() - __napiInstance.exports['__napi_register__validate_symbol_174']?.() - __napiInstance.exports['__napi_register__validate_optional_175']?.() - __napiInstance.exports['__napi_register__return_undefined_if_invalid_176']?.() - __napiInstance.exports['__napi_register__return_undefined_if_invalid_promise_177']?.() - __napiInstance.exports['__napi_register__ts_rename_178']?.() - __napiInstance.exports['__napi_register__override_individual_arg_on_function_179']?.() - __napiInstance.exports['__napi_register__override_individual_arg_on_function_with_cb_arg_180']?.() - __napiInstance.exports['__napi_register__call0_181']?.() - __napiInstance.exports['__napi_register__call1_182']?.() - __napiInstance.exports['__napi_register__call2_183']?.() - __napiInstance.exports['__napi_register__apply0_184']?.() - __napiInstance.exports['__napi_register__apply1_185']?.() - __napiInstance.exports['__napi_register__call_function_186']?.() - __napiInstance.exports['__napi_register__call_function_with_arg_187']?.() - __napiInstance.exports['__napi_register__create_reference_on_function_188']?.() - __napiInstance.exports['__napi_register__call_function_with_arg_and_ctx_189']?.() - __napiInstance.exports['__napi_register__reference_as_callback_190']?.() - __napiInstance.exports['__napi_register__build_threadsafe_function_from_function_191']?.() - __napiInstance.exports['__napi_register__Fib_struct_192']?.() - __napiInstance.exports['__napi_register__Fib_impl_193']?.() - __napiInstance.exports['__napi_register__Fib_impl_195']?.() - __napiInstance.exports['__napi_register__Fib2_struct_196']?.() - __napiInstance.exports['__napi_register__Fib2_impl_197']?.() - __napiInstance.exports['__napi_register__Fib2_impl_199']?.() - __napiInstance.exports['__napi_register__Fib3_struct_200']?.() - __napiInstance.exports['__napi_register__Fib3_impl_201']?.() - __napiInstance.exports['__napi_register__ALIGNMENT_202']?.() - __napiInstance.exports['__napi_register__xxh64_203']?.() - __napiInstance.exports['__napi_register__xxh128_204']?.() - __napiInstance.exports['__napi_register__Xxh3_struct_205']?.() - __napiInstance.exports['__napi_register__Xxh3_impl_209']?.() - __napiInstance.exports['__napi_register__xxh2_plus_210']?.() - __napiInstance.exports['__napi_register__xxh3_xxh64_alias_211']?.() - __napiInstance.exports['__napi_register__xxh64_alias_212']?.() - __napiInstance.exports['__napi_register__get_mapping_213']?.() - __napiInstance.exports['__napi_register__sum_mapping_214']?.() - __napiInstance.exports['__napi_register__get_btree_mapping_215']?.() - __napiInstance.exports['__napi_register__sum_btree_mapping_216']?.() - __napiInstance.exports['__napi_register__get_index_mapping_217']?.() - __napiInstance.exports['__napi_register__sum_index_mapping_218']?.() - __napiInstance.exports['__napi_register__indexmap_passthrough_219']?.() - __napiInstance.exports['__napi_register__map_option_220']?.() - __napiInstance.exports['__napi_register__return_null_221']?.() - __napiInstance.exports['__napi_register__return_undefined_222']?.() - __napiInstance.exports['__napi_register__UseNullableStruct_struct_223']?.() - __napiInstance.exports['__napi_register__NotUseNullableStruct_struct_224']?.() - __napiInstance.exports['__napi_register__DefaultUseNullableStruct_struct_225']?.() - __napiInstance.exports['__napi_register__UseNullableClass_struct_226']?.() - __napiInstance.exports['__napi_register__NotUseNullableClass_struct_227']?.() - __napiInstance.exports['__napi_register__DefaultUseNullableClass_struct_228']?.() - __napiInstance.exports['__napi_register__add_229']?.() - __napiInstance.exports['__napi_register__fibonacci_230']?.() - __napiInstance.exports['__napi_register__list_obj_keys_231']?.() - __napiInstance.exports['__napi_register__create_obj_232']?.() - __napiInstance.exports['__napi_register__get_global_233']?.() - __napiInstance.exports['__napi_register__get_undefined_234']?.() - __napiInstance.exports['__napi_register__get_null_235']?.() - __napiInstance.exports['__napi_register__AllOptionalObject_struct_236']?.() - __napiInstance.exports['__napi_register__receive_all_optional_object_237']?.() - __napiInstance.exports['__napi_register__AliasedEnum_238']?.() - __napiInstance.exports['__napi_register__StructContainsAliasedEnum_struct_239']?.() - __napiInstance.exports['__napi_register__fn_received_aliased_240']?.() - __napiInstance.exports['__napi_register__StrictObject_struct_241']?.() - __napiInstance.exports['__napi_register__receive_strict_object_242']?.() - __napiInstance.exports['__napi_register__get_str_from_object_243']?.() - __napiInstance.exports['__napi_register__TsTypeChanged_struct_244']?.() - __napiInstance.exports['__napi_register__create_obj_with_property_245']?.() - __napiInstance.exports['__napi_register__getter_from_obj_246']?.() - __napiInstance.exports['__napi_register__ObjectOnlyFromJs_struct_247']?.() - __napiInstance.exports['__napi_register__receive_object_only_from_js_248']?.() - __napiInstance.exports['__napi_register__object_get_named_property_should_perform_typecheck_249']?.() - __napiInstance.exports['__napi_register__ObjectOnlyToJs_struct_250']?.() - __napiInstance.exports['__napi_register__return_object_only_to_js_251']?.() - __napiInstance.exports['__napi_register__async_plus_100_252']?.() - __napiInstance.exports['__napi_register__JsRepo_struct_253']?.() - __napiInstance.exports['__napi_register__JsRepo_impl_256']?.() - __napiInstance.exports['__napi_register__JsRemote_struct_257']?.() - __napiInstance.exports['__napi_register__JsRemote_impl_260']?.() - __napiInstance.exports['__napi_register__CSSRuleList_struct_261']?.() - __napiInstance.exports['__napi_register__CSSRuleList_impl_265']?.() - __napiInstance.exports['__napi_register__CSSStyleSheet_struct_266']?.() - __napiInstance.exports['__napi_register__AnotherCSSStyleSheet_struct_267']?.() - __napiInstance.exports['__napi_register__AnotherCSSStyleSheet_impl_269']?.() - __napiInstance.exports['__napi_register__CSSStyleSheet_impl_273']?.() - __napiInstance.exports['__napi_register__PackageJson_struct_274']?.() - __napiInstance.exports['__napi_register__read_package_json_275']?.() - __napiInstance.exports['__napi_register__get_package_json_name_276']?.() - __napiInstance.exports['__napi_register__test_serde_roundtrip_277']?.() - __napiInstance.exports['__napi_register__test_serde_big_number_precision_278']?.() - __napiInstance.exports['__napi_register__return_from_shared_crate_279']?.() - __napiInstance.exports['__napi_register__contains_280']?.() - __napiInstance.exports['__napi_register__concat_str_281']?.() - __napiInstance.exports['__napi_register__concat_utf16_282']?.() - __napiInstance.exports['__napi_register__concat_latin1_283']?.() - __napiInstance.exports['__napi_register__roundtrip_str_284']?.() - __napiInstance.exports['__napi_register__set_symbol_in_obj_285']?.() - __napiInstance.exports['__napi_register__create_symbol_286']?.() - __napiInstance.exports['__napi_register__create_symbol_for_287']?.() - __napiInstance.exports['__napi_register__DelaySum_impl_288']?.() - __napiInstance.exports['__napi_register__without_abort_controller_289']?.() - __napiInstance.exports['__napi_register__with_abort_controller_290']?.() - __napiInstance.exports['__napi_register__AsyncTaskVoidReturn_impl_291']?.() - __napiInstance.exports['__napi_register__async_task_void_return_292']?.() - __napiInstance.exports['__napi_register__AsyncTaskOptionalReturn_impl_293']?.() - __napiInstance.exports['__napi_register__async_task_optional_return_294']?.() - __napiInstance.exports['__napi_register__call_threadsafe_function_295']?.() - __napiInstance.exports['__napi_register__call_long_threadsafe_function_296']?.() - __napiInstance.exports['__napi_register__threadsafe_function_throw_error_297']?.() - __napiInstance.exports['__napi_register__threadsafe_function_fatal_mode_298']?.() - __napiInstance.exports['__napi_register__threadsafe_function_fatal_mode_error_299']?.() - __napiInstance.exports['__napi_register__threadsafe_function_closure_capture_300']?.() - __napiInstance.exports['__napi_register__tsfn_call_with_callback_301']?.() - __napiInstance.exports['__napi_register__tsfn_async_call_302']?.() - __napiInstance.exports['__napi_register__accept_threadsafe_function_303']?.() - __napiInstance.exports['__napi_register__accept_threadsafe_function_fatal_304']?.() - __napiInstance.exports['__napi_register__accept_threadsafe_function_tuple_args_305']?.() - __napiInstance.exports['__napi_register__tsfn_return_promise_306']?.() - __napiInstance.exports['__napi_register__tsfn_return_promise_timeout_307']?.() - __napiInstance.exports['__napi_register__tsfn_throw_from_js_308']?.() - __napiInstance.exports['__napi_register__get_buffer_309']?.() - __napiInstance.exports['__napi_register__append_buffer_310']?.() - __napiInstance.exports['__napi_register__get_empty_buffer_311']?.() - __napiInstance.exports['__napi_register__convert_u32_array_312']?.() - __napiInstance.exports['__napi_register__create_external_typed_array_313']?.() - __napiInstance.exports['__napi_register__mutate_typed_array_314']?.() - __napiInstance.exports['__napi_register__deref_uint8_array_315']?.() - __napiInstance.exports['__napi_register__buffer_pass_through_316']?.() - __napiInstance.exports['__napi_register__array_buffer_pass_through_317']?.() - __napiInstance.exports['__napi_register__accept_slice_318']?.() - __napiInstance.exports['__napi_register__u8_array_to_array_319']?.() - __napiInstance.exports['__napi_register__i8_array_to_array_320']?.() - __napiInstance.exports['__napi_register__u16_array_to_array_321']?.() - __napiInstance.exports['__napi_register__i16_array_to_array_322']?.() - __napiInstance.exports['__napi_register__u32_array_to_array_323']?.() - __napiInstance.exports['__napi_register__i32_array_to_array_324']?.() - __napiInstance.exports['__napi_register__f32_array_to_array_325']?.() - __napiInstance.exports['__napi_register__f64_array_to_array_326']?.() - __napiInstance.exports['__napi_register__u64_array_to_array_327']?.() - __napiInstance.exports['__napi_register__i64_array_to_array_328']?.() - __napiInstance.exports['__napi_register__accept_uint8_clamped_slice_329']?.() - __napiInstance.exports['__napi_register__accept_uint8_clamped_slice_and_buffer_slice_330']?.() - __napiInstance.exports['__napi_register__AsyncBuffer_impl_331']?.() - __napiInstance.exports['__napi_register__async_reduce_buffer_332']?.() - __napiInstance.exports['__napi_register__async_buffer_to_array_333']?.() + __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']?.() } module.exports.Animal = __napiModule.exports.Animal module.exports.AnimalWithDefaultConstructor = __napiModule.exports.AnimalWithDefaultConstructor @@ -439,6 +441,7 @@ module.exports.createExternalTypedArray = __napiModule.exports.createExternalTyp module.exports.createObj = __napiModule.exports.createObj module.exports.createObjectWithClassField = __napiModule.exports.createObjectWithClassField module.exports.createObjWithProperty = __napiModule.exports.createObjWithProperty +module.exports.createOptionalExternal = __napiModule.exports.createOptionalExternal module.exports.createReferenceOnFunction = __napiModule.exports.createReferenceOnFunction module.exports.createSymbol = __napiModule.exports.createSymbol module.exports.createSymbolFor = __napiModule.exports.createSymbolFor @@ -473,6 +476,7 @@ module.exports.getNestedNumArr = __napiModule.exports.getNestedNumArr module.exports.getNull = __napiModule.exports.getNull module.exports.getNumArr = __napiModule.exports.getNumArr module.exports.getNums = __napiModule.exports.getNums +module.exports.getOptionalExternal = __napiModule.exports.getOptionalExternal module.exports.getPackageJsonName = __napiModule.exports.getPackageJsonName module.exports.getStrFromObject = __napiModule.exports.getStrFromObject module.exports.getterFromObj = __napiModule.exports.getterFromObj @@ -487,6 +491,7 @@ module.exports.Kind = __napiModule.exports.Kind module.exports.listObjKeys = __napiModule.exports.listObjKeys module.exports.mapOption = __napiModule.exports.mapOption module.exports.mutateExternal = __napiModule.exports.mutateExternal +module.exports.mutateOptionalExternal = __napiModule.exports.mutateOptionalExternal module.exports.mutateTypedArray = __napiModule.exports.mutateTypedArray module.exports.objectGetNamedPropertyShouldPerformTypecheck = __napiModule.exports.objectGetNamedPropertyShouldPerformTypecheck module.exports.optionEnd = __napiModule.exports.optionEnd diff --git a/examples/napi/package.json b/examples/napi/package.json index 46c94324..7c84ac45 100644 --- a/examples/napi/package.json +++ b/examples/napi/package.json @@ -11,7 +11,10 @@ "test": "cross-env TS_NODE_PROJECT=./tsconfig.json node --es-module-specifier-resolution=node --loader ts-node/esm/transpile-only --experimental-wasi-unstable-preview1 ../../node_modules/ava/entrypoints/cli.mjs" }, "napi": { - "binaryName": "example" + "binaryName": "example", + "wasm": { + "initialMemory": 16384 + } }, "devDependencies": { "@napi-rs/cli": "workspace:*",