@tanstack/react-router 1.97.20 → 1.97.23

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 (182) hide show
  1. package/dist/cjs/Match.cjs +4 -5
  2. package/dist/cjs/Match.cjs.map +1 -1
  3. package/dist/cjs/Matches.cjs +0 -10
  4. package/dist/cjs/Matches.cjs.map +1 -1
  5. package/dist/cjs/Matches.d.cts +3 -30
  6. package/dist/cjs/RouterProvider.cjs.map +1 -1
  7. package/dist/cjs/RouterProvider.d.cts +2 -2
  8. package/dist/cjs/Transitioner.cjs +2 -2
  9. package/dist/cjs/Transitioner.cjs.map +1 -1
  10. package/dist/cjs/awaited.cjs +6 -6
  11. package/dist/cjs/awaited.cjs.map +1 -1
  12. package/dist/cjs/awaited.d.cts +1 -1
  13. package/dist/cjs/fileRoute.cjs.map +1 -1
  14. package/dist/cjs/fileRoute.d.cts +2 -3
  15. package/dist/cjs/index.cjs +136 -42
  16. package/dist/cjs/index.cjs.map +1 -1
  17. package/dist/cjs/index.d.cts +12 -26
  18. package/dist/cjs/link.cjs +8 -9
  19. package/dist/cjs/link.cjs.map +1 -1
  20. package/dist/cjs/link.d.cts +2 -49
  21. package/dist/cjs/redirects.cjs.map +1 -1
  22. package/dist/cjs/redirects.d.cts +1 -1
  23. package/dist/cjs/route.cjs +14 -15
  24. package/dist/cjs/route.cjs.map +1 -1
  25. package/dist/cjs/route.d.cts +2 -149
  26. package/dist/cjs/routeInfo.d.cts +2 -3
  27. package/dist/cjs/router.cjs +52 -71
  28. package/dist/cjs/router.cjs.map +1 -1
  29. package/dist/cjs/router.d.cts +4 -19
  30. package/dist/cjs/routerContext.d.cts +1 -1
  31. package/dist/cjs/scroll-restoration.cjs +2 -2
  32. package/dist/cjs/scroll-restoration.cjs.map +1 -1
  33. package/dist/cjs/scroll-restoration.d.cts +1 -1
  34. package/dist/cjs/structuralSharing.d.cts +1 -4
  35. package/dist/cjs/typePrimitives.d.cts +1 -1
  36. package/dist/cjs/useLoaderData.cjs.map +1 -1
  37. package/dist/cjs/useLoaderData.d.cts +2 -1
  38. package/dist/cjs/useLoaderDeps.cjs.map +1 -1
  39. package/dist/cjs/useLoaderDeps.d.cts +2 -1
  40. package/dist/cjs/useMatch.cjs.map +1 -1
  41. package/dist/cjs/useMatch.d.cts +2 -1
  42. package/dist/cjs/useParams.cjs.map +1 -1
  43. package/dist/cjs/useParams.d.cts +2 -1
  44. package/dist/cjs/useRouteContext.cjs.map +1 -1
  45. package/dist/cjs/useRouteContext.d.cts +2 -1
  46. package/dist/cjs/useRouterState.cjs +2 -2
  47. package/dist/cjs/useRouterState.cjs.map +1 -1
  48. package/dist/cjs/useSearch.cjs.map +1 -1
  49. package/dist/cjs/useSearch.d.cts +2 -1
  50. package/dist/cjs/utils.cjs +0 -152
  51. package/dist/cjs/utils.cjs.map +1 -1
  52. package/dist/cjs/utils.d.cts +1 -81
  53. package/dist/esm/Match.js +1 -2
  54. package/dist/esm/Match.js.map +1 -1
  55. package/dist/esm/Matches.d.ts +3 -30
  56. package/dist/esm/Matches.js +0 -10
  57. package/dist/esm/Matches.js.map +1 -1
  58. package/dist/esm/RouterProvider.d.ts +2 -2
  59. package/dist/esm/RouterProvider.js.map +1 -1
  60. package/dist/esm/Transitioner.js +1 -1
  61. package/dist/esm/Transitioner.js.map +1 -1
  62. package/dist/esm/awaited.d.ts +1 -1
  63. package/dist/esm/awaited.js +1 -1
  64. package/dist/esm/awaited.js.map +1 -1
  65. package/dist/esm/fileRoute.d.ts +2 -3
  66. package/dist/esm/fileRoute.js.map +1 -1
  67. package/dist/esm/index.d.ts +12 -26
  68. package/dist/esm/index.js +5 -10
  69. package/dist/esm/index.js.map +1 -1
  70. package/dist/esm/link.d.ts +2 -49
  71. package/dist/esm/link.js +2 -3
  72. package/dist/esm/link.js.map +1 -1
  73. package/dist/esm/redirects.d.ts +1 -1
  74. package/dist/esm/redirects.js.map +1 -1
  75. package/dist/esm/route.d.ts +2 -149
  76. package/dist/esm/route.js +1 -2
  77. package/dist/esm/route.js.map +1 -1
  78. package/dist/esm/routeInfo.d.ts +2 -3
  79. package/dist/esm/router.d.ts +4 -19
  80. package/dist/esm/router.js +2 -21
  81. package/dist/esm/router.js.map +1 -1
  82. package/dist/esm/routerContext.d.ts +1 -1
  83. package/dist/esm/scroll-restoration.d.ts +1 -1
  84. package/dist/esm/scroll-restoration.js +1 -1
  85. package/dist/esm/scroll-restoration.js.map +1 -1
  86. package/dist/esm/structuralSharing.d.ts +1 -4
  87. package/dist/esm/typePrimitives.d.ts +1 -1
  88. package/dist/esm/useLoaderData.d.ts +2 -1
  89. package/dist/esm/useLoaderData.js.map +1 -1
  90. package/dist/esm/useLoaderDeps.d.ts +2 -1
  91. package/dist/esm/useLoaderDeps.js.map +1 -1
  92. package/dist/esm/useMatch.d.ts +2 -1
  93. package/dist/esm/useMatch.js.map +1 -1
  94. package/dist/esm/useParams.d.ts +2 -1
  95. package/dist/esm/useParams.js.map +1 -1
  96. package/dist/esm/useRouteContext.d.ts +2 -1
  97. package/dist/esm/useRouteContext.js.map +1 -1
  98. package/dist/esm/useRouterState.js +1 -1
  99. package/dist/esm/useRouterState.js.map +1 -1
  100. package/dist/esm/useSearch.d.ts +2 -1
  101. package/dist/esm/useSearch.js.map +1 -1
  102. package/dist/esm/utils.d.ts +1 -81
  103. package/dist/esm/utils.js +0 -152
  104. package/dist/esm/utils.js.map +1 -1
  105. package/package.json +3 -2
  106. package/src/Match.tsx +5 -2
  107. package/src/Matches.tsx +8 -101
  108. package/src/RouterProvider.tsx +4 -2
  109. package/src/Transitioner.tsx +1 -1
  110. package/src/awaited.tsx +2 -2
  111. package/src/fileRoute.ts +6 -3
  112. package/src/index.tsx +128 -128
  113. package/src/link.tsx +27 -155
  114. package/src/redirects.ts +1 -1
  115. package/src/route.ts +41 -315
  116. package/src/routeInfo.ts +7 -3
  117. package/src/router.ts +33 -53
  118. package/src/scroll-restoration.tsx +2 -3
  119. package/src/structuralSharing.ts +5 -7
  120. package/src/typePrimitives.ts +1 -1
  121. package/src/useLoaderData.tsx +2 -1
  122. package/src/useLoaderDeps.tsx +2 -1
  123. package/src/useMatch.tsx +2 -1
  124. package/src/useParams.tsx +2 -1
  125. package/src/useRouteContext.ts +2 -1
  126. package/src/useRouterState.tsx +1 -1
  127. package/src/useSearch.tsx +2 -1
  128. package/src/utils.ts +1 -405
  129. package/dist/cjs/defer.cjs +0 -25
  130. package/dist/cjs/defer.cjs.map +0 -1
  131. package/dist/cjs/defer.d.cts +0 -20
  132. package/dist/cjs/location.d.cts +0 -12
  133. package/dist/cjs/manifest.d.cts +0 -24
  134. package/dist/cjs/path.cjs +0 -289
  135. package/dist/cjs/path.cjs.map +0 -1
  136. package/dist/cjs/path.d.cts +0 -34
  137. package/dist/cjs/qss.cjs +0 -51
  138. package/dist/cjs/qss.cjs.map +0 -1
  139. package/dist/cjs/qss.d.cts +0 -27
  140. package/dist/cjs/root.cjs +0 -5
  141. package/dist/cjs/root.cjs.map +0 -1
  142. package/dist/cjs/root.d.cts +0 -2
  143. package/dist/cjs/searchMiddleware.cjs +0 -42
  144. package/dist/cjs/searchMiddleware.cjs.map +0 -1
  145. package/dist/cjs/searchMiddleware.d.cts +0 -5
  146. package/dist/cjs/searchParams.cjs +0 -61
  147. package/dist/cjs/searchParams.cjs.map +0 -1
  148. package/dist/cjs/searchParams.d.cts +0 -7
  149. package/dist/cjs/serializer.d.cts +0 -15
  150. package/dist/cjs/validators.d.cts +0 -51
  151. package/dist/esm/defer.d.ts +0 -20
  152. package/dist/esm/defer.js +0 -25
  153. package/dist/esm/defer.js.map +0 -1
  154. package/dist/esm/location.d.ts +0 -12
  155. package/dist/esm/manifest.d.ts +0 -24
  156. package/dist/esm/path.d.ts +0 -34
  157. package/dist/esm/path.js +0 -289
  158. package/dist/esm/path.js.map +0 -1
  159. package/dist/esm/qss.d.ts +0 -27
  160. package/dist/esm/qss.js +0 -51
  161. package/dist/esm/qss.js.map +0 -1
  162. package/dist/esm/root.d.ts +0 -2
  163. package/dist/esm/root.js +0 -5
  164. package/dist/esm/root.js.map +0 -1
  165. package/dist/esm/searchMiddleware.d.ts +0 -5
  166. package/dist/esm/searchMiddleware.js +0 -42
  167. package/dist/esm/searchMiddleware.js.map +0 -1
  168. package/dist/esm/searchParams.d.ts +0 -7
  169. package/dist/esm/searchParams.js +0 -61
  170. package/dist/esm/searchParams.js.map +0 -1
  171. package/dist/esm/serializer.d.ts +0 -15
  172. package/dist/esm/validators.d.ts +0 -51
  173. package/src/defer.ts +0 -52
  174. package/src/location.ts +0 -13
  175. package/src/manifest.ts +0 -32
  176. package/src/path.ts +0 -427
  177. package/src/qss.ts +0 -91
  178. package/src/root.ts +0 -2
  179. package/src/searchMiddleware.ts +0 -54
  180. package/src/searchParams.ts +0 -77
  181. package/src/serializer.ts +0 -24
  182. package/src/validators.ts +0 -121
