react-router 7.10.0-pre.0 → 7.10.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.
- package/CHANGELOG.md +6 -0
- package/dist/development/{browser-eL-tAN4R.d.ts → browser-BpxEZgZC.d.ts} +1 -1
- package/dist/development/{browser-BHySFrZ2.d.mts → browser-C5z6FZmz.d.mts} +1 -1
- package/dist/development/{chunk-4BTFPFZR.mjs → chunk-GIMUO62I.mjs} +2 -2
- package/dist/development/{chunk-M4WLV5HP.js → chunk-KQLPIZ7E.js} +1 -1
- package/dist/development/{chunk-Z4R76DXJ.js → chunk-RHWHYDYZ.js} +7 -7
- package/dist/development/{chunk-CECIHG5K.mjs → chunk-V5RTLP6E.mjs} +2 -2
- package/dist/development/{chunk-2VILFZWG.js → chunk-XHWAND4X.js} +94 -94
- package/dist/development/dom-export.d.mts +10 -10
- package/dist/development/dom-export.d.ts +10 -10
- package/dist/development/dom-export.js +27 -27
- package/dist/development/dom-export.mjs +3 -3
- package/dist/{production/index-react-server-client-CNrKUHDv.d.ts → development/index-react-server-client-CCjKYJTH.d.ts} +17 -174
- package/dist/development/{index-react-server-client-DYtvZPLT.d.mts → index-react-server-client-CipGfVBI.d.mts} +17 -174
- package/dist/development/index-react-server-client.d.mts +2 -2
- package/dist/development/index-react-server-client.d.ts +2 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.js +1 -1
- package/dist/development/index-react-server.mjs +1 -1
- package/dist/development/index.d.mts +8 -8
- package/dist/development/index.d.ts +8 -8
- package/dist/development/index.js +76 -76
- package/dist/development/index.mjs +3 -3
- package/dist/{production/instrumentation-Dwf-sTWa.d.ts → development/instrumentation-BB0wRuqz.d.ts} +27 -3
- package/dist/development/lib/types/internal.d.mts +2 -2
- package/dist/development/lib/types/internal.d.ts +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-C97Jz2jB.d.mts → register-C1RwVJAt.d.mts} +1 -1
- package/dist/development/{register-BnQsYkwj.d.ts → register-ODDAAYlf.d.ts} +1 -1
- package/dist/development/{router-Dgz_Mh9m.d.mts → router-CwNp5l9u.d.mts} +27 -3
- package/dist/production/{browser-eL-tAN4R.d.ts → browser-BpxEZgZC.d.ts} +1 -1
- package/dist/production/{browser-BHySFrZ2.d.mts → browser-C5z6FZmz.d.mts} +1 -1
- package/dist/production/{chunk-5DTJHKF7.js → chunk-3MVZKESN.js} +94 -94
- package/dist/production/{chunk-KJ5676BZ.mjs → chunk-7F5XUDXM.mjs} +2 -2
- package/dist/production/{chunk-55FFLVQP.js → chunk-C7S4I3K5.js} +1 -1
- package/dist/production/{chunk-QKAGOFED.mjs → chunk-ISOIFGFA.mjs} +2 -2
- package/dist/production/{chunk-SGCRBGEM.js → chunk-YU3WNS3T.js} +7 -7
- package/dist/production/dom-export.d.mts +10 -10
- package/dist/production/dom-export.d.ts +10 -10
- package/dist/production/dom-export.js +27 -27
- package/dist/production/dom-export.mjs +3 -3
- package/dist/{development/index-react-server-client-CNrKUHDv.d.ts → production/index-react-server-client-CCjKYJTH.d.ts} +17 -174
- package/dist/production/{index-react-server-client-DYtvZPLT.d.mts → index-react-server-client-CipGfVBI.d.mts} +17 -174
- package/dist/production/index-react-server-client.d.mts +2 -2
- package/dist/production/index-react-server-client.d.ts +2 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.js +1 -1
- package/dist/production/index-react-server.mjs +1 -1
- package/dist/production/index.d.mts +8 -8
- package/dist/production/index.d.ts +8 -8
- package/dist/production/index.js +76 -76
- package/dist/production/index.mjs +3 -3
- package/dist/{development/instrumentation-Dwf-sTWa.d.ts → production/instrumentation-BB0wRuqz.d.ts} +27 -3
- package/dist/production/lib/types/internal.d.mts +2 -2
- package/dist/production/lib/types/internal.d.ts +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{register-C97Jz2jB.d.mts → register-C1RwVJAt.d.mts} +1 -1
- package/dist/production/{register-BnQsYkwj.d.ts → register-ODDAAYlf.d.ts} +1 -1
- package/dist/production/{router-Dgz_Mh9m.d.mts → router-CwNp5l9u.d.mts} +27 -3
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/**
|
|
2
|
-
* react-router v7.10.0-pre.
|
|
2
|
+
* react-router v7.10.0-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkC7S4I3K5js = require('./chunk-C7S4I3K5.js');
|
|
18
18
|
|
|
19
19
|
// lib/dom/ssr/hydration.tsx
|
|
20
20
|
function getHydrationData({
|
|
@@ -29,12 +29,12 @@ function getHydrationData({
|
|
|
29
29
|
...state,
|
|
30
30
|
loaderData: { ...state.loaderData }
|
|
31
31
|
};
|
|
32
|
-
let initialMatches =
|
|
32
|
+
let initialMatches = _chunkC7S4I3K5js.matchRoutes.call(void 0, routes, location, basename);
|
|
33
33
|
if (initialMatches) {
|
|
34
34
|
for (let match of initialMatches) {
|
|
35
35
|
let routeId = match.route.id;
|
|
36
36
|
let routeInfo = getRouteInfo(routeId);
|
|
37
|
-
if (
|
|
37
|
+
if (_chunkC7S4I3K5js.shouldHydrateRouteLoader.call(void 0,
|
|
38
38
|
routeId,
|
|
39
39
|
routeInfo.clientLoader,
|
|
40
40
|
routeInfo.hasLoader,
|
|
@@ -112,7 +112,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
);
|
|
115
|
-
if (
|
|
115
|
+
if (_chunkC7S4I3K5js.isRouteErrorResponse.call(void 0, error)) {
|
|
116
116
|
return /* @__PURE__ */ _react2.default.createElement(
|
|
117
117
|
ErrorWrapper,
|
|
118
118
|
{
|
|
@@ -120,7 +120,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
120
120
|
title: "Unhandled Thrown Response!"
|
|
121
121
|
},
|
|
122
122
|
/* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText),
|
|
123
|
-
|
|
123
|
+
_chunkC7S4I3K5js.ENABLE_DEV_WARNINGS ? heyDeveloper : null
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
let errorInstance;
|
|
@@ -146,7 +146,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
146
146
|
function RSCDefaultRootErrorBoundary({
|
|
147
147
|
hasRootLayout
|
|
148
148
|
}) {
|
|
149
|
-
let error =
|
|
149
|
+
let error = _chunkC7S4I3K5js.useRouteError.call(void 0, );
|
|
150
150
|
if (hasRootLayout === void 0) {
|
|
151
151
|
throw new Error("Missing 'hasRootLayout' prop");
|
|
152
152
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { f as RouterProviderProps$1, e as RouterInit, u as unstable_ClientInstrumentation, g as unstable_ClientOnErrorFunction } from './router-
|
|
3
|
-
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-
|
|
2
|
+
import { f as RouterProviderProps$1, e as RouterInit, u as unstable_ClientInstrumentation, g as unstable_ClientOnErrorFunction } from './router-CwNp5l9u.mjs';
|
|
3
|
+
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-C5z6FZmz.mjs';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
6
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -25,16 +25,9 @@ interface HydratedRouterProps {
|
|
|
25
25
|
* added routes via `route.lazy` or `patchRoutesOnNavigation`). This is
|
|
26
26
|
* mostly useful for observability such as wrapping navigations, fetches,
|
|
27
27
|
* as well as route loaders/actions/middlewares with logging and/or performance
|
|
28
|
-
* tracing.
|
|
28
|
+
* tracing. See the [docs](../../how-to/instrumentation) for more information.
|
|
29
29
|
*
|
|
30
30
|
* ```tsx
|
|
31
|
-
* startTransition(() => {
|
|
32
|
-
* hydrateRoot(
|
|
33
|
-
* document,
|
|
34
|
-
* <HydratedRouter unstable_instrumentations={[logging]} />
|
|
35
|
-
* );
|
|
36
|
-
* });
|
|
37
|
-
*
|
|
38
31
|
* const logging = {
|
|
39
32
|
* router({ instrument }) {
|
|
40
33
|
* instrument({
|
|
@@ -67,6 +60,13 @@ interface HydratedRouterProps {
|
|
|
67
60
|
* let duration = Math.round(performance.now() - start);
|
|
68
61
|
* console.log(`end ${label} (${duration}ms)`);
|
|
69
62
|
* }
|
|
63
|
+
*
|
|
64
|
+
* startTransition(() => {
|
|
65
|
+
* hydrateRoot(
|
|
66
|
+
* document,
|
|
67
|
+
* <HydratedRouter unstable_instrumentations={[logging]} />
|
|
68
|
+
* );
|
|
69
|
+
* });
|
|
70
70
|
* ```
|
|
71
71
|
*/
|
|
72
72
|
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RouterProviderProps as RouterProviderProps$1, RouterInit, unstable_ClientOnErrorFunction } from 'react-router';
|
|
3
|
-
import { u as unstable_ClientInstrumentation } from './instrumentation-
|
|
4
|
-
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-
|
|
3
|
+
import { u as unstable_ClientInstrumentation } from './instrumentation-BB0wRuqz.js';
|
|
4
|
+
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-BpxEZgZC.js';
|
|
5
5
|
|
|
6
6
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
7
7
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -26,16 +26,9 @@ interface HydratedRouterProps {
|
|
|
26
26
|
* added routes via `route.lazy` or `patchRoutesOnNavigation`). This is
|
|
27
27
|
* mostly useful for observability such as wrapping navigations, fetches,
|
|
28
28
|
* as well as route loaders/actions/middlewares with logging and/or performance
|
|
29
|
-
* tracing.
|
|
29
|
+
* tracing. See the [docs](../../how-to/instrumentation) for more information.
|
|
30
30
|
*
|
|
31
31
|
* ```tsx
|
|
32
|
-
* startTransition(() => {
|
|
33
|
-
* hydrateRoot(
|
|
34
|
-
* document,
|
|
35
|
-
* <HydratedRouter unstable_instrumentations={[logging]} />
|
|
36
|
-
* );
|
|
37
|
-
* });
|
|
38
|
-
*
|
|
39
32
|
* const logging = {
|
|
40
33
|
* router({ instrument }) {
|
|
41
34
|
* instrument({
|
|
@@ -68,6 +61,13 @@ interface HydratedRouterProps {
|
|
|
68
61
|
* let duration = Math.round(performance.now() - start);
|
|
69
62
|
* console.log(`end ${label} (${duration}ms)`);
|
|
70
63
|
* }
|
|
64
|
+
*
|
|
65
|
+
* startTransition(() => {
|
|
66
|
+
* hydrateRoot(
|
|
67
|
+
* document,
|
|
68
|
+
* <HydratedRouter unstable_instrumentations={[logging]} />
|
|
69
|
+
* );
|
|
70
|
+
* });
|
|
71
71
|
* ```
|
|
72
72
|
*/
|
|
73
73
|
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
|
@@ -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.10.0-pre.
|
|
2
|
+
* react-router v7.10.0-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkYU3WNS3Tjs = require('./chunk-YU3WNS3T.js');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -32,7 +32,7 @@ var _chunkSGCRBGEMjs = require('./chunk-SGCRBGEM.js');
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
var
|
|
35
|
+
var _chunkC7S4I3K5js = require('./chunk-C7S4I3K5.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);
|
|
@@ -204,7 +204,7 @@ function HydratedRouter(props) {
|
|
|
204
204
|
}, []);
|
|
205
205
|
React2.useEffect(() => {
|
|
206
206
|
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
|
|
207
|
-
document.querySelectorAll(`[${
|
|
207
|
+
document.querySelectorAll(`[${_chunkC7S4I3K5js.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
|
|
208
208
|
}
|
|
209
209
|
}, [criticalCss]);
|
|
210
210
|
let [location2, setLocation] = React2.useState(router.state.location);
|
|
@@ -376,10 +376,10 @@ function createRouterFromPayload({
|
|
|
376
376
|
};
|
|
377
377
|
if (payload.type !== "render") throw new Error("Invalid payload type");
|
|
378
378
|
globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {}));
|
|
379
|
-
|
|
379
|
+
_chunkYU3WNS3Tjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
|
|
380
380
|
let patches = /* @__PURE__ */ new Map();
|
|
381
381
|
_optionalChain([payload, 'access', _22 => _22.patches, 'optionalAccess', _23 => _23.forEach, 'call', _24 => _24((patch) => {
|
|
382
|
-
|
|
382
|
+
_chunkC7S4I3K5js.invariant.call(void 0, patch.parentId, "Invalid patch parentId");
|
|
383
383
|
if (!patches.has(patch.parentId)) {
|
|
384
384
|
patches.set(patch.parentId, []);
|
|
385
385
|
}
|
|
@@ -401,12 +401,12 @@ function createRouterFromPayload({
|
|
|
401
401
|
}
|
|
402
402
|
return [route];
|
|
403
403
|
}, []);
|
|
404
|
-
globalVar.__reactRouterDataRouter =
|
|
404
|
+
globalVar.__reactRouterDataRouter = _chunkC7S4I3K5js.createRouter.call(void 0, {
|
|
405
405
|
routes,
|
|
406
406
|
getContext,
|
|
407
407
|
basename: payload.basename,
|
|
408
|
-
history:
|
|
409
|
-
hydrationData:
|
|
408
|
+
history: _chunkC7S4I3K5js.createBrowserHistory.call(void 0, ),
|
|
409
|
+
hydrationData: _chunkYU3WNS3Tjs.getHydrationData.call(void 0, {
|
|
410
410
|
state: {
|
|
411
411
|
loaderData: payload.loaderData,
|
|
412
412
|
actionData: payload.actionData,
|
|
@@ -415,7 +415,7 @@ function createRouterFromPayload({
|
|
|
415
415
|
routes,
|
|
416
416
|
getRouteInfo: (routeId) => {
|
|
417
417
|
let match = payload.matches.find((m) => m.id === routeId);
|
|
418
|
-
|
|
418
|
+
_chunkC7S4I3K5js.invariant.call(void 0, match, "Route not found in payload");
|
|
419
419
|
return {
|
|
420
420
|
clientLoader: match.clientLoader,
|
|
421
421
|
hasLoader: match.hasLoader,
|
|
@@ -513,9 +513,9 @@ function createRouterFromPayload({
|
|
|
513
513
|
routeModules: globalVar.__reactRouterRouteModules
|
|
514
514
|
};
|
|
515
515
|
}
|
|
516
|
-
var renderedRoutesContext =
|
|
516
|
+
var renderedRoutesContext = _chunkC7S4I3K5js.createContext.call(void 0, );
|
|
517
517
|
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
|
|
518
|
-
let dataStrategy =
|
|
518
|
+
let dataStrategy = _chunkC7S4I3K5js.getSingleFetchDataStrategyImpl.call(void 0,
|
|
519
519
|
getRouter,
|
|
520
520
|
(match) => {
|
|
521
521
|
let M = match;
|
|
@@ -571,20 +571,20 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
|
|
571
571
|
function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
|
|
572
572
|
return async (args, basename, targetRoutes) => {
|
|
573
573
|
let { request, context } = args;
|
|
574
|
-
let url =
|
|
574
|
+
let url = _chunkC7S4I3K5js.singleFetchUrl.call(void 0, request.url, basename, "rsc");
|
|
575
575
|
if (request.method === "GET") {
|
|
576
|
-
url =
|
|
576
|
+
url = _chunkC7S4I3K5js.stripIndexParam.call(void 0, url);
|
|
577
577
|
if (targetRoutes) {
|
|
578
578
|
url.searchParams.set("_routes", targetRoutes.join(","));
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
581
|
let res = await fetchImplementation(
|
|
582
|
-
new Request(url, await
|
|
582
|
+
new Request(url, await _chunkC7S4I3K5js.createRequestInit.call(void 0, request))
|
|
583
583
|
);
|
|
584
584
|
if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
|
|
585
|
-
throw new (0,
|
|
585
|
+
throw new (0, _chunkC7S4I3K5js.ErrorResponseImpl)(res.status, res.statusText, await res.text());
|
|
586
586
|
}
|
|
587
|
-
|
|
587
|
+
_chunkC7S4I3K5js.invariant.call(void 0, res.body, "No response body to decode");
|
|
588
588
|
try {
|
|
589
589
|
const payload = await createFromReadableStream(res.body, {
|
|
590
590
|
temporaryReferences: void 0
|
|
@@ -608,7 +608,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
|
|
|
608
608
|
}
|
|
609
609
|
context.get(renderedRoutesContext).push(...payload.matches);
|
|
610
610
|
let results = { routes: {} };
|
|
611
|
-
const dataKey =
|
|
611
|
+
const dataKey = _chunkC7S4I3K5js.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
|
|
612
612
|
for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {
|
|
613
613
|
results.routes[routeId] = { data };
|
|
614
614
|
}
|
|
@@ -641,7 +641,7 @@ function RSCHydratedRouter({
|
|
|
641
641
|
[createFromReadableStream, payload, fetchImplementation, getContext]
|
|
642
642
|
);
|
|
643
643
|
React3.useEffect(() => {
|
|
644
|
-
|
|
644
|
+
_chunkC7S4I3K5js.setIsHydrated.call(void 0, );
|
|
645
645
|
}, []);
|
|
646
646
|
React3.useLayoutEffect(() => {
|
|
647
647
|
const globalVar = window;
|
|
@@ -743,8 +743,8 @@ function RSCHydratedRouter({
|
|
|
743
743
|
routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" },
|
|
744
744
|
routeModules
|
|
745
745
|
};
|
|
746
|
-
return /* @__PURE__ */ React3.createElement(
|
|
747
|
-
|
|
746
|
+
return /* @__PURE__ */ React3.createElement(_chunkC7S4I3K5js.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkYU3WNS3Tjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkC7S4I3K5js.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
|
|
747
|
+
_chunkC7S4I3K5js.RouterProvider,
|
|
748
748
|
{
|
|
749
749
|
router: transitionEnabledRouter,
|
|
750
750
|
flushSync: ReactDOM2.flushSync,
|
|
@@ -761,8 +761,8 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
761
761
|
// the server loader flow regardless of whether the client loader calls
|
|
762
762
|
// `serverLoader` or not, otherwise we'll have nothing to render.
|
|
763
763
|
match.hasComponent && !match.element;
|
|
764
|
-
|
|
765
|
-
|
|
764
|
+
_chunkC7S4I3K5js.invariant.call(void 0, window.__reactRouterRouteModules);
|
|
765
|
+
_chunkYU3WNS3Tjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
|
|
766
766
|
let dataRoute = {
|
|
767
767
|
id: match.id,
|
|
768
768
|
element: match.element,
|
|
@@ -812,7 +812,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
812
812
|
return await callSingleFetch(singleFetch);
|
|
813
813
|
}
|
|
814
814
|
}) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => {
|
|
815
|
-
throw
|
|
815
|
+
throw _chunkC7S4I3K5js.noActionDefinedError.call(void 0, "action", match.id);
|
|
816
816
|
},
|
|
817
817
|
path: match.path,
|
|
818
818
|
shouldRevalidate: match.shouldRevalidate,
|
|
@@ -825,7 +825,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
825
825
|
hasShouldRevalidate: match.shouldRevalidate != null
|
|
826
826
|
};
|
|
827
827
|
if (typeof dataRoute.loader === "function") {
|
|
828
|
-
dataRoute.loader.hydrate =
|
|
828
|
+
dataRoute.loader.hydrate = _chunkC7S4I3K5js.shouldHydrateRouteLoader.call(void 0,
|
|
829
829
|
match.id,
|
|
830
830
|
match.clientLoader,
|
|
831
831
|
match.hasLoader,
|
|
@@ -835,7 +835,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
835
835
|
return dataRoute;
|
|
836
836
|
}
|
|
837
837
|
function callSingleFetch(singleFetch) {
|
|
838
|
-
|
|
838
|
+
_chunkC7S4I3K5js.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
|
|
839
839
|
return singleFetch();
|
|
840
840
|
}
|
|
841
841
|
function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
|
@@ -843,7 +843,7 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
|
|
843
843
|
let fn = type === "action" ? "serverAction()" : "serverLoader()";
|
|
844
844
|
let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
|
|
845
845
|
console.error(msg);
|
|
846
|
-
throw new (0,
|
|
846
|
+
throw new (0, _chunkC7S4I3K5js.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
|
|
847
847
|
}
|
|
848
848
|
}
|
|
849
849
|
var nextPaths = /* @__PURE__ */ new Set();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.10.0-pre.
|
|
2
|
+
* react-router v7.10.0-pre.1
|
|
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-
|
|
17
|
+
} from "./chunk-ISOIFGFA.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-
|
|
45
|
+
} from "./chunk-7F5XUDXM.mjs";
|
|
46
46
|
|
|
47
47
|
// lib/dom-export/dom-router-provider.tsx
|
|
48
48
|
import * as React from "react";
|
|
@@ -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-
|
|
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-BB0wRuqz.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
interface Route {
|
|
@@ -536,7 +536,7 @@ interface DOMRouterOpts {
|
|
|
536
536
|
* added routes via `route.lazy` or `patchRoutesOnNavigation`). This is
|
|
537
537
|
* mostly useful for observability such as wrapping navigations, fetches,
|
|
538
538
|
* as well as route loaders/actions/middlewares with logging and/or performance
|
|
539
|
-
* tracing.
|
|
539
|
+
* tracing. See the [docs](../../how-to/instrumentation) for more information.
|
|
540
540
|
*
|
|
541
541
|
* ```tsx
|
|
542
542
|
* let router = createBrowserRouter(routes, {
|
|
@@ -580,189 +580,32 @@ interface DOMRouterOpts {
|
|
|
580
580
|
*/
|
|
581
581
|
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
|
582
582
|
/**
|
|
583
|
-
* Override the default data strategy of running loaders in parallel
|
|
584
|
-
*
|
|
585
|
-
*
|
|
586
|
-
* <docs-warning>This is a low-level API intended for advanced use-cases. This
|
|
587
|
-
* overrides React Router's internal handling of
|
|
588
|
-
* [`action`](../../start/data/route-object#action)/[`loader`](../../start/data/route-object#loader)
|
|
589
|
-
* execution, and if done incorrectly will break your app code. Please use
|
|
590
|
-
* with caution and perform the appropriate testing.</docs-warning>
|
|
591
|
-
*
|
|
592
|
-
* By default, React Router is opinionated about how your data is loaded/submitted -
|
|
593
|
-
* and most notably, executes all of your [`loader`](../../start/data/route-object#loader)s
|
|
594
|
-
* in parallel for optimal data fetching. While we think this is the right
|
|
595
|
-
* behavior for most use-cases, we realize that there is no "one size fits all"
|
|
596
|
-
* solution when it comes to data fetching for the wide landscape of
|
|
597
|
-
* application requirements.
|
|
598
|
-
*
|
|
599
|
-
* The `dataStrategy` option gives you full control over how your [`action`](../../start/data/route-object#action)s
|
|
600
|
-
* and [`loader`](../../start/data/route-object#loader)s are executed and lays
|
|
601
|
-
* the foundation to build in more advanced APIs such as middleware, context,
|
|
602
|
-
* and caching layers. Over time, we expect that we'll leverage this API
|
|
603
|
-
* internally to bring more first class APIs to React Router, but until then
|
|
604
|
-
* (and beyond), this is your way to add more advanced functionality for your
|
|
605
|
-
* application's data needs.
|
|
606
|
-
*
|
|
607
|
-
* The `dataStrategy` function should return a key/value-object of
|
|
608
|
-
* `routeId` -> {@link DataStrategyResult} and should include entries for any
|
|
609
|
-
* routes where a handler was executed. A `DataStrategyResult` indicates if
|
|
610
|
-
* the handler was successful or not based on the `DataStrategyResult.type`
|
|
611
|
-
* field. If the returned `DataStrategyResult.result` is a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response),
|
|
612
|
-
* React Router will unwrap it for you (via [`res.json`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json)
|
|
613
|
-
* or [`res.text`](https://developer.mozilla.org/en-US/docs/Web/API/Response/text)).
|
|
614
|
-
* If you need to do custom decoding of a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
|
615
|
-
* but want to preserve the status code, you can use the `data` utility to
|
|
616
|
-
* return your decoded data along with a `ResponseInit`.
|
|
617
|
-
*
|
|
618
|
-
* <details>
|
|
619
|
-
* <summary><b>Example <code>dataStrategy</code> Use Cases</b></summary>
|
|
620
|
-
*
|
|
621
|
-
* **Adding logging**
|
|
622
|
-
*
|
|
623
|
-
* In the simplest case, let's look at hooking into this API to add some logging
|
|
624
|
-
* for when our route [`action`](../../start/data/route-object#action)s/[`loader`](../../start/data/route-object#loader)s
|
|
625
|
-
* execute:
|
|
583
|
+
* Override the default data strategy of running loaders in parallel -
|
|
584
|
+
* see the [docs](../../how-to/data-strategy) for more information.
|
|
626
585
|
*
|
|
627
586
|
* ```tsx
|
|
628
587
|
* let router = createBrowserRouter(routes, {
|
|
629
|
-
* async dataStrategy({
|
|
630
|
-
*
|
|
631
|
-
*
|
|
632
|
-
*
|
|
633
|
-
*
|
|
634
|
-
*
|
|
635
|
-
*
|
|
636
|
-
* })
|
|
588
|
+
* async dataStrategy({
|
|
589
|
+
* matches,
|
|
590
|
+
* request,
|
|
591
|
+
* runClientMiddleware,
|
|
592
|
+
* }) {
|
|
593
|
+
* const matchesToLoad = matches.filter((m) =>
|
|
594
|
+
* m.shouldCallHandler(),
|
|
637
595
|
* );
|
|
638
|
-
* return results;
|
|
639
|
-
* },
|
|
640
|
-
* });
|
|
641
|
-
* ```
|
|
642
|
-
*
|
|
643
|
-
* **Middleware**
|
|
644
|
-
*
|
|
645
|
-
* Let's define a middleware on each route via [`handle`](../../start/data/route-object#handle)
|
|
646
|
-
* and call middleware sequentially first, then call all
|
|
647
|
-
* [`loader`](../../start/data/route-object#loader)s in parallel - providing
|
|
648
|
-
* any data made available via the middleware:
|
|
649
|
-
*
|
|
650
|
-
* ```ts
|
|
651
|
-
* const routes = [
|
|
652
|
-
* {
|
|
653
|
-
* id: "parent",
|
|
654
|
-
* path: "/parent",
|
|
655
|
-
* loader({ request }, context) {
|
|
656
|
-
* // ...
|
|
657
|
-
* },
|
|
658
|
-
* handle: {
|
|
659
|
-
* async middleware({ request }, context) {
|
|
660
|
-
* context.parent = "PARENT MIDDLEWARE";
|
|
661
|
-
* },
|
|
662
|
-
* },
|
|
663
|
-
* children: [
|
|
664
|
-
* {
|
|
665
|
-
* id: "child",
|
|
666
|
-
* path: "child",
|
|
667
|
-
* loader({ request }, context) {
|
|
668
|
-
* // ...
|
|
669
|
-
* },
|
|
670
|
-
* handle: {
|
|
671
|
-
* async middleware({ request }, context) {
|
|
672
|
-
* context.child = "CHILD MIDDLEWARE";
|
|
673
|
-
* },
|
|
674
|
-
* },
|
|
675
|
-
* },
|
|
676
|
-
* ],
|
|
677
|
-
* },
|
|
678
|
-
* ];
|
|
679
596
|
*
|
|
680
|
-
*
|
|
681
|
-
*
|
|
682
|
-
*
|
|
683
|
-
*
|
|
684
|
-
*
|
|
685
|
-
* if (match.route.handle?.middleware) {
|
|
686
|
-
* await match.route.handle.middleware(
|
|
687
|
-
* { request, params },
|
|
688
|
-
* context
|
|
689
|
-
* );
|
|
690
|
-
* }
|
|
691
|
-
* }
|
|
692
|
-
*
|
|
693
|
-
* // Run loaders in parallel with the `context` value
|
|
694
|
-
* let matchesToLoad = matches.filter((m) => m.shouldLoad);
|
|
695
|
-
* let results = await Promise.all(
|
|
696
|
-
* matchesToLoad.map((match, i) =>
|
|
697
|
-
* match.resolve((handler) => {
|
|
698
|
-
* // Whatever you pass to `handler` will be passed as the 2nd parameter
|
|
699
|
-
* // to your loader/action
|
|
700
|
-
* return handler(context);
|
|
701
|
-
* })
|
|
702
|
-
* )
|
|
703
|
-
* );
|
|
704
|
-
* return results.reduce(
|
|
705
|
-
* (acc, result, i) =>
|
|
706
|
-
* Object.assign(acc, {
|
|
707
|
-
* [matchesToLoad[i].route.id]: result,
|
|
597
|
+
* const results: Record<string, DataStrategyResult> = {};
|
|
598
|
+
* await runClientMiddleware(() =>
|
|
599
|
+
* Promise.all(
|
|
600
|
+
* matchesToLoad.map(async (match) => {
|
|
601
|
+
* results[match.route.id] = await match.resolve();
|
|
708
602
|
* }),
|
|
709
|
-
*
|
|
603
|
+
* ),
|
|
710
604
|
* );
|
|
711
|
-
* },
|
|
712
|
-
* });
|
|
713
|
-
* ```
|
|
714
|
-
*
|
|
715
|
-
* **Custom Handler**
|
|
716
|
-
*
|
|
717
|
-
* It's also possible you don't even want to define a [`loader`](../../start/data/route-object#loader)
|
|
718
|
-
* implementation at the route level. Maybe you want to just determine the
|
|
719
|
-
* routes and issue a single GraphQL request for all of your data? You can do
|
|
720
|
-
* that by setting your `route.loader=true` so it qualifies as "having a
|
|
721
|
-
* loader", and then store GQL fragments on `route.handle`:
|
|
722
|
-
*
|
|
723
|
-
* ```ts
|
|
724
|
-
* const routes = [
|
|
725
|
-
* {
|
|
726
|
-
* id: "parent",
|
|
727
|
-
* path: "/parent",
|
|
728
|
-
* loader: true,
|
|
729
|
-
* handle: {
|
|
730
|
-
* gql: gql`
|
|
731
|
-
* fragment Parent on Whatever {
|
|
732
|
-
* parentField
|
|
733
|
-
* }
|
|
734
|
-
* `,
|
|
735
|
-
* },
|
|
736
|
-
* children: [
|
|
737
|
-
* {
|
|
738
|
-
* id: "child",
|
|
739
|
-
* path: "child",
|
|
740
|
-
* loader: true,
|
|
741
|
-
* handle: {
|
|
742
|
-
* gql: gql`
|
|
743
|
-
* fragment Child on Whatever {
|
|
744
|
-
* childField
|
|
745
|
-
* }
|
|
746
|
-
* `,
|
|
747
|
-
* },
|
|
748
|
-
* },
|
|
749
|
-
* ],
|
|
750
|
-
* },
|
|
751
|
-
* ];
|
|
752
|
-
*
|
|
753
|
-
* let router = createBrowserRouter(routes, {
|
|
754
|
-
* async dataStrategy({ matches, params, request }) {
|
|
755
|
-
* // Compose route fragments into a single GQL payload
|
|
756
|
-
* let gql = getFragmentsFromRouteHandles(matches);
|
|
757
|
-
* let data = await fetchGql(gql);
|
|
758
|
-
* // Parse results back out into individual route level `DataStrategyResult`'s
|
|
759
|
-
* // keyed by `routeId`
|
|
760
|
-
* let results = parseResultsFromGql(data);
|
|
761
605
|
* return results;
|
|
762
606
|
* },
|
|
763
607
|
* });
|
|
764
608
|
* ```
|
|
765
|
-
*</details>
|
|
766
609
|
*/
|
|
767
610
|
dataStrategy?: DataStrategyFunction;
|
|
768
611
|
/**
|