From d88a9393af1fd1217d3086a51daca40c239011ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Tue, 21 Oct 2025 07:40:37 +0200 Subject: [PATCH] Use newer Javy and omit source code from wasm Javy v1.2.0 is a couple of years old. The current version is v7.0.1. Besides being newer it also builds smaller WASM files (1/10 in size). Version 7.0.1 also has feature for omitting the JS source from the WASM file. When used it produces even smaller WASM files. ```console $ ./javy-x86_64-linux-v1.2.0 compile out.js -o plugin-1.2.0.wasm $ ./javy-x86_64-linux-v7.0.1 build out.js -o plugin-7.0.1.wasm $ ./javy-x86_64-linux-v7.0.1 build out.js --codegen source=omitted -o plugin-7.0.1-omit-source.wasm $ ls -lh *.wasm -rw-rw-r-- 1 arne arne 70M okt 21 07:28 plugin-1.2.0.wasm -rw-rw-r-- 1 arne arne 7,3M okt 21 07:28 plugin-7.0.1.wasm -rw-rw-r-- 1 arne arne 6,4M okt 21 07:28 plugin-7.0.1-omit-source.wasm ``` --- .github/workflows/ci.yml | 8 ++++---- Makefile | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f576664..f64ee47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,12 +13,12 @@ jobs: with: sqlc-version: '1.24.0' - uses: actions/setup-node@v4 - - run: wget https://github.com/bytecodealliance/javy/releases/download/v1.2.0/javy-x86_64-linux-v1.2.0.gz - - run: gzip -d javy-x86_64-linux-v1.2.0.gz - - run: chmod +x javy-x86_64-linux-v1.2.0 + - run: wget https://github.com/bytecodealliance/javy/releases/download/v7.0.1/javy-x86_64-linux-v7.0.1.gz + - run: gzip -d javy-x86_64-linux-v7.0.1.gz + - run: chmod +x javy-x86_64-linux-v7.0.1 - run: npm install - run: npx tsc --noEmit - run: npx esbuild --bundle src/app.ts --tree-shaking=true --format=esm --target=es2020 --outfile=out.js - - run: ./javy-x86_64-linux-v1.2.0 compile out.js -o examples/plugin.wasm + - run: ./javy-x86_64-linux-v7.0.1 compile out.js -o examples/plugin.wasm - run: sqlc -f sqlc.dev.yaml diff working-directory: examples \ No newline at end of file diff --git a/Makefile b/Makefile index 8ab6195..6a50cd4 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,9 @@ generate: examples/plugin.wasm examples/sqlc.dev.yaml cd examples && sqlc-dev -f sqlc.dev.yaml generate -# https://github.com/bytecodealliance/javy/releases/tag/v1.2.0 +# https://github.com/bytecodealliance/javy/releases/tag/v7.0.1 examples/plugin.wasm: out.js - ./javy compile out.js -o examples/plugin.wasm + ./javy build out.js --codegen source=omitted -o examples/plugin.wasm out.js: src/app.ts $(wildcard src/drivers/*.ts) src/gen/plugin/codegen_pb.ts npx tsc --noEmit