ruby_wasm 2.5.0.pre.1 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +13 -9
  3. data/Cargo.lock +705 -451
  4. data/Gemfile +1 -1
  5. data/README.md +12 -19
  6. data/Rakefile +9 -9
  7. data/benchmarks/vm_deep_call.rb +2 -2
  8. data/docs/cheat_sheet.md +8 -8
  9. data/ext/ruby_wasm/Cargo.toml +6 -5
  10. data/ext/ruby_wasm/src/lib.rs +208 -7
  11. data/lib/ruby_wasm/build/executor.rb +4 -0
  12. data/lib/ruby_wasm/build/product/crossruby.rb +57 -23
  13. data/lib/ruby_wasm/build/product/libyaml.rb +5 -3
  14. data/lib/ruby_wasm/build/product/openssl.rb +7 -2
  15. data/lib/ruby_wasm/build/product/product.rb +3 -3
  16. data/lib/ruby_wasm/build/product/ruby_source.rb +3 -3
  17. data/lib/ruby_wasm/build/product/wasi_vfs.rb +1 -39
  18. data/lib/ruby_wasm/build/product/zlib.rb +5 -3
  19. data/lib/ruby_wasm/build/target.rb +24 -0
  20. data/lib/ruby_wasm/build/toolchain.rb +1 -1
  21. data/lib/ruby_wasm/build.rb +7 -3
  22. data/lib/ruby_wasm/cli.rb +171 -13
  23. data/lib/ruby_wasm/feature_set.rb +30 -0
  24. data/lib/ruby_wasm/packager/component_adapter/wasi_snapshot_preview1.command.wasm +0 -0
  25. data/lib/ruby_wasm/packager/component_adapter/wasi_snapshot_preview1.reactor.wasm +0 -0
  26. data/lib/ruby_wasm/packager/component_adapter.rb +14 -0
  27. data/lib/ruby_wasm/packager/core.rb +192 -4
  28. data/lib/ruby_wasm/packager/file_system.rb +20 -17
  29. data/lib/ruby_wasm/packager.rb +21 -83
  30. data/lib/ruby_wasm/rake_task.rb +2 -0
  31. data/lib/ruby_wasm/version.rb +1 -1
  32. data/lib/ruby_wasm.rb +2 -0
  33. data/package-lock.json +410 -133
  34. data/package.json +3 -3
  35. data/{tasks → rakelib}/ci.rake +3 -3
  36. data/{tasks → rakelib}/doc.rake +6 -1
  37. data/{tasks → rakelib}/format.rake +3 -2
  38. data/{tasks → rakelib}/gem.rake +4 -1
  39. data/{tasks → rakelib}/packaging.rake +34 -17
  40. data/{tasks → rakelib}/version.rake +2 -0
  41. data/sig/ruby_wasm/build.rbs +36 -31
  42. data/sig/ruby_wasm/cli.rbs +30 -3
  43. data/sig/ruby_wasm/ext.rbs +28 -3
  44. data/sig/ruby_wasm/feature_set.rbs +12 -0
  45. data/sig/ruby_wasm/packager.rbs +44 -7
  46. metadata +16 -15
  47. data/builders/wasm32-unknown-emscripten/Dockerfile +0 -43
  48. data/builders/wasm32-unknown-emscripten/entrypoint.sh +0 -7
  49. data/builders/wasm32-unknown-wasi/Dockerfile +0 -47
  50. data/builders/wasm32-unknown-wasi/entrypoint.sh +0 -7
  51. data/ruby_wasm.gemspec +0 -32
  52. /data/{tasks → rakelib}/check.rake +0 -0
