react-router 7.7.0-pre.1 → 7.7.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 (58) hide show
  1. package/CHANGELOG.md +9 -7
  2. package/dist/development/{browser-BSrXyLft.d.mts → browser-CcxeZJcQ.d.mts} +3 -30
  3. package/dist/development/{chunk-6ZHKKNZG.js → chunk-4ADB4KIO.js} +170 -140
  4. package/dist/development/{chunk-YNUF36W5.mjs → chunk-EF7DTUVF.mjs} +52 -22
  5. package/dist/{production/chunk-KZZC37RO.mjs → development/chunk-T3VM44WY.mjs} +31 -26
  6. package/dist/development/{chunk-Z7T4GLA7.js → chunk-V6PEDDZI.js} +1 -1
  7. package/dist/development/components-DzqPLVI1.d.mts +464 -0
  8. package/dist/development/dom-export.d.mts +3 -3
  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-DOK8MfYF.d.mts → development/index-react-server-client-CUidsuu_.d.mts} +2 -2
  12. package/dist/development/{index-react-server-client-LrDNRnlX.d.ts → index-react-server-client-kY8DvDF3.d.ts} +177 -529
  13. package/dist/development/index-react-server-client.d.mts +3 -3
  14. package/dist/development/index-react-server-client.d.ts +2 -2
  15. package/dist/development/index-react-server-client.js +10 -4
  16. package/dist/development/index-react-server-client.mjs +9 -3
  17. package/dist/development/index-react-server.js +20 -6
  18. package/dist/development/index-react-server.mjs +21 -6
  19. package/dist/development/index.d.mts +396 -9
  20. package/dist/development/index.d.ts +372 -12
  21. package/dist/development/index.js +131 -120
  22. package/dist/development/index.mjs +9 -3
  23. package/dist/development/lib/types/internal.d.mts +1 -1
  24. package/dist/development/lib/types/internal.d.ts +1 -1
  25. package/dist/development/lib/types/internal.js +1 -1
  26. package/dist/development/lib/types/internal.mjs +1 -1
  27. package/dist/{production/route-data-DAw7Esur.d.mts → development/route-data-DjzmHYNR.d.mts} +1 -1
  28. package/dist/{production/route-data-7aXBQ4I3.d.ts → development/routeModules-g5PTiDfO.d.ts} +156 -156
  29. package/dist/production/{browser-BSrXyLft.d.mts → browser-CcxeZJcQ.d.mts} +3 -30
  30. package/dist/production/{chunk-W77PDD2Y.js → chunk-2TYFPE3B.js} +170 -140
  31. package/dist/production/{chunk-SH44XSL4.js → chunk-5KHO4FML.js} +1 -1
  32. package/dist/{development/chunk-YP7CIEHK.mjs → production/chunk-GNZILI6H.mjs} +31 -26
  33. package/dist/production/{chunk-4FKAWASN.mjs → chunk-WPPIQDYG.mjs} +52 -22
  34. package/dist/production/components-DzqPLVI1.d.mts +464 -0
  35. package/dist/production/dom-export.d.mts +3 -3
  36. package/dist/production/dom-export.js +3 -3
  37. package/dist/production/dom-export.mjs +3 -3
  38. package/dist/{development/index-react-server-client-DOK8MfYF.d.mts → production/index-react-server-client-CUidsuu_.d.mts} +2 -2
  39. package/dist/production/{index-react-server-client-LrDNRnlX.d.ts → index-react-server-client-kY8DvDF3.d.ts} +177 -529
  40. package/dist/production/index-react-server-client.d.mts +3 -3
  41. package/dist/production/index-react-server-client.d.ts +2 -2
  42. package/dist/production/index-react-server-client.js +10 -4
  43. package/dist/production/index-react-server-client.mjs +9 -3
  44. package/dist/production/index-react-server.js +20 -6
  45. package/dist/production/index-react-server.mjs +21 -6
  46. package/dist/production/index.d.mts +396 -9
  47. package/dist/production/index.d.ts +372 -12
  48. package/dist/production/index.js +131 -120
  49. package/dist/production/index.mjs +9 -3
  50. package/dist/production/lib/types/internal.d.mts +1 -1
  51. package/dist/production/lib/types/internal.d.ts +1 -1
  52. package/dist/production/lib/types/internal.js +1 -1
  53. package/dist/production/lib/types/internal.mjs +1 -1
  54. package/dist/{development/route-data-DAw7Esur.d.mts → production/route-data-DjzmHYNR.d.mts} +1 -1
  55. package/dist/{development/route-data-7aXBQ4I3.d.ts → production/routeModules-g5PTiDfO.d.ts} +156 -156
  56. package/package.json +1 -1
  57. package/dist/development/components-IaVqGBuO.d.mts +0 -816
  58. package/dist/production/components-IaVqGBuO.d.mts +0 -816
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.7.0-pre.1
2
+ * react-router v7.7.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -31,7 +31,7 @@ import {
31
31
  isSession,
32
32
  routeRSCServerRequest,
33
33
  setDevServerHooks
34
- } from "./chunk-KZZC37RO.mjs";
34
+ } from "./chunk-GNZILI6H.mjs";
35
35
  import {
36
36
  Action,
37
37
  Await,
@@ -69,6 +69,9 @@ import {
69
69
  StaticRouter,
70
70
  StaticRouterProvider,
71
71
  ViewTransitionContext,
72
+ WithComponentProps,
73
+ WithErrorBoundaryProps,
74
+ WithHydrateFallbackProps,
72
75
  createBrowserHistory,
73
76
  createBrowserRouter,
74
77
  createClientRoutes,
@@ -137,7 +140,7 @@ import {
137
140
  withComponentProps,
138
141
  withErrorBoundaryProps,
139
142
  withHydrateFallbackProps
140
- } from "./chunk-4FKAWASN.mjs";
143
+ } from "./chunk-WPPIQDYG.mjs";
141
144
  export {
142
145
  Await,
143
146
  BrowserRouter,
@@ -177,6 +180,9 @@ export {
177
180
  ServerMode as UNSAFE_ServerMode,
178
181
  SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol,
179
182
  ViewTransitionContext as UNSAFE_ViewTransitionContext,
183
+ WithComponentProps as UNSAFE_WithComponentProps,
184
+ WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps,
185
+ WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps,
180
186
  createBrowserHistory as UNSAFE_createBrowserHistory,
181
187
  createClientRoutes as UNSAFE_createClientRoutes,
182
188
  createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut,
@@ -1,4 +1,4 @@
1
- import { w as RouteModule, x as LinkDescriptor, L as Location, y as Pretty, z as MetaDescriptor, G as GetLoaderData, E as ServerDataFunctionArgs, J as unstable_MiddlewareNextFunction, K as ClientDataFunctionArgs, O as ServerDataFrom, Q as Normalize, V as GetActionData } from '../../route-data-DAw7Esur.mjs';
1
+ import { n as RouteModule, o as LinkDescriptor, c as Location, p as Pretty, q as MetaDescriptor, G as GetLoaderData, r as ServerDataFunctionArgs, s as unstable_MiddlewareNextFunction, t as ClientDataFunctionArgs, v as ServerDataFrom, w as Normalize, x as GetActionData } from '../../route-data-DjzmHYNR.mjs';
2
2
  import { R as RouteFiles, P as Pages } from '../../register-DiOIlEq5.mjs';
3
3
  import 'react';
4
4
 
@@ -1,4 +1,4 @@
1
- import { R as RouteModule, L as LinkDescriptor, a as Location, P as Pretty, M as MetaDescriptor, G as GetLoaderData, S as ServerDataFunctionArgs, u as unstable_MiddlewareNextFunction, C as ClientDataFunctionArgs, b as ServerDataFrom, N as Normalize, c as GetActionData } from '../../route-data-7aXBQ4I3.js';
1
+ import { R as RouteModule, L as LinkDescriptor, a as Location, P as Pretty, M as MetaDescriptor, G as GetLoaderData, S as ServerDataFunctionArgs, u as unstable_MiddlewareNextFunction, C as ClientDataFunctionArgs, b as ServerDataFrom, N as Normalize, c as GetActionData } from '../../routeModules-g5PTiDfO.js';
2
2
  import { R as RouteFiles, P as Pages } from '../../register-DiOIlEq5.js';
3
3
  import 'react';
4
4
 
@@ -1,5 +1,5 @@
1
1
  "use strict";/**
2
- * react-router v7.7.0-pre.1
2
+ * react-router v7.7.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.7.0-pre.1
2
+ * react-router v7.7.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1867,4 +1867,4 @@ type _DataActionData<ServerActionData, ClientActionData> = Awaited<[
1867
1867
  IsDefined<ClientActionData>
1868
1868
  ] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
1869
1869
 
1870
- export { type RouterState as $, Action as A, type BlockerFunction as B, type ClientActionFunction as C, type DataStrategyFunction as D, type ServerDataFunctionArgs as E, type FutureConfig as F, type GetLoaderData as G, type HydrationState as H, type InitialEntry as I, type unstable_MiddlewareNextFunction as J, type ClientDataFunctionArgs as K, type Location as L, type MetaFunction as M, type NavigateOptions as N, type ServerDataFrom as O, type ParamParseKey as P, type Normalize as Q, type RouterInit as R, type SerializeFrom as S, type To as T, type UIMatch as U, type GetActionData as V, type RouteModules as W, type AppLoadContext as X, type MiddlewareEnabled as Y, type unstable_InitialContext as Z, type Equal as _, type Blocker as a, type ServerRouteModule as a$, type DataRouteObject as a0, type StaticHandler as a1, type GetScrollPositionFunction as a2, type GetScrollRestorationKeyFunction as a3, type StaticHandlerContext as a4, type Fetcher as a5, type NavigationStates as a6, type RouterSubscriber as a7, type RouterNavigateOptions as a8, type RouterFetchOptions as a9, matchRoutes as aA, redirect as aB, redirectDocument as aC, replace as aD, resolvePath as aE, type DataRouteMatch as aF, type PatchRoutesOnNavigationFunctionArgs as aG, type ClientActionFunctionArgs as aH, type ClientLoaderFunctionArgs as aI, type HeadersArgs as aJ, type MetaArgs as aK, type PageLinkDescriptor as aL, type HtmlLinkDescriptor as aM, type Future as aN, type unstable_SerializesTo as aO, createBrowserHistory as aP, invariant as aQ, createRouter as aR, ErrorResponseImpl as aS, DataRouterContext as aT, DataRouterStateContext as aU, FetchersContext as aV, LocationContext as aW, NavigationContext as aX, RouteContext as aY, ViewTransitionContext as aZ, type RouteManifest as a_, type RevalidationState as aa, type ActionFunctionArgs as ab, type DataStrategyFunctionArgs as ac, type DataStrategyMatch as ad, type DataStrategyResult as ae, DataWithResponseInit as af, type ErrorResponse as ag, type FormEncType as ah, type FormMethod as ai, type HTMLFormMethod as aj, type LoaderFunctionArgs as ak, type unstable_MiddlewareFunction as al, type PathParam as am, type RedirectFunction as an, type unstable_RouterContext as ao, type ShouldRevalidateFunctionArgs as ap, unstable_createContext as aq, createPath as ar, parsePath as as, IDLE_NAVIGATION as at, IDLE_FETCHER as au, IDLE_BLOCKER as av, data as aw, generatePath as ax, isRouteErrorResponse as ay, matchPath as az, type RelativeRoutingType as b, type History as b0, type CreateStaticHandlerOptions as b1, type Path as c, type PathPattern as d, type PathMatch as e, type Navigation as f, type Params as g, type Router as h, type RouteObject as i, type NonIndexRouteObject as j, type LazyRouteFunction as k, type IndexRouteObject as l, type Navigator as m, type PatchRoutesOnNavigationFunction as n, type RouteMatch as o, type ActionFunction as p, type ClientLoaderFunction as q, type HeadersFunction as r, type LinksFunction as s, type LoaderFunction as t, unstable_RouterContextProvider as u, type ShouldRevalidateFunction as v, type RouteModule as w, type LinkDescriptor as x, type Pretty as y, type MetaDescriptor as z };
1870
+ export { type RouterState as $, Action as A, type BlockerFunction as B, type ClientActionFunction as C, type DataStrategyFunction as D, type Blocker as E, type FutureConfig as F, type GetLoaderData as G, type HydrationState as H, type InitialEntry as I, type SerializeFrom as J, type ParamParseKey as K, type LazyRouteFunction as L, type MetaFunction as M, type NonIndexRouteObject as N, type Path as O, type PatchRoutesOnNavigationFunction as P, type PathPattern as Q, type Router as R, type ShouldRevalidateFunction as S, type To as T, type UIMatch as U, type PathMatch as V, type Navigation as W, type AppLoadContext as X, type MiddlewareEnabled as Y, type unstable_InitialContext as Z, type Equal as _, type RelativeRoutingType as a, type ServerRouteModule as a$, type DataRouteObject as a0, type StaticHandler as a1, type GetScrollPositionFunction as a2, type GetScrollRestorationKeyFunction as a3, type StaticHandlerContext as a4, type Fetcher as a5, type NavigationStates as a6, type RouterSubscriber as a7, type RouterNavigateOptions as a8, type RouterFetchOptions as a9, matchRoutes as aA, redirect as aB, redirectDocument as aC, replace as aD, resolvePath as aE, type DataRouteMatch as aF, type PatchRoutesOnNavigationFunctionArgs as aG, type ClientActionFunctionArgs as aH, type ClientLoaderFunctionArgs as aI, type HeadersArgs as aJ, type MetaArgs as aK, type PageLinkDescriptor as aL, type HtmlLinkDescriptor as aM, type Future as aN, type unstable_SerializesTo as aO, createBrowserHistory as aP, invariant as aQ, createRouter as aR, ErrorResponseImpl as aS, DataRouterContext as aT, DataRouterStateContext as aU, FetchersContext as aV, LocationContext as aW, NavigationContext as aX, RouteContext as aY, ViewTransitionContext as aZ, type RouteManifest as a_, type RevalidationState as aa, type ActionFunctionArgs as ab, type DataStrategyFunctionArgs as ac, type DataStrategyMatch as ad, type DataStrategyResult as ae, DataWithResponseInit as af, type ErrorResponse as ag, type FormEncType as ah, type FormMethod as ai, type HTMLFormMethod as aj, type LoaderFunctionArgs as ak, type unstable_MiddlewareFunction as al, type PathParam as am, type RedirectFunction as an, type unstable_RouterContext as ao, type ShouldRevalidateFunctionArgs as ap, unstable_createContext as aq, createPath as ar, parsePath as as, IDLE_NAVIGATION as at, IDLE_FETCHER as au, IDLE_BLOCKER as av, data as aw, generatePath as ax, isRouteErrorResponse as ay, matchPath as az, type IndexRouteObject as b, type History as b0, type CreateStaticHandlerOptions as b1, type Location as c, type Navigator as d, type RouterInit as e, type RouteObject as f, type RouteMatch as g, type Params as h, type ActionFunction as i, type ClientLoaderFunction as j, type HeadersFunction as k, type LinksFunction as l, type LoaderFunction as m, type RouteModule as n, type LinkDescriptor as o, type Pretty as p, type MetaDescriptor as q, type ServerDataFunctionArgs as r, type unstable_MiddlewareNextFunction as s, type ClientDataFunctionArgs as t, unstable_RouterContextProvider as u, type ServerDataFrom as v, type Normalize as w, type GetActionData as x, type RouteModules as y, type NavigateOptions as z };
@@ -1408,16 +1408,6 @@ interface RouteContextObject {
1408
1408
  }
1409
1409
  declare const RouteContext: React.Context<RouteContextObject>;
1410
1410
 
1411
- /**
1412
- * An object of unknown type for route loaders and actions provided by the
1413
- * server's `getLoadContext()` function. This is defined as an empty interface
1414
- * specifically so apps can leverage declaration merging to augment this type
1415
- * globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
1416
- */
1417
- interface AppLoadContext {
1418
- [key: string]: unknown;
1419
- }
1420
-
1421
1411
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
1422
1412
  type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
1423
1413
  interface HtmlLinkProps {
@@ -1522,13 +1512,165 @@ interface PageLinkDescriptor extends Omit<HtmlLinkDescriptor, "href" | "rel" | "
1522
1512
  }
1523
1513
  type LinkDescriptor = HtmlLinkDescriptor | PageLinkDescriptor;
1524
1514
 
1515
+ /**
1516
+ * An object of unknown type for route loaders and actions provided by the
1517
+ * server's `getLoadContext()` function. This is defined as an empty interface
1518
+ * specifically so apps can leverage declaration merging to augment this type
1519
+ * globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
1520
+ */
1521
+ interface AppLoadContext {
1522
+ [key: string]: unknown;
1523
+ }
1524
+
1525
+ type Serializable = undefined | null | boolean | string | symbol | number | Array<Serializable> | {
1526
+ [key: PropertyKey]: Serializable;
1527
+ } | bigint | Date | URL | RegExp | Error | Map<Serializable, Serializable> | Set<Serializable> | Promise<Serializable>;
1528
+
1529
+ type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
1530
+ type IsAny<T> = 0 extends 1 & T ? true : false;
1531
+ type Func = (...args: any[]) => unknown;
1532
+ type Pretty<T> = {
1533
+ [K in keyof T]: T[K];
1534
+ } & {};
1535
+ type Normalize<T> = _Normalize<UnionKeys<T>, T>;
1536
+ type _Normalize<Key extends keyof any, T> = T extends infer U ? Pretty<{
1537
+ [K in Key as K extends keyof U ? undefined extends U[K] ? never : K : never]: K extends keyof U ? U[K] : never;
1538
+ } & {
1539
+ [K in Key as K extends keyof U ? undefined extends U[K] ? K : never : never]?: K extends keyof U ? U[K] : never;
1540
+ } & {
1541
+ [K in Key as K extends keyof U ? never : K]?: undefined;
1542
+ }> : never;
1543
+ type UnionKeys<T> = T extends any ? keyof T : never;
1544
+
1545
+ type RouteModule$1 = {
1546
+ meta?: Func;
1547
+ links?: Func;
1548
+ headers?: Func;
1549
+ loader?: Func;
1550
+ clientLoader?: Func;
1551
+ action?: Func;
1552
+ clientAction?: Func;
1553
+ HydrateFallback?: Func;
1554
+ default?: Func;
1555
+ ErrorBoundary?: Func;
1556
+ [key: string]: unknown;
1557
+ };
1558
+
1559
+ /**
1560
+ * A brand that can be applied to a type to indicate that it will serialize
1561
+ * to a specific type when transported to the client from a loader.
1562
+ * Only use this if you have additional serialization/deserialization logic
1563
+ * in your application.
1564
+ */
1565
+ type unstable_SerializesTo<T> = {
1566
+ unstable__ReactRouter_SerializesTo: [T];
1567
+ };
1568
+
1569
+ type Serialize<T> = T extends unstable_SerializesTo<infer To> ? To : T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
1570
+ [K in keyof T]: Serialize<T[K]>;
1571
+ } : undefined;
1572
+ type VoidToUndefined<T> = Equal<T, void> extends true ? undefined : T;
1573
+ type DataFrom<T> = IsAny<T> extends true ? undefined : T extends Func ? VoidToUndefined<Awaited<ReturnType<T>>> : undefined;
1574
+ type ClientData<T> = T extends Response ? never : T extends DataWithResponseInit<infer U> ? U : T;
1575
+ type ServerData<T> = T extends Response ? never : T extends DataWithResponseInit<infer U> ? Serialize<U> : Serialize<T>;
1576
+ type ServerDataFrom<T> = ServerData<DataFrom<T>>;
1577
+ type ClientDataFrom<T> = ClientData<DataFrom<T>>;
1578
+ type ClientDataFunctionArgs<Params> = {
1579
+ /**
1580
+ * A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the URL, the method, the "content-type" header, and the request body from the request.
1581
+ *
1582
+ * @note Because client data functions are called before a network request is made, the Request object does not include the headers which the browser automatically adds. React Router infers the "content-type" header from the enc-type of the form that performed the submission.
1583
+ **/
1584
+ request: Request;
1585
+ /**
1586
+ * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
1587
+ * @example
1588
+ * // app/routes.ts
1589
+ * route("teams/:teamId", "./team.tsx"),
1590
+ *
1591
+ * // app/team.tsx
1592
+ * export function clientLoader({
1593
+ * params,
1594
+ * }: Route.ClientLoaderArgs) {
1595
+ * params.teamId;
1596
+ * // ^ string
1597
+ * }
1598
+ **/
1599
+ params: Params;
1600
+ /**
1601
+ * When `future.unstable_middleware` is not enabled, this is undefined.
1602
+ *
1603
+ * When `future.unstable_middleware` is enabled, this is an instance of
1604
+ * `unstable_RouterContextProvider` and can be used to access context values
1605
+ * from your route middlewares. You may pass in initial context values in your
1606
+ * `<HydratedRouter unstable_getContext>` prop
1607
+ */
1608
+ context: unstable_RouterContextProvider;
1609
+ };
1610
+ type ServerDataFunctionArgs<Params> = {
1611
+ /** 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. */
1612
+ request: Request;
1613
+ /**
1614
+ * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
1615
+ * @example
1616
+ * // app/routes.ts
1617
+ * route("teams/:teamId", "./team.tsx"),
1618
+ *
1619
+ * // app/team.tsx
1620
+ * export function loader({
1621
+ * params,
1622
+ * }: Route.LoaderArgs) {
1623
+ * params.teamId;
1624
+ * // ^ string
1625
+ * }
1626
+ **/
1627
+ params: Params;
1628
+ /**
1629
+ * Without `future.unstable_middleware` enabled, this is the context passed in
1630
+ * to your server adapter's `getLoadContext` function. It's a way to bridge the
1631
+ * gap between the adapter's request/response API with your React Router app.
1632
+ * It is only applicable if you are using a custom server adapter.
1633
+ *
1634
+ * With `future.unstable_middleware` enabled, this is an instance of
1635
+ * `unstable_RouterContextProvider` and can be used for type-safe access to
1636
+ * context value set in your route middlewares. If you are using a custom
1637
+ * server adapter, you may provide an initial set of context values from your
1638
+ * `getLoadContext` function.
1639
+ */
1640
+ context: MiddlewareEnabled extends true ? unstable_RouterContextProvider : AppLoadContext;
1641
+ };
1642
+ type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [
1643
+ ClientLoaderFunctionArgs | ClientActionFunctionArgs | ClientDataFunctionArgs<unknown>
1644
+ ] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
1645
+ type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
1646
+ type IsHydrate<ClientLoader> = ClientLoader extends {
1647
+ hydrate: true;
1648
+ } ? true : ClientLoader extends {
1649
+ hydrate: false;
1650
+ } ? false : false;
1651
+ type GetLoaderData<T extends RouteModule$1> = _DataLoaderData<ServerDataFrom<T["loader"]>, ClientDataFrom<T["clientLoader"]>, IsHydrate<T["clientLoader"]>, T extends {
1652
+ HydrateFallback: Func;
1653
+ } ? true : false>;
1654
+ type _DataLoaderData<ServerLoaderData, ClientLoaderData, ClientLoaderHydrate extends boolean, HasHydrateFallback> = [
1655
+ HasHydrateFallback,
1656
+ ClientLoaderHydrate
1657
+ ] extends [true, true] ? IsDefined<ClientLoaderData> extends true ? ClientLoaderData : undefined : [
1658
+ IsDefined<ClientLoaderData>,
1659
+ IsDefined<ServerLoaderData>
1660
+ ] extends [true, true] ? ServerLoaderData | ClientLoaderData : IsDefined<ClientLoaderData> extends true ? ClientLoaderData : IsDefined<ServerLoaderData> extends true ? ServerLoaderData : undefined;
1661
+ type GetActionData<T extends RouteModule$1> = _DataActionData<ServerDataFrom<T["action"]>, ClientDataFrom<T["clientAction"]>>;
1662
+ type _DataActionData<ServerActionData, ClientActionData> = Awaited<[
1663
+ IsDefined<ServerActionData>,
1664
+ IsDefined<ClientActionData>
1665
+ ] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
1666
+
1525
1667
  interface RouteModules {
1526
- [routeId: string]: RouteModule$1 | undefined;
1668
+ [routeId: string]: RouteModule | undefined;
1527
1669
  }
1528
1670
  /**
1529
1671
  * The shape of a route module shipped to the client
1530
1672
  */
1531
- interface RouteModule$1 {
1673
+ interface RouteModule {
1532
1674
  clientAction?: ClientActionFunction;
1533
1675
  clientLoader?: ClientLoaderFunction;
1534
1676
  unstable_clientMiddleware?: unstable_MiddlewareFunction<undefined>[];
@@ -1544,7 +1686,7 @@ interface RouteModule$1 {
1544
1686
  /**
1545
1687
  * The shape of a route module on the server
1546
1688
  */
1547
- interface ServerRouteModule extends RouteModule$1 {
1689
+ interface ServerRouteModule extends RouteModule {
1548
1690
  action?: ActionFunction;
1549
1691
  headers?: HeadersFunction | {
1550
1692
  [name: string]: string;
@@ -1725,146 +1867,4 @@ type RouteComponent = ComponentType<{}>;
1725
1867
  */
1726
1868
  type RouteHandle = unknown;
1727
1869
 
1728
- type Serializable = undefined | null | boolean | string | symbol | number | Array<Serializable> | {
1729
- [key: PropertyKey]: Serializable;
1730
- } | bigint | Date | URL | RegExp | Error | Map<Serializable, Serializable> | Set<Serializable> | Promise<Serializable>;
1731
-
1732
- type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
1733
- type IsAny<T> = 0 extends 1 & T ? true : false;
1734
- type Func = (...args: any[]) => unknown;
1735
- type Pretty<T> = {
1736
- [K in keyof T]: T[K];
1737
- } & {};
1738
- type Normalize<T> = _Normalize<UnionKeys<T>, T>;
1739
- type _Normalize<Key extends keyof any, T> = T extends infer U ? Pretty<{
1740
- [K in Key as K extends keyof U ? undefined extends U[K] ? never : K : never]: K extends keyof U ? U[K] : never;
1741
- } & {
1742
- [K in Key as K extends keyof U ? undefined extends U[K] ? K : never : never]?: K extends keyof U ? U[K] : never;
1743
- } & {
1744
- [K in Key as K extends keyof U ? never : K]?: undefined;
1745
- }> : never;
1746
- type UnionKeys<T> = T extends any ? keyof T : never;
1747
-
1748
- type RouteModule = {
1749
- meta?: Func;
1750
- links?: Func;
1751
- headers?: Func;
1752
- loader?: Func;
1753
- clientLoader?: Func;
1754
- action?: Func;
1755
- clientAction?: Func;
1756
- HydrateFallback?: Func;
1757
- default?: Func;
1758
- ErrorBoundary?: Func;
1759
- [key: string]: unknown;
1760
- };
1761
-
1762
- /**
1763
- * A brand that can be applied to a type to indicate that it will serialize
1764
- * to a specific type when transported to the client from a loader.
1765
- * Only use this if you have additional serialization/deserialization logic
1766
- * in your application.
1767
- */
1768
- type unstable_SerializesTo<T> = {
1769
- unstable__ReactRouter_SerializesTo: [T];
1770
- };
1771
-
1772
- type Serialize<T> = T extends unstable_SerializesTo<infer To> ? To : T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
1773
- [K in keyof T]: Serialize<T[K]>;
1774
- } : undefined;
1775
- type VoidToUndefined<T> = Equal<T, void> extends true ? undefined : T;
1776
- type DataFrom<T> = IsAny<T> extends true ? undefined : T extends Func ? VoidToUndefined<Awaited<ReturnType<T>>> : undefined;
1777
- type ClientData<T> = T extends Response ? never : T extends DataWithResponseInit<infer U> ? U : T;
1778
- type ServerData<T> = T extends Response ? never : T extends DataWithResponseInit<infer U> ? Serialize<U> : Serialize<T>;
1779
- type ServerDataFrom<T> = ServerData<DataFrom<T>>;
1780
- type ClientDataFrom<T> = ClientData<DataFrom<T>>;
1781
- type ClientDataFunctionArgs<Params> = {
1782
- /**
1783
- * A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the URL, the method, the "content-type" header, and the request body from the request.
1784
- *
1785
- * @note Because client data functions are called before a network request is made, the Request object does not include the headers which the browser automatically adds. React Router infers the "content-type" header from the enc-type of the form that performed the submission.
1786
- **/
1787
- request: Request;
1788
- /**
1789
- * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
1790
- * @example
1791
- * // app/routes.ts
1792
- * route("teams/:teamId", "./team.tsx"),
1793
- *
1794
- * // app/team.tsx
1795
- * export function clientLoader({
1796
- * params,
1797
- * }: Route.ClientLoaderArgs) {
1798
- * params.teamId;
1799
- * // ^ string
1800
- * }
1801
- **/
1802
- params: Params;
1803
- /**
1804
- * When `future.unstable_middleware` is not enabled, this is undefined.
1805
- *
1806
- * When `future.unstable_middleware` is enabled, this is an instance of
1807
- * `unstable_RouterContextProvider` and can be used to access context values
1808
- * from your route middlewares. You may pass in initial context values in your
1809
- * `<HydratedRouter unstable_getContext>` prop
1810
- */
1811
- context: unstable_RouterContextProvider;
1812
- };
1813
- type ServerDataFunctionArgs<Params> = {
1814
- /** 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. */
1815
- request: Request;
1816
- /**
1817
- * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
1818
- * @example
1819
- * // app/routes.ts
1820
- * route("teams/:teamId", "./team.tsx"),
1821
- *
1822
- * // app/team.tsx
1823
- * export function loader({
1824
- * params,
1825
- * }: Route.LoaderArgs) {
1826
- * params.teamId;
1827
- * // ^ string
1828
- * }
1829
- **/
1830
- params: Params;
1831
- /**
1832
- * Without `future.unstable_middleware` enabled, this is the context passed in
1833
- * to your server adapter's `getLoadContext` function. It's a way to bridge the
1834
- * gap between the adapter's request/response API with your React Router app.
1835
- * It is only applicable if you are using a custom server adapter.
1836
- *
1837
- * With `future.unstable_middleware` enabled, this is an instance of
1838
- * `unstable_RouterContextProvider` and can be used for type-safe access to
1839
- * context value set in your route middlewares. If you are using a custom
1840
- * server adapter, you may provide an initial set of context values from your
1841
- * `getLoadContext` function.
1842
- */
1843
- context: MiddlewareEnabled extends true ? unstable_RouterContextProvider : AppLoadContext;
1844
- };
1845
- type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [
1846
- ClientLoaderFunctionArgs | ClientActionFunctionArgs | ClientDataFunctionArgs<unknown>
1847
- ] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
1848
- type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
1849
- type IsHydrate<ClientLoader> = ClientLoader extends {
1850
- hydrate: true;
1851
- } ? true : ClientLoader extends {
1852
- hydrate: false;
1853
- } ? false : false;
1854
- type GetLoaderData<T extends RouteModule> = _DataLoaderData<ServerDataFrom<T["loader"]>, ClientDataFrom<T["clientLoader"]>, IsHydrate<T["clientLoader"]>, T extends {
1855
- HydrateFallback: Func;
1856
- } ? true : false>;
1857
- type _DataLoaderData<ServerLoaderData, ClientLoaderData, ClientLoaderHydrate extends boolean, HasHydrateFallback> = [
1858
- HasHydrateFallback,
1859
- ClientLoaderHydrate
1860
- ] extends [true, true] ? IsDefined<ClientLoaderData> extends true ? ClientLoaderData : undefined : [
1861
- IsDefined<ClientLoaderData>,
1862
- IsDefined<ServerLoaderData>
1863
- ] extends [true, true] ? ServerLoaderData | ClientLoaderData : IsDefined<ClientLoaderData> extends true ? ClientLoaderData : IsDefined<ServerLoaderData> extends true ? ServerLoaderData : undefined;
1864
- type GetActionData<T extends RouteModule> = _DataActionData<ServerDataFrom<T["action"]>, ClientDataFrom<T["clientAction"]>>;
1865
- type _DataActionData<ServerActionData, ClientActionData> = Awaited<[
1866
- IsDefined<ServerActionData>,
1867
- IsDefined<ClientActionData>
1868
- ] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
1869
-
1870
- export { type ActionFunctionArgs as $, type ActionFunction as A, type GetScrollPositionFunction as B, type ClientDataFunctionArgs as C, type DataStrategyFunction as D, type Equal as E, type GetScrollRestorationKeyFunction as F, type GetLoaderData as G, type HydrationState as H, type InitialEntry as I, type StaticHandlerContext as J, type Fetcher as K, type LinkDescriptor as L, type MetaDescriptor as M, type Normalize as N, type Navigation as O, type Pretty as P, type NavigationStates as Q, type RouteModule as R, type ServerDataFunctionArgs as S, type To as T, type RelativeRoutingType as U, type Blocker as V, type BlockerFunction as W, type RouterSubscriber as X, type RouterNavigateOptions as Y, type RouterFetchOptions as Z, type RevalidationState as _, type Location as a, type FutureConfig as a$, type DataStrategyFunctionArgs as a0, type DataStrategyMatch as a1, type DataStrategyResult as a2, DataWithResponseInit as a3, type ErrorResponse as a4, type FormEncType as a5, type FormMethod as a6, type HTMLFormMethod as a7, type LazyRouteFunction as a8, type LoaderFunctionArgs as a9, type NavigateOptions as aA, type Navigator as aB, type PatchRoutesOnNavigationFunctionArgs as aC, type RouteMatch as aD, type RouteObject as aE, type ClientActionFunctionArgs as aF, type ClientLoaderFunctionArgs as aG, type HeadersArgs as aH, type MetaArgs as aI, type PageLinkDescriptor as aJ, type HtmlLinkDescriptor as aK, type Future as aL, type unstable_SerializesTo as aM, createBrowserHistory as aN, invariant as aO, createRouter as aP, ErrorResponseImpl as aQ, DataRouterContext as aR, DataRouterStateContext as aS, FetchersContext as aT, LocationContext as aU, NavigationContext as aV, RouteContext as aW, ViewTransitionContext as aX, type RouteManifest as aY, type ServerRouteModule as aZ, type SerializeFrom as a_, type unstable_MiddlewareFunction as aa, type ParamParseKey as ab, type PathMatch as ac, type PathParam as ad, type PathPattern as ae, type RedirectFunction as af, type unstable_RouterContext as ag, type ShouldRevalidateFunctionArgs as ah, type UIMatch as ai, unstable_createContext as aj, Action as ak, createPath as al, parsePath as am, IDLE_NAVIGATION as an, IDLE_FETCHER as ao, IDLE_BLOCKER as ap, data as aq, generatePath as ar, isRouteErrorResponse as as, matchPath as at, matchRoutes as au, redirect as av, redirectDocument as aw, replace as ax, resolvePath as ay, type DataRouteMatch as az, type ServerDataFrom as b, type History as b0, type CreateStaticHandlerOptions as b1, type GetActionData as c, type Router as d, type RouteModules as e, type IndexRouteObject as f, type LoaderFunction as g, type MetaFunction as h, type LinksFunction as i, type NonIndexRouteObject as j, type AppLoadContext as k, unstable_RouterContextProvider as l, type MiddlewareEnabled as m, type unstable_InitialContext as n, type ClientActionFunction as o, type ClientLoaderFunction as p, type HeadersFunction as q, type ShouldRevalidateFunction as r, type Params as s, type RouterInit as t, type unstable_MiddlewareNextFunction as u, type RouterState as v, type PatchRoutesOnNavigationFunction as w, type DataRouteObject as x, type Path as y, type StaticHandler as z };
1870
+ export { type GetScrollRestorationKeyFunction as $, Action as A, type BlockerFunction as B, type ClientDataFunctionArgs as C, type DataStrategyFunction as D, type unstable_InitialContext as E, type Equal as F, type GetLoaderData as G, type HydrationState as H, type InitialEntry as I, type ClientActionFunction as J, type ClientLoaderFunction as K, type LinkDescriptor as L, type MetaDescriptor as M, type Normalize as N, type HeadersFunction as O, type Pretty as P, type ShouldRevalidateFunction as Q, type RouteModule$1 as R, type ServerDataFunctionArgs as S, type To as T, type UIMatch as U, type RouterInit as V, type RouterState as W, type PatchRoutesOnNavigationFunction as X, type DataRouteObject as Y, type StaticHandler as Z, type GetScrollPositionFunction as _, type Location as a, type ServerRouteModule as a$, type StaticHandlerContext as a0, type Fetcher as a1, type NavigationStates as a2, type RouterSubscriber as a3, type RouterNavigateOptions as a4, type RouterFetchOptions as a5, type RevalidationState as a6, type ActionFunctionArgs as a7, type DataStrategyFunctionArgs as a8, type DataStrategyMatch as a9, replace as aA, resolvePath as aB, type DataRouteMatch as aC, type Navigator as aD, type PatchRoutesOnNavigationFunctionArgs as aE, type RouteMatch as aF, type ClientActionFunctionArgs as aG, type ClientLoaderFunctionArgs as aH, type HeadersArgs as aI, type MetaArgs as aJ, type PageLinkDescriptor as aK, type HtmlLinkDescriptor as aL, type Future as aM, type unstable_SerializesTo as aN, createBrowserHistory as aO, invariant as aP, createRouter as aQ, ErrorResponseImpl as aR, DataRouterContext as aS, DataRouterStateContext as aT, FetchersContext as aU, LocationContext as aV, NavigationContext as aW, RouteContext as aX, ViewTransitionContext as aY, type FutureConfig as aZ, type RouteManifest as a_, type DataStrategyResult as aa, DataWithResponseInit as ab, type ErrorResponse as ac, type FormEncType as ad, type FormMethod as ae, type HTMLFormMethod as af, type LazyRouteFunction as ag, type LoaderFunctionArgs as ah, type unstable_MiddlewareFunction as ai, type PathParam as aj, type RedirectFunction as ak, type unstable_RouterContext as al, type ShouldRevalidateFunctionArgs as am, unstable_createContext as an, createPath as ao, parsePath as ap, IDLE_NAVIGATION as aq, IDLE_FETCHER as ar, IDLE_BLOCKER as as, data as at, generatePath as au, isRouteErrorResponse as av, matchPath as aw, matchRoutes as ax, redirect as ay, redirectDocument as az, type ServerDataFrom as b, type History as b0, type CreateStaticHandlerOptions as b1, type GetActionData as c, type Router as d, type RouteModules as e, type NavigateOptions as f, type Blocker as g, type SerializeFrom as h, type RelativeRoutingType as i, type ParamParseKey as j, type Path as k, type PathPattern as l, type PathMatch as m, type Navigation as n, type Params as o, type RouteObject as p, type IndexRouteObject as q, type LoaderFunction as r, type ActionFunction as s, type MetaFunction as t, type unstable_MiddlewareNextFunction as u, type LinksFunction as v, type NonIndexRouteObject as w, type AppLoadContext as x, unstable_RouterContextProvider as y, type MiddlewareEnabled as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-router",
3
- "version": "7.7.0-pre.1",
3
+ "version": "7.7.0",
4
4
  "description": "Declarative routing for React",
5
5
  "keywords": [
6
6
  "react",