react-router 7.6.3 → 7.7.0-pre.1

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 +47 -0
  2. package/dist/development/browser-BSrXyLft.d.mts +157 -0
  3. package/dist/development/chunk-6ZHKKNZG.js +1898 -0
  4. package/dist/development/{chunk-QMGIS6GS.mjs → chunk-YNUF36W5.mjs} +1483 -3019
  5. package/dist/development/chunk-YP7CIEHK.mjs +2695 -0
  6. package/dist/development/chunk-Z7T4GLA7.js +8217 -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 +64 -76
  10. package/dist/development/dom-export.mjs +17 -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 +55 -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 +2600 -11447
  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-4FKAWASN.mjs} +1483 -3019
  35. package/dist/production/chunk-KZZC37RO.mjs +2695 -0
  36. package/dist/production/chunk-SH44XSL4.js +8217 -0
  37. package/dist/production/chunk-W77PDD2Y.js +1898 -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 +64 -76
  41. package/dist/production/dom-export.mjs +17 -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 +55 -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 +2600 -11447
  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.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -8,61 +8,45 @@
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
+
13
+
14
+ var _chunkZ7T4GLA7js = require('./chunk-Z7T4GLA7.js');
47
15
 
48
16
  // 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");
17
+ var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react);
18
+ var _reactdom = require('react-dom'); var ReactDOM = _interopRequireWildcard(_reactdom);
19
+ var _reactrouter = require('react-router');
52
20
  function RouterProvider(props) {
53
- return /* @__PURE__ */ React.createElement(import_react_router.RouterProvider, { flushSync: ReactDOM.flushSync, ...props });
21
+ return /* @__PURE__ */ React.createElement(_reactrouter.RouterProvider, { flushSync: ReactDOM.flushSync, ...props });
54
22
  }
55
23
 
56
24
  // lib/dom-export/hydrated-router.tsx
57
- var React2 = __toESM(require("react"));
58
- var import_react_router2 = require("react-router");
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
59
43
  var ssrInfo = null;
60
44
  var router = null;
