/** * Render Pipeline * * Orchestrates the complete page rendering process through 10 stages: * 1. Page Resolution - 2. Layout/Provider Collection - 3. Speculative Cache Check (parallel) * 4. Route Params - 5. Two-Phase Data Fetching - 6. Await Cache Check * 7. Bundle Preparation - 8. Layout Application - 9. SSR Rendering - 10. Result Assembly * * Performance optimizations: * - Speculative cache check runs in parallel with data fetching * - Two-phase data fetching: load all modules first, then fetch all data in parallel * - Supports both /pages/ and /app/ router directories * * @module rendering/orchestrator/pipeline */ import { type RenderCacheKeyComposition } from "../../cache/keys/dependency-pinning.js"; import { type RouterDirectories } from "../../utils/route-path-utils.js"; import type { RuntimeAdapter } from "../../platform/adapters/base.js"; import type { VeryfrontConfig } from "../../config/index.js"; import type { CacheLookupResult } from "../cache/cache-coordinator.js"; import type { PageRenderer } from "../page-renderer.js"; import type { PageResolver } from "../page-resolution/index.js"; import type { LayoutOrchestrator } from "./layout.js"; import type { SSROrchestrator } from "./ssr-orchestrator.js"; import type { PageDataResponse, RenderOptions, RenderResult } from "./types.js"; export { __injectCssCacheForTests } from "./css-cache.js"; /** * Minimal cache interface used by RenderPipeline. * Decoupled from the concrete CacheCoordinator class so that Renderer * can supply a context-aware adapter without an unsafe `as any` cast. */ export interface PipelineCacheCoordinator { checkCache(slug: string, cacheKey?: string, nonce?: string): Promise; persistResult(result: RenderResult, slug: string, cacheKey?: string, nonce?: string): Promise; } export interface RenderPipelineConfig { pageResolver: PageResolver; cacheCoordinator: PipelineCacheCoordinator; pageRenderer: PageRenderer; layoutOrchestrator: LayoutOrchestrator; ssrOrchestrator: SSROrchestrator; adapter: RuntimeAdapter; mode: "development" | "production"; projectDir: string; /** Whether browser module URLs may use the local filesystem endpoint. */ isLocalProject: boolean; /** Narrow host-owned capability for project-code execution. */ allowHostProjectCodeExecution?: boolean; /** Stable project identity used to isolate transformed module caches. */ projectId?: string; /** Release or preview source used to isolate transformed module caches. */ contentSourceId?: string; /** Project configuration used to resolve the matching React runtime. */ config?: VeryfrontConfig; /** Configured App and Pages Router roots. */ directories?: RouterDirectories; /** Query parameter handling for cache keys (from config.cache.queryParams) */ queryParamOptions?: import("../../cache/keys.js").QueryParamCacheOptions; /** Prefixes applied after the pipeline returns a render cache override. */ renderCacheKeyComposition?: Omit; } export declare class RenderPipeline { private config; private dataFetcher; private moduleLoaderConfig; private reactVersionPromise; constructor(config: RenderPipelineConfig); private getDependencyPinningSource; private getReactVersion; private planClientPageIsland; /** * Build an immutable loader configuration for one render request. A pipeline can * serve concurrent requests, so request identity must not be written into shared * mutable state while module transforms are in flight. */ private resolveModuleLoaderConfig; /** * Clear the module cache to force re-transformation on next render. * Called by poke/invalidation handlers to ensure fresh modules are loaded. */ clearModuleCache(): void; private loadModule; private resolveCssFromRenderedHtml; /** * Load modules in parallel and return only successfully loaded ones. * * IMPORTANT: Page modules are considered critical - if a page module fails to load, * we throw an error instead of silently continuing with missing props. This prevents * users from seeing broken pages with no indication of the problem. * * A layout module that fails to load does not stop this phase: the page * continues without that layout's data, and the apply phase loads the layout * again. That second attempt is what decides the render, so a failure here is * only provisional - unless the project's source is gone, in which case the * reload fails identically and the render is already over. */ private loadModulesInParallel; /** * Resolve page + layout data props from module data-fetching hooks. * Shared by both renderPage() and resolvePageData() to keep behavior aligned. */ private resolveDataFetching; /** * Build a host-owned worker generation for raw local data modules. * * A mutable source may only reuse a Worker when its filesystem adapter * supplies an exact snapshot generation. Otherwise the data fetcher selects * a single-use Worker so an imported module graph cannot survive a source * change. Production releases are immutable and may use the release id. */ private resolveDataWorkerIdentity; private applyFetchedDataResults; renderPage(slug: string, options?: RenderOptions): Promise; /** Resolve page data for SPA client-side navigation without rendering HTML. */ resolvePageData(slug: string, options?: RenderOptions): Promise; private extractMdxMetadata; private resolveAppPath; private resolveProjectUpdatedAt; private resolvePageDataCss; private hasReadyReleaseCss; private generatePageCssFromHtml; /** * Build a cache key that is safe for multi-tenant + query-param aware caching. * Returns null when request contains sensitive headers (Authorization/Cookie) and * no explicit cacheKey override was provided, to avoid leaking personalized HTML. * * Query param handling uses config.queryParamOptions for filtering (utm_*, gclid, etc.). */ private buildCacheKey; } //# sourceMappingURL=pipeline.d.ts.map