import { createRenderContext, createRenderContextFromEnriched, type CreateRenderContextOptions, type RenderContext } from "./context/render-context.js"; import { type SharedServicesOptions } from "./shared/shared-services.js"; import { type ContextAwareCacheOptions } from "./shared/context-aware-cache.js"; import type { PageDataResponse, RenderOptions, RenderResult } from "./orchestrator/types.js"; import type { HandlerContext } from "../types/index.js"; /** * Options for initializing the Renderer */ export interface RendererOptions { /** Shared services options */ shared?: SharedServicesOptions; /** Cache options */ cache?: ContextAwareCacheOptions; } /** * Renderer - Shared renderer for all projects * * Initialize once at startup, then use for any project by passing * a RenderContext to each render call. * * ## Singleflight Deduplication * * Uses Singleflight to deduplicate concurrent renders of the same page. * Key insight: We cache the HTML string, not the stream. Each caller gets * a fresh RenderResult with the same HTML but no stream (streams can only * be consumed once). This prevents "body already consumed" errors while * still avoiding duplicate render work. * * The Singleflight key includes cache prefix, slug, and colorScheme. The prefix * includes release and manifest version when a ready release asset manifest is * consumed, so JIT and manifest-backed renders never share in-flight work. */ export declare class Renderer { private cache; private layoutComponentCache; private initialized; private initializationPromise; /** * Singleflight for render deduplication. Caches HTML string results so * concurrent requests for the same page share the render work. * Key format: {cachePrefix}:{slug}:{colorScheme} */ private renderFlight; /** Lets foreground followers recover when a background leader fails fast at capacity. */ private renderFlightAdmissions; private productionPrewarmContexts; constructor(options?: RendererOptions); initialize(options?: SharedServicesOptions): Promise; renderPage(slug: string, ctx: RenderContext, options?: RenderOptions): Promise; private renderPageWithAdmission; private resolveReleaseAssetManifest; private withManifestCachePrefix; /** * Build a Singleflight key for render deduplication. * Includes all context that affects rendering output. */ private getSingleflightKey; /** * Compute a cache key that is query-aware and avoids caching personalized responses * (Authorization / Cookie / x-api-key) unless the caller explicitly provides one. * * Query param handling is configurable via `config.cache.queryParams`: * - "ignore-all": Ignore all query params (pages share cache regardless of URL params) * - "include-all": Include all query params (each unique query = separate cache) * - "include-list": Only include specified params * - "exclude-list": Exclude common tracking/cache-busting params (default) */ private buildCacheKey; private withDependencyPinningCacheKey; private scheduleProductionRenderPrewarm; private shouldScheduleProductionPrewarm; private shouldScheduleProductionStaleRefresh; private getProductionPrewarmKey; private rememberProductionPrewarm; private buildCanonicalPrewarmOptions; private buildRoutePrewarmOptions; private buildStaleRefreshOptions; private scheduleProductionRenderRefresh; private runProductionRenderPrewarm; private doRenderPage; private runRenderWithCapacity; resolvePageData(slug: string, ctx: RenderContext, options?: RenderOptions): Promise; getAllPages(ctx: RenderContext): Promise; pageExists(slug: string, ctx: RenderContext): Promise; private filterResolvablePrewarmSlugs; clearCache(ctx: RenderContext, slug?: string): Promise; clearCacheForProject(projectId: string): Promise; destroy(): Promise; private createServicesForContext; } export { createRenderContext, createRenderContextFromEnriched, type CreateRenderContextOptions, type RenderContext, }; export declare function getRenderer(): Renderer; export declare function initializeRenderer(options?: RendererOptions): Promise; export declare function isRendererInitialized(): boolean; export declare function destroyRenderer(): Promise; export declare function clearRendererCacheForProject(projectId: string): Promise; export declare function renderPage(slug: string, handlerCtx: HandlerContext, options?: RenderOptions, contextOptions?: CreateRenderContextOptions): Promise; //# sourceMappingURL=renderer.d.ts.map