react-router 7.14.1 → 7.15.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 (72) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/dist/development/{browser-D-3-U2Jj.d.mts → browser-CRsXgNrY.d.mts} +2 -2
  3. package/dist/{production/browser-D-3-U2Jj.d.mts → development/browser-wDl1FZEL.d.ts} +2 -2
  4. package/dist/{production/chunk-3SUPTI2U.js → development/chunk-2D5H3HU3.js} +7 -7
  5. package/dist/development/{chunk-OE4NN4TA.mjs → chunk-5KNZJZUH.mjs} +362 -213
  6. package/dist/development/{chunk-YMKMFAYZ.js → chunk-AM3XM4LS.js} +314 -172
  7. package/dist/development/{chunk-BFXCU3MI.mjs → chunk-RMD3H4O3.mjs} +81 -62
  8. package/dist/development/{chunk-3F6IB66O.js → chunk-Z5YQYACE.js} +146 -139
  9. package/dist/{production/context-BzhbVly6.d.mts → development/context-BQs41HrG.d.mts} +94 -42
  10. package/dist/development/{routeModules-CM_clkdE.d.ts → data-BVUf681J.d.mts} +89 -56
  11. package/dist/{production/routeModules-CM_clkdE.d.ts → development/data-BqZ2x964.d.ts} +79 -46
  12. package/dist/development/dom-export.d.mts +9 -9
  13. package/dist/development/dom-export.d.ts +9 -9
  14. package/dist/development/dom-export.js +37 -40
  15. package/dist/development/dom-export.mjs +12 -15
  16. package/dist/development/{index-react-server-client-CimaPp9o.d.ts → index-react-server-client-CSv-KZBk.d.ts} +123 -121
  17. package/dist/{production/index-react-server-client-WSaoxloq.d.mts → development/index-react-server-client-Ck_yZ1qL.d.mts} +102 -100
  18. package/dist/development/index-react-server-client.d.mts +3 -3
  19. package/dist/development/index-react-server-client.d.ts +3 -3
  20. package/dist/development/index-react-server-client.js +4 -4
  21. package/dist/development/index-react-server-client.mjs +2 -2
  22. package/dist/development/index-react-server.d.mts +107 -36
  23. package/dist/development/index-react-server.d.ts +107 -36
  24. package/dist/development/index-react-server.js +60 -33
  25. package/dist/development/index-react-server.mjs +60 -33
  26. package/dist/development/index.d.mts +11 -11
  27. package/dist/development/index.d.ts +11 -11
  28. package/dist/development/index.js +174 -155
  29. package/dist/development/index.mjs +3 -3
  30. package/dist/{production/instrumentation-CMVbvxj9.d.ts → development/instrumentation-DlJ2QV7d.d.ts} +73 -21
  31. package/dist/development/lib/types/internal.d.mts +2 -2
  32. package/dist/development/lib/types/internal.d.ts +2 -2
  33. package/dist/development/lib/types/internal.js +1 -1
  34. package/dist/development/lib/types/internal.mjs +1 -1
  35. package/dist/development/{register-D1WlEpq9.d.ts → register-Bsscfj79.d.ts} +1 -1
  36. package/dist/{production/register-D1WlEpq9.d.ts → development/register-Df8okEea.d.mts} +1 -1
  37. package/dist/production/{browser-CtktEGQs.d.ts → browser-CRsXgNrY.d.mts} +2 -2
  38. package/dist/{development/browser-CtktEGQs.d.ts → production/browser-wDl1FZEL.d.ts} +2 -2
  39. package/dist/production/{chunk-G5ZWO7Q6.mjs → chunk-23ZOHYE5.mjs} +81 -62
  40. package/dist/{development/chunk-7VLQJKNG.js → production/chunk-7YXKJMLN.js} +7 -7
  41. package/dist/production/{chunk-SPR7R4GU.mjs → chunk-GM3PW4GX.mjs} +362 -213
  42. package/dist/production/{chunk-UVEQGZIH.js → chunk-LCJTIOKZ.js} +314 -172
  43. package/dist/production/{chunk-LIOP3ILM.js → chunk-YBQJ3ABE.js} +146 -139
  44. package/dist/{development/context-BzhbVly6.d.mts → production/context-BQs41HrG.d.mts} +94 -42
  45. package/dist/{development/routeModules-Djumx26z.d.mts → production/data-BVUf681J.d.mts} +79 -46
  46. package/dist/production/{routeModules-Djumx26z.d.mts → data-BqZ2x964.d.ts} +89 -56
  47. package/dist/production/dom-export.d.mts +9 -9
  48. package/dist/production/dom-export.d.ts +9 -9
  49. package/dist/production/dom-export.js +37 -40
  50. package/dist/production/dom-export.mjs +12 -15
  51. package/dist/production/{index-react-server-client-CimaPp9o.d.ts → index-react-server-client-CSv-KZBk.d.ts} +123 -121
  52. package/dist/{development/index-react-server-client-WSaoxloq.d.mts → production/index-react-server-client-Ck_yZ1qL.d.mts} +102 -100
  53. package/dist/production/index-react-server-client.d.mts +3 -3
  54. package/dist/production/index-react-server-client.d.ts +3 -3
  55. package/dist/production/index-react-server-client.js +4 -4
  56. package/dist/production/index-react-server-client.mjs +2 -2
  57. package/dist/production/index-react-server.d.mts +107 -36
  58. package/dist/production/index-react-server.d.ts +107 -36
  59. package/dist/production/index-react-server.js +60 -33
  60. package/dist/production/index-react-server.mjs +60 -33
  61. package/dist/production/index.d.mts +11 -11
  62. package/dist/production/index.d.ts +11 -11
  63. package/dist/production/index.js +174 -155
  64. package/dist/production/index.mjs +3 -3
  65. package/dist/{development/instrumentation-CMVbvxj9.d.ts → production/instrumentation-DlJ2QV7d.d.ts} +73 -21
  66. package/dist/production/lib/types/internal.d.mts +2 -2
  67. package/dist/production/lib/types/internal.d.ts +2 -2
  68. package/dist/production/lib/types/internal.js +1 -1
  69. package/dist/production/lib/types/internal.mjs +1 -1
  70. package/dist/{development/register-aE9ob3TK.d.mts → production/register-Bsscfj79.d.ts} +1 -1
  71. package/dist/production/{register-aE9ob3TK.d.mts → register-Df8okEea.d.mts} +1 -1
  72. package/package.json +1 -1
