ruby_wasm 2.5.1-x86_64-linux-musl → 2.6.0-x86_64-linux-musl
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +3 -2
- data/README.md +3 -3
- data/Rakefile +2 -1
- data/docs/cheat_sheet.md +8 -8
- data/lib/ruby_wasm/3.1/ruby_wasm.so +0 -0
- data/lib/ruby_wasm/3.2/ruby_wasm.so +0 -0
- data/lib/ruby_wasm/3.3/ruby_wasm.so +0 -0
- data/lib/ruby_wasm/build/product/crossruby.rb +7 -2
- data/lib/ruby_wasm/build/product/product.rb +1 -0
- data/lib/ruby_wasm/build/toolchain/wit_bindgen.rb +2 -2
- data/lib/ruby_wasm/build/toolchain.rb +3 -2
- data/lib/ruby_wasm/cli.rb +13 -7
- data/lib/ruby_wasm/feature_set.rb +30 -0
- data/lib/ruby_wasm/packager/core.rb +26 -9
- data/lib/ruby_wasm/packager/file_system.rb +1 -1
- data/lib/ruby_wasm/packager.rb +9 -6
- data/lib/ruby_wasm/version.rb +1 -1
- data/lib/ruby_wasm.rb +1 -0
- data/package-lock.json +5512 -7233
- data/package.json +2 -2
- data/rakelib/check.rake +23 -10
- data/rakelib/packaging.rake +18 -3
- data/sig/ruby_wasm/build.rbs +3 -1
- data/sig/ruby_wasm/cli.rbs +1 -1
- data/sig/ruby_wasm/ext.rbs +10 -0
- data/sig/ruby_wasm/feature_set.rbs +12 -0
- data/sig/ruby_wasm/packager.rbs +11 -5
- metadata +4 -2
data/package.json
CHANGED
data/rakelib/check.rake
CHANGED
@@ -1,35 +1,48 @@
|
|
1
1
|
namespace :check do
|
2
|
+
legacy_wit_bindgen = RubyWasm::WitBindgen.new(build_dir: "build", revision: "251e84b89121751f79ac268629e9285082b2596d")
|
2
3
|
wit_bindgen = RubyWasm::WitBindgen.new(build_dir: "build")
|
3
4
|
task :install_wit_bindgen do
|
5
|
+
legacy_wit_bindgen.install
|
4
6
|
wit_bindgen.install
|
5
7
|
end
|
6
|
-
task
|
8
|
+
task legacy_bindgen_c: :install_wit_bindgen do
|
7
9
|
wits = [
|
8
|
-
%w[packages/gems/js/ext/
|
9
|
-
%w[packages/gems/js/ext/js/bindgen/rb-js-abi-host.wit --import]
|
10
|
+
%w[packages/gems/js/ext/js/bindgen/legacy/rb-abi-guest.wit --export],
|
11
|
+
%w[packages/gems/js/ext/js/bindgen/legacy/rb-js-abi-host.wit --import]
|
10
12
|
]
|
11
13
|
wits.each do |wit|
|
12
14
|
path, mode = wit
|
13
|
-
sh "#{
|
15
|
+
sh "#{legacy_wit_bindgen.bin_path} guest c #{mode} #{path} --out-dir #{File.dirname(path)}"
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
17
|
-
task
|
19
|
+
task legacy_bindgen_js: :install_wit_bindgen do
|
18
20
|
sh *[
|
19
|
-
|
21
|
+
legacy_wit_bindgen.bin_path,
|
20
22
|
"host",
|
21
23
|
"js",
|
22
24
|
"--import",
|
23
|
-
"packages/gems/js/ext/
|
25
|
+
"packages/gems/js/ext/js/bindgen/legacy/rb-abi-guest.wit",
|
24
26
|
"--export",
|
25
|
-
"packages/gems/js/ext/js/bindgen/rb-js-abi-host.wit",
|
27
|
+
"packages/gems/js/ext/js/bindgen/legacy/rb-js-abi-host.wit",
|
26
28
|
"--out-dir",
|
27
|
-
"packages/npm-packages/ruby-wasm-wasi/src/bindgen"
|
29
|
+
"packages/npm-packages/ruby-wasm-wasi/src/bindgen/legacy"
|
28
30
|
]
|
29
31
|
end
|
30
32
|
|
33
|
+
task bindgen_c: :install_wit_bindgen do
|
34
|
+
js_pkg_dir = "packages/gems/js"
|
35
|
+
sh(
|
36
|
+
wit_bindgen.bin_path,
|
37
|
+
"c",
|
38
|
+
File.join(js_pkg_dir, "wit"),
|
39
|
+
"--out-dir",
|
40
|
+
File.join(js_pkg_dir, "ext", "js", "bindgen")
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
31
44
|
desc "Check wit-bindgen'ed sources are up-to-date"
|
32
|
-
task bindgen: %i[bindgen_c
|
45
|
+
task bindgen: %i[bindgen_c legacy_bindgen_c legacy_bindgen_js]
|
33
46
|
|
34
47
|
task :type do
|
35
48
|
sh "bundle exec steep check"
|
data/rakelib/packaging.rake
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
wasi_vfs = RubyWasm::WasiVfsProduct.new(File.join(Dir.pwd, "build"))
|
2
2
|
wasi_sdk = TOOLCHAINS["wasi-sdk"]
|
3
|
+
def exe_rbwasm = File.expand_path(File.join(__dir__, "..", "exe", "rbwasm"))
|
4
|
+
|
3
5
|
tools = {
|
4
|
-
"WASI_VFS_CLI" =>
|
6
|
+
"WASI_VFS_CLI" => exe_rbwasm,
|
5
7
|
"WASMOPT" => wasi_sdk.wasm_opt
|
6
8
|
}
|
7
9
|
|
@@ -11,7 +13,7 @@ def npm_pkg_build_command(pkg)
|
|
11
13
|
[
|
12
14
|
"bundle",
|
13
15
|
"exec",
|
14
|
-
|
16
|
+
exe_rbwasm,
|
15
17
|
"build",
|
16
18
|
"--ruby-version",
|
17
19
|
pkg[:ruby_version],
|
@@ -27,7 +29,8 @@ def npm_pkg_rubies_cache_key(pkg)
|
|
27
29
|
return nil unless build_command
|
28
30
|
require "open3"
|
29
31
|
cmd = build_command + ["--print-ruby-cache-key"]
|
30
|
-
|
32
|
+
chdir = pkg[:gemfile] ? File.dirname(pkg[:gemfile]) : Dir.pwd
|
33
|
+
stdout, status = Open3.capture2(*cmd, chdir: chdir)
|
31
34
|
unless status.success?
|
32
35
|
raise "Command failed with status (#{status.exitstatus}): #{cmd.join ""}"
|
33
36
|
end
|
@@ -72,6 +75,18 @@ namespace :npm do
|
|
72
75
|
*build_command,
|
73
76
|
"-o",
|
74
77
|
File.join(dist_dir, "ruby.debug+stdlib.wasm")
|
78
|
+
if pkg[:enable_component_model]
|
79
|
+
component_path = File.join(pkg_dir, "tmp", "ruby.component.wasm")
|
80
|
+
FileUtils.mkdir_p(File.dirname(component_path))
|
81
|
+
|
82
|
+
sh env.merge("RUBY_WASM_EXPERIMENTAL_COMPONENT_MODEL" => "1"),
|
83
|
+
*build_command, "-o", component_path
|
84
|
+
sh "npx", "jco", "transpile",
|
85
|
+
"--no-wasi-shim", "--instantiation", "--valid-lifting-optimization",
|
86
|
+
component_path, "-o", File.join(dist_dir, "component")
|
87
|
+
# ./component/package.json is required to be an ES module
|
88
|
+
File.write(File.join(dist_dir, "component", "package.json"), '{ "type": "module" }')
|
89
|
+
end
|
75
90
|
end
|
76
91
|
sh wasi_sdk.wasm_opt,
|
77
92
|
"--strip-debug",
|
data/sig/ruby_wasm/build.rbs
CHANGED
@@ -158,9 +158,10 @@ module RubyWasm
|
|
158
158
|
@toolchain: Toolchain
|
159
159
|
@srcdir: String
|
160
160
|
@ext_relative_path: String
|
161
|
+
@features: RubyWasm::FeatureSet
|
161
162
|
|
162
163
|
attr_reader name: String
|
163
|
-
def initialize: (String srcdir, Toolchain toolchain, ?ext_relative_path: String?) -> void
|
164
|
+
def initialize: (String srcdir, Toolchain toolchain, features: RubyWasm::FeatureSet, ?ext_relative_path: String?) -> void
|
164
165
|
def product_build_dir: (CrossRubyProduct crossruby) -> String
|
165
166
|
def linklist: (CrossRubyProduct crossruby) -> String
|
166
167
|
def metadata_json: (CrossRubyProduct crossruby) -> String
|
@@ -241,6 +242,7 @@ module RubyWasm
|
|
241
242
|
def self.find_path: (String command) -> String?
|
242
243
|
def self.check_executable: (String command) -> String
|
243
244
|
def cc: -> String
|
245
|
+
def cxx: -> String
|
244
246
|
def ranlib: -> String
|
245
247
|
def ld: -> String
|
246
248
|
def ar: -> String
|
data/sig/ruby_wasm/cli.rbs
CHANGED
@@ -33,7 +33,7 @@ module RubyWasm
|
|
33
33
|
private
|
34
34
|
|
35
35
|
def build_config: (cli_options options) -> Packager::build_config
|
36
|
-
def compute_build_source: (cli_options options) -> Packager::build_source
|
36
|
+
def compute_build_source: (cli_options options) -> [Packager::build_source, String?]
|
37
37
|
def self.build_source_aliases: (string root) -> Hash[string, Packager::build_source]
|
38
38
|
def self.bundled_patches_path: () -> string
|
39
39
|
def root: () -> string
|
data/sig/ruby_wasm/ext.rbs
CHANGED
@@ -23,4 +23,14 @@ module RubyWasmExt
|
|
23
23
|
def use_built_in_libdl: (bool) -> void
|
24
24
|
def encode: () -> bytes
|
25
25
|
end
|
26
|
+
|
27
|
+
class ComponentEncode
|
28
|
+
def initialize: () -> void
|
29
|
+
def validate: (bool) -> void
|
30
|
+
def adapter: (String name, bytes module) -> void
|
31
|
+
def module: (bytes module) -> void
|
32
|
+
def realloc_via_memory_grow: (bool) -> void
|
33
|
+
def import_name_map: (Hash[String, String] map) -> void
|
34
|
+
def encode: () -> bytes
|
35
|
+
end
|
26
36
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class RubyWasm::FeatureSet
|
2
|
+
@features: Hash[Symbol, bool]
|
3
|
+
|
4
|
+
def initialize: (Hash[Symbol, bool]) -> void
|
5
|
+
|
6
|
+
FEATURES: Hash[Symbol, String]
|
7
|
+
|
8
|
+
def self.derive_from_env: () -> RubyWasm::FeatureSet
|
9
|
+
|
10
|
+
def support_dynamic_linking?: () -> bool
|
11
|
+
def support_component_model?: () -> bool
|
12
|
+
end
|
data/sig/ruby_wasm/packager.rbs
CHANGED
@@ -18,14 +18,20 @@ class RubyWasm::Packager
|
|
18
18
|
patches: Array[String],
|
19
19
|
}
|
20
20
|
|
21
|
-
type build_config =
|
21
|
+
type build_config = {
|
22
|
+
target: String,
|
23
|
+
src: RubyWasm::Packager::build_source,
|
24
|
+
default_exts: String,
|
25
|
+
suffix: String,
|
26
|
+
}
|
22
27
|
|
23
28
|
type bytes = String
|
24
29
|
|
25
30
|
@definition: untyped
|
26
31
|
@config: build_config
|
32
|
+
@features: RubyWasm::FeatureSet
|
27
33
|
|
28
|
-
def initialize: (string root, build_config?, untyped? definition) -> void
|
34
|
+
def initialize: (string root, build_config?, untyped? definition, features: RubyWasm::FeatureSet) -> void
|
29
35
|
|
30
36
|
def package: (RubyWasm::BuildExecutor, string dest_dir, untyped options) -> bytes
|
31
37
|
|
@@ -35,7 +41,7 @@ class RubyWasm::Packager
|
|
35
41
|
EXCLUDED_GEMS: Array[string]
|
36
42
|
|
37
43
|
def specs: () -> Array[untyped]
|
38
|
-
def
|
44
|
+
def features: () -> RubyWasm::FeatureSet
|
39
45
|
|
40
46
|
def root: () -> string
|
41
47
|
|
@@ -50,7 +56,7 @@ class RubyWasm::Packager
|
|
50
56
|
@packager: RubyWasm::Packager
|
51
57
|
def initialize: (RubyWasm::Packager) -> void
|
52
58
|
def build: (RubyWasm::BuildExecutor, untyped options) -> String
|
53
|
-
def build_and_link_exts: (RubyWasm::BuildExecutor) -> bytes
|
59
|
+
def build_and_link_exts: (RubyWasm::BuildExecutor, bytes module_bytes) -> bytes
|
54
60
|
|
55
61
|
extend Forwardable
|
56
62
|
|
@@ -66,7 +72,7 @@ class RubyWasm::Packager
|
|
66
72
|
def initialize: (RubyWasm::Packager) -> void
|
67
73
|
def build: (RubyWasm::BuildExecutor, untyped options) -> String
|
68
74
|
def specs_with_extensions: () -> Array[[untyped, Array[string]]]
|
69
|
-
def build_and_link_exts: (RubyWasm::BuildExecutor) -> bytes
|
75
|
+
def build_and_link_exts: (RubyWasm::BuildExecutor, bytes module_bytes) -> bytes
|
70
76
|
end
|
71
77
|
|
72
78
|
class DynamicLinking < RubyWasm::Packager::Core::BuildStrategy
|
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.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: x86_64-linux-musl
|
6
6
|
authors:
|
7
7
|
- Yuta Saito
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-05 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.
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- lib/ruby_wasm/build/toolchain.rb
|
57
57
|
- lib/ruby_wasm/build/toolchain/wit_bindgen.rb
|
58
58
|
- lib/ruby_wasm/cli.rb
|
59
|
+
- lib/ruby_wasm/feature_set.rb
|
59
60
|
- lib/ruby_wasm/packager.rb
|
60
61
|
- lib/ruby_wasm/packager/component_adapter.rb
|
61
62
|
- lib/ruby_wasm/packager/component_adapter/wasi_snapshot_preview1.command.wasm
|
@@ -78,6 +79,7 @@ files:
|
|
78
79
|
- sig/ruby_wasm/build.rbs
|
79
80
|
- sig/ruby_wasm/cli.rbs
|
80
81
|
- sig/ruby_wasm/ext.rbs
|
82
|
+
- sig/ruby_wasm/feature_set.rbs
|
81
83
|
- sig/ruby_wasm/packager.rbs
|
82
84
|
- sig/ruby_wasm/util.rbs
|
83
85
|
- tools/clang-format-diff.sh
|