@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 CHANGED
@@ -1,3 +1,3 @@
1
1
  # `@oxc-parser/binding-wasm32-wasi`
2
2
 
3
- This is the **wasm32-wasip1** binary for `@oxc-parser/binding`
3
+ This is the **wasm32-wasip1-threads** binary for `@oxc-parser/binding`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxc-parser/binding-wasm32-wasi",
3
- "version": "0.56.2",
3
+ "version": "0.56.4",
4
4
  "cpu": [
5
5
  "wasm32"
6
6
  ],
@@ -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
  },
Binary file
@@ -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)