import { q as FarmConfig, P as ParsedRoute, aj as ResolvedFarmRouteRuntimeConfig, h as RouteModule, X as LayoutModule, a1 as SSGCollectionResult, Y as FarmRequest, Z as FarmResponse, ak as ResolvedFarmAPIConfig, j as FarmMdxResolvedConfig, al as ResolvedFarmDevtoolsConfig, am as ResolvedFarmDevIndicatorsConfig, an as ResolvedFarmAuthConfig, ao as ResolvedFarmPerformanceConfig, ap as ResolvedFarmSecurityConfig } from './client-plugins-IR4yJ6w3.js'; import { F as FarmDocsResolvedConfig } from './types-CKwggz9n.js'; import { FarmMarkdownResolvedConfig } from './markdown.js'; import { F as FarmWorkflowsResolvedConfig } from './workflows-BantWytQ.js'; import { FarmCronResolvedConfig } from './cron.js'; import { R as ResolvedFarmImageConfig } from './image-config-Duob7wER.js'; import { ProgrammaticRedirectRoute, ProgrammaticRouteSearchClientOptions } from './routes.js'; import { ViteDevServer } from 'vite'; import { F as FarmIslandStrategy } from './island-CfGru1MO.js'; import { M as MetadataImageKind, A as ApplicationMetadataRouteKind } from './metadata-route-Du0gRdBR.js'; import { FarmServerRendererRuntime, FarmRenderer } from './renderer.js'; import { F as FarmRouteRenderPlan } from './render-plan-CWfyp4ZG.js'; import { R as ResolvedFarmI18nConfig } from './types-CnH8DOqo.js'; import { F as FarmI18nRuntime } from './runtime-BgDQzBiu.js'; import { R as ResolvedFarmThemeConfig } from './types-DQnyD3VD.js'; interface IsolatedClientBoundaryReference { /** Absolute source path. Converted to a Vite URL only at the manifest edge. */ modulePath: string; islandStrategy: FarmIslandStrategy; } declare const STATIC_METADATA_IMAGE_EXTENSIONS: readonly ["png", "jpg", "jpeg", "gif", "webp"]; type StaticMetadataImageExtension = (typeof STATIC_METADATA_IMAGE_EXTENSIONS)[number]; interface StaticMetadataImageInfo { extension: StaticMetadataImageExtension; contentType: string; width: number; height: number; alt?: string; hash: string; byteLength: number; } interface RouteEntry { route: ParsedRoute; modulePath: string; markdownSourcePath?: string; pattern: string; source?: "file" | "programmatic"; sourceRoot: string; } interface RouteSlotEntry extends RouteEntry { name: string; ownerPattern: string; interception: boolean; fallback: boolean; containerId: string; } interface MatchedRouteSlot { name: string; ownerPattern: string; containerId: string; interception: boolean; fallback: boolean; route: RouteSlotEntry; params: Record; } interface FarmClientRouteManifest { routes: Array<{ pattern: string; modulePath: string; shouldHydrate: boolean; isClientComponent: boolean; islandStrategy: FarmIslandStrategy | null; hasIsolatedClientBoundaries?: true; isolatedBoundaries?: IsolatedClientBoundaryReference[]; renderPlan: FarmRouteRenderPlan; suppressedAsyncHydration?: true; search?: ProgrammaticRouteSearchClientOptions; segments: Array<{ segment: string; isDynamic: boolean; isCatchAll?: boolean; isOptional?: boolean; }>; }>; layouts: Array<{ pattern: string; modulePath: string; shouldHydrate: boolean; isClientComponent: boolean; islandStrategy: FarmIslandStrategy | null; hasIsolatedClientBoundaries?: true; isolatedBoundaries?: IsolatedClientBoundaryReference[]; }>; slots: Array<{ name: string; ownerPattern: string; pattern: string; modulePath: string; containerId: string; interception: boolean; fallback: boolean; shouldHydrate: boolean; isClientComponent: boolean; segments: RouteEntry["route"]["segments"]; }>; } interface MetadataImageEntry extends RouteEntry { kind: MetadataImageKind; fileName: "opengraph-image" | "twitter-image"; sourceType: "module" | "static"; staticInfo?: StaticMetadataImageInfo; } interface ApplicationMetadataRouteEntry extends RouteEntry { kind: ApplicationMetadataRouteKind; fileName: "sitemap" | "robots" | "manifest"; outputName: "sitemap.xml" | "robots.txt" | "manifest.webmanifest"; } /** * Manages route discovery and matching for the Farm.js application */ declare class RouteManager { private config; private routes; private pageRouteShapes; private layouts; private routeSlots; private loadings; private errors; private metadataImages; private metadataRoutes; private redirects; private programmaticPages; private programmaticLayouts; private rendererRuntime?; private viteServer?; private clientManifestCache?; constructor(config: Required, viteServer?: ViteDevServer); setRendererRuntime(rendererRuntime: FarmServerRendererRuntime): void; /** * Discover all routes in the app directory */ discoverRoutes(): Promise; /** * Find matching route for a given URL path */ matchRoute(pathname: string, options?: { interceptFrom?: string; }): { route: RouteEntry | null; params: Record; layouts: RouteEntry[]; slots: MatchedRouteSlot[]; }; /** * Get all registered routes */ getRoutes(): Map; /** * Get all registered layouts */ getLayouts(): Map; getRouteSlots(): Map; /** Resolve route rules, inherited layouts, and the page export in precedence order. */ resolveRouteRuntimeConfig(pattern: string): Promise; /** * Get all route-level loading boundaries. */ getLoadings(): Map; /** * Get all route-level error boundaries. */ getErrors(): Map; getMetadataImages(): Map; getMetadataRoutes(): Map; getRedirects(): ProgrammaticRedirectRoute[]; matchRedirect(pathname: string, search?: string): { redirect: ProgrammaticRedirectRoute; destination: string; statusCode: number; params: Record; } | null; /** * Return the nearest matching loading boundary for a pathname. */ getMatchingLoading(pathname: string): RouteEntry | null; /** * Return the nearest matching error boundary for a pathname. */ getMatchingError(pathname: string): RouteEntry | null; matchMetadataImage(pathname: string): { image: MetadataImageEntry; params: Record; pagePath: string; } | null; matchMetadataRoute(pathname: string): { metadata: ApplicationMetadataRouteEntry; params: Record; routePath: string; } | null; getMatchingMetadataRoute(pathname: string, kind: ApplicationMetadataRouteKind): { metadata: ApplicationMetadataRouteEntry; params: Record; routePath: string; } | null; resolveMetadataRoutePath(metadata: ApplicationMetadataRouteEntry, params?: Record): string; getMatchingMetadataImage(pathname: string, kind: MetadataImageKind): { image: MetadataImageEntry; params: Record; } | null; resolveMetadataImagePath(image: MetadataImageEntry, params?: Record): string; /** * Generate the compiled route decisions consumed by SPA navigation. * Requests still fetch route data, but never inspect component source. */ generateClientManifest(projectRoot?: string): FarmClientRouteManifest; /** @internal Client modules selected by the compiled hydration ownership plan. */ getIsolatedClientBoundaryModules(projectRoot?: string): ReadonlySet; /** * Invalidate build-time route metadata after a page or layout changes in dev. * Navigation requests reuse the cached manifest and never inspect source files. */ invalidateClientManifest(): void; /** * Load a route module dynamically */ loadRouteModule(modulePath: string): Promise; /** * Load a layout module dynamically */ loadLayoutModule(modulePath: string): Promise; /** * Create a route pattern from parsed route */ private createRoutePattern; private registerPageRoute; private discoverFileRoutes; private discoverProgrammaticRoutes; private loadProgrammaticRoutesModule; /** * Find all layouts that should wrap a given path */ private findMatchingLayouts; private findMatchingRouteSlots; private matchesRoutePrefix; private findNearestBoundary; /** * Log discovered routes for debugging */ private logRoutes; /** * Collect SSG pages for static generation * * Returns all pages marked with `export const ssg = true` along with * their pre-computed paths (for dynamic routes using getStaticPaths) */ collectSSGPages(): Promise; private toRoutePathname; private localizeRedirectDestination; private getI18nConfig; /** * Check if a route is SSG */ isRouteSSG(modulePath: string): Promise; /** * Check if a route has ISR (Incremental Static Regeneration) */ hasRouteISR(modulePath: string): Promise; /** * Get revalidation interval for a route */ getRouteRevalidateInterval(modulePath: string): Promise; } interface FarmNavigationFragmentLayout { pattern: string; module: { default?: any; }; } interface FarmNavigationFragmentSlot { name: string; ownerPattern: string; containerId: string; module: { default?: any; }; props: Record; } interface FarmNavigationFragmentInput { PageComponent: any; LoadingComponent?: any; pageProps: Record; params: Record; layouts: FarmNavigationFragmentLayout[]; /** First destination layout that changed compared with the active shell. */ layoutStartIndex?: number; slots?: FarmNavigationFragmentSlot[]; pageShouldHydrate: boolean; layoutShouldHydrate: boolean; islandStrategy?: FarmIslandStrategy | null; } declare class ServerRenderer { private config; private routeManager; private ssgManifest; private dataCache; private i18nRuntime?; private viteServer?; private rendererRuntime; constructor(config: Required, routeManager: RouteManager, i18nRuntime?: FarmI18nRuntime, viteServer?: ViteDevServer); initialize(): Promise; private createPageBoundary; private collectDevStyleHrefs; private collectDevStyleLinks; private createLayoutBoundary; private wrapClientGraph; private renderElementToCompleteHTML; /** * Buffered render carrying document-head markup for renderers that emit it * during render (e.g. ). Other renderers return an empty head. */ private renderElementToDocumentParts; /** * Render the route tree used by client navigation without producing a second * document response. Layout markers let the browser preserve the longest * common shell and replace only the first changed boundary. */ renderNavigationFragment(input: FarmNavigationFragmentInput): Promise; runWithRequestContext(request: Request, fn: () => T | Promise): Promise; resolveRouteContext(input: { request: Request; rawRequest?: FarmRequest; params: Record; search: Record; path: string; }): Promise; /** * Load SSG manifest from build output */ private loadSSGManifest; /** * Check if a path should be served from SSG cache */ private shouldServeSSG; private getSSGCacheKey; private getPPRCacheKey; private getCachedSSGPage; private cacheSSGPage; private getCachedPPRShell; private cachePPRShell; private getPPRShellBypassReason; private getPPRHeaders; private serveCachedPPRShell; /** * Regenerate an SSG page in the background (ISR) */ private regenerateSSGPage; /** * Serve a pre-rendered SSG page */ private serveSSGPage; renderPage(req: FarmRequest, res: FarmResponse): Promise; private renderPageInContext; private wrapWithIntegrationProviders; private resolveRouteMetadata; private resolveMetadataImageReference; private renderMetadataRoute; private renderMetadataImage; private writeMetadataImageResponse; private writeStaticMetadataImageResponse; private renderRouteErrorBoundary; private renderBufferedSSR; private renderWithSSR; private render404; private renderError; private createFullHTML; private applyDeploymentHeaders; private getDeploymentId; } type NormalizedFarmConfig = Omit, "api" | "devtools" | "devIndicators" | "images" | "i18n" | "performance" | "security" | "theme"> & { api: ResolvedFarmAPIConfig; docs: FarmDocsResolvedConfig; md: FarmMarkdownResolvedConfig; mdx: FarmMdxResolvedConfig; cron: FarmCronResolvedConfig; workflows: FarmWorkflowsResolvedConfig; devtools: ResolvedFarmDevtoolsConfig; devIndicators: ResolvedFarmDevIndicatorsConfig; images: ResolvedFarmImageConfig; i18n: ResolvedFarmI18nConfig; auth: ResolvedFarmAuthConfig; performance: ResolvedFarmPerformanceConfig; security: ResolvedFarmSecurityConfig; theme: ResolvedFarmThemeConfig; renderer: FarmRenderer; }; declare class FarmApp { private config; private routeManager; private serverRenderer; private i18nRuntime; private viteServer?; constructor(config?: FarmConfig, viteServer?: ViteDevServer); initialize(): Promise; getRouteManager(): RouteManager; getServerRenderer(): ServerRenderer; getI18nRuntime(): FarmI18nRuntime; getConfig(): NormalizedFarmConfig; private normalizeConfig; private verifyAppStructure; } declare function createFarmApp(config?: FarmConfig, viteServer?: ViteDevServer): FarmApp; export { FarmApp as F, RouteManager as R, ServerRenderer as S, createFarmApp as c };