react-router 0.0.0-experimental-1d760f6a6 → 0.0.0-experimental-b2bc694a6

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 (40) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/development/{chunk-QBMD7MNB.mjs → chunk-YFJEQYI5.mjs} +63 -34
  3. package/dist/development/dom-export.d.mts +2 -2
  4. package/dist/development/dom-export.d.ts +1 -2
  5. package/dist/development/dom-export.js +34 -6095
  6. package/dist/development/dom-export.mjs +6 -3
  7. package/dist/{production/fog-of-war-BLArG-qZ.d.ts → development/fog-of-war-B1MWugqW.d.mts} +59 -4
  8. package/dist/development/index.d.mts +7 -58
  9. package/dist/development/index.d.ts +1877 -188
  10. package/dist/development/index.js +63 -34
  11. package/dist/development/index.mjs +2 -2
  12. package/dist/development/lib/types/route-module.d.mts +1 -2
  13. package/dist/development/lib/types/route-module.d.ts +1 -2
  14. package/dist/development/lib/types/route-module.js +1 -1
  15. package/dist/development/lib/types/route-module.mjs +1 -1
  16. package/dist/{production/route-data-C12CLHiN.d.mts → development/route-data-BvrN3Sw4.d.mts} +11 -1
  17. package/dist/development/{route-data-C12CLHiN.d.mts → route-data-fNWkI-4T.d.ts} +11 -1
  18. package/dist/production/{chunk-DSJGM2GU.mjs → chunk-257QFYRX.mjs} +63 -34
  19. package/dist/production/dom-export.d.mts +2 -2
  20. package/dist/production/dom-export.d.ts +1 -2
  21. package/dist/production/dom-export.js +34 -6095
  22. package/dist/production/dom-export.mjs +6 -3
  23. package/dist/{development/fog-of-war-BLArG-qZ.d.ts → production/fog-of-war-B1MWugqW.d.mts} +59 -4
  24. package/dist/production/index.d.mts +7 -58
  25. package/dist/production/index.d.ts +1877 -188
  26. package/dist/production/index.js +63 -34
  27. package/dist/production/index.mjs +2 -2
  28. package/dist/production/lib/types/route-module.d.mts +1 -2
  29. package/dist/production/lib/types/route-module.d.ts +1 -2
  30. package/dist/production/lib/types/route-module.js +1 -1
  31. package/dist/production/lib/types/route-module.mjs +1 -1
  32. package/dist/{development/route-data-C12CLHiN.d.ts → production/route-data-BvrN3Sw4.d.mts} +11 -1
  33. package/dist/production/{route-data-C12CLHiN.d.ts → route-data-fNWkI-4T.d.ts} +11 -1
  34. package/package.json +1 -1
  35. package/dist/development/data-CQbyyGzl.d.mts +0 -11
  36. package/dist/development/data-CQbyyGzl.d.ts +0 -11
  37. package/dist/development/fog-of-war-D2zsXvum.d.mts +0 -1691
  38. package/dist/production/data-CQbyyGzl.d.mts +0 -11
  39. package/dist/production/data-CQbyyGzl.d.ts +0 -11
  40. package/dist/production/fog-of-war-D2zsXvum.d.mts +0 -1691
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-1d760f6a6
2
+ * react-router v0.0.0-experimental-b2bc694a6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1740,7 +1740,11 @@ function createRouter(init) {
1740
1740
  }
1741
1741
  return {
1742
1742
  matches,
1743
- pendingActionResult: [boundaryMatch.route.id, result]
1743
+ pendingActionResult: [
1744
+ boundaryMatch.route.id,
1745
+ result,
1746
+ actionMatch.route.id
1747
+ ]
1744
1748
  };
1745
1749
  }
1746
1750
  return {
@@ -4511,7 +4515,9 @@ function processRouteLoaderData(matches, results, pendingActionResult, isStaticH
4511
4515
  });
4512
4516
  if (pendingError !== void 0 && pendingActionResult) {
4513
4517
  errors = { [pendingActionResult[0]]: pendingError };
4514
- loaderData[pendingActionResult[0]] = void 0;
4518
+ if (pendingActionResult[2]) {
4519
+ loaderData[pendingActionResult[2]] = void 0;
4520
+ }
4515
4521
  }
4516
4522
  return {
4517
4523
  loaderData,
@@ -6675,7 +6681,8 @@ async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, f
6675
6681
  )
6676
6682
  );
6677
6683
  await Promise.all(routeDfds.map((d) => d.promise));
6678
- if ((!router.state.initialized || routesParams.size === 0) && !window.__reactRouterHdrActive) {
6684
+ let isInitialLoad = !router.state.initialized && router.state.navigation.state === "idle";
6685
+ if ((isInitialLoad || routesParams.size === 0) && !window.__reactRouterHdrActive) {
6679
6686
  singleFetchDfd.resolve({ routes: {} });
6680
6687
  } else {
6681
6688
  let targetRoutes = ssr && foundOptOutRoute && routesParams.size > 0 ? [...routesParams.keys()] : void 0;
@@ -7417,8 +7424,8 @@ var nextPaths = /* @__PURE__ */ new Set();
7417
7424
  var discoveredPathsMaxSize = 1e3;
7418
7425
  var discoveredPaths = /* @__PURE__ */ new Set();
7419
7426
  var URL_LIMIT = 7680;
7420
- function isFogOfWarEnabled(ssr) {
7421
- return ssr === true;
7427
+ function isFogOfWarEnabled(routeDiscovery, ssr) {
7428
+ return routeDiscovery.mode === "lazy" && ssr === true;
7422
7429
  }
7423
7430
  function getPartialManifest({ sri, ...manifest }, router) {
7424
7431
  let routeIds = new Set(router.state.matches.map((m) => m.route.id));
@@ -7445,8 +7452,8 @@ function getPartialManifest({ sri, ...manifest }, router) {
7445
7452
  sri: sri ? true : void 0
7446
7453
  };
7447
7454
  }
7448
- function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, isSpaMode, basename) {
7449
- if (!isFogOfWarEnabled(ssr)) {
7455
+ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDiscovery, isSpaMode, basename) {
7456
+ if (!isFogOfWarEnabled(routeDiscovery, ssr)) {
7450
7457
  return void 0;
7451
7458
  }
7452
7459
  return async ({ path, patch, signal, fetcherKey }) => {
@@ -7461,14 +7468,15 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, isSpaMo
7461
7468
  ssr,
7462
7469
  isSpaMode,
7463
7470
  basename,
7471
+ routeDiscovery.manifestPath,
7464
7472
  patch,
7465
7473
  signal
7466
7474
  );
7467
7475
  };
7468
7476
  }
7469
- function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
7477
+ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
7470
7478
  React8.useEffect(() => {
7471
- if (!isFogOfWarEnabled(ssr) || navigator.connection?.saveData === true) {
7479
+ if (!isFogOfWarEnabled(routeDiscovery, ssr) || navigator.connection?.saveData === true) {
7472
7480
  return;
7473
7481
  }
7474
7482
  function registerElement(el) {
@@ -7502,6 +7510,7 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
7502
7510
  ssr,
7503
7511
  isSpaMode,
7504
7512
  router.basename,
7513
+ routeDiscovery.manifestPath,
7505
7514
  router.patchRoutes
7506
7515
  );
7507
7516
  } catch (e) {
@@ -7518,15 +7527,21 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
7518
7527
  attributeFilter: ["data-discover", "href", "action"]
7519
7528
  });
7520
7529
  return () => observer.disconnect();
7521
- }, [ssr, isSpaMode, manifest, routeModules, router]);
7530
+ }, [ssr, isSpaMode, manifest, routeModules, router, routeDiscovery]);
7531
+ }
7532
+ function getManifestPath(_manifestPath, basename) {
7533
+ let manifestPath = _manifestPath || "/__manifest";
7534
+ if (basename == null) {
7535
+ return manifestPath;
7536
+ }
7537
+ return `${basename}${manifestPath}`.replace(/\/+/g, "/");
7522
7538
  }
7523
7539
  var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
7524
- async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, patchRoutes, signal) {
7525
- let manifestPath = `${basename != null ? basename : "/"}/__manifest`.replace(
7526
- /\/+/g,
7527
- "/"
7540
+ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, manifestPath, patchRoutes, signal) {
7541
+ let url = new URL(
7542
+ getManifestPath(manifestPath, basename),
7543
+ window.location.origin
7528
7544
  );
7529
- let url = new URL(manifestPath, window.location.origin);
7530
7545
  paths.sort().forEach((path) => url.searchParams.append("p", path));
7531
7546
  url.searchParams.set("version", manifest.version);
7532
7547
  if (url.toString().length > URL_LIMIT) {
@@ -7553,7 +7568,9 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
7553
7568
  }
7554
7569
  sessionStorage.setItem(MANIFEST_VERSION_STORAGE_KEY, manifest.version);
7555
7570
  window.location.href = errorReloadPath;
7556
- throw new Error("Detected manifest version mismatch, reloading...");
7571
+ console.warn("Detected manifest version mismatch, reloading...");
7572
+ await new Promise(() => {
7573
+ });
7557
7574
  } else if (res.status >= 400) {
7558
7575
  throw new Error(await res.text());
7559
7576
  }
@@ -7932,10 +7949,17 @@ function isValidMetaTag(tagName) {
7932
7949
  }
7933
7950
  var isHydrated = false;
7934
7951
  function Scripts(props) {
7935
- let { manifest, serverHandoffString, isSpaMode, ssr, renderMeta } = useFrameworkContext();
7952
+ let {
7953
+ manifest,
7954
+ serverHandoffString,
7955
+ isSpaMode,
7956
+ renderMeta,
7957
+ routeDiscovery,
7958
+ ssr
7959
+ } = useFrameworkContext();
7936
7960
  let { router, static: isStatic, staticContext } = useDataRouterContext2();
7937
7961
  let { matches: routerMatches } = useDataRouterStateContext();
7938
- let enableFogOfWar = isFogOfWarEnabled(ssr);
7962
+ let enableFogOfWar = isFogOfWarEnabled(routeDiscovery, ssr);
7939
7963
  if (renderMeta) {
7940
7964
  renderMeta.didRenderScripts = true;
7941
7965
  }
@@ -8091,7 +8115,7 @@ function mergeRefs(...refs) {
8091
8115
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
8092
8116
  try {
8093
8117
  if (isBrowser) {
8094
- window.__reactRouterVersion = "0.0.0-experimental-1d760f6a6";
8118
+ window.__reactRouterVersion = "0.0.0-experimental-b2bc694a6";
8095
8119
  }
8096
8120
  } catch (e) {
8097
8121
  }
@@ -9215,6 +9239,7 @@ function ServerRouter({
9215
9239
  future: context.future,
9216
9240
  ssr: context.ssr,
9217
9241
  isSpaMode: context.isSpaMode,
9242
+ routeDiscovery: context.routeDiscovery,
9218
9243
  serializeError: context.serializeError,
9219
9244
  renderMeta: context.renderMeta
9220
9245
  }
@@ -9264,7 +9289,8 @@ function createRoutesStub(routes, unstable_getContext) {
9264
9289
  },
9265
9290
  routeModules: {},
9266
9291
  ssr: false,
9267
- isSpaMode: false
9292
+ isSpaMode: false,
9293
+ routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }
9268
9294
  };
9269
9295
  let patched = processRoutes(
9270
9296
  // @ts-expect-error `StubRouteObject` is stricter about `loader`/`action`
@@ -10233,7 +10259,10 @@ Error: ${e instanceof Error ? e.toString() : e}`
10233
10259
  }
10234
10260
  }
10235
10261
  }
10236
- let manifestUrl = `${normalizedBasename}/__manifest`.replace(/\/+/g, "/");
10262
+ let manifestUrl = getManifestPath(
10263
+ _build.routeDiscovery.manifestPath,
10264
+ normalizedBasename
10265
+ );
10237
10266
  if (url.pathname === manifestUrl) {
10238
10267
  try {
10239
10268
  let res = await handleManifestRequest(_build, routes, url);
@@ -10243,7 +10272,7 @@ Error: ${e instanceof Error ? e.toString() : e}`
10243
10272
  return new Response("Unknown Server Error", { status: 500 });
10244
10273
  }
10245
10274
  }
10246
- let matches = matchServerRoutes(routes, url.pathname, _build.basename);
10275
+ let matches = matchServerRoutes(routes, normalizedPath, _build.basename);
10247
10276
  if (matches && matches.length > 0) {
10248
10277
  Object.assign(params, matches[0].params);
10249
10278
  }
@@ -10431,17 +10460,21 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
10431
10460
  actionData: context.actionData,
10432
10461
  errors: serializeErrors2(context.errors, serverMode)
10433
10462
  };
10463
+ let baseServerHandoff = {
10464
+ basename: build.basename,
10465
+ future: build.future,
10466
+ routeDiscovery: build.routeDiscovery,
10467
+ ssr: build.ssr,
10468
+ isSpaMode: isSpaMode2
10469
+ };
10434
10470
  let entryContext = {
10435
10471
  manifest: build.assets,
10436
10472
  routeModules: createEntryRouteModules(build.routes),
10437
10473
  staticHandlerContext: context,
10438
10474
  criticalCss,
10439
10475
  serverHandoffString: createServerHandoffString({
10440
- basename: build.basename,
10441
- criticalCss,
10442
- future: build.future,
10443
- ssr: build.ssr,
10444
- isSpaMode: isSpaMode2
10476
+ ...baseServerHandoff,
10477
+ criticalCss
10445
10478
  }),
10446
10479
  serverHandoffStream: encodeViaTurboStream(
10447
10480
  state,
@@ -10452,6 +10485,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
10452
10485
  renderMeta: {},
10453
10486
  future: build.future,
10454
10487
  ssr: build.ssr,
10488
+ routeDiscovery: build.routeDiscovery,
10455
10489
  isSpaMode: isSpaMode2,
10456
10490
  serializeError: (err) => serializeError(err, serverMode)
10457
10491
  };
@@ -10494,12 +10528,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
10494
10528
  entryContext = {
10495
10529
  ...entryContext,
10496
10530
  staticHandlerContext: context,
10497
- serverHandoffString: createServerHandoffString({
10498
- basename: build.basename,
10499
- future: build.future,
10500
- ssr: build.ssr,
10501
- isSpaMode: isSpaMode2
10502
- }),
10531
+ serverHandoffString: createServerHandoffString(baseServerHandoff),
10503
10532
  serverHandoffStream: encodeViaTurboStream(
10504
10533
  state2,
10505
10534
  request.signal,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-1d760f6a6
2
+ * react-router v0.0.0-experimental-b2bc694a6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -125,7 +125,7 @@ import {
125
125
  useSearchParams,
126
126
  useSubmit,
127
127
  useViewTransitionState
128
- } from "./chunk-QBMD7MNB.mjs";
128
+ } from "./chunk-YFJEQYI5.mjs";
129
129
  export {
130
130
  Await,
131
131
  BrowserRouter,
@@ -1,5 +1,4 @@
1
- import { aF as LinkDescriptor, aC as MetaDescriptor, aU as ServerDataFrom, aV as ClientDataFrom, aW as Func, aX as unstable_MiddlewareNextFunction, E as Equal, u as unstable_RouterContextProvider, M as MiddlewareEnabled, aY as Pretty } from '../../route-data-C12CLHiN.mjs';
2
- import { A as AppLoadContext } from '../../data-CQbyyGzl.mjs';
1
+ import { aE as LinkDescriptor, aB as MetaDescriptor, aV as ServerDataFrom, aW as ClientDataFrom, aX as Func, aY as unstable_MiddlewareNextFunction, E as Equal, ab as unstable_RouterContextProvider, s as MiddlewareEnabled, t as AppLoadContext, aZ as Pretty } from '../../route-data-BvrN3Sw4.mjs';
3
2
  import 'react';
4
3
 
5
4
  type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
@@ -1,5 +1,4 @@
1
- import { aF as LinkDescriptor, aC as MetaDescriptor, aU as ServerDataFrom, aV as ClientDataFrom, aW as Func, aX as unstable_MiddlewareNextFunction, E as Equal, u as unstable_RouterContextProvider, M as MiddlewareEnabled, aY as Pretty } from '../../route-data-C12CLHiN.js';
2
- import { A as AppLoadContext } from '../../data-CQbyyGzl.js';
1
+ import { aH as LinkDescriptor, aF as MetaDescriptor, aV as ServerDataFrom, aW as ClientDataFrom, aX as Func, aY as unstable_MiddlewareNextFunction, $ as Equal, u as unstable_RouterContextProvider, M as MiddlewareEnabled, i as AppLoadContext, aZ as Pretty } from '../../route-data-fNWkI-4T.js';
3
2
  import 'react';
4
3
 
5
4
  type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-1d760f6a6
2
+ * react-router v0.0.0-experimental-b2bc694a6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-1d760f6a6
2
+ * react-router v0.0.0-experimental-b2bc694a6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1397,6 +1397,16 @@ interface RouteContextObject {
1397
1397
  }
1398
1398
  declare const RouteContext: React.Context<RouteContextObject>;
1399
1399
 
1400
+ /**
1401
+ * An object of unknown type for route loaders and actions provided by the
1402
+ * server's `getLoadContext()` function. This is defined as an empty interface
1403
+ * specifically so apps can leverage declaration merging to augment this type
1404
+ * globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
1405
+ */
1406
+ interface AppLoadContext {
1407
+ [key: string]: unknown;
1408
+ }
1409
+
1400
1410
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
1401
1411
  type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
1402
1412
  interface HtmlLinkProps {
@@ -1736,4 +1746,4 @@ type ServerDataFrom<T> = ServerData<DataFrom<T>>;
1736
1746
  type ClientDataFrom<T> = ClientData<DataFrom<T>>;
1737
1747
  type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
1738
1748
 
1739
- export { type DataStrategyResult as $, type ActionFunctionArgs as A, type BlockerFunction as B, type CreateStaticHandlerOptions as C, type DataStrategyFunction as D, type Equal as E, type FutureConfig as F, type DataRouteObject as G, type HydrationState as H, type InitialEntry as I, type ClientLoaderFunction as J, type GetScrollPositionFunction as K, type LoaderFunctionArgs as L, type MiddlewareEnabled as M, type NavigateOptions as N, type GetScrollRestorationKeyFunction as O, type ParamParseKey as P, type Fetcher as Q, type RouterInit as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type NavigationStates as V, type RouterSubscriber as W, type RouterNavigateOptions as X, type RouterFetchOptions as Y, type DataStrategyFunctionArgs as Z, type DataStrategyMatch as _, type Router as a, DataWithResponseInit as a0, type ErrorResponse as a1, type FormEncType as a2, type FormMethod as a3, type HTMLFormMethod as a4, type LazyRouteFunction as a5, type unstable_MiddlewareFunction as a6, type PathParam as a7, type RedirectFunction as a8, type unstable_RouterContext as a9, type HeadersFunction as aA, type MetaArgs as aB, type MetaDescriptor as aC, type PageLinkDescriptor as aD, type HtmlLinkDescriptor as aE, type LinkDescriptor as aF, type Future as aG, type unstable_SerializesTo as aH, createBrowserHistory as aI, invariant as aJ, createRouter as aK, ErrorResponseImpl as aL, DataRouterContext as aM, DataRouterStateContext as aN, FetchersContext as aO, LocationContext as aP, NavigationContext as aQ, RouteContext as aR, ViewTransitionContext as aS, type History as aT, type ServerDataFrom as aU, type ClientDataFrom as aV, type Func as aW, type unstable_MiddlewareNextFunction as aX, type Pretty as aY, type ShouldRevalidateFunction as aa, type ShouldRevalidateFunctionArgs as ab, unstable_createContext as ac, createPath as ad, parsePath as ae, IDLE_NAVIGATION as af, IDLE_FETCHER as ag, IDLE_BLOCKER as ah, data as ai, generatePath as aj, isRouteErrorResponse as ak, matchPath as al, matchRoutes as am, redirect as an, redirectDocument as ao, replace as ap, resolvePath as aq, type DataRouteMatch as ar, type Navigator as as, type PatchRoutesOnNavigationFunction as at, type PatchRoutesOnNavigationFunctionArgs as au, type RouteMatch as av, type ClientActionFunction as aw, type ClientActionFunctionArgs as ax, type ClientLoaderFunctionArgs as ay, type HeadersArgs as az, type RouteModules as b, type RouteManifest as c, type RelativeRoutingType as d, type Location as e, Action as f, type Path as g, type PathPattern as h, type PathMatch as i, type Params as j, type RouteObject as k, type Navigation as l, type RevalidationState as m, type SerializeFrom as n, type Blocker as o, type StaticHandlerContext as p, type StaticHandler as q, type unstable_InitialContext as r, type IndexRouteObject as s, type LoaderFunction as t, unstable_RouterContextProvider as u, type ActionFunction as v, type MetaFunction as w, type LinksFunction as x, type NonIndexRouteObject as y, type RouterState as z };
1749
+ export { type FormEncType as $, Action as A, type BlockerFunction as B, type CreateStaticHandlerOptions as C, type DataStrategyFunction as D, type Equal as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type NavigationStates as J, type RouterSubscriber as K, type Location as L, type MetaFunction as M, type NavigateOptions as N, type RouterNavigateOptions as O, type ParamParseKey as P, type RouterFetchOptions as Q, type RouterInit as R, type SerializeFrom as S, type To as T, type UIMatch as U, type ActionFunctionArgs as V, type DataStrategyFunctionArgs as W, type DataStrategyMatch as X, type DataStrategyResult as Y, DataWithResponseInit as Z, type ErrorResponse as _, type Router as a, type FormMethod as a0, type HTMLFormMethod as a1, type LazyRouteFunction as a2, type LoaderFunctionArgs as a3, type unstable_MiddlewareFunction as a4, type PathParam as a5, type RedirectFunction as a6, type unstable_RouterContext as a7, type ShouldRevalidateFunction as a8, type ShouldRevalidateFunctionArgs as a9, type MetaArgs as aA, type MetaDescriptor as aB, type PageLinkDescriptor as aC, type HtmlLinkDescriptor as aD, type LinkDescriptor as aE, type Future as aF, type unstable_SerializesTo as aG, createBrowserHistory as aH, invariant as aI, createRouter as aJ, ErrorResponseImpl as aK, DataRouterContext as aL, DataRouterStateContext as aM, FetchersContext as aN, LocationContext as aO, NavigationContext as aP, RouteContext as aQ, ViewTransitionContext as aR, type RouteManifest as aS, type ServerRouteModule as aT, type History as aU, type ServerDataFrom as aV, type ClientDataFrom as aW, type Func as aX, type unstable_MiddlewareNextFunction as aY, type Pretty as aZ, unstable_createContext as aa, unstable_RouterContextProvider as ab, createPath as ac, parsePath as ad, IDLE_NAVIGATION as ae, IDLE_FETCHER as af, IDLE_BLOCKER as ag, data as ah, generatePath as ai, isRouteErrorResponse as aj, matchPath as ak, matchRoutes as al, redirect as am, redirectDocument as an, replace as ao, resolvePath as ap, type DataRouteMatch as aq, type Navigator as ar, type PatchRoutesOnNavigationFunction as as, type PatchRoutesOnNavigationFunctionArgs as at, type RouteMatch as au, type ClientActionFunction as av, type ClientActionFunctionArgs as aw, type ClientLoaderFunctionArgs as ax, type HeadersArgs as ay, type HeadersFunction as az, type RouteModules as b, type RelativeRoutingType as c, type Path as d, type PathPattern as e, type PathMatch as f, type Params as g, type RouteObject as h, type Navigation as i, type RevalidationState as j, type Blocker as k, type StaticHandlerContext as l, type StaticHandler as m, type IndexRouteObject as n, type LoaderFunction as o, type ActionFunction as p, type LinksFunction as q, type NonIndexRouteObject as r, type MiddlewareEnabled as s, type AppLoadContext as t, type unstable_InitialContext as u, type RouterState as v, type DataRouteObject as w, type ClientLoaderFunction as x, type GetScrollRestorationKeyFunction as y, type Fetcher as z };
@@ -1397,6 +1397,16 @@ interface RouteContextObject {
1397
1397
  }
1398
1398
  declare const RouteContext: React.Context<RouteContextObject>;
1399
1399
 
1400
+ /**
1401
+ * An object of unknown type for route loaders and actions provided by the
1402
+ * server's `getLoadContext()` function. This is defined as an empty interface
1403
+ * specifically so apps can leverage declaration merging to augment this type
1404
+ * globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
1405
+ */
1406
+ interface AppLoadContext {
1407
+ [key: string]: unknown;
1408
+ }
1409
+
1400
1410
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
1401
1411
  type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
1402
1412
  interface HtmlLinkProps {
@@ -1736,4 +1746,4 @@ type ServerDataFrom<T> = ServerData<DataFrom<T>>;
1736
1746
  type ClientDataFrom<T> = ClientData<DataFrom<T>>;
1737
1747
  type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
1738
1748
 
1739
- export { type DataStrategyResult as $, type ActionFunctionArgs as A, type BlockerFunction as B, type CreateStaticHandlerOptions as C, type DataStrategyFunction as D, type Equal as E, type FutureConfig as F, type DataRouteObject as G, type HydrationState as H, type InitialEntry as I, type ClientLoaderFunction as J, type GetScrollPositionFunction as K, type LoaderFunctionArgs as L, type MiddlewareEnabled as M, type NavigateOptions as N, type GetScrollRestorationKeyFunction as O, type ParamParseKey as P, type Fetcher as Q, type RouterInit as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type NavigationStates as V, type RouterSubscriber as W, type RouterNavigateOptions as X, type RouterFetchOptions as Y, type DataStrategyFunctionArgs as Z, type DataStrategyMatch as _, type Router as a, DataWithResponseInit as a0, type ErrorResponse as a1, type FormEncType as a2, type FormMethod as a3, type HTMLFormMethod as a4, type LazyRouteFunction as a5, type unstable_MiddlewareFunction as a6, type PathParam as a7, type RedirectFunction as a8, type unstable_RouterContext as a9, type HeadersFunction as aA, type MetaArgs as aB, type MetaDescriptor as aC, type PageLinkDescriptor as aD, type HtmlLinkDescriptor as aE, type LinkDescriptor as aF, type Future as aG, type unstable_SerializesTo as aH, createBrowserHistory as aI, invariant as aJ, createRouter as aK, ErrorResponseImpl as aL, DataRouterContext as aM, DataRouterStateContext as aN, FetchersContext as aO, LocationContext as aP, NavigationContext as aQ, RouteContext as aR, ViewTransitionContext as aS, type History as aT, type ServerDataFrom as aU, type ClientDataFrom as aV, type Func as aW, type unstable_MiddlewareNextFunction as aX, type Pretty as aY, type ShouldRevalidateFunction as aa, type ShouldRevalidateFunctionArgs as ab, unstable_createContext as ac, createPath as ad, parsePath as ae, IDLE_NAVIGATION as af, IDLE_FETCHER as ag, IDLE_BLOCKER as ah, data as ai, generatePath as aj, isRouteErrorResponse as ak, matchPath as al, matchRoutes as am, redirect as an, redirectDocument as ao, replace as ap, resolvePath as aq, type DataRouteMatch as ar, type Navigator as as, type PatchRoutesOnNavigationFunction as at, type PatchRoutesOnNavigationFunctionArgs as au, type RouteMatch as av, type ClientActionFunction as aw, type ClientActionFunctionArgs as ax, type ClientLoaderFunctionArgs as ay, type HeadersArgs as az, type RouteModules as b, type RouteManifest as c, type RelativeRoutingType as d, type Location as e, Action as f, type Path as g, type PathPattern as h, type PathMatch as i, type Params as j, type RouteObject as k, type Navigation as l, type RevalidationState as m, type SerializeFrom as n, type Blocker as o, type StaticHandlerContext as p, type StaticHandler as q, type unstable_InitialContext as r, type IndexRouteObject as s, type LoaderFunction as t, unstable_RouterContextProvider as u, type ActionFunction as v, type MetaFunction as w, type LinksFunction as x, type NonIndexRouteObject as y, type RouterState as z };
1749
+ export { type Equal as $, Action as A, type BlockerFunction as B, type ClientLoaderFunction as C, type DataStrategyFunction as D, type FormEncType as E, type FutureConfig as F, type PageLinkDescriptor as G, type HydrationState as H, type InitialEntry as I, type History as J, type GetScrollRestorationKeyFunction as K, type LazyRouteFunction as L, type MiddlewareEnabled as M, type NonIndexRouteObject as N, type Fetcher as O, type PatchRoutesOnNavigationFunction as P, type StaticHandler as Q, type RouteObject as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type CreateStaticHandlerOptions as V, type unstable_InitialContext as W, type LoaderFunction as X, type ActionFunction as Y, type MetaFunction as Z, type LinksFunction as _, type RouterInit as a, type RouterState as a0, type GetScrollPositionFunction as a1, type NavigationStates as a2, type RouterSubscriber as a3, type RouterNavigateOptions as a4, type RouterFetchOptions as a5, type DataStrategyFunctionArgs as a6, type DataStrategyMatch as a7, type DataStrategyResult as a8, DataWithResponseInit as a9, type ClientActionFunctionArgs as aA, type ClientLoaderFunctionArgs as aB, type HeadersArgs as aC, type HeadersFunction as aD, type MetaArgs as aE, type MetaDescriptor as aF, type HtmlLinkDescriptor as aG, type LinkDescriptor as aH, type Future as aI, type unstable_SerializesTo as aJ, createBrowserHistory as aK, invariant as aL, createRouter as aM, ErrorResponseImpl as aN, DataRouterContext as aO, DataRouterStateContext as aP, FetchersContext as aQ, LocationContext as aR, NavigationContext as aS, RouteContext as aT, ViewTransitionContext as aU, type ServerDataFrom as aV, type ClientDataFrom as aW, type Func as aX, type unstable_MiddlewareNextFunction as aY, type Pretty as aZ, type ErrorResponse as aa, type FormMethod as ab, type unstable_MiddlewareFunction as ac, type PathParam as ad, type RedirectFunction as ae, type unstable_RouterContext as af, type ShouldRevalidateFunction as ag, type ShouldRevalidateFunctionArgs as ah, unstable_createContext as ai, createPath as aj, parsePath as ak, IDLE_NAVIGATION as al, IDLE_FETCHER as am, IDLE_BLOCKER as an, data as ao, generatePath as ap, isRouteErrorResponse as aq, matchPath as ar, matchRoutes as as, redirect as at, redirectDocument as au, replace as av, resolvePath as aw, type DataRouteMatch as ax, type PatchRoutesOnNavigationFunctionArgs as ay, type ClientActionFunction as az, type Router as b, type RelativeRoutingType as c, type IndexRouteObject as d, type Location as e, type Navigator as f, type RouteMatch as g, type RouteManifest as h, type AppLoadContext as i, type LoaderFunctionArgs as j, type ActionFunctionArgs as k, type StaticHandlerContext as l, type RouteModules as m, type DataRouteObject as n, type ParamParseKey as o, type Path as p, type PathPattern as q, type PathMatch as r, type NavigateOptions as s, type Params as t, unstable_RouterContextProvider as u, type Navigation as v, type RevalidationState as w, type SerializeFrom as x, type Blocker as y, type HTMLFormMethod as z };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-1d760f6a6
2
+ * react-router v0.0.0-experimental-b2bc694a6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1590,7 +1590,11 @@ function createRouter(init) {
1590
1590
  }
1591
1591
  return {
1592
1592
  matches,
1593
- pendingActionResult: [boundaryMatch.route.id, result]
1593
+ pendingActionResult: [
1594
+ boundaryMatch.route.id,
1595
+ result,
1596
+ actionMatch.route.id
1597
+ ]
1594
1598
  };
1595
1599
  }
1596
1600
  return {
@@ -4361,7 +4365,9 @@ function processRouteLoaderData(matches, results, pendingActionResult, isStaticH
4361
4365
  });
4362
4366
  if (pendingError !== void 0 && pendingActionResult) {
4363
4367
  errors = { [pendingActionResult[0]]: pendingError };
4364
- loaderData[pendingActionResult[0]] = void 0;
4368
+ if (pendingActionResult[2]) {
4369
+ loaderData[pendingActionResult[2]] = void 0;
4370
+ }
4365
4371
  }
4366
4372
  return {
4367
4373
  loaderData,
@@ -6525,7 +6531,8 @@ async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, f
6525
6531
  )
6526
6532
  );
6527
6533
  await Promise.all(routeDfds.map((d) => d.promise));
6528
- if ((!router.state.initialized || routesParams.size === 0) && !window.__reactRouterHdrActive) {
6534
+ let isInitialLoad = !router.state.initialized && router.state.navigation.state === "idle";
6535
+ if ((isInitialLoad || routesParams.size === 0) && !window.__reactRouterHdrActive) {
6529
6536
  singleFetchDfd.resolve({ routes: {} });
6530
6537
  } else {
6531
6538
  let targetRoutes = ssr && foundOptOutRoute && routesParams.size > 0 ? [...routesParams.keys()] : void 0;
@@ -7267,8 +7274,8 @@ var nextPaths = /* @__PURE__ */ new Set();
7267
7274
  var discoveredPathsMaxSize = 1e3;
7268
7275
  var discoveredPaths = /* @__PURE__ */ new Set();
7269
7276
  var URL_LIMIT = 7680;
7270
- function isFogOfWarEnabled(ssr) {
7271
- return ssr === true;
7277
+ function isFogOfWarEnabled(routeDiscovery, ssr) {
7278
+ return routeDiscovery.mode === "lazy" && ssr === true;
7272
7279
  }
7273
7280
  function getPartialManifest({ sri, ...manifest }, router) {
7274
7281
  let routeIds = new Set(router.state.matches.map((m) => m.route.id));
@@ -7295,8 +7302,8 @@ function getPartialManifest({ sri, ...manifest }, router) {
7295
7302
  sri: sri ? true : void 0
7296
7303
  };
7297
7304
  }
7298
- function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, isSpaMode, basename) {
7299
- if (!isFogOfWarEnabled(ssr)) {
7305
+ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDiscovery, isSpaMode, basename) {
7306
+ if (!isFogOfWarEnabled(routeDiscovery, ssr)) {
7300
7307
  return void 0;
7301
7308
  }
7302
7309
  return async ({ path, patch, signal, fetcherKey }) => {
@@ -7311,14 +7318,15 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, isSpaMo
7311
7318
  ssr,
7312
7319
  isSpaMode,
7313
7320
  basename,
7321
+ routeDiscovery.manifestPath,
7314
7322
  patch,
7315
7323
  signal
7316
7324
  );
7317
7325
  };
7318
7326
  }
7319
- function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
7327
+ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
7320
7328
  React8.useEffect(() => {
7321
- if (!isFogOfWarEnabled(ssr) || navigator.connection?.saveData === true) {
7329
+ if (!isFogOfWarEnabled(routeDiscovery, ssr) || navigator.connection?.saveData === true) {
7322
7330
  return;
7323
7331
  }
7324
7332
  function registerElement(el) {
@@ -7352,6 +7360,7 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
7352
7360
  ssr,
7353
7361
  isSpaMode,
7354
7362
  router.basename,
7363
+ routeDiscovery.manifestPath,
7355
7364
  router.patchRoutes
7356
7365
  );
7357
7366
  } catch (e) {
@@ -7368,15 +7377,21 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
7368
7377
  attributeFilter: ["data-discover", "href", "action"]
7369
7378
  });
7370
7379
  return () => observer.disconnect();
7371
- }, [ssr, isSpaMode, manifest, routeModules, router]);
7380
+ }, [ssr, isSpaMode, manifest, routeModules, router, routeDiscovery]);
7381
+ }
7382
+ function getManifestPath(_manifestPath, basename) {
7383
+ let manifestPath = _manifestPath || "/__manifest";
7384
+ if (basename == null) {
7385
+ return manifestPath;
7386
+ }
7387
+ return `${basename}${manifestPath}`.replace(/\/+/g, "/");
7372
7388
  }
7373
7389
  var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
7374
- async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, patchRoutes, signal) {
7375
- let manifestPath = `${basename != null ? basename : "/"}/__manifest`.replace(
7376
- /\/+/g,
7377
- "/"
7390
+ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, manifestPath, patchRoutes, signal) {
7391
+ let url = new URL(
7392
+ getManifestPath(manifestPath, basename),
7393
+ window.location.origin
7378
7394
  );
7379
- let url = new URL(manifestPath, window.location.origin);
7380
7395
  paths.sort().forEach((path) => url.searchParams.append("p", path));
7381
7396
  url.searchParams.set("version", manifest.version);
7382
7397
  if (url.toString().length > URL_LIMIT) {
@@ -7403,7 +7418,9 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
7403
7418
  }
7404
7419
  sessionStorage.setItem(MANIFEST_VERSION_STORAGE_KEY, manifest.version);
7405
7420
  window.location.href = errorReloadPath;
7406
- throw new Error("Detected manifest version mismatch, reloading...");
7421
+ console.warn("Detected manifest version mismatch, reloading...");
7422
+ await new Promise(() => {
7423
+ });
7407
7424
  } else if (res.status >= 400) {
7408
7425
  throw new Error(await res.text());
7409
7426
  }
@@ -7782,10 +7799,17 @@ function isValidMetaTag(tagName) {
7782
7799
  }
7783
7800
  var isHydrated = false;
7784
7801
  function Scripts(props) {
7785
- let { manifest, serverHandoffString, isSpaMode, ssr, renderMeta } = useFrameworkContext();
7802
+ let {
7803
+ manifest,
7804
+ serverHandoffString,
7805
+ isSpaMode,
7806
+ renderMeta,
7807
+ routeDiscovery,
7808
+ ssr
7809
+ } = useFrameworkContext();
7786
7810
  let { router, static: isStatic, staticContext } = useDataRouterContext2();
7787
7811
  let { matches: routerMatches } = useDataRouterStateContext();
7788
- let enableFogOfWar = isFogOfWarEnabled(ssr);
7812
+ let enableFogOfWar = isFogOfWarEnabled(routeDiscovery, ssr);
7789
7813
  if (renderMeta) {
7790
7814
  renderMeta.didRenderScripts = true;
7791
7815
  }
@@ -7941,7 +7965,7 @@ function mergeRefs(...refs) {
7941
7965
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
7942
7966
  try {
7943
7967
  if (isBrowser) {
7944
- window.__reactRouterVersion = "0.0.0-experimental-1d760f6a6";
7968
+ window.__reactRouterVersion = "0.0.0-experimental-b2bc694a6";
7945
7969
  }
7946
7970
  } catch (e) {
7947
7971
  }
@@ -9065,6 +9089,7 @@ function ServerRouter({
9065
9089
  future: context.future,
9066
9090
  ssr: context.ssr,
9067
9091
  isSpaMode: context.isSpaMode,
9092
+ routeDiscovery: context.routeDiscovery,
9068
9093
  serializeError: context.serializeError,
9069
9094
  renderMeta: context.renderMeta
9070
9095
  }
@@ -9114,7 +9139,8 @@ function createRoutesStub(routes, unstable_getContext) {
9114
9139
  },
9115
9140
  routeModules: {},
9116
9141
  ssr: false,
9117
- isSpaMode: false
9142
+ isSpaMode: false,
9143
+ routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }
9118
9144
  };
9119
9145
  let patched = processRoutes(
9120
9146
  // @ts-expect-error `StubRouteObject` is stricter about `loader`/`action`
@@ -10083,7 +10109,10 @@ Error: ${e instanceof Error ? e.toString() : e}`
10083
10109
  }
10084
10110
  }
10085
10111
  }
10086
- let manifestUrl = `${normalizedBasename}/__manifest`.replace(/\/+/g, "/");
10112
+ let manifestUrl = getManifestPath(
10113
+ _build.routeDiscovery.manifestPath,
10114
+ normalizedBasename
10115
+ );
10087
10116
  if (url.pathname === manifestUrl) {
10088
10117
  try {
10089
10118
  let res = await handleManifestRequest(_build, routes, url);
@@ -10093,7 +10122,7 @@ Error: ${e instanceof Error ? e.toString() : e}`
10093
10122
  return new Response("Unknown Server Error", { status: 500 });
10094
10123
  }
10095
10124
  }
10096
- let matches = matchServerRoutes(routes, url.pathname, _build.basename);
10125
+ let matches = matchServerRoutes(routes, normalizedPath, _build.basename);
10097
10126
  if (matches && matches.length > 0) {
10098
10127
  Object.assign(params, matches[0].params);
10099
10128
  }
@@ -10281,17 +10310,21 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
10281
10310
  actionData: context.actionData,
10282
10311
  errors: serializeErrors2(context.errors, serverMode)
10283
10312
  };