61
45
  function initSsrInfo() {
62
46
  if (!ssrInfo && window.__reactRouterContext && window.__reactRouterManifest && window.__reactRouterRouteModules) {
63
47
  if (window.__reactRouterManifest.sri === true) {
64
48
  const importMap = document.querySelector("script[rr-importmap]");
65
- if (importMap?.textContent) {
49
+ if (_optionalChain([importMap, 'optionalAccess', _ => _.textContent])) {
66
50
  try {
67
51
  window.__reactRouterManifest.sri = JSON.parse(
68
52
  importMap.textContent
@@ -94,9 +78,9 @@ function createHydratedRouter({
94
78
  let localSsrInfo = ssrInfo;
95
79
  if (!ssrInfo.stateDecodingPromise) {
96
80
  let stream = ssrInfo.context.stream;
97
- (0, import_react_router2.UNSAFE_invariant)(stream, "No stream found for single fetch decoding");
81
+ _reactrouter.UNSAFE_invariant.call(void 0, stream, "No stream found for single fetch decoding");
98
82
  ssrInfo.context.stream = void 0;
99
- ssrInfo.stateDecodingPromise = (0, import_react_router2.UNSAFE_decodeViaTurboStream)(stream, window).then((value) => {
83
+ ssrInfo.stateDecodingPromise = _reactrouter.UNSAFE_decodeViaTurboStream.call(void 0, stream, window).then((value) => {
100
84
  ssrInfo.context.state = value.value;
101
85
  localSsrInfo.stateDecodingPromise.value = true;
102
86
  }).catch((e) => {
@@ -109,7 +93,7 @@ function createHydratedRouter({
109
93
  if (!ssrInfo.stateDecodingPromise.value) {
110
94
  throw ssrInfo.stateDecodingPromise;
111
95
  }
112
- let routes = (0, import_react_router2.UNSAFE_createClientRoutes)(
96
+ let routes = _reactrouter.UNSAFE_createClientRoutes.call(void 0,
113
97
  ssrInfo.manifest.routes,
114
98
  ssrInfo.routeModules,
115
99
  ssrInfo.context.state,
@@ -119,7 +103,7 @@ function createHydratedRouter({
119
103
  let hydrationData = void 0;
120
104
  if (ssrInfo.context.isSpaMode) {
121
105
  let { loaderData } = ssrInfo.context.state;
122
- if (ssrInfo.manifest.routes.root?.hasLoader && loaderData && "root" in loaderData) {
106
+ if (_optionalChain([ssrInfo, 'access', _2 => _2.manifest, 'access', _3 => _3.routes, 'access', _4 => _4.root, 'optionalAccess', _5 => _5.hasLoader]) && loaderData && "root" in loaderData) {
123
107
  hydrationData = {
124
108
  loaderData: {
125
109
  root: loaderData.root
@@ -127,41 +111,41 @@ function createHydratedRouter({
127
111
  };
128
112
  }
129
113
  } else {
130
- hydrationData = (0, import_react_router2.UNSAFE_getHydrationData)(
114
+ hydrationData = _reactrouter.UNSAFE_getHydrationData.call(void 0,
131
115
  ssrInfo.context.state,
132
116
  routes,
133
117
  (routeId) => ({
134
- clientLoader: ssrInfo.routeModules[routeId]?.clientLoader,
135
- hasLoader: ssrInfo.manifest.routes[routeId]?.hasLoader === true,
136
- hasHydrateFallback: ssrInfo.routeModules[routeId]?.HydrateFallback != null
118
+ clientLoader: _optionalChain([ssrInfo, 'access', _6 => _6.routeModules, 'access', _7 => _7[routeId], 'optionalAccess', _8 => _8.clientLoader]),
119
+ hasLoader: _optionalChain([ssrInfo, 'access', _9 => _9.manifest, 'access', _10 => _10.routes, 'access', _11 => _11[routeId], 'optionalAccess', _12 => _12.hasLoader]) === true,
120
+ hasHydrateFallback: _optionalChain([ssrInfo, 'access', _13 => _13.routeModules, 'access', _14 => _14[routeId], 'optionalAccess', _15 => _15.HydrateFallback]) != null
137
121
  }),
138
122
  window.location,
139
- window.__reactRouterContext?.basename,
123
+ _optionalChain([window, 'access', _16 => _16.__reactRouterContext, 'optionalAccess', _17 => _17.basename]),
140
124
  ssrInfo.context.isSpaMode
141
125
  );
142
126
  if (hydrationData && hydrationData.errors) {
143
- hydrationData.errors = (0, import_react_router2.UNSAFE_deserializeErrors)(hydrationData.errors);
127
+ hydrationData.errors = _reactrouter.UNSAFE_deserializeErrors.call(void 0, hydrationData.errors);
144
128
  }
145
129
  }
146
- let router2 = (0, import_react_router2.UNSAFE_createRouter)({
130
+ let router2 = _reactrouter.UNSAFE_createRouter.call(void 0, {
147
131
  routes,
148
- history: (0, import_react_router2.UNSAFE_createBrowserHistory)(),
132
+ history: _reactrouter.UNSAFE_createBrowserHistory.call(void 0, ),
149
133
  basename: ssrInfo.context.basename,
150
134
  unstable_getContext,
151
135
  hydrationData,
152
- hydrationRouteProperties: import_react_router2.UNSAFE_hydrationRouteProperties,
153
- mapRouteProperties: import_react_router2.UNSAFE_mapRouteProperties,
136
+ hydrationRouteProperties: _reactrouter.UNSAFE_hydrationRouteProperties,
137
+ mapRouteProperties: _reactrouter.UNSAFE_mapRouteProperties,
154
138
  future: {
155
139
  unstable_middleware: ssrInfo.context.future.unstable_middleware
156
140
  },
157
- dataStrategy: (0, import_react_router2.UNSAFE_getTurboStreamSingleFetchDataStrategy)(
141
+ dataStrategy: _reactrouter.UNSAFE_getTurboStreamSingleFetchDataStrategy.call(void 0,
158
142
  () => router2,
159
143
  ssrInfo.manifest,
160
144
  ssrInfo.routeModules,
161
145
  ssrInfo.context.ssr,
162
146
  ssrInfo.context.basename
163
147
  ),
164
- patchRoutesOnNavigation: (0, import_react_router2.UNSAFE_getPatchRoutesOnNavigationFunction)(
148
+ patchRoutesOnNavigation: _reactrouter.UNSAFE_getPatchRoutesOnNavigationFunction.call(void 0,
165
149
  ssrInfo.manifest,
166
150
  ssrInfo.routeModules,
167
151
  ssrInfo.context.ssr,
@@ -176,7 +160,7 @@ function createHydratedRouter({
176
160
  router2.initialize();
177
161
  }
178
162
  router2.createRoutesForHMR = /* spacer so ts-ignore does not affect the right hand of the assignment */
179
- import_react_router2.UNSAFE_createClientRoutesWithHMRRevalidationOptOut;
163
+ _reactrouter.UNSAFE_createClientRoutesWithHMRRevalidationOptOut;
180
164
  window.__reactRouterDataRouter = router2;
181
165
  return router2;
182
166
  }
@@ -187,13 +171,18 @@ function HydratedRouter(props) {
187
171
  });
188
172
  }
189
173
  let [criticalCss, setCriticalCss] = React2.useState(
190
- process.env.NODE_ENV === "development" ? ssrInfo?.context.criticalCss : void 0
174
+ process.env.NODE_ENV === "development" ? _optionalChain([ssrInfo, 'optionalAccess', _18 => _18.context, 'access', _19 => _19.criticalCss]) : void 0
191
175
  );
192
- if (process.env.NODE_ENV === "development") {
193
- if (ssrInfo) {
194
- window.__reactRouterClearCriticalCss = () => setCriticalCss(void 0);
176
+ React2.useEffect(() => {
177
+ if (process.env.NODE_ENV === "development") {
178
+ setCriticalCss(void 0);
195
179
  }
196
- }
180
+ }, []);
181
+ React2.useEffect(() => {
182
+ if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
183
+ document.querySelectorAll(`[${_chunkZ7T4GLA7js.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
184
+ }
185
+ }, [criticalCss]);
197
186
  let [location, setLocation] = React2.useState(router.state.location);
198
187
  React2.useLayoutEffect(() => {
199
188
  if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {
@@ -210,8 +199,8 @@ function HydratedRouter(props) {
210
199
  });
211
200
  }
212
201
  }, [location]);
213
- (0, import_react_router2.UNSAFE_invariant)(ssrInfo, "ssrInfo unavailable for HydratedRouter");
214
- (0, import_react_router2.UNSAFE_useFogOFWarDiscovery)(
202
+ _reactrouter.UNSAFE_invariant.call(void 0, ssrInfo, "ssrInfo unavailable for HydratedRouter");
203
+ _reactrouter.UNSAFE_useFogOFWarDiscovery.call(void 0,
215
204
  router,
216
205
  ssrInfo.manifest,
217
206
  ssrInfo.routeModules,
@@ -223,7 +212,7 @@ function HydratedRouter(props) {
223
212
  // This fragment is important to ensure we match the <ServerRouter> JSX
224
213
  // structure so that useId values hydrate correctly
225
214
  /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
226
- import_react_router2.UNSAFE_FrameworkContext.Provider,
215
+ _reactrouter.UNSAFE_FrameworkContext.Provider,
227
216
  {
228
217
  value: {
229
218
  manifest: ssrInfo.manifest,
@@ -235,12 +224,11 @@ function HydratedRouter(props) {
235
224
  routeDiscovery: ssrInfo.context.routeDiscovery
236
225
  }
237
226
  },
238
- /* @__PURE__ */ React2.createElement(import_react_router2.UNSAFE_RemixErrorBoundary, { location }, /* @__PURE__ */ React2.createElement(RouterProvider, { router }))
227
+ /* @__PURE__ */ React2.createElement(_reactrouter.UNSAFE_RemixErrorBoundary, { location }, /* @__PURE__ */ React2.createElement(RouterProvider, { router }))
239
228
  ), /* @__PURE__ */ React2.createElement(React2.Fragment, null))
240
229
  );
241
230
  }
242
- // Annotate the CommonJS export names for ESM import in node:
243
- 0 && (module.exports = {
244
- HydratedRouter,
245
- RouterProvider
246
- });
231
+
232
+
233
+
234
+ 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.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -8,7 +8,13 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
+ "use client";
11
12
  import {
13
+ deserializeErrors,
14
+ getHydrationData
15
+ } from "./chunk-YP7CIEHK.mjs";
16
+ import {
17
+ CRITICAL_CSS_DATA_ATTRIBUTE,
12
18
  FrameworkContext,
13
19
  RemixErrorBoundary,
14
20
  RouterProvider,
@@ -17,15 +23,13 @@ import {
17
23
  createClientRoutesWithHMRRevalidationOptOut,
18
24
  createRouter,
19
25
  decodeViaTurboStream,
20
- deserializeErrors,
21
- getHydrationData,
22
26
  getPatchRoutesOnNavigationFunction,
23
27
  getTurboStreamSingleFetchDataStrategy,
24
28
  hydrationRouteProperties,
25
29
  invariant,
26
30
  mapRouteProperties,
27
31
  useFogOFWarDiscovery
28
- } from "./chunk-QMGIS6GS.mjs";
32
+ } from "./chunk-YNUF36W5.mjs";
29
33
 
30
34
  // lib/dom-export/dom-router-provider.tsx
31
35
  import * as React from "react";
@@ -169,11 +173,16 @@ function HydratedRouter(props) {
169
173
  let [criticalCss, setCriticalCss] = React2.useState(
170
174
  process.env.NODE_ENV === "development" ? ssrInfo?.context.criticalCss : void 0
171
175
  );
172
- if (process.env.NODE_ENV === "development") {
173
- if (ssrInfo) {
174
- window.__reactRouterClearCriticalCss = () => setCriticalCss(void 0);
176
+ React2.useEffect(() => {
177
+ if (process.env.NODE_ENV === "development") {
178
+ setCriticalCss(void 0);
175
179
  }
176
- }
180
+ }, []);
181
+ React2.useEffect(() => {
182
+ if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
183
+ document.querySelectorAll(`[${CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
184
+ }
185
+ }, [criticalCss]);
177
186
  let [location, setLocation] = React2.useState(router.state.location);
178
187
  React2.useLayoutEffect(() => {
179
188
  if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {