Skip to content

Add opt-in URLPattern parser with nested route support - #576

Merged
molefrog merged 2 commits into
mainfrom
feat/url-pattern-parser
Sep 30, 2026
Merged

molefrog merged 2 commits into
mainfrom
feat/url-pattern-parser

Conversation

@molefrog

@molefrog molefrog commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Fixes #563 by adding urlPatternParser exports from wouter/url-pattern and wouter-preact/url-pattern. <Router parser={urlPatternParser}> uses the native URLPattern API for pathname syntax and groups, matching the longest valid prefix for nested routes. A browser or runtime with native URLPattern support is required.

The optional adapter measures 223 B minified and Brotli compressed; default bundles and runtime dependencies are unchanged. Parser typings accept objects with a compatible exec method.

Validated with native URLPattern in Bun 1.4.2: 269 passing tests, one existing skip, 100% line coverage, TypeScript, lint, and size limits.

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions

Copy link
Copy Markdown

size-limit report 馃摝

Path Size
packages/wouter/src/index.js 2.29 KB (0%)
packages/wouter/src/use-browser-location.js 555 B (0%)
packages/wouter/src/memory-location.js 729 B (0%)
packages/wouter/src/use-hash-location.js 720 B (0%)
packages/wouter-preact/src/index.js 2.18 KB (0%)
packages/wouter-preact/src/use-browser-location.js 488 B (0%)
packages/wouter-preact/src/use-hash-location.js 645 B (0%)
packages/wouter-preact/src/memory-location.js 664 B (0%)
packages/wouter/src/url-pattern.js 223 B (+100% 馃敽)
packages/wouter-preact/src/url-pattern.js 223 B (+100% 馃敽)

@molefrog
molefrog merged commit ef10e32 into main Sep 30, 2026
3 checks passed
@molefrog
molefrog deleted the feat/url-pattern-parser branch September 30, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom parser to adapt URLPattern syntax fails

1 participant