Files
SluijsensandClaude Opus 5.5 65c850e949 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>
2026-10-31 17:41:12 +01:00

2.1 KiB

Component Methods: prerendering

Signatures are the intended interfaces. Detailed rules follow in Functional Design.

config/inlineScripts.ts

type MovedScript = { fileName: string; body: string };
type ExternalizeResult = { html: string; moved: MovedScript[] };

// Replaces each executable inline script with a reference to a file named
// after its content hash; order and all other content stay as they are.
export function externalizeInlineScripts(html: string): ExternalizeResult;

// Executable inline scripts still present; data blocks such as JSON-LD excluded.
export function findExecutableInlineScripts(html: string): string[];

config/externalizeInlineScripts.ts

// Rewrites all HTML under clientDir and writes moved scripts to clientDir/assets.
// Exits non-zero when a page has no moved scripts or a violation remains.
export function externalizeOutput(clientDir: string): void;

config/previewServer.ts

// Maps a request path to a file following the nginx rules.
export function resolveRequest(
    path: string,
    fileExists: (file: string) => boolean,
): { file: string; status: 200 | 404 } | { redirect: string };

export function startPreviewServer(clientDir: string, port: number): Server;

src/router.tsx

export function getRouter(): AnyRouter;

src/hooks/useHydrated.ts

export default function useHydrated(): boolean;

src/components/Reveal

// Props are unchanged, so the 21 call sites stay as they are.
type RevealProps = BoxProps & { delay?: number };

useReveal<T>() keeps returning { ref, visible }. visible now starts as true and only becomes false when the element is below the viewport after hydration.

src/components/DeferredImage

Props are unchanged. The rendered output gains a <noscript> image.

src/seo.ts

// Adds the preload link for a page's first photo to its head.
export function preloadImage(src: string): HeadLink;

Route head()

Pages pass their first photo to pageHead, so the existing pageHead(path) helper stays the single source for head tags. The exact shape is settled in unit 2.