react-router 0.0.0-experimental-8e9d8ef63 → 0.0.0-experimental-8677247c0

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 (36) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/dist/development/{chunk-EJSPM7NW.mjs → chunk-HKRGPCO4.mjs} +97 -35
  3. package/dist/development/dom-export.d.mts +2 -2
  4. package/dist/development/dom-export.d.ts +2 -2
  5. package/dist/development/dom-export.js +68 -32
  6. package/dist/development/dom-export.mjs +9 -4
  7. package/dist/development/{fog-of-war-BOz-S1N8.d.mts → fog-of-war-BALYJxf_.d.mts} +3 -3
  8. package/dist/{production/fog-of-war-BBVWdkR1.d.ts → development/fog-of-war-Cm1iXIp7.d.ts} +3 -3
  9. package/dist/development/index.d.mts +9 -5
  10. package/dist/development/index.d.ts +9 -5
  11. package/dist/development/index.js +97 -35
  12. package/dist/development/index.mjs +2 -2
  13. package/dist/development/lib/types/route-module.d.mts +83 -2
  14. package/dist/development/lib/types/route-module.d.ts +83 -2
  15. package/dist/development/lib/types/route-module.js +1 -1
  16. package/dist/development/lib/types/route-module.mjs +1 -1
  17. package/dist/development/{route-data-CfLfC_Bh.d.ts → route-data-BmvbmBej.d.mts} +75 -2
  18. package/dist/{production/route-data-CfLfC_Bh.d.mts → development/route-data-BmvbmBej.d.ts} +75 -2
  19. package/dist/production/{chunk-7VURRAOS.mjs → chunk-A75QPPAM.mjs} +97 -35
  20. package/dist/production/dom-export.d.mts +2 -2
  21. package/dist/production/dom-export.d.ts +2 -2
  22. package/dist/production/dom-export.js +68 -32
  23. package/dist/production/dom-export.mjs +9 -4
  24. package/dist/production/{fog-of-war-BOz-S1N8.d.mts → fog-of-war-BALYJxf_.d.mts} +3 -3
  25. package/dist/{development/fog-of-war-BBVWdkR1.d.ts → production/fog-of-war-Cm1iXIp7.d.ts} +3 -3
  26. package/dist/production/index.d.mts +9 -5
  27. package/dist/production/index.d.ts +9 -5
  28. package/dist/production/index.js +97 -35
  29. package/dist/production/index.mjs +2 -2
  30. package/dist/production/lib/types/route-module.d.mts +83 -2
  31. package/dist/production/lib/types/route-module.d.ts +83 -2
  32. package/dist/production/lib/types/route-module.js +1 -1
  33. package/dist/production/lib/types/route-module.mjs +1 -1
  34. package/dist/production/{route-data-CfLfC_Bh.d.ts → route-data-BmvbmBej.d.mts} +75 -2
  35. package/dist/{development/route-data-CfLfC_Bh.d.mts → production/route-data-BmvbmBej.d.ts} +75 -2
  36. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,79 @@
1
1
  # `react-router`
2
2
 
