import type { EcoPagesAppConfig, MatchResult } from '../../../types/internal-types.js'; import type { PageRendererResolver } from '../../../route-renderer/route-renderer.js'; import type { RouteRegistry } from '../../../router/server/route-registry.js'; import type { PageCacheService } from '../../../services/cache/page-cache-service.js'; import type { CacheStrategy } from '../../../services/cache/cache.types.js'; import type { FileSystemServerResponseFactory } from './fs-server-response-factory.js'; export interface FileSystemResponseMatcherOptions { appConfig: EcoPagesAppConfig; assetPrefix: string; router: RouteRegistry; routeRendererFactory: PageRendererResolver; fileSystemResponseFactory: FileSystemServerResponseFactory; /** Optional cache service. When null, caching is disabled. */ cacheService?: PageCacheService | null; /** Default cache strategy when caching is enabled. @default 'static' */ defaultCacheStrategy?: CacheStrategy; } /** * Matches file-system routes to rendered HTML responses. * * This render pipeline coordinates page module inspection, request-local policy, * renderer invocation, middleware execution, cache integration, and fallback * error translation. */ export declare class FileSystemResponseMatcher { private appConfig; private assetPrefix; private router; private routeRendererFactory; private fileSystemResponseFactory; private pageRequestCacheCoordinator; private fileRouteMiddlewarePipeline; constructor({ appConfig, assetPrefix, router, routeRendererFactory, fileSystemResponseFactory, cacheService, defaultCacheStrategy, }: FileSystemResponseMatcherOptions); /** * Resolves unmatched paths either as static asset requests or as the custom * not-found page. * @param requestUrl Incoming pathname. * @returns Static file response or rendered 404 response. */ handleNoMatch(requestUrl: string): Promise; /** * Handles a matched file-system page route. * * The method inspects page metadata needed for request-time execution, * prepares the renderer invocation, validates middleware/cache constraints, * and delegates caching plus middleware execution to dedicated collaborators. * * @param match Router match result. * @param request Optional incoming request. A synthetic GET request is created when omitted. * @returns Final response for the matched route. */ handleMatch(match: MatchResult, request?: Request): Promise; /** * Renders the app-owned custom 404 page, falling back to the default text 404 * when the page template cannot be resolved. */ private renderCustomNotFoundResponse; /** * Renders the app-owned custom 500 page, falling back to the default text 500 * when the page template cannot be resolved. */ private renderCustomServerErrorResponse; /** * Builds development-only error details for the custom 500 page. * @remarks Production omits these fields so stacks are not serialized into HTML. */ private buildServerErrorPageProps; private renderCustomErrorPageResponse; private renderCustomNotFoundResponseOrServerError; /** * Logs the original render failure, then tries the custom 500 page once. * @remarks Any failure while rendering the custom 500 page falls back to the * default plain-text response and never re-enters the custom page path. * In development the thrown error's `message` and `stack` are passed into the * custom 500 page props. */ private createInternalServerErrorResponse; private createExecutionPlan; /** * Loads the matched page module for request-time inspection. * * The matcher needs access to page-level metadata such as `cache` and * `middleware` before full rendering starts, so it asks the owning route * renderer to load the page module. That preserves integration-specific page * import setup for request-time inspection as well as for full rendering. * * @param filePath Absolute page module path. * @returns Imported page module. */ private importPageModule; /** * Get the underlying cache service for external invalidation. */ getCacheService(): PageCacheService | null; }