/** * Tree-walk matcher. Pure function. * * Specificity: static children → paramChild → splatChild. Per-segment * URL decoding (Spring's `PathPatternParser` model): keeps `%2F` inside * a segment instead of letting it act as a separator. * * Splat captures the rest of the path AFTER per-segment decoding, so * `/a/foo%2Fbar/baz` and `/a/foo/bar/baz` produce the same splat value. * Documented trade-off — handle the rare encoded-slash case in `'raw'` * body mode if needed. * * Deliberate semantics: * - A `{*splat}` matches ZERO trailing segments, so `/api/{*rest}` matches * `/api` (with `rest: ''`). * - A method-less structural node is NOT a match: walking to a dead end fails * and backtracks to param/splat siblings (so `/users/me` still matches * `/users/:id` even when `/users/me/avatar` created a method-less `me` node). * - Matching is method-aware: a node without the request's method does not * end the walk either, so `DELETE /events/new` reaches `DELETE /events/:slug` * next to a GET-only `/events/new`. 405 only when no route matching the path * has the method; `Allow` lists the methods of all of them. */ import type { MatchResult, RouteNode } from './RouteNode.ts'; export declare function getMatchedNode(result: MatchResult): RouteNode | undefined; /** Thrown when a path contains a malformed `%XX` sequence. */ export declare class MalformedPathError extends Error { readonly statusCode = 400; constructor(message: string); } /** * - `null` → no path match (404). * - `{ entry: null, allowedMethods }` → path matched, but no matching route * has the method (405). * - full result → success. */ export declare function match(root: RouteNode, method: string, path: string): MatchResult | null;