ruby_wasm 2.7.1-x64-mingw-ucrt → 2.8.1-x64-mingw-ucrt

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.
data/package.json CHANGED
@@ -6,10 +6,10 @@
6
6
  ],
7
7
  "devDependencies": {
8
8
  "@bytecodealliance/jco": "1.4.4",
9
- "@playwright/test": "^1.49.0",
10
- "@rollup/plugin-node-resolve": "^15.3.0",
9
+ "@playwright/test": "^1.54.1",
10
+ "@rollup/plugin-node-resolve": "^16.0.1",
11
11
  "@rollup/plugin-json": "^6.1.0",
12
- "rollup": "^4.28.0",
13
- "typedoc": "^0.27.2"
12
+ "rollup": "^4.46.2",
13
+ "typedoc": "^0.28.8"
14
14
  }
15
15
  }
data/rakelib/ci.rake CHANGED
@@ -1,7 +1,8 @@
1
1
  def latest_build_sources
2
2
  BUILD_SOURCES
3
3
  .filter_map do |name|
4
- src = RubyWasm::CLI.build_source_aliases(LIB_ROOT)[name]
4
+ config = RubyWasm::CLI.build_config_aliases(LIB_ROOT)[name]
5
+ src = config[:src]
5
6
  case src[:type]
6
7
  when "github"
7
8
  url = "repos/#{src[:repo]}/commits/#{src[:rev]}"
@@ -23,7 +24,8 @@ def release_note
23
24
  EOS
24
25
 
25
26
  BUILD_SOURCES.each do |name|
26
- source = RubyWasm::CLI.build_source_aliases(LIB_ROOT)[name]
27
+ config = RubyWasm::CLI.build_config_aliases(LIB_ROOT)[name]
28
+ source = config[:src]
27
29
  case source[:type]
28
30
  when "github"
29
31
  output +=
@@ -132,6 +134,40 @@ namespace :ci do
132
134
  end
133
135
  end
134
136
 
137
+ desc "Prune old caches in GitHub Actions"
138
+ task :prune_caches, [:days] do |_, args|
139
+ RubyWasm::Toolchain.check_executable("gh")
140
+
141
+ days = (args[:days] || 1).to_i
142
+ repo = ENV["GITHUB_REPOSITORY"] || "ruby/ruby.wasm"
143
+ cutoff = (Time.now.utc - days * 86_400).iso8601
144
+
145
+ puts "Deleting caches last accessed before #{cutoff}…"
146
+
147
+ page = 1
148
+ deleted = 0
149
+
150
+ loop do
151
+ resp = `gh api -H 'Accept: application/vnd.github+json' "/repos/#{repo}/actions/caches?per_page=100&page=#{page}"`
152
+ raise "gh api failed" unless $?.success?
153
+
154
+ data = JSON.parse(resp)
155
+ caches = data["actions_caches"]
156
+
157
+ old = caches.select { |c| c["last_accessed_at"] < cutoff }
158
+ old.each do |c|
159
+ id = c["id"]
160
+ system("gh api -X DELETE /repos/#{repo}/actions/caches/#{id}")
161
+ deleted += 1
162
+ end
163
+
164
+ break if caches.size < 100
165
+ page += 1
166
+ end
167
+
168
+ puts "Deleted #{deleted} caches older than #{days} days."
169
+ end
170
+
135
171
  desc "Publish artifacts as a GitHub Release"
136
172
  task :publish, [:tag] do |t, args|
137
173
  RubyWasm::Toolchain.check_executable("gh")
@@ -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]}",
@@ -240,7 +240,7 @@ module RubyWasm
240
240
  def initialize: -> void
241
241
  def find_tool: (Symbol name) -> String
242
242
  def check_envvar: (untyped name) -> void
243
- def self.get: (Target target, ?String? build_dir) -> (Toolchain)
243
+ def self.get: (Target target, Hash[untyped, untyped] config, ?String? build_dir) -> (Toolchain)
244
244
  def self.find_path: (String command) -> String?
245
245
  def self.check_executable: (String command) -> String
246
246
  def cc: -> String
@@ -249,28 +249,38 @@ module RubyWasm
249
249
  def ld: -> String
250
250
  def ar: -> String
251
251
 
252
- def install: -> void
252
+ def install: (_CommandExecutor executor) -> void
253
253
  end
254
254
 
255
255
  class WASISDK < Toolchain
256
256
  @wasm_opt_path: String
257
257
  @need_fetch_wasi_sdk: bool
258
- @need_fetch_binaryen: bool
259
258
  @tools: Hash[Symbol, String]
260
259
  @wasi_sdk_path: String
261
- @binaryen_version: Integer
262
- @version_major: Integer
263
- @version_minor: Integer
264
- @binaryen_path: String
260
+ @version: String
261
+ @binaryen: Binaryen
265
262
 
266
- def initialize: (?String? wasi_sdk_path, ?build_dir: String?, ?version_major: Integer, ?version_minor: Integer, ?binaryen_version: Integer) -> void
263
+ def initialize: (?String? wasi_sdk_path, ?build_dir: String?, ?version: String, ?binaryen_version: Integer) -> void
267
264
  def find_tool: (Symbol name) -> String
268
265
  def wasm_opt: -> String
269
266
  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
