import type { EcoPagesAppConfig } from '../types/internal-types.js'; import type { AnyIntegrationPlugin } from '../plugins/integration-plugin.js'; import type { IntegrationRenderer } from './orchestration/integration-renderer.js'; /** * Narrow route-render contract exposed to higher-level routing code. * * @remarks * Higher-level routing code only needs request execution and page-module * loading. Returning this narrowed shape avoids a dedicated wrapper class while * still keeping callers off the full integration renderer surface. */ export type PageRouteRenderer = Pick, 'execute' | 'loadPageModule'>; /** * Narrow explicit-view render contract exposed to static route handling. * * @remarks * Explicit static routes only need `renderToResponse()`, so the factory can * hide the broader integration renderer surface there as well. */ export type ExplicitViewRenderer = Pick, 'renderToResponse'>; export interface PageRendererResolver { getPageRenderer(filePath: string): PageRouteRenderer; } export interface ExplicitViewRendererResolver { getExplicitViewRenderer(integrationName: string): ExplicitViewRenderer | null; } /** * Combined renderer-factory contract used by static generation. */ export type StaticGenerationRendererResolver = PageRendererResolver & ExplicitViewRendererResolver; /** * Selects and caches integration renderers for route files and explicit views. * * @remarks * The factory owns the policy that maps a route file or explicit integration * name to one initialized integration renderer. Renderer instances are cached by * integration name so repeated requests do not rebuild renderer state. */ export declare class RouteRendererFactory { private appConfig; runtimeOrigin: string; private rendererModules?; private rendererCache; /** * Creates the route-renderer factory for one app/runtime instance. */ constructor({ appConfig, rendererModules, runtimeOrigin, }: { appConfig: EcoPagesAppConfig; rendererModules?: unknown; runtimeOrigin: string; }); /** * Returns a route renderer for the supplied route file. */ getPageRenderer(filePath: string): PageRouteRenderer; /** * Returns a renderer for an explicit view integration. */ getExplicitViewRenderer(integrationName: string): ExplicitViewRenderer | null; /** * Resolves the integration plugin that owns a given route file. */ getIntegrationPlugin(filePath: string): AnyIntegrationPlugin; /** * Returns the cached renderer engine for the file's owning integration, * creating it on first use. */ private getRouteRendererEngine; }