Closed guest271314 closed 1 year ago
@guest271314 this project does not depend on V8, it's just used for testing. The example folder demonstrates running Spidermonkey in Wasmtime without any V8 being used.
Variations of componentization for other engines would be interesting to see. This project is focused on full engine and WinterCG compat via Spidermonkey. Other componentization efforts may have other priorities. Happy to discuss further.
Thanks.
I normally don't install Node.js. I just extract the node
executable and run that. I think the example expects node
to be installed on the system.
I've had issues downloading 1 GB Rust toolchain on a temporary file system running on RAM, and downloading crates, I have run out of disk space before when I tried to build this roll-your-own-javascript-runtime . So I have just used wasmtime
executable alone.
From Running the Component in Wasmtime
Set up the Cargo.toml as in the example directory.
When I read
demonstrates running Spidermonkey in Wasmtime without any V8 being used.
I don't think of Rust, although I am aware that SpiderMonkey is written in part in Rust. I can probably just download SpiderMoney and wasmtime
and go.
I've run into this in other WebAssembly/WASI repositories, where it is taken as a given that the user has Rust, Node.js, or something else already installed.
I think the approach should be generic, with everything, in this case 2 to 3 executables, for the given architecture already built - without relying on any configuration or downloads from any particular programming language first.
If you have a component, you don't need a JS toolchain to run that component. But when creating a component, the expectation is that you will create it from the guest language toolchain for that language. For example in JS, a JS bundler, TypeScript, other JS operations will be part of that build. So having a JS-based build tool is preferable.
Once you have a component though, the example in https://github.com/bytecodealliance/componentize-js/tree/main/example given the compiled component.wasm
demonstrates the Wasmtime-only host execution. Then there's your two executables - a component host and a component.
In future the JS toolchain itself will likely be componentizable but there are still a few steps to get there. We certainly dogfood where we can.
Creating a generic host executable for components and making it available for multiple platforms seems a useful thing at some point. It's not currently a priority though.
Thanks.
What I conceptutalize is creating a WASM environment for an already built program then just dropping the as is program behind a WASM interface for the browser. Something like v86 and buildroot without the entire operating system.
I've narrowed the folders and files of the (C source code) program down to
I don't have Rust installed. I have not dove in to WIT or the "component" model. Don't use TypeScript. I'll read the documentation of this and jco and do some testing at some point.
Since you are embedding SpiderMonkey JavaScript engine why is V8 and Node.js involved in the process?
Embedding size is noted as 5MB.
node
nightly (v21.0.0-nightly202305318aa02e81d0 ) executable alone is 91.2MB.Node.js does not provide a download of
node
executable alone. Node.js nightly download includenode_modules
,npm
, etc. That's why I wrote this https://github.com/guest271314/download-node-nightly-executable.That last time I checked
d8
(10.9.60) alone was 26.1MB.txiki.js supports wasm3 WebAssembly engine is 7.6MB.
QuickJS
qjs
executable is 5MB, less than 1MB afterstrip
.I think the JavaScript examples should be as generic as standard, considering QuickJS, txiki.js, Bun, Deno, and Node.js, favoring neither.
Can't you just use SpiderMonkey for the entire process without depending on V8 (
node
) andnpm
and without tailoring the example in the README for Node.js (that will cost at least 91.2MB)?