react-router 7.9.4 → 7.9.5

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/development/browser-DM83uryY.d.ts +310 -0
  3. package/dist/development/browser-DfMfSvsC.d.mts +310 -0
  4. package/dist/development/chunk-FQEOJFGW.js +188 -0
  5. package/dist/development/chunk-IXESJAGJ.js +1310 -0
  6. package/dist/development/{chunk-WY5IRSCW.mjs → chunk-JG3XND5A.mjs} +197 -857
  7. package/dist/development/{chunk-OIYGIGL5.mjs → chunk-UIGDSWPH.mjs} +365 -22
  8. package/dist/development/{chunk-DI2QHYMJ.js → chunk-VNR6V74N.js} +1226 -122
  9. package/dist/development/dom-export.d.mts +103 -6
  10. package/dist/development/dom-export.d.ts +103 -4
  11. package/dist/development/dom-export.js +708 -20
  12. package/dist/development/dom-export.mjs +692 -11
  13. package/dist/{production/index-react-server-client-BIz4AUNd.d.mts → development/index-react-server-client-B0vnxMMk.d.mts} +137 -78
  14. package/dist/{production/index-react-server-client-BbRcBjrA.d.ts → development/index-react-server-client-BSxMvS7Z.d.ts} +195 -135
  15. package/dist/development/index-react-server-client.d.mts +2 -3
  16. package/dist/development/index-react-server-client.d.ts +2 -2
  17. package/dist/development/index-react-server-client.js +4 -4
  18. package/dist/development/index-react-server-client.mjs +2 -2
  19. package/dist/development/index-react-server.d.mts +107 -3
  20. package/dist/development/index-react-server.d.ts +107 -3
  21. package/dist/development/index-react-server.js +235 -10
  22. package/dist/development/index-react-server.mjs +235 -10
  23. package/dist/development/index.d.mts +14 -320
  24. package/dist/development/index.d.ts +14 -362
  25. package/dist/development/index.js +146 -962
  26. package/dist/development/index.mjs +3 -9
  27. package/dist/development/{routeModules-D5iJ6JYT.d.ts → instrumentation-iAqbU5Q4.d.ts} +173 -24
  28. package/dist/development/lib/types/internal.d.mts +2 -3
  29. package/dist/development/lib/types/internal.d.ts +2 -2
  30. package/dist/development/lib/types/internal.js +1 -1
  31. package/dist/development/lib/types/internal.mjs +1 -1
  32. package/dist/development/{register-CI4bTprK.d.mts → register-_G476ptB.d.mts} +1 -1
  33. package/dist/{production/register-C34pU-in.d.ts → development/register-c-dooqKE.d.ts} +1 -1
  34. package/dist/{production/context-DSyS5mLj.d.mts → development/router-DIAPGK5f.d.mts} +1873 -1254
  35. package/dist/production/browser-DM83uryY.d.ts +310 -0
  36. package/dist/production/browser-DfMfSvsC.d.mts +310 -0
  37. package/dist/production/chunk-CWEARR4H.js +188 -0
  38. package/dist/production/{chunk-4E5LHRQP.js → chunk-EAE7427A.js} +1226 -122
  39. package/dist/production/chunk-ERPFE3MR.js +1310 -0
  40. package/dist/production/{chunk-3TADTUL4.mjs → chunk-RZ6LZWMW.mjs} +365 -22
  41. package/dist/production/{chunk-FR6HSPLK.mjs → chunk-TPBVZP6U.mjs} +197 -857
  42. package/dist/production/dom-export.d.mts +103 -6
  43. package/dist/production/dom-export.d.ts +103 -4
  44. package/dist/production/dom-export.js +708 -20
  45. package/dist/production/dom-export.mjs +692 -11
  46. package/dist/{development/index-react-server-client-BbRcBjrA.d.ts → production/index-react-server-client-B0vnxMMk.d.mts} +195 -135
  47. package/dist/{development/index-react-server-client-BIz4AUNd.d.mts → production/index-react-server-client-BSxMvS7Z.d.ts} +137 -78
  48. package/dist/production/index-react-server-client.d.mts +2 -3
  49. package/dist/production/index-react-server-client.d.ts +2 -2
  50. package/dist/production/index-react-server-client.js +4 -4
  51. package/dist/production/index-react-server-client.mjs +2 -2
  52. package/dist/production/index-react-server.d.mts +107 -3
  53. package/dist/production/index-react-server.d.ts +107 -3
  54. package/dist/production/index-react-server.js +235 -10
  55. package/dist/production/index-react-server.mjs +235 -10
  56. package/dist/production/index.d.mts +14 -320
  57. package/dist/production/index.d.ts +14 -362
  58. package/dist/production/index.js +146 -962
  59. package/dist/production/index.mjs +3 -9
  60. package/dist/production/{routeModules-D5iJ6JYT.d.ts → instrumentation-iAqbU5Q4.d.ts} +173 -24
  61. package/dist/production/lib/types/internal.d.mts +2 -3
  62. package/dist/production/lib/types/internal.d.ts +2 -2
  63. package/dist/production/lib/types/internal.js +1 -1
  64. package/dist/production/lib/types/internal.mjs +1 -1
  65. package/dist/production/{register-CI4bTprK.d.mts → register-_G476ptB.d.mts} +1 -1
  66. package/dist/{development/register-C34pU-in.d.ts → production/register-c-dooqKE.d.ts} +1 -1
  67. package/dist/{development/context-DSyS5mLj.d.mts → production/router-DIAPGK5f.d.mts} +1873 -1254
  68. package/package.json +1 -1
  69. package/dist/development/browser-z32v5KVN.d.mts +0 -46
  70. package/dist/development/chunk-72XNTZCV.js +0 -2089
  71. package/dist/development/route-data-DZQOUSqV.d.mts +0 -473
  72. package/dist/production/browser-z32v5KVN.d.mts +0 -46
  73. package/dist/production/chunk-WNLQ53P5.js +0 -2089
  74. package/dist/production/route-data-DZQOUSqV.d.mts +0 -473
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.9.4
2
+ * react-router v7.9.5
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -454,19 +454,23 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties2, parentPath = [],
454
454
  if (isIndexRoute(route)) {
455
455
  let indexRoute = {
456
456
  ...route,
457
- ...mapRouteProperties2(route),
458
457
  id
459
458
  };
460
- manifest[id] = indexRoute;
459
+ manifest[id] = mergeRouteUpdates(
460
+ indexRoute,
461
+ mapRouteProperties2(indexRoute)
462
+ );
461
463
  return indexRoute;
462
464
  } else {
463
465
  let pathOrLayoutRoute = {
464
466
  ...route,
465
- ...mapRouteProperties2(route),
466
467
  id,
467
468
  children: void 0
468
469
  };
469
- manifest[id] = pathOrLayoutRoute;
470
+ manifest[id] = mergeRouteUpdates(
471
+ pathOrLayoutRoute,
472
+ mapRouteProperties2(pathOrLayoutRoute)
473
+ );
470
474
  if (route.children) {
471
475
  pathOrLayoutRoute.children = convertRoutesToDataRoutes(
472
476
  route.children,
@@ -480,6 +484,17 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties2, parentPath = [],
480
484
  }
481
485
  });
