react-router 0.0.0-experimental-e613d4238 → 0.0.0-experimental-4e44d47
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-YJ6T7YSE.js → chunk-7B7CUJYE.js} +345 -66
- package/dist/development/{chunk-XXC4LMW2.js → chunk-MTLWRICG.js} +164 -161
- package/dist/development/{chunk-2YVPYFDJ.mjs → chunk-PSQFTIPQ.mjs} +67 -51
- package/dist/development/{chunk-5P3HEZQU.mjs → chunk-XVVWTPHF.mjs} +307 -25
- 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-83aVZHgI.d.ts} +198 -134
- package/dist/{production/index-react-server-client-2EDmGlsZ.d.mts → development/index-react-server-client-BDG19ZQl.d.mts} +140 -77
- 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 +106 -1
- package/dist/development/index-react-server.d.ts +106 -1
- package/dist/development/index-react-server.js +181 -8
- package/dist/development/index-react-server.mjs +181 -8
- package/dist/development/index.d.mts +13 -18
- package/dist/development/index.d.ts +13 -16
- package/dist/development/index.js +161 -147
- package/dist/development/index.mjs +3 -5
- package/dist/development/instrumentation-XYmrzhe3.d.ts +1138 -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/{routeModules-BmVo7q9e.d.ts → routeModules-Bu1JamQV.d.ts} +73 -1046
- package/dist/development/{route-data-CDwqkzPE.d.mts → routeModules-CtCOLGtG.d.mts} +157 -147
- package/dist/development/{context-BqL5Eckq.d.mts → router-2BoB34m1.d.mts} +1403 -1250
- package/dist/production/{chunk-VNGQS422.mjs → chunk-GSSVRQ6M.mjs} +307 -25
- package/dist/production/{chunk-5MHETEIL.mjs → chunk-IZVJSKMU.mjs} +67 -51
- package/dist/production/{chunk-QBUHFRYZ.js → chunk-OXRQQZPR.js} +345 -66
- package/dist/production/{chunk-E4G6PZCJ.js → chunk-UNIYMJFU.js} +164 -161
- 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/{development/index-react-server-client-2EDmGlsZ.d.mts → production/index-react-server-client-83aVZHgI.d.ts} +140 -77
- package/dist/production/{index-react-server-client-DKvU8YRr.d.ts → index-react-server-client-BDG19ZQl.d.mts} +198 -134
- 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 +106 -1
- package/dist/production/index-react-server.d.ts +106 -1
- package/dist/production/index-react-server.js +181 -8
- package/dist/production/index-react-server.mjs +181 -8
- package/dist/production/index.d.mts +13 -18
- package/dist/production/index.d.ts +13 -16
- package/dist/production/index.js +161 -147
- package/dist/production/index.mjs +3 -5
- package/dist/production/instrumentation-XYmrzhe3.d.ts +1138 -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/{routeModules-BmVo7q9e.d.ts → routeModules-Bu1JamQV.d.ts} +73 -1046
- package/dist/production/{route-data-CDwqkzPE.d.mts → routeModules-CtCOLGtG.d.mts} +157 -147
- package/dist/production/{context-BqL5Eckq.d.mts → router-2BoB34m1.d.mts} +1403 -1250
- 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
|
+
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,99 @@ 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 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
|
+
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
|
+
|
|
890
988
|
/**
|
|
891
989
|
* A Router instance manages all navigation and data loading/mutations
|
|
892
990
|
*/
|
|
@@ -1171,6 +1269,7 @@ interface RouterInit {
|
|
|
1171
1269
|
history: History;
|
|
1172
1270
|
basename?: string;
|
|
1173
1271
|
getContext?: () => MaybePromise<RouterContextProvider>;
|
|
1272
|
+
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
|
1174
1273
|
mapRouteProperties?: MapRoutePropertiesFunction;
|
|
1175
1274
|
future?: Partial<FutureConfig>;
|
|
1176
1275
|
hydrationRouteProperties?: string[];
|
|
@@ -1437,6 +1536,7 @@ type BlockerFunction = (args: {
|
|
|
1437
1536
|
interface CreateStaticHandlerOptions {
|
|
1438
1537
|
basename?: string;
|
|
1439
1538
|
mapRouteProperties?: MapRoutePropertiesFunction;
|
|
1539
|
+
unstable_instrumentations?: Pick<unstable_ServerInstrumentation, "route">[];
|
|
1440
1540
|
future?: {};
|
|
1441
1541
|
}
|
|
1442
1542
|
declare function createStaticHandler(routes: AgnosticRouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;
|
|
@@ -1807,6 +1907,11 @@ type ClientDataFunctionArgs<Params> = {
|
|
|
1807
1907
|
* }
|
|
1808
1908
|
**/
|
|
1809
1909
|
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
|
+
pattern: string;
|
|
1810
1915
|
/**
|
|
1811
1916
|
* When `future.v8_middleware` is not enabled, this is undefined.
|
|
1812
1917
|
*
|
|
@@ -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-4e44d47
|
|
31
31
|
*
|
|
32
32
|
* Copyright (c) Remix Software Inc.
|
|
33
33
|
*
|
|
@@ -107,6 +107,134 @@ 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, 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
|
+
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
|
+
|
|
110
238
|
// lib/router/utils.ts
|
|
111
239
|
function createContext(defaultValue) {
|
|
112
240
|
return { defaultValue };
|
|
@@ -200,19 +328,23 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
|
|
|
200
328
|
if (isIndexRoute(route)) {
|
|
201
329
|
let indexRoute = {
|
|
202
330
|
...route,
|
|
203
|
-
...mapRouteProperties(route),
|
|
204
331
|
id
|
|
205
332
|
};
|
|
206
|
-
manifest[id] =
|
|
333
|
+
manifest[id] = mergeRouteUpdates(
|
|
334
|
+
indexRoute,
|
|
335
|
+
mapRouteProperties(indexRoute)
|
|
336
|
+
);
|
|
207
337
|
return indexRoute;
|
|
208
338
|
} else {
|
|
209
339
|
let pathOrLayoutRoute = {
|
|
210
340
|
...route,
|
|
211
|
-
...mapRouteProperties(route),
|
|
212
341
|
id,
|
|
213
342
|
children: void 0
|
|
214
343
|
};
|
|
215
|
-
manifest[id] =
|
|
344
|
+
manifest[id] = mergeRouteUpdates(
|
|
345
|
+
pathOrLayoutRoute,
|
|
346
|
+
mapRouteProperties(pathOrLayoutRoute)
|
|
347
|
+
);
|
|
216
348
|
if (route.children) {
|
|
217
349
|
pathOrLayoutRoute.children = convertRoutesToDataRoutes(
|
|
218
350
|
route.children,
|
|
@@ -226,6 +358,17 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
|
|
|
226
358
|
}
|
|
227
359
|
});
|
|
228
360
|
}
|
|
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
|
+
}
|
|
229
372
|
function matchRoutes(routes, locationArg, basename = "/") {
|
|
230
373
|
return matchRoutesImpl(routes, locationArg, basename, false);
|
|
231
374
|
}
|
|
@@ -652,6 +795,9 @@ var ErrorResponseImpl = class {
|
|
|
652
795
|
function isRouteErrorResponse(error) {
|
|
653
796
|
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
|
654
797
|
}
|
|
798
|
+
function getRoutePattern(paths) {
|
|
799
|
+
return paths.filter(Boolean).join("/").replace(/\/\/*/g, "/");
|
|
800
|
+
}
|
|
655
801
|
|
|
656
802
|
// lib/router/router.ts
|
|
657
803
|
var validMutationMethodsArr = [
|
|
@@ -682,7 +828,20 @@ function createStaticHandler(routes, opts) {
|
|
|
682
828
|
);
|
|
683
829
|
let manifest = {};
|
|
684
830
|
let basename = (opts ? opts.basename : null) || "/";
|
|
685
|
-
let
|
|
831
|
+
let _mapRouteProperties = opts?.mapRouteProperties || defaultMapRouteProperties;
|
|
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
|
+
}
|
|
686
845
|
let dataRoutes = convertRoutesToDataRoutes(
|
|
687
846
|
routes,
|
|
688
847
|
mapRouteProperties,
|
|
@@ -752,6 +911,7 @@ function createStaticHandler(routes, opts) {
|
|
|
752
911
|
let response = await runServerMiddlewarePipeline(
|
|
753
912
|
{
|
|
754
913
|
request,
|
|
914
|
+
pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
755
915
|
matches,
|
|
756
916
|
params: matches[0].params,
|
|
757
917
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -897,6 +1057,7 @@ function createStaticHandler(routes, opts) {
|
|
|
897
1057
|
let response = await runServerMiddlewarePipeline(
|
|
898
1058
|
{
|
|
899
1059
|
request,
|
|
1060
|
+
pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
900
1061
|
matches,
|
|
901
1062
|
params: matches[0].params,
|
|
902
1063
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -1178,6 +1339,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1178
1339
|
mapRouteProperties,
|
|
1179
1340
|
manifest,
|
|
1180
1341
|
request,
|
|
1342
|
+
getRoutePattern(matches.map((m) => m.route.path)),
|
|
1181
1343
|
match,
|
|
1182
1344
|
[],
|
|
1183
1345
|
requestContext,
|
|
@@ -1188,6 +1350,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1188
1350
|
mapRouteProperties,
|
|
1189
1351
|
manifest,
|
|
1190
1352
|
request,
|
|
1353
|
+
getRoutePattern(matches.map((m) => m.route.path)),
|
|
1191
1354
|
match,
|
|
1192
1355
|
[],
|
|
1193
1356
|
requestContext,
|
|
@@ -1531,7 +1694,12 @@ async function runMiddlewarePipeline(args, handler, processResult, isResult, err
|
|
|
1531
1694
|
(m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
|
|
1532
1695
|
);
|
|
1533
1696
|
let result = await callRouteMiddleware(
|
|
1534
|
-
{
|
|
1697
|
+
{
|
|
1698
|
+
request,
|
|
1699
|
+
params,
|
|
1700
|
+
context,
|
|
1701
|
+
pattern: getRoutePattern(matches.map((m) => m.route.path))
|
|
1702
|
+
},
|
|
1535
1703
|
tuples,
|
|
1536
1704
|
handler,
|
|
1537
1705
|
processResult,
|
|
@@ -1609,7 +1777,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
|
|
|
1609
1777
|
handler: lazyRoutePromises.lazyHandlerPromise
|
|
1610
1778
|
};
|
|
1611
1779
|
}
|
|
1612
|
-
function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
|
|
1780
|
+
function getDataStrategyMatch(mapRouteProperties, manifest, request, pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
|
|
1613
1781
|
let isUsingNewApi = false;
|
|
1614
1782
|
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
|
1615
1783
|
mapRouteProperties,
|
|
@@ -1643,6 +1811,7 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazy
|
|
|
1643
1811
|
if (callHandler && !isMiddlewareOnlyRoute) {
|
|
1644
1812
|
return callLoaderOrAction({
|
|
1645
1813
|
request,
|
|
1814
|
+
pattern,
|
|
1646
1815
|
match,
|
|
1647
1816
|
lazyHandlerPromise: _lazyPromises?.handler,
|
|
1648
1817
|
lazyRoutePromise: _lazyPromises?.route,
|
|
@@ -1676,6 +1845,7 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
1676
1845
|
mapRouteProperties,
|
|
1677
1846
|
manifest,
|
|
1678
1847
|
request,
|
|
1848
|
+
getRoutePattern(matches.map((m) => m.route.path)),
|
|
1679
1849
|
match,
|
|
1680
1850
|
lazyRoutePropertiesToSkip,
|
|
1681
1851
|
scopedContext,
|
|
@@ -1690,6 +1860,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
1690
1860
|
}
|
|
1691
1861
|
let dataStrategyArgs = {
|
|
1692
1862
|
request,
|
|
1863
|
+
pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
1693
1864
|
params: matches[0].params,
|
|
1694
1865
|
context: scopedContext,
|
|
1695
1866
|
matches
|
|
@@ -1717,6 +1888,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
1717
1888
|
}
|
|
1718
1889
|
async function callLoaderOrAction({
|
|
1719
1890
|
request,
|
|
1891
|
+
pattern,
|
|
1720
1892
|
match,
|
|
1721
1893
|
lazyHandlerPromise,
|
|
1722
1894
|
lazyRoutePromise,
|
|
@@ -1743,6 +1915,7 @@ async function callLoaderOrAction({
|
|
|
1743
1915
|
return handler(
|
|
1744
1916
|
{
|
|
1745
1917
|
request,
|
|
1918
|
+
pattern,
|
|
1746
1919
|
params: match.params,
|
|
1747
1920
|
context: scopedContext
|
|
1748
1921
|
},
|