@oxc-parser/binding-wasm32-wasi 0.56.2 → 0.56.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/parser.wasi-browser.js +8 -1
- package/parser.wasm32-wasi.wasm +0 -0
- package/wasi-worker-browser.mjs +8 -1
package/README.md
CHANGED
package/package.json
CHANGED
package/parser.wasi-browser.js
CHANGED
|
@@ -4,11 +4,17 @@ import {
|
|
|
4
4
|
WASI as __WASI,
|
|
5
5
|
createOnMessage as __wasmCreateOnMessageForFsProxy,
|
|
6
6
|
} from '@napi-rs/wasm-runtime'
|
|
7
|
-
|
|
7
|
+
import { memfs } from '@napi-rs/wasm-runtime/fs'
|
|
8
8
|
import __wasmUrl from './parser.wasm32-wasi.wasm?url'
|
|
9
9
|
|
|
10
|
+
export const { fs: __fs, vol: __volume } = memfs()
|
|
11
|
+
|
|
10
12
|
const __wasi = new __WASI({
|
|
11
13
|
version: 'preview1',
|
|
14
|
+
fs: __fs,
|
|
15
|
+
preopens: {
|
|
16
|
+
'/': '/',
|
|
17
|
+
},
|
|
12
18
|
})
|
|
13
19
|
|
|
14
20
|
const __emnapiContext = __emnapiGetDefaultContext()
|
|
@@ -33,6 +39,7 @@ const {
|
|
|
33
39
|
const worker = new Worker(new URL('@oxc-parser/binding-wasm32-wasi/wasi-worker-browser.mjs', import.meta.url), {
|
|
34
40
|
type: 'module',
|
|
35
41
|
})
|
|
42
|
+
worker.addEventListener('message', __wasmCreateOnMessageForFsProxy(__fs))
|
|
36
43
|
|
|
37
44
|
return worker
|
|
38
45
|
},
|
package/parser.wasm32-wasi.wasm
CHANGED
|
Binary file
|
package/wasi-worker-browser.mjs
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import { instantiateNapiModuleSync, MessageHandler, WASI } from '@napi-rs/wasm-runtime'
|
|
1
|
+
import { instantiateNapiModuleSync, MessageHandler, WASI, createFsProxy } from '@napi-rs/wasm-runtime'
|
|
2
|
+
import { memfsExported as __memfsExported } from '@napi-rs/wasm-runtime/fs'
|
|
3
|
+
|
|
4
|
+
const fs = createFsProxy(__memfsExported)
|
|
2
5
|
|
|
3
6
|
const handler = new MessageHandler({
|
|
4
7
|
onLoad({ wasmModule, wasmMemory }) {
|
|
5
8
|
const wasi = new WASI({
|
|
9
|
+
fs,
|
|
10
|
+
preopens: {
|
|
11
|
+
'/': '/',
|
|
12
|
+
},
|
|
6
13
|
print: function () {
|
|
7
14
|
// eslint-disable-next-line no-console
|
|
8
15
|
console.log.apply(console, arguments)
|