import { DiscoveredFile, RouteFileType } from './auto-scanner'; import { ExtractedPath } from './path-extractor'; /** * Transformed route configuration */ export interface TransformedRoute { /** Unique route identifier */ readonly id: string; /** URL path pattern */ readonly path: string; /** Original file path */ readonly filePath: string; /** Whether route is lazy loaded */ readonly lazy: boolean; /** Route import path for lazy loading */ readonly importPath: string; /** Route component name */ readonly componentName: string; /** Child routes */ readonly children: readonly TransformedRoute[]; /** Parent layout route ID (if any) */ readonly layoutId: string | null; /** Route metadata */ readonly meta: TransformedRouteMeta; /** Route type */ readonly type: RouteFileType; /** Whether this is an index route */ readonly index: boolean; /** Extracted path information */ readonly extracted: ExtractedPath; } /** * Route metadata attached to transformed routes */ export interface TransformedRouteMeta { /** Page title template */ readonly title?: string; /** SEO description */ readonly description?: string; /** Whether route requires authentication */ readonly requiresAuth?: boolean; /** Required roles */ readonly roles?: readonly string[]; /** Required permissions */ readonly permissions?: readonly string[]; /** Feature flag dependency */ readonly featureFlag?: string; /** Route groups */ readonly groups: readonly string[]; /** Parallel slots */ readonly parallelSlots: readonly string[]; /** Custom metadata from file exports */ readonly custom?: Record; } /** * Route transformer configuration */ export interface TransformerConfig { /** Base path for route files */ readonly basePath: string; /** Enable lazy loading for routes */ readonly lazy: boolean; /** Custom import path resolver */ readonly resolveImportPath?: (filePath: string) => string; /** Custom route ID generator */ readonly generateId?: (filePath: string, extracted: ExtractedPath) => string; /** Custom component name generator */ readonly generateComponentName?: (filePath: string) => string; /** Metadata extractor from file content */ readonly extractMeta?: (filePath: string) => Promise>; /** Whether to include error boundaries */ readonly includeErrorBoundaries?: boolean; /** Whether to include loading states */ readonly includeLoadingStates?: boolean; /** Feature flag for transformer */ readonly featureFlag?: string; } /** * Route tree node for hierarchical representation */ export interface RouteTreeNode { /** Route at this node */ readonly route: TransformedRoute; /** Child nodes */ readonly children: readonly RouteTreeNode[]; /** Layout node (if this is wrapped by a layout) */ readonly layout: RouteTreeNode | null; /** Parallel route slots */ readonly slots: ReadonlyMap; } /** * Transformation result with statistics */ export interface TransformResult { /** Transformed routes as flat list */ readonly routes: readonly TransformedRoute[]; /** Routes organized as tree */ readonly tree: readonly RouteTreeNode[]; /** Transformation statistics */ readonly stats: TransformStats; /** Any warnings during transformation */ readonly warnings: readonly TransformWarning[]; } /** * Transformation statistics */ export interface TransformStats { /** Total routes transformed */ readonly totalRoutes: number; /** Number of lazy routes */ readonly lazyRoutes: number; /** Number of layout routes */ readonly layoutRoutes: number; /** Number of index routes */ readonly indexRoutes: number; /** Maximum nesting depth */ readonly maxDepth: number; /** Routes with parameters */ readonly parametricRoutes: number; /** Transformation duration (ms) */ readonly durationMs: number; } /** * Warning generated during transformation */ export interface TransformWarning { /** Warning type */ readonly type: 'missing-layout' | 'orphan-route' | 'duplicate-path' | 'deep-nesting' | 'naming'; /** File path that caused warning */ readonly filePath: string; /** Warning message */ readonly message: string; /** Suggested fix */ readonly suggestion?: string; } /** * Default transformer configuration */ export declare const DEFAULT_TRANSFORMER_CONFIG: TransformerConfig; /** * Transforms discovered files into route configurations * * @example * ```typescript * const transformer = new RouteTransformer({ * basePath: 'src/routes', * lazy: true, * }); * * const result = await transformer.transform(files); * console.log(`Transformed ${result.stats.totalRoutes} routes`); * ``` */ export declare class RouteTransformer { private readonly config; constructor(config?: Partial); /** * Transform discovered files into route configurations * * @param files - Discovered files from scanner * @returns Transformation result */ transform(files: readonly DiscoveredFile[]): Promise; /** * Transform a single file into a route */ private transformFile; /** * Find the parent layout for a route */ private findParentLayout; /** * Build hierarchical route tree */ private buildRouteTree; } /** * Create a new RouteTransformer instance * * @param config - Transformer configuration * @returns Configured RouteTransformer */ export declare function createRouteTransformer(config?: Partial): RouteTransformer; /** * Transform discovered files into route configurations (convenience function) * * @param files - Discovered files * @param config - Transformer configuration * @returns Transformation result */ export declare function transformRoutes(files: readonly DiscoveredFile[], config?: Partial): Promise; /** * Generate route configuration code * * @param routes - Transformed routes * @returns Generated TypeScript code */ export declare function generateRouteConfig(routes: readonly TransformedRoute[]): string; /** * Generate route type definitions * * @param routes - Transformed routes * @returns Generated TypeScript type definitions */ export declare function generateRouteTypes(routes: readonly TransformedRoute[]): string;