267
+ def download_url: () -> String
268
+ def install_wasi_sdk: (_CommandExecutor executor) -> void
269
+ def install: (_CommandExecutor executor) -> void
270
+ end
271
+
272
+ class Binaryen
273
+ @need_fetch_binaryen: bool
274
+ @binaryen_path: String
275
+ @binaryen_version: Integer
276
+ @wasm_opt_path: String
277
+
278
+ def initialize: (?build_dir: String?, ?binaryen_version: Integer) -> void
279
+ def wasm_opt: -> String
280
+ def binaryen_path: -> String
281
+ def binaryen_version: -> Integer
282
+ def download_url: (Integer version) -> String
283
+ def install: (_CommandExecutor executor) -> void
274
284
  end
275
285
 
276
286
  class Emscripten < Toolchain
@@ -280,7 +290,12 @@ module RubyWasm
280
290
  def find_tool: (Symbol name) -> String
281
291
  end
282
292
 
293
+ interface _CommandExecutor
294
+ def system: (*_ToS args, ?chdir: String?, ?env: Hash[String, String]?) -> void
295
+ end
296
+
283
297
  class BuildExecutor
298
+ include _CommandExecutor
284
299
  @verbose: bool
285
300
  @github_actions_markup: bool
286
301
  @process_count: Integer
@@ -289,7 +304,6 @@ module RubyWasm
289
304
  attr_reader process_count: Integer
290
305
 
291
306
  def initialize: (?verbose: bool) -> void
292
- def system: (*_ToS args, ?chdir: String?, ?env: Hash[String, String]?) -> void
293
307
  def rm_rf: (FileUtils::pathlist list) -> void
294
308
  def rm_f: (FileUtils::pathlist list) -> void
295
309
  def cp_r: (FileUtils::pathlist src, path dest) -> void
@@ -304,6 +318,10 @@ module RubyWasm
304
318
  private def _print_command: (Array[_ToS] command, Hash[String, String]? env) -> void
305
319
  end
306
320
 
321
+ class SilentExecutor
322
+ include _CommandExecutor
323
+ end
324
+
307
325
  class StatusPrinter
308
326
  @mutex: Mutex
309
327
  @counter: Integer
@@ -319,6 +337,8 @@ module RubyWasm
319
337
  def format_size: (Integer size) -> String
320
338
 
321
339
  def download: (String url, String dest, String message) -> void
340
+ def head: (String url) -> bool
341
+ private def _head: (URI::HTTPS uri, Integer limit) -> bool
322
342
  end
323
343
 
324
344
  class BuildTask
@@ -29,14 +29,17 @@ module RubyWasm
29
29
 
30
30
  def initialize: (stdout: IO, stderr: IO) -> void
31
31
 
32
+ def run: (Array[String] args) -> void
33
+
32
34
  def build: (Array[String] args) -> void
35
+ def do_build_with_force_ruby_platform: (cli_options options) -> void
33
36
  def pack: (Array[String] args) -> void
34
37
 
35
38
  private
36
39
 
37
40
  def build_config: (cli_options options) -> Packager::build_config
38
- def compute_build_source: (cli_options options) -> [Packager::build_source, String?]
39
- 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]
40
43
  def self.bundled_patches_path: () -> string
41
44
  def root: () -> string
42
45
 
@@ -49,5 +52,6 @@ module RubyWasm
49
52
 
50
53
  self.@logger: Logger?
51
54
  def self.logger: () -> Logger
55
+ def self.logger=: (Logger) -> void
52
56
  attr_accessor self.log_level: Symbol
53
57
  end
@@ -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
 
@@ -70,8 +61,12 @@ class RubyWasm::Packager
70
61
  def build_strategy: () -> BuildStrategy
71
62
 
72
63
  class BuildStrategy
64
+ include RubyWasm::_Cacheable
65
+
73
66
  @packager: RubyWasm::Packager
74
67
  def initialize: (RubyWasm::Packager) -> void
68
+ def target: () -> RubyWasm::Target
69
+ def artifact: () -> string
75
70
  def build: (RubyWasm::BuildExecutor, untyped options) -> String
76
71
  def specs_with_extensions: () -> Array[[untyped, Array[string]]]
77
72
  def build_gem_exts: (RubyWasm::BuildExecutor, string gem_home) -> void
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_wasm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
4
+ version: 2.8.1
5
5
  platform: x64-mingw-ucrt
6
6
  authors:
7
7
  - Yuta Saito
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-23 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2025-12-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: logger
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: Ruby to WebAssembly toolkit. This gem takes Ruby code and Gemfile, and
14
28
  packages them with Ruby runtime into a WebAssembly binary.
15
29
  email:
@@ -34,8 +48,6 @@ files:
34
48
  - exe/rbwasm
35
49
  - ext/ruby_wasm/README.md
36
50
  - lib/ruby_wasm.rb
37
- - lib/ruby_wasm/3.1/ruby_wasm.so
38
- - lib/ruby_wasm/3.2/ruby_wasm.so
39
51
  - lib/ruby_wasm/3.3/ruby_wasm.so
40
52
  - lib/ruby_wasm/3.4/ruby_wasm.so
41
53
  - lib/ruby_wasm/build.rb
@@ -97,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
109
  requirements:
98
110
  - - ">="
99
111
  - !ruby/object:Gem::Version
100
- version: '3.1'
112
+ version: '3.3'
101
113
  - - "<"
102
114
  - !ruby/object:Gem::Version
103
115
  version: 3.5.dev
Binary file
Binary file