This is an small experiment I did to try to run Javascript in a sandboxed environment.
To do this I use QuickJS compiled to WebAssembly. All the heavy lifting of running QuickJS on WASM is done on this library.
$ # inside this repository
$ yarn install
$ yarn start
Take a look at example code inside of src/
folder.
What works:
- run javascript code in isolation
- push functions into the VM, (like
console.log
, orfetch
) - extract results from the VM
Not so good yet:
- very new projects, scarce docs, and not many people using it
- it seems that not all of QuickJS is exposed to WASM
- I had no success working with imports/require but I may be doing something wrong
- async code doesn't seem not to be working
I need to take another look to the things that didn't work for me and maybe reach to other people to see if I'm doing something wrong, or if there's other work to be done on the glue parts.