ruby_wasm 2.7.2 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
1
  wasi_vfs = RubyWasm::WasiVfsProduct.new(File.join(Dir.pwd, "build"))
2
- wasi_sdk = TOOLCHAINS["wasi-sdk"]
2
+ binaryen = RubyWasm::Binaryen.new(build_dir: File.join(Dir.pwd, "build"))
3
3
  def exe_rbwasm = File.expand_path(File.join(__dir__, "..", "exe", "rbwasm"))
4
4
 
5
5
  tools = {
6
6
  "WASI_VFS_CLI" => exe_rbwasm,
7
- "WASMOPT" => wasi_sdk.wasm_opt
7
+ "WASMOPT" => binaryen.wasm_opt
8
8
  }
9
9
 
10
10
  def npm_pkg_build_command(pkg)
@@ -51,7 +51,7 @@ def vendor_gem_cache(pkg)
51
51
  JS::VERSION
52
52
  end
53
53
 
54
- def build_ruby(pkg, base_dir, pkg_dir, wasi_sdk, clean: false)
54
+ def build_ruby(pkg, base_dir, pkg_dir, binaryen, clean: false)
55
55
  build_command = npm_pkg_build_command(pkg)
56
56
  # Skip if the package does not require building ruby
57
57
  return unless build_command
@@ -111,12 +111,12 @@ def build_ruby(pkg, base_dir, pkg_dir, wasi_sdk, clean: false)
111
111
  File.join(dist_dir, "ruby.debug+stdlib.wasm")
112
112
  end
113
113
 
114
- sh wasi_sdk.wasm_opt,
114
+ sh binaryen.wasm_opt,
115
115
  "--strip-debug",
116
116
  File.join(dist_dir, "ruby.wasm"),
117
117
  "-o",
118
118
  File.join(dist_dir, "ruby.wasm")
119
- sh wasi_sdk.wasm_opt,
119
+ sh binaryen.wasm_opt,
120
120
  "--strip-debug",
121
121
  File.join(dist_dir, "ruby.debug+stdlib.wasm"),
122
122
  "-o",
@@ -137,7 +137,7 @@ namespace :npm do
137
137
  namespace pkg[:name] do
138
138
  desc "Build ruby for npm package #{pkg[:name]}"
139
139
  task "ruby" do
140
- build_ruby(pkg, base_dir, pkg_dir, wasi_sdk)
140
+ build_ruby(pkg, base_dir, pkg_dir, binaryen)
141
141
  end
142
142
 
143
143
  desc "Build npm package #{pkg[:name]}"
@@ -147,7 +147,7 @@ namespace :npm do
147
147
 
148
148
  desc "Clean and build npm package #{pkg[:name]}"
149
149
  task "clean-build" do
150
- build_ruby(pkg, base_dir, pkg_dir, wasi_sdk, clean: true)
150
+ build_ruby(pkg, base_dir, pkg_dir, binaryen, clean: true)
151
151
  end
152
152
 
153
153
  desc "Check npm package #{pkg[:name]}"
@@ -158,7 +158,8 @@ namespace :npm do
158
158
 
159
159
  desc "Make tarball for npm package #{pkg[:name]}"
160
160
  task pkg[:name] do
161
- wasi_sdk.install_binaryen
161
+ executor = RubyWasm::BuildExecutor.new
162
+ binaryen.install(executor)
162
163
  Rake::Task["npm:#{pkg[:name]}:build"].invoke
163
164
  sh "npm pack", chdir: pkg_dir
164
165
  end
@@ -201,7 +202,8 @@ namespace :standalone do
201
202
 
202
203
  desc "Build standalone package #{pkg[:name]}"
203
204
  task "#{pkg[:name]}" => ["build:#{pkg[:build]}"] do
204
- wasi_sdk.install_binaryen
205
+ executor = RubyWasm::SilentExecutor.new
206
+ binaryen.install(executor)
205
207
  base_dir = Dir.pwd
206
208
  sh tools,
207
209
  "./build-package.sh #{base_dir}/rubies/ruby-#{pkg[:build]}",
@@ -218,6 +218,7 @@ module RubyWasm
218
218
  def extinit_obj: -> String
219
219
  def extinit_c_erb: -> String
220
220
  def baseruby_path: -> String
221
+ def dump_ast_path: -> String
221
222
  def configure_args: (String build_triple, Toolchain toolchain) -> Array[String]
222
223
  def rbconfig_rb: -> String?
223
224
  end
@@ -240,7 +241,7 @@ module RubyWasm
240
241
  def initialize: -> void
241
242
  def find_tool: (Symbol name) -> String
242
243
  def check_envvar: (untyped name) -> void
243
- def self.get: (Target target, ?String? build_dir) -> (Toolchain)
244
+ def self.get: (Target target, Hash[untyped, untyped] config, ?String? build_dir) -> (Toolchain)
244
245
  def self.find_path: (String command) -> String?
245
246
  def self.check_executable: (String command) -> String
246
247
  def cc: -> String
@@ -249,28 +250,38 @@ module RubyWasm
249
250
  def ld: -> String
250
251
  def ar: -> String
251
252
 
252
- def install: -> void
253
+ def install: (_CommandExecutor executor) -> void
253
254
  end
254
255
 
255
256
  class WASISDK < Toolchain
256
257
  @wasm_opt_path: String
257
258
  @need_fetch_wasi_sdk: bool
258
- @need_fetch_binaryen: bool
259
259
  @tools: Hash[Symbol, String]
