react-router 7.11.0 → 7.12.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 (68) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/development/{browser-Cv4JZyZ5.d.mts → browser-BEPxnEBW.d.mts} +4 -2
  3. package/dist/{production/browser-Cv4JZyZ5.d.mts → development/browser-CJ9_du-U.d.ts} +4 -2
  4. package/dist/development/{chunk-SZQUWNVJ.js → chunk-2BEI23B2.js} +117 -35
  5. package/dist/development/{chunk-2JY4UAJA.js → chunk-7ZCBDOCZ.js} +98 -108
  6. package/dist/development/{chunk-JMJ3UQ3L.mjs → chunk-EPOLDU6W.mjs} +122 -50
  7. package/dist/development/{chunk-YNUBSHFH.mjs → chunk-FNSCYPCZ.mjs} +111 -11
  8. package/dist/{production/chunk-BEXOWXJO.js → development/chunk-G2I2SRFA.js} +7 -7
  9. package/dist/development/dom-export.d.mts +2 -2
  10. package/dist/development/dom-export.d.ts +2 -2
  11. package/dist/development/dom-export.js +35 -30
  12. package/dist/development/dom-export.mjs +12 -7
  13. package/dist/development/{index-react-server-client-P7VgYu6T.d.mts → index-react-server-client-IoJGLOqV.d.mts} +3 -1
  14. package/dist/{production/index-react-server-client-Cv5Q9lf0.d.ts → development/index-react-server-client-gGyf-7Xp.d.ts} +3 -1
  15. package/dist/development/index-react-server-client.d.mts +2 -2
  16. package/dist/development/index-react-server-client.d.ts +2 -2
  17. package/dist/development/index-react-server-client.js +4 -4
  18. package/dist/development/index-react-server-client.mjs +2 -2
  19. package/dist/development/index-react-server.d.mts +3 -1
  20. package/dist/development/index-react-server.d.ts +3 -1
  21. package/dist/development/index-react-server.js +92 -7
  22. package/dist/development/index-react-server.mjs +92 -7
  23. package/dist/development/index.d.mts +9 -9
  24. package/dist/development/index.d.ts +9 -9
  25. package/dist/development/index.js +205 -101
  26. package/dist/development/index.mjs +7 -3
  27. package/dist/{production/instrumentation-BlrVzjbg.d.ts → development/instrumentation-DvHY1sgY.d.ts} +45 -1
  28. package/dist/development/lib/types/internal.d.mts +2 -2
  29. package/dist/development/lib/types/internal.d.ts +2 -2
  30. package/dist/development/lib/types/internal.js +1 -1
  31. package/dist/development/lib/types/internal.mjs +1 -1
  32. package/dist/development/{register-BGQUMCK4.d.ts → register-Bm80E9qL.d.ts} +1 -1
  33. package/dist/development/{register-DTJJbt1o.d.mts → register-CS_tiXsm.d.mts} +1 -1
  34. package/dist/development/{router-5fbeEIMQ.d.mts → router-5iOvts3c.d.mts} +45 -1
  35. package/dist/{development/browser-o-qhcuhA.d.ts → production/browser-BEPxnEBW.d.mts} +4 -2
  36. package/dist/production/{browser-o-qhcuhA.d.ts → browser-CJ9_du-U.d.ts} +4 -2
  37. package/dist/{development/chunk-GNDLROV6.js → production/chunk-337Z4Y65.js} +7 -7
  38. package/dist/production/{chunk-TINMVEA2.mjs → chunk-DZM3VO5F.mjs} +122 -50
  39. package/dist/production/{chunk-E6GYEQUT.mjs → chunk-QCD7HIN2.mjs} +111 -11
  40. package/dist/production/{chunk-ZMYPVUNZ.js → chunk-Y62AB6TB.js} +98 -108
  41. package/dist/production/{chunk-2HFJAX7U.js → chunk-Z47B263N.js} +117 -35
  42. package/dist/production/dom-export.d.mts +2 -2
  43. package/dist/production/dom-export.d.ts +2 -2
  44. package/dist/production/dom-export.js +35 -30
  45. package/dist/production/dom-export.mjs +12 -7
  46. package/dist/production/{index-react-server-client-P7VgYu6T.d.mts → index-react-server-client-IoJGLOqV.d.mts} +3 -1
  47. package/dist/{development/index-react-server-client-Cv5Q9lf0.d.ts → production/index-react-server-client-gGyf-7Xp.d.ts} +3 -1
  48. package/dist/production/index-react-server-client.d.mts +2 -2
  49. package/dist/production/index-react-server-client.d.ts +2 -2
  50. package/dist/production/index-react-server-client.js +4 -4
  51. package/dist/production/index-react-server-client.mjs +2 -2
  52. package/dist/production/index-react-server.d.mts +3 -1
  53. package/dist/production/index-react-server.d.ts +3 -1
  54. package/dist/production/index-react-server.js +92 -7
  55. package/dist/production/index-react-server.mjs +92 -7
  56. package/dist/production/index.d.mts +9 -9
  57. package/dist/production/index.d.ts +9 -9
  58. package/dist/production/index.js +205 -101
  59. package/dist/production/index.mjs +7 -3
  60. package/dist/{development/instrumentation-BlrVzjbg.d.ts → production/instrumentation-DvHY1sgY.d.ts} +45 -1
  61. package/dist/production/lib/types/internal.d.mts +2 -2
  62. package/dist/production/lib/types/internal.d.ts +2 -2
  63. package/dist/production/lib/types/internal.js +1 -1
  64. package/dist/production/lib/types/internal.mjs +1 -1
  65. package/dist/production/{register-BGQUMCK4.d.ts → register-Bm80E9qL.d.ts} +1 -1
  66. package/dist/production/{register-DTJJbt1o.d.mts → register-CS_tiXsm.d.mts} +1 -1
  67. package/dist/production/{router-5fbeEIMQ.d.mts → router-5iOvts3c.d.mts} +45 -1
  68. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2
