react-router 0.0.0-experimental-cb0fdf114 → 0.0.0-experimental-689d76079

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 (72) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/dist/development/{browser-C9Ar1yxG.d.ts → browser-C-UvoYvi.d.ts} +2 -2
  3. package/dist/development/{browser-vtIR1Kpe.d.mts → browser-I6n6wVSO.d.mts} +2 -2
  4. package/dist/development/{chunk-C2BCPNNB.js → chunk-64IGXH5S.js} +73 -60
  5. package/dist/{production/chunk-TVHB74EG.js → development/chunk-E4C63BHH.js} +7 -7
  6. package/dist/development/{chunk-N5N2QD3Q.mjs → chunk-N6IZKBC5.mjs} +3 -3
  7. package/dist/development/{chunk-L7VOOA4V.mjs → chunk-RPWK4TB6.mjs} +36 -23
  8. package/dist/development/{chunk-ZE7HRIRF.js → chunk-WIMVKWVX.js} +99 -99
  9. package/dist/{production/context-phCt_zmH.d.mts → development/context-DGGUoDIu.d.mts} +1 -1
  10. package/dist/development/dom-export.d.mts +4 -4
  11. package/dist/development/dom-export.d.ts +4 -4
  12. package/dist/development/dom-export.js +27 -27
  13. package/dist/development/dom-export.mjs +3 -3
  14. package/dist/{production/index-react-server-client-C41e-M56.d.ts → development/index-react-server-client-BBd0A0TL.d.ts} +7 -5
  15. package/dist/{production/index-react-server-client-DB0NZKUQ.d.mts → development/index-react-server-client-BjhKIe3u.d.mts} +7 -5
  16. package/dist/development/index-react-server-client.d.mts +3 -3
  17. package/dist/development/index-react-server-client.d.ts +3 -3
  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 +6 -0
  21. package/dist/development/index-react-server.d.ts +6 -0
  22. package/dist/development/index-react-server.js +9 -6
  23. package/dist/development/index-react-server.mjs +9 -6
  24. package/dist/development/index.d.mts +11 -11
  25. package/dist/development/index.d.ts +11 -11
  26. package/dist/development/index.js +96 -96
  27. package/dist/development/index.mjs +3 -3
  28. package/dist/{production/instrumentation-BYr6ff5D.d.ts → development/instrumentation-g0dG8UL0.d.ts} +1 -1
  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-CTxsJBKQ.d.mts → register-D9d2sMQ7.d.mts} +1 -1
  34. package/dist/development/{register-CkcGwv27.d.ts → register-DcBltf5q.d.ts} +1 -1
  35. package/dist/development/{routeModules-CA7kSxJJ.d.ts → routeModules-7rtk67cd.d.ts} +32 -11
  36. package/dist/development/{routeModules-BRrCYrSL.d.mts → routeModules-BW4a8k3I.d.mts} +32 -11
  37. package/dist/production/{browser-C9Ar1yxG.d.ts → browser-C-UvoYvi.d.ts} +2 -2
  38. package/dist/production/{browser-vtIR1Kpe.d.mts → browser-I6n6wVSO.d.mts} +2 -2
  39. package/dist/production/{chunk-BUU6CIKQ.mjs → chunk-5PRXMKWZ.mjs} +3 -3
  40. package/dist/production/{chunk-AS4FL2MB.js → chunk-NA4ZUJK5.js} +73 -60
  41. package/dist/{development/chunk-3UD6OXWZ.js → production/chunk-UNN6ZJ6W.js} +7 -7
  42. package/dist/production/{chunk-4OARA26X.js → chunk-UZZ2OU6Q.js} +99 -99
  43. package/dist/production/{chunk-PDPTMKPS.mjs → chunk-VFF3M6RU.mjs} +36 -23
  44. package/dist/{development/context-phCt_zmH.d.mts → production/context-DGGUoDIu.d.mts} +1 -1
  45. package/dist/production/dom-export.d.mts +4 -4
  46. package/dist/production/dom-export.d.ts +4 -4
  47. package/dist/production/dom-export.js +27 -27
  48. package/dist/production/dom-export.mjs +3 -3
  49. package/dist/{development/index-react-server-client-C41e-M56.d.ts → production/index-react-server-client-BBd0A0TL.d.ts} +7 -5
  50. package/dist/{development/index-react-server-client-DB0NZKUQ.d.mts → production/index-react-server-client-BjhKIe3u.d.mts} +7 -5
  51. package/dist/production/index-react-server-client.d.mts +3 -3
  52. package/dist/production/index-react-server-client.d.ts +3 -3
  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 +6 -0
  56. package/dist/production/index-react-server.d.ts +6 -0
  57. package/dist/production/index-react-server.js +9 -6
  58. package/dist/production/index-react-server.mjs +9 -6
  59. package/dist/production/index.d.mts +11 -11
  60. package/dist/production/index.d.ts +11 -11
  61. package/dist/production/index.js +96 -96
  62. package/dist/production/index.mjs +3 -3
  63. package/dist/{development/instrumentation-BYr6ff5D.d.ts → production/instrumentation-g0dG8UL0.d.ts} +1 -1
  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-CTxsJBKQ.d.mts → register-D9d2sMQ7.d.mts} +1 -1
  69. package/dist/production/{register-CkcGwv27.d.ts → register-DcBltf5q.d.ts} +1 -1
  70. package/dist/production/{routeModules-CA7kSxJJ.d.ts → routeModules-7rtk67cd.d.ts} +32 -11
  71. package/dist/production/{routeModules-BRrCYrSL.d.mts → routeModules-BW4a8k3I.d.mts} +32 -11
  72. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-cb0fdf114
