ruby_wasm 2.5.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/.clang-format +8 -0
  3. data/CONTRIBUTING.md +124 -0
  4. data/Cargo.lock +2452 -0
  5. data/Cargo.toml +7 -0
  6. data/Gemfile +17 -0
  7. data/LICENSE +21 -0
  8. data/NOTICE +1293 -0
  9. data/README.md +161 -0
  10. data/Rakefile +164 -0
  11. data/Steepfile +24 -0
  12. data/benchmarks/vm_deep_call.rb +55 -0
  13. data/builders/wasm32-unknown-emscripten/Dockerfile +43 -0
  14. data/builders/wasm32-unknown-emscripten/entrypoint.sh +7 -0
  15. data/builders/wasm32-unknown-wasi/Dockerfile +47 -0
  16. data/builders/wasm32-unknown-wasi/entrypoint.sh +7 -0
  17. data/docs/api.md +2 -0
  18. data/docs/cheat_sheet.md +195 -0
  19. data/docs/faq.md +25 -0
  20. data/exe/rbwasm +7 -0
  21. data/ext/.gitignore +2 -0
  22. data/ext/README.md +11 -0
  23. data/ext/extinit.c.erb +32 -0
  24. data/ext/ruby_wasm/Cargo.toml +17 -0
  25. data/ext/ruby_wasm/extconf.rb +6 -0
  26. data/ext/ruby_wasm/src/lib.rs +69 -0
  27. data/lib/ruby_wasm/build/build_params.rb +3 -0
  28. data/lib/ruby_wasm/build/downloader.rb +18 -0
  29. data/lib/ruby_wasm/build/executor.rb +187 -0
  30. data/lib/ruby_wasm/build/product/baseruby.rb +37 -0
  31. data/lib/ruby_wasm/build/product/crossruby.rb +326 -0
  32. data/lib/ruby_wasm/build/product/libyaml.rb +68 -0
  33. data/lib/ruby_wasm/build/product/openssl.rb +88 -0
  34. data/lib/ruby_wasm/build/product/product.rb +39 -0
  35. data/lib/ruby_wasm/build/product/ruby_source.rb +103 -0
  36. data/lib/ruby_wasm/build/product/wasi_vfs.rb +83 -0
  37. data/lib/ruby_wasm/build/product/zlib.rb +68 -0
  38. data/lib/ruby_wasm/build/product.rb +8 -0
  39. data/lib/ruby_wasm/build/toolchain/wit_bindgen.rb +31 -0
  40. data/lib/ruby_wasm/build/toolchain.rb +193 -0
  41. data/lib/ruby_wasm/build.rb +88 -0
  42. data/lib/ruby_wasm/cli.rb +195 -0
  43. data/lib/ruby_wasm/packager/core.rb +156 -0
  44. data/lib/ruby_wasm/packager/file_system.rb +157 -0
  45. data/lib/ruby_wasm/packager.rb +159 -0
  46. data/lib/ruby_wasm/rake_task.rb +58 -0
  47. data/lib/ruby_wasm/util.rb +15 -0
  48. data/lib/ruby_wasm/version.rb +3 -0
  49. data/lib/ruby_wasm.rb +33 -0
  50. data/package-lock.json +9500 -0
  51. data/package.json +12 -0
  52. data/ruby_wasm.gemspec +32 -0
  53. data/sig/open_uri.rbs +4 -0
  54. data/sig/ruby_wasm/build.rbs +322 -0
  55. data/sig/ruby_wasm/cli.rbs +24 -0
  56. data/sig/ruby_wasm/ext.rbs +11 -0
  57. data/sig/ruby_wasm/packager.rbs +91 -0
  58. data/sig/ruby_wasm/util.rbs +5 -0
  59. data/tasks/check.rake +37 -0
  60. data/tasks/ci.rake +152 -0
  61. data/tasks/doc.rake +24 -0
  62. data/tasks/format.rake +34 -0
  63. data/tasks/gem.rake +19 -0
  64. data/tasks/packaging.rake +148 -0
  65. data/tasks/version.rake +38 -0
  66. data/tools/clang-format-diff.sh +18 -0
  67. data/tools/exe/rbminify +12 -0
  68. data/tools/lib/syntax_tree/minify_ruby.rb +63 -0
  69. metadata +115 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7ae1888b47708e127d63f9ca22d6c3b0e052bf8e466c3ca6e732966ed17efa5f
