react-router 0.0.0-experimental-c19b79d → 0.0.0-experimental-e0b6ce9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/development/{chunk-AGOH44BE.mjs → chunk-4FI4BC6Y.mjs} +67 -51
  2. package/dist/development/{chunk-IMKEG5CI.mjs → chunk-F6CT5MEB.mjs} +314 -30
  3. package/dist/development/{chunk-LUB73E44.js → chunk-INO4IHBF.js} +352 -71
  4. package/dist/development/{chunk-2G2U5HGB.js → chunk-ITZFCV4J.js} +164 -161
  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-CYIi6gi0.d.mts} +198 -134
  10. package/dist/{production/index-react-server-client-DKvU8YRr.d.ts → development/index-react-server-client-ChBGplLn.d.ts} +198 -134
  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 +90 -1
  16. package/dist/development/index-react-server.d.ts +90 -1
  17. package/dist/development/index-react-server.js +188 -9
  18. package/dist/development/index-react-server.mjs +188 -9
  19. package/dist/development/index.d.mts +13 -20
  20. package/dist/development/index.d.ts +13 -18
  21. package/dist/development/index.js +161 -147
  22. package/dist/development/index.mjs +3 -5
  23. package/dist/development/instrumentation-BGrNA7uj.d.ts +1122 -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/{route-data-CDwqkzPE.d.mts → routeModules-Cy4Xsfoi.d.mts} +157 -147
  31. package/dist/{production/routeModules-BmVo7q9e.d.ts → development/routeModules-DqotkItD.d.ts} +73 -1046
  32. package/dist/{production/context-BqL5Eckq.d.mts → development/router-DWv6Clt-.d.mts} +1390 -1253
  33. package/dist/production/{chunk-AODJW4D3.mjs → chunk-52MYED7O.mjs} +67 -51
  34. package/dist/production/{chunk-FGRCWJDI.js → chunk-DASXXYNZ.js} +164 -161
  35. package/dist/production/{chunk-2L5AG5Y5.js → chunk-K7VXYOZD.js} +352 -71
  36. package/dist/production/{chunk-UOQCOPF6.mjs → chunk-LKSLGWXX.mjs} +314 -30
  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/production/{index-react-server-client-2EDmGlsZ.d.mts → index-react-server-client-CYIi6gi0.d.mts} +140 -77
  42. package/dist/{development/index-react-server-client-2EDmGlsZ.d.mts → production/index-react-server-client-ChBGplLn.d.ts} +140 -77
  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 +90 -1
  48. package/dist/production/index-react-server.d.ts +90 -1
  49. package/dist/production/index-react-server.js +188 -9
  50. package/dist/production/index-react-server.mjs +188 -9
  51. package/dist/production/index.d.mts +13 -20
  52. package/dist/production/index.d.ts +13 -18
  53. package/dist/production/index.js +161 -147
  54. package/dist/production/index.mjs +3 -5
  55. package/dist/production/instrumentation-BGrNA7uj.d.ts +1122 -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/{route-data-CDwqkzPE.d.mts → routeModules-Cy4Xsfoi.d.mts} +157 -147
  63. package/dist/{development/routeModules-BmVo7q9e.d.ts → production/routeModules-DqotkItD.d.ts} +73 -1046
  64. package/dist/{development/context-BqL5Eckq.d.mts → production/router-DWv6Clt-.d.mts} +1390 -1253
  65. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2
