UNPKG

@getcronit/pylon

Version:

![Pylon cover](https://github.com/user-attachments/assets/c28e49b2-5672-4849-826e-8b2eab0360cc)

58 lines (57 loc) 1.81 kB
/** * Interface representing a route configuration. */ export interface Route { path?: string; Component?: string; element?: string; errorElement?: string; lazy?: string; loader?: string; shouldRevalidate?: string; index?: boolean; children?: Route[]; HydrateFallback?: string; } /** * Context for the scan operation to collect imports and slugs. */ interface ScanContext { imports: string[]; routeSlugs: string[]; } /** * Converts a file path to a corresponding layout component name. * @param filePath - The file path to convert. * @returns The generated layout component name. */ export declare function getLayoutComponentName(filePath: string): string; /** * Converts a file path to a corresponding page component name. * @param filePath - The file path to convert. * @returns The generated page component name. */ export declare function getPageComponentName(filePath: string): string; /** * Converts dynamic route segments from [param] format to :param format. * @param segment - A segment of the route. * @returns The converted route segment. */ export declare function convertToDynamicRoute(segment: string): string; /** * Recursively scans a directory to build route objects. * @param directory - The directory to scan. * @param context - The scan context. * @param basePath - The base route path accumulated so far. * @returns A Route object or null if the directory does not define a route. */ export declare function scanDirectory(directory: string, context: ScanContext, basePath?: string): Route | null; /** * Builds the route configuration and outputs the generated code. * @returns The complete file content as a string. */ export declare function makeAppFiles(): { routes: string; slugs: string; }; export {};