Skip to content

Using gems with Node WASI #604

@terrablue

Description

@terrablue

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions