react-router 0.0.0-experimental-a65d6f5 → 0.0.0-experimental-c19b79d
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/development/{chunk-ZLVXSGFL.js → chunk-2G2U5HGB.js} +161 -164
- package/dist/development/{chunk-CWSJ6RYI.mjs → chunk-AGOH44BE.mjs} +51 -67
- package/dist/development/{chunk-47MIYFLC.mjs → chunk-IMKEG5CI.mjs} +29 -309
- package/dist/development/{chunk-QOFB7XZ5.js → chunk-LUB73E44.js} +70 -347
- package/dist/development/{router-DQIRhYoj.d.mts → context-BqL5Eckq.d.mts} +1288 -1441
- package/dist/development/dom-export.d.mts +4 -59
- package/dist/development/dom-export.d.ts +3 -59
- package/dist/development/dom-export.js +5 -8
- package/dist/development/dom-export.mjs +5 -8
- package/dist/{production/index-react-server-client-lf74v6ET.d.mts → development/index-react-server-client-2EDmGlsZ.d.mts} +77 -140
- package/dist/development/{index-react-server-client-lf74v6ET.d.mts → index-react-server-client-DKvU8YRr.d.ts} +134 -198
- package/dist/development/index-react-server-client.d.mts +3 -3
- package/dist/development/index-react-server-client.d.ts +2 -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 +1 -106
- package/dist/development/index-react-server.d.ts +1 -106
- package/dist/development/index-react-server.js +8 -181
- package/dist/development/index-react-server.mjs +8 -181
- package/dist/development/index.d.mts +20 -13
- package/dist/development/index.d.ts +18 -13
- package/dist/development/index.js +147 -161
- package/dist/development/index.mjs +5 -3
- package/dist/development/lib/types/internal.d.mts +3 -3
- package/dist/development/lib/types/internal.d.ts +2 -3
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-DiOIlEq5.d.mts → register-BrVEYTED.d.mts} +7 -1
- package/dist/{production/register-DiOIlEq5.d.mts → development/register-D8NQoPsO.d.ts} +7 -1
- package/dist/development/{routeModules--SgCTStn.d.mts → route-data-CDwqkzPE.d.mts} +147 -157
- package/dist/{production/routeModules-rxNxBmdR.d.ts → development/routeModules-BmVo7q9e.d.ts} +1046 -73
- package/dist/production/{chunk-ZOHTOBOT.js → chunk-2L5AG5Y5.js} +70 -347
- package/dist/production/{chunk-UAAA7FTX.mjs → chunk-AODJW4D3.mjs} +51 -67
- package/dist/production/{chunk-4SPSFXAZ.js → chunk-FGRCWJDI.js} +161 -164
- package/dist/production/{chunk-MMAHTIVZ.mjs → chunk-UOQCOPF6.mjs} +29 -309
- package/dist/production/{router-DQIRhYoj.d.mts → context-BqL5Eckq.d.mts} +1288 -1441
- package/dist/production/dom-export.d.mts +4 -59
- package/dist/production/dom-export.d.ts +3 -59
- package/dist/production/dom-export.js +5 -8
- package/dist/production/dom-export.mjs +5 -8
- package/dist/{development/index-react-server-client-Iw2PMej2.d.ts → production/index-react-server-client-2EDmGlsZ.d.mts} +77 -140
- package/dist/production/{index-react-server-client-Iw2PMej2.d.ts → index-react-server-client-DKvU8YRr.d.ts} +134 -198
- package/dist/production/index-react-server-client.d.mts +3 -3
- package/dist/production/index-react-server-client.d.ts +2 -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 +1 -106
- package/dist/production/index-react-server.d.ts +1 -106
- package/dist/production/index-react-server.js +8 -181
- package/dist/production/index-react-server.mjs +8 -181
- package/dist/production/index.d.mts +20 -13
- package/dist/production/index.d.ts +18 -13
- package/dist/production/index.js +147 -161
- package/dist/production/index.mjs +5 -3
- package/dist/production/lib/types/internal.d.mts +3 -3
- package/dist/production/lib/types/internal.d.ts +2 -3
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/register-DiOIlEq5.d.ts → production/register-BrVEYTED.d.mts} +7 -1
- package/dist/production/{register-DiOIlEq5.d.ts → register-D8NQoPsO.d.ts} +7 -1
- package/dist/production/{routeModules--SgCTStn.d.mts → route-data-CDwqkzPE.d.mts} +147 -157
- package/dist/{development/routeModules-rxNxBmdR.d.ts → production/routeModules-BmVo7q9e.d.ts} +1046 -73
- package/package.json +1 -1
- package/dist/development/instrumentation-BWRz1MRU.d.ts +0 -1138
- package/dist/production/instrumentation-BWRz1MRU.d.ts +0 -1138
|
@@ -351,11 +351,6 @@ type DefaultContext = MiddlewareEnabled extends true ? Readonly<RouterContextPro
|
|
|
351
351
|
interface DataFunctionArgs<Context> {
|
|
352
352
|
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read headers (like cookies, and {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} from the request. */
|
|
353
353
|
request: Request;
|
|
354
|
-
/**
|
|
355
|
-
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
|
356
|
-
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
|
357
|
-
*/
|
|
358
|
-
unstable_pattern: string;
|
|
359
354
|
/**
|
|
360
355
|
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
361
356
|
* @example
|
|
@@ -576,7 +571,7 @@ type AgnosticPatchRoutesOnNavigationFunction<O extends AgnosticRouteObject = Agn
|
|
|
576
571
|
* properties from framework-agnostic properties
|
|
577
572
|
*/
|
|
578
573
|
interface MapRoutePropertiesFunction {
|
|
579
|
-
(route:
|
|
574
|
+
(route: AgnosticRouteObject): {
|
|
580
575
|
hasErrorBoundary: boolean;
|
|
581
576
|
} & Record<string, any>;
|
|
582
577
|
}
|
|
@@ -892,99 +887,6 @@ type ErrorResponse = {
|
|
|
892
887
|
*/
|
|
893
888
|
declare function isRouteErrorResponse(error: any): error is ErrorResponse;
|
|
894
889
|
|
|
895
|
-
type unstable_ServerInstrumentation = {
|
|
896
|
-
handler?: unstable_InstrumentRequestHandlerFunction;
|
|
897
|
-
route?: unstable_InstrumentRouteFunction;
|
|
898
|
-
};
|
|
899
|
-
type unstable_ClientInstrumentation = {
|
|
900
|
-
router?: unstable_InstrumentRouterFunction;
|
|
901
|
-
route?: unstable_InstrumentRouteFunction;
|
|
902
|
-
};
|
|
903
|
-
type unstable_InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
|
904
|
-
type unstable_InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
|
905
|
-
type unstable_InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
|
906
|
-
interface GenericInstrumentFunction {
|
|
907
|
-
(handler: () => Promise<void>, info: unknown): Promise<void>;
|
|
908
|
-
}
|
|
909
|
-
type InstrumentableRoute = {
|
|
910
|
-
id: string;
|
|
911
|
-
index: boolean | undefined;
|
|
912
|
-
path: string | undefined;
|
|
913
|
-
instrument(instrumentations: RouteInstrumentations): void;
|
|
914
|
-
};
|
|
915
|
-
type RouteInstrumentations = {
|
|
916
|
-
lazy?: InstrumentLazyFunction;
|
|
917
|
-
"lazy.loader"?: InstrumentLazyFunction;
|
|
918
|
-
"lazy.action"?: InstrumentLazyFunction;
|
|
919
|
-
"lazy.middleware"?: InstrumentLazyFunction;
|
|
920
|
-
middleware?: InstrumentRouteHandlerFunction;
|
|
921
|
-
loader?: InstrumentRouteHandlerFunction;
|
|
922
|
-
action?: InstrumentRouteHandlerFunction;
|
|
923
|
-
};
|
|
924
|
-
type RouteHandlerInstrumentationInfo = Readonly<{
|
|
925
|
-
request: {
|
|
926
|
-
method: string;
|
|
927
|
-
url: string;
|
|
928
|
-
headers: Pick<Headers, "get">;
|
|
929
|
-
};
|
|
930
|
-
params: LoaderFunctionArgs["params"];
|
|
931
|
-
unstable_pattern: string;
|
|
932
|
-
context: Pick<RouterContextProvider, "get">;
|
|
933
|
-
}>;
|
|
934
|
-
interface InstrumentLazyFunction extends GenericInstrumentFunction {
|
|
935
|
-
(handler: () => Promise<void>): Promise<void>;
|
|
936
|
-
}
|
|
937
|
-
interface InstrumentRouteHandlerFunction extends GenericInstrumentFunction {
|
|
938
|
-
(handler: () => Promise<void>, info: RouteHandlerInstrumentationInfo): Promise<void>;
|
|
939
|
-
}
|
|
940
|
-
type InstrumentableRouter = {
|
|
941
|
-
instrument(instrumentations: RouterInstrumentations): void;
|
|
942
|
-
};
|
|
943
|
-
type RouterInstrumentations = {
|
|
944
|
-
navigate?: InstrumentNavigateFunction;
|
|
945
|
-
fetch?: InstrumentFetchFunction;
|
|
946
|
-
};
|
|
947
|
-
type RouterNavigationInstrumentationInfo = Readonly<{
|
|
948
|
-
to: string | number;
|
|
949
|
-
currentUrl: string;
|
|
950
|
-
formMethod?: HTMLFormMethod;
|
|
951
|
-
formEncType?: FormEncType;
|
|
952
|
-
formData?: FormData;
|
|
953
|
-
body?: any;
|
|
954
|
-
}>;
|
|
955
|
-
type RouterFetchInstrumentationInfo = Readonly<{
|
|
956
|
-
href: string;
|
|
957
|
-
currentUrl: string;
|
|
958
|
-
fetcherKey: string;
|
|
959
|
-
formMethod?: HTMLFormMethod;
|
|
960
|
-
formEncType?: FormEncType;
|
|
961
|
-
formData?: FormData;
|
|
962
|
-
body?: any;
|
|
963
|
-
}>;
|
|
964
|
-
interface InstrumentNavigateFunction extends GenericInstrumentFunction {
|
|
965
|
-
(handler: () => Promise<void>, info: RouterNavigationInstrumentationInfo): MaybePromise<void>;
|
|
966
|
-
}
|
|
967
|
-
interface InstrumentFetchFunction extends GenericInstrumentFunction {
|
|
968
|
-
(handler: () => Promise<void>, info: RouterFetchInstrumentationInfo): MaybePromise<void>;
|
|
969
|
-
}
|
|
970
|
-
type InstrumentableRequestHandler = {
|
|
971
|
-
instrument(instrumentations: RequestHandlerInstrumentations): void;
|
|
972
|
-
};
|
|
973
|
-
type RequestHandlerInstrumentations = {
|
|
974
|
-
request?: InstrumentRequestHandlerFunction;
|
|
975
|
-
};
|
|
976
|
-
type RequestHandlerInstrumentationInfo = Readonly<{
|
|
977
|
-
request: {
|
|
978
|
-
method: string;
|
|
979
|
-
url: string;
|
|
980
|
-
headers: Pick<Headers, "get">;
|
|
981
|
-
};
|
|
982
|
-
context: Pick<RouterContextProvider, "get">;
|
|
983
|
-
}>;
|
|
984
|
-
interface InstrumentRequestHandlerFunction extends GenericInstrumentFunction {
|
|
985
|
-
(handler: () => Promise<void>, info: RequestHandlerInstrumentationInfo): MaybePromise<void>;
|
|
986
|
-
}
|
|
987
|
-
|
|
988
890
|
/**
|
|
989
891
|
* A Router instance manages all navigation and data loading/mutations
|
|
990
892
|
*/
|
|
@@ -1269,7 +1171,6 @@ interface RouterInit {
|
|
|
1269
1171
|
history: History;
|
|
1270
1172
|
basename?: string;
|
|
1271
1173
|
getContext?: () => MaybePromise<RouterContextProvider>;
|
|
1272
|
-
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
|
1273
1174
|
mapRouteProperties?: MapRoutePropertiesFunction;
|
|
1274
1175
|
future?: Partial<FutureConfig>;
|
|
1275
1176
|
hydrationRouteProperties?: string[];
|
|
@@ -1536,7 +1437,6 @@ type BlockerFunction = (args: {
|
|
|
1536
1437
|
interface CreateStaticHandlerOptions {
|
|
1537
1438
|
basename?: string;
|
|
1538
1439
|
mapRouteProperties?: MapRoutePropertiesFunction;
|
|
1539
|
-
unstable_instrumentations?: Pick<unstable_ServerInstrumentation, "route">[];
|
|
1540
1440
|
future?: {};
|
|
1541
1441
|
}
|
|
1542
1442
|
declare function createStaticHandler(routes: AgnosticRouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;
|
|
@@ -1907,11 +1807,6 @@ type ClientDataFunctionArgs<Params> = {
|
|
|
1907
1807
|
* }
|
|
1908
1808
|
**/
|
|
1909
1809
|
params: Params;
|
|
1910
|
-
/**
|
|
1911
|
-
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
|
1912
|
-
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
|
1913
|
-
*/
|
|
1914
|
-
unstable_pattern: string;
|
|
1915
1810
|
/**
|
|
1916
1811
|
* When `future.v8_middleware` is not enabled, this is undefined.
|
|
1917
1812
|
*
|
|
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
|
|
|
27
27
|
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* react-router v0.0.0-experimental-
|
|
30
|
+
* react-router v0.0.0-experimental-c19b79d
|
|
31
31
|
*
|
|
32
32
|
* Copyright (c) Remix Software Inc.
|
|
33
33
|
*
|
|
@@ -107,134 +107,6 @@ function parsePath(path) {
|
|
|
107
107
|
return parsedPath;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
// lib/router/instrumentation.ts
|
|
111
|
-
var UninstrumentedSymbol = Symbol("Uninstrumented");
|
|
112
|
-
function getInstrumentedImplementation(impls, handler, getInfo = () => void 0) {
|
|
113
|
-
if (impls.length === 0) {
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
return async (...args) => {
|
|
117
|
-
let value;
|
|
118
|
-
let info = getInfo(...args);
|
|
119
|
-
await recurseRight(
|
|
120
|
-
impls,
|
|
121
|
-
info,
|
|
122
|
-
async () => {
|
|
123
|
-
value = await handler(...args);
|
|
124
|
-
},
|
|
125
|
-
impls.length - 1
|
|
126
|
-
);
|
|
127
|
-
return value;
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
async function recurseRight(impls, info, handler, index) {
|
|
131
|
-
let impl = impls[index];
|
|
132
|
-
if (!impl) {
|
|
133
|
-
await handler();
|
|
134
|
-
} else {
|
|
135
|
-
await impl(async () => {
|
|
136
|
-
await recurseRight(impls, info, handler, index - 1);
|
|
137
|
-
}, info);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
function getInstrumentationInfo(args) {
|
|
141
|
-
let { request, context, params, unstable_pattern } = args;
|
|
142
|
-
return {
|
|
143
|
-
// pseudo "Request" with the info they may want to read from
|
|
144
|
-
request: {
|
|
145
|
-
method: request.method,
|
|
146
|
-
url: request.url,
|
|
147
|
-
// Maybe make this a proxy that only supports `get`?
|
|
148
|
-
headers: {
|
|
149
|
-
get: (...args2) => request.headers.get(...args2)
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
params: { ...params },
|
|
153
|
-
unstable_pattern,
|
|
154
|
-
context: {
|
|
155
|
-
get: (...args2) => context.get(...args2)
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
function getInstrumentationsByType(instrumentations, key) {
|
|
160
|
-
let value = [];
|
|
161
|
-
for (let i in instrumentations) {
|
|
162
|
-
let instrumentation = instrumentations[i];
|
|
163
|
-
if (key in instrumentation && instrumentation[key] != null) {
|
|
164
|
-
value.push(instrumentation[key]);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
return value;
|
|
168
|
-
}
|
|
169
|
-
function getInstrumentationUpdates(fns, route) {
|
|
170
|
-
let instrumentations = [];
|
|
171
|
-
fns.forEach(
|
|
172
|
-
(fn) => fn({
|
|
173
|
-
id: route.id,
|
|
174
|
-
index: route.index,
|
|
175
|
-
path: route.path,
|
|
176
|
-
instrument(i) {
|
|
177
|
-
instrumentations.push(i);
|
|
178
|
-
}
|
|
179
|
-
})
|
|
180
|
-
);
|
|
181
|
-
let updates = {};
|
|
182
|
-
if (instrumentations.length > 0) {
|
|
183
|
-
["lazy", "loader", "action"].forEach((key) => {
|
|
184
|
-
let func = route[key];
|
|
185
|
-
if (typeof func === "function") {
|
|
186
|
-
let original = func[UninstrumentedSymbol] ?? func;
|
|
187
|
-
let instrumented = getInstrumentedImplementation(
|
|
188
|
-
getInstrumentationsByType(instrumentations, key),
|
|
189
|
-
original,
|
|
190
|
-
key === "lazy" ? () => void 0 : (...args) => getInstrumentationInfo(
|
|
191
|
-
args[0]
|
|
192
|
-
)
|
|
193
|
-
);
|
|
194
|
-
if (instrumented) {
|
|
195
|
-
instrumented[UninstrumentedSymbol] = original;
|
|
196
|
-
updates[key] = instrumented;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
if (route.middleware && route.middleware.length > 0) {
|
|
201
|
-
updates.middleware = route.middleware.map((middleware) => {
|
|
202
|
-
let original = middleware[UninstrumentedSymbol] ?? middleware;
|
|
203
|
-
let instrumented = getInstrumentedImplementation(
|
|
204
|
-
getInstrumentationsByType(instrumentations, "middleware"),
|
|
205
|
-
original,
|
|
206
|
-
(...args) => getInstrumentationInfo(
|
|
207
|
-
args[0]
|
|
208
|
-
)
|
|
209
|
-
);
|
|
210
|
-
if (instrumented) {
|
|
211
|
-
instrumented[UninstrumentedSymbol] = original;
|
|
212
|
-
return instrumented;
|
|
213
|
-
}
|
|
214
|
-
return middleware;
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
if (typeof route.lazy === "object") {
|
|
218
|
-
let lazyObject = route.lazy;
|
|
219
|
-
["middleware", "loader", "action"].forEach((key) => {
|
|
220
|
-
let func = lazyObject[key];
|
|
221
|
-
if (typeof func === "function") {
|
|
222
|
-
let instrumented = getInstrumentedImplementation(
|
|
223
|
-
getInstrumentationsByType(instrumentations, `lazy.${key}`),
|
|
224
|
-
func
|
|
225
|
-
);
|
|
226
|
-
if (instrumented) {
|
|
227
|
-
updates.lazy = Object.assign(updates.lazy || {}, {
|
|
228
|
-
[key]: instrumented
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
return updates;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
110
|
// lib/router/utils.ts
|
|
239
111
|
function createContext(defaultValue) {
|
|
240
112
|
return { defaultValue };
|
|
@@ -328,23 +200,19 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
|
|
|
328
200
|
if (isIndexRoute(route)) {
|
|
329
201
|
let indexRoute = {
|
|
330
202
|
...route,
|
|
203
|
+
...mapRouteProperties(route),
|
|
331
204
|
id
|
|
332
205
|
};
|
|
333
|
-
manifest[id] =
|
|
334
|
-
indexRoute,
|
|
335
|
-
mapRouteProperties(indexRoute)
|
|
336
|
-
);
|
|
206
|
+
manifest[id] = indexRoute;
|
|
337
207
|
return indexRoute;
|
|
338
208
|
} else {
|
|
339
209
|
let pathOrLayoutRoute = {
|
|
340
210
|
...route,
|
|
211
|
+
...mapRouteProperties(route),
|
|
341
212
|
id,
|
|
342
213
|
children: void 0
|
|
343
214
|
};
|
|
344
|
-
manifest[id] =
|
|
345
|
-
pathOrLayoutRoute,
|
|
346
|
-
mapRouteProperties(pathOrLayoutRoute)
|
|
347
|
-
);
|
|
215
|
+
manifest[id] = pathOrLayoutRoute;
|
|
348
216
|
if (route.children) {
|
|
349
217
|
pathOrLayoutRoute.children = convertRoutesToDataRoutes(
|
|
350
218
|
route.children,
|
|
@@ -358,17 +226,6 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
|
|
|
358
226
|
}
|
|
359
227
|
});
|
|
360
228
|
}
|
|
361
|
-
function mergeRouteUpdates(route, updates) {
|
|
362
|
-
return Object.assign(route, {
|
|
363
|
-
...updates,
|
|
364
|
-
...typeof updates.lazy === "object" && updates.lazy != null ? {
|
|
365
|
-
lazy: {
|
|
366
|
-
...route.lazy,
|
|
367
|
-
...updates.lazy
|
|
368
|
-
}
|
|
369
|
-
} : {}
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
229
|
function matchRoutes(routes, locationArg, basename = "/") {
|
|
373
230
|
return matchRoutesImpl(routes, locationArg, basename, false);
|
|
374
231
|
}
|
|
@@ -795,9 +652,6 @@ var ErrorResponseImpl = class {
|
|
|
795
652
|
function isRouteErrorResponse(error) {
|
|
796
653
|
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
|
797
654
|
}
|
|
798
|
-
function getRoutePattern(paths) {
|
|
799
|
-
return paths.filter(Boolean).join("/").replace(/\/\/*/g, "/");
|
|
800
|
-
}
|
|
801
655
|
|
|
802
656
|
// lib/router/router.ts
|
|
803
657
|
var validMutationMethodsArr = [
|
|
@@ -828,20 +682,7 @@ function createStaticHandler(routes, opts) {
|
|
|
828
682
|
);
|
|
829
683
|
let manifest = {};
|
|
830
684
|
let basename = (opts ? opts.basename : null) || "/";
|
|
831
|
-
let
|
|
832
|
-
let mapRouteProperties = _mapRouteProperties;
|
|
833
|
-
if (opts?.unstable_instrumentations) {
|
|
834
|
-
let instrumentations = opts.unstable_instrumentations;
|
|
835
|
-
mapRouteProperties = (route) => {
|
|
836
|
-
return {
|
|
837
|
-
..._mapRouteProperties(route),
|
|
838
|
-
...getInstrumentationUpdates(
|
|
839
|
-
instrumentations.map((i) => i.route).filter(Boolean),
|
|
840
|
-
route
|
|
841
|
-
)
|
|
842
|
-
};
|
|
843
|
-
};
|
|
844
|
-
}
|
|
685
|
+
let mapRouteProperties = opts?.mapRouteProperties || defaultMapRouteProperties;
|
|
845
686
|
let dataRoutes = convertRoutesToDataRoutes(
|
|
846
687
|
routes,
|
|
847
688
|
mapRouteProperties,
|
|
@@ -911,7 +752,6 @@ function createStaticHandler(routes, opts) {
|
|
|
911
752
|
let response = await runServerMiddlewarePipeline(
|
|
912
753
|
{
|
|
913
754
|
request,
|
|
914
|
-
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
915
755
|
matches,
|
|
916
756
|
params: matches[0].params,
|
|
917
757
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -1057,7 +897,6 @@ function createStaticHandler(routes, opts) {
|
|
|
1057
897
|
let response = await runServerMiddlewarePipeline(
|
|
1058
898
|
{
|
|
1059
899
|
request,
|
|
1060
|
-
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
1061
900
|
matches,
|
|
1062
901
|
params: matches[0].params,
|
|
1063
902
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -1339,7 +1178,6 @@ function createStaticHandler(routes, opts) {
|
|
|
1339
1178
|
mapRouteProperties,
|
|
1340
1179
|
manifest,
|
|
1341
1180
|
request,
|
|
1342
|
-
getRoutePattern(matches.map((m) => m.route.path)),
|
|
1343
1181
|
match,
|
|
1344
1182
|
[],
|
|
1345
1183
|
requestContext,
|
|
@@ -1350,7 +1188,6 @@ function createStaticHandler(routes, opts) {
|
|
|
1350
1188
|
mapRouteProperties,
|
|
1351
1189
|
manifest,
|
|
1352
1190
|
request,
|
|
1353
|
-
getRoutePattern(matches.map((m) => m.route.path)),
|
|
1354
1191
|
match,
|
|
1355
1192
|
[],
|
|
1356
1193
|
requestContext,
|
|
@@ -1694,12 +1531,7 @@ async function runMiddlewarePipeline(args, handler, processResult, isResult, err
|
|
|
1694
1531
|
(m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
|
|
1695
1532
|
);
|
|
1696
1533
|
let result = await callRouteMiddleware(
|
|
1697
|
-
{
|
|
1698
|
-
request,
|
|
1699
|
-
params,
|
|
1700
|
-
context,
|
|
1701
|
-
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path))
|
|
1702
|
-
},
|
|
1534
|
+
{ request, params, context },
|
|
1703
1535
|
tuples,
|
|
1704
1536
|
handler,
|
|
1705
1537
|
processResult,
|
|
@@ -1777,7 +1609,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
|
|
|
1777
1609
|
handler: lazyRoutePromises.lazyHandlerPromise
|
|
1778
1610
|
};
|
|
1779
1611
|
}
|
|
1780
|
-
function getDataStrategyMatch(mapRouteProperties, manifest, request,
|
|
1612
|
+
function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
|
|
1781
1613
|
let isUsingNewApi = false;
|
|
1782
1614
|
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
|
1783
1615
|
mapRouteProperties,
|
|
@@ -1811,7 +1643,6 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pa
|
|
|
1811
1643
|
if (callHandler && !isMiddlewareOnlyRoute) {
|
|
1812
1644
|
return callLoaderOrAction({
|
|
1813
1645
|
request,
|
|
1814
|
-
unstable_pattern,
|
|
1815
1646
|
match,
|
|
1816
1647
|
lazyHandlerPromise: _lazyPromises?.handler,
|
|
1817
1648
|
lazyRoutePromise: _lazyPromises?.route,
|
|
@@ -1845,7 +1676,6 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
1845
1676
|
mapRouteProperties,
|
|
1846
1677
|
manifest,
|
|
1847
1678
|
request,
|
|
1848
|
-
getRoutePattern(matches.map((m) => m.route.path)),
|
|
1849
1679
|
match,
|
|
1850
1680
|
lazyRoutePropertiesToSkip,
|
|
1851
1681
|
scopedContext,
|
|
@@ -1860,7 +1690,6 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
1860
1690
|
}
|
|
1861
1691
|
let dataStrategyArgs = {
|
|
1862
1692
|
request,
|
|
1863
|
-
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
1864
1693
|
params: matches[0].params,
|
|
1865
1694
|
context: scopedContext,
|
|
1866
1695
|
matches
|
|
@@ -1888,7 +1717,6 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
1888
1717
|
}
|
|
1889
1718
|
async function callLoaderOrAction({
|
|
1890
1719
|
request,
|
|
1891
|
-
unstable_pattern,
|
|
1892
1720
|
match,
|
|
1893
1721
|
lazyHandlerPromise,
|
|
1894
1722
|
lazyRoutePromise,
|
|
@@ -1915,7 +1743,6 @@ async function callLoaderOrAction({
|
|
|
1915
1743
|
return handler(
|
|
1916
1744
|
{
|
|
1917
1745
|
request,
|
|
1918
|
-
unstable_pattern,
|
|
1919
1746
|
params: match.params,
|
|
1920
1747
|
context: scopedContext
|
|
1921
1748
|
},
|