react-router 7.9.4 → 7.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/dist/development/browser-BbBXFHbO.d.ts +310 -0
- package/dist/development/browser-C07r42Tt.d.mts +310 -0
- package/dist/development/{chunk-OIYGIGL5.mjs → chunk-4WY6JWTD.mjs} +458 -43
- package/dist/development/{chunk-DI2QHYMJ.js → chunk-AMVS5XVJ.js} +1314 -138
- package/dist/development/{chunk-WY5IRSCW.mjs → chunk-G3INQAYP.mjs} +197 -857
- package/dist/development/chunk-O4JVZSOY.js +1310 -0
- package/dist/development/chunk-PZWDWJAY.js +188 -0
- package/dist/development/dom-export.d.mts +103 -6
- package/dist/development/dom-export.d.ts +103 -4
- package/dist/development/dom-export.js +708 -20
- package/dist/development/dom-export.mjs +692 -11
- package/dist/{production/index-react-server-client-BbRcBjrA.d.ts → development/index-react-server-client-Da3kmxNd.d.ts} +195 -135
- package/dist/{production/index-react-server-client-BIz4AUNd.d.mts → development/index-react-server-client-rcoGPJhU.d.mts} +137 -78
- package/dist/development/index-react-server-client.d.mts +2 -3
- package/dist/development/index-react-server-client.d.ts +2 -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 +107 -3
- package/dist/development/index-react-server.d.ts +107 -3
- package/dist/development/index-react-server.js +259 -13
- package/dist/development/index-react-server.mjs +259 -13
- package/dist/development/index.d.mts +14 -320
- package/dist/development/index.d.ts +14 -362
- package/dist/development/index.js +146 -962
- package/dist/development/index.mjs +3 -9
- package/dist/development/{routeModules-D5iJ6JYT.d.ts → instrumentation-Unc20tLk.d.ts} +178 -25
- package/dist/development/lib/types/internal.d.mts +2 -3
- 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/{production/register-C34pU-in.d.ts → development/register-BpU9rFBJ.d.ts} +1 -1
- package/dist/development/{register-CI4bTprK.d.mts → register-QkB3HGjm.d.mts} +1 -1
- package/dist/{production/context-DSyS5mLj.d.mts → development/router-CAvh_Drx.d.mts} +1877 -1254
- package/dist/production/browser-BbBXFHbO.d.ts +310 -0
- package/dist/production/browser-C07r42Tt.d.mts +310 -0
- package/dist/production/{chunk-4E5LHRQP.js → chunk-EAIF67OW.js} +1314 -138
- package/dist/production/{chunk-FR6HSPLK.mjs → chunk-FDUMZGKM.mjs} +197 -857
- package/dist/production/{chunk-3TADTUL4.mjs → chunk-FUSXQSWG.mjs} +458 -43
- package/dist/production/chunk-G5A35OQU.js +188 -0
- package/dist/production/chunk-QN64DHI4.js +1310 -0
- package/dist/production/dom-export.d.mts +103 -6
- package/dist/production/dom-export.d.ts +103 -4
- package/dist/production/dom-export.js +708 -20
- package/dist/production/dom-export.mjs +692 -11
- package/dist/{development/index-react-server-client-BIz4AUNd.d.mts → production/index-react-server-client-Da3kmxNd.d.ts} +137 -78
- package/dist/{development/index-react-server-client-BbRcBjrA.d.ts → production/index-react-server-client-rcoGPJhU.d.mts} +195 -135
- package/dist/production/index-react-server-client.d.mts +2 -3
- package/dist/production/index-react-server-client.d.ts +2 -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 +107 -3
- package/dist/production/index-react-server.d.ts +107 -3
- package/dist/production/index-react-server.js +259 -13
- package/dist/production/index-react-server.mjs +259 -13
- package/dist/production/index.d.mts +14 -320
- package/dist/production/index.d.ts +14 -362
- package/dist/production/index.js +146 -962
- package/dist/production/index.mjs +3 -9
- package/dist/production/{routeModules-D5iJ6JYT.d.ts → instrumentation-Unc20tLk.d.ts} +178 -25
- package/dist/production/lib/types/internal.d.mts +2 -3
- 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/{development/register-C34pU-in.d.ts → production/register-BpU9rFBJ.d.ts} +1 -1
- package/dist/production/{register-CI4bTprK.d.mts → register-QkB3HGjm.d.mts} +1 -1
- package/dist/{development/context-DSyS5mLj.d.mts → production/router-CAvh_Drx.d.mts} +1877 -1254
- package/package.json +1 -1
- package/dist/development/browser-z32v5KVN.d.mts +0 -46
- package/dist/development/chunk-72XNTZCV.js +0 -2089
- package/dist/development/route-data-DZQOUSqV.d.mts +0 -473
- package/dist/production/browser-z32v5KVN.d.mts +0 -46
- package/dist/production/chunk-WNLQ53P5.js +0 -2089
- package/dist/production/route-data-DZQOUSqV.d.mts +0 -473
|
@@ -6,7 +6,7 @@ export { BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta, NavLi
|
|
|
6
6
|
import { serialize, parse } from 'cookie';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* react-router v7.9.
|
|
9
|
+
* react-router v7.9.6
|
|
10
10
|
*
|
|
11
11
|
* Copyright (c) Remix Software Inc.
|
|
12
12
|
*
|
|
@@ -86,6 +86,185 @@ function parsePath(path) {
|
|
|
86
86
|
return parsedPath;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
// lib/router/instrumentation.ts
|
|
90
|
+
var UninstrumentedSymbol = Symbol("Uninstrumented");
|
|
91
|
+
function getRouteInstrumentationUpdates(fns, route) {
|
|
92
|
+
let aggregated = {
|
|
93
|
+
lazy: [],
|
|
94
|
+
"lazy.loader": [],
|
|
95
|
+
"lazy.action": [],
|
|
96
|
+
"lazy.middleware": [],
|
|
97
|
+
middleware: [],
|
|
98
|
+
loader: [],
|
|
99
|
+
action: []
|
|
100
|
+
};
|
|
101
|
+
fns.forEach(
|
|
102
|
+
(fn) => fn({
|
|
103
|
+
id: route.id,
|
|
104
|
+
index: route.index,
|
|
105
|
+
path: route.path,
|
|
106
|
+
instrument(i) {
|
|
107
|
+
let keys = Object.keys(aggregated);
|
|
108
|
+
for (let key of keys) {
|
|
109
|
+
if (i[key]) {
|
|
110
|
+
aggregated[key].push(i[key]);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
);
|
|
116
|
+
let updates = {};
|
|
117
|
+
if (typeof route.lazy === "function" && aggregated.lazy.length > 0) {
|
|
118
|
+
let instrumented = wrapImpl(aggregated.lazy, route.lazy, () => void 0);
|
|
119
|
+
if (instrumented) {
|
|
120
|
+
updates.lazy = instrumented;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (typeof route.lazy === "object") {
|
|
124
|
+
let lazyObject = route.lazy;
|
|
125
|
+
["middleware", "loader", "action"].forEach((key) => {
|
|
126
|
+
let lazyFn = lazyObject[key];
|
|
127
|
+
let instrumentations = aggregated[`lazy.${key}`];
|
|
128
|
+
if (typeof lazyFn === "function" && instrumentations.length > 0) {
|
|
129
|
+
let instrumented = wrapImpl(instrumentations, lazyFn, () => void 0);
|
|
130
|
+
if (instrumented) {
|
|
131
|
+
updates.lazy = Object.assign(updates.lazy || {}, {
|
|
132
|
+
[key]: instrumented
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
["loader", "action"].forEach((key) => {
|
|
139
|
+
let handler = route[key];
|
|
140
|
+
if (typeof handler === "function" && aggregated[key].length > 0) {
|
|
141
|
+
let original = handler[UninstrumentedSymbol] ?? handler;
|
|
142
|
+
let instrumented = wrapImpl(
|
|
143
|
+
aggregated[key],
|
|
144
|
+
original,
|
|
145
|
+
(...args) => getHandlerInfo(args[0])
|
|
146
|
+
);
|
|
147
|
+
if (instrumented) {
|
|
148
|
+
instrumented[UninstrumentedSymbol] = original;
|
|
149
|
+
updates[key] = instrumented;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
if (route.middleware && route.middleware.length > 0 && aggregated.middleware.length > 0) {
|
|
154
|
+
updates.middleware = route.middleware.map((middleware) => {
|
|
155
|
+
let original = middleware[UninstrumentedSymbol] ?? middleware;
|
|
156
|
+
let instrumented = wrapImpl(
|
|
157
|
+
aggregated.middleware,
|
|
158
|
+
original,
|
|
159
|
+
(...args) => getHandlerInfo(args[0])
|
|
160
|
+
);
|
|
161
|
+
if (instrumented) {
|
|
162
|
+
instrumented[UninstrumentedSymbol] = original;
|
|
163
|
+
return instrumented;
|
|
164
|
+
}
|
|
165
|
+
return middleware;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
return updates;
|
|
169
|
+
}
|
|
170
|
+
function wrapImpl(impls, handler, getInfo) {
|
|
171
|
+
if (impls.length === 0) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
return async (...args) => {
|
|
175
|
+
let result = await recurseRight(
|
|
176
|
+
impls,
|
|
177
|
+
getInfo(...args),
|
|
178
|
+
() => handler(...args),
|
|
179
|
+
impls.length - 1
|
|
180
|
+
);
|
|
181
|
+
if (result.type === "error") {
|
|
182
|
+
throw result.value;
|
|
183
|
+
}
|
|
184
|
+
return result.value;
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
async function recurseRight(impls, info, handler, index) {
|
|
188
|
+
let impl = impls[index];
|
|
189
|
+
let result;
|
|
190
|
+
if (!impl) {
|
|
191
|
+
try {
|
|
192
|
+
let value = await handler();
|
|
193
|
+
result = { type: "success", value };
|
|
194
|
+
} catch (e) {
|
|
195
|
+
result = { type: "error", value: e };
|
|
196
|
+
}
|
|
197
|
+
} else {
|
|
198
|
+
let handlerPromise = void 0;
|
|
199
|
+
let callHandler = async () => {
|
|
200
|
+
if (handlerPromise) {
|
|
201
|
+
console.error("You cannot call instrumented handlers more than once");
|
|
202
|
+
} else {
|
|
203
|
+
handlerPromise = recurseRight(impls, info, handler, index - 1);
|
|
204
|
+
}
|
|
205
|
+
result = await handlerPromise;
|
|
206
|
+
invariant(result, "Expected a result");
|
|
207
|
+
if (result.type === "error" && result.value instanceof Error) {
|
|
208
|
+
return { status: "error", error: result.value };
|
|
209
|
+
}
|
|
210
|
+
return { status: "success", error: void 0 };
|
|
211
|
+
};
|
|
212
|
+
try {
|
|
213
|
+
await impl(callHandler, info);
|
|
214
|
+
} catch (e) {
|
|
215
|
+
console.error("An instrumentation function threw an error:", e);
|
|
216
|
+
}
|
|
217
|
+
if (!handlerPromise) {
|
|
218
|
+
await callHandler();
|
|
219
|
+
}
|
|
220
|
+
await handlerPromise;
|
|
221
|
+
}
|
|
222
|
+
if (result) {
|
|
223
|
+
return result;
|
|
224
|
+
}
|
|
225
|
+
return {
|
|
226
|
+
type: "error",
|
|
227
|
+
value: new Error("No result assigned in instrumentation chain.")
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function getHandlerInfo(args) {
|
|
231
|
+
let { request, context, params, unstable_pattern } = args;
|
|
232
|
+
return {
|
|
233
|
+
request: getReadonlyRequest(request),
|
|
234
|
+
params: { ...params },
|
|
235
|
+
unstable_pattern,
|
|
236
|
+
context: getReadonlyContext(context)
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
function getReadonlyRequest(request) {
|
|
240
|
+
return {
|
|
241
|
+
method: request.method,
|
|
242
|
+
url: request.url,
|
|
243
|
+
headers: {
|
|
244
|
+
get: (...args) => request.headers.get(...args)
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
function getReadonlyContext(context) {
|
|
249
|
+
if (isPlainObject(context)) {
|
|
250
|
+
let frozen = { ...context };
|
|
251
|
+
Object.freeze(frozen);
|
|
252
|
+
return frozen;
|
|
253
|
+
} else {
|
|
254
|
+
return {
|
|
255
|
+
get: (ctx) => context.get(ctx)
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
var objectProtoNames = Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
|
|
260
|
+
function isPlainObject(thing) {
|
|
261
|
+
if (thing === null || typeof thing !== "object") {
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
const proto = Object.getPrototypeOf(thing);
|
|
265
|
+
return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames;
|
|
266
|
+
}
|
|
267
|
+
|
|
89
268
|
// lib/router/utils.ts
|
|
90
269
|
function createContext(defaultValue) {
|
|
91
270
|
return { defaultValue };
|
|
@@ -179,19 +358,23 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
|
|
|
179
358
|
if (isIndexRoute(route)) {
|
|
180
359
|
let indexRoute = {
|
|
181
360
|
...route,
|
|
182
|
-
...mapRouteProperties(route),
|
|
183
361
|
id
|
|
184
362
|
};
|
|
185
|
-
manifest[id] =
|
|
363
|
+
manifest[id] = mergeRouteUpdates(
|
|
364
|
+
indexRoute,
|
|
365
|
+
mapRouteProperties(indexRoute)
|
|
366
|
+
);
|
|
186
367
|
return indexRoute;
|
|
187
368
|
} else {
|
|
188
369
|
let pathOrLayoutRoute = {
|
|
189
370
|
...route,
|
|
190
|
-
...mapRouteProperties(route),
|
|
191
371
|
id,
|
|
192
372
|
children: void 0
|
|
193
373
|
};
|
|
194
|
-
manifest[id] =
|
|
374
|
+
manifest[id] = mergeRouteUpdates(
|
|
375
|
+
pathOrLayoutRoute,
|
|
376
|
+
mapRouteProperties(pathOrLayoutRoute)
|
|
377
|
+
);
|
|
195
378
|
if (route.children) {
|
|
196
379
|
pathOrLayoutRoute.children = convertRoutesToDataRoutes(
|
|
197
380
|
route.children,
|
|
@@ -205,6 +388,17 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
|
|
|
205
388
|
}
|
|
206
389
|
});
|
|
207
390
|
}
|
|
391
|
+
function mergeRouteUpdates(route, updates) {
|
|
392
|
+
return Object.assign(route, {
|
|
393
|
+
...updates,
|
|
394
|
+
...typeof updates.lazy === "object" && updates.lazy != null ? {
|
|
395
|
+
lazy: {
|
|
396
|
+
...route.lazy,
|
|
397
|
+
...updates.lazy
|
|
398
|
+
}
|
|
399
|
+
} : {}
|
|
400
|
+
});
|
|
401
|
+
}
|
|
208
402
|
function matchRoutes(routes, locationArg, basename = "/") {
|
|
209
403
|
return matchRoutesImpl(routes, locationArg, basename, false);
|
|
210
404
|
}
|
|
@@ -492,13 +686,36 @@ function prependBasename({
|
|
|
492
686
|
}) {
|
|
493
687
|
return pathname === "/" ? basename : joinPaths([basename, pathname]);
|
|
494
688
|
}
|
|
689
|
+
var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
690
|
+
var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
|
|
495
691
|
function resolvePath(to, fromPathname = "/") {
|
|
496
692
|
let {
|
|
497
693
|
pathname: toPathname,
|
|
498
694
|
search = "",
|
|
499
695
|
hash = ""
|
|
500
696
|
} = typeof to === "string" ? parsePath(to) : to;
|
|
501
|
-
let pathname
|
|
697
|
+
let pathname;
|
|
698
|
+
if (toPathname) {
|
|
699
|
+
if (isAbsoluteUrl(toPathname)) {
|
|
700
|
+
pathname = toPathname;
|
|
701
|
+
} else {
|
|
702
|
+
if (toPathname.includes("//")) {
|
|
703
|
+
let oldPathname = toPathname;
|
|
704
|
+
toPathname = toPathname.replace(/\/\/+/g, "/");
|
|
705
|
+
warning(
|
|
706
|
+
false,
|
|
707
|
+
`Pathnames cannot have embedded double slashes - normalizing ${oldPathname} -> ${toPathname}`
|
|
708
|
+
);
|
|
709
|
+
}
|
|
710
|
+
if (toPathname.startsWith("/")) {
|
|
711
|
+
pathname = resolvePathname(toPathname.substring(1), "/");
|
|
712
|
+
} else {
|
|
713
|
+
pathname = resolvePathname(toPathname, fromPathname);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
} else {
|
|
717
|
+
pathname = fromPathname;
|
|
718
|
+
}
|
|
502
719
|
return {
|
|
503
720
|
pathname,
|
|
504
721
|
search: normalizeSearch(search),
|
|
@@ -631,6 +848,9 @@ var ErrorResponseImpl = class {
|
|
|
631
848
|
function isRouteErrorResponse(error) {
|
|
632
849
|
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
|
633
850
|
}
|
|
851
|
+
function getRoutePattern(paths) {
|
|
852
|
+
return paths.filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
|
|
853
|
+
}
|
|
634
854
|
|
|
635
855
|
// lib/router/router.ts
|
|
636
856
|
var validMutationMethodsArr = [
|
|
@@ -648,8 +868,6 @@ var validRequestMethodsArr = [
|
|
|
648
868
|
];
|
|
649
869
|
var validRequestMethods = new Set(validRequestMethodsArr);
|
|
650
870
|
var redirectStatusCodes = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
|
|
651
|
-
var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
652
|
-
var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
|
|
653
871
|
var defaultMapRouteProperties = (route) => ({
|
|
654
872
|
hasErrorBoundary: Boolean(route.hasErrorBoundary)
|
|
655
873
|
});
|
|
@@ -661,7 +879,20 @@ function createStaticHandler(routes, opts) {
|
|
|
661
879
|
);
|
|
662
880
|
let manifest = {};
|
|
663
881
|
let basename = (opts ? opts.basename : null) || "/";
|
|
664
|
-
let
|
|
882
|
+
let _mapRouteProperties = opts?.mapRouteProperties || defaultMapRouteProperties;
|
|
883
|
+
let mapRouteProperties = _mapRouteProperties;
|
|
884
|
+
if (opts?.unstable_instrumentations) {
|
|
885
|
+
let instrumentations = opts.unstable_instrumentations;
|
|
886
|
+
mapRouteProperties = (route) => {
|
|
887
|
+
return {
|
|
888
|
+
..._mapRouteProperties(route),
|
|
889
|
+
...getRouteInstrumentationUpdates(
|
|
890
|
+
instrumentations.map((i) => i.route).filter(Boolean),
|
|
891
|
+
route
|
|
892
|
+
)
|
|
893
|
+
};
|
|
894
|
+
};
|
|
895
|
+
}
|
|
665
896
|
let dataRoutes = convertRoutesToDataRoutes(
|
|
666
897
|
routes,
|
|
667
898
|
mapRouteProperties,
|
|
@@ -731,6 +962,7 @@ function createStaticHandler(routes, opts) {
|
|
|
731
962
|
let response = await runServerMiddlewarePipeline(
|
|
732
963
|
{
|
|
733
964
|
request,
|
|
965
|
+
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
734
966
|
matches,
|
|
735
967
|
params: matches[0].params,
|
|
736
968
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -876,6 +1108,7 @@ function createStaticHandler(routes, opts) {
|
|
|
876
1108
|
let response = await runServerMiddlewarePipeline(
|
|
877
1109
|
{
|
|
878
1110
|
request,
|
|
1111
|
+
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
879
1112
|
matches,
|
|
880
1113
|
params: matches[0].params,
|
|
881
1114
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -1151,12 +1384,14 @@ function createStaticHandler(routes, opts) {
|
|
|
1151
1384
|
// Up to but not including the boundary
|
|
1152
1385
|
matches.findIndex((m) => m.route.id === pendingActionResult[0]) - 1
|
|
1153
1386
|
) : void 0;
|
|
1387
|
+
let pattern = getRoutePattern(matches.map((m) => m.route.path));
|
|
1154
1388
|
dsMatches = matches.map((match, index) => {
|
|
1155
1389
|
if (maxIdx != null && index > maxIdx) {
|
|
1156
1390
|
return getDataStrategyMatch(
|
|
1157
1391
|
mapRouteProperties,
|
|
1158
1392
|
manifest,
|
|
1159
1393
|
request,
|
|
1394
|
+
pattern,
|
|
1160
1395
|
match,
|
|
1161
1396
|
[],
|
|
1162
1397
|
requestContext,
|
|
@@ -1167,6 +1402,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1167
1402
|
mapRouteProperties,
|
|
1168
1403
|
manifest,
|
|
1169
1404
|
request,
|
|
1405
|
+
pattern,
|
|
1170
1406
|
match,
|
|
1171
1407
|
[],
|
|
1172
1408
|
requestContext,
|
|
@@ -1505,12 +1741,17 @@ function runServerMiddlewarePipeline(args, handler, errorHandler) {
|
|
|
1505
1741
|
}
|
|
1506
1742
|
}
|
|
1507
1743
|
async function runMiddlewarePipeline(args, handler, processResult, isResult, errorHandler) {
|
|
1508
|
-
let { matches, request, params, context } = args;
|
|
1744
|
+
let { matches, request, params, context, unstable_pattern } = args;
|
|
1509
1745
|
let tuples = matches.flatMap(
|
|
1510
1746
|
(m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
|
|
1511
1747
|
);
|
|
1512
1748
|
let result = await callRouteMiddleware(
|
|
1513
|
-
{
|
|
1749
|
+
{
|
|
1750
|
+
request,
|
|
1751
|
+
params,
|
|
1752
|
+
context,
|
|
1753
|
+
unstable_pattern
|
|
1754
|
+
},
|
|
1514
1755
|
tuples,
|
|
1515
1756
|
handler,
|
|
1516
1757
|
processResult,
|
|
@@ -1588,7 +1829,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
|
|
|
1588
1829
|
handler: lazyRoutePromises.lazyHandlerPromise
|
|
1589
1830
|
};
|
|
1590
1831
|
}
|
|
1591
|
-
function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
|
|
1832
|
+
function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
|
|
1592
1833
|
let isUsingNewApi = false;
|
|
1593
1834
|
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
|
1594
1835
|
mapRouteProperties,
|
|
@@ -1619,9 +1860,10 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazy
|
|
|
1619
1860
|
let { lazy, loader, middleware } = match.route;
|
|
1620
1861
|
let callHandler = isUsingNewApi || shouldLoad || handlerOverride && !isMutationMethod(request.method) && (lazy || loader);
|
|
1621
1862
|
let isMiddlewareOnlyRoute = middleware && middleware.length > 0 && !loader && !lazy;
|
|
1622
|
-
if (callHandler && !isMiddlewareOnlyRoute) {
|
|
1863
|
+
if (callHandler && (isMutationMethod(request.method) || !isMiddlewareOnlyRoute)) {
|
|
1623
1864
|
return callLoaderOrAction({
|
|
1624
1865
|
request,
|
|
1866
|
+
unstable_pattern,
|
|
1625
1867
|
match,
|
|
1626
1868
|
lazyHandlerPromise: _lazyPromises?.handler,
|
|
1627
1869
|
lazyRoutePromise: _lazyPromises?.route,
|
|
@@ -1655,6 +1897,7 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
1655
1897
|
mapRouteProperties,
|
|
1656
1898
|
manifest,
|
|
1657
1899
|
request,
|
|
1900
|
+
getRoutePattern(matches.map((m) => m.route.path)),
|
|
1658
1901
|
match,
|
|
1659
1902
|
lazyRoutePropertiesToSkip,
|
|
1660
1903
|
scopedContext,
|
|
@@ -1669,6 +1912,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
1669
1912
|
}
|
|
1670
1913
|
let dataStrategyArgs = {
|
|
1671
1914
|
request,
|
|
1915
|
+
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
1672
1916
|
params: matches[0].params,
|
|
1673
1917
|
context: scopedContext,
|
|
1674
1918
|
matches
|
|
@@ -1696,6 +1940,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
1696
1940
|
}
|
|
1697
1941
|
async function callLoaderOrAction({
|
|
1698
1942
|
request,
|
|
1943
|
+
unstable_pattern,
|
|
1699
1944
|
match,
|
|
1700
1945
|
lazyHandlerPromise,
|
|
1701
1946
|
lazyRoutePromise,
|
|
@@ -1722,6 +1967,7 @@ async function callLoaderOrAction({
|
|
|
1722
1967
|
return handler(
|
|
1723
1968
|
{
|
|
1724
1969
|
request,
|
|
1970
|
+
unstable_pattern,
|
|
1725
1971
|
params: match.params,
|
|
1726
1972
|
context: scopedContext
|
|
1727
1973
|
},
|