/** * Nexus SSR Renderer — assembles server-rendered HTML with island markers. * Implements PPR (Partial Pre-Rendering): static shell + dynamic holes. * * Edge-Cache Header Strategy: * Nexus knows the TTL of every cache() call made during rendering. * The renderer collects these TTLs and emits the most conservative * Cache-Control header, ensuring CDNs never serve stale content. * * Rules: * 1. No cache() calls → Cache-Control: no-store (dynamic, session data) * 2. All static (TTL=∞) → Cache-Control: public, max-age=31536000, immutable * 3. Mixed TTLs → Cache-Control: s-maxage=, stale-while-revalidate= * 4. Has Suspense boundary → Cache-Control: no-store (streaming, can't cache) * 5. Has user session → Cache-Control: private, no-store (never CDN-cache) */ import type { MatchedRoute } from '@nexus_js/router'; import { type NexusContext } from './context.js'; export interface RenderOptions { dev: boolean; /** Required for loading `.nx` routes (dev compile + prod build path). */ appRoot: string; /** * From `.nexus/build-id.json` after `nexus build`. Injected into the document * as `window.__NEXUS_BUILD_ID__` so `callAction` can send `x-nexus-build-id`. */ buildId?: string; assets: AssetManifest; /** * Extra `