wasi-js getImportObject
walmartwarlord opened this issue · comments
Jeremy Gilbert commented
Hi! Thanks for this. I'm looking at the wasi-js example, and wondering where can get the value of wasmOpts
here?
import { WASI } from "wasi-js";
import fs from "fs";
import nodeBindings from "wasi-js/dist/bindings/node";
const wasi = new WASI({
args: [],
env: {},
bindings: {...nodeBindings, fs},
});
const source = await readFile(pathToWasm);
const typedArray = new Uint8Array(source);
const result = await WebAssembly.instantiate(typedArray, wasmOpts); // where can we wasmOpts
wasi.start(result.instance);
I tried looking at the WASI implementation of node 20 and tried to do it as well - but it is undefined:
const result = await WebAssembly.instantiate(typedArray, wasi.getImportObject()); // getImportObject is undefined
Any tips? Thank you!
William Stein commented
I don't have time at the moment to look into this, but I would start by looking first at
cowasm/core/wasi-js/src/runtime.ts
Line 77 in 28cf78a