Skip to content
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Thumbs.db
*.wasm
/wasm_exec.js
docs/public/wasm/gh-aw.wasm
docs/public/wasm/gh-aw.wasm.br
docs/public/wasm/gh-aw.wasm.gz
docs/public/wasm/wasm_exec.js

# Go binary for this project
Expand Down
2 changes: 1 addition & 1 deletion docs/public/editor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
<div class="loading-overlay" id="loadingOverlay">
<div class="loading-spinner"></div>
<div class="f4 color-fg-muted mb-1">Loading gh-aw compiler...</div>
<div class="f6 color-fg-subtle">Downloading WebAssembly module (~17 MB)</div>
<div class="f6 color-fg-subtle">Downloading WebAssembly module (~5 MB compressed)</div>
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loading message was updated to show "~5 MB compressed" but the updated message may be misleading since GitHub Pages does not automatically serve the compressed .br files. Users will still download the full uncompressed ~17 MB .wasm file unless additional configuration or code changes are made to explicitly fetch and decompress the .br file.

This change should be coordinated with actual implementation to serve the compressed file, otherwise users will see a message claiming ~5 MB but actually download ~17 MB, leading to a confusing user experience.

Copilot uses AI. Check for mistakes.
</div>

<!-- Header -->
Expand Down
13 changes: 13 additions & 0 deletions scripts/bundle-wasm-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ if [ ! -f "${WASM_EXEC_SRC}" ]; then
fi
cp "${WASM_EXEC_SRC}" "${DEST_DIR}/wasm_exec.js"

# Generate brotli-compressed version for smaller transfers
# GitHub Pages serves .br files automatically when Accept-Encoding: br is present
Comment on lines +38 to +39
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment states "GitHub Pages serves .br files automatically when Accept-Encoding: br is present" but this behavior is not standard for GitHub Pages. GitHub Pages (using Jekyll) does not automatically serve pre-compressed .br files - it serves the .wasm file directly. Modern CDNs and web servers like Nginx, Caddy, or Cloudflare can serve pre-compressed files automatically, but GitHub Pages does not have this feature built-in.

The compressed files will be uploaded but won't be automatically served to browsers. To utilize these compressed files, you would need custom JavaScript to fetch the .br or .gz files explicitly, or configure a CDN in front of GitHub Pages that supports this feature.

Consider either:

  1. Updating the comment to clarify that these files are created for potential future use or manual serving
  2. Implementing client-side logic to fetch the compressed version explicitly
  3. Documenting that a CDN configuration is required to serve these files
Suggested change
# Generate brotli-compressed version for smaller transfers
# GitHub Pages serves .br files automatically when Accept-Encoding: br is present
# Generate brotli-compressed version for smaller transfers.
# Note: GitHub Pages does not automatically serve .br files; these are for use with a CDN or custom setup.

Copilot uses AI. Check for mistakes.
if command -v brotli &> /dev/null; then
echo "==> Compressing WASM with brotli..."
brotli -k -q 11 "${DEST_DIR}/gh-aw.wasm"
echo "Compressed: $(du -h "${DEST_DIR}/gh-aw.wasm.br" | cut -f1) (from $(du -h "${DEST_DIR}/gh-aw.wasm" | cut -f1))"
else
echo "Warning: brotli not found. Install with: apt-get install brotli (or brew install brotli)"
echo "Falling back to gzip compression..."
gzip -k -9 "${DEST_DIR}/gh-aw.wasm"
echo "Compressed: $(du -h "${DEST_DIR}/gh-aw.wasm.gz" | cut -f1) (from $(du -h "${DEST_DIR}/gh-aw.wasm" | cut -f1))"
fi

echo ""
echo "Done. Files in ${DEST_DIR}:"
ls -lh "${DEST_DIR}/gh-aw.wasm" "${DEST_DIR}/wasm_exec.js"
Comment on lines +40 to 53
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The final ls command only lists the uncompressed WASM file and wasm_exec.js, but doesn't show the newly created compressed files (.br or .gz). This makes it difficult to verify that the compression step succeeded.

Consider updating the ls command to include the compressed files. For example:

  • If brotli succeeds, list gh-aw.wasm.br
  • If gzip fallback is used, list gh-aw.wasm.gz

This would provide better visibility into what files were actually created by the script.

Suggested change
if command -v brotli &> /dev/null; then
echo "==> Compressing WASM with brotli..."
brotli -k -q 11 "${DEST_DIR}/gh-aw.wasm"
echo "Compressed: $(du -h "${DEST_DIR}/gh-aw.wasm.br" | cut -f1) (from $(du -h "${DEST_DIR}/gh-aw.wasm" | cut -f1))"
else
echo "Warning: brotli not found. Install with: apt-get install brotli (or brew install brotli)"
echo "Falling back to gzip compression..."
gzip -k -9 "${DEST_DIR}/gh-aw.wasm"
echo "Compressed: $(du -h "${DEST_DIR}/gh-aw.wasm.gz" | cut -f1) (from $(du -h "${DEST_DIR}/gh-aw.wasm" | cut -f1))"
fi
echo ""
echo "Done. Files in ${DEST_DIR}:"
ls -lh "${DEST_DIR}/gh-aw.wasm" "${DEST_DIR}/wasm_exec.js"
COMPRESSED_EXT=""
if command -v brotli &> /dev/null; then
echo "==> Compressing WASM with brotli..."
brotli -k -q 11 "${DEST_DIR}/gh-aw.wasm"
echo "Compressed: $(du -h "${DEST_DIR}/gh-aw.wasm.br" | cut -f1) (from $(du -h "${DEST_DIR}/gh-aw.wasm" | cut -f1))"
COMPRESSED_EXT="br"
else
echo "Warning: brotli not found. Install with: apt-get install brotli (or brew install brotli)"
echo "Falling back to gzip compression..."
gzip -k -9 "${DEST_DIR}/gh-aw.wasm"
echo "Compressed: $(du -h "${DEST_DIR}/gh-aw.wasm.gz" | cut -f1) (from $(du -h "${DEST_DIR}/gh-aw.wasm" | cut -f1))"
COMPRESSED_EXT="gz"
fi
echo ""
echo "Done. Files in ${DEST_DIR}:"
if [ -n "${COMPRESSED_EXT}" ]; then
ls -lh "${DEST_DIR}/gh-aw.wasm" "${DEST_DIR}/gh-aw.wasm.${COMPRESSED_EXT}" "${DEST_DIR}/wasm_exec.js"
else
ls -lh "${DEST_DIR}/gh-aw.wasm" "${DEST_DIR}/wasm_exec.js"
fi

Copilot uses AI. Check for mistakes.