/** * Extract typed params from a route pattern string. * Matches `:paramName` and `:paramName?` (optional). * Custom regex constraints like `:id(\d+)` are ignored for type purposes. */ export declare function extractParamsFromPattern(pattern: string): Record | undefined; /** * Format a single route entry for codegen output. * Routes without search remain plain strings (params are extracted from * the pattern at the type level by ExtractParams). * Routes with search become objects with path and search fields. */ export declare function formatRouteEntry(key: string, pattern: string, _params?: Record, search?: Record): string; /** * Extract route definitions from source code by walking the TypeScript AST. * Finds path() and path.json(), path.md(), etc. call expressions and extracts * the pattern, name, params, and optional search schema from each. * Skips unnamed paths (no { name: "..." }). */ export declare function extractRoutesFromSource(code: string): Array<{ name: string; pattern: string; params?: Record; search?: Record; }>; /** * Generate a per-module types file from extracted routes. * Output has zero imports, preventing circular references. */ export declare function generatePerModuleTypesSource(routes: Array<{ name: string; pattern: string; params?: Record; search?: Record; }>): string; /** * Generates a .ts file that augments RSCRouter.GeneratedRouteMap * with route name -> pattern mappings. This enables Handler<"routeName"> * without circular references since the file has no imports from the app. */ export declare function generateRouteTypesSource(routeManifest: Record, searchSchemas?: Record>): string; /** Default exclude patterns for route type scanning. */ export declare const DEFAULT_EXCLUDE_PATTERNS: string[]; export type ScanFilter = (absolutePath: string) => boolean; /** * Compile include/exclude glob patterns into a single predicate. * Paths are made root-relative before matching. * Returns undefined when no filtering is needed (no include, default exclude). */ export declare function createScanFilter(root: string, opts: { include?: string[]; exclude?: string[]; }): ScanFilter | undefined; /** * Recursively find .ts/.tsx files under a directory, skipping node_modules * and .gen. files. */ export declare function findTsFiles(dir: string, filter?: ScanFilter): string[]; /** * Generate per-module route type files by statically parsing url module source. * Scans for files containing `urls(` and writes a sibling `.gen.ts` with the * extracted route name/pattern pairs. Only writes when content has changed. */ export declare function writePerModuleRouteTypes(root: string, filter?: ScanFilter): void; /** * Generate per-module route types for a single url module file. * Follows include() calls recursively to produce the full route tree. * No-ops if the file doesn't contain `urls(` or has no named routes. */ export declare function writePerModuleRouteTypesForFile(filePath: string): void; /** * Extract include() calls from source code by walking the TypeScript AST. * Returns the path prefix, variable name, and optional name prefix for each. */ export declare function extractIncludesFromSource(code: string): Array<{ pathPrefix: string; variableName: string; namePrefix: string | null; }>; /** * Recursively build a route map from a urls module file. * Extracts local path() routes and follows include() calls to sub-modules. * Handles both imported and same-file variables. */ export declare function buildCombinedRouteMap(filePath: string, variableName?: string, visited?: Set): Record; /** * Resolve routes and search schemas from a router source file by following the * variable passed to `.routes(...)` or `urls: ...` in createRouter options. */ export declare function buildCombinedRouteMapForRouterFile(routerFilePath: string): { routes: Record; searchSchemas: Record>; }; /** * Scan for files containing createRouter() and return their paths. * Call once at startup; the result can be reused on subsequent watcher triggers. */ export declare function findRouterFiles(root: string, filter?: ScanFilter): string[]; /** * Generate per-router named-routes.gen.ts files from known router file paths. * Re-reads each router file and resolves url patterns via static source parsing. * * Pass `knownRouterFiles` from a previous `findRouterFiles()` call to skip the * full directory scan. If omitted, falls back to scanning (startup path). */ /** * Write named-routes.gen.ts files from static source parsing. * Dev-only: provides initial .gen.ts files for IDE types before runtime * discovery runs. Must NOT be called during production builds — runtime * discovery in buildStart produces the definitive file. */ export declare function writeCombinedRouteTypes(root: string, knownRouterFiles?: string[], opts?: { preserveIfLarger?: boolean; }): void; //# sourceMappingURL=generate-route-types.d.ts.map