- * react-router v7.11.0
2
+ * react-router v7.12.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -13,7 +13,7 @@
13
13
 
14
14
 
15
15
 
16
- var _chunkGNDLROV6js = require('./chunk-GNDLROV6.js');
16
+ var _chunkG2I2SRFAjs = require('./chunk-G2I2SRFA.js');
17
17
 
18
18
 
19
19
 
@@ -32,7 +32,7 @@ var _chunkGNDLROV6js = require('./chunk-GNDLROV6.js');
32
32
 
33
33
 
34
34
 
35
- var _chunkSZQUWNVJjs = require('./chunk-SZQUWNVJ.js');
35
+ var _chunk2BEI23B2js = require('./chunk-2BEI23B2.js');
36
36
 
37
37
  // lib/dom-export/dom-router-provider.tsx
38
38
  var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
@@ -166,7 +166,8 @@ function createHydratedRouter({
166
166
  ssrInfo.manifest,
167
167
  ssrInfo.routeModules,
168
168
  ssrInfo.context.ssr,
169
- ssrInfo.context.basename
169
+ ssrInfo.context.basename,
170
+ ssrInfo.context.future.unstable_trailingSlashAwareDataRequests
170
171
  ),
171
172
  patchRoutesOnNavigation: _reactrouter.UNSAFE_getPatchRoutesOnNavigationFunction.call(void 0,
172
173
  ssrInfo.manifest,
@@ -204,7 +205,7 @@ function HydratedRouter(props) {
204
205
  }, []);
205
206
  React2.useEffect(() => {
206
207
  if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
207
- document.querySelectorAll(`[${_chunkSZQUWNVJjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
208
+ document.querySelectorAll(`[${_chunk2BEI23B2js.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
208
209
  }
209
210
  }, [criticalCss]);
210
211
  let [location2, setLocation] = React2.useState(router.state.location);
@@ -376,10 +377,10 @@ function createRouterFromPayload({
376
377
  };
377
378
  if (payload.type !== "render") throw new Error("Invalid payload type");
378
379
  globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {}));
379
- _chunkGNDLROV6js.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
380
+ _chunkG2I2SRFAjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
380
381
  let patches = /* @__PURE__ */ new Map();
381
382
  _optionalChain([payload, 'access', _22 => _22.patches, 'optionalAccess', _23 => _23.forEach, 'call', _24 => _24((patch) => {
382
- _chunkSZQUWNVJjs.invariant.call(void 0, patch.parentId, "Invalid patch parentId");
383
+ _chunk2BEI23B2js.invariant.call(void 0, patch.parentId, "Invalid patch parentId");
383
384
  if (!patches.has(patch.parentId)) {
384
385
  patches.set(patch.parentId, []);
385
386
  }
@@ -401,12 +402,12 @@ function createRouterFromPayload({
401
402
  }
402
403
  return [route];
403
404
  }, []);
404
- globalVar.__reactRouterDataRouter = _chunkSZQUWNVJjs.createRouter.call(void 0, {
405
+ globalVar.__reactRouterDataRouter = _chunk2BEI23B2js.createRouter.call(void 0, {
405
406
  routes,
406
407
  getContext,
407
408
  basename: payload.basename,
408
- history: _chunkSZQUWNVJjs.createBrowserHistory.call(void 0, ),
409
- hydrationData: _chunkGNDLROV6js.getHydrationData.call(void 0, {
409
+ history: _chunk2BEI23B2js.createBrowserHistory.call(void 0, ),
410
+ hydrationData: _chunkG2I2SRFAjs.getHydrationData.call(void 0, {
410
411
  state: {
411
412
  loaderData: payload.loaderData,
412
413
  actionData: payload.actionData,
@@ -415,7 +416,7 @@ function createRouterFromPayload({
415
416
  routes,
416
417
  getRouteInfo: (routeId) => {
417
418
  let match = payload.matches.find((m) => m.id === routeId);
418
- _chunkSZQUWNVJjs.invariant.call(void 0, match, "Route not found in payload");
419
+ _chunk2BEI23B2js.invariant.call(void 0, match, "Route not found in payload");
419
420
  return {
420
421
  clientLoader: match.clientLoader,
421
422
  hasLoader: match.hasLoader,
@@ -513,9 +514,9 @@ function createRouterFromPayload({
513
514
  routeModules: globalVar.__reactRouterRouteModules
514
515
  };
515
516
  }
516
- var renderedRoutesContext = _chunkSZQUWNVJjs.createContext.call(void 0, );
517
+ var renderedRoutesContext = _chunk2BEI23B2js.createContext.call(void 0, );
517
518
  function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
518
- let dataStrategy = _chunkSZQUWNVJjs.getSingleFetchDataStrategyImpl.call(void 0,
519
+ let dataStrategy = _chunk2BEI23B2js.getSingleFetchDataStrategyImpl.call(void 0,
519
520
  getRouter,
520
521
  (match) => {
521
522
  let M = match;
@@ -532,6 +533,8 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
532
533
  getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation),
533
534
  ssr,
534
535
  basename,
536
+ // .rsc requests are always trailing slash aware
537
+ true,
535
538
  // If the route has a component but we don't have an element, we need to hit
536
539
  // the server loader flow regardless of whether the client loader calls
537
540
  // `serverLoader` or not, otherwise we'll have nothing to render.
@@ -569,22 +572,22 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
569
572
  });
570
573
  }
571
574
  function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
572
- return async (args, basename, targetRoutes) => {
575
+ return async (args, basename, trailingSlashAware, targetRoutes) => {
573
576
  let { request, context } = args;
574
- let url = _chunkSZQUWNVJjs.singleFetchUrl.call(void 0, request.url, basename, "rsc");
577
+ let url = _chunk2BEI23B2js.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
575
578
  if (request.method === "GET") {
576
- url = _chunkSZQUWNVJjs.stripIndexParam.call(void 0, url);
579
+ url = _chunk2BEI23B2js.stripIndexParam.call(void 0, url);
577
580
  if (targetRoutes) {
578
581
  url.searchParams.set("_routes", targetRoutes.join(","));
579
582
  }
580
583
  }
581
584
  let res = await fetchImplementation(
582
- new Request(url, await _chunkSZQUWNVJjs.createRequestInit.call(void 0, request))
585
+ new Request(url, await _chunk2BEI23B2js.createRequestInit.call(void 0, request))
583
586
  );
584
587
  if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
585
- throw new (0, _chunkSZQUWNVJjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
588
+ throw new (0, _chunk2BEI23B2js.ErrorResponseImpl)(res.status, res.statusText, await res.text());
586
589
  }
587
- _chunkSZQUWNVJjs.invariant.call(void 0, res.body, "No response body to decode");
590
+ _chunk2BEI23B2js.invariant.call(void 0, res.body, "No response body to decode");
588
591
  try {
589
592
  const payload = await createFromReadableStream(res.body, {
590
593
  temporaryReferences: void 0
@@ -608,7 +611,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
608
611
  }
609
612
  context.get(renderedRoutesContext).push(...payload.matches);
610
613
  let results = { routes: {} };
611
- const dataKey = _chunkSZQUWNVJjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
614
+ const dataKey = _chunk2BEI23B2js.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
612
615
  for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {
613
616
  results.routes[routeId] = { data };
614
617
  }
@@ -641,7 +644,7 @@ function RSCHydratedRouter({
641
644
  [createFromReadableStream, payload, fetchImplementation, getContext]
642
645
  );
643
646
  React3.useEffect(() => {
644
- _chunkSZQUWNVJjs.setIsHydrated.call(void 0, );
647
+ _chunk2BEI23B2js.setIsHydrated.call(void 0, );
645
648
  }, []);
646
649
  React3.useLayoutEffect(() => {
647
650
  const globalVar = window;
@@ -726,7 +729,9 @@ function RSCHydratedRouter({
726
729
  // These flags have no runtime impact so can always be false. If we add
727
730
  // flags that drive runtime behavior they'll need to be proxied through.
728
731
  v8_middleware: false,
729
- unstable_subResourceIntegrity: false
732
+ unstable_subResourceIntegrity: false,
733
+ unstable_trailingSlashAwareDataRequests: true
734
+ // always on for RSC
730
735
  },
731
736
  isSpaMode: false,
732
737
  ssr: true,
@@ -743,8 +748,8 @@ function RSCHydratedRouter({
743
748
  routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" },
744
749
  routeModules
745
750
  };
746
- return /* @__PURE__ */ React3.createElement(_chunkSZQUWNVJjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkGNDLROV6js.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkSZQUWNVJjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
747
- _chunkSZQUWNVJjs.RouterProvider,
751
+ return /* @__PURE__ */ React3.createElement(_chunk2BEI23B2js.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkG2I2SRFAjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunk2BEI23B2js.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
752
+ _chunk2BEI23B2js.RouterProvider,
748
753
  {
749
754
  router: transitionEnabledRouter,
750
755
  flushSync: ReactDOM2.flushSync
@@ -760,8 +765,8 @@ function createRouteFromServerManifest(match, payload) {
760
765
  // the server loader flow regardless of whether the client loader calls
761
766
  // `serverLoader` or not, otherwise we'll have nothing to render.
762
767
  match.hasComponent && !match.element;
763
- _chunkSZQUWNVJjs.invariant.call(void 0, window.__reactRouterRouteModules);
764
- _chunkGNDLROV6js.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
768
+ _chunk2BEI23B2js.invariant.call(void 0, window.__reactRouterRouteModules);
769
+ _chunkG2I2SRFAjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
765
770
  let dataRoute = {
766
771
  id: match.id,
767
772
  element: match.element,
@@ -811,7 +816,7 @@ function createRouteFromServerManifest(match, payload) {
811
816
  return await callSingleFetch(singleFetch);
812
817
  }
813
818
  }) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => {
814
- throw _chunkSZQUWNVJjs.noActionDefinedError.call(void 0, "action", match.id);
819
+ throw _chunk2BEI23B2js.noActionDefinedError.call(void 0, "action", match.id);
815
820
  },
816
821
  path: match.path,
817
822
  shouldRevalidate: match.shouldRevalidate,
@@ -824,7 +829,7 @@ function createRouteFromServerManifest(match, payload) {
824
829
  hasShouldRevalidate: match.shouldRevalidate != null
825
830
  };
826
831
  if (typeof dataRoute.loader === "function") {
827
- dataRoute.loader.hydrate = _chunkSZQUWNVJjs.shouldHydrateRouteLoader.call(void 0,
832
+ dataRoute.loader.hydrate = _chunk2BEI23B2js.shouldHydrateRouteLoader.call(void 0,
828
833
  match.id,
829
834
  match.clientLoader,
830
835
  match.hasLoader,
@@ -834,7 +839,7 @@ function createRouteFromServerManifest(match, payload) {
834
839
  return dataRoute;
835
840
  }
836
841
  function callSingleFetch(singleFetch) {
837
- _chunkSZQUWNVJjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
842
+ _chunk2BEI23B2js.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
838
843
  return singleFetch();
839
844
  }
840
845
  function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
@@ -842,7 +847,7 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
842
847
  let fn = type === "action" ? "serverAction()" : "serverLoader()";
843
848
  let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
844
849
  console.error(msg);
845
- throw new (0, _chunkSZQUWNVJjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
850
+ throw new (0, _chunk2BEI23B2js.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
846
851
  }
847
852
  }
848
853
  var nextPaths = /* @__PURE__ */ new Set();
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.11.0
2
+ * react-router v7.12.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -14,7 +14,7 @@ import {
14
14
  deserializeErrors,
15
15
  getHydrationData,
16
16
  populateRSCRouteModules
17
- } from "./chunk-YNUBSHFH.mjs";
17
+ } from "./chunk-FNSCYPCZ.mjs";
18
18
  import {
19
19
  CRITICAL_CSS_DATA_ATTRIBUTE,
20
20
  ErrorResponseImpl,
@@ -42,7 +42,7 @@ import {
42
42
  singleFetchUrl,
43
43
  stripIndexParam,
44
44
  useFogOFWarDiscovery
45
- } from "./chunk-JMJ3UQ3L.mjs";
45
+ } from "./chunk-EPOLDU6W.mjs";
46
46
 
47
47
  // lib/dom-export/dom-router-provider.tsx
48
48
  import * as React from "react";
@@ -158,7 +158,8 @@ function createHydratedRouter({
158
158
  ssrInfo.manifest,
159
159
  ssrInfo.routeModules,
160
160
  ssrInfo.context.ssr,
161
- ssrInfo.context.basename
161
+ ssrInfo.context.basename,
162
+ ssrInfo.context.future.unstable_trailingSlashAwareDataRequests
162
163
  ),
163
164
  patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(
164
165
  ssrInfo.manifest,
@@ -524,6 +525,8 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
524
525
  getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation),
525
526
  ssr,
526
527
  basename,
528
+ // .rsc requests are always trailing slash aware
529
+ true,
527
530
  // If the route has a component but we don't have an element, we need to hit
528
531
  // the server loader flow regardless of whether the client loader calls
529
532
  // `serverLoader` or not, otherwise we'll have nothing to render.
@@ -561,9 +564,9 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
561
564
  });
562
565
  }
563
566
  function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
564
- return async (args, basename, targetRoutes) => {
567
+ return async (args, basename, trailingSlashAware, targetRoutes) => {
565
568
  let { request, context } = args;
566
- let url = singleFetchUrl(request.url, basename, "rsc");
569
+ let url = singleFetchUrl(request.url, basename, trailingSlashAware, "rsc");
567
570
  if (request.method === "GET") {
568
571
  url = stripIndexParam(url);
569
572
  if (targetRoutes) {
@@ -718,7 +721,9 @@ function RSCHydratedRouter({
718
721
  // These flags have no runtime impact so can always be false. If we add
719
722
  // flags that drive runtime behavior they'll need to be proxied through.
720
723
  v8_middleware: false,
721
- unstable_subResourceIntegrity: false
724
+ unstable_subResourceIntegrity: false,
725
+ unstable_trailingSlashAwareDataRequests: true
726
+ // always on for RSC
722
727
  },
723
728
  isSpaMode: false,
724
729
  ssr: true,
@@ -1,4 +1,4 @@
1
- import { bE as RouteManifest, q as RouteModules, W as HydrationState, a3 as DataRouteObject, a as ClientLoaderFunction, a7 as StaticHandlerContext, bF as ServerRouteModule, s as MiddlewareEnabled, c as RouterContextProvider, t as AppLoadContext, an as LoaderFunctionArgs, ae as ActionFunctionArgs, aw as unstable_ServerInstrumentation, al as HTMLFormMethod, aj as FormEncType, y as RelativeRoutingType, bh as PageLinkDescriptor, T as To, bG as History, a6 as GetScrollRestorationKeyFunction, e as RouterInit, bH as FutureConfig$1, u as unstable_ClientInstrumentation, r as DataStrategyFunction, a2 as PatchRoutesOnNavigationFunction, v as NavigateOptions, a8 as Fetcher, Q as RouteObject, p as Router, x as SerializeFrom, B as BlockerFunction, L as Location, bI as CreateStaticHandlerOptions$1, a4 as StaticHandler } from './router-5fbeEIMQ.mjs';
1
+ import { bG as RouteManifest, q as RouteModules, W as HydrationState, a3 as DataRouteObject, a as ClientLoaderFunction, a7 as StaticHandlerContext, bH as ServerRouteModule, s as MiddlewareEnabled, c as RouterContextProvider, t as AppLoadContext, an as LoaderFunctionArgs, ae as ActionFunctionArgs, aw as unstable_ServerInstrumentation, al as HTMLFormMethod, aj as FormEncType, y as RelativeRoutingType, bh as PageLinkDescriptor, T as To, bI as History, a6 as GetScrollRestorationKeyFunction, e as RouterInit, bJ as FutureConfig$1, u as unstable_ClientInstrumentation, r as DataStrategyFunction, a2 as PatchRoutesOnNavigationFunction, v as NavigateOptions, a8 as Fetcher, Q as RouteObject, p as Router, x as SerializeFrom, B as BlockerFunction, L as Location, bK as CreateStaticHandlerOptions$1, a4 as StaticHandler } from './router-5iOvts3c.mjs';
2
2
  import * as React from 'react';
3
3
 
4
4
  interface Route {
@@ -59,6 +59,7 @@ interface EntryContext extends FrameworkContextObject {
59
59
  }
60
60
  interface FutureConfig {
61
61
  unstable_subResourceIntegrity: boolean;
62
+ unstable_trailingSlashAwareDataRequests: boolean;
62
63
  v8_middleware: boolean;
63
64
  }
64
65
  type CriticalCss = string | {
@@ -113,6 +114,7 @@ interface ServerBuild {
113
114
  mode: "lazy" | "initial";
114
115
  manifestPath: string;
115
116
  };
117
+ allowedActionOrigins?: string[] | false;
116
118
  }
117
119
  interface HandleDocumentRequestFunction {
118
120
  (request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: MiddlewareEnabled extends true ? RouterContextProvider : AppLoadContext): Promise<Response> | Response;
@@ -1,4 +1,4 @@
1
- import { bE as RouteManifest, o as RouteModules, Q as HydrationState, a1 as DataRouteObject, a as ClientLoaderFunction, a5 as StaticHandlerContext, bF as ServerRouteModule, q as MiddlewareEnabled, c as RouterContextProvider, r as AppLoadContext, al as LoaderFunctionArgs, ac as ActionFunctionArgs, au as unstable_ServerInstrumentation, aj as HTMLFormMethod, ah as FormEncType, w as RelativeRoutingType, bh as PageLinkDescriptor, T as To, bG as History, a4 as GetScrollRestorationKeyFunction, e as RouterInit, bH as FutureConfig$1, u as unstable_ClientInstrumentation, p as DataStrategyFunction, a0 as PatchRoutesOnNavigationFunction, s as NavigateOptions, a6 as Fetcher, K as RouteObject, n as Router, v as SerializeFrom, B as BlockerFunction, L as Location, bI as CreateStaticHandlerOptions$1, a2 as StaticHandler } from './instrumentation-BlrVzjbg.js';
1
+ import { bG as RouteManifest, o as RouteModules, Q as HydrationState, a1 as DataRouteObject, a as ClientLoaderFunction, a5 as StaticHandlerContext, bH as ServerRouteModule, q as MiddlewareEnabled, c as RouterContextProvider, r as AppLoadContext, al as LoaderFunctionArgs, ac as ActionFunctionArgs, au as unstable_ServerInstrumentation, aj as HTMLFormMethod, ah as FormEncType, w as RelativeRoutingType, bh as PageLinkDescriptor, T as To, bI as History, a4 as GetScrollRestorationKeyFunction, e as RouterInit, bJ as FutureConfig$1, u as unstable_ClientInstrumentation, p as DataStrategyFunction, a0 as PatchRoutesOnNavigationFunction, s as NavigateOptions, a6 as Fetcher, K as RouteObject, n as Router, v as SerializeFrom, B as BlockerFunction, L as Location, bK as CreateStaticHandlerOptions$1, a2 as StaticHandler } from './instrumentation-DvHY1sgY.js';
2
2
  import * as React from 'react';
3
3
 
4
4
  interface Route {
@@ -59,6 +59,7 @@ interface EntryContext extends FrameworkContextObject {
59
59
  }
60
60
  interface FutureConfig {
61
61
  unstable_subResourceIntegrity: boolean;
62
+ unstable_trailingSlashAwareDataRequests: boolean;
62
63
  v8_middleware: boolean;
63
64
  }
64
65
  type CriticalCss = string | {
@@ -113,6 +114,7 @@ interface ServerBuild {
113
114
  mode: "lazy" | "initial";
114
115
  manifestPath: string;
115
116
  };
117
+ allowedActionOrigins?: string[] | false;
116
118
  }
117
119
  interface HandleDocumentRequestFunction {
118
120
  (request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: MiddlewareEnabled extends true ? RouterContextProvider : AppLoadContext): Promise<Response> | Response;
@@ -1,3 +1,3 @@
1
- export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aR as UNSAFE_AwaitContextProvider, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps } from './router-5fbeEIMQ.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-P7VgYu6T.mjs';
1
+ export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aR as UNSAFE_AwaitContextProvider, bA as UNSAFE_WithComponentProps, bE as UNSAFE_WithErrorBoundaryProps, bC as UNSAFE_WithHydrateFallbackProps } from './router-5iOvts3c.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-IoJGLOqV.mjs';
3
3
  import 'react';
@@ -1,3 +1,3 @@
1
- export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aP as UNSAFE_AwaitContextProvider, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps } from './instrumentation-BlrVzjbg.js';
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-Cv5Q9lf0.js';
1
+ export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aP as UNSAFE_AwaitContextProvider, bA as UNSAFE_WithComponentProps, bE as UNSAFE_WithErrorBoundaryProps, bC as UNSAFE_WithHydrateFallbackProps } from './instrumentation-DvHY1sgY.js';
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-gGyf-7Xp.js';
3
3
  import 'react';
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
2
- * react-router v7.11.0
2
+ * react-router v7.12.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -19,7 +19,7 @@
19
19
 
20
20
 
21
21
 
22
- var _chunk2JY4UAJAjs = require('./chunk-2JY4UAJA.js');
22
+ var _chunk7ZCBDOCZjs = require('./chunk-7ZCBDOCZ.js');
23
23
 
24
24
 
25
25
 
@@ -34,7 +34,7 @@ var _chunk2JY4UAJAjs = require('./chunk-2JY4UAJA.js');
34
34
 
35
35
 
36
36
 
37
- var _chunkSZQUWNVJjs = require('./chunk-SZQUWNVJ.js');
37
+ var _chunk2BEI23B2js = require('./chunk-2BEI23B2.js');
38
38
 
39
39
 
40
40
 
@@ -58,4 +58,4 @@ var _chunkSZQUWNVJjs = require('./chunk-SZQUWNVJ.js');
58
58
 
59
59
 
60
60
 
61
- exports.BrowserRouter = _chunk2JY4UAJAjs.BrowserRouter; exports.Form = _chunk2JY4UAJAjs.Form; exports.HashRouter = _chunk2JY4UAJAjs.HashRouter; exports.Link = _chunk2JY4UAJAjs.Link; exports.Links = _chunkSZQUWNVJjs.Links; exports.MemoryRouter = _chunkSZQUWNVJjs.MemoryRouter; exports.Meta = _chunkSZQUWNVJjs.Meta; exports.NavLink = _chunk2JY4UAJAjs.NavLink; exports.Navigate = _chunkSZQUWNVJjs.Navigate; exports.Outlet = _chunkSZQUWNVJjs.Outlet; exports.Route = _chunkSZQUWNVJjs.Route; exports.Router = _chunkSZQUWNVJjs.Router; exports.RouterProvider = _chunkSZQUWNVJjs.RouterProvider; exports.Routes = _chunkSZQUWNVJjs.Routes; exports.ScrollRestoration = _chunk2JY4UAJAjs.ScrollRestoration; exports.StaticRouter = _chunk2JY4UAJAjs.StaticRouter; exports.StaticRouterProvider = _chunk2JY4UAJAjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkSZQUWNVJjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkSZQUWNVJjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkSZQUWNVJjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkSZQUWNVJjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunk2JY4UAJAjs.HistoryRouter;
61
+ exports.BrowserRouter = _chunk7ZCBDOCZjs.BrowserRouter; exports.Form = _chunk7ZCBDOCZjs.Form; exports.HashRouter = _chunk7ZCBDOCZjs.HashRouter; exports.Link = _chunk7ZCBDOCZjs.Link; exports.Links = _chunk2BEI23B2js.Links; exports.MemoryRouter = _chunk2BEI23B2js.MemoryRouter; exports.Meta = _chunk2BEI23B2js.Meta; exports.NavLink = _chunk7ZCBDOCZjs.NavLink; exports.Navigate = _chunk2BEI23B2js.Navigate; exports.Outlet = _chunk2BEI23B2js.Outlet; exports.Route = _chunk2BEI23B2js.Route; exports.Router = _chunk2BEI23B2js.Router; exports.RouterProvider = _chunk2BEI23B2js.RouterProvider; exports.Routes = _chunk2BEI23B2js.Routes; exports.ScrollRestoration = _chunk7ZCBDOCZjs.ScrollRestoration; exports.StaticRouter = _chunk7ZCBDOCZjs.StaticRouter; exports.StaticRouterProvider = _chunk7ZCBDOCZjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunk2BEI23B2js.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunk2BEI23B2js.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunk2BEI23B2js.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunk2BEI23B2js.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunk7ZCBDOCZjs.HistoryRouter;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.11.0
2
+ * react-router v7.12.0
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-JMJ3UQ3L.mjs";
35
+ } from "./chunk-EPOLDU6W.mjs";
36
36
  export {
37
37
  BrowserRouter,
38
38
  Form,
@@ -2238,6 +2238,7 @@ type LoadServerActionFunction = (id: string) => Promise<Function>;
2238
2238
  * @category RSC
2239
2239
  * @mode data
2240
2240
  * @param opts Options
2241
+ * @param opts.allowedActionOrigins Origin patterns that are allowed to execute actions.
2241
2242
  * @param opts.basename The basename to use when matching the request.
2242
2243
  * @param opts.createTemporaryReferenceSet A function that returns a temporary
2243
2244
  * reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components)
@@ -2267,7 +2268,8 @@ type LoadServerActionFunction = (id: string) => Promise<Function>;
2267
2268
  * that contains the [RSC](https://react.dev/reference/rsc/server-components)
2268
2269
  * data for hydration.
2269
2270
  */
2270
- declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
2271
+ declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
2272
+ allowedActionOrigins?: string[];
2271
2273
  createTemporaryReferenceSet: () => unknown;
2272
2274
  basename?: string;
2273
2275
  decodeReply?: DecodeReplyFunction;
@@ -2238,6 +2238,7 @@ type LoadServerActionFunction = (id: string) => Promise<Function>;
2238
2238
  * @category RSC
2239
2239
  * @mode data
2240
2240
  * @param opts Options
2241
+ * @param opts.allowedActionOrigins Origin patterns that are allowed to execute actions.
2241
2242
  * @param opts.basename The basename to use when matching the request.
2242
2243
  * @param opts.createTemporaryReferenceSet A function that returns a temporary
2243
2244
  * reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components)
@@ -2267,7 +2268,8 @@ type LoadServerActionFunction = (id: string) => Promise<Function>;
2267
2268
  * that contains the [RSC](https://react.dev/reference/rsc/server-components)
2268
2269
  * data for hydration.
2269
2270
  */
2270
- declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
2271
+ declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
2272
+ allowedActionOrigins?: string[];
2271
2273
  createTemporaryReferenceSet: () => unknown;
2272
2274
  basename?: string;
2273
2275
  decodeReply?: DecodeReplyFunction;
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
27
27
  var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
28
28
 
29
29
  /**
30
- * react-router v7.11.0
30
+ * react-router v7.12.0
31
31
  *
32
32
  * Copyright (c) Remix Software Inc.
33
33
  *
@@ -166,6 +166,9 @@ function getRouteInstrumentationUpdates(fns, route) {
166
166
  (...args) => getHandlerInfo(args[0])
167
167
  );
168
168
  if (instrumented) {
169
+ if (key === "loader" && original.hydrate === true) {
170
+ instrumented.hydrate = true;
171
+ }
169
172
  instrumented[UninstrumentedSymbol] = original;
170
173
  updates[key] = instrumented;
171
174
  }
@@ -2394,6 +2397,85 @@ function prependCookies(parentHeaders, childHeaders) {
2394
2397
  }
2395
2398
  var SINGLE_FETCH_REDIRECT_STATUS = 202;
2396
2399
 
2400
+ // lib/actions.ts
2401
+ function throwIfPotentialCSRFAttack(headers, allowedActionOrigins) {
2402
+ let originHeader = headers.get("origin");
2403
+ let originDomain = typeof originHeader === "string" && originHeader !== "null" ? new URL(originHeader).host : originHeader;
2404
+ let host = parseHostHeader(headers);
2405
+ if (originDomain && (!host || originDomain !== host.value)) {
2406
+ if (!isAllowedOrigin(originDomain, allowedActionOrigins)) {
2407
+ if (host) {
2408
+ throw new Error(
2409
+ `${host.type} header does not match \`origin\` header from a forwarded action request. Aborting the action.`
2410
+ );
2411
+ } else {
2412
+ throw new Error(
2413
+ "`x-forwarded-host` or `host` headers are not provided. One of these is needed to compare the `origin` header from a forwarded action request. Aborting the action."
2414
+ );
2415
+ }
2416
+ }
2417
+ }
2418
+ }
2419
+ function matchWildcardDomain(domain, pattern) {
2420
+ const domainParts = domain.split(".");
2421
+ const patternParts = pattern.split(".");
2422
+ if (patternParts.length < 1) {
2423
+ return false;
2424
+ }
2425
+ if (domainParts.length < patternParts.length) {
2426
+ return false;
2427
+ }
2428
+ if (patternParts.length === 1 && (patternParts[0] === "*" || patternParts[0] === "**")) {
2429
+ return false;
2430
+ }
2431
+ while (patternParts.length) {
2432
+ const patternPart = patternParts.pop();
2433
+ const domainPart = domainParts.pop();
2434
+ switch (patternPart) {
2435
+ case "": {
2436
+ return false;
2437
+ }
2438
+ case "*": {
2439
+ if (domainPart) {
2440
+ continue;
2441
+ } else {
2442
+ return false;
2443
+ }
2444
+ }
2445
+ case "**": {
2446
+ if (patternParts.length > 0) {
2447
+ return false;
2448
+ }
2449
+ return domainPart !== void 0;
2450
+ }
2451
+ case void 0:
2452
+ default: {
2453
+ if (domainPart !== patternPart) {
2454
+ return false;
2455
+ }
2456
+ }
2457
+ }
2458
+ }
2459
+ return domainParts.length === 0;
2460
+ }
2461
+ function isAllowedOrigin(originDomain, allowedActionOrigins = []) {
2462
+ return allowedActionOrigins.some(
2463
+ (allowedOrigin) => allowedOrigin && (allowedOrigin === originDomain || matchWildcardDomain(originDomain, allowedOrigin))
2464
+ );
2465
+ }
2466
+ function parseHostHeader(headers) {
2467
+ let forwardedHostHeader = headers.get("x-forwarded-host");
2468
+ let forwardedHostValue = forwardedHostHeader?.split(",")[0]?.trim();
2469
+ let hostHeader = headers.get("host");
2470
+ return forwardedHostValue ? {
2471
+ type: "x-forwarded-host",
2472
+ value: forwardedHostValue
2473
+ } : hostHeader ? {
2474
+ type: "host",
2475
+ value: hostHeader
2476
+ } : void 0;
2477
+ }
2478
+
2397
2479
  // lib/errors.ts
2398
2480
  var ERROR_DIGEST_BASE = "REACT_ROUTER_ERROR";
2399
2481
  var ERROR_DIGEST_REDIRECT = "REDIRECT";
@@ -2489,6 +2571,7 @@ var Await = async ({
2489
2571
  });
2490
2572
  };
2491
2573
  async function matchRSCServerRequest({
2574
+ allowedActionOrigins,
2492
2575
  createTemporaryReferenceSet,
2493
2576
  basename,
2494
2577
  decodeReply,
@@ -2504,10 +2587,10 @@ async function matchRSCServerRequest({
2504
2587
  let url = new URL(request.url);
2505
2588
  basename = basename || "/";
2506
2589
  let normalizedPath = url.pathname;
2507
- if (stripBasename(normalizedPath, basename) === "/_root.rsc") {
2508
- normalizedPath = basename;
2509
- } else if (normalizedPath.endsWith(".rsc")) {
2510
- normalizedPath = normalizedPath.replace(/\.rsc$/, "");
2590
+ if (url.pathname.endsWith("/_.rsc")) {
2591
+ normalizedPath = url.pathname.replace(/_\.rsc$/, "");
2592
+ } else if (url.pathname.endsWith(".rsc")) {
2593
+ normalizedPath = url.pathname.replace(/\.rsc$/, "");
2511
2594
  }
2512
2595
  if (stripBasename(normalizedPath, basename) !== "/" && normalizedPath.endsWith("/")) {
2513
2596
  normalizedPath = normalizedPath.slice(0, -1);
@@ -2561,7 +2644,8 @@ async function matchRSCServerRequest({
2561
2644
  decodeFormState,
2562
2645
  onError,
2563
2646
  generateResponse,
2564
- temporaryReferences
2647
+ temporaryReferences,
2648
+ allowedActionOrigins
2565
2649
  );
2566
2650
  response.headers.set("X-Remix-Response", "yes");
2567
2651
  return response;
@@ -2740,7 +2824,7 @@ async function generateResourceResponse(request, routes, basename, routeId, requ
2740
2824
  });
2741
2825
  }
2742
2826
  }
2743
- async function generateRenderResponse(request, routes, basename, isDataRequest, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, generateResponse, temporaryReferences) {
2827
+ async function generateRenderResponse(request, routes, basename, isDataRequest, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, generateResponse, temporaryReferences, allowedActionOrigins) {
2744
2828
  let statusCode = 200;
2745
2829
  let url = new URL(request.url);
2746
2830
  let isSubmission = isMutationMethod(request.method);
@@ -2766,6 +2850,7 @@ async function generateRenderResponse(request, routes, basename, isDataRequest,
2766
2850
  let formState;
2767
2851
  let skipRevalidation = false;
2768
2852
  if (request.method === "POST") {
2853
+ throwIfPotentialCSRFAttack(request.headers, allowedActionOrigins);
2769
2854
  ctx.runningAction = true;
2770
2855
  let result2 = await processServerAction(
2771
2856
  request,