482
486
  }
487
+ function mergeRouteUpdates(route, updates) {
488
+ return Object.assign(route, {
489
+ ...updates,
490
+ ...typeof updates.lazy === "object" && updates.lazy != null ? {
491
+ lazy: {
492
+ ...route.lazy,
493
+ ...updates.lazy
494
+ }
495
+ } : {}
496
+ });
497
+ }
483
498
  function matchRoutes(routes, locationArg, basename = "/") {
484
499
  return matchRoutesImpl(routes, locationArg, basename, false);
485
500
  }
@@ -935,6 +950,277 @@ var ErrorResponseImpl = class {
935
950
  function isRouteErrorResponse(error) {
936
951
  return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
937
952
  }
953
+ function getRoutePattern(paths) {
954
+ return paths.filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
955
+ }
956
+
957
+ // lib/router/instrumentation.ts
958
+ var UninstrumentedSymbol = Symbol("Uninstrumented");
959
+ function getRouteInstrumentationUpdates(fns, route) {
960
+ let aggregated = {
961
+ lazy: [],
962
+ "lazy.loader": [],
963
+ "lazy.action": [],
964
+ "lazy.middleware": [],
965
+ middleware: [],
966
+ loader: [],
967
+ action: []
968
+ };
969
+ fns.forEach(
970
+ (fn) => fn({
971
+ id: route.id,
972
+ index: route.index,
973
+ path: route.path,
974
+ instrument(i) {
975
+ let keys = Object.keys(aggregated);
976
+ for (let key of keys) {
977
+ if (i[key]) {
978
+ aggregated[key].push(i[key]);
979
+ }
980
+ }
981
+ }
982
+ })
983
+ );
984
+ let updates = {};
985
+ if (typeof route.lazy === "function" && aggregated.lazy.length > 0) {
986
+ let instrumented = wrapImpl(aggregated.lazy, route.lazy, () => void 0);
987
+ if (instrumented) {
988
+ updates.lazy = instrumented;
989
+ }
990
+ }
991
+ if (typeof route.lazy === "object") {
992
+ let lazyObject = route.lazy;
993
+ ["middleware", "loader", "action"].forEach((key) => {
994
+ let lazyFn = lazyObject[key];
995
+ let instrumentations = aggregated[`lazy.${key}`];
996
+ if (typeof lazyFn === "function" && instrumentations.length > 0) {
997
+ let instrumented = wrapImpl(instrumentations, lazyFn, () => void 0);
998
+ if (instrumented) {
999
+ updates.lazy = Object.assign(updates.lazy || {}, {
1000
+ [key]: instrumented
1001
+ });
1002
+ }
1003
+ }
1004
+ });
1005
+ }
1006
+ ["loader", "action"].forEach((key) => {
1007
+ let handler = route[key];
1008
+ if (typeof handler === "function" && aggregated[key].length > 0) {
1009
+ let original = handler[UninstrumentedSymbol] ?? handler;
1010
+ let instrumented = wrapImpl(
1011
+ aggregated[key],
1012
+ original,
1013
+ (...args) => getHandlerInfo(args[0])
1014
+ );
1015
+ if (instrumented) {
1016
+ instrumented[UninstrumentedSymbol] = original;
1017
+ updates[key] = instrumented;
1018
+ }
1019
+ }
1020
+ });
1021
+ if (route.middleware && route.middleware.length > 0 && aggregated.middleware.length > 0) {
1022
+ updates.middleware = route.middleware.map((middleware) => {
1023
+ let original = middleware[UninstrumentedSymbol] ?? middleware;
1024
+ let instrumented = wrapImpl(
1025
+ aggregated.middleware,
1026
+ original,
1027
+ (...args) => getHandlerInfo(args[0])
1028
+ );
1029
+ if (instrumented) {
1030
+ instrumented[UninstrumentedSymbol] = original;
1031
+ return instrumented;
1032
+ }
1033
+ return middleware;
1034
+ });
1035
+ }
1036
+ return updates;
1037
+ }
1038
+ function instrumentClientSideRouter(router, fns) {
1039
+ let aggregated = {
1040
+ navigate: [],
1041
+ fetch: []
1042
+ };
1043
+ fns.forEach(
1044
+ (fn) => fn({
1045
+ instrument(i) {
1046
+ let keys = Object.keys(i);
1047
+ for (let key of keys) {
1048
+ if (i[key]) {
1049
+ aggregated[key].push(i[key]);
1050
+ }
1051
+ }
1052
+ }
1053
+ })
1054
+ );
1055
+ if (aggregated.navigate.length > 0) {
1056
+ let navigate = router.navigate[UninstrumentedSymbol] ?? router.navigate;
1057
+ let instrumentedNavigate = wrapImpl(
1058
+ aggregated.navigate,
1059
+ navigate,
1060
+ (...args) => {
1061
+ let [to, opts] = args;
1062
+ return {
1063
+ to: typeof to === "number" || typeof to === "string" ? to : to ? createPath(to) : ".",
1064
+ ...getRouterInfo(router, opts ?? {})
1065
+ };
1066
+ }
1067
+ );
1068
+ if (instrumentedNavigate) {
1069
+ instrumentedNavigate[UninstrumentedSymbol] = navigate;
1070
+ router.navigate = instrumentedNavigate;
1071
+ }
1072
+ }
1073
+ if (aggregated.fetch.length > 0) {
1074
+ let fetch2 = router.fetch[UninstrumentedSymbol] ?? router.fetch;
1075
+ let instrumentedFetch = wrapImpl(aggregated.fetch, fetch2, (...args) => {
1076
+ let [key, , href, opts] = args;
1077
+ return {
1078
+ href: href ?? ".",
1079
+ fetcherKey: key,
1080
+ ...getRouterInfo(router, opts ?? {})
1081
+ };
1082
+ });
1083
+ if (instrumentedFetch) {
1084
+ instrumentedFetch[UninstrumentedSymbol] = fetch2;
1085
+ router.fetch = instrumentedFetch;
1086
+ }
1087
+ }
1088
+ return router;
1089
+ }
1090
+ function instrumentHandler(handler, fns) {
1091
+ let aggregated = {
1092
+ request: []
1093
+ };
1094
+ fns.forEach(
1095
+ (fn) => fn({
1096
+ instrument(i) {
1097
+ let keys = Object.keys(i);
1098
+ for (let key of keys) {
1099
+ if (i[key]) {
1100
+ aggregated[key].push(i[key]);
1101
+ }
1102
+ }
1103
+ }
1104
+ })
1105
+ );
1106
+ let instrumentedHandler = handler;
1107
+ if (aggregated.request.length > 0) {
1108
+ instrumentedHandler = wrapImpl(aggregated.request, handler, (...args) => {
1109
+ let [request, context] = args;
1110
+ return {
1111
+ request: getReadonlyRequest(request),
1112
+ context: context != null ? getReadonlyContext(context) : context
1113
+ };
1114
+ });
1115
+ }
1116
+ return instrumentedHandler;
1117
+ }
1118
+ function wrapImpl(impls, handler, getInfo) {
1119
+ if (impls.length === 0) {
1120
+ return null;
1121
+ }
1122
+ return async (...args) => {
1123
+ let result = await recurseRight(
1124
+ impls,
1125
+ getInfo(...args),
1126
+ () => handler(...args),
1127
+ impls.length - 1
1128
+ );
1129
+ if (result.type === "error") {
1130
+ throw result.value;
1131
+ }
1132
+ return result.value;
1133
+ };
1134
+ }
1135
+ async function recurseRight(impls, info, handler, index) {
1136
+ let impl = impls[index];
1137
+ let result;
1138
+ if (!impl) {
1139
+ try {
1140
+ let value = await handler();
1141
+ result = { type: "success", value };
1142
+ } catch (e) {
1143
+ result = { type: "error", value: e };
1144
+ }
1145
+ } else {
1146
+ let handlerPromise = void 0;
1147
+ let callHandler = async () => {
1148
+ if (handlerPromise) {
1149
+ console.error("You cannot call instrumented handlers more than once");
1150
+ } else {
1151
+ handlerPromise = recurseRight(impls, info, handler, index - 1);
1152
+ }
1153
+ result = await handlerPromise;
1154
+ invariant(result, "Expected a result");
1155
+ if (result.type === "error" && result.value instanceof Error) {
1156
+ return { status: "error", error: result.value };
1157
+ }
1158
+ return { status: "success", error: void 0 };
1159
+ };
1160
+ try {
1161
+ await impl(callHandler, info);
1162
+ } catch (e) {
1163
+ console.error("An instrumentation function threw an error:", e);
1164
+ }
1165
+ if (!handlerPromise) {
1166
+ await callHandler();
1167
+ }
1168
+ await handlerPromise;
1169
+ }
1170
+ if (result) {
1171
+ return result;
1172
+ }
1173
+ return {
1174
+ type: "error",
1175
+ value: new Error("No result assigned in instrumentation chain.")
1176
+ };
1177
+ }
1178
+ function getHandlerInfo(args) {
1179
+ let { request, context, params, unstable_pattern } = args;
1180
+ return {
1181
+ request: getReadonlyRequest(request),
1182
+ params: { ...params },
1183
+ unstable_pattern,
1184
+ context: getReadonlyContext(context)
1185
+ };
1186
+ }
1187
+ function getRouterInfo(router, opts) {
1188
+ return {
1189
+ currentUrl: createPath(router.state.location),
1190
+ ..."formMethod" in opts ? { formMethod: opts.formMethod } : {},
1191
+ ..."formEncType" in opts ? { formEncType: opts.formEncType } : {},
1192
+ ..."formData" in opts ? { formData: opts.formData } : {},
1193
+ ..."body" in opts ? { body: opts.body } : {}
1194
+ };
1195
+ }
1196
+ function getReadonlyRequest(request) {
1197
+ return {
1198
+ method: request.method,
1199
+ url: request.url,
1200
+ headers: {
1201
+ get: (...args) => request.headers.get(...args)
1202
+ }
1203
+ };
1204
+ }
1205
+ function getReadonlyContext(context) {
1206
+ if (isPlainObject(context)) {
1207
+ let frozen = { ...context };
1208
+ Object.freeze(frozen);
1209
+ return frozen;
1210
+ } else {
1211
+ return {
1212
+ get: (ctx) => context.get(ctx)
1213
+ };
1214
+ }
1215
+ }
1216
+ var objectProtoNames = Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
1217
+ function isPlainObject(thing) {
1218
+ if (thing === null || typeof thing !== "object") {
1219
+ return false;
1220
+ }
1221
+ const proto = Object.getPrototypeOf(thing);
1222
+ return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames;
1223
+ }
938
1224
 
939
1225
  // lib/router/router.ts
940
1226
  var validMutationMethodsArr = [
@@ -994,7 +1280,20 @@ function createRouter(init) {
994
1280
  "You must provide a non-empty routes array to createRouter"
995
1281
  );
996
1282
  let hydrationRouteProperties2 = init.hydrationRouteProperties || [];
997
- let mapRouteProperties2 = init.mapRouteProperties || defaultMapRouteProperties;
1283
+ let _mapRouteProperties = init.mapRouteProperties || defaultMapRouteProperties;
1284
+ let mapRouteProperties2 = _mapRouteProperties;
1285
+ if (init.unstable_instrumentations) {
1286
+ let instrumentations = init.unstable_instrumentations;
1287
+ mapRouteProperties2 = (route) => {
1288
+ return {
1289
+ ..._mapRouteProperties(route),
1290
+ ...getRouteInstrumentationUpdates(
1291
+ instrumentations.map((i) => i.route).filter(Boolean),
1292
+ route
1293
+ )
1294
+ };
1295
+ };
1296
+ }
998
1297
  let manifest = {};
999
1298
  let dataRoutes = convertRoutesToDataRoutes(
1000
1299
  init.routes,
@@ -2746,6 +3045,12 @@ function createRouter(init) {
2746
3045
  updateState(newState);
2747
3046
  }
2748
3047
  };
3048
+ if (init.unstable_instrumentations) {
3049
+ router = instrumentClientSideRouter(
3050
+ router,
3051
+ init.unstable_instrumentations.map((i) => i.router).filter(Boolean)
3052
+ );
3053
+ }
2749
3054
  return router;
2750
3055
  }
2751
3056
  function createStaticHandler(routes, opts) {
@@ -2755,7 +3060,20 @@ function createStaticHandler(routes, opts) {
2755
3060
  );
2756
3061
  let manifest = {};
2757
3062
  let basename = (opts ? opts.basename : null) || "/";
2758
- let mapRouteProperties2 = opts?.mapRouteProperties || defaultMapRouteProperties;
3063
+ let _mapRouteProperties = opts?.mapRouteProperties || defaultMapRouteProperties;
3064
+ let mapRouteProperties2 = _mapRouteProperties;
3065
+ if (opts?.unstable_instrumentations) {
3066
+ let instrumentations = opts.unstable_instrumentations;
3067
+ mapRouteProperties2 = (route) => {
3068
+ return {
3069
+ ..._mapRouteProperties(route),
3070
+ ...getRouteInstrumentationUpdates(
3071
+ instrumentations.map((i) => i.route).filter(Boolean),
3072
+ route
3073
+ )
3074
+ };
3075
+ };
3076
+ }
2759
3077
  let dataRoutes = convertRoutesToDataRoutes(
2760
3078
  routes,
2761
3079
  mapRouteProperties2,
@@ -2825,6 +3143,7 @@ function createStaticHandler(routes, opts) {
2825
3143
  let response = await runServerMiddlewarePipeline(
2826
3144
  {
2827
3145
  request,
3146
+ unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
2828
3147
  matches,
2829
3148
  params: matches[0].params,
2830
3149
  // If we're calling middleware then it must be enabled so we can cast
@@ -2970,6 +3289,7 @@ function createStaticHandler(routes, opts) {
2970
3289
  let response = await runServerMiddlewarePipeline(
2971
3290
  {
2972
3291
  request,
3292
+ unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
2973
3293
  matches,
2974
3294
  params: matches[0].params,
2975
3295
  // If we're calling middleware then it must be enabled so we can cast
@@ -3245,12 +3565,14 @@ function createStaticHandler(routes, opts) {
3245
3565
  // Up to but not including the boundary
3246
3566
  matches.findIndex((m) => m.route.id === pendingActionResult[0]) - 1
3247
3567
  ) : void 0;
3568
+ let pattern = getRoutePattern(matches.map((m) => m.route.path));
3248
3569
  dsMatches = matches.map((match, index) => {
3249
3570
  if (maxIdx != null && index > maxIdx) {
3250
3571
  return getDataStrategyMatch(
3251
3572
  mapRouteProperties2,
3252
3573
  manifest,
3253
3574
  request,
3575
+ pattern,
3254
3576
  match,
3255
3577
  [],
3256
3578
  requestContext,
@@ -3261,6 +3583,7 @@ function createStaticHandler(routes, opts) {
3261
3583
  mapRouteProperties2,
3262
3584
  manifest,
3263
3585
  request,
3586
+ pattern,
3264
3587
  match,
3265
3588
  [],
3266
3589
  requestContext,
@@ -3541,6 +3864,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
3541
3864
  actionResult,
3542
3865
  actionStatus
3543
3866
  };
3867
+ let pattern = getRoutePattern(matches.map((m) => m.route.path));
3544
3868
  let dsMatches = matches.map((match, index) => {
3545
3869
  let { route } = match;
3546
3870
  let forceShouldLoad = null;
@@ -3564,6 +3888,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
3564
3888
  mapRouteProperties2,
3565
3889
  manifest,
3566
3890
  request,
3891
+ pattern,
3567
3892
  match,
3568
3893
  lazyRoutePropertiesToSkip,
3569
3894
  scopedContext,
@@ -3584,6 +3909,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
3584
3909
  mapRouteProperties2,
3585
3910
  manifest,
3586
3911
  request,
3912
+ pattern,
3587
3913
  match,
3588
3914
  lazyRoutePropertiesToSkip,
3589
3915
  scopedContext,
@@ -4037,12 +4363,17 @@ function runClientMiddlewarePipeline(args, handler) {
4037
4363
  }
4038
4364
  }
4039
4365
  async function runMiddlewarePipeline(args, handler, processResult, isResult, errorHandler) {
4040
- let { matches, request, params, context } = args;
4366
+ let { matches, request, params, context, unstable_pattern } = args;
4041
4367
  let tuples = matches.flatMap(
4042
4368
  (m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
4043
4369
  );
4044
4370
  let result = await callRouteMiddleware(
4045
- { request, params, context },
4371
+ {
4372
+ request,
4373
+ params,
4374
+ context,
4375
+ unstable_pattern
4376
+ },
4046
4377
  tuples,
4047
4378
  handler,
4048
4379
  processResult,
@@ -4120,7 +4451,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties2, manifest, request
4120
4451
  handler: lazyRoutePromises.lazyHandlerPromise
4121
4452
  };
4122
4453
  }
4123
- function getDataStrategyMatch(mapRouteProperties2, manifest, request, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
4454
+ function getDataStrategyMatch(mapRouteProperties2, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
4124
4455
  let isUsingNewApi = false;
4125
4456
  let _lazyPromises = getDataStrategyMatchLazyPromises(
4126
4457
  mapRouteProperties2,
@@ -4151,9 +4482,10 @@ function getDataStrategyMatch(mapRouteProperties2, manifest, request, match, laz
4151
4482
  let { lazy, loader, middleware } = match.route;
4152
4483
  let callHandler = isUsingNewApi || shouldLoad || handlerOverride && !isMutationMethod(request.method) && (lazy || loader);
4153
4484
  let isMiddlewareOnlyRoute = middleware && middleware.length > 0 && !loader && !lazy;
4154
- if (callHandler && !isMiddlewareOnlyRoute) {
4485
+ if (callHandler && (isMutationMethod(request.method) || !isMiddlewareOnlyRoute)) {
4155
4486
  return callLoaderOrAction({
4156
4487
  request,
4488
+ unstable_pattern,
4157
4489
  match,
4158
4490
  lazyHandlerPromise: _lazyPromises?.handler,
4159
4491
  lazyRoutePromise: _lazyPromises?.route,
@@ -4187,6 +4519,7 @@ function getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request,
4187
4519
  mapRouteProperties2,
4188
4520
  manifest,
4189
4521
  request,
4522
+ getRoutePattern(matches.map((m) => m.route.path)),
4190
4523
  match,
4191
4524
  lazyRoutePropertiesToSkip,
4192
4525
  scopedContext,
@@ -4201,6 +4534,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
4201
4534
  }
4202
4535
  let dataStrategyArgs = {
4203
4536
  request,
4537
+ unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
4204
4538
  params: matches[0].params,
4205
4539
  context: scopedContext,
4206
4540
  matches
@@ -4241,6 +4575,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
4241
4575
  }
4242
4576
  async function callLoaderOrAction({
4243
4577
  request,
4578
+ unstable_pattern,
4244
4579
  match,
4245
4580
  lazyHandlerPromise,
4246
4581
  lazyRoutePromise,
@@ -4267,6 +4602,7 @@ async function callLoaderOrAction({
4267
4602
  return handler(
4268
4603
  {
4269
4604
  request,
4605
+ unstable_pattern,
4270
4606
  params: match.params,
4271
4607
  context: scopedContext
4272
4608
  },
@@ -5557,10 +5893,11 @@ function useRoute(...args) {
5557
5893
  "useRoute" /* UseRoute */
5558
5894
  );
5559
5895
  const id = args[0] ?? currentRouteId;
5560
- const state = useDataRouterState("useRouteLoaderData" /* UseRouteLoaderData */);
5896
+ const state = useDataRouterState("useRoute" /* UseRoute */);
5561
5897
  const route = state.matches.find(({ route: route2 }) => route2.id === id);
5562
5898
  if (route === void 0) return void 0;
5563
5899
  return {
5900
+ handle: route.route.handle,
5564
5901
  loaderData: state.loaderData[id],
5565
5902
  actionData: state.actionData?.[id]
5566
5903
  };
@@ -5647,7 +5984,8 @@ function createMemoryRouter(routes, opts) {
5647
5984
  hydrationRouteProperties,
5648
5985
  mapRouteProperties,
5649
5986
  dataStrategy: opts?.dataStrategy,
5650
- patchRoutesOnNavigation: opts?.patchRoutesOnNavigation
5987
+ patchRoutesOnNavigation: opts?.patchRoutesOnNavigation,
5988
+ unstable_instrumentations: opts?.unstable_instrumentations
5651
5989
  }).initialize();
5652
5990
  }
5653
5991
  var Deferred = class {
@@ -6609,7 +6947,7 @@ function stringify(input, index) {
6609
6947
  str[index2] += "]";
6610
6948
  } else if (Object.getPrototypeOf(input2) === null) {
6611
6949
  str[index2] = `["${TYPE_NULL_OBJECT}",{${partsForObj(input2)}}]`;
6612
- } else if (isPlainObject(input2)) {
6950
+ } else if (isPlainObject2(input2)) {
6613
6951
  str[index2] = `{${partsForObj(input2)}}`;
6614
6952
  } else {
6615
6953
  error = new Error("Cannot encode object with prototype");
@@ -6663,10 +7001,10 @@ function stringify(input, index) {
6663
7001
  }
6664
7002
  }
6665
7003
  }
6666
- var objectProtoNames = Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
6667
- function isPlainObject(thing) {
7004
+ var objectProtoNames2 = Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
7005
+ function isPlainObject2(thing) {
6668
7006
  const proto = Object.getPrototypeOf(thing);
6669
- return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames;
7007
+ return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames2;
6670
7008
  }
6671
7009
 
6672
7010
  // vendor/turbo-stream-v2/unflatten.ts
@@ -8062,7 +8400,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
8062
8400
  let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
8063
8401
  let initialError = hasInitialError ? initialState?.errors?.[route.id] : void 0;
8064
8402
  let isHydrationRequest = needsRevalidation == null && (routeModule.clientLoader?.hydrate === true || !route.hasLoader);
8065
- dataRoute.loader = async ({ request, params, context }, singleFetch) => {
8403
+ dataRoute.loader = async ({ request, params, context, unstable_pattern }, singleFetch) => {
8066
8404
  try {
8067
8405
  let result = await prefetchStylesAndCallHandler(async () => {
8068
8406
  invariant2(
@@ -8076,6 +8414,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
8076
8414
  request,
8077
8415
  params,
8078
8416
  context,
8417
+ unstable_pattern,
8079
8418
  async serverLoader() {
8080
8419
  preventInvalidServerHandlerCall("loader", route);
8081
8420
  if (isHydrationRequest) {
@@ -8101,7 +8440,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
8101
8440
  route.hasLoader,
8102
8441
  isSpaMode
8103
8442
  );
8104
- dataRoute.action = ({ request, params, context }, singleFetch) => {
8443
+ dataRoute.action = ({ request, params, context, unstable_pattern }, singleFetch) => {
8105
8444
  return prefetchStylesAndCallHandler(async () => {
8106
8445
  invariant2(
8107
8446
  routeModule,
@@ -8117,6 +8456,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
8117
8456
  request,
8118
8457
  params,
8119
8458
  context,
8459
+ unstable_pattern,
8120
8460
  async serverAction() {
8121
8461
  preventInvalidServerHandlerCall("action", route);
8122
8462
  return fetchServerAction(singleFetch);
@@ -9126,7 +9466,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
9126
9466
  try {
9127
9467
  if (isBrowser) {
9128
9468
  window.__reactRouterVersion = // @ts-expect-error
9129
- "7.9.4";
9469
+ "7.9.5";
9130
9470
  }
9131
9471
  } catch (e) {
9132
9472
  }
@@ -9142,7 +9482,8 @@ function createBrowserRouter(routes, opts) {
9142
9482
  hydrationRouteProperties,
9143
9483
  dataStrategy: opts?.dataStrategy,
9144
9484
  patchRoutesOnNavigation: opts?.patchRoutesOnNavigation,
9145
- window: opts?.window
9485
+ window: opts?.window,
9486
+ unstable_instrumentations: opts?.unstable_instrumentations
9146
9487
  }).initialize();
9147
9488
  }
9148
9489
  function createHashRouter(routes, opts) {
@@ -9157,7 +9498,8 @@ function createHashRouter(routes, opts) {
9157
9498
  hydrationRouteProperties,
9158
9499
  dataStrategy: opts?.dataStrategy,
9159
9500
  patchRoutesOnNavigation: opts?.patchRoutesOnNavigation,
9160
- window: opts?.window
9501
+ window: opts?.window,
9502
+ unstable_instrumentations: opts?.unstable_instrumentations
9161
9503
  }).initialize();
9162
9504
  }
9163
9505
  function parseHydrationData() {
@@ -10242,6 +10584,7 @@ export {
10242
10584
  replace,
10243
10585
  ErrorResponseImpl,
10244
10586
  isRouteErrorResponse,
10587
+ instrumentHandler,
10245
10588
  IDLE_NAVIGATION,
10246
10589
  IDLE_FETCHER,
10247
10590
  IDLE_BLOCKER,