10313
+ let baseServerHandoff = {
10314
+ basename: build.basename,
10315
+ future: build.future,
10316
+ routeDiscovery: build.routeDiscovery,
10317
+ ssr: build.ssr,
10318
+ isSpaMode: isSpaMode2
10319
+ };
10284
10320
  let entryContext = {
10285
10321
  manifest: build.assets,
10286
10322
  routeModules: createEntryRouteModules(build.routes),
10287
10323
  staticHandlerContext: context,
10288
10324
  criticalCss,
10289
10325
  serverHandoffString: createServerHandoffString({
10290
- basename: build.basename,
10291
- criticalCss,
10292
- future: build.future,
10293
- ssr: build.ssr,
10294
- isSpaMode: isSpaMode2
10326
+ ...baseServerHandoff,
10327
+ criticalCss
10295
10328
  }),
10296
10329
  serverHandoffStream: encodeViaTurboStream(
10297
10330
  state,
@@ -10302,6 +10335,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
10302
10335
  renderMeta: {},
10303
10336
  future: build.future,
10304
10337
  ssr: build.ssr,
10338
+ routeDiscovery: build.routeDiscovery,
10305
10339
  isSpaMode: isSpaMode2,
10306
10340
  serializeError: (err) => serializeError(err, serverMode)
10307
10341
  };
@@ -10344,12 +10378,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
10344
10378
  entryContext = {
10345
10379
  ...entryContext,
10346
10380
  staticHandlerContext: context,
10347
- serverHandoffString: createServerHandoffString({
10348
- basename: build.basename,
10349
- future: build.future,
10350
- ssr: build.ssr,
10351
- isSpaMode: isSpaMode2
10352
- }),
10381
+ serverHandoffString: createServerHandoffString(baseServerHandoff),
10353
10382
  serverHandoffStream: encodeViaTurboStream(
10354
10383
  state2,
10355
10384
  request.signal,
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { R as RouterProviderProps$1 } from './fog-of-war-D2zsXvum.mjs';
3
- import { R as RouterInit } from './route-data-C12CLHiN.mjs';
2
+ import { R as RouterProviderProps$1 } from './fog-of-war-B1MWugqW.mjs';
3
+ import { R as RouterInit } from './route-data-BvrN3Sw4.mjs';
4
4
 
5
5
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
6
6
  declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
- import { R as RouterProviderProps$1 } from './fog-of-war-BLArG-qZ.js';
3
- import { R as RouterInit } from './route-data-C12CLHiN.js';
2
+ import { RouterProviderProps as RouterProviderProps$1, RouterInit } from 'react-router';
4
3
 
5
4
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
6
5
  declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;