Skip to content

Omit ruby.debug.wasm in npm package to reduce size #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/npm-packages/ruby-head-wasm-wasi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const main = async () => {
const binary = await fs.readFile(
// Tips: Replace the binary with debug info if you want symbolicated stack trace.
// (only nightly release for now)
// "./node_modules/ruby-head-wasm-wasi/dist/ruby.debug.wasm"
// "./node_modules/ruby-head-wasm-wasi/dist/ruby.debug+stdlib.wasm"
"./node_modules/ruby-head-wasm-wasi/dist/ruby.wasm"
);
const module = await WebAssembly.compile(binary);
Expand Down Expand Up @@ -64,7 +64,7 @@ See [the example project](https://github.com/ruby/ruby.wasm/tree/main/packages/n
const response = await fetch(
// Tips: Replace the binary with debug info if you want symbolicated stack trace.
// (only nightly release for now)
// "https://cdn.jsdelivr.net/npm/ruby-head-wasm-wasi@latest/dist/ruby.debug.wasm"
// "https://cdn.jsdelivr.net/npm/ruby-head-wasm-wasi@next/dist/ruby.debug+stdlib.wasm"
"https://cdn.jsdelivr.net/npm/ruby-head-wasm-wasi@latest/dist/ruby.wasm"
);
const buffer = await response.arrayBuffer();
Expand Down
3 changes: 1 addition & 2 deletions packages/npm-packages/ruby-wasm-wasi/build-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ wit-bindgen js \
)

wasm-opt --strip-debug "$ruby_root/usr/local/bin/ruby" -o "$dist_dir/ruby.wasm"
cp "$ruby_root/usr/local/bin/ruby" "$dist_dir/ruby.debug.wasm"

# Build +stdlib versions (removing files that are not used in normal use cases)
workdir="$(mktemp -d)"
Expand All @@ -38,7 +37,7 @@ rm -rf $workdir/ruby-root/usr/local/include
rm -f $workdir/ruby-root/usr/local/lib/libruby-static.a
rm -f $workdir/ruby-root/usr/local/bin/ruby
wasi-vfs pack "$dist_dir/ruby.wasm" --mapdir /usr::$workdir/ruby-root/usr -o "$dist_dir/ruby+stdlib.wasm"
wasi-vfs pack "$dist_dir/ruby.debug.wasm" --mapdir /usr::$workdir/ruby-root/usr -o "$dist_dir/ruby.debug+stdlib.wasm"
wasi-vfs pack "$ruby_root/usr/local/bin/ruby" --mapdir /usr::$workdir/ruby-root/usr -o "$dist_dir/ruby.debug+stdlib.wasm"


mkdir "$dist_dir/bindgen"
Expand Down
1 change: 0 additions & 1 deletion packages/npm-packages/ruby-wasm-wasi/test/package.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ describe("Packaging validation", () => {

test.each([
{ file: "ruby+stdlib.wasm", stdlib: true },
{ file: "ruby.debug.wasm", stdlib: false },
{ file: "ruby.debug+stdlib.wasm", stdlib: true },
])("Load all variants", async ({ file, stdlib }) => {
const binary = await fs.readFile(path.join(__dirname, `./../dist/${file}`));
Expand Down