3
+ ## 7.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - New type-safe `href` utility that guarantees links point to actual paths in your app ([#13012](https://github.com/remix-run/react-router/pull/13012))
8
+
9
+ ```tsx
10
+ import { href } from "react-router";
11
+
12
+ export default function Component() {
13
+ const link = href("/blog/:slug", { slug: "my-first-post" });
14
+ return (
15
+ <main>
16
+ <Link to={href("/products/:id", { id: "asdf" })} />
17
+ <NavLink to={href("/:lang?/about", { lang: "en" })} />
18
+ </main>
19
+ );
20
+ }
21
+ ```
22
+
23
+ ### Patch Changes
24
+
25
+ - Fix typegen for repeated params ([#13012](https://github.com/remix-run/react-router/pull/13012))
26
+
27
+ In React Router, path parameters are keyed by their name.
28
+ So for a path pattern like `/a/:id/b/:id?/c/:id`, the last `:id` will set the value for `id` in `useParams` and the `params` prop.
29
+ For example, `/a/1/b/2/c/3` will result in the value `{ id: 3 }` at runtime.
30
+
31
+ Previously, generated types for params incorrectly modeled repeated params with an array.
32
+ So `/a/1/b/2/c/3` generated a type like `{ id: [1,2,3] }`.
33
+
34
+ To be consistent with runtime behavior, the generated types now correctly model the "last one wins" semantics of path parameters.
35
+ So `/a/1/b/2/c/3` now generates a type like `{ id: 3 }`.
36
+
37
+ - Don't apply Single Fetch revalidation de-optimization when in SPA mode since there is no server HTTP request ([#12948](https://github.com/remix-run/react-router/pull/12948))
38
+
39
+ - Properly handle revalidations to across a prerender/SPA boundary ([#13021](https://github.com/remix-run/react-router/pull/13021))
40
+
41
+ - In "hybrid" applications where some routes are pre-rendered and some are served from a SPA fallback, we need to avoid making `.data` requests if the path wasn't pre-rendered because the request will 404
42
+ - We don't know all the pre-rendered paths client-side, however:
43
+ - All `loader` data in `ssr:false` mode is static because it's generated at build time
44
+ - A route must use a `clientLoader` to do anything dynamic
45
+ - Therefore, if a route only has a `loader` and not a `clientLoader`, we disable revalidation by default because there is no new data to retrieve
46
+ - We short circuit and skip single fetch `.data` request logic if there are no server loaders with `shouldLoad=true` in our single fetch `dataStrategy`
47
+ - This ensures that the route doesn't cause a `.data` request that would 404 after a submission
48
+
49
+ - Error at build time in `ssr:false` + `prerender` apps for the edge case scenario of: ([#13021](https://github.com/remix-run/react-router/pull/13021))
50
+
51
+ - A parent route has only a `loader` (does not have a `clientLoader`)
52
+ - The parent route is pre-rendered
53
+ - The parent route has children routes which are not prerendered
54
+ - This means that when the child paths are loaded via the SPA fallback, the parent won't have any `loaderData` because there is no server on which to run the `loader`
55
+ - This can be resolved by either adding a parent `clientLoader` or pre-rendering the child paths
56
+ - If you add a `clientLoader`, calling the `serverLoader()` on non-prerendered paths will throw a 404
57
+
58
+ - Add unstable support for splitting route modules in framework mode via `future.unstable_splitRouteModules` ([#11871](https://github.com/remix-run/react-router/pull/11871))
59
+
60
+ - Add `unstable_SerializesTo` brand type for library authors to register types serializable by React Router's streaming format (`turbo-stream`) ([`ab5b05b02`](https://github.com/remix-run/react-router/commit/ab5b05b02f99f062edb3c536c392197c88eb6c77))
61
+
62
+ - Align dev server behavior with static file server behavior when `ssr:false` is set ([#12948](https://github.com/remix-run/react-router/pull/12948))
63
+
64
+ - When no `prerender` config exists, only SSR down to the root `HydrateFallback` (SPA Mode)
65
+ - When a `prerender` config exists but the current path is not prerendered, only SSR down to the root `HydrateFallback` (SPA Fallback)
66
+ - Return a 404 on `.data` requests to non-pre-rendered paths
67
+
68
+ - Improve prefetch performance of CSS side effects in framework mode ([#12889](https://github.com/remix-run/react-router/pull/12889))
69
+
70
+ - Disable Lazy Route Discovery for all `ssr:false` apps and not just "SPA Mode" because there is no runtime server to serve the search-param-configured `__manifest` requests ([#12894](https://github.com/remix-run/react-router/pull/12894))
71
+
72
+ - We previously only disabled this for "SPA Mode" which is `ssr:false` and no `prerender` config but we realized it should apply to all `ssr:false` apps, including those prerendering multiple pages
73
+ - In those `prerender` scenarios we would prerender the `/__manifest` file assuming the static file server would serve it but that makes some unneccesary assumptions about the static file server behaviors
74
+
75
+ - Properly handle interrupted manifest requests in lazy route discovery ([#12915](https://github.com/remix-run/react-router/pull/12915))
76
+
3
77
  ## 7.1.5
4
78
 
5
79
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-8e9d8ef63
2
+ * react-router v0.0.0-experimental-8677247c0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -5664,17 +5664,42 @@ function StreamTransfer({
5664
5664
  )));
5665
5665
  }
5666
5666
  }
5667
- function getSingleFetchDataStrategy(manifest, routeModules, getRouter) {
5667
+ function getSingleFetchDataStrategy(manifest, routeModules, ssr, getRouter) {
5668
5668
  return async ({ request, matches, fetcherKey }) => {
5669
5669
  if (request.method !== "GET") {
5670
5670
  return singleFetchActionStrategy(request, matches);
5671
5671
  }
5672
+ if (!ssr) {
5673
+ let foundRevalidatingServerLoader = matches.some(
5674
+ (m) => m.shouldLoad && manifest.routes[m.route.id]?.hasLoader && !manifest.routes[m.route.id]?.hasClientLoader
5675
+ );
5676
+ if (!foundRevalidatingServerLoader) {
5677
+ let matchesToLoad = matches.filter((m) => m.shouldLoad);
5678
+ let url = stripIndexParam(singleFetchUrl(request.url));
5679
+ let init = await createRequestInit(request);
5680
+ let results = {};
5681
+ await Promise.all(
5682
+ matchesToLoad.map(
5683
+ (m) => m.resolve(async (handler) => {
5684
+ try {
5685
+ let result = manifest.routes[m.route.id]?.hasClientLoader ? await fetchSingleLoader(handler, url, init, m.route.id) : await handler();
5686
+ results[m.route.id] = { type: "data", result };
5687
+ } catch (e) {
5688
+ results[m.route.id] = { type: "error", result: e };
5689
+ }
5690
+ })
5691
+ )
5692
+ );
5693
+ return results;
5694
+ }
5695
+ }
5672
5696
  if (fetcherKey) {
5673
5697
  return singleFetchLoaderFetcherStrategy(request, matches);
5674
5698
  }
5675
5699
  return singleFetchLoaderNavigationStrategy(
5676
5700
  manifest,
5677
5701
  routeModules,
5702
+ ssr,
5678
5703
  getRouter(),
5679
5704
  request,
5680
5705
  matches
@@ -5708,7 +5733,7 @@ async function singleFetchActionStrategy(request, matches) {
5708
5733
  }
5709
5734
  };
5710
5735
  }
5711
- async function singleFetchLoaderNavigationStrategy(manifest, routeModules, router, request, matches) {
5736
+ async function singleFetchLoaderNavigationStrategy(manifest, routeModules, ssr, router, request, matches) {
5712
5737
  let routesParams = /* @__PURE__ */ new Set();
5713
5738
  let foundOptOutRoute = false;
5714
5739
  let routeDfds = matches.map(() => createDeferred2());
@@ -5774,7 +5799,7 @@ async function singleFetchLoaderNavigationStrategy(manifest, routeModules, route
5774
5799
  singleFetchDfd.resolve({});
5775
5800
  } else {
5776
5801
  try {
5777
- if (foundOptOutRoute && routesParams.size > 0) {
5802
+ if (ssr && foundOptOutRoute && routesParams.size > 0) {
5778
5803
  url.searchParams.set(
5779
5804
  "_routes",
5780
5805
  matches.filter((m) => routesParams.has(m.route.id)).map((m) => m.route.id).join(",")
@@ -6142,27 +6167,22 @@ function createServerRoutes(manifest, routeModules, future, isSpaMode, parentId
6142
6167
  return dataRoute;
6143
6168
  });
6144
6169
  }
6145
- function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest, routeModulesCache, initialState, future, isSpaMode) {
6170
+ function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest, routeModulesCache, initialState, ssr, isSpaMode) {
6146
6171
  return createClientRoutes(
6147
6172
  manifest,
6148
6173
  routeModulesCache,
6149
6174
  initialState,
6175
+ ssr,
6150
6176
  isSpaMode,
6151
6177
  "",
6152
6178
  groupRoutesByParentId(manifest),
6153
6179
  needsRevalidation
6154
6180
  );
6155
6181
  }
6156
- function preventInvalidServerHandlerCall(type, route, isSpaMode) {
6157
- if (isSpaMode) {
6158
- let fn2 = type === "action" ? "serverAction()" : "serverLoader()";
6159
- let msg2 = `You cannot call ${fn2} in SPA Mode (routeId: "${route.id}")`;
6160
- console.error(msg2);
6161
- throw new ErrorResponseImpl(400, "Bad Request", new Error(msg2), true);
6162
- }
6163
- let fn = type === "action" ? "serverAction()" : "serverLoader()";
6164
- let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${route.id}")`;
6182
+ function preventInvalidServerHandlerCall(type, route) {
6165
6183
  if (type === "loader" && !route.hasLoader || type === "action" && !route.hasAction) {
6184
+ let fn = type === "action" ? "serverAction()" : "serverLoader()";
6185
+ let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${route.id}")`;
6166
6186
  console.error(msg);
6167
6187
  throw new ErrorResponseImpl(400, "Bad Request", new Error(msg), true);
6168
6188
  }
@@ -6173,7 +6193,7 @@ function noActionDefinedError(type, routeId) {
6173
6193
  console.error(msg);
6174
6194
  throw new ErrorResponseImpl(405, "Method Not Allowed", new Error(msg), true);
6175
6195
  }
6176
- function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode, parentId = "", routesByParentId = groupRoutesByParentId(manifest), needsRevalidation) {
6196
+ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSpaMode, parentId = "", routesByParentId = groupRoutesByParentId(manifest), needsRevalidation) {
6177
6197
  return (routesByParentId[parentId] || []).map((route) => {
6178
6198
  let routeModule = routeModulesCache[route.id];
6179
6199
  function fetchServerHandler(singleFetch) {
@@ -6229,7 +6249,8 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
6229
6249
  handle: routeModule.handle,
6230
6250
  shouldRevalidate: getShouldRevalidateFunction(
6231
6251
  routeModule,
6232
- route.id,
6252
+ route,
6253
+ ssr,
6233
6254
  needsRevalidation
6234
6255
  )
6235
6256
  });
@@ -6246,14 +6267,13 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
6246
6267
  "No `routeModule` available for critical-route loader"
6247
6268
  );
6248
6269
  if (!routeModule.clientLoader) {
6249
- if (isSpaMode) return null;
6250
6270
  return fetchServerLoader(singleFetch);
6251
6271
  }
6252
6272
  return routeModule.clientLoader({
6253
6273
  request,
6254
6274
  params,
6255
6275
  async serverLoader() {
6256
- preventInvalidServerHandlerCall("loader", route, isSpaMode);
6276
+ preventInvalidServerHandlerCall("loader", route);
6257
6277
  if (isHydrationRequest) {
6258
6278
  if (hasInitialData) {
6259
6279
  return initialData;
@@ -6292,7 +6312,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
6292
6312
  request,
6293
6313
  params,
6294
6314
  async serverAction() {
6295
- preventInvalidServerHandlerCall("action", route, isSpaMode);
6315
+ preventInvalidServerHandlerCall("action", route);
6296
6316
  return fetchServerAction(singleFetch);
6297
6317
  }
6298
6318
  });
@@ -6301,7 +6321,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
6301
6321
  } else {
6302
6322
  if (!route.hasClientLoader) {
6303
6323
  dataRoute.loader = ({ request }, singleFetch) => prefetchStylesAndCallHandler(() => {
6304
- if (isSpaMode) return Promise.resolve(null);
6305
6324
  return fetchServerLoader(singleFetch);
6306
6325
  });
6307
6326
  } else if (route.clientLoaderModule) {
@@ -6315,7 +6334,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
6315
6334
  return clientLoader({
6316
6335
  ...args,
6317
6336
  async serverLoader() {
6318
- preventInvalidServerHandlerCall("loader", route, isSpaMode);
6337
+ preventInvalidServerHandlerCall("loader", route);
6319
6338
  return fetchServerLoader(singleFetch);
6320
6339
  }
6321
6340
  });
@@ -6340,7 +6359,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
6340
6359
  return clientAction({
6341
6360
  ...args,
6342
6361
  async serverAction() {
6343
- preventInvalidServerHandlerCall("action", route, isSpaMode);
6362
+ preventInvalidServerHandlerCall("action", route);
6344
6363
  return fetchServerAction(singleFetch);
6345
6364
  }
6346
6365
  });
@@ -6362,7 +6381,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
6362
6381
  lazyRoute.loader = (args, singleFetch) => clientLoader({
6363
6382
  ...args,
6364
6383
  async serverLoader() {
6365
- preventInvalidServerHandlerCall("loader", route, isSpaMode);
6384
+ preventInvalidServerHandlerCall("loader", route);
6366
6385
  return fetchServerLoader(singleFetch);
6367
6386
  }
6368
6387
  });
@@ -6372,7 +6391,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
6372
6391
  lazyRoute.action = (args, singleFetch) => clientAction({
6373
6392
  ...args,
6374
6393
  async serverAction() {
6375
- preventInvalidServerHandlerCall("action", route, isSpaMode);
6394
+ preventInvalidServerHandlerCall("action", route);
6376
6395
  return fetchServerAction(singleFetch);
6377
6396
  }
6378
6397
  });
@@ -6383,7 +6402,8 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
6383
6402
  hasErrorBoundary: lazyRoute.hasErrorBoundary,
6384
6403
  shouldRevalidate: getShouldRevalidateFunction(
6385
6404
  lazyRoute,
6386
- route.id,
6405
+ route,
6406
+ ssr,
6387
6407
  needsRevalidation
6388
6408
  ),
6389
6409
  handle: lazyRoute.handle,
@@ -6398,6 +6418,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
6398
6418
  manifest,
6399
6419
  routeModulesCache,
6400
6420
  initialState,
6421
+ ssr,
6401
6422
  isSpaMode,
6402
6423
  route.id,
6403
6424
  routesByParentId,
@@ -6407,15 +6428,23 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
6407
6428
  return dataRoute;
6408
6429
  });
6409
6430
  }
6410
- function getShouldRevalidateFunction(route, routeId, needsRevalidation) {
6431
+ function getShouldRevalidateFunction(route, manifestRoute, ssr, needsRevalidation) {
6411
6432
  if (needsRevalidation) {
6412
6433
  return wrapShouldRevalidateForHdr(
6413
- routeId,
6434
+ manifestRoute.id,
6414
6435
  route.shouldRevalidate,
6415
6436
  needsRevalidation
6416
6437
  );
6417
6438
  }
6418
- if (route.shouldRevalidate) {
6439
+ if (!ssr && manifestRoute.hasLoader && !manifestRoute.hasClientLoader) {
6440
+ if (route.shouldRevalidate) {
6441
+ let fn = route.shouldRevalidate;
6442
+ return (opts) => fn({ ...opts, defaultShouldRevalidate: false });
6443
+ } else {
6444
+ return () => false;
6445
+ }
6446
+ }
6447
+ if (ssr && route.shouldRevalidate) {
6419
6448
  let fn = route.shouldRevalidate;
6420
6449
  return (opts) => fn({ ...opts, defaultShouldRevalidate: true });
6421
6450
  }
@@ -6505,6 +6534,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, isSpaMo
6505
6534
  [path],
6506
6535
  manifest,
6507
6536
  routeModules,
6537
+ ssr,
6508
6538
  isSpaMode,
6509
6539
  basename,
6510
6540
  patch,
@@ -6544,6 +6574,7 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
6544
6574
  lazyPaths,
6545
6575
  manifest,
6546
6576
  routeModules,
6577
+ ssr,
6547
6578
  isSpaMode,
6548
6579
  router.basename,
6549
6580
  router.patchRoutes
@@ -6564,7 +6595,7 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
6564
6595
  return () => observer.disconnect();
6565
6596
  }, [ssr, isSpaMode, manifest, routeModules, router]);
6566
6597
  }
6567
- async function fetchAndApplyManifestPatches(paths, manifest, routeModules, isSpaMode, basename, patchRoutes, signal) {
6598
+ async function fetchAndApplyManifestPatches(paths, manifest, routeModules, ssr, isSpaMode, basename, patchRoutes, signal) {
6568
6599
  let manifestPath = `${basename != null ? basename : "/"}/__manifest`.replace(
6569
6600
  /\/+/g,
6570
6601
  "/"
@@ -6607,7 +6638,7 @@ async function fetchAndApplyManifestPatches(paths, manifest, routeModules, isSpa
6607
6638
  parentIds.forEach(
6608
6639
  (parentId) => patchRoutes(
6609
6640
  parentId || null,
6610
- createClientRoutes(patches, routeModules, null, isSpaMode, parentId)
6641
+ createClientRoutes(patches, routeModules, null, ssr, isSpaMode, parentId)
6611
6642
  )
6612
6643
  );
6613
6644
  }
@@ -7087,7 +7118,7 @@ function mergeRefs(...refs) {
7087
7118
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
7088
7119
  try {
7089
7120
  if (isBrowser) {
7090
- window.__reactRouterVersion = "0.0.0-experimental-8e9d8ef63";
7121
+ window.__reactRouterVersion = "0.0.0-experimental-8677247c0";
7091
7122
  }
7092
7123
  } catch (e) {
7093
7124
  }
@@ -9092,6 +9123,10 @@ var createRequestHandler = (build, mode) => {
9092
9123
  errorHandler = derived.errorHandler;
9093
9124
  }
9094
9125
  let url = new URL(request.url);
9126
+ let normalizedPath = url.pathname.replace(/\.data$/, "").replace(/^\/_root$/, "/");
9127
+ if (normalizedPath !== "/" && normalizedPath.endsWith("/")) {
9128
+ normalizedPath = normalizedPath.slice(0, -1);
9129
+ }
9095
9130
  let params = {};
9096
9131
  let handleError = (error) => {
9097
9132
  if (mode === "development" /* Development */) {
@@ -9103,6 +9138,32 @@ var createRequestHandler = (build, mode) => {
9103
9138
  request
9104
9139
  });
9105
9140
  };
9141
+ if (!_build.ssr) {
9142
+ if (_build.prerender.length === 0) {
9143
+ request.headers.set("X-React-Router-SPA-Mode", "yes");
9144
+ } else if (!_build.prerender.includes(normalizedPath) && !_build.prerender.includes(normalizedPath + "/")) {
9145
+ if (url.pathname.endsWith(".data")) {
9146
+ errorHandler(
9147
+ new ErrorResponseImpl(
9148
+ 404,
9149
+ "Not Found",
9150
+ `Refusing to SSR the path \`${normalizedPath}\` because \`ssr:false\` is set and the path is not included in the \`prerender\` config, so in production the path will be a 404.`
9151
+ ),
9152
+ {
9153
+ context: loadContext,
9154
+ params,
9155
+ request
9156
+ }
9157
+ );
9158
+ return new Response("Not Found", {
9159
+ status: 404,
9160
+ statusText: "Not Found"
9161
+ });
9162
+ } else {
9163
+ request.headers.set("X-React-Router-SPA-Mode", "yes");
9164
+ }
9165
+ }
9166
+ }
9106
9167
  let manifestUrl = `${_build.basename ?? "/"}/__manifest`.replace(
9107
9168
  /\/+/g,
9108
9169
  "/"
@@ -9123,7 +9184,7 @@ var createRequestHandler = (build, mode) => {
9123
9184
  let response;
9124
9185
  if (url.pathname.endsWith(".data")) {
9125
9186
  let handlerUrl = new URL(request.url);
9126
- handlerUrl.pathname = handlerUrl.pathname.replace(/\.data$/, "").replace(/^\/_root$/, "/");
9187
+ handlerUrl.pathname = normalizedPath;
9127
9188
  let singleFetchMatches = matchServerRoutes(
9128
9189
  routes,
9129
9190
  handlerUrl.pathname,
@@ -9263,6 +9324,7 @@ async function handleSingleFetchRequest(serverMode, build, staticHandler, reques
9263
9324
  );
9264
9325
  }
9265
9326
  async function handleDocumentRequest(serverMode, build, staticHandler, request, loadContext, handleError, criticalCss) {
9327
+ let isSpaMode = request.headers.has("X-React-Router-SPA-Mode");
9266
9328
  let context;
9267
9329
  try {
9268
9330
  context = await staticHandler.query(request, {
@@ -9302,7 +9364,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
9302
9364
  criticalCss,
9303
9365
  future: build.future,
9304
9366
  ssr: build.ssr,
9305
- isSpaMode: build.isSpaMode
9367
+ isSpaMode
9306
9368
  }),
9307
9369
  serverHandoffStream: encodeViaTurboStream(
9308
9370
  state,
@@ -9313,7 +9375,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
9313
9375
  renderMeta: {},
9314
9376
  future: build.future,
9315
9377
  ssr: build.ssr,
9316
- isSpaMode: build.isSpaMode,
9378
+ isSpaMode,
9317
9379
  serializeError: (err) => serializeError(err, serverMode)
9318
9380
  };
9319
9381
  let handleDocumentRequestFunction = build.entry.module.default;
@@ -9359,7 +9421,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
9359
9421
  basename: build.basename,
9360
9422
  future: build.future,
9361
9423
  ssr: build.ssr,
9362
- isSpaMode: build.isSpaMode
9424
+ isSpaMode
9363
9425
  }),
9364
9426
  serverHandoffStream: encodeViaTurboStream(
9365
9427
  state2,
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { R as RouterProviderProps$1 } from './fog-of-war-BOz-S1N8.mjs';
3
- import './route-data-CfLfC_Bh.mjs';
2
+ import { R as RouterProviderProps$1 } from './fog-of-war-BALYJxf_.mjs';
3
+ import './route-data-BmvbmBej.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,6 @@
1
1
  import * as React from 'react';
2
- import { R as RouterProviderProps$1 } from './fog-of-war-BBVWdkR1.js';
3
- import './route-data-CfLfC_Bh.js';
2
+ import { R as RouterProviderProps$1 } from './fog-of-war-Cm1iXIp7.js';
3
+ import './route-data-BmvbmBej.js';
4
4
 
5
5
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
6
6
  declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;