react-router 7.6.1 → 7.6.2

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 (32) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/development/{chunk-DQRVZFIR.mjs → chunk-NL6KNZEE.mjs} +48 -39
  3. package/dist/development/dom-export.d.mts +2 -2
  4. package/dist/development/dom-export.js +1 -1
  5. package/dist/development/dom-export.mjs +2 -2
  6. package/dist/development/index.d.mts +8 -389
  7. package/dist/development/index.d.ts +819 -799
  8. package/dist/development/index.js +51 -39
  9. package/dist/development/index.mjs +9 -3
  10. package/dist/development/lib/types/internal.d.mts +1 -1
  11. package/dist/development/lib/types/internal.d.ts +1 -1
  12. package/dist/development/lib/types/internal.js +1 -1
  13. package/dist/development/lib/types/internal.mjs +1 -1
  14. package/dist/{production/lib-B8x_tOvL.d.mts → development/lib-C1JSsICm.d.mts} +537 -136
  15. package/dist/{production/register-BkDIKxVz.d.ts → development/register-DCE0tH5m.d.ts} +1 -1
  16. package/dist/{production/route-data-WyrduLgj.d.mts → development/route-data-ByAYLHuM.d.mts} +1 -1
  17. package/dist/production/{chunk-UG2XJOVM.mjs → chunk-JRQCFVZH.mjs} +48 -39
  18. package/dist/production/dom-export.d.mts +2 -2
  19. package/dist/production/dom-export.js +1 -1
  20. package/dist/production/dom-export.mjs +2 -2
  21. package/dist/production/index.d.mts +8 -389
  22. package/dist/production/index.d.ts +819 -799
  23. package/dist/production/index.js +51 -39
  24. package/dist/production/index.mjs +9 -3
  25. package/dist/production/lib/types/internal.d.mts +1 -1
  26. package/dist/production/lib/types/internal.d.ts +1 -1
  27. package/dist/production/lib/types/internal.js +1 -1
  28. package/dist/production/lib/types/internal.mjs +1 -1
  29. package/dist/{development/lib-B8x_tOvL.d.mts → production/lib-C1JSsICm.d.mts} +537 -136
  30. package/dist/{development/register-BkDIKxVz.d.ts → production/register-DCE0tH5m.d.ts} +1 -1
  31. package/dist/{development/route-data-WyrduLgj.d.mts → production/route-data-ByAYLHuM.d.mts} +1 -1
  32. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.6.1
2
+ * react-router v7.6.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -98,6 +98,9 @@ __export(react_router_exports, {
98
98
  UNSAFE_shouldHydrateRouteLoader: () => shouldHydrateRouteLoader,
99
99
  UNSAFE_useFogOFWarDiscovery: () => useFogOFWarDiscovery,
100
100
  UNSAFE_useScrollRestoration: () => useScrollRestoration,
101
+ UNSAFE_withComponentProps: () => withComponentProps,
102
+ UNSAFE_withErrorBoundaryProps: () => withErrorBoundaryProps,
103
+ UNSAFE_withHydrateFallbackProps: () => withHydrateFallbackProps,
101
104
  createBrowserRouter: () => createBrowserRouter,
102
105
  createCookie: () => createCookie,
103
106
  createCookieSessionStorage: () => createCookieSessionStorage,
@@ -6070,6 +6073,38 @@ var createRoutesFromElements = createRoutesFromChildren;
6070
6073
  function renderMatches(matches) {
6071
6074
  return _renderMatches(matches);
6072
6075
  }
6076
+ function withComponentProps(Component4) {
6077
+ return function WithComponentProps() {
6078
+ const props = {
6079
+ params: useParams(),
6080
+ loaderData: useLoaderData(),
6081
+ actionData: useActionData(),
6082
+ matches: useMatches()
6083
+ };
6084
+ return React3.createElement(Component4, props);
6085
+ };
6086
+ }
6087
+ function withHydrateFallbackProps(HydrateFallback) {
6088
+ return function WithHydrateFallbackProps() {
6089
+ const props = {
6090
+ params: useParams(),
6091
+ loaderData: useLoaderData(),
6092
+ actionData: useActionData()
6093
+ };
6094
+ return React3.createElement(HydrateFallback, props);
6095
+ };
6096
+ }
6097
+ function withErrorBoundaryProps(ErrorBoundary) {
6098
+ return function WithErrorBoundaryProps() {
6099
+ const props = {
6100
+ params: useParams(),
6101
+ loaderData: useLoaderData(),
6102
+ actionData: useActionData(),
6103
+ error: useRouteError()
6104
+ };
6105
+ return React3.createElement(ErrorBoundary, props);
6106
+ };
6107
+ }
6073
6108
 
6074
6109
  // lib/dom/lib.tsx
6075
6110
  var React10 = __toESM(require("react"));
@@ -8835,7 +8870,7 @@ function mergeRefs(...refs) {
8835
8870
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
8836
8871
  try {
8837
8872
  if (isBrowser) {
8838
- window.__reactRouterVersion = "7.6.1";
8873
+ window.__reactRouterVersion = "7.6.2";
8839
8874
  }
8840
8875
  } catch (e) {
8841
8876
  }
@@ -10029,37 +10064,6 @@ function createRoutesStub(routes, unstable_getContext) {
10029
10064
  return /* @__PURE__ */ React13.createElement(FrameworkContext.Provider, { value: remixContextRef.current }, /* @__PURE__ */ React13.createElement(RouterProvider, { router: routerRef.current }));
10030
10065
  };
10031
10066
  }
10032
- function withComponentProps(Component4) {
10033
- return function Wrapped() {
10034
- return React13.createElement(Component4, {
10035
- params: useParams(),
10036
- loaderData: useLoaderData(),
10037
- actionData: useActionData(),
10038
- matches: useMatches()
10039
- });
10040
- };
10041
- }
10042
- function withHydrateFallbackProps(HydrateFallback) {
10043
- return function Wrapped() {
10044
- const props = {
10045
- params: useParams(),
10046
- loaderData: useLoaderData(),
10047
- actionData: useActionData()
10048
- };
10049
- return React13.createElement(HydrateFallback, props);
10050
- };
10051
- }
10052
- function withErrorBoundaryProps(ErrorBoundary) {
10053
- return function Wrapped() {
10054
- const props = {
10055
- params: useParams(),
10056
- loaderData: useLoaderData(),
10057
- actionData: useActionData(),
10058
- error: useRouteError()
10059
- };
10060
- return React13.createElement(ErrorBoundary, props);
10061
- };
10062
- }
10063
10067
  function processRoutes(routes, manifest, routeModules, parentId) {
10064
10068
  return routes.map((route) => {
10065
10069
  if (!route.id) {
@@ -10578,6 +10582,13 @@ function createServerHandoffString(serverHandoff) {
10578
10582
  // lib/server-runtime/headers.ts
10579
10583
  var import_set_cookie_parser = require("set-cookie-parser");
10580
10584
  function getDocumentHeaders(build, context) {
10585
+ return getDocumentHeadersImpl(context, (m) => {
10586
+ let route = build.routes[m.route.id];
10587
+ invariant3(route, `Route with id "${m.route.id}" not found in build`);
10588
+ return route.module.headers;
10589
+ });
10590
+ }
10591
+ function getDocumentHeadersImpl(context, getRouteHeadersFn) {
10581
10592
  let boundaryIdx = context.errors ? context.matches.findIndex((m) => context.errors[m.route.id]) : -1;
10582
10593
  let matches = boundaryIdx >= 0 ? context.matches.slice(0, boundaryIdx + 1) : context.matches;
10583
10594
  let errorHeaders;
@@ -10595,14 +10606,12 @@ function getDocumentHeaders(build, context) {
10595
10606
  }
10596
10607
  return matches.reduce((parentHeaders, match, idx) => {
10597
10608
  let { id } = match.route;
10598
- let route = build.routes[id];
10599
- invariant3(route, `Route with id "${id}" not found in build`);
10600
- let routeModule = route.module;
10601
10609
  let loaderHeaders = context.loaderHeaders[id] || new Headers();
10602
10610
  let actionHeaders = context.actionHeaders[id] || new Headers();
10603
10611
  let includeErrorHeaders = errorHeaders != null && idx === matches.length - 1;
10604
10612
  let includeErrorCookies = includeErrorHeaders && errorHeaders !== loaderHeaders && errorHeaders !== actionHeaders;
10605
- if (routeModule.headers == null) {
10613
+ let headersFn = getRouteHeadersFn(match);
10614
+ if (headersFn == null) {
10606
10615
  let headers2 = new Headers(parentHeaders);
10607
10616
  if (includeErrorCookies) {
10608
10617
  prependCookies(errorHeaders, headers2);
@@ -10612,12 +10621,12 @@ function getDocumentHeaders(build, context) {
10612
10621
  return headers2;
10613
10622
  }
10614
10623
  let headers = new Headers(
10615
- routeModule.headers ? typeof routeModule.headers === "function" ? routeModule.headers({
10624
+ typeof headersFn === "function" ? headersFn({
10616
10625
  loaderHeaders,
10617
10626
  parentHeaders,
10618
10627
  actionHeaders,
10619
10628
  errorHeaders: includeErrorHeaders ? errorHeaders : void 0
10620
- }) : routeModule.headers : void 0
10629
+ }) : headersFn
10621
10630
  );
10622
10631
  if (includeErrorCookies) {
10623
10632
  prependCookies(errorHeaders, headers);
@@ -11648,6 +11657,9 @@ function getHydrationData(state, routes, getRouteInfo, location, basename, isSpa
11648
11657
  UNSAFE_shouldHydrateRouteLoader,
11649
11658
  UNSAFE_useFogOFWarDiscovery,
11650
11659
  UNSAFE_useScrollRestoration,
11660
+ UNSAFE_withComponentProps,
11661
+ UNSAFE_withErrorBoundaryProps,
11662
+ UNSAFE_withHydrateFallbackProps,
11651
11663
  createBrowserRouter,
11652
11664
  createCookie,
11653
11665
  createCookieSessionStorage,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.6.1
2
+ * react-router v7.6.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -124,8 +124,11 @@ import {
124
124
  useScrollRestoration,
125
125
  useSearchParams,
126
126
  useSubmit,
127
- useViewTransitionState
128
- } from "./chunk-DQRVZFIR.mjs";
127
+ useViewTransitionState,
128
+ withComponentProps,
129
+ withErrorBoundaryProps,
130
+ withHydrateFallbackProps
131
+ } from "./chunk-NL6KNZEE.mjs";
129
132
  export {
130
133
  Await,
131
134
  BrowserRouter,
@@ -179,6 +182,9 @@ export {
179
182
  shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader,
180
183
  useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery,
181
184
  useScrollRestoration as UNSAFE_useScrollRestoration,
185
+ withComponentProps as UNSAFE_withComponentProps,
186
+ withErrorBoundaryProps as UNSAFE_withErrorBoundaryProps,
187
+ withHydrateFallbackProps as UNSAFE_withHydrateFallbackProps,
182
188
  createBrowserRouter,
183
189
  createCookie,
184
190
  createCookieSessionStorage,
@@ -1,4 +1,4 @@
1
- import { aE as LinkDescriptor, aV as RouteModule, L as Location, aB as MetaDescriptor, aW as unstable_MiddlewareNextFunction, aX as ServerDataFrom, ac as unstable_RouterContextProvider, r as MiddlewareEnabled, s as AppLoadContext, aY as Pretty, aZ as GetLoaderData, a_ as Normalize, a$ as GetActionData } from '../../route-data-WyrduLgj.mjs';
1
+ import { aD as LinkDescriptor, aV as RouteModule, L as Location, aA as MetaDescriptor, aW as unstable_MiddlewareNextFunction, aX as ServerDataFrom, a9 as unstable_RouterContextProvider, h as MiddlewareEnabled, i as AppLoadContext, aY as Pretty, aZ as GetLoaderData, a_ as Normalize, a$ as GetActionData } from '../../route-data-ByAYLHuM.mjs';
2
2
  import { a as RouteFiles, P as Pages } from '../../register-DeIo2iHO.mjs';
3
3
  import 'react';
4
4
 
@@ -1,4 +1,4 @@
1
- import { aI as LinkDescriptor, aX as RouteModule, e as Location, aG as MetaDescriptor, aY as unstable_MiddlewareNextFunction, aZ as ServerDataFrom, u as unstable_RouterContextProvider, M as MiddlewareEnabled, i as AppLoadContext, a_ as Pretty, a$ as GetLoaderData, b0 as RouteFiles, b1 as Normalize, _ as Pages, b2 as GetActionData } from '../../register-BkDIKxVz.js';
1
+ import { aI as LinkDescriptor, aX as RouteModule, g as Location, aG as MetaDescriptor, aY as unstable_MiddlewareNextFunction, aZ as ServerDataFrom, u as unstable_RouterContextProvider, M as MiddlewareEnabled, A as AppLoadContext, a_ as Pretty, a$ as GetLoaderData, b0 as RouteFiles, b1 as Normalize, _ as Pages, b2 as GetActionData } from '../../register-DCE0tH5m.js';
2
2
  import 'react';
3
3
 
4
4
  type MaybePromise<T> = T | Promise<T>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.6.1
2
+ * react-router v7.6.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.6.1
2
+ * react-router v7.6.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *