Simple streamable WebAssembly binary parser.
Test
Compiling Code
npm run build
Examples
See the examples/
folder.
Running Tests
npm test
Creating Tests
Place a .wasm
and an associated .wasm.out
file in the test
directory.
The testing harness will compare the parsing output of the .wasm
file against the .wasm.out
file.
You can use the npm test update
command to automatically create a .out
files. This is useful if you have made a change that affects the tests.
2.0.0 (2020-06-10)
Bug Fixes
- print data section entries in a single line (e2aa667)
Features
- remove type section from disassembly (d61d67d), closes #56
BREAKING CHANGES
- Disassembly output will no longer print all the
types in the beginning by default.
The type section can be reconstructed from the implicit type
information in the remainder of the disassembly, and is generally
just cognitive overhead for developers, especially in the browser
DevTools (see https://crbug.com/1092763 for relevant downstream
issue in Chromium DevTools). Relying on the implicit type information
is far more readable for humans and also avoids the need to dump all
the types in the beginning, which take up precious space since both
Chromium and Firefox DevTools limit the number of lines that are
displayed for large Wasm modules.
This adds a skipTypes
option to WasmDisassembler
instances, which
can be used to restore the old behavior. By default this option is set
to true
.
This includes a fix to call_indirect
and return_call_indirect
,
where we had previously refered to the type by name, and now we
use the abbreviated form for printing types as well [1].