@@ -3,10 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const history = require("@tanstack/history");
4
4
  const reactStore = require("@tanstack/react-store");
5
5
  const invariant = require("tiny-invariant");
6
- const root = require("./root.cjs");
7
- const searchParams = require("./searchParams.cjs");
8
- const utils = require("./utils.cjs");
9
- const path = require("./path.cjs");
6
+ const routerCore = require("@tanstack/router-core");
10
7
  const redirects = require("./redirects.cjs");
11
8
  const notFound = require("./not-found.cjs");
12
9
  const componentTypes = [
@@ -64,7 +61,7 @@ class Router {
64
61
  var _a;
65
62
  if (newOptions.notFoundRoute) {
66
63
  console.warn(
67
- "The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/guide/not-found-errors#migrating-from-notfoundroute for more info."
64
+ "The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info."
68
65
  );
69
66
  }
70
67
  const previousOptions = this.options;
@@ -83,7 +80,7 @@ class Router {
83
80
  if (newOptions.basepath === void 0 || newOptions.basepath === "" || newOptions.basepath === "/") {
84
81
  this.basepath = "/";
85
82
  } else {
86
- this.basepath = `/${path.trimPath(newOptions.basepath)}`;
83
+ this.basepath = `/${routerCore.trimPath(newOptions.basepath)}`;
87
84
  }
88
85
  }
89
86
  if (
@@ -142,7 +139,7 @@ class Router {
142
139
  );
143
140
  this.routesById[childRoute.id] = childRoute;
144
141
  if (!childRoute.isRoot && childRoute.path) {
145
- const trimmedFullPath = path.trimPathRight(childRoute.fullPath);
142
+ const trimmedFullPath = routerCore.trimPathRight(childRoute.fullPath);
146
143
  if (!this.routesByPath[trimmedFullPath] || childRoute.fullPath.endsWith("/")) {
147
144
  this.routesByPath[trimmedFullPath] = childRoute;
148
145
  }
@@ -161,8 +158,8 @@ class Router {
161
158
  if (d.isRoot || !d.path) {
162
159
  return;
163
160
  }
164
- const trimmed = path.trimPathLeft(d.fullPath);
165
- const parsed = path.parsePathname(trimmed);
161
+ const trimmed = routerCore.trimPathLeft(d.fullPath);
162
+ const parsed = routerCore.parsePathname(trimmed);
166
163
  while (parsed.length > 1 && ((_a = parsed[0]) == null ? void 0 : _a.value) === "/") {
167
164
  parsed.shift();
168
165
  }
@@ -230,10 +227,10 @@ class Router {
230
227
  return {
231
228
  pathname,
232
229
  searchStr,
233
- search: utils.replaceEqualDeep(previousLocation == null ? void 0 : previousLocation.search, parsedSearch),
230
+ search: routerCore.replaceEqualDeep(previousLocation == null ? void 0 : previousLocation.search, parsedSearch),
234
231
  hash: hash.split("#").reverse()[0] ?? "",
235
232
  href: `${pathname}${searchStr}${hash}`,
236
- state: utils.replaceEqualDeep(previousLocation == null ? void 0 : previousLocation.state, state)
233
+ state: routerCore.replaceEqualDeep(previousLocation == null ? void 0 : previousLocation.state, state)
237
234
  };
238
235
  };
239
236
  const location = parse(locationToParse ?? this.history.location);
@@ -249,11 +246,11 @@ class Router {
249
246
  }
250
247
  return location;
251
248
  };
252
- this.resolvePathWithBase = (from, path$1) => {
253
- const resolvedPath = path.resolvePath({
249
+ this.resolvePathWithBase = (from, path) => {
250
+ const resolvedPath = routerCore.resolvePath({
254
251
  basepath: this.basepath,
255
252
  base: from,
256
- to: path.cleanPath(path$1),
253
+ to: routerCore.cleanPath(path),
257
254
  trailingSlash: this.options.trailingSlash,
258
255
  caseSensitive: this.options.caseSensitive
259
256
  });
@@ -261,9 +258,9 @@ class Router {
261
258
  };
262
259
  this.getMatchedRoutes = (next, dest) => {
263
260
  let routeParams = {};
264
- const trimmedPath = path.trimPathRight(next.pathname);
261
+ const trimmedPath = routerCore.trimPathRight(next.pathname);
265
262
  const getMatchedParams = (route) => {
266
- const result = path.matchPathname(this.basepath, trimmedPath, {
263
+ const result = routerCore.matchPathname(this.basepath, trimmedPath, {
267
264
  to: route.fullPath,
268
265
  caseSensitive: route.options.caseSensitive ?? this.options.caseSensitive,
269
266
  fuzzy: true
@@ -283,7 +280,7 @@ class Router {
283
280
  return false;
284
281
  });
285
282
  }
286
- let routeCursor = foundRoute || this.routesById[root.rootRouteId];
283
+ let routeCursor = foundRoute || this.routesById[routerCore.rootRouteId];
287
284
  const matchedRoutes = [routeCursor];
288
285
  while (routeCursor.parentRoute) {
289
286
  routeCursor = routeCursor.parentRoute;
@@ -308,7 +305,7 @@ class Router {
308
305
  var _a, _b, _c, _d, _e, _f;
309
306
  const fromMatches = dest._fromLocation ? this.matchRoutes(dest._fromLocation, { _buildLocation: true }) : this.state.matches;
310
307
  const fromMatch = dest.from != null ? fromMatches.find(
311
- (d) => path.matchPathname(this.basepath, path.trimPathRight(d.pathname), {
308
+ (d) => routerCore.matchPathname(this.basepath, routerCore.trimPathRight(d.pathname), {
312
309
  to: dest.from,
313
310
  caseSensitive: false,
314
311
  fuzzy: false
@@ -319,7 +316,7 @@ class Router {
319
316
  dest.from == null || fromMatch != null,
320
317
  "Could not find match for from: " + dest.from
321
318
  );
322
- const fromSearch = ((_a = this.state.pendingMatches) == null ? void 0 : _a.length) ? (_b = utils.last(this.state.pendingMatches)) == null ? void 0 : _b.search : ((_c = utils.last(fromMatches)) == null ? void 0 : _c.search) || this.latestLocation.search;
319
+ const fromSearch = ((_a = this.state.pendingMatches) == null ? void 0 : _a.length) ? (_b = routerCore.last(this.state.pendingMatches)) == null ? void 0 : _b.search : ((_c = routerCore.last(fromMatches)) == null ? void 0 : _c.search) || this.latestLocation.search;
323
320
  const stayingMatches = matchedRoutesResult == null ? void 0 : matchedRoutesResult.matchedRoutes.filter(
324
321
  (d) => fromMatches.find((e) => e.routeId === d.id)
325
322
  );
@@ -328,12 +325,12 @@ class Router {
328
325
  pathname = this.resolvePathWithBase(fromPath, `${dest.to}`);
329
326
  } else {
330
327
  const fromRouteByFromPathRouteId = this.routesById[(_d = stayingMatches == null ? void 0 : stayingMatches.find((route) => {
331
- const interpolatedPath = path.interpolatePath({
328
+ const interpolatedPath = routerCore.interpolatePath({
332
329
  path: route.fullPath,
333
330
  params: (matchedRoutesResult == null ? void 0 : matchedRoutesResult.routeParams) ?? {},
334
331
  decodeCharMap: this.pathParamsDecodeCharMap
335
332
  });
336
- const pathname2 = path.joinPaths([this.basepath, interpolatedPath]);
333
+ const pathname2 = routerCore.joinPaths([this.basepath, interpolatedPath]);
337
334
  return pathname2 === fromPath;
338
335
  })) == null ? void 0 : _d.id];
339
336
  pathname = this.resolvePathWithBase(
@@ -341,10 +338,10 @@ class Router {
341
338
  (fromRouteByFromPathRouteId == null ? void 0 : fromRouteByFromPathRouteId.to) ?? fromPath
342
339
  );
343
340
  }
344
- const prevParams = { ...(_e = utils.last(fromMatches)) == null ? void 0 : _e.params };
341
+ const prevParams = { ...(_e = routerCore.last(fromMatches)) == null ? void 0 : _e.params };
345
342
  let nextParams = (dest.params ?? true) === true ? prevParams : {
346
343
  ...prevParams,
347
- ...utils.functionalUpdate(dest.params, prevParams)
344
+ ...routerCore.functionalUpdate(dest.params, prevParams)
348
345
  };
349
346
  if (Object.keys(nextParams).length > 0) {
350
347
  matchedRoutesResult == null ? void 0 : matchedRoutesResult.matchedRoutes.map((route) => {
@@ -354,7 +351,7 @@ class Router {
354
351
  nextParams = { ...nextParams, ...fn(nextParams) };
355
352
  });
356
353
  }
357
- pathname = path.interpolatePath({
354
+ pathname = routerCore.interpolatePath({
358
355
  path: pathname,
359
356
  params: nextParams ?? {},
360
357
  leaveWildcards: false,
@@ -440,7 +437,7 @@ class Router {
440
437
  if (dest.search === true) {
441
438
  return search3;
442
439
  }
443
- return utils.functionalUpdate(dest.search, search3);
440
+ return routerCore.functionalUpdate(dest.search, search3);
444
441
  };
445
442
  allMiddlewares.push(final);
446
443
  const applyNext = (index, currentSearch) => {
@@ -456,12 +453,12 @@ class Router {
456
453
  return applyNext(0, search2);
457
454
  };
458
455
  search = applyMiddlewares(search);
459
- search = utils.replaceEqualDeep(fromSearch, search);
456
+ search = routerCore.replaceEqualDeep(fromSearch, search);
460
457
  const searchStr = this.options.stringifySearch(search);
461
- const hash = dest.hash === true ? this.latestLocation.hash : dest.hash ? utils.functionalUpdate(dest.hash, this.latestLocation.hash) : void 0;
458
+ const hash = dest.hash === true ? this.latestLocation.hash : dest.hash ? routerCore.functionalUpdate(dest.hash, this.latestLocation.hash) : void 0;
462
459
  const hashStr = hash ? `#${hash}` : "";
463
- let nextState = dest.state === true ? this.latestLocation.state : dest.state ? utils.functionalUpdate(dest.state, this.latestLocation.state) : {};
464
- nextState = utils.replaceEqualDeep(this.latestLocation.state, nextState);
460
+ let nextState = dest.state === true ? this.latestLocation.state : dest.state ? routerCore.functionalUpdate(dest.state, this.latestLocation.state) : {};
461
+ nextState = routerCore.replaceEqualDeep(this.latestLocation.state, nextState);
465
462
  return {
466
463
  pathname,
467
464
  search,
@@ -479,7 +476,7 @@ class Router {
479
476
  if (!maskedNext) {
480
477
  let params = {};
481
478
  const foundMask = (_a = this.options.routeMasks) == null ? void 0 : _a.find((d) => {
482
- const match = path.matchPathname(this.basepath, next.pathname, {
479
+ const match = routerCore.matchPathname(this.basepath, next.pathname, {
483
480
  to: d.from,
484
481
  caseSensitive: false,
485
482
  fuzzy: false
@@ -493,7 +490,7 @@ class Router {
493
490
  if (foundMask) {
494
491
  const { from: _from, ...maskProps } = foundMask;
495
492
  maskedDest = {
496
- ...utils.pick(opts, ["from"]),
493
+ ...routerCore.pick(opts, ["from"]),
497
494
  ...maskProps,
498
495
  params
499
496
  };
@@ -511,7 +508,7 @@ class Router {
511
508
  };
512
509
  if (opts.mask) {
513
510
  return buildWithMatches(opts, {
514
- ...utils.pick(opts, ["from"]),
511
+ ...routerCore.pick(opts, ["from"]),
515
512
  ...opts.mask
516
513
  });
517
514
  }
@@ -524,13 +521,13 @@ class Router {
524
521
  }) => {
525
522
  const isSameState = () => {
526
523
  next.state.key = this.latestLocation.state.key;
527
- const isEqual = utils.deepEqual(next.state, this.latestLocation.state);
524
+ const isEqual = routerCore.deepEqual(next.state, this.latestLocation.state);
528
525
  delete next.state.key;
529
526
  return isEqual;
530
527
  };
531
528
  const isSameUrl = this.latestLocation.href === next.href;
532
529
  const previousCommitPromise = this.commitLocationPromise;
533
- this.commitLocationPromise = utils.createControlledPromise(() => {
530
+ this.commitLocationPromise = routerCore.createControlledPromise(() => {
534
531
  previousCommitPromise == null ? void 0 : previousCommitPromise.resolve();
535
532
  });
536
533
  if (isSameUrl && isSameState()) {
@@ -916,11 +913,11 @@ class Router {
916
913
  try {
917
914
  updateMatch(matchId, (prev) => ({
918
915
  ...prev,
919
- loadPromise: utils.createControlledPromise(() => {
916
+ loadPromise: routerCore.createControlledPromise(() => {
920
917
  var _a2;
921
918
  (_a2 = prev.loadPromise) == null ? void 0 : _a2.resolve();
922
919
  }),
923
- beforeLoadPromise: utils.createControlledPromise()
920
+ beforeLoadPromise: routerCore.createControlledPromise()
924
921
  }));
925
922
  const abortController = new AbortController();
926
923
  let pendingTimeout;
@@ -1041,7 +1038,7 @@ class Router {
1041
1038
  const shouldReload = typeof shouldReloadOption === "function" ? shouldReloadOption(getLoaderContext()) : shouldReloadOption;
1042
1039
  updateMatch(matchId, (prev) => ({
1043
1040
  ...prev,
1044
- loaderPromise: utils.createControlledPromise(),
1041
+ loaderPromise: routerCore.createControlledPromise(),
1045
1042
  preload: !!preload && !this.state.matches.find((d) => d.id === matchId)
1046
1043
  }));
1047
1044
  const runLoader = async () => {
@@ -1337,7 +1334,7 @@ class Router {
1337
1334
  }
1338
1335
  const pending = (opts == null ? void 0 : opts.pending) === void 0 ? !this.state.isLoading : opts.pending;
1339
1336
  const baseLocation = pending ? this.latestLocation : this.state.resolvedLocation;
1340
- const match = path.matchPathname(this.basepath, baseLocation.pathname, {
1337
+ const match = routerCore.matchPathname(this.basepath, baseLocation.pathname, {
1341
1338
  ...opts,
1342
1339
  to: next.pathname
1343
1340
  });
@@ -1345,12 +1342,12 @@ class Router {
1345
1342
  return false;
1346
1343
  }
1347
1344
  if (location.params) {
1348
- if (!utils.deepEqual(match, location.params, { partial: true })) {
1345
+ if (!routerCore.deepEqual(match, location.params, { partial: true })) {
1349
1346
  return false;
1350
1347
  }
1351
1348
  }
1352
1349
  if (match && ((opts == null ? void 0 : opts.includeSearch) ?? true)) {
1353
- return utils.deepEqual(baseLocation.search, next.search, { partial: true }) ? match : false;
1350
+ return routerCore.deepEqual(baseLocation.search, next.search, { partial: true }) ? match : false;
1354
1351
  }
1355
1352
  return match;
1356
1353
  };
@@ -1360,8 +1357,8 @@ class Router {
1360
1357
  const matchesByRouteId = Object.fromEntries(
1361
1358
  matches.map((match2) => [match2.routeId, match2])
1362
1359
  );
1363
- let routeCursor = (err.global ? this.looseRoutesById[root.rootRouteId] : this.looseRoutesById[err.routeId]) || this.looseRoutesById[root.rootRouteId];
1364
- while (!routeCursor.options.notFoundComponent && !this.options.defaultNotFoundComponent && routeCursor.id !== root.rootRouteId) {
1360
+ let routeCursor = (err.global ? this.looseRoutesById[routerCore.rootRouteId] : this.looseRoutesById[err.routeId]) || this.looseRoutesById[routerCore.rootRouteId];
1361
+ while (!routeCursor.options.notFoundComponent && !this.options.defaultNotFoundComponent && routeCursor.id !== routerCore.rootRouteId) {
1365
1362
  routeCursor = routeCursor.parentRoute;
1366
1363
  invariant(
1367
1364
  routeCursor,
@@ -1396,8 +1393,8 @@ class Router {
1396
1393
  ...options,
1397
1394
  caseSensitive: options.caseSensitive ?? false,
1398
1395
  notFoundMode: options.notFoundMode ?? "fuzzy",
1399
- stringifySearch: options.stringifySearch ?? searchParams.defaultStringifySearch,
1400
- parseSearch: options.parseSearch ?? searchParams.defaultParseSearch
1396
+ stringifySearch: options.stringifySearch ?? routerCore.defaultStringifySearch,
1397
+ parseSearch: options.parseSearch ?? routerCore.defaultParseSearch
1401
1398
  });
1402
1399
  if (typeof document !== "undefined") {
1403
1400
  window.__TSR_ROUTER__ = this;
@@ -1432,7 +1429,7 @@ class Router {
1432
1429
  // If we found a route, and it's not an index route and we have left over path
1433
1430
  foundRoute ? foundRoute.path !== "/" && routeParams["**"] : (
1434
1431
  // Or if we didn't find a route and we have left over path
1435
- path.trimPathRight(next.pathname)
1432
+ routerCore.trimPathRight(next.pathname)
1436
1433
  )
1437
1434
  ) {
1438
1435
  if (this.options.notFoundRoute) {
@@ -1453,7 +1450,7 @@ class Router {
1453
1450
  }
1454
1451
  }
1455
1452
  }
1456
- return root.rootRouteId;
1453
+ return routerCore.rootRouteId;
1457
1454
  })();
1458
1455
  const parseErrors = matchedRoutes.map((route) => {
1459
1456
  var _a;
@@ -1512,12 +1509,12 @@ class Router {
1512
1509
  search: preMatchSearch
1513
1510
  })) ?? "";
1514
1511
  const loaderDepsHash = loaderDeps ? JSON.stringify(loaderDeps) : "";
1515
- const interpolatedPath = path.interpolatePath({
1512
+ const interpolatedPath = routerCore.interpolatePath({
1516
1513
  path: route.fullPath,
1517
1514
  params: routeParams,
1518
1515
  decodeCharMap: this.pathParamsDecodeCharMap
1519
1516
  });
1520
- const matchId = path.interpolatePath({
1517
+ const matchId = routerCore.interpolatePath({
1521
1518
  path: route.id,
1522
1519
  params: routeParams,
1523
1520
  leaveWildcards: true,
@@ -1533,8 +1530,8 @@ class Router {
1533
1530
  match = {
1534
1531
  ...existingMatch,
1535
1532
  cause,
1536
- params: previousMatch ? utils.replaceEqualDeep(previousMatch.params, routeParams) : routeParams,
1537
- search: previousMatch ? utils.replaceEqualDeep(previousMatch.search, preMatchSearch) : utils.replaceEqualDeep(existingMatch.search, preMatchSearch)
1533
+ params: previousMatch ? routerCore.replaceEqualDeep(previousMatch.params, routeParams) : routeParams,
1534
+ search: previousMatch ? routerCore.replaceEqualDeep(previousMatch.search, preMatchSearch) : routerCore.replaceEqualDeep(existingMatch.search, preMatchSearch)
1538
1535
  };
1539
1536
  } else {
1540
1537
  const status = route.options.loader || route.options.beforeLoad || route.lazyFn || routeNeedsPreload(route) ? "pending" : "success";
@@ -1542,10 +1539,10 @@ class Router {
1542
1539
  id: matchId,
1543
1540
  index,
1544
1541
  routeId: route.id,
1545
- params: previousMatch ? utils.replaceEqualDeep(previousMatch.params, routeParams) : routeParams,
1546
- pathname: path.joinPaths([this.basepath, interpolatedPath]),
1542
+ params: previousMatch ? routerCore.replaceEqualDeep(previousMatch.params, routeParams) : routeParams,
1543
+ pathname: routerCore.joinPaths([this.basepath, interpolatedPath]),
1547
1544
  updatedAt: Date.now(),
1548
- search: previousMatch ? utils.replaceEqualDeep(previousMatch.search, preMatchSearch) : preMatchSearch,
1545
+ search: previousMatch ? routerCore.replaceEqualDeep(previousMatch.search, preMatchSearch) : preMatchSearch,
1549
1546
  searchError: void 0,
1550
1547
  status,
1551
1548
  isFetching: false,
@@ -1557,14 +1554,14 @@ class Router {
1557
1554
  abortController: new AbortController(),
1558
1555
  fetchCount: 0,
1559
1556
  cause,
1560
- loaderDeps: previousMatch ? utils.replaceEqualDeep(previousMatch.loaderDeps, loaderDeps) : loaderDeps,
1557
+ loaderDeps: previousMatch ? routerCore.replaceEqualDeep(previousMatch.loaderDeps, loaderDeps) : loaderDeps,
1561
1558
  invalid: false,
1562
1559
  preload: false,
1563
1560
  links: void 0,
1564
1561
  scripts: void 0,
1565
1562
  meta: void 0,
1566
1563
  staticData: route.options.staticData || {},
1567
- loadPromise: utils.createControlledPromise(),
1564
+ loadPromise: routerCore.createControlledPromise(),
1568
1565
  fullPath: route.fullPath
1569
1566
  };
1570
1567
  }
@@ -1648,27 +1645,11 @@ function getInitialRouterState(location) {
1648
1645
  statusCode: 200
1649
1646
  };
1650
1647
  }
1651
- function defaultSerializeError(err) {
1652
- if (err instanceof Error) {
1653
- const obj = {
1654
- name: err.name,
1655
- message: err.message
1656
- };
1657
- if (process.env.NODE_ENV === "development") {
1658
- obj.stack = err.stack;
1659
- }
1660
- return obj;
1661
- }
1662
- return {
1663
- data: err
1664
- };
1665
- }
1666
1648
  exports.PathParamError = PathParamError;
1667
1649
  exports.Router = Router;
1668
1650
  exports.SearchParamError = SearchParamError;
1669
1651
  exports.componentTypes = componentTypes;
1670
1652
  exports.createRouter = createRouter;
1671
- exports.defaultSerializeError = defaultSerializeError;
1672
1653
  exports.getInitialRouterState = getInitialRouterState;
1673
1654
  exports.lazyFn = lazyFn;
1674
1655
  //# sourceMappingURL=router.cjs.map