A small gem which vendors binaryen
releases for easy use from Ruby. It includes the following executables:
Here's a version of the table with the descriptions shortened to a single sentence:
exe | description |
---|---|
wasm-split |
Splits a module into a primary and a secondary module, or instruments a module to gather a profile for future splitting. |
wasm-ctor-eval |
Executes code at compile time. |
wasm-merge |
Merges multiple wasm files into one. |
wasm-reduce |
Reduces a wasm file to a smaller one with the same behavior on a given command. |
wasm-metadce |
Performs dead code elimination (DCE) on a larger space that the wasm module is just a part of. |
wasm-shell |
Executes .wast files. |
wasm-fuzz-types |
Fuzzes type construction, canonicalization, and operations. |
wasm-fuzz-lattices |
Fuzzes lattices for reflexivity, transitivity, and anti-symmetry, and transfer functions for monotonicity. |
wasm-emscripten-finalize |
Performs Emscripten-specific transforms on .wasm files. |
wasm-as |
Assembles a .wat (WebAssembly text format) into a .wasm (WebAssembly binary format). |
wasm-opt |
Reads, writes, and optimizes files. |
wasm-dis |
Un-assembles a .wasm (WebAssembly binary format) into a .wat (WebAssembly text format). |
wasm2js |
Transforms .wasm/.wat files to asm.js. |
Please note that these are simplified descriptions and may not fully capture the functionality of each command. For a complete understanding, refer to the original descriptions or the respective command's documentation.
It also include libinaryen
and it's corresponding header files, if you need them.
Add the following to your Gemfile:
gem "binaryen"
Then run bundle install
.
This library only contains vendored executables, and minimal Ruby code to invoke
them. You can see some examples of how to use this gem in the
./examples
directory.
./examples/wasm_opt.rb
- Optimize a WebAssembly module./examples/wasm_split.rb
- Strip a WebAssembly module
Bug reports and pull requests are welcome on GitHub at https://github.com/Shopify/binaryen-rb. Signing Shopify's CLA is a mandatory when opening, you will be prompted to do so by a Github action.
Read and follow the guidelines in CONTRIBUTING.md.
This gem is published to Rubygems.
The procedure to publish a new release version is as follows:
- Update
lib/binaryen/version.rb
to a validbinaryen
release version - Run bundle install to bump the version of the gem in
Gemfile.lock
- Open a pull request, review, and merge
- Review commits since the last release to identify user-facing changes that should be included in the release notes
- Create a relase on GitHub with a version number that matches
lib/binaryen/version.rb
. Pick theCreate new tag
option. More on creating releases - Deploy via Shipit and see your latest version on Rubygems