react-router 7.6.3 → 7.7.0-pre.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 (64) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/development/browser-BSrXyLft.d.mts +157 -0
  3. package/dist/development/chunk-P37AORTA.js +21 -0
  4. package/dist/development/{chunk-QMGIS6GS.mjs → chunk-PUMRC5B5.mjs} +1473 -3024
  5. package/dist/development/chunk-PY5DBM7W.mjs +2695 -0
  6. package/dist/development/chunk-X5ZUQHCD.js +10021 -0
  7. package/dist/development/components-IaVqGBuO.d.mts +816 -0
  8. package/dist/development/dom-export.d.mts +4 -2
  9. package/dist/development/dom-export.js +57 -76
  10. package/dist/development/dom-export.mjs +11 -8
  11. package/dist/development/index-react-server-client-DOK8MfYF.d.mts +1360 -0
  12. package/dist/development/{lib-B33EY9A0.d.mts → index-react-server-client-LrDNRnlX.d.ts} +39 -5
  13. package/dist/development/index-react-server-client.d.mts +4 -0
  14. package/dist/development/index-react-server-client.d.ts +3 -0
  15. package/dist/development/index-react-server-client.js +54 -0
  16. package/dist/development/index-react-server-client.mjs +53 -0
  17. package/dist/development/index-react-server.d.mts +1863 -0
  18. package/dist/development/index-react-server.d.ts +1863 -0
  19. package/dist/development/index-react-server.js +3196 -0
  20. package/dist/development/index-react-server.mjs +3083 -0
  21. package/dist/development/index.d.mts +33 -47
  22. package/dist/development/index.d.ts +195 -2190
  23. package/dist/development/index.js +2596 -11444
  24. package/dist/development/index.mjs +33 -18
  25. package/dist/development/lib/types/internal.d.mts +2 -2
  26. package/dist/development/lib/types/internal.d.ts +2 -1
  27. package/dist/development/lib/types/internal.js +2 -20
  28. package/dist/development/lib/types/internal.mjs +1 -1
  29. package/dist/{production/register-DeIo2iHO.d.mts → development/register-DiOIlEq5.d.mts} +1 -1
  30. package/dist/development/{register-DeIo2iHO.d.mts → register-DiOIlEq5.d.ts} +1 -1
  31. package/dist/development/{route-data-D7Xbr_Ww.d.mts → route-data-7aXBQ4I3.d.ts} +26 -15
  32. package/dist/{production/route-data-D7Xbr_Ww.d.mts → development/route-data-DAw7Esur.d.mts} +16 -5
  33. package/dist/production/browser-BSrXyLft.d.mts +157 -0
  34. package/dist/production/{chunk-S4Z2UWCU.mjs → chunk-5AMJKWMN.mjs} +1473 -3024
  35. package/dist/production/chunk-KWWBKJDT.mjs +2695 -0
  36. package/dist/production/chunk-LKVDO7TU.js +10021 -0
  37. package/dist/production/chunk-P37AORTA.js +21 -0
  38. package/dist/production/components-IaVqGBuO.d.mts +816 -0
  39. package/dist/production/dom-export.d.mts +4 -2
  40. package/dist/production/dom-export.js +57 -76
  41. package/dist/production/dom-export.mjs +11 -8
  42. package/dist/production/index-react-server-client-DOK8MfYF.d.mts +1360 -0
  43. package/dist/production/{lib-B33EY9A0.d.mts → index-react-server-client-LrDNRnlX.d.ts} +39 -5
  44. package/dist/production/index-react-server-client.d.mts +4 -0
  45. package/dist/production/index-react-server-client.d.ts +3 -0
  46. package/dist/production/index-react-server-client.js +54 -0
  47. package/dist/production/index-react-server-client.mjs +53 -0
  48. package/dist/production/index-react-server.d.mts +1863 -0
  49. package/dist/production/index-react-server.d.ts +1863 -0
  50. package/dist/production/index-react-server.js +3196 -0
  51. package/dist/production/index-react-server.mjs +3083 -0
  52. package/dist/production/index.d.mts +33 -47
  53. package/dist/production/index.d.ts +195 -2190
  54. package/dist/production/index.js +2596 -11444
  55. package/dist/production/index.mjs +33 -18
  56. package/dist/production/lib/types/internal.d.mts +2 -2
  57. package/dist/production/lib/types/internal.d.ts +2 -1
  58. package/dist/production/lib/types/internal.js +2 -20
  59. package/dist/production/lib/types/internal.mjs +1 -1
  60. package/dist/production/register-DiOIlEq5.d.mts +24 -0
  61. package/dist/production/register-DiOIlEq5.d.ts +24 -0
  62. package/dist/production/{register-COAKzST_.d.ts → route-data-7aXBQ4I3.d.ts} +26 -38
  63. package/dist/{development/register-COAKzST_.d.ts → production/route-data-DAw7Esur.d.mts} +16 -28
  64. package/package.json +56 -11
@@ -1,6 +1,8 @@
1
1
  import * as React from 'react';
2
- import { R as RouterProviderProps$1 } from './lib-B33EY9A0.mjs';
3
- import { R as RouterInit } from './route-data-D7Xbr_Ww.mjs';
2
+ import { R as RouterProviderProps$1 } from './components-IaVqGBuO.mjs';
3
+ import './browser-BSrXyLft.mjs';
4
+ import { R as RouterInit } from './route-data-DAw7Esur.mjs';
5
+ import 'node:async_hooks';
4
6
 
5
7
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
6
8
  declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
@@ -1,5 +1,5 @@
1
- /**
2
- * react-router v7.6.3
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 _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.7.0-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -8,61 +8,43 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- "use strict";
12
- var __create = Object.create;
13
- var __defProp = Object.defineProperty;
14
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15
- var __getOwnPropNames = Object.getOwnPropertyNames;
16
- var __getProtoOf = Object.getPrototypeOf;
17
- var __hasOwnProp = Object.prototype.hasOwnProperty;
18
- var __export = (target, all) => {
19
- for (var name in all)
20
- __defProp(target, name, { get: all[name], enumerable: true });
21
- };
22
- var __copyProps = (to, from, except, desc) => {
23
- if (from && typeof from === "object" || typeof from === "function") {
24
- for (let key of __getOwnPropNames(from))
25
- if (!__hasOwnProp.call(to, key) && key !== except)
26
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
27
- }
28
- return to;
29
- };
30
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
31
- // If the importer is in node compatibility mode or this is not an ESM
32
- // file that has been converted to a CommonJS file using a Babel-
33
- // compatible transform (i.e. "__esModule" has not been set), then set
34
- // "default" to the CommonJS "module.exports" for node compatibility.
35
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
36
- mod
37
- ));
38
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
39
-
40
- // dom-export.ts
41
- var dom_export_exports = {};
42
- __export(dom_export_exports, {
43
- HydratedRouter: () => HydratedRouter,
44
- RouterProvider: () => RouterProvider
45
- });
46
- module.exports = __toCommonJS(dom_export_exports);
11
+ "use client";
12
+ require('./chunk-P37AORTA.js');
47
13
 
48
14
  // lib/dom-export/dom-router-provider.tsx
49
- var React = __toESM(require("react"));
50
- var ReactDOM = __toESM(require("react-dom"));
51
- var import_react_router = require("react-router");
15
+ var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react);
16
+ var _reactdom = require('react-dom'); var ReactDOM = _interopRequireWildcard(_reactdom);
17
+ var _reactrouter = require('react-router');
52
18
  function RouterProvider(props) {
53
- return /* @__PURE__ */ React.createElement(import_react_router.RouterProvider, { flushSync: ReactDOM.flushSync, ...props });
19
+ return /* @__PURE__ */ React.createElement(_reactrouter.RouterProvider, { flushSync: ReactDOM.flushSync, ...props });
54
20
  }
55
21
 
56
22
  // lib/dom-export/hydrated-router.tsx
57
- var React2 = __toESM(require("react"));
58
- var import_react_router2 = require("react-router");
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
59
41
  var ssrInfo = null;
60
42
  var router = null;
61
43
  function initSsrInfo() {
62
44
  if (!ssrInfo && window.__reactRouterContext && window.__reactRouterManifest && window.__reactRouterRouteModules) {
63
45
  if (window.__reactRouterManifest.sri === true) {
64
46
  const importMap = document.querySelector("script[rr-importmap]");
65
- if (importMap?.textContent) {
47
+ if (_optionalChain([importMap, 'optionalAccess', _ => _.textContent])) {
66
48
  try {
67
49
  window.__reactRouterManifest.sri = JSON.parse(
68
50
  importMap.textContent
@@ -94,9 +76,9 @@ function createHydratedRouter({
94
76
  let localSsrInfo = ssrInfo;
95
77
  if (!ssrInfo.stateDecodingPromise) {
96
78
  let stream = ssrInfo.context.stream;
97
- (0, import_react_router2.UNSAFE_invariant)(stream, "No stream found for single fetch decoding");
79
+ _reactrouter.UNSAFE_invariant.call(void 0, stream, "No stream found for single fetch decoding");
98
80
  ssrInfo.context.stream = void 0;
99
- ssrInfo.stateDecodingPromise = (0, import_react_router2.UNSAFE_decodeViaTurboStream)(stream, window).then((value) => {
81
+ ssrInfo.stateDecodingPromise = _reactrouter.UNSAFE_decodeViaTurboStream.call(void 0, stream, window).then((value) => {
100
82
  ssrInfo.context.state = value.value;
101
83
  localSsrInfo.stateDecodingPromise.value = true;
102
84
  }).catch((e) => {
@@ -109,7 +91,7 @@ function createHydratedRouter({
109
91
  if (!ssrInfo.stateDecodingPromise.value) {
110
92
  throw ssrInfo.stateDecodingPromise;
111
93
  }
112
- let routes = (0, import_react_router2.UNSAFE_createClientRoutes)(
94
+ let routes = _reactrouter.UNSAFE_createClientRoutes.call(void 0,
113
95
  ssrInfo.manifest.routes,
114
96
  ssrInfo.routeModules,
115
97
  ssrInfo.context.state,
@@ -119,7 +101,7 @@ function createHydratedRouter({
119
101
  let hydrationData = void 0;
120
102
  if (ssrInfo.context.isSpaMode) {
121
103
  let { loaderData } = ssrInfo.context.state;
122
- if (ssrInfo.manifest.routes.root?.hasLoader && loaderData && "root" in loaderData) {
104
+ if (_optionalChain([ssrInfo, 'access', _2 => _2.manifest, 'access', _3 => _3.routes, 'access', _4 => _4.root, 'optionalAccess', _5 => _5.hasLoader]) && loaderData && "root" in loaderData) {
123
105
  hydrationData = {
124
106
  loaderData: {
125
107
  root: loaderData.root
@@ -127,41 +109,41 @@ function createHydratedRouter({
127
109
  };
128
110
  }
129
111
  } else {
130
- hydrationData = (0, import_react_router2.UNSAFE_getHydrationData)(
112
+ hydrationData = _reactrouter.UNSAFE_getHydrationData.call(void 0,
131
113
  ssrInfo.context.state,
132
114
  routes,
133
115
  (routeId) => ({
134
- clientLoader: ssrInfo.routeModules[routeId]?.clientLoader,
135
- hasLoader: ssrInfo.manifest.routes[routeId]?.hasLoader === true,
136
- hasHydrateFallback: ssrInfo.routeModules[routeId]?.HydrateFallback != null
116
+ clientLoader: _optionalChain([ssrInfo, 'access', _6 => _6.routeModules, 'access', _7 => _7[routeId], 'optionalAccess', _8 => _8.clientLoader]),
117
+ hasLoader: _optionalChain([ssrInfo, 'access', _9 => _9.manifest, 'access', _10 => _10.routes, 'access', _11 => _11[routeId], 'optionalAccess', _12 => _12.hasLoader]) === true,
118
+ hasHydrateFallback: _optionalChain([ssrInfo, 'access', _13 => _13.routeModules, 'access', _14 => _14[routeId], 'optionalAccess', _15 => _15.HydrateFallback]) != null
137
119
  }),
138
120
  window.location,
139
- window.__reactRouterContext?.basename,
121
+ _optionalChain([window, 'access', _16 => _16.__reactRouterContext, 'optionalAccess', _17 => _17.basename]),
140
122
  ssrInfo.context.isSpaMode
141
123
  );
142
124
  if (hydrationData && hydrationData.errors) {
143
- hydrationData.errors = (0, import_react_router2.UNSAFE_deserializeErrors)(hydrationData.errors);
125
+ hydrationData.errors = _reactrouter.UNSAFE_deserializeErrors.call(void 0, hydrationData.errors);
144
126
  }
145
127
  }
146
- let router2 = (0, import_react_router2.UNSAFE_createRouter)({
128
+ let router2 = _reactrouter.UNSAFE_createRouter.call(void 0, {
147
129
  routes,
148
- history: (0, import_react_router2.UNSAFE_createBrowserHistory)(),
130
+ history: _reactrouter.UNSAFE_createBrowserHistory.call(void 0, ),
149
131
  basename: ssrInfo.context.basename,
150
132
  unstable_getContext,
151
133
  hydrationData,
152
- hydrationRouteProperties: import_react_router2.UNSAFE_hydrationRouteProperties,
153
- mapRouteProperties: import_react_router2.UNSAFE_mapRouteProperties,
134
+ hydrationRouteProperties: _reactrouter.UNSAFE_hydrationRouteProperties,
135
+ mapRouteProperties: _reactrouter.UNSAFE_mapRouteProperties,
154
136
  future: {
155
137
  unstable_middleware: ssrInfo.context.future.unstable_middleware
156
138
  },
157
- dataStrategy: (0, import_react_router2.UNSAFE_getTurboStreamSingleFetchDataStrategy)(
139
+ dataStrategy: _reactrouter.UNSAFE_getTurboStreamSingleFetchDataStrategy.call(void 0,
158
140
  () => router2,
159
141
  ssrInfo.manifest,
160
142
  ssrInfo.routeModules,
161
143
  ssrInfo.context.ssr,
162
144
  ssrInfo.context.basename
163
145
  ),
164
- patchRoutesOnNavigation: (0, import_react_router2.UNSAFE_getPatchRoutesOnNavigationFunction)(
146
+ patchRoutesOnNavigation: _reactrouter.UNSAFE_getPatchRoutesOnNavigationFunction.call(void 0,
165
147
  ssrInfo.manifest,
166
148
  ssrInfo.routeModules,
167
149
  ssrInfo.context.ssr,
@@ -176,7 +158,7 @@ function createHydratedRouter({
176
158
  router2.initialize();
177
159
  }
178
160
  router2.createRoutesForHMR = /* spacer so ts-ignore does not affect the right hand of the assignment */
179
- import_react_router2.UNSAFE_createClientRoutesWithHMRRevalidationOptOut;
161
+ _reactrouter.UNSAFE_createClientRoutesWithHMRRevalidationOptOut;
180
162
  window.__reactRouterDataRouter = router2;
181
163
  return router2;
182
164
  }
@@ -187,13 +169,13 @@ function HydratedRouter(props) {
187
169
  });
188
170
  }
189
171
  let [criticalCss, setCriticalCss] = React2.useState(
190
- process.env.NODE_ENV === "development" ? ssrInfo?.context.criticalCss : void 0
172
+ process.env.NODE_ENV === "development" ? _optionalChain([ssrInfo, 'optionalAccess', _18 => _18.context, 'access', _19 => _19.criticalCss]) : void 0
191
173
  );
192
- if (process.env.NODE_ENV === "development") {
193
- if (ssrInfo) {
194
- window.__reactRouterClearCriticalCss = () => setCriticalCss(void 0);
174
+ React2.useEffect(() => {
175
+ if (process.env.NODE_ENV === "development") {
176
+ setCriticalCss(void 0);
195
177
  }
196
- }
178
+ }, []);
197
179
  let [location, setLocation] = React2.useState(router.state.location);
198
180
  React2.useLayoutEffect(() => {
199
181
  if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {
@@ -210,8 +192,8 @@ function HydratedRouter(props) {
210
192
  });
211
193
  }
212
194
  }, [location]);
213
- (0, import_react_router2.UNSAFE_invariant)(ssrInfo, "ssrInfo unavailable for HydratedRouter");
214
- (0, import_react_router2.UNSAFE_useFogOFWarDiscovery)(
195
+ _reactrouter.UNSAFE_invariant.call(void 0, ssrInfo, "ssrInfo unavailable for HydratedRouter");
196
+ _reactrouter.UNSAFE_useFogOFWarDiscovery.call(void 0,
215
197
  router,
216
198
  ssrInfo.manifest,
217
199
  ssrInfo.routeModules,
@@ -223,7 +205,7 @@ function HydratedRouter(props) {
223
205
  // This fragment is important to ensure we match the <ServerRouter> JSX
224
206
  // structure so that useId values hydrate correctly
225
207
  /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
226
- import_react_router2.UNSAFE_FrameworkContext.Provider,
208
+ _reactrouter.UNSAFE_FrameworkContext.Provider,
227
209
  {
228
210
  value: {
229
211
  manifest: ssrInfo.manifest,
@@ -235,12 +217,11 @@ function HydratedRouter(props) {
235
217
  routeDiscovery: ssrInfo.context.routeDiscovery
236
218
  }
237
219
  },
238
- /* @__PURE__ */ React2.createElement(import_react_router2.UNSAFE_RemixErrorBoundary, { location }, /* @__PURE__ */ React2.createElement(RouterProvider, { router }))
220
+ /* @__PURE__ */ React2.createElement(_reactrouter.UNSAFE_RemixErrorBoundary, { location }, /* @__PURE__ */ React2.createElement(RouterProvider, { router }))
239
221
  ), /* @__PURE__ */ React2.createElement(React2.Fragment, null))
240
222
  );
241
223
  }
242
- // Annotate the CommonJS export names for ESM import in node:
243
- 0 && (module.exports = {
244
- HydratedRouter,
245
- RouterProvider
246
- });
224
+
225
+
226
+
227
+ exports.HydratedRouter = HydratedRouter; exports.RouterProvider = RouterProvider;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.6.3
2
+ * react-router v7.7.0-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -8,6 +8,11 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
+ "use client";
12
+ import {
13
+ deserializeErrors,
14
+ getHydrationData
15
+ } from "./chunk-PY5DBM7W.mjs";
11
16
  import {
12
17
  FrameworkContext,
13
18
  RemixErrorBoundary,
@@ -17,15 +22,13 @@ import {
17
22
  createClientRoutesWithHMRRevalidationOptOut,
18
23
  createRouter,
19
24
  decodeViaTurboStream,
20
- deserializeErrors,
21
- getHydrationData,
22
25
  getPatchRoutesOnNavigationFunction,
23
26
  getTurboStreamSingleFetchDataStrategy,
24
27
  hydrationRouteProperties,
25
28
  invariant,
26
29
  mapRouteProperties,
27
30
  useFogOFWarDiscovery
28
- } from "./chunk-QMGIS6GS.mjs";
31
+ } from "./chunk-PUMRC5B5.mjs";
29
32
 
30
33
  // lib/dom-export/dom-router-provider.tsx
31
34
  import * as React from "react";
@@ -169,11 +172,11 @@ function HydratedRouter(props) {
169
172
  let [criticalCss, setCriticalCss] = React2.useState(
170
173
  process.env.NODE_ENV === "development" ? ssrInfo?.context.criticalCss : void 0
171
174
  );
172
- if (process.env.NODE_ENV === "development") {
173
- if (ssrInfo) {
174
- window.__reactRouterClearCriticalCss = () => setCriticalCss(void 0);
175
+ React2.useEffect(() => {
176
+ if (process.env.NODE_ENV === "development") {
177
+ setCriticalCss(void 0);
175
178
  }
176
- }
179
+ }, []);
177
180
  let [location, setLocation] = React2.useState(router.state.location);
178
181
  React2.useLayoutEffect(() => {
179
182
  if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {