-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #528 from ruby/katei/add-wasip2-pkg
- Loading branch information
Showing
24 changed files
with
272 additions
and
61 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 |
---|---|---|
|
@@ -15,6 +15,7 @@ compile_commands.json | |
html | ||
|
||
build_manifest.json | ||
ci_matrix.json | ||
|
||
vendor/bundle | ||
/pkg |
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
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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
wasm32-unknown-wasip2 |
File renamed without changes.
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.tgz | ||
/tmp | ||
/bundle | ||
/vendor |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
source "https://rubygems.org" | ||
|
||
# We build ./vendor/cache/js-{version}.gem just before evaluating this Gemfile | ||
# so that Bundler builds extensions even from the local gem. (gem extensions | ||
# from "path:" gems are not built by Bundler.) | ||
# Thus even we specify version of "js" gem here, it should always installed | ||
# from the ./vendor/cache/js-{version}.gem, not from rubygems.org. To achieve this, | ||
# we always use non-exist version during development. | ||
require_relative "../../gems/js/lib/js/version.rb" | ||
gem "js", JS::VERSION | ||
gem "ruby_wasm", path: "../../../", group: [:build] | ||
gem "power_assert" | ||
gem "test-unit" |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
PATH | ||
remote: ../../.. | ||
specs: | ||
ruby_wasm (2.6.2.dev) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
js (2.6.2.dev) | ||
power_assert (2.0.3) | ||
test-unit (3.6.2) | ||
power_assert | ||
|
||
PLATFORMS | ||
ruby | ||
x86_64-linux | ||
|
||
DEPENDENCIES | ||
js (= 2.6.2.dev) | ||
power_assert | ||
ruby_wasm! | ||
test-unit | ||
|
||
BUNDLED WITH | ||
2.6.0.dev |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# @ruby/head-wasm-wasip2 | ||
|
||
[![npm version](https://badge.fury.io/js/@ruby%2Fhead-wasm-wasip2.svg)](https://www.npmjs.com/package/@ruby/head-wasm-wasip2) | ||
|
||
This package provides WebAssembly binaries of CRuby built from the latest `HEAD` source code targeting environments compatible with WASI Preview2. | ||
|
||
See [`@ruby/wasm-wasi`](https://github.com/ruby/ruby.wasm/blob/main/packages/npm-packages/ruby-wasm-wasi/README.md) for how to use this package. |
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"name": "@ruby/head-wasm-wasip2", | ||
"version": "2.6.2", | ||
"description": "Ruby head built on WASI Preview 2", | ||
"main": "./dist/cjs/index.js", | ||
"module": "./dist/esm/index.js", | ||
"private": true, | ||
"exports": { | ||
".": { | ||
"browser": "./dist/esm/index.js", | ||
"umd": "./dist/umd/index.js", | ||
"import": "./dist/esm/index.js", | ||
"require": "./dist/cjs/index.js" | ||
}, | ||
"./dist/*": { | ||
"browser": "./dist/esm/*.js", | ||
"umd": "./dist/umd/*.js", | ||
"import": "./dist/esm/*.js", | ||
"require": "./dist/cjs/*.js" | ||
}, | ||
"./*.wasm": { | ||
"browser": "./*.wasm", | ||
"umd": "./*.wasm", | ||
"import": "./*.wasm", | ||
"require": "./*.wasm" | ||
} | ||
}, | ||
"files": [ | ||
"dist", | ||
"README.md" | ||
], | ||
"scripts": { | ||
"__comment": "FIXME: Enable test:e2e after https://github.com/bytecodealliance/jco/pull/499 is merged", | ||
"test": "npm run run-script -- test:unit && npm run run-script -- test:vitest -- --run", | ||
"run-script": "RUBY_NPM_PACKAGE_ROOT=../ruby-head-wasm-wasip2 ENABLE_COMPONENT_TESTS=1 npm -C ../ruby-wasm-wasi run", | ||
"build:deps": "cd ../ruby-wasm-wasi && npm run build", | ||
"build:static:files": "../ruby-wasm-wasi/tools/pack-static-files.sh ./dist", | ||
"build:static": "npm run build:static:files", | ||
"build:rollup": "rollup -c rollup.config.mjs", | ||
"build": "npm run build:deps && npm run build:static && npm run build:rollup" | ||
}, | ||
"repository": "https://github.com/ruby/ruby.wasm", | ||
"homepage": "https://github.com/ruby/ruby.wasm/tree/main/packages/npm-packages/ruby-head-wasm-wasi", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"keywords": [ | ||
"wasm", | ||
"webassembly", | ||
"wasi", | ||
"ruby" | ||
], | ||
"license": "MIT", | ||
"dependencies": { | ||
"@ruby/wasm-wasi": "^2.0.0", | ||
"@bytecodealliance/preview2-shim": "^0.16.5" | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/npm-packages/ruby-head-wasm-wasip2/rollup.config.mjs
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import json from "@rollup/plugin-json"; | ||
import { nodeResolve } from "@rollup/plugin-node-resolve"; | ||
import fs from "fs"; | ||
import path from "path"; | ||
|
||
/** @type {import('rollup').RollupOptions[]} */ | ||
export default [ | ||
{ | ||
input: "src/browser.script.js", | ||
output: [ | ||
{ | ||
file: "dist/browser.script.iife.js", | ||
format: "iife", | ||
banner: "/* " + fs.readFileSync(path.resolve("../../../NOTICE"), "utf8") + "*/", | ||
} | ||
], | ||
plugins: [ | ||
json(), nodeResolve() | ||
], | ||
}, | ||
]; |
6 changes: 6 additions & 0 deletions
6
packages/npm-packages/ruby-head-wasm-wasip2/src/browser.script.js
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { instantiate } from "../dist/component/ruby.component" | ||
import { componentMain } from "@ruby/wasm-wasi/dist/browser.script" | ||
import * as wasip2 from "@bytecodealliance/preview2-shim" | ||
import * as pkg from "../package.json" | ||
|
||
componentMain(pkg, { instantiate, wasip2 }) |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
!.gitkeep | ||
/coverage | ||
/playwright-report | ||
/test-results | ||
*.tgz |
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
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
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
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
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
Oops, something went wrong.