4
+ data.tar.gz: 818a32d985fa7bd2c25dadda8990ca7d399731bb0cd6f643f74f7082db87fe66
5
+ SHA512:
6
+ metadata.gz: a9e2266baeaca22fd6b76151105707bec020907f312f310f6d177e57e37bf520bb514b7166f65bd7780281b858d0b2c1a4a39605fe5d852074222c386b4c4f43
7
+ data.tar.gz: 56ccd07cea6b6c18f8401ef3a7e222de3586b8279054d58ee8af7140fde0cb3809439450bf18c98cae8e7d8a41449814f7d0d18df4ff5744ccc3517d831e0796
data/.clang-format ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ Language: Cpp
3
+ BasedOnStyle: LLVM
4
+ IndentPPDirectives: AfterHash
5
+ ---
6
+ Language: JavaScript
7
+ DisableFormat: true
8
+ ---
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,124 @@
1
+ # How to Contribute
2
+
3
+ Thank you for your interest in contributing to ruby.wasm!
4
+ This document describes development setup and pointers for diving into this project.
5
+
6
+ ## Install dependencies
7
+
8
+ ```console
9
+ $ git clone https://github.com/ruby/ruby.wasm
10
+ $ cd ruby.wasm
11
+ $ ./bin/setup
12
+ $ rake --tasks
13
+ ```
14
+
15
+ ## Building and Testing [`ruby-wasm-wasi`](./packages/npm-packages/ruby-wasm-wasi)
16
+
17
+ ```console
18
+ # Download a prebuilt Ruby release (if you don't need to re-build Ruby)
19
+ $ rake build:download_prebuilt
20
+
21
+ # Build Ruby (if you need to build Ruby by yourself)
22
+ $ rake build:head-wasm32-unknown-wasi-full-js-debug
23
+
24
+ # Build npm package
25
+ $ rake npm:ruby-head-wasm-wasi
26
+ # Test npm package
27
+ $ rake npm:ruby-head-wasm-wasi:check
28
+ ```
29
+
30
+ If you need to re-build Ruby, please clean `./rubies` directory, and run `rake npm:ruby-head-wasm-wasi` again.
31
+
32
+ ## Building CRuby from source
33
+
34
+ If you want to build CRuby for WebAssembly from source yourself, follow the below instructions.
35
+
36
+ > **Warning**
37
+ > If you just want to build npm packages, you don't need to build CRuby from source.
38
+ > You can download a prebuilt Ruby release by `rake build:download_prebuilt`.
39
+
40
+ ### For WASI target
41
+
42
+ You can build CRuby for WebAssembly/WASI on Linux (x86_64) or macOS (x86_64, arm64).
43
+ For WASI target, dependencies are automatically downloaded on demand, so you don't need to install them manually.
44
+
45
+ To select a build profile, see [profiles section in README](https://github.com/ruby/ruby.wasm#profiles).
46
+
47
+ ```console
48
+ # Build only a specific combination of ruby version, profile, and target
49
+ $ rake build:head-wasm32-unknown-wasi-full
50
+ # Clean up the build directory
51
+ $ rake build:head-wasm32-unknown-wasi-full:clean
52
+ # Force to re-execute "make install"
53
+ $ rake build:head-wasm32-unknown-wasi-full:remake
54
+
55
+ # Output is in the `rubies` directory
56
+ $ tree -L 3 rubies/head-wasm32-unknown-wasi-full-js
57
+ rubies/head-wasm32-unknown-wasi-full-js/
58
+ ├── usr
59
+ │   └── local
60
+ │   ├── bin
61
+ │   ├── include
62
+ │   ├── lib
63
+ │   └── share
64
+ ```
65
+
66
+ ### For Emscripten target
67
+
68
+ To build CRuby for WebAssembly/Emscripten, you need to install [Emscripten](https://emscripten.org).
69
+ Please follow the official instructions to install.
70
+
71
+ ```console
72
+ # Build only a specific combination of ruby version, profile, and target
73
+ $ rake build:head-wasm32-unknown-emscripten-full-js
74
+ # Output is in the `rubies` directory
75
+ $ tree -L 3 rubies/head-wasm32-unknown-emscripten-full-js
76
+ rubies/head-wasm32-unknown-emscripten-full
77
+ └── usr
78
+ └── local
79
+ ├── bin
80
+ ├── include
81
+ ├── lib
82
+ └── share
83
+ ```
84
+
85
+ ## Code Formatting
86
+
87
+ This project uses multiple code formatters for each language.
88
+ To format all files, run `rake format`.
89
+ Please make sure to run this command before submitting a pull request.
90
+
91
+ ## Re-bindgen from `.wit` files
92
+
93
+ If you update [`*.wit`](https://github.com/WebAssembly/component-model/blob/ed90add27ae845b2e2b9d7db38a966d9f78aa4c0/design/mvp/WIT.md), which describe the interface of a WebAssembly module, either imported or exported, you need to re-generate glue code from `*.wit`.
94
+
95
+ To re-generate them, you need to install the Rust compiler `rustc` and Cargo, then run `rake check:bindgen`.
96
+
97
+ The rake task installs [`wit-bindgen`](https://github.com/bytecodealliance/wit-bindgen) on demand, then just execute it for each generated code
98
+
99
+ If you see `missing executable: cargo`, please make sure `cargo` is installed correctly in your `PATH`.
100
+
101
+ ## Release Process
102
+
103
+ To bump up npm package version, please follow the below steps:
104
+
105
+ ```
106
+ $ rake 'bump_version[0.6.0]'
107
+ $ git commit -m"Bump version to 0.6.0"
108
+ $ git tag 0.6.0
109
+ $ git push origin 0.6.0
110
+ ```
111
+
112
+ ## Release Channels
113
+
114
+ Each npm package in this project provides two release channels: `latest` and `next`. The `latest` channel is for stable releases, and `next` channel is for pre-release.
115
+
116
+ e.g. For [`@ruby/wasm-wasi`](https://www.npmjs.com/package/@ruby/wasm-wasi)
117
+
118
+ ```console
119
+ $ npm install --save @ruby/wasm-wasi@latest
120
+ # or if you want the nightly snapshot
121
+ $ npm install --save @ruby/wasm-wasi@next
122
+ # or you can specify the exact snapshot version
123
+ $ npm install --save @ruby/wasm-wasi@2.4.1-2023-12-25-a
124
+ ```