feat: add wasm runtime package (#1904)

This commit is contained in:
LongYinan 2024-01-16 23:28:40 +08:00 committed by GitHub
parent ddeaf30f14
commit 120accd965
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 4436 additions and 180 deletions

View file

@ -25,7 +25,7 @@ build_and_test: &BUILD_AND_TEST
yarn --version yarn --version
test_script: test_script:
- yarn install --immutable --mode=skip-build - yarn install --immutable --mode=skip-build
- yarn build - yarn lerna run build --scope '@napi-rs/*' --ignore '@napi-rs/wasm-runtime'
- cargo test -p napi-sys --lib -- --nocapture - cargo test -p napi-sys --lib -- --nocapture
- yarn build:test - yarn build:test
- yarn test --verbose - yarn test --verbose

View file

@ -205,7 +205,7 @@ overrides:
- '@typescript-eslint' - '@typescript-eslint'
parserOptions: parserOptions:
project: project:
- ./examples/tsconfig.json - ./tsconfig.json
rules: rules:
'import/order': 'import/order':
[ [

View file

@ -0,0 +1,49 @@
diff --git a/index.js b/index.js
index 7a0e9c2a123bc9d26c20bb3de4a3c4e49b24ee40..b1a53729c2900ddfca88a0f312a785c51a5aac80 100644
--- a/index.js
+++ b/index.js
@@ -8,19 +8,17 @@
'use strict'
-const base64 = require('base64-js')
-const ieee754 = require('ieee754')
+import * as base64 from 'base64-js'
+import * as ieee754 from 'ieee754'
const customInspectSymbol =
(typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation
? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
: null
-exports.Buffer = Buffer
-exports.SlowBuffer = SlowBuffer
-exports.INSPECT_MAX_BYTES = 50
+const INSPECT_MAX_BYTES = 50
const K_MAX_LENGTH = 0x7fffffff
-exports.kMaxLength = K_MAX_LENGTH
+const kMaxLength = K_MAX_LENGTH
/**
* If `Buffer.TYPED_ARRAY_SUPPORT`:
@@ -616,7 +614,7 @@ Buffer.prototype.equals = function equals (b) {
Buffer.prototype.inspect = function inspect () {
let str = ''
- const max = exports.INSPECT_MAX_BYTES
+ const max = INSPECT_MAX_BYTES
str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
if (this.length > max) str += ' ... '
return '<Buffer ' + str + '>'
@@ -2104,3 +2102,10 @@ function defineBigIntMethod (fn) {
function BufferBigIntNotDefined () {
throw new Error('BigInt not supported')
}
+
+export {
+ Buffer,
+ SlowBuffer,
+ INSPECT_MAX_BYTES,
+ kMaxLength,
+}
\ No newline at end of file

File diff suppressed because one or more lines are too long

View file

@ -1,10 +1,12 @@
export const createWasiBrowserBinding = ( export const createWasiBrowserBinding = (
wasiFilename: string, wasiFilename: string,
wasiRegisterFunctions: string[], wasiRegisterFunctions: string[],
) => `import { instantiateNapiModuleSync as __emnapiInstantiateNapiModuleSync } from '@emnapi/core' ) => `import {
import { getDefaultContext as __emnapiGetDefaultContext } from '@emnapi/runtime' instantiateNapiModuleSync as __emnapiInstantiateNapiModuleSync,
import { WASI as __WASI } from '@tybys/wasm-util' getDefaultContext as __emnapiGetDefaultContext,
import { Volume as __Volume, createFsFromVolume as __createFsFromVolume } from 'memfs-browser' WASI as __WASI,
} from '@napi-rs/wasm-runtime'
import { Volume as __Volume, createFsFromVolume as __createFsFromVolume } from '@napi-rs/wasm-runtime/fs'
import __wasmUrl from './${wasiFilename}.wasm?url' import __wasmUrl from './${wasiFilename}.wasm?url'

View file

@ -51,9 +51,8 @@ globalThis.onmessage = function (e) {
}; };
` `
export const WASI_WORKER_BROWSER_TEMPLATE = `import { instantiateNapiModuleSync, MessageHandler } from '@emnapi/core' export const WASI_WORKER_BROWSER_TEMPLATE = `import { instantiateNapiModuleSync, MessageHandler, WASI } from '@napi-rs/wasm-runtime'
import { WASI } from '@tybys/wasm-util' import { Volume, createFsFromVolume } from '@napi-rs/wasm-runtime/fs'
import { Volume, createFsFromVolume } from 'memfs-browser'
const fs = createFsFromVolume( const fs = createFsFromVolume(
Volume.fromJSON({ Volume.fromJSON({

View file

@ -10,6 +10,7 @@ Generated by [AVA](https://avajs.dev).
[ [
'@napi-rs/cli', '@napi-rs/cli',
'@napi-rs/wasm-runtime',
'@types/lodash', '@types/lodash',
'@vitest/browser', '@vitest/browser',
'@vitest/ui', '@vitest/ui',
@ -17,7 +18,6 @@ Generated by [AVA](https://avajs.dev).
'cross-env', 'cross-env',
'electron', 'electron',
'lodash', 'lodash',
'memfs-browser',
'sinon', 'sinon',
'vite', 'vite',
'vite-plugin-node-polyfills', 'vite-plugin-node-polyfills',

View file

@ -2,12 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/png" href="https://napi.rs/img/favicon.png" /> <title>Vite Playground</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <script type="module" src="./vite-entry.js"></script>
<title>NAPI-RS examples playground</title>
</head> </head>
<body>
<div id="app" />
</body>
</html> </html>

View file

@ -1,10 +1,12 @@
import { instantiateNapiModuleSync as __emnapiInstantiateNapiModuleSync } from '@emnapi/core' import {
import { getDefaultContext as __emnapiGetDefaultContext } from '@emnapi/runtime' instantiateNapiModuleSync as __emnapiInstantiateNapiModuleSync,
import { WASI as __WASI } from '@tybys/wasm-util' getDefaultContext as __emnapiGetDefaultContext,
WASI as __WASI,
} from '@napi-rs/wasm-runtime'
import { import {
Volume as __Volume, Volume as __Volume,
createFsFromVolume as __createFsFromVolume, createFsFromVolume as __createFsFromVolume,
} from 'memfs-browser' } from '@napi-rs/wasm-runtime/fs'
import __wasmUrl from './index.wasm?url' import __wasmUrl from './index.wasm?url'

View file

@ -8,15 +8,19 @@ const __nodePath = require('node:path')
const { WASI: __nodeWASI } = require('node:wasi') const { WASI: __nodeWASI } = require('node:wasi')
const { Worker } = require('node:worker_threads') const { Worker } = require('node:worker_threads')
const { instantiateNapiModuleSync: __emnapiInstantiateNapiModuleSync } = require('@emnapi/core') const {
const { getDefaultContext: __emnapiGetDefaultContext } = require('@emnapi/runtime') instantiateNapiModuleSync: __emnapiInstantiateNapiModuleSync,
} = require('@emnapi/core')
const {
getDefaultContext: __emnapiGetDefaultContext,
} = require('@emnapi/runtime')
const __wasi = new __nodeWASI({ const __wasi = new __nodeWASI({
version: 'preview1', version: 'preview1',
env: process.env, env: process.env,
preopens: { preopens: {
'/': '/' '/': '/',
} },
}) })
const __emnapiContext = __emnapiGetDefaultContext() const __emnapiContext = __emnapiGetDefaultContext()
@ -33,14 +37,23 @@ if (!__nodeFs.existsSync(__wasmFilePath)) {
try { try {
__wasmFilePath = __nodePath.resolve('@examples/napi-wasm32-wasi') __wasmFilePath = __nodePath.resolve('@examples/napi-wasm32-wasi')
} catch { } catch {
throw new Error('Cannot find index.wasm file, and @examples/napi-wasm32-wasi package is not installed.') 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), { const {
instance: __napiInstance,
module: __wasiModule,
napiModule: __napiModule,
} = __emnapiInstantiateNapiModuleSync(__nodeFs.readFileSync(__wasmFilePath), {
context: __emnapiContext, context: __emnapiContext,
asyncWorkPoolSize: (function() { asyncWorkPoolSize: (function () {
const threadsSizeFromEnv = Number(process.env.NAPI_RS_ASYNC_WORK_POOL_SIZE ?? process.env.UV_THREADPOOL_SIZE) const threadsSizeFromEnv = Number(
process.env.NAPI_RS_ASYNC_WORK_POOL_SIZE ??
process.env.UV_THREADPOOL_SIZE,
)
// NaN > 0 is false // NaN > 0 is false
if (threadsSizeFromEnv > 0) { if (threadsSizeFromEnv > 0) {
return threadsSizeFromEnv return threadsSizeFromEnv
@ -66,7 +79,7 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
}, },
beforeInit({ instance }) { beforeInit({ instance }) {
__napi_rs_initialize_modules(instance) __napi_rs_initialize_modules(instance)
} },
}) })
function __napi_rs_initialize_modules(__napiInstance) { function __napi_rs_initialize_modules(__napiInstance) {
@ -95,7 +108,9 @@ function __napi_rs_initialize_modules(__napiInstance) {
__napiInstance.exports['__napi_register__read_file_21']?.() __napiInstance.exports['__napi_register__read_file_21']?.()
__napiInstance.exports['__napi_register__return_js_function_22']?.() __napiInstance.exports['__napi_register__return_js_function_22']?.()
__napiInstance.exports['__napi_register__callback_return_promise_23']?.() __napiInstance.exports['__napi_register__callback_return_promise_23']?.()
__napiInstance.exports['__napi_register__callback_return_promise_and_spawn_24']?.() __napiInstance.exports[
'__napi_register__callback_return_promise_and_spawn_24'
]?.()
__napiInstance.exports['__napi_register__capture_error_in_callback_25']?.() __napiInstance.exports['__napi_register__capture_error_in_callback_25']?.()
__napiInstance.exports['__napi_register__Animal_struct_26']?.() __napiInstance.exports['__napi_register__Animal_struct_26']?.()
__napiInstance.exports['__napi_register__Animal_impl_38']?.() __napiInstance.exports['__napi_register__Animal_impl_38']?.()
@ -108,7 +123,9 @@ function __napi_rs_initialize_modules(__napiInstance) {
__napiInstance.exports['__napi_register__Blake2bKey_struct_50']?.() __napiInstance.exports['__napi_register__Blake2bKey_struct_50']?.()
__napiInstance.exports['__napi_register__Context_struct_51']?.() __napiInstance.exports['__napi_register__Context_struct_51']?.()
__napiInstance.exports['__napi_register__Context_impl_56']?.() __napiInstance.exports['__napi_register__Context_impl_56']?.()
__napiInstance.exports['__napi_register__AnimalWithDefaultConstructor_struct_57']?.() __napiInstance.exports[
'__napi_register__AnimalWithDefaultConstructor_struct_57'
]?.()
__napiInstance.exports['__napi_register__NinjaTurtle_struct_58']?.() __napiInstance.exports['__napi_register__NinjaTurtle_struct_58']?.()
__napiInstance.exports['__napi_register__NinjaTurtle_impl_65']?.() __napiInstance.exports['__napi_register__NinjaTurtle_impl_65']?.()
__napiInstance.exports['__napi_register__JsAssets_struct_66']?.() __napiInstance.exports['__napi_register__JsAssets_struct_66']?.()
@ -117,17 +134,27 @@ function __napi_rs_initialize_modules(__napiInstance) {
__napiInstance.exports['__napi_register__JsAsset_impl_73']?.() __napiInstance.exports['__napi_register__JsAsset_impl_73']?.()
__napiInstance.exports['__napi_register__Optional_struct_74']?.() __napiInstance.exports['__napi_register__Optional_struct_74']?.()
__napiInstance.exports['__napi_register__Optional_impl_79']?.() __napiInstance.exports['__napi_register__Optional_impl_79']?.()
__napiInstance.exports['__napi_register__ObjectFieldClassInstance_struct_80']?.() __napiInstance.exports[
__napiInstance.exports['__napi_register__create_object_with_class_field_81']?.() '__napi_register__ObjectFieldClassInstance_struct_80'
__napiInstance.exports['__napi_register__receive_object_with_class_field_82']?.() ]?.()
__napiInstance.exports[
'__napi_register__create_object_with_class_field_81'
]?.()
__napiInstance.exports[
'__napi_register__receive_object_with_class_field_82'
]?.()
__napiInstance.exports['__napi_register__NotWritableClass_struct_83']?.() __napiInstance.exports['__napi_register__NotWritableClass_struct_83']?.()
__napiInstance.exports['__napi_register__NotWritableClass_impl_85']?.() __napiInstance.exports['__napi_register__NotWritableClass_impl_85']?.()
__napiInstance.exports['__napi_register__CustomFinalize_struct_86']?.() __napiInstance.exports['__napi_register__CustomFinalize_struct_86']?.()
__napiInstance.exports['__napi_register__CustomFinalize_impl_88']?.() __napiInstance.exports['__napi_register__CustomFinalize_impl_88']?.()
__napiInstance.exports['__napi_register__Width_struct_89']?.() __napiInstance.exports['__napi_register__Width_struct_89']?.()
__napiInstance.exports['__napi_register__plus_one_90']?.() __napiInstance.exports['__napi_register__plus_one_90']?.()
__napiInstance.exports['__napi_register__GetterSetterWithClosures_struct_91']?.() __napiInstance.exports[
__napiInstance.exports['__napi_register__GetterSetterWithClosures_impl_93']?.() '__napi_register__GetterSetterWithClosures_struct_91'
]?.()
__napiInstance.exports[
'__napi_register__GetterSetterWithClosures_impl_93'
]?.()
__napiInstance.exports['__napi_register__CatchOnConstructor_struct_94']?.() __napiInstance.exports['__napi_register__CatchOnConstructor_struct_94']?.()
__napiInstance.exports['__napi_register__CatchOnConstructor_impl_96']?.() __napiInstance.exports['__napi_register__CatchOnConstructor_impl_96']?.()
__napiInstance.exports['__napi_register__CatchOnConstructor2_struct_97']?.() __napiInstance.exports['__napi_register__CatchOnConstructor2_struct_97']?.()
@ -140,7 +167,9 @@ function __napi_rs_initialize_modules(__napiInstance) {
__napiInstance.exports['__napi_register__chrono_date_add_1_minute_109']?.() __napiInstance.exports['__napi_register__chrono_date_add_1_minute_109']?.()
__napiInstance.exports['__napi_register__Dates_struct_110']?.() __napiInstance.exports['__napi_register__Dates_struct_110']?.()
__napiInstance.exports['__napi_register__chrono_native_date_time_111']?.() __napiInstance.exports['__napi_register__chrono_native_date_time_111']?.()
__napiInstance.exports['__napi_register__chrono_native_date_time_return_112']?.() __napiInstance.exports[
'__napi_register__chrono_native_date_time_return_112'
]?.()
__napiInstance.exports['__napi_register__either_string_or_number_113']?.() __napiInstance.exports['__napi_register__either_string_or_number_113']?.()
__napiInstance.exports['__napi_register__return_either_114']?.() __napiInstance.exports['__napi_register__return_either_114']?.()
__napiInstance.exports['__napi_register__either3_115']?.() __napiInstance.exports['__napi_register__either3_115']?.()
@ -148,7 +177,9 @@ function __napi_rs_initialize_modules(__napiInstance) {
__napiInstance.exports['__napi_register__either4_117']?.() __napiInstance.exports['__napi_register__either4_117']?.()
__napiInstance.exports['__napi_register__JsClassForEither_struct_118']?.() __napiInstance.exports['__napi_register__JsClassForEither_struct_118']?.()
__napiInstance.exports['__napi_register__JsClassForEither_impl_120']?.() __napiInstance.exports['__napi_register__JsClassForEither_impl_120']?.()
__napiInstance.exports['__napi_register__AnotherClassForEither_struct_121']?.() __napiInstance.exports[
'__napi_register__AnotherClassForEither_struct_121'
]?.()
__napiInstance.exports['__napi_register__AnotherClassForEither_impl_123']?.() __napiInstance.exports['__napi_register__AnotherClassForEither_impl_123']?.()
__napiInstance.exports['__napi_register__receive_class_or_number_124']?.() __napiInstance.exports['__napi_register__receive_class_or_number_124']?.()
__napiInstance.exports['__napi_register__receive_mut_class_or_number_125']?.() __napiInstance.exports['__napi_register__receive_mut_class_or_number_125']?.()
@ -197,10 +228,16 @@ function __napi_rs_initialize_modules(__napiInstance) {
__napiInstance.exports['__napi_register__validate_symbol_168']?.() __napiInstance.exports['__napi_register__validate_symbol_168']?.()
__napiInstance.exports['__napi_register__validate_optional_169']?.() __napiInstance.exports['__napi_register__validate_optional_169']?.()
__napiInstance.exports['__napi_register__return_undefined_if_invalid_170']?.() __napiInstance.exports['__napi_register__return_undefined_if_invalid_170']?.()
__napiInstance.exports['__napi_register__return_undefined_if_invalid_promise_171']?.() __napiInstance.exports[
'__napi_register__return_undefined_if_invalid_promise_171'
]?.()
__napiInstance.exports['__napi_register__ts_rename_172']?.() __napiInstance.exports['__napi_register__ts_rename_172']?.()
__napiInstance.exports['__napi_register__override_individual_arg_on_function_173']?.() __napiInstance.exports[
__napiInstance.exports['__napi_register__override_individual_arg_on_function_with_cb_arg_174']?.() '__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_struct_175']?.()
__napiInstance.exports['__napi_register__Fib_impl_176']?.() __napiInstance.exports['__napi_register__Fib_impl_176']?.()
__napiInstance.exports['__napi_register__Fib_impl_178']?.() __napiInstance.exports['__napi_register__Fib_impl_178']?.()
@ -232,7 +269,9 @@ function __napi_rs_initialize_modules(__napiInstance) {
__napiInstance.exports['__napi_register__AllOptionalObject_struct_208']?.() __napiInstance.exports['__napi_register__AllOptionalObject_struct_208']?.()
__napiInstance.exports['__napi_register__receive_all_optional_object_209']?.() __napiInstance.exports['__napi_register__receive_all_optional_object_209']?.()
__napiInstance.exports['__napi_register__AliasedEnum_210']?.() __napiInstance.exports['__napi_register__AliasedEnum_210']?.()
__napiInstance.exports['__napi_register__StructContainsAliasedEnum_struct_211']?.() __napiInstance.exports[
'__napi_register__StructContainsAliasedEnum_struct_211'
]?.()
__napiInstance.exports['__napi_register__fn_received_aliased_212']?.() __napiInstance.exports['__napi_register__fn_received_aliased_212']?.()
__napiInstance.exports['__napi_register__StrictObject_struct_213']?.() __napiInstance.exports['__napi_register__StrictObject_struct_213']?.()
__napiInstance.exports['__napi_register__receive_strict_object_214']?.() __napiInstance.exports['__napi_register__receive_strict_object_214']?.()
@ -257,7 +296,9 @@ function __napi_rs_initialize_modules(__napiInstance) {
__napiInstance.exports['__napi_register__read_package_json_243']?.() __napiInstance.exports['__napi_register__read_package_json_243']?.()
__napiInstance.exports['__napi_register__get_package_json_name_244']?.() __napiInstance.exports['__napi_register__get_package_json_name_244']?.()
__napiInstance.exports['__napi_register__test_serde_roundtrip_245']?.() __napiInstance.exports['__napi_register__test_serde_roundtrip_245']?.()
__napiInstance.exports['__napi_register__test_serde_big_number_precision_246']?.() __napiInstance.exports[
'__napi_register__test_serde_big_number_precision_246'
]?.()
__napiInstance.exports['__napi_register__return_from_shared_crate_247']?.() __napiInstance.exports['__napi_register__return_from_shared_crate_247']?.()
__napiInstance.exports['__napi_register__contains_248']?.() __napiInstance.exports['__napi_register__contains_248']?.()
__napiInstance.exports['__napi_register__concat_str_249']?.() __napiInstance.exports['__napi_register__concat_str_249']?.()
@ -272,19 +313,35 @@ function __napi_rs_initialize_modules(__napiInstance) {
__napiInstance.exports['__napi_register__with_abort_controller_258']?.() __napiInstance.exports['__napi_register__with_abort_controller_258']?.()
__napiInstance.exports['__napi_register__AsyncTaskVoidReturn_impl_259']?.() __napiInstance.exports['__napi_register__AsyncTaskVoidReturn_impl_259']?.()
__napiInstance.exports['__napi_register__async_task_void_return_260']?.() __napiInstance.exports['__napi_register__async_task_void_return_260']?.()
__napiInstance.exports['__napi_register__AsyncTaskOptionalReturn_impl_261']?.() __napiInstance.exports[
'__napi_register__AsyncTaskOptionalReturn_impl_261'
]?.()
__napiInstance.exports['__napi_register__async_task_optional_return_262']?.() __napiInstance.exports['__napi_register__async_task_optional_return_262']?.()
__napiInstance.exports['__napi_register__call_threadsafe_function_263']?.() __napiInstance.exports['__napi_register__call_threadsafe_function_263']?.()
__napiInstance.exports['__napi_register__call_long_threadsafe_function_264']?.() __napiInstance.exports[
__napiInstance.exports['__napi_register__threadsafe_function_throw_error_265']?.() '__napi_register__call_long_threadsafe_function_264'
__napiInstance.exports['__napi_register__threadsafe_function_fatal_mode_266']?.() ]?.()
__napiInstance.exports['__napi_register__threadsafe_function_fatal_mode_error_267']?.() __napiInstance.exports[
__napiInstance.exports['__napi_register__threadsafe_function_closure_capture_268']?.() '__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_call_with_callback_269']?.()
__napiInstance.exports['__napi_register__tsfn_async_call_270']?.() __napiInstance.exports['__napi_register__tsfn_async_call_270']?.()
__napiInstance.exports['__napi_register__accept_threadsafe_function_271']?.() __napiInstance.exports['__napi_register__accept_threadsafe_function_271']?.()
__napiInstance.exports['__napi_register__accept_threadsafe_function_fatal_272']?.() __napiInstance.exports[
__napiInstance.exports['__napi_register__accept_threadsafe_function_tuple_args_273']?.() '__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_274']?.()
__napiInstance.exports['__napi_register__tsfn_return_promise_timeout_275']?.() __napiInstance.exports['__napi_register__tsfn_return_promise_timeout_275']?.()
__napiInstance.exports['__napi_register__tsfn_throw_from_js_276']?.() __napiInstance.exports['__napi_register__tsfn_throw_from_js_276']?.()
@ -301,8 +358,10 @@ function __napi_rs_initialize_modules(__napiInstance) {
__napiInstance.exports['__napi_register__async_reduce_buffer_287']?.() __napiInstance.exports['__napi_register__async_reduce_buffer_287']?.()
} }
module.exports.Animal = __napiModule.exports.Animal module.exports.Animal = __napiModule.exports.Animal
module.exports.AnimalWithDefaultConstructor = __napiModule.exports.AnimalWithDefaultConstructor module.exports.AnimalWithDefaultConstructor =
module.exports.AnotherClassForEither = __napiModule.exports.AnotherClassForEither __napiModule.exports.AnimalWithDefaultConstructor
module.exports.AnotherClassForEither =
__napiModule.exports.AnotherClassForEither
module.exports.AnotherCssStyleSheet = __napiModule.exports.AnotherCssStyleSheet module.exports.AnotherCssStyleSheet = __napiModule.exports.AnotherCssStyleSheet
module.exports.AnotherCSSStyleSheet = __napiModule.exports.AnotherCSSStyleSheet module.exports.AnotherCSSStyleSheet = __napiModule.exports.AnotherCSSStyleSheet
module.exports.Asset = __napiModule.exports.Asset module.exports.Asset = __napiModule.exports.Asset
@ -327,7 +386,8 @@ module.exports.Dog = __napiModule.exports.Dog
module.exports.Fib = __napiModule.exports.Fib module.exports.Fib = __napiModule.exports.Fib
module.exports.Fib2 = __napiModule.exports.Fib2 module.exports.Fib2 = __napiModule.exports.Fib2
module.exports.Fib3 = __napiModule.exports.Fib3 module.exports.Fib3 = __napiModule.exports.Fib3
module.exports.GetterSetterWithClosures = __napiModule.exports.GetterSetterWithClosures module.exports.GetterSetterWithClosures =
__napiModule.exports.GetterSetterWithClosures
module.exports.JsClassForEither = __napiModule.exports.JsClassForEither module.exports.JsClassForEither = __napiModule.exports.JsClassForEither
module.exports.JsRemote = __napiModule.exports.JsRemote module.exports.JsRemote = __napiModule.exports.JsRemote
module.exports.JsRepo = __napiModule.exports.JsRepo module.exports.JsRepo = __napiModule.exports.JsRepo
@ -336,33 +396,44 @@ module.exports.NotWritableClass = __napiModule.exports.NotWritableClass
module.exports.Optional = __napiModule.exports.Optional module.exports.Optional = __napiModule.exports.Optional
module.exports.Selector = __napiModule.exports.Selector module.exports.Selector = __napiModule.exports.Selector
module.exports.Width = __napiModule.exports.Width module.exports.Width = __napiModule.exports.Width
module.exports.acceptThreadsafeFunction = __napiModule.exports.acceptThreadsafeFunction module.exports.acceptThreadsafeFunction =
module.exports.acceptThreadsafeFunctionFatal = __napiModule.exports.acceptThreadsafeFunctionFatal __napiModule.exports.acceptThreadsafeFunction
module.exports.acceptThreadsafeFunctionTupleArgs = __napiModule.exports.acceptThreadsafeFunctionTupleArgs module.exports.acceptThreadsafeFunctionFatal =
__napiModule.exports.acceptThreadsafeFunctionFatal
module.exports.acceptThreadsafeFunctionTupleArgs =
__napiModule.exports.acceptThreadsafeFunctionTupleArgs
module.exports.add = __napiModule.exports.add module.exports.add = __napiModule.exports.add
module.exports.ALIAS = __napiModule.exports.ALIAS module.exports.ALIAS = __napiModule.exports.ALIAS
module.exports.AliasedEnum = __napiModule.exports.AliasedEnum module.exports.AliasedEnum = __napiModule.exports.AliasedEnum
module.exports.appendBuffer = __napiModule.exports.appendBuffer module.exports.appendBuffer = __napiModule.exports.appendBuffer
module.exports.arrayBufferPassThrough = __napiModule.exports.arrayBufferPassThrough module.exports.arrayBufferPassThrough =
__napiModule.exports.arrayBufferPassThrough
module.exports.asyncMultiTwo = __napiModule.exports.asyncMultiTwo module.exports.asyncMultiTwo = __napiModule.exports.asyncMultiTwo
module.exports.asyncPlus100 = __napiModule.exports.asyncPlus100 module.exports.asyncPlus100 = __napiModule.exports.asyncPlus100
module.exports.asyncReduceBuffer = __napiModule.exports.asyncReduceBuffer module.exports.asyncReduceBuffer = __napiModule.exports.asyncReduceBuffer
module.exports.asyncTaskOptionalReturn = __napiModule.exports.asyncTaskOptionalReturn module.exports.asyncTaskOptionalReturn =
__napiModule.exports.asyncTaskOptionalReturn
module.exports.asyncTaskVoidReturn = __napiModule.exports.asyncTaskVoidReturn module.exports.asyncTaskVoidReturn = __napiModule.exports.asyncTaskVoidReturn
module.exports.bigintAdd = __napiModule.exports.bigintAdd module.exports.bigintAdd = __napiModule.exports.bigintAdd
module.exports.bigintFromI128 = __napiModule.exports.bigintFromI128 module.exports.bigintFromI128 = __napiModule.exports.bigintFromI128
module.exports.bigintFromI64 = __napiModule.exports.bigintFromI64 module.exports.bigintFromI64 = __napiModule.exports.bigintFromI64
module.exports.bigintGetU64AsString = __napiModule.exports.bigintGetU64AsString module.exports.bigintGetU64AsString = __napiModule.exports.bigintGetU64AsString
module.exports.bufferPassThrough = __napiModule.exports.bufferPassThrough module.exports.bufferPassThrough = __napiModule.exports.bufferPassThrough
module.exports.callbackReturnPromise = __napiModule.exports.callbackReturnPromise module.exports.callbackReturnPromise =
module.exports.callbackReturnPromiseAndSpawn = __napiModule.exports.callbackReturnPromiseAndSpawn __napiModule.exports.callbackReturnPromise
module.exports.callLongThreadsafeFunction = __napiModule.exports.callLongThreadsafeFunction module.exports.callbackReturnPromiseAndSpawn =
module.exports.callThreadsafeFunction = __napiModule.exports.callThreadsafeFunction __napiModule.exports.callbackReturnPromiseAndSpawn
module.exports.captureErrorInCallback = __napiModule.exports.captureErrorInCallback module.exports.callLongThreadsafeFunction =
__napiModule.exports.callLongThreadsafeFunction
module.exports.callThreadsafeFunction =
__napiModule.exports.callThreadsafeFunction
module.exports.captureErrorInCallback =
__napiModule.exports.captureErrorInCallback
module.exports.chronoDateAdd1Minute = __napiModule.exports.chronoDateAdd1Minute module.exports.chronoDateAdd1Minute = __napiModule.exports.chronoDateAdd1Minute
module.exports.chronoDateToMillis = __napiModule.exports.chronoDateToMillis module.exports.chronoDateToMillis = __napiModule.exports.chronoDateToMillis
module.exports.chronoNativeDateTime = __napiModule.exports.chronoNativeDateTime module.exports.chronoNativeDateTime = __napiModule.exports.chronoNativeDateTime
module.exports.chronoNativeDateTimeReturn = __napiModule.exports.chronoNativeDateTimeReturn module.exports.chronoNativeDateTimeReturn =
__napiModule.exports.chronoNativeDateTimeReturn
module.exports.concatLatin1 = __napiModule.exports.concatLatin1 module.exports.concatLatin1 = __napiModule.exports.concatLatin1
module.exports.concatStr = __napiModule.exports.concatStr module.exports.concatStr = __napiModule.exports.concatStr
module.exports.concatUtf16 = __napiModule.exports.concatUtf16 module.exports.concatUtf16 = __napiModule.exports.concatUtf16
@ -372,10 +443,13 @@ module.exports.createBigInt = __napiModule.exports.createBigInt
module.exports.createBigIntI64 = __napiModule.exports.createBigIntI64 module.exports.createBigIntI64 = __napiModule.exports.createBigIntI64
module.exports.createExternal = __napiModule.exports.createExternal module.exports.createExternal = __napiModule.exports.createExternal
module.exports.createExternalString = __napiModule.exports.createExternalString module.exports.createExternalString = __napiModule.exports.createExternalString
module.exports.createExternalTypedArray = __napiModule.exports.createExternalTypedArray module.exports.createExternalTypedArray =
__napiModule.exports.createExternalTypedArray
module.exports.createObj = __napiModule.exports.createObj module.exports.createObj = __napiModule.exports.createObj
module.exports.createObjectWithClassField = __napiModule.exports.createObjectWithClassField module.exports.createObjectWithClassField =
module.exports.createObjWithProperty = __napiModule.exports.createObjWithProperty __napiModule.exports.createObjectWithClassField
module.exports.createObjWithProperty =
__napiModule.exports.createObjWithProperty
module.exports.createSymbol = __napiModule.exports.createSymbol module.exports.createSymbol = __napiModule.exports.createSymbol
module.exports.createSymbolFor = __napiModule.exports.createSymbolFor module.exports.createSymbolFor = __napiModule.exports.createSymbolFor
module.exports.CustomNumEnum = __napiModule.exports.CustomNumEnum module.exports.CustomNumEnum = __napiModule.exports.CustomNumEnum
@ -418,42 +492,57 @@ module.exports.optionEnd = __napiModule.exports.optionEnd
module.exports.optionOnly = __napiModule.exports.optionOnly module.exports.optionOnly = __napiModule.exports.optionOnly
module.exports.optionStart = __napiModule.exports.optionStart module.exports.optionStart = __napiModule.exports.optionStart
module.exports.optionStartEnd = __napiModule.exports.optionStartEnd module.exports.optionStartEnd = __napiModule.exports.optionStartEnd
module.exports.overrideIndividualArgOnFunction = __napiModule.exports.overrideIndividualArgOnFunction module.exports.overrideIndividualArgOnFunction =
module.exports.overrideIndividualArgOnFunctionWithCbArg = __napiModule.exports.overrideIndividualArgOnFunctionWithCbArg __napiModule.exports.overrideIndividualArgOnFunction
module.exports.overrideIndividualArgOnFunctionWithCbArg =
__napiModule.exports.overrideIndividualArgOnFunctionWithCbArg
module.exports.panic = __napiModule.exports.panic module.exports.panic = __napiModule.exports.panic
module.exports.plusOne = __napiModule.exports.plusOne module.exports.plusOne = __napiModule.exports.plusOne
module.exports.promiseInEither = __napiModule.exports.promiseInEither module.exports.promiseInEither = __napiModule.exports.promiseInEither
module.exports.readFile = __napiModule.exports.readFile module.exports.readFile = __napiModule.exports.readFile
module.exports.readFileAsync = __napiModule.exports.readFileAsync module.exports.readFileAsync = __napiModule.exports.readFileAsync
module.exports.readPackageJson = __napiModule.exports.readPackageJson module.exports.readPackageJson = __napiModule.exports.readPackageJson
module.exports.receiveAllOptionalObject = __napiModule.exports.receiveAllOptionalObject module.exports.receiveAllOptionalObject =
__napiModule.exports.receiveAllOptionalObject
module.exports.receiveClassOrNumber = __napiModule.exports.receiveClassOrNumber module.exports.receiveClassOrNumber = __napiModule.exports.receiveClassOrNumber
module.exports.receiveDifferentClass = __napiModule.exports.receiveDifferentClass module.exports.receiveDifferentClass =
module.exports.receiveMutClassOrNumber = __napiModule.exports.receiveMutClassOrNumber __napiModule.exports.receiveDifferentClass
module.exports.receiveObjectOnlyFromJs = __napiModule.exports.receiveObjectOnlyFromJs module.exports.receiveMutClassOrNumber =
module.exports.receiveObjectWithClassField = __napiModule.exports.receiveObjectWithClassField __napiModule.exports.receiveMutClassOrNumber
module.exports.receiveObjectOnlyFromJs =
__napiModule.exports.receiveObjectOnlyFromJs
module.exports.receiveObjectWithClassField =
__napiModule.exports.receiveObjectWithClassField
module.exports.receiveStrictObject = __napiModule.exports.receiveStrictObject module.exports.receiveStrictObject = __napiModule.exports.receiveStrictObject
module.exports.receiveString = __napiModule.exports.receiveString module.exports.receiveString = __napiModule.exports.receiveString
module.exports.returnEither = __napiModule.exports.returnEither module.exports.returnEither = __napiModule.exports.returnEither
module.exports.returnEitherClass = __napiModule.exports.returnEitherClass module.exports.returnEitherClass = __napiModule.exports.returnEitherClass
module.exports.returnFromSharedCrate = __napiModule.exports.returnFromSharedCrate module.exports.returnFromSharedCrate =
__napiModule.exports.returnFromSharedCrate
module.exports.returnJsFunction = __napiModule.exports.returnJsFunction module.exports.returnJsFunction = __napiModule.exports.returnJsFunction
module.exports.returnNull = __napiModule.exports.returnNull module.exports.returnNull = __napiModule.exports.returnNull
module.exports.returnUndefined = __napiModule.exports.returnUndefined module.exports.returnUndefined = __napiModule.exports.returnUndefined
module.exports.returnUndefinedIfInvalid = __napiModule.exports.returnUndefinedIfInvalid module.exports.returnUndefinedIfInvalid =
module.exports.returnUndefinedIfInvalidPromise = __napiModule.exports.returnUndefinedIfInvalidPromise __napiModule.exports.returnUndefinedIfInvalid
module.exports.returnUndefinedIfInvalidPromise =
__napiModule.exports.returnUndefinedIfInvalidPromise
module.exports.roundtripStr = __napiModule.exports.roundtripStr module.exports.roundtripStr = __napiModule.exports.roundtripStr
module.exports.runScript = __napiModule.exports.runScript module.exports.runScript = __napiModule.exports.runScript
module.exports.setSymbolInObj = __napiModule.exports.setSymbolInObj module.exports.setSymbolInObj = __napiModule.exports.setSymbolInObj
module.exports.Status = __napiModule.exports.Status module.exports.Status = __napiModule.exports.Status
module.exports.sumMapping = __napiModule.exports.sumMapping module.exports.sumMapping = __napiModule.exports.sumMapping
module.exports.sumNums = __napiModule.exports.sumNums module.exports.sumNums = __napiModule.exports.sumNums
module.exports.testSerdeBigNumberPrecision = __napiModule.exports.testSerdeBigNumberPrecision module.exports.testSerdeBigNumberPrecision =
__napiModule.exports.testSerdeBigNumberPrecision
module.exports.testSerdeRoundtrip = __napiModule.exports.testSerdeRoundtrip module.exports.testSerdeRoundtrip = __napiModule.exports.testSerdeRoundtrip
module.exports.threadsafeFunctionClosureCapture = __napiModule.exports.threadsafeFunctionClosureCapture module.exports.threadsafeFunctionClosureCapture =
module.exports.threadsafeFunctionFatalMode = __napiModule.exports.threadsafeFunctionFatalMode __napiModule.exports.threadsafeFunctionClosureCapture
module.exports.threadsafeFunctionFatalModeError = __napiModule.exports.threadsafeFunctionFatalModeError module.exports.threadsafeFunctionFatalMode =
module.exports.threadsafeFunctionThrowError = __napiModule.exports.threadsafeFunctionThrowError __napiModule.exports.threadsafeFunctionFatalMode
module.exports.threadsafeFunctionFatalModeError =
__napiModule.exports.threadsafeFunctionFatalModeError
module.exports.threadsafeFunctionThrowError =
__napiModule.exports.threadsafeFunctionThrowError
module.exports.throwAsyncError = __napiModule.exports.throwAsyncError module.exports.throwAsyncError = __napiModule.exports.throwAsyncError
module.exports.throwError = __napiModule.exports.throwError module.exports.throwError = __napiModule.exports.throwError
module.exports.throwSyntaxError = __napiModule.exports.throwSyntaxError module.exports.throwSyntaxError = __napiModule.exports.throwSyntaxError
@ -461,7 +550,8 @@ module.exports.toJsObj = __napiModule.exports.toJsObj
module.exports.tsfnAsyncCall = __napiModule.exports.tsfnAsyncCall module.exports.tsfnAsyncCall = __napiModule.exports.tsfnAsyncCall
module.exports.tsfnCallWithCallback = __napiModule.exports.tsfnCallWithCallback module.exports.tsfnCallWithCallback = __napiModule.exports.tsfnCallWithCallback
module.exports.tsfnReturnPromise = __napiModule.exports.tsfnReturnPromise module.exports.tsfnReturnPromise = __napiModule.exports.tsfnReturnPromise
module.exports.tsfnReturnPromiseTimeout = __napiModule.exports.tsfnReturnPromiseTimeout module.exports.tsfnReturnPromiseTimeout =
__napiModule.exports.tsfnReturnPromiseTimeout
module.exports.tsfnThrowFromJs = __napiModule.exports.tsfnThrowFromJs module.exports.tsfnThrowFromJs = __napiModule.exports.tsfnThrowFromJs
module.exports.tsRename = __napiModule.exports.tsRename module.exports.tsRename = __napiModule.exports.tsRename
module.exports.validateArray = __napiModule.exports.validateArray module.exports.validateArray = __napiModule.exports.validateArray
@ -482,7 +572,8 @@ module.exports.validateSymbol = __napiModule.exports.validateSymbol
module.exports.validateTypedArray = __napiModule.exports.validateTypedArray module.exports.validateTypedArray = __napiModule.exports.validateTypedArray
module.exports.validateUndefined = __napiModule.exports.validateUndefined module.exports.validateUndefined = __napiModule.exports.validateUndefined
module.exports.withAbortController = __napiModule.exports.withAbortController module.exports.withAbortController = __napiModule.exports.withAbortController
module.exports.withoutAbortController = __napiModule.exports.withoutAbortController module.exports.withoutAbortController =
__napiModule.exports.withoutAbortController
module.exports.xxh64Alias = __napiModule.exports.xxh64Alias module.exports.xxh64Alias = __napiModule.exports.xxh64Alias
module.exports.xxh2 = __napiModule.exports.xxh2 module.exports.xxh2 = __napiModule.exports.xxh2
module.exports.xxh3 = __napiModule.exports.xxh3 module.exports.xxh3 = __napiModule.exports.xxh3

View file

@ -12,6 +12,7 @@
}, },
"devDependencies": { "devDependencies": {
"@napi-rs/cli": "workspace:*", "@napi-rs/cli": "workspace:*",
"@napi-rs/wasm-runtime": "workspace:*",
"@types/lodash": "^4.14.201", "@types/lodash": "^4.14.201",
"@vitest/browser": "^1.1.3", "@vitest/browser": "^1.1.3",
"@vitest/ui": "^1.1.3", "@vitest/ui": "^1.1.3",
@ -19,7 +20,6 @@
"cross-env": "7.0.3", "cross-env": "7.0.3",
"electron": "^28.0.0", "electron": "^28.0.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"memfs-browser": "^4.6.10002",
"sinon": "^17.0.1", "sinon": "^17.0.1",
"vite": "^5.0.11", "vite": "^5.0.11",
"vite-plugin-node-polyfills": "^0.19.0", "vite-plugin-node-polyfills": "^0.19.0",

View file

@ -0,0 +1,19 @@
import {
Animal,
Kind,
asyncMultiTwo,
tsfnReturnPromise,
} from './index.wasi-browser'
console.info(new Animal(Kind.Cat, 'Tom'))
asyncMultiTwo(200).then((res) => {
console.info(res)
})
const value = await tsfnReturnPromise((err, value) => {
if (err) {
throw err
}
return Promise.resolve(value + 2)
})
console.info(value)

View file

@ -8,14 +8,9 @@ export default defineConfig({
'Cross-Origin-Embedder-Policy': 'require-corp', 'Cross-Origin-Embedder-Policy': 'require-corp',
}, },
}, },
define: {
process: {
env: {},
},
},
plugins: [ plugins: [
nodePolyfills({ nodePolyfills({
include: ['buffer', 'util', 'stream'], include: ['util'],
}), }),
{ {
name: 'configure-response-headers', name: 'configure-response-headers',

View file

@ -1,6 +1,9 @@
import { instantiateNapiModuleSync, MessageHandler } from '@emnapi/core' import {
import { WASI } from '@tybys/wasm-util' instantiateNapiModuleSync,
import { Volume, createFsFromVolume } from 'memfs-browser' MessageHandler,
WASI,
} from '@napi-rs/wasm-runtime'
import { Volume, createFsFromVolume } from '@napi-rs/wasm-runtime/fs'
const fs = createFsFromVolume( const fs = createFsFromVolume(
Volume.fromJSON({ Volume.fromJSON({
@ -16,7 +19,7 @@ const handler = new MessageHandler({
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log.apply(console, arguments) console.log.apply(console, arguments)
}, },
printErr: function() { printErr: function () {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error.apply(console, arguments) console.error.apply(console, arguments)
}, },

View file

@ -5,6 +5,7 @@
"workspaces": [ "workspaces": [
"bench", "bench",
"cli", "cli",
"wasm-runtime",
"triples", "triples",
"memory-testing", "memory-testing",
"examples/napi", "examples/napi",
@ -63,11 +64,6 @@
}, },
"devDependencies": { "devDependencies": {
"@napi-rs/cli": "workspace:*", "@napi-rs/cli": "workspace:*",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@taplo/cli": "^0.5.2", "@taplo/cli": "^0.5.2",
"@types/debug": "^4.1.12", "@types/debug": "^4.1.12",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
@ -89,6 +85,7 @@
"lint-staged": "^15.2.0", "lint-staged": "^15.2.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"prettier": "^3.1.0", "prettier": "^3.1.0",
"rollup": "^4.9.5",
"shx": "^0.3.4", "shx": "^0.3.4",
"sinon": "^17.0.1", "sinon": "^17.0.1",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
@ -96,5 +93,9 @@
"tslib": "^2.6.2", "tslib": "^2.6.2",
"typescript": "^5.3.2" "typescript": "^5.3.2"
}, },
"packageManager": "yarn@4.0.2" "packageManager": "yarn@4.0.2",
"resolutions": {
"node-inspect-extracted": "patch:node-inspect-extracted@npm%3A3.0.0#~/.yarn/patches/node-inspect-extracted-npm-3.0.0-f661b6c334.patch",
"buffer@npm:^6.0.3": "patch:buffer@npm%3A6.0.3#~/.yarn/patches/buffer-npm-6.0.3-cd90dfedfe.patch"
}
} }

View file

@ -3,6 +3,8 @@
"include": [ "include": [
"./ava.config.mjs", "./ava.config.mjs",
"./triples/index.js", "./triples/index.js",
"./wasm-runtime/*.js",
"./wasm-runtime/*.cjs",
"./memory-testing/*.js", "./memory-testing/*.js",
"./memory-testing/*.mjs", "./memory-testing/*.mjs",
"./crates/cli/index.js", "./crates/cli/index.js",

13
wasm-runtime/assert.cjs Normal file
View file

@ -0,0 +1,13 @@
function assert(condition, message) {
if (!condition) {
throw new Error(message || 'Assertion failed')
}
}
module.exports = assert
module.exports.strictEqual = function strictEqual(a, b) {
if (a !== b) {
throw new Error(`Expected ${a} to strict equal ${b}`)
}
}

5
wasm-runtime/fs.js Normal file
View file

@ -0,0 +1,5 @@
import * as memfs from 'memfs'
const { createFsFromVolume, Volume, fs } = memfs
export { createFsFromVolume, Volume, fs }

54
wasm-runtime/package.json Normal file
View file

@ -0,0 +1,54 @@
{
"name": "@napi-rs/wasm-runtime",
"version": "0.0.0",
"type": "module",
"description": "Runtime and polyfill for wasm targets",
"author": {
"name": "LongYinan",
"url": "https://github.com/Brooooooklyn"
},
"repository": {
"type": "git",
"url": "git+https://github.com/napi-rs/napi-rs.git",
"directory": "wasi-runtime"
},
"license": "MIT",
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"files": [
"dist/*.js"
],
"devDependencies": {
"@emnapi/core": "^0.45.0",
"@emnapi/runtime": "^0.45.0",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-inject": "^5.0.5",
"@rollup/plugin-json": "^6.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@tybys/wasm-util": "^0.8.1",
"buffer": "^6.0.3",
"memfs": "^4.6.0",
"node-inspect-extracted": "^3.0.0",
"path-browserify": "^1.0.1",
"process": "^0.11.10",
"readable-stream": "^4.5.2",
"rollup": "^4.9.5",
"rollup-plugin-polyfill-node": "^0.13.0",
"tslib": "^2.6.2"
},
"scripts": {
"build": "rollup -c rollup.config.js"
},
"exports": {
".": {
"import": "./dist/runtime.js"
},
"./fs": {
"import": "./dist/fs.js"
}
}
}

View file

@ -0,0 +1,70 @@
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import alias from '@rollup/plugin-alias'
import commonjs from '@rollup/plugin-commonjs'
import inject from '@rollup/plugin-inject'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import replace from '@rollup/plugin-replace'
import { defineConfig } from 'rollup'
const dirname = join(fileURLToPath(import.meta.url), '..')
export default defineConfig([
{
input: './fs.js',
plugins: [
commonjs(),
alias({
entries: [
{ find: 'path', replacement: 'path-browserify' },
{ find: 'stream', replacement: 'readable-stream' },
{ find: 'assert', replacement: join(dirname, 'assert.cjs') },
{ find: 'util', replacement: join(dirname, 'util') },
],
}),
inject({
process: ['process', 'default'],
Buffer: ['buffer', 'Buffer'],
}),
nodeResolve({
preferBuiltins: false,
mainFields: ['browser', 'module', 'main'],
}),
replace({
'process.env.NODE_ENV': '"production"',
'process.env.NODE_DEBUG': false,
global: undefined,
preventAssignment: false,
}),
],
treeshake: true,
output: {
format: 'esm',
sourcemap: 'inline',
dir: './dist',
},
},
{
input: './runtime.js',
treeshake: true,
plugins: [
replace({
process: 'null',
'process.env.NODE_ENV': '"production"',
'process.env.NODE_DEBUG_NATIVE': false,
__webpack_public_path__: undefined,
preventAssignment: false,
}),
nodeResolve({
preferBuiltins: false,
mainFields: ['browser', 'module', 'main'],
}),
],
output: {
format: 'esm',
sourcemap: 'inline',
dir: './dist',
},
},
])

3
wasm-runtime/runtime.js Normal file
View file

@ -0,0 +1,3 @@
export { instantiateNapiModuleSync, MessageHandler } from '@emnapi/core'
export { getDefaultContext } from '@emnapi/runtime'
export { WASI } from '@tybys/wasm-util'

28
wasm-runtime/util.js Normal file
View file

@ -0,0 +1,28 @@
import { inspect, format } from 'node-inspect-extracted'
function isBuffer(arg) {
return (
arg &&
typeof arg === 'object' &&
typeof arg.copy === 'function' &&
typeof arg.fill === 'function' &&
typeof arg.readUInt8 === 'function'
)
}
// borrow from https://github.com/isaacs/inherits
function inherits(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true,
},
})
}
}
export { inherits, inspect, format, isBuffer }

240
yarn.lock
View file

@ -363,6 +363,7 @@ __metadata:
dependencies: dependencies:
"@emnapi/core": "npm:0.45.0" "@emnapi/core": "npm:0.45.0"
"@napi-rs/cli": "workspace:*" "@napi-rs/cli": "workspace:*"
"@napi-rs/wasm-runtime": "workspace:*"
"@types/lodash": "npm:^4.14.201" "@types/lodash": "npm:^4.14.201"
"@vitest/browser": "npm:^1.1.3" "@vitest/browser": "npm:^1.1.3"
"@vitest/ui": "npm:^1.1.3" "@vitest/ui": "npm:^1.1.3"
@ -370,7 +371,6 @@ __metadata:
cross-env: "npm:7.0.3" cross-env: "npm:7.0.3"
electron: "npm:^28.0.0" electron: "npm:^28.0.0"
lodash: "npm:^4.17.21" lodash: "npm:^4.17.21"
memfs-browser: "npm:^4.6.10002"
sinon: "npm:^17.0.1" sinon: "npm:^17.0.1"
vite: "npm:^5.0.11" vite: "npm:^5.0.11"
vite-plugin-node-polyfills: "npm:^0.19.0" vite-plugin-node-polyfills: "npm:^0.19.0"
@ -943,6 +943,31 @@ __metadata:
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@napi-rs/wasm-runtime@workspace:*, @napi-rs/wasm-runtime@workspace:wasm-runtime":
version: 0.0.0-use.local
resolution: "@napi-rs/wasm-runtime@workspace:wasm-runtime"
dependencies:
"@emnapi/core": "npm:^0.45.0"
"@emnapi/runtime": "npm:^0.45.0"
"@rollup/plugin-alias": "npm:^5.1.0"
"@rollup/plugin-commonjs": "npm:^25.0.7"
"@rollup/plugin-inject": "npm:^5.0.5"
"@rollup/plugin-json": "npm:^6.0.1"
"@rollup/plugin-node-resolve": "npm:^15.2.3"
"@rollup/plugin-replace": "npm:^5.0.5"
"@tybys/wasm-util": "npm:^0.8.1"
buffer: "npm:^6.0.3"
memfs: "npm:^4.6.0"
node-inspect-extracted: "npm:^3.0.0"
path-browserify: "npm:^1.0.1"
process: "npm:^0.11.10"
readable-stream: "npm:^4.5.2"
rollup: "npm:^4.9.5"
rollup-plugin-polyfill-node: "npm:^0.13.0"
tslib: "npm:^2.6.2"
languageName: unknown
linkType: soft
"@nodelib/fs.scandir@npm:2.1.5": "@nodelib/fs.scandir@npm:2.1.5":
version: 2.1.5 version: 2.1.5
resolution: "@nodelib/fs.scandir@npm:2.1.5" resolution: "@nodelib/fs.scandir@npm:2.1.5"
@ -1520,7 +1545,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@rollup/plugin-inject@npm:^5.0.5": "@rollup/plugin-inject@npm:^5.0.4, @rollup/plugin-inject@npm:^5.0.5":
version: 5.0.5 version: 5.0.5
resolution: "@rollup/plugin-inject@npm:5.0.5" resolution: "@rollup/plugin-inject@npm:5.0.5"
dependencies: dependencies:
@ -1610,93 +1635,93 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@rollup/rollup-android-arm-eabi@npm:4.9.4": "@rollup/rollup-android-arm-eabi@npm:4.9.5":
version: 4.9.4 version: 4.9.5
resolution: "@rollup/rollup-android-arm-eabi@npm:4.9.4" resolution: "@rollup/rollup-android-arm-eabi@npm:4.9.5"
conditions: os=android & cpu=arm conditions: os=android & cpu=arm
languageName: node languageName: node
linkType: hard linkType: hard
"@rollup/rollup-android-arm64@npm:4.9.4": "@rollup/rollup-android-arm64@npm:4.9.5":
version: 4.9.4 version: 4.9.5
resolution: "@rollup/rollup-android-arm64@npm:4.9.4" resolution: "@rollup/rollup-android-arm64@npm:4.9.5"
conditions: os=android & cpu=arm64 conditions: os=android & cpu=arm64
languageName: node languageName: node
linkType: hard linkType: hard
"@rollup/rollup-darwin-arm64@npm:4.9.4": "@rollup/rollup-darwin-arm64@npm:4.9.5":
version: 4.9.4 version: 4.9.5
resolution: "@rollup/rollup-darwin-arm64@npm:4.9.4" resolution: "@rollup/rollup-darwin-arm64@npm:4.9.5"
conditions: os=darwin & cpu=arm64 conditions: os=darwin & cpu=arm64
languageName: node languageName: node
linkType: hard linkType: hard
"@rollup/rollup-darwin-x64@npm:4.9.4": "@rollup/rollup-darwin-x64@npm:4.9.5":
version: 4.9.4 version: 4.9.5
resolution: "@rollup/rollup-darwin-x64@npm:4.9.4" resolution: "@rollup/rollup-darwin-x64@npm:4.9.5"
conditions: os=darwin & cpu=x64 conditions: os=darwin & cpu=x64
languageName: node languageName: node
linkType: hard linkType: hard
"@rollup/rollup-linux-arm-gnueabihf@npm:4.9.4": "@rollup/rollup-linux-arm-gnueabihf@npm:4.9.5":
version: 4.9.4 version: 4.9.5
resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.9.4" resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.9.5"
conditions: os=linux & cpu=arm conditions: os=linux & cpu=arm
languageName: node languageName: node
linkType: hard linkType: hard
"@rollup/rollup-linux-arm64-gnu@npm:4.9.4": "@rollup/rollup-linux-arm64-gnu@npm:4.9.5":
version: 4.9.4 version: 4.9.5
resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.9.4" resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.9.5"
conditions: os=linux & cpu=arm64 & libc=glibc conditions: os=linux & cpu=arm64 & libc=glibc
languageName: node languageName: node
linkType: hard linkType: hard
"@rollup/rollup-linux-arm64-musl@npm:4.9.4": "@rollup/rollup-linux-arm64-musl@npm:4.9.5":
version: 4.9.4 version: 4.9.5
resolution: "@rollup/rollup-linux-arm64-musl@npm:4.9.4" resolution: "@rollup/rollup-linux-arm64-musl@npm:4.9.5"
conditions: os=linux & cpu=arm64 & libc=musl conditions: os=linux & cpu=arm64 & libc=musl
languageName: node languageName: node
linkType: hard linkType: hard
"@rollup/rollup-linux-riscv64-gnu@npm:4.9.4": "@rollup/rollup-linux-riscv64-gnu@npm:4.9.5":
version: 4.9.4 version: 4.9.5
resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.9.4" resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.9.5"
conditions: os=linux & cpu=riscv64 & libc=glibc conditions: os=linux & cpu=riscv64 & libc=glibc
languageName: node languageName: node
linkType: hard linkType: hard
"@rollup/rollup-linux-x64-gnu@npm:4.9.4": "@rollup/rollup-linux-x64-gnu@npm:4.9.5":
version: 4.9.4 version: 4.9.5
resolution: "@rollup/rollup-linux-x64-gnu@npm:4.9.4" resolution: "@rollup/rollup-linux-x64-gnu@npm:4.9.5"
conditions: os=linux & cpu=x64 & libc=glibc conditions: os=linux & cpu=x64 & libc=glibc
languageName: node languageName: node
linkType: hard linkType: hard
"@rollup/rollup-linux-x64-musl@npm:4.9.4": "@rollup/rollup-linux-x64-musl@npm:4.9.5":
version: 4.9.4 version: 4.9.5
resolution: "@rollup/rollup-linux-x64-musl@npm:4.9.4" resolution: "@rollup/rollup-linux-x64-musl@npm:4.9.5"
conditions: os=linux & cpu=x64 & libc=musl conditions: os=linux & cpu=x64 & libc=musl
languageName: node languageName: node
linkType: hard linkType: hard
"@rollup/rollup-win32-arm64-msvc@npm:4.9.4": "@rollup/rollup-win32-arm64-msvc@npm:4.9.5":
version: 4.9.4 version: 4.9.5
resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.9.4" resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.9.5"
conditions: os=win32 & cpu=arm64 conditions: os=win32 & cpu=arm64
languageName: node languageName: node
linkType: hard linkType: hard
"@rollup/rollup-win32-ia32-msvc@npm:4.9.4": "@rollup/rollup-win32-ia32-msvc@npm:4.9.5":
version: 4.9.4 version: 4.9.5
resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.9.4" resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.9.5"
conditions: os=win32 & cpu=ia32 conditions: os=win32 & cpu=ia32
languageName: node languageName: node
linkType: hard linkType: hard
"@rollup/rollup-win32-x64-msvc@npm:4.9.4": "@rollup/rollup-win32-x64-msvc@npm:4.9.5":
version: 4.9.4 version: 4.9.5
resolution: "@rollup/rollup-win32-x64-msvc@npm:4.9.4" resolution: "@rollup/rollup-win32-x64-msvc@npm:4.9.5"
conditions: os=win32 & cpu=x64 conditions: os=win32 & cpu=x64
languageName: node languageName: node
linkType: hard linkType: hard
@ -1953,7 +1978,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@tybys/wasm-util@npm:0.8.1": "@tybys/wasm-util@npm:0.8.1, @tybys/wasm-util@npm:^0.8.1":
version: 0.8.1 version: 0.8.1
resolution: "@tybys/wasm-util@npm:0.8.1" resolution: "@tybys/wasm-util@npm:0.8.1"
dependencies: dependencies:
@ -2579,6 +2604,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"abort-controller@npm:^3.0.0":
version: 3.0.0
resolution: "abort-controller@npm:3.0.0"
dependencies:
event-target-shim: "npm:^5.0.0"
checksum: 90ccc50f010250152509a344eb2e71977fbf8db0ab8f1061197e3275ddf6c61a41a6edfd7b9409c664513131dd96e962065415325ef23efa5db931b382d24ca5
languageName: node
linkType: hard
"acorn-jsx@npm:^5.3.2": "acorn-jsx@npm:^5.3.2":
version: 5.3.2 version: 5.3.2
resolution: "acorn-jsx@npm:5.3.2" resolution: "acorn-jsx@npm:5.3.2"
@ -3427,6 +3461,16 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"buffer@npm:6.0.3":
version: 6.0.3
resolution: "buffer@npm:6.0.3"
dependencies:
base64-js: "npm:^1.3.1"
ieee754: "npm:^1.2.1"
checksum: 2a905fbbcde73cc5d8bd18d1caa23715d5f83a5935867c2329f0ac06104204ba7947be098fe1317fbd8830e26090ff8e764f08cd14fefc977bb248c3487bcbd0
languageName: node
linkType: hard
"buffer@npm:^5.2.1, buffer@npm:^5.5.0, buffer@npm:^5.7.1": "buffer@npm:^5.2.1, buffer@npm:^5.5.0, buffer@npm:^5.7.1":
version: 5.7.1 version: 5.7.1
resolution: "buffer@npm:5.7.1" resolution: "buffer@npm:5.7.1"
@ -3437,6 +3481,16 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"buffer@patch:buffer@npm%3A6.0.3#~/.yarn/patches/buffer-npm-6.0.3-cd90dfedfe.patch":
version: 6.0.3
resolution: "buffer@patch:buffer@npm%3A6.0.3#~/.yarn/patches/buffer-npm-6.0.3-cd90dfedfe.patch::version=6.0.3&hash=1a8c3b"
dependencies:
base64-js: "npm:^1.3.1"
ieee754: "npm:^1.2.1"
checksum: badada2d9020d9a20ba088de350750bc8b7fed20a35b62bae96a3b23dd3c956a20770ddf3e7f0af0ce8c1578d5679619b53fd79fac11ac637900ae92ed48130a
languageName: node
linkType: hard
"buffers@npm:~0.1.1": "buffers@npm:~0.1.1":
version: 0.1.1 version: 0.1.1
resolution: "buffers@npm:0.1.1" resolution: "buffers@npm:0.1.1"
@ -5398,6 +5452,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"event-target-shim@npm:^5.0.0":
version: 5.0.1
resolution: "event-target-shim@npm:5.0.1"
checksum: 0255d9f936215fd206156fd4caa9e8d35e62075d720dc7d847e89b417e5e62cf1ce6c9b4e0a1633a9256de0efefaf9f8d26924b1f3c8620cffb9db78e7d3076b
languageName: node
linkType: hard
"eventemitter3@npm:^4.0.4": "eventemitter3@npm:^4.0.4":
version: 4.0.7 version: 4.0.7
resolution: "eventemitter3@npm:4.0.7" resolution: "eventemitter3@npm:4.0.7"
@ -5412,7 +5473,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"events@npm:^3.0.0": "events@npm:^3.0.0, events@npm:^3.3.0":
version: 3.3.0 version: 3.3.0
resolution: "events@npm:3.3.0" resolution: "events@npm:3.3.0"
checksum: d6b6f2adbccbcda74ddbab52ed07db727ef52e31a61ed26db9feb7dc62af7fc8e060defa65e5f8af9449b86b52cc1a1f6a79f2eafcf4e62add2b7a1fa4a432f6 checksum: d6b6f2adbccbcda74ddbab52ed07db727ef52e31a61ed26db9feb7dc62af7fc8e060defa65e5f8af9449b86b52cc1a1f6a79f2eafcf4e62add2b7a1fa4a432f6
@ -6641,7 +6702,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"ieee754@npm:^1.1.13": "ieee754@npm:^1.1.13, ieee754@npm:^1.2.1":
version: 1.2.1 version: 1.2.1
resolution: "ieee754@npm:1.2.1" resolution: "ieee754@npm:1.2.1"
checksum: b0782ef5e0935b9f12883a2e2aa37baa75da6e66ce6515c168697b42160807d9330de9a32ec1ed73149aea02e0d822e572bca6f1e22bdcbd2149e13b050b17bb checksum: b0782ef5e0935b9f12883a2e2aa37baa75da6e66ce6515c168697b42160807d9330de9a32ec1ed73149aea02e0d822e572bca6f1e22bdcbd2149e13b050b17bb
@ -8149,16 +8210,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"memfs-browser@npm:^4.6.10002": "memfs@npm:^4.6.0":
version: 4.6.10002
resolution: "memfs-browser@npm:4.6.10002"
dependencies:
memfs: "npm:4.6.0"
checksum: 61431d8d455a3ab963c2c7cb231441773d67e28b0d05ce69bd95db712c87767a3e676968006b17458729c42110864b6b41ceac687adcc8228525080fde97bc69
languageName: node
linkType: hard
"memfs@npm:4.6.0":
version: 4.6.0 version: 4.6.0
resolution: "memfs@npm:4.6.0" resolution: "memfs@npm:4.6.0"
dependencies: dependencies:
@ -8637,11 +8689,6 @@ __metadata:
resolution: "napi-rs@workspace:." resolution: "napi-rs@workspace:."
dependencies: dependencies:
"@napi-rs/cli": "workspace:*" "@napi-rs/cli": "workspace:*"
"@rollup/plugin-alias": "npm:^5.1.0"
"@rollup/plugin-commonjs": "npm:^25.0.7"
"@rollup/plugin-json": "npm:^6.0.1"
"@rollup/plugin-node-resolve": "npm:^15.2.3"
"@rollup/plugin-replace": "npm:^5.0.5"
"@taplo/cli": "npm:^0.5.2" "@taplo/cli": "npm:^0.5.2"
"@types/debug": "npm:^4.1.12" "@types/debug": "npm:^4.1.12"
"@types/lodash-es": "npm:^4.17.12" "@types/lodash-es": "npm:^4.17.12"
@ -8663,6 +8710,7 @@ __metadata:
lint-staged: "npm:^15.2.0" lint-staged: "npm:^15.2.0"
npm-run-all: "npm:^4.1.5" npm-run-all: "npm:^4.1.5"
prettier: "npm:^3.1.0" prettier: "npm:^3.1.0"
rollup: "npm:^4.9.5"
shx: "npm:^0.3.4" shx: "npm:^0.3.4"
sinon: "npm:^17.0.1" sinon: "npm:^17.0.1"
source-map-support: "npm:^0.5.21" source-map-support: "npm:^0.5.21"
@ -8797,6 +8845,20 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"node-inspect-extracted@npm:3.0.0":
version: 3.0.0
resolution: "node-inspect-extracted@npm:3.0.0"
checksum: 4f98732157b14da835992ac55595274c4b7b15b5d6849cbfec4421f93bc4d50500d301a73048c8aeea159e9d505406c09f3234137f51892fe0fd936bddb9959f
languageName: node
linkType: hard
"node-inspect-extracted@patch:node-inspect-extracted@npm%3A3.0.0#~/.yarn/patches/node-inspect-extracted-npm-3.0.0-f661b6c334.patch":
version: 3.0.0
resolution: "node-inspect-extracted@patch:node-inspect-extracted@npm%3A3.0.0#~/.yarn/patches/node-inspect-extracted-npm-3.0.0-f661b6c334.patch::version=3.0.0&hash=519cf0"
checksum: 10d926fa12e6c0f3338c2d50946104472d7158b0bbe24f44d98e597038ea3144359e57403ca950d1bf3e68fbe07be24fdb7a0e9fba3fcb0d2511aeca99c87b62
languageName: node
linkType: hard
"node-machine-id@npm:1.1.12": "node-machine-id@npm:1.1.12":
version: 1.1.12 version: 1.1.12
resolution: "node-machine-id@npm:1.1.12" resolution: "node-machine-id@npm:1.1.12"
@ -10341,6 +10403,19 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"readable-stream@npm:^4.5.2":
version: 4.5.2
resolution: "readable-stream@npm:4.5.2"
dependencies:
abort-controller: "npm:^3.0.0"
buffer: "npm:^6.0.3"
events: "npm:^3.3.0"
process: "npm:^0.11.10"
string_decoder: "npm:^1.3.0"
checksum: a2c80e0e53aabd91d7df0330929e32d0a73219f9477dbbb18472f6fdd6a11a699fc5d172a1beff98d50eae4f1496c950ffa85b7cc2c4c196963f289a5f39275d
languageName: node
linkType: hard
"readdir-glob@npm:^1.1.2": "readdir-glob@npm:^1.1.2":
version: 1.1.3 version: 1.1.3
resolution: "readdir-glob@npm:1.1.3" resolution: "readdir-glob@npm:1.1.3"
@ -10582,23 +10657,34 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"rollup@npm:^4.2.0": "rollup-plugin-polyfill-node@npm:^0.13.0":
version: 4.9.4 version: 0.13.0
resolution: "rollup@npm:4.9.4" resolution: "rollup-plugin-polyfill-node@npm:0.13.0"
dependencies: dependencies:
"@rollup/rollup-android-arm-eabi": "npm:4.9.4" "@rollup/plugin-inject": "npm:^5.0.4"
"@rollup/rollup-android-arm64": "npm:4.9.4" peerDependencies:
"@rollup/rollup-darwin-arm64": "npm:4.9.4" rollup: ^1.20.0 || ^2.0.0 || ^3.0.0 || ^4.0.0
"@rollup/rollup-darwin-x64": "npm:4.9.4" checksum: a6d7746d73b48869c2650d733a4f1bf4cd8613669959811485e866c13b6462465b227f9923a21521013cfc85dd23c28b5ccee1c1359584f1ccf6320e7c823fb3
"@rollup/rollup-linux-arm-gnueabihf": "npm:4.9.4" languageName: node
"@rollup/rollup-linux-arm64-gnu": "npm:4.9.4" linkType: hard
"@rollup/rollup-linux-arm64-musl": "npm:4.9.4"
"@rollup/rollup-linux-riscv64-gnu": "npm:4.9.4" "rollup@npm:^4.2.0, rollup@npm:^4.9.5":
"@rollup/rollup-linux-x64-gnu": "npm:4.9.4" version: 4.9.5
"@rollup/rollup-linux-x64-musl": "npm:4.9.4" resolution: "rollup@npm:4.9.5"
"@rollup/rollup-win32-arm64-msvc": "npm:4.9.4" dependencies:
"@rollup/rollup-win32-ia32-msvc": "npm:4.9.4" "@rollup/rollup-android-arm-eabi": "npm:4.9.5"
"@rollup/rollup-win32-x64-msvc": "npm:4.9.4" "@rollup/rollup-android-arm64": "npm:4.9.5"
"@rollup/rollup-darwin-arm64": "npm:4.9.5"
"@rollup/rollup-darwin-x64": "npm:4.9.5"
"@rollup/rollup-linux-arm-gnueabihf": "npm:4.9.5"
"@rollup/rollup-linux-arm64-gnu": "npm:4.9.5"
"@rollup/rollup-linux-arm64-musl": "npm:4.9.5"
"@rollup/rollup-linux-riscv64-gnu": "npm:4.9.5"
"@rollup/rollup-linux-x64-gnu": "npm:4.9.5"
"@rollup/rollup-linux-x64-musl": "npm:4.9.5"
"@rollup/rollup-win32-arm64-msvc": "npm:4.9.5"
"@rollup/rollup-win32-ia32-msvc": "npm:4.9.5"
"@rollup/rollup-win32-x64-msvc": "npm:4.9.5"
"@types/estree": "npm:1.0.5" "@types/estree": "npm:1.0.5"
fsevents: "npm:~2.3.2" fsevents: "npm:~2.3.2"
dependenciesMeta: dependenciesMeta:
@ -10632,7 +10718,7 @@ __metadata:
optional: true optional: true
bin: bin:
rollup: dist/bin/rollup rollup: dist/bin/rollup
checksum: 3a494f2d922bf8e03c4110f6582233e31a0ff584b2bab472f8718e7a81dd875ba0d813d6d3bb0532f68a8521aacd804fe0bc7607eeeae3ec62ce4f468cdf092d checksum: 7f241ad4028f32c1300eb8391493f192f622ed7e9564f993d8f3862be32dd995c8237f4691ea76327a323ef62808495a497eabf0c8fb0c6fa6556a69653a449f
languageName: node languageName: node
linkType: hard linkType: hard
@ -11368,7 +11454,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"string_decoder@npm:^1.0.0, string_decoder@npm:^1.1.1": "string_decoder@npm:^1.0.0, string_decoder@npm:^1.1.1, string_decoder@npm:^1.3.0":
version: 1.3.0 version: 1.3.0
resolution: "string_decoder@npm:1.3.0" resolution: "string_decoder@npm:1.3.0"
dependencies: dependencies: