ruby_wasm 2.5.0-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/.clang-format +8 -0
  3. data/CONTRIBUTING.md +126 -0
  4. data/Gemfile +17 -0
  5. data/LICENSE +21 -0
  6. data/NOTICE +1293 -0
  7. data/README.md +153 -0
  8. data/Rakefile +163 -0
  9. data/Steepfile +24 -0
  10. data/benchmarks/vm_deep_call.rb +55 -0
  11. data/builders/wasm32-unknown-emscripten/Dockerfile +43 -0
  12. data/builders/wasm32-unknown-emscripten/entrypoint.sh +7 -0
  13. data/builders/wasm32-unknown-wasi/Dockerfile +47 -0
  14. data/builders/wasm32-unknown-wasi/entrypoint.sh +7 -0
  15. data/docs/api.md +2 -0
  16. data/docs/cheat_sheet.md +195 -0
  17. data/docs/faq.md +25 -0
  18. data/exe/rbwasm +7 -0
  19. data/ext/.gitignore +2 -0
  20. data/ext/README.md +11 -0
  21. data/ext/extinit.c.erb +32 -0
  22. data/lib/ruby_wasm/3.0/ruby_wasm.bundle +0 -0
  23. data/lib/ruby_wasm/3.1/ruby_wasm.bundle +0 -0
  24. data/lib/ruby_wasm/3.2/ruby_wasm.bundle +0 -0
  25. data/lib/ruby_wasm/build/build_params.rb +3 -0
  26. data/lib/ruby_wasm/build/downloader.rb +18 -0
  27. data/lib/ruby_wasm/build/executor.rb +187 -0
  28. data/lib/ruby_wasm/build/product/baseruby.rb +37 -0
  29. data/lib/ruby_wasm/build/product/crossruby.rb +330 -0
  30. data/lib/ruby_wasm/build/product/libyaml.rb +68 -0
  31. data/lib/ruby_wasm/build/product/openssl.rb +88 -0
  32. data/lib/ruby_wasm/build/product/product.rb +39 -0
  33. data/lib/ruby_wasm/build/product/ruby_source.rb +103 -0
  34. data/lib/ruby_wasm/build/product/wasi_vfs.rb +45 -0
  35. data/lib/ruby_wasm/build/product/zlib.rb +68 -0
  36. data/lib/ruby_wasm/build/product.rb +8 -0
  37. data/lib/ruby_wasm/build/toolchain/wit_bindgen.rb +31 -0
  38. data/lib/ruby_wasm/build/toolchain.rb +193 -0
  39. data/lib/ruby_wasm/build.rb +88 -0
  40. data/lib/ruby_wasm/cli.rb +217 -0
  41. data/lib/ruby_wasm/packager/core.rb +156 -0
  42. data/lib/ruby_wasm/packager/file_system.rb +158 -0
  43. data/lib/ruby_wasm/packager.rb +159 -0
  44. data/lib/ruby_wasm/rake_task.rb +59 -0
  45. data/lib/ruby_wasm/util.rb +15 -0
  46. data/lib/ruby_wasm/version.rb +3 -0
  47. data/lib/ruby_wasm.rb +33 -0
  48. data/package-lock.json +9500 -0
  49. data/package.json +12 -0
  50. data/rakelib/check.rake +37 -0
  51. data/rakelib/ci.rake +152 -0
  52. data/rakelib/doc.rake +29 -0
  53. data/rakelib/format.rake +35 -0
  54. data/rakelib/gem.rake +22 -0
  55. data/rakelib/packaging.rake +151 -0
  56. data/rakelib/version.rake +40 -0
  57. data/sig/open_uri.rbs +4 -0
  58. data/sig/ruby_wasm/build.rbs +318 -0
  59. data/sig/ruby_wasm/cli.rbs +27 -0
  60. data/sig/ruby_wasm/ext.rbs +13 -0
  61. data/sig/ruby_wasm/packager.rbs +91 -0
  62. data/sig/ruby_wasm/util.rbs +5 -0
  63. data/tools/clang-format-diff.sh +18 -0
  64. data/tools/exe/rbminify +12 -0
  65. data/tools/lib/syntax_tree/minify_ruby.rb +63 -0
  66. metadata +114 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9c6e8c3a7519319f289d45b0275ffa0e97b41c12a89c687f2dd82e3321e82943
4
+ data.tar.gz: eb71c64ef94a9fea9a45cbb67d85adfee898476bf43da95011e4cde0677dd9ac
5
+ SHA512:
6
+ metadata.gz: 8af36b52c8b0a0f61baaf5a4c7c29245ff8d742d79258b12f066376e99af52dd4081e99ba1a7489b51dd42af390a37e843ce6d8e06c073e05a5a4ecbea70fd4f
7
+ data.tar.gz: '0905bc881c33c0bbe286b78a375d431ee191a2a0a18fe31bac826d1e2a4ad6fec91f9ac27b5ad30e1a063bb4726a5ee6e0c272d4f4868300fc3cd43dfecdc49b'
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,126 @@
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
+ # Compile extension library
13
+ $ bundle exec rake compile
14
+ $ rake --tasks
15
+ ```
16
+
17
+ ## Building and Testing [`ruby-wasm-wasi`](./packages/npm-packages/ruby-wasm-wasi)
18
+
19
+ ```console
20
+ # Download a prebuilt Ruby release (if you don't need to re-build Ruby)
21
+ $ rake build:download_prebuilt
22
+
23
+ # Build Ruby (if you need to build Ruby by yourself)
24
+ $ rake build:head-wasm32-unknown-wasi-full
25
+
26
+ # Build npm package
27
+ $ rake npm:ruby-head-wasm-wasi
28
+ # Test npm package
29
+ $ rake npm:ruby-head-wasm-wasi:check
30
+ ```
31
+
32
+ If you need to re-build Ruby, please clean `./rubies` directory, and run `rake npm:ruby-head-wasm-wasi` again.
33
+
34
+ ## Building CRuby from source
35
+
36
+ If you want to build CRuby for WebAssembly from source yourself, follow the below instructions.
37
+
38
+ > **Warning**
39
+ > If you just want to build npm packages, you don't need to build CRuby from source.
40
+ > You can download a prebuilt Ruby release by `rake build:download_prebuilt`.
41
+
42
+ ### For WASI target
43
+
44
+ You can build CRuby for WebAssembly/WASI on Linux (x86_64) or macOS (x86_64, arm64).
45
+ For WASI target, dependencies are automatically downloaded on demand, so you don't need to install them manually.
46
+
47
+ To select a build profile, see [profiles section in README](https://github.com/ruby/ruby.wasm#profiles).
48
+
49
+ ```console
50
+ # Build only a specific combination of ruby version, profile, and target
51
+ $ rake build:head-wasm32-unknown-wasi-full
52
+ # Clean up the build directory
53
+ $ rake build:head-wasm32-unknown-wasi-full:clean
54
+ # Force to re-execute "make install"
55
+ $ rake build:head-wasm32-unknown-wasi-full:remake
56
+
57
+ # Output is in the `rubies` directory
58
+ $ tree -L 3 rubies/head-wasm32-unknown-wasi-full
59
+ rubies/head-wasm32-unknown-wasi-full/
60
+ ├── usr
61
+ │   └── local
62
+ │   ├── bin
63
+ │   ├── include
64
+ │   ├── lib
65
+ │   └── share
66
+ ```
67
+
68
+ ### For Emscripten target
69
+
70
+ To build CRuby for WebAssembly/Emscripten, you need to install [Emscripten](https://emscripten.org).
71
+ Please follow the official instructions to install.
72
+
73
+ ```console
74
+ # Build only a specific combination of ruby version, profile, and target
75
+ $ rake build:head-wasm32-unknown-emscripten-full
76
+ # Output is in the `rubies` directory
77
+ $ tree -L 3 rubies/head-wasm32-unknown-emscripten-full
78
+ rubies/head-wasm32-unknown-emscripten-full
79
+ └── usr
80
+ └── local
81
+ ├── bin
82
+ ├── include
83
+ ├── lib
84
+ └── share
85
+ ```
86
+
87
+ ## Code Formatting
88
+
89
+ This project uses multiple code formatters for each language.
90
+ To format all files, run `rake format`.
91
+ Please make sure to run this command before submitting a pull request.
92
+
93
+ ## Re-bindgen from `.wit` files
94
+
95
+ 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`.
96
+
97
+ To re-generate them, you need to install the Rust compiler `rustc` and Cargo, then run `rake check:bindgen`.
98
+
99
+ The rake task installs [`wit-bindgen`](https://github.com/bytecodealliance/wit-bindgen) on demand, then just execute it for each generated code
100
+
101
+ If you see `missing executable: cargo`, please make sure `cargo` is installed correctly in your `PATH`.
102
+
103
+ ## Release Process
104
+
105
+ To bump up npm package version, please follow the below steps:
106
+
107
+ ```
108
+ $ rake 'bump_version[0.6.0]'
109
+ $ git commit -m"Bump version to 0.6.0"
110
+ $ git tag 0.6.0
111
+ $ git push origin 0.6.0
112
+ ```
113
+
114
+ ## Release Channels
115
+
116
+ 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.
117
+
118
+ e.g. For [`@ruby/wasm-wasi`](https://www.npmjs.com/package/@ruby/wasm-wasi)
119
+
120
+ ```console
121
+ $ npm install --save @ruby/wasm-wasi@latest
122
+ # or if you want the nightly snapshot
123
+ $ npm install --save @ruby/wasm-wasi@next
124
+ # or you can specify the exact snapshot version
125
+ $ npm install --save @ruby/wasm-wasi@2.5.0-2024-01-28-a
126
+ ```
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
6
+
7
+ group :development do
8
+ gem "rake"
9
+ gem "rake-compiler"
10
+ gem "rb_sys", "0.9.85"
11
+ end
12
+
13
+ group :check do
14
+ gem "webrick"
15
+ gem "syntax_tree", "~> 3.5"
16
+ gem "steep"
17
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Yuta Saito
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.