ruby_wasm 2.6.0-arm64-darwin → 2.6.2-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +4 -2
- data/README.md +1 -1
- data/Rakefile +3 -2
- data/docs/cheat_sheet.md +8 -8
- data/ext/ruby_wasm/README.md +3 -0
- data/lib/ruby_wasm/3.1/ruby_wasm.bundle +0 -0
- data/lib/ruby_wasm/3.2/ruby_wasm.bundle +0 -0
- data/lib/ruby_wasm/3.3/ruby_wasm.bundle +0 -0
- data/lib/ruby_wasm/build/product/crossruby.rb +10 -7
- data/lib/ruby_wasm/build/toolchain/wit_bindgen.rb +1 -1
- data/lib/ruby_wasm/build/toolchain.rb +1 -1
- data/lib/ruby_wasm/cli.rb +17 -3
- data/lib/ruby_wasm/packager/core.rb +88 -52
- data/lib/ruby_wasm/packager/file_system.rb +17 -0
- data/lib/ruby_wasm/packager.rb +27 -4
- data/lib/ruby_wasm/version.rb +1 -1
- data/package-lock.json +841 -386
- data/package.json +3 -2
- data/rakelib/packaging.rake +4 -3
- data/sig/ruby_wasm/build.rbs +2 -1
- data/sig/ruby_wasm/cli.rbs +2 -0
- data/sig/ruby_wasm/ext.rbs +8 -0
- data/sig/ruby_wasm/packager.rbs +11 -5
- metadata +4 -5
- data/ext/.gitignore +0 -2
- data/ext/README.md +0 -11
- /data/{ext → lib/ruby_wasm/build/product/crossruby}/extinit.c.erb +0 -0
data/package.json
CHANGED
data/rakelib/packaging.rake
CHANGED
@@ -30,9 +30,10 @@ def npm_pkg_rubies_cache_key(pkg)
|
|
30
30
|
require "open3"
|
31
31
|
cmd = build_command + ["--print-ruby-cache-key"]
|
32
32
|
chdir = pkg[:gemfile] ? File.dirname(pkg[:gemfile]) : Dir.pwd
|
33
|
-
|
33
|
+
env = { "RUBY_WASM_ROOT" => LIB_ROOT }
|
34
|
+
stdout, status = Open3.capture2(env, *cmd, chdir: chdir)
|
34
35
|
unless status.success?
|
35
|
-
raise "Command failed with status (#{status.exitstatus}): #{cmd.join ""}"
|
36
|
+
raise "Command failed with status (#{status.exitstatus}): #{cmd.join " "}"
|
36
37
|
end
|
37
38
|
require "json"
|
38
39
|
JSON.parse(stdout)["hexdigest"]
|
@@ -79,7 +80,7 @@ namespace :npm do
|
|
79
80
|
component_path = File.join(pkg_dir, "tmp", "ruby.component.wasm")
|
80
81
|
FileUtils.mkdir_p(File.dirname(component_path))
|
81
82
|
|
82
|
-
sh env.merge("
|
83
|
+
sh env.merge("RUBY_WASM_EXPERIMENTAL_DYNAMIC_LINKING" => "1"),
|
83
84
|
*build_command, "-o", component_path
|
84
85
|
sh "npx", "jco", "transpile",
|
85
86
|
"--no-wasi-shim", "--instantiation", "--valid-lifting-optimization",
|
data/sig/ruby_wasm/build.rbs
CHANGED
@@ -33,6 +33,7 @@ module RubyWasm
|
|
33
33
|
@source: BuildSource
|
34
34
|
|
35
35
|
attr_reader toolchain: Toolchain
|
36
|
+
attr_reader baseruby: BaseRubyProduct
|
36
37
|
|
37
38
|
def initialize: (
|
38
39
|
string name,
|
@@ -168,7 +169,7 @@ module RubyWasm
|
|
168
169
|
def feature_name: (CrossRubyProduct crossruby) -> String
|
169
170
|
|
170
171
|
def make_args: (CrossRubyProduct crossruby) -> Array[String]
|
171
|
-
def build: (BuildExecutor executor, CrossRubyProduct crossruby) -> void
|
172
|
+
def build: (BuildExecutor executor, CrossRubyProduct crossruby, Array[String] extra_mkargs) -> void
|
172
173
|
def do_extconf: (BuildExecutor executor, CrossRubyProduct crossruby) -> void
|
173
174
|
def do_install_rb: (BuildExecutor executor, CrossRubyProduct crossruby) -> void
|
174
175
|
|
data/sig/ruby_wasm/cli.rbs
CHANGED
@@ -14,10 +14,12 @@ module RubyWasm
|
|
14
14
|
target_triplet: String,
|
15
15
|
profile: String,
|
16
16
|
stdlib: bool,
|
17
|
+
without_stdlib_components: Array[String],
|
17
18
|
disable_gems: bool,
|
18
19
|
gemfile: String?,
|
19
20
|
patches: Array[String],
|
20
21
|
format: String,
|
22
|
+
dest_dir: String,
|
21
23
|
}
|
22
24
|
|
23
25
|
DEFAULT_RUBIES_DIR: string
|
data/sig/ruby_wasm/ext.rbs
CHANGED
@@ -33,4 +33,12 @@ module RubyWasmExt
|
|
33
33
|
def import_name_map: (Hash[String, String] map) -> void
|
34
34
|
def encode: () -> bytes
|
35
35
|
end
|
36
|
+
|
37
|
+
class WasiVirt
|
38
|
+
def initialize: () -> void
|
39
|
+
def allow_all: () -> void
|
40
|
+
def map_dir: (String guest_path, String host_path) -> void
|
41
|
+
def finish: () -> bytes
|
42
|
+
def compose: (bytes component_bytes) -> bytes
|
43
|
+
end
|
36
44
|
end
|
data/sig/ruby_wasm/packager.rbs
CHANGED
@@ -23,6 +23,7 @@ class RubyWasm::Packager
|
|
23
23
|
src: RubyWasm::Packager::build_source,
|
24
24
|
default_exts: String,
|
25
25
|
suffix: String,
|
26
|
+
gem_home: String?,
|
26
27
|
}
|
27
28
|
|
28
29
|
type bytes = String
|
@@ -45,7 +46,7 @@ class RubyWasm::Packager
|
|
45
46
|
|
46
47
|
def root: () -> string
|
47
48
|
|
48
|
-
ALL_DEFAULT_EXTS:
|
49
|
+
ALL_DEFAULT_EXTS: String
|
49
50
|
|
50
51
|
def build_options: () -> Hash[Symbol, untyped]
|
51
52
|
def full_build_options: () -> Hash[Symbol, untyped]
|
@@ -56,7 +57,8 @@ class RubyWasm::Packager
|
|
56
57
|
@packager: RubyWasm::Packager
|
57
58
|
def initialize: (RubyWasm::Packager) -> void
|
58
59
|
def build: (RubyWasm::BuildExecutor, untyped options) -> String
|
59
|
-
def
|
60
|
+
def build_gem_exts: (RubyWasm::BuildExecutor, string gem_home) -> void
|
61
|
+
def link_gem_exts: (RubyWasm::BuildExecutor, string ruby_root, string gem_home, bytes module_bytes) -> bytes
|
60
62
|
|
61
63
|
extend Forwardable
|
62
64
|
|
@@ -72,16 +74,19 @@ class RubyWasm::Packager
|
|
72
74
|
def initialize: (RubyWasm::Packager) -> void
|
73
75
|
def build: (RubyWasm::BuildExecutor, untyped options) -> String
|
74
76
|
def specs_with_extensions: () -> Array[[untyped, Array[string]]]
|
75
|
-
def
|
77
|
+
def build_gem_exts: (RubyWasm::BuildExecutor, string gem_home) -> void
|
78
|
+
def link_gem_exts: (RubyWasm::BuildExecutor, string ruby_root, string gem_home, bytes module_bytes) -> bytes
|
79
|
+
def wasi_exec_model: () -> String
|
80
|
+
def with_unbundled_env: () { () -> void } -> void
|
76
81
|
end
|
77
82
|
|
78
83
|
class DynamicLinking < RubyWasm::Packager::Core::BuildStrategy
|
79
84
|
@build: RubyWasm::Build
|
80
85
|
def derive_build: () -> RubyWasm::Build
|
81
|
-
def build_exts: (RubyWasm::BuildExecutor, RubyWasm::Build) -> void
|
82
86
|
def name: () -> string
|
83
87
|
|
84
|
-
private def
|
88
|
+
private def _build_gem_exts: (RubyWasm::BuildExecutor, RubyWasm::Build, string gem_home) -> void
|
89
|
+
private def _link_gem_exts: (RubyWasm::BuildExecutor, RubyWasm::Build, string ruby_root, string gem_home, bytes module_bytes) -> bytes
|
85
90
|
end
|
86
91
|
|
87
92
|
class StaticLinking < RubyWasm::Packager::Core::BuildStrategy
|
@@ -102,6 +107,7 @@ class RubyWasm::Packager
|
|
102
107
|
def initialize: (string dest_dir, RubyWasm::Packager) -> void
|
103
108
|
def package_ruby_root: (String tarball, RubyWasm::BuildExecutor) -> void
|
104
109
|
def remove_stdlib: (RubyWasm::BuildExecutor) -> void
|
110
|
+
def remove_stdlib_component: (RubyWasm::BuildExecutor, string) -> void
|
105
111
|
def package_gems: () -> void
|
106
112
|
|
107
113
|
def setup_rb_content: () -> String
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_wasm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.2
|
5
5
|
platform: arm64-darwin
|
6
6
|
authors:
|
7
7
|
- Yuta Saito
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby to WebAssembly toolkit. This gem takes Ruby code and Gemfile, and
|
14
14
|
packages them with Ruby runtime into a WebAssembly binary.
|
@@ -32,9 +32,7 @@ files:
|
|
32
32
|
- docs/cheat_sheet.md
|
33
33
|
- docs/faq.md
|
34
34
|
- exe/rbwasm
|
35
|
-
- ext
|
36
|
-
- ext/README.md
|
37
|
-
- ext/extinit.c.erb
|
35
|
+
- ext/ruby_wasm/README.md
|
38
36
|
- lib/ruby_wasm.rb
|
39
37
|
- lib/ruby_wasm/3.1/ruby_wasm.bundle
|
40
38
|
- lib/ruby_wasm/3.2/ruby_wasm.bundle
|
@@ -46,6 +44,7 @@ files:
|
|
46
44
|
- lib/ruby_wasm/build/product.rb
|
47
45
|
- lib/ruby_wasm/build/product/baseruby.rb
|
48
46
|
- lib/ruby_wasm/build/product/crossruby.rb
|
47
|
+
- lib/ruby_wasm/build/product/crossruby/extinit.c.erb
|
49
48
|
- lib/ruby_wasm/build/product/libyaml.rb
|
50
49
|
- lib/ruby_wasm/build/product/openssl.rb
|
51
50
|
- lib/ruby_wasm/build/product/product.rb
|
data/ext/.gitignore
DELETED
data/ext/README.md
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
# Ruby extensions
|
2
|
-
`ruby.wasm` uses two C extensions to turn Ruby in to a guest module.
|
3
|
-
The `js` extension enables Ruby to use JavaScript APIs.
|
4
|
-
The `witapi` extension exports Ruby's interpreter interface to allow the host to use the Ruby interpreter.
|
5
|
-
In other words, `js` allows Ruby to talk to Javascript and `witapi` allows a host to talk to Ruby.
|
6
|
-
|
7
|
-
Under each subdirectory, there is a `bindgen/*.wit` file outlining the interfaces for each form of communication.
|
8
|
-
Specifically, `bindgen/rb-js-abi-host.wit` describes embedder's requirements and `bindgen/rb-js-abi-guest.wit` describes exported API from Ruby interpreter.
|
9
|
-
The `.c` and `.h` files are autogenerated from [wit-bindgen](https://github.com/bytecodealliance/wit-bindgen#host-runtimes-for-components).
|
10
|
-
You can read more about it in the [contributing guide](/CONTRIBUTING.md#re-bindgen-from-wit-files).
|
11
|
-
Note that we currently do not use the latest version of wit-bindgen because of how fast it is changing, with features being changed or even [removed](https://github.com/bytecodealliance/wit-bindgen/pull/346) at times.
|
File without changes
|