react-router 8.3.1 → 8.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/dist/development/dom-export.d.ts +2 -1
  3. package/dist/development/dom-export.js +1 -1
  4. package/dist/development/index-react-server-client.js +2 -2
  5. package/dist/development/index-react-server.d.ts +601 -189
  6. package/dist/development/index-react-server.js +100 -48
  7. package/dist/development/index.d.ts +10 -9
  8. package/dist/development/index.js +6 -5
  9. package/dist/development/lib/actions.js +1 -1
  10. package/dist/development/lib/components.js +66 -10
  11. package/dist/development/lib/context.d.ts +19 -6
  12. package/dist/development/lib/context.js +11 -3
  13. package/dist/development/lib/dom/dom.d.ts +3 -0
  14. package/dist/development/lib/dom/dom.js +1 -1
  15. package/dist/development/lib/dom/global.d.ts +35 -0
  16. package/dist/development/lib/dom/lib.d.ts +34 -9
  17. package/dist/development/lib/dom/lib.js +30 -37
  18. package/dist/development/lib/dom/server.d.ts +6 -1
  19. package/dist/development/lib/dom/server.js +41 -15
  20. package/dist/development/lib/dom/ssr/components.js +26 -31
  21. package/dist/development/lib/dom/ssr/data.js +1 -1
  22. package/dist/development/lib/dom/ssr/entry.d.ts +13 -2
  23. package/dist/development/lib/dom/ssr/errorBoundaries.js +1 -1
  24. package/dist/development/lib/dom/ssr/fallback.js +1 -1
  25. package/dist/development/lib/dom/ssr/fog-of-war.d.ts +3 -2
  26. package/dist/development/lib/dom/ssr/fog-of-war.js +46 -22
  27. package/dist/development/lib/dom/ssr/hydration.d.ts +3 -1
  28. package/dist/development/lib/dom/ssr/hydration.js +6 -4
  29. package/dist/development/lib/dom/ssr/invariant.js +1 -1
  30. package/dist/development/lib/dom/ssr/links.js +1 -1
  31. package/dist/development/lib/dom/ssr/markup.js +5 -2
  32. package/dist/development/lib/dom/ssr/route-discovery.d.ts +120 -0
  33. package/dist/development/lib/dom/ssr/route-discovery.js +415 -0
  34. package/dist/development/lib/dom/ssr/routeModules.js +1 -1
  35. package/dist/development/lib/dom/ssr/routes-test-stub.js +2 -2
  36. package/dist/development/lib/dom/ssr/routes.d.ts +2 -2
  37. package/dist/development/lib/dom/ssr/routes.js +8 -8
  38. package/dist/development/lib/dom/ssr/server.js +4 -2
  39. package/dist/development/lib/dom/ssr/single-fetch.d.ts +28 -2
  40. package/dist/development/lib/dom/ssr/single-fetch.js +80 -71
  41. package/dist/development/lib/dom-export/dom-router-provider.js +1 -1
  42. package/dist/development/lib/dom-export/hydrated-router.d.ts +28 -0
  43. package/dist/development/lib/dom-export/hydrated-router.js +33 -12
  44. package/dist/development/lib/errors.js +1 -1
  45. package/dist/development/lib/hooks.d.ts +3 -3
  46. package/dist/development/lib/hooks.js +52 -47
  47. package/dist/development/lib/href.js +1 -1
  48. package/dist/development/lib/router/history.js +1 -1
  49. package/dist/development/lib/router/instrumentation.js +1 -1
  50. package/dist/development/lib/router/matcher-route-pattern.d.ts +2 -0
  51. package/dist/development/lib/router/matcher-route-pattern.js +216 -0
  52. package/dist/development/lib/router/matcher-route-pattern.preload.d.ts +20 -0
  53. package/dist/development/lib/router/matcher-route-pattern.preload.js +36 -0
  54. package/dist/development/lib/router/matcher.d.ts +2 -0
  55. package/dist/development/lib/router/matcher.js +29 -0
  56. package/dist/development/lib/router/navigation.js +1 -1
  57. package/dist/development/lib/router/router.d.ts +19 -7
  58. package/dist/development/lib/router/router.js +235 -128
  59. package/dist/development/lib/router/url.js +1 -1
  60. package/dist/development/lib/router/utils.d.ts +30 -5
  61. package/dist/development/lib/router/utils.js +8 -5
  62. package/dist/development/lib/rsc/browser.js +3 -2
  63. package/dist/development/lib/rsc/errorBoundaries.js +1 -1
  64. package/dist/development/lib/rsc/html-stream/browser.js +1 -1
  65. package/dist/development/lib/rsc/html-stream/server.js +25 -15
  66. package/dist/development/lib/rsc/route-modules.js +1 -1
  67. package/dist/development/lib/rsc/server.rsc.d.ts +10 -2
  68. package/dist/development/lib/rsc/server.ssr.js +25 -21
  69. package/dist/development/lib/server-runtime/build.d.ts +14 -0
  70. package/dist/development/lib/server-runtime/cookies.js +1 -1
  71. package/dist/development/lib/server-runtime/crypto.js +1 -1
  72. package/dist/development/lib/server-runtime/data.js +1 -1
  73. package/dist/development/lib/server-runtime/dev.js +1 -1
  74. package/dist/development/lib/server-runtime/entry.js +1 -1
  75. package/dist/development/lib/server-runtime/errors.js +1 -1
  76. package/dist/development/lib/server-runtime/headers.js +1 -1
  77. package/dist/development/lib/server-runtime/invariant.js +1 -1
  78. package/dist/development/lib/server-runtime/mode.js +1 -1
  79. package/dist/development/lib/server-runtime/routeMatching.js +3 -4
  80. package/dist/development/lib/server-runtime/routes.d.ts +1 -1
  81. package/dist/development/lib/server-runtime/routes.js +1 -1
  82. package/dist/development/lib/server-runtime/server.js +18 -9
  83. package/dist/development/lib/server-runtime/serverHandoff.d.ts +17 -0
  84. package/dist/development/lib/server-runtime/serverHandoff.js +1 -1
  85. package/dist/development/lib/server-runtime/sessions/cookieStorage.js +1 -1
  86. package/dist/development/lib/server-runtime/sessions/memoryStorage.js +1 -1
  87. package/dist/development/lib/server-runtime/sessions.js +1 -1
  88. package/dist/development/lib/server-runtime/single-fetch.js +1 -1
  89. package/dist/development/lib/server-runtime/urls.js +1 -1
  90. package/dist/development/lib/server-runtime/warnings.js +1 -1
  91. package/dist/development/lib/types/internal.js +1 -1
  92. package/dist/development/lib/types/route-data.d.ts +2 -2
  93. package/dist/development/lib/types/route-module-annotations.d.ts +1 -1
  94. package/dist/development/route-pattern.d.ts +3 -0
  95. package/dist/development/route-pattern.js +12 -0
  96. package/dist/development/vendor/turbo-stream-v2/flatten.js +1 -1
  97. package/dist/development/vendor/turbo-stream-v2/turbo-stream.js +1 -1
  98. package/dist/development/vendor/turbo-stream-v2/unflatten.js +1 -1
  99. package/dist/development/vendor/turbo-stream-v2/utils.js +1 -1
  100. package/dist/production/dom-export.d.ts +2 -1
  101. package/dist/production/dom-export.js +1 -1
  102. package/dist/production/index-react-server-client.js +2 -2
  103. package/dist/production/index-react-server.d.ts +601 -189
  104. package/dist/production/index-react-server.js +100 -48
  105. package/dist/production/index.d.ts +10 -9
  106. package/dist/production/index.js +6 -5
  107. package/dist/production/lib/actions.js +1 -1
  108. package/dist/production/lib/components.js +66 -10
  109. package/dist/production/lib/context.d.ts +19 -6
  110. package/dist/production/lib/context.js +11 -3
  111. package/dist/production/lib/dom/dom.d.ts +3 -0
  112. package/dist/production/lib/dom/dom.js +1 -1
  113. package/dist/production/lib/dom/global.d.ts +35 -0
  114. package/dist/production/lib/dom/lib.d.ts +34 -9
  115. package/dist/production/lib/dom/lib.js +30 -37
  116. package/dist/production/lib/dom/server.d.ts +6 -1
  117. package/dist/production/lib/dom/server.js +41 -15
  118. package/dist/production/lib/dom/ssr/components.js +26 -31
  119. package/dist/production/lib/dom/ssr/data.js +1 -1
  120. package/dist/production/lib/dom/ssr/entry.d.ts +13 -2
  121. package/dist/production/lib/dom/ssr/errorBoundaries.js +1 -1
  122. package/dist/production/lib/dom/ssr/fallback.js +1 -1
  123. package/dist/production/lib/dom/ssr/fog-of-war.d.ts +3 -2
  124. package/dist/production/lib/dom/ssr/fog-of-war.js +46 -22
  125. package/dist/production/lib/dom/ssr/hydration.d.ts +3 -1
  126. package/dist/production/lib/dom/ssr/hydration.js +6 -4
  127. package/dist/production/lib/dom/ssr/invariant.js +1 -1
  128. package/dist/production/lib/dom/ssr/links.js +1 -1
  129. package/dist/production/lib/dom/ssr/markup.js +5 -2
  130. package/dist/production/lib/dom/ssr/route-discovery.d.ts +120 -0
  131. package/dist/production/lib/dom/ssr/route-discovery.js +415 -0
  132. package/dist/production/lib/dom/ssr/routeModules.js +1 -1
  133. package/dist/production/lib/dom/ssr/routes-test-stub.js +2 -2
  134. package/dist/production/lib/dom/ssr/routes.d.ts +2 -2
  135. package/dist/production/lib/dom/ssr/routes.js +8 -8
  136. package/dist/production/lib/dom/ssr/server.js +4 -2
  137. package/dist/production/lib/dom/ssr/single-fetch.d.ts +28 -2
  138. package/dist/production/lib/dom/ssr/single-fetch.js +80 -71
  139. package/dist/production/lib/dom-export/dom-router-provider.js +1 -1
  140. package/dist/production/lib/dom-export/hydrated-router.d.ts +28 -0
  141. package/dist/production/lib/dom-export/hydrated-router.js +33 -12
  142. package/dist/production/lib/errors.js +1 -1
  143. package/dist/production/lib/hooks.d.ts +3 -3
  144. package/dist/production/lib/hooks.js +51 -46
  145. package/dist/production/lib/href.js +1 -1
  146. package/dist/production/lib/router/history.js +1 -1
  147. package/dist/production/lib/router/instrumentation.js +1 -1
  148. package/dist/production/lib/router/matcher-route-pattern.d.ts +2 -0
  149. package/dist/production/lib/router/matcher-route-pattern.js +216 -0
  150. package/dist/production/lib/router/matcher-route-pattern.preload.d.ts +20 -0
  151. package/dist/production/lib/router/matcher-route-pattern.preload.js +36 -0
  152. package/dist/production/lib/router/matcher.d.ts +2 -0
  153. package/dist/production/lib/router/matcher.js +29 -0
  154. package/dist/production/lib/router/navigation.js +1 -1
  155. package/dist/production/lib/router/router.d.ts +19 -7
  156. package/dist/production/lib/router/router.js +235 -128
  157. package/dist/production/lib/router/url.js +1 -1
  158. package/dist/production/lib/router/utils.d.ts +30 -5
  159. package/dist/production/lib/router/utils.js +8 -5
  160. package/dist/production/lib/rsc/browser.js +3 -2
  161. package/dist/production/lib/rsc/errorBoundaries.js +1 -1
  162. package/dist/production/lib/rsc/html-stream/browser.js +1 -1
  163. package/dist/production/lib/rsc/html-stream/server.js +25 -15
  164. package/dist/production/lib/rsc/route-modules.js +1 -1
  165. package/dist/production/lib/rsc/server.rsc.d.ts +10 -2
  166. package/dist/production/lib/rsc/server.ssr.js +25 -21
  167. package/dist/production/lib/server-runtime/build.d.ts +14 -0
  168. package/dist/production/lib/server-runtime/cookies.js +1 -1
  169. package/dist/production/lib/server-runtime/crypto.js +1 -1
  170. package/dist/production/lib/server-runtime/data.js +1 -1
  171. package/dist/production/lib/server-runtime/dev.js +1 -1
  172. package/dist/production/lib/server-runtime/entry.js +1 -1
  173. package/dist/production/lib/server-runtime/errors.js +1 -1
  174. package/dist/production/lib/server-runtime/headers.js +1 -1
  175. package/dist/production/lib/server-runtime/invariant.js +1 -1
  176. package/dist/production/lib/server-runtime/mode.js +1 -1
  177. package/dist/production/lib/server-runtime/routeMatching.js +3 -4
  178. package/dist/production/lib/server-runtime/routes.d.ts +1 -1
  179. package/dist/production/lib/server-runtime/routes.js +1 -1
  180. package/dist/production/lib/server-runtime/server.js +18 -9
  181. package/dist/production/lib/server-runtime/serverHandoff.d.ts +17 -0
  182. package/dist/production/lib/server-runtime/serverHandoff.js +1 -1
  183. package/dist/production/lib/server-runtime/sessions/cookieStorage.js +1 -1
  184. package/dist/production/lib/server-runtime/sessions/memoryStorage.js +1 -1
  185. package/dist/production/lib/server-runtime/sessions.js +1 -1
  186. package/dist/production/lib/server-runtime/single-fetch.js +1 -1
  187. package/dist/production/lib/server-runtime/urls.js +1 -1
  188. package/dist/production/lib/server-runtime/warnings.js +1 -1
  189. package/dist/production/lib/types/internal.js +1 -1
  190. package/dist/production/lib/types/route-data.d.ts +2 -2
  191. package/dist/production/lib/types/route-module-annotations.d.ts +1 -1
  192. package/dist/production/route-pattern.d.ts +3 -0
  193. package/dist/production/route-pattern.js +12 -0
  194. package/dist/production/vendor/turbo-stream-v2/flatten.js +1 -1
  195. package/dist/production/vendor/turbo-stream-v2/turbo-stream.js +1 -1
  196. package/dist/production/vendor/turbo-stream-v2/unflatten.js +1 -1
  197. package/dist/production/vendor/turbo-stream-v2/utils.js +1 -1
  198. package/docs/explanation/lazy-route-discovery.md +4 -0
  199. package/docs/explanation/sessions-and-cookies.md +108 -4
  200. package/docs/how-to/custom-fetch.md +218 -0
  201. package/docs/how-to/data-strategy.md +23 -1
  202. package/docs/how-to/fetchers.md +6 -1
  203. package/docs/how-to/middleware.md +4 -1
  204. package/docs/how-to/optimize-revalidation.md +178 -5
  205. package/docs/how-to/pre-rendering.md +23 -1
  206. package/docs/how-to/react-server-components.md +26 -3
  207. package/docs/how-to/resource-routes.md +3 -0
  208. package/docs/how-to/route-discovery.md +145 -0
  209. package/docs/how-to/spa.md +2 -0
  210. package/docs/how-to/view-transitions.md +80 -13
  211. package/docs/start/data/actions.md +2 -1
  212. package/docs/start/data/route-object.md +21 -6
  213. package/docs/start/framework/actions.md +4 -2
  214. package/docs/start/framework/navigating.md +5 -9
  215. package/docs/start/framework/rendering.md +37 -0
  216. package/docs/start/framework/route-module.md +32 -5
  217. package/docs/upgrading/future.md +68 -0
  218. package/package.json +19 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v8.3.1
2
+ * react-router v8.5.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -12,7 +12,7 @@ import { createPath, invariant, parsePath, warning } from "./router/history.js";
12
12
  import { convertRouteMatchToUiMatch, decodePath, getResolveToMatches, getRoutePattern, isBrowser, isRouteErrorResponse, joinPaths, matchPath, matchRoutes, parseToInfo, resolveTo, stripBasename } from "./router/utils.js";
13
13
  import { getNavigatorCurrentUrl, validateNavigationTarget } from "./router/navigation.js";
14
14
  import { IDLE_BLOCKER, hasInvalidProtocol } from "./router/router.js";
15
- import { AwaitContext, DataRouterContext, DataRouterStateContext, LocationContext, NavigationContext, RSCRouterContext, RouteContext, RouteErrorContext } from "./context.js";
15
+ import { AwaitContext, DataRouterContext, DataRouterDataContext, DataRouterNavigationContext, DataRouterStateContext, FetchersContext, IsDataRouteContext, LocationContext, NavigationContext, RSCRouterContext, RouteContext, RouteErrorContext, RouteIdContext } from "./context.js";
16
16
  import { decodeRedirectErrorDigest, decodeRouteErrorResponseDigest } from "./errors.js";
17
17
  import * as React$1 from "react";
18
18
  //#region lib/hooks.tsx
