@mcp-use/inspector 0.9.0-canary.4 → 0.9.0-canary.6
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/dist/client/assets/__vite-browser-external-DFygW7-s.js +1 -0
- package/dist/client/assets/browser-C7T69h9H.js +408 -0
- package/dist/client/assets/display-A5IEINAP-PpmJDTVa.js +17 -0
- package/dist/client/assets/embeddings-DHqEojuq.js +1 -0
- package/dist/client/assets/index-BisjKad9.js +7 -0
- package/dist/client/assets/index-C1CCILMM.js +33 -0
- package/dist/client/assets/index-CHNXgq6o.css +1 -0
- package/dist/client/assets/index-CI3g_RcQ.js +8 -0
- package/dist/client/assets/index-Cx63umjv.js +152 -0
- package/dist/client/assets/index-DGYydIoI.js +2 -0
- package/dist/client/assets/index-DRz5BQNA.js +1 -0
- package/dist/client/assets/index-DoALAYox.js +25 -0
- package/dist/client/assets/index-IFdSquJo.js +1626 -0
- package/dist/client/assets/index-JiKw9JSs.js +5 -0
- package/dist/client/assets/index-OksJgzlF.js +20 -0
- package/dist/client/assets/path-C9FudP8b.js +1 -0
- package/dist/client/assets/transport-wrapper-browser-BI4dDu3b.js +1 -0
- package/dist/client/assets/util-t-trnxQI.js +1 -0
- package/dist/client/assets/winston-DCacaJQs.js +37 -0
- package/dist/client/index.html +3 -3
- package/package.json +5 -4
- package/dist/client/assets/__vite-browser-external-CHS79mP1.js +0 -8
- package/dist/client/assets/browser-CwknRi82.js +0 -17967
- package/dist/client/assets/display-A5IEINAP-DNDlZQ8k.js +0 -480
- package/dist/client/assets/embeddings-DSM58WFd.js +0 -26
- package/dist/client/assets/index-BMuvzxLw.js +0 -400
- package/dist/client/assets/index-BWKKRrN4.js +0 -43965
- package/dist/client/assets/index-Br7cLVs6.css +0 -5812
- package/dist/client/assets/index-BumNh2YP.js +0 -725
- package/dist/client/assets/index-D-pAR_RA.js +0 -26733
- package/dist/client/assets/index-DD0wWmuA.js +0 -9991
- package/dist/client/assets/index-DEA0KU_h.js +0 -105533
- package/dist/client/assets/index-DX0TIfSM.js +0 -102
- package/dist/client/assets/index-DctLeaKS.js +0 -2817
- package/dist/client/assets/index-DgPlosep.js +0 -1812
- package/dist/client/assets/index-DiEpOjl1.js +0 -5370
- package/dist/client/assets/path-QsnVvLoj.js +0 -62
- package/dist/client/assets/transport-wrapper-browser-ChPHVnHg.js +0 -165
- package/dist/client/assets/util-D59LNlyU.js +0 -23
- package/dist/client/assets/winston-B_texDHP.js +0 -12307
|
@@ -1,2817 +0,0 @@
|
|
|
1
|
-
import { c as createServerRoutes, s as shouldHydrateRouteLoader, b as createStaticRouter, r as reactExports, F as FrameworkContext, R as RemixErrorBoundary, S as StaticRouterProvider, d as StreamTransfer, u as useRouteError, e as re, E as ErrorResponseImpl, m as matchRoutes, f as RouterContextProvider, g as convertRoutesToDataRoutes, h as createMemoryRouter, i as RouterProvider, j as RSCRouterContext, k as SINGLE_FETCH_REDIRECT_STATUS, l as isRouteErrorResponse, w as warnOnce, n as createStaticHandler, o as instrumentHandler, q as withErrorBoundaryProps, t as withHydrateFallbackProps, v as withComponentProps, O as Outlet, x as React, y as decodeViaTurboStream, z as SingleFetchRedirectSymbol, A as redirectDocument, B as replace, C as redirect, D as stripBasename, G as getManifestPath, H as isRedirectResponse, I as isDataWithResponseInit, J as isRedirectStatusCode, K as isResponse, L as getStaticContextFromError, N as NO_BODY_STATUS_CODES, M as encode, P as escapeHtml, Q as invariant$1, T as useFogOFWarDiscovery, U as reactDomExports, V as createClientRoutes, W as createRouter, X as getPatchRoutesOnNavigationFunction, Y as getTurboStreamSingleFetchDataStrategy, Z as mapRouteProperties, $ as hydrationRouteProperties, a0 as createBrowserHistory, a1 as createClientRoutesWithHMRRevalidationOptOut } from "./index-DEA0KU_h.js";
|
|
2
|
-
import { a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, as, at, au, av, aw, ax, ay, az, aA, aB, aC, aD, aE, aF, aG, aH, aI, aJ, aK, aL, aM, aN, aO, aP, aQ, aR, aS, aT, aU, aV, aW, aX, aY, aZ, a_, a$, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bf } from "./index-DEA0KU_h.js";
|
|
3
|
-
var dist = {};
|
|
4
|
-
var hasRequiredDist;
|
|
5
|
-
function requireDist() {
|
|
6
|
-
if (hasRequiredDist) return dist;
|
|
7
|
-
hasRequiredDist = 1;
|
|
8
|
-
Object.defineProperty(dist, "__esModule", { value: true });
|
|
9
|
-
dist.parse = parse;
|
|
10
|
-
dist.serialize = serialize;
|
|
11
|
-
const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
|
|
12
|
-
const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
|
|
13
|
-
const domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
|
|
14
|
-
const pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
15
|
-
const __toString = Object.prototype.toString;
|
|
16
|
-
const NullObject = /* @__PURE__ */ (() => {
|
|
17
|
-
const C = function() {
|
|
18
|
-
};
|
|
19
|
-
C.prototype = /* @__PURE__ */ Object.create(null);
|
|
20
|
-
return C;
|
|
21
|
-
})();
|
|
22
|
-
function parse(str, options) {
|
|
23
|
-
const obj = new NullObject();
|
|
24
|
-
const len = str.length;
|
|
25
|
-
if (len < 2)
|
|
26
|
-
return obj;
|
|
27
|
-
const dec = options?.decode || decode;
|
|
28
|
-
let index = 0;
|
|
29
|
-
do {
|
|
30
|
-
const eqIdx = str.indexOf("=", index);
|
|
31
|
-
if (eqIdx === -1)
|
|
32
|
-
break;
|
|
33
|
-
const colonIdx = str.indexOf(";", index);
|
|
34
|
-
const endIdx = colonIdx === -1 ? len : colonIdx;
|
|
35
|
-
if (eqIdx > endIdx) {
|
|
36
|
-
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
const keyStartIdx = startIndex(str, index, eqIdx);
|
|
40
|
-
const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
|
|
41
|
-
const key = str.slice(keyStartIdx, keyEndIdx);
|
|
42
|
-
if (obj[key] === void 0) {
|
|
43
|
-
let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
|
|
44
|
-
let valEndIdx = endIndex(str, endIdx, valStartIdx);
|
|
45
|
-
const value = dec(str.slice(valStartIdx, valEndIdx));
|
|
46
|
-
obj[key] = value;
|
|
47
|
-
}
|
|
48
|
-
index = endIdx + 1;
|
|
49
|
-
} while (index < len);
|
|
50
|
-
return obj;
|
|
51
|
-
}
|
|
52
|
-
function startIndex(str, index, max) {
|
|
53
|
-
do {
|
|
54
|
-
const code = str.charCodeAt(index);
|
|
55
|
-
if (code !== 32 && code !== 9)
|
|
56
|
-
return index;
|
|
57
|
-
} while (++index < max);
|
|
58
|
-
return max;
|
|
59
|
-
}
|
|
60
|
-
function endIndex(str, index, min) {
|
|
61
|
-
while (index > min) {
|
|
62
|
-
const code = str.charCodeAt(--index);
|
|
63
|
-
if (code !== 32 && code !== 9)
|
|
64
|
-
return index + 1;
|
|
65
|
-
}
|
|
66
|
-
return min;
|
|
67
|
-
}
|
|
68
|
-
function serialize(name, val, options) {
|
|
69
|
-
const enc = options?.encode || encodeURIComponent;
|
|
70
|
-
if (!cookieNameRegExp.test(name)) {
|
|
71
|
-
throw new TypeError(`argument name is invalid: ${name}`);
|
|
72
|
-
}
|
|
73
|
-
const value = enc(val);
|
|
74
|
-
if (!cookieValueRegExp.test(value)) {
|
|
75
|
-
throw new TypeError(`argument val is invalid: ${val}`);
|
|
76
|
-
}
|
|
77
|
-
let str = name + "=" + value;
|
|
78
|
-
if (!options)
|
|
79
|
-
return str;
|
|
80
|
-
if (options.maxAge !== void 0) {
|
|
81
|
-
if (!Number.isInteger(options.maxAge)) {
|
|
82
|
-
throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
|
|
83
|
-
}
|
|
84
|
-
str += "; Max-Age=" + options.maxAge;
|
|
85
|
-
}
|
|
86
|
-
if (options.domain) {
|
|
87
|
-
if (!domainValueRegExp.test(options.domain)) {
|
|
88
|
-
throw new TypeError(`option domain is invalid: ${options.domain}`);
|
|
89
|
-
}
|
|
90
|
-
str += "; Domain=" + options.domain;
|
|
91
|
-
}
|
|
92
|
-
if (options.path) {
|
|
93
|
-
if (!pathValueRegExp.test(options.path)) {
|
|
94
|
-
throw new TypeError(`option path is invalid: ${options.path}`);
|
|
95
|
-
}
|
|
96
|
-
str += "; Path=" + options.path;
|
|
97
|
-
}
|
|
98
|
-
if (options.expires) {
|
|
99
|
-
if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) {
|
|
100
|
-
throw new TypeError(`option expires is invalid: ${options.expires}`);
|
|
101
|
-
}
|
|
102
|
-
str += "; Expires=" + options.expires.toUTCString();
|
|
103
|
-
}
|
|
104
|
-
if (options.httpOnly) {
|
|
105
|
-
str += "; HttpOnly";
|
|
106
|
-
}
|
|
107
|
-
if (options.secure) {
|
|
108
|
-
str += "; Secure";
|
|
109
|
-
}
|
|
110
|
-
if (options.partitioned) {
|
|
111
|
-
str += "; Partitioned";
|
|
112
|
-
}
|
|
113
|
-
if (options.priority) {
|
|
114
|
-
const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : void 0;
|
|
115
|
-
switch (priority) {
|
|
116
|
-
case "low":
|
|
117
|
-
str += "; Priority=Low";
|
|
118
|
-
break;
|
|
119
|
-
case "medium":
|
|
120
|
-
str += "; Priority=Medium";
|
|
121
|
-
break;
|
|
122
|
-
case "high":
|
|
123
|
-
str += "; Priority=High";
|
|
124
|
-
break;
|
|
125
|
-
default:
|
|
126
|
-
throw new TypeError(`option priority is invalid: ${options.priority}`);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
if (options.sameSite) {
|
|
130
|
-
const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite;
|
|
131
|
-
switch (sameSite) {
|
|
132
|
-
case true:
|
|
133
|
-
case "strict":
|
|
134
|
-
str += "; SameSite=Strict";
|
|
135
|
-
break;
|
|
136
|
-
case "lax":
|
|
137
|
-
str += "; SameSite=Lax";
|
|
138
|
-
break;
|
|
139
|
-
case "none":
|
|
140
|
-
str += "; SameSite=None";
|
|
141
|
-
break;
|
|
142
|
-
default:
|
|
143
|
-
throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return str;
|
|
147
|
-
}
|
|
148
|
-
function decode(str) {
|
|
149
|
-
if (str.indexOf("%") === -1)
|
|
150
|
-
return str;
|
|
151
|
-
try {
|
|
152
|
-
return decodeURIComponent(str);
|
|
153
|
-
} catch (e) {
|
|
154
|
-
return str;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function isDate(val) {
|
|
158
|
-
return __toString.call(val) === "[object Date]";
|
|
159
|
-
}
|
|
160
|
-
return dist;
|
|
161
|
-
}
|
|
162
|
-
var distExports = requireDist();
|
|
163
|
-
var setCookie = { exports: {} };
|
|
164
|
-
var hasRequiredSetCookie;
|
|
165
|
-
function requireSetCookie() {
|
|
166
|
-
if (hasRequiredSetCookie) return setCookie.exports;
|
|
167
|
-
hasRequiredSetCookie = 1;
|
|
168
|
-
var defaultParseOptions = {
|
|
169
|
-
decodeValues: true,
|
|
170
|
-
map: false,
|
|
171
|
-
silent: false
|
|
172
|
-
};
|
|
173
|
-
function isForbiddenKey(key) {
|
|
174
|
-
return typeof key !== "string" || key in {};
|
|
175
|
-
}
|
|
176
|
-
function createNullObj() {
|
|
177
|
-
return /* @__PURE__ */ Object.create(null);
|
|
178
|
-
}
|
|
179
|
-
function isNonEmptyString(str) {
|
|
180
|
-
return typeof str === "string" && !!str.trim();
|
|
181
|
-
}
|
|
182
|
-
function parseString(setCookieValue, options) {
|
|
183
|
-
var parts = setCookieValue.split(";").filter(isNonEmptyString);
|
|
184
|
-
var nameValuePairStr = parts.shift();
|
|
185
|
-
var parsed = parseNameValuePair(nameValuePairStr);
|
|
186
|
-
var name = parsed.name;
|
|
187
|
-
var value = parsed.value;
|
|
188
|
-
options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
|
|
189
|
-
if (isForbiddenKey(name)) {
|
|
190
|
-
return null;
|
|
191
|
-
}
|
|
192
|
-
try {
|
|
193
|
-
value = options.decodeValues ? decodeURIComponent(value) : value;
|
|
194
|
-
} catch (e) {
|
|
195
|
-
console.error(
|
|
196
|
-
"set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",
|
|
197
|
-
e
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
var cookie = createNullObj();
|
|
201
|
-
cookie.name = name;
|
|
202
|
-
cookie.value = value;
|
|
203
|
-
parts.forEach(function(part) {
|
|
204
|
-
var sides = part.split("=");
|
|
205
|
-
var key = sides.shift().trimLeft().toLowerCase();
|
|
206
|
-
if (isForbiddenKey(key)) {
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
var value2 = sides.join("=");
|
|
210
|
-
if (key === "expires") {
|
|
211
|
-
cookie.expires = new Date(value2);
|
|
212
|
-
} else if (key === "max-age") {
|
|
213
|
-
var n = parseInt(value2, 10);
|
|
214
|
-
if (!Number.isNaN(n)) cookie.maxAge = n;
|
|
215
|
-
} else if (key === "secure") {
|
|
216
|
-
cookie.secure = true;
|
|
217
|
-
} else if (key === "httponly") {
|
|
218
|
-
cookie.httpOnly = true;
|
|
219
|
-
} else if (key === "samesite") {
|
|
220
|
-
cookie.sameSite = value2;
|
|
221
|
-
} else if (key === "partitioned") {
|
|
222
|
-
cookie.partitioned = true;
|
|
223
|
-
} else if (key) {
|
|
224
|
-
cookie[key] = value2;
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
return cookie;
|
|
228
|
-
}
|
|
229
|
-
function parseNameValuePair(nameValuePairStr) {
|
|
230
|
-
var name = "";
|
|
231
|
-
var value = "";
|
|
232
|
-
var nameValueArr = nameValuePairStr.split("=");
|
|
233
|
-
if (nameValueArr.length > 1) {
|
|
234
|
-
name = nameValueArr.shift();
|
|
235
|
-
value = nameValueArr.join("=");
|
|
236
|
-
} else {
|
|
237
|
-
value = nameValuePairStr;
|
|
238
|
-
}
|
|
239
|
-
return { name, value };
|
|
240
|
-
}
|
|
241
|
-
function parse(input, options) {
|
|
242
|
-
options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
|
|
243
|
-
if (!input) {
|
|
244
|
-
if (!options.map) {
|
|
245
|
-
return [];
|
|
246
|
-
} else {
|
|
247
|
-
return createNullObj();
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
if (input.headers) {
|
|
251
|
-
if (typeof input.headers.getSetCookie === "function") {
|
|
252
|
-
input = input.headers.getSetCookie();
|
|
253
|
-
} else if (input.headers["set-cookie"]) {
|
|
254
|
-
input = input.headers["set-cookie"];
|
|
255
|
-
} else {
|
|
256
|
-
var sch = input.headers[Object.keys(input.headers).find(function(key) {
|
|
257
|
-
return key.toLowerCase() === "set-cookie";
|
|
258
|
-
})];
|
|
259
|
-
if (!sch && input.headers.cookie && !options.silent) {
|
|
260
|
-
console.warn(
|
|
261
|
-
"Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
|
|
262
|
-
);
|
|
263
|
-
}
|
|
264
|
-
input = sch;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
if (!Array.isArray(input)) {
|
|
268
|
-
input = [input];
|
|
269
|
-
}
|
|
270
|
-
if (!options.map) {
|
|
271
|
-
return input.filter(isNonEmptyString).map(function(str) {
|
|
272
|
-
return parseString(str, options);
|
|
273
|
-
}).filter(Boolean);
|
|
274
|
-
} else {
|
|
275
|
-
var cookies = createNullObj();
|
|
276
|
-
return input.filter(isNonEmptyString).reduce(function(cookies2, str) {
|
|
277
|
-
var cookie = parseString(str, options);
|
|
278
|
-
if (cookie && !isForbiddenKey(cookie.name)) {
|
|
279
|
-
cookies2[cookie.name] = cookie;
|
|
280
|
-
}
|
|
281
|
-
return cookies2;
|
|
282
|
-
}, cookies);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
function splitCookiesString(cookiesString) {
|
|
286
|
-
if (Array.isArray(cookiesString)) {
|
|
287
|
-
return cookiesString;
|
|
288
|
-
}
|
|
289
|
-
if (typeof cookiesString !== "string") {
|
|
290
|
-
return [];
|
|
291
|
-
}
|
|
292
|
-
var cookiesStrings = [];
|
|
293
|
-
var pos = 0;
|
|
294
|
-
var start;
|
|
295
|
-
var ch;
|
|
296
|
-
var lastComma;
|
|
297
|
-
var nextStart;
|
|
298
|
-
var cookiesSeparatorFound;
|
|
299
|
-
function skipWhitespace() {
|
|
300
|
-
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
|
|
301
|
-
pos += 1;
|
|
302
|
-
}
|
|
303
|
-
return pos < cookiesString.length;
|
|
304
|
-
}
|
|
305
|
-
function notSpecialChar() {
|
|
306
|
-
ch = cookiesString.charAt(pos);
|
|
307
|
-
return ch !== "=" && ch !== ";" && ch !== ",";
|
|
308
|
-
}
|
|
309
|
-
while (pos < cookiesString.length) {
|
|
310
|
-
start = pos;
|
|
311
|
-
cookiesSeparatorFound = false;
|
|
312
|
-
while (skipWhitespace()) {
|
|
313
|
-
ch = cookiesString.charAt(pos);
|
|
314
|
-
if (ch === ",") {
|
|
315
|
-
lastComma = pos;
|
|
316
|
-
pos += 1;
|
|
317
|
-
skipWhitespace();
|
|
318
|
-
nextStart = pos;
|
|
319
|
-
while (pos < cookiesString.length && notSpecialChar()) {
|
|
320
|
-
pos += 1;
|
|
321
|
-
}
|
|
322
|
-
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
|
|
323
|
-
cookiesSeparatorFound = true;
|
|
324
|
-
pos = nextStart;
|
|
325
|
-
cookiesStrings.push(cookiesString.substring(start, lastComma));
|
|
326
|
-
start = pos;
|
|
327
|
-
} else {
|
|
328
|
-
pos = lastComma + 1;
|
|
329
|
-
}
|
|
330
|
-
} else {
|
|
331
|
-
pos += 1;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
if (!cookiesSeparatorFound || pos >= cookiesString.length) {
|
|
335
|
-
cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
return cookiesStrings;
|
|
339
|
-
}
|
|
340
|
-
setCookie.exports = parse;
|
|
341
|
-
setCookie.exports.parse = parse;
|
|
342
|
-
setCookie.exports.parseString = parseString;
|
|
343
|
-
setCookie.exports.splitCookiesString = splitCookiesString;
|
|
344
|
-
return setCookie.exports;
|
|
345
|
-
}
|
|
346
|
-
var setCookieExports = /* @__PURE__ */ requireSetCookie();
|
|
347
|
-
var define_process_env_default = {};
|
|
348
|
-
function ServerRouter({
|
|
349
|
-
context,
|
|
350
|
-
url,
|
|
351
|
-
nonce
|
|
352
|
-
}) {
|
|
353
|
-
if (typeof url === "string") {
|
|
354
|
-
url = new URL(url);
|
|
355
|
-
}
|
|
356
|
-
let { manifest, routeModules, criticalCss, serverHandoffString } = context;
|
|
357
|
-
let routes = createServerRoutes(
|
|
358
|
-
manifest.routes,
|
|
359
|
-
routeModules,
|
|
360
|
-
context.future,
|
|
361
|
-
context.isSpaMode
|
|
362
|
-
);
|
|
363
|
-
context.staticHandlerContext.loaderData = {
|
|
364
|
-
...context.staticHandlerContext.loaderData
|
|
365
|
-
};
|
|
366
|
-
for (let match of context.staticHandlerContext.matches) {
|
|
367
|
-
let routeId = match.route.id;
|
|
368
|
-
let route = routeModules[routeId];
|
|
369
|
-
let manifestRoute = context.manifest.routes[routeId];
|
|
370
|
-
if (route && manifestRoute && shouldHydrateRouteLoader(
|
|
371
|
-
routeId,
|
|
372
|
-
route.clientLoader,
|
|
373
|
-
manifestRoute.hasLoader,
|
|
374
|
-
context.isSpaMode
|
|
375
|
-
) && (route.HydrateFallback || !manifestRoute.hasLoader)) {
|
|
376
|
-
delete context.staticHandlerContext.loaderData[routeId];
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
let router2 = createStaticRouter(routes, context.staticHandlerContext);
|
|
380
|
-
return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement(
|
|
381
|
-
FrameworkContext.Provider,
|
|
382
|
-
{
|
|
383
|
-
value: {
|
|
384
|
-
manifest,
|
|
385
|
-
routeModules,
|
|
386
|
-
criticalCss,
|
|
387
|
-
serverHandoffString,
|
|
388
|
-
future: context.future,
|
|
389
|
-
ssr: context.ssr,
|
|
390
|
-
isSpaMode: context.isSpaMode,
|
|
391
|
-
routeDiscovery: context.routeDiscovery,
|
|
392
|
-
serializeError: context.serializeError,
|
|
393
|
-
renderMeta: context.renderMeta
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
/* @__PURE__ */ reactExports.createElement(RemixErrorBoundary, { location: router2.state.location }, /* @__PURE__ */ reactExports.createElement(
|
|
397
|
-
StaticRouterProvider,
|
|
398
|
-
{
|
|
399
|
-
router: router2,
|
|
400
|
-
context: context.staticHandlerContext,
|
|
401
|
-
hydrate: false
|
|
402
|
-
}
|
|
403
|
-
))
|
|
404
|
-
), context.serverHandoffStream ? /* @__PURE__ */ reactExports.createElement(reactExports.Suspense, null, /* @__PURE__ */ reactExports.createElement(
|
|
405
|
-
StreamTransfer,
|
|
406
|
-
{
|
|
407
|
-
context,
|
|
408
|
-
identifier: 0,
|
|
409
|
-
reader: context.serverHandoffStream.getReader(),
|
|
410
|
-
textDecoder: new TextDecoder(),
|
|
411
|
-
nonce
|
|
412
|
-
}
|
|
413
|
-
)) : null);
|
|
414
|
-
}
|
|
415
|
-
function createRoutesStub(routes, _context) {
|
|
416
|
-
return function RoutesTestStub({
|
|
417
|
-
initialEntries,
|
|
418
|
-
initialIndex,
|
|
419
|
-
hydrationData,
|
|
420
|
-
future
|
|
421
|
-
}) {
|
|
422
|
-
let routerRef = reactExports.useRef();
|
|
423
|
-
let frameworkContextRef = reactExports.useRef();
|
|
424
|
-
if (routerRef.current == null) {
|
|
425
|
-
frameworkContextRef.current = {
|
|
426
|
-
future: {
|
|
427
|
-
unstable_subResourceIntegrity: future?.unstable_subResourceIntegrity === true,
|
|
428
|
-
v8_middleware: future?.v8_middleware === true
|
|
429
|
-
},
|
|
430
|
-
manifest: {
|
|
431
|
-
routes: {},
|
|
432
|
-
entry: { imports: [], module: "" },
|
|
433
|
-
url: "",
|
|
434
|
-
version: ""
|
|
435
|
-
},
|
|
436
|
-
routeModules: {},
|
|
437
|
-
ssr: false,
|
|
438
|
-
isSpaMode: false,
|
|
439
|
-
routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }
|
|
440
|
-
};
|
|
441
|
-
let patched = processRoutes(
|
|
442
|
-
// @ts-expect-error `StubRouteObject` is stricter about `loader`/`action`
|
|
443
|
-
// types compared to `AgnosticRouteObject`
|
|
444
|
-
convertRoutesToDataRoutes(routes, (r) => r),
|
|
445
|
-
_context !== void 0 ? _context : future?.v8_middleware ? new RouterContextProvider() : {},
|
|
446
|
-
frameworkContextRef.current.manifest,
|
|
447
|
-
frameworkContextRef.current.routeModules
|
|
448
|
-
);
|
|
449
|
-
routerRef.current = createMemoryRouter(patched, {
|
|
450
|
-
initialEntries,
|
|
451
|
-
initialIndex,
|
|
452
|
-
hydrationData
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
return /* @__PURE__ */ reactExports.createElement(FrameworkContext.Provider, { value: frameworkContextRef.current }, /* @__PURE__ */ reactExports.createElement(RouterProvider, { router: routerRef.current }));
|
|
456
|
-
};
|
|
457
|
-
}
|
|
458
|
-
function processRoutes(routes, context, manifest, routeModules, parentId) {
|
|
459
|
-
return routes.map((route) => {
|
|
460
|
-
if (!route.id) {
|
|
461
|
-
throw new Error(
|
|
462
|
-
"Expected a route.id in react-router processRoutes() function"
|
|
463
|
-
);
|
|
464
|
-
}
|
|
465
|
-
let newRoute = {
|
|
466
|
-
id: route.id,
|
|
467
|
-
path: route.path,
|
|
468
|
-
index: route.index,
|
|
469
|
-
Component: route.Component ? withComponentProps(route.Component) : void 0,
|
|
470
|
-
HydrateFallback: route.HydrateFallback ? withHydrateFallbackProps(route.HydrateFallback) : void 0,
|
|
471
|
-
ErrorBoundary: route.ErrorBoundary ? withErrorBoundaryProps(route.ErrorBoundary) : void 0,
|
|
472
|
-
action: route.action ? (args) => route.action({ ...args, context }) : void 0,
|
|
473
|
-
loader: route.loader ? (args) => route.loader({ ...args, context }) : void 0,
|
|
474
|
-
middleware: route.middleware ? route.middleware.map(
|
|
475
|
-
(mw) => (...args) => mw(
|
|
476
|
-
{ ...args[0], context },
|
|
477
|
-
args[1]
|
|
478
|
-
)
|
|
479
|
-
) : void 0,
|
|
480
|
-
handle: route.handle,
|
|
481
|
-
shouldRevalidate: route.shouldRevalidate
|
|
482
|
-
};
|
|
483
|
-
let entryRoute = {
|
|
484
|
-
id: route.id,
|
|
485
|
-
path: route.path,
|
|
486
|
-
index: route.index,
|
|
487
|
-
parentId,
|
|
488
|
-
hasAction: route.action != null,
|
|
489
|
-
hasLoader: route.loader != null,
|
|
490
|
-
// When testing routes, you should be stubbing loader/action/middleware,
|
|
491
|
-
// not trying to re-implement the full loader/clientLoader/SSR/hydration
|
|
492
|
-
// flow. That is better tested via E2E tests.
|
|
493
|
-
hasClientAction: false,
|
|
494
|
-
hasClientLoader: false,
|
|
495
|
-
hasClientMiddleware: false,
|
|
496
|
-
hasErrorBoundary: route.ErrorBoundary != null,
|
|
497
|
-
// any need for these?
|
|
498
|
-
module: "build/stub-path-to-module.js",
|
|
499
|
-
clientActionModule: void 0,
|
|
500
|
-
clientLoaderModule: void 0,
|
|
501
|
-
clientMiddlewareModule: void 0,
|
|
502
|
-
hydrateFallbackModule: void 0
|
|
503
|
-
};
|
|
504
|
-
manifest.routes[newRoute.id] = entryRoute;
|
|
505
|
-
routeModules[route.id] = {
|
|
506
|
-
default: newRoute.Component || Outlet,
|
|
507
|
-
ErrorBoundary: newRoute.ErrorBoundary || void 0,
|
|
508
|
-
handle: route.handle,
|
|
509
|
-
links: route.links,
|
|
510
|
-
meta: route.meta,
|
|
511
|
-
shouldRevalidate: route.shouldRevalidate
|
|
512
|
-
};
|
|
513
|
-
if (route.children) {
|
|
514
|
-
newRoute.children = processRoutes(
|
|
515
|
-
route.children,
|
|
516
|
-
context,
|
|
517
|
-
manifest,
|
|
518
|
-
routeModules,
|
|
519
|
-
newRoute.id
|
|
520
|
-
);
|
|
521
|
-
}
|
|
522
|
-
return newRoute;
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
var encoder = /* @__PURE__ */ new TextEncoder();
|
|
526
|
-
var sign = async (value, secret) => {
|
|
527
|
-
let data2 = encoder.encode(value);
|
|
528
|
-
let key = await createKey(secret, ["sign"]);
|
|
529
|
-
let signature = await crypto.subtle.sign("HMAC", key, data2);
|
|
530
|
-
let hash = btoa(String.fromCharCode(...new Uint8Array(signature))).replace(
|
|
531
|
-
/=+$/,
|
|
532
|
-
""
|
|
533
|
-
);
|
|
534
|
-
return value + "." + hash;
|
|
535
|
-
};
|
|
536
|
-
var unsign = async (cookie, secret) => {
|
|
537
|
-
let index = cookie.lastIndexOf(".");
|
|
538
|
-
let value = cookie.slice(0, index);
|
|
539
|
-
let hash = cookie.slice(index + 1);
|
|
540
|
-
let data2 = encoder.encode(value);
|
|
541
|
-
let key = await createKey(secret, ["verify"]);
|
|
542
|
-
try {
|
|
543
|
-
let signature = byteStringToUint8Array(atob(hash));
|
|
544
|
-
let valid = await crypto.subtle.verify("HMAC", key, signature, data2);
|
|
545
|
-
return valid ? value : false;
|
|
546
|
-
} catch (error) {
|
|
547
|
-
return false;
|
|
548
|
-
}
|
|
549
|
-
};
|
|
550
|
-
var createKey = async (secret, usages) => crypto.subtle.importKey(
|
|
551
|
-
"raw",
|
|
552
|
-
encoder.encode(secret),
|
|
553
|
-
{ name: "HMAC", hash: "SHA-256" },
|
|
554
|
-
false,
|
|
555
|
-
usages
|
|
556
|
-
);
|
|
557
|
-
function byteStringToUint8Array(byteString) {
|
|
558
|
-
let array = new Uint8Array(byteString.length);
|
|
559
|
-
for (let i = 0; i < byteString.length; i++) {
|
|
560
|
-
array[i] = byteString.charCodeAt(i);
|
|
561
|
-
}
|
|
562
|
-
return array;
|
|
563
|
-
}
|
|
564
|
-
var createCookie = (name, cookieOptions = {}) => {
|
|
565
|
-
let { secrets = [], ...options } = {
|
|
566
|
-
path: "/",
|
|
567
|
-
sameSite: "lax",
|
|
568
|
-
...cookieOptions
|
|
569
|
-
};
|
|
570
|
-
warnOnceAboutExpiresCookie(name, options.expires);
|
|
571
|
-
return {
|
|
572
|
-
get name() {
|
|
573
|
-
return name;
|
|
574
|
-
},
|
|
575
|
-
get isSigned() {
|
|
576
|
-
return secrets.length > 0;
|
|
577
|
-
},
|
|
578
|
-
get expires() {
|
|
579
|
-
return typeof options.maxAge !== "undefined" ? new Date(Date.now() + options.maxAge * 1e3) : options.expires;
|
|
580
|
-
},
|
|
581
|
-
async parse(cookieHeader, parseOptions) {
|
|
582
|
-
if (!cookieHeader) return null;
|
|
583
|
-
let cookies = distExports.parse(cookieHeader, { ...options, ...parseOptions });
|
|
584
|
-
if (name in cookies) {
|
|
585
|
-
let value = cookies[name];
|
|
586
|
-
if (typeof value === "string" && value !== "") {
|
|
587
|
-
let decoded = await decodeCookieValue(value, secrets);
|
|
588
|
-
return decoded;
|
|
589
|
-
} else {
|
|
590
|
-
return "";
|
|
591
|
-
}
|
|
592
|
-
} else {
|
|
593
|
-
return null;
|
|
594
|
-
}
|
|
595
|
-
},
|
|
596
|
-
async serialize(value, serializeOptions) {
|
|
597
|
-
return distExports.serialize(
|
|
598
|
-
name,
|
|
599
|
-
value === "" ? "" : await encodeCookieValue(value, secrets),
|
|
600
|
-
{
|
|
601
|
-
...options,
|
|
602
|
-
...serializeOptions
|
|
603
|
-
}
|
|
604
|
-
);
|
|
605
|
-
}
|
|
606
|
-
};
|
|
607
|
-
};
|
|
608
|
-
var isCookie = (object) => {
|
|
609
|
-
return object != null && typeof object.name === "string" && typeof object.isSigned === "boolean" && typeof object.parse === "function" && typeof object.serialize === "function";
|
|
610
|
-
};
|
|
611
|
-
async function encodeCookieValue(value, secrets) {
|
|
612
|
-
let encoded = encodeData(value);
|
|
613
|
-
if (secrets.length > 0) {
|
|
614
|
-
encoded = await sign(encoded, secrets[0]);
|
|
615
|
-
}
|
|
616
|
-
return encoded;
|
|
617
|
-
}
|
|
618
|
-
async function decodeCookieValue(value, secrets) {
|
|
619
|
-
if (secrets.length > 0) {
|
|
620
|
-
for (let secret of secrets) {
|
|
621
|
-
let unsignedValue = await unsign(value, secret);
|
|
622
|
-
if (unsignedValue !== false) {
|
|
623
|
-
return decodeData(unsignedValue);
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
return null;
|
|
627
|
-
}
|
|
628
|
-
return decodeData(value);
|
|
629
|
-
}
|
|
630
|
-
function encodeData(value) {
|
|
631
|
-
return btoa(myUnescape(encodeURIComponent(JSON.stringify(value))));
|
|
632
|
-
}
|
|
633
|
-
function decodeData(value) {
|
|
634
|
-
try {
|
|
635
|
-
return JSON.parse(decodeURIComponent(myEscape(atob(value))));
|
|
636
|
-
} catch (error) {
|
|
637
|
-
return {};
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
function myEscape(value) {
|
|
641
|
-
let str = value.toString();
|
|
642
|
-
let result = "";
|
|
643
|
-
let index = 0;
|
|
644
|
-
let chr, code;
|
|
645
|
-
while (index < str.length) {
|
|
646
|
-
chr = str.charAt(index++);
|
|
647
|
-
if (/[\w*+\-./@]/.exec(chr)) {
|
|
648
|
-
result += chr;
|
|
649
|
-
} else {
|
|
650
|
-
code = chr.charCodeAt(0);
|
|
651
|
-
if (code < 256) {
|
|
652
|
-
result += "%" + hex(code, 2);
|
|
653
|
-
} else {
|
|
654
|
-
result += "%u" + hex(code, 4).toUpperCase();
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
return result;
|
|
659
|
-
}
|
|
660
|
-
function hex(code, length) {
|
|
661
|
-
let result = code.toString(16);
|
|
662
|
-
while (result.length < length) result = "0" + result;
|
|
663
|
-
return result;
|
|
664
|
-
}
|
|
665
|
-
function myUnescape(value) {
|
|
666
|
-
let str = value.toString();
|
|
667
|
-
let result = "";
|
|
668
|
-
let index = 0;
|
|
669
|
-
let chr, part;
|
|
670
|
-
while (index < str.length) {
|
|
671
|
-
chr = str.charAt(index++);
|
|
672
|
-
if (chr === "%") {
|
|
673
|
-
if (str.charAt(index) === "u") {
|
|
674
|
-
part = str.slice(index + 1, index + 5);
|
|
675
|
-
if (/^[\da-f]{4}$/i.exec(part)) {
|
|
676
|
-
result += String.fromCharCode(parseInt(part, 16));
|
|
677
|
-
index += 5;
|
|
678
|
-
continue;
|
|
679
|
-
}
|
|
680
|
-
} else {
|
|
681
|
-
part = str.slice(index, index + 2);
|
|
682
|
-
if (/^[\da-f]{2}$/i.exec(part)) {
|
|
683
|
-
result += String.fromCharCode(parseInt(part, 16));
|
|
684
|
-
index += 2;
|
|
685
|
-
continue;
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
result += chr;
|
|
690
|
-
}
|
|
691
|
-
return result;
|
|
692
|
-
}
|
|
693
|
-
function warnOnceAboutExpiresCookie(name, expires) {
|
|
694
|
-
warnOnce(
|
|
695
|
-
!expires,
|
|
696
|
-
`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.`
|
|
697
|
-
);
|
|
698
|
-
}
|
|
699
|
-
function createEntryRouteModules(manifest) {
|
|
700
|
-
return Object.keys(manifest).reduce((memo, routeId) => {
|
|
701
|
-
let route = manifest[routeId];
|
|
702
|
-
if (route) {
|
|
703
|
-
memo[routeId] = route.module;
|
|
704
|
-
}
|
|
705
|
-
return memo;
|
|
706
|
-
}, {});
|
|
707
|
-
}
|
|
708
|
-
var ServerMode = /* @__PURE__ */ ((ServerMode2) => {
|
|
709
|
-
ServerMode2["Development"] = "development";
|
|
710
|
-
ServerMode2["Production"] = "production";
|
|
711
|
-
ServerMode2["Test"] = "test";
|
|
712
|
-
return ServerMode2;
|
|
713
|
-
})(ServerMode || {});
|
|
714
|
-
function isServerMode(value) {
|
|
715
|
-
return value === "development" || value === "production" || value === "test";
|
|
716
|
-
}
|
|
717
|
-
function sanitizeError(error, serverMode) {
|
|
718
|
-
if (error instanceof Error && serverMode !== "development") {
|
|
719
|
-
let sanitized = new Error("Unexpected Server Error");
|
|
720
|
-
sanitized.stack = void 0;
|
|
721
|
-
return sanitized;
|
|
722
|
-
}
|
|
723
|
-
return error;
|
|
724
|
-
}
|
|
725
|
-
function sanitizeErrors(errors, serverMode) {
|
|
726
|
-
return Object.entries(errors).reduce((acc, [routeId, error]) => {
|
|
727
|
-
return Object.assign(acc, { [routeId]: sanitizeError(error, serverMode) });
|
|
728
|
-
}, {});
|
|
729
|
-
}
|
|
730
|
-
function serializeError(error, serverMode) {
|
|
731
|
-
let sanitized = sanitizeError(error, serverMode);
|
|
732
|
-
return {
|
|
733
|
-
message: sanitized.message,
|
|
734
|
-
stack: sanitized.stack
|
|
735
|
-
};
|
|
736
|
-
}
|
|
737
|
-
function serializeErrors(errors, serverMode) {
|
|
738
|
-
if (!errors) return null;
|
|
739
|
-
let entries = Object.entries(errors);
|
|
740
|
-
let serialized = {};
|
|
741
|
-
for (let [key, val] of entries) {
|
|
742
|
-
if (isRouteErrorResponse(val)) {
|
|
743
|
-
serialized[key] = { ...val, __type: "RouteErrorResponse" };
|
|
744
|
-
} else if (val instanceof Error) {
|
|
745
|
-
let sanitized = sanitizeError(val, serverMode);
|
|
746
|
-
serialized[key] = {
|
|
747
|
-
message: sanitized.message,
|
|
748
|
-
stack: sanitized.stack,
|
|
749
|
-
__type: "Error",
|
|
750
|
-
// If this is a subclass (i.e., ReferenceError), send up the type so we
|
|
751
|
-
// can re-create the same type during hydration. This will only apply
|
|
752
|
-
// in dev mode since all production errors are sanitized to normal
|
|
753
|
-
// Error instances
|
|
754
|
-
...sanitized.name !== "Error" ? {
|
|
755
|
-
__subType: sanitized.name
|
|
756
|
-
} : {}
|
|
757
|
-
};
|
|
758
|
-
} else {
|
|
759
|
-
serialized[key] = val;
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
return serialized;
|
|
763
|
-
}
|
|
764
|
-
function matchServerRoutes(routes, pathname, basename) {
|
|
765
|
-
let matches = matchRoutes(
|
|
766
|
-
routes,
|
|
767
|
-
pathname,
|
|
768
|
-
basename
|
|
769
|
-
);
|
|
770
|
-
if (!matches) return null;
|
|
771
|
-
return matches.map((match) => ({
|
|
772
|
-
params: match.params,
|
|
773
|
-
pathname: match.pathname,
|
|
774
|
-
route: match.route
|
|
775
|
-
}));
|
|
776
|
-
}
|
|
777
|
-
async function callRouteHandler(handler, args) {
|
|
778
|
-
let result = await handler({
|
|
779
|
-
request: stripRoutesParam(stripIndexParam(args.request)),
|
|
780
|
-
params: args.params,
|
|
781
|
-
context: args.context,
|
|
782
|
-
unstable_pattern: args.unstable_pattern
|
|
783
|
-
});
|
|
784
|
-
if (isDataWithResponseInit(result) && result.init && result.init.status && isRedirectStatusCode(result.init.status)) {
|
|
785
|
-
throw new Response(null, result.init);
|
|
786
|
-
}
|
|
787
|
-
return result;
|
|
788
|
-
}
|
|
789
|
-
function stripIndexParam(request) {
|
|
790
|
-
let url = new URL(request.url);
|
|
791
|
-
let indexValues = url.searchParams.getAll("index");
|
|
792
|
-
url.searchParams.delete("index");
|
|
793
|
-
let indexValuesToKeep = [];
|
|
794
|
-
for (let indexValue of indexValues) {
|
|
795
|
-
if (indexValue) {
|
|
796
|
-
indexValuesToKeep.push(indexValue);
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
for (let toKeep of indexValuesToKeep) {
|
|
800
|
-
url.searchParams.append("index", toKeep);
|
|
801
|
-
}
|
|
802
|
-
let init = {
|
|
803
|
-
method: request.method,
|
|
804
|
-
body: request.body,
|
|
805
|
-
headers: request.headers,
|
|
806
|
-
signal: request.signal
|
|
807
|
-
};
|
|
808
|
-
if (init.body) {
|
|
809
|
-
init.duplex = "half";
|
|
810
|
-
}
|
|
811
|
-
return new Request(url.href, init);
|
|
812
|
-
}
|
|
813
|
-
function stripRoutesParam(request) {
|
|
814
|
-
let url = new URL(request.url);
|
|
815
|
-
url.searchParams.delete("_routes");
|
|
816
|
-
let init = {
|
|
817
|
-
method: request.method,
|
|
818
|
-
body: request.body,
|
|
819
|
-
headers: request.headers,
|
|
820
|
-
signal: request.signal
|
|
821
|
-
};
|
|
822
|
-
if (init.body) {
|
|
823
|
-
init.duplex = "half";
|
|
824
|
-
}
|
|
825
|
-
return new Request(url.href, init);
|
|
826
|
-
}
|
|
827
|
-
function invariant(value, message) {
|
|
828
|
-
if (value === false || value === null || typeof value === "undefined") {
|
|
829
|
-
console.error(
|
|
830
|
-
"The following error is a bug in React Router; please open an issue! https://github.com/remix-run/react-router/issues/new/choose"
|
|
831
|
-
);
|
|
832
|
-
throw new Error(message);
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
var globalDevServerHooksKey = "__reactRouterDevServerHooks";
|
|
836
|
-
function setDevServerHooks(devServerHooks) {
|
|
837
|
-
globalThis[globalDevServerHooksKey] = devServerHooks;
|
|
838
|
-
}
|
|
839
|
-
function getDevServerHooks() {
|
|
840
|
-
return globalThis[globalDevServerHooksKey];
|
|
841
|
-
}
|
|
842
|
-
function getBuildTimeHeader(request, headerName) {
|
|
843
|
-
if (typeof process !== "undefined") {
|
|
844
|
-
try {
|
|
845
|
-
if (define_process_env_default?.IS_RR_BUILD_REQUEST === "yes") {
|
|
846
|
-
return request.headers.get(headerName);
|
|
847
|
-
}
|
|
848
|
-
} catch (e) {
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
return null;
|
|
852
|
-
}
|
|
853
|
-
function groupRoutesByParentId(manifest) {
|
|
854
|
-
let routes = {};
|
|
855
|
-
Object.values(manifest).forEach((route) => {
|
|
856
|
-
if (route) {
|
|
857
|
-
let parentId = route.parentId || "";
|
|
858
|
-
if (!routes[parentId]) {
|
|
859
|
-
routes[parentId] = [];
|
|
860
|
-
}
|
|
861
|
-
routes[parentId].push(route);
|
|
862
|
-
}
|
|
863
|
-
});
|
|
864
|
-
return routes;
|
|
865
|
-
}
|
|
866
|
-
function createRoutes(manifest, parentId = "", routesByParentId = groupRoutesByParentId(manifest)) {
|
|
867
|
-
return (routesByParentId[parentId] || []).map((route) => ({
|
|
868
|
-
...route,
|
|
869
|
-
children: createRoutes(manifest, route.id, routesByParentId)
|
|
870
|
-
}));
|
|
871
|
-
}
|
|
872
|
-
function createStaticHandlerDataRoutes(manifest, future, parentId = "", routesByParentId = groupRoutesByParentId(manifest)) {
|
|
873
|
-
return (routesByParentId[parentId] || []).map((route) => {
|
|
874
|
-
let commonRoute = {
|
|
875
|
-
// Always include root due to default boundaries
|
|
876
|
-
hasErrorBoundary: route.id === "root" || route.module.ErrorBoundary != null,
|
|
877
|
-
id: route.id,
|
|
878
|
-
path: route.path,
|
|
879
|
-
middleware: route.module.middleware,
|
|
880
|
-
// Need to use RR's version in the param typed here to permit the optional
|
|
881
|
-
// context even though we know it'll always be provided in remix
|
|
882
|
-
loader: route.module.loader ? async (args) => {
|
|
883
|
-
let preRenderedData = getBuildTimeHeader(
|
|
884
|
-
args.request,
|
|
885
|
-
"X-React-Router-Prerender-Data"
|
|
886
|
-
);
|
|
887
|
-
if (preRenderedData != null) {
|
|
888
|
-
let encoded = preRenderedData ? decodeURI(preRenderedData) : preRenderedData;
|
|
889
|
-
invariant(encoded, "Missing prerendered data for route");
|
|
890
|
-
let uint8array = new TextEncoder().encode(encoded);
|
|
891
|
-
let stream = new ReadableStream({
|
|
892
|
-
start(controller) {
|
|
893
|
-
controller.enqueue(uint8array);
|
|
894
|
-
controller.close();
|
|
895
|
-
}
|
|
896
|
-
});
|
|
897
|
-
let decoded = await decodeViaTurboStream(stream, globalThis);
|
|
898
|
-
let data2 = decoded.value;
|
|
899
|
-
if (data2 && SingleFetchRedirectSymbol in data2) {
|
|
900
|
-
let result = data2[SingleFetchRedirectSymbol];
|
|
901
|
-
let init = { status: result.status };
|
|
902
|
-
if (result.reload) {
|
|
903
|
-
throw redirectDocument(result.redirect, init);
|
|
904
|
-
} else if (result.replace) {
|
|
905
|
-
throw replace(result.redirect, init);
|
|
906
|
-
} else {
|
|
907
|
-
throw redirect(result.redirect, init);
|
|
908
|
-
}
|
|
909
|
-
} else {
|
|
910
|
-
invariant(
|
|
911
|
-
data2 && route.id in data2,
|
|
912
|
-
"Unable to decode prerendered data"
|
|
913
|
-
);
|
|
914
|
-
let result = data2[route.id];
|
|
915
|
-
invariant(
|
|
916
|
-
"data" in result,
|
|
917
|
-
"Unable to process prerendered data"
|
|
918
|
-
);
|
|
919
|
-
return result.data;
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
let val = await callRouteHandler(route.module.loader, args);
|
|
923
|
-
return val;
|
|
924
|
-
} : void 0,
|
|
925
|
-
action: route.module.action ? (args) => callRouteHandler(route.module.action, args) : void 0,
|
|
926
|
-
handle: route.module.handle
|
|
927
|
-
};
|
|
928
|
-
return route.index ? {
|
|
929
|
-
index: true,
|
|
930
|
-
...commonRoute
|
|
931
|
-
} : {
|
|
932
|
-
caseSensitive: route.caseSensitive,
|
|
933
|
-
children: createStaticHandlerDataRoutes(
|
|
934
|
-
manifest,
|
|
935
|
-
future,
|
|
936
|
-
route.id,
|
|
937
|
-
routesByParentId
|
|
938
|
-
),
|
|
939
|
-
...commonRoute
|
|
940
|
-
};
|
|
941
|
-
});
|
|
942
|
-
}
|
|
943
|
-
function createServerHandoffString(serverHandoff) {
|
|
944
|
-
return escapeHtml(JSON.stringify(serverHandoff));
|
|
945
|
-
}
|
|
946
|
-
function getDocumentHeaders(context, build) {
|
|
947
|
-
return getDocumentHeadersImpl(context, (m) => {
|
|
948
|
-
let route = build.routes[m.route.id];
|
|
949
|
-
invariant(route, `Route with id "${m.route.id}" not found in build`);
|
|
950
|
-
return route.module.headers;
|
|
951
|
-
});
|
|
952
|
-
}
|
|
953
|
-
function getDocumentHeadersImpl(context, getRouteHeadersFn, _defaultHeaders) {
|
|
954
|
-
let boundaryIdx = context.errors ? context.matches.findIndex((m) => context.errors[m.route.id]) : -1;
|
|
955
|
-
let matches = boundaryIdx >= 0 ? context.matches.slice(0, boundaryIdx + 1) : context.matches;
|
|
956
|
-
let errorHeaders;
|
|
957
|
-
if (boundaryIdx >= 0) {
|
|
958
|
-
let { actionHeaders, actionData, loaderHeaders, loaderData } = context;
|
|
959
|
-
context.matches.slice(boundaryIdx).some((match) => {
|
|
960
|
-
let id = match.route.id;
|
|
961
|
-
if (actionHeaders[id] && (!actionData || !actionData.hasOwnProperty(id))) {
|
|
962
|
-
errorHeaders = actionHeaders[id];
|
|
963
|
-
} else if (loaderHeaders[id] && !loaderData.hasOwnProperty(id)) {
|
|
964
|
-
errorHeaders = loaderHeaders[id];
|
|
965
|
-
}
|
|
966
|
-
return errorHeaders != null;
|
|
967
|
-
});
|
|
968
|
-
}
|
|
969
|
-
const defaultHeaders = new Headers(_defaultHeaders);
|
|
970
|
-
return matches.reduce((parentHeaders, match, idx) => {
|
|
971
|
-
let { id } = match.route;
|
|
972
|
-
let loaderHeaders = context.loaderHeaders[id] || new Headers();
|
|
973
|
-
let actionHeaders = context.actionHeaders[id] || new Headers();
|
|
974
|
-
let includeErrorHeaders = errorHeaders != null && idx === matches.length - 1;
|
|
975
|
-
let includeErrorCookies = includeErrorHeaders && errorHeaders !== loaderHeaders && errorHeaders !== actionHeaders;
|
|
976
|
-
let headersFn = getRouteHeadersFn(match);
|
|
977
|
-
if (headersFn == null) {
|
|
978
|
-
let headers2 = new Headers(parentHeaders);
|
|
979
|
-
if (includeErrorCookies) {
|
|
980
|
-
prependCookies(errorHeaders, headers2);
|
|
981
|
-
}
|
|
982
|
-
prependCookies(actionHeaders, headers2);
|
|
983
|
-
prependCookies(loaderHeaders, headers2);
|
|
984
|
-
return headers2;
|
|
985
|
-
}
|
|
986
|
-
let headers = new Headers(
|
|
987
|
-
typeof headersFn === "function" ? headersFn({
|
|
988
|
-
loaderHeaders,
|
|
989
|
-
parentHeaders,
|
|
990
|
-
actionHeaders,
|
|
991
|
-
errorHeaders: includeErrorHeaders ? errorHeaders : void 0
|
|
992
|
-
}) : headersFn
|
|
993
|
-
);
|
|
994
|
-
if (includeErrorCookies) {
|
|
995
|
-
prependCookies(errorHeaders, headers);
|
|
996
|
-
}
|
|
997
|
-
prependCookies(actionHeaders, headers);
|
|
998
|
-
prependCookies(loaderHeaders, headers);
|
|
999
|
-
prependCookies(parentHeaders, headers);
|
|
1000
|
-
return headers;
|
|
1001
|
-
}, new Headers(defaultHeaders));
|
|
1002
|
-
}
|
|
1003
|
-
function prependCookies(parentHeaders, childHeaders) {
|
|
1004
|
-
let parentSetCookieString = parentHeaders.get("Set-Cookie");
|
|
1005
|
-
if (parentSetCookieString) {
|
|
1006
|
-
let cookies = setCookieExports.splitCookiesString(parentSetCookieString);
|
|
1007
|
-
let childCookies = new Set(childHeaders.getSetCookie());
|
|
1008
|
-
cookies.forEach((cookie) => {
|
|
1009
|
-
if (!childCookies.has(cookie)) {
|
|
1010
|
-
childHeaders.append("Set-Cookie", cookie);
|
|
1011
|
-
}
|
|
1012
|
-
});
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
var SERVER_NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([
|
|
1016
|
-
...NO_BODY_STATUS_CODES,
|
|
1017
|
-
304
|
|
1018
|
-
]);
|
|
1019
|
-
async function singleFetchAction(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError) {
|
|
1020
|
-
try {
|
|
1021
|
-
let handlerRequest = new Request(handlerUrl, {
|
|
1022
|
-
method: request.method,
|
|
1023
|
-
body: request.body,
|
|
1024
|
-
headers: request.headers,
|
|
1025
|
-
signal: request.signal,
|
|
1026
|
-
...request.body ? { duplex: "half" } : void 0
|
|
1027
|
-
});
|
|
1028
|
-
let result = await staticHandler.query(handlerRequest, {
|
|
1029
|
-
requestContext: loadContext,
|
|
1030
|
-
skipLoaderErrorBubbling: true,
|
|
1031
|
-
skipRevalidation: true,
|
|
1032
|
-
generateMiddlewareResponse: build.future.v8_middleware ? async (query) => {
|
|
1033
|
-
try {
|
|
1034
|
-
let innerResult = await query(handlerRequest);
|
|
1035
|
-
return handleQueryResult(innerResult);
|
|
1036
|
-
} catch (error) {
|
|
1037
|
-
return handleQueryError(error);
|
|
1038
|
-
}
|
|
1039
|
-
} : void 0
|
|
1040
|
-
});
|
|
1041
|
-
return handleQueryResult(result);
|
|
1042
|
-
} catch (error) {
|
|
1043
|
-
return handleQueryError(error);
|
|
1044
|
-
}
|
|
1045
|
-
function handleQueryResult(result) {
|
|
1046
|
-
return isResponse(result) ? result : staticContextToResponse(result);
|
|
1047
|
-
}
|
|
1048
|
-
function handleQueryError(error) {
|
|
1049
|
-
handleError(error);
|
|
1050
|
-
return generateSingleFetchResponse(request, build, serverMode, {
|
|
1051
|
-
result: { error },
|
|
1052
|
-
headers: new Headers(),
|
|
1053
|
-
status: 500
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
|
-
function staticContextToResponse(context) {
|
|
1057
|
-
let headers = getDocumentHeaders(context, build);
|
|
1058
|
-
if (isRedirectStatusCode(context.statusCode) && headers.has("Location")) {
|
|
1059
|
-
return new Response(null, { status: context.statusCode, headers });
|
|
1060
|
-
}
|
|
1061
|
-
if (context.errors) {
|
|
1062
|
-
Object.values(context.errors).forEach((err) => {
|
|
1063
|
-
if (!isRouteErrorResponse(err) || err.error) {
|
|
1064
|
-
handleError(err);
|
|
1065
|
-
}
|
|
1066
|
-
});
|
|
1067
|
-
context.errors = sanitizeErrors(context.errors, serverMode);
|
|
1068
|
-
}
|
|
1069
|
-
let singleFetchResult;
|
|
1070
|
-
if (context.errors) {
|
|
1071
|
-
singleFetchResult = { error: Object.values(context.errors)[0] };
|
|
1072
|
-
} else {
|
|
1073
|
-
singleFetchResult = {
|
|
1074
|
-
data: Object.values(context.actionData || {})[0]
|
|
1075
|
-
};
|
|
1076
|
-
}
|
|
1077
|
-
return generateSingleFetchResponse(request, build, serverMode, {
|
|
1078
|
-
result: singleFetchResult,
|
|
1079
|
-
headers,
|
|
1080
|
-
status: context.statusCode
|
|
1081
|
-
});
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
async function singleFetchLoaders(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError) {
|
|
1085
|
-
let routesParam = new URL(request.url).searchParams.get("_routes");
|
|
1086
|
-
let loadRouteIds = routesParam ? new Set(routesParam.split(",")) : null;
|
|
1087
|
-
try {
|
|
1088
|
-
let handlerRequest = new Request(handlerUrl, {
|
|
1089
|
-
headers: request.headers,
|
|
1090
|
-
signal: request.signal
|
|
1091
|
-
});
|
|
1092
|
-
let result = await staticHandler.query(handlerRequest, {
|
|
1093
|
-
requestContext: loadContext,
|
|
1094
|
-
filterMatchesToLoad: (m) => !loadRouteIds || loadRouteIds.has(m.route.id),
|
|
1095
|
-
skipLoaderErrorBubbling: true,
|
|
1096
|
-
generateMiddlewareResponse: build.future.v8_middleware ? async (query) => {
|
|
1097
|
-
try {
|
|
1098
|
-
let innerResult = await query(handlerRequest);
|
|
1099
|
-
return handleQueryResult(innerResult);
|
|
1100
|
-
} catch (error) {
|
|
1101
|
-
return handleQueryError(error);
|
|
1102
|
-
}
|
|
1103
|
-
} : void 0
|
|
1104
|
-
});
|
|
1105
|
-
return handleQueryResult(result);
|
|
1106
|
-
} catch (error) {
|
|
1107
|
-
return handleQueryError(error);
|
|
1108
|
-
}
|
|
1109
|
-
function handleQueryResult(result) {
|
|
1110
|
-
return isResponse(result) ? result : staticContextToResponse(result);
|
|
1111
|
-
}
|
|
1112
|
-
function handleQueryError(error) {
|
|
1113
|
-
handleError(error);
|
|
1114
|
-
return generateSingleFetchResponse(request, build, serverMode, {
|
|
1115
|
-
result: { error },
|
|
1116
|
-
headers: new Headers(),
|
|
1117
|
-
status: 500
|
|
1118
|
-
});
|
|
1119
|
-
}
|
|
1120
|
-
function staticContextToResponse(context) {
|
|
1121
|
-
let headers = getDocumentHeaders(context, build);
|
|
1122
|
-
if (isRedirectStatusCode(context.statusCode) && headers.has("Location")) {
|
|
1123
|
-
return new Response(null, { status: context.statusCode, headers });
|
|
1124
|
-
}
|
|
1125
|
-
if (context.errors) {
|
|
1126
|
-
Object.values(context.errors).forEach((err) => {
|
|
1127
|
-
if (!isRouteErrorResponse(err) || err.error) {
|
|
1128
|
-
handleError(err);
|
|
1129
|
-
}
|
|
1130
|
-
});
|
|
1131
|
-
context.errors = sanitizeErrors(context.errors, serverMode);
|
|
1132
|
-
}
|
|
1133
|
-
let results = {};
|
|
1134
|
-
let loadedMatches = new Set(
|
|
1135
|
-
context.matches.filter(
|
|
1136
|
-
(m) => loadRouteIds ? loadRouteIds.has(m.route.id) : m.route.loader != null
|
|
1137
|
-
).map((m) => m.route.id)
|
|
1138
|
-
);
|
|
1139
|
-
if (context.errors) {
|
|
1140
|
-
for (let [id, error] of Object.entries(context.errors)) {
|
|
1141
|
-
results[id] = { error };
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
for (let [id, data2] of Object.entries(context.loaderData)) {
|
|
1145
|
-
if (!(id in results) && loadedMatches.has(id)) {
|
|
1146
|
-
results[id] = { data: data2 };
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
return generateSingleFetchResponse(request, build, serverMode, {
|
|
1150
|
-
result: results,
|
|
1151
|
-
headers,
|
|
1152
|
-
status: context.statusCode
|
|
1153
|
-
});
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
function generateSingleFetchResponse(request, build, serverMode, {
|
|
1157
|
-
result,
|
|
1158
|
-
headers,
|
|
1159
|
-
status
|
|
1160
|
-
}) {
|
|
1161
|
-
let resultHeaders = new Headers(headers);
|
|
1162
|
-
resultHeaders.set("X-Remix-Response", "yes");
|
|
1163
|
-
if (SERVER_NO_BODY_STATUS_CODES.has(status)) {
|
|
1164
|
-
return new Response(null, { status, headers: resultHeaders });
|
|
1165
|
-
}
|
|
1166
|
-
resultHeaders.set("Content-Type", "text/x-script");
|
|
1167
|
-
resultHeaders.delete("Content-Length");
|
|
1168
|
-
return new Response(
|
|
1169
|
-
encodeViaTurboStream(
|
|
1170
|
-
result,
|
|
1171
|
-
request.signal,
|
|
1172
|
-
build.entry.module.streamTimeout,
|
|
1173
|
-
serverMode
|
|
1174
|
-
),
|
|
1175
|
-
{
|
|
1176
|
-
status: status || 200,
|
|
1177
|
-
headers: resultHeaders
|
|
1178
|
-
}
|
|
1179
|
-
);
|
|
1180
|
-
}
|
|
1181
|
-
function generateSingleFetchRedirectResponse(redirectResponse, request, build, serverMode) {
|
|
1182
|
-
let redirect2 = getSingleFetchRedirect(
|
|
1183
|
-
redirectResponse.status,
|
|
1184
|
-
redirectResponse.headers,
|
|
1185
|
-
build.basename
|
|
1186
|
-
);
|
|
1187
|
-
let headers = new Headers(redirectResponse.headers);
|
|
1188
|
-
headers.delete("Location");
|
|
1189
|
-
headers.set("Content-Type", "text/x-script");
|
|
1190
|
-
return generateSingleFetchResponse(request, build, serverMode, {
|
|
1191
|
-
result: request.method === "GET" ? { [SingleFetchRedirectSymbol]: redirect2 } : redirect2,
|
|
1192
|
-
headers,
|
|
1193
|
-
status: SINGLE_FETCH_REDIRECT_STATUS
|
|
1194
|
-
});
|
|
1195
|
-
}
|
|
1196
|
-
function getSingleFetchRedirect(status, headers, basename) {
|
|
1197
|
-
let redirect2 = headers.get("Location");
|
|
1198
|
-
if (basename) {
|
|
1199
|
-
redirect2 = stripBasename(redirect2, basename) || redirect2;
|
|
1200
|
-
}
|
|
1201
|
-
return {
|
|
1202
|
-
redirect: redirect2,
|
|
1203
|
-
status,
|
|
1204
|
-
revalidate: (
|
|
1205
|
-
// Technically X-Remix-Revalidate isn't needed here - that was an implementation
|
|
1206
|
-
// detail of ?_data requests as our way to tell the front end to revalidate when
|
|
1207
|
-
// we didn't have a response body to include that information in.
|
|
1208
|
-
// With single fetch, we tell the front end via this revalidate boolean field.
|
|
1209
|
-
// However, we're respecting it for now because it may be something folks have
|
|
1210
|
-
// used in their own responses
|
|
1211
|
-
// TODO(v3): Consider removing or making this official public API
|
|
1212
|
-
headers.has("X-Remix-Revalidate") || headers.has("Set-Cookie")
|
|
1213
|
-
),
|
|
1214
|
-
reload: headers.has("X-Remix-Reload-Document"),
|
|
1215
|
-
replace: headers.has("X-Remix-Replace")
|
|
1216
|
-
};
|
|
1217
|
-
}
|
|
1218
|
-
function encodeViaTurboStream(data2, requestSignal, streamTimeout, serverMode) {
|
|
1219
|
-
let controller = new AbortController();
|
|
1220
|
-
let timeoutId = setTimeout(
|
|
1221
|
-
() => controller.abort(new Error("Server Timeout")),
|
|
1222
|
-
typeof streamTimeout === "number" ? streamTimeout : 4950
|
|
1223
|
-
);
|
|
1224
|
-
requestSignal.addEventListener("abort", () => clearTimeout(timeoutId));
|
|
1225
|
-
return encode(data2, {
|
|
1226
|
-
signal: controller.signal,
|
|
1227
|
-
plugins: [
|
|
1228
|
-
(value) => {
|
|
1229
|
-
if (value instanceof Error) {
|
|
1230
|
-
let { name, message, stack } = serverMode === "production" ? sanitizeError(value, serverMode) : value;
|
|
1231
|
-
return ["SanitizedError", name, message, stack];
|
|
1232
|
-
}
|
|
1233
|
-
if (value instanceof ErrorResponseImpl) {
|
|
1234
|
-
let { data: data3, status, statusText } = value;
|
|
1235
|
-
return ["ErrorResponse", data3, status, statusText];
|
|
1236
|
-
}
|
|
1237
|
-
if (value && typeof value === "object" && SingleFetchRedirectSymbol in value) {
|
|
1238
|
-
return ["SingleFetchRedirect", value[SingleFetchRedirectSymbol]];
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
|
-
],
|
|
1242
|
-
postPlugins: [
|
|
1243
|
-
(value) => {
|
|
1244
|
-
if (!value) return;
|
|
1245
|
-
if (typeof value !== "object") return;
|
|
1246
|
-
return [
|
|
1247
|
-
"SingleFetchClassInstance",
|
|
1248
|
-
Object.fromEntries(Object.entries(value))
|
|
1249
|
-
];
|
|
1250
|
-
},
|
|
1251
|
-
() => ["SingleFetchFallback"]
|
|
1252
|
-
]
|
|
1253
|
-
});
|
|
1254
|
-
}
|
|
1255
|
-
function derive(build, mode) {
|
|
1256
|
-
let routes = createRoutes(build.routes);
|
|
1257
|
-
let dataRoutes = createStaticHandlerDataRoutes(build.routes, build.future);
|
|
1258
|
-
let serverMode = isServerMode(mode) ? mode : "production";
|
|
1259
|
-
let staticHandler = createStaticHandler(dataRoutes, {
|
|
1260
|
-
basename: build.basename,
|
|
1261
|
-
unstable_instrumentations: build.entry.module.unstable_instrumentations
|
|
1262
|
-
});
|
|
1263
|
-
let errorHandler = build.entry.module.handleError || ((error, { request }) => {
|
|
1264
|
-
if (serverMode !== "test" && !request.signal.aborted) {
|
|
1265
|
-
console.error(
|
|
1266
|
-
// @ts-expect-error This is "private" from users but intended for internal use
|
|
1267
|
-
isRouteErrorResponse(error) && error.error ? error.error : error
|
|
1268
|
-
);
|
|
1269
|
-
}
|
|
1270
|
-
});
|
|
1271
|
-
let requestHandler = async (request, initialContext) => {
|
|
1272
|
-
let params = {};
|
|
1273
|
-
let loadContext;
|
|
1274
|
-
let handleError = (error) => {
|
|
1275
|
-
if (mode === "development") {
|
|
1276
|
-
getDevServerHooks()?.processRequestError?.(error);
|
|
1277
|
-
}
|
|
1278
|
-
errorHandler(error, {
|
|
1279
|
-
context: loadContext,
|
|
1280
|
-
params,
|
|
1281
|
-
request
|
|
1282
|
-
});
|
|
1283
|
-
};
|
|
1284
|
-
if (build.future.v8_middleware) {
|
|
1285
|
-
if (initialContext && !(initialContext instanceof RouterContextProvider)) {
|
|
1286
|
-
let error = new Error(
|
|
1287
|
-
"Invalid `context` value provided to `handleRequest`. When middleware is enabled you must return an instance of `RouterContextProvider` from your `getLoadContext` function."
|
|
1288
|
-
);
|
|
1289
|
-
handleError(error);
|
|
1290
|
-
return returnLastResortErrorResponse(error, serverMode);
|
|
1291
|
-
}
|
|
1292
|
-
loadContext = initialContext || new RouterContextProvider();
|
|
1293
|
-
} else {
|
|
1294
|
-
loadContext = initialContext || {};
|
|
1295
|
-
}
|
|
1296
|
-
let url = new URL(request.url);
|
|
1297
|
-
let normalizedBasename = build.basename || "/";
|
|
1298
|
-
let normalizedPath = url.pathname;
|
|
1299
|
-
if (stripBasename(normalizedPath, normalizedBasename) === "/_root.data") {
|
|
1300
|
-
normalizedPath = normalizedBasename;
|
|
1301
|
-
} else if (normalizedPath.endsWith(".data")) {
|
|
1302
|
-
normalizedPath = normalizedPath.replace(/\.data$/, "");
|
|
1303
|
-
}
|
|
1304
|
-
if (stripBasename(normalizedPath, normalizedBasename) !== "/" && normalizedPath.endsWith("/")) {
|
|
1305
|
-
normalizedPath = normalizedPath.slice(0, -1);
|
|
1306
|
-
}
|
|
1307
|
-
let isSpaMode = getBuildTimeHeader(request, "X-React-Router-SPA-Mode") === "yes";
|
|
1308
|
-
if (!build.ssr) {
|
|
1309
|
-
let decodedPath = decodeURI(normalizedPath);
|
|
1310
|
-
if (normalizedBasename !== "/") {
|
|
1311
|
-
let strippedPath = stripBasename(decodedPath, normalizedBasename);
|
|
1312
|
-
if (strippedPath == null) {
|
|
1313
|
-
errorHandler(
|
|
1314
|
-
new ErrorResponseImpl(
|
|
1315
|
-
404,
|
|
1316
|
-
"Not Found",
|
|
1317
|
-
`Refusing to prerender the \`${decodedPath}\` path because it does not start with the basename \`${normalizedBasename}\``
|
|
1318
|
-
),
|
|
1319
|
-
{
|
|
1320
|
-
context: loadContext,
|
|
1321
|
-
params,
|
|
1322
|
-
request
|
|
1323
|
-
}
|
|
1324
|
-
);
|
|
1325
|
-
return new Response("Not Found", {
|
|
1326
|
-
status: 404,
|
|
1327
|
-
statusText: "Not Found"
|
|
1328
|
-
});
|
|
1329
|
-
}
|
|
1330
|
-
decodedPath = strippedPath;
|
|
1331
|
-
}
|
|
1332
|
-
if (build.prerender.length === 0) {
|
|
1333
|
-
isSpaMode = true;
|
|
1334
|
-
} else if (!build.prerender.includes(decodedPath) && !build.prerender.includes(decodedPath + "/")) {
|
|
1335
|
-
if (url.pathname.endsWith(".data")) {
|
|
1336
|
-
errorHandler(
|
|
1337
|
-
new ErrorResponseImpl(
|
|
1338
|
-
404,
|
|
1339
|
-
"Not Found",
|
|
1340
|
-
`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.`
|
|
1341
|
-
),
|
|
1342
|
-
{
|
|
1343
|
-
context: loadContext,
|
|
1344
|
-
params,
|
|
1345
|
-
request
|
|
1346
|
-
}
|
|
1347
|
-
);
|
|
1348
|
-
return new Response("Not Found", {
|
|
1349
|
-
status: 404,
|
|
1350
|
-
statusText: "Not Found"
|
|
1351
|
-
});
|
|
1352
|
-
} else {
|
|
1353
|
-
isSpaMode = true;
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
let manifestUrl = getManifestPath(
|
|
1358
|
-
build.routeDiscovery.manifestPath,
|
|
1359
|
-
normalizedBasename
|
|
1360
|
-
);
|
|
1361
|
-
if (url.pathname === manifestUrl) {
|
|
1362
|
-
try {
|
|
1363
|
-
let res = await handleManifestRequest(build, routes, url);
|
|
1364
|
-
return res;
|
|
1365
|
-
} catch (e) {
|
|
1366
|
-
handleError(e);
|
|
1367
|
-
return new Response("Unknown Server Error", { status: 500 });
|
|
1368
|
-
}
|
|
1369
|
-
}
|
|
1370
|
-
let matches = matchServerRoutes(routes, normalizedPath, build.basename);
|
|
1371
|
-
if (matches && matches.length > 0) {
|
|
1372
|
-
Object.assign(params, matches[0].params);
|
|
1373
|
-
}
|
|
1374
|
-
let response;
|
|
1375
|
-
if (url.pathname.endsWith(".data")) {
|
|
1376
|
-
let handlerUrl = new URL(request.url);
|
|
1377
|
-
handlerUrl.pathname = normalizedPath;
|
|
1378
|
-
let singleFetchMatches = matchServerRoutes(
|
|
1379
|
-
routes,
|
|
1380
|
-
handlerUrl.pathname,
|
|
1381
|
-
build.basename
|
|
1382
|
-
);
|
|
1383
|
-
response = await handleSingleFetchRequest(
|
|
1384
|
-
serverMode,
|
|
1385
|
-
build,
|
|
1386
|
-
staticHandler,
|
|
1387
|
-
request,
|
|
1388
|
-
handlerUrl,
|
|
1389
|
-
loadContext,
|
|
1390
|
-
handleError
|
|
1391
|
-
);
|
|
1392
|
-
if (isRedirectResponse(response)) {
|
|
1393
|
-
response = generateSingleFetchRedirectResponse(
|
|
1394
|
-
response,
|
|
1395
|
-
request,
|
|
1396
|
-
build,
|
|
1397
|
-
serverMode
|
|
1398
|
-
);
|
|
1399
|
-
}
|
|
1400
|
-
if (build.entry.module.handleDataRequest) {
|
|
1401
|
-
response = await build.entry.module.handleDataRequest(response, {
|
|
1402
|
-
context: loadContext,
|
|
1403
|
-
params: singleFetchMatches ? singleFetchMatches[0].params : {},
|
|
1404
|
-
request
|
|
1405
|
-
});
|
|
1406
|
-
if (isRedirectResponse(response)) {
|
|
1407
|
-
response = generateSingleFetchRedirectResponse(
|
|
1408
|
-
response,
|
|
1409
|
-
request,
|
|
1410
|
-
build,
|
|
1411
|
-
serverMode
|
|
1412
|
-
);
|
|
1413
|
-
}
|
|
1414
|
-
}
|
|
1415
|
-
} else if (!isSpaMode && matches && matches[matches.length - 1].route.module.default == null && matches[matches.length - 1].route.module.ErrorBoundary == null) {
|
|
1416
|
-
response = await handleResourceRequest(
|
|
1417
|
-
serverMode,
|
|
1418
|
-
build,
|
|
1419
|
-
staticHandler,
|
|
1420
|
-
matches.slice(-1)[0].route.id,
|
|
1421
|
-
request,
|
|
1422
|
-
loadContext,
|
|
1423
|
-
handleError
|
|
1424
|
-
);
|
|
1425
|
-
} else {
|
|
1426
|
-
let { pathname } = url;
|
|
1427
|
-
let criticalCss = void 0;
|
|
1428
|
-
if (build.unstable_getCriticalCss) {
|
|
1429
|
-
criticalCss = await build.unstable_getCriticalCss({ pathname });
|
|
1430
|
-
} else if (mode === "development" && getDevServerHooks()?.getCriticalCss) {
|
|
1431
|
-
criticalCss = await getDevServerHooks()?.getCriticalCss?.(pathname);
|
|
1432
|
-
}
|
|
1433
|
-
response = await handleDocumentRequest(
|
|
1434
|
-
serverMode,
|
|
1435
|
-
build,
|
|
1436
|
-
staticHandler,
|
|
1437
|
-
request,
|
|
1438
|
-
loadContext,
|
|
1439
|
-
handleError,
|
|
1440
|
-
isSpaMode,
|
|
1441
|
-
criticalCss
|
|
1442
|
-
);
|
|
1443
|
-
}
|
|
1444
|
-
if (request.method === "HEAD") {
|
|
1445
|
-
return new Response(null, {
|
|
1446
|
-
headers: response.headers,
|
|
1447
|
-
status: response.status,
|
|
1448
|
-
statusText: response.statusText
|
|
1449
|
-
});
|
|
1450
|
-
}
|
|
1451
|
-
return response;
|
|
1452
|
-
};
|
|
1453
|
-
if (build.entry.module.unstable_instrumentations) {
|
|
1454
|
-
requestHandler = instrumentHandler(
|
|
1455
|
-
requestHandler,
|
|
1456
|
-
build.entry.module.unstable_instrumentations.map((i) => i.handler).filter(Boolean)
|
|
1457
|
-
);
|
|
1458
|
-
}
|
|
1459
|
-
return {
|
|
1460
|
-
routes,
|
|
1461
|
-
dataRoutes,
|
|
1462
|
-
serverMode,
|
|
1463
|
-
staticHandler,
|
|
1464
|
-
errorHandler,
|
|
1465
|
-
requestHandler
|
|
1466
|
-
};
|
|
1467
|
-
}
|
|
1468
|
-
var createRequestHandler = (build, mode) => {
|
|
1469
|
-
let _build;
|
|
1470
|
-
let routes;
|
|
1471
|
-
let serverMode;
|
|
1472
|
-
let staticHandler;
|
|
1473
|
-
let errorHandler;
|
|
1474
|
-
let _requestHandler;
|
|
1475
|
-
return async function requestHandler(request, initialContext) {
|
|
1476
|
-
_build = typeof build === "function" ? await build() : build;
|
|
1477
|
-
if (typeof build === "function") {
|
|
1478
|
-
let derived = derive(_build, mode);
|
|
1479
|
-
routes = derived.routes;
|
|
1480
|
-
serverMode = derived.serverMode;
|
|
1481
|
-
staticHandler = derived.staticHandler;
|
|
1482
|
-
errorHandler = derived.errorHandler;
|
|
1483
|
-
_requestHandler = derived.requestHandler;
|
|
1484
|
-
} else if (!routes || !serverMode || !staticHandler || !errorHandler || !_requestHandler) {
|
|
1485
|
-
let derived = derive(_build, mode);
|
|
1486
|
-
routes = derived.routes;
|
|
1487
|
-
serverMode = derived.serverMode;
|
|
1488
|
-
staticHandler = derived.staticHandler;
|
|
1489
|
-
errorHandler = derived.errorHandler;
|
|
1490
|
-
_requestHandler = derived.requestHandler;
|
|
1491
|
-
}
|
|
1492
|
-
return _requestHandler(request, initialContext);
|
|
1493
|
-
};
|
|
1494
|
-
};
|
|
1495
|
-
async function handleManifestRequest(build, routes, url) {
|
|
1496
|
-
if (build.assets.version !== url.searchParams.get("version")) {
|
|
1497
|
-
return new Response(null, {
|
|
1498
|
-
status: 204,
|
|
1499
|
-
headers: {
|
|
1500
|
-
"X-Remix-Reload-Document": "true"
|
|
1501
|
-
}
|
|
1502
|
-
});
|
|
1503
|
-
}
|
|
1504
|
-
let patches = {};
|
|
1505
|
-
if (url.searchParams.has("paths")) {
|
|
1506
|
-
let paths = /* @__PURE__ */ new Set();
|
|
1507
|
-
let pathParam = url.searchParams.get("paths") || "";
|
|
1508
|
-
let requestedPaths = pathParam.split(",").filter(Boolean);
|
|
1509
|
-
requestedPaths.forEach((path) => {
|
|
1510
|
-
if (!path.startsWith("/")) {
|
|
1511
|
-
path = `/${path}`;
|
|
1512
|
-
}
|
|
1513
|
-
let segments = path.split("/").slice(1);
|
|
1514
|
-
segments.forEach((_, i) => {
|
|
1515
|
-
let partialPath = segments.slice(0, i + 1).join("/");
|
|
1516
|
-
paths.add(`/${partialPath}`);
|
|
1517
|
-
});
|
|
1518
|
-
});
|
|
1519
|
-
for (let path of paths) {
|
|
1520
|
-
let matches = matchServerRoutes(routes, path, build.basename);
|
|
1521
|
-
if (matches) {
|
|
1522
|
-
for (let match of matches) {
|
|
1523
|
-
let routeId = match.route.id;
|
|
1524
|
-
let route = build.assets.routes[routeId];
|
|
1525
|
-
if (route) {
|
|
1526
|
-
patches[routeId] = route;
|
|
1527
|
-
}
|
|
1528
|
-
}
|
|
1529
|
-
}
|
|
1530
|
-
}
|
|
1531
|
-
return Response.json(patches, {
|
|
1532
|
-
headers: {
|
|
1533
|
-
"Cache-Control": "public, max-age=31536000, immutable"
|
|
1534
|
-
}
|
|
1535
|
-
});
|
|
1536
|
-
}
|
|
1537
|
-
return new Response("Invalid Request", { status: 400 });
|
|
1538
|
-
}
|
|
1539
|
-
async function handleSingleFetchRequest(serverMode, build, staticHandler, request, handlerUrl, loadContext, handleError) {
|
|
1540
|
-
let response = request.method !== "GET" ? await singleFetchAction(
|
|
1541
|
-
build,
|
|
1542
|
-
serverMode,
|
|
1543
|
-
staticHandler,
|
|
1544
|
-
request,
|
|
1545
|
-
handlerUrl,
|
|
1546
|
-
loadContext,
|
|
1547
|
-
handleError
|
|
1548
|
-
) : await singleFetchLoaders(
|
|
1549
|
-
build,
|
|
1550
|
-
serverMode,
|
|
1551
|
-
staticHandler,
|
|
1552
|
-
request,
|
|
1553
|
-
handlerUrl,
|
|
1554
|
-
loadContext,
|
|
1555
|
-
handleError
|
|
1556
|
-
);
|
|
1557
|
-
return response;
|
|
1558
|
-
}
|
|
1559
|
-
async function handleDocumentRequest(serverMode, build, staticHandler, request, loadContext, handleError, isSpaMode, criticalCss) {
|
|
1560
|
-
try {
|
|
1561
|
-
let result = await staticHandler.query(request, {
|
|
1562
|
-
requestContext: loadContext,
|
|
1563
|
-
generateMiddlewareResponse: build.future.v8_middleware ? async (query) => {
|
|
1564
|
-
try {
|
|
1565
|
-
let innerResult = await query(request);
|
|
1566
|
-
if (!isResponse(innerResult)) {
|
|
1567
|
-
innerResult = await renderHtml(innerResult, isSpaMode);
|
|
1568
|
-
}
|
|
1569
|
-
return innerResult;
|
|
1570
|
-
} catch (error) {
|
|
1571
|
-
handleError(error);
|
|
1572
|
-
return new Response(null, { status: 500 });
|
|
1573
|
-
}
|
|
1574
|
-
} : void 0
|
|
1575
|
-
});
|
|
1576
|
-
if (!isResponse(result)) {
|
|
1577
|
-
result = await renderHtml(result, isSpaMode);
|
|
1578
|
-
}
|
|
1579
|
-
return result;
|
|
1580
|
-
} catch (error) {
|
|
1581
|
-
handleError(error);
|
|
1582
|
-
return new Response(null, { status: 500 });
|
|
1583
|
-
}
|
|
1584
|
-
async function renderHtml(context, isSpaMode2) {
|
|
1585
|
-
let headers = getDocumentHeaders(context, build);
|
|
1586
|
-
if (SERVER_NO_BODY_STATUS_CODES.has(context.statusCode)) {
|
|
1587
|
-
return new Response(null, { status: context.statusCode, headers });
|
|
1588
|
-
}
|
|
1589
|
-
if (context.errors) {
|
|
1590
|
-
Object.values(context.errors).forEach((err) => {
|
|
1591
|
-
if (!isRouteErrorResponse(err) || err.error) {
|
|
1592
|
-
handleError(err);
|
|
1593
|
-
}
|
|
1594
|
-
});
|
|
1595
|
-
context.errors = sanitizeErrors(context.errors, serverMode);
|
|
1596
|
-
}
|
|
1597
|
-
let state = {
|
|
1598
|
-
loaderData: context.loaderData,
|
|
1599
|
-
actionData: context.actionData,
|
|
1600
|
-
errors: serializeErrors(context.errors, serverMode)
|
|
1601
|
-
};
|
|
1602
|
-
let baseServerHandoff = {
|
|
1603
|
-
basename: build.basename,
|
|
1604
|
-
future: build.future,
|
|
1605
|
-
routeDiscovery: build.routeDiscovery,
|
|
1606
|
-
ssr: build.ssr,
|
|
1607
|
-
isSpaMode: isSpaMode2
|
|
1608
|
-
};
|
|
1609
|
-
let entryContext = {
|
|
1610
|
-
manifest: build.assets,
|
|
1611
|
-
routeModules: createEntryRouteModules(build.routes),
|
|
1612
|
-
staticHandlerContext: context,
|
|
1613
|
-
criticalCss,
|
|
1614
|
-
serverHandoffString: createServerHandoffString({
|
|
1615
|
-
...baseServerHandoff,
|
|
1616
|
-
criticalCss
|
|
1617
|
-
}),
|
|
1618
|
-
serverHandoffStream: encodeViaTurboStream(
|
|
1619
|
-
state,
|
|
1620
|
-
request.signal,
|
|
1621
|
-
build.entry.module.streamTimeout,
|
|
1622
|
-
serverMode
|
|
1623
|
-
),
|
|
1624
|
-
renderMeta: {},
|
|
1625
|
-
future: build.future,
|
|
1626
|
-
ssr: build.ssr,
|
|
1627
|
-
routeDiscovery: build.routeDiscovery,
|
|
1628
|
-
isSpaMode: isSpaMode2,
|
|
1629
|
-
serializeError: (err) => serializeError(err, serverMode)
|
|
1630
|
-
};
|
|
1631
|
-
let handleDocumentRequestFunction = build.entry.module.default;
|
|
1632
|
-
try {
|
|
1633
|
-
return await handleDocumentRequestFunction(
|
|
1634
|
-
request,
|
|
1635
|
-
context.statusCode,
|
|
1636
|
-
headers,
|
|
1637
|
-
entryContext,
|
|
1638
|
-
loadContext
|
|
1639
|
-
);
|
|
1640
|
-
} catch (error) {
|
|
1641
|
-
handleError(error);
|
|
1642
|
-
let errorForSecondRender = error;
|
|
1643
|
-
if (isResponse(error)) {
|
|
1644
|
-
try {
|
|
1645
|
-
let data2 = await unwrapResponse(error);
|
|
1646
|
-
errorForSecondRender = new ErrorResponseImpl(
|
|
1647
|
-
error.status,
|
|
1648
|
-
error.statusText,
|
|
1649
|
-
data2
|
|
1650
|
-
);
|
|
1651
|
-
} catch (e) {
|
|
1652
|
-
}
|
|
1653
|
-
}
|
|
1654
|
-
context = getStaticContextFromError(
|
|
1655
|
-
staticHandler.dataRoutes,
|
|
1656
|
-
context,
|
|
1657
|
-
errorForSecondRender
|
|
1658
|
-
);
|
|
1659
|
-
if (context.errors) {
|
|
1660
|
-
context.errors = sanitizeErrors(context.errors, serverMode);
|
|
1661
|
-
}
|
|
1662
|
-
let state2 = {
|
|
1663
|
-
loaderData: context.loaderData,
|
|
1664
|
-
actionData: context.actionData,
|
|
1665
|
-
errors: serializeErrors(context.errors, serverMode)
|
|
1666
|
-
};
|
|
1667
|
-
entryContext = {
|
|
1668
|
-
...entryContext,
|
|
1669
|
-
staticHandlerContext: context,
|
|
1670
|
-
serverHandoffString: createServerHandoffString(baseServerHandoff),
|
|
1671
|
-
serverHandoffStream: encodeViaTurboStream(
|
|
1672
|
-
state2,
|
|
1673
|
-
request.signal,
|
|
1674
|
-
build.entry.module.streamTimeout,
|
|
1675
|
-
serverMode
|
|
1676
|
-
),
|
|
1677
|
-
renderMeta: {}
|
|
1678
|
-
};
|
|
1679
|
-
try {
|
|
1680
|
-
return await handleDocumentRequestFunction(
|
|
1681
|
-
request,
|
|
1682
|
-
context.statusCode,
|
|
1683
|
-
headers,
|
|
1684
|
-
entryContext,
|
|
1685
|
-
loadContext
|
|
1686
|
-
);
|
|
1687
|
-
} catch (error2) {
|
|
1688
|
-
handleError(error2);
|
|
1689
|
-
return returnLastResortErrorResponse(error2, serverMode);
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
async function handleResourceRequest(serverMode, build, staticHandler, routeId, request, loadContext, handleError) {
|
|
1695
|
-
try {
|
|
1696
|
-
let result = await staticHandler.queryRoute(request, {
|
|
1697
|
-
routeId,
|
|
1698
|
-
requestContext: loadContext,
|
|
1699
|
-
generateMiddlewareResponse: build.future.v8_middleware ? async (queryRoute) => {
|
|
1700
|
-
try {
|
|
1701
|
-
let innerResult = await queryRoute(request);
|
|
1702
|
-
return handleQueryRouteResult(innerResult);
|
|
1703
|
-
} catch (error) {
|
|
1704
|
-
return handleQueryRouteError(error);
|
|
1705
|
-
}
|
|
1706
|
-
} : void 0
|
|
1707
|
-
});
|
|
1708
|
-
return handleQueryRouteResult(result);
|
|
1709
|
-
} catch (error) {
|
|
1710
|
-
return handleQueryRouteError(error);
|
|
1711
|
-
}
|
|
1712
|
-
function handleQueryRouteResult(result) {
|
|
1713
|
-
if (isResponse(result)) {
|
|
1714
|
-
return result;
|
|
1715
|
-
}
|
|
1716
|
-
if (typeof result === "string") {
|
|
1717
|
-
return new Response(result);
|
|
1718
|
-
}
|
|
1719
|
-
return Response.json(result);
|
|
1720
|
-
}
|
|
1721
|
-
function handleQueryRouteError(error) {
|
|
1722
|
-
if (isResponse(error)) {
|
|
1723
|
-
return error;
|
|
1724
|
-
}
|
|
1725
|
-
if (isRouteErrorResponse(error)) {
|
|
1726
|
-
handleError(error);
|
|
1727
|
-
return errorResponseToJson(error, serverMode);
|
|
1728
|
-
}
|
|
1729
|
-
if (error instanceof Error && error.message === "Expected a response from queryRoute") {
|
|
1730
|
-
let newError = new Error(
|
|
1731
|
-
"Expected a Response to be returned from resource route handler"
|
|
1732
|
-
);
|
|
1733
|
-
handleError(newError);
|
|
1734
|
-
return returnLastResortErrorResponse(newError, serverMode);
|
|
1735
|
-
}
|
|
1736
|
-
handleError(error);
|
|
1737
|
-
return returnLastResortErrorResponse(error, serverMode);
|
|
1738
|
-
}
|
|
1739
|
-
}
|
|
1740
|
-
function errorResponseToJson(errorResponse, serverMode) {
|
|
1741
|
-
return Response.json(
|
|
1742
|
-
serializeError(
|
|
1743
|
-
// @ts-expect-error This is "private" from users but intended for internal use
|
|
1744
|
-
errorResponse.error || new Error("Unexpected Server Error"),
|
|
1745
|
-
serverMode
|
|
1746
|
-
),
|
|
1747
|
-
{
|
|
1748
|
-
status: errorResponse.status,
|
|
1749
|
-
statusText: errorResponse.statusText
|
|
1750
|
-
}
|
|
1751
|
-
);
|
|
1752
|
-
}
|
|
1753
|
-
function returnLastResortErrorResponse(error, serverMode) {
|
|
1754
|
-
let message = "Unexpected Server Error";
|
|
1755
|
-
if (serverMode !== "production") {
|
|
1756
|
-
message += `
|
|
1757
|
-
|
|
1758
|
-
${String(error)}`;
|
|
1759
|
-
}
|
|
1760
|
-
return new Response(message, {
|
|
1761
|
-
status: 500,
|
|
1762
|
-
headers: {
|
|
1763
|
-
"Content-Type": "text/plain"
|
|
1764
|
-
}
|
|
1765
|
-
});
|
|
1766
|
-
}
|
|
1767
|
-
function unwrapResponse(response) {
|
|
1768
|
-
let contentType = response.headers.get("Content-Type");
|
|
1769
|
-
return contentType && /\bapplication\/json\b/.test(contentType) ? response.body == null ? null : response.json() : response.text();
|
|
1770
|
-
}
|
|
1771
|
-
function flash(name) {
|
|
1772
|
-
return `__flash_${name}__`;
|
|
1773
|
-
}
|
|
1774
|
-
var createSession = (initialData = {}, id = "") => {
|
|
1775
|
-
let map = new Map(Object.entries(initialData));
|
|
1776
|
-
return {
|
|
1777
|
-
get id() {
|
|
1778
|
-
return id;
|
|
1779
|
-
},
|
|
1780
|
-
get data() {
|
|
1781
|
-
return Object.fromEntries(map);
|
|
1782
|
-
},
|
|
1783
|
-
has(name) {
|
|
1784
|
-
return map.has(name) || map.has(flash(name));
|
|
1785
|
-
},
|
|
1786
|
-
get(name) {
|
|
1787
|
-
if (map.has(name)) return map.get(name);
|
|
1788
|
-
let flashName = flash(name);
|
|
1789
|
-
if (map.has(flashName)) {
|
|
1790
|
-
let value = map.get(flashName);
|
|
1791
|
-
map.delete(flashName);
|
|
1792
|
-
return value;
|
|
1793
|
-
}
|
|
1794
|
-
return void 0;
|
|
1795
|
-
},
|
|
1796
|
-
set(name, value) {
|
|
1797
|
-
map.set(name, value);
|
|
1798
|
-
},
|
|
1799
|
-
flash(name, value) {
|
|
1800
|
-
map.set(flash(name), value);
|
|
1801
|
-
},
|
|
1802
|
-
unset(name) {
|
|
1803
|
-
map.delete(name);
|
|
1804
|
-
}
|
|
1805
|
-
};
|
|
1806
|
-
};
|
|
1807
|
-
var isSession = (object) => {
|
|
1808
|
-
return object != null && typeof object.id === "string" && typeof object.data !== "undefined" && typeof object.has === "function" && typeof object.get === "function" && typeof object.set === "function" && typeof object.flash === "function" && typeof object.unset === "function";
|
|
1809
|
-
};
|
|
1810
|
-
function createSessionStorage({
|
|
1811
|
-
cookie: cookieArg,
|
|
1812
|
-
createData,
|
|
1813
|
-
readData,
|
|
1814
|
-
updateData,
|
|
1815
|
-
deleteData
|
|
1816
|
-
}) {
|
|
1817
|
-
let cookie = isCookie(cookieArg) ? cookieArg : createCookie(cookieArg?.name || "__session", cookieArg);
|
|
1818
|
-
warnOnceAboutSigningSessionCookie(cookie);
|
|
1819
|
-
return {
|
|
1820
|
-
async getSession(cookieHeader, options) {
|
|
1821
|
-
let id = cookieHeader && await cookie.parse(cookieHeader, options);
|
|
1822
|
-
let data2 = id && await readData(id);
|
|
1823
|
-
return createSession(data2 || {}, id || "");
|
|
1824
|
-
},
|
|
1825
|
-
async commitSession(session, options) {
|
|
1826
|
-
let { id, data: data2 } = session;
|
|
1827
|
-
let expires = options?.maxAge != null ? new Date(Date.now() + options.maxAge * 1e3) : options?.expires != null ? options.expires : cookie.expires;
|
|
1828
|
-
if (id) {
|
|
1829
|
-
await updateData(id, data2, expires);
|
|
1830
|
-
} else {
|
|
1831
|
-
id = await createData(data2, expires);
|
|
1832
|
-
}
|
|
1833
|
-
return cookie.serialize(id, options);
|
|
1834
|
-
},
|
|
1835
|
-
async destroySession(session, options) {
|
|
1836
|
-
await deleteData(session.id);
|
|
1837
|
-
return cookie.serialize("", {
|
|
1838
|
-
...options,
|
|
1839
|
-
maxAge: void 0,
|
|
1840
|
-
expires: /* @__PURE__ */ new Date(0)
|
|
1841
|
-
});
|
|
1842
|
-
}
|
|
1843
|
-
};
|
|
1844
|
-
}
|
|
1845
|
-
function warnOnceAboutSigningSessionCookie(cookie) {
|
|
1846
|
-
warnOnce(
|
|
1847
|
-
cookie.isSigned,
|
|
1848
|
-
`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.`
|
|
1849
|
-
);
|
|
1850
|
-
}
|
|
1851
|
-
function createCookieSessionStorage({ cookie: cookieArg } = {}) {
|
|
1852
|
-
let cookie = isCookie(cookieArg) ? cookieArg : createCookie(cookieArg?.name || "__session", cookieArg);
|
|
1853
|
-
warnOnceAboutSigningSessionCookie(cookie);
|
|
1854
|
-
return {
|
|
1855
|
-
async getSession(cookieHeader, options) {
|
|
1856
|
-
return createSession(
|
|
1857
|
-
cookieHeader && await cookie.parse(cookieHeader, options) || {}
|
|
1858
|
-
);
|
|
1859
|
-
},
|
|
1860
|
-
async commitSession(session, options) {
|
|
1861
|
-
let serializedCookie = await cookie.serialize(session.data, options);
|
|
1862
|
-
if (serializedCookie.length > 4096) {
|
|
1863
|
-
throw new Error(
|
|
1864
|
-
"Cookie length will exceed browser maximum. Length: " + serializedCookie.length
|
|
1865
|
-
);
|
|
1866
|
-
}
|
|
1867
|
-
return serializedCookie;
|
|
1868
|
-
},
|
|
1869
|
-
async destroySession(_session, options) {
|
|
1870
|
-
return cookie.serialize("", {
|
|
1871
|
-
...options,
|
|
1872
|
-
maxAge: void 0,
|
|
1873
|
-
expires: /* @__PURE__ */ new Date(0)
|
|
1874
|
-
});
|
|
1875
|
-
}
|
|
1876
|
-
};
|
|
1877
|
-
}
|
|
1878
|
-
function createMemorySessionStorage({ cookie } = {}) {
|
|
1879
|
-
let map = /* @__PURE__ */ new Map();
|
|
1880
|
-
return createSessionStorage({
|
|
1881
|
-
cookie,
|
|
1882
|
-
async createData(data2, expires) {
|
|
1883
|
-
let id = Math.random().toString(36).substring(2, 10);
|
|
1884
|
-
map.set(id, { data: data2, expires });
|
|
1885
|
-
return id;
|
|
1886
|
-
},
|
|
1887
|
-
async readData(id) {
|
|
1888
|
-
if (map.has(id)) {
|
|
1889
|
-
let { data: data2, expires } = map.get(id);
|
|
1890
|
-
if (!expires || expires > /* @__PURE__ */ new Date()) {
|
|
1891
|
-
return data2;
|
|
1892
|
-
}
|
|
1893
|
-
if (expires) map.delete(id);
|
|
1894
|
-
}
|
|
1895
|
-
return null;
|
|
1896
|
-
},
|
|
1897
|
-
async updateData(id, data2, expires) {
|
|
1898
|
-
map.set(id, { data: data2, expires });
|
|
1899
|
-
},
|
|
1900
|
-
async deleteData(id) {
|
|
1901
|
-
map.delete(id);
|
|
1902
|
-
}
|
|
1903
|
-
});
|
|
1904
|
-
}
|
|
1905
|
-
function href(path, ...args) {
|
|
1906
|
-
let params = args[0];
|
|
1907
|
-
let result = path.replace(/\/*\*?$/, "").replace(
|
|
1908
|
-
/\/:([\w-]+)(\?)?/g,
|
|
1909
|
-
// same regex as in .\router\utils.ts: compilePath().
|
|
1910
|
-
(_, param, questionMark) => {
|
|
1911
|
-
const isRequired = questionMark === void 0;
|
|
1912
|
-
const value = params ? params[param] : void 0;
|
|
1913
|
-
if (isRequired && value === void 0) {
|
|
1914
|
-
throw new Error(
|
|
1915
|
-
`Path '${path}' requires param '${param}' but it was not provided`
|
|
1916
|
-
);
|
|
1917
|
-
}
|
|
1918
|
-
return value === void 0 ? "" : "/" + value;
|
|
1919
|
-
}
|
|
1920
|
-
);
|
|
1921
|
-
if (path.endsWith("*")) {
|
|
1922
|
-
const value = params ? params["*"] : void 0;
|
|
1923
|
-
if (value !== void 0) {
|
|
1924
|
-
result += "/" + value;
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1927
|
-
return result || "/";
|
|
1928
|
-
}
|
|
1929
|
-
var encoder2 = new TextEncoder();
|
|
1930
|
-
var trailer = "</body></html>";
|
|
1931
|
-
function injectRSCPayload(rscStream) {
|
|
1932
|
-
let decoder = new TextDecoder();
|
|
1933
|
-
let resolveFlightDataPromise;
|
|
1934
|
-
let flightDataPromise = new Promise(
|
|
1935
|
-
(resolve) => resolveFlightDataPromise = resolve
|
|
1936
|
-
);
|
|
1937
|
-
let startedRSC = false;
|
|
1938
|
-
let buffered = [];
|
|
1939
|
-
let timeout = null;
|
|
1940
|
-
function flushBufferedChunks(controller) {
|
|
1941
|
-
for (let chunk of buffered) {
|
|
1942
|
-
let buf = decoder.decode(chunk, { stream: true });
|
|
1943
|
-
if (buf.endsWith(trailer)) {
|
|
1944
|
-
buf = buf.slice(0, -trailer.length);
|
|
1945
|
-
}
|
|
1946
|
-
controller.enqueue(encoder2.encode(buf));
|
|
1947
|
-
}
|
|
1948
|
-
buffered.length = 0;
|
|
1949
|
-
timeout = null;
|
|
1950
|
-
}
|
|
1951
|
-
return new TransformStream({
|
|
1952
|
-
transform(chunk, controller) {
|
|
1953
|
-
buffered.push(chunk);
|
|
1954
|
-
if (timeout) {
|
|
1955
|
-
return;
|
|
1956
|
-
}
|
|
1957
|
-
timeout = setTimeout(async () => {
|
|
1958
|
-
flushBufferedChunks(controller);
|
|
1959
|
-
if (!startedRSC) {
|
|
1960
|
-
startedRSC = true;
|
|
1961
|
-
writeRSCStream(rscStream, controller).catch((err) => controller.error(err)).then(resolveFlightDataPromise);
|
|
1962
|
-
}
|
|
1963
|
-
}, 0);
|
|
1964
|
-
},
|
|
1965
|
-
async flush(controller) {
|
|
1966
|
-
await flightDataPromise;
|
|
1967
|
-
if (timeout) {
|
|
1968
|
-
clearTimeout(timeout);
|
|
1969
|
-
flushBufferedChunks(controller);
|
|
1970
|
-
}
|
|
1971
|
-
controller.enqueue(encoder2.encode("</body></html>"));
|
|
1972
|
-
}
|
|
1973
|
-
});
|
|
1974
|
-
}
|
|
1975
|
-
async function writeRSCStream(rscStream, controller) {
|
|
1976
|
-
let decoder = new TextDecoder("utf-8", { fatal: true });
|
|
1977
|
-
const reader = rscStream.getReader();
|
|
1978
|
-
try {
|
|
1979
|
-
let read;
|
|
1980
|
-
while ((read = await reader.read()) && !read.done) {
|
|
1981
|
-
const chunk = read.value;
|
|
1982
|
-
try {
|
|
1983
|
-
writeChunk(
|
|
1984
|
-
JSON.stringify(decoder.decode(chunk, { stream: true })),
|
|
1985
|
-
controller
|
|
1986
|
-
);
|
|
1987
|
-
} catch (err) {
|
|
1988
|
-
let base64 = JSON.stringify(btoa(String.fromCodePoint(...chunk)));
|
|
1989
|
-
writeChunk(
|
|
1990
|
-
`Uint8Array.from(atob(${base64}), m => m.codePointAt(0))`,
|
|
1991
|
-
controller
|
|
1992
|
-
);
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
} finally {
|
|
1996
|
-
reader.releaseLock();
|
|
1997
|
-
}
|
|
1998
|
-
let remaining = decoder.decode();
|
|
1999
|
-
if (remaining.length) {
|
|
2000
|
-
writeChunk(JSON.stringify(remaining), controller);
|
|
2001
|
-
}
|
|
2002
|
-
}
|
|
2003
|
-
function writeChunk(chunk, controller) {
|
|
2004
|
-
controller.enqueue(
|
|
2005
|
-
encoder2.encode(
|
|
2006
|
-
`<script>${escapeScript(
|
|
2007
|
-
`(self.__FLIGHT_DATA||=[]).push(${chunk})`
|
|
2008
|
-
)}<\/script>`
|
|
2009
|
-
)
|
|
2010
|
-
);
|
|
2011
|
-
}
|
|
2012
|
-
function escapeScript(script) {
|
|
2013
|
-
return script.replace(/<!--/g, "<\\!--").replace(/<\/(script)/gi, "</\\$1");
|
|
2014
|
-
}
|
|
2015
|
-
var RSCRouterGlobalErrorBoundary = class extends re.Component {
|
|
2016
|
-
constructor(props) {
|
|
2017
|
-
super(props);
|
|
2018
|
-
this.state = { error: null, location: props.location };
|
|
2019
|
-
}
|
|
2020
|
-
static getDerivedStateFromError(error) {
|
|
2021
|
-
return { error };
|
|
2022
|
-
}
|
|
2023
|
-
static getDerivedStateFromProps(props, state) {
|
|
2024
|
-
if (state.location !== props.location) {
|
|
2025
|
-
return { error: null, location: props.location };
|
|
2026
|
-
}
|
|
2027
|
-
return { error: state.error, location: state.location };
|
|
2028
|
-
}
|
|
2029
|
-
render() {
|
|
2030
|
-
if (this.state.error) {
|
|
2031
|
-
return /* @__PURE__ */ re.createElement(
|
|
2032
|
-
RSCDefaultRootErrorBoundaryImpl,
|
|
2033
|
-
{
|
|
2034
|
-
error: this.state.error,
|
|
2035
|
-
renderAppShell: true
|
|
2036
|
-
}
|
|
2037
|
-
);
|
|
2038
|
-
} else {
|
|
2039
|
-
return this.props.children;
|
|
2040
|
-
}
|
|
2041
|
-
}
|
|
2042
|
-
};
|
|
2043
|
-
function ErrorWrapper({
|
|
2044
|
-
renderAppShell,
|
|
2045
|
-
title,
|
|
2046
|
-
children
|
|
2047
|
-
}) {
|
|
2048
|
-
if (!renderAppShell) {
|
|
2049
|
-
return children;
|
|
2050
|
-
}
|
|
2051
|
-
return /* @__PURE__ */ re.createElement("html", { lang: "en" }, /* @__PURE__ */ re.createElement("head", null, /* @__PURE__ */ re.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ re.createElement(
|
|
2052
|
-
"meta",
|
|
2053
|
-
{
|
|
2054
|
-
name: "viewport",
|
|
2055
|
-
content: "width=device-width,initial-scale=1,viewport-fit=cover"
|
|
2056
|
-
}
|
|
2057
|
-
), /* @__PURE__ */ re.createElement("title", null, title)), /* @__PURE__ */ re.createElement("body", null, /* @__PURE__ */ re.createElement("main", { style: { fontFamily: "system-ui, sans-serif", padding: "2rem" } }, children)));
|
|
2058
|
-
}
|
|
2059
|
-
function RSCDefaultRootErrorBoundaryImpl({
|
|
2060
|
-
error,
|
|
2061
|
-
renderAppShell
|
|
2062
|
-
}) {
|
|
2063
|
-
console.error(error);
|
|
2064
|
-
let heyDeveloper = /* @__PURE__ */ re.createElement(
|
|
2065
|
-
"script",
|
|
2066
|
-
{
|
|
2067
|
-
dangerouslySetInnerHTML: {
|
|
2068
|
-
__html: `
|
|
2069
|
-
console.log(
|
|
2070
|
-
"💿 Hey developer 👋. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information."
|
|
2071
|
-
);
|
|
2072
|
-
`
|
|
2073
|
-
}
|
|
2074
|
-
}
|
|
2075
|
-
);
|
|
2076
|
-
if (isRouteErrorResponse(error)) {
|
|
2077
|
-
return /* @__PURE__ */ re.createElement(
|
|
2078
|
-
ErrorWrapper,
|
|
2079
|
-
{
|
|
2080
|
-
renderAppShell,
|
|
2081
|
-
title: "Unhandled Thrown Response!"
|
|
2082
|
-
},
|
|
2083
|
-
/* @__PURE__ */ re.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText),
|
|
2084
|
-
heyDeveloper
|
|
2085
|
-
);
|
|
2086
|
-
}
|
|
2087
|
-
let errorInstance;
|
|
2088
|
-
if (error instanceof Error) {
|
|
2089
|
-
errorInstance = error;
|
|
2090
|
-
} else {
|
|
2091
|
-
let errorString = error == null ? "Unknown Error" : typeof error === "object" && "toString" in error ? error.toString() : JSON.stringify(error);
|
|
2092
|
-
errorInstance = new Error(errorString);
|
|
2093
|
-
}
|
|
2094
|
-
return /* @__PURE__ */ re.createElement(ErrorWrapper, { renderAppShell, title: "Application Error!" }, /* @__PURE__ */ re.createElement("h1", { style: { fontSize: "24px" } }, "Application Error"), /* @__PURE__ */ re.createElement(
|
|
2095
|
-
"pre",
|
|
2096
|
-
{
|
|
2097
|
-
style: {
|
|
2098
|
-
padding: "2rem",
|
|
2099
|
-
background: "hsla(10, 50%, 50%, 0.1)",
|
|
2100
|
-
color: "red",
|
|
2101
|
-
overflow: "auto"
|
|
2102
|
-
}
|
|
2103
|
-
},
|
|
2104
|
-
errorInstance.stack
|
|
2105
|
-
), heyDeveloper);
|
|
2106
|
-
}
|
|
2107
|
-
function RSCDefaultRootErrorBoundary({
|
|
2108
|
-
hasRootLayout
|
|
2109
|
-
}) {
|
|
2110
|
-
let error = useRouteError();
|
|
2111
|
-
if (hasRootLayout === void 0) {
|
|
2112
|
-
throw new Error("Missing 'hasRootLayout' prop");
|
|
2113
|
-
}
|
|
2114
|
-
return /* @__PURE__ */ re.createElement(
|
|
2115
|
-
RSCDefaultRootErrorBoundaryImpl,
|
|
2116
|
-
{
|
|
2117
|
-
renderAppShell: !hasRootLayout,
|
|
2118
|
-
error
|
|
2119
|
-
}
|
|
2120
|
-
);
|
|
2121
|
-
}
|
|
2122
|
-
function createRSCRouteModules(payload) {
|
|
2123
|
-
const routeModules = {};
|
|
2124
|
-
for (const match of payload.matches) {
|
|
2125
|
-
populateRSCRouteModules(routeModules, match);
|
|
2126
|
-
}
|
|
2127
|
-
return routeModules;
|
|
2128
|
-
}
|
|
2129
|
-
function populateRSCRouteModules(routeModules, matches) {
|
|
2130
|
-
matches = Array.isArray(matches) ? matches : [matches];
|
|
2131
|
-
for (const match of matches) {
|
|
2132
|
-
routeModules[match.id] = {
|
|
2133
|
-
links: match.links,
|
|
2134
|
-
meta: match.meta,
|
|
2135
|
-
default: noopComponent
|
|
2136
|
-
};
|
|
2137
|
-
}
|
|
2138
|
-
}
|
|
2139
|
-
var noopComponent = () => null;
|
|
2140
|
-
var REACT_USE = "use";
|
|
2141
|
-
var useImpl = React[REACT_USE];
|
|
2142
|
-
function useSafe(promise) {
|
|
2143
|
-
if (useImpl) {
|
|
2144
|
-
return useImpl(promise);
|
|
2145
|
-
}
|
|
2146
|
-
throw new Error("React Router v7 requires React 19+ for RSC features.");
|
|
2147
|
-
}
|
|
2148
|
-
async function routeRSCServerRequest({
|
|
2149
|
-
request,
|
|
2150
|
-
fetchServer,
|
|
2151
|
-
createFromReadableStream,
|
|
2152
|
-
renderHTML,
|
|
2153
|
-
hydrate = true
|
|
2154
|
-
}) {
|
|
2155
|
-
const url = new URL(request.url);
|
|
2156
|
-
const isDataRequest = isReactServerRequest(url);
|
|
2157
|
-
const respondWithRSCPayload = isDataRequest || isManifestRequest(url) || request.headers.has("rsc-action-id");
|
|
2158
|
-
const serverResponse = await fetchServer(request);
|
|
2159
|
-
if (respondWithRSCPayload || serverResponse.headers.get("React-Router-Resource") === "true") {
|
|
2160
|
-
return serverResponse;
|
|
2161
|
-
}
|
|
2162
|
-
if (!serverResponse.body) {
|
|
2163
|
-
throw new Error("Missing body in server response");
|
|
2164
|
-
}
|
|
2165
|
-
const detectRedirectResponse = serverResponse.clone();
|
|
2166
|
-
let serverResponseB = null;
|
|
2167
|
-
if (hydrate) {
|
|
2168
|
-
serverResponseB = serverResponse.clone();
|
|
2169
|
-
}
|
|
2170
|
-
const body = serverResponse.body;
|
|
2171
|
-
let buffer;
|
|
2172
|
-
let streamControllers = [];
|
|
2173
|
-
const createStream = () => {
|
|
2174
|
-
if (!buffer) {
|
|
2175
|
-
buffer = [];
|
|
2176
|
-
return body.pipeThrough(
|
|
2177
|
-
new TransformStream({
|
|
2178
|
-
transform(chunk, controller) {
|
|
2179
|
-
buffer.push(chunk);
|
|
2180
|
-
controller.enqueue(chunk);
|
|
2181
|
-
streamControllers.forEach((c) => c.enqueue(chunk));
|
|
2182
|
-
},
|
|
2183
|
-
flush() {
|
|
2184
|
-
streamControllers.forEach((c) => c.close());
|
|
2185
|
-
streamControllers = [];
|
|
2186
|
-
}
|
|
2187
|
-
})
|
|
2188
|
-
);
|
|
2189
|
-
}
|
|
2190
|
-
return new ReadableStream({
|
|
2191
|
-
start(controller) {
|
|
2192
|
-
buffer.forEach((chunk) => controller.enqueue(chunk));
|
|
2193
|
-
streamControllers.push(controller);
|
|
2194
|
-
}
|
|
2195
|
-
});
|
|
2196
|
-
};
|
|
2197
|
-
let deepestRenderedBoundaryId = null;
|
|
2198
|
-
const getPayload = () => {
|
|
2199
|
-
const payloadPromise = Promise.resolve(
|
|
2200
|
-
createFromReadableStream(createStream())
|
|
2201
|
-
);
|
|
2202
|
-
return Object.defineProperties(payloadPromise, {
|
|
2203
|
-
_deepestRenderedBoundaryId: {
|
|
2204
|
-
get() {
|
|
2205
|
-
return deepestRenderedBoundaryId;
|
|
2206
|
-
},
|
|
2207
|
-
set(boundaryId) {
|
|
2208
|
-
deepestRenderedBoundaryId = boundaryId;
|
|
2209
|
-
}
|
|
2210
|
-
},
|
|
2211
|
-
formState: {
|
|
2212
|
-
get() {
|
|
2213
|
-
return payloadPromise.then(
|
|
2214
|
-
(payload) => payload.type === "render" ? payload.formState : void 0
|
|
2215
|
-
);
|
|
2216
|
-
}
|
|
2217
|
-
}
|
|
2218
|
-
});
|
|
2219
|
-
};
|
|
2220
|
-
try {
|
|
2221
|
-
if (!detectRedirectResponse.body) {
|
|
2222
|
-
throw new Error("Failed to clone server response");
|
|
2223
|
-
}
|
|
2224
|
-
const payload = await createFromReadableStream(
|
|
2225
|
-
detectRedirectResponse.body
|
|
2226
|
-
);
|
|
2227
|
-
if (serverResponse.status === SINGLE_FETCH_REDIRECT_STATUS && payload.type === "redirect") {
|
|
2228
|
-
const headers2 = new Headers(serverResponse.headers);
|
|
2229
|
-
headers2.delete("Content-Encoding");
|
|
2230
|
-
headers2.delete("Content-Length");
|
|
2231
|
-
headers2.delete("Content-Type");
|
|
2232
|
-
headers2.delete("X-Remix-Response");
|
|
2233
|
-
headers2.set("Location", payload.location);
|
|
2234
|
-
return new Response(serverResponseB?.body || "", {
|
|
2235
|
-
headers: headers2,
|
|
2236
|
-
status: payload.status,
|
|
2237
|
-
statusText: serverResponse.statusText
|
|
2238
|
-
});
|
|
2239
|
-
}
|
|
2240
|
-
const html = await renderHTML(getPayload);
|
|
2241
|
-
const headers = new Headers(serverResponse.headers);
|
|
2242
|
-
headers.set("Content-Type", "text/html; charset=utf-8");
|
|
2243
|
-
if (!hydrate) {
|
|
2244
|
-
return new Response(html, {
|
|
2245
|
-
status: serverResponse.status,
|
|
2246
|
-
headers
|
|
2247
|
-
});
|
|
2248
|
-
}
|
|
2249
|
-
if (!serverResponseB?.body) {
|
|
2250
|
-
throw new Error("Failed to clone server response");
|
|
2251
|
-
}
|
|
2252
|
-
const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body));
|
|
2253
|
-
return new Response(body2, {
|
|
2254
|
-
status: serverResponse.status,
|
|
2255
|
-
headers
|
|
2256
|
-
});
|
|
2257
|
-
} catch (reason) {
|
|
2258
|
-
if (reason instanceof Response) {
|
|
2259
|
-
return reason;
|
|
2260
|
-
}
|
|
2261
|
-
try {
|
|
2262
|
-
const status = isRouteErrorResponse(reason) ? reason.status : 500;
|
|
2263
|
-
const html = await renderHTML(() => {
|
|
2264
|
-
const decoded = Promise.resolve(
|
|
2265
|
-
createFromReadableStream(createStream())
|
|
2266
|
-
);
|
|
2267
|
-
const payloadPromise = decoded.then(
|
|
2268
|
-
(payload) => Object.assign(payload, {
|
|
2269
|
-
status,
|
|
2270
|
-
errors: deepestRenderedBoundaryId ? {
|
|
2271
|
-
[deepestRenderedBoundaryId]: reason
|
|
2272
|
-
} : {}
|
|
2273
|
-
})
|
|
2274
|
-
);
|
|
2275
|
-
return Object.defineProperties(payloadPromise, {
|
|
2276
|
-
_deepestRenderedBoundaryId: {
|
|
2277
|
-
get() {
|
|
2278
|
-
return deepestRenderedBoundaryId;
|
|
2279
|
-
},
|
|
2280
|
-
set(boundaryId) {
|
|
2281
|
-
deepestRenderedBoundaryId = boundaryId;
|
|
2282
|
-
}
|
|
2283
|
-
},
|
|
2284
|
-
formState: {
|
|
2285
|
-
get() {
|
|
2286
|
-
return payloadPromise.then(
|
|
2287
|
-
(payload) => payload.type === "render" ? payload.formState : void 0
|
|
2288
|
-
);
|
|
2289
|
-
}
|
|
2290
|
-
}
|
|
2291
|
-
});
|
|
2292
|
-
});
|
|
2293
|
-
const headers = new Headers(serverResponse.headers);
|
|
2294
|
-
headers.set("Content-Type", "text/html");
|
|
2295
|
-
if (!hydrate) {
|
|
2296
|
-
return new Response(html, {
|
|
2297
|
-
status,
|
|
2298
|
-
headers
|
|
2299
|
-
});
|
|
2300
|
-
}
|
|
2301
|
-
if (!serverResponseB?.body) {
|
|
2302
|
-
throw new Error("Failed to clone server response");
|
|
2303
|
-
}
|
|
2304
|
-
const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body));
|
|
2305
|
-
return new Response(body2, {
|
|
2306
|
-
status,
|
|
2307
|
-
headers
|
|
2308
|
-
});
|
|
2309
|
-
} catch {
|
|
2310
|
-
}
|
|
2311
|
-
throw reason;
|
|
2312
|
-
}
|
|
2313
|
-
}
|
|
2314
|
-
function RSCStaticRouter({ getPayload }) {
|
|
2315
|
-
const decoded = getPayload();
|
|
2316
|
-
const payload = useSafe(decoded);
|
|
2317
|
-
if (payload.type === "redirect") {
|
|
2318
|
-
throw new Response(null, {
|
|
2319
|
-
status: payload.status,
|
|
2320
|
-
headers: {
|
|
2321
|
-
Location: payload.location
|
|
2322
|
-
}
|
|
2323
|
-
});
|
|
2324
|
-
}
|
|
2325
|
-
if (payload.type !== "render") return null;
|
|
2326
|
-
let patchedLoaderData = { ...payload.loaderData };
|
|
2327
|
-
for (const match of payload.matches) {
|
|
2328
|
-
if (shouldHydrateRouteLoader(
|
|
2329
|
-
match.id,
|
|
2330
|
-
match.clientLoader,
|
|
2331
|
-
match.hasLoader,
|
|
2332
|
-
false
|
|
2333
|
-
) && (match.hydrateFallbackElement || !match.hasLoader)) {
|
|
2334
|
-
delete patchedLoaderData[match.id];
|
|
2335
|
-
}
|
|
2336
|
-
}
|
|
2337
|
-
const context = {
|
|
2338
|
-
get _deepestRenderedBoundaryId() {
|
|
2339
|
-
return decoded._deepestRenderedBoundaryId ?? null;
|
|
2340
|
-
},
|
|
2341
|
-
set _deepestRenderedBoundaryId(boundaryId) {
|
|
2342
|
-
decoded._deepestRenderedBoundaryId = boundaryId;
|
|
2343
|
-
},
|
|
2344
|
-
actionData: payload.actionData,
|
|
2345
|
-
actionHeaders: {},
|
|
2346
|
-
basename: payload.basename,
|
|
2347
|
-
errors: payload.errors,
|
|
2348
|
-
loaderData: patchedLoaderData,
|
|
2349
|
-
loaderHeaders: {},
|
|
2350
|
-
location: payload.location,
|
|
2351
|
-
statusCode: 200,
|
|
2352
|
-
matches: payload.matches.map((match) => ({
|
|
2353
|
-
params: match.params,
|
|
2354
|
-
pathname: match.pathname,
|
|
2355
|
-
pathnameBase: match.pathnameBase,
|
|
2356
|
-
route: {
|
|
2357
|
-
id: match.id,
|
|
2358
|
-
action: match.hasAction || !!match.clientAction,
|
|
2359
|
-
handle: match.handle,
|
|
2360
|
-
hasErrorBoundary: match.hasErrorBoundary,
|
|
2361
|
-
loader: match.hasLoader || !!match.clientLoader,
|
|
2362
|
-
index: match.index,
|
|
2363
|
-
path: match.path,
|
|
2364
|
-
shouldRevalidate: match.shouldRevalidate
|
|
2365
|
-
}
|
|
2366
|
-
}))
|
|
2367
|
-
};
|
|
2368
|
-
const router2 = createStaticRouter(
|
|
2369
|
-
payload.matches.reduceRight((previous, match) => {
|
|
2370
|
-
const route = {
|
|
2371
|
-
id: match.id,
|
|
2372
|
-
action: match.hasAction || !!match.clientAction,
|
|
2373
|
-
element: match.element,
|
|
2374
|
-
errorElement: match.errorElement,
|
|
2375
|
-
handle: match.handle,
|
|
2376
|
-
hasErrorBoundary: !!match.errorElement,
|
|
2377
|
-
hydrateFallbackElement: match.hydrateFallbackElement,
|
|
2378
|
-
index: match.index,
|
|
2379
|
-
loader: match.hasLoader || !!match.clientLoader,
|
|
2380
|
-
path: match.path,
|
|
2381
|
-
shouldRevalidate: match.shouldRevalidate
|
|
2382
|
-
};
|
|
2383
|
-
if (previous.length > 0) {
|
|
2384
|
-
route.children = previous;
|
|
2385
|
-
}
|
|
2386
|
-
return [route];
|
|
2387
|
-
}, []),
|
|
2388
|
-
context
|
|
2389
|
-
);
|
|
2390
|
-
const frameworkContext = {
|
|
2391
|
-
future: {
|
|
2392
|
-
// These flags have no runtime impact so can always be false. If we add
|
|
2393
|
-
// flags that drive runtime behavior they'll need to be proxied through.
|
|
2394
|
-
v8_middleware: false,
|
|
2395
|
-
unstable_subResourceIntegrity: false
|
|
2396
|
-
},
|
|
2397
|
-
isSpaMode: false,
|
|
2398
|
-
ssr: true,
|
|
2399
|
-
criticalCss: "",
|
|
2400
|
-
manifest: {
|
|
2401
|
-
routes: {},
|
|
2402
|
-
version: "1",
|
|
2403
|
-
url: "",
|
|
2404
|
-
entry: {
|
|
2405
|
-
module: "",
|
|
2406
|
-
imports: []
|
|
2407
|
-
}
|
|
2408
|
-
},
|
|
2409
|
-
routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" },
|
|
2410
|
-
routeModules: createRSCRouteModules(payload)
|
|
2411
|
-
};
|
|
2412
|
-
return /* @__PURE__ */ reactExports.createElement(RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ reactExports.createElement(RSCRouterGlobalErrorBoundary, { location: payload.location }, /* @__PURE__ */ reactExports.createElement(FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ reactExports.createElement(
|
|
2413
|
-
StaticRouterProvider,
|
|
2414
|
-
{
|
|
2415
|
-
context,
|
|
2416
|
-
router: router2,
|
|
2417
|
-
hydrate: false,
|
|
2418
|
-
nonce: payload.nonce
|
|
2419
|
-
}
|
|
2420
|
-
))));
|
|
2421
|
-
}
|
|
2422
|
-
function isReactServerRequest(url) {
|
|
2423
|
-
return url.pathname.endsWith(".rsc");
|
|
2424
|
-
}
|
|
2425
|
-
function isManifestRequest(url) {
|
|
2426
|
-
return url.pathname.endsWith(".manifest");
|
|
2427
|
-
}
|
|
2428
|
-
function deserializeErrors(errors) {
|
|
2429
|
-
if (!errors) return null;
|
|
2430
|
-
let entries = Object.entries(errors);
|
|
2431
|
-
let serialized = {};
|
|
2432
|
-
for (let [key, val] of entries) {
|
|
2433
|
-
if (val && val.__type === "RouteErrorResponse") {
|
|
2434
|
-
serialized[key] = new ErrorResponseImpl(
|
|
2435
|
-
val.status,
|
|
2436
|
-
val.statusText,
|
|
2437
|
-
val.data,
|
|
2438
|
-
val.internal === true
|
|
2439
|
-
);
|
|
2440
|
-
} else if (val && val.__type === "Error") {
|
|
2441
|
-
if (val.__subType) {
|
|
2442
|
-
let ErrorConstructor = window[val.__subType];
|
|
2443
|
-
if (typeof ErrorConstructor === "function") {
|
|
2444
|
-
try {
|
|
2445
|
-
let error = new ErrorConstructor(val.message);
|
|
2446
|
-
error.stack = val.stack;
|
|
2447
|
-
serialized[key] = error;
|
|
2448
|
-
} catch (e) {
|
|
2449
|
-
}
|
|
2450
|
-
}
|
|
2451
|
-
}
|
|
2452
|
-
if (serialized[key] == null) {
|
|
2453
|
-
let error = new Error(val.message);
|
|
2454
|
-
error.stack = val.stack;
|
|
2455
|
-
serialized[key] = error;
|
|
2456
|
-
}
|
|
2457
|
-
} else {
|
|
2458
|
-
serialized[key] = val;
|
|
2459
|
-
}
|
|
2460
|
-
}
|
|
2461
|
-
return serialized;
|
|
2462
|
-
}
|
|
2463
|
-
function getHydrationData({
|
|
2464
|
-
state,
|
|
2465
|
-
routes,
|
|
2466
|
-
getRouteInfo,
|
|
2467
|
-
location,
|
|
2468
|
-
basename,
|
|
2469
|
-
isSpaMode
|
|
2470
|
-
}) {
|
|
2471
|
-
let hydrationData = {
|
|
2472
|
-
...state,
|
|
2473
|
-
loaderData: { ...state.loaderData }
|
|
2474
|
-
};
|
|
2475
|
-
let initialMatches = matchRoutes(routes, location, basename);
|
|
2476
|
-
if (initialMatches) {
|
|
2477
|
-
for (let match of initialMatches) {
|
|
2478
|
-
let routeId = match.route.id;
|
|
2479
|
-
let routeInfo = getRouteInfo(routeId);
|
|
2480
|
-
if (shouldHydrateRouteLoader(
|
|
2481
|
-
routeId,
|
|
2482
|
-
routeInfo.clientLoader,
|
|
2483
|
-
routeInfo.hasLoader,
|
|
2484
|
-
isSpaMode
|
|
2485
|
-
) && (routeInfo.hasHydrateFallback || !routeInfo.hasLoader)) {
|
|
2486
|
-
delete hydrationData.loaderData[routeId];
|
|
2487
|
-
} else if (!routeInfo.hasLoader) {
|
|
2488
|
-
hydrationData.loaderData[routeId] = null;
|
|
2489
|
-
}
|
|
2490
|
-
}
|
|
2491
|
-
}
|
|
2492
|
-
return hydrationData;
|
|
2493
|
-
}
|
|
2494
|
-
function RouterProvider2(props) {
|
|
2495
|
-
return /* @__PURE__ */ reactExports.createElement(RouterProvider, { flushSync: reactDomExports.flushSync, ...props });
|
|
2496
|
-
}
|
|
2497
|
-
var ssrInfo = null;
|
|
2498
|
-
var router = null;
|
|
2499
|
-
function initSsrInfo() {
|
|
2500
|
-
if (!ssrInfo && window.__reactRouterContext && window.__reactRouterManifest && window.__reactRouterRouteModules) {
|
|
2501
|
-
if (window.__reactRouterManifest.sri === true) {
|
|
2502
|
-
const importMap = document.querySelector("script[rr-importmap]");
|
|
2503
|
-
if (importMap?.textContent) {
|
|
2504
|
-
try {
|
|
2505
|
-
window.__reactRouterManifest.sri = JSON.parse(
|
|
2506
|
-
importMap.textContent
|
|
2507
|
-
).integrity;
|
|
2508
|
-
} catch (err) {
|
|
2509
|
-
console.error("Failed to parse import map", err);
|
|
2510
|
-
}
|
|
2511
|
-
}
|
|
2512
|
-
}
|
|
2513
|
-
ssrInfo = {
|
|
2514
|
-
context: window.__reactRouterContext,
|
|
2515
|
-
manifest: window.__reactRouterManifest,
|
|
2516
|
-
routeModules: window.__reactRouterRouteModules,
|
|
2517
|
-
stateDecodingPromise: void 0,
|
|
2518
|
-
router: void 0,
|
|
2519
|
-
routerInitialized: false
|
|
2520
|
-
};
|
|
2521
|
-
}
|
|
2522
|
-
}
|
|
2523
|
-
function createHydratedRouter({
|
|
2524
|
-
getContext,
|
|
2525
|
-
unstable_instrumentations
|
|
2526
|
-
}) {
|
|
2527
|
-
initSsrInfo();
|
|
2528
|
-
if (!ssrInfo) {
|
|
2529
|
-
throw new Error(
|
|
2530
|
-
"You must be using the SSR features of React Router in order to skip passing a `router` prop to `<RouterProvider>`"
|
|
2531
|
-
);
|
|
2532
|
-
}
|
|
2533
|
-
let localSsrInfo = ssrInfo;
|
|
2534
|
-
if (!ssrInfo.stateDecodingPromise) {
|
|
2535
|
-
let stream = ssrInfo.context.stream;
|
|
2536
|
-
invariant$1(stream, "No stream found for single fetch decoding");
|
|
2537
|
-
ssrInfo.context.stream = void 0;
|
|
2538
|
-
ssrInfo.stateDecodingPromise = decodeViaTurboStream(stream, window).then((value) => {
|
|
2539
|
-
ssrInfo.context.state = value.value;
|
|
2540
|
-
localSsrInfo.stateDecodingPromise.value = true;
|
|
2541
|
-
}).catch((e) => {
|
|
2542
|
-
localSsrInfo.stateDecodingPromise.error = e;
|
|
2543
|
-
});
|
|
2544
|
-
}
|
|
2545
|
-
if (ssrInfo.stateDecodingPromise.error) {
|
|
2546
|
-
throw ssrInfo.stateDecodingPromise.error;
|
|
2547
|
-
}
|
|
2548
|
-
if (!ssrInfo.stateDecodingPromise.value) {
|
|
2549
|
-
throw ssrInfo.stateDecodingPromise;
|
|
2550
|
-
}
|
|
2551
|
-
let routes = createClientRoutes(
|
|
2552
|
-
ssrInfo.manifest.routes,
|
|
2553
|
-
ssrInfo.routeModules,
|
|
2554
|
-
ssrInfo.context.state,
|
|
2555
|
-
ssrInfo.context.ssr,
|
|
2556
|
-
ssrInfo.context.isSpaMode
|
|
2557
|
-
);
|
|
2558
|
-
let hydrationData = void 0;
|
|
2559
|
-
if (ssrInfo.context.isSpaMode) {
|
|
2560
|
-
let { loaderData } = ssrInfo.context.state;
|
|
2561
|
-
if (ssrInfo.manifest.routes.root?.hasLoader && loaderData && "root" in loaderData) {
|
|
2562
|
-
hydrationData = {
|
|
2563
|
-
loaderData: {
|
|
2564
|
-
root: loaderData.root
|
|
2565
|
-
}
|
|
2566
|
-
};
|
|
2567
|
-
}
|
|
2568
|
-
} else {
|
|
2569
|
-
hydrationData = getHydrationData({
|
|
2570
|
-
state: ssrInfo.context.state,
|
|
2571
|
-
routes,
|
|
2572
|
-
getRouteInfo: (routeId) => ({
|
|
2573
|
-
clientLoader: ssrInfo.routeModules[routeId]?.clientLoader,
|
|
2574
|
-
hasLoader: ssrInfo.manifest.routes[routeId]?.hasLoader === true,
|
|
2575
|
-
hasHydrateFallback: ssrInfo.routeModules[routeId]?.HydrateFallback != null
|
|
2576
|
-
}),
|
|
2577
|
-
location: window.location,
|
|
2578
|
-
basename: window.__reactRouterContext?.basename,
|
|
2579
|
-
isSpaMode: ssrInfo.context.isSpaMode
|
|
2580
|
-
});
|
|
2581
|
-
if (hydrationData && hydrationData.errors) {
|
|
2582
|
-
hydrationData.errors = deserializeErrors(hydrationData.errors);
|
|
2583
|
-
}
|
|
2584
|
-
}
|
|
2585
|
-
let router2 = createRouter({
|
|
2586
|
-
routes,
|
|
2587
|
-
history: createBrowserHistory(),
|
|
2588
|
-
basename: ssrInfo.context.basename,
|
|
2589
|
-
getContext,
|
|
2590
|
-
hydrationData,
|
|
2591
|
-
hydrationRouteProperties,
|
|
2592
|
-
unstable_instrumentations,
|
|
2593
|
-
mapRouteProperties,
|
|
2594
|
-
future: {
|
|
2595
|
-
middleware: ssrInfo.context.future.v8_middleware
|
|
2596
|
-
},
|
|
2597
|
-
dataStrategy: getTurboStreamSingleFetchDataStrategy(
|
|
2598
|
-
() => router2,
|
|
2599
|
-
ssrInfo.manifest,
|
|
2600
|
-
ssrInfo.routeModules,
|
|
2601
|
-
ssrInfo.context.ssr,
|
|
2602
|
-
ssrInfo.context.basename
|
|
2603
|
-
),
|
|
2604
|
-
patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(
|
|
2605
|
-
ssrInfo.manifest,
|
|
2606
|
-
ssrInfo.routeModules,
|
|
2607
|
-
ssrInfo.context.ssr,
|
|
2608
|
-
ssrInfo.context.routeDiscovery,
|
|
2609
|
-
ssrInfo.context.isSpaMode,
|
|
2610
|
-
ssrInfo.context.basename
|
|
2611
|
-
)
|
|
2612
|
-
});
|
|
2613
|
-
ssrInfo.router = router2;
|
|
2614
|
-
if (router2.state.initialized) {
|
|
2615
|
-
ssrInfo.routerInitialized = true;
|
|
2616
|
-
router2.initialize();
|
|
2617
|
-
}
|
|
2618
|
-
router2.createRoutesForHMR = /* spacer so ts-ignore does not affect the right hand of the assignment */
|
|
2619
|
-
createClientRoutesWithHMRRevalidationOptOut;
|
|
2620
|
-
window.__reactRouterDataRouter = router2;
|
|
2621
|
-
return router2;
|
|
2622
|
-
}
|
|
2623
|
-
function HydratedRouter(props) {
|
|
2624
|
-
if (!router) {
|
|
2625
|
-
router = createHydratedRouter({
|
|
2626
|
-
getContext: props.getContext,
|
|
2627
|
-
unstable_instrumentations: props.unstable_instrumentations
|
|
2628
|
-
});
|
|
2629
|
-
}
|
|
2630
|
-
let [criticalCss, setCriticalCss] = reactExports.useState(
|
|
2631
|
-
void 0
|
|
2632
|
-
);
|
|
2633
|
-
reactExports.useEffect(() => {
|
|
2634
|
-
}, []);
|
|
2635
|
-
reactExports.useEffect(() => {
|
|
2636
|
-
}, [criticalCss]);
|
|
2637
|
-
let [location2, setLocation] = reactExports.useState(router.state.location);
|
|
2638
|
-
reactExports.useLayoutEffect(() => {
|
|
2639
|
-
if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {
|
|
2640
|
-
ssrInfo.routerInitialized = true;
|
|
2641
|
-
ssrInfo.router.initialize();
|
|
2642
|
-
}
|
|
2643
|
-
}, []);
|
|
2644
|
-
reactExports.useLayoutEffect(() => {
|
|
2645
|
-
if (ssrInfo && ssrInfo.router) {
|
|
2646
|
-
return ssrInfo.router.subscribe((newState) => {
|
|
2647
|
-
if (newState.location !== location2) {
|
|
2648
|
-
setLocation(newState.location);
|
|
2649
|
-
}
|
|
2650
|
-
});
|
|
2651
|
-
}
|
|
2652
|
-
}, [location2]);
|
|
2653
|
-
invariant$1(ssrInfo, "ssrInfo unavailable for HydratedRouter");
|
|
2654
|
-
useFogOFWarDiscovery(
|
|
2655
|
-
router,
|
|
2656
|
-
ssrInfo.manifest,
|
|
2657
|
-
ssrInfo.routeModules,
|
|
2658
|
-
ssrInfo.context.ssr,
|
|
2659
|
-
ssrInfo.context.routeDiscovery,
|
|
2660
|
-
ssrInfo.context.isSpaMode
|
|
2661
|
-
);
|
|
2662
|
-
return (
|
|
2663
|
-
// This fragment is important to ensure we match the <ServerRouter> JSX
|
|
2664
|
-
// structure so that useId values hydrate correctly
|
|
2665
|
-
/* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement(
|
|
2666
|
-
FrameworkContext.Provider,
|
|
2667
|
-
{
|
|
2668
|
-
value: {
|
|
2669
|
-
manifest: ssrInfo.manifest,
|
|
2670
|
-
routeModules: ssrInfo.routeModules,
|
|
2671
|
-
future: ssrInfo.context.future,
|
|
2672
|
-
criticalCss,
|
|
2673
|
-
ssr: ssrInfo.context.ssr,
|
|
2674
|
-
isSpaMode: ssrInfo.context.isSpaMode,
|
|
2675
|
-
routeDiscovery: ssrInfo.context.routeDiscovery
|
|
2676
|
-
}
|
|
2677
|
-
},
|
|
2678
|
-
/* @__PURE__ */ reactExports.createElement(RemixErrorBoundary, { location: location2 }, /* @__PURE__ */ reactExports.createElement(
|
|
2679
|
-
RouterProvider2,
|
|
2680
|
-
{
|
|
2681
|
-
router,
|
|
2682
|
-
unstable_onError: props.unstable_onError
|
|
2683
|
-
}
|
|
2684
|
-
))
|
|
2685
|
-
), /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null))
|
|
2686
|
-
);
|
|
2687
|
-
}
|
|
2688
|
-
export {
|
|
2689
|
-
a2 as Await,
|
|
2690
|
-
a3 as BrowserRouter,
|
|
2691
|
-
a4 as Form,
|
|
2692
|
-
a5 as HashRouter,
|
|
2693
|
-
HydratedRouter,
|
|
2694
|
-
a6 as IDLE_BLOCKER,
|
|
2695
|
-
a7 as IDLE_FETCHER,
|
|
2696
|
-
a8 as IDLE_NAVIGATION,
|
|
2697
|
-
a9 as Link,
|
|
2698
|
-
aa as Links,
|
|
2699
|
-
ab as MemoryRouter,
|
|
2700
|
-
ac as Meta,
|
|
2701
|
-
ad as NavLink,
|
|
2702
|
-
ae as Navigate,
|
|
2703
|
-
af as NavigationType,
|
|
2704
|
-
Outlet,
|
|
2705
|
-
ag as PrefetchPageLinks,
|
|
2706
|
-
ah as Route,
|
|
2707
|
-
ai as Router,
|
|
2708
|
-
RouterContextProvider,
|
|
2709
|
-
RouterProvider2 as RouterProvider,
|
|
2710
|
-
aj as Routes,
|
|
2711
|
-
ak as Scripts,
|
|
2712
|
-
al as ScrollRestoration,
|
|
2713
|
-
ServerRouter,
|
|
2714
|
-
am as StaticRouter,
|
|
2715
|
-
StaticRouterProvider,
|
|
2716
|
-
an as UNSAFE_AwaitContextProvider,
|
|
2717
|
-
ao as UNSAFE_DataRouterContext,
|
|
2718
|
-
ap as UNSAFE_DataRouterStateContext,
|
|
2719
|
-
ErrorResponseImpl as UNSAFE_ErrorResponseImpl,
|
|
2720
|
-
aq as UNSAFE_FetchersContext,
|
|
2721
|
-
FrameworkContext as UNSAFE_FrameworkContext,
|
|
2722
|
-
ar as UNSAFE_LocationContext,
|
|
2723
|
-
as as UNSAFE_NavigationContext,
|
|
2724
|
-
RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary,
|
|
2725
|
-
RemixErrorBoundary as UNSAFE_RemixErrorBoundary,
|
|
2726
|
-
at as UNSAFE_RouteContext,
|
|
2727
|
-
ServerMode as UNSAFE_ServerMode,
|
|
2728
|
-
SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol,
|
|
2729
|
-
au as UNSAFE_ViewTransitionContext,
|
|
2730
|
-
av as UNSAFE_WithComponentProps,
|
|
2731
|
-
aw as UNSAFE_WithErrorBoundaryProps,
|
|
2732
|
-
ax as UNSAFE_WithHydrateFallbackProps,
|
|
2733
|
-
createBrowserHistory as UNSAFE_createBrowserHistory,
|
|
2734
|
-
createClientRoutes as UNSAFE_createClientRoutes,
|
|
2735
|
-
createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut,
|
|
2736
|
-
createRouter as UNSAFE_createRouter,
|
|
2737
|
-
decodeViaTurboStream as UNSAFE_decodeViaTurboStream,
|
|
2738
|
-
deserializeErrors as UNSAFE_deserializeErrors,
|
|
2739
|
-
getHydrationData as UNSAFE_getHydrationData,
|
|
2740
|
-
getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction,
|
|
2741
|
-
getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy,
|
|
2742
|
-
hydrationRouteProperties as UNSAFE_hydrationRouteProperties,
|
|
2743
|
-
invariant$1 as UNSAFE_invariant,
|
|
2744
|
-
mapRouteProperties as UNSAFE_mapRouteProperties,
|
|
2745
|
-
shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader,
|
|
2746
|
-
useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery,
|
|
2747
|
-
ay as UNSAFE_useScrollRestoration,
|
|
2748
|
-
withComponentProps as UNSAFE_withComponentProps,
|
|
2749
|
-
withErrorBoundaryProps as UNSAFE_withErrorBoundaryProps,
|
|
2750
|
-
withHydrateFallbackProps as UNSAFE_withHydrateFallbackProps,
|
|
2751
|
-
az as createBrowserRouter,
|
|
2752
|
-
aA as createContext,
|
|
2753
|
-
createCookie,
|
|
2754
|
-
createCookieSessionStorage,
|
|
2755
|
-
aB as createHashRouter,
|
|
2756
|
-
createMemoryRouter,
|
|
2757
|
-
createMemorySessionStorage,
|
|
2758
|
-
aC as createPath,
|
|
2759
|
-
createRequestHandler,
|
|
2760
|
-
aD as createRoutesFromChildren,
|
|
2761
|
-
aE as createRoutesFromElements,
|
|
2762
|
-
createRoutesStub,
|
|
2763
|
-
aF as createSearchParams,
|
|
2764
|
-
createSession,
|
|
2765
|
-
createSessionStorage,
|
|
2766
|
-
aG as createStaticHandler,
|
|
2767
|
-
createStaticRouter,
|
|
2768
|
-
aH as data,
|
|
2769
|
-
aI as generatePath,
|
|
2770
|
-
href,
|
|
2771
|
-
isCookie,
|
|
2772
|
-
isRouteErrorResponse,
|
|
2773
|
-
isSession,
|
|
2774
|
-
aJ as matchPath,
|
|
2775
|
-
matchRoutes,
|
|
2776
|
-
aK as parsePath,
|
|
2777
|
-
redirect,
|
|
2778
|
-
redirectDocument,
|
|
2779
|
-
aL as renderMatches,
|
|
2780
|
-
replace,
|
|
2781
|
-
aM as resolvePath,
|
|
2782
|
-
aN as unstable_HistoryRouter,
|
|
2783
|
-
RSCStaticRouter as unstable_RSCStaticRouter,
|
|
2784
|
-
routeRSCServerRequest as unstable_routeRSCServerRequest,
|
|
2785
|
-
setDevServerHooks as unstable_setDevServerHooks,
|
|
2786
|
-
aO as unstable_usePrompt,
|
|
2787
|
-
aP as unstable_useRoute,
|
|
2788
|
-
aQ as useActionData,
|
|
2789
|
-
aR as useAsyncError,
|
|
2790
|
-
aS as useAsyncValue,
|
|
2791
|
-
aT as useBeforeUnload,
|
|
2792
|
-
aU as useBlocker,
|
|
2793
|
-
aV as useFetcher,
|
|
2794
|
-
aW as useFetchers,
|
|
2795
|
-
aX as useFormAction,
|
|
2796
|
-
aY as useHref,
|
|
2797
|
-
aZ as useInRouterContext,
|
|
2798
|
-
a_ as useLinkClickHandler,
|
|
2799
|
-
a$ as useLoaderData,
|
|
2800
|
-
b0 as useLocation,
|
|
2801
|
-
b1 as useMatch,
|
|
2802
|
-
b2 as useMatches,
|
|
2803
|
-
b3 as useNavigate,
|
|
2804
|
-
b4 as useNavigation,
|
|
2805
|
-
b5 as useNavigationType,
|
|
2806
|
-
b6 as useOutlet,
|
|
2807
|
-
b7 as useOutletContext,
|
|
2808
|
-
b8 as useParams,
|
|
2809
|
-
b9 as useResolvedPath,
|
|
2810
|
-
ba as useRevalidator,
|
|
2811
|
-
useRouteError,
|
|
2812
|
-
bb as useRouteLoaderData,
|
|
2813
|
-
bc as useRoutes,
|
|
2814
|
-
bd as useSearchParams,
|
|
2815
|
-
be as useSubmit,
|
|
2816
|
-
bf as useViewTransitionState
|
|
2817
|
-
};
|