- * react-router v0.0.0-experimental-c19b79d
2
+ * react-router v0.0.0-experimental-e0b6ce9
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -454,19 +454,23 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
454
454
  if (isIndexRoute(route)) {
455
455
  let indexRoute = {
456
456
  ...route,
457
- ...mapRouteProperties(route),
458
457
  id
459
458
  };
460
- manifest[id] = indexRoute;
459
+ manifest[id] = mergeRouteUpdates(
460
+ indexRoute,
461
+ mapRouteProperties(indexRoute)
462
+ );
461
463
  return indexRoute;
462
464
  } else {
463
465
  let pathOrLayoutRoute = {
464
466
  ...route,
465
- ...mapRouteProperties(route),
466
467
  id,
467
468
  children: void 0
468
469
  };
469
- manifest[id] = pathOrLayoutRoute;
470
+ manifest[id] = mergeRouteUpdates(
471
+ pathOrLayoutRoute,
472
+ mapRouteProperties(pathOrLayoutRoute)
473
+ );
470
474
  if (route.children) {
471
475
  pathOrLayoutRoute.children = convertRoutesToDataRoutes(
472
476
  route.children,
@@ -480,6 +484,17 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, 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,233 @@ 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 = _nullishCoalesce(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 = _nullishCoalesce(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 = _nullishCoalesce(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, _nullishCoalesce(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 = _nullishCoalesce(router.fetch[UninstrumentedSymbol], () => ( router.fetch));
1075
+ let instrumentedFetch = wrapImpl(aggregated.fetch, fetch2, (...args) => {
1076
+ let [key, , href, opts] = args;
1077
+ return {
1078
+ href: _nullishCoalesce(href, () => ( ".")),
1079
+ fetcherKey: key,
1080
+ ...getRouterInfo(router, _nullishCoalesce(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
+ // TODO: Handle non-middleware flows
1113
+ // @ts-expect-error
1114
+ context: getReadonlyContext(context)
1115
+ };
1116
+ });
1117
+ }
1118
+ return instrumentedHandler;
1119
+ }
1120
+ function wrapImpl(impls, handler, getInfo) {
1121
+ if (impls.length === 0) {
1122
+ return null;
1123
+ }
1124
+ return async (...args) => {
1125
+ let value;
1126
+ let info = getInfo(...args);
1127
+ await recurseRight(
1128
+ impls,
1129
+ info,
1130
+ async () => {
1131
+ value = await handler(...args);
1132
+ },
1133
+ impls.length - 1
1134
+ );
1135
+ return value;
1136
+ };
1137
+ }
1138
+ async function recurseRight(impls, info, handler, index) {
1139
+ let impl = impls[index];
1140
+ if (!impl) {
1141
+ await handler();
1142
+ } else {
1143
+ await impl(async () => {
1144
+ await recurseRight(impls, info, handler, index - 1);
1145
+ }, info);
1146
+ }
1147
+ }
1148
+ function getHandlerInfo(args) {
1149
+ let { request, context, params, unstable_pattern } = args;
1150
+ return {
1151
+ request: getReadonlyRequest(request),
1152
+ params: { ...params },
1153
+ unstable_pattern,
1154
+ context: getReadonlyContext(context)
1155
+ };
1156
+ }
1157
+ function getRouterInfo(router, opts) {
1158
+ return {
1159
+ currentUrl: createPath(router.state.location),
1160
+ ..."formMethod" in opts ? { formMethod: opts.formMethod } : {},
1161
+ ..."formEncType" in opts ? { formEncType: opts.formEncType } : {},
1162
+ ..."formData" in opts ? { formData: opts.formData } : {},
1163
+ ..."body" in opts ? { body: opts.body } : {}
1164
+ };
1165
+ }
1166
+ function getReadonlyRequest(request) {
1167
+ return {
1168
+ method: request.method,
1169
+ url: request.url,
1170
+ headers: {
1171
+ get: (...args) => request.headers.get(...args)
1172
+ }
1173
+ };
1174
+ }
1175
+ function getReadonlyContext(context) {
1176
+ return {
1177
+ get: (ctx) => context.get(ctx)
1178
+ };
1179
+ }
938
1180
 
939
1181
  // lib/router/router.ts
940
1182
  var validMutationMethodsArr = [
@@ -994,7 +1236,20 @@ function createRouter(init) {
994
1236
  "You must provide a non-empty routes array to createRouter"
995
1237
  );
996
1238
  let hydrationRouteProperties = init.hydrationRouteProperties || [];
997
- let mapRouteProperties = init.mapRouteProperties || defaultMapRouteProperties;
1239
+ let _mapRouteProperties = init.mapRouteProperties || defaultMapRouteProperties;
1240
+ let mapRouteProperties = _mapRouteProperties;
1241
+ if (init.unstable_instrumentations) {
1242
+ let instrumentations = init.unstable_instrumentations;
1243
+ mapRouteProperties = (route) => {
1244
+ return {
1245
+ ..._mapRouteProperties(route),
1246
+ ...getRouteInstrumentationUpdates(
1247
+ instrumentations.map((i) => i.route).filter(Boolean),
1248
+ route
1249
+ )
1250
+ };
1251
+ };
1252
+ }
998
1253
  let manifest = {};
999
1254
  let dataRoutes = convertRoutesToDataRoutes(
1000
1255
  init.routes,
@@ -2746,6 +3001,12 @@ function createRouter(init) {
2746
3001
  updateState(newState);
2747
3002
  }
2748
3003
  };
3004
+ if (init.unstable_instrumentations) {
3005
+ router = instrumentClientSideRouter(
3006
+ router,
3007
+ init.unstable_instrumentations.map((i) => i.router).filter(Boolean)
3008
+ );
3009
+ }
2749
3010
  return router;
2750
3011
  }
2751
3012
  function createStaticHandler(routes, opts) {
@@ -2755,7 +3016,20 @@ function createStaticHandler(routes, opts) {
2755
3016
  );
2756
3017
  let manifest = {};
2757
3018
  let basename = (opts ? opts.basename : null) || "/";
2758
- let mapRouteProperties = _optionalChain([opts, 'optionalAccess', _16 => _16.mapRouteProperties]) || defaultMapRouteProperties;
3019
+ let _mapRouteProperties = _optionalChain([opts, 'optionalAccess', _16 => _16.mapRouteProperties]) || defaultMapRouteProperties;
3020
+ let mapRouteProperties = _mapRouteProperties;
3021
+ if (_optionalChain([opts, 'optionalAccess', _17 => _17.unstable_instrumentations])) {
3022
+ let instrumentations = opts.unstable_instrumentations;
3023
+ mapRouteProperties = (route) => {
3024
+ return {
3025
+ ..._mapRouteProperties(route),
3026
+ ...getRouteInstrumentationUpdates(
3027
+ instrumentations.map((i) => i.route).filter(Boolean),
3028
+ route
3029
+ )
3030
+ };
3031
+ };
3032
+ }
2759
3033
  let dataRoutes = convertRoutesToDataRoutes(
2760
3034
  routes,
2761
3035
  mapRouteProperties,
@@ -2825,6 +3099,7 @@ function createStaticHandler(routes, opts) {
2825
3099
  let response = await runServerMiddlewarePipeline(
2826
3100
  {
2827
3101
  request,
3102
+ unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
2828
3103
  matches,
2829
3104
  params: matches[0].params,
2830
3105
  // If we're calling middleware then it must be enabled so we can cast
@@ -2888,9 +3163,9 @@ function createStaticHandler(routes, opts) {
2888
3163
  } else {
2889
3164
  let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
2890
3165
  matches,
2891
- _optionalChain([matches, 'access', _17 => _17.find, 'call', _18 => _18(
3166
+ _optionalChain([matches, 'access', _18 => _18.find, 'call', _19 => _19(
2892
3167
  (m) => m.route.id === routeId || m.route.loader
2893
- ), 'optionalAccess', _19 => _19.route, 'access', _20 => _20.id]) || routeId
3168
+ ), 'optionalAccess', _20 => _20.route, 'access', _21 => _21.id]) || routeId
2894
3169
  ).route.id;
2895
3170
  let staticContext = {
2896
3171
  matches,
@@ -2970,6 +3245,7 @@ function createStaticHandler(routes, opts) {
2970
3245
  let response = await runServerMiddlewarePipeline(
2971
3246
  {
2972
3247
  request,
3248
+ unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
2973
3249
  matches,
2974
3250
  params: matches[0].params,
2975
3251
  // If we're calling middleware then it must be enabled so we can cast
@@ -3222,11 +3498,11 @@ function createStaticHandler(routes, opts) {
3222
3498
  }
3223
3499
  async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, pendingActionResult) {
3224
3500
  let isRouteRequest = routeMatch != null;
3225
- if (isRouteRequest && !_optionalChain([routeMatch, 'optionalAccess', _21 => _21.route, 'access', _22 => _22.loader]) && !_optionalChain([routeMatch, 'optionalAccess', _23 => _23.route, 'access', _24 => _24.lazy])) {
3501
+ if (isRouteRequest && !_optionalChain([routeMatch, 'optionalAccess', _22 => _22.route, 'access', _23 => _23.loader]) && !_optionalChain([routeMatch, 'optionalAccess', _24 => _24.route, 'access', _25 => _25.lazy])) {
3226
3502
  throw getInternalRouterError(400, {
3227
3503
  method: request.method,
3228
3504
  pathname: new URL(request.url).pathname,
3229
- routeId: _optionalChain([routeMatch, 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id])
3505
+ routeId: _optionalChain([routeMatch, 'optionalAccess', _26 => _26.route, 'access', _27 => _27.id])
3230
3506
  });
3231
3507
  }
3232
3508
  let dsMatches;
@@ -3245,12 +3521,14 @@ function createStaticHandler(routes, opts) {
3245
3521
  // Up to but not including the boundary
3246
3522
  matches.findIndex((m) => m.route.id === pendingActionResult[0]) - 1
3247
3523
  ) : void 0;
3524
+ let pattern = getRoutePattern(matches.map((m) => m.route.path));
3248
3525
  dsMatches = matches.map((match, index) => {
3249
3526
  if (maxIdx != null && index > maxIdx) {
3250
3527
  return getDataStrategyMatch(
3251
3528
  mapRouteProperties,
3252
3529
  manifest,
3253
3530
  request,
3531
+ pattern,
3254
3532
  match,
3255
3533
  [],
3256
3534
  requestContext,
@@ -3261,6 +3539,7 @@ function createStaticHandler(routes, opts) {
3261
3539
  mapRouteProperties,
3262
3540
  manifest,
3263
3541
  request,
3542
+ pattern,
3264
3543
  match,
3265
3544
  [],
3266
3545
  requestContext,
@@ -3534,13 +3813,14 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
3534
3813
  let shouldSkipRevalidation = actionStatus && actionStatus >= 400;
3535
3814
  let baseShouldRevalidateArgs = {
3536
3815
  currentUrl,
3537
- currentParams: _optionalChain([state, 'access', _27 => _27.matches, 'access', _28 => _28[0], 'optionalAccess', _29 => _29.params]) || {},
3816
+ currentParams: _optionalChain([state, 'access', _28 => _28.matches, 'access', _29 => _29[0], 'optionalAccess', _30 => _30.params]) || {},
3538
3817
  nextUrl,
3539
3818
  nextParams: matches[0].params,
3540
3819
  ...submission,
3541
3820
  actionResult,
3542
3821
  actionStatus
3543
3822
  };
3823
+ let pattern = getRoutePattern(matches.map((m) => m.route.path));
3544
3824
  let dsMatches = matches.map((match, index) => {
3545
3825
  let { route } = match;
3546
3826
  let forceShouldLoad = null;
@@ -3564,6 +3844,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
3564
3844
  mapRouteProperties,
3565
3845
  manifest,
3566
3846
  request,
3847
+ pattern,
3567
3848
  match,
3568
3849
  lazyRoutePropertiesToSkip,
3569
3850
  scopedContext,
@@ -3584,6 +3865,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
3584
3865
  mapRouteProperties,
3585
3866
  manifest,
3586
3867
  request,
3868
+ pattern,
3587
3869
  match,
3588
3870
  lazyRoutePropertiesToSkip,
3589
3871
  scopedContext,
@@ -3758,7 +4040,7 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
3758
4040
  let newRoutes = convertRoutesToDataRoutes(
3759
4041
  uniqueChildren,
3760
4042
  mapRouteProperties,
3761
- [routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess', _30 => _30.length]) || "0")],
4043
+ [routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess', _31 => _31.length]) || "0")],
3762
4044
  manifest
3763
4045
  );
3764
4046
  childrenToPatch.push(...newRoutes);
@@ -3795,7 +4077,7 @@ function isSameRoute(newRoute, existingRoute) {
3795
4077
  return true;
3796
4078
  }
3797
4079
  return newRoute.children.every(
3798
- (aChild, i) => _optionalChain([existingRoute, 'access', _31 => _31.children, 'optionalAccess', _32 => _32.some, 'call', _33 => _33((bChild) => isSameRoute(aChild, bChild))])
4080
+ (aChild, i) => _optionalChain([existingRoute, 'access', _32 => _32.children, 'optionalAccess', _33 => _33.some, 'call', _34 => _34((bChild) => isSameRoute(aChild, bChild))])
3799
4081
  );
3800
4082
  }
3801
4083
  var lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();
@@ -3943,9 +4225,9 @@ function loadLazyRoute(route, type, manifest, mapRouteProperties, lazyRoutePrope
3943
4225
  }
3944
4226
  let lazyRoutePromise = lazyPropertyPromises.length > 0 ? Promise.all(lazyPropertyPromises).then(() => {
3945
4227
  }) : void 0;
3946
- _optionalChain([lazyRoutePromise, 'optionalAccess', _34 => _34.catch, 'call', _35 => _35(() => {
4228
+ _optionalChain([lazyRoutePromise, 'optionalAccess', _35 => _35.catch, 'call', _36 => _36(() => {
3947
4229
  })]);
3948
- _optionalChain([lazyHandlerPromise, 'optionalAccess', _36 => _36.catch, 'call', _37 => _37(() => {
4230
+ _optionalChain([lazyHandlerPromise, 'optionalAccess', _37 => _37.catch, 'call', _38 => _38(() => {
3949
4231
  })]);
3950
4232
  return {
3951
4233
  lazyRoutePromise,
@@ -4037,12 +4319,17 @@ function runClientMiddlewarePipeline(args, handler) {
4037
4319
  }
4038
4320
  }
4039
4321
  async function runMiddlewarePipeline(args, handler, processResult, isResult, errorHandler) {
4040
- let { matches, request, params, context } = args;
4322
+ let { matches, request, params, context, unstable_pattern } = args;
4041
4323
  let tuples = matches.flatMap(
4042
4324
  (m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
4043
4325
  );
4044
4326
  let result = await callRouteMiddleware(
4045
- { request, params, context },
4327
+ {
4328
+ request,
4329
+ params,
4330
+ context,
4331
+ unstable_pattern
4332
+ },
4046
4333
  tuples,
4047
4334
  handler,
4048
4335
  processResult,
@@ -4120,7 +4407,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
4120
4407
  handler: lazyRoutePromises.lazyHandlerPromise
4121
4408
  };
4122
4409
  }
4123
- function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
4410
+ function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
4124
4411
  let isUsingNewApi = false;
4125
4412
  let _lazyPromises = getDataStrategyMatchLazyPromises(
4126
4413
  mapRouteProperties,
@@ -4154,9 +4441,10 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazy
4154
4441
  if (callHandler && !isMiddlewareOnlyRoute) {
4155
4442
  return callLoaderOrAction({
4156
4443
  request,
4444
+ unstable_pattern,
4157
4445
  match,
4158
- lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess', _38 => _38.handler]),
4159
- lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess', _39 => _39.route]),
4446
+ lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess', _39 => _39.handler]),
4447
+ lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess', _40 => _40.route]),
4160
4448
  handlerOverride,
4161
4449
  scopedContext
4162
4450
  });
@@ -4187,6 +4475,7 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
4187
4475
  mapRouteProperties,
4188
4476
  manifest,
4189
4477
  request,
4478
+ getRoutePattern(matches.map((m) => m.route.path)),
4190
4479
  match,
4191
4480
  lazyRoutePropertiesToSkip,
4192
4481
  scopedContext,
@@ -4196,11 +4485,12 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
4196
4485
  });
4197
4486
  }
4198
4487
  async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherKey, scopedContext, isStaticHandler) {
4199
- if (matches.some((m) => _optionalChain([m, 'access', _40 => _40._lazyPromises, 'optionalAccess', _41 => _41.middleware]))) {
4200
- await Promise.all(matches.map((m) => _optionalChain([m, 'access', _42 => _42._lazyPromises, 'optionalAccess', _43 => _43.middleware])));
4488
+ if (matches.some((m) => _optionalChain([m, 'access', _41 => _41._lazyPromises, 'optionalAccess', _42 => _42.middleware]))) {
4489
+ await Promise.all(matches.map((m) => _optionalChain([m, 'access', _43 => _43._lazyPromises, 'optionalAccess', _44 => _44.middleware])));
4201
4490
  }
4202
4491
  let dataStrategyArgs = {
4203
4492
  request,
4493
+ unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
4204
4494
  params: matches[0].params,
4205
4495
  context: scopedContext,
4206
4496
  matches
@@ -4231,8 +4521,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
4231
4521
  try {
4232
4522
  await Promise.all(
4233
4523
  matches.flatMap((m) => [
4234
- _optionalChain([m, 'access', _44 => _44._lazyPromises, 'optionalAccess', _45 => _45.handler]),
4235
- _optionalChain([m, 'access', _46 => _46._lazyPromises, 'optionalAccess', _47 => _47.route])
4524
+ _optionalChain([m, 'access', _45 => _45._lazyPromises, 'optionalAccess', _46 => _46.handler]),
4525
+ _optionalChain([m, 'access', _47 => _47._lazyPromises, 'optionalAccess', _48 => _48.route])
4236
4526
  ])
4237
4527
  );
4238
4528
  } catch (e) {
@@ -4241,6 +4531,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
4241
4531
  }
4242
4532
  async function callLoaderOrAction({
4243
4533
  request,
4534
+ unstable_pattern,
4244
4535
  match,
4245
4536
  lazyHandlerPromise,
4246
4537
  lazyRoutePromise,
@@ -4267,6 +4558,7 @@ async function callLoaderOrAction({
4267
4558
  return handler(
4268
4559
  {
4269
4560
  request,
4561
+ unstable_pattern,
4270
4562
  params: match.params,
4271
4563
  context: scopedContext
4272
4564
  },
@@ -4375,19 +4667,19 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
4375
4667
  return {
4376
4668
  type: "error" /* error */,
4377
4669
  error: result.data,
4378
- statusCode: _optionalChain([result, 'access', _48 => _48.init, 'optionalAccess', _49 => _49.status]),
4379
- headers: _optionalChain([result, 'access', _50 => _50.init, 'optionalAccess', _51 => _51.headers]) ? new Headers(result.init.headers) : void 0
4670
+ statusCode: _optionalChain([result, 'access', _49 => _49.init, 'optionalAccess', _50 => _50.status]),
4671
+ headers: _optionalChain([result, 'access', _51 => _51.init, 'optionalAccess', _52 => _52.headers]) ? new Headers(result.init.headers) : void 0
4380
4672
  };
4381
4673
  }
4382
4674
  return {
4383
4675
  type: "error" /* error */,
4384
4676
  error: new ErrorResponseImpl(
4385
- _optionalChain([result, 'access', _52 => _52.init, 'optionalAccess', _53 => _53.status]) || 500,
4677
+ _optionalChain([result, 'access', _53 => _53.init, 'optionalAccess', _54 => _54.status]) || 500,
4386
4678
  void 0,
4387
4679
  result.data
4388
4680
  ),
4389
4681
  statusCode: isRouteErrorResponse(result) ? result.status : void 0,
4390
- headers: _optionalChain([result, 'access', _54 => _54.init, 'optionalAccess', _55 => _55.headers]) ? new Headers(result.init.headers) : void 0
4682
+ headers: _optionalChain([result, 'access', _55 => _55.init, 'optionalAccess', _56 => _56.headers]) ? new Headers(result.init.headers) : void 0
4391
4683
  };
4392
4684
  }
4393
4685
  return {
@@ -4400,8 +4692,8 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
4400
4692
  return {
4401
4693
  type: "data" /* data */,
4402
4694
  data: result.data,
4403
- statusCode: _optionalChain([result, 'access', _56 => _56.init, 'optionalAccess', _57 => _57.status]),
4404
- headers: _optionalChain([result, 'access', _58 => _58.init, 'optionalAccess', _59 => _59.headers]) ? new Headers(result.init.headers) : void 0
4695
+ statusCode: _optionalChain([result, 'access', _57 => _57.init, 'optionalAccess', _58 => _58.status]),
4696
+ headers: _optionalChain([result, 'access', _59 => _59.init, 'optionalAccess', _60 => _60.headers]) ? new Headers(result.init.headers) : void 0
4405
4697
  };
4406
4698
  }
4407
4699
  return { type: "data" /* data */, data: result };
@@ -4550,7 +4842,7 @@ function processLoaderData(state, matches, results, pendingActionResult, revalid
4550
4842
  let result = fetcherResults[key];
4551
4843
  invariant(result, "Did not find corresponding fetcher result");
4552
4844
  if (isErrorResult(result)) {
4553
- let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess', _60 => _60.route, 'access', _61 => _61.id]));
4845
+ let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess', _61 => _61.route, 'access', _62 => _62.id]));
4554
4846
  if (!(errors && errors[boundaryMatch.route.id])) {
4555
4847
  errors = {
4556
4848
  ...errors,
@@ -4684,8 +4976,8 @@ function dataWithResponseInitToResponse(data2) {
4684
4976
  }
4685
4977
  function dataWithResponseInitToErrorResponse(data2) {
4686
4978
  return new ErrorResponseImpl(
4687
- _nullishCoalesce(_optionalChain([data2, 'access', _62 => _62.init, 'optionalAccess', _63 => _63.status]), () => ( 500)),
4688
- _nullishCoalesce(_optionalChain([data2, 'access', _64 => _64.init, 'optionalAccess', _65 => _65.statusText]), () => ( "Internal Server Error")),
4979
+ _nullishCoalesce(_optionalChain([data2, 'access', _63 => _63.init, 'optionalAccess', _64 => _64.status]), () => ( 500)),
4980
+ _nullishCoalesce(_optionalChain([data2, 'access', _65 => _65.init, 'optionalAccess', _66 => _66.statusText]), () => ( "Internal Server Error")),
4689
4981
  data2.data
4690
4982
  );
4691
4983
  }
@@ -5717,7 +6009,7 @@ function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules
5717
6009
  return {
5718
6010
  hasLoader: manifestRoute.hasLoader,
5719
6011
  hasClientLoader: manifestRoute.hasClientLoader,
5720
- hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess', _66 => _66.shouldRevalidate]))
6012
+ hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess', _67 => _67.shouldRevalidate]))
5721
6013
  };
5722
6014
  },
5723
6015
  fetchAndDecodeViaTurboStream,
@@ -5884,7 +6176,7 @@ async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams,
5884
6176
  let routeResult = fetchedData.routes[match.route.id];
5885
6177
  if ("error" in routeResult) {
5886
6178
  middlewareError = routeResult.error;
5887
- if (_optionalChain([results, 'access', _67 => _67[match.route.id], 'optionalAccess', _68 => _68.result]) == null) {
6179
+ if (_optionalChain([results, 'access', _68 => _68[match.route.id], 'optionalAccess', _69 => _69.result]) == null) {
5888
6180
  results[match.route.id] = {
5889
6181
  type: "error",
5890
6182
  result: middlewareError
@@ -5997,7 +6289,7 @@ async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
5997
6289
  }
5998
6290
  } else {
5999
6291
  let typed = decoded.value;
6000
- let routeId = _optionalChain([targetRoutes, 'optionalAccess', _69 => _69[0]]);
6292
+ let routeId = _optionalChain([targetRoutes, 'optionalAccess', _70 => _70[0]]);
6001
6293
  invariant2(routeId, "No routeId found for single fetch call decoding");
6002
6294
  if ("redirect" in typed) {
6003
6295
  data2 = { redirect: typed };
@@ -6309,7 +6601,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
6309
6601
  if (locationArg) {
6310
6602
  let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
6311
6603
  invariant(
6312
- parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _70 => _70.pathname, 'optionalAccess', _71 => _71.startsWith, 'call', _72 => _72(parentPathnameBase)]),
6604
+ parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _71 => _71.pathname, 'optionalAccess', _72 => _72.startsWith, 'call', _73 => _73(parentPathnameBase)]),
6313
6605
  `When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${parentPathnameBase}" but pathname "${parsedLocationArg.pathname}" was given in the \`location\` prop.`
6314
6606
  );
6315
6607
  location = parsedLocationArg;
@@ -6471,10 +6763,10 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
6471
6763
  }
6472
6764
  }
6473
6765
  let renderedMatches = matches;
6474
- let errors = _optionalChain([dataRouterState, 'optionalAccess', _73 => _73.errors]);
6766
+ let errors = _optionalChain([dataRouterState, 'optionalAccess', _74 => _74.errors]);
6475
6767
  if (errors != null) {
6476
6768
  let errorIndex = renderedMatches.findIndex(
6477
- (m) => m.route.id && _optionalChain([errors, 'optionalAccess', _74 => _74[m.route.id]]) !== void 0
6769
+ (m) => m.route.id && _optionalChain([errors, 'optionalAccess', _75 => _75[m.route.id]]) !== void 0
6478
6770
  );
6479
6771
  invariant(
6480
6772
  errorIndex >= 0,
@@ -6652,15 +6944,15 @@ function useRouteError() {
6652
6944
  if (error !== void 0) {
6653
6945
  return error;
6654
6946
  }
6655
- return _optionalChain([state, 'access', _75 => _75.errors, 'optionalAccess', _76 => _76[routeId]]);
6947
+ return _optionalChain([state, 'access', _76 => _76.errors, 'optionalAccess', _77 => _77[routeId]]);
6656
6948
  }
6657
6949
  function useAsyncValue() {
6658
6950
  let value = React3.useContext(AwaitContext);
6659
- return _optionalChain([value, 'optionalAccess', _77 => _77._data]);
6951
+ return _optionalChain([value, 'optionalAccess', _78 => _78._data]);
6660
6952
  }
6661
6953
  function useAsyncError() {
6662
6954
  let value = React3.useContext(AwaitContext);
6663
- return _optionalChain([value, 'optionalAccess', _78 => _78._error]);
6955
+ return _optionalChain([value, 'optionalAccess', _79 => _79._error]);
6664
6956
  }
6665
6957
  var blockerId = 0;
6666
6958
  function useBlocker(shouldBlock) {
@@ -6730,19 +7022,6 @@ function warningOnce(key, cond, message) {
6730
7022
  warning(false, message);
6731
7023
  }
6732
7024
  }
6733
- function useRoute(...args) {
6734
- const currentRouteId = useCurrentRouteId(
6735
- "useRoute" /* UseRoute */
6736
- );
6737
- const id = _nullishCoalesce(args[0], () => ( currentRouteId));
6738
- const state = useDataRouterState("useRouteLoaderData" /* UseRouteLoaderData */);
6739
- const route = state.matches.find(({ route: route2 }) => route2.id === id);
6740
- if (route === void 0) return void 0;
6741
- return {
6742
- loaderData: state.loaderData[id],
6743
- actionData: _optionalChain([state, 'access', _79 => _79.actionData, 'optionalAccess', _80 => _80[id]])
6744
- };
6745
- }
6746
7025
 
6747
7026
  // lib/dom/ssr/errorBoundaries.tsx
6748
7027
 
@@ -6785,7 +7064,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
6785
7064
  let route = manifest.routes[match.route.id];
6786
7065
  return [
6787
7066
  route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
6788
- _optionalChain([module, 'optionalAccess', _81 => _81.links, 'optionalCall', _82 => _82()]) || []
7067
+ _optionalChain([module, 'optionalAccess', _80 => _80.links, 'optionalCall', _81 => _81()]) || []
6789
7068
  ];
6790
7069
  }).flat(2);
6791
7070
  let preloads = getModuleLinkHrefs(matches, manifest);
@@ -6886,7 +7165,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
6886
7165
  // param change, /users/123 -> /users/456
6887
7166
  currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
6888
7167
  // e.g. /files/images/avatar.jpg -> files/finances.xls
6889
- _optionalChain([currentMatches, 'access', _83 => _83[index], 'access', _84 => _84.route, 'access', _85 => _85.path, 'optionalAccess', _86 => _86.endsWith, 'call', _87 => _87("*")]) && currentMatches[index].params["*"] !== match.params["*"]
7168
+ _optionalChain([currentMatches, 'access', _82 => _82[index], 'access', _83 => _83.route, 'access', _84 => _84.path, 'optionalAccess', _85 => _85.endsWith, 'call', _86 => _86("*")]) && currentMatches[index].params["*"] !== match.params["*"]
6890
7169
  );
6891
7170
  };
6892
7171
  if (mode === "assets") {
@@ -6909,7 +7188,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
6909
7188
  location.pathname + location.search + location.hash,
6910
7189
  window.origin
6911
7190
  ),
6912
- currentParams: _optionalChain([currentMatches, 'access', _88 => _88[0], 'optionalAccess', _89 => _89.params]) || {},
7191
+ currentParams: _optionalChain([currentMatches, 'access', _87 => _87[0], 'optionalAccess', _88 => _88.params]) || {},
6913
7192
  nextUrl: new URL(page, window.origin),
6914
7193
  nextParams: match.params,
6915
7194
  defaultShouldRevalidate: true
@@ -7181,11 +7460,11 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7181
7460
  )
7182
7461
  });
7183
7462
  let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
7184
- let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _90 => _90.loaderData, 'optionalAccess', _91 => _91[route.id]]) : void 0;
7463
+ let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _89 => _89.loaderData, 'optionalAccess', _90 => _90[route.id]]) : void 0;
7185
7464
  let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
7186
- let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _92 => _92.errors, 'optionalAccess', _93 => _93[route.id]]) : void 0;
7187
- let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _94 => _94.clientLoader, 'optionalAccess', _95 => _95.hydrate]) === true || !route.hasLoader);
7188
- dataRoute.loader = async ({ request, params, context }, singleFetch) => {
7465
+ let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _91 => _91.errors, 'optionalAccess', _92 => _92[route.id]]) : void 0;
7466
+ let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _93 => _93.clientLoader, 'optionalAccess', _94 => _94.hydrate]) === true || !route.hasLoader);
7467
+ dataRoute.loader = async ({ request, params, context, unstable_pattern }, singleFetch) => {
7189
7468
  try {
7190
7469
  let result = await prefetchStylesAndCallHandler(async () => {
7191
7470
  invariant2(
@@ -7199,6 +7478,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7199
7478
  request,
7200
7479
  params,
7201
7480
  context,
7481
+ unstable_pattern,
7202
7482
  async serverLoader() {
7203
7483
  preventInvalidServerHandlerCall("loader", route);
7204
7484
  if (isHydrationRequest) {
@@ -7224,7 +7504,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7224
7504
  route.hasLoader,
7225
7505
  isSpaMode
7226
7506
  );
7227
- dataRoute.action = ({ request, params, context }, singleFetch) => {
7507
+ dataRoute.action = ({ request, params, context, unstable_pattern }, singleFetch) => {
7228
7508
  return prefetchStylesAndCallHandler(async () => {
7229
7509
  invariant2(
7230
7510
  routeModule,
@@ -7240,6 +7520,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7240
7520
  request,
7241
7521
  params,
7242
7522
  context,
7523
+ unstable_pattern,
7243
7524
  async serverAction() {
7244
7525
  preventInvalidServerHandlerCall("action", route);
7245
7526
  return fetchServerAction(singleFetch);
@@ -7478,7 +7759,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
7478
7759
  function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
7479
7760
  React6.useEffect(() => {
7480
7761
  if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
7481
- _optionalChain([window, 'access', _96 => _96.navigator, 'optionalAccess', _97 => _97.connection, 'optionalAccess', _98 => _98.saveData]) === true) {
7762
+ _optionalChain([window, 'access', _95 => _95.navigator, 'optionalAccess', _96 => _96.connection, 'optionalAccess', _97 => _97.saveData]) === true) {
7482
7763
  return;
7483
7764
  }
7484
7765
  function registerElement(el) {
@@ -7587,7 +7868,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
7587
7868
  }
7588
7869
  serverPatches = await res.json();
7589
7870
  } catch (e) {
7590
- if (_optionalChain([signal, 'optionalAccess', _99 => _99.aborted])) return;
7871
+ if (_optionalChain([signal, 'optionalAccess', _98 => _98.aborted])) return;
7591
7872
  throw e;
7592
7873
  }
7593
7874
  let knownRoutes = new Set(Object.keys(manifest.routes));
@@ -7828,7 +8109,7 @@ function PrefetchPageLinksImpl({
7828
8109
  if (!manifestRoute || !manifestRoute.hasLoader) {
7829
8110
  return;
7830
8111
  }
7831
- if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _100 => _100[m.route.id], 'optionalAccess', _101 => _101.shouldRevalidate])) {
8112
+ if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _99 => _99[m.route.id], 'optionalAccess', _100 => _100.shouldRevalidate])) {
7832
8113
  foundOptOutRoute = true;
7833
8114
  } else if (manifestRoute.hasClientLoader) {
7834
8115
  foundOptOutRoute = true;
@@ -7902,7 +8183,7 @@ function Meta() {
7902
8183
  error
7903
8184
  };
7904
8185
  matches[i] = match;
7905
- if (_optionalChain([routeModule, 'optionalAccess', _102 => _102.meta])) {
8186
+ if (_optionalChain([routeModule, 'optionalAccess', _101 => _101.meta])) {
7906
8187
  routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
7907
8188
  data: data2,
7908
8189
  loaderData: data2,
@@ -8001,7 +8282,7 @@ function Scripts(scriptProps) {
8001
8282
  }
8002
8283
  let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
8003
8284
  let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
8004
- let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _103 => _103.hmr, 'optionalAccess', _104 => _104.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
8285
+ let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _102 => _102.hmr, 'optionalAccess', _103 => _103.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
8005
8286
  ${matches.map((match, routeIndex) => {
8006
8287
  let routeVarName = `route${routeIndex}`;
8007
8288
  let manifestEntry = manifest.routes[match.route.id];
@@ -8231,7 +8512,7 @@ function BoundaryShell({
8231
8512
  children
8232
8513
  }) {
8233
8514
  let { routeModules } = useFrameworkContext();
8234
- if (_optionalChain([routeModules, 'access', _105 => _105.root, 'optionalAccess', _106 => _106.Layout]) && !isOutsideRemixApp) {
8515
+ if (_optionalChain([routeModules, 'access', _104 => _104.root, 'optionalAccess', _105 => _105.Layout]) && !isOutsideRemixApp) {
8235
8516
  return children;
8236
8517
  }
8237
8518
  return /* @__PURE__ */ React8.createElement("html", { lang: "en" }, /* @__PURE__ */ React8.createElement("head", null, /* @__PURE__ */ React8.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React8.createElement(
@@ -8347,4 +8628,4 @@ function BoundaryShell({
8347
8628
 
8348
8629
 
8349
8630
 
8350
- exports.Action = Action; exports.createMemoryHistory = createMemoryHistory; exports.createBrowserHistory = createBrowserHistory; exports.createHashHistory = createHashHistory; exports.invariant = invariant; exports.warning = warning; exports.createPath = createPath; exports.parsePath = parsePath; exports.createContext = createContext; exports.RouterContextProvider = RouterContextProvider; exports.convertRoutesToDataRoutes = convertRoutesToDataRoutes; exports.matchRoutes = matchRoutes; exports.generatePath = generatePath; exports.matchPath = matchPath; exports.stripBasename = stripBasename; exports.resolvePath = resolvePath; exports.getResolveToMatches = getResolveToMatches; exports.resolveTo = resolveTo; exports.joinPaths = joinPaths; exports.data = data; exports.redirect = redirect; exports.redirectDocument = redirectDocument; exports.replace = replace; exports.ErrorResponseImpl = ErrorResponseImpl; exports.isRouteErrorResponse = isRouteErrorResponse; exports.escapeHtml = escapeHtml; exports.encode = encode; exports.IDLE_NAVIGATION = IDLE_NAVIGATION; exports.IDLE_FETCHER = IDLE_FETCHER; exports.IDLE_BLOCKER = IDLE_BLOCKER; exports.createRouter = createRouter; exports.createStaticHandler = createStaticHandler; exports.getStaticContextFromError = getStaticContextFromError; exports.isDataWithResponseInit = isDataWithResponseInit; exports.isResponse = isResponse; exports.isRedirectStatusCode = isRedirectStatusCode; exports.isRedirectResponse = isRedirectResponse; exports.isMutationMethod = isMutationMethod; exports.createRequestInit = createRequestInit; exports.SingleFetchRedirectSymbol = SingleFetchRedirectSymbol; exports.SINGLE_FETCH_REDIRECT_STATUS = SINGLE_FETCH_REDIRECT_STATUS; exports.NO_BODY_STATUS_CODES = NO_BODY_STATUS_CODES; exports.StreamTransfer = StreamTransfer; exports.getTurboStreamSingleFetchDataStrategy = getTurboStreamSingleFetchDataStrategy; exports.getSingleFetchDataStrategyImpl = getSingleFetchDataStrategyImpl; exports.stripIndexParam = stripIndexParam; exports.singleFetchUrl = singleFetchUrl; exports.decodeViaTurboStream = decodeViaTurboStream; exports.DataRouterContext = DataRouterContext; exports.DataRouterStateContext = DataRouterStateContext; exports.RSCRouterContext = RSCRouterContext; exports.ViewTransitionContext = ViewTransitionContext; exports.FetchersContext = FetchersContext; exports.AwaitContext = AwaitContext; exports.AwaitContextProvider = AwaitContextProvider; exports.NavigationContext = NavigationContext; exports.LocationContext = LocationContext; exports.RouteContext = RouteContext; exports.ENABLE_DEV_WARNINGS = ENABLE_DEV_WARNINGS; exports.warnOnce = warnOnce; exports.useHref = useHref; exports.useInRouterContext = useInRouterContext; exports.useLocation = useLocation; exports.useNavigationType = useNavigationType; exports.useMatch = useMatch; exports.useNavigate = useNavigate; exports.useOutletContext = useOutletContext; exports.useOutlet = useOutlet; exports.useParams = useParams; exports.useResolvedPath = useResolvedPath; exports.useRoutes = useRoutes; exports.useRoutesImpl = useRoutesImpl; exports._renderMatches = _renderMatches; exports.useRouteId = useRouteId; exports.useNavigation = useNavigation; exports.useRevalidator = useRevalidator; exports.useMatches = useMatches; exports.useLoaderData = useLoaderData; exports.useRouteLoaderData = useRouteLoaderData; exports.useActionData = useActionData; exports.useRouteError = useRouteError; exports.useAsyncValue = useAsyncValue; exports.useAsyncError = useAsyncError; exports.useBlocker = useBlocker; exports.useRoute = useRoute; exports.RemixErrorBoundary = RemixErrorBoundary; exports.createServerRoutes = createServerRoutes; exports.createClientRoutesWithHMRRevalidationOptOut = createClientRoutesWithHMRRevalidationOptOut; exports.noActionDefinedError = noActionDefinedError; exports.createClientRoutes = createClientRoutes; exports.shouldHydrateRouteLoader = shouldHydrateRouteLoader; exports.getPatchRoutesOnNavigationFunction = getPatchRoutesOnNavigationFunction; exports.useFogOFWarDiscovery = useFogOFWarDiscovery; exports.getManifestPath = getManifestPath; exports.FrameworkContext = FrameworkContext; exports.usePrefetchBehavior = usePrefetchBehavior; exports.CRITICAL_CSS_DATA_ATTRIBUTE = CRITICAL_CSS_DATA_ATTRIBUTE; exports.Links = Links; exports.PrefetchPageLinks = PrefetchPageLinks; exports.Meta = Meta; exports.setIsHydrated = setIsHydrated; exports.Scripts = Scripts; exports.mergeRefs = mergeRefs;
8631
+ exports.Action = Action; exports.createMemoryHistory = createMemoryHistory; exports.createBrowserHistory = createBrowserHistory; exports.createHashHistory = createHashHistory; exports.invariant = invariant; exports.warning = warning; exports.createPath = createPath; exports.parsePath = parsePath; exports.createContext = createContext; exports.RouterContextProvider = RouterContextProvider; exports.convertRoutesToDataRoutes = convertRoutesToDataRoutes; exports.matchRoutes = matchRoutes; exports.generatePath = generatePath; exports.matchPath = matchPath; exports.stripBasename = stripBasename; exports.resolvePath = resolvePath; exports.getResolveToMatches = getResolveToMatches; exports.resolveTo = resolveTo; exports.joinPaths = joinPaths; exports.data = data; exports.redirect = redirect; exports.redirectDocument = redirectDocument; exports.replace = replace; exports.ErrorResponseImpl = ErrorResponseImpl; exports.isRouteErrorResponse = isRouteErrorResponse; exports.escapeHtml = escapeHtml; exports.encode = encode; exports.instrumentHandler = instrumentHandler; exports.IDLE_NAVIGATION = IDLE_NAVIGATION; exports.IDLE_FETCHER = IDLE_FETCHER; exports.IDLE_BLOCKER = IDLE_BLOCKER; exports.createRouter = createRouter; exports.createStaticHandler = createStaticHandler; exports.getStaticContextFromError = getStaticContextFromError; exports.isDataWithResponseInit = isDataWithResponseInit; exports.isResponse = isResponse; exports.isRedirectStatusCode = isRedirectStatusCode; exports.isRedirectResponse = isRedirectResponse; exports.isMutationMethod = isMutationMethod; exports.createRequestInit = createRequestInit; exports.SingleFetchRedirectSymbol = SingleFetchRedirectSymbol; exports.SINGLE_FETCH_REDIRECT_STATUS = SINGLE_FETCH_REDIRECT_STATUS; exports.NO_BODY_STATUS_CODES = NO_BODY_STATUS_CODES; exports.StreamTransfer = StreamTransfer; exports.getTurboStreamSingleFetchDataStrategy = getTurboStreamSingleFetchDataStrategy; exports.getSingleFetchDataStrategyImpl = getSingleFetchDataStrategyImpl; exports.stripIndexParam = stripIndexParam; exports.singleFetchUrl = singleFetchUrl; exports.decodeViaTurboStream = decodeViaTurboStream; exports.DataRouterContext = DataRouterContext; exports.DataRouterStateContext = DataRouterStateContext; exports.RSCRouterContext = RSCRouterContext; exports.ViewTransitionContext = ViewTransitionContext; exports.FetchersContext = FetchersContext; exports.AwaitContext = AwaitContext; exports.AwaitContextProvider = AwaitContextProvider; exports.NavigationContext = NavigationContext; exports.LocationContext = LocationContext; exports.RouteContext = RouteContext; exports.ENABLE_DEV_WARNINGS = ENABLE_DEV_WARNINGS; exports.warnOnce = warnOnce; exports.useHref = useHref; exports.useInRouterContext = useInRouterContext; exports.useLocation = useLocation; exports.useNavigationType = useNavigationType; exports.useMatch = useMatch; exports.useNavigate = useNavigate; exports.useOutletContext = useOutletContext; exports.useOutlet = useOutlet; exports.useParams = useParams; exports.useResolvedPath = useResolvedPath; exports.useRoutes = useRoutes; exports.useRoutesImpl = useRoutesImpl; exports._renderMatches = _renderMatches; exports.useRouteId = useRouteId; exports.useNavigation = useNavigation; exports.useRevalidator = useRevalidator; exports.useMatches = useMatches; exports.useLoaderData = useLoaderData; exports.useRouteLoaderData = useRouteLoaderData; exports.useActionData = useActionData; exports.useRouteError = useRouteError; exports.useAsyncValue = useAsyncValue; exports.useAsyncError = useAsyncError; exports.useBlocker = useBlocker; exports.RemixErrorBoundary = RemixErrorBoundary; exports.createServerRoutes = createServerRoutes; exports.createClientRoutesWithHMRRevalidationOptOut = createClientRoutesWithHMRRevalidationOptOut; exports.noActionDefinedError = noActionDefinedError; exports.createClientRoutes = createClientRoutes; exports.shouldHydrateRouteLoader = shouldHydrateRouteLoader; exports.getPatchRoutesOnNavigationFunction = getPatchRoutesOnNavigationFunction; exports.useFogOFWarDiscovery = useFogOFWarDiscovery; exports.getManifestPath = getManifestPath; exports.FrameworkContext = FrameworkContext; exports.usePrefetchBehavior = usePrefetchBehavior; exports.CRITICAL_CSS_DATA_ATTRIBUTE = CRITICAL_CSS_DATA_ATTRIBUTE; exports.Links = Links; exports.PrefetchPageLinks = PrefetchPageLinks; exports.Meta = Meta; exports.setIsHydrated = setIsHydrated; exports.Scripts = Scripts; exports.mergeRefs = mergeRefs;