@@ -1,25 +1,25 @@
1
- import { m as HTMLFormMethod, n as FormEncType, o as LoaderFunctionArgs, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, r as RouteObject, s as History, t as MaybePromise, u as MapRoutePropertiesFunction, v as Action, L as Location, w as DataRouteMatch, x as Submission, y as RouteData, z as DataStrategyFunction, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, U as UIMatch, T as To, I as Path, P as Params, J as InitialEntry, K as NonIndexRouteObject, O as LazyRouteFunction, Q as IndexRouteObject, V as RouteMatch, W as TrackedPromise } from './routeModules-Djumx26z.mjs';
1
+ import { m as HTMLFormMethod, n as FormEncType, o as LoaderFunctionArgs, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, r as RouteObject, s as History, t as MaybePromise, u as MapRoutePropertiesFunction, v as Action, L as Location, w as DataRouteMatch, x as Submission, y as RouteData, z as DataStrategyFunction, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, I as RouteBranch, J as RouteManifest, U as UIMatch, T as To, K as Path, P as Params, O as InitialEntry, Q as NonIndexRouteObject, V as LazyRouteFunction, W as IndexRouteObject, X as RouteMatch, Y as TrackedPromise } from './data-BVUf681J.mjs';
2
2
  import * as React from 'react';
3
3
 