2
+ * react-router v0.0.0-experimental-689d76079
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -723,8 +723,7 @@ function generatePath(originalPath, params = {}) {
723
723
  const segments = path.split(/\/+/).map((segment, index, array) => {
724
724
  const isLastSegment = index === array.length - 1;
725
725
  if (isLastSegment && segment === "*") {
726
- const star = "*";
727
- return stringify2(params[star]);
726
+ return stringify2(params["*"]);
728
727
  }
729
728
  const keyMatch = segment.match(/^:([\w-]+)(\??)(.*)/);
730
729
  if (keyMatch) {
@@ -845,7 +844,7 @@ function resolvePath(to, fromPathname = "/") {
845
844
  } = typeof to === "string" ? parsePath(to) : to;
846
845
  let pathname;
847
846
  if (toPathname) {
848
- toPathname = toPathname.replace(/\/\/+/g, "/");
847
+ toPathname = removeDoubleSlashes(toPathname);
849
848
  if (toPathname.startsWith("/")) {
850
849
  pathname = resolvePathname(toPathname.substring(1), "/");
851
850
  } else {
@@ -861,7 +860,7 @@ function resolvePath(to, fromPathname = "/") {
861
860
  };
862
861
  }
863
862
  function resolvePathname(relativePath, fromPathname) {
864
- let segments = fromPathname.replace(/\/+$/, "").split("/");
863
+ let segments = removeTrailingSlash(fromPathname).split("/");
865
864
  let relativeSegments = relativePath.split("/");
866
865
  relativeSegments.forEach((segment) => {
867
866
  if (segment === "..") {
@@ -932,8 +931,10 @@ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = fal
932
931
  }
933
932
  return path;
934
933
  }
935
- var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
936
- var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
934
+ var removeDoubleSlashes = (path) => path.replace(/\/\/+/g, "/");
935
+ var joinPaths = (paths) => removeDoubleSlashes(paths.join("/"));
936
+ var removeTrailingSlash = (path) => path.replace(/\/+$/, "");
937
+ var normalizePathname = (pathname) => removeTrailingSlash(pathname).replace(/^\/*/, "/");
937
938
  var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
938
939
  var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
939
940
  var DataWithResponseInit = class {
@@ -987,7 +988,8 @@ function isRouteErrorResponse(error) {
987
988
  return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
988
989
  }
989
990
  function getRoutePattern(matches) {
990
- return matches.map((m) => m.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
991
+ let parts = matches.map((m) => m.route.path).filter(Boolean);
992
+ return joinPaths(parts) || "/";
991
993
  }
992
994
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
993
995
  function parseToInfo(_to, basename) {
@@ -2656,6 +2658,14 @@ function createRouter(init) {
2656
2658
  key
2657
2659
  );
2658
2660
  let result = results[match.route.id];
2661
+ if (!result) {
2662
+ for (let match2 of matches) {
2663
+ if (results[match2.route.id]) {
2664
+ result = results[match2.route.id];
2665
+ break;
2666
+ }
2667
+ }
2668
+ }
2659
2669
  if (fetchControllers.get(key) === abortController) {
2660
2670
  fetchControllers.delete(key);
2661
2671
  }
@@ -5022,7 +5032,7 @@ function normalizeRedirectLocation(location, currentUrl, basename, historyInstan
5022
5032
  }
5023
5033
  let isSameBasename = stripBasename(url.pathname, basename) != null;
5024
5034
  if (url.origin === currentUrl.origin && isSameBasename) {
5025
- return url.pathname + url.search + url.hash;
5035
+ return removeDoubleSlashes(url.pathname) + url.search + url.hash;
5026
5036
  }
5027
5037
  }
5028
5038
  try {
@@ -5732,7 +5742,7 @@ function useOutlet(context) {
5732
5742
  function useParams() {
5733
5743
  let { matches } = React2.useContext(RouteContext);
5734
5744
  let routeMatch = matches[matches.length - 1];
5735
- return routeMatch ? routeMatch.params : {};
5745
+ return routeMatch?.params ?? {};
5736
5746
  }
5737
5747
  function useResolvedPath(to, { relative } = {}) {
5738
5748
  let { matches } = React2.useContext(RouteContext);
@@ -6503,6 +6513,16 @@ function RouterProvider({
6503
6513
  ]
6504
6514
  );
6505
6515
  React3.useLayoutEffect(() => router.subscribe(setState), [router, setState]);
6516
+ let initialized = state.initialized;
6517
+ React3.useLayoutEffect(() => {
6518
+ if (!initialized && router.state.initialized) {
6519
+ setState(router.state, {
6520
+ deletedFetchers: [],
6521
+ flushSync: false,
6522
+ newErrors: null
6523
+ });
6524
+ }
6525
+ }, [initialized, setState, router.state]);
6506
6526
  React3.useEffect(() => {
6507
6527
  if (vtContext.isTransitioning && !vtContext.flushSync) {
6508
6528
  setRenderDfd(new Deferred());
@@ -7302,9 +7322,6 @@ async function stringify(stack) {
7302
7322
  deferred[index] = input;
7303
7323
  } else if (input instanceof Error) {
7304
7324
  str[index] = `["${TYPE_ERROR}",${JSON.stringify(input.message)}`;
7305
- if (input.name !== "Error") {
7306
- str[index] += `,${JSON.stringify(input.name)}`;
7307
- }
7308
7325
  str[index] += "]";
7309
7326
  } else if (Object.getPrototypeOf(input) === null) {
7310
7327
  str[index] = `["${TYPE_NULL_OBJECT}",{${partsForObj(input)}}]`;
@@ -7369,7 +7386,6 @@ function isPlainObject2(thing) {
7369
7386
  }
7370
7387
 
7371
7388
  // vendor/turbo-stream-v2/unflatten.ts
7372
- var globalObj = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : void 0;
7373
7389
  function unflatten(parsed) {
7374
7390
  const { hydrated, values } = this;
7375
7391
  if (typeof parsed === "number") return hydrate.call(this, parsed);
@@ -7512,8 +7528,8 @@ function hydrate(index) {
7512
7528
  }
7513
7529
  continue;
7514
7530
  case TYPE_ERROR:
7515
- const [, message, errorType] = value;
7516
- let error = errorType && globalObj && globalObj[errorType] ? new globalObj[errorType](message) : new Error(message);
7531
+ const [, message] = value;
7532
+ let error = new Error(message);
7517
7533
  hydrated[index2] = error;
7518
7534
  set(error);
7519
7535
  continue;
@@ -8219,9 +8235,9 @@ function singleFetchUrl(reqUrl, basename, trailingSlashAware, extension) {
8219
8235
  if (url.pathname === "/") {
8220
8236
  url.pathname = `_root.${extension}`;
8221
8237
  } else if (basename && stripBasename(url.pathname, basename) === "/") {
8222
- url.pathname = `${basename.replace(/\/$/, "")}/_root.${extension}`;
8238
+ url.pathname = `${removeTrailingSlash(basename)}/_root.${extension}`;
8223
8239
  } else {
8224
- url.pathname = `${url.pathname.replace(/\/$/, "")}.${extension}`;
8240
+ url.pathname = `${removeTrailingSlash(url.pathname)}.${extension}`;
8225
8241
  }
8226
8242
  }
8227
8243
  return url;
@@ -9177,10 +9193,7 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscover
9177
9193
  }
9178
9194
  function getManifestPath(_manifestPath, basename) {
9179
9195
  let manifestPath = _manifestPath || "/__manifest";
9180
- if (basename == null) {
9181
- return manifestPath;
9182
- }
9183
- return `${basename}${manifestPath}`.replace(/\/+/g, "/");
9196
+ return basename == null ? manifestPath : joinPaths([basename, manifestPath]);
9184
9197
  }
9185
9198
  var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
9186
9199
  async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, manifestPath, patchRoutes, signal) {
@@ -9970,7 +9983,7 @@ var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "un
9970
9983
  try {
9971
9984
  if (isBrowser2) {
9972
9985
  window.__reactRouterVersion = // @ts-expect-error
9973
- "0.0.0-experimental-cb0fdf114";
9986
+ "0.0.0-experimental-689d76079";
9974
9987
  }
9975
9988
  } catch (e) {
9976
9989
  }