react-router 7.1.3 → 7.1.4

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 (36) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/dist/development/{chunk-SYFQ2XB5.mjs → chunk-W3FMU5Y5.mjs} +52 -47
  3. package/dist/development/dom-export.d.mts +2 -2
  4. package/dist/development/dom-export.d.ts +2 -2
  5. package/dist/development/dom-export.js +35 -36
  6. package/dist/development/dom-export.mjs +2 -2
  7. package/dist/{production/fog-of-war-Ckdfl79L.d.ts → development/fog-of-war-CCAcUMgB.d.ts} +1 -1
  8. package/dist/development/{fog-of-war-Ckdfl79L.d.ts → fog-of-war-D6dP9JIt.d.mts} +1 -1
  9. package/dist/development/index.d.mts +5 -41
  10. package/dist/development/index.d.ts +5 -41
  11. package/dist/development/index.js +52 -47
  12. package/dist/development/index.mjs +2 -2
  13. package/dist/development/lib/types/route-module.d.mts +1 -1
  14. package/dist/development/lib/types/route-module.d.ts +1 -1
  15. package/dist/development/lib/types/route-module.js +1 -1
  16. package/dist/development/lib/types/route-module.mjs +1 -1
  17. package/dist/development/{route-data-Cw8htKcF.d.ts → route-data-Cq_b5feC.d.mts} +27 -1
  18. package/dist/{production/route-data-Cw8htKcF.d.mts → development/route-data-Cq_b5feC.d.ts} +27 -1
  19. package/dist/production/{chunk-OKQ6KMOJ.mjs → chunk-FIUQORTV.mjs} +52 -47
  20. package/dist/production/dom-export.d.mts +2 -2
  21. package/dist/production/dom-export.d.ts +2 -2
  22. package/dist/production/dom-export.js +35 -36
  23. package/dist/production/dom-export.mjs +2 -2
  24. package/dist/{development/fog-of-war-ClXvjZ4E.d.mts → production/fog-of-war-CCAcUMgB.d.ts} +1 -1
  25. package/dist/production/{fog-of-war-ClXvjZ4E.d.mts → fog-of-war-D6dP9JIt.d.mts} +1 -1
  26. package/dist/production/index.d.mts +5 -41
  27. package/dist/production/index.d.ts +5 -41
  28. package/dist/production/index.js +52 -47
  29. package/dist/production/index.mjs +2 -2
  30. package/dist/production/lib/types/route-module.d.mts +1 -1
  31. package/dist/production/lib/types/route-module.d.ts +1 -1
  32. package/dist/production/lib/types/route-module.js +1 -1
  33. package/dist/production/lib/types/route-module.mjs +1 -1
  34. package/dist/production/{route-data-Cw8htKcF.d.ts → route-data-Cq_b5feC.d.mts} +27 -1
  35. package/dist/{development/route-data-Cw8htKcF.d.mts → production/route-data-Cq_b5feC.d.ts} +27 -1
  36. package/package.json +1 -1
@@ -1355,6 +1355,9 @@ type LinkDescriptor = HtmlLinkDescriptor | PageLinkDescriptor;
1355
1355
  interface RouteModules {
1356
1356
  [routeId: string]: RouteModule | undefined;
1357
1357
  }
1358
+ /**
1359
+ * The shape of a route module shipped to the client
1360
+ */
1358
1361
  interface RouteModule {
1359
1362
  clientAction?: ClientActionFunction;
1360
1363
  clientLoader?: ClientLoaderFunction;
@@ -1367,6 +1370,16 @@ interface RouteModule {
1367
1370
  meta?: MetaFunction;
1368
1371
  shouldRevalidate?: ShouldRevalidateFunction;
1369
1372
  }
1373
+ /**
1374
+ * The shape of a route module on the server
1375
+ */
1376
+ interface ServerRouteModule extends RouteModule {
1377
+ action?: ActionFunction;
1378
+ headers?: HeadersFunction | {
1379
+ [name: string]: string;
1380
+ };
1381
+ loader?: LoaderFunction;
1382
+ }
1370
1383
  /**
1371
1384
  * A function that handles data mutations for a route on the client
1372
1385
  */
@@ -1393,6 +1406,19 @@ type ClientLoaderFunctionArgs = LoaderFunctionArgs<undefined> & {
1393
1406
  * ErrorBoundary to display for this route
1394
1407
  */
1395
1408
  type ErrorBoundaryComponent = ComponentType;
1409
+ type HeadersArgs = {
1410
+ loaderHeaders: Headers;
1411
+ parentHeaders: Headers;
1412
+ actionHeaders: Headers;
1413
+ errorHeaders: Headers | undefined;
1414
+ };
1415
+ /**
1416
+ * A function that returns HTTP headers to be used for a route. These headers
1417
+ * will be merged with (and take precedence over) headers from parent routes.
1418
+ */
1419
+ interface HeadersFunction {
1420
+ (args: HeadersArgs): Headers | HeadersInit;
1421
+ }
1396
1422
  /**
1397
1423
  * `<Route HydrateFallback>` component to render on initial loads
1398
1424
  * when client loaders are present
@@ -1549,4 +1575,4 @@ type ServerDataFrom<T> = ServerData<DataFrom<T>>;
1549
1575
  type ClientDataFrom<T> = ClientData<DataFrom<T>>;
1550
1576
  type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
1551
1577
 
1552
- export { type HTMLFormMethod as $, type ActionFunction as A, type BlockerFunction as B, type ClientActionFunction as C, type DataStrategyFunction as D, type RouterInit as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type RouterSubscriber as J, type RouterNavigateOptions as K, type LoaderFunction as L, type MetaFunction as M, type NavigateOptions as N, type RouterFetchOptions as O, type ParamParseKey as P, type DataStrategyFunctionArgs as Q, type RouteModules as R, type SerializeFrom as S, type To as T, type UIMatch as U, type DataStrategyMatch as V, type DataStrategyResult as W, DataWithResponseInit as X, type ErrorResponse as Y, type FormEncType as Z, type FormMethod as _, type Router as a, type LazyRouteFunction as a0, type PathParam as a1, type RedirectFunction as a2, type ShouldRevalidateFunction as a3, type ShouldRevalidateFunctionArgs as a4, createPath as a5, parsePath as a6, IDLE_NAVIGATION as a7, IDLE_FETCHER as a8, IDLE_BLOCKER as a9, DataRouterContext as aA, DataRouterStateContext as aB, FetchersContext as aC, LocationContext as aD, NavigationContext as aE, RouteContext as aF, ViewTransitionContext as aG, type RouteModule as aH, type History as aI, type ServerDataFrom as aJ, type ClientDataFrom as aK, type Func as aL, type Equal as aM, type Pretty as aN, data as aa, generatePath as ab, isRouteErrorResponse as ac, matchPath as ad, matchRoutes as ae, redirect as af, redirectDocument as ag, replace as ah, resolvePath as ai, type DataRouteMatch as aj, type DataRouteObject as ak, type Navigator as al, type PatchRoutesOnNavigationFunction as am, type PatchRoutesOnNavigationFunctionArgs as an, type RouteMatch as ao, type ClientActionFunctionArgs as ap, type ClientLoaderFunctionArgs as aq, type MetaArgs as ar, type MetaDescriptor as as, type PageLinkDescriptor as at, type HtmlLinkDescriptor as au, type LinkDescriptor as av, createBrowserHistory as aw, invariant as ax, createRouter as ay, ErrorResponseImpl as az, type ClientLoaderFunction as b, type LinksFunction as c, type RouteManifest as d, type LoaderFunctionArgs as e, type ActionFunctionArgs as f, type RelativeRoutingType as g, type Location as h, Action as i, type Path as j, type PathPattern as k, type PathMatch as l, type Params as m, type RouteObject as n, type Navigation as o, type RevalidationState as p, type Blocker as q, type StaticHandlerContext as r, type StaticHandler as s, type CreateStaticHandlerOptions as t, type IndexRouteObject as u, type NonIndexRouteObject as v, type RouterState as w, type GetScrollRestorationKeyFunction as x, type Fetcher as y, type NavigationStates as z };
1578
+ export { type LazyRouteFunction as $, type ActionFunctionArgs as A, type BlockerFunction as B, type CreateStaticHandlerOptions as C, type DataStrategyFunction as D, type RouterSubscriber as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type RouterNavigateOptions as J, type RouterFetchOptions as K, type LoaderFunctionArgs as L, type MetaFunction as M, type NavigateOptions as N, type DataStrategyFunctionArgs as O, type ParamParseKey as P, type DataStrategyMatch as Q, type RouteModules as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type DataStrategyResult as V, DataWithResponseInit as W, type ErrorResponse as X, type FormEncType as Y, type FormMethod as Z, type HTMLFormMethod as _, type Router as a, type PathParam as a0, type RedirectFunction as a1, type ShouldRevalidateFunction as a2, type ShouldRevalidateFunctionArgs as a3, createPath as a4, parsePath as a5, IDLE_NAVIGATION as a6, IDLE_FETCHER as a7, IDLE_BLOCKER as a8, data as a9, invariant as aA, createRouter as aB, ErrorResponseImpl as aC, DataRouterContext as aD, DataRouterStateContext as aE, FetchersContext as aF, LocationContext as aG, NavigationContext as aH, RouteContext as aI, ViewTransitionContext as aJ, type RouteModule as aK, type History as aL, type ServerDataFrom as aM, type ClientDataFrom as aN, type Func as aO, type Equal as aP, type Pretty as aQ, generatePath as aa, isRouteErrorResponse as ab, matchPath as ac, matchRoutes as ad, redirect as ae, redirectDocument as af, replace as ag, resolvePath as ah, type DataRouteMatch as ai, type DataRouteObject as aj, type Navigator as ak, type PatchRoutesOnNavigationFunction as al, type PatchRoutesOnNavigationFunctionArgs as am, type RouteMatch as an, type ClientActionFunction as ao, type ClientActionFunctionArgs as ap, type ClientLoaderFunction as aq, type ClientLoaderFunctionArgs as ar, type HeadersArgs as as, type HeadersFunction as at, type MetaArgs as au, type MetaDescriptor as av, type PageLinkDescriptor as aw, type HtmlLinkDescriptor as ax, type LinkDescriptor as ay, createBrowserHistory as az, type RouteManifest as b, type RelativeRoutingType as c, type Location as d, Action as e, type Path as f, type PathPattern as g, type PathMatch as h, type Params as i, type RouteObject as j, type Navigation as k, type RevalidationState as l, type SerializeFrom as m, type Blocker as n, type StaticHandlerContext as o, type StaticHandler as p, type IndexRouteObject as q, type LoaderFunction as r, type ActionFunction as s, type LinksFunction as t, type NonIndexRouteObject as u, type RouterState as v, type GetScrollRestorationKeyFunction as w, type Fetcher as x, type NavigationStates as y, type RouterInit as z };
@@ -1355,6 +1355,9 @@ type LinkDescriptor = HtmlLinkDescriptor | PageLinkDescriptor;
1355
1355
  interface RouteModules {
1356
1356
  [routeId: string]: RouteModule | undefined;
1357
1357
  }
1358
+ /**
1359
+ * The shape of a route module shipped to the client
1360
+ */
1358
1361
  interface RouteModule {
1359
1362
  clientAction?: ClientActionFunction;
1360
1363
  clientLoader?: ClientLoaderFunction;
@@ -1367,6 +1370,16 @@ interface RouteModule {
1367
1370
  meta?: MetaFunction;
1368
1371
  shouldRevalidate?: ShouldRevalidateFunction;
1369
1372
  }
1373
+ /**
1374
+ * The shape of a route module on the server
1375
+ */
1376
+ interface ServerRouteModule extends RouteModule {
1377
+ action?: ActionFunction;
1378
+ headers?: HeadersFunction | {
1379
+ [name: string]: string;
1380
+ };
1381
+ loader?: LoaderFunction;
1382
+ }
1370
1383
  /**
1371
1384
  * A function that handles data mutations for a route on the client
1372
1385
  */
@@ -1393,6 +1406,19 @@ type ClientLoaderFunctionArgs = LoaderFunctionArgs<undefined> & {
1393
1406
  * ErrorBoundary to display for this route
1394
1407
  */
1395
1408
  type ErrorBoundaryComponent = ComponentType;
1409
+ type HeadersArgs = {
1410
+ loaderHeaders: Headers;
1411
+ parentHeaders: Headers;
1412
+ actionHeaders: Headers;
1413
+ errorHeaders: Headers | undefined;
1414
+ };
1415
+ /**
1416
+ * A function that returns HTTP headers to be used for a route. These headers
1417
+ * will be merged with (and take precedence over) headers from parent routes.
1418
+ */
1419
+ interface HeadersFunction {
1420
+ (args: HeadersArgs): Headers | HeadersInit;
1421
+ }
1396
1422
  /**
1397
1423
  * `<Route HydrateFallback>` component to render on initial loads
1398
1424
  * when client loaders are present
@@ -1549,4 +1575,4 @@ type ServerDataFrom<T> = ServerData<DataFrom<T>>;
1549
1575
  type ClientDataFrom<T> = ClientData<DataFrom<T>>;
1550
1576
  type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
1551
1577
 
1552
- export { type HTMLFormMethod as $, type ActionFunction as A, type BlockerFunction as B, type ClientActionFunction as C, type DataStrategyFunction as D, type RouterInit as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type RouterSubscriber as J, type RouterNavigateOptions as K, type LoaderFunction as L, type MetaFunction as M, type NavigateOptions as N, type RouterFetchOptions as O, type ParamParseKey as P, type DataStrategyFunctionArgs as Q, type RouteModules as R, type SerializeFrom as S, type To as T, type UIMatch as U, type DataStrategyMatch as V, type DataStrategyResult as W, DataWithResponseInit as X, type ErrorResponse as Y, type FormEncType as Z, type FormMethod as _, type Router as a, type LazyRouteFunction as a0, type PathParam as a1, type RedirectFunction as a2, type ShouldRevalidateFunction as a3, type ShouldRevalidateFunctionArgs as a4, createPath as a5, parsePath as a6, IDLE_NAVIGATION as a7, IDLE_FETCHER as a8, IDLE_BLOCKER as a9, DataRouterContext as aA, DataRouterStateContext as aB, FetchersContext as aC, LocationContext as aD, NavigationContext as aE, RouteContext as aF, ViewTransitionContext as aG, type RouteModule as aH, type History as aI, type ServerDataFrom as aJ, type ClientDataFrom as aK, type Func as aL, type Equal as aM, type Pretty as aN, data as aa, generatePath as ab, isRouteErrorResponse as ac, matchPath as ad, matchRoutes as ae, redirect as af, redirectDocument as ag, replace as ah, resolvePath as ai, type DataRouteMatch as aj, type DataRouteObject as ak, type Navigator as al, type PatchRoutesOnNavigationFunction as am, type PatchRoutesOnNavigationFunctionArgs as an, type RouteMatch as ao, type ClientActionFunctionArgs as ap, type ClientLoaderFunctionArgs as aq, type MetaArgs as ar, type MetaDescriptor as as, type PageLinkDescriptor as at, type HtmlLinkDescriptor as au, type LinkDescriptor as av, createBrowserHistory as aw, invariant as ax, createRouter as ay, ErrorResponseImpl as az, type ClientLoaderFunction as b, type LinksFunction as c, type RouteManifest as d, type LoaderFunctionArgs as e, type ActionFunctionArgs as f, type RelativeRoutingType as g, type Location as h, Action as i, type Path as j, type PathPattern as k, type PathMatch as l, type Params as m, type RouteObject as n, type Navigation as o, type RevalidationState as p, type Blocker as q, type StaticHandlerContext as r, type StaticHandler as s, type CreateStaticHandlerOptions as t, type IndexRouteObject as u, type NonIndexRouteObject as v, type RouterState as w, type GetScrollRestorationKeyFunction as x, type Fetcher as y, type NavigationStates as z };
1578
+ export { type LazyRouteFunction as $, type ActionFunctionArgs as A, type BlockerFunction as B, type CreateStaticHandlerOptions as C, type DataStrategyFunction as D, type RouterSubscriber as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type RouterNavigateOptions as J, type RouterFetchOptions as K, type LoaderFunctionArgs as L, type MetaFunction as M, type NavigateOptions as N, type DataStrategyFunctionArgs as O, type ParamParseKey as P, type DataStrategyMatch as Q, type RouteModules as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type DataStrategyResult as V, DataWithResponseInit as W, type ErrorResponse as X, type FormEncType as Y, type FormMethod as Z, type HTMLFormMethod as _, type Router as a, type PathParam as a0, type RedirectFunction as a1, type ShouldRevalidateFunction as a2, type ShouldRevalidateFunctionArgs as a3, createPath as a4, parsePath as a5, IDLE_NAVIGATION as a6, IDLE_FETCHER as a7, IDLE_BLOCKER as a8, data as a9, invariant as aA, createRouter as aB, ErrorResponseImpl as aC, DataRouterContext as aD, DataRouterStateContext as aE, FetchersContext as aF, LocationContext as aG, NavigationContext as aH, RouteContext as aI, ViewTransitionContext as aJ, type RouteModule as aK, type History as aL, type ServerDataFrom as aM, type ClientDataFrom as aN, type Func as aO, type Equal as aP, type Pretty as aQ, generatePath as aa, isRouteErrorResponse as ab, matchPath as ac, matchRoutes as ad, redirect as ae, redirectDocument as af, replace as ag, resolvePath as ah, type DataRouteMatch as ai, type DataRouteObject as aj, type Navigator as ak, type PatchRoutesOnNavigationFunction as al, type PatchRoutesOnNavigationFunctionArgs as am, type RouteMatch as an, type ClientActionFunction as ao, type ClientActionFunctionArgs as ap, type ClientLoaderFunction as aq, type ClientLoaderFunctionArgs as ar, type HeadersArgs as as, type HeadersFunction as at, type MetaArgs as au, type MetaDescriptor as av, type PageLinkDescriptor as aw, type HtmlLinkDescriptor as ax, type LinkDescriptor as ay, createBrowserHistory as az, type RouteManifest as b, type RelativeRoutingType as c, type Location as d, Action as e, type Path as f, type PathPattern as g, type PathMatch as h, type Params as i, type RouteObject as j, type Navigation as k, type RevalidationState as l, type SerializeFrom as m, type Blocker as n, type StaticHandlerContext as o, type StaticHandler as p, type IndexRouteObject as q, type LoaderFunction as r, type ActionFunction as s, type LinksFunction as t, type NonIndexRouteObject as u, type RouterState as v, type GetScrollRestorationKeyFunction as w, type Fetcher as x, type NavigationStates as y, type RouterInit as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-router",
3
- "version": "7.1.3",
3
+ "version": "7.1.4",
4
4
  "description": "Declarative routing for React",
5
5
  "keywords": [
6
6
  "react",