react-router 7.13.1 → 7.13.2

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 (76) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/{production/browser-DzsJABDQ.d.mts → development/browser-Bfn3xw9E.d.ts} +2 -1
  3. package/dist/development/{browser-DzsJABDQ.d.mts → browser-Di6-vSl-.d.mts} +2 -1
  4. package/dist/development/{chunk-XOLAXE2Z.js → chunk-GO74ODU3.js} +190 -111
  5. package/dist/{production/chunk-B5UMK6O7.js → development/chunk-HPFFRPKK.js} +100 -99
  6. package/dist/development/{chunk-KSEWV2VO.js → chunk-LLP6DRWX.js} +7 -7
  7. package/dist/{production/chunk-TXB4YXR2.mjs → development/chunk-UALY5CBT.mjs} +83 -49
  8. package/dist/development/{chunk-LFPYN7LY.mjs → chunk-UVKPFVEO.mjs} +124 -44
  9. package/dist/development/context-phCt_zmH.d.mts +1713 -0
  10. package/dist/development/dom-export.d.mts +3 -2
  11. package/dist/development/dom-export.d.ts +3 -2
  12. package/dist/development/dom-export.js +45 -29
  13. package/dist/development/dom-export.mjs +21 -5
  14. package/dist/development/{index-react-server-client-C4tCIird.d.ts → index-react-server-client-BcrVT7Dd.d.mts} +4 -2
  15. package/dist/{production/index-react-server-client-EzWJGpN_.d.mts → development/index-react-server-client-CCwMoQIT.d.ts} +1067 -10
  16. package/dist/development/index-react-server-client.d.mts +3 -2
  17. package/dist/development/index-react-server-client.d.ts +3 -2
  18. package/dist/development/index-react-server-client.js +4 -4
  19. package/dist/development/index-react-server-client.mjs +2 -2
  20. package/dist/development/index-react-server.d.mts +293 -246
  21. package/dist/development/index-react-server.d.ts +293 -246
  22. package/dist/development/index-react-server.js +121 -43
  23. package/dist/development/index-react-server.mjs +121 -43
  24. package/dist/development/index.d.mts +15 -13
  25. package/dist/development/index.d.ts +15 -13
  26. package/dist/development/index.js +176 -142
  27. package/dist/development/index.mjs +3 -3
  28. package/dist/development/instrumentation-BYr6ff5D.d.ts +657 -0
  29. package/dist/development/lib/types/internal.d.mts +2 -2
  30. package/dist/development/lib/types/internal.d.ts +2 -2
  31. package/dist/development/lib/types/internal.js +1 -1
  32. package/dist/development/lib/types/internal.mjs +1 -1
  33. package/dist/development/{register-CBoanF80.d.ts → register-CTxsJBKQ.d.mts} +1 -1
  34. package/dist/development/{register-cRYJ3CjG.d.mts → register-CkcGwv27.d.ts} +1 -1
  35. package/dist/development/routeModules-BRrCYrSL.d.mts +1693 -0
  36. package/dist/development/routeModules-CA7kSxJJ.d.ts +1693 -0
  37. package/dist/production/{browser-sPQ7eaK4.d.ts → browser-Bfn3xw9E.d.ts} +2 -1
  38. package/dist/{development/browser-sPQ7eaK4.d.ts → production/browser-Di6-vSl-.d.mts} +2 -1
  39. package/dist/production/{chunk-RJCJ3EYF.mjs → chunk-2BDJPJTA.mjs} +124 -44
  40. package/dist/production/{chunk-ZJMCM6KT.js → chunk-CAFVLUDY.js} +7 -7
  41. package/dist/production/{chunk-772H4TVR.js → chunk-LKUVSIBA.js} +190 -111
  42. package/dist/{development/chunk-JPUPSTYD.mjs → production/chunk-PY35PE22.mjs} +83 -49
  43. package/dist/{development/chunk-2YMDXNOJ.js → production/chunk-XAAX7KIK.js} +100 -99
  44. package/dist/production/context-phCt_zmH.d.mts +1713 -0
  45. package/dist/production/dom-export.d.mts +3 -2
  46. package/dist/production/dom-export.d.ts +3 -2
  47. package/dist/production/dom-export.js +45 -29
  48. package/dist/production/dom-export.mjs +21 -5
  49. package/dist/{development/index-react-server-client-EzWJGpN_.d.mts → production/index-react-server-client-BcrVT7Dd.d.mts} +4 -2
  50. package/dist/production/{index-react-server-client-C4tCIird.d.ts → index-react-server-client-CCwMoQIT.d.ts} +1067 -10
  51. package/dist/production/index-react-server-client.d.mts +3 -2
  52. package/dist/production/index-react-server-client.d.ts +3 -2
  53. package/dist/production/index-react-server-client.js +4 -4
  54. package/dist/production/index-react-server-client.mjs +2 -2
  55. package/dist/production/index-react-server.d.mts +293 -246
  56. package/dist/production/index-react-server.d.ts +293 -246
  57. package/dist/production/index-react-server.js +121 -43
  58. package/dist/production/index-react-server.mjs +121 -43
  59. package/dist/production/index.d.mts +15 -13
  60. package/dist/production/index.d.ts +15 -13
  61. package/dist/production/index.js +176 -142
  62. package/dist/production/index.mjs +3 -3
  63. package/dist/production/instrumentation-BYr6ff5D.d.ts +657 -0
  64. package/dist/production/lib/types/internal.d.mts +2 -2
  65. package/dist/production/lib/types/internal.d.ts +2 -2
  66. package/dist/production/lib/types/internal.js +1 -1
  67. package/dist/production/lib/types/internal.mjs +1 -1
  68. package/dist/production/{register-CBoanF80.d.ts → register-CTxsJBKQ.d.mts} +1 -1
  69. package/dist/production/{register-cRYJ3CjG.d.mts → register-CkcGwv27.d.ts} +1 -1
  70. package/dist/production/routeModules-BRrCYrSL.d.mts +1693 -0
  71. package/dist/production/routeModules-CA7kSxJJ.d.ts +1693 -0
  72. package/package.json +1 -1
  73. package/dist/development/instrumentation--6Pioq_G.d.ts +0 -3344
  74. package/dist/development/router-cLsU7kHk.d.mts +0 -3344
  75. package/dist/production/instrumentation--6Pioq_G.d.ts +0 -3344
  76. package/dist/production/router-cLsU7kHk.d.mts +0 -3344
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.13.1
2
+ * react-router v7.13.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1380,6 +1380,7 @@ function createRouter(init) {
1380
1380
  }
