react-router 0.0.0-experimental-689d76079 → 0.0.0-experimental-34996874d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/dist/development/{browser-I6n6wVSO.d.mts → browser-DOdQ29qc.d.mts} +2 -2
- package/dist/development/{browser-C-UvoYvi.d.ts → browser-fmM0RC-q.d.ts} +2 -2
- package/dist/{production/chunk-UNN6ZJ6W.js → development/chunk-BSV573QI.js} +7 -7
- package/dist/development/{chunk-N6IZKBC5.mjs → chunk-OFM6MSVO.mjs} +76 -60
- package/dist/{production/chunk-UZZ2OU6Q.js → development/chunk-U6SV3TY5.js} +139 -139
- package/dist/development/{chunk-64IGXH5S.js → chunk-VP7MBYDE.js} +127 -84
- package/dist/development/{chunk-RPWK4TB6.mjs → chunk-ZRB2HDCJ.mjs} +169 -126
- package/dist/{production/context-DGGUoDIu.d.mts → development/context-5jDC4-vN.d.mts} +78 -39
- package/dist/development/dom-export.d.mts +7 -7
- package/dist/development/dom-export.d.ts +7 -7
- package/dist/development/dom-export.js +35 -36
- package/dist/development/dom-export.mjs +10 -11
- package/dist/{production/index-react-server-client-BjhKIe3u.d.mts → development/index-react-server-client-CRAVUwl_.d.mts} +33 -34
- package/dist/development/{index-react-server-client-BBd0A0TL.d.ts → index-react-server-client-CilLfWxK.d.ts} +51 -52
- package/dist/development/index-react-server-client.d.mts +3 -3
- package/dist/development/index-react-server-client.d.ts +3 -3
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +85 -28
- package/dist/development/index-react-server.d.ts +85 -28
- package/dist/development/index-react-server.js +60 -32
- package/dist/development/index-react-server.mjs +60 -32
- package/dist/development/index.d.mts +10 -10
- package/dist/development/index.d.ts +10 -10
- package/dist/development/index.js +170 -154
- package/dist/development/index.mjs +3 -3
- package/dist/{production/instrumentation-g0dG8UL0.d.ts → development/instrumentation-BvOM_tqB.d.ts} +60 -21
- package/dist/development/lib/types/internal.d.mts +2 -2
- package/dist/development/lib/types/internal.d.ts +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-DcBltf5q.d.ts → register-Cs_YOjxD.d.ts} +1 -1
- package/dist/development/{register-D9d2sMQ7.d.mts → register-D8QAj40q.d.mts} +1 -1
- package/dist/development/{routeModules-7rtk67cd.d.ts → routeModules-CwfU3INC.d.ts} +32 -14
- package/dist/development/{routeModules-BW4a8k3I.d.mts → routeModules-TFkxZ8Dg.d.mts} +32 -14
- package/dist/production/{browser-I6n6wVSO.d.mts → browser-DOdQ29qc.d.mts} +2 -2
- package/dist/production/{browser-C-UvoYvi.d.ts → browser-fmM0RC-q.d.ts} +2 -2
- package/dist/{development/chunk-WIMVKWVX.js → production/chunk-JTGQRTOX.js} +139 -139
- package/dist/production/{chunk-NA4ZUJK5.js → chunk-QEWGMILU.js} +127 -84
- package/dist/production/{chunk-VFF3M6RU.mjs → chunk-RT56BADL.mjs} +169 -126
- package/dist/{development/chunk-E4C63BHH.js → production/chunk-XLB5A5UA.js} +7 -7
- package/dist/production/{chunk-5PRXMKWZ.mjs → chunk-Y4VPCUGN.mjs} +76 -60
- package/dist/{development/context-DGGUoDIu.d.mts → production/context-5jDC4-vN.d.mts} +78 -39
- package/dist/production/dom-export.d.mts +7 -7
- package/dist/production/dom-export.d.ts +7 -7
- package/dist/production/dom-export.js +35 -36
- package/dist/production/dom-export.mjs +10 -11
- package/dist/{development/index-react-server-client-BjhKIe3u.d.mts → production/index-react-server-client-CRAVUwl_.d.mts} +33 -34
- package/dist/production/{index-react-server-client-BBd0A0TL.d.ts → index-react-server-client-CilLfWxK.d.ts} +51 -52
- package/dist/production/index-react-server-client.d.mts +3 -3
- package/dist/production/index-react-server-client.d.ts +3 -3
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +85 -28
- package/dist/production/index-react-server.d.ts +85 -28
- package/dist/production/index-react-server.js +60 -32
- package/dist/production/index-react-server.mjs +60 -32
- package/dist/production/index.d.mts +10 -10
- package/dist/production/index.d.ts +10 -10
- package/dist/production/index.js +170 -154
- package/dist/production/index.mjs +3 -3
- package/dist/{development/instrumentation-g0dG8UL0.d.ts → production/instrumentation-BvOM_tqB.d.ts} +60 -21
- package/dist/production/lib/types/internal.d.mts +2 -2
- package/dist/production/lib/types/internal.d.ts +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{register-DcBltf5q.d.ts → register-Cs_YOjxD.d.ts} +1 -1
- package/dist/production/{register-D9d2sMQ7.d.mts → register-D8QAj40q.d.mts} +1 -1
- package/dist/production/{routeModules-7rtk67cd.d.ts → routeModules-CwfU3INC.d.ts} +32 -14
- package/dist/production/{routeModules-BW4a8k3I.d.mts → routeModules-TFkxZ8Dg.d.mts} +32 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
+
## v7.14.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Remove the un-documented custom error serialization logic from the internal turbo-stream implementation. React Router only automatically handles serialization of `Error` and it's standard subtypes (`SyntaxError`, `TypeError`, etc.). ([[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1))
|
|
8
|
+
|
|
9
|
+
- Properly handle parent middleware redirects during `fetcher.load` ([[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1))
|
|
10
|
+
|
|
11
|
+
- Remove redundant `Omit<RouterProviderProps, "flushSync">` from `react-router/dom` `RouterProvider` ([[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1))
|
|
12
|
+
|
|
13
|
+
- Improved types for `generatePath`'s `param` arg ([[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1))
|
|
14
|
+
|
|
15
|
+
Type errors when required params are omitted:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
// Before
|
|
19
|
+
// Passes type checks, but throws at runtime 💥
|
|
20
|
+
generatePath(":required", { required: null });
|
|
21
|
+
|
|
22
|
+
// After
|
|
23
|
+
generatePath(":required", { required: null });
|
|
24
|
+
// ^^^^^^^^ Type 'null' is not assignable to type 'string'.ts(2322)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Allow omission of optional params:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
// Before
|
|
31
|
+
generatePath(":optional?", {});
|
|
32
|
+
// ^^ Property 'optional' is missing in type '{}' but required in type '{ optional: string | null | undefined; }'.ts(2741)
|
|
33
|
+
|
|
34
|
+
// After
|
|
35
|
+
generatePath(":optional?", {});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Allows extra keys:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
// Before
|
|
42
|
+
generatePath(":a", { a: "1", b: "2" });
|
|
43
|
+
// ^ Object literal may only specify known properties, and 'b' does not exist in type '{ a: string; }'.ts(2353)
|
|
44
|
+
|
|
45
|
+
// After
|
|
46
|
+
generatePath(":a", { a: "1", b: "2" });
|
|
47
|
+
```
|
|
48
|
+
|
|
3
49
|
## v7.14.1
|
|
4
50
|
|
|
5
51
|
### Patch Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterInit } from './context-
|
|
3
|
-
import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './routeModules-
|
|
2
|
+
import { R as RouterInit } from './context-5jDC4-vN.mjs';
|
|
3
|
+
import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './routeModules-TFkxZ8Dg.mjs';
|
|
4
4
|
|
|
5
5
|
declare function getRequest(): Request;
|
|
6
6
|
type RSCRouteConfigEntryBase = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterInit } from './instrumentation-
|
|
3
|
-
import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './routeModules-
|
|
2
|
+
import { R as RouterInit } from './instrumentation-BvOM_tqB.js';
|
|
3
|
+
import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './routeModules-CwfU3INC.js';
|
|
4
4
|
|
|
5
5
|
declare function getRequest(): Request;
|
|
6
6
|
type RSCRouteConfigEntryBase = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-34996874d
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkVP7MBYDEjs = require('./chunk-VP7MBYDE.js');
|
|
18
18
|
|
|
19
19
|
// lib/dom/ssr/hydration.tsx
|
|
20
20
|
function getHydrationData({
|
|
@@ -29,12 +29,12 @@ function getHydrationData({
|
|
|
29
29
|
...state,
|
|
30
30
|
loaderData: { ...state.loaderData }
|
|
31
31
|
};
|
|
32
|
-
let initialMatches =
|
|
32
|
+
let initialMatches = _chunkVP7MBYDEjs.matchRoutes.call(void 0, routes, location, basename);
|
|
33
33
|
if (initialMatches) {
|
|
34
34
|
for (let match of initialMatches) {
|
|
35
35
|
let routeId = match.route.id;
|
|
36
36
|
let routeInfo = getRouteInfo(routeId);
|
|
37
|
-
if (
|
|
37
|
+
if (_chunkVP7MBYDEjs.shouldHydrateRouteLoader.call(void 0,
|
|
38
38
|
routeId,
|
|
39
39
|
routeInfo.clientLoader,
|
|
40
40
|
routeInfo.hasLoader,
|
|
@@ -112,7 +112,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
);
|
|
115
|
-
if (
|
|
115
|
+
if (_chunkVP7MBYDEjs.isRouteErrorResponse.call(void 0, error)) {
|
|
116
116
|
return /* @__PURE__ */ _react2.default.createElement(
|
|
117
117
|
ErrorWrapper,
|
|
118
118
|
{
|
|
@@ -120,7 +120,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
120
120
|
title: "Unhandled Thrown Response!"
|
|
121
121
|
},
|
|
122
122
|
/* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText),
|
|
123
|
-
|
|
123
|
+
_chunkVP7MBYDEjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
let errorInstance;
|
|
@@ -146,7 +146,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
146
146
|
function RSCDefaultRootErrorBoundary({
|
|
147
147
|
hasRootLayout
|
|
148
148
|
}) {
|
|
149
|
-
let error =
|
|
149
|
+
let error = _chunkVP7MBYDEjs.useRouteError.call(void 0, );
|
|
150
150
|
if (hasRootLayout === void 0) {
|
|
151
151
|
throw new Error("Missing 'hasRootLayout' prop");
|
|
152
152
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-34996874d
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
SingleFetchRedirectSymbol,
|
|
23
23
|
StaticRouterProvider,
|
|
24
24
|
StreamTransfer,
|
|
25
|
+
URL_LIMIT,
|
|
25
26
|
convertRoutesToDataRoutes,
|
|
26
27
|
createMemoryRouter,
|
|
27
28
|
createServerRoutes,
|
|
@@ -41,6 +42,7 @@ import {
|
|
|
41
42
|
isResponse,
|
|
42
43
|
isRouteErrorResponse,
|
|
43
44
|
matchRoutes,
|
|
45
|
+
matchRoutesImpl,
|
|
44
46
|
redirect,
|
|
45
47
|
redirectDocument,
|
|
46
48
|
replace,
|
|
@@ -51,7 +53,7 @@ import {
|
|
|
51
53
|
withComponentProps,
|
|
52
54
|
withErrorBoundaryProps,
|
|
53
55
|
withHydrateFallbackProps
|
|
54
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-ZRB2HDCJ.mjs";
|
|
55
57
|
|
|
56
58
|
// lib/dom/ssr/server.tsx
|
|
57
59
|
import * as React from "react";
|
|
@@ -137,8 +139,7 @@ function createRoutesStub(routes, _context) {
|
|
|
137
139
|
if (routerRef.current == null) {
|
|
138
140
|
frameworkContextRef.current = {
|
|
139
141
|
future: {
|
|
140
|
-
|
|
141
|
-
unstable_subResourceIntegrity: future?.unstable_subResourceIntegrity === true,
|
|
142
|
+
v8_passThroughRequests: future?.v8_passThroughRequests === true,
|
|
142
143
|
v8_middleware: future?.v8_middleware === true,
|
|
143
144
|
unstable_trailingSlashAwareDataRequests: future?.unstable_trailingSlashAwareDataRequests === true
|
|
144
145
|
},
|
|
@@ -490,29 +491,48 @@ function serializeErrors(errors, serverMode) {
|
|
|
490
491
|
return serialized;
|
|
491
492
|
}
|
|
492
493
|
|
|
494
|
+
// lib/server-runtime/invariant.ts
|
|
495
|
+
function invariant(value, message) {
|
|
496
|
+
if (value === false || value === null || typeof value === "undefined") {
|
|
497
|
+
console.error(
|
|
498
|
+
"The following error is a bug in React Router; please open an issue! https://github.com/remix-run/react-router/issues/new/choose"
|
|
499
|
+
);
|
|
500
|
+
throw new Error(message);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
493
504
|
// lib/server-runtime/routeMatching.ts
|
|
494
|
-
function matchServerRoutes(
|
|
495
|
-
let matches =
|
|
496
|
-
|
|
505
|
+
function matchServerRoutes(manifest, dataRoutes, branches, pathname, basename) {
|
|
506
|
+
let matches = matchRoutesImpl(
|
|
507
|
+
dataRoutes,
|
|
497
508
|
pathname,
|
|
498
|
-
basename
|
|
509
|
+
basename ?? "/",
|
|
510
|
+
false,
|
|
511
|
+
branches
|
|
499
512
|
);
|
|
500
513
|
if (!matches) return null;
|
|
501
|
-
return matches.map((match) =>
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
514
|
+
return matches.map((match) => {
|
|
515
|
+
let route = manifest[match.route.id];
|
|
516
|
+
invariant(
|
|
517
|
+
route,
|
|
518
|
+
`Route with id "${match.route.id}" not found in manifest.`
|
|
519
|
+
);
|
|
520
|
+
return {
|
|
521
|
+
params: match.params,
|
|
522
|
+
pathname: match.pathname,
|
|
523
|
+
route
|
|
524
|
+
};
|
|
525
|
+
});
|
|
506
526
|
}
|
|
507
527
|
|
|
508
528
|
// lib/server-runtime/data.ts
|
|
509
529
|
async function callRouteHandler(handler, args, future) {
|
|
510
530
|
let result = await handler({
|
|
511
|
-
request: future.
|
|
512
|
-
|
|
531
|
+
request: future.v8_passThroughRequests ? args.request : stripRoutesParam(stripIndexParam(args.request)),
|
|
532
|
+
url: args.url,
|
|
513
533
|
params: args.params,
|
|
514
534
|
context: args.context,
|
|
515
|
-
|
|
535
|
+
pattern: args.pattern
|
|
516
536
|
});
|
|
517
537
|
if (isDataWithResponseInit(result) && result.init && result.init.status && isRedirectStatusCode(result.init.status)) {
|
|
518
538
|
throw new Response(null, result.init);
|
|
@@ -558,16 +578,6 @@ function stripRoutesParam(request) {
|
|
|
558
578
|
return new Request(url.href, init);
|
|
559
579
|
}
|
|
560
580
|
|
|
561
|
-
// lib/server-runtime/invariant.ts
|
|
562
|
-
function invariant(value, message) {
|
|
563
|
-
if (value === false || value === null || typeof value === "undefined") {
|
|
564
|
-
console.error(
|
|
565
|
-
"The following error is a bug in React Router; please open an issue! https://github.com/remix-run/react-router/issues/new/choose"
|
|
566
|
-
);
|
|
567
|
-
throw new Error(message);
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
|
|
571
581
|
// lib/server-runtime/dev.ts
|
|
572
582
|
var globalDevServerHooksKey = "__reactRouterDevServerHooks";
|
|
573
583
|
function setDevServerHooks(devServerHooks) {
|
|
@@ -602,12 +612,6 @@ function groupRoutesByParentId(manifest) {
|
|
|
602
612
|
});
|
|
603
613
|
return routes;
|
|
604
614
|
}
|
|
605
|
-
function createRoutes(manifest, parentId = "", routesByParentId = groupRoutesByParentId(manifest)) {
|
|
606
|
-
return (routesByParentId[parentId] || []).map((route) => ({
|
|
607
|
-
...route,
|
|
608
|
-
children: createRoutes(manifest, route.id, routesByParentId)
|
|
609
|
-
}));
|
|
610
|
-
}
|
|
611
615
|
function createStaticHandlerDataRoutes(manifest, future, parentId = "", routesByParentId = groupRoutesByParentId(manifest)) {
|
|
612
616
|
return (routesByParentId[parentId] || []).map((route) => {
|
|
613
617
|
let commonRoute = {
|
|
@@ -894,7 +898,7 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand
|
|
|
894
898
|
} catch (e) {
|
|
895
899
|
return handleQueryError(new Error("Bad Request"), 400);
|
|
896
900
|
}
|
|
897
|
-
let handlerRequest = build.future.
|
|
901
|
+
let handlerRequest = build.future.v8_passThroughRequests ? request : new Request(handlerUrl, {
|
|
898
902
|
method: request.method,
|
|
899
903
|
body: request.body,
|
|
900
904
|
headers: request.headers,
|
|
@@ -913,7 +917,7 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand
|
|
|
913
917
|
return handleQueryError(error);
|
|
914
918
|
}
|
|
915
919
|
} : void 0,
|
|
916
|
-
|
|
920
|
+
normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
|
|
917
921
|
});
|
|
918
922
|
return handleQueryResult(result);
|
|
919
923
|
} catch (error) {
|
|
@@ -962,7 +966,7 @@ async function singleFetchLoaders(build, serverMode, staticHandler, request, han
|
|
|
962
966
|
let routesParam = new URL(request.url).searchParams.get("_routes");
|
|
963
967
|
let loadRouteIds = routesParam ? new Set(routesParam.split(",")) : null;
|
|
964
968
|
try {
|
|
965
|
-
let handlerRequest = build.future.
|
|
969
|
+
let handlerRequest = build.future.v8_passThroughRequests ? request : new Request(handlerUrl, {
|
|
966
970
|
headers: request.headers,
|
|
967
971
|
signal: request.signal
|
|
968
972
|
});
|
|
@@ -978,7 +982,7 @@ async function singleFetchLoaders(build, serverMode, staticHandler, request, han
|
|
|
978
982
|
return handleQueryError(error);
|
|
979
983
|
}
|
|
980
984
|
} : void 0,
|
|
981
|
-
|
|
985
|
+
normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
|
|
982
986
|
});
|
|
983
987
|
return handleQueryResult(result);
|
|
984
988
|
} catch (error) {
|
|
@@ -1145,12 +1149,12 @@ function encodeViaTurboStream(data2, requestSignal, streamTimeout, serverMode) {
|
|
|
1145
1149
|
|
|
1146
1150
|
// lib/server-runtime/server.ts
|
|
1147
1151
|
function derive(build, mode) {
|
|
1148
|
-
let routes = createRoutes(build.routes);
|
|
1149
1152
|
let dataRoutes = createStaticHandlerDataRoutes(build.routes, build.future);
|
|
1150
1153
|
let serverMode = isServerMode(mode) ? mode : "production" /* Production */;
|
|
1151
1154
|
let staticHandler = createStaticHandler(dataRoutes, {
|
|
1152
1155
|
basename: build.basename,
|
|
1153
|
-
|
|
1156
|
+
instrumentations: build.entry.module.instrumentations,
|
|
1157
|
+
future: build.future
|
|
1154
1158
|
});
|
|
1155
1159
|
let errorHandler = build.entry.module.handleError || ((error, { request }) => {
|
|
1156
1160
|
if (serverMode !== "test" /* Test */ && !request.signal.aborted) {
|
|
@@ -1247,24 +1251,30 @@ function derive(build, mode) {
|
|
|
1247
1251
|
);
|
|
1248
1252
|
if (requestUrl.pathname === manifestUrl) {
|
|
1249
1253
|
try {
|
|
1250
|
-
let res = await handleManifestRequest(
|
|
1254
|
+
let res = await handleManifestRequest(
|
|
1255
|
+
build,
|
|
1256
|
+
staticHandler.dataRoutes,
|
|
1257
|
+
staticHandler._internalRouteBranches,
|
|
1258
|
+
requestUrl
|
|
1259
|
+
);
|
|
1251
1260
|
return res;
|
|
1252
1261
|
} catch (e) {
|
|
1253
1262
|
handleError(e);
|
|
1254
1263
|
return new Response("Unknown Server Error", { status: 500 });
|
|
1255
1264
|
}
|
|
1256
1265
|
}
|
|
1257
|
-
let matches = matchServerRoutes(
|
|
1266
|
+
let matches = matchServerRoutes(
|
|
1267
|
+
build.routes,
|
|
1268
|
+
staticHandler.dataRoutes,
|
|
1269
|
+
staticHandler._internalRouteBranches,
|
|
1270
|
+
normalizedPathname,
|
|
1271
|
+
build.basename
|
|
1272
|
+
);
|
|
1258
1273
|
if (matches && matches.length > 0) {
|
|
1259
1274
|
Object.assign(params, matches[0].params);
|
|
1260
1275
|
}
|
|
1261
1276
|
let response;
|
|
1262
1277
|
if (requestUrl.pathname.endsWith(".data")) {
|
|
1263
|
-
let singleFetchMatches = matchServerRoutes(
|
|
1264
|
-
routes,
|
|
1265
|
-
normalizedPathname,
|
|
1266
|
-
build.basename
|
|
1267
|
-
);
|
|
1268
1278
|
response = await handleSingleFetchRequest(
|
|
1269
1279
|
serverMode,
|
|
1270
1280
|
build,
|
|
@@ -1285,7 +1295,7 @@ function derive(build, mode) {
|
|
|
1285
1295
|
if (build.entry.module.handleDataRequest) {
|
|
1286
1296
|
response = await build.entry.module.handleDataRequest(response, {
|
|
1287
1297
|
context: loadContext,
|
|
1288
|
-
params:
|
|
1298
|
+
params: matches ? matches[0].params : {},
|
|
1289
1299
|
request
|
|
1290
1300
|
});
|
|
1291
1301
|
if (isRedirectResponse(response)) {
|
|
@@ -1335,15 +1345,13 @@ function derive(build, mode) {
|
|
|
1335
1345
|
}
|
|
1336
1346
|
return response;
|
|
1337
1347
|
};
|
|
1338
|
-
if (build.entry.module.
|
|
1348
|
+
if (build.entry.module.instrumentations) {
|
|
1339
1349
|
requestHandler = instrumentHandler(
|
|
1340
1350
|
requestHandler,
|
|
1341
|
-
build.entry.module.
|
|
1351
|
+
build.entry.module.instrumentations.map((i) => i.handler).filter(Boolean)
|
|
1342
1352
|
);
|
|
1343
1353
|
}
|
|
1344
1354
|
return {
|
|
1345
|
-
routes,
|
|
1346
|
-
dataRoutes,
|
|
1347
1355
|
serverMode,
|
|
1348
1356
|
staticHandler,
|
|
1349
1357
|
errorHandler,
|
|
@@ -1352,7 +1360,6 @@ function derive(build, mode) {
|
|
|
1352
1360
|
}
|
|
1353
1361
|
var createRequestHandler = (build, mode) => {
|
|
1354
1362
|
let _build;
|
|
1355
|
-
let routes;
|
|
1356
1363
|
let serverMode;
|
|
1357
1364
|
let staticHandler;
|
|
1358
1365
|
let errorHandler;
|
|
@@ -1361,14 +1368,12 @@ var createRequestHandler = (build, mode) => {
|
|
|
1361
1368
|
_build = typeof build === "function" ? await build() : build;
|
|
1362
1369
|
if (typeof build === "function") {
|
|
1363
1370
|
let derived = derive(_build, mode);
|
|
1364
|
-
routes = derived.routes;
|
|
1365
1371
|
serverMode = derived.serverMode;
|
|
1366
1372
|
staticHandler = derived.staticHandler;
|
|
1367
1373
|
errorHandler = derived.errorHandler;
|
|
1368
1374
|
_requestHandler = derived.requestHandler;
|
|
1369
|
-
} else if (!
|
|
1375
|
+
} else if (!serverMode || !staticHandler || !errorHandler || !_requestHandler) {
|
|
1370
1376
|
let derived = derive(_build, mode);
|
|
1371
|
-
routes = derived.routes;
|
|
1372
1377
|
serverMode = derived.serverMode;
|
|
1373
1378
|
staticHandler = derived.staticHandler;
|
|
1374
1379
|
errorHandler = derived.errorHandler;
|
|
@@ -1377,7 +1382,7 @@ var createRequestHandler = (build, mode) => {
|
|
|
1377
1382
|
return _requestHandler(request, initialContext);
|
|
1378
1383
|
};
|
|
1379
1384
|
};
|
|
1380
|
-
async function handleManifestRequest(build,
|
|
1385
|
+
async function handleManifestRequest(build, dataRoutes, branches, url) {
|
|
1381
1386
|
if (build.assets.version !== url.searchParams.get("version")) {
|
|
1382
1387
|
return new Response(null, {
|
|
1383
1388
|
status: 204,
|
|
@@ -1386,6 +1391,12 @@ async function handleManifestRequest(build, routes, url) {
|
|
|
1386
1391
|
}
|
|
1387
1392
|
});
|
|
1388
1393
|
}
|
|
1394
|
+
if (url.toString().length > URL_LIMIT) {
|
|
1395
|
+
return new Response(null, {
|
|
1396
|
+
statusText: "Bad Request",
|
|
1397
|
+
status: 400
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1389
1400
|
let patches = {};
|
|
1390
1401
|
if (url.searchParams.has("paths")) {
|
|
1391
1402
|
let paths = /* @__PURE__ */ new Set();
|
|
@@ -1402,7 +1413,13 @@ async function handleManifestRequest(build, routes, url) {
|
|
|
1402
1413
|
});
|
|
1403
1414
|
});
|
|
1404
1415
|
for (let path of paths) {
|
|
1405
|
-
let matches = matchServerRoutes(
|
|
1416
|
+
let matches = matchServerRoutes(
|
|
1417
|
+
build.routes,
|
|
1418
|
+
dataRoutes,
|
|
1419
|
+
branches,
|
|
1420
|
+
path,
|
|
1421
|
+
build.basename
|
|
1422
|
+
);
|
|
1406
1423
|
if (matches) {
|
|
1407
1424
|
for (let match of matches) {
|
|
1408
1425
|
let routeId = match.route.id;
|
|
@@ -1470,7 +1487,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
1470
1487
|
return new Response(null, { status: 500 });
|
|
1471
1488
|
}
|
|
1472
1489
|
} : void 0,
|
|
1473
|
-
|
|
1490
|
+
normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
|
|
1474
1491
|
});
|
|
1475
1492
|
if (!isResponse(result)) {
|
|
1476
1493
|
result = await renderHtml(result, isSpaMode);
|
|
@@ -1603,7 +1620,7 @@ async function handleResourceRequest(serverMode, build, staticHandler, routeId,
|
|
|
1603
1620
|
return handleQueryRouteError(error);
|
|
1604
1621
|
}
|
|
1605
1622
|
} : void 0,
|
|
1606
|
-
|
|
1623
|
+
normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
|
|
1607
1624
|
});
|
|
1608
1625
|
return handleQueryRouteResult(result);
|
|
1609
1626
|
} catch (error) {
|
|
@@ -2430,10 +2447,9 @@ function RSCStaticRouter({ getPayload }) {
|
|
|
2430
2447
|
// These flags have no runtime impact so can always be false. If we add
|
|
2431
2448
|
// flags that drive runtime behavior they'll need to be proxied through.
|
|
2432
2449
|
v8_middleware: false,
|
|
2433
|
-
unstable_subResourceIntegrity: false,
|
|
2434
2450
|
unstable_trailingSlashAwareDataRequests: true,
|
|
2435
2451
|
// always on for RSC
|
|
2436
|
-
|
|
2452
|
+
v8_passThroughRequests: true
|
|
2437
2453
|
// always on for RSC
|
|
2438
2454
|
},
|
|
2439
2455
|
isSpaMode: false,
|