/** * vapor-chamber-router - the route table. * * Rows (generator-emitted, server-sorted by priority) -> compiled table. * Everything static is precomputed here once: parent chain, renderable * chain, load chain, merged query defs, name map. Hot paths never derive. * * The generator is trusted - duplicate-name / unknown-parent validation runs * in dev only; production assumes well-formed rows the same way it assumes a * valid migration. */ import type { ParamType, RouteParams, RouteRecord, Segment, TableRecord } from './types'; export type RouteTable = { records: readonly TableRecord[]; /** Resolve a path as in the URL (no query/hash) to the first matching * record; captured params come back decoded. */ resolve: (path: string) => { record: TableRecord; params: RouteParams; } | null; getRecord: (name: string) => TableRecord | undefined; /** Interpolate params into a record's pattern. */ buildPath: (record: TableRecord, params?: RouteParams) => string; }; /** * Render a compiled record's segments into a path, or report the first * required param the caller failed to supply. * * Shared because there are exactly two callers and they differ only in what a * missing param MEANS: `buildPath` throws (a link the app asked for and cannot * build is a bug), while breadcrumb projection yields a non-linking crumb (an * ancestor the current URL simply cannot address is normal). Keeping one copy * of the walk keeps route-URL construction from drifting between the two - * which in a router is precisely where a subtle mismatch would hide. */ export declare function renderSegments(segments: readonly Segment[], params: RouteParams): { path: string; missing?: undefined; } | { path?: undefined; missing: string; }; /** Compile one path pattern into segments + a matching RegExp; a typed param * with no regex of its own matches its type's pattern. */ export declare function compilePath(path: string, paramTypes?: Readonly>): { segments: Segment[]; re: RegExp; keys: string[]; }; export declare function createRouteTable(rows: readonly RouteRecord[]): RouteTable; /** * @internal - a `*` splat is a path, as vue-router reads it: each segment is * encoded on its own and the slashes stay. `resolve` decodes it the same way, * segment by segment. buildPath and interpolateLoad both write it through * this. tests/router/splat-encoding.test.ts. */ export declare const encodeSplat: (value: string) => string; //# sourceMappingURL=table.d.ts.map