react-router 0.0.0-experimental-d4ee0faac → 0.0.0-experimental-80dc2f07b

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 (70) hide show
  1. package/CHANGELOG.md +13 -29
  2. package/dist/development/browser-DO9ukXOW.d.mts +226 -0
  3. package/dist/development/{chunk-AXZ7XWJM.mjs → chunk-FRVKHHSP.mjs} +138 -104
  4. package/dist/development/{chunk-TYXIL3CH.js → chunk-KW2YDZG2.js} +172 -142
  5. package/dist/development/{chunk-BYMLG5RB.js → chunk-QIEB5IKV.js} +84 -80
  6. package/dist/{production/chunk-SSVNUOFF.mjs → development/chunk-ZDIHB6MN.mjs} +32 -29
  7. package/dist/development/components-kfi-pq4A.d.mts +802 -0
  8. package/dist/development/dom-export.d.mts +13 -6
  9. package/dist/development/dom-export.d.ts +10 -3
  10. package/dist/development/dom-export.js +3 -3
  11. package/dist/development/dom-export.mjs +3 -3
  12. package/dist/development/index-react-server-client-C4nRtAah.d.ts +3178 -0
  13. package/dist/development/index-react-server-client-DWt5PSS7.d.mts +2381 -0
  14. package/dist/development/index-react-server-client.d.mts +3 -3
  15. package/dist/development/index-react-server-client.d.ts +2 -2
  16. package/dist/development/index-react-server-client.js +10 -4
  17. package/dist/development/index-react-server-client.mjs +9 -3
  18. package/dist/development/index-react-server.d.mts +115 -2
  19. package/dist/development/index-react-server.d.ts +115 -2
  20. package/dist/development/index-react-server.js +44 -22
  21. package/dist/development/index-react-server.mjs +45 -22
  22. package/dist/development/index.d.mts +1033 -15
  23. package/dist/development/index.d.ts +1107 -20
  24. package/dist/development/index.js +132 -123
  25. package/dist/development/index.mjs +9 -3
  26. package/dist/development/lib/types/internal.d.mts +1 -1
  27. package/dist/development/lib/types/internal.d.ts +1 -1
  28. package/dist/development/lib/types/internal.js +1 -1
  29. package/dist/development/lib/types/internal.mjs +1 -1
  30. package/dist/{production/route-data-DAw7Esur.d.mts → development/route-data-Dccdkjzt.d.mts} +55 -3
  31. package/dist/development/{route-data-7aXBQ4I3.d.ts → routeModules-ePxkpnOJ.d.ts} +210 -158
  32. package/dist/production/browser-DO9ukXOW.d.mts +226 -0
  33. package/dist/production/{chunk-XHN2I73S.js → chunk-BJQSOW5M.js} +84 -80
  34. package/dist/production/{chunk-EATVYSE3.js → chunk-IMCXOMKU.js} +172 -142
  35. package/dist/{development/chunk-ECP3BYMQ.mjs → production/chunk-NUPZJCEO.mjs} +32 -29
  36. package/dist/production/{chunk-RB7EVRHX.mjs → chunk-VQ4KM56U.mjs} +138 -104
  37. package/dist/production/components-kfi-pq4A.d.mts +802 -0
  38. package/dist/production/dom-export.d.mts +13 -6
  39. package/dist/production/dom-export.d.ts +10 -3
  40. package/dist/production/dom-export.js +3 -3
  41. package/dist/production/dom-export.mjs +3 -3
  42. package/dist/production/index-react-server-client-C4nRtAah.d.ts +3178 -0
  43. package/dist/production/index-react-server-client-DWt5PSS7.d.mts +2381 -0
  44. package/dist/production/index-react-server-client.d.mts +3 -3
  45. package/dist/production/index-react-server-client.d.ts +2 -2
  46. package/dist/production/index-react-server-client.js +10 -4
  47. package/dist/production/index-react-server-client.mjs +9 -3
  48. package/dist/production/index-react-server.d.mts +115 -2
  49. package/dist/production/index-react-server.d.ts +115 -2
  50. package/dist/production/index-react-server.js +44 -22
  51. package/dist/production/index-react-server.mjs +45 -22
  52. package/dist/production/index.d.mts +1033 -15
  53. package/dist/production/index.d.ts +1107 -20
  54. package/dist/production/index.js +132 -123
  55. package/dist/production/index.mjs +9 -3
  56. package/dist/production/lib/types/internal.d.mts +1 -1
  57. package/dist/production/lib/types/internal.d.ts +1 -1
  58. package/dist/production/lib/types/internal.js +1 -1
  59. package/dist/production/lib/types/internal.mjs +1 -1
  60. package/dist/{development/route-data-DAw7Esur.d.mts → production/route-data-Dccdkjzt.d.mts} +55 -3
  61. package/dist/production/{route-data-7aXBQ4I3.d.ts → routeModules-ePxkpnOJ.d.ts} +210 -158
  62. package/package.json +1 -1
  63. package/dist/development/browser-BSrXyLft.d.mts +0 -157
  64. package/dist/development/components-IaVqGBuO.d.mts +0 -816
  65. package/dist/development/index-react-server-client-DOK8MfYF.d.mts +0 -1360
  66. package/dist/development/index-react-server-client-LrDNRnlX.d.ts +0 -2171
  67. package/dist/production/browser-BSrXyLft.d.mts +0 -157
  68. package/dist/production/components-IaVqGBuO.d.mts +0 -816
  69. package/dist/production/index-react-server-client-DOK8MfYF.d.mts +0 -1360
  70. package/dist/production/index-react-server-client-LrDNRnlX.d.ts +0 -2171
@@ -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-d4ee0faac
2
+ * react-router v0.0.0-experimental-80dc2f07b
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -2305,9 +2305,7 @@ function createRouter(init) {
2305
2305
  )
2306
2306
  };
2307
2307
  } else {
2308
- dataResults[routeId] = await convertDataStrategyResultToDataResult(
2309
- result
2310
- );
2308
+ dataResults[routeId] = await convertDataStrategyResultToDataResult(result);
2311
2309
  }
2312
2310
  }
2313
2311
  return dataResults;
@@ -4163,7 +4161,10 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
4163
4161
  });
4164
4162
  try {
4165
4163
  await Promise.all(
4166
- matches.flatMap((m) => [_optionalChain([m, 'access', _43 => _43._lazyPromises, 'optionalAccess', _44 => _44.handler]), _optionalChain([m, 'access', _45 => _45._lazyPromises, 'optionalAccess', _46 => _46.route])])
4164
+ matches.flatMap((m) => [
4165
+ _optionalChain([m, 'access', _43 => _43._lazyPromises, 'optionalAccess', _44 => _44.handler]),
4166
+ _optionalChain([m, 'access', _45 => _45._lazyPromises, 'optionalAccess', _46 => _46.route])
4167
+ ])
4167
4168
  );
4168
4169
  } catch (e) {
4169
4170
  }
@@ -5478,8 +5479,10 @@ function encode(input, options) {
5478
5479
  lastSentIndex++;
5479
5480
  } else if (id2 < 0) {
5480
5481
  controller.enqueue(
5481
- textEncoder.encode(`${TYPE_ERROR}${deferredId}:${id2}
5482
- `)
5482
+ textEncoder.encode(
5483
+ `${TYPE_ERROR}${deferredId}:${id2}
5484
+ `
5485
+ )
5483
5486
  );
5484
5487
  } else {
5485
5488
  const values = encoder.stringified.slice(lastSentIndex + 1).join(",");
@@ -6406,68 +6409,71 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, fut
6406
6409
  }
6407
6410
  }
6408
6411
  }
