Repository navigation
perf: inline critical assets, cache the home page, and slim the Worker bundle - #16
Merged
Merged
Conversation
- Inline style.css and the pre-paint theme bootstrap into the server-rendered HTML, removing both render-blocking requests on first load - Edge-cache GET / per URL for five minutes via the Cache API, keyed by APP_VERSION so deploys invalidate it; skip the cache in local dev - Reduce home rendering from five sequential D1 reads to two parallel reads and parallelize the dashboard/health queries - Add immutable caching for versioned static assets; bump the service-worker shell cache and stop precaching the now-inlined assets - Remove the startup forced reflow in preview action placement - Deduplicate favicon requests and add a buildErrors contract test Co-Authored-By: Claude Code <noreply@anthropic.com>
|
🔎 Cloudflare preview: https://f0419adc-feedreader.phatpham9.workers.dev Uploaded from |
- @cloudflare/workers-types 4.20260621.1 -> 5.20261113.1 - typescript 5.9.3 -> 7.0.2 - vitest 3.2.6 -> 5.1.0 - wrangler 4.103.0 -> 4.161.0 - linkedom 0.18.12 -> 0.18.15 npm audit drops from 12 vulnerabilities (2 critical, 8 high, 1 moderate, 1 low) to 0. Verified with a clean npm ci, typecheck, 83 tests, local D1 migrations, wrangler deploy --dry-run, and a dev smoke test including source parsing and article-preview extraction. Co-Authored-By: Claude Code <noreply@anthropic.com>
- Swap the DOM parser used by GitHub Trending and the reader preview for node-html-parser 9.0.7; keep the DOM-like surface behind core/sources/dom.ts - Shrink the Worker bundle from 911.2 KiB / 210.4 KiB gzip to 327.5 KiB / 87.9 KiB gzip - Parser benchmark on a 248 KB page: 7.4 ms -> 3.6 ms median (parse + queries) - Drop the now-unused DOM lib from tsconfig and simplify the Cache typings - Add wrapper tests for body selection, fragments, and parent traversal Verified with 85 tests, typecheck, a live GitHub Trending parse, live GitHub and Hugging Face preview extraction (including paper byline/links/citations), browser preview rendering, and a cold mobile trace (LCP 294 ms, no render-blocking requests, no forced reflow). Co-Authored-By: Claude Code <noreply@anthropic.com>
Member
Author
End-to-end verification after replacing linkedom
🤖 Generated with Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First load / rendering
style.cssand the pre-paint theme bootstrap into the server-rendered HTML. Both are read once per isolate through theASSETSbinding, so the files stay the single source of truth.GET /per URL for five minutes via the Cache API, keyed byAPP_VERSIONso every deploy invalidates it. Localwrangler dev(APP_VERSION=dev) skips this cache so template/CSS edits are visible immediately.dashboard()query used only for error banners. Parallelizedashboard()/healthPayload()queries.web-static/_headerswith one-year immutable caching for versioned static assets.service-worker.jsstays revalidated.buildErrorscontract test.Dependency upgrades
@cloudflare/workers-typestypescriptvitestwranglerlinkedomnode-html-parsernpm auditdrops from 12 vulnerabilities (2 critical, 8 high, 1 moderate, 1 low) to 0.npm outdatedis empty.Parser replacement
core/sources/dom.tsnow wrapsnode-html-parserinstead of linkedom. The wrapper exposes the same DOM-like surface used by GitHub Trending and the reader preview (querySelector,querySelectorAll,closest,nextElementSibling,children,classList,textContent) plus aparentElement()accessor.tsconfig.jsonand simplified the WorkersCachetypings.core/test/dom.spec.tscovering body selection, fragments, and parent traversal.Measured impact
Cold mobile browser load (Fast 4G, 4x CPU, service worker cleared):
Desktop cold LCP measured at 43 ms.
Verification
npm cinpm run typecheck(TypeScript 7)npm test(Vitest 5: 85 passing on Node 26; CI uses Node 24, which is supported)npm run db:migrate:localwrangler deploy --dry-runREADME.md,docs/ARCHITECTURE.md,docs/DEPLOYMENT.md,docs/RUNBOOK.mdNotes
/api/itemsand personalization caches still invalidate fromsync_state.last_success_at.node-html-parseris now the only runtime dependency (besides the Worker platform bindings).🤖 Generated with Claude Code