@@ -1,43 +0,0 @@
1
- FROM emscripten/emsdk:3.1.31
2
-
3
- ARG NODE_MAJOR_VERSION=20
4
-
5
- RUN set -eux; \
6
- apt-get update; \
7
- apt-get install -y ca-certificates curl gnupg; \
8
- mkdir -p /etc/apt/keyrings; \
9
- curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \
10
- echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR_VERSION.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list; \
11
- apt-get update; \
12
- apt-get install ruby ruby-dev ruby-bundler nodejs \
13
- bison make autoconf git curl build-essential \
14
- libyaml-dev zlib1g-dev gosu \
15
- libclang-13-dev -y; \
16
- apt-get clean; \
17
- rm -r /var/lib/apt/lists/*
18
-
19
- # Prefer apt-installed nodejs instead of emsdk's old one.
20
- ENV PATH=/usr/bin:$PATH
21
-
22
- ENV RUSTUP_HOME=/usr/local/rustup \
23
- CARGO_HOME=/usr/local/cargo \
24
- PATH=/usr/local/cargo/bin:$PATH \
25
- RUST_VERSION=1.74
26
-
27
- RUN set -eux pipefail; \
28
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
29
- sh -s -- -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION; \
30
- chmod -R a+w $RUSTUP_HOME $CARGO_HOME
31
-
32
- ENV BUNDLE_PATH=/usr/local/gems
33
- RUN set -eux; \
34
- mkdir -p $BUNDLE_PATH; \
35
- chmod -R 777 $BUNDLE_PATH
36
-
37
- COPY entrypoint.sh /usr/local/bin/entrypoint.sh
38
- RUN chmod +x /usr/local/bin/entrypoint.sh
39
- ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
40
- # Build with non-root user because `@npmcli/promise-spawn` sets `uid` and `gid` to cwd owner when the current user is root.
41
- # This permission demotion results in EACCES error at reading `$HOME/.node_modules` in `resolve` package, which is used by `@rollup/plugin-node-resolve`.
42
- # * https://github.com/npm/cli/blob/32336f6efe06bd52de1dc67c0f812d4705533ef2/node_modules/%40npmcli/promise-spawn/lib/index.js#L13
43
- RUN adduser --disabled-password --gecos '' me
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- [ ! -z "${RUBYWASM_UID+x}" ] && usermod --uid "$RUBYWASM_UID" --non-unique me
6
- [ ! -z "${RUBYWASM_GID+x}" ] && groupmod --gid "$RUBYWASM_GID" --non-unique me
7
- exec gosu me "$@"
@@ -1,47 +0,0 @@
1
- FROM debian:bullseye
2
-
3
- ARG WASI_PRESET_ARGS_VERSION=0.1.1
4
- ARG NODE_MAJOR_VERSION=20
5
-
6
- RUN set -eux; \
7
- apt-get update; \
8
- apt-get install -y ca-certificates curl gnupg; \
9
- mkdir -p /etc/apt/keyrings; \
10
- curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \
11
- echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR_VERSION.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list; \
12
- apt-get update; \
13
- apt-get install ruby ruby-dev ruby-bundler nodejs \
14
- bison make autoconf git curl build-essential \
15
- libyaml-dev zlib1g-dev gosu \
16
- libclang-13-dev -y; \
17
- apt-get clean; \
18
- rm -r /var/lib/apt/lists/*
19
-
20
- RUN set -eux pipefail; \
21
- wasi_preset_args_url="https://github.com/kateinoigakukun/wasi-preset-args/releases/download/v${WASI_PRESET_ARGS_VERSION}/wasi-preset-args-x86_64-unknown-linux-gnu.zip"; \
22
- curl -LO "$wasi_preset_args_url"; \
23
- unzip wasi-preset-args-x86_64-unknown-linux-gnu.zip; \
24
- mv wasi-preset-args /usr/local/bin/wasi-preset-args
25
-
26
- ENV RUSTUP_HOME=/usr/local/rustup \
27
- CARGO_HOME=/usr/local/cargo \
28
- PATH=/usr/local/cargo/bin:$PATH \
29
- RUST_VERSION=1.74
30
-
31
- RUN set -eux pipefail; \
32
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
33
- sh -s -- -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION; \
34
- chmod -R a+w $RUSTUP_HOME $CARGO_HOME
35
-
36
- ENV BUNDLE_PATH=/usr/local/gems
37
- RUN set -eux; \
38
- mkdir -p $BUNDLE_PATH; \
39
- chmod -R 777 $BUNDLE_PATH
40
-
41
- COPY entrypoint.sh /usr/local/bin/entrypoint.sh
42
- RUN chmod +x /usr/local/bin/entrypoint.sh
43
- ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
44
- # Build with non-root user because `@npmcli/promise-spawn` sets `uid` and `gid` to cwd owner when the current user is root.
45
- # This permission demotion results in EACCES error at reading `$HOME/.node_modules` in `resolve` package, which is used by `@rollup/plugin-node-resolve`.
46
- # * https://github.com/npm/cli/blob/32336f6efe06bd52de1dc67c0f812d4705533ef2/node_modules/%40npmcli/promise-spawn/lib/index.js#L13
47
- RUN adduser --disabled-password --gecos '' me
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- [ ! -z "${RUBYWASM_UID+x}" ] && usermod --uid "$RUBYWASM_UID" --non-unique me
6
- [ ! -z "${RUBYWASM_GID+x}" ] && groupmod --gid "$RUBYWASM_GID" --non-unique me
7
- exec gosu me "$@"
data/ruby_wasm.gemspec DELETED
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/ruby_wasm/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "ruby_wasm"
7
- spec.version = RubyWasm::VERSION
8
- spec.authors = ["Yuta Saito"]
9
- spec.email = ["kateinoigakukun@gmail.com"]
10
-
11
- spec.summary = %q{Ruby to WebAssembly toolkit}
12
- spec.description = %q{Ruby to WebAssembly toolkit. This gem takes Ruby code and Gemfile, and packages them with Ruby runtime into a WebAssembly binary.}
13
- spec.homepage = "https://github.com/ruby/ruby.wasm"
14
- spec.license = "MIT"
15
- spec.required_ruby_version = ">= 2.6.0"
16
-
17
- spec.metadata["homepage_uri"] = spec.homepage
18
- spec.metadata["source_code_uri"] = spec.homepage
19
-
20
- # Specify which files should be added to the gem when it is released.
21
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
- spec.files = Dir.chdir(__dir__) do
23
- `git ls-files -z`.split("\x0").reject do |f|
24
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)}) ||
25
- f.match(%r{\Apackages/})
26
- end
27
- end
28
- spec.bindir = "exe"
29
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
- spec.require_paths = ["lib"]
31
- spec.extensions = ["ext/ruby_wasm/Cargo.toml"]
32
- end
File without changes