* Returns true if a pathname segment contains URLPattern syntax that the * radix tree cannot model structurally — i.e. it is not a plain static * string, a bare `:param`, or a standalone `*`. * * Affected syntax: * - Optional / non-capturing groups: `{.ext}?` `{foo}` * - Regex-constrai
(segment: string)
| 195 | * clause. This is intentional — the two checks subsume each other for `*`. |
| 196 | */ |
| 197 | function isComplexSegment(segment: string): boolean { |
| 198 | if (segment.includes("{") || segment.includes("(")) return true; |
| 199 | if (segment.includes("*") && segment !== "*") return true; |
| 200 | if (segment.endsWith("?") || segment.endsWith("+")) return true; |
| 201 | if (segment.includes("\\")) return true; |
| 202 | return false; |
| 203 | } |
| 204 | |
| 205 | function createNode(): RouteNode { |
| 206 | return { |