feat(fetch): portable wasm build with passthrough and meta fixes #1

Merged
w33ble merged 13 commits from feat/wasm-portable-build into main 2026-10-06 12:24:40 -06:00
Collaborator

Summary

  • Replace napi @kreuzberg/html-to-markdown dep (per-OS .node binaries) with @kreuzberg/html-to-markdown-wasm; embed 3.2MB wasm via initSync into single 4.5MB skill/resources/fetch.js runnable on Linux + macOS with no install step, no --compile, no per-arch matrix
  • Vendor wasm-bindgen loader in src/vendor (gen-wasm.ts regenerates gitignored base64 blob; chained into build/build:dev)
  • --meta: hybrid extraction (document.* from full-page HTML, headers/links/images from cleaned content fragment), plain-JSON serialization of wasm getters, markdown-mode parsing, empty envelope for plain/JSON
  • Strip heading permalink anchors pre-conversion (keeps MDN anchor-wrapped heading text, unwraps link syntax in header strings)
  • Pass through text/plain and JSON API responses unconverted (JSON retry with proper Accept); non-OK responses exit 1 with server body truncated to 500 chars on stderr; late markdown responses route through passthrough instead of HTML parser
  • README + SKILL.md updated (wasm setup, passthrough, --meta scope: content-fragment only, nav/footer excluded)

Why

The bundled script only ran on the build OS due to the native html-to-markdown runtime. This makes the skill downloadable and runnable anywhere Bun runs.

## Summary - Replace napi `@kreuzberg/html-to-markdown` dep (per-OS .node binaries) with `@kreuzberg/html-to-markdown-wasm`; embed 3.2MB wasm via `initSync` into single 4.5MB `skill/resources/fetch.js` runnable on Linux + macOS with no install step, no `--compile`, no per-arch matrix - Vendor wasm-bindgen loader in `src/vendor` (`gen-wasm.ts` regenerates gitignored base64 blob; chained into `build`/`build:dev`) - `--meta`: hybrid extraction (document.* from full-page HTML, headers/links/images from cleaned content fragment), plain-JSON serialization of wasm getters, markdown-mode parsing, empty envelope for plain/JSON - Strip heading permalink anchors pre-conversion (keeps MDN anchor-wrapped heading text, unwraps link syntax in header strings) - Pass through text/plain and JSON API responses unconverted (JSON retry with proper Accept); non-OK responses exit 1 with server body truncated to 500 chars on stderr; late markdown responses route through passthrough instead of HTML parser - README + SKILL.md updated (wasm setup, passthrough, --meta scope: content-fragment only, nav/footer excluded) ## Why The bundled script only ran on the build OS due to the native html-to-markdown runtime. This makes the skill downloadable and runnable anywhere Bun runs.
w33ble merged commit c6a1133370 into main 2026-10-06 12:24:40 -06:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
w33ble/web-fetch!1
No description provided.