declare enum JayRouteParamType { single = 0, catchAll = 1, optional = 2 } interface JayRouteParam { name: string; type: JayRouteParamType; } type JayRouteSegment = string | JayRouteParam; type JayRoute = { segments: JayRouteSegment[]; rawRoute: string; jayHtmlPath: string; compPath: string; /** * Browser-safe (`./client`) bundle path used for the hydration import, distinct from the SSR * `compPath` (which may be `./tools` for devOnly routes or `.` otherwise). Set for NPM plugin * routes so hydration never imports a server bundle. See DL#182. */ clientCompPath?: string; /** Export name for the page component (default: 'page'). Used by plugin routes where the export name differs. */ componentExport?: string; /** NPM package name for plugin routes. Used by build to generate portable module paths. */ packageName?: string; /** * Explicit params declared via YAML body in headless component script tags (DL#156). * Used by static override routes to provide param values. * e.g., /products/ceramic-flower-vase declares { slug: 'ceramic-flower-vase' }. */ inferredParams?: Record; /** When true, dev-server tooling route — consumers may filter from page navigation. */ devOnly?: boolean; }; type JayRoutes = JayRoute[]; /** * A reserved top-level error-page folder (Design Log #218). `pages/404/`, `pages/5xx/`, etc. are * not routable; they are collected here instead of in {@link JayRoutes}. */ type JayErrorPage = { /** HTTP status token: exact (`404`, `502`) or family (`4xx`, `5xx`). */ token: string; jayHtmlPath: string; compPath: string; }; type JayErrorPages = JayErrorPage[]; /** Result of a route scan: navigable routes plus reserved error pages (DL#218). */ interface ScanResult { routes: JayRoutes; errorPages: JayErrorPages; } /** True when a top-level folder name is a reserved HTTP status token (DL#218). */ declare function isStatusToken(name: string): boolean; interface ScanFilesOptions { jayHtmlFilename: string; compFilename: string; } /** * Sort routes by priority so that more specific routes match first. * Static routes come before dynamic routes at the same position. */ declare function sortRoutesByPriority(routes: JayRoutes): JayRoutes; /** * Parse a route path string into segments (DL#130). * Supports [param], [[optional]], [...catchAll] patterns. */ declare function parseRouteSegments(routePath: string): JayRouteSegment[]; /** * Create a JayRoute from explicit path and file locations (DL#130). * Used for plugin-provided routes where the path is declared, not inferred from the filesystem. */ declare function createRoute(routePath: string, jayHtmlPath: string, compPath: string, componentExport?: string, options?: { devOnly?: boolean; clientCompPath?: string; }): JayRoute; /** * Scan a pages directory for navigable routes and reserved error pages (DL#218). * * Returns `{ routes, errorPages }`. Callers that only need routes destructure `{ routes }`. */ declare function scanRoutes(baseDir: string, options: ScanFilesOptions): Promise; declare function routeToExpressRoute(route: JayRoute): string; export { type JayErrorPage, type JayErrorPages, type JayRoute, type JayRouteParam, JayRouteParamType, type JayRouteSegment, type JayRoutes, type ScanFilesOptions, type ScanResult, createRoute, isStatusToken, parseRouteSegments, routeToExpressRoute, scanRoutes, sortRoutesByPriority };