Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ruby.wasm is a collection of WebAssembly ports of the CRuby.

License

NotificationsYou must be signed in to change notification settings

kojix2/ruby.wasm

 
 

Repository files navigation

Build ruby.wasm

ruby.wasm is a collection of WebAssembly ports of theCRuby.It enables running Ruby application on browsers, WASI compatible WebAssembly runtimes, and Edge Computing platforms.

Try ruby.wasm (no installation needed)

Try ruby.wasm inTryRuby in your browser.

Quick Example: Ruby on browser

Create and saveindex.html page with the following contents:

<html><scriptsrc="https://cdn.jsdelivr.net/npm/ruby-head-wasm-wasi@0.5.0/dist/browser.script.iife.js"></script><scripttype="text/ruby">puts"Hello, world!"</script></html>

Quick Example: How to package your Ruby application as a WASI application

Dependencies:wasi-vfs,wasmtime

#Download a prebuilt Ruby release$curl -LO https://github.com/ruby/ruby.wasm/releases/latest/download/ruby-head-wasm32-unknown-wasi-full.tar.gz$tar xfz ruby-head-wasm32-unknown-wasi-full.tar.gz#Extract ruby binary not to pack itself$mv head-wasm32-unknown-wasi-full/usr/local/bin/ruby ruby.wasm#Put your app code$mkdir src$echo"puts 'Hello'"> src/my_app.rb#Pack the whole directory under /usr and your app dir$wasi-vfs pack ruby.wasm --mapdir /src::./src --mapdir /usr::./head-wasm32-unknown-wasi-full/usr -o my-ruby-app.wasm#Run the packed scripts$wasmtime my-ruby-app.wasm -- /src/my_app.rbHello

npm packages (for JavaScript host environments)

See theREADME.md of each package for more detail and its usage.

PackageDescriptionnpm
ruby-head-wasm-wasiHEAD CRuby built on WASI with JS interop supportnpm version
ruby-head-wasm-emscriptenHEAD CRuby built on Emscripten (not well tested)npm version

Prebuilt binaries

This project distributesprebuilt Ruby binaries in GitHub Releases.Abuild is a combination of ruby version,profile, andtarget.

Supported Target Triples

TripleDescription
wasm32-unknown-wasiTargeting WASI-compatible environments (e.g. Node.js, browsers with polyfill,wasmtime, and so on)
wasm32-unknown-emscriptenTargeting JavaScript environments including Node.js and browsers

Profiles

ProfileDescription
minimalNo standard extension libraries (likejson,yaml, orstringio)
fullAll standard extension libraries
*-jsEnabled JS interoperability, only usable with npm package
*-debugWith DWARF info andname section for debugging

Note:* is a wildcard that represents any other profile name except for itself, applied recursively. For example,minimal-full-js-debug is a valid profile.

Notable Limitations

The current WASI target build does not yet supportThread related APIs. Specifically, WASI does not yet have an API for creating and managing threads yet.

Also there is no support for networking. It is one of the goal of WASI to support networking in the future, but it is not yet implemented.

Contributing

SeeCONTRIBUTING.md for how to build and test, and how to contribute to this project.Bug reports and pull requests are welcome on GitHub athttps://github.com/ruby/ruby.wasm

About

ruby.wasm is a collection of WebAssembly ports of the CRuby.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C32.1%
  • Ruby28.1%
  • TypeScript19.0%
  • JavaScript14.2%
  • Shell4.0%
  • Dockerfile1.9%
  • HTML0.7%

[8]ページ先頭

©2009-2025 Movatter.jp