ruby_wasm 2.6.2-x86_64-linux → 2.7.0-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +8 -6
- data/Gemfile +2 -1
- data/NOTICE +1 -2
- data/README.md +1 -1
- data/Rakefile +9 -3
- data/docs/api.md +1 -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 +11 -3
- data/lib/ruby_wasm/cli.rb +9 -3
- data/lib/ruby_wasm/packager/core.rb +56 -38
- data/lib/ruby_wasm/packager/file_system.rb +0 -1
- data/lib/ruby_wasm/packager.rb +1 -1
- data/lib/ruby_wasm/version.rb +1 -1
- data/package-lock.json +1515 -7900
- data/package.json +4 -3
- data/rakelib/check.rake +5 -1
- data/rakelib/ci.rake +11 -5
- data/rakelib/doc.rake +11 -14
- data/rakelib/packaging.rake +98 -59
- data/rakelib/version.rake +19 -1
- data/sbom.spdx.json +114 -0
- data/sig/ruby_wasm/build.rbs +1 -0
- metadata +3 -5
- data/tools/clang-format-diff.sh +0 -18
- data/tools/exe/rbminify +0 -12
- data/tools/lib/syntax_tree/minify_ruby.rb +0 -63
data/package.json
CHANGED
@@ -5,9 +5,10 @@
|
|
5
5
|
"packages/npm-packages/*"
|
6
6
|
],
|
7
7
|
"devDependencies": {
|
8
|
-
"@
|
8
|
+
"@bytecodealliance/jco": "1.4.4",
|
9
|
+
"@playwright/test": "^1.46.1",
|
9
10
|
"@rollup/plugin-json": "^6.1.0",
|
10
|
-
"rollup": "^4.
|
11
|
-
"
|
11
|
+
"rollup": "^4.22.5",
|
12
|
+
"typedoc": "^0.26.7"
|
12
13
|
}
|
13
14
|
}
|
data/rakelib/check.rake
CHANGED
@@ -41,8 +41,12 @@ namespace :check do
|
|
41
41
|
)
|
42
42
|
end
|
43
43
|
|
44
|
+
task bindgen_ts: :install_wit_bindgen do
|
45
|
+
sh "node", "packages/npm-packages/ruby-wasm-wasi/tools/component-ts-bindgen.mjs"
|
46
|
+
end
|
47
|
+
|
44
48
|
desc "Check wit-bindgen'ed sources are up-to-date"
|
45
|
-
task bindgen: %i[bindgen_c legacy_bindgen_c legacy_bindgen_js]
|
49
|
+
task bindgen: %i[bindgen_c bindgen_ts legacy_bindgen_c legacy_bindgen_js]
|
46
50
|
|
47
51
|
task :type do
|
48
52
|
sh "bundle exec steep check"
|
data/rakelib/ci.rake
CHANGED
@@ -62,19 +62,21 @@ def rake_task_matrix
|
|
62
62
|
end
|
63
63
|
npm_entries =
|
64
64
|
NPM_PACKAGES.map do |pkg|
|
65
|
+
package_json =
|
66
|
+
JSON.parse(
|
67
|
+
File.read("packages/npm-packages/#{pkg[:name]}/package.json")
|
68
|
+
)
|
65
69
|
entry = {
|
66
70
|
task: "npm:#{pkg[:name]}",
|
67
71
|
prerelease: "npm:configure_prerelease",
|
68
72
|
artifact: "packages/npm-packages/#{pkg[:name]}/#{pkg[:name]}-*.tgz",
|
69
73
|
artifact_name: "npm-#{pkg[:name]}",
|
74
|
+
# Skip publishing packages with `"private": true`
|
75
|
+
should_publish: !package_json["private"],
|
70
76
|
builder: pkg[:target],
|
71
77
|
rubies_cache_key: npm_pkg_rubies_cache_key(pkg)
|
72
78
|
}
|
73
79
|
# Run tests only if the package has 'test' script
|
74
|
-
package_json =
|
75
|
-
JSON.parse(
|
76
|
-
File.read("packages/npm-packages/#{pkg[:name]}/package.json")
|
77
|
-
)
|
78
80
|
if package_json["scripts"] && package_json["scripts"]["test"]
|
79
81
|
entry[:test] = "npm:#{pkg[:name]}:check"
|
80
82
|
end
|
@@ -95,7 +97,10 @@ end
|
|
95
97
|
|
96
98
|
namespace :ci do
|
97
99
|
task :rake_task_matrix do
|
98
|
-
|
100
|
+
content = JSON.generate(rake_task_matrix.flat_map { |_, entries| entries })
|
101
|
+
output = "ci_matrix.json"
|
102
|
+
File.write("#{output}", content)
|
103
|
+
puts "Created \"#{output}\""
|
99
104
|
end
|
100
105
|
|
101
106
|
task :pin_build_manifest do
|
@@ -139,6 +144,7 @@ namespace :ci do
|
|
139
144
|
.map { |entry| "release/#{entry[:artifact_name]}/*" }
|
140
145
|
File.open("release/note.md", "w") { |f| f.print release_note }
|
141
146
|
matrix[:npm].each do |task|
|
147
|
+
next unless task[:should_publish]
|
142
148
|
artifact = task[:artifact_name]
|
143
149
|
tarball = Dir.glob("release/#{artifact}/*")
|
144
150
|
next if tarball.empty?
|
data/rakelib/doc.rake
CHANGED
@@ -12,18 +12,15 @@ RDoc::Task.new do |doc|
|
|
12
12
|
]
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
"false",
|
27
|
-
"./packages/npm-packages/ruby-wasm-wasi/dist/esm/index.js"
|
28
|
-
end
|
15
|
+
desc "Generate TypeScript documentation"
|
16
|
+
task :typedoc do
|
17
|
+
sh "npm install"
|
18
|
+
mkdir_p "html/npm/@ruby/wasm-wasi"
|
19
|
+
sh "npx typedoc packages/npm-packages/ruby-wasm-wasi/src/index.ts --sort source-order --out html/npm/@ruby/wasm-wasi"
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Generate documentation site"
|
23
|
+
task :doc do
|
24
|
+
Rake::Task["rdoc"].invoke
|
25
|
+
Rake::Task["typedoc"].invoke
|
29
26
|
end
|
data/rakelib/packaging.rake
CHANGED
@@ -11,8 +11,6 @@ def npm_pkg_build_command(pkg)
|
|
11
11
|
# Skip if the package does not require building ruby
|
12
12
|
return nil unless pkg[:ruby_version] && pkg[:target]
|
13
13
|
[
|
14
|
-
"bundle",
|
15
|
-
"exec",
|
16
14
|
exe_rbwasm,
|
17
15
|
"build",
|
18
16
|
"--ruby-version",
|
@@ -25,6 +23,8 @@ def npm_pkg_build_command(pkg)
|
|
25
23
|
end
|
26
24
|
|
27
25
|
def npm_pkg_rubies_cache_key(pkg)
|
26
|
+
vendor_gem_cache(pkg)
|
27
|
+
|
28
28
|
build_command = npm_pkg_build_command(pkg)
|
29
29
|
return nil unless build_command
|
30
30
|
require "open3"
|
@@ -39,6 +39,96 @@ def npm_pkg_rubies_cache_key(pkg)
|
|
39
39
|
JSON.parse(stdout)["hexdigest"]
|
40
40
|
end
|
41
41
|
|
42
|
+
def vendor_gem_cache(pkg)
|
43
|
+
return unless pkg[:gemfile]
|
44
|
+
pkg_dir = File.dirname(pkg[:gemfile])
|
45
|
+
pkg_dir = File.expand_path(pkg_dir)
|
46
|
+
vendor_cache_dir = File.join(pkg_dir, "vendor", "cache")
|
47
|
+
mkdir_p vendor_cache_dir
|
48
|
+
require_relative "../packages/gems/js/lib/js/version"
|
49
|
+
sh "gem", "-C", "packages/gems/js", "build", "-o",
|
50
|
+
File.join(vendor_cache_dir, "js-#{JS::VERSION}.gem")
|
51
|
+
JS::VERSION
|
52
|
+
end
|
53
|
+
|
54
|
+
def build_ruby(pkg, base_dir, pkg_dir, wasi_sdk, clean: false)
|
55
|
+
build_command = npm_pkg_build_command(pkg)
|
56
|
+
# Skip if the package does not require building ruby
|
57
|
+
return unless build_command
|
58
|
+
|
59
|
+
js_gem_version = vendor_gem_cache(pkg)
|
60
|
+
|
61
|
+
env = {
|
62
|
+
# Share ./build and ./rubies in the same workspace
|
63
|
+
"RUBY_WASM_ROOT" => base_dir
|
64
|
+
}
|
65
|
+
cwd = base_dir
|
66
|
+
if gemfile_path = pkg[:gemfile]
|
67
|
+
cwd = File.dirname(gemfile_path)
|
68
|
+
else
|
69
|
+
# Explicitly disable rubygems integration since Bundler finds
|
70
|
+
# Gemfile in the repo root directory.
|
71
|
+
build_command.push "--disable-gems"
|
72
|
+
end
|
73
|
+
dist_dir = File.join(pkg_dir, "dist")
|
74
|
+
mkdir_p dist_dir
|
75
|
+
if pkg[:target].start_with?("wasm32-unknown-wasi")
|
76
|
+
if pkg[:enable_component_model]
|
77
|
+
component_path = File.join(pkg_dir, "tmp", "ruby.component.wasm")
|
78
|
+
FileUtils.mkdir_p(File.dirname(component_path))
|
79
|
+
|
80
|
+
# Remove js gem from the ./bundle directory to force Bundler to re-install it
|
81
|
+
rm_rf FileList[File.join(pkg_dir, "bundle", "**", "js-#{js_gem_version}")]
|
82
|
+
|
83
|
+
Dir.chdir(cwd) do
|
84
|
+
sh env.merge("RUBY_WASM_EXPERIMENTAL_DYNAMIC_LINKING" => "1"),
|
85
|
+
*build_command, *(clean ? ["--clean"] : []),
|
86
|
+
"-o", component_path
|
87
|
+
end
|
88
|
+
sh "npx", "jco", "transpile",
|
89
|
+
"--no-wasi-shim", "--instantiation", "--valid-lifting-optimization",
|
90
|
+
component_path, "-o", File.join(dist_dir, "component")
|
91
|
+
# ./component/package.json is required to be an ES module
|
92
|
+
File.write(File.join(dist_dir, "component", "package.json"), '{ "type": "module" }')
|
93
|
+
else
|
94
|
+
Dir.chdir(cwd) do
|
95
|
+
# uninstall js gem to re-install just-built js gem
|
96
|
+
sh "gem", "uninstall", "js", "-v", js_gem_version, "--force"
|
97
|
+
# install gems including js gem
|
98
|
+
sh "bundle", "install"
|
99
|
+
|
100
|
+
sh env,
|
101
|
+
"bundle", "exec",
|
102
|
+
*build_command,
|
103
|
+
"--no-stdlib", "--remake",
|
104
|
+
*(clean ? ["--clean"] : []),
|
105
|
+
"-o",
|
106
|
+
File.join(dist_dir, "ruby.wasm")
|
107
|
+
sh env,
|
108
|
+
"bundle", "exec",
|
109
|
+
*build_command,
|
110
|
+
"-o",
|
111
|
+
File.join(dist_dir, "ruby.debug+stdlib.wasm")
|
112
|
+
end
|
113
|
+
|
114
|
+
sh wasi_sdk.wasm_opt,
|
115
|
+
"--strip-debug",
|
116
|
+
File.join(dist_dir, "ruby.wasm"),
|
117
|
+
"-o",
|
118
|
+
File.join(dist_dir, "ruby.wasm")
|
119
|
+
sh wasi_sdk.wasm_opt,
|
120
|
+
"--strip-debug",
|
121
|
+
File.join(dist_dir, "ruby.debug+stdlib.wasm"),
|
122
|
+
"-o",
|
123
|
+
File.join(dist_dir, "ruby+stdlib.wasm")
|
124
|
+
end
|
125
|
+
elsif pkg[:target] == "wasm32-unknown-emscripten"
|
126
|
+
Dir.chdir(cwd || base_dir) do
|
127
|
+
sh env, *build_command, "-o", "/dev/null"
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
42
132
|
namespace :npm do
|
43
133
|
NPM_PACKAGES.each do |pkg|
|
44
134
|
base_dir = Dir.pwd
|
@@ -47,63 +137,7 @@ namespace :npm do
|
|
47
137
|
namespace pkg[:name] do
|
48
138
|
desc "Build ruby for npm package #{pkg[:name]}"
|
49
139
|
task "ruby" do
|
50
|
-
|
51
|
-
# Skip if the package does not require building ruby
|
52
|
-
next unless build_command
|
53
|
-
|
54
|
-
env = {
|
55
|
-
# Share ./build and ./rubies in the same workspace
|
56
|
-
"RUBY_WASM_ROOT" => base_dir
|
57
|
-
}
|
58
|
-
cwd = nil
|
59
|
-
if gemfile_path = pkg[:gemfile]
|
60
|
-
cwd = File.dirname(gemfile_path)
|
61
|
-
else
|
62
|
-
# Explicitly disable rubygems integration since Bundler finds
|
63
|
-
# Gemfile in the repo root directory.
|
64
|
-
build_command.push "--disable-gems"
|
65
|
-
end
|
66
|
-
dist_dir = File.join(pkg_dir, "dist")
|
67
|
-
mkdir_p dist_dir
|
68
|
-
if pkg[:target].start_with?("wasm32-unknown-wasi")
|
69
|
-
Dir.chdir(cwd || base_dir) do
|
70
|
-
sh env,
|
71
|
-
*build_command,
|
72
|
-
"--no-stdlib",
|
73
|
-
"-o",
|
74
|
-
File.join(dist_dir, "ruby.wasm")
|
75
|
-
sh env,
|
76
|
-
*build_command,
|
77
|
-
"-o",
|
78
|
-
File.join(dist_dir, "ruby.debug+stdlib.wasm")
|
79
|
-
if pkg[:enable_component_model]
|
80
|
-
component_path = File.join(pkg_dir, "tmp", "ruby.component.wasm")
|
81
|
-
FileUtils.mkdir_p(File.dirname(component_path))
|
82
|
-
|
83
|
-
sh env.merge("RUBY_WASM_EXPERIMENTAL_DYNAMIC_LINKING" => "1"),
|
84
|
-
*build_command, "-o", component_path
|
85
|
-
sh "npx", "jco", "transpile",
|
86
|
-
"--no-wasi-shim", "--instantiation", "--valid-lifting-optimization",
|
87
|
-
component_path, "-o", File.join(dist_dir, "component")
|
88
|
-
# ./component/package.json is required to be an ES module
|
89
|
-
File.write(File.join(dist_dir, "component", "package.json"), '{ "type": "module" }')
|
90
|
-
end
|
91
|
-
end
|
92
|
-
sh wasi_sdk.wasm_opt,
|
93
|
-
"--strip-debug",
|
94
|
-
File.join(dist_dir, "ruby.wasm"),
|
95
|
-
"-o",
|
96
|
-
File.join(dist_dir, "ruby.wasm")
|
97
|
-
sh wasi_sdk.wasm_opt,
|
98
|
-
"--strip-debug",
|
99
|
-
File.join(dist_dir, "ruby.debug+stdlib.wasm"),
|
100
|
-
"-o",
|
101
|
-
File.join(dist_dir, "ruby+stdlib.wasm")
|
102
|
-
elsif pkg[:target] == "wasm32-unknown-emscripten"
|
103
|
-
Dir.chdir(cwd || base_dir) do
|
104
|
-
sh env, *build_command, "-o", "/dev/null"
|
105
|
-
end
|
106
|
-
end
|
140
|
+
build_ruby(pkg, base_dir, pkg_dir, wasi_sdk)
|
107
141
|
end
|
108
142
|
|
109
143
|
desc "Build npm package #{pkg[:name]}"
|
@@ -111,6 +145,11 @@ namespace :npm do
|
|
111
145
|
sh tools, "npm run build", chdir: pkg_dir
|
112
146
|
end
|
113
147
|
|
148
|
+
desc "Clean and build npm package #{pkg[:name]}"
|
149
|
+
task "clean-build" do
|
150
|
+
build_ruby(pkg, base_dir, pkg_dir, wasi_sdk, clean: true)
|
151
|
+
end
|
152
|
+
|
114
153
|
desc "Check npm package #{pkg[:name]}"
|
115
154
|
task "check" do
|
116
155
|
sh "npm test", chdir: pkg_dir
|
data/rakelib/version.rake
CHANGED
@@ -36,5 +36,23 @@ task :bump_version, %i[version] do |t, args|
|
|
36
36
|
# Update ./package-lock.json
|
37
37
|
sh "npm install"
|
38
38
|
# Update Gemfile.lock
|
39
|
-
|
39
|
+
NPM_PACKAGES.each do |pkg|
|
40
|
+
next unless pkg[:gemfile]
|
41
|
+
vendor_gem_cache(pkg)
|
42
|
+
sh "BUNDLE_GEMFILE=#{pkg[:gemfile]} bundle install"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def bump_dev_version_rb(version_rb)
|
47
|
+
version_rb_content = File.read(version_rb)
|
48
|
+
version_rb_content.sub!(/VERSION = "(.+)"$/) do
|
49
|
+
dev_version = $1.end_with?(".dev") ? $1 : $1 + ".dev"
|
50
|
+
"VERSION = \"#{dev_version}\""
|
51
|
+
end
|
52
|
+
File.write(version_rb, version_rb_content)
|
53
|
+
end
|
54
|
+
|
55
|
+
task :bump_dev_version do
|
56
|
+
bump_dev_version_rb("lib/ruby_wasm/version.rb")
|
57
|
+
bump_dev_version_rb("packages/gems/js/lib/js/version.rb")
|
40
58
|
end
|
data/sbom.spdx.json
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
{
|
2
|
+
"spdxVersion": "SPDX-2.3",
|
3
|
+
"dataLicense": "CC0-1.0",
|
4
|
+
"SPDXID": "SPDXRef-DOCUMENT",
|
5
|
+
"name": "ruby.wasm-spdx",
|
6
|
+
"documentNamespace": "http://spdx.org/spdxdocs/ruby.wasm-spdx-01906291-792d-7385-b800-45753122d052",
|
7
|
+
"creationInfo": {
|
8
|
+
"created": "2024-06-29T14:00:00Z",
|
9
|
+
"comment": "This document only covers software packages used by WebAssembly form of Ruby interpreters distributed by ruby.wasm project. It does not cover those used by the build system for now.",
|
10
|
+
"creators": [
|
11
|
+
"Person: Yuta Saito"
|
12
|
+
]
|
13
|
+
},
|
14
|
+
"documentDescribes": [
|
15
|
+
"SPDXRef-Package-ruby.wasm"
|
16
|
+
],
|
17
|
+
"packages": [
|
18
|
+
{
|
19
|
+
"SPDXID": "SPDXRef-Package-ruby.wasm",
|
20
|
+
"name": "ruby.wasm",
|
21
|
+
"filesAnalyzed": false,
|
22
|
+
"licenseDeclared": "MIT",
|
23
|
+
"licenseConcluded": "MIT",
|
24
|
+
"downloadLocation": "git+http://github.com/ruby/ruby.wasm.git",
|
25
|
+
"copyrightText": "Copyright (c) 2021 Yuta Saito"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"SPDXID": "SPDXRef-Package-ruby",
|
29
|
+
"name": "ruby",
|
30
|
+
"filesAnalyzed": false,
|
31
|
+
"licenseDeclared": "BSD-2-Clause OR Ruby",
|
32
|
+
"licenseConcluded": "Ruby",
|
33
|
+
"downloadLocation": "https://www.ruby-lang.org/en/",
|
34
|
+
"copyrightText": "Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>."
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"SPDXID": "SPDXRef-Package-libyaml",
|
38
|
+
"name": "libyaml",
|
39
|
+
"filesAnalyzed": false,
|
40
|
+
"licenseDeclared": "MIT",
|
41
|
+
"licenseConcluded": "MIT",
|
42
|
+
"downloadLocation": "git+https://github.com/yaml/libyaml.git",
|
43
|
+
"copyrightText": "Copyright (c) 2017-2020 Ingy döt Net\nCopyright (c) 2006-2016 Kirill Simonov"
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"SPDXID": "SPDXRef-Package-zlib",
|
47
|
+
"name": "zlib",
|
48
|
+
"filesAnalyzed": false,
|
49
|
+
"downloadLocation": "git+https://github.com/madler/zlib.git",
|
50
|
+
"licenseConcluded": "Zlib",
|
51
|
+
"licenseDeclared": "Zlib",
|
52
|
+
"copyrightText": "Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler"
|
53
|
+
},
|
54
|
+
{
|
55
|
+
"SPDXID": "SPDXRef-Package-wasi-libc",
|
56
|
+
"name": "wasi-libc",
|
57
|
+
"filesAnalyzed": false,
|
58
|
+
"downloadLocation": "git+https://github.com/WebAssembly/wasi-libc.git",
|
59
|
+
"licenseConcluded": "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT",
|
60
|
+
"licenseDeclared": "MIT",
|
61
|
+
"copyrightText": "NOASSERTION"
|
62
|
+
},
|
63
|
+
{
|
64
|
+
"SPDXID": "SPDXRef-Package-openssl",
|
65
|
+
"name": "openssl",
|
66
|
+
"filesAnalyzed": false,
|
67
|
+
"downloadLocation": "https://www.openssl.org",
|
68
|
+
"licenseConcluded": "Apache-2.0",
|
69
|
+
"licenseDeclared": "Apache-2.0",
|
70
|
+
"copyrightText": "Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved."
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"SPDXID": "SPDXRef-Package-wasi-vfs",
|
74
|
+
"name": "wasi-vfs",
|
75
|
+
"filesAnalyzed": false,
|
76
|
+
"downloadLocation": "git+https://github.com/kateinoigakukun/wasi-vfs.git",
|
77
|
+
"licenseConcluded": "Apache-2.0 WITH LLVM-exception",
|
78
|
+
"licenseDeclared": "Apache-2.0 WITH LLVM-exception",
|
79
|
+
"copyrightText": "NOASSERTION"
|
80
|
+
}
|
81
|
+
],
|
82
|
+
"relationships": [
|
83
|
+
{
|
84
|
+
"spdxElementId": "SPDXRef-Package-ruby.wasm",
|
85
|
+
"relatedSpdxElement": "SPDXRef-Package-ruby",
|
86
|
+
"relationshipType": "DEPENDS_ON"
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"spdxElementId": "SPDXRef-Package-ruby.wasm",
|
90
|
+
"relatedSpdxElement": "SPDXRef-Package-libyaml",
|
91
|
+
"relationshipType": "DEPENDS_ON"
|
92
|
+
},
|
93
|
+
{
|
94
|
+
"spdxElementId": "SPDXRef-Package-ruby.wasm",
|
95
|
+
"relatedSpdxElement": "SPDXRef-Package-zlib",
|
96
|
+
"relationshipType": "DEPENDS_ON"
|
97
|
+
},
|
98
|
+
{
|
99
|
+
"spdxElementId": "SPDXRef-Package-ruby.wasm",
|
100
|
+
"relatedSpdxElement": "SPDXRef-Package-wasi-libc",
|
101
|
+
"relationshipType": "DEPENDS_ON"
|
102
|
+
},
|
103
|
+
{
|
104
|
+
"spdxElementId": "SPDXRef-Package-ruby.wasm",
|
105
|
+
"relatedSpdxElement": "SPDXRef-Package-openssl",
|
106
|
+
"relationshipType": "DEPENDS_ON"
|
107
|
+
},
|
108
|
+
{
|
109
|
+
"spdxElementId": "SPDXRef-Package-ruby.wasm",
|
110
|
+
"relatedSpdxElement": "SPDXRef-Package-wasi-vfs",
|
111
|
+
"relationshipType": "DEPENDS_ON"
|
112
|
+
}
|
113
|
+
]
|
114
|
+
}
|
data/sig/ruby_wasm/build.rbs
CHANGED
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.7.0
|
5
5
|
platform: x86_64-linux
|
6
6
|
authors:
|
7
7
|
- Yuta Saito
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-11 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.
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- rakelib/gem.rake
|
75
75
|
- rakelib/packaging.rake
|
76
76
|
- rakelib/version.rake
|
77
|
+
- sbom.spdx.json
|
77
78
|
- sig/open_uri.rbs
|
78
79
|
- sig/ruby_wasm/build.rbs
|
79
80
|
- sig/ruby_wasm/cli.rbs
|
@@ -81,9 +82,6 @@ files:
|
|
81
82
|
- sig/ruby_wasm/feature_set.rbs
|
82
83
|
- sig/ruby_wasm/packager.rbs
|
83
84
|
- sig/ruby_wasm/util.rbs
|
84
|
-
- tools/clang-format-diff.sh
|
85
|
-
- tools/exe/rbminify
|
86
|
-
- tools/lib/syntax_tree/minify_ruby.rb
|
87
85
|
homepage: https://github.com/ruby/ruby.wasm
|
88
86
|
licenses:
|
89
87
|
- MIT
|
data/tools/clang-format-diff.sh
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
set -eo pipefail
|
4
|
-
|
5
|
-
if [ -n "$1" ]; then
|
6
|
-
BASE_BRANCH="$1"
|
7
|
-
elif [ -n "$GITHUB_EVENT_BEFORE" ] && [ "push" = "$GITHUB_EVENT_NAME" ]; then
|
8
|
-
BASE_BRANCH="$GITHUB_EVENT_BEFORE"
|
9
|
-
elif [ -n "$GITHUB_BASE_REF" ]; then
|
10
|
-
BASE_BRANCH="origin/$GITHUB_BASE_REF"
|
11
|
-
else
|
12
|
-
BASE_BRANCH="@{upstream}"
|
13
|
-
fi
|
14
|
-
|
15
|
-
MERGE_BASE=$(git merge-base $BASE_BRANCH HEAD)
|
16
|
-
|
17
|
-
git diff -U0 --no-color $MERGE_BASE -- '*.c' '*.h' | clang-format-diff -i -p1
|
18
|
-
exit $?
|
data/tools/exe/rbminify
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$LOAD_PATH << File.join(File.dirname(__FILE__), "../lib")
|
4
|
-
|
5
|
-
require "syntax_tree"
|
6
|
-
require "syntax_tree/cli"
|
7
|
-
require "syntax_tree/minify_ruby"
|
8
|
-
|
9
|
-
# Override the default formatter with our own.
|
10
|
-
SyntaxTree.register_handler(".rb", SyntaxTree::MinifyRuby)
|
11
|
-
|
12
|
-
exit(SyntaxTree::CLI.run(ARGV))
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require "syntax_tree"
|
2
|
-
|
3
|
-
module SyntaxTree
|
4
|
-
module MinifyRuby
|
5
|
-
|
6
|
-
# This is a required API for syntax tree which just delegates to SyntaxTree.parse.
|
7
|
-
def self.parse(source)
|
8
|
-
::SyntaxTree.parse(source)
|
9
|
-
end
|
10
|
-
|
11
|
-
# This is the main entrypoint for the formatter. It parses the source,
|
12
|
-
# builds a formatter, then prints the result.
|
13
|
-
def self.format(source, _maxwidth = nil)
|
14
|
-
formatter = Formatter.new(source)
|
15
|
-
program = parse(source)
|
16
|
-
CommentStrippingVisitor.new.visit(program)
|
17
|
-
program.format(formatter)
|
18
|
-
|
19
|
-
formatter.flush
|
20
|
-
formatter.output.join
|
21
|
-
end
|
22
|
-
|
23
|
-
# This is a required API for syntax tree which just delegates to SyntaxTree.read.
|
24
|
-
def self.read(filepath)
|
25
|
-
::SyntaxTree.read(filepath)
|
26
|
-
end
|
27
|
-
|
28
|
-
class CommentStrippingVisitor < SyntaxTree::Visitor
|
29
|
-
def visit(node)
|
30
|
-
if node and node.comments.any?
|
31
|
-
node.comments.clear
|
32
|
-
end
|
33
|
-
super(node)
|
34
|
-
end
|
35
|
-
|
36
|
-
def visit_statements(node)
|
37
|
-
node.body.delete_if { _1.is_a?(SyntaxTree::Comment) }
|
38
|
-
super(node)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
class Formatter < SyntaxTree::Formatter
|
43
|
-
def initialize(source)
|
44
|
-
super(source, [], Float::INFINITY) do |n|
|
45
|
-
# This block, called `genspace`, is used to generate indentation for `n` depth.
|
46
|
-
""
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def breakable(
|
51
|
-
separator = " ",
|
52
|
-
_width = separator.length,
|
53
|
-
indent: nil,
|
54
|
-
force: nil
|
55
|
-
)
|
56
|
-
# Don't break when already broken
|
57
|
-
return if target.last.is_a?(PrettierPrint::BreakParent)
|
58
|
-
return if not force and separator == ""
|
59
|
-
super(separator, _width, indent: indent, force: force)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|