@rolldown/binding-wasm32-wasi 1.2.0 → 1.2.1
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/package.json +8 -8
- package/rolldown-binding.wasi-browser.js +333 -40
- package/rolldown-binding.wasi.cjs +603 -58
- package/rolldown-binding.wasi.d.cts +3112 -0
- package/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/wasi-worker-browser.mjs +13 -1
- package/wasi-worker.mjs +12 -1
|
Binary file
|
package/wasi-worker-browser.mjs
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
instantiateNapiModuleSync,
|
|
3
|
+
MessageHandler,
|
|
4
|
+
WASI,
|
|
5
|
+
createFsProxy,
|
|
6
|
+
emnapiAsyncWorkPlugin,
|
|
7
|
+
emnapiTSFNPlugin,
|
|
8
|
+
} from '@napi-rs/wasm-runtime'
|
|
2
9
|
import { memfsExported as __memfsExported } from '@napi-rs/wasm-runtime/fs'
|
|
3
10
|
|
|
4
11
|
const fs = createFsProxy(__memfsExported)
|
|
@@ -26,6 +33,11 @@ const handler = new MessageHandler({
|
|
|
26
33
|
return instantiateNapiModuleSync(wasmModule, {
|
|
27
34
|
childThread: true,
|
|
28
35
|
wasi,
|
|
36
|
+
// The wasm links a "basic" emnapi archive (no C async-work /
|
|
37
|
+
// threadsafe-function implementations), so every thread that
|
|
38
|
+
// instantiates it must provide the JavaScript implementations
|
|
39
|
+
// through the emnapi plugins.
|
|
40
|
+
plugins: [emnapiAsyncWorkPlugin, emnapiTSFNPlugin],
|
|
29
41
|
overwriteImports(importObject) {
|
|
30
42
|
importObject.env = {
|
|
31
43
|
...importObject.env,
|
package/wasi-worker.mjs
CHANGED
|
@@ -6,7 +6,13 @@ import { parentPort, Worker } from "node:worker_threads";
|
|
|
6
6
|
|
|
7
7
|
const require = createRequire(import.meta.url);
|
|
8
8
|
|
|
9
|
-
const {
|
|
9
|
+
const {
|
|
10
|
+
instantiateNapiModuleSync,
|
|
11
|
+
MessageHandler,
|
|
12
|
+
getDefaultContext,
|
|
13
|
+
emnapiAsyncWorkPlugin,
|
|
14
|
+
emnapiTSFNPlugin,
|
|
15
|
+
} = require("@napi-rs/wasm-runtime");
|
|
10
16
|
|
|
11
17
|
if (parentPort) {
|
|
12
18
|
parentPort.on("message", (data) => {
|
|
@@ -46,6 +52,11 @@ const handler = new MessageHandler({
|
|
|
46
52
|
childThread: true,
|
|
47
53
|
wasi,
|
|
48
54
|
context: emnapiContext,
|
|
55
|
+
// The wasm links a "basic" emnapi archive (no C async-work /
|
|
56
|
+
// threadsafe-function implementations), so every thread that
|
|
57
|
+
// instantiates it must provide the JavaScript implementations
|
|
58
|
+
// through the emnapi plugins.
|
|
59
|
+
plugins: [emnapiAsyncWorkPlugin, emnapiTSFNPlugin],
|
|
49
60
|
overwriteImports(importObject) {
|
|
50
61
|
importObject.env = {
|
|
51
62
|
...importObject.env,
|