Commit graph

6 commits

Author SHA1 Message Date
Snider
aae5d21ad4 test(wasm): add binary size gate test
TestWASMBinarySize builds WASM with -ldflags="-s -w", gzips the
binary, and asserts < 1MB gzip (842KB actual) and < 3MB raw (2.90MB
actual). Skipped in -short mode. Matches Makefile WASM_GZ_LIMIT.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 08:42:58 +00:00
Snider
4c657377c4 fix(wasm): reduce binary from 1.56MB to 830KB gzip
Move heavyweight imports out of WASM build via //go:build !js tags:
- register.go: encoding/json + text/template (codegen)
- pipeline.go: go-i18n/reversal (grammar imprint)
- layout.go: replace fmt.Sprintf with string concat

Add cmd/codegen/ CLI as build-time replacement for in-browser
registerComponents(). Reads slot JSON from stdin, writes WC bundle
JS to stdout.

Result: 2.90MB raw / 830KB gzip (was 6.04MB / 1.56MB).
Makefile gate passes (limit 1MB gzip).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 08:29:54 +00:00
Claude
dcd55a434c
feat(wasm): add registerComponents export for WC codegen
Exposes gohtml.registerComponents(slotsJSON) to browser context.
Pure-Go buildComponentJS is testable without WASM; WASM glue uses
Function constructor for browser-side execution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 20:50:50 +00:00
Claude
9bc1fa7c69
fix: escape variant names, single-pass StripTags, WASM security contract
- Escape variant name in Responsive.Render HTML attribute (XSS fix)
- Rewrite StripTags to single-pass O(n) space collapsing
- Document Raw() security contract in WASM entry point
- Add TestAttr_NonElement coverage
- Fix Makefile WASM target to rebuild on source changes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 00:21:24 +00:00
Claude
e34c5c96c3
test: add WASM browser test harness
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 00:15:26 +00:00
Claude
5acf63cb4b
feat: add WASM entry point with renderToString
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 00:12:04 +00:00