react-router 0.0.0-experimental-c19b79d → 0.0.0-experimental-e0b6ce9
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-AGOH44BE.mjs → chunk-4FI4BC6Y.mjs} +67 -51
- package/dist/development/{chunk-IMKEG5CI.mjs → chunk-F6CT5MEB.mjs} +314 -30
- package/dist/development/{chunk-LUB73E44.js → chunk-INO4IHBF.js} +352 -71
- package/dist/development/{chunk-2G2U5HGB.js → chunk-ITZFCV4J.js} +164 -161
- package/dist/development/dom-export.d.mts +59 -4
- package/dist/development/dom-export.d.ts +59 -3
- package/dist/development/dom-export.js +8 -5
- package/dist/development/dom-export.mjs +8 -5
- package/dist/development/{index-react-server-client-DKvU8YRr.d.ts → index-react-server-client-CYIi6gi0.d.mts} +198 -134
- package/dist/{production/index-react-server-client-DKvU8YRr.d.ts → development/index-react-server-client-ChBGplLn.d.ts} +198 -134
- package/dist/development/index-react-server-client.d.mts +3 -3
- package/dist/development/index-react-server-client.d.ts +3 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +90 -1
- package/dist/development/index-react-server.d.ts +90 -1
- package/dist/development/index-react-server.js +188 -9
- package/dist/development/index-react-server.mjs +188 -9
- package/dist/development/index.d.mts +13 -20
- package/dist/development/index.d.ts +13 -18
- package/dist/development/index.js +161 -147
- package/dist/development/index.mjs +3 -5
- package/dist/development/instrumentation-BGrNA7uj.d.ts +1122 -0
- package/dist/development/lib/types/internal.d.mts +3 -3
- package/dist/development/lib/types/internal.d.ts +3 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-BrVEYTED.d.mts → register-DiOIlEq5.d.mts} +1 -7
- package/dist/{production/register-BrVEYTED.d.mts → development/register-DiOIlEq5.d.ts} +1 -7
- package/dist/development/{route-data-CDwqkzPE.d.mts → routeModules-Cy4Xsfoi.d.mts} +157 -147
- package/dist/{production/routeModules-BmVo7q9e.d.ts → development/routeModules-DqotkItD.d.ts} +73 -1046
- package/dist/{production/context-BqL5Eckq.d.mts → development/router-DWv6Clt-.d.mts} +1390 -1253
- package/dist/production/{chunk-AODJW4D3.mjs → chunk-52MYED7O.mjs} +67 -51
- package/dist/production/{chunk-FGRCWJDI.js → chunk-DASXXYNZ.js} +164 -161
- package/dist/production/{chunk-2L5AG5Y5.js → chunk-K7VXYOZD.js} +352 -71
- package/dist/production/{chunk-UOQCOPF6.mjs → chunk-LKSLGWXX.mjs} +314 -30
- package/dist/production/dom-export.d.mts +59 -4
- package/dist/production/dom-export.d.ts +59 -3
- package/dist/production/dom-export.js +8 -5
- package/dist/production/dom-export.mjs +8 -5
- package/dist/production/{index-react-server-client-2EDmGlsZ.d.mts → index-react-server-client-CYIi6gi0.d.mts} +140 -77
- package/dist/{development/index-react-server-client-2EDmGlsZ.d.mts → production/index-react-server-client-ChBGplLn.d.ts} +140 -77
- package/dist/production/index-react-server-client.d.mts +3 -3
- package/dist/production/index-react-server-client.d.ts +3 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +90 -1
- package/dist/production/index-react-server.d.ts +90 -1
- package/dist/production/index-react-server.js +188 -9
- package/dist/production/index-react-server.mjs +188 -9
- package/dist/production/index.d.mts +13 -20
- package/dist/production/index.d.ts +13 -18
- package/dist/production/index.js +161 -147
- package/dist/production/index.mjs +3 -5
- package/dist/production/instrumentation-BGrNA7uj.d.ts +1122 -0
- package/dist/production/lib/types/internal.d.mts +3 -3
- package/dist/production/lib/types/internal.d.ts +3 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/register-D8NQoPsO.d.ts → production/register-DiOIlEq5.d.mts} +1 -7
- package/dist/production/{register-D8NQoPsO.d.ts → register-DiOIlEq5.d.ts} +1 -7
- package/dist/production/{route-data-CDwqkzPE.d.mts → routeModules-Cy4Xsfoi.d.mts} +157 -147
- package/dist/{development/routeModules-BmVo7q9e.d.ts → production/routeModules-DqotkItD.d.ts} +73 -1046
- package/dist/{development/context-BqL5Eckq.d.mts → production/router-DWv6Clt-.d.mts} +1390 -1253
- package/package.json +1 -1
|
@@ -351,6 +351,11 @@ 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;
|
|
354
359
|
/**
|
|
355
360
|
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
356
361
|
* @example
|
|
@@ -571,7 +576,7 @@ type AgnosticPatchRoutesOnNavigationFunction<O extends AgnosticRouteObject = Agn
|
|
|
571
576
|
* properties from framework-agnostic properties
|
|
572
577
|
*/
|
|
573
578
|
interface MapRoutePropertiesFunction {
|
|
574
|
-
(route:
|
|
579
|
+
(route: AgnosticDataRouteObject): {
|
|
575
580
|
hasErrorBoundary: boolean;
|
|
576
581
|
} & Record<string, any>;
|
|
577
582
|
}
|
|
@@ -887,6 +892,83 @@ type ErrorResponse = {
|
|
|
887
892
|
*/
|
|
888
893
|
declare function isRouteErrorResponse(error: any): error is ErrorResponse;
|
|
889
894
|
|
|
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 InstrumentFunction<T> {
|
|
907
|
+
(handler: () => Promise<void>, info: T): Promise<void>;
|
|
908
|
+
}
|
|
909
|
+
type ReadonlyRequest = {
|
|
910
|
+
method: string;
|
|
911
|
+
url: string;
|
|
912
|
+
headers: Pick<Headers, "get">;
|
|
913
|
+
};
|
|
914
|
+
type ReadonlyContext = Pick<RouterContextProvider, "get">;
|
|
915
|
+
type InstrumentableRoute = {
|
|
916
|
+
id: string;
|
|
917
|
+
index: boolean | undefined;
|
|
918
|
+
path: string | undefined;
|
|
919
|
+
instrument(instrumentations: RouteInstrumentations): void;
|
|
920
|
+
};
|
|
921
|
+
type RouteInstrumentations = {
|
|
922
|
+
lazy?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
|
923
|
+
"lazy.loader"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
|
924
|
+
"lazy.action"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
|
925
|
+
"lazy.middleware"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
|
926
|
+
middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
|
927
|
+
loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
|
928
|
+
action?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
|
929
|
+
};
|
|
930
|
+
type RouteLazyInstrumentationInfo = undefined;
|
|
931
|
+
type RouteHandlerInstrumentationInfo = Readonly<{
|
|
932
|
+
request: ReadonlyRequest;
|
|
933
|
+
params: LoaderFunctionArgs["params"];
|
|
934
|
+
unstable_pattern: string;
|
|
935
|
+
context: ReadonlyContext;
|
|
936
|
+
}>;
|
|
937
|
+
type InstrumentableRouter = {
|
|
938
|
+
instrument(instrumentations: RouterInstrumentations): void;
|
|
939
|
+
};
|
|
940
|
+
type RouterInstrumentations = {
|
|
941
|
+
navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo>;
|
|
942
|
+
fetch?: InstrumentFunction<RouterFetchInstrumentationInfo>;
|
|
943
|
+
};
|
|
944
|
+
type RouterNavigationInstrumentationInfo = Readonly<{
|
|
945
|
+
to: string | number;
|
|
946
|
+
currentUrl: string;
|
|
947
|
+
formMethod?: HTMLFormMethod;
|
|
948
|
+
formEncType?: FormEncType;
|
|
949
|
+
formData?: FormData;
|
|
950
|
+
body?: any;
|
|
951
|
+
}>;
|
|
952
|
+
type RouterFetchInstrumentationInfo = Readonly<{
|
|
953
|
+
href: string;
|
|
954
|
+
currentUrl: string;
|
|
955
|
+
fetcherKey: string;
|
|
956
|
+
formMethod?: HTMLFormMethod;
|
|
957
|
+
formEncType?: FormEncType;
|
|
958
|
+
formData?: FormData;
|
|
959
|
+
body?: any;
|
|
960
|
+
}>;
|
|
961
|
+
type InstrumentableRequestHandler = {
|
|
962
|
+
instrument(instrumentations: RequestHandlerInstrumentations): void;
|
|
963
|
+
};
|
|
964
|
+
type RequestHandlerInstrumentations = {
|
|
965
|
+
request?: InstrumentFunction<RequestHandlerInstrumentationInfo>;
|
|
966
|
+
};
|
|
967
|
+
type RequestHandlerInstrumentationInfo = Readonly<{
|
|
968
|
+
request: ReadonlyRequest;
|
|
969
|
+
context: ReadonlyContext;
|
|
970
|
+
}>;
|
|
971
|
+
|
|
890
972
|
/**
|
|
891
973
|
* A Router instance manages all navigation and data loading/mutations
|
|
892
974
|
*/
|
|
@@ -1171,6 +1253,7 @@ interface RouterInit {
|
|
|
1171
1253
|
history: History;
|
|
1172
1254
|
basename?: string;
|
|
1173
1255
|
getContext?: () => MaybePromise<RouterContextProvider>;
|
|
1256
|
+
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
|
1174
1257
|
mapRouteProperties?: MapRoutePropertiesFunction;
|
|
1175
1258
|
future?: Partial<FutureConfig>;
|
|
1176
1259
|
hydrationRouteProperties?: string[];
|
|
@@ -1437,6 +1520,7 @@ type BlockerFunction = (args: {
|
|
|
1437
1520
|
interface CreateStaticHandlerOptions {
|
|
1438
1521
|
basename?: string;
|
|
1439
1522
|
mapRouteProperties?: MapRoutePropertiesFunction;
|
|
1523
|
+
unstable_instrumentations?: Pick<unstable_ServerInstrumentation, "route">[];
|
|
1440
1524
|
future?: {};
|
|
1441
1525
|
}
|
|
1442
1526
|
declare function createStaticHandler(routes: AgnosticRouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;
|
|
@@ -1807,6 +1891,11 @@ type ClientDataFunctionArgs<Params> = {
|
|
|
1807
1891
|
* }
|
|
1808
1892
|
**/
|
|
1809
1893
|
params: Params;
|
|
1894
|
+
/**
|
|
1895
|
+
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
|
1896
|
+
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
|
1897
|
+
*/
|
|
1898
|
+
unstable_pattern: string;
|
|
1810
1899
|
/**
|
|
1811
1900
|
* When `future.v8_middleware` is not enabled, this is undefined.
|
|
1812
1901
|
*
|
|
@@ -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-e0b6ce9
|
|
31
31
|
*
|
|
32
32
|
* Copyright (c) Remix Software Inc.
|
|
33
33
|
*
|
|
@@ -107,6 +107,139 @@ function parsePath(path) {
|
|
|
107
107
|
return parsedPath;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
// lib/router/instrumentation.ts
|
|
111
|
+
var UninstrumentedSymbol = Symbol("Uninstrumented");
|
|
112
|
+
function getRouteInstrumentationUpdates(fns, route) {
|
|
113
|
+
let aggregated = {
|
|
114
|
+
lazy: [],
|
|
115
|
+
"lazy.loader": [],
|
|
116
|
+
"lazy.action": [],
|
|
117
|
+
"lazy.middleware": [],
|
|
118
|
+
middleware: [],
|
|
119
|
+
loader: [],
|
|
120
|
+
action: []
|
|
121
|
+
};
|
|
122
|
+
fns.forEach(
|
|
123
|
+
(fn) => fn({
|
|
124
|
+
id: route.id,
|
|
125
|
+
index: route.index,
|
|
126
|
+
path: route.path,
|
|
127
|
+
instrument(i) {
|
|
128
|
+
let keys = Object.keys(aggregated);
|
|
129
|
+
for (let key of keys) {
|
|
130
|
+
if (i[key]) {
|
|
131
|
+
aggregated[key].push(i[key]);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
);
|
|
137
|
+
let updates = {};
|
|
138
|
+
if (typeof route.lazy === "function" && aggregated.lazy.length > 0) {
|
|
139
|
+
let instrumented = wrapImpl(aggregated.lazy, route.lazy, () => void 0);
|
|
140
|
+
if (instrumented) {
|
|
141
|
+
updates.lazy = instrumented;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (typeof route.lazy === "object") {
|
|
145
|
+
let lazyObject = route.lazy;
|
|
146
|
+
["middleware", "loader", "action"].forEach((key) => {
|
|
147
|
+
let lazyFn = lazyObject[key];
|
|
148
|
+
let instrumentations = aggregated[`lazy.${key}`];
|
|
149
|
+
if (typeof lazyFn === "function" && instrumentations.length > 0) {
|
|
150
|
+
let instrumented = wrapImpl(instrumentations, lazyFn, () => void 0);
|
|
151
|
+
if (instrumented) {
|
|
152
|
+
updates.lazy = Object.assign(updates.lazy || {}, {
|
|
153
|
+
[key]: instrumented
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
["loader", "action"].forEach((key) => {
|
|
160
|
+
let handler = route[key];
|
|
161
|
+
if (typeof handler === "function" && aggregated[key].length > 0) {
|
|
162
|
+
let original = handler[UninstrumentedSymbol] ?? handler;
|
|
163
|
+
let instrumented = wrapImpl(
|
|
164
|
+
aggregated[key],
|
|
165
|
+
original,
|
|
166
|
+
(...args) => getHandlerInfo(args[0])
|
|
167
|
+
);
|
|
168
|
+
if (instrumented) {
|
|
169
|
+
instrumented[UninstrumentedSymbol] = original;
|
|
170
|
+
updates[key] = instrumented;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
if (route.middleware && route.middleware.length > 0 && aggregated.middleware.length > 0) {
|
|
175
|
+
updates.middleware = route.middleware.map((middleware) => {
|
|
176
|
+
let original = middleware[UninstrumentedSymbol] ?? middleware;
|
|
177
|
+
let instrumented = wrapImpl(
|
|
178
|
+
aggregated.middleware,
|
|
179
|
+
original,
|
|
180
|
+
(...args) => getHandlerInfo(args[0])
|
|
181
|
+
);
|
|
182
|
+
if (instrumented) {
|
|
183
|
+
instrumented[UninstrumentedSymbol] = original;
|
|
184
|
+
return instrumented;
|
|
185
|
+
}
|
|
186
|
+
return middleware;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
return updates;
|
|
190
|
+
}
|
|
191
|
+
function wrapImpl(impls, handler, getInfo) {
|
|
192
|
+
if (impls.length === 0) {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
return async (...args) => {
|
|
196
|
+
let value;
|
|
197
|
+
let info = getInfo(...args);
|
|
198
|
+
await recurseRight(
|
|
199
|
+
impls,
|
|
200
|
+
info,
|
|
201
|
+
async () => {
|
|
202
|
+
value = await handler(...args);
|
|
203
|
+
},
|
|
204
|
+
impls.length - 1
|
|
205
|
+
);
|
|
206
|
+
return value;
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
async function recurseRight(impls, info, handler, index) {
|
|
210
|
+
let impl = impls[index];
|
|
211
|
+
if (!impl) {
|
|
212
|
+
await handler();
|
|
213
|
+
} else {
|
|
214
|
+
await impl(async () => {
|
|
215
|
+
await recurseRight(impls, info, handler, index - 1);
|
|
216
|
+
}, info);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function getHandlerInfo(args) {
|
|
220
|
+
let { request, context, params, unstable_pattern } = args;
|
|
221
|
+
return {
|
|
222
|
+
request: getReadonlyRequest(request),
|
|
223
|
+
params: { ...params },
|
|
224
|
+
unstable_pattern,
|
|
225
|
+
context: getReadonlyContext(context)
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function getReadonlyRequest(request) {
|
|
229
|
+
return {
|
|
230
|
+
method: request.method,
|
|
231
|
+
url: request.url,
|
|
232
|
+
headers: {
|
|
233
|
+
get: (...args) => request.headers.get(...args)
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function getReadonlyContext(context) {
|
|
238
|
+
return {
|
|
239
|
+
get: (ctx) => context.get(ctx)
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
110
243
|
// lib/router/utils.ts
|
|
111
244
|
function createContext(defaultValue) {
|
|
112
245
|
return { defaultValue };
|
|
@@ -200,19 +333,23 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
|
|
|
200
333
|
if (isIndexRoute(route)) {
|
|
201
334
|
let indexRoute = {
|
|
202
335
|
...route,
|
|
203
|
-
...mapRouteProperties(route),
|
|
204
336
|
id
|
|
205
337
|
};
|
|
206
|
-
manifest[id] =
|
|
338
|
+
manifest[id] = mergeRouteUpdates(
|
|
339
|
+
indexRoute,
|
|
340
|
+
mapRouteProperties(indexRoute)
|
|
341
|
+
);
|
|
207
342
|
return indexRoute;
|
|
208
343
|
} else {
|
|
209
344
|
let pathOrLayoutRoute = {
|
|
210
345
|
...route,
|
|
211
|
-
...mapRouteProperties(route),
|
|
212
346
|
id,
|
|
213
347
|
children: void 0
|
|
214
348
|
};
|
|
215
|
-
manifest[id] =
|
|
349
|
+
manifest[id] = mergeRouteUpdates(
|
|
350
|
+
pathOrLayoutRoute,
|
|
351
|
+
mapRouteProperties(pathOrLayoutRoute)
|
|
352
|
+
);
|
|
216
353
|
if (route.children) {
|
|
217
354
|
pathOrLayoutRoute.children = convertRoutesToDataRoutes(
|
|
218
355
|
route.children,
|
|
@@ -226,6 +363,17 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
|
|
|
226
363
|
}
|
|
227
364
|
});
|
|
228
365
|
}
|
|
366
|
+
function mergeRouteUpdates(route, updates) {
|
|
367
|
+
return Object.assign(route, {
|
|
368
|
+
...updates,
|
|
369
|
+
...typeof updates.lazy === "object" && updates.lazy != null ? {
|
|
370
|
+
lazy: {
|
|
371
|
+
...route.lazy,
|
|
372
|
+
...updates.lazy
|
|
373
|
+
}
|
|
374
|
+
} : {}
|
|
375
|
+
});
|
|
376
|
+
}
|
|
229
377
|
function matchRoutes(routes, locationArg, basename = "/") {
|
|
230
378
|
return matchRoutesImpl(routes, locationArg, basename, false);
|
|
231
379
|
}
|
|
@@ -652,6 +800,9 @@ var ErrorResponseImpl = class {
|
|
|
652
800
|
function isRouteErrorResponse(error) {
|
|
653
801
|
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
|
654
802
|
}
|
|
803
|
+
function getRoutePattern(paths) {
|
|
804
|
+
return paths.filter(Boolean).join("/").replace(/\/\/*/g, "/");
|
|
805
|
+
}
|
|
655
806
|
|
|
656
807
|
// lib/router/router.ts
|
|
657
808
|
var validMutationMethodsArr = [
|
|
@@ -682,7 +833,20 @@ function createStaticHandler(routes, opts) {
|
|
|
682
833
|
);
|
|
683
834
|
let manifest = {};
|
|
684
835
|
let basename = (opts ? opts.basename : null) || "/";
|
|
685
|
-
let
|
|
836
|
+
let _mapRouteProperties = opts?.mapRouteProperties || defaultMapRouteProperties;
|
|
837
|
+
let mapRouteProperties = _mapRouteProperties;
|
|
838
|
+
if (opts?.unstable_instrumentations) {
|
|
839
|
+
let instrumentations = opts.unstable_instrumentations;
|
|
840
|
+
mapRouteProperties = (route) => {
|
|
841
|
+
return {
|
|
842
|
+
..._mapRouteProperties(route),
|
|
843
|
+
...getRouteInstrumentationUpdates(
|
|
844
|
+
instrumentations.map((i) => i.route).filter(Boolean),
|
|
845
|
+
route
|
|
846
|
+
)
|
|
847
|
+
};
|
|
848
|
+
};
|
|
849
|
+
}
|
|
686
850
|
let dataRoutes = convertRoutesToDataRoutes(
|
|
687
851
|
routes,
|
|
688
852
|
mapRouteProperties,
|
|
@@ -752,6 +916,7 @@ function createStaticHandler(routes, opts) {
|
|
|
752
916
|
let response = await runServerMiddlewarePipeline(
|
|
753
917
|
{
|
|
754
918
|
request,
|
|
919
|
+
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
755
920
|
matches,
|
|
756
921
|
params: matches[0].params,
|
|
757
922
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -897,6 +1062,7 @@ function createStaticHandler(routes, opts) {
|
|
|
897
1062
|
let response = await runServerMiddlewarePipeline(
|
|
898
1063
|
{
|
|
899
1064
|
request,
|
|
1065
|
+
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
900
1066
|
matches,
|
|
901
1067
|
params: matches[0].params,
|
|
902
1068
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -1172,12 +1338,14 @@ function createStaticHandler(routes, opts) {
|
|
|
1172
1338
|
// Up to but not including the boundary
|
|
1173
1339
|
matches.findIndex((m) => m.route.id === pendingActionResult[0]) - 1
|
|
1174
1340
|
) : void 0;
|
|
1341
|
+
let pattern = getRoutePattern(matches.map((m) => m.route.path));
|
|
1175
1342
|
dsMatches = matches.map((match, index) => {
|
|
1176
1343
|
if (maxIdx != null && index > maxIdx) {
|
|
1177
1344
|
return getDataStrategyMatch(
|
|
1178
1345
|
mapRouteProperties,
|
|
1179
1346
|
manifest,
|
|
1180
1347
|
request,
|
|
1348
|
+
pattern,
|
|
1181
1349
|
match,
|
|
1182
1350
|
[],
|
|
1183
1351
|
requestContext,
|
|
@@ -1188,6 +1356,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1188
1356
|
mapRouteProperties,
|
|
1189
1357
|
manifest,
|
|
1190
1358
|
request,
|
|
1359
|
+
pattern,
|
|
1191
1360
|
match,
|
|
1192
1361
|
[],
|
|
1193
1362
|
requestContext,
|
|
@@ -1526,12 +1695,17 @@ function runServerMiddlewarePipeline(args, handler, errorHandler) {
|
|
|
1526
1695
|
}
|
|
1527
1696
|
}
|
|
1528
1697
|
async function runMiddlewarePipeline(args, handler, processResult, isResult, errorHandler) {
|
|
1529
|
-
let { matches, request, params, context } = args;
|
|
1698
|
+
let { matches, request, params, context, unstable_pattern } = args;
|
|
1530
1699
|
let tuples = matches.flatMap(
|
|
1531
1700
|
(m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
|
|
1532
1701
|
);
|
|
1533
1702
|
let result = await callRouteMiddleware(
|
|
1534
|
-
{
|
|
1703
|
+
{
|
|
1704
|
+
request,
|
|
1705
|
+
params,
|
|
1706
|
+
context,
|
|
1707
|
+
unstable_pattern
|
|
1708
|
+
},
|
|
1535
1709
|
tuples,
|
|
1536
1710
|
handler,
|
|
1537
1711
|
processResult,
|
|
@@ -1609,7 +1783,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
|
|
|
1609
1783
|
handler: lazyRoutePromises.lazyHandlerPromise
|
|
1610
1784
|
};
|
|
1611
1785
|
}
|
|
1612
|
-
function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
|
|
1786
|
+
function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
|
|
1613
1787
|
let isUsingNewApi = false;
|
|
1614
1788
|
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
|
1615
1789
|
mapRouteProperties,
|
|
@@ -1643,6 +1817,7 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazy
|
|
|
1643
1817
|
if (callHandler && !isMiddlewareOnlyRoute) {
|
|
1644
1818
|
return callLoaderOrAction({
|
|
1645
1819
|
request,
|
|
1820
|
+
unstable_pattern,
|
|
1646
1821
|
match,
|
|
1647
1822
|
lazyHandlerPromise: _lazyPromises?.handler,
|
|
1648
1823
|
lazyRoutePromise: _lazyPromises?.route,
|
|
@@ -1676,6 +1851,7 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
1676
1851
|
mapRouteProperties,
|
|
1677
1852
|
manifest,
|
|
1678
1853
|
request,
|
|
1854
|
+
getRoutePattern(matches.map((m) => m.route.path)),
|
|
1679
1855
|
match,
|
|
1680
1856
|
lazyRoutePropertiesToSkip,
|
|
1681
1857
|
scopedContext,
|
|
@@ -1690,6 +1866,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
1690
1866
|
}
|
|
1691
1867
|
let dataStrategyArgs = {
|
|
1692
1868
|
request,
|
|
1869
|
+
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
1693
1870
|
params: matches[0].params,
|
|
1694
1871
|
context: scopedContext,
|
|
1695
1872
|
matches
|
|
@@ -1717,6 +1894,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
1717
1894
|
}
|
|
1718
1895
|
async function callLoaderOrAction({
|
|
1719
1896
|
request,
|
|
1897
|
+
unstable_pattern,
|
|
1720
1898
|
match,
|
|
1721
1899
|
lazyHandlerPromise,
|
|
1722
1900
|
lazyRoutePromise,
|
|
@@ -1743,6 +1921,7 @@ async function callLoaderOrAction({
|
|
|
1743
1921
|
return handler(
|
|
1744
1922
|
{
|
|
1745
1923
|
request,
|
|
1924
|
+
unstable_pattern,
|
|
1746
1925
|
params: match.params,
|
|
1747
1926
|
context: scopedContext
|
|
1748
1927
|
},
|