wasmedge-quickjs
wasmedge-quickjs copied to clipboard
Support all node.js APIs
We are tracking the progress in the WasmEdge repo.
https://github.com/WasmEdge/WasmEdge/issues/1535
Do you intend to also support the built-in WebAssembly
object:
import * as std from 'std'
let wasmBuffer = std.loadFile('target/wasm32-unknown-unknown/release/node.wasm');
WebAssembly.instantiate(wasmBuffer).then(wasmModule => {
const { add } = wasmModule.instance.exports;
const sum = add(5, 6);
console.log(sum);
});
Hmm. Our goal is to run JS inside Wasm. When the Wasm modules spec is ready, we could allow JS programs to call from one WasmEdge instance to another one. But it is not currently a priority unless you want to work on it. :)
I have a related question: currently the module federation backend framework (written largely in JS and running on Node.js) streams code directly from its source repo, compiles and loads into memory (both JS and Wasm). Naturally, the JS framework uses the above wasm APIs. The plan is to port the framework to QuickJS to support a wasm runtime (for serverless, embedded). Or to compile Deno to wasm and port to that (if possible - haven't investigated). If there is a better way to do this, I'm all in. Otherwise, I will help implement the above APIs. Timeline would be starting around October.