react-router 0.0.0-experimental-e613d4238 → 0.0.0-experimental-3df673e

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 (65) hide show
  1. package/dist/development/{chunk-2YVPYFDJ.mjs → chunk-27W3PGKT.mjs} +67 -51
  2. package/dist/development/{chunk-5P3HEZQU.mjs → chunk-5FNKA3AJ.mjs} +309 -25
  3. package/dist/{production/chunk-E4G6PZCJ.js → development/chunk-HMTR6AB3.js} +164 -161
  4. package/dist/development/{chunk-YJ6T7YSE.js → chunk-OAO2BCWA.js} +347 -66
  5. package/dist/development/dom-export.d.mts +59 -4
  6. package/dist/development/dom-export.d.ts +59 -3
  7. package/dist/development/dom-export.js +8 -5
  8. package/dist/development/dom-export.mjs +8 -5
  9. package/dist/development/{index-react-server-client-DKvU8YRr.d.ts → index-react-server-client-CCykjjOv.d.ts} +198 -134
  10. package/dist/{production/index-react-server-client-2EDmGlsZ.d.mts → development/index-react-server-client-vPxdwQO-.d.mts} +140 -77
  11. package/dist/development/index-react-server-client.d.mts +3 -3
  12. package/dist/development/index-react-server-client.d.ts +3 -2
  13. package/dist/development/index-react-server-client.js +4 -4
  14. package/dist/development/index-react-server-client.mjs +2 -2
  15. package/dist/development/index-react-server.d.mts +106 -1
  16. package/dist/development/index-react-server.d.ts +106 -1
  17. package/dist/development/index-react-server.js +181 -8
  18. package/dist/development/index-react-server.mjs +181 -8
  19. package/dist/development/index.d.mts +13 -18
  20. package/dist/development/index.d.ts +13 -16
  21. package/dist/development/index.js +161 -147
  22. package/dist/development/index.mjs +3 -5
  23. package/dist/development/instrumentation-BsMyG4uF.d.ts +1138 -0
  24. package/dist/development/lib/types/internal.d.mts +3 -3
  25. package/dist/development/lib/types/internal.d.ts +3 -2
  26. package/dist/development/lib/types/internal.js +1 -1
  27. package/dist/development/lib/types/internal.mjs +1 -1
  28. package/dist/development/{register-BrVEYTED.d.mts → register-DiOIlEq5.d.mts} +1 -7
  29. package/dist/{production/register-BrVEYTED.d.mts → development/register-DiOIlEq5.d.ts} +1 -7
  30. package/dist/development/{routeModules-BmVo7q9e.d.ts → routeModules-BsBQDHG4.d.ts} +73 -1046
  31. package/dist/development/{route-data-CDwqkzPE.d.mts → routeModules-DSpLybMz.d.mts} +157 -147
  32. package/dist/development/{context-BqL5Eckq.d.mts → router-B02dMGKy.d.mts} +1403 -1250
  33. package/dist/{development/chunk-XXC4LMW2.js → production/chunk-BJWGLTLV.js} +164 -161
  34. package/dist/production/{chunk-5MHETEIL.mjs → chunk-IFXZKZUN.mjs} +67 -51
  35. package/dist/production/{chunk-QBUHFRYZ.js → chunk-NZTFTCSL.js} +347 -66
  36. package/dist/production/{chunk-VNGQS422.mjs → chunk-XWLYGPB7.mjs} +309 -25
  37. package/dist/production/dom-export.d.mts +59 -4
  38. package/dist/production/dom-export.d.ts +59 -3
  39. package/dist/production/dom-export.js +8 -5
  40. package/dist/production/dom-export.mjs +8 -5
  41. package/dist/{development/index-react-server-client-2EDmGlsZ.d.mts → production/index-react-server-client-CCykjjOv.d.ts} +140 -77
  42. package/dist/production/{index-react-server-client-DKvU8YRr.d.ts → index-react-server-client-vPxdwQO-.d.mts} +198 -134
  43. package/dist/production/index-react-server-client.d.mts +3 -3
  44. package/dist/production/index-react-server-client.d.ts +3 -2
  45. package/dist/production/index-react-server-client.js +4 -4
  46. package/dist/production/index-react-server-client.mjs +2 -2
  47. package/dist/production/index-react-server.d.mts +106 -1
  48. package/dist/production/index-react-server.d.ts +106 -1
  49. package/dist/production/index-react-server.js +181 -8
  50. package/dist/production/index-react-server.mjs +181 -8
  51. package/dist/production/index.d.mts +13 -18
  52. package/dist/production/index.d.ts +13 -16
  53. package/dist/production/index.js +161 -147
  54. package/dist/production/index.mjs +3 -5
  55. package/dist/production/instrumentation-BsMyG4uF.d.ts +1138 -0
  56. package/dist/production/lib/types/internal.d.mts +3 -3
  57. package/dist/production/lib/types/internal.d.ts +3 -2
  58. package/dist/production/lib/types/internal.js +1 -1
  59. package/dist/production/lib/types/internal.mjs +1 -1
  60. package/dist/{development/register-D8NQoPsO.d.ts → production/register-DiOIlEq5.d.mts} +1 -7
  61. package/dist/production/{register-D8NQoPsO.d.ts → register-DiOIlEq5.d.ts} +1 -7
  62. package/dist/production/{routeModules-BmVo7q9e.d.ts → routeModules-BsBQDHG4.d.ts} +73 -1046
  63. package/dist/production/{route-data-CDwqkzPE.d.mts → routeModules-DSpLybMz.d.mts} +157 -147
  64. package/dist/production/{context-BqL5Eckq.d.mts → router-B02dMGKy.d.mts} +1403 -1250
  65. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-e613d4238
2
+ * react-router v0.0.0-experimental-3df673e
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,229 @@ 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 getInstrumentedImplementation(impls, handler, getInfo = () => void 0) {
960
+ if (impls.length === 0) {
961
+ return null;
962
+ }
963
+ return async (...args) => {
964
+ let value;
965
+ let info = getInfo(...args);
966
+ await recurseRight(
967
+ impls,
968
+ info,
969
+ async () => {
970
+ value = await handler(...args);
971
+ },
972
+ impls.length - 1
973
+ );
974
+ return value;
975
+ };
976
+ }
977
+ async function recurseRight(impls, info, handler, index) {
978
+ let impl = impls[index];
979
+ if (!impl) {
980
+ await handler();
981
+ } else {
982
+ await impl(async () => {
983
+ await recurseRight(impls, info, handler, index - 1);
984
+ }, info);
985
+ }
986
+ }
987
+ function getInstrumentationInfo(args) {
988
+ let { request, context, params, unstable_pattern } = args;
989
+ return {
990
+ // pseudo "Request" with the info they may want to read from
991
+ request: {
992
+ method: request.method,
993
+ url: request.url,
994
+ // Maybe make this a proxy that only supports `get`?
995
+ headers: {
996
+ get: (...args2) => request.headers.get(...args2)
997
+ }
998
+ },
999
+ params: { ...params },
1000
+ unstable_pattern,
1001
+ context: {
1002
+ get: (...args2) => context.get(...args2)
1003
+ }
1004
+ };
1005
+ }
1006
+ function getInstrumentationsByType(instrumentations, key) {
1007
+ let value = [];
1008
+ for (let i in instrumentations) {
1009
+ let instrumentation = instrumentations[i];
1010
+ if (key in instrumentation && instrumentation[key] != null) {
1011
+ value.push(instrumentation[key]);
1012
+ }
1013
+ }
1014
+ return value;
1015
+ }
1016
+ function getInstrumentationUpdates(fns, route) {
1017
+ let instrumentations = [];
1018
+ fns.forEach(
1019
+ (fn) => fn({
1020
+ id: route.id,
1021
+ index: route.index,
1022
+ path: route.path,
1023
+ instrument(i) {
1024
+ instrumentations.push(i);
1025
+ }
1026
+ })
1027
+ );
1028
+ let updates = {};
1029
+ if (instrumentations.length > 0) {
1030
+ ["lazy", "loader", "action"].forEach((key) => {
1031
+ let func = route[key];
1032
+ if (typeof func === "function") {
1033
+ let original = func[UninstrumentedSymbol] ?? func;
1034
+ let instrumented = getInstrumentedImplementation(
1035
+ getInstrumentationsByType(instrumentations, key),
1036
+ original,
1037
+ key === "lazy" ? () => void 0 : (...args) => getInstrumentationInfo(
1038
+ args[0]
1039
+ )
1040
+ );
1041
+ if (instrumented) {
1042
+ instrumented[UninstrumentedSymbol] = original;
1043
+ updates[key] = instrumented;
1044
+ }
1045
+ }
1046
+ });
1047
+ if (route.middleware && route.middleware.length > 0) {
1048
+ updates.middleware = route.middleware.map((middleware) => {
1049
+ let original = middleware[UninstrumentedSymbol] ?? middleware;
1050
+ let instrumented = getInstrumentedImplementation(
1051
+ getInstrumentationsByType(instrumentations, "middleware"),
1052
+ original,
1053
+ (...args) => getInstrumentationInfo(
1054
+ args[0]
1055
+ )
1056
+ );
1057
+ if (instrumented) {
1058
+ instrumented[UninstrumentedSymbol] = original;
1059
+ return instrumented;
1060
+ }
1061
+ return middleware;
1062
+ });
1063
+ }
1064
+ if (typeof route.lazy === "object") {
1065
+ let lazyObject = route.lazy;
1066
+ ["middleware", "loader", "action"].forEach((key) => {
1067
+ let func = lazyObject[key];
1068
+ if (typeof func === "function") {
1069
+ let instrumented = getInstrumentedImplementation(
1070
+ getInstrumentationsByType(instrumentations, `lazy.${key}`),
1071
+ func
1072
+ );
1073
+ if (instrumented) {
1074
+ updates.lazy = Object.assign(updates.lazy || {}, {
1075
+ [key]: instrumented
1076
+ });
1077
+ }
1078
+ }
1079
+ });
1080
+ }
1081
+ }
1082
+ return updates;
1083
+ }
1084
+ function instrumentClientSideRouter(router, fns) {
1085
+ let instrumentations = [];
1086
+ fns.forEach(
1087
+ (fn) => fn({
1088
+ instrument(i) {
1089
+ instrumentations.push(i);
1090
+ }
1091
+ })
1092
+ );
1093
+ if (instrumentations.length > 0) {
1094
+ let navigate = router.navigate[UninstrumentedSymbol] ?? router.navigate;
1095
+ let instrumentedNavigate = getInstrumentedImplementation(
1096
+ getInstrumentationsByType(instrumentations, "navigate"),
1097
+ navigate,
1098
+ (...args) => {
1099
+ let [to, opts] = args;
1100
+ opts = opts ?? {};
1101
+ let info = {
1102
+ to: typeof to === "number" || typeof to === "string" ? to : to ? createPath(to) : ".",
1103
+ currentUrl: createPath(router.state.location),
1104
+ ..."formMethod" in opts ? { formMethod: opts.formMethod } : {},
1105
+ ..."formEncType" in opts ? { formEncType: opts.formEncType } : {},
1106
+ ..."formData" in opts ? { formData: opts.formData } : {},
1107
+ ..."body" in opts ? { body: opts.body } : {}
1108
+ };
1109
+ return info;
1110
+ }
1111
+ );
1112
+ if (instrumentedNavigate) {
1113
+ instrumentedNavigate[UninstrumentedSymbol] = navigate;
1114
+ router.navigate = instrumentedNavigate;
1115
+ }
1116
+ let fetch2 = router.fetch[UninstrumentedSymbol] ?? router.fetch;
1117
+ let instrumentedFetch = getInstrumentedImplementation(
1118
+ getInstrumentationsByType(instrumentations, "fetch"),
1119
+ fetch2,
1120
+ (...args) => {
1121
+ let [key, , href, opts] = args;
1122
+ opts = opts ?? {};
1123
+ let info = {
1124
+ href: href ?? ".",
1125
+ currentUrl: createPath(router.state.location),
1126
+ fetcherKey: key,
1127
+ ..."formMethod" in opts ? { formMethod: opts.formMethod } : {},
1128
+ ..."formEncType" in opts ? { formEncType: opts.formEncType } : {},
1129
+ ..."formData" in opts ? { formData: opts.formData } : {},
1130
+ ..."body" in opts ? { body: opts.body } : {}
1131
+ };
1132
+ return info;
1133
+ }
1134
+ );
1135
+ if (instrumentedFetch) {
1136
+ instrumentedFetch[UninstrumentedSymbol] = fetch2;
1137
+ router.fetch = instrumentedFetch;
1138
+ }
1139
+ }
1140
+ return router;
1141
+ }
1142
+ function instrumentHandler(handler, fns) {
1143
+ let instrumentations = [];
1144
+ fns.forEach(
1145
+ (fn) => fn({
1146
+ instrument(i) {
1147
+ instrumentations.push(i);
1148
+ }
1149
+ })
1150
+ );
1151
+ if (instrumentations.length === 0) {
1152
+ return handler;
1153
+ }
1154
+ let instrumentedHandler = getInstrumentedImplementation(
1155
+ getInstrumentationsByType(instrumentations, "request"),
1156
+ handler,
1157
+ (...args) => {
1158
+ let [request, context] = args;
1159
+ let info = {
1160
+ request: {
1161
+ method: request.method,
1162
+ url: request.url,
1163
+ headers: {
1164
+ get: (...args2) => request.headers.get(...args2)
1165
+ }
1166
+ },
1167
+ context: {
1168
+ get: (ctx) => context ? context.get(ctx) : void 0
1169
+ }
1170
+ };
1171
+ return info;
1172
+ }
1173
+ );
1174
+ return instrumentedHandler ?? handler;
1175
+ }
938
1176
 