4
- type unstable_ServerInstrumentation = {
5
- handler?: unstable_InstrumentRequestHandlerFunction;
6
- route?: unstable_InstrumentRouteFunction;
4
+ type ServerInstrumentation = {
5
+ handler?: InstrumentRequestHandlerFunction;
6
+ route?: InstrumentRouteFunction;
7
7
  };
8
- type unstable_ClientInstrumentation = {
9
- router?: unstable_InstrumentRouterFunction;
10
- route?: unstable_InstrumentRouteFunction;
8
+ type ClientInstrumentation = {
9
+ router?: InstrumentRouterFunction;
10
+ route?: InstrumentRouteFunction;
11
11
  };
12
- type unstable_InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
13
- type unstable_InstrumentRouterFunction = (router: InstrumentableRouter) => void;
14
- type unstable_InstrumentRouteFunction = (route: InstrumentableRoute) => void;
15
- type unstable_InstrumentationHandlerResult = {
12
+ type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
13
+ type InstrumentRouterFunction = (router: InstrumentableRouter) => void;
14
+ type InstrumentRouteFunction = (route: InstrumentableRoute) => void;
15
+ type InstrumentationHandlerResult = {
16
16
  status: "success";
17
17
  error: undefined;
18
18
  } | {
19
19
  status: "error";
20
20
  error: Error;
21
21
  };
22
- type InstrumentFunction<T> = (handler: () => Promise<unstable_InstrumentationHandlerResult>, info: T) => Promise<void>;
22
+ type InstrumentFunction<T> = (handler: () => Promise<InstrumentationHandlerResult>, info: T) => Promise<void>;
23
23
  type ReadonlyRequest = {
24
24
  method: string;
25
25
  url: string;
@@ -45,7 +45,7 @@ type RouteLazyInstrumentationInfo = undefined;
45
45
  type RouteHandlerInstrumentationInfo = Readonly<{
46
46
  request: ReadonlyRequest;
47
47
  params: LoaderFunctionArgs["params"];
48
- unstable_pattern: string;
48
+ pattern: string;
49
49
  context: ReadonlyContext;
50
50
  }>;
51
51
  type InstrumentableRouter = {
@@ -115,6 +115,20 @@ interface Router$1 {
115
115
  * Return the routes for this router instance
116
116
  */
117
117
  get routes(): DataRouteObject[];
118
+ /**
119
+ * @private
120
+ * PRIVATE - DO NOT USE
121
+ *
122
+ * Return the route branches for this router instance
123
+ */
124
+ get branches(): RouteBranch<DataRouteObject>[] | undefined;
125
+ /**
126
+ * @private
127
+ * PRIVATE - DO NOT USE
128
+ *
129
+ * Return the manifest for this router instance
130
+ */
131
+ get manifest(): RouteManifest;
118
132
  /**
119
133
  * @private
120
134
  * PRIVATE - DO NOT USE
@@ -362,7 +376,6 @@ type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "e
362
376
  * Future flags to toggle new feature behavior
363
377
  */
364
378
  interface FutureConfig {
365
- unstable_passThroughRequests: boolean;
366
379
  }
367
380
  /**
368
381
  * Initialization options for createRouter
@@ -372,7 +385,7 @@ interface RouterInit {
372
385
  history: History;
373
386
  basename?: string;
374
387
  getContext?: () => MaybePromise<RouterContextProvider>;
375
- unstable_instrumentations?: unstable_ClientInstrumentation[];
388
+ instrumentations?: ClientInstrumentation[];
376
389
  mapRouteProperties?: MapRoutePropertiesFunction;
377
390
  future?: Partial<FutureConfig>;
378
391
  hydrationRouteProperties?: string[];
@@ -400,7 +413,33 @@ interface StaticHandlerContext {
400
413
  * A StaticHandler instance manages a singular SSR navigation/fetch event
401
414
  */
402
415
  interface StaticHandler {
416
+ /**
417
+ * The set of data routes managed by this handler
418
+ */
403
419
  dataRoutes: DataRouteObject[];
420
+ /**
421
+ * @private
422
+ * PRIVATE - DO NOT USE
423
+ *
424
+ * The route branches derived from the data routes, used for internal route
425
+ * matching in Framework Mode
426
+ */
427
+ _internalRouteBranches: RouteBranch<DataRouteObject>[];
428
+ /**
429
+ * Perform a query for a given request - executing all matched route
430
+ * loaders/actions. Used for document requests.
431
+ *
432
+ * @param request The request to query
433
+ * @param opts Optional query options
434
+ * @param opts.dataStrategy Alternate dataStrategy implementation
435
+ * @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded
436
+ * @param opts.generateMiddlewareResponse To enable middleware, provide a function
437
+ * to generate a response to bubble back up the middleware chain
438
+ * @param opts.requestContext Context object to pass to loaders/actions
439
+ * @param opts.skipLoaderErrorBubbling Skip loader error bubbling
440
+ * @param opts.skipRevalidation Skip revalidation after action submission
441
+ * @param opts.normalizePath Normalize the request path
442
+ */
404
443
  query(request: Request, opts?: {
405
444
  requestContext?: unknown;
406
445
  filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
@@ -410,14 +449,27 @@ interface StaticHandler {
410
449
  generateMiddlewareResponse?: (query: (r: Request, args?: {
411
450
  filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
412
451
  }) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
413
- unstable_normalizePath?: (request: Request) => Path;
452
+ normalizePath?: (request: Request) => Path;
414
453
  }): Promise<StaticHandlerContext | Response>;
454
+ /**
455
+ * Perform a query for a specific route. Used for resource requests.
456
+ *
457
+ * @param request The request to query
458
+ * @param opts Optional queryRoute options
459
+ * @param opts.dataStrategy Alternate dataStrategy implementation
460
+ * @param opts.generateMiddlewareResponse To enable middleware, provide a function
461
+ * to generate a response to bubble back up the middleware chain
462
+ * @param opts.requestContext Context object to pass to loaders/actions
463
+ * @param opts.routeId The ID of the route to query
464
+ * @param opts.normalizePath Normalize the request path
465
+
466
+ */
415
467
  queryRoute(request: Request, opts?: {
416
468
  routeId?: string;
417
469
  requestContext?: unknown;
418
470
  dataStrategy?: DataStrategyFunction<unknown>;
419
471
  generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>;
420
- unstable_normalizePath?: (request: Request) => Path;
472
+ normalizePath?: (request: Request) => Path;
421
473
  }): Promise<any>;
422
474
  }
423
475
  type ViewTransitionOpts = {
@@ -461,14 +513,14 @@ type BaseNavigateOrFetchOptions = {
461
513
  preventScrollReset?: boolean;
462
514
  relative?: RelativeRoutingType;
463
515
  flushSync?: boolean;
464
- unstable_defaultShouldRevalidate?: boolean;
516
+ defaultShouldRevalidate?: boolean;
465
517
  };
466
518
  type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
467
519
  replace?: boolean;
468
520
  state?: any;
469
521
  fromRouteId?: string;
470
522
  viewTransition?: boolean;
471
- unstable_mask?: To;
523
+ mask?: To;
472
524
  };
473
525
  type BaseSubmissionOptions = {
474
526
  formMethod?: HTMLFormMethod;
@@ -651,7 +703,7 @@ declare function createRouter(init: RouterInit): Router$1;
651
703
  interface CreateStaticHandlerOptions {
652
704
  basename?: string;
653
705
  mapRouteProperties?: MapRoutePropertiesFunction;
654
- unstable_instrumentations?: Pick<unstable_ServerInstrumentation, "route">[];
706
+ instrumentations?: Pick<ServerInstrumentation, "route">[];
655
707
  future?: Partial<FutureConfig>;
656
708
  }
657
709
 
@@ -702,7 +754,7 @@ interface MemoryRouterOpts {
702
754
  *
703
755
  * ```tsx
704
756
  * let router = createBrowserRouter(routes, {
705
- * unstable_instrumentations: [logging]
757
+ * instrumentations: [logging]
706
758
  * });
707
759
  *
708
760
  *
@@ -740,7 +792,7 @@ interface MemoryRouterOpts {
740
792
  * }
741
793
  * ```
742
794
  */
743
- unstable_instrumentations?: unstable_ClientInstrumentation[];
795
+ instrumentations?: ClientInstrumentation[];
744
796
  /**
745
797
  * Override the default data strategy of running loaders in parallel -
746
798
  * see the [docs](../../how-to/data-strategy) for more information.
@@ -792,7 +844,7 @@ interface MemoryRouterOpts {
792
844
  * @param {MemoryRouterOpts.hydrationData} opts.hydrationData n/a
793
845
  * @param {MemoryRouterOpts.initialEntries} opts.initialEntries n/a
794
846
  * @param {MemoryRouterOpts.initialIndex} opts.initialIndex n/a
795
- * @param {MemoryRouterOpts.unstable_instrumentations} opts.unstable_instrumentations n/a
847
+ * @param {MemoryRouterOpts.instrumentations} opts.instrumentations n/a
796
848
  * @param {MemoryRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a
797
849
  * @returns An initialized {@link DataRouter} to pass to {@link RouterProvider | `<RouterProvider>`}
798
850
  */
@@ -805,7 +857,7 @@ interface ClientOnErrorFunction {
805
857
  (error: unknown, info: {
806
858
  location: Location;
807
859
  params: Params;
808
- unstable_pattern: string;
860
+ pattern: string;
809
861
  errorInfo?: React.ErrorInfo;
810
862
  }): void;
811
863
  }
@@ -839,7 +891,7 @@ interface RouterProviderProps {
839
891
  *
840
892
  * ```tsx
841
893
  * <RouterProvider onError=(error, info) => {
842
- * let { location, params, unstable_pattern, errorInfo } = info;
894
+ * let { location, params, pattern, errorInfo } = info;
843
895
  * console.error(error, location, errorInfo);
844
896
  * reportToErrorService(error, location, errorInfo);
845
897
  * }} />
@@ -862,9 +914,9 @@ interface RouterProviderProps {
862
914
  * - When set to `false`, the router will not leverage `React.startTransition` or
863
915
  * `React.useOptimistic` on any navigations or state changes.
864
916
  *
865
- * For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
917
+ * For more information, please see the [docs](../../explanation/react-transitions).
866
918
  */
867
- unstable_useTransitions?: boolean;
919
+ useTransitions?: boolean;
868
920
  }
869
921
  /**
870
922
  * Render the UI for the given {@link DataRouter}. This component should
@@ -895,10 +947,10 @@ interface RouterProviderProps {
895
947
  * @param {RouterProviderProps.flushSync} props.flushSync n/a
896
948
  * @param {RouterProviderProps.onError} props.onError n/a
897
949
  * @param {RouterProviderProps.router} props.router n/a
898
- * @param {RouterProviderProps.unstable_useTransitions} props.unstable_useTransitions n/a
950
+ * @param {RouterProviderProps.useTransitions} props.useTransitions n/a
899
951
  * @returns React element for the rendered router
900
952
  */
901
- declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, onError, unstable_useTransitions, }: RouterProviderProps): React.ReactElement;
953
+ declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, onError, useTransitions, }: RouterProviderProps): React.ReactElement;
902
954
  /**
903
955
  * @category Types
904
956
  */
@@ -931,9 +983,9 @@ interface MemoryRouterProps {
931
983
  * - When set to `false`, the router will not leverage `React.startTransition`
932
984
  * on any navigations or state changes.
933
985
  *
934
- * For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
986
+ * For more information, please see the [docs](../../explanation/react-transitions).
935
987
  */
936
- unstable_useTransitions?: boolean;
988
+ useTransitions?: boolean;
937
989
  }
938
990
  /**
939
991
  * A declarative {@link Router | `<Router>`} that stores all entries in memory.
@@ -946,11 +998,11 @@ interface MemoryRouterProps {
946
998
  * @param {MemoryRouterProps.children} props.children n/a
947
999
  * @param {MemoryRouterProps.initialEntries} props.initialEntries n/a
948
1000
  * @param {MemoryRouterProps.initialIndex} props.initialIndex n/a
949
- * @param {MemoryRouterProps.unstable_useTransitions} props.unstable_useTransitions n/a
1001
+ * @param {MemoryRouterProps.useTransitions} props.useTransitions n/a
950
1002
  * @returns A declarative in-memory {@link Router | `<Router>`} for client-side
951
1003
  * routing.
952
1004
  */
953
- declare function MemoryRouter({ basename, children, initialEntries, initialIndex, unstable_useTransitions, }: MemoryRouterProps): React.ReactElement;
1005
+ declare function MemoryRouter({ basename, children, initialEntries, initialIndex, useTransitions, }: MemoryRouterProps): React.ReactElement;
954
1006
  /**
955
1007
  * @category Types
956
1008
  */
@@ -1318,9 +1370,9 @@ interface RouterProps {
1318
1370
  * - When set to `false`, the router will not leverage `React.startTransition`
1319
1371
  * on any navigations or state changes.
1320
1372
  *
1321
- * For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
1373
+ * For more information, please see the [docs](../../explanation/react-transitions).
1322
1374
  */
1323
- unstable_useTransitions?: boolean;
1375
+ useTransitions?: boolean;
1324
1376
  }
1325
1377
  /**
1326
1378
  * Provides location context for the rest of the app.
@@ -1339,11 +1391,11 @@ interface RouterProps {
1339
1391
  * @param {RouterProps.navigationType} props.navigationType n/a
1340
1392
  * @param {RouterProps.navigator} props.navigator n/a
1341
1393
  * @param {RouterProps.static} props.static n/a
1342
- * @param {RouterProps.unstable_useTransitions} props.unstable_useTransitions n/a
1394
+ * @param {RouterProps.useTransitions} props.useTransitions n/a
1343
1395
  * @returns React element for the rendered router or `null` if the location does
1344
1396
  * not match the {@link props.basename}
1345
1397
  */
1346
- declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, unstable_useTransitions, }: RouterProps): React.ReactElement | null;
1398
+ declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, useTransitions, }: RouterProps): React.ReactElement | null;
1347
1399
  /**
1348
1400
  * @category Types
1349
1401
  */
@@ -1636,7 +1688,7 @@ declare function withErrorBoundaryProps(ErrorBoundary: ErrorBoundaryType): () =>
1636
1688
  error: unknown;
1637
1689
  }, string | React.JSXElementConstructor<any>>;
1638
1690
 
1639
- interface DataRouterContextObject extends Omit<NavigationContextObject, "future" | "unstable_useTransitions"> {
1691
+ interface DataRouterContextObject extends Omit<NavigationContextObject, "future" | "useTransitions"> {
1640
1692
  router: Router$1;
1641
1693
  staticContext?: StaticHandlerContext;
1642
1694
  onError?: ClientOnErrorFunction;
@@ -1660,7 +1712,7 @@ interface NavigateOptions {
1660
1712
  /** Replace the current entry in the history stack instead of pushing a new one */
1661
1713
  replace?: boolean;
1662
1714
  /** Masked URL */
1663
- unstable_mask?: To;
1715
+ mask?: To;
1664
1716
  /** Adds persistent client side routing state to the next location */
1665
1717
  state?: any;
1666
1718
  /** If you are using {@link ScrollRestoration `<ScrollRestoration>`}, prevent the scroll position from being reset to the top of the window when navigating */
@@ -1672,7 +1724,7 @@ interface NavigateOptions {
1672
1724
  /** Enables a {@link https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API View Transition} for this navigation by wrapping the final state update in `document.startViewTransition()`. If you need to apply specific styles for this view transition, you will also need to leverage the {@link useViewTransitionState `useViewTransitionState()`} hook. */
1673
1725
  viewTransition?: boolean;
1674
1726
  /** Specifies the default revalidation behavior after this submission */
1675
- unstable_defaultShouldRevalidate?: boolean;
1727
+ defaultShouldRevalidate?: boolean;
1676
1728
  }
1677
1729
  /**
1678
1730
  * A Navigator is a "location changer"; it's how you get to different locations.
@@ -1694,7 +1746,7 @@ interface NavigationContextObject {
1694
1746
  basename: string;
1695
1747
  navigator: Navigator;
1696
1748
  static: boolean;
1697
- unstable_useTransitions: boolean | undefined;
1749
+ useTransitions: boolean | undefined;
1698
1750
  future: {};
1699
1751
  }
1700
1752
  declare const NavigationContext: React.Context<NavigationContextObject>;
@@ -1710,4 +1762,4 @@ interface RouteContextObject {
1710
1762
  }
1711
1763
  declare const RouteContext: React.Context<RouteContextObject>;
1712
1764
 
1713
- export { createRoutesFromElements as $, AwaitContextProvider as A, type BlockerFunction as B, type ClientOnErrorFunction as C, type RouteProps as D, type RouterProps as E, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, IDLE_NAVIGATION as I, type RoutesProps as J, Await as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateOptions as N, type OutletProps as O, type PathRouteProps as P, MemoryRouter as Q, type RouterInit as R, type StaticHandler as S, Navigate as T, Outlet as U, Route as V, Router as W, RouterProvider as X, Routes as Y, createMemoryRouter as Z, createRoutesFromChildren as _, type RouterProviderProps as a, renderMatches as a0, createRouter as a1, DataRouterContext as a2, DataRouterStateContext as a3, FetchersContext as a4, LocationContext as a5, NavigationContext as a6, RouteContext as a7, ViewTransitionContext as a8, hydrationRouteProperties as a9, mapRouteProperties as aa, WithComponentProps as ab, withComponentProps as ac, WithHydrateFallbackProps as ad, withHydrateFallbackProps as ae, WithErrorBoundaryProps as af, withErrorBoundaryProps as ag, type FutureConfig as ah, type CreateStaticHandlerOptions as ai, type Router$1 as b, type Blocker as c, type RelativeRoutingType as d, type Navigation as e, type RouterState as f, type GetScrollRestorationKeyFunction as g, type StaticHandlerContext as h, type NavigationStates as i, type RouterSubscriber as j, type RouterNavigateOptions as k, type RouterFetchOptions as l, type RevalidationState as m, type unstable_ServerInstrumentation as n, type unstable_InstrumentRequestHandlerFunction as o, type unstable_InstrumentRouterFunction as p, type unstable_InstrumentRouteFunction as q, type unstable_InstrumentationHandlerResult as r, IDLE_FETCHER as s, IDLE_BLOCKER as t, type unstable_ClientInstrumentation as u, type Navigator as v, type AwaitProps as w, type IndexRouteProps as x, type MemoryRouterProps as y, type NavigateProps as z };
1765
+ export { createRoutesFromElements as $, AwaitContextProvider as A, type BlockerFunction as B, type ClientInstrumentation as C, type RouteProps as D, type RouterProps as E, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, type InstrumentRequestHandlerFunction as I, type RoutesProps as J, Await as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateOptions as N, type OutletProps as O, type PathRouteProps as P, MemoryRouter as Q, type RouterInit as R, type StaticHandler as S, Navigate as T, Outlet as U, Route as V, Router as W, RouterProvider as X, Routes as Y, createMemoryRouter as Z, createRoutesFromChildren as _, type RouterProviderProps as a, renderMatches as a0, createRouter as a1, DataRouterContext as a2, DataRouterStateContext as a3, FetchersContext as a4, LocationContext as a5, NavigationContext as a6, RouteContext as a7, ViewTransitionContext as a8, hydrationRouteProperties as a9, mapRouteProperties as aa, WithComponentProps as ab, withComponentProps as ac, WithHydrateFallbackProps as ad, withHydrateFallbackProps as ae, WithErrorBoundaryProps as af, withErrorBoundaryProps as ag, type FutureConfig as ah, type CreateStaticHandlerOptions as ai, type ClientOnErrorFunction as b, type Router$1 as c, type Blocker as d, type RelativeRoutingType as e, type Navigation as f, type RouterState as g, type GetScrollRestorationKeyFunction as h, type StaticHandlerContext as i, type NavigationStates as j, type RouterSubscriber as k, type RouterNavigateOptions as l, type RouterFetchOptions as m, type RevalidationState as n, type ServerInstrumentation as o, type InstrumentRouterFunction as p, type InstrumentRouteFunction as q, type InstrumentationHandlerResult as r, IDLE_NAVIGATION as s, IDLE_FETCHER as t, IDLE_BLOCKER as u, type Navigator as v, type AwaitProps as w, type IndexRouteProps as x, type MemoryRouterProps as y, type NavigateProps as z };
@@ -1,16 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ComponentType, ReactElement } from 'react';
3
3
 
4
- /**
5
- * An augmentable interface users can modify in their app-code to opt into
6
- * future-flag-specific types
7
- */
8
- interface Future {
9
- }
10
- type MiddlewareEnabled = Future extends {
11
- v8_middleware: infer T extends boolean;
12
- } ? T : false;
13
-
14
4
  /**
15
5
  * Actions represent the type of change to a location value.
16
6
  */
@@ -72,7 +62,7 @@ interface Location<State = any> extends Path {
72
62
  * The masked location displayed in the URL bar, which differs from the URL the
73
63
  * router is operating on
74
64
  */
75
- unstable_mask: Path | undefined;
65
+ mask?: Path;
76
66
  }
77
67
  /**
78
68
  * A change to the current location.
@@ -265,6 +255,16 @@ type UrlHistoryOptions = {
265
255
  v5Compat?: boolean;
266
256
  };
267
257
 
258
+ /**
259
+ * An augmentable interface users can modify in their app-code to opt into
260
+ * future-flag-specific types
261
+ */
262
+ interface Future {
263
+ }
264
+ type MiddlewareEnabled = Future extends {
265
+ v8_middleware: infer T extends boolean;
266
+ } ? T : false;
267
+
268
268
  type MaybePromise<T> = T | Promise<T>;
269
269
  /**
270
270
  * Map of routeId -> data returned from a loader/action/error
@@ -445,19 +445,19 @@ interface DataFunctionArgs<Context> {
445
445
  /** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read headers (like cookies, and {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} from the request. */
446
446
  request: Request;
447
447
  /**
448
- * A URL instance representing the application location being navigated to or fetched.
449
- * Without `future.unstable_passThroughRequests` enabled, this matches `request.url`.
450
- * With `future.unstable_passThroughRequests` enabled, this is a normalized
451
- * URL with React-Router-specific implementation details removed (`.data`
452
- * suffixes, `index`/`_routes` search params).
453
- * The URL includes the origin from the request for convenience.
448
+ * A URL instance representing the application location being navigated to or
449
+ * fetched. By default, this matches `request.url`.
450
+ *
451
+ * In Framework mode with `future.v8_passThroughRequests` enabled, this is a
452
+ * normalized URL with React-Router-specific implementation details removed
453
+ * (`.data` suffixes, `index`/`_routes` search params).
454
454
  */
455
- unstable_url: URL;
455
+ url: URL;
456
456
  /**
457
457
  * Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
458
458
  * Mostly useful as a identifier to aggregate on for logging/tracing/etc.
459
459
  */
460
- unstable_pattern: string;
460
+ pattern: string;
461
461
  /**
462
462
  * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
463
463
  * @example
@@ -846,13 +846,30 @@ type DataNonIndexRouteObject = NonIndexRouteObject & {
846
846
  type DataRouteObject = DataIndexRouteObject | DataNonIndexRouteObject;
847
847
  type RouteManifest<R = DataRouteObject> = Record<string, R | undefined>;
848
848
  type Regex_az = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
849
- type Regez_AZ = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z";
849
+ type Regex_AZ = Uppercase<Regex_az>;
850
850
  type Regex_09 = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
851
- type Regex_w = Regex_az | Regez_AZ | Regex_09 | "_";
852
- type ParamChar = Regex_w | "-";
853
- type RegexMatchPlus<CharPattern extends string, T extends string> = T extends `${infer First}${infer Rest}` ? First extends CharPattern ? RegexMatchPlus<CharPattern, Rest> extends never ? First : `${First}${RegexMatchPlus<CharPattern, Rest>}` : never : never;
854
- type _PathParam<Path extends string> = Path extends `${infer L}/${infer R}` ? _PathParam<L> | _PathParam<R> : Path extends `:${infer Param}` ? Param extends `${infer Optional}?${string}` ? RegexMatchPlus<ParamChar, Optional> : RegexMatchPlus<ParamChar, Param> : never;
855
- type PathParam<Path extends string> = Path extends "*" | "/*" ? "*" : Path extends `${infer Rest}/*` ? "*" | _PathParam<Rest> : _PathParam<Path>;
851
+ type Regex_w = Regex_az | Regex_AZ | Regex_09 | "_";
852
+ /** Emulates Regex `+` operator */
853
+ type RegexMatchPlus<char extends string, T extends string> = _RegexMatchPlus<char, T> extends infer result extends string ? result extends '' ? never : result : never;
854
+ type _RegexMatchPlus<char extends string, T extends string> = T extends `${infer head extends char}${infer rest}` ? `${head}${_RegexMatchPlus<char, rest>}` : '';
855
+ type ParamNameChar = Regex_w | "-";
856
+ type Simplify<T> = {
857
+ [K in keyof T]: T[K];
858
+ } & {};
859
+ type GeneratePathParams<path extends string> = Simplify<ParseParams<path> & {
860
+ [key in string]: string | null | undefined;
861
+ }>;
862
+ type ParseParams<path extends string> = path extends '*' ? {
863
+ '*': string;
864
+ } : path extends `${infer rest}/*` ? {
865
+ '*': string;
866
+ } & ParseParams<rest> : _ParseParams<path>;
867
+ type _ParseParams<path extends string> = path extends `${infer left}/${infer right}` ? _ParseParams<left> & _ParseParams<right> : path extends `:${infer param}?${string}` ? {
868
+ [key in RegexMatchPlus<ParamNameChar, param>]?: string | null | undefined;
869
+ } : path extends `:${infer param}` ? {
870
+ [key in RegexMatchPlus<ParamNameChar, param>]: string;
871
+ } : {};
872
+ type PathParam<path extends string> = (keyof ParseParams<path>) & string;
856
873
  type ParamParseKey<Segment extends string> = [
857
874
  PathParam<Segment>
858
875
  ] extends [never] ? string : PathParam<Segment>;
@@ -939,6 +956,24 @@ interface UIMatch<Data = unknown, Handle = unknown> {
939
956
  */
940
957
  handle: Handle;
941
958
  }
959
+ interface RouteMeta<RouteObjectType extends RouteObject = RouteObject> {
960
+ relativePath: string;
961
+ caseSensitive: boolean;
962
+ childrenIndex: number;
963
+ route: RouteObjectType;
964
+ }
965
+ /**
966
+ * @private
967
+ * PRIVATE - DO NOT USE
968
+ *
969
+ * A "branch" of routes that match a given route pattern.
970
+ * This is an internal interface not intended for direct external usage.
971
+ */
972
+ interface RouteBranch<RouteObjectType extends RouteObject = RouteObject> {
973
+ path: string;
974
+ score: number;
975
+ routesMeta: RouteMeta<RouteObjectType>[];
976
+ }
942
977
  /**
943
978
  * Returns a path with params interpolated.
944
979
  *
@@ -953,9 +988,7 @@ interface UIMatch<Data = unknown, Handle = unknown> {
953
988
  * @param params The parameters to interpolate into the path.
954
989
  * @returns The generated path with parameters interpolated.
955
990
  */
956
- declare function generatePath<Path extends string>(originalPath: Path, params?: {
957
- [key in PathParam<Path>]: string | null;
958
- }): string;
991
+ declare function generatePath<Path extends string>(originalPath: Path, params?: GeneratePathParams<Path>): string;
959
992
  /**
960
993
  * Used to match on some portion of a URL pathname.
961
994
  */
@@ -1011,7 +1044,7 @@ interface PathMatch<ParamKey extends string = string> {
1011
1044
  * @returns A path match object if the pattern matches the pathname,
1012
1045
  * or `null` if it does not match.
1013
1046
  */
1014
- declare function matchPath<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path, pathname: string): PathMatch<ParamKey> | null;
1047
+ declare function matchPath<Path extends string>(pattern: PathPattern<Path> | Path, pathname: string): PathMatch<ParamParseKey<Path>> | null;
1015
1048
  /**
1016
1049
  * Returns a resolved {@link Path} object relative to the given pathname.
1017
1050
  *
@@ -1199,16 +1232,6 @@ declare class ErrorResponseImpl implements ErrorResponse {
1199
1232
  */
1200
1233
  declare function isRouteErrorResponse(error: any): error is ErrorResponse;
1201
1234
 
1202
- /**
1203
- * An object of unknown type for route loaders and actions provided by the
1204
- * server's `getLoadContext()` function. This is defined as an empty interface
1205
- * specifically so apps can leverage declaration merging to augment this type
1206
- * globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
1207
- */
1208
- interface AppLoadContext {
1209
- [key: string]: unknown;
1210
- }
1211
-
1212
1235
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
1213
1236
  type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
1214
1237
  interface HtmlLinkProps {
@@ -1380,14 +1403,14 @@ type ClientDataFunctionArgs<Params> = {
1380
1403
  **/
1381
1404
  request: Request;
1382
1405
  /**
1383
- * A URL instance representing the application location being navigated to or fetched.
1384
- * Without `future.unstable_passThroughRequests` enabled, this matches `request.url`.
1385
- * With `future.unstable_passThroughRequests` enabled, this is a normalized
1386
- * URL with React-Router-specific implementation details removed (`.data`
1387
- * pathnames, `index`/`_routes` search params).
1388
- * The URL includes the origin from the request for convenience.
1406
+ * A URL instance representing the application location being navigated to or
1407
+ * fetched. By default, this matches `request.url`.
1408
+ *
1409
+ * In Framework mode with `future.v8_passThroughRequests` enabled, this is a
1410
+ * normalized URL with React-Router-specific implementation details removed
1411
+ * (`.data` suffixes, `index`/`_routes` search params).
1389
1412
  */
1390
- unstable_url: URL;
1413
+ url: URL;
1391
1414
  /**
1392
1415
  * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
1393
1416
  * @example
@@ -1407,7 +1430,7 @@ type ClientDataFunctionArgs<Params> = {
1407
1430
  * Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
1408
1431
  * Mostly useful as a identifier to aggregate on for logging/tracing/etc.
1409
1432
  */
1410
- unstable_pattern: string;
1433
+ pattern: string;
1411
1434
  /**
1412
1435
  * When `future.v8_middleware` is not enabled, this is undefined.
1413
1436
  *
@@ -1422,14 +1445,14 @@ type ServerDataFunctionArgs<Params> = {
1422
1445
  /** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the url, method, headers (such as cookies), and request body from the request. */
1423
1446
  request: Request;
1424
1447
  /**
1425
- * A URL instance representing the application location being navigated to or fetched.
1426
- * Without `future.unstable_passThroughRequests` enabled, this matches `request.url`.
1427
- * With `future.unstable_passThroughRequests` enabled, this is a normalized
1428
- * URL with React-Router-specific implementation details removed (`.data`
1429
- * pathnames, `index`/`_routes` search params).
1430
- * The URL includes the origin from the request for convenience.
1448
+ * A URL instance representing the application location being navigated to or
1449
+ * fetched. By default, this matches `request.url`.
1450
+ *
1451
+ * In Framework mode with `future.v8_passThroughRequests` enabled, this is a
1452
+ * normalized URL with React-Router-specific implementation details removed
1453
+ * (`.data` suffixes, `index`/`_routes` search params).
1431
1454
  */
1432
- unstable_url: URL;
1455
+ url: URL;
1433
1456
  /**
1434
1457
  * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
1435
1458
  * @example
@@ -1449,7 +1472,7 @@ type ServerDataFunctionArgs<Params> = {
1449
1472
  * Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
1450
1473
  * Mostly useful as a identifier to aggregate on for logging/tracing/etc.
1451
1474
  */
1452
- unstable_pattern: string;
1475
+ pattern: string;
1453
1476
  /**
1454
1477
  * Without `future.v8_middleware` enabled, this is the context passed in
1455
1478
  * to your server adapter's `getLoadContext` function. It's a way to bridge the
@@ -1696,4 +1719,14 @@ type RouteComponent = ComponentType<{}>;
1696
1719
  */
1697
1720
  type RouteHandle = unknown;
1698
1721
 
1699
- export { type BaseRouteObject as $, type ActionFunction as A, type DataStrategyResult as B, type ClientActionFunction as C, type DataRouteMatch as D, type ServerDataFrom as E, type FormEncType as F, type GetLoaderData as G, type HeadersFunction as H, type GetActionData as I, type RouteModules as J, type SerializeFrom as K, type Location as L, type MetaFunction as M, type Normalize as N, type ParamParseKey as O, type Params as P, type PathPattern as Q, type RouteModule$1 as R, type ShouldRevalidateFunction as S, type To as T, type UIMatch as U, type PathMatch as V, type InitialEntry as W, type IndexRouteObject as X, type NonIndexRouteObject as Y, type Equal as Z, type ActionFunctionArgs as _, type ClientLoaderFunction as a, type DataStrategyFunctionArgs as a0, type DataStrategyMatch as a1, DataWithResponseInit as a2, type ErrorResponse as a3, type FormMethod as a4, type LazyRouteFunction as a5, type MiddlewareFunction as a6, type PatchRoutesOnNavigationFunctionArgs as a7, type PathParam as a8, type RedirectFunction as a9, invariant as aA, ErrorResponseImpl as aB, type RouteManifest as aC, type ServerRouteModule as aD, type TrackedPromise as aE, type RouteMatch as aa, type RouterContext as ab, type ShouldRevalidateFunctionArgs as ac, createContext as ad, createPath as ae, parsePath as af, data as ag, generatePath as ah, isRouteErrorResponse as ai, matchPath as aj, matchRoutes as ak, redirect as al, redirectDocument as am, replace as an, resolvePath as ao, type ClientActionFunctionArgs as ap, type ClientLoaderFunctionArgs as aq, type HeadersArgs as ar, type MetaArgs as as, type PageLinkDescriptor as at, type HtmlLinkDescriptor as au, type Future as av, type unstable_SerializesTo as aw, createMemoryHistory as ax, createBrowserHistory as ay, createHashHistory as az, type LinksFunction as b, RouterContextProvider as c, type LoaderFunction as d, type RouteObject as e, type History as f, type MaybePromise as g, type MapRoutePropertiesFunction as h, Action as i, type Submission as j, type RouteData as k, type DataStrategyFunction as l, type PatchRoutesOnNavigationFunction as m, type DataRouteObject as n, type HTMLFormMethod as o, type Path as p, type LoaderFunctionArgs as q, type MiddlewareEnabled as r, type AppLoadContext as s, type LinkDescriptor as t, type Func as u, type Pretty as v, type MetaDescriptor as w, type ServerDataFunctionArgs as x, type MiddlewareNextFunction as y, type ClientDataFunctionArgs as z };
1722
+ /**
1723
+ * An object of unknown type for route loaders and actions provided by the
1724
+ * server's `getLoadContext()` function. This is defined as an empty interface
1725
+ * specifically so apps can leverage declaration merging to augment this type
1726
+ * globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
1727
+ */
1728
+ interface AppLoadContext {
1729
+ [key: string]: unknown;
1730
+ }
1731
+
1732
+ export { type PathPattern as $, type ActionFunction as A, type PatchRoutesOnNavigationFunction as B, type ClientActionFunction as C, type DataStrategyResult as D, type DataRouteObject as E, type Func as F, type GetLoaderData as G, type HeadersFunction as H, type RouteBranch as I, type RouteManifest as J, type Path as K, type Location as L, type MetaFunction as M, type Normalize as N, type InitialEntry as O, type Params as P, type NonIndexRouteObject as Q, type RouteModule$1 as R, type ShouldRevalidateFunction as S, type To as T, type UIMatch as U, type LazyRouteFunction as V, type IndexRouteObject as W, type RouteMatch as X, type TrackedPromise as Y, type RouteModules as Z, type SerializeFrom as _, type ClientLoaderFunction as a, type PathMatch as a0, type ParamParseKey as a1, type Equal as a2, type ActionFunctionArgs as a3, type BaseRouteObject as a4, type DataStrategyFunctionArgs as a5, type DataStrategyMatch as a6, DataWithResponseInit as a7, type ErrorResponse as a8, type FormMethod as a9, createMemoryHistory as aA, createBrowserHistory as aB, createHashHistory as aC, invariant as aD, ErrorResponseImpl as aE, type ServerRouteModule as aF, type MiddlewareFunction as aa, type PatchRoutesOnNavigationFunctionArgs as ab, type PathParam as ac, type RedirectFunction as ad, type RouterContext as ae, type ShouldRevalidateFunctionArgs as af, createContext as ag, createPath as ah, parsePath as ai, data as aj, generatePath as ak, isRouteErrorResponse as al, matchPath as am, matchRoutes as an, redirect as ao, redirectDocument as ap, replace as aq, resolvePath as ar, type ClientActionFunctionArgs as as, type ClientLoaderFunctionArgs as at, type HeadersArgs as au, type MetaArgs as av, type PageLinkDescriptor as aw, type HtmlLinkDescriptor as ax, type Future as ay, type unstable_SerializesTo as az, type LinksFunction as b, RouterContextProvider as c, type LoaderFunction as d, type LinkDescriptor as e, type Pretty as f, type MetaDescriptor as g, type ServerDataFunctionArgs as h, type MiddlewareNextFunction as i, type ClientDataFunctionArgs as j, type ServerDataFrom as k, type GetActionData as l, type HTMLFormMethod as m, type FormEncType as n, type LoaderFunctionArgs as o, type MiddlewareEnabled as p, type AppLoadContext as q, type RouteObject as r, type History as s, type MaybePromise as t, type MapRoutePropertiesFunction as u, Action as v, type DataRouteMatch as w, type Submission as x, type RouteData as y, type DataStrategyFunction as z };