feat: add multi-encoding compression with lazy caching and pre-compressed assets

- Build-time: pre-compress static assets (.gz, .br, .zst) via compress-assets.ts
- Runtime: serve pre-compressed embedded assets with Accept-Encoding negotiation
- ISR cache: lazy per-encoding compression (compress on first request, cache result)
- tower-http: enable runtime compression for API/SSR responses (respects Content-Encoding)
This commit is contained in:
2026-01-15 15:50:55 -06:00
parent 846f559ff5
commit 5e0029c98b
12 changed files with 799 additions and 19 deletions
+6 -1
View File
@@ -34,7 +34,12 @@ time = { version = "0.3.44", features = ["formatting", "macros", "serde"] }
tokio = { version = "1.49.0", features = ["full"] }
tokio-util = { version = "0.7.18", features = ["io"] }
tower = "0.5"
tower-http = { version = "0.6.8", features = ["trace", "cors", "limit"] }
tower-http = { version = "0.6.8", features = ["trace", "cors", "limit", "compression-full"] }
# Compression for ISR cache
zstd = "0.13"
brotli = "8"
flate2 = "1.0"
tracing = "0.1.44"
tracing-subscriber = { version = "0.3.22", features = ["env-filter", "json"] }
ulid = { version = "1", features = ["serde"] }