939
1177
  // lib/router/router.ts
940
1178
  var validMutationMethodsArr = [
@@ -994,7 +1232,20 @@ function createRouter(init) {
994
1232
  "You must provide a non-empty routes array to createRouter"
995
1233
  );
996
1234
  let hydrationRouteProperties2 = init.hydrationRouteProperties || [];
997
- let mapRouteProperties2 = init.mapRouteProperties || defaultMapRouteProperties;
1235
+ let _mapRouteProperties = init.mapRouteProperties || defaultMapRouteProperties;
1236
+ let mapRouteProperties2 = _mapRouteProperties;
1237
+ if (init.unstable_instrumentations) {
1238
+ let instrumentations = init.unstable_instrumentations;
1239
+ mapRouteProperties2 = (route) => {
1240
+ return {
1241
+ ..._mapRouteProperties(route),
1242
+ ...getInstrumentationUpdates(
1243
+ instrumentations.map((i) => i.route).filter(Boolean),
1244
+ route
1245
+ )
1246
+ };
1247
+ };
1248
+ }
998
1249
  let manifest = {};
999
1250
  let dataRoutes = convertRoutesToDataRoutes(
1000
1251
  init.routes,
@@ -2746,6 +2997,12 @@ function createRouter(init) {
2746
2997
  updateState(newState);
2747
2998
  }
2748
2999
  };
3000
+ if (init.unstable_instrumentations) {
3001
+ router = instrumentClientSideRouter(
3002
+ router,
3003
+ init.unstable_instrumentations.map((i) => i.router).filter(Boolean)
3004
+ );
3005
+ }
2749
3006
  return router;
2750
3007
  }
