Using gems with Node WASI
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 875
- Forks
- 68
- Avg merge
- 9d 5h
- Merged PRs (30d)
- 1
Description
Hey, since I needed it myself, and based on https://gist.github.com/kateinoigakukun/5caf3b83b2732b1653e91b0e75ce3390, I wrote JS code that allows you to use gems with Node WASI.
Unfortunately, as you need preopens for that (to map the gems into the WASI vfs), it's currently not possible to use DefaultRubyVM for that, as its options are limited to env.
I wrote my own small wrapper to allow me access to the full breadth of WASI options: https://github.com/primate-run/primate/blob/master/packages/ruby/src/private/wasi.ts, but it took me a bit to understand how to get the RubyVM from the package to mimic the behaviour of DefaultRubyVM. The examples in the cheatsheet are all using DefaultRubyVM.
It is possible to perhaps make DefaultRubyVM a bit more flexible, so that it's possible to use preopens with it?
Alternatively, if you want to keep the defaults simple, perhaps add this example to the readme or cheatsheet? I don't mind sending a PR.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the DefaultRubyVM usage in the cheatsheet and README, then compare it with the linked wasi.ts wrapper and its handling of preopens. Confirm whether the intended result is a more flexible DefaultRubyVM API or a documented Node WASI example, and validate that gems can be mapped into the WASI virtual filesystem.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, ruby, wasm
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100