6409
- return renderedMatches.reduceRight((outlet, match, index) => {
6410
- let error;
6411
- let shouldRenderHydrateFallback = false;
6412
- let errorElement = null;
6413
- let hydrateFallbackElement = null;
6414
- if (dataRouterState) {
6415
- error = errors && match.route.id ? errors[match.route.id] : void 0;
6416
- errorElement = match.route.errorElement || defaultErrorElement;
6417
- if (renderFallback) {
6418
- if (fallbackIndex < 0 && index === 0) {
6419
- warningOnce(
6420
- "route-fallback",
6421
- false,
6422
- "No `HydrateFallback` element provided to render during initial hydration"
6423
- );
6424
- shouldRenderHydrateFallback = true;
6425
- hydrateFallbackElement = null;
6426
- } else if (fallbackIndex === index) {
6427
- shouldRenderHydrateFallback = true;
6428
- hydrateFallbackElement = match.route.hydrateFallbackElement || null;
6412
+ return renderedMatches.reduceRight(
6413
+ (outlet, match, index) => {
6414
+ let error;
6415
+ let shouldRenderHydrateFallback = false;
6416
+ let errorElement = null;
6417
+ let hydrateFallbackElement = null;
6418
+ if (dataRouterState) {
6419
+ error = errors && match.route.id ? errors[match.route.id] : void 0;
6420
+ errorElement = match.route.errorElement || defaultErrorElement;
6421
+ if (renderFallback) {
6422
+ if (fallbackIndex < 0 && index === 0) {
6423
+ warningOnce(
6424
+ "route-fallback",
6425
+ false,
6426
+ "No `HydrateFallback` element provided to render during initial hydration"
6427
+ );
6428
+ shouldRenderHydrateFallback = true;
6429
+ hydrateFallbackElement = null;
6430
+ } else if (fallbackIndex === index) {
6431
+ shouldRenderHydrateFallback = true;
6432
+ hydrateFallbackElement = match.route.hydrateFallbackElement || null;
6433
+ }
6429
6434
  }
6430
6435
  }
6431
- }
6432
- let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
6433
- let getChildren = () => {
6434
- let children;
6435
- if (error) {
6436
- children = errorElement;
6437
- } else if (shouldRenderHydrateFallback) {
6438
- children = hydrateFallbackElement;
6439
- } else if (match.route.Component) {
6440
- children = /* @__PURE__ */ React3.createElement(match.route.Component, null);
6441
- } else if (match.route.element) {
6442
- children = match.route.element;
6443
- } else {
6444
- children = outlet;
6445
- }
6446
- return /* @__PURE__ */ React3.createElement(
6447
- RenderedRoute,
6436
+ let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
6437
+ let getChildren = () => {
6438
+ let children;
6439
+ if (error) {
6440
+ children = errorElement;
6441
+ } else if (shouldRenderHydrateFallback) {
6442
+ children = hydrateFallbackElement;
6443
+ } else if (match.route.Component) {
6444
+ children = /* @__PURE__ */ React3.createElement(match.route.Component, null);
6445
+ } else if (match.route.element) {
6446
+ children = match.route.element;
6447
+ } else {
6448
+ children = outlet;
6449
+ }
6450
+ return /* @__PURE__ */ React3.createElement(
6451
+ RenderedRoute,
6452
+ {
6453
+ match,
6454
+ routeContext: {
6455
+ outlet,
6456
+ matches: matches2,
6457
+ isDataRoute: dataRouterState != null
6458
+ },
6459
+ children
6460
+ }
6461
+ );
6462
+ };
6463
+ return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React3.createElement(
6464
+ RenderErrorBoundary,
6448
6465
  {
6449
- match,
6450
- routeContext: {
6451
- outlet,
6452
- matches: matches2,
6453
- isDataRoute: dataRouterState != null
6454
- },
6455
- children
6466
+ location: dataRouterState.location,
6467
+ revalidation: dataRouterState.revalidation,
6468
+ component: errorElement,
6469
+ error,
6470
+ children: getChildren(),
6471
+ routeContext: { outlet: null, matches: matches2, isDataRoute: true }
6456
6472
  }
6457
- );
6458
- };
6459
- return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React3.createElement(
6460
- RenderErrorBoundary,
6461
- {
6462
- location: dataRouterState.location,
6463
- revalidation: dataRouterState.revalidation,
6464
- component: errorElement,
6465
- error,
6466
- children: getChildren(),
6467
- routeContext: { outlet: null, matches: matches2, isDataRoute: true }
6468
- }
6469
- ) : getChildren();
6470
- }, null);
6473
+ ) : getChildren();
6474
+ },
6475
+ null
6476
+ );
6471
6477
  }
6472
6478
  function getDataRouterConsoleError(hookName) {
6473
6479
  return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
@@ -7605,7 +7611,7 @@ function getActiveMatches(matches, errors, isSpaMode) {
7605
7611
  return matches;
7606
7612
  }
7607
7613
  var CRITICAL_CSS_DATA_ATTRIBUTE = "data-react-router-critical-css";
7608
- function Links() {
7614
+ function Links({ nonce }) {
7609
7615
  let { isSpaMode, manifest, routeModules, criticalCss } = useFrameworkContext();
7610
7616
  let { errors, matches: routerMatches } = useDataRouterStateContext();
7611
7617
  let matches = getActiveMatches(routerMatches, errors, isSpaMode);
@@ -7624,16 +7630,14 @@ function Links() {
7624
7630
  {
7625
7631
  ...{ [CRITICAL_CSS_DATA_ATTRIBUTE]: "" },
7626
7632
  rel: "stylesheet",
7627
- href: criticalCss.href
7633
+ href: criticalCss.href,
7634
+ nonce
7628
7635
  }
7629
7636
  ) : null, keyedLinks.map(
7630
- ({ key, link }) => isPageLinkDescriptor(link) ? /* @__PURE__ */ React7.createElement(PrefetchPageLinks, { key, ...link }) : /* @__PURE__ */ React7.createElement("link", { key, ...link })
7637
+ ({ key, link }) => isPageLinkDescriptor(link) ? /* @__PURE__ */ React7.createElement(PrefetchPageLinks, { key, nonce, ...link }) : /* @__PURE__ */ React7.createElement("link", { key, nonce, ...link })
7631
7638
  ));
7632
7639
  }
7633
- function PrefetchPageLinks({
7634
- page,
7635
- ...dataLinkProps
7636
- }) {
7640
+ function PrefetchPageLinks({ page, ...linkProps }) {
7637
7641
  let { router } = useDataRouterContext2();
7638
7642
  let matches = React7.useMemo(
7639
7643
  () => matchRoutes(router.routes, page, router.basename),
@@ -7642,7 +7646,7 @@ function PrefetchPageLinks({
7642
7646
  if (!matches) {
7643
7647
  return null;
7644
7648
  }
7645
- return /* @__PURE__ */ React7.createElement(PrefetchPageLinksImpl, { page, matches, ...dataLinkProps });
7649
+ return /* @__PURE__ */ React7.createElement(PrefetchPageLinksImpl, { page, matches, ...linkProps });
7646
7650
  }
7647
7651
  function useKeyedPrefetchLinks(matches) {
7648
7652
  let { manifest, routeModules } = useFrameworkContext();
@@ -7741,7 +7745,7 @@ function PrefetchPageLinksImpl({
7741
7745
  return /* @__PURE__ */ React7.createElement(React7.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ React7.createElement("link", { key: href, rel: "prefetch", as: "fetch", href, ...linkProps })), moduleHrefs.map((href) => /* @__PURE__ */ React7.createElement("link", { key: href, rel: "modulepreload", href, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
7742
7746
  // these don't spread `linkProps` because they are full link descriptors
7743
7747
  // already with their own props
7744
- /* @__PURE__ */ React7.createElement("link", { key, ...link })
7748
+ /* @__PURE__ */ React7.createElement("link", { key, nonce: linkProps.nonce, ...link })
7745
7749
  )));
7746
7750
  }
7747
7751
  function Meta() {
@@ -7846,7 +7850,7 @@ function isValidMetaTag(tagName) {
7846
7850
  return typeof tagName === "string" && /^(meta|link)$/.test(tagName);
7847
7851
  }
7848
7852
  var isHydrated = false;
7849
- function Scripts(props) {
7853
+ function Scripts(scriptProps) {
7850
7854
  let {
7851
7855
  manifest,
7852
7856
  serverHandoffString,
@@ -7932,7 +7936,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
7932
7936
  return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
7933
7937
  "script",
7934
7938
  {
7935
- ...props,
7939
+ ...scriptProps,
7936
7940
  suppressHydrationWarning: true,
7937
7941
  dangerouslySetInnerHTML: createHtml(contextScript),
7938
7942
  type: void 0
@@ -7940,7 +7944,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
7940
7944
  ), /* @__PURE__ */ React7.createElement(
7941
7945
  "script",
7942
7946
  {
7943
- ...props,
7947
+ ...scriptProps,
7944
7948
  suppressHydrationWarning: true,
7945
7949
  dangerouslySetInnerHTML: createHtml(routeModulesScript),
7946
7950
  type: "module",
@@ -7977,7 +7981,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
7977
7981
  {
7978
7982
  rel: "modulepreload",
7979
7983
  href: manifest.url,
7980
- crossOrigin: props.crossOrigin,
7984
+ crossOrigin: scriptProps.crossOrigin,
7981
7985
  integrity: sri[manifest.url],
7982
7986
  suppressHydrationWarning: true
7983
7987
  }
@@ -7986,7 +7990,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
7986
7990
  {
7987
7991
  rel: "modulepreload",
7988
7992
  href: manifest.entry.module,
7989
- crossOrigin: props.crossOrigin,
7993
+ crossOrigin: scriptProps.crossOrigin,
7990
7994
  integrity: sri[manifest.entry.module],
7991
7995
  suppressHydrationWarning: true
7992
7996
  }
@@ -7996,7 +8000,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
7996
8000
  key: path,
7997
8001
  rel: "modulepreload",
7998
8002
  href: path,
7999
- crossOrigin: props.crossOrigin,
8003
+ crossOrigin: scriptProps.crossOrigin,
8000
8004
  integrity: sri[path],
8001
8005
  suppressHydrationWarning: true
8002
8006
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-d4ee0faac
2
+ * react-router v0.0.0-experimental-80dc2f07b
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -57,7 +57,7 @@ import {
57
57
  withComponentProps,
58
58
  withErrorBoundaryProps,
59
59
  withHydrateFallbackProps
60
- } from "./chunk-RB7EVRHX.mjs";
60
+ } from "./chunk-FRVKHHSP.mjs";
61
61
 
62
62
  // lib/dom/ssr/server.tsx
63
63
  import * as React from "react";
@@ -1805,9 +1805,10 @@ function createCallServer({
1805
1805
  encodeReply,
1806
1806
  fetch: fetchImplementation = fetch
1807
1807
  }) {
1808
+ const globalVar = window;
1808
1809
  let landedActionId = 0;
1809
1810
  return async (id, args) => {
1810
- let actionId = window.__routerActionID = (window.__routerActionID ?? (window.__routerActionID = 0)) + 1;
1811
+ let actionId = globalVar.__routerActionID = (globalVar.__routerActionID ?? (globalVar.__routerActionID = 0)) + 1;
1811
1812
  const temporaryReferences = createTemporaryReferenceSet();
1812
1813
  const response = await fetchImplementation(
1813
1814
  new Request(location.href, {
@@ -1830,7 +1831,7 @@ function createCallServer({
1830
1831
  window.location.href = payload.location;
1831
1832
  return;
1832
1833
  }
1833
- window.__router.navigate(payload.location, {
1834
+ globalVar.__router.navigate(payload.location, {
1834
1835
  replace: payload.replace
1835
1836
  });
1836
1837
  return payload.actionResult;
@@ -1844,21 +1845,21 @@ function createCallServer({
1844
1845
  async () => {
1845
1846
  const rerender = await payload.rerender;
1846
1847
  if (!rerender) return;
1847
- if (landedActionId < actionId && window.__routerActionID <= actionId) {
1848
+ if (landedActionId < actionId && globalVar.__routerActionID <= actionId) {
1848
1849
  landedActionId = actionId;
1849
1850
  if (rerender.type === "redirect") {
1850
1851
  if (rerender.reload) {
1851
1852
  window.location.href = rerender.location;
1852
1853
  return;
1853
1854
  }
1854
- window.__router.navigate(rerender.location, {
1855
+ globalVar.__router.navigate(rerender.location, {
1855
1856
  replace: rerender.replace
1856
1857
  });
1857
1858
  return;
1858
1859
  }
1859
1860
  let lastMatch;
1860
1861
  for (const match of rerender.matches) {
1861
- window.__router.patchRoutes(
1862
+ globalVar.__router.patchRoutes(
1862
1863
  lastMatch?.id ?? null,
1863
1864
  [createRouteFromServerManifest(match)],
1864
1865
  true
@@ -1870,12 +1871,12 @@ function createCallServer({
1870
1871
  window.__router._internalSetStateDoNotUseOrYouWillBreakYourApp({
1871
1872
  loaderData: Object.assign(
1872
1873
  {},
1873
- window.__router.state.loaderData,
1874
+ globalVar.__router.state.loaderData,
1874
1875
  rerender.loaderData
1875
1876
  ),
1876
1877
  errors: rerender.errors ? Object.assign(
1877
1878
  {},
1878
- window.__router.state.errors,
1879
+ globalVar.__router.state.errors,
1879
1880
  rerender.errors
1880
1881
  ) : null
1881
1882
  });
@@ -1893,7 +1894,8 @@ function createRouterFromPayload({
1893
1894
  unstable_getContext,
1894
1895
  payload
1895
1896
  }) {
1896
- if (window.__router) return window.__router;
1897
+ const globalVar = window;
1898
+ if (globalVar.__router) return globalVar.__router;
1897
1899
  if (payload.type !== "render") throw new Error("Invalid payload type");
1898
1900
  let patches = /* @__PURE__ */ new Map();
1899
1901
  payload.patches?.forEach((patch) => {
@@ -1919,7 +1921,7 @@ function createRouterFromPayload({
1919
1921
  }
1920
1922
  return [route];
1921
1923
  }, []);
1922
- window.__router = createRouter({
1924
+ globalVar.__router = createRouter({
1923
1925
  routes,
1924
1926
  unstable_getContext,
1925
1927
  basename: payload.basename,
@@ -1957,26 +1959,26 @@ function createRouterFromPayload({
1957
1959
  },
1958
1960
  // FIXME: Pass `build.ssr` into this function
1959
1961
  dataStrategy: getRSCSingleFetchDataStrategy(
1960
- () => window.__router,
1962
+ () => globalVar.__router,
1961
1963
  true,
1962
1964
  payload.basename,
1963
1965
  createFromReadableStream,
1964
1966
  fetchImplementation
1965
1967
  )
1966
1968
  });
1967
- if (window.__router.state.initialized) {
1968
- window.__routerInitialized = true;
1969
- window.__router.initialize();
1969
+ if (globalVar.__router.state.initialized) {
1970
+ globalVar.__routerInitialized = true;
1971
+ globalVar.__router.initialize();
1970
1972
  } else {
1971
- window.__routerInitialized = false;
1973
+ globalVar.__routerInitialized = false;
1972
1974
  }
1973
1975
  let lastLoaderData = void 0;
1974
- window.__router.subscribe(({ loaderData, actionData }) => {
1976
+ globalVar.__router.subscribe(({ loaderData, actionData }) => {
1975
1977
  if (lastLoaderData !== loaderData) {
1976
- window.__routerActionID = (window.__routerActionID ?? (window.__routerActionID = 0)) + 1;
1978
+ globalVar.__routerActionID = (globalVar.__routerActionID ?? (globalVar.__routerActionID = 0)) + 1;
1977
1979
  }
1978
1980
  });
1979
- return window.__router;
1981
+ return globalVar.__router;
1980
1982
  }
1981
1983
  var renderedRoutesContext = unstable_createContext();
1982
1984
  function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
@@ -2109,9 +2111,10 @@ function RSCHydratedRouter({
2109
2111
  ]
2110
2112
  );
2111
2113
  React4.useLayoutEffect(() => {
2112
- if (!window.__routerInitialized) {
2113
- window.__routerInitialized = true;
2114
- window.__router.initialize();
2114
+ const globalVar = window;
2115
+ if (!globalVar.__routerInitialized) {
2116
+ globalVar.__routerInitialized = true;
2117
+ globalVar.__router.initialize();
2115
2118
  }
2116
2119
  }, []);
2117
2120
  let [location2, setLocation] = React4.useState(router.state.location);
@@ -2297,7 +2300,8 @@ function getManifestUrl(paths) {
2297
2300
  if (paths.length === 1) {
2298
2301
  return new URL(`${paths[0]}.manifest`, window.location.origin);
2299
2302
  }
2300
- let basename = (window.__router.basename ?? "").replace(/^\/|\/$/g, "");
2303
+ const globalVar = window;
2304
+ let basename = (globalVar.__router.basename ?? "").replace(/^\/|\/$/g, "");
2301
2305
  let url = new URL(`${basename}/.manifest`, window.location.origin);
2302
2306
  paths.sort().forEach((path) => url.searchParams.append("p", path));
2303
2307
  return url;
@@ -2323,9 +2327,10 @@ async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fet
2323
2327
  }
2324
2328
  paths.forEach((p) => addToFifoQueue(p, discoveredPaths));
2325
2329
  payload.patches.forEach((p) => {
2326
- window.__router.patchRoutes(p.parentId ?? null, [
2327
- createRouteFromServerManifest(p)
2328
- ]);
2330
+ window.__router.patchRoutes(
2331
+ p.parentId ?? null,
2332
+ [createRouteFromServerManifest(p)]
2333
+ );
2329
2334
  });
2330
2335
  }
2331
2336
  function addToFifoQueue(path, queue) {
@@ -2488,9 +2493,7 @@ async function routeRSCServerRequest({
2488
2493
  throw reason;
2489
2494
  }
2490
2495
  }
2491
- function RSCStaticRouter({
2492
- getPayload
2493
- }) {
2496
+ function RSCStaticRouter({ getPayload }) {
2494
2497
  const payload = React5.use(getPayload());
2495
2498
  if (payload.type === "redirect") {
2496
2499
  throw new Response(null, {