2751
3008
  function createStaticHandler(routes, opts) {
@@ -2755,7 +3012,20 @@ function createStaticHandler(routes, opts) {
2755
3012
  );
2756
3013
  let manifest = {};
2757
3014
  let basename = (opts ? opts.basename : null) || "/";
2758
- let mapRouteProperties2 = opts?.mapRouteProperties || defaultMapRouteProperties;
3015
+ let _mapRouteProperties = opts?.mapRouteProperties || defaultMapRouteProperties;
3016
+ let mapRouteProperties2 = _mapRouteProperties;
3017
+ if (opts?.unstable_instrumentations) {
3018
+ let instrumentations = opts.unstable_instrumentations;
3019
+ mapRouteProperties2 = (route) => {
3020
+ return {
3021
+ ..._mapRouteProperties(route),
3022
+ ...getInstrumentationUpdates(
3023
+ instrumentations.map((i) => i.route).filter(Boolean),
3024
+ route
3025
+ )
3026
+ };
3027
+ };
3028
+ }
2759
3029
  let dataRoutes = convertRoutesToDataRoutes(
2760
3030
  routes,
2761
3031
  mapRouteProperties2,
@@ -2825,6 +3095,7 @@ function createStaticHandler(routes, opts) {
2825
3095
  let response = await runServerMiddlewarePipeline(
2826
3096
  {
2827
3097
  request,
3098
+ unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
2828
3099
  matches,
2829
3100
  params: matches[0].params,
2830
3101
  // If we're calling middleware then it must be enabled so we can cast
@@ -2970,6 +3241,7 @@ function createStaticHandler(routes, opts) {
2970
3241
  let response = await runServerMiddlewarePipeline(
2971
3242
  {
2972
3243
  request,
3244
+ unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
2973
3245
  matches,
2974
3246
  params: matches[0].params,
2975
3247
  // If we're calling middleware then it must be enabled so we can cast
@@ -3251,6 +3523,7 @@ function createStaticHandler(routes, opts) {
3251
3523
  mapRouteProperties2,
3252
3524
  manifest,
3253
3525
  request,
3526
+ getRoutePattern(matches.map((m) => m.route.path)),
3254
3527
  match,
3255
3528
  [],
3256
3529
  requestContext,
@@ -3261,6 +3534,7 @@ function createStaticHandler(routes, opts) {
3261
3534
  mapRouteProperties2,
3262
3535
  manifest,
3263
3536
  request,
3537
+ getRoutePattern(matches.map((m) => m.route.path)),
3264
3538
  match,
3265
3539
  [],
3266
3540
  requestContext,
@@ -3541,6 +3815,8 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
3541
3815
  actionResult,
3542
3816
  actionStatus
3543
3817
  };
3818
+ let pattern = getRoutePattern(matches.map((m) => m.route.path));
3819
+ console.log(pattern, matches);
3544
3820
  let dsMatches = matches.map((match, index) => {
3545
3821
  let { route } = match;
3546
3822
  let forceShouldLoad = null;
@@ -3564,6 +3840,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
3564
3840
  mapRouteProperties2,
3565
3841
  manifest,
3566
3842
  request,
3843
+ pattern,
3567
3844
  match,
3568
3845
  lazyRoutePropertiesToSkip,
3569
3846
  scopedContext,
@@ -3584,6 +3861,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
3584
3861
  mapRouteProperties2,
3585
3862
  manifest,
3586
3863
  request,
3864
+ pattern,
3587
3865
  match,
3588
3866
  lazyRoutePropertiesToSkip,
3589
3867
  scopedContext,
@@ -4042,7 +4320,12 @@ async function runMiddlewarePipeline(args, handler, processResult, isResult, err
4042
4320
  (m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
4043
4321
  );
4044
4322
  let result = await callRouteMiddleware(
4045
- { request, params, context },
4323
+ {
4324
+ request,
4325
+ params,
4326
+ context,
4327
+ unstable_pattern: getRoutePattern(matches.map((m) => m.route.path))
4328
+ },
4046
4329
  tuples,
4047
4330
  handler,
4048
4331
  processResult,
@@ -4120,7 +4403,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties2, manifest, request
4120
4403
  handler: lazyRoutePromises.lazyHandlerPromise
4121
4404
  };
4122
4405
  }
4123
- function getDataStrategyMatch(mapRouteProperties2, manifest, request, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
4406
+ function getDataStrategyMatch(mapRouteProperties2, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
4124
4407
  let isUsingNewApi = false;
4125
4408
  let _lazyPromises = getDataStrategyMatchLazyPromises(
4126
4409
  mapRouteProperties2,
@@ -4154,6 +4437,7 @@ function getDataStrategyMatch(mapRouteProperties2, manifest, request, match, laz
4154
4437
  if (callHandler && !isMiddlewareOnlyRoute) {
4155
4438
  return callLoaderOrAction({
4156
4439
  request,
4440
+ unstable_pattern,
4157
4441
  match,
4158
4442
  lazyHandlerPromise: _lazyPromises?.handler,
4159
4443
  lazyRoutePromise: _lazyPromises?.route,
@@ -4187,6 +4471,7 @@ function getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request,
4187
4471
  mapRouteProperties2,
4188
4472
  manifest,
4189
4473
  request,
4474
+ getRoutePattern(matches.map((m) => m.route.path)),
4190
4475
  match,
4191
4476
  lazyRoutePropertiesToSkip,
4192
4477
  scopedContext,
@@ -4201,6 +4486,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
4201
4486
  }
4202
4487
  let dataStrategyArgs = {
4203
4488
  request,
4489
+ unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
4204
4490
  params: matches[0].params,
4205
4491
  context: scopedContext,
4206
4492
  matches
@@ -4241,6 +4527,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
4241
4527
  }
4242
4528
  async function callLoaderOrAction({
4243
4529
  request,
4530
+ unstable_pattern,
4244
4531
  match,
4245
4532
  lazyHandlerPromise,
4246
4533
  lazyRoutePromise,
@@ -4267,6 +4554,7 @@ async function callLoaderOrAction({
4267
4554
  return handler(
4268
4555
  {
4269
4556
  request,
4557
+ unstable_pattern,
4270
4558
  params: match.params,
4271
4559
  context: scopedContext
4272
4560
  },
@@ -5552,15 +5840,6 @@ function warningOnce(key, cond, message) {
5552
5840
  warning(false, message);
5553
5841
  }
5554
5842
  }
5555
- function useRoute(routeId) {
5556
- const state = useDataRouterState("useRouteLoaderData" /* UseRouteLoaderData */);
5557
- const route = state.matches.find(({ route: route2 }) => route2.id === routeId);
5558
- if (route === void 0) return void 0;
5559
- return {
5560
- loaderData: state.loaderData[routeId],
5561
- actionData: state.actionData?.[routeId]
5562
- };
5563
- }
5564
5843
 
5565
5844
  // lib/components.tsx
5566
5845
  import * as React3 from "react";
@@ -5643,7 +5922,8 @@ function createMemoryRouter(routes, opts) {
5643
5922
  hydrationRouteProperties,
5644
5923
  mapRouteProperties,
5645
5924
  dataStrategy: opts?.dataStrategy,
5646
- patchRoutesOnNavigation: opts?.patchRoutesOnNavigation
5925
+ patchRoutesOnNavigation: opts?.patchRoutesOnNavigation,
5926
+ unstable_instrumentations: opts?.unstable_instrumentations
5647
5927
  }).initialize();
5648
5928
  }
5649
5929
  var Deferred = class {
@@ -8058,7 +8338,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
8058
8338
  let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
8059
8339
  let initialError = hasInitialError ? initialState?.errors?.[route.id] : void 0;
8060
8340
  let isHydrationRequest = needsRevalidation == null && (routeModule.clientLoader?.hydrate === true || !route.hasLoader);
8061
- dataRoute.loader = async ({ request, params, context }, singleFetch) => {
8341
+ dataRoute.loader = async ({ request, params, context, unstable_pattern }, singleFetch) => {
8062
8342
  try {
8063
8343
  let result = await prefetchStylesAndCallHandler(async () => {
8064
8344
  invariant2(
@@ -8072,6 +8352,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
8072
8352
  request,
8073
8353
  params,
8074
8354
  context,
8355
+ unstable_pattern,
8075
8356
  async serverLoader() {
8076
8357
  preventInvalidServerHandlerCall("loader", route);
8077
8358
  if (isHydrationRequest) {
@@ -8097,7 +8378,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
8097
8378
  route.hasLoader,
8098
8379
  isSpaMode
8099
8380
  );
8100
- dataRoute.action = ({ request, params, context }, singleFetch) => {
8381
+ dataRoute.action = ({ request, params, context, unstable_pattern }, singleFetch) => {
8101
8382
  return prefetchStylesAndCallHandler(async () => {
8102
8383
  invariant2(
8103
8384
  routeModule,
@@ -8113,6 +8394,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
8113
8394
  request,
8114
8395
  params,
8115
8396
  context,
8397
+ unstable_pattern,
8116
8398
  async serverAction() {
8117
8399
  preventInvalidServerHandlerCall("action", route);
8118
8400
  return fetchServerAction(singleFetch);
@@ -9122,7 +9404,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
9122
9404
  try {
9123
9405
  if (isBrowser) {
9124
9406
  window.__reactRouterVersion = // @ts-expect-error
9125
- "0.0.0-experimental-e613d4238";
9407
+ "0.0.0-experimental-3df673e";
9126
9408
  }
9127
9409
  } catch (e) {
9128
9410
  }
@@ -9138,7 +9420,8 @@ function createBrowserRouter(routes, opts) {
9138
9420
  hydrationRouteProperties,
9139
9421
  dataStrategy: opts?.dataStrategy,
9140
9422
  patchRoutesOnNavigation: opts?.patchRoutesOnNavigation,
9141
- window: opts?.window
9423
+ window: opts?.window,
9424
+ unstable_instrumentations: opts?.unstable_instrumentations
9142
9425
  }).initialize();
9143
9426
  }
9144
9427
  function createHashRouter(routes, opts) {
@@ -9153,7 +9436,8 @@ function createHashRouter(routes, opts) {
9153
9436
  hydrationRouteProperties,
9154
9437
  dataStrategy: opts?.dataStrategy,
9155
9438
  patchRoutesOnNavigation: opts?.patchRoutesOnNavigation,
9156
- window: opts?.window
9439
+ window: opts?.window,
9440
+ unstable_instrumentations: opts?.unstable_instrumentations
9157
9441
  }).initialize();
9158
9442
  }
9159
9443
  function parseHydrationData() {
@@ -10238,6 +10522,7 @@ export {
10238
10522
  replace,
10239
10523
  ErrorResponseImpl,
10240
10524
  isRouteErrorResponse,
10525
+ instrumentHandler,
10241
10526
  IDLE_NAVIGATION,
10242
10527
  IDLE_FETCHER,
10243
10528
  IDLE_BLOCKER,
@@ -10280,7 +10565,6 @@ export {
10280
10565
  useAsyncValue,
10281
10566
  useAsyncError,
10282
10567
  useBlocker,
10283
- useRoute,
10284
10568
  warnOnce,
10285
10569
  mapRouteProperties,
10286
10570
  hydrationRouteProperties,