@@ -136,7 +136,7 @@ const navigateEffectWarning = "You should call navigate() in a React.useEffect()
136
136
  * * These options only work in Framework and Data modes:
137
137
  * * `flushSync`: Wrap the DOM updates in [`ReactDom.flushSync`](https://react.dev/reference/react-dom/flushSync)
138
138
  * * `preventScrollReset`: Do not scroll back to the top of the page after navigation
139
- * * `viewTransition`: Enable [`document.startViewTransition`](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) for this navigation
139
+ * * `viewTransition`: **Deprecated.** Use React's [`<ViewTransition>`](https://react.dev/reference/react/ViewTransition) component instead. See the [migration guide](../../how-to/view-transitions).
140
140
  *
141
141
  * @example
142
142
  * import { useNavigate } from "react-router";
@@ -269,8 +269,7 @@ const navigateEffectWarning = "You should call navigate() in a React.useEffect()
269
269
  * @returns A navigate function for programmatic navigation
270
270
  */
271
271
  function useNavigate() {
272
- let { isDataRoute } = React$1.useContext(RouteContext);
273
- return isDataRoute ? useNavigateStable() : useNavigateUnstable();
272
+ return React$1.useContext(IsDataRouteContext) ? useNavigateStable() : useNavigateUnstable();
274
273
  }
275
274
  function useNavigateUnstable() {
276
275
  invariant(useInRouterContext(), `useNavigate() may be used only in the context of a <Router> component.`);
@@ -588,7 +587,7 @@ function useRoutesImpl(routes, locationArg, dataRouterOpts) {
588
587
  let parentRoute = routeMatch && routeMatch.route;
589
588
  {
590
589
  let parentPath = parentRoute && parentRoute.path || "";
591
- warningOnce(parentPathname, !parentRoute || parentPath.endsWith("*") || parentPath.endsWith("*?"), `You rendered descendant <Routes> (or called \`useRoutes()\`) at "${parentPathname}" (under <Route path="${parentPath}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.\n\nPlease change the parent <Route path="${parentPath}"> to <Route path="${parentPath === "/" ? "*" : `${parentPath}/*`}">.`);
590
+ warningOnce(parentPathname, !parentRoute || parentPath.endsWith("*") || parentPath.endsWith("*?"), `You rendered descendant <Routes> (or called \`useRoutes()\`) at "${parentPathname}" (under <Route path="${parentPath}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.\n\nPlease change the parent <Route path="${parentPath}"> to <Route path="${parentPath === "/" ? "*" : `${parentPath}/*`}\">.`);
592
591
  }
593
592
  let locationFromContext = useLocation();
594
593
  let location;
@@ -603,7 +602,10 @@ function useRoutesImpl(routes, locationArg, dataRouterOpts) {
603
602
  let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
604
603
  remainingPathname = "/" + pathname.replace(/^\//, "").split("/").slice(parentSegments.length).join("/");
605
604
  }
606
- let matches = dataRouterOpts && dataRouterOpts.state.matches.length ? dataRouterOpts.state.matches.map((m) => Object.assign(m, { route: dataRouterOpts.manifest[m.route.id] || m.route })) : matchRoutes(routes, { pathname: remainingPathname });
605
+ let matches;
606
+ if (dataRouterOpts) if (dataRouterOpts.state.matches.length) matches = dataRouterOpts.state.matches.map((m) => Object.assign(m, { route: dataRouterOpts.manifest[m.route.id] || m.route }));
607
+ else matches = dataRouterOpts.router.match(dataRouterOpts.state.location);
608
+ else matches = matchRoutes(routes, { pathname: remainingPathname });
607
609
  warning(parentRoute || matches != null, `No routes matched location "${location.pathname}${location.search}${location.hash}" `);
608
610
  warning(matches == null || matches[matches.length - 1].route.element !== void 0 || matches[matches.length - 1].route.Component !== void 0 || matches[matches.length - 1].route.lazy !== void 0, `Matched leaf route at location "${location.pathname}${location.search}${location.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);
609
611
  let renderedMatches = _renderMatches(matches && matches.map((match) => Object.assign({}, match, {
@@ -679,10 +681,10 @@ var RenderErrorBoundary = class extends React$1.Component {
679
681
  const decoded = decodeRouteErrorResponseDigest(error.digest);
680
682
  if (decoded) error = decoded;
681
683
  }
682
- let result = error !== void 0 ? /* @__PURE__ */ React$1.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ React$1.createElement(RouteErrorContext.Provider, {
684
+ let result = error !== void 0 ? /* @__PURE__ */ React$1.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ React$1.createElement(IsDataRouteContext.Provider, { value: this.props.routeContext.isDataRoute }, /* @__PURE__ */ React$1.createElement(RouteIdContext.Provider, { value: this.props.routeContext.matches[this.props.routeContext.matches.length - 1]?.route.id }, /* @__PURE__ */ React$1.createElement(RouteErrorContext.Provider, {
683
685
  value: error,
684
686
  children: this.props.component
685
- })) : this.props.children;
687
+ })))) : this.props.children;
686
688
  if (this.context) return /* @__PURE__ */ React$1.createElement(RSCErrorHandler, { error }, result);
687
689
  return result;
688
690
  }
@@ -716,7 +718,7 @@ function RSCErrorHandler({ children, error }) {
716
718
  function RenderedRoute({ routeContext, match, children }) {
717
719
  let dataRouterContext = React$1.useContext(DataRouterContext);
718
720
  if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;
719
- return /* @__PURE__ */ React$1.createElement(RouteContext.Provider, { value: routeContext }, children);
721
+ return /* @__PURE__ */ React$1.createElement(RouteContext.Provider, { value: routeContext }, /* @__PURE__ */ React$1.createElement(IsDataRouteContext.Provider, { value: routeContext.isDataRoute }, /* @__PURE__ */ React$1.createElement(RouteIdContext.Provider, { value: match.route.id }, children)));
720
722
  }
721
723
  function _renderMatches(matches, parentMatches = [], dataRouterOpts) {
722
724
  let dataRouterState = dataRouterOpts?.state;
@@ -826,25 +828,25 @@ function useDataRouterState(hookName) {
826
828
  invariant(state, getDataRouterConsoleError(hookName));
827
829
  return state;
828
830
  }
829
- function useRouteContext(hookName) {
830
- let route = React$1.useContext(RouteContext);
831
- invariant(route, getDataRouterConsoleError(hookName));
832
- return route;
831
+ function useDataRouterFetchers(hookName) {
832
+ let fetchers = React$1.useContext(FetchersContext);
833
+ invariant(fetchers, getDataRouterConsoleError(hookName));
834
+ return fetchers;
833
835
  }
834
- function useCurrentRouteId(hookName) {
835
- let route = useRouteContext(hookName);
836
- let thisRoute = route.matches[route.matches.length - 1];
837
- invariant(thisRoute.route.id, `${hookName} can only be used on routes that contain a unique "id"`);
838
- return thisRoute.route.id;
836
+ function useDataRouterData(hookName) {
837
+ let data = React$1.useContext(DataRouterDataContext);
838
+ invariant(data, getDataRouterConsoleError(hookName));
839
+ return data;
839
840
  }
840
- /**
841
- * Returns the ID for the nearest contextual route
842
- *
843
- * @category Hooks
844
- * @returns The ID of the nearest contextual route
845
- */
846
- function useRouteId() {
847
- return useCurrentRouteId("useRouteId");
841
+ function useDataRouterNavigation(hookName) {
842
+ let navigation = React$1.useContext(DataRouterNavigationContext);
843
+ invariant(navigation, getDataRouterConsoleError(hookName));
844
+ return navigation;
845
+ }
846
+ function useCurrentRouteId(hookName) {
847
+ let routeId = React$1.useContext(RouteIdContext);
848
+ invariant(routeId, `${hookName} can only be used on routes that contain a unique "id"`);
849
+ return routeId;
848
850
  }
849
851
  /**
850
852
  * Returns the current {@link Navigation}, defaulting to an "idle" navigation
@@ -869,11 +871,11 @@ function useRouteId() {
869
871
  * @returns The current {@link Navigation} object
870
872
  */
871
873
  function useNavigation() {
872
- let state = useDataRouterState("useNavigation");
874
+ let { navigation } = useDataRouterNavigation("useNavigation");
873
875
  return React$1.useMemo(() => {
874
- let { matches, historyAction, ...rest } = state.navigation;
876
+ let { matches, historyAction, ...rest } = navigation;
875
877
  return rest;
876
- }, [state.navigation]);
878
+ }, [navigation]);
877
879
  }
878
880
  /**
879
881
  * Revalidate the data on the page for reasons outside of normal data mutations
@@ -912,14 +914,14 @@ function useNavigation() {
912
914
  */
913
915
  function useRevalidator() {
914
916
  let dataRouterContext = useDataRouterContext("useRevalidator");
915
- let state = useDataRouterState("useRevalidator");
917
+ let { revalidation } = useDataRouterNavigation("useRevalidator");
916
918
  let revalidate = React$1.useCallback(async () => {
917
919
  await dataRouterContext.router.revalidate();
918
920
  }, [dataRouterContext.router]);
919
921
  return React$1.useMemo(() => ({
920
922
  revalidate,
921
- state: state.revalidation
922
- }), [revalidate, state.revalidation]);
923
+ state: revalidation
924
+ }), [revalidate, revalidation]);
923
925
  }
924
926
  /**
925
927
  * Returns the active route matches, useful for accessing `loaderData` for
@@ -956,7 +958,8 @@ function useRevalidator() {
956
958
  * @returns An array of {@link UIMatch | UI matches} for the current route hierarchy
957
959
  */
958
960
  function useMatches() {
959
- let { matches, loaderData } = useDataRouterState("useMatches");
961
+ let { matches } = useDataRouterState("useMatches");
962
+ let { loaderData } = useDataRouterData("useMatches");
960
963
  return React$1.useMemo(() => matches.map((m) => convertRouteMatchToUiMatch(m, loaderData)), [matches, loaderData]);
961
964
  }
962
965
  /**
@@ -983,9 +986,9 @@ function useMatches() {
983
986
  * @returns The data returned from the route's [`loader`](../../start/framework/route-module#loader) or [`clientLoader`](../../start/framework/route-module#clientloader) function
984
987
  */
985
988
  function useLoaderData() {
986
- let state = useDataRouterState("useLoaderData");
989
+ let data = useDataRouterData("useLoaderData");
987
990
  let routeId = useCurrentRouteId("useLoaderData");
988
- return state.loaderData[routeId];
991
+ return data.loaderData[routeId];
989
992
  }
990
993
  /**
991
994
  * Returns the [`loader`](../../start/framework/route-module#loader) data for a
@@ -1020,7 +1023,7 @@ function useLoaderData() {
1020
1023
  * function, or `undefined` if not found
1021
1024
  */
1022
1025
  function useRouteLoaderData(routeId) {
1023
- return useDataRouterState("useRouteLoaderData").loaderData[routeId];
1026
+ return useDataRouterData("useRouteLoaderData").loaderData[routeId];
1024
1027
  }
1025
1028
  /**
1026
1029
  * Returns the [`action`](../../start/framework/route-module#action) data from
@@ -1055,9 +1058,9 @@ function useRouteLoaderData(routeId) {
1055
1058
  * has been called
1056
1059
  */
1057
1060
  function useActionData() {
1058
- let state = useDataRouterState("useActionData");
1059
- let routeId = useCurrentRouteId("useLoaderData");
1060
- return state.actionData ? state.actionData[routeId] : void 0;
1061
+ let data = useDataRouterData("useActionData");
1062
+ let routeId = useCurrentRouteId("useActionData");
1063
+ return data.actionData ? data.actionData[routeId] : void 0;
1061
1064
  }
1062
1065
  /**
1063
1066
  * Accesses the error thrown during an
@@ -1081,10 +1084,10 @@ function useActionData() {
1081
1084
  */
1082
1085
  function useRouteError() {
1083
1086
  let error = React$1.useContext(RouteErrorContext);
1084
- let state = useDataRouterState("useRouteError");
1087
+ let data = useDataRouterData("useRouteError");
1085
1088
  let routeId = useCurrentRouteId("useRouteError");
1086
1089
  if (error !== void 0) return error;
1087
- return state.errors?.[routeId];
1090
+ return data.errors?.[routeId];
1088
1091
  }
1089
1092
  /**
1090
1093
  * Returns the resolved promise value from the closest {@link Await | `<Await>`}.
@@ -1309,12 +1312,13 @@ function useRoute(...args) {
1309
1312
  const currentRouteId = useCurrentRouteId("useRoute");
1310
1313
  const id = args[0] ?? currentRouteId;
1311
1314
  const state = useDataRouterState("useRoute");
1315
+ const data = useDataRouterData("useRoute");
1312
1316
  const route = state.matches.find(({ route }) => route.id === id);
1313
1317
  if (route === void 0) return void 0;
1314
1318
  return {
1315
1319
  handle: route.route.handle,
1316
- loaderData: state.loaderData[id],
1317
- actionData: state.actionData?.[id]
1320
+ loaderData: data.loaderData[id],
1321
+ actionData: data.actionData?.[id]
1318
1322
  };
1319
1323
  }
1320
1324
  function toRouterStateMatch(match) {
@@ -1337,7 +1341,7 @@ function toRouterStateMatch(match) {
1337
1341
  * @example
1338
1342
  * import { unstable_useRouterState as useRouterState } from "react-router";
1339
1343
  *
1340
- * let { active, pending } = unstable_useRouterState();
1344
+ * let { active, pending } = useRouterState();
1341
1345
  *
1342
1346
  * // Active is always populated with the current location
1343
1347
  * active.location; // replaces `useLocation()`
@@ -1368,7 +1372,8 @@ function toRouterStateMatch(match) {
1368
1372
  * @returns The current router state with `active` and `pending` variants
1369
1373
  */
1370
1374
  function useRouterState() {
1371
- let { location, historyAction: type, matches, navigation } = useDataRouterState("unstable_useRouterState");
1375
+ let { location, historyAction: type, matches } = useDataRouterState("unstable_useRouterState");
1376
+ let { navigation } = useDataRouterNavigation("unstable_useRouterState");
1372
1377
  let active = React$1.useMemo(() => ({
1373
1378
  type,
1374
1379
  location,
@@ -1415,4 +1420,4 @@ function useRouterState() {
1415
1420
  }), [active, pending]);
1416
1421
  }
1417
1422
  //#endregion
1418
- export { _renderMatches, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRoute, useRouteError, useRouteId, useRouteLoaderData, useRouterState, useRoutes, useRoutesImpl };
1423
+ export { _renderMatches, useActionData, useAsyncError, useAsyncValue, useBlocker, useCurrentRouteId, useDataRouterContext, useDataRouterData, useDataRouterFetchers, useDataRouterState, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRoute, useRouteError, useRouteLoaderData, useRouterState, useRoutes, useRoutesImpl };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v8.3.1
2
+ * react-router v8.5.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v8.3.1
2
+ * react-router v8.5.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v8.3.1
2
+ * react-router v8.5.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -0,0 +1,216 @@
1
+ /**
2
+ * react-router v8.5.0
3
+ *
4
+ * Copyright (c) Remix Software Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ import { invariant, parsePath, warning } from "./history.js";
12
+ import { decodePath, explodeOptionalSegments, joinPaths, matchPath, normalizePathname, stripBasename } from "./utils.js";
13
+ import { createMultiMatcher } from "@remix-run/route-pattern/match";
14
+ import { descending } from "@remix-run/route-pattern/specificity";
15
+ //#region lib/router/matcher-route-pattern.ts
16
+ var RoutePatternDataRouteMatcher = class {
17
+ #state;
18
+ #basename;
19
+ constructor(basename) {
20
+ this.#basename = basename;
21
+ }
22
+ update(routes) {
23
+ let branches = flattenRoutes(routes);
24
+ let matcher = createMultiMatcher({ ignoreCase: true });
25
+ let partialMatcher = createMultiMatcher({ ignoreCase: true });
26
+ for (let branch of branches) {
27
+ let routePattern = convertReactRouterPathToRoutePattern(branch.path);
28
+ validateRoutePatternSplat(branch.path, routePattern);
29
+ routePattern = addOptionalTrailingSlash(routePattern);
30
+ matcher.add(routePattern, branch);
31
+ if (!branch.routesMeta[branch.routesMeta.length - 1].route.index) partialMatcher.add(routePattern === "/" ? `/*__rr_partial` : `${routePattern}(/*__rr_partial)`, branch);
32
+ }
33
+ this.#state = {
34
+ branches,
35
+ matcher,
36
+ partialMatcher
37
+ };
38
+ return branches;
39
+ }
40
+ match(locationArg, allowPartial = false) {
41
+ let pathname = stripBasename((typeof locationArg === "string" ? parsePath(locationArg) : locationArg).pathname || "/", this.#basename);
42
+ if (pathname == null) return null;
43
+ let decoded = decodePath(pathname);
44
+ let url = new URL("http://reactrouter.local");
45
+ url.pathname = pathname.endsWith("/") ? pathname : `${pathname}/`;
46
+ invariant(this.#state, "Route pattern routes must be initialized before matching.");
47
+ let matches = this.#state.matcher.matchAll(url);
48
+ if (allowPartial) matches.push(...this.#state.partialMatcher.matchAll(url));
49
+ for (let match of prioritizeValidatedMatches(matches)) {
50
+ let routeMatches = convertRoutePatternMatchToRouteMatches(match, decoded, allowPartial);
51
+ if (routeMatches && validateRouteMatchParams(routeMatches)) return routeMatches;
52
+ }
53
+ return null;
54
+ }
55
+ };
56
+ function validateRoutePatternSplat(routePath, routePattern) {
57
+ invariant(getRoutePatternSplatIndexes(routePattern).length <= 1 && isTerminalRoutePatternSplat(routePattern), `Route path "${routePath}" is not supported with \`future.unstable_routePatternMatching\` because React Router only supports a single splat at the end of a route path.`);
58
+ }
59
+ function getRoutePatternSplatIndexes(routePattern) {
60
+ let splatIndexes = [];
61
+ for (let i = 0; i < routePattern.length; i++) {
62
+ let char = routePattern[i];
63
+ if (char === "\\") {
64
+ i++;
65
+ continue;
66
+ }
67
+ if (char === "*") splatIndexes.push(i);
68
+ }
69
+ return splatIndexes;
70
+ }
71
+ function isTerminalRoutePatternSplat(routePattern) {
72
+ for (let i = 0; i < routePattern.length; i++) {
73
+ let char = routePattern[i];
74
+ if (char === "\\") {
75
+ i++;
76
+ continue;
77
+ }
78
+ if (char !== "*") continue;
79
+ let suffix = routePattern.slice(i + 1);
80
+ return /^[a-zA-Z_$][a-zA-Z_$0-9]*$/.test(suffix) || suffix === "";
81
+ }
82
+ return true;
83
+ }
84
+ function addOptionalTrailingSlash(routePattern) {
85
+ return routePattern === "/" ? routePattern : `${routePattern.replace(/\/+$/, "")}(/)`;
86
+ }
87
+ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "") {
88
+ routes.forEach((route, index) => {
89
+ invariant(route.caseSensitive !== true, "`caseSensitive` routes are not supported with `future.unstable_routePatternMatching`.");
90
+ let meta = {
91
+ relativePath: route.path || "",
92
+ caseSensitive: false,
93
+ childrenIndex: index,
94
+ route
95
+ };
96
+ let absolutePath;
97
+ if (meta.relativePath.startsWith("/")) {
98
+ absolutePath = meta.relativePath;
99
+ let parentPathMatch = explodeOptionalSegments(parentPath).find((path) => meta.relativePath.startsWith(path));
100
+ invariant(parentPathMatch != null, `Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`);
101
+ meta.relativePath = meta.relativePath.slice(parentPathMatch.length);
102
+ }
103
+ let routesMeta = parentsMeta.concat(meta);
104
+ let path = absolutePath ?? (meta.relativePath ? joinPaths([parentPath, meta.relativePath]) : parentPath);
105
+ if (route.children && route.children.length > 0) {
106
+ invariant(route.index !== true, `Index routes must not have child routes. Please remove all child routes from route path "${path}".`);
107
+ flattenRoutes(route.children, branches, routesMeta, path);
108
+ if (route.children?.some((child) => child.index)) return;
109
+ }
110
+ if (route.path != null || route.index) branches.push({
111
+ path,
112
+ score: 0,
113
+ routesMeta
114
+ });
115
+ });
116
+ return branches;
117
+ }
118
+ function convertReactRouterPathToRoutePattern(path) {
119
+ warning(path === "*" || !path.endsWith("*") || path.endsWith("/*"), `Route path "${path}" will be treated as if it were "${path.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${path.replace(/\*$/, "/*")}".`);
120
+ if (path.endsWith("*") && path !== "*" && !path.endsWith("/*")) path = path.replace(/\*$/, "/*");
121
+ path = path.replace(/^\/*/, "/");
122
+ if (path === "") return "/";
123
+ let segments = path.split("/");
124
+ let pattern = segments.shift() || "";
125
+ for (let i = 0; i < segments.length;) {
126
+ let optionalRun = [];
127
+ while (i < segments.length && isOptionalRouteSegment(segments[i])) {
128
+ optionalRun.push(convertRouteSegment(segments[i].slice(0, -1)));
129
+ i++;
130
+ }
131
+ if (optionalRun.length > 0) {
132
+ let nested = optionalRun.reduceRight((child, segment) => `/${segment}${child ? `(${child})` : ""}`, "");
133
+ pattern += `(${nested})`;
134
+ continue;
135
+ }
136
+ pattern += `/${convertRouteSegment(segments[i])}`;
137
+ i++;
138
+ }
139
+ return pattern || "/";
140
+ }
141
+ function isOptionalRouteSegment(segment) {
142
+ return segment.endsWith("?");
143
+ }
144
+ function convertRouteSegment(segment) {
145
+ if (segment === "*") return "*__rr_splat";
146
+ let paramMatch = segment.match(/^:([\w-]+)(\?)?(.*)$/);
147
+ if (paramMatch) {
148
+ let [, paramName, optional, suffix] = paramMatch;
149
+ let converted = `:${paramName}${escapeRoutePatternLiteral(suffix)}`;
150
+ return optional ? `(:${paramName})${escapeRoutePatternLiteral(suffix)}` : converted;
151
+ }
152
+ return escapeRoutePatternLiteral(segment);
153
+ }
154
+ function escapeRoutePatternLiteral(value) {
155
+ return value.replace(/[\\():*]/g, "\\$&");
156
+ }
157
+ function validateRouteMatchParams(matches) {
158
+ return matches.every(({ route, params }) => route.unstable_validateParams == null || Object.keys(route.unstable_validateParams).length === 0 || Object.entries(route.unstable_validateParams).every(([param, re]) => params[param] != null ? new RegExp(re.source, re.flags).test(params[param]) : true));
159
+ }
160
+ function prioritizeValidatedMatches(matches) {
161
+ return matches.sort((a, b) => {
162
+ let specificity = descending(a, b);
163
+ if (specificity !== 0) return specificity;
164
+ return Number(hasParamValidators(b)) - Number(hasParamValidators(a));
165
+ });
166
+ }
167
+ function hasParamValidators(match) {
168
+ return match.data.routesMeta.some((meta) => meta.route.unstable_validateParams != null && Object.keys(meta.route.unstable_validateParams).length > 0);
169
+ }
170
+ function convertRoutePatternMatchToRouteMatches(match, pathname, allowPartial) {
171
+ let result = matchRoutePatternBranch(match.data, pathname, allowPartial, 0, "/", {});
172
+ if (result == null) return null;
173
+ for (let routeMatch of result.matches) routeMatch.params = result.params;
174
+ return result.matches;
175
+ }
176
+ function matchRoutePatternBranch(branch, pathname, allowPartial, metaIndex, matchedPathname, matchedParams) {
177
+ let meta = branch.routesMeta[metaIndex];
178
+ let end = metaIndex === branch.routesMeta.length - 1;
179
+ let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
180
+ for (let relativePath of explodeOptionalSegments(meta.relativePath)) {
181
+ let pattern = {
182
+ path: relativePath,
183
+ caseSensitive: false,
184
+ end
185
+ };
186
+ let pathMatch = matchPath(pattern, remainingPathname);
187
+ if (!pathMatch && end && allowPartial && !meta.route.index) pathMatch = matchPath({
188
+ ...pattern,
189
+ end: false
190
+ }, remainingPathname);
191
+ if (!pathMatch) continue;
192
+ let params = {
193
+ ...matchedParams,
194
+ ...pathMatch.params
195
+ };
196
+ let routeMatch = {
197
+ params,
198
+ pathname: joinPaths([matchedPathname, pathMatch.pathname]),
199
+ pathnameBase: normalizePathname(joinPaths([matchedPathname, pathMatch.pathnameBase])),
200
+ route: meta.route
201
+ };
202
+ let nextMatchedPathname = pathMatch.pathnameBase === "/" ? matchedPathname : joinPaths([matchedPathname, pathMatch.pathnameBase]);
203
+ if (end) return {
204
+ matches: [routeMatch],
205
+ params
206
+ };
207
+ let childResult = matchRoutePatternBranch(branch, pathname, allowPartial, metaIndex + 1, nextMatchedPathname, params);
208
+ if (childResult) return {
209
+ matches: [routeMatch, ...childResult.matches],
210
+ params: childResult.params
211
+ };
212
+ }
213
+ return null;
214
+ }
215
+ //#endregion
216
+ export { RoutePatternDataRouteMatcher };
@@ -0,0 +1,20 @@
1
+
2
+ //#region lib/router/matcher-route-pattern.preload.d.ts
3
+ /**
4
+ * Initialize the route-pattern matcher before creating a Data Router or static
5
+ * handler with `future.unstable_routePatternMatching` enabled. Import from
6
+ * `react-router/route-pattern` and call this once during application startup.
7
+ * Server and browser applications must each preload their own matcher.
8
+ *
9
+ * The matcher is statically imported by this module. Tree-shaking bundlers can
10
+ * remove it from applications that do not use this function. Initialization is
11
+ * synchronous, and repeated calls are safe.
12
+ *
13
+ * @public
14
+ * @category Data Routers
15
+ * @mode data
16
+ * @returns {void}
17
+ */
18
+ declare function unstable_preloadRoutePattern(): void;
19
+ //#endregion
20
+ export { unstable_preloadRoutePattern };
@@ -0,0 +1,36 @@
1
+ /**
2
+ * react-router v8.5.0
3
+ *
4
+ * Copyright (c) Remix Software Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ import { RoutePatternDataRouteMatcher } from "./matcher-route-pattern.js";
12
+ //#region lib/router/matcher-route-pattern.preload.ts
13
+ let RoutePatternMatcher;
14
+ function getRoutePatternMatcher() {
15
+ return RoutePatternMatcher;
16
+ }
17
+ /**
18
+ * Initialize the route-pattern matcher before creating a Data Router or static
19
+ * handler with `future.unstable_routePatternMatching` enabled. Import from
20
+ * `react-router/route-pattern` and call this once during application startup.
21
+ * Server and browser applications must each preload their own matcher.
22
+ *
23
+ * The matcher is statically imported by this module. Tree-shaking bundlers can
24
+ * remove it from applications that do not use this function. Initialization is
25
+ * synchronous, and repeated calls are safe.
26
+ *
27
+ * @public
28
+ * @category Data Routers
29
+ * @mode data
30
+ * @returns {void}
31
+ */
32
+ function unstable_preloadRoutePattern() {
33
+ RoutePatternMatcher = RoutePatternDataRouteMatcher;
34
+ }
35
+ //#endregion
36
+ export { getRoutePatternMatcher, unstable_preloadRoutePattern };
@@ -0,0 +1,2 @@
1
+
2
+ export { };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * react-router v8.5.0
3
+ *
4
+ * Copyright (c) Remix Software Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ import { flattenAndRankRoutes, matchRoutesImpl } from "./utils.js";
12
+ //#region lib/router/matcher.ts
13
+ var V6RegExMatcher = class {
14
+ #routes = [];
15
+ #branches = [];
16
+ #basename;
17
+ constructor(basename) {
18
+ this.#basename = basename;
19
+ }
20
+ update(routes) {
21
+ this.#routes = routes;
22
+ this.#branches = flattenAndRankRoutes(routes);
23
+ }
24
+ match(locationArg, allowPartial = false) {
25
+ return matchRoutesImpl(this.#routes, locationArg, this.#basename, allowPartial, this.#branches);
26
+ }
27
+ };
28
+ //#endregion
29
+ export { V6RegExMatcher };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v8.3.1
2
+ * react-router v8.5.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { Action, History, Location, Path, To } from "./history.js";
3
- import { DataRouteMatch, DataRouteObject, DataStrategyFunction, FormEncType, HTMLFormMethod, MapRoutePropertiesFunction, MaybePromise, PatchRoutesOnNavigationFunction, RouteBranch, RouteData, RouteManifest, RouteObject, RouterContextProvider, Submission, UIMatch } from "./utils.js";
3
+ import { DataRouteMatch, DataRouteObject, DataStrategyFunction, FormEncType, HTMLFormMethod, MapRoutePropertiesFunction, MaybePromise, PatchRoutesOnNavigationFunction, RouteData, RouteManifest, RouteObject, RouterContextProvider, Submission, UIMatch } from "./utils.js";
4
4
  import { ClientInstrumentation, ServerInstrumentation } from "./instrumentation.js";
5
5
 
6
6
  //#region lib/router/router.d.ts
@@ -40,9 +40,10 @@ interface Router {
40
40
  * @private
41
41
  * PRIVATE - DO NOT USE
42
42
  *
43
- * Return the route branches for this router instance
43
+ * Match routes against a location using the router's configured route
44
+ * matching implementation.
44
45
  */
45
- get branches(): RouteBranch<DataRouteObject>[] | undefined;
46
+ match(locationArg: Partial<Location> | string): DataRouteMatch[] | null;
46
47
  /**
47
48
  * @private
48
49
  * PRIVATE - DO NOT USE
@@ -304,7 +305,12 @@ type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "e
304
305
  /**
305
306
  * Future flags to toggle new feature behavior
306
307
  */
307
- interface FutureConfig {}
308
+ interface FutureConfig {
309
+ /** @internal Enables application-controlled Framework route discovery. */
310
+ unstable_customRouteDiscovery?: boolean;
311
+ /** Enables route-pattern matching after calling `unstable_preloadRoutePattern()`. */
312
+ unstable_routePatternMatching?: boolean;
313
+ }
308
314
  /**
309
315
  * Initialization options for createRouter
310
316
  */
@@ -336,6 +342,8 @@ interface StaticHandlerContext {
336
342
  loaderHeaders: Record<string, Headers>;
337
343
  actionHeaders: Record<string, Headers>;
338
344
  _deepestRenderedBoundaryId?: string | null;
345
+ /** @private */
346
+ _match: StaticHandler["match"];
339
347
  }
340
348
  /**
341
349
  * A StaticHandler instance manages a singular SSR navigation/fetch event
@@ -349,10 +357,10 @@ interface StaticHandler {
349
357
  * @private
350
358
  * PRIVATE - DO NOT USE
351
359
  *
352
- * The route branches derived from the data routes, used for internal route
353
- * matching in Framework Mode
360
+ * Match routes against a location using the handler's configured route
361
+ * matching implementation.
354
362
  */
355
- _internalRouteBranches: RouteBranch<DataRouteObject>[];
363
+ match(locationArg: Partial<Location> | string): DataRouteMatch[] | null;
356
364
  /**
357
365
  * Perform a query for a given request - executing all matched route
358
366
  * loaders/actions. Used for document requests.
@@ -446,6 +454,10 @@ type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
446
454
  replace?: boolean;
447
455
  state?: any;
448
456
  fromRouteId?: string;
457
+ /**
458
+ * @deprecated Use React's `<ViewTransition>` component instead. See the
459
+ * [migration guide](https://reactrouter.com/how-to/view-transitions).
460
+ */
449
461
  viewTransition?: boolean;
450
462
  mask?: To;
451
463
  };