react-router 0.0.0-experimental-2a6c7bc → 0.0.0-experimental-e89ad3012

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 (61) hide show
  1. package/dist/development/{chunk-VEWXUMGM.mjs → chunk-3O4L5GVQ.mjs} +90 -125
  2. package/dist/development/{chunk-JRLTRGBE.js → chunk-JJHCVRDZ.js} +89 -124
  3. package/dist/development/{chunk-GSZ4XTPZ.js → chunk-ROJMZUUV.js} +130 -130
  4. package/dist/{production/chunk-ATNMTWNA.mjs → development/chunk-XKV32KFX.mjs} +157 -141
  5. package/dist/development/{components-CFzgj3gZ.d.mts → components-BkK38HPd.d.mts} +16 -16
  6. package/dist/development/{context-AvZz33Zq.d.mts → context-CphUWOpx.d.mts} +238 -22
  7. package/dist/development/dom-export.d.mts +3 -3
  8. package/dist/development/dom-export.d.ts +1 -1
  9. package/dist/development/dom-export.js +3 -3
  10. package/dist/development/dom-export.mjs +3 -3
  11. package/dist/{production/index-react-server-client-DIZWnqdE.d.ts → development/index-react-server-client-D-lyvxf_.d.ts} +25 -26
  12. package/dist/{production/index-react-server-client-BuCmY0hu.d.mts → development/index-react-server-client-pe1TAKAq.d.mts} +12 -13
  13. package/dist/development/index-react-server-client.d.mts +4 -4
  14. package/dist/development/index-react-server-client.d.ts +2 -2
  15. package/dist/development/index-react-server-client.js +4 -4
  16. package/dist/development/index-react-server-client.mjs +2 -2
  17. package/dist/development/index-react-server.d.mts +193 -14
  18. package/dist/development/index-react-server.d.ts +193 -14
  19. package/dist/development/index-react-server.js +115 -147
  20. package/dist/development/index-react-server.mjs +115 -147
  21. package/dist/development/index.d.mts +8 -8
  22. package/dist/development/index.d.ts +4 -4
  23. package/dist/development/index.js +240 -224
  24. package/dist/development/index.mjs +3 -3
  25. package/dist/development/lib/types/internal.d.mts +2 -2
  26. package/dist/development/lib/types/internal.d.ts +1 -1
  27. package/dist/development/lib/types/internal.js +1 -1
  28. package/dist/development/lib/types/internal.mjs +1 -1
  29. package/dist/development/{route-data-BnrIwdAP.d.mts → route-data-DJXZgnJq.d.mts} +1 -1
  30. package/dist/development/{routeModules-BbH0xTnc.d.ts → routeModules-DH3xUx4Z.d.ts} +238 -22
  31. package/dist/{development/chunk-M2KD4YIT.mjs → production/chunk-J6PLTU3O.mjs} +157 -141
  32. package/dist/production/{chunk-3UOGQQWX.js → chunk-NFNPXIQE.js} +89 -124
  33. package/dist/production/{chunk-P2JVUBYL.mjs → chunk-QI3NR5VQ.mjs} +90 -125
  34. package/dist/production/{chunk-ZIOZTUIH.js → chunk-X3M2F3OK.js} +130 -130
  35. package/dist/production/{components-CFzgj3gZ.d.mts → components-BkK38HPd.d.mts} +16 -16
  36. package/dist/production/{context-AvZz33Zq.d.mts → context-CphUWOpx.d.mts} +238 -22
  37. package/dist/production/dom-export.d.mts +3 -3
  38. package/dist/production/dom-export.d.ts +1 -1
  39. package/dist/production/dom-export.js +3 -3
  40. package/dist/production/dom-export.mjs +3 -3
  41. package/dist/{development/index-react-server-client-DIZWnqdE.d.ts → production/index-react-server-client-D-lyvxf_.d.ts} +25 -26
  42. package/dist/{development/index-react-server-client-BuCmY0hu.d.mts → production/index-react-server-client-pe1TAKAq.d.mts} +12 -13
  43. package/dist/production/index-react-server-client.d.mts +4 -4
  44. package/dist/production/index-react-server-client.d.ts +2 -2
  45. package/dist/production/index-react-server-client.js +4 -4
  46. package/dist/production/index-react-server-client.mjs +2 -2
  47. package/dist/production/index-react-server.d.mts +193 -14
  48. package/dist/production/index-react-server.d.ts +193 -14
  49. package/dist/production/index-react-server.js +115 -147
  50. package/dist/production/index-react-server.mjs +115 -147
  51. package/dist/production/index.d.mts +8 -8
  52. package/dist/production/index.d.ts +4 -4
  53. package/dist/production/index.js +240 -224
  54. package/dist/production/index.mjs +3 -3
  55. package/dist/production/lib/types/internal.d.mts +2 -2
  56. package/dist/production/lib/types/internal.d.ts +1 -1
  57. package/dist/production/lib/types/internal.js +1 -1
  58. package/dist/production/lib/types/internal.mjs +1 -1
  59. package/dist/production/{route-data-BnrIwdAP.d.mts → route-data-DJXZgnJq.d.mts} +1 -1
  60. package/dist/production/{routeModules-BbH0xTnc.d.ts → routeModules-DH3xUx4Z.d.ts} +238 -22
  61. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { I as InitialEntry, T as To, i as RelativeRoutingType, w as NonIndexRouteObject, af as LazyRouteFunction, q as IndexRouteObject, a as Location, A as Action, aC as Navigator, d as Router$1, Q as RouterInit, aY as FutureConfig$1, H as HydrationState, D as DataStrategyFunction, W as PatchRoutesOnNavigationFunction, p as RouteObject, aE as RouteMatch, o as Params, U as UIMatch, ae as HTMLFormMethod, ac as FormEncType, aZ as RouteManifest, a_ as ServerRouteModule, z as MiddlewareEnabled, y as unstable_RouterContextProvider, x as AppLoadContext, ag as LoaderFunctionArgs, a6 as ActionFunctionArgs, e as RouteModules, X as DataRouteObject, J as ClientLoaderFunction, $ as StaticHandlerContext, aJ as PageLinkDescriptor, a$ as History, _ as GetScrollRestorationKeyFunction, f as NavigateOptions, a0 as Fetcher, h as SerializeFrom, B as BlockerFunction, b0 as CreateStaticHandlerOptions$1, Y as StaticHandler } from './routeModules-BbH0xTnc.js';
