Adds the prerendering requirements, design and baseline

Records the requirements, execution plan, application design, the first unit's
functional design and code generation plan, and the baseline on master.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 17:41:12 +01:00
co-authored by Claude Opus 5.5
parent c4c2f83d6c
commit 65c850e949
22 changed files with 2569 additions and 0 deletions
@@ -0,0 +1,49 @@
# Components: prerendering
All paths are under `web/`. "New" and "changed" refer to master at c4c2f83.
## Build and entry (unit 1)
| Component | Status | Responsibility |
|---|---|---|
| `vite.config.ts` | Changed | Adds the `tanstackStart` plugin with prerendering; the plugin is left out under Vitest |
| `src/router.tsx` | New | `getRouter()`: the router options now in `main.tsx` (scroll restoration, default error component) |
| `src/routes/__root.tsx` | Changed | Renders the document through `shellComponent` (`html`, `HeadContent`, providers, `Scripts`); imports the fonts |
| `src/client.tsx` | New | Browser entry: starts Sentry, then hydrates. Replaces `main.tsx` |
| `src/main.tsx`, `index.html` | Removed | Start generates the document; fallback tags are no longer needed |
| `config/inlineScripts.ts` | New | Pure logic: finds executable inline scripts in HTML and replaces them with file references |
| `config/externalizeInlineScripts.ts` | New | Post-build runner: applies the logic to all HTML in the output, writes the files, fails the build on a violation |
| `config/previewServer.ts` | New | Static server for Lighthouse and browser tests, following the nginx rules and using `securityHeaders` |
| `e2e/` | New | Browser tests against the built output: hydration, CSP, content without JavaScript |
| `src/test/renderApp.tsx` | Changed | Renders the app without the document shell in jsdom |
## Hydration safety (unit 1)
| Component | Status | Responsibility |
|---|---|---|
| `src/hooks/useHydrated.ts` | New | `false` during prerendering and the first browser render, then `true` |
| `routes/index.tsx`, `routes/contact.tsx`, `routes/portfolio.tsx` | Changed | Search values take effect after hydration, through `useHydrated` |
| `usePageLoaded`, `useInView` | Changed | Same first render on server and client |
| `NavigationBar`, `useReveal`, `useHeroSlider`, `TestimonialCarousel`, `ContactSection` | Changed | Breakpoint and media query values start from a server-safe value; `useHeroSlider` also reads `document.hidden` safely |
| `UmamiAnalytics` | Changed | Reads the hostname in its effect, not during render |
| `Footer`, `ContactDetails`, `lib/contactChannels.ts`, `ContactFormGate`, `ContactForm` | Changed | E-mail address only after hydration (FR-PR-22); `Footer` also renders the year safely |
| `src/routes/$.tsx` | New | Catch-all route rendering `NotFound`; source of `404.html` |
| `NotFound` | Changed | Shows the shoot section buttons after hydration |
## Display (unit 2)
| Component | Status | Responsibility |
|---|---|---|
| `Reveal`, `useReveal` | Changed | Visible in the HTML; only content below the viewport at load is hidden for its fade-in |
| `DeferredImage` | Changed | Real image for visitors without JavaScript; deferred loading with JavaScript stays |
| `NoScriptNav` | New | Rendered inside `<noscript>`: a menu link, a close link and the CSS that shows `#mobile-nav` through `:target` and expands the shoot submenu |
| `Hero`, `TestimonialCarousel`, `ContactSection` | Changed where needed | First slide, usable content and mailto route without JavaScript |
| `seo.ts` and route `head()` | Changed | Preload link for the first photo per page |
## Hosting (unit 3)
| Component | Status | Responsibility |
|---|---|---|
| `config/serverConfig.ts`, `deploy/` | Changed | URL rules and real 404 on nginx and IIS |
| `.gitea/workflows/continuous_integration.yaml` | Changed | Client output only; upload order for all HTML files. The output path itself changes in unit 1 |
| `lighthouserc.cjs`, `lighthouserc.desktop.cjs` | Changed | Preview server, final targets |