Change8

@remix-run/route-pattern@0.18.0

Breaking Changes
📦 remixView on GitHub →
2 breaking4 features1 deprecations🔧 13 symbols

Summary

This release removes obsolete href generation utilities and restricts protocol patterns while introducing powerful new introspection capabilities via the AST, string getters, detailed match metadata, and specificity comparison functions.

⚠️ Breaking Changes

  • Removed `createHrefBuilder`, `type HrefBuilder`, and `type HrefBuilderArg` as they are obsolete due to `RoutePattern.href`.
  • Simplified protocol acceptance in patterns to only allow `http`, `https`, and `http(s)`. Arbitrary `PartPattern` for protocol is no longer allowed and will result in a `ParseError`.

Migration Steps

  1. Replace usage of `createHrefBuilder`, `HrefBuilder`, and `HrefBuilderArg` with alternatives utilizing `RoutePattern.href`.
  2. Update type definitions from `HrefBuilderArgs<Source>` to `HrefArgs<Source>`.

✨ New Features

  • Added `ast` property to `RoutePattern` providing a read-only, bare-metal API for advanced matcher use cases.
  • Added `protocol`, `hostname`, `port`, `pathname`, and `search` getters to `RoutePattern` to display normalized pattern parts as strings.
  • Added `meta` property to the result of `RoutePattern.match()`, providing rich information about matched params (variables and wildcards) in hostname and pathname.
  • Added functions in `@remix-run/route-pattern/specificity` module (`lessThan`, `greaterThan`, `equal`, `ascending`, `descending`) for comparing match specificity based on static, variable, and wildcard matches.

Affected Symbols

⚡ Deprecations

  • Use `HrefArgs` instead of `HrefBuilderArgs` for type arguments related to href generation.