/** * Instead of parsing through the paths in runtime on every request, * we map the routes into 2 separate groups: Ones with static routes and * ones with dynamic routes (routes with e.g. :id). * * This will make it faster to look up the routes and find the correct ones. * * TODO: Consider having them as some sort of maps/weakmaps for faster lookup * e.g. match with the route parts * */ export class Parser { /** * @param {import("./config").Config} config */ constructor(config: import("./config").Config); rootPath: string; /** * @param {import("../types/SimplrRoute").SimplrRoute[]} routes */ parseRoutes(routes: import("../types/SimplrRoute").SimplrRoute[]): { dynamicRoutes: any[]; staticRoutes: any[]; }; /** * @param {import("../types/SimplrRoute").SimplrRoute[]} routes * @param {import("../types/Shared").SimplrRouterNavigationData[]} staticRoutes * @param {import("../types/Shared").SimplrRouterNavigationData[]} dynamicRoutes * @param {import("../types/Shared").SimplrRouterNavigationData} [parent] * @param {boolean} [isNested = false] */ _iterateRoutes(routes: import("../types/SimplrRoute").SimplrRoute[], staticRoutes: import("../types/Shared").SimplrRouterNavigationData[], dynamicRoutes: import("../types/Shared").SimplrRouterNavigationData[], parent?: import("../types/Shared").SimplrRouterNavigationData, isNested?: boolean): void; /** * @param {string} partOne * @param {string} partTwo */ _needsSlashBetween(partOne: string, partTwo: string): boolean; /** * @returns { string } * */ parseViewFromUrl(): string; /** * @param {string} path * @param {boolean} [addRootPath] */ buildFullPath(path: string, addRootPath?: boolean): string; /** * When searching for a route, we build a needle to find from * the haystack of routes. If the app has a rootPath set up, * we append that to the route to match the full route and * update the history accordingly * * @param {string} path */ buildNeedle(path: string): string; /** * @param {string} path */ handleLeadingAndTrailingSlash(path: string): string; /** * @param {string} route */ splitRouteParts(route: string): string[]; /** * @param {import("../types/Shared").SimplrRouterNavigationData} routeObject * @param {string[]} urlRouteParts */ mapParametersForRoute(routeObject: import("../types/Shared").SimplrRouterNavigationData, urlRouteParts: string[]): void; /** * @param {string} pathA * @param {string} pathB */ _getRouteSeparator(pathA: string, pathB: string): "" | "/"; /** * @param {string} path */ _addRootPath(path: string): string; }