route-pattern v0.23.0
Minor Changes
-
BREAKING CHANGE:
RoutePatternno longer exposes its parsed internals. Construct patterns withRoutePattern.parse(), and usepattern.source,pattern.toString(), orpattern.toJSON()instead of reading parsed internals such aspattern.pathname.tokens,pattern.hostname, orpattern.search.Added
getRoutePatternCaptures(pattern)for supported capture introspection. It returns readonly{ part, type, name, optional }entries in source order so consumers can inspect the variables (:name) and wildcards (*name) declared in a pattern without relying on internal parser tokens.Exported
RoutePatternCaptureandRoutePatternJSONfrom@remix-run/route-pattern,CreateHrefErrorDetailsfrom@remix-run/route-pattern/href, andMatchParamMetafrom@remix-run/route-pattern/match.
Patch Changes
-
Fixed several route pattern matching and href generation edge cases:
ignoreCasenow applies consistently to pathname matching, key-only search constraints keep generated hrefs matchable, pathname params useencodeURIComponentsegment encoding, hostname params reject URL-structural and control characters, optional joins no longer generate duplicate slashes, missing-param errors report every missing required param, optional variant duplicates are collapsed, port-only origins are rejected, and protocol/port constraints participate in specificity. -
Fixed route pattern helper types so literal pattern types follow the same grammar as runtime parsing. Invalid literal patterns now evaluate to
neverinCreateHrefArgs,MatchParams, andJoinPatterns, while broadstringpatterns remain usable.