react-router 7.11.0-pre.0 → 7.12.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.
- package/CHANGELOG.md +52 -2
- package/dist/development/{browser-Cv4JZyZ5.d.mts → browser-BEPxnEBW.d.mts} +4 -2
- package/dist/{production/browser-Cv4JZyZ5.d.mts → development/browser-CJ9_du-U.d.ts} +4 -2
- package/dist/development/{chunk-QMKP6CC3.mjs → chunk-2RQJSHF5.mjs} +111 -11
- package/dist/development/{chunk-JKMHOZYW.js → chunk-AUGQXA25.js} +98 -108
- package/dist/development/{chunk-OVG6YSZ5.js → chunk-JBLDGBX7.js} +7 -7
- package/dist/development/{chunk-KRMLYMWA.mjs → chunk-KYKH2NCS.mjs} +122 -50
- package/dist/development/{chunk-UO7KGW2U.js → chunk-MNTWZBMV.js} +117 -35
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.d.ts +2 -2
- package/dist/development/dom-export.js +35 -30
- package/dist/development/dom-export.mjs +12 -7
- package/dist/development/{index-react-server-client-P7VgYu6T.d.mts → index-react-server-client-IoJGLOqV.d.mts} +3 -1
- package/dist/{production/index-react-server-client-Cv5Q9lf0.d.ts → development/index-react-server-client-gGyf-7Xp.d.ts} +3 -1
- 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.d.mts +3 -1
- package/dist/development/index-react-server.d.ts +3 -1
- package/dist/development/index-react-server.js +92 -7
- package/dist/development/index-react-server.mjs +92 -7
- package/dist/development/index.d.mts +9 -9
- package/dist/development/index.d.ts +9 -9
- package/dist/development/index.js +205 -101
- package/dist/development/index.mjs +7 -3
- package/dist/{production/instrumentation-BlrVzjbg.d.ts → development/instrumentation-DvHY1sgY.d.ts} +45 -1
- 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-BGQUMCK4.d.ts → register-Bm80E9qL.d.ts} +1 -1
- package/dist/development/{register-DTJJbt1o.d.mts → register-CS_tiXsm.d.mts} +1 -1
- package/dist/development/{router-5fbeEIMQ.d.mts → router-5iOvts3c.d.mts} +45 -1
- package/dist/{development/browser-o-qhcuhA.d.ts → production/browser-BEPxnEBW.d.mts} +4 -2
- package/dist/production/{browser-o-qhcuhA.d.ts → browser-CJ9_du-U.d.ts} +4 -2
- package/dist/production/{chunk-IDHO4Q57.mjs → chunk-HFQUWXEK.mjs} +122 -50
- package/dist/production/{chunk-J4JITZ76.mjs → chunk-ILRYJQTC.mjs} +111 -11
- package/dist/production/{chunk-YGB3JEIP.js → chunk-O6YLM5NB.js} +7 -7
- package/dist/production/{chunk-M5W3Q3T5.js → chunk-QWJQISZK.js} +98 -108
- package/dist/production/{chunk-AO22ZXHI.js → chunk-ZR2NIBH2.js} +117 -35
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.d.ts +2 -2
- package/dist/production/dom-export.js +35 -30
- package/dist/production/dom-export.mjs +12 -7
- package/dist/production/{index-react-server-client-P7VgYu6T.d.mts → index-react-server-client-IoJGLOqV.d.mts} +3 -1
- package/dist/{development/index-react-server-client-Cv5Q9lf0.d.ts → production/index-react-server-client-gGyf-7Xp.d.ts} +3 -1
- 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.d.mts +3 -1
- package/dist/production/index-react-server.d.ts +3 -1
- package/dist/production/index-react-server.js +92 -7
- package/dist/production/index-react-server.mjs +92 -7
- package/dist/production/index.d.mts +9 -9
- package/dist/production/index.d.ts +9 -9
- package/dist/production/index.js +205 -101
- package/dist/production/index.mjs +7 -3
- package/dist/{development/instrumentation-BlrVzjbg.d.ts → production/instrumentation-DvHY1sgY.d.ts} +45 -1
- 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-BGQUMCK4.d.ts → register-Bm80E9qL.d.ts} +1 -1
- package/dist/production/{register-DTJJbt1o.d.mts → register-CS_tiXsm.d.mts} +1 -1
- package/dist/production/{router-5fbeEIMQ.d.mts → router-5iOvts3c.d.mts} +45 -1
- package/package.json +1 -1
package/dist/production/index.js
CHANGED
|
@@ -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.
|
|
2
|
+
* react-router v7.12.0-pre.0
|
|
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 _chunkO6YLM5NBjs = require('./chunk-O6YLM5NB.js');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
@@ -40,7 +40,7 @@ var _chunkYGB3JEIPjs = require('./chunk-YGB3JEIP.js');
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
var
|
|
43
|
+
var _chunkQWJQISZKjs = require('./chunk-QWJQISZK.js');
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
@@ -147,7 +147,9 @@ var _chunkM5W3Q3T5js = require('./chunk-M5W3Q3T5.js');
|
|
|
147
147
|
|
|
148
148
|
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
var _chunkZR2NIBH2js = require('./chunk-ZR2NIBH2.js');
|
|
151
153
|
|
|
152
154
|
// lib/dom/ssr/server.tsx
|
|
153
155
|
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
|
|
@@ -160,7 +162,7 @@ function ServerRouter({
|
|
|
160
162
|
url = new URL(url);
|
|
161
163
|
}
|
|
162
164
|
let { manifest, routeModules, criticalCss, serverHandoffString } = context;
|
|
163
|
-
let routes =
|
|
165
|
+
let routes = _chunkZR2NIBH2js.createServerRoutes.call(void 0,
|
|
164
166
|
manifest.routes,
|
|
165
167
|
routeModules,
|
|
166
168
|
context.future,
|
|
@@ -173,7 +175,7 @@ function ServerRouter({
|
|
|
173
175
|
let routeId = match.route.id;
|
|
174
176
|
let route = routeModules[routeId];
|
|
175
177
|
let manifestRoute = context.manifest.routes[routeId];
|
|
176
|
-
if (route && manifestRoute &&
|
|
178
|
+
if (route && manifestRoute && _chunkZR2NIBH2js.shouldHydrateRouteLoader.call(void 0,
|
|
177
179
|
routeId,
|
|
178
180
|
route.clientLoader,
|
|
179
181
|
manifestRoute.hasLoader,
|
|
@@ -182,9 +184,9 @@ function ServerRouter({
|
|
|
182
184
|
delete context.staticHandlerContext.loaderData[routeId];
|
|
183
185
|
}
|
|
184
186
|
}
|
|
185
|
-
let router =
|
|
187
|
+
let router = _chunkQWJQISZKjs.createStaticRouter.call(void 0, routes, context.staticHandlerContext);
|
|
186
188
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
187
|
-
|
|
189
|
+
_chunkZR2NIBH2js.FrameworkContext.Provider,
|
|
188
190
|
{
|
|
189
191
|
value: {
|
|
190
192
|
manifest,
|
|
@@ -199,8 +201,8 @@ function ServerRouter({
|
|
|
199
201
|
renderMeta: context.renderMeta
|
|
200
202
|
}
|
|
201
203
|
},
|
|
202
|
-
/* @__PURE__ */ React.createElement(
|
|
203
|
-
|
|
204
|
+
/* @__PURE__ */ React.createElement(_chunkZR2NIBH2js.RemixErrorBoundary, { location: router.state.location }, /* @__PURE__ */ React.createElement(
|
|
205
|
+
_chunkQWJQISZKjs.StaticRouterProvider,
|
|
204
206
|
{
|
|
205
207
|
router,
|
|
206
208
|
context: context.staticHandlerContext,
|
|
@@ -208,7 +210,7 @@ function ServerRouter({
|
|
|
208
210
|
}
|
|
209
211
|
))
|
|
210
212
|
), context.serverHandoffStream ? /* @__PURE__ */ React.createElement(React.Suspense, null, /* @__PURE__ */ React.createElement(
|
|
211
|
-
|
|
213
|
+
_chunkZR2NIBH2js.StreamTransfer,
|
|
212
214
|
{
|
|
213
215
|
context,
|
|
214
216
|
identifier: 0,
|
|
@@ -234,7 +236,8 @@ function createRoutesStub(routes, _context) {
|
|
|
234
236
|
frameworkContextRef.current = {
|
|
235
237
|
future: {
|
|
236
238
|
unstable_subResourceIntegrity: _optionalChain([future, 'optionalAccess', _2 => _2.unstable_subResourceIntegrity]) === true,
|
|
237
|
-
v8_middleware: _optionalChain([future, 'optionalAccess', _3 => _3.v8_middleware]) === true
|
|
239
|
+
v8_middleware: _optionalChain([future, 'optionalAccess', _3 => _3.v8_middleware]) === true,
|
|
240
|
+
unstable_trailingSlashAwareDataRequests: _optionalChain([future, 'optionalAccess', _4 => _4.unstable_trailingSlashAwareDataRequests]) === true
|
|
238
241
|
},
|
|
239
242
|
manifest: {
|
|
240
243
|
routes: {},
|
|
@@ -250,18 +253,18 @@ function createRoutesStub(routes, _context) {
|
|
|
250
253
|
let patched = processRoutes(
|
|
251
254
|
// @ts-expect-error `StubRouteObject` is stricter about `loader`/`action`
|
|
252
255
|
// types compared to `AgnosticRouteObject`
|
|
253
|
-
|
|
254
|
-
_context !== void 0 ? _context : _optionalChain([future, 'optionalAccess',
|
|
256
|
+
_chunkZR2NIBH2js.convertRoutesToDataRoutes.call(void 0, routes, (r) => r),
|
|
257
|
+
_context !== void 0 ? _context : _optionalChain([future, 'optionalAccess', _5 => _5.v8_middleware]) ? new (0, _chunkZR2NIBH2js.RouterContextProvider)() : {},
|
|
255
258
|
frameworkContextRef.current.manifest,
|
|
256
259
|
frameworkContextRef.current.routeModules
|
|
257
260
|
);
|
|
258
|
-
routerRef.current =
|
|
261
|
+
routerRef.current = _chunkZR2NIBH2js.createMemoryRouter.call(void 0, patched, {
|
|
259
262
|
initialEntries,
|
|
260
263
|
initialIndex,
|
|
261
264
|
hydrationData
|
|
262
265
|
});
|
|
263
266
|
}
|
|
264
|
-
return /* @__PURE__ */ React2.createElement(
|
|
267
|
+
return /* @__PURE__ */ React2.createElement(_chunkZR2NIBH2js.FrameworkContext.Provider, { value: frameworkContextRef.current }, /* @__PURE__ */ React2.createElement(_chunkZR2NIBH2js.RouterProvider, { router: routerRef.current }));
|
|
265
268
|
};
|
|
266
269
|
}
|
|
267
270
|
function processRoutes(routes, context, manifest, routeModules, parentId) {
|
|
@@ -275,9 +278,9 @@ function processRoutes(routes, context, manifest, routeModules, parentId) {
|
|
|
275
278
|
id: route.id,
|
|
276
279
|
path: route.path,
|
|
277
280
|
index: route.index,
|
|
278
|
-
Component: route.Component ?
|
|
279
|
-
HydrateFallback: route.HydrateFallback ?
|
|
280
|
-
ErrorBoundary: route.ErrorBoundary ?
|
|
281
|
+
Component: route.Component ? _chunkZR2NIBH2js.withComponentProps.call(void 0, route.Component) : void 0,
|
|
282
|
+
HydrateFallback: route.HydrateFallback ? _chunkZR2NIBH2js.withHydrateFallbackProps.call(void 0, route.HydrateFallback) : void 0,
|
|
283
|
+
ErrorBoundary: route.ErrorBoundary ? _chunkZR2NIBH2js.withErrorBoundaryProps.call(void 0, route.ErrorBoundary) : void 0,
|
|
281
284
|
action: route.action ? (args) => route.action({ ...args, context }) : void 0,
|
|
282
285
|
loader: route.loader ? (args) => route.loader({ ...args, context }) : void 0,
|
|
283
286
|
middleware: route.middleware ? route.middleware.map(
|
|
@@ -312,7 +315,7 @@ function processRoutes(routes, context, manifest, routeModules, parentId) {
|
|
|
312
315
|
};
|
|
313
316
|
manifest.routes[newRoute.id] = entryRoute;
|
|
314
317
|
routeModules[route.id] = {
|
|
315
|
-
default: newRoute.Component ||
|
|
318
|
+
default: newRoute.Component || _chunkZR2NIBH2js.Outlet,
|
|
316
319
|
ErrorBoundary: newRoute.ErrorBoundary || void 0,
|
|
317
320
|
handle: route.handle,
|
|
318
321
|
links: route.links,
|
|
@@ -507,7 +510,7 @@ function myUnescape(value) {
|
|
|
507
510
|
return result;
|
|
508
511
|
}
|
|
509
512
|
function warnOnceAboutExpiresCookie(name, expires) {
|
|
510
|
-
|
|
513
|
+
_chunkZR2NIBH2js.warnOnce.call(void 0,
|
|
511
514
|
!expires,
|
|
512
515
|
`The "${name}" cookie has an "expires" property set. This will cause the expires value to not be updated when the session is committed. Instead, you should set the expires value when serializing the cookie. You can use \`commitSession(session, { expires })\` if using a session storage object, or \`cookie.serialize("value", { expires })\` if you're using the cookie directly.`
|
|
513
516
|
);
|
|
@@ -561,7 +564,7 @@ function serializeErrors(errors, serverMode) {
|
|
|
561
564
|
let entries = Object.entries(errors);
|
|
562
565
|
let serialized = {};
|
|
563
566
|
for (let [key, val] of entries) {
|
|
564
|
-
if (
|
|
567
|
+
if (_chunkZR2NIBH2js.isRouteErrorResponse.call(void 0, val)) {
|
|
565
568
|
serialized[key] = { ...val, __type: "RouteErrorResponse" };
|
|
566
569
|
} else if (val instanceof Error) {
|
|
567
570
|
let sanitized = sanitizeError(val, serverMode);
|
|
@@ -586,7 +589,7 @@ function serializeErrors(errors, serverMode) {
|
|
|
586
589
|
|
|
587
590
|
// lib/server-runtime/routeMatching.ts
|
|
588
591
|
function matchServerRoutes(routes, pathname, basename) {
|
|
589
|
-
let matches =
|
|
592
|
+
let matches = _chunkZR2NIBH2js.matchRoutes.call(void 0,
|
|
590
593
|
routes,
|
|
591
594
|
pathname,
|
|
592
595
|
basename
|
|
@@ -607,7 +610,7 @@ async function callRouteHandler(handler, args) {
|
|
|
607
610
|
context: args.context,
|
|
608
611
|
unstable_pattern: args.unstable_pattern
|
|
609
612
|
});
|
|
610
|
-
if (
|
|
613
|
+
if (_chunkZR2NIBH2js.isDataWithResponseInit.call(void 0, result) && result.init && result.init.status && _chunkZR2NIBH2js.isRedirectStatusCode.call(void 0, result.init.status)) {
|
|
611
614
|
throw new Response(null, result.init);
|
|
612
615
|
}
|
|
613
616
|
return result;
|
|
@@ -672,7 +675,7 @@ function getDevServerHooks() {
|
|
|
672
675
|
function getBuildTimeHeader(request, headerName) {
|
|
673
676
|
if (typeof process !== "undefined") {
|
|
674
677
|
try {
|
|
675
|
-
if (_optionalChain([process, 'access',
|
|
678
|
+
if (_optionalChain([process, 'access', _6 => _6.env, 'optionalAccess', _7 => _7.IS_RR_BUILD_REQUEST]) === "yes") {
|
|
676
679
|
return request.headers.get(headerName);
|
|
677
680
|
}
|
|
678
681
|
} catch (e) {
|
|
@@ -726,17 +729,17 @@ function createStaticHandlerDataRoutes(manifest, future, parentId = "", routesBy
|
|
|
726
729
|
controller.close();
|
|
727
730
|
}
|
|
728
731
|
});
|
|
729
|
-
let decoded = await
|
|
732
|
+
let decoded = await _chunkZR2NIBH2js.decodeViaTurboStream.call(void 0, stream, global);
|
|
730
733
|
let data2 = decoded.value;
|
|
731
|
-
if (data2 &&
|
|
732
|
-
let result = data2[
|
|
734
|
+
if (data2 && _chunkZR2NIBH2js.SingleFetchRedirectSymbol in data2) {
|
|
735
|
+
let result = data2[_chunkZR2NIBH2js.SingleFetchRedirectSymbol];
|
|
733
736
|
let init = { status: result.status };
|
|
734
737
|
if (result.reload) {
|
|
735
|
-
throw
|
|
738
|
+
throw _chunkZR2NIBH2js.redirectDocument.call(void 0, result.redirect, init);
|
|
736
739
|
} else if (result.replace) {
|
|
737
|
-
throw
|
|
740
|
+
throw _chunkZR2NIBH2js.replace.call(void 0, result.redirect, init);
|
|
738
741
|
} else {
|
|
739
|
-
throw
|
|
742
|
+
throw _chunkZR2NIBH2js.redirect.call(void 0, result.redirect, init);
|
|
740
743
|
}
|
|
741
744
|
} else {
|
|
742
745
|
invariant2(
|
|
@@ -775,7 +778,7 @@ function createStaticHandlerDataRoutes(manifest, future, parentId = "", routesBy
|
|
|
775
778
|
|
|
776
779
|
// lib/server-runtime/serverHandoff.ts
|
|
777
780
|
function createServerHandoffString(serverHandoff) {
|
|
778
|
-
return
|
|
781
|
+
return _chunkZR2NIBH2js.escapeHtml.call(void 0, JSON.stringify(serverHandoff));
|
|
779
782
|
}
|
|
780
783
|
|
|
781
784
|
// lib/server-runtime/headers.ts
|
|
@@ -850,13 +853,96 @@ function prependCookies(parentHeaders, childHeaders) {
|
|
|
850
853
|
}
|
|
851
854
|
}
|
|
852
855
|
|
|
856
|
+
// lib/actions.ts
|
|
857
|
+
function throwIfPotentialCSRFAttack(headers, allowedActionOrigins) {
|
|
858
|
+
let originHeader = headers.get("origin");
|
|
859
|
+
let originDomain = typeof originHeader === "string" && originHeader !== "null" ? new URL(originHeader).host : originHeader;
|
|
860
|
+
let host = parseHostHeader(headers);
|
|
861
|
+
if (originDomain && (!host || originDomain !== host.value)) {
|
|
862
|
+
if (!isAllowedOrigin(originDomain, allowedActionOrigins)) {
|
|
863
|
+
if (host) {
|
|
864
|
+
throw new Error(
|
|
865
|
+
`${host.type} header does not match \`origin\` header from a forwarded action request. Aborting the action.`
|
|
866
|
+
);
|
|
867
|
+
} else {
|
|
868
|
+
throw new Error(
|
|
869
|
+
"`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."
|
|
870
|
+
);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
function matchWildcardDomain(domain, pattern) {
|
|
876
|
+
const domainParts = domain.split(".");
|
|
877
|
+
const patternParts = pattern.split(".");
|
|
878
|
+
if (patternParts.length < 1) {
|
|
879
|
+
return false;
|
|
880
|
+
}
|
|
881
|
+
if (domainParts.length < patternParts.length) {
|
|
882
|
+
return false;
|
|
883
|
+
}
|
|
884
|
+
if (patternParts.length === 1 && (patternParts[0] === "*" || patternParts[0] === "**")) {
|
|
885
|
+
return false;
|
|
886
|
+
}
|
|
887
|
+
while (patternParts.length) {
|
|
888
|
+
const patternPart = patternParts.pop();
|
|
889
|
+
const domainPart = domainParts.pop();
|
|
890
|
+
switch (patternPart) {
|
|
891
|
+
case "": {
|
|
892
|
+
return false;
|
|
893
|
+
}
|
|
894
|
+
case "*": {
|
|
895
|
+
if (domainPart) {
|
|
896
|
+
continue;
|
|
897
|
+
} else {
|
|
898
|
+
return false;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
case "**": {
|
|
902
|
+
if (patternParts.length > 0) {
|
|
903
|
+
return false;
|
|
904
|
+
}
|
|
905
|
+
return domainPart !== void 0;
|
|
906
|
+
}
|
|
907
|
+
case void 0:
|
|
908
|
+
default: {
|
|
909
|
+
if (domainPart !== patternPart) {
|
|
910
|
+
return false;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
return domainParts.length === 0;
|
|
916
|
+
}
|
|
917
|
+
function isAllowedOrigin(originDomain, allowedActionOrigins = []) {
|
|
918
|
+
return allowedActionOrigins.some(
|
|
919
|
+
(allowedOrigin) => allowedOrigin && (allowedOrigin === originDomain || matchWildcardDomain(originDomain, allowedOrigin))
|
|
920
|
+
);
|
|
921
|
+
}
|
|
922
|
+
function parseHostHeader(headers) {
|
|
923
|
+
let forwardedHostHeader = headers.get("x-forwarded-host");
|
|
924
|
+
let forwardedHostValue = _optionalChain([forwardedHostHeader, 'optionalAccess', _8 => _8.split, 'call', _9 => _9(","), 'access', _10 => _10[0], 'optionalAccess', _11 => _11.trim, 'call', _12 => _12()]);
|
|
925
|
+
let hostHeader = headers.get("host");
|
|
926
|
+
return forwardedHostValue ? {
|
|
927
|
+
type: "x-forwarded-host",
|
|
928
|
+
value: forwardedHostValue
|
|
929
|
+
} : hostHeader ? {
|
|
930
|
+
type: "host",
|
|
931
|
+
value: hostHeader
|
|
932
|
+
} : void 0;
|
|
933
|
+
}
|
|
934
|
+
|
|
853
935
|
// lib/server-runtime/single-fetch.ts
|
|
854
936
|
var SERVER_NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([
|
|
855
|
-
...
|
|
937
|
+
..._chunkZR2NIBH2js.NO_BODY_STATUS_CODES,
|
|
856
938
|
304
|
|
857
939
|
]);
|
|
858
940
|
async function singleFetchAction(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError) {
|
|
859
941
|
try {
|
|
942
|
+
throwIfPotentialCSRFAttack(
|
|
943
|
+
request.headers,
|
|
944
|
+
Array.isArray(build.allowedActionOrigins) ? build.allowedActionOrigins : []
|
|
945
|
+
);
|
|
860
946
|
let handlerRequest = new Request(handlerUrl, {
|
|
861
947
|
method: request.method,
|
|
862
948
|
body: request.body,
|
|
@@ -882,7 +968,7 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand
|
|
|
882
968
|
return handleQueryError(error);
|
|
883
969
|
}
|
|
884
970
|
function handleQueryResult(result) {
|
|
885
|
-
return
|
|
971
|
+
return _chunkZR2NIBH2js.isResponse.call(void 0, result) ? result : staticContextToResponse(result);
|
|
886
972
|
}
|
|
887
973
|
function handleQueryError(error) {
|
|
888
974
|
handleError(error);
|
|
@@ -894,12 +980,12 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand
|
|
|
894
980
|
}
|
|
895
981
|
function staticContextToResponse(context) {
|
|
896
982
|
let headers = getDocumentHeaders(context, build);
|
|
897
|
-
if (
|
|
983
|
+
if (_chunkZR2NIBH2js.isRedirectStatusCode.call(void 0, context.statusCode) && headers.has("Location")) {
|
|
898
984
|
return new Response(null, { status: context.statusCode, headers });
|
|
899
985
|
}
|
|
900
986
|
if (context.errors) {
|
|
901
987
|
Object.values(context.errors).forEach((err) => {
|
|
902
|
-
if (!
|
|
988
|
+
if (!_chunkZR2NIBH2js.isRouteErrorResponse.call(void 0, err) || err.error) {
|
|
903
989
|
handleError(err);
|
|
904
990
|
}
|
|
905
991
|
});
|
|
@@ -946,7 +1032,7 @@ async function singleFetchLoaders(build, serverMode, staticHandler, request, han
|
|
|
946
1032
|
return handleQueryError(error);
|
|
947
1033
|
}
|
|
948
1034
|
function handleQueryResult(result) {
|
|
949
|
-
return
|
|
1035
|
+
return _chunkZR2NIBH2js.isResponse.call(void 0, result) ? result : staticContextToResponse(result);
|
|
950
1036
|
}
|
|
951
1037
|
function handleQueryError(error) {
|
|
952
1038
|
handleError(error);
|
|
@@ -958,12 +1044,12 @@ async function singleFetchLoaders(build, serverMode, staticHandler, request, han
|
|
|
958
1044
|
}
|
|
959
1045
|
function staticContextToResponse(context) {
|
|
960
1046
|
let headers = getDocumentHeaders(context, build);
|
|
961
|
-
if (
|
|
1047
|
+
if (_chunkZR2NIBH2js.isRedirectStatusCode.call(void 0, context.statusCode) && headers.has("Location")) {
|
|
962
1048
|
return new Response(null, { status: context.statusCode, headers });
|
|
963
1049
|
}
|
|
964
1050
|
if (context.errors) {
|
|
965
1051
|
Object.values(context.errors).forEach((err) => {
|
|
966
|
-
if (!
|
|
1052
|
+
if (!_chunkZR2NIBH2js.isRouteErrorResponse.call(void 0, err) || err.error) {
|
|
967
1053
|
handleError(err);
|
|
968
1054
|
}
|
|
969
1055
|
});
|
|
@@ -1027,15 +1113,15 @@ function generateSingleFetchRedirectResponse(redirectResponse, request, build, s
|
|
|
1027
1113
|
headers.delete("Location");
|
|
1028
1114
|
headers.set("Content-Type", "text/x-script");
|
|
1029
1115
|
return generateSingleFetchResponse(request, build, serverMode, {
|
|
1030
|
-
result: request.method === "GET" ? { [
|
|
1116
|
+
result: request.method === "GET" ? { [_chunkZR2NIBH2js.SingleFetchRedirectSymbol]: redirect2 } : redirect2,
|
|
1031
1117
|
headers,
|
|
1032
|
-
status:
|
|
1118
|
+
status: _chunkZR2NIBH2js.SINGLE_FETCH_REDIRECT_STATUS
|
|
1033
1119
|
});
|
|
1034
1120
|
}
|
|
1035
1121
|
function getSingleFetchRedirect(status, headers, basename) {
|
|
1036
1122
|
let redirect2 = headers.get("Location");
|
|
1037
1123
|
if (basename) {
|
|
1038
|
-
redirect2 =
|
|
1124
|
+
redirect2 = _chunkZR2NIBH2js.stripBasename.call(void 0, redirect2, basename) || redirect2;
|
|
1039
1125
|
}
|
|
1040
1126
|
return {
|
|
1041
1127
|
redirect: redirect2,
|
|
@@ -1061,7 +1147,7 @@ function encodeViaTurboStream(data2, requestSignal, streamTimeout, serverMode) {
|
|
|
1061
1147
|
typeof streamTimeout === "number" ? streamTimeout : 4950
|
|
1062
1148
|
);
|
|
1063
1149
|
requestSignal.addEventListener("abort", () => clearTimeout(timeoutId));
|
|
1064
|
-
return
|
|
1150
|
+
return _chunkZR2NIBH2js.encode.call(void 0, data2, {
|
|
1065
1151
|
signal: controller.signal,
|
|
1066
1152
|
plugins: [
|
|
1067
1153
|
(value) => {
|
|
@@ -1069,12 +1155,12 @@ function encodeViaTurboStream(data2, requestSignal, streamTimeout, serverMode) {
|
|
|
1069
1155
|
let { name, message, stack } = serverMode === "production" /* Production */ ? sanitizeError(value, serverMode) : value;
|
|
1070
1156
|
return ["SanitizedError", name, message, stack];
|
|
1071
1157
|
}
|
|
1072
|
-
if (value instanceof
|
|
1158
|
+
if (value instanceof _chunkZR2NIBH2js.ErrorResponseImpl) {
|
|
1073
1159
|
let { data: data3, status, statusText } = value;
|
|
1074
1160
|
return ["ErrorResponse", data3, status, statusText];
|
|
1075
1161
|
}
|
|
1076
|
-
if (value && typeof value === "object" &&
|
|
1077
|
-
return ["SingleFetchRedirect", value[
|
|
1162
|
+
if (value && typeof value === "object" && _chunkZR2NIBH2js.SingleFetchRedirectSymbol in value) {
|
|
1163
|
+
return ["SingleFetchRedirect", value[_chunkZR2NIBH2js.SingleFetchRedirectSymbol]];
|
|
1078
1164
|
}
|
|
1079
1165
|
}
|
|
1080
1166
|
],
|
|
@@ -1097,7 +1183,7 @@ function derive(build, mode) {
|
|
|
1097
1183
|
let routes = createRoutes(build.routes);
|
|
1098
1184
|
let dataRoutes = createStaticHandlerDataRoutes(build.routes, build.future);
|
|
1099
1185
|
let serverMode = isServerMode(mode) ? mode : "production" /* Production */;
|
|
1100
|
-
let staticHandler =
|
|
1186
|
+
let staticHandler = _chunkZR2NIBH2js.createStaticHandler.call(void 0, dataRoutes, {
|
|
1101
1187
|
basename: build.basename,
|
|
1102
1188
|
unstable_instrumentations: build.entry.module.unstable_instrumentations
|
|
1103
1189
|
});
|
|
@@ -1105,7 +1191,7 @@ function derive(build, mode) {
|
|
|
1105
1191
|
if (serverMode !== "test" /* Test */ && !request.signal.aborted) {
|
|
1106
1192
|
console.error(
|
|
1107
1193
|
// @ts-expect-error This is "private" from users but intended for internal use
|
|
1108
|
-
|
|
1194
|
+
_chunkZR2NIBH2js.isRouteErrorResponse.call(void 0, error) && error.error ? error.error : error
|
|
1109
1195
|
);
|
|
1110
1196
|
}
|
|
1111
1197
|
});
|
|
@@ -1114,7 +1200,7 @@ function derive(build, mode) {
|
|
|
1114
1200
|
let loadContext;
|
|
1115
1201
|
let handleError = (error) => {
|
|
1116
1202
|
if (mode === "development" /* Development */) {
|
|
1117
|
-
_optionalChain([getDevServerHooks, 'call',
|
|
1203
|
+
_optionalChain([getDevServerHooks, 'call', _13 => _13(), 'optionalAccess', _14 => _14.processRequestError, 'optionalCall', _15 => _15(error)]);
|
|
1118
1204
|
}
|
|
1119
1205
|
errorHandler(error, {
|
|
1120
1206
|
context: loadContext,
|
|
@@ -1123,36 +1209,44 @@ function derive(build, mode) {
|
|
|
1123
1209
|
});
|
|
1124
1210
|
};
|
|
1125
1211
|
if (build.future.v8_middleware) {
|
|
1126
|
-
if (initialContext && !(initialContext instanceof
|
|
1212
|
+
if (initialContext && !(initialContext instanceof _chunkZR2NIBH2js.RouterContextProvider)) {
|
|
1127
1213
|
let error = new Error(
|
|
1128
1214
|
"Invalid `context` value provided to `handleRequest`. When middleware is enabled you must return an instance of `RouterContextProvider` from your `getLoadContext` function."
|
|
1129
1215
|
);
|
|
1130
1216
|
handleError(error);
|
|
1131
1217
|
return returnLastResortErrorResponse(error, serverMode);
|
|
1132
1218
|
}
|
|
1133
|
-
loadContext = initialContext || new (0,
|
|
1219
|
+
loadContext = initialContext || new (0, _chunkZR2NIBH2js.RouterContextProvider)();
|
|
1134
1220
|
} else {
|
|
1135
1221
|
loadContext = initialContext || {};
|
|
1136
1222
|
}
|
|
1137
1223
|
let url = new URL(request.url);
|
|
1138
1224
|
let normalizedBasename = build.basename || "/";
|
|
1139
1225
|
let normalizedPath = url.pathname;
|
|
1140
|
-
if (
|
|
1141
|
-
normalizedPath
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1226
|
+
if (build.future.unstable_trailingSlashAwareDataRequests) {
|
|
1227
|
+
if (normalizedPath.endsWith("/_.data")) {
|
|
1228
|
+
normalizedPath = normalizedPath.replace(/_.data$/, "");
|
|
1229
|
+
} else {
|
|
1230
|
+
normalizedPath = normalizedPath.replace(/\.data$/, "");
|
|
1231
|
+
}
|
|
1232
|
+
} else {
|
|
1233
|
+
if (_chunkZR2NIBH2js.stripBasename.call(void 0, normalizedPath, normalizedBasename) === "/_root.data") {
|
|
1234
|
+
normalizedPath = normalizedBasename;
|
|
1235
|
+
} else if (normalizedPath.endsWith(".data")) {
|
|
1236
|
+
normalizedPath = normalizedPath.replace(/\.data$/, "");
|
|
1237
|
+
}
|
|
1238
|
+
if (_chunkZR2NIBH2js.stripBasename.call(void 0, normalizedPath, normalizedBasename) !== "/" && normalizedPath.endsWith("/")) {
|
|
1239
|
+
normalizedPath = normalizedPath.slice(0, -1);
|
|
1240
|
+
}
|
|
1147
1241
|
}
|
|
1148
1242
|
let isSpaMode = getBuildTimeHeader(request, "X-React-Router-SPA-Mode") === "yes";
|
|
1149
1243
|
if (!build.ssr) {
|
|
1150
1244
|
let decodedPath = decodeURI(normalizedPath);
|
|
1151
1245
|
if (normalizedBasename !== "/") {
|
|
1152
|
-
let strippedPath =
|
|
1246
|
+
let strippedPath = _chunkZR2NIBH2js.stripBasename.call(void 0, decodedPath, normalizedBasename);
|
|
1153
1247
|
if (strippedPath == null) {
|
|
1154
1248
|
errorHandler(
|
|
1155
|
-
new (0,
|
|
1249
|
+
new (0, _chunkZR2NIBH2js.ErrorResponseImpl)(
|
|
1156
1250
|
404,
|
|
1157
1251
|
"Not Found",
|
|
1158
1252
|
`Refusing to prerender the \`${decodedPath}\` path because it does not start with the basename \`${normalizedBasename}\``
|
|
@@ -1175,7 +1269,7 @@ function derive(build, mode) {
|
|
|
1175
1269
|
} else if (!build.prerender.includes(decodedPath) && !build.prerender.includes(decodedPath + "/")) {
|
|
1176
1270
|
if (url.pathname.endsWith(".data")) {
|
|
1177
1271
|
errorHandler(
|
|
1178
|
-
new (0,
|
|
1272
|
+
new (0, _chunkZR2NIBH2js.ErrorResponseImpl)(
|
|
1179
1273
|
404,
|
|
1180
1274
|
"Not Found",
|
|
1181
1275
|
`Refusing to SSR the path \`${decodedPath}\` because \`ssr:false\` is set and the path is not included in the \`prerender\` config, so in production the path will be a 404.`
|
|
@@ -1195,7 +1289,7 @@ function derive(build, mode) {
|
|
|
1195
1289
|
}
|
|
1196
1290
|
}
|
|
1197
1291
|
}
|
|
1198
|
-
let manifestUrl =
|
|
1292
|
+
let manifestUrl = _chunkZR2NIBH2js.getManifestPath.call(void 0,
|
|
1199
1293
|
build.routeDiscovery.manifestPath,
|
|
1200
1294
|
normalizedBasename
|
|
1201
1295
|
);
|
|
@@ -1230,7 +1324,7 @@ function derive(build, mode) {
|
|
|
1230
1324
|
loadContext,
|
|
1231
1325
|
handleError
|
|
1232
1326
|
);
|
|
1233
|
-
if (
|
|
1327
|
+
if (_chunkZR2NIBH2js.isRedirectResponse.call(void 0, response)) {
|
|
1234
1328
|
response = generateSingleFetchRedirectResponse(
|
|
1235
1329
|
response,
|
|
1236
1330
|
request,
|
|
@@ -1244,7 +1338,7 @@ function derive(build, mode) {
|
|
|
1244
1338
|
params: singleFetchMatches ? singleFetchMatches[0].params : {},
|
|
1245
1339
|
request
|
|
1246
1340
|
});
|
|
1247
|
-
if (
|
|
1341
|
+
if (_chunkZR2NIBH2js.isRedirectResponse.call(void 0, response)) {
|
|
1248
1342
|
response = generateSingleFetchRedirectResponse(
|
|
1249
1343
|
response,
|
|
1250
1344
|
request,
|
|
@@ -1268,8 +1362,8 @@ function derive(build, mode) {
|
|
|
1268
1362
|
let criticalCss = void 0;
|
|
1269
1363
|
if (build.unstable_getCriticalCss) {
|
|
1270
1364
|
criticalCss = await build.unstable_getCriticalCss({ pathname });
|
|
1271
|
-
} else if (mode === "development" /* Development */ && _optionalChain([getDevServerHooks, 'call',
|
|
1272
|
-
criticalCss = await _optionalChain([getDevServerHooks, 'call',
|
|
1365
|
+
} else if (mode === "development" /* Development */ && _optionalChain([getDevServerHooks, 'call', _16 => _16(), 'optionalAccess', _17 => _17.getCriticalCss])) {
|
|
1366
|
+
criticalCss = await _optionalChain([getDevServerHooks, 'call', _18 => _18(), 'optionalAccess', _19 => _19.getCriticalCss, 'optionalCall', _20 => _20(pathname)]);
|
|
1273
1367
|
}
|
|
1274
1368
|
response = await handleDocumentRequest(
|
|
1275
1369
|
serverMode,
|
|
@@ -1292,7 +1386,7 @@ function derive(build, mode) {
|
|
|
1292
1386
|
return response;
|
|
1293
1387
|
};
|
|
1294
1388
|
if (build.entry.module.unstable_instrumentations) {
|
|
1295
|
-
requestHandler =
|
|
1389
|
+
requestHandler = _chunkZR2NIBH2js.instrumentHandler.call(void 0,
|
|
1296
1390
|
requestHandler,
|
|
1297
1391
|
build.entry.module.unstable_instrumentations.map((i) => i.handler).filter(Boolean)
|
|
1298
1392
|
);
|
|
@@ -1399,12 +1493,18 @@ async function handleSingleFetchRequest(serverMode, build, staticHandler, reques
|
|
|
1399
1493
|
}
|
|
1400
1494
|
async function handleDocumentRequest(serverMode, build, staticHandler, request, loadContext, handleError, isSpaMode, criticalCss) {
|
|
1401
1495
|
try {
|
|
1496
|
+
if (request.method === "POST") {
|
|
1497
|
+
throwIfPotentialCSRFAttack(
|
|
1498
|
+
request.headers,
|
|
1499
|
+
Array.isArray(build.allowedActionOrigins) ? build.allowedActionOrigins : []
|
|
1500
|
+
);
|
|
1501
|
+
}
|
|
1402
1502
|
let result = await staticHandler.query(request, {
|
|
1403
1503
|
requestContext: loadContext,
|
|
1404
1504
|
generateMiddlewareResponse: build.future.v8_middleware ? async (query) => {
|
|
1405
1505
|
try {
|
|
1406
1506
|
let innerResult = await query(request);
|
|
1407
|
-
if (!
|
|
1507
|
+
if (!_chunkZR2NIBH2js.isResponse.call(void 0, innerResult)) {
|
|
1408
1508
|
innerResult = await renderHtml(innerResult, isSpaMode);
|
|
1409
1509
|
}
|
|
1410
1510
|
return innerResult;
|
|
@@ -1414,7 +1514,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
1414
1514
|
}
|
|
1415
1515
|
} : void 0
|
|
1416
1516
|
});
|
|
1417
|
-
if (!
|
|
1517
|
+
if (!_chunkZR2NIBH2js.isResponse.call(void 0, result)) {
|
|
1418
1518
|
result = await renderHtml(result, isSpaMode);
|
|
1419
1519
|
}
|
|
1420
1520
|
return result;
|
|
@@ -1429,7 +1529,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
1429
1529
|
}
|
|
1430
1530
|
if (context.errors) {
|
|
1431
1531
|
Object.values(context.errors).forEach((err) => {
|
|
1432
|
-
if (!
|
|
1532
|
+
if (!_chunkZR2NIBH2js.isRouteErrorResponse.call(void 0, err) || err.error) {
|
|
1433
1533
|
handleError(err);
|
|
1434
1534
|
}
|
|
1435
1535
|
});
|
|
@@ -1481,10 +1581,10 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
1481
1581
|
} catch (error) {
|
|
1482
1582
|
handleError(error);
|
|
1483
1583
|
let errorForSecondRender = error;
|
|
1484
|
-
if (
|
|
1584
|
+
if (_chunkZR2NIBH2js.isResponse.call(void 0, error)) {
|
|
1485
1585
|
try {
|
|
1486
1586
|
let data2 = await unwrapResponse(error);
|
|
1487
|
-
errorForSecondRender = new (0,
|
|
1587
|
+
errorForSecondRender = new (0, _chunkZR2NIBH2js.ErrorResponseImpl)(
|
|
1488
1588
|
error.status,
|
|
1489
1589
|
error.statusText,
|
|
1490
1590
|
data2
|
|
@@ -1492,7 +1592,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
1492
1592
|
} catch (e) {
|
|
1493
1593
|
}
|
|
1494
1594
|
}
|
|
1495
|
-
context =
|
|
1595
|
+
context = _chunkZR2NIBH2js.getStaticContextFromError.call(void 0,
|
|
1496
1596
|
staticHandler.dataRoutes,
|
|
1497
1597
|
context,
|
|
1498
1598
|
errorForSecondRender
|
|
@@ -1551,7 +1651,7 @@ async function handleResourceRequest(serverMode, build, staticHandler, routeId,
|
|
|
1551
1651
|
return handleQueryRouteError(error);
|
|
1552
1652
|
}
|
|
1553
1653
|
function handleQueryRouteResult(result) {
|
|
1554
|
-
if (
|
|
1654
|
+
if (_chunkZR2NIBH2js.isResponse.call(void 0, result)) {
|
|
1555
1655
|
return result;
|
|
1556
1656
|
}
|
|
1557
1657
|
if (typeof result === "string") {
|
|
@@ -1560,10 +1660,10 @@ async function handleResourceRequest(serverMode, build, staticHandler, routeId,
|
|
|
1560
1660
|
return Response.json(result);
|
|
1561
1661
|
}
|
|
1562
1662
|
function handleQueryRouteError(error) {
|
|
1563
|
-
if (
|
|
1663
|
+
if (_chunkZR2NIBH2js.isResponse.call(void 0, error)) {
|
|
1564
1664
|
return error;
|
|
1565
1665
|
}
|
|
1566
|
-
if (
|
|
1666
|
+
if (_chunkZR2NIBH2js.isRouteErrorResponse.call(void 0, error)) {
|
|
1567
1667
|
handleError(error);
|
|
1568
1668
|
return errorResponseToJson(error, serverMode);
|
|
1569
1669
|
}
|
|
@@ -1657,7 +1757,7 @@ function createSessionStorage({
|
|
|
1657
1757
|
updateData,
|
|
1658
1758
|
deleteData
|
|
1659
1759
|
}) {
|
|
1660
|
-
let cookie = isCookie(cookieArg) ? cookieArg : createCookie(_optionalChain([cookieArg, 'optionalAccess',
|
|
1760
|
+
let cookie = isCookie(cookieArg) ? cookieArg : createCookie(_optionalChain([cookieArg, 'optionalAccess', _21 => _21.name]) || "__session", cookieArg);
|
|
1661
1761
|
warnOnceAboutSigningSessionCookie(cookie);
|
|
1662
1762
|
return {
|
|
1663
1763
|
async getSession(cookieHeader, options) {
|
|
@@ -1667,7 +1767,7 @@ function createSessionStorage({
|
|
|
1667
1767
|
},
|
|
1668
1768
|
async commitSession(session, options) {
|
|
1669
1769
|
let { id, data: data2 } = session;
|
|
1670
|
-
let expires = _optionalChain([options, 'optionalAccess',
|
|
1770
|
+
let expires = _optionalChain([options, 'optionalAccess', _22 => _22.maxAge]) != null ? new Date(Date.now() + options.maxAge * 1e3) : _optionalChain([options, 'optionalAccess', _23 => _23.expires]) != null ? options.expires : cookie.expires;
|
|
1671
1771
|
if (id) {
|
|
1672
1772
|
await updateData(id, data2, expires);
|
|
1673
1773
|
} else {
|
|
@@ -1686,7 +1786,7 @@ function createSessionStorage({
|
|
|
1686
1786
|
};
|
|
1687
1787
|
}
|
|
1688
1788
|
function warnOnceAboutSigningSessionCookie(cookie) {
|
|
1689
|
-
|
|
1789
|
+
_chunkZR2NIBH2js.warnOnce.call(void 0,
|
|
1690
1790
|
cookie.isSigned,
|
|
1691
1791
|
`The "${cookie.name}" cookie is not signed, but session cookies should be signed to prevent tampering on the client before they are sent back to the server. See https://reactrouter.com/explanation/sessions-and-cookies#signing-cookies for more information.`
|
|
1692
1792
|
);
|
|
@@ -1694,7 +1794,7 @@ function warnOnceAboutSigningSessionCookie(cookie) {
|
|
|
1694
1794
|
|
|
1695
1795
|
// lib/server-runtime/sessions/cookieStorage.ts
|
|
1696
1796
|
function createCookieSessionStorage({ cookie: cookieArg } = {}) {
|
|
1697
|
-
let cookie = isCookie(cookieArg) ? cookieArg : createCookie(_optionalChain([cookieArg, 'optionalAccess',
|
|
1797
|
+
let cookie = isCookie(cookieArg) ? cookieArg : createCookie(_optionalChain([cookieArg, 'optionalAccess', _24 => _24.name]) || "__session", cookieArg);
|
|
1698
1798
|
warnOnceAboutSigningSessionCookie(cookie);
|
|
1699
1799
|
return {
|
|
1700
1800
|
async getSession(cookieHeader, options) {
|
|
@@ -1758,7 +1858,7 @@ function href(path, ...args) {
|
|
|
1758
1858
|
// same regex as in .\router\utils.ts: compilePath().
|
|
1759
1859
|
(_, param, questionMark) => {
|
|
1760
1860
|
const isRequired = questionMark === void 0;
|
|
1761
|
-
const value = _optionalChain([params, 'optionalAccess',
|
|
1861
|
+
const value = _optionalChain([params, 'optionalAccess', _25 => _25[param]]);
|
|
1762
1862
|
if (isRequired && value === void 0) {
|
|
1763
1863
|
throw new Error(
|
|
1764
1864
|
`Path '${path}' requires param '${param}' but it was not provided`
|
|
@@ -1768,7 +1868,7 @@ function href(path, ...args) {
|
|
|
1768
1868
|
}
|
|
1769
1869
|
);
|
|
1770
1870
|
if (path.endsWith("*")) {
|
|
1771
|
-
const value = _optionalChain([params, 'optionalAccess',
|
|
1871
|
+
const value = _optionalChain([params, 'optionalAccess', _26 => _26["*"]]);
|
|
1772
1872
|
if (value !== void 0) {
|
|
1773
1873
|
result += "/" + value;
|
|
1774
1874
|
}
|
|
@@ -1966,14 +2066,14 @@ async function routeRSCServerRequest({
|
|
|
1966
2066
|
const payload = await createFromReadableStream(
|
|
1967
2067
|
detectRedirectResponse.body
|
|
1968
2068
|
);
|
|
1969
|
-
if (serverResponse.status ===
|
|
2069
|
+
if (serverResponse.status === _chunkZR2NIBH2js.SINGLE_FETCH_REDIRECT_STATUS && payload.type === "redirect") {
|
|
1970
2070
|
const headers2 = new Headers(serverResponse.headers);
|
|
1971
2071
|
headers2.delete("Content-Encoding");
|
|
1972
2072
|
headers2.delete("Content-Length");
|
|
1973
2073
|
headers2.delete("Content-Type");
|
|
1974
2074
|
headers2.delete("X-Remix-Response");
|
|
1975
2075
|
headers2.set("Location", payload.location);
|
|
1976
|
-
return new Response(_optionalChain([serverResponseB, 'optionalAccess',
|
|
2076
|
+
return new Response(_optionalChain([serverResponseB, 'optionalAccess', _27 => _27.body]) || "", {
|
|
1977
2077
|
headers: headers2,
|
|
1978
2078
|
status: payload.status,
|
|
1979
2079
|
statusText: serverResponse.statusText
|
|
@@ -1985,11 +2085,11 @@ async function routeRSCServerRequest({
|
|
|
1985
2085
|
let html = await renderHTML(getPayload, {
|
|
1986
2086
|
onError(error) {
|
|
1987
2087
|
if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
|
|
1988
|
-
renderRedirect =
|
|
2088
|
+
renderRedirect = _chunkZR2NIBH2js.decodeRedirectErrorDigest.call(void 0, error.digest);
|
|
1989
2089
|
if (renderRedirect) {
|
|
1990
2090
|
return error.digest;
|
|
1991
2091
|
}
|
|
1992
|
-
let routeErrorResponse =
|
|
2092
|
+
let routeErrorResponse = _chunkZR2NIBH2js.decodeRouteErrorResponseDigest.call(void 0, error.digest);
|
|
1993
2093
|
if (routeErrorResponse) {
|
|
1994
2094
|
renderError = routeErrorResponse;
|
|
1995
2095
|
status = routeErrorResponse.status;
|
|
@@ -2021,7 +2121,7 @@ async function routeRSCServerRequest({
|
|
|
2021
2121
|
if (renderRedirect) {
|
|
2022
2122
|
controller.enqueue(
|
|
2023
2123
|
new TextEncoder().encode(
|
|
2024
|
-
`<meta http-equiv="refresh" content="0;url=${
|
|
2124
|
+
`<meta http-equiv="refresh" content="0;url=${_chunkZR2NIBH2js.escapeHtml.call(void 0, renderRedirect.location)}"/>`
|
|
2025
2125
|
)
|
|
2026
2126
|
);
|
|
2027
2127
|
}
|
|
@@ -2034,7 +2134,7 @@ async function routeRSCServerRequest({
|
|
|
2034
2134
|
headers
|
|
2035
2135
|
});
|
|
2036
2136
|
}
|
|
2037
|
-
if (!_optionalChain([serverResponseB, 'optionalAccess',
|
|
2137
|
+
if (!_optionalChain([serverResponseB, 'optionalAccess', _28 => _28.body])) {
|
|
2038
2138
|
throw new Error("Failed to clone server response");
|
|
2039
2139
|
}
|
|
2040
2140
|
const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body)).pipeThrough(redirectTransform);
|
|
@@ -2057,7 +2157,7 @@ async function routeRSCServerRequest({
|
|
|
2057
2157
|
}
|
|
2058
2158
|
try {
|
|
2059
2159
|
reason = _nullishCoalesce(renderError, () => ( reason));
|
|
2060
|
-
let [status, statusText] =
|
|
2160
|
+
let [status, statusText] = _chunkZR2NIBH2js.isRouteErrorResponse.call(void 0, reason) ? [reason.status, reason.statusText] : [500, ""];
|
|
2061
2161
|
let retryRedirect;
|
|
2062
2162
|
let reactHeaders = new Headers();
|
|
2063
2163
|
const html = await renderHTML(
|
|
@@ -2094,11 +2194,11 @@ async function routeRSCServerRequest({
|
|
|
2094
2194
|
{
|
|
2095
2195
|
onError(error) {
|
|
2096
2196
|
if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
|
|
2097
|
-
retryRedirect =
|
|
2197
|
+
retryRedirect = _chunkZR2NIBH2js.decodeRedirectErrorDigest.call(void 0, error.digest);
|
|
2098
2198
|
if (retryRedirect) {
|
|
2099
2199
|
return error.digest;
|
|
2100
2200
|
}
|
|
2101
|
-
let routeErrorResponse =
|
|
2201
|
+
let routeErrorResponse = _chunkZR2NIBH2js.decodeRouteErrorResponseDigest.call(void 0,
|
|
2102
2202
|
error.digest
|
|
2103
2203
|
);
|
|
2104
2204
|
if (routeErrorResponse) {
|
|
@@ -2132,7 +2232,7 @@ async function routeRSCServerRequest({
|
|
|
2132
2232
|
if (retryRedirect) {
|
|
2133
2233
|
controller.enqueue(
|
|
2134
2234
|
new TextEncoder().encode(
|
|
2135
|
-
`<meta http-equiv="refresh" content="0;url=${
|
|
2235
|
+
`<meta http-equiv="refresh" content="0;url=${_chunkZR2NIBH2js.escapeHtml.call(void 0, retryRedirect.location)}"/>`
|
|
2136
2236
|
)
|
|
2137
2237
|
);
|
|
2138
2238
|
}
|
|
@@ -2145,7 +2245,7 @@ async function routeRSCServerRequest({
|
|
|
2145
2245
|
headers
|
|
2146
2246
|
});
|
|
2147
2247
|
}
|
|
2148
|
-
if (!_optionalChain([serverResponseB, 'optionalAccess',
|
|
2248
|
+
if (!_optionalChain([serverResponseB, 'optionalAccess', _29 => _29.body])) {
|
|
2149
2249
|
throw new Error("Failed to clone server response");
|
|
2150
2250
|
}
|
|
2151
2251
|
const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body)).pipeThrough(retryRedirectTransform);
|
|
@@ -2173,7 +2273,7 @@ function RSCStaticRouter({ getPayload }) {
|
|
|
2173
2273
|
if (payload.type !== "render") return null;
|
|
2174
2274
|
let patchedLoaderData = { ...payload.loaderData };
|
|
2175
2275
|
for (const match of payload.matches) {
|
|
2176
|
-
if (
|
|
2276
|
+
if (_chunkZR2NIBH2js.shouldHydrateRouteLoader.call(void 0,
|
|
2177
2277
|
match.id,
|
|
2178
2278
|
match.clientLoader,
|
|
2179
2279
|
match.hasLoader,
|
|
@@ -2213,7 +2313,7 @@ function RSCStaticRouter({ getPayload }) {
|
|
|
2213
2313
|
}
|
|
2214
2314
|
}))
|
|
2215
2315
|
};
|
|
2216
|
-
const router =
|
|
2316
|
+
const router = _chunkQWJQISZKjs.createStaticRouter.call(void 0,
|
|
2217
2317
|
payload.matches.reduceRight((previous, match) => {
|
|
2218
2318
|
const route = {
|
|
2219
2319
|
id: match.id,
|
|
@@ -2240,7 +2340,9 @@ function RSCStaticRouter({ getPayload }) {
|
|
|
2240
2340
|
// These flags have no runtime impact so can always be false. If we add
|
|
2241
2341
|
// flags that drive runtime behavior they'll need to be proxied through.
|
|
2242
2342
|
v8_middleware: false,
|
|
2243
|
-
unstable_subResourceIntegrity: false
|
|
2343
|
+
unstable_subResourceIntegrity: false,
|
|
2344
|
+
unstable_trailingSlashAwareDataRequests: true
|
|
2345
|
+
// always on for RSC
|
|
2244
2346
|
},
|
|
2245
2347
|
isSpaMode: false,
|
|
2246
2348
|
ssr: true,
|
|
@@ -2255,10 +2357,10 @@ function RSCStaticRouter({ getPayload }) {
|
|
|
2255
2357
|
}
|
|
2256
2358
|
},
|
|
2257
2359
|
routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" },
|
|
2258
|
-
routeModules:
|
|
2360
|
+
routeModules: _chunkO6YLM5NBjs.createRSCRouteModules.call(void 0, payload)
|
|
2259
2361
|
};
|
|
2260
|
-
return /* @__PURE__ */ React3.createElement(
|
|
2261
|
-
|
|
2362
|
+
return /* @__PURE__ */ React3.createElement(_chunkZR2NIBH2js.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkO6YLM5NBjs.RSCRouterGlobalErrorBoundary, { location: payload.location }, /* @__PURE__ */ React3.createElement(_chunkZR2NIBH2js.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
|
|
2363
|
+
_chunkQWJQISZKjs.StaticRouterProvider,
|
|
2262
2364
|
{
|
|
2263
2365
|
context,
|
|
2264
2366
|
router,
|
|
@@ -2281,7 +2383,7 @@ function deserializeErrors(errors) {
|
|
|
2281
2383
|
let serialized = {};
|
|
2282
2384
|
for (let [key, val] of entries) {
|
|
2283
2385
|
if (val && val.__type === "RouteErrorResponse") {
|
|
2284
|
-
serialized[key] = new (0,
|
|
2386
|
+
serialized[key] = new (0, _chunkZR2NIBH2js.ErrorResponseImpl)(
|
|
2285
2387
|
val.status,
|
|
2286
2388
|
val.statusText,
|
|
2287
2389
|
val.data,
|
|
@@ -2438,4 +2540,6 @@ function deserializeErrors(errors) {
|
|
|
2438
2540
|
|
|
2439
2541
|
|
|
2440
2542
|
|
|
2441
|
-
|
|
2543
|
+
|
|
2544
|
+
|
|
2545
|
+
exports.Await = _chunkZR2NIBH2js.Await; exports.BrowserRouter = _chunkQWJQISZKjs.BrowserRouter; exports.Form = _chunkQWJQISZKjs.Form; exports.HashRouter = _chunkQWJQISZKjs.HashRouter; exports.IDLE_BLOCKER = _chunkZR2NIBH2js.IDLE_BLOCKER; exports.IDLE_FETCHER = _chunkZR2NIBH2js.IDLE_FETCHER; exports.IDLE_NAVIGATION = _chunkZR2NIBH2js.IDLE_NAVIGATION; exports.Link = _chunkQWJQISZKjs.Link; exports.Links = _chunkZR2NIBH2js.Links; exports.MemoryRouter = _chunkZR2NIBH2js.MemoryRouter; exports.Meta = _chunkZR2NIBH2js.Meta; exports.NavLink = _chunkQWJQISZKjs.NavLink; exports.Navigate = _chunkZR2NIBH2js.Navigate; exports.NavigationType = _chunkZR2NIBH2js.Action; exports.Outlet = _chunkZR2NIBH2js.Outlet; exports.PrefetchPageLinks = _chunkZR2NIBH2js.PrefetchPageLinks; exports.Route = _chunkZR2NIBH2js.Route; exports.Router = _chunkZR2NIBH2js.Router; exports.RouterContextProvider = _chunkZR2NIBH2js.RouterContextProvider; exports.RouterProvider = _chunkZR2NIBH2js.RouterProvider; exports.Routes = _chunkZR2NIBH2js.Routes; exports.Scripts = _chunkZR2NIBH2js.Scripts; exports.ScrollRestoration = _chunkQWJQISZKjs.ScrollRestoration; exports.ServerRouter = ServerRouter; exports.StaticRouter = _chunkQWJQISZKjs.StaticRouter; exports.StaticRouterProvider = _chunkQWJQISZKjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkZR2NIBH2js.AwaitContextProvider; exports.UNSAFE_DataRouterContext = _chunkZR2NIBH2js.DataRouterContext; exports.UNSAFE_DataRouterStateContext = _chunkZR2NIBH2js.DataRouterStateContext; exports.UNSAFE_ErrorResponseImpl = _chunkZR2NIBH2js.ErrorResponseImpl; exports.UNSAFE_FetchersContext = _chunkZR2NIBH2js.FetchersContext; exports.UNSAFE_FrameworkContext = _chunkZR2NIBH2js.FrameworkContext; exports.UNSAFE_LocationContext = _chunkZR2NIBH2js.LocationContext; exports.UNSAFE_NavigationContext = _chunkZR2NIBH2js.NavigationContext; exports.UNSAFE_RSCDefaultRootErrorBoundary = _chunkO6YLM5NBjs.RSCDefaultRootErrorBoundary; exports.UNSAFE_RemixErrorBoundary = _chunkZR2NIBH2js.RemixErrorBoundary; exports.UNSAFE_RouteContext = _chunkZR2NIBH2js.RouteContext; exports.UNSAFE_ServerMode = ServerMode; exports.UNSAFE_SingleFetchRedirectSymbol = _chunkZR2NIBH2js.SingleFetchRedirectSymbol; exports.UNSAFE_ViewTransitionContext = _chunkZR2NIBH2js.ViewTransitionContext; exports.UNSAFE_WithComponentProps = _chunkZR2NIBH2js.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkZR2NIBH2js.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkZR2NIBH2js.WithHydrateFallbackProps; exports.UNSAFE_createBrowserHistory = _chunkZR2NIBH2js.createBrowserHistory; exports.UNSAFE_createClientRoutes = _chunkZR2NIBH2js.createClientRoutes; exports.UNSAFE_createClientRoutesWithHMRRevalidationOptOut = _chunkZR2NIBH2js.createClientRoutesWithHMRRevalidationOptOut; exports.UNSAFE_createHashHistory = _chunkZR2NIBH2js.createHashHistory; exports.UNSAFE_createMemoryHistory = _chunkZR2NIBH2js.createMemoryHistory; exports.UNSAFE_createRouter = _chunkZR2NIBH2js.createRouter; exports.UNSAFE_decodeViaTurboStream = _chunkZR2NIBH2js.decodeViaTurboStream; exports.UNSAFE_deserializeErrors = deserializeErrors; exports.UNSAFE_getHydrationData = _chunkO6YLM5NBjs.getHydrationData; exports.UNSAFE_getPatchRoutesOnNavigationFunction = _chunkZR2NIBH2js.getPatchRoutesOnNavigationFunction; exports.UNSAFE_getTurboStreamSingleFetchDataStrategy = _chunkZR2NIBH2js.getTurboStreamSingleFetchDataStrategy; exports.UNSAFE_hydrationRouteProperties = _chunkZR2NIBH2js.hydrationRouteProperties; exports.UNSAFE_invariant = _chunkZR2NIBH2js.invariant; exports.UNSAFE_mapRouteProperties = _chunkZR2NIBH2js.mapRouteProperties; exports.UNSAFE_shouldHydrateRouteLoader = _chunkZR2NIBH2js.shouldHydrateRouteLoader; exports.UNSAFE_useFogOFWarDiscovery = _chunkZR2NIBH2js.useFogOFWarDiscovery; exports.UNSAFE_useScrollRestoration = _chunkQWJQISZKjs.useScrollRestoration; exports.UNSAFE_withComponentProps = _chunkZR2NIBH2js.withComponentProps; exports.UNSAFE_withErrorBoundaryProps = _chunkZR2NIBH2js.withErrorBoundaryProps; exports.UNSAFE_withHydrateFallbackProps = _chunkZR2NIBH2js.withHydrateFallbackProps; exports.createBrowserRouter = _chunkQWJQISZKjs.createBrowserRouter; exports.createContext = _chunkZR2NIBH2js.createContext; exports.createCookie = createCookie; exports.createCookieSessionStorage = createCookieSessionStorage; exports.createHashRouter = _chunkQWJQISZKjs.createHashRouter; exports.createMemoryRouter = _chunkZR2NIBH2js.createMemoryRouter; exports.createMemorySessionStorage = createMemorySessionStorage; exports.createPath = _chunkZR2NIBH2js.createPath; exports.createRequestHandler = createRequestHandler; exports.createRoutesFromChildren = _chunkZR2NIBH2js.createRoutesFromChildren; exports.createRoutesFromElements = _chunkZR2NIBH2js.createRoutesFromElements; exports.createRoutesStub = createRoutesStub; exports.createSearchParams = _chunkQWJQISZKjs.createSearchParams; exports.createSession = createSession; exports.createSessionStorage = createSessionStorage; exports.createStaticHandler = _chunkQWJQISZKjs.createStaticHandler; exports.createStaticRouter = _chunkQWJQISZKjs.createStaticRouter; exports.data = _chunkZR2NIBH2js.data; exports.generatePath = _chunkZR2NIBH2js.generatePath; exports.href = href; exports.isCookie = isCookie; exports.isRouteErrorResponse = _chunkZR2NIBH2js.isRouteErrorResponse; exports.isSession = isSession; exports.matchPath = _chunkZR2NIBH2js.matchPath; exports.matchRoutes = _chunkZR2NIBH2js.matchRoutes; exports.parsePath = _chunkZR2NIBH2js.parsePath; exports.redirect = _chunkZR2NIBH2js.redirect; exports.redirectDocument = _chunkZR2NIBH2js.redirectDocument; exports.renderMatches = _chunkZR2NIBH2js.renderMatches; exports.replace = _chunkZR2NIBH2js.replace; exports.resolvePath = _chunkZR2NIBH2js.resolvePath; exports.unstable_HistoryRouter = _chunkQWJQISZKjs.HistoryRouter; exports.unstable_RSCStaticRouter = RSCStaticRouter; exports.unstable_routeRSCServerRequest = routeRSCServerRequest; exports.unstable_setDevServerHooks = setDevServerHooks; exports.unstable_usePrompt = _chunkQWJQISZKjs.usePrompt; exports.unstable_useRoute = _chunkZR2NIBH2js.useRoute; exports.useActionData = _chunkZR2NIBH2js.useActionData; exports.useAsyncError = _chunkZR2NIBH2js.useAsyncError; exports.useAsyncValue = _chunkZR2NIBH2js.useAsyncValue; exports.useBeforeUnload = _chunkQWJQISZKjs.useBeforeUnload; exports.useBlocker = _chunkZR2NIBH2js.useBlocker; exports.useFetcher = _chunkQWJQISZKjs.useFetcher; exports.useFetchers = _chunkQWJQISZKjs.useFetchers; exports.useFormAction = _chunkQWJQISZKjs.useFormAction; exports.useHref = _chunkZR2NIBH2js.useHref; exports.useInRouterContext = _chunkZR2NIBH2js.useInRouterContext; exports.useLinkClickHandler = _chunkQWJQISZKjs.useLinkClickHandler; exports.useLoaderData = _chunkZR2NIBH2js.useLoaderData; exports.useLocation = _chunkZR2NIBH2js.useLocation; exports.useMatch = _chunkZR2NIBH2js.useMatch; exports.useMatches = _chunkZR2NIBH2js.useMatches; exports.useNavigate = _chunkZR2NIBH2js.useNavigate; exports.useNavigation = _chunkZR2NIBH2js.useNavigation; exports.useNavigationType = _chunkZR2NIBH2js.useNavigationType; exports.useOutlet = _chunkZR2NIBH2js.useOutlet; exports.useOutletContext = _chunkZR2NIBH2js.useOutletContext; exports.useParams = _chunkZR2NIBH2js.useParams; exports.useResolvedPath = _chunkZR2NIBH2js.useResolvedPath; exports.useRevalidator = _chunkZR2NIBH2js.useRevalidator; exports.useRouteError = _chunkZR2NIBH2js.useRouteError; exports.useRouteLoaderData = _chunkZR2NIBH2js.useRouteLoaderData; exports.useRoutes = _chunkZR2NIBH2js.useRoutes; exports.useSearchParams = _chunkQWJQISZKjs.useSearchParams; exports.useSubmit = _chunkQWJQISZKjs.useSubmit; exports.useViewTransitionState = _chunkQWJQISZKjs.useViewTransitionState;
|