UNPKG

@vaadin/hilla-file-router

Version:

Hilla file-based router

30 lines (29 loc) 1.16 kB
import { RouteParamType } from "../shared/routeParamType.js"; export declare const routeParamTypeMap: ReadonlyMap<RouteParamType, RegExp>; /** * Converts a file system pattern to an URL pattern string. * * @param segment - a string representing a file system pattern: * - `{param}` - for a required single parameter; * - `{{param}}` - for an optional single parameter; * - `{...wildcard}` - for multiple parameters, including none. * * @returns a string representing a URL pattern, respectively: * - `:param`; * - `:param?`; * - `*`. */ export declare function convertFSRouteSegmentToURLPatternFormat(segment: string): string; /** * Extracts the parameter name and its type from the route segment. * * @param segment - A part of the FS route URL. * @returns A map of parameter names and their types. */ export declare function extractParameterFromRouteSegment(segment: string): Readonly<Record<string, RouteParamType>>; /** * A small helper function that clears route path of the control characters in * order to sort the routes alphabetically. */ export declare function cleanUp(path: string): string; export declare function strip(path: string): string;