import { ParsedRouteSegment } from './segment-parser'; /** * Represents a discovered route for conflict detection */ export interface RouteForConflictDetection { /** URL path pattern */ readonly urlPath: string; /** Source file path (for error reporting) */ readonly filePath: string; /** Parsed segments */ readonly segments: readonly ParsedRouteSegment[]; /** Whether this is a layout */ readonly isLayout: boolean; /** Whether this is an index route */ readonly isIndex: boolean; /** Nesting depth */ readonly depth: number; } /** * Type of route conflict */ export type ConflictType = 'exact' | 'ambiguous' | 'shadow'; /** * Severity of a conflict */ export type ConflictSeverity = 'error' | 'warning'; /** * Route conflict information */ export interface RouteConflict { /** Type of conflict */ readonly type: ConflictType; /** Conflicting path pattern */ readonly path: string; /** Files involved in conflict */ readonly files: readonly string[]; /** Human-readable message */ readonly message: string; /** Severity level */ readonly severity: ConflictSeverity; } /** * Result of conflict detection analysis */ export interface ConflictDetectionResult { /** Whether any errors were detected */ readonly hasErrors: boolean; /** Whether any warnings were detected */ readonly hasWarnings: boolean; /** List of detected conflicts */ readonly conflicts: readonly RouteConflict[]; /** Human-readable report */ readonly report: string; } /** * Options for conflict detection */ export interface ConflictDetectionOptions { /** Maximum nesting depth before warning */ maxNestingDepth?: number; /** Check for nested dynamic conflicts */ checkNestedDynamic?: boolean; /** Check for deep nesting warnings */ checkDeepNesting?: boolean; /** Check for index-layout conflicts */ checkIndexLayouts?: boolean; } /** * Detect all route conflicts in a set of routes * * @param routes - Routes to check for conflicts * @param options - Detection options * @returns Conflict detection result */ export declare function detectConflicts(routes: readonly RouteForConflictDetection[], options?: ConflictDetectionOptions): ConflictDetectionResult; /** * Find routes with exactly the same URL path * * @param routes - Routes to check * @returns Array of duplicate conflicts */ export declare function findExactDuplicates(routes: readonly RouteForConflictDetection[]): RouteConflict[]; /** * Find static routes that would be shadowed by dynamic routes * * Example: `/users/new` would be matched by `/users/:id` before reaching the static route * * @param routes - Routes to check * @returns Array of shadow conflicts */ export declare function findDynamicShadows(routes: readonly RouteForConflictDetection[]): RouteConflict[]; /** * Find ambiguous dynamic routes at the same path level * * Example: `[id].tsx` and `[slug].tsx` in the same directory * * @param routes - Routes to check * @returns Array of ambiguous conflicts */ export declare function findAmbiguousRoutes(routes: readonly RouteForConflictDetection[]): RouteConflict[]; /** * Find catch-all routes that conflict with each other * * @param routes - Routes to check * @returns Array of catch-all conflicts */ export declare function findCatchAllConflicts(routes: readonly RouteForConflictDetection[]): RouteConflict[]; /** * Detect nested dynamic route conflicts * * Example: /users/:id/posts/:postId vs /users/:userId/comments/:commentId * * @param routes - Routes to check * @returns Array of nested dynamic conflicts */ export declare function findNestedDynamicConflicts(routes: readonly RouteForConflictDetection[]): RouteConflict[]; /** * Detect deep nesting issues (warning) * * @param routes - Routes to check * @param maxDepth - Maximum allowed depth * @returns Array of deep nesting conflicts */ export declare function findDeepNestingWarnings(routes: readonly RouteForConflictDetection[], maxDepth?: number): RouteConflict[]; /** * Detect index route conflicts * * Example: index.tsx and _layout.tsx both trying to render at same path * * @param routes - Routes to check * @returns Array of index-layout conflicts */ export declare function findIndexLayoutConflicts(routes: readonly RouteForConflictDetection[]): RouteConflict[]; /** * Generate a human-readable conflict report * * @param conflicts - Array of conflicts * @returns Formatted report string */ export declare function generateConflictReport(conflicts: readonly RouteConflict[]): string; /** * Calculate route specificity for proper ordering * * Higher specificity = more specific route = should be matched first * * @param route - Route to calculate specificity for * @returns Specificity score */ export declare function calculateRouteSpecificity(route: RouteForConflictDetection): number; /** * Sort routes by specificity (most specific first) * * @param routes - Routes to sort * @returns Sorted routes array */ export declare function sortBySpecificity(routes: readonly T[]): T[]; /** * Validate routes and throw on errors * * @param routes - Routes to validate * @throws Error if route conflicts are detected */ export declare function validateRoutes(routes: readonly RouteForConflictDetection[]): void; /** * Check if routes are valid (without throwing) * * @param routes - Routes to validate * @returns True if no errors found */ export declare function areRoutesValid(routes: readonly RouteForConflictDetection[]): boolean;