perf(web): cache static assets and defer wasm boot

Add long Cache-Control for /static, version client embed URLs from
asset_version, and delay WASM mount until after load so LCP images win.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-09-18 15:07:54 +08:00
1 parent 981d754133
commit 453321c8c2
5 files changed
+87 -15

No files matched your search

@@ -297,3 +297,23 @@ func TestNavBrandClientChrome(t *testing.T) {
t.Fatalf("missing drawer veil")
}
}
func TestClientEmbedAssetVersion(t *testing.T) {
page := map[string]any{
"title": "v",
"asset_version": "20260918d",
"client": map[string]any{
"source": "/static/client.mq.md",
},
}
html := render.RenderPage(page, "", "")
if !strings.Contains(html, `/static/marqdo-bridge.js?v=20260918d`) {
t.Fatalf("missing versioned bridge: %s", html)
}
if !strings.Contains(html, `data-mq-wasm="/static/marqdo_wasm.wasm?v=20260918d"`) {
t.Fatalf("missing versioned wasm")
}
if !strings.Contains(html, `data-mq-source-url="/static/client.mq.md?v=20260918d"`) {
t.Fatalf("missing versioned source")
}
}