npm path-to-regexp 9.0.0
v9.0.0

3 hours ago

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
  • Refactor matching to be non-greedy by @blakeembrey in #450
  • Build project as ESM by @blakeembrey in #458
  • Remove TokenData class and Keys type by @blakeembrey in #461

Fixed

Full Changelog: v8.4.2...v9.0.0

Don't miss a new path-to-regexp release

NewReleases is sending notifications on new releases.