UNPKG

sicua

Version:

A tool for analyzing project structure and dependencies

78 lines (77 loc) 2.47 kB
import { NormalizedLink } from "../types/internalTypes"; /** * Utility functions for route extraction and normalization */ export declare class RouteUtils { /** * Extracts route from file path based on framework patterns */ static extractRouteFromPath(filePath: string): string | null; /** * Enhanced App Router route extraction with full Next.js 13+ support */ static extractAppDirRoute(filePath: string): string; /** * Extracts route groups from App Router path */ static extractRouteGroups(filePath: string): string[]; /** * Extracts parallel route slots from App Router path */ static extractParallelRoutes(filePath: string): Array<{ slot: string; path: string; }>; /** * Determines if a path represents an intercepting route */ static isInterceptingRoute(filePath: string): { isIntercepting: boolean; interceptType: "(..)" | "(...)" | "(....)" | "(.)" | null; targetRoute: string | null; }; /** * Gets the layout hierarchy for a given route */ static getLayoutHierarchy(filePath: string): string[]; /** * Checks if a route has dynamic segments */ static hasDynamicSegments(route: string): { hasDynamic: boolean; segments: Array<{ type: "dynamic" | "catch-all" | "optional-catch-all"; name: string; optional: boolean; }>; }; private static isLikelyUIComponent; /** * Extracts route from Next.js pages directory */ static extractNextJsRoute(filePath: string): string; /** * Extracts route from React Router routes directory */ static extractReactRouterRoute(filePath: string): string; /** * Normalizes a link path for consistent analysis */ static normalizeLinkPath(link: string, sourcePath: string): NormalizedLink; /** * Extracts route params from a route string */ static extractRouteParams(route: string): string[]; /** * Checks if a route is a dynamic route */ static isDynamicRoute(route: string): boolean; /** * Gets matching routes between file system routes and route definitions */ static findMatchingRoutes(fileSystemRoutes: string[], routeDefinitions: string[]): Map<string, string[]>; /** * Converts a route to a regex pattern for matching */ private static routeToRegexPattern; }