-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update docs and README.md to use 3.3
- Loading branch information
1 parent
9fed740
commit f63b6d1
Showing
2 changed files
with
14 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ Create and save `index.html` page with the following contents: | |
|
||
```html | ||
<html> | ||
<script src="https://cdn.jsdelivr.net/npm/@ruby/3.2[email protected]/dist/browser.script.iife.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/@ruby/3.3[email protected]/dist/browser.script.iife.js"></script> | ||
<script type="text/ruby"> | ||
require "js" | ||
|
@@ -70,6 +70,11 @@ See the `README.md` of each package for more detail and its usage. | |
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td><a href="/packages/npm-packages/ruby-3.3-wasm-wasi">@ruby/3.3-wasm-wasi</a></td> | ||
<td>CRuby 3.3 built on WASI with JS interop support</td> | ||
<td><a href="https://www.npmjs.com/package/@ruby/3.3-wasm-wasi" rel="nofollow"><img src="https://badge.fury.io/js/@ruby%2F3.3-wasm-wasi.svg" alt="npm version" style="max-width: 100%;"></a></td> | ||
</tr> | ||
<tr> | ||
<td><a href="/packages/npm-packages/ruby-3.2-wasm-wasi">@ruby/3.2-wasm-wasi</a></td> | ||
<td>CRuby 3.2 built on WASI with JS interop support</td> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,10 @@ | |
|
||
## Node.js | ||
|
||
To install the package, install `@ruby/3.2-wasm-wasi` and `@ruby/wasm-wasi` from npm: | ||
To install the package, install `@ruby/3.3-wasm-wasi` and `@ruby/wasm-wasi` from npm: | ||
|
||
```console | ||
npm install --save @ruby/3.2-wasm-wasi @ruby/wasm-wasi | ||
npm install --save @ruby/3.3-wasm-wasi @ruby/wasm-wasi | ||
``` | ||
|
||
Then instantiate a Ruby VM by the following code: | ||
|
@@ -20,7 +20,7 @@ Then instantiate a Ruby VM by the following code: | |
import fs from "fs/promises"; | ||
import { DefaultRubyVM } from "@ruby/wasm-wasi/dist/node"; | ||
|
||
const binary = await fs.readFile("./node_modules/@ruby/3.2-wasm-wasi/dist/ruby.wasm"); | ||
const binary = await fs.readFile("./node_modules/@ruby/3.3-wasm-wasi/dist/ruby.wasm"); | ||
const module = await WebAssembly.compile(binary); | ||
const { vm } = await DefaultRubyVM(module); | ||
vm.eval(`puts "hello world"`); | ||
|
@@ -38,7 +38,7 @@ The easiest way to run Ruby on browser is to use `browser.script.iife.js` script | |
|
||
```html | ||
<html> | ||
<script src="https://cdn.jsdelivr.net/npm/@ruby/3.2[email protected]/dist/browser.script.iife.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/@ruby/3.3[email protected]/dist/browser.script.iife.js"></script> | ||
<script type="text/ruby"> | ||
require "js" | ||
JS.global[:document].write "Hello, world!" | ||
|
@@ -52,7 +52,7 @@ If you want to control Ruby VM from JavaScript, you can use `@ruby/wasm-wasi` pa | |
<html> | ||
<script type="module"> | ||
import { DefaultRubyVM } from "https://cdn.jsdelivr.net/npm/@ruby/[email protected]/dist/browser/+esm"; | ||
const response = await fetch("https://cdn.jsdelivr.net/npm/@ruby/3.2[email protected]/dist/ruby+stdlib.wasm"); | ||
const response = await fetch("https://cdn.jsdelivr.net/npm/@ruby/3.3[email protected]/dist/ruby+stdlib.wasm"); | ||
const module = await WebAssembly.compileStreaming(response); | ||
const { vm } = await DefaultRubyVM(module); | ||
|
@@ -73,7 +73,7 @@ If you want to control Ruby VM from JavaScript, you can use `@ruby/wasm-wasi` pa | |
<script> | ||
const main = async () => { | ||
const { DefaultRubyVM } = window["ruby-wasm-wasi"]; | ||
const response = await fetch("https://cdn.jsdelivr.net/npm/@ruby/3.2[email protected]/dist/ruby+stdlib.wasm"); | ||
const response = await fetch("https://cdn.jsdelivr.net/npm/@ruby/3.3[email protected]/dist/ruby+stdlib.wasm"); | ||
const module = await WebAssembly.compileStreaming(response); | ||
const { vm } = await DefaultRubyVM(module); | ||
|
@@ -128,7 +128,7 @@ end | |
|
||
```html | ||
<html> | ||
<script src="https://cdn.jsdelivr.net/npm/@ruby/3.2[email protected]/dist/browser.script.iife.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/@ruby/3.3[email protected]/dist/browser.script.iife.js"></script> | ||
<script type="text/ruby" data-eval="async"> | ||
require "js" | ||
|
@@ -144,7 +144,7 @@ Or using `@ruby/wasm-wasi` package API `RubyVM#evalAsync`: | |
<html> | ||
<script type="module"> | ||
import { DefaultRubyVM } from "https://cdn.jsdelivr.net/npm/@ruby/[email protected]/dist/browser/+esm"; | ||
const response = await fetch("https://cdn.jsdelivr.net/npm/@ruby/3.2[email protected]/dist/ruby+stdlib.wasm"); | ||
const response = await fetch("https://cdn.jsdelivr.net/npm/@ruby/3.3[email protected]/dist/ruby+stdlib.wasm"); | ||
const module = await WebAssembly.compileStreaming(response); | ||
const { vm } = await DefaultRubyVM(module); | ||
|