molefrog / molefrog/wouter

Custom parser to adapt URLPattern syntax fails

Open
#563 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.9k
Forks
190
Avg merge
12h 50m
Merged PRs (30d)
3

Description

Is it possible to pass Router a custom parser function that would work with the WHATWG URLPattern syntax?

I tried modifying Wouter's path-to-regex example but the example relies on parse options not available in URLPattern or path-to-regex v8.x. Eg, the example uses the end parser option to match segments but applying the closest equivalent {/*remainder} fails to match.

Beyond a custom parser function, would it make sense to add a builtin Wouter feature to support the new syntax? Eg, <Router urlpattern> or <Router crapNewSyntax> or somesuch. You wouldn't need to add path-to-regex as a dependency. You could instead mention that the option might require a polyfill. The URLPattern syntax has growing browser support, was added to Node v23.8, and is now being used as default in backend routers like Koa and Express.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin at the Router entry point and the existing path-to-regex example mentioned in the issue; inspect how custom parser functions and matching options are currently exposed. Compare the requested WHATWG URLPattern cases, including {/*remainder}, and define whether completion means custom-parser support or a built-in option with matching behavior covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.