1381
1381
  let dataStrategyImpl = init.dataStrategy || defaultDataStrategyWithMiddleware;
1382
1382
  let future = {
1383
+ unstable_passThroughRequests: false,
1383
1384
  ...init.future
1384
1385
  };
1385
1386
  let unlistenHistory = null;
@@ -1443,10 +1444,11 @@ function createRouter(init) {
1443
1444
  relevantMatches = relevantMatches.slice(0, idx + 1);
1444
1445
  }
1445
1446
  renderFallback = false;
1446
- initialized = relevantMatches.every((m) => {
1447
+ initialized = true;
1448
+ relevantMatches.forEach((m) => {
1447
1449
  let status = getRouteHydrationStatus(m.route, loaderData, errors);
1448
1450
  renderFallback = renderFallback || status.renderFallback;
1449
- return !status.shouldLoad;
1451
+ initialized = initialized && !status.shouldLoad;
1450
1452
  });
1451
1453
  }
1452
1454
  }
@@ -2025,6 +2027,7 @@ function createRouter(init) {
2025
2027
  mapRouteProperties2,
2026
2028
  manifest,
2027
2029
  request,
2030
+ location,
2028
2031
  matches,
2029
2032
  actionMatch,
2030
2033
  initialHydration ? [] : hydrationRouteProperties2,
@@ -2032,6 +2035,7 @@ function createRouter(init) {
2032
2035
  );
2033
2036
  let results = await callDataStrategy(
2034
2037
  request,
2038
+ location,
2035
2039
  dsMatches,
2036
2040
  scopedContext,
2037
2041
  null
@@ -2219,6 +2223,7 @@ function createRouter(init) {
2219
2223
  dsMatches,
2220
2224
  revalidatingFetchers,
2221
2225
  request,
2226
+ location,
2222
2227
  scopedContext
2223
2228
  );
2224
2229
  if (request.signal.aborted) {
@@ -2410,6 +2415,7 @@ function createRouter(init) {
2410
2415
  mapRouteProperties2,
2411
2416
  manifest,
2412
2417
  fetchRequest,
2418
+ path,
2413
2419
  requestMatches,
2414
2420
  match,
2415
2421
  hydrationRouteProperties2,
@@ -2417,6 +2423,7 @@ function createRouter(init) {
2417
2423
  );
2418
2424
  let actionResults = await callDataStrategy(
2419
2425
  fetchRequest,
2426
+ path,
2420
2427
  fetchMatches,
2421
2428
  scopedContext,
2422
2429
  key
@@ -2520,6 +2527,7 @@ function createRouter(init) {
2520
2527
  dsMatches,
2521
2528
  revalidatingFetchers,
2522
2529
  revalidationRequest,
2530
+ nextLocation,
2523
2531
  scopedContext
2524
2532
  );
2525
2533
  if (abortController.signal.aborted) {
@@ -2634,6 +2642,7 @@ function createRouter(init) {
2634
2642
  mapRouteProperties2,
2635
2643
  manifest,
2636
2644
  fetchRequest,
2645
+ path,
2637
2646
  matches,
2638
2647
  match,
2639
2648
  hydrationRouteProperties2,
@@ -2641,6 +2650,7 @@ function createRouter(init) {
2641
2650
  );
2642
2651
  let results = await callDataStrategy(
2643
2652
  fetchRequest,
2653
+ path,
2644
2654
  dsMatches,
2645
2655
  scopedContext,
2646
2656
  key
@@ -2749,13 +2759,14 @@ function createRouter(init) {
2749
2759
  });
2750
2760
  }
2751
2761
  }
2752
- async function callDataStrategy(request, matches, scopedContext, fetcherKey) {
2762
+ async function callDataStrategy(request, path, matches, scopedContext, fetcherKey) {
2753
2763
  let results;
2754
2764
  let dataResults = {};
2755
2765
  try {
2756
2766
  results = await callDataStrategyImpl(
2757
2767
  dataStrategyImpl,
2758
2768
  request,
2769
+ path,
2759
2770
  matches,
2760
2771
  fetcherKey,
2761
2772
  scopedContext,
@@ -2807,9 +2818,10 @@ function createRouter(init) {
2807
2818
  }
2808
2819
  return dataResults;
2809
2820
  }
2810
- async function callLoadersAndMaybeResolveData(matches, fetchersToLoad, request, scopedContext) {
2821
+ async function callLoadersAndMaybeResolveData(matches, fetchersToLoad, request, location, scopedContext) {
2811
2822
  let loaderResultsPromise = callDataStrategy(
2812
2823
  request,
2824
+ location,
2813
2825
  matches,
2814
2826
  scopedContext,
2815
2827
  null
@@ -2819,6 +2831,7 @@ function createRouter(init) {
2819
2831
  if (f.matches && f.match && f.request && f.controller) {
2820
2832
  let results = await callDataStrategy(
2821
2833
  f.request,
2834
+ f.path,
2822
2835
  f.matches,
2823
2836
  scopedContext,
2824
2837
  f.key
@@ -3227,6 +3240,11 @@ function createStaticHandler(routes, opts) {
3227
3240
  let basename = (opts ? opts.basename : null) || "/";
3228
3241
  let _mapRouteProperties = opts?.mapRouteProperties || defaultMapRouteProperties;
3229
3242
  let mapRouteProperties2 = _mapRouteProperties;
3243
+ let future = {
3244
+ unstable_passThroughRequests: false,
3245
+ // unused in static handler
3246
+ ...opts?.future
3247
+ };
3230
3248
  if (opts?.unstable_instrumentations) {
3231
3249
  let instrumentations = opts.unstable_instrumentations;
3232
3250
  mapRouteProperties2 = (route) => {
@@ -3251,11 +3269,12 @@ function createStaticHandler(routes, opts) {
3251
3269
  skipLoaderErrorBubbling,
3252
3270
  skipRevalidation,
3253
3271
  dataStrategy,
3254
- generateMiddlewareResponse
3272
+ generateMiddlewareResponse,
3273
+ unstable_normalizePath
3255
3274
  } = {}) {
3256
- let url = new URL(request.url);
3275
+ let normalizePath = unstable_normalizePath || defaultNormalizePath;
3257
3276
  let method = request.method;
3258
- let location = createLocation("", createPath(url), null, "default");
3277
+ let location = createLocation("", normalizePath(request), null, "default");
3259
3278
  let matches = matchRoutes(dataRoutes, location, basename);
3260
3279
  requestContext = requestContext != null ? requestContext : new RouterContextProvider();
3261
3280
  if (!isValidMethod(method) && method !== "HEAD") {
@@ -3308,6 +3327,7 @@ function createStaticHandler(routes, opts) {
3308
3327
  let response = await runServerMiddlewarePipeline(
3309
3328
  {
3310
3329
  request,
3330
+ unstable_url: createDataFunctionUrl(request, location),
3311
3331
  unstable_pattern: getRoutePattern(matches),
3312
3332
  matches,
3313
3333
  params: matches[0].params,
@@ -3424,11 +3444,12 @@ function createStaticHandler(routes, opts) {
3424
3444
  routeId,
3425
3445
  requestContext,
3426
3446
  dataStrategy,
3427
- generateMiddlewareResponse
3447
+ generateMiddlewareResponse,
3448
+ unstable_normalizePath
3428
3449
  } = {}) {
3429
- let url = new URL(request.url);
3450
+ let normalizePath = unstable_normalizePath || defaultNormalizePath;
3430
3451
  let method = request.method;
3431
- let location = createLocation("", createPath(url), null, "default");
3452
+ let location = createLocation("", normalizePath(request), null, "default");
3432
3453
  let matches = matchRoutes(dataRoutes, location, basename);
3433
3454
  requestContext = requestContext != null ? requestContext : new RouterContextProvider();
3434
3455
  if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") {
@@ -3454,6 +3475,7 @@ function createStaticHandler(routes, opts) {
3454
3475
  let response = await runServerMiddlewarePipeline(
3455
3476
  {
3456
3477
  request,
3478
+ unstable_url: createDataFunctionUrl(request, location),
3457
3479
  unstable_pattern: getRoutePattern(matches),
3458
3480
  matches,
3459
3481
  params: matches[0].params,
@@ -3531,6 +3553,7 @@ function createStaticHandler(routes, opts) {
3531
3553
  if (isMutationMethod(request.method)) {
3532
3554
  let result2 = await submit(
3533
3555
  request,
3556
+ location,
3534
3557
  matches,
3535
3558
  routeMatch || getTargetMatch(matches, location),
3536
3559
  requestContext,
@@ -3544,6 +3567,7 @@ function createStaticHandler(routes, opts) {
3544
3567
  }
3545
3568
  let result = await loadRouteData(
3546
3569
  request,
3570
+ location,
3547
3571
  matches,
3548
3572
  requestContext,
3549
3573
  dataStrategy,
@@ -3569,7 +3593,7 @@ function createStaticHandler(routes, opts) {
3569
3593
  throw e;
3570
3594
  }
3571
3595
  }
3572
- async function submit(request, matches, actionMatch, requestContext, dataStrategy, skipLoaderErrorBubbling, isRouteRequest, filterMatchesToLoad, skipRevalidation) {
3596
+ async function submit(request, location, matches, actionMatch, requestContext, dataStrategy, skipLoaderErrorBubbling, isRouteRequest, filterMatchesToLoad, skipRevalidation) {
3573
3597
  let result;
3574
3598
  if (!actionMatch.route.action && !actionMatch.route.lazy) {
3575
3599
  let error = getInternalRouterError(405, {
@@ -3589,6 +3613,7 @@ function createStaticHandler(routes, opts) {
3589
3613
  mapRouteProperties2,
3590
3614
  manifest,
3591
3615
  request,
3616
+ location,
3592
3617
  matches,
3593
3618
  actionMatch,
3594
3619
  [],
@@ -3596,6 +3621,7 @@ function createStaticHandler(routes, opts) {
3596
3621
  );
3597
3622
  let results = await callDataStrategy(
3598
3623
  request,
3624
+ location,
3599
3625
  dsMatches,
3600
3626
  isRouteRequest,
3601
3627
  requestContext,
@@ -3669,6 +3695,7 @@ function createStaticHandler(routes, opts) {
3669
3695
  let boundaryMatch = skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id);
3670
3696
  let handlerContext2 = await loadRouteData(
3671
3697
  loaderRequest,
3698
+ location,
3672
3699
  matches,
3673
3700
  requestContext,
3674
3701
  dataStrategy,
@@ -3688,6 +3715,7 @@ function createStaticHandler(routes, opts) {
3688
3715
  }
3689
3716
  let handlerContext = await loadRouteData(
3690
3717
  loaderRequest,
3718
+ location,
3691
3719
  matches,
3692
3720
  requestContext,
3693
3721
  dataStrategy,
@@ -3705,7 +3733,7 @@ function createStaticHandler(routes, opts) {
3705
3733
  actionHeaders: result.headers ? { [actionMatch.route.id]: result.headers } : {}
3706
3734
  };
3707
3735
  }
3708
- async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, pendingActionResult) {
3736
+ async function loadRouteData(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, pendingActionResult) {
3709
3737
  let isRouteRequest = routeMatch != null;
3710
3738
  if (isRouteRequest && !routeMatch?.route.loader && !routeMatch?.route.lazy) {
3711
3739
  throw getInternalRouterError(400, {
@@ -3720,6 +3748,7 @@ function createStaticHandler(routes, opts) {
3720
3748
  mapRouteProperties2,
3721
3749
  manifest,
3722
3750
  request,
3751
+ location,
3723
3752
  matches,
3724
3753
  routeMatch,
3725
3754
  [],
@@ -3737,6 +3766,7 @@ function createStaticHandler(routes, opts) {
3737
3766
  mapRouteProperties2,
3738
3767
  manifest,
3739
3768
  request,
3769
+ location,
3740
3770
  pattern,
3741
3771
  match,
3742
3772
  [],
@@ -3748,6 +3778,7 @@ function createStaticHandler(routes, opts) {
3748
3778
  mapRouteProperties2,
3749
3779
  manifest,
3750
3780
  request,
3781
+ location,
3751
3782
  pattern,
3752
3783
  match,
3753
3784
  [],
@@ -3769,6 +3800,7 @@ function createStaticHandler(routes, opts) {
3769
3800
  }
3770
3801
  let results = await callDataStrategy(
3771
3802
  request,
3803
+ location,
3772
3804
  dsMatches,
3773
3805
  isRouteRequest,
3774
3806
  requestContext,
@@ -3789,10 +3821,11 @@ function createStaticHandler(routes, opts) {
3789
3821
  matches
3790
3822
  };
3791
3823
  }
3792
- async function callDataStrategy(request, matches, isRouteRequest, requestContext, dataStrategy) {
3824
+ async function callDataStrategy(request, location, matches, isRouteRequest, requestContext, dataStrategy) {
3793
3825
  let results = await callDataStrategyImpl(
3794
3826
  dataStrategy || defaultDataStrategy,
3795
3827
  request,
3828
+ location,
3796
3829
  matches,
3797
3830
  null,
3798
3831
  requestContext,
@@ -3855,6 +3888,14 @@ function throwStaticHandlerAbortedError(request, isRouteRequest) {
3855
3888
  function isSubmissionNavigation(opts) {
3856
3889
  return opts != null && ("formData" in opts && opts.formData != null || "body" in opts && opts.body !== void 0);
3857
3890
  }
3891
+ function defaultNormalizePath(request) {
3892
+ let url = new URL(request.url);
3893
+ return {
3894
+ pathname: url.pathname,
3895
+ search: url.search,
3896
+ hash: url.hash
3897
+ };
3898
+ }
3858
3899
  function normalizeTo(location, matches, basename, to, fromRouteId, relative) {
3859
3900
  let contextualMatches;
3860
3901
  let activeRouteMatch;
@@ -4054,6 +4095,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
4054
4095
  mapRouteProperties2,
4055
4096
  manifest,
4056
4097
  request,
4098
+ location,
4057
4099
  pattern,
4058
4100
  match,
4059
4101
  lazyRoutePropertiesToSkip,
@@ -4084,6 +4126,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
4084
4126
  mapRouteProperties2,
4085
4127
  manifest,
4086
4128
  request,
4129
+ location,
4087
4130
  pattern,
4088
4131
  match,
4089
4132
  lazyRoutePropertiesToSkip,
@@ -4133,6 +4176,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
4133
4176
  mapRouteProperties2,
4134
4177
  manifest,
4135
4178
  fetchRequest,
4179
+ f.path,
4136
4180
  fetcherMatches,
4137
4181
  fetcherMatch,
4138
4182
  lazyRoutePropertiesToSkip,
@@ -4144,6 +4188,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
4144
4188
  mapRouteProperties2,
4145
4189
  manifest,
4146
4190
  fetchRequest,
4191
+ f.path,
4147
4192
  fetcherMatches,
4148
4193
  fetcherMatch,
4149
4194
  lazyRoutePropertiesToSkip,
@@ -4168,6 +4213,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
4168
4213
  mapRouteProperties2,
4169
4214
  manifest,
4170
4215
  fetchRequest,
4216
+ f.path,
4171
4217
  fetcherMatches,
4172
4218
  fetcherMatch,
4173
4219
  lazyRoutePropertiesToSkip,
@@ -4552,17 +4598,12 @@ function runClientMiddlewarePipeline(args, handler) {
4552
4598
  }
4553
4599
  }
4554
4600
  async function runMiddlewarePipeline(args, handler, processResult, isResult, errorHandler) {
4555
- let { matches, request, params, context, unstable_pattern } = args;
4601
+ let { matches, ...dataFnArgs } = args;
4556
4602
  let tuples = matches.flatMap(
4557
4603
  (m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
4558
4604
  );
4559
4605
  let result = await callRouteMiddleware(
4560
- {
4561
- request,
4562
- params,
4563
- context,
4564
- unstable_pattern
4565
- },
4606
+ dataFnArgs,
4566
4607
  tuples,
4567
4608
  handler,
4568
4609
  processResult,
@@ -4640,7 +4681,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties2, manifest, request
4640
4681
  handler: lazyRoutePromises.lazyHandlerPromise
4641
4682
  };
4642
4683
  }
4643
- function getDataStrategyMatch(mapRouteProperties2, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
4684
+ function getDataStrategyMatch(mapRouteProperties2, manifest, request, path, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
4644
4685
  let isUsingNewApi = false;
4645
4686
  let _lazyPromises = getDataStrategyMatchLazyPromises(
4646
4687
  mapRouteProperties2,
@@ -4680,6 +4721,7 @@ function getDataStrategyMatch(mapRouteProperties2, manifest, request, unstable_p
4680
4721
  if (callHandler && (isMutationMethod(request.method) || !isMiddlewareOnlyRoute)) {
4681
4722
  return callLoaderOrAction({
4682
4723
  request,
4724
+ path,
4683
4725
  unstable_pattern,
4684
4726
  match,
4685
4727
  lazyHandlerPromise: _lazyPromises?.handler,
@@ -4692,7 +4734,7 @@ function getDataStrategyMatch(mapRouteProperties2, manifest, request, unstable_p
4692
4734
  }
4693
4735
  };
4694
4736
  }
4695
- function getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request, matches, targetMatch, lazyRoutePropertiesToSkip, scopedContext, shouldRevalidateArgs = null) {
4737
+ function getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request, path, matches, targetMatch, lazyRoutePropertiesToSkip, scopedContext, shouldRevalidateArgs = null) {
4696
4738
  return matches.map((match) => {
4697
4739
  if (match.route.id !== targetMatch.route.id) {
4698
4740
  return {
@@ -4714,6 +4756,7 @@ function getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request,
4714
4756
  mapRouteProperties2,
4715
4757
  manifest,
4716
4758
  request,
4759
+ path,
4717
4760
  getRoutePattern(matches),
4718
4761
  match,
4719
4762
  lazyRoutePropertiesToSkip,
@@ -4723,12 +4766,13 @@ function getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request,
4723
4766
  );
4724
4767
  });
4725
4768
  }
4726
- async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherKey, scopedContext, isStaticHandler) {
4769
+ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fetcherKey, scopedContext, isStaticHandler) {
4727
4770
  if (matches.some((m) => m._lazyPromises?.middleware)) {
4728
4771
  await Promise.all(matches.map((m) => m._lazyPromises?.middleware));
4729
4772
  }
4730
4773
  let dataStrategyArgs = {
4731
4774
  request,
4775
+ unstable_url: createDataFunctionUrl(request, path),
4732
4776
  unstable_pattern: getRoutePattern(matches),
4733
4777
  params: matches[0].params,
4734
4778
  context: scopedContext,
@@ -4770,6 +4814,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
4770
4814
  }
4771
4815
  async function callLoaderOrAction({
4772
4816
  request,
4817
+ path,
4773
4818
  unstable_pattern,
4774
4819
  match,
4775
4820
  lazyHandlerPromise,
@@ -4797,6 +4842,7 @@ async function callLoaderOrAction({
4797
4842
  return handler(
4798
4843
  {
4799
4844
  request,
4845
+ unstable_url: createDataFunctionUrl(request, path),
4800
4846
  unstable_pattern,
4801
4847
  params: match.params,
4802
4848
  context: scopedContext
@@ -4954,20 +5000,20 @@ function normalizeRelativeRoutingRedirectResponse(response, request, routeId, ma
4954
5000
  }
4955
5001
  return response;
4956
5002
  }
5003
+ var invalidProtocols = [
5004
+ "about:",
5005
+ "blob:",
5006
+ "chrome:",
5007
+ "chrome-untrusted:",
5008
+ "content:",
5009
+ "data:",
5010
+ "devtools:",
5011
+ "file:",
5012
+ "filesystem:",
5013
+ // eslint-disable-next-line no-script-url
5014
+ "javascript:"
5015
+ ];
4957
5016
  function normalizeRedirectLocation(location, currentUrl, basename, historyInstance) {
4958
- let invalidProtocols = [
4959
- "about:",
4960
- "blob:",
4961
- "chrome:",
4962
- "chrome-untrusted:",
4963
- "content:",
4964
- "data:",
4965
- "devtools:",
4966
- "file:",
4967
- "filesystem:",
4968
- // eslint-disable-next-line no-script-url
4969
- "javascript:"
4970
- ];
4971
5017
  if (isAbsoluteUrl(location)) {
4972
5018
  let normalizedLocation = location;
4973
5019
  let url = normalizedLocation.startsWith("//") ? new URL(currentUrl.protocol + normalizedLocation) : new URL(normalizedLocation);
@@ -5007,6 +5053,24 @@ function createClientSideRequest(history, location, signal, submission) {
5007
5053
  }
5008
5054
  return new Request(url, init);
5009
5055
  }
5056
+ function createDataFunctionUrl(request, path) {
5057
+ let url = new URL(request.url);
5058
+ let parsed = typeof path === "string" ? parsePath(path) : path;
5059
+ url.pathname = parsed.pathname || "/";
5060
+ if (parsed.search) {
5061
+ let searchParams = new URLSearchParams(parsed.search);
5062
+ let indexValues = searchParams.getAll("index");
5063
+ searchParams.delete("index");
5064
+ for (let value of indexValues.filter(Boolean)) {
5065
+ searchParams.append("index", value);
5066
+ }
5067
+ url.search = searchParams.size ? `?${searchParams.toString()}` : "";
5068
+ } else {
5069
+ url.search = "";
5070
+ }
5071
+ url.hash = parsed.hash || "";
5072
+ return url;
5073
+ }
5010
5074
  function convertFormDataToSearchParams(formData) {
5011
5075
  let searchParams = new URLSearchParams();
5012
5076
  for (let [key, value] of formData.entries()) {
@@ -5748,21 +5812,21 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
5748
5812
  pathname: joinPaths([
5749
5813
  parentPathnameBase,
5750
5814
  // Re-encode pathnames that were decoded inside matchRoutes.
5751
- // Pre-encode `?` and `#` ahead of `encodeLocation` because it uses
5815
+ // Pre-encode `%`, `?` and `#` ahead of `encodeLocation` because it uses
5752
5816
  // `new URL()` internally and we need to prevent it from treating
5753
5817
  // them as separators
5754
5818
  navigator.encodeLocation ? navigator.encodeLocation(
5755
- match.pathname.replace(/\?/g, "%3F").replace(/#/g, "%23")
5819
+ match.pathname.replace(/%/g, "%25").replace(/\?/g, "%3F").replace(/#/g, "%23")
5756
5820
  ).pathname : match.pathname
5757
5821
  ]),
5758
5822
  pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([
5759
5823
  parentPathnameBase,
5760
5824
  // Re-encode pathnames that were decoded inside matchRoutes
5761
- // Pre-encode `?` and `#` ahead of `encodeLocation` because it uses
5825
+ // Pre-encode `%`, `?` and `#` ahead of `encodeLocation` because it uses
5762
5826
  // `new URL()` internally and we need to prevent it from treating
5763
5827
  // them as separators
5764
5828
  navigator.encodeLocation ? navigator.encodeLocation(
5765
- match.pathnameBase.replace(/\?/g, "%3F").replace(/#/g, "%23")
5829
+ match.pathnameBase.replace(/%/g, "%25").replace(/\?/g, "%3F").replace(/#/g, "%23")
5766
5830
  ).pathname : match.pathnameBase
5767
5831
  ])
5768
5832
  })
@@ -8721,7 +8785,13 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
8721
8785
  let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
8722
8786
  let initialError = hasInitialError ? initialState?.errors?.[route.id] : void 0;
8723
8787
  let isHydrationRequest = needsRevalidation == null && (routeModule.clientLoader?.hydrate === true || !route.hasLoader);
8724
- dataRoute.loader = async ({ request, params, context, unstable_pattern }, singleFetch) => {
8788
+ dataRoute.loader = async ({
8789
+ request,
8790
+ params,
8791
+ context,
8792
+ unstable_pattern,
8793
+ unstable_url
8794
+ }, singleFetch) => {
8725
8795
  try {
8726
8796
  let result = await prefetchStylesAndCallHandler(async () => {
8727
8797
  invariant2(
@@ -8736,6 +8806,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
8736
8806
  params,
8737
8807
  context,
8738
8808
  unstable_pattern,
8809
+ unstable_url,
8739
8810
  async serverLoader() {
8740
8811
  preventInvalidServerHandlerCall("loader", route);
8741
8812
  if (isHydrationRequest) {
@@ -8761,7 +8832,13 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
8761
8832
  route.hasLoader,
8762
8833
  isSpaMode
8763
8834
  );
8764
- dataRoute.action = ({ request, params, context, unstable_pattern }, singleFetch) => {
8835
+ dataRoute.action = ({
8836
+ request,
8837
+ params,
8838
+ context,
8839
+ unstable_pattern,
8840
+ unstable_url
8841
+ }, singleFetch) => {
8765
8842
  return prefetchStylesAndCallHandler(async () => {
8766
8843
  invariant2(
8767
8844
  routeModule,
@@ -8778,6 +8855,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
8778
8855
  params,
8779
8856
  context,
8780
8857
  unstable_pattern,
8858
+ unstable_url,
8781
8859
  async serverAction() {
8782
8860
  preventInvalidServerHandlerCall("action", route);
8783
8861
  return fetchServerAction(singleFetch);
@@ -9819,7 +9897,7 @@ var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "un
9819
9897
  try {
9820
9898
  if (isBrowser2) {
9821
9899
  window.__reactRouterVersion = // @ts-expect-error
9822
- "7.13.1";
9900
+ "7.13.2";
9823
9901
  }
9824
9902
  } catch (e) {
9825
9903
  }
@@ -10863,6 +10941,7 @@ function createStaticRouter(routes, context, opts = {}) {
10863
10941
  get future() {
10864
10942
  return {
10865
10943
  v8_middleware: false,
10944
+ unstable_passThroughRequests: false,
10866
10945
  ...opts?.future
10867
10946
  };
10868
10947
  },
@@ -10984,6 +11063,7 @@ export {
10984
11063
  createRouter,
10985
11064
  createStaticHandler,
10986
11065
  getStaticContextFromError,
11066
+ invalidProtocols,
10987
11067
  isDataWithResponseInit,
10988
11068
  isResponse,
10989
11069
  isRedirectStatusCode,