Important: This release switches the package to ESM only and node >= 22. It removes the TokenData class in favor of plain objects. The largest incompatible API change is to switch ambiguous matches from the first being greedy to the last. For example:
const input = "/foo.json.html";
const fn = match("/:file.:ext");
fn(input); //=> ["foo", "json.html"]In the v8 this would have output ["foo.json", "html"]. Making the last parameter or wildcard greedy can improve performance of the regular expressions and makes things easier to describe for an API that may not use regular expressions.
Changed
- Avoid duplicate trailing delimiter matches by @vibhor-aggr in #443
- A path that explicitly provided the trailing delimiter (e.g.
/foo/) will no longer append an extra optional delimiter
- A path that explicitly provided the trailing delimiter (e.g.
- Refactor matching to be non-greedy by @blakeembrey in #450
- Build project as ESM by @blakeembrey in #458
- Remove
TokenDataclass andKeystype by @blakeembrey in #461
Fixed
- Reject an empty-string param in compile by @spokodev in #444
- Reject wildcard array that compiles to an empty path by @spokodev in #448
- Fix stringify of param names with control characters by @chatman-media in #445
- Quote param names followed by astral ID_Continue text by @dylanpulver in #451
- Fix stringify lookahead across empty text tokens by @jakezwang in #456
Full Changelog: v8.4.2...v9.0.0