Packages

path-to-regexp

9.0.0 · 22 Oct 2026MIT310.6M / weekRepositoryHomepagenpmAtom feed

Your version

9.0.0

latestmajor22 Oct 2026Where it was published

In short

3 fixed6 changed

Release note

Important: This release switches the package to ESM only and node >= 22. The primary incompatible API change is to switch ambiguous matches (2+ parameters in a segment) 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 and wildcard greedy can improve performance of the regular expressions and makes it easier to build non-regex based versions of the matcher.

Changed

  • Avoid duplicate trailing delimiter matches

    • A path that explicitly provided the trailing delimiter (e.g. /foo/) will no longer append an extra optional delimiter

  • Refactor matching to be non-greedy

  • Build project as ESM

  • Remove TokenData class and Keys type

Fixed

  • Reject an empty-string param in compile

  • Reject wildcard array that compiles to an empty path

  • Fix stringify of param names with control characters

  • Quote param names followed by astral ID_Continue text

  • Fix stringify lookahead across empty text tokens