1
+ import { I as InitialEntry, T as To, i as RelativeRoutingType, w as NonIndexRouteObject, af as LazyRouteFunction, q as IndexRouteObject, a as Location, A as Action, aC as Navigator, d as Router$1, Q as RouterInit, aY as FutureConfig$1, H as HydrationState, D as DataStrategyFunction, W as PatchRoutesOnNavigationFunction, p as RouteObject, aE as RouteMatch, o as Params, U as UIMatch, ae as HTMLFormMethod, ac as FormEncType, aZ as RouteManifest, a_ as ServerRouteModule, z as MiddlewareEnabled, y as unstable_RouterContextProvider, x as AppLoadContext, ag as LoaderFunctionArgs, a6 as ActionFunctionArgs, e as RouteModules, X as DataRouteObject, J as ClientLoaderFunction, $ as StaticHandlerContext, aJ as PageLinkDescriptor, a$ as History, _ as GetScrollRestorationKeyFunction, f as NavigateOptions, a0 as Fetcher, h as SerializeFrom, B as BlockerFunction, b0 as CreateStaticHandlerOptions$1, Y as StaticHandler } from './routeModules-DH3xUx4Z.js';
2
2
  import * as React from 'react';
3
3
 
4
4
  declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & {
@@ -32,7 +32,7 @@ interface MemoryRouterOpts {
32
32
  */
33
33
  initialEntries?: InitialEntry[];
34
34
  /**
35
- * Index of {@link initialEntries} the application should initialize to
35
+ * Index of `initialEntries` the application should initialize to
36
36
  */
37
37
  initialIndex?: number;
38
38
  /**
@@ -133,7 +133,7 @@ interface MemoryRouterProps {
133
133
  */
134
134
  initialEntries?: InitialEntry[];
135
135
  /**
136
- * Index of {@link initialEntries} the application should initialize to
136
+ * Index of `initialEntries` the application should initialize to
137
137
  */
138
138
  initialIndex?: number;
139
139
  }
@@ -170,7 +170,7 @@ interface NavigateProps {
170
170
  */
171
171
  state?: any;
172
172
  /**
173
- * How to interpret relative routing in the {@link to} prop.
173
+ * How to interpret relative routing in the `to` prop.
174
174
  * See {@link RelativeRoutingType}.
175
175
  */
176
176
  relative?: RelativeRoutingType;
@@ -288,32 +288,32 @@ interface PathRouteProps {
288
288
  children?: React.ReactNode;
289
289
  /**
290
290
  * The React element to render when this Route matches.
291
- * Mutually exclusive with {@link Component}.
291
+ * Mutually exclusive with `Component`.
292
292
  */
293
293
  element?: React.ReactNode | null;
294
294
  /**
295
295
  * The React element to render while this router is loading data.
296
- * Mutually exclusive with {@link HydrateFallback}.
296
+ * Mutually exclusive with `HydrateFallback`.
297
297
  */
298
298
  hydrateFallbackElement?: React.ReactNode | null;
299
299
  /**
300
300
  * The React element to render at this route if an error occurs.
301
- * Mutually exclusive with {@link ErrorBoundary}.
301
+ * Mutually exclusive with `ErrorBoundary`.
302
302
  */
303
303
  errorElement?: React.ReactNode | null;
304
304
  /**
305
305
  * The React Component to render when this route matches.
306
- * Mutually exclusive with {@link element}.
306
+ * Mutually exclusive with `element`.
307
307
  */
308
308
  Component?: React.ComponentType | null;
309
309
  /**
310
310
  * The React Component to render while this router is loading data.
311
- * Mutually exclusive with {@link hydrateFallbackElement}.
311
+ * Mutually exclusive with `hydrateFallbackElement`.
312
312
  */
313
313
  HydrateFallback?: React.ComponentType | null;
314
314
  /**
315
315
  * The React Component to render at this route if an error occurs.
316
- * Mutually exclusive with {@link errorElement}.
316
+ * Mutually exclusive with `errorElement`.
317
317
  */
318
318
  ErrorBoundary?: React.ComponentType | null;
319
319
  }
@@ -375,32 +375,32 @@ interface IndexRouteProps {
375
375
  children?: undefined;
376
376
  /**
377
377
  * The React element to render when this Route matches.
378
- * Mutually exclusive with {@link Component}.
378
+ * Mutually exclusive with `Component`.
379
379
  */
380
380
  element?: React.ReactNode | null;
381
381
  /**
382
382
  * The React element to render while this router is loading data.
383
- * Mutually exclusive with {@link HydrateFallback}.
383
+ * Mutually exclusive with `HydrateFallback`.
384
384
  */
385
385
  hydrateFallbackElement?: React.ReactNode | null;
386
386
  /**
387
387
  * The React element to render at this route if an error occurs.
388
- * Mutually exclusive with {@link ErrorBoundary}.
388
+ * Mutually exclusive with `ErrorBoundary`.
389
389
  */
390
390
  errorElement?: React.ReactNode | null;
391
391
  /**
392
392
  * The React Component to render when this route matches.
393
- * Mutually exclusive with {@link element}.
393
+ * Mutually exclusive with `element`.
394
394
  */
395
395
  Component?: React.ComponentType | null;
396
396
  /**
397
397
  * The React Component to render while this router is loading data.
398
- * Mutually exclusive with {@link hydrateFallbackElement}.
398
+ * Mutually exclusive with `hydrateFallbackElement`.
399
399
  */
400
400
  HydrateFallback?: React.ComponentType | null;
401
401
  /**
402
402
  * The React Component to render at this route if an error occurs.
403
- * Mutually exclusive with {@link errorElement}.
403
+ * Mutually exclusive with `errorElement`.
404
404
  */
405
405
  ErrorBoundary?: React.ComponentType | null;
406
406
  }
@@ -1268,7 +1268,7 @@ interface DOMRouterOpts {
1268
1268
  * [`clientLoader`](../../start/framework/route-module#clientLoader)), you may
1269
1269
  * want to include `loaderData` for only some routes that were loaded/rendered
1270
1270
  * on the server. This allows you to hydrate _some_ of the routes (such as the
1271
- * app layout/shell) while showing a {@link PathRouteProps.HydrateFallback | `HydrateFallback`}
1271
+ * app layout/shell) while showing a `HydrateFallback`
1272
1272
  * component and running the [`loader`](../../start/data/route-object#loader)s
1273
1273
  * for other routes during hydration.
1274
1274
  *
@@ -1276,8 +1276,7 @@ interface DOMRouterOpts {
1276
1276
  * hydration in two scenarios:
1277
1277
  *
1278
1278
  * 1. No hydration data is provided
1279
- * In these cases the {@link PathRouteProps.HydrateFallback | `HydrateFallback`}
1280
- * component will render on initial hydration
1279
+ * In these cases the `HydrateFallback` component will render on initial hydration
1281
1280
  * 2. The `loader.hydrate` property is set to `true`
1282
1281
  * This allows you to run the [`loader`](../../start/data/route-object#loader)
1283
1282
  * even if you did not render a fallback on initial hydration (i.e., to
@@ -1339,9 +1338,9 @@ interface DOMRouterOpts {
1339
1338
  *
1340
1339
  * The `dataStrategy` function should return a key/value-object of
1341
1340
  * `routeId` -> {@link DataStrategyResult} and should include entries for any
1342
- * routes where a handler was executed. A {@link DataStrategyResult} indicates
1343
- * if the handler was successful or not based on the {@link DataStrategyResult.type}
1344
- * field. If the returned {@link DataStrategyResult.result} is a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response),
1341
+ * routes where a handler was executed. A `DataStrategyResult` indicates
1342
+ * if the handler was successful or not based on the `DataStrategyResult.type`
1343
+ * field. If the returned `DataStrategyResult.result` is a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response),
1345
1344
  * React Router will unwrap it for you (via [`res.json`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json)
1346
1345
  * or [`res.text`](https://developer.mozilla.org/en-US/docs/Web/API/Response/text)).
1347
1346
  * If you need to do custom decoding of a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
@@ -1361,7 +1360,7 @@ interface DOMRouterOpts {
1361
1360
  * let router = createBrowserRouter(routes, {
1362
1361
  * async dataStrategy({ matches, request }) {
1363
1362
  * const matchesToLoad = matches.filter((m) => m.shouldLoad);
1364
- * const results = {};
1363
+ * const results: Record<string, DataStrategyResult> = {};
1365
1364
  * await Promise.all(
1366
1365
  * matchesToLoad.map(async (match) => {
1367
1366
  * console.log(`Processing ${match.route.id}`);
@@ -1535,7 +1534,7 @@ interface DOMRouterOpts {
1535
1534
  *
1536
1535
  * `patchRoutesOnNavigation` will be called anytime React Router is unable to
1537
1536
  * match a `path`. The arguments include the `path`, any partial
1538
- * {@link RouteMatch | `matches`}, and a `patch` function you can call to patch
1537
+ * `matches`, and a `patch` function you can call to patch
1539
1538
  * new routes into the tree at a specific location. This method is executed
1540
1539
  * during the `loading` portion of the navigation for `GET` requests and during
1541
1540
  * the `submitting` portion of the navigation for non-`GET` requests.
@@ -1638,7 +1637,7 @@ interface DOMRouterOpts {
1638
1637
  * **Co-locating route discovery with route definition**
1639
1638
  *
1640
1639
  * If you don't wish to perform your own pseudo-matching, you can leverage
1641
- * the partial {@link RouteMatch | `matches`} array and the [`handle`](../../start/data/route-object#handle)
1640
+ * the partial `matches` array and the [`handle`](../../start/data/route-object#handle)
1642
1641
  * field on a route to keep the children definitions co-located:
1643
1642
  *
1644
1643
  * ```tsx
@@ -3289,4 +3288,4 @@ declare function createStaticRouter(routes: RouteObject[], context: StaticHandle
3289
3288
  future?: Partial<FutureConfig$1>;
3290
3289
  }): Router$1;
3291
3290
 
3292
- export { ScrollRestoration as $, type AssetsManifest as A, type BrowserRouterProps as B, type ScrollRestorationProps as C, type DOMRouterOpts as D, type EntryContext as E, type FutureConfig as F, type SetURLSearchParams as G, type HydrateFallbackType as H, type IndexRouteProps as I, type SubmitFunction as J, type FetcherSubmitFunction as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateProps as N, type OutletProps as O, type PathRouteProps as P, type FetcherWithComponents as Q, type RouteComponentType as R, type ServerBuild as S, createBrowserRouter as T, createHashRouter as U, BrowserRouter as V, HashRouter as W, Link as X, HistoryRouter as Y, NavLink as Z, Form as _, type ErrorBoundaryType as a, useLinkClickHandler as a0, useSearchParams as a1, useSubmit as a2, useFormAction as a3, useFetcher as a4, useFetchers as a5, useBeforeUnload as a6, usePrompt as a7, useViewTransitionState as a8, type FetcherSubmitOptions as a9, WithHydrateFallbackProps as aA, withHydrateFallbackProps as aB, WithErrorBoundaryProps as aC, withErrorBoundaryProps as aD, FrameworkContext as aE, createClientRoutes as aF, createClientRoutesWithHMRRevalidationOptOut as aG, shouldHydrateRouteLoader as aH, useScrollRestoration as aI, type ParamKeyValuePair as aa, type SubmitOptions as ab, type URLSearchParamsInit as ac, type SubmitTarget as ad, createSearchParams as ae, type StaticRouterProps as af, type StaticRouterProviderProps as ag, createStaticHandler as ah, createStaticRouter as ai, StaticRouter as aj, StaticRouterProvider as ak, Meta as al, Links as am, Scripts as an, PrefetchPageLinks as ao, type ScriptsProps as ap, type PrefetchBehavior as aq, type DiscoverBehavior as ar, type HandleDataRequestFunction as as, type HandleDocumentRequestFunction as at, type HandleErrorFunction as au, type ServerEntryModule as av, hydrationRouteProperties as aw, mapRouteProperties as ax, WithComponentProps as ay, withComponentProps as az, type AwaitProps as b, type MemoryRouterProps as c, type RouteProps as d, type RouterProps as e, type RouterProviderProps as f, type RoutesProps as g, Await as h, MemoryRouter as i, Navigate as j, Outlet as k, Route$1 as l, Router as m, RouterProvider as n, Routes as o, createMemoryRouter as p, createRoutesFromChildren as q, createRoutesFromElements as r, renderMatches as s, type HashRouterProps as t, type HistoryRouterProps as u, type LinkProps as v, type NavLinkProps as w, type NavLinkRenderProps as x, type FetcherFormProps as y, type FormProps as z };
3291
+ export { ScrollRestoration as $, type AssetsManifest as A, type BrowserRouterProps as B, type ScrollRestorationProps as C, type DOMRouterOpts as D, type EntryContext as E, type FutureConfig as F, type SetURLSearchParams as G, type HydrateFallbackType as H, type IndexRouteProps as I, type SubmitFunction as J, type FetcherSubmitFunction as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateProps as N, type OutletProps as O, type PathRouteProps as P, type FetcherWithComponents as Q, type RouteComponentType as R, type ServerBuild as S, createBrowserRouter as T, createHashRouter as U, BrowserRouter as V, HashRouter as W, Link as X, HistoryRouter as Y, NavLink as Z, Form as _, type ErrorBoundaryType as a, useLinkClickHandler as a0, useSearchParams as a1, useSubmit as a2, useFormAction as a3, useFetcher as a4, useFetchers as a5, useBeforeUnload as a6, usePrompt as a7, useViewTransitionState as a8, type FetcherSubmitOptions as a9, withComponentProps as aA, WithHydrateFallbackProps as aB, withHydrateFallbackProps as aC, WithErrorBoundaryProps as aD, withErrorBoundaryProps as aE, FrameworkContext as aF, createClientRoutes as aG, createClientRoutesWithHMRRevalidationOptOut as aH, shouldHydrateRouteLoader as aI, useScrollRestoration as aJ, type ParamKeyValuePair as aa, type SubmitOptions as ab, type URLSearchParamsInit as ac, type SubmitTarget as ad, createSearchParams as ae, type StaticRouterProps as af, type StaticRouterProviderProps as ag, createStaticHandler as ah, createStaticRouter as ai, StaticRouter as aj, StaticRouterProvider as ak, Meta as al, Links as am, Scripts as an, PrefetchPageLinks as ao, type LinksProps as ap, type ScriptsProps as aq, type PrefetchBehavior as ar, type DiscoverBehavior as as, type HandleDataRequestFunction as at, type HandleDocumentRequestFunction as au, type HandleErrorFunction as av, type ServerEntryModule as aw, hydrationRouteProperties as ax, mapRouteProperties as ay, WithComponentProps as az, type AwaitProps as b, type MemoryRouterProps as c, type RouteProps as d, type RouterProps as e, type RouterProviderProps as f, type RoutesProps as g, Await as h, MemoryRouter as i, Navigate as j, Outlet as k, Route$1 as l, Router as m, RouterProvider as n, Routes as o, createMemoryRouter as p, createRoutesFromChildren as q, createRoutesFromElements as r, renderMatches as s, type HashRouterProps as t, type HistoryRouterProps as u, type LinkProps as v, type NavLinkProps as w, type NavLinkRenderProps as x, type FetcherFormProps as y, type FormProps as z };
@@ -1,7 +1,7 @@
1
- import './components-CFzgj3gZ.mjs';
1
+ import './components-BkK38HPd.mjs';
2
2
  import * as React from 'react';
3
- import { az as RouteManifest, M as MiddlewareEnabled, o as unstable_RouterContextProvider, j as LoaderFunctionArgs, i as ActionFunctionArgs, J as StaticHandlerContext, H as HydrationState, z as DataRouteObject, a2 as HTMLFormMethod, a0 as FormEncType, a as RelativeRoutingType, T as To, aA as History, E as GetScrollRestorationKeyFunction, e as RouterInit, F as FutureConfig$1, D as DataStrategyFunction, P as PatchRoutesOnNavigationFunction, q as NavigateOptions, K as Fetcher, f as RouteObject, R as Router, B as BlockerFunction, c as Location, aB as CreateStaticHandlerOptions$1, C as StaticHandler } from './context-AvZz33Zq.mjs';
4
- import { o as ServerRouteModule, A as AppLoadContext, c as RouteModules, h as ClientLoaderFunction, m as PageLinkDescriptor, d as SerializeFrom } from './route-data-BnrIwdAP.mjs';
3
+ import { az as RouteManifest, M as MiddlewareEnabled, o as unstable_RouterContextProvider, j as LoaderFunctionArgs, i as ActionFunctionArgs, J as StaticHandlerContext, H as HydrationState, z as DataRouteObject, a2 as HTMLFormMethod, a0 as FormEncType, a as RelativeRoutingType, T as To, aA as History, E as GetScrollRestorationKeyFunction, e as RouterInit, F as FutureConfig$1, D as DataStrategyFunction, P as PatchRoutesOnNavigationFunction, q as NavigateOptions, K as Fetcher, f as RouteObject, R as Router, B as BlockerFunction, c as Location, aB as CreateStaticHandlerOptions$1, C as StaticHandler } from './context-CphUWOpx.mjs';
4
+ import { o as ServerRouteModule, A as AppLoadContext, c as RouteModules, h as ClientLoaderFunction, m as PageLinkDescriptor, d as SerializeFrom } from './route-data-DJXZgnJq.mjs';
5
5
 
6
6
  type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
7
7
  interface ServerRoute extends Route {
@@ -463,7 +463,7 @@ interface DOMRouterOpts {
463
463
  * [`clientLoader`](../../start/framework/route-module#clientLoader)), you may
464
464
  * want to include `loaderData` for only some routes that were loaded/rendered
465
465
  * on the server. This allows you to hydrate _some_ of the routes (such as the
466
- * app layout/shell) while showing a {@link PathRouteProps.HydrateFallback | `HydrateFallback`}
466
+ * app layout/shell) while showing a `HydrateFallback`
467
467
  * component and running the [`loader`](../../start/data/route-object#loader)s
468
468
  * for other routes during hydration.
469
469
  *
@@ -471,8 +471,7 @@ interface DOMRouterOpts {
471
471
  * hydration in two scenarios:
472
472
  *
473
473
  * 1. No hydration data is provided
474
- * In these cases the {@link PathRouteProps.HydrateFallback | `HydrateFallback`}
475
- * component will render on initial hydration
474
+ * In these cases the `HydrateFallback` component will render on initial hydration
476
475
  * 2. The `loader.hydrate` property is set to `true`
477
476
  * This allows you to run the [`loader`](../../start/data/route-object#loader)
478
477
  * even if you did not render a fallback on initial hydration (i.e., to
@@ -534,9 +533,9 @@ interface DOMRouterOpts {
534
533
  *
535
534
  * The `dataStrategy` function should return a key/value-object of
536
535
  * `routeId` -> {@link DataStrategyResult} and should include entries for any
537
- * routes where a handler was executed. A {@link DataStrategyResult} indicates
538
- * if the handler was successful or not based on the {@link DataStrategyResult.type}
539
- * field. If the returned {@link DataStrategyResult.result} is a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response),
536
+ * routes where a handler was executed. A `DataStrategyResult` indicates
537
+ * if the handler was successful or not based on the `DataStrategyResult.type`
538
+ * field. If the returned `DataStrategyResult.result` is a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response),
540
539
  * React Router will unwrap it for you (via [`res.json`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json)
541
540
  * or [`res.text`](https://developer.mozilla.org/en-US/docs/Web/API/Response/text)).
542
541
  * If you need to do custom decoding of a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
@@ -556,7 +555,7 @@ interface DOMRouterOpts {
556
555
  * let router = createBrowserRouter(routes, {
557
556
  * async dataStrategy({ matches, request }) {
558
557
  * const matchesToLoad = matches.filter((m) => m.shouldLoad);
559
- * const results = {};
558
+ * const results: Record<string, DataStrategyResult> = {};
560
559
  * await Promise.all(
561
560
  * matchesToLoad.map(async (match) => {
562
561
  * console.log(`Processing ${match.route.id}`);
@@ -730,7 +729,7 @@ interface DOMRouterOpts {
730
729
  *
731
730
  * `patchRoutesOnNavigation` will be called anytime React Router is unable to
732
731
  * match a `path`. The arguments include the `path`, any partial
733
- * {@link RouteMatch | `matches`}, and a `patch` function you can call to patch
732
+ * `matches`, and a `patch` function you can call to patch
734
733
  * new routes into the tree at a specific location. This method is executed
735
734
  * during the `loading` portion of the navigation for `GET` requests and during
736
735
  * the `submitting` portion of the navigation for non-`GET` requests.
@@ -833,7 +832,7 @@ interface DOMRouterOpts {
833
832
  * **Co-locating route discovery with route definition**
834
833
  *
835
834
  * If you don't wish to perform your own pseudo-matching, you can leverage
836
- * the partial {@link RouteMatch | `matches`} array and the [`handle`](../../start/data/route-object#handle)
835
+ * the partial `matches` array and the [`handle`](../../start/data/route-object#handle)
837
836
  * field on a route to keep the children definitions co-located:
838
837
  *
839
838
  * ```tsx
@@ -2484,4 +2483,4 @@ declare function createStaticRouter(routes: RouteObject[], context: StaticHandle
2484
2483
  future?: Partial<FutureConfig$1>;
2485
2484
  }): Router;
2486
2485
 
2487
- export { type PrefetchBehavior as $, type AssetsManifest as A, type BrowserRouterProps as B, useViewTransitionState as C, type DOMRouterOpts as D, type EntryContext as E, type FutureConfig as F, type FetcherSubmitOptions as G, type HashRouterProps as H, type SubmitOptions as I, type SubmitTarget as J, createSearchParams as K, type LinkProps as L, type StaticRouterProps as M, type NavLinkProps as N, type StaticRouterProviderProps as O, type ParamKeyValuePair as P, createStaticHandler as Q, createStaticRouter as R, type ServerBuild as S, StaticRouter as T, type URLSearchParamsInit as U, StaticRouterProvider as V, Meta as W, Links as X, Scripts as Y, PrefetchPageLinks as Z, type ScriptsProps as _, type HistoryRouterProps as a, type DiscoverBehavior as a0, type HandleDataRequestFunction as a1, type HandleDocumentRequestFunction as a2, type HandleErrorFunction as a3, type ServerEntryModule as a4, FrameworkContext as a5, createClientRoutes as a6, createClientRoutesWithHMRRevalidationOptOut as a7, shouldHydrateRouteLoader as a8, useScrollRestoration as a9, type NavLinkRenderProps as b, type FetcherFormProps as c, type FormProps as d, type ScrollRestorationProps as e, type SetURLSearchParams as f, type SubmitFunction as g, type FetcherSubmitFunction as h, type FetcherWithComponents as i, createBrowserRouter as j, createHashRouter as k, BrowserRouter as l, HashRouter as m, Link as n, HistoryRouter as o, NavLink as p, Form as q, ScrollRestoration as r, useSearchParams as s, useSubmit as t, useLinkClickHandler as u, useFormAction as v, useFetcher as w, useFetchers as x, useBeforeUnload as y, usePrompt as z };
2486
+ export { type ScriptsProps as $, type AssetsManifest as A, type BrowserRouterProps as B, useViewTransitionState as C, type DOMRouterOpts as D, type EntryContext as E, type FutureConfig as F, type FetcherSubmitOptions as G, type HashRouterProps as H, type SubmitOptions as I, type SubmitTarget as J, createSearchParams as K, type LinkProps as L, type StaticRouterProps as M, type NavLinkProps as N, type StaticRouterProviderProps as O, type ParamKeyValuePair as P, createStaticHandler as Q, createStaticRouter as R, type ServerBuild as S, StaticRouter as T, type URLSearchParamsInit as U, StaticRouterProvider as V, Meta as W, Links as X, Scripts as Y, PrefetchPageLinks as Z, type LinksProps as _, type HistoryRouterProps as a, type PrefetchBehavior as a0, type DiscoverBehavior as a1, type HandleDataRequestFunction as a2, type HandleDocumentRequestFunction as a3, type HandleErrorFunction as a4, type ServerEntryModule as a5, FrameworkContext as a6, createClientRoutes as a7, createClientRoutesWithHMRRevalidationOptOut as a8, shouldHydrateRouteLoader as a9, useScrollRestoration as aa, type NavLinkRenderProps as b, type FetcherFormProps as c, type FormProps as d, type ScrollRestorationProps as e, type SetURLSearchParams as f, type SubmitFunction as g, type FetcherSubmitFunction as h, type FetcherWithComponents as i, createBrowserRouter as j, createHashRouter as k, BrowserRouter as l, HashRouter as m, Link as n, HistoryRouter as o, NavLink as p, Form as q, ScrollRestoration as r, useSearchParams as s, useSubmit as t, useLinkClickHandler as u, useFormAction as v, useFetcher as w, useFetchers as x, useBeforeUnload as y, usePrompt as z };
@@ -1,5 +1,5 @@
1
- export { f as Await, g as MemoryRouter, h as Navigate, i as Outlet, j as Route, k as Router, l as RouterProvider, m as Routes, W as UNSAFE_WithComponentProps, v as UNSAFE_WithErrorBoundaryProps, t as UNSAFE_WithHydrateFallbackProps } from './components-CFzgj3gZ.mjs';
2
- export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-BuCmY0hu.mjs';
3
- import './context-AvZz33Zq.mjs';
1
+ export { f as Await, g as MemoryRouter, h as Navigate, i as Outlet, j as Route, k as Router, l as RouterProvider, m as Routes, W as UNSAFE_WithComponentProps, v as UNSAFE_WithErrorBoundaryProps, t as UNSAFE_WithHydrateFallbackProps } from './components-BkK38HPd.mjs';
2
+ export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-pe1TAKAq.mjs';
3
+ import './context-CphUWOpx.mjs';
4
4
  import 'react';
5
- import './route-data-BnrIwdAP.mjs';
5
+ import './route-data-DJXZgnJq.mjs';
@@ -1,3 +1,3 @@
1
- export { h as Await, V as BrowserRouter, _ as Form, W as HashRouter, X as Link, am as Links, i as MemoryRouter, al as Meta, Z as NavLink, j as Navigate, k as Outlet, l as Route, m as Router, n as RouterProvider, o as Routes, $ as ScrollRestoration, aj as StaticRouter, ak as StaticRouterProvider, ay as UNSAFE_WithComponentProps, aC as UNSAFE_WithErrorBoundaryProps, aA as UNSAFE_WithHydrateFallbackProps, Y as unstable_HistoryRouter } from './index-react-server-client-DIZWnqdE.js';
2
- import './routeModules-BbH0xTnc.js';
1
+ export { h as Await, V as BrowserRouter, _ as Form, W as HashRouter, X as Link, am as Links, i as MemoryRouter, al as Meta, Z as NavLink, j as Navigate, k as Outlet, l as Route, m as Router, n as RouterProvider, o as Routes, $ as ScrollRestoration, aj as StaticRouter, ak as StaticRouterProvider, az as UNSAFE_WithComponentProps, aD as UNSAFE_WithErrorBoundaryProps, aB as UNSAFE_WithHydrateFallbackProps, Y as unstable_HistoryRouter } from './index-react-server-client-D-lyvxf_.js';
2
+ import './routeModules-DH3xUx4Z.js';
3
3
  import 'react';
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
2
- * react-router v0.0.0-experimental-2a6c7bc
2
+ * react-router v0.0.0-experimental-e89ad3012
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -30,11 +30,11 @@
30
30
 
31
31
 
32
32
 
33
- var _chunkZIOZTUIHjs = require('./chunk-ZIOZTUIH.js');
33
+ var _chunkX3M2F3OKjs = require('./chunk-X3M2F3OK.js');
34
34
 
35
35
 
36
36
 
37
- var _chunk3UOGQQWXjs = require('./chunk-3UOGQQWX.js');
37
+ var _chunkNFNPXIQEjs = require('./chunk-NFNPXIQE.js');
38
38
 
39
39
 
40
40
 
@@ -58,4 +58,4 @@ var _chunk3UOGQQWXjs = require('./chunk-3UOGQQWX.js');
58
58
 
59
59
 
60
60
 
61
- exports.Await = _chunkZIOZTUIHjs.Await; exports.BrowserRouter = _chunkZIOZTUIHjs.BrowserRouter; exports.Form = _chunkZIOZTUIHjs.Form; exports.HashRouter = _chunkZIOZTUIHjs.HashRouter; exports.Link = _chunkZIOZTUIHjs.Link; exports.Links = _chunk3UOGQQWXjs.Links; exports.MemoryRouter = _chunkZIOZTUIHjs.MemoryRouter; exports.Meta = _chunk3UOGQQWXjs.Meta; exports.NavLink = _chunkZIOZTUIHjs.NavLink; exports.Navigate = _chunkZIOZTUIHjs.Navigate; exports.Outlet = _chunkZIOZTUIHjs.Outlet; exports.Route = _chunkZIOZTUIHjs.Route; exports.Router = _chunkZIOZTUIHjs.Router; exports.RouterProvider = _chunkZIOZTUIHjs.RouterProvider; exports.Routes = _chunkZIOZTUIHjs.Routes; exports.ScrollRestoration = _chunkZIOZTUIHjs.ScrollRestoration; exports.StaticRouter = _chunkZIOZTUIHjs.StaticRouter; exports.StaticRouterProvider = _chunkZIOZTUIHjs.StaticRouterProvider; exports.UNSAFE_WithComponentProps = _chunkZIOZTUIHjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkZIOZTUIHjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkZIOZTUIHjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkZIOZTUIHjs.HistoryRouter;
61
+ exports.Await = _chunkX3M2F3OKjs.Await; exports.BrowserRouter = _chunkX3M2F3OKjs.BrowserRouter; exports.Form = _chunkX3M2F3OKjs.Form; exports.HashRouter = _chunkX3M2F3OKjs.HashRouter; exports.Link = _chunkX3M2F3OKjs.Link; exports.Links = _chunkNFNPXIQEjs.Links; exports.MemoryRouter = _chunkX3M2F3OKjs.MemoryRouter; exports.Meta = _chunkNFNPXIQEjs.Meta; exports.NavLink = _chunkX3M2F3OKjs.NavLink; exports.Navigate = _chunkX3M2F3OKjs.Navigate; exports.Outlet = _chunkX3M2F3OKjs.Outlet; exports.Route = _chunkX3M2F3OKjs.Route; exports.Router = _chunkX3M2F3OKjs.Router; exports.RouterProvider = _chunkX3M2F3OKjs.RouterProvider; exports.Routes = _chunkX3M2F3OKjs.Routes; exports.ScrollRestoration = _chunkX3M2F3OKjs.ScrollRestoration; exports.StaticRouter = _chunkX3M2F3OKjs.StaticRouter; exports.StaticRouterProvider = _chunkX3M2F3OKjs.StaticRouterProvider; exports.UNSAFE_WithComponentProps = _chunkX3M2F3OKjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkX3M2F3OKjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkX3M2F3OKjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkX3M2F3OKjs.HistoryRouter;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-2a6c7bc
2
+ * react-router v0.0.0-experimental-e89ad3012
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -32,7 +32,7 @@ import {
32
32
  WithComponentProps,
33
33
  WithErrorBoundaryProps,
34
34
  WithHydrateFallbackProps
35
- } from "./chunk-P2JVUBYL.mjs";
35
+ } from "./chunk-QI3NR5VQ.mjs";
36
36
  export {
37
37
  Await,
38
38
  BrowserRouter,
@@ -227,27 +227,117 @@ type Submission = {
227
227
  json: undefined;
228
228
  text: string;
229
229
  };
230
+ /**
231
+ * A context instance used as the key for the `get`/`set` methods of a
232
+ * {@link unstable_RouterContextProvider}. Accepts an optional default
233
+ * value to be returned if no value has been set.
234
+ */
230
235
  interface unstable_RouterContext<T = unknown> {
231
236
  defaultValue?: T;
232
237
  }
233
238
  /**
234
- * Creates a context object that may be used to store and retrieve arbitrary values.
239
+ * Creates a type-safe context object that can be used to store and retrieve
240
+ * values in middleware, [loaders](../../start/framework/route-module#loader),
241
+ * and [actions](../../start/framework/route-module#action). Similar to React's
242
+ * [`createContext`](https://react.dev/reference/react/createContext), but
243
+ * designed for React Router's request/response lifecycle.
244
+ *
245
+ * If a `defaultValue` is provided, it will be returned from `context.get()` when
246
+ * no value has been set for the context. Otherwise reading this context when no
247
+ * value has been set will throw an error.
235
248
  *
236
- * If a `defaultValue` is provided, it will be returned from `context.get()` when no value has been
237
- * set for the context. Otherwise reading this context when no value has been set will throw an
238
- * error.
249
+ * ```tsx filename=app/context.ts
250
+ * import { unstable_createContext } from "react-router";
251
+ *
252
+ * // Create a context for user data
253
+ * export const userContext =
254
+ * unstable_createContext<User | null>(null);
255
+ * ```
256
+ *
257
+ * ```tsx filename=app/middleware/auth.ts
258
+ * import { userContext } from "~/context";
259
+ * import { getUserFromSession } from "~/auth.server";
260
+ *
261
+ * export const authMiddleware = async ({
262
+ * request,
263
+ * context,
264
+ * }) => {
265
+ * const user = await getUserFromSession(request);
266
+ * context.set(userContext, user);
267
+ * };
268
+ * ```
239
269
  *
240
- * @param defaultValue The default value for the context
241
- * @returns A context object
270
+ * ```tsx filename=app/routes/profile.tsx
271
+ * import { userContext } from "~/context";
272
+ *
273
+ * export async function loader({
274
+ * context,
275
+ * }: Route.LoaderArgs) {
276
+ * const user = context.get(userContext);
277
+ *
278
+ * if (!user) {
279
+ * throw new Response("Unauthorized", { status: 401 });
280
+ * }
281
+ *
282
+ * return { user };
283
+ * }
284
+ * ```
285
+ *
286
+ * @public
287
+ * @category Utils
288
+ * @mode framework
289
+ * @mode data
290
+ * @param defaultValue An optional default value for the context. This value will
291
+ * be returned if no value has been set for this context.
292
+ * @returns A {@link unstable_RouterContext} object that can be used with
293
+ * `context.get()` and `context.set()` in middleware, loaders, and actions.
242
294
  */
243
295
  declare function unstable_createContext<T>(defaultValue?: T): unstable_RouterContext<T>;
244
296
  /**
245
- * Provides methods for writing/reading values in application context in a typesafe way.
297
+ * Provides methods for writing/reading values in application context in a
298
+ * type-safe way. Primarily for usage with [Middleware](../../how-to/middleware).
299
+ *
300
+ * @example
301
+ * import {
302
+ * unstable_createContext,
303
+ * unstable_RouterContextProvider
304
+ * } from "react-router";
305
+ *
306
+ * const userContext = unstable_createContext<User | null>(null);
307
+ * const contextProvider = new unstable_RouterContextProvider();
308
+ * contextProvider.set(userContext, getUser());
309
+ * const user = contextProvider.get(userContext);
310
+ * // ^ User
311
+ *
312
+ * @public
313
+ * @category Utils
314
+ * @mode framework
315
+ * @mode data
246
316
  */
247
317
  declare class unstable_RouterContextProvider {
248
318
  #private;
319
+ /**
320
+ * Create a new `unstable_RouterContextProvider` instance
321
+ * @param init An optional initial context map to populate the provider with
322
+ */
249
323
  constructor(init?: Map<unstable_RouterContext, unknown>);
324
+ /**
325
+ * Access a value from the context. If no value has been set for the
326
+ * context, it will return the context's `defaultValue` if provided, or throw an
327
+ * error if no `defaultValue` was set.
328
+ * @param context The context to get the value for
329
+ * @returns The value for the context, or the contexts `defaultValue` if no
330
+ * value was set
331
+ */
250
332
  get<T>(context: unstable_RouterContext<T>): T;
333
+ /**
334
+ * Set a value for the context. If the context already has a value set,
335
+ * this will overwrite it.
336
+ *
337
+ * @param context The context to set the value for
338
+ * @param value The value to set for the context
339
+ * @returns {void}
340
+ */
251
341
  set<C extends unstable_RouterContext>(context: C, value: C extends unstable_RouterContext<infer T> ? T : never): void;
252
342
  }
253
343
  type DefaultContext = MiddlewareEnabled extends true ? Readonly<unstable_RouterContextProvider> : any;
@@ -272,7 +362,7 @@ interface DataFunctionArgs<Context> {
272
362
  * params.teamId;
273
363
  * // ^ string
274
364
  * }
275
- **/
365
+ */
276
366
  params: Params;
277
367
  /**
278
368
  * This is the context passed in to your server adapter's getLoadContext() function.
@@ -587,7 +677,27 @@ interface AgnosticDataRouteMatch extends AgnosticRouteMatch<string, AgnosticData
587
677
  /**
588
678
  * Matches the given routes to a location and returns the match data.
589
679
  *
680
+ * @example
681
+ * import { matchRoutes } from "react-router";
682
+ *
683
+ * let routes = [{
684
+ * path: "/",
685
+ * Component: Root,
686
+ * children: [{
687
+ * path: "dashboard",
688
+ * Component: Dashboard,
689
+ * }]
690
+ * }];
691
+ *
692
+ * matchRoutes(routes, "/dashboard"); // [rootMatch, dashboardMatch]
693
+ *
694
+ * @public
590
695
  * @category Utils
696
+ * @param routes The array of route objects to match against.
697
+ * @param locationArg The location to match against, either a string path or a
698
+ * partial {@link Location} object
699
+ * @param basename Optional base path to strip from the location before matching.
700
+ * @returns An array of matched routes, or `null` if no matches were found.
591
701
  */
592
702
  declare function matchRoutes<RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject>(routes: RouteObjectType[], locationArg: Partial<Location> | string, basename?: string): AgnosticRouteMatch<string, RouteObjectType>[] | null;
593
703
  interface UIMatch<Data = unknown, Handle = unknown> {
@@ -595,7 +705,7 @@ interface UIMatch<Data = unknown, Handle = unknown> {
595
705
  pathname: string;
596
706
  /**
597
707
  * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the matched route.
598
- **/
708
+ */
599
709
  params: AgnosticRouteMatch["params"];
600
710
  /**
601
711
  * The return value from the matched route's loader or clientLoader
@@ -616,9 +726,29 @@ declare class DataWithResponseInit<D> {
616
726
  }
617
727
  /**
618
728
  * Create "responses" that contain `status`/`headers` without forcing
619
- * serialization into an actual `Response` - used by Remix single fetch
729
+ * serialization into an actual `Response`
620
730
  *
731
+ * @example
732
+ * import { data } from "react-router";
733
+ *
734
+ * export async function action({ request }) {
735
+ * let formData = await request.formData();
736
+ * let item = await createItem(formData);
737
+ * return data(item, {
738
+ * status: 201,
739
+ * headers: { "X-Custom-Header": "value" }
740
+ * });
741
+ * }
742
+ *
743
+ * @public
621
744
  * @category Utils
745
+ * @mode framework
746
+ * @mode data
747
+ * @param data The data to be included in the response.
748
+ * @param init The status code or a `ResponseInit` object to be included in the
749
+ * response.
750
+ * @returns A `DataWithResponseInit` instance containing the data and response
751
+ * init.
622
752
  */
623
753
  declare function data<D>(data: D, init?: number | ResponseInit): DataWithResponseInit<D>;
624
754
  type RedirectFunction = (url: string, init?: number | ResponseInit) => Response;
@@ -626,7 +756,25 @@ type RedirectFunction = (url: string, init?: number | ResponseInit) => Response;
626
756
  * A redirect response. Sets the status code and the `Location` header.
627
757
  * Defaults to "302 Found".
628
758
  *
759
+ * @example
760
+ * import { redirect } from "react-router";
761
+ *
762
+ * export function loader({ request }) {
763
+ * if (!isLoggedIn(request))
764
+ * throw redirect("/login");
765
+ * }
766
+ *
767
+ * // ...
768
+ * }
769
+ *
770
+ * @public
629
771
  * @category Utils
772
+ * @mode framework
773
+ * @mode data
774
+ * @param url The URL to redirect to.
775
+ * @param init The status code or a `ResponseInit` object to be included in the
776
+ * response.
777
+ * @returns A `Response` object with the redirect status and `Location` header.
630
778
  */
631
779
  declare const redirect$1: RedirectFunction;
632
780
  /**
@@ -634,7 +782,26 @@ declare const redirect$1: RedirectFunction;
634
782
  * Sets the status code and the `Location` header.
635
783
  * Defaults to "302 Found".
636
784
  *
785
+ * @example
786
+ * // routes/logout.tsx
787
+ * import { redirectDocument } from "react-router";
788
+ * import { destroySession } from "../sessions.server";
789
+ *
790
+ * export async function action({ request }) {
791
+ * let session = await getSession(request.headers.get("Cookie"));
792
+ * return redirectDocument("/", {
793
+ * headers: { "Set-Cookie": await destroySession(session) }
794
+ * });
795
+ * }
796
+ *
797
+ * @public
637
798
  * @category Utils
799
+ * @mode framework
800
+ * @mode data
801
+ * @param url The URL to redirect to.
802
+ * @param init The status code or a `ResponseInit` object to be included in the
803
+ * response.
804
+ * @returns A `Response` object with the redirect status and `Location` header.
638
805
  */
639
806
  declare const redirectDocument$1: RedirectFunction;
640
807
  /**
@@ -643,7 +810,21 @@ declare const redirectDocument$1: RedirectFunction;
643
810
  * Sets the status code and the `Location` header.
644
811
  * Defaults to "302 Found".
645
812
  *
813
+ * @example
814
+ * import { replace } from "react-router";
815
+ *
816
+ * export function loader() {
817
+ * return replace("/new-location");
818
+ * }
819
+ *
820
+ * @public
646
821
  * @category Utils
822
+ * @mode framework
823
+ * @mode data
824
+ * @param url The URL to redirect to.
825
+ * @param init The status code or a `ResponseInit` object to be included in the
826
+ * response.
827
+ * @returns A `Response` object with the redirect status and `Location` header.
647
828
  */
648
829
  declare const replace$1: RedirectFunction;
649
830
 
@@ -956,15 +1137,13 @@ interface StaticHandler {
956
1137
  skipLoaderErrorBubbling?: boolean;
957
1138
  skipRevalidation?: boolean;
958
1139
  dataStrategy?: DataStrategyFunction<unknown>;
959
- unstable_respond?: (staticContext: StaticHandlerContext) => MaybePromise<Response>;
960
- unstable_stream?: (context: unstable_RouterContextProvider, query: (r: Request) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
1140
+ unstable_generateMiddlewareResponse?: (query: (r: Request) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
961
1141
  }): Promise<StaticHandlerContext | Response>;
962
1142
  queryRoute(request: Request, opts?: {
963
1143
  routeId?: string;
964
1144
  requestContext?: unknown;
965
1145
  dataStrategy?: DataStrategyFunction<unknown>;
966
- unstable_respond?: (res: Response) => MaybePromise<Response>;
967
- unstable_stream?: (context: unstable_RouterContextProvider, queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>;
1146
+ unstable_generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>;
968
1147
  }): Promise<any>;
969
1148
  }
970
1149
  type ViewTransitionOpts = {