260
260
  @wasi_sdk_path: String
261
- @binaryen_version: Integer
262
- @version_major: Integer
263
- @version_minor: Integer
264
- @binaryen_path: String
261
+ @version: String
262
+ @binaryen: Binaryen
265
263
 
266
- def initialize: (?String? wasi_sdk_path, ?build_dir: String?, ?version_major: Integer, ?version_minor: Integer, ?binaryen_version: Integer) -> void
264
+ def initialize: (?String? wasi_sdk_path, ?build_dir: String?, ?version: String, ?binaryen_version: Integer) -> void
267
265
  def find_tool: (Symbol name) -> String
268
266
  def wasm_opt: -> String
269
267
  def wasi_sdk_path: -> String
270
- def download_url: (Integer? version_major, Integer? version_minor) -> String
271
- def binaryen_download_url: (Integer? version) -> String
272
- def install_wasi_sdk: -> void
273
- def install_binaryen: -> void
268
+ def download_url: () -> String
269
+ def install_wasi_sdk: (_CommandExecutor executor) -> void
270
+ def install: (_CommandExecutor executor) -> void
271
+ end
272
+
273
+ class Binaryen
274
+ @need_fetch_binaryen: bool
275
+ @binaryen_path: String
276
+ @binaryen_version: Integer
277
+ @wasm_opt_path: String
278
+
279
+ def initialize: (?build_dir: String?, ?binaryen_version: Integer) -> void
280
+ def wasm_opt: -> String
281
+ def binaryen_path: -> String
282
+ def binaryen_version: -> Integer
283
+ def download_url: (Integer version) -> String
284
+ def install: (_CommandExecutor executor) -> void
274
285
  end
275
286
 
276
287
  class Emscripten < Toolchain
@@ -280,7 +291,12 @@ module RubyWasm
280
291
  def find_tool: (Symbol name) -> String
281
292
  end
282
293
 
294
+ interface _CommandExecutor
295
+ def system: (*_ToS args, ?chdir: String?, ?env: Hash[String, String]?) -> void
296
+ end
297
+
283
298
  class BuildExecutor
299
+ include _CommandExecutor
284
300
  @verbose: bool
285
301
  @github_actions_markup: bool
286
302
  @process_count: Integer
@@ -289,7 +305,6 @@ module RubyWasm
289
305
  attr_reader process_count: Integer
290
306
 
291
307
  def initialize: (?verbose: bool) -> void
292
- def system: (*_ToS args, ?chdir: String?, ?env: Hash[String, String]?) -> void
293
308
  def rm_rf: (FileUtils::pathlist list) -> void
294
309
  def rm_f: (FileUtils::pathlist list) -> void
295
310
  def cp_r: (FileUtils::pathlist src, path dest) -> void
@@ -304,6 +319,10 @@ module RubyWasm
304
319
  private def _print_command: (Array[_ToS] command, Hash[String, String]? env) -> void
305
320
  end
306
321
 
322
+ class SilentExecutor
323
+ include _CommandExecutor
324
+ end
325
+
307
326
  class StatusPrinter
308
327
  @mutex: Mutex
309
328
  @counter: Integer
@@ -319,6 +338,8 @@ module RubyWasm
319
338
  def format_size: (Integer size) -> String
320
339
 
321
340
  def download: (String url, String dest, String message) -> void
341
+ def head: (String url) -> bool
342
+ private def _head: (URI::HTTPS uri, Integer limit) -> bool
322
343
  end
323
344
 
324
345
  class BuildTask
@@ -38,8 +38,8 @@ module RubyWasm
38
38
  private
39
39
 
40
40
  def build_config: (cli_options options) -> Packager::build_config
41
- def compute_build_source: (cli_options options) -> [Packager::build_source, String?]
42
- def self.build_source_aliases: (string root) -> Hash[string, Packager::build_source]
41
+ def compute_build_alias: (cli_options options) -> Packager::build_config
42
+ def self.build_config_aliases: (string root) -> Hash[string, Packager::build_config]
43
43
  def self.bundled_patches_path: () -> string
44
44
  def root: () -> string
45
45
 
@@ -13,18 +13,9 @@ class RubyWasm::Packager
13
13
  type: "local",
14
14
  path: String,
15
15
  }
16
- type build_source = (build_source_github | build_source_tarball | build_source_local) & {
17
- name: string,
18
- patches: Array[String],
19
- }
16
+ type build_source = untyped
20
17
 
21
- type build_config = {
22
- target: String,
23
- src: RubyWasm::Packager::build_source,
24
- default_exts: String,
25
- suffix: String,
26
- gem_home: String?,
27
- }
18
+ type build_config = untyped
28
19
 
29
20
  type bytes = String
30
21
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_wasm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.2
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuta Saito
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-10-03 00:00:00.000000000 Z
10
+ date: 2026-03-29 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: logger
@@ -105,7 +104,6 @@ licenses:
105
104
  metadata:
106
105
  homepage_uri: https://github.com/ruby/ruby.wasm
107
106
  source_code_uri: https://github.com/ruby/ruby.wasm
108
- post_install_message:
109
107
  rdoc_options: []
110
108
  require_paths:
111
109
  - lib
@@ -120,8 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
118
  - !ruby/object:Gem::Version
121
119
  version: '0'
122
120
  requirements: []
123
- rubygems_version: 3.5.3
124
- signing_key:
121
+ rubygems_version: 3.6.2
125
122
  specification_version: 4
126
123
  summary: Ruby to WebAssembly toolkit
127
124
  test_files: []