@farm.js/core 0.1.45 → 0.1.47

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 (191) hide show
  1. package/dist/{agent-mcp-EnzWYv_X.d.ts → agent-mcp-BtK_KZ1m.d.ts} +2 -2
  2. package/dist/{agent-mcp-CWI-awqd.d.mts → agent-mcp-Cc-ypyNi.d.mts} +2 -2
  3. package/dist/agent-runtime.d.mts +10 -10
  4. package/dist/agent-runtime.d.ts +10 -10
  5. package/dist/api/client.d.mts +3 -3
  6. package/dist/api/client.d.ts +3 -3
  7. package/dist/api/route-manager.d.mts +16 -16
  8. package/dist/api/route-manager.d.ts +16 -16
  9. package/dist/api/runtime.d.mts +12 -12
  10. package/dist/api/runtime.d.ts +12 -12
  11. package/dist/{api-client-Dk9QOLwr.d.mts → api-client-CFdv-Xgh.d.mts} +3 -3
  12. package/dist/{api-client-BJv9mTbO.d.ts → api-client-CvI5oOBE.d.ts} +3 -3
  13. package/dist/api.d.mts +17 -17
  14. package/dist/api.d.ts +17 -17
  15. package/dist/{app-DG3dE8v5.d.mts → app-2SBLAaNq.d.mts} +8 -8
  16. package/dist/{app-CAN_2Cqo.d.ts → app-BlXGEpdA.d.ts} +8 -8
  17. package/dist/{app-manifest-DazjgQya.d.ts → app-manifest-D1Tgp8ya.d.ts} +1 -1
  18. package/dist/{app-manifest-8x5VjZ0L.d.mts → app-manifest-nZHIvS3a.d.mts} +1 -1
  19. package/dist/app-markdown.d.mts +11 -11
  20. package/dist/app-markdown.d.ts +11 -11
  21. package/dist/{base-path-BU16ETmo.d.mts → base-path-leyrqXbX.d.mts} +1 -1
  22. package/dist/{base-path-BU16ETmo.d.ts → base-path-leyrqXbX.d.ts} +1 -1
  23. package/dist/{chunk-I5IO3ASU.cjs → chunk-2DZFF7F7.cjs} +268 -140
  24. package/dist/{chunk-YAD64RWI.cjs → chunk-2NROIAA6.cjs} +50 -50
  25. package/dist/{chunk-K5DHVEXC.mjs → chunk-2SLWGLZ7.mjs} +2 -2
  26. package/dist/{chunk-FHQZJJQR.mjs → chunk-3HEQSCVV.mjs} +1 -1
  27. package/dist/{chunk-VR64PHNT.mjs → chunk-7P475T2X.mjs} +206 -78
  28. package/dist/{chunk-2NCY6O6Q.mjs → chunk-FQUKOELE.mjs} +3 -3
  29. package/dist/{chunk-X6YOWNDZ.mjs → chunk-KQANE4Q4.mjs} +1 -1
  30. package/dist/{chunk-KVN3YEFF.cjs → chunk-NFME7OKZ.cjs} +6 -6
  31. package/dist/{chunk-2DZOABRK.cjs → chunk-OF4TXHM4.cjs} +1 -1
  32. package/dist/{chunk-SIVK2SRR.cjs → chunk-Q5F32A26.cjs} +43 -43
  33. package/dist/{chunk-FDCV5OCT.mjs → chunk-QSG2IX4A.mjs} +1 -1
  34. package/dist/{chunk-UN4B2TXC.cjs → chunk-XIZO5VDA.cjs} +2 -2
  35. package/dist/{client-plugins-nQ0tYt4l.d.mts → client-plugins-DEmIQo5R.d.mts} +1438 -1438
  36. package/dist/{client-plugins-BGS0wqzc.d.ts → client-plugins-br48Hpmk.d.ts} +1438 -1438
  37. package/dist/client-plugins.d.mts +10 -10
  38. package/dist/client-plugins.d.ts +10 -10
  39. package/dist/client.d.mts +17 -17
  40. package/dist/client.d.ts +17 -17
  41. package/dist/config.d.mts +10 -10
  42. package/dist/config.d.ts +10 -10
  43. package/dist/docs.d.mts +11 -11
  44. package/dist/docs.d.ts +11 -11
  45. package/dist/{endpoint-BOE0IAaG.d.ts → endpoint-BgHn0lhl.d.ts} +1 -1
  46. package/dist/{endpoint-DGZRZHux.d.mts → endpoint-BkMSCRf6.d.mts} +1 -1
  47. package/dist/environment/vite.d.mts +1 -1
  48. package/dist/environment/vite.d.ts +1 -1
  49. package/dist/i18n/client.d.mts +2 -2
  50. package/dist/i18n/client.d.ts +2 -2
  51. package/dist/i18n/index.d.mts +3 -3
  52. package/dist/i18n/index.d.ts +3 -3
  53. package/dist/i18n/server.d.mts +5 -5
  54. package/dist/i18n/server.d.ts +5 -5
  55. package/dist/image/server.d.mts +1 -1
  56. package/dist/image/server.d.ts +1 -1
  57. package/dist/image/sharp.d.mts +1 -1
  58. package/dist/image/sharp.d.ts +1 -1
  59. package/dist/{image-config-BpH1q5R8.d.ts → image-config-CeDgNyX4.d.mts} +1 -1
  60. package/dist/{image-config-BpH1q5R8.d.mts → image-config-CeDgNyX4.d.ts} +1 -1
  61. package/dist/image.d.mts +1 -1
  62. package/dist/image.d.ts +1 -1
  63. package/dist/{index-BJJfLxJo.d.mts → index-Cl3akY5U.d.mts} +2 -2
  64. package/dist/{index-Cy26isrh.d.ts → index-CyD9Rfso.d.ts} +2 -2
  65. package/dist/{index-CwoOP-MW.d.ts → index-MocnSP3a.d.ts} +2 -2
  66. package/dist/{index-y1jgR74U.d.mts → index-_nhUt_dh.d.mts} +2 -2
  67. package/dist/index.cjs +6 -6
  68. package/dist/index.d.mts +32 -32
  69. package/dist/index.d.ts +32 -32
  70. package/dist/index.mjs +5 -5
  71. package/dist/{instrumentation-runtime-CE06JLHZ.d.mts → instrumentation-runtime-CX9Zh-16.d.mts} +1 -1
  72. package/dist/{instrumentation-runtime-CE06JLHZ.d.ts → instrumentation-runtime-CX9Zh-16.d.ts} +1 -1
  73. package/dist/instrumentation.d.mts +2 -2
  74. package/dist/instrumentation.d.ts +2 -2
  75. package/dist/integrations.d.mts +10 -10
  76. package/dist/integrations.d.ts +10 -10
  77. package/dist/internal/app-markdown-runtime.d.mts +11 -11
  78. package/dist/internal/app-markdown-runtime.d.ts +11 -11
  79. package/dist/internal/build-runtime.cjs +6 -6
  80. package/dist/internal/build-runtime.d.mts +12 -12
  81. package/dist/internal/build-runtime.d.ts +12 -12
  82. package/dist/internal/build-runtime.mjs +5 -5
  83. package/dist/internal/client-error-overlay.cjs +4 -4
  84. package/dist/internal/client-error-overlay.mjs +1 -1
  85. package/dist/internal/client-runtime.d.mts +1 -1
  86. package/dist/internal/client-runtime.d.ts +1 -1
  87. package/dist/internal/compression-runtime.d.mts +10 -10
  88. package/dist/internal/compression-runtime.d.ts +10 -10
  89. package/dist/internal/config-runtime.d.mts +11 -11
  90. package/dist/internal/config-runtime.d.ts +11 -11
  91. package/dist/internal/form-actions.d.mts +1 -1
  92. package/dist/internal/form-actions.d.ts +1 -1
  93. package/dist/internal/islx-client.d.mts +4 -0
  94. package/dist/internal/islx-client.d.ts +4 -0
  95. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  96. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  97. package/dist/internal/production-runtime.cjs +4 -4
  98. package/dist/internal/production-runtime.d.mts +25 -25
  99. package/dist/internal/production-runtime.d.ts +25 -25
  100. package/dist/internal/production-runtime.mjs +3 -3
  101. package/dist/{layers-CM5i6T7z.d.mts → layers-D9fbe-rz.d.mts} +1 -1
  102. package/dist/{layers-CM5i6T7z.d.ts → layers-D9fbe-rz.d.ts} +1 -1
  103. package/dist/markdown.d.mts +10 -10
  104. package/dist/markdown.d.ts +10 -10
  105. package/dist/middleware.d.mts +12 -12
  106. package/dist/middleware.d.ts +12 -12
  107. package/dist/navigation.d.mts +13 -13
  108. package/dist/navigation.d.ts +13 -13
  109. package/dist/{observability-CoXunYhS.d.mts → observability-B2363jB6.d.mts} +1 -1
  110. package/dist/{observability-CoXunYhS.d.ts → observability-B2363jB6.d.ts} +1 -1
  111. package/dist/observability.d.mts +1 -1
  112. package/dist/observability.d.ts +1 -1
  113. package/dist/og.d.mts +0 -5
  114. package/dist/og.d.ts +0 -5
  115. package/dist/plugin.cjs +5 -5
  116. package/dist/plugin.d.mts +12 -12
  117. package/dist/plugin.d.ts +12 -12
  118. package/dist/plugin.mjs +4 -4
  119. package/dist/{production-runtime-ClFA_1KQ.d.mts → production-runtime-BEbIyIUe.d.mts} +4 -4
  120. package/dist/{production-runtime-BVMDgHrA.d.ts → production-runtime-DsHjccVI.d.ts} +4 -4
  121. package/dist/{ssg-XnMHCyEc.d.ts → programmatic-routes-client-DlMKstmL.d.ts} +57 -57
  122. package/dist/{ssg-ByrOVYdM.d.mts → programmatic-routes-client-Dqr6tHND.d.mts} +57 -57
  123. package/dist/{render-plan-CoSovy_O.d.mts → render-plan-Bu6XOxNg.d.mts} +1 -1
  124. package/dist/{render-plan-y2DefWf8.d.ts → render-plan-MefW_fLC.d.ts} +1 -1
  125. package/dist/renderer/react/server.d.mts +1 -1
  126. package/dist/renderer/react/server.d.ts +1 -1
  127. package/dist/renderer-client.d.mts +12 -12
  128. package/dist/renderer-client.d.ts +12 -12
  129. package/dist/{request-cNM09Q7e.d.mts → request-BBe1B8Bk.d.mts} +1 -1
  130. package/dist/{request-aG5Wovm5.d.ts → request-CMsRJQK3.d.ts} +1 -1
  131. package/dist/request.d.mts +11 -11
  132. package/dist/request.d.ts +11 -11
  133. package/dist/{resolver-khasx3fU.d.mts → resolver-C2G-3Tm6.d.mts} +1 -1
  134. package/dist/{resolver-DadfRL6F.d.ts → resolver-DC57A4vz.d.ts} +1 -1
  135. package/dist/{integration-api-DWyMmvrR.d.mts → route-2_yXC6gv.d.mts} +100 -100
  136. package/dist/{integration-api-BuPHMeKz.d.ts → route-DFhZj6jN.d.ts} +100 -100
  137. package/dist/{route-pattern-W-SsJGSp.d.mts → route-pattern-CVsVbq5n.d.mts} +1 -1
  138. package/dist/{route-pattern-W-SsJGSp.d.ts → route-pattern-CVsVbq5n.d.ts} +1 -1
  139. package/dist/{route-rendering-EyInfsjI.d.mts → route-rendering-DTLNruPw.d.ts} +1 -1
  140. package/dist/{route-rendering-B3uQmCWX.d.ts → route-rendering-Do8tuYgh.d.mts} +1 -1
  141. package/dist/{router-DNUf-Bg1.d.ts → router-BJreOZ-k.d.ts} +2 -2
  142. package/dist/{router-Devibh4r.d.mts → router-o2mZB9Y4.d.mts} +2 -2
  143. package/dist/routes.d.mts +11 -11
  144. package/dist/routes.d.ts +11 -11
  145. package/dist/{runtime-BgDQzBiu.d.ts → runtime-B9HmxiZc.d.ts} +2 -2
  146. package/dist/{runtime-CV2UCV-5.d.mts → runtime-CCxTmGuf.d.mts} +2 -2
  147. package/dist/{runtime-CLr9P5kn.d.ts → runtime-Cp5YZNz4.d.mts} +5 -5
  148. package/dist/{runtime-9KZb8AI5.d.mts → runtime-Da57KD8F.d.ts} +5 -5
  149. package/dist/server-action-security.d.mts +1 -1
  150. package/dist/server-action-security.d.ts +1 -1
  151. package/dist/server-fn-client.d.mts +4 -4
  152. package/dist/server-fn-client.d.ts +4 -4
  153. package/dist/{server-fn-error-DDh14a0V.d.mts → server-fn-error-DrcH9cc1.d.mts} +1 -1
  154. package/dist/{server-fn-error-DDh14a0V.d.ts → server-fn-error-DrcH9cc1.d.ts} +1 -1
  155. package/dist/server-fn.d.mts +3 -3
  156. package/dist/server-fn.d.ts +3 -3
  157. package/dist/server-plugins.d.mts +11 -11
  158. package/dist/server-plugins.d.ts +11 -11
  159. package/dist/server-query-client.d.mts +2 -2
  160. package/dist/server-query-client.d.ts +2 -2
  161. package/dist/server-query.d.mts +2 -2
  162. package/dist/server-query.d.ts +2 -2
  163. package/dist/server.cjs +14 -14
  164. package/dist/server.d.mts +20 -20
  165. package/dist/server.d.ts +20 -20
  166. package/dist/server.mjs +4 -4
  167. package/dist/{spa-router-Ds6R_oe-.d.ts → spa-router-CN2vc0GY.d.ts} +4 -4
  168. package/dist/{spa-router-BIxh4IY-.d.mts → spa-router-COZLIB7k.d.mts} +4 -4
  169. package/dist/storage.d.mts +3 -3
  170. package/dist/storage.d.ts +3 -3
  171. package/dist/testing.d.mts +12 -12
  172. package/dist/testing.d.ts +12 -12
  173. package/dist/theme/server.d.mts +1 -1
  174. package/dist/theme/server.d.ts +1 -1
  175. package/dist/{types-CnH8DOqo.d.mts → types--Wh02r5_.d.mts} +1 -1
  176. package/dist/{types-CnH8DOqo.d.ts → types--Wh02r5_.d.ts} +1 -1
  177. package/dist/{types-Cc8l9IqS.d.ts → types-BnIqOn9w.d.mts} +1 -1
  178. package/dist/{types-Cc8l9IqS.d.mts → types-BnIqOn9w.d.ts} +1 -1
  179. package/dist/{utils-BN70ueSN.d.ts → utils-BAtVIHfw.d.mts} +2 -2
  180. package/dist/{utils-BrjR5xRs.d.mts → utils-Y8MZrj4b.d.ts} +2 -2
  181. package/dist/version.cjs +2 -2
  182. package/dist/version.mjs +1 -1
  183. package/dist/vite.cjs +5 -5
  184. package/dist/vite.d.mts +14 -14
  185. package/dist/vite.d.ts +14 -14
  186. package/dist/vite.mjs +4 -4
  187. package/dist/{workflows-IWP1ddBm.d.mts → workflows-Df1C_7OG.d.mts} +1 -1
  188. package/dist/{workflows-IWP1ddBm.d.ts → workflows-Df1C_7OG.d.ts} +1 -1
  189. package/dist/workflows.d.mts +1 -1
  190. package/dist/workflows.d.ts +1 -1
  191. package/package.json +3 -3
@@ -11,7 +11,7 @@ var _chunkCGR525MJcjs = require('./chunk-CGR525MJ.cjs');
11
11
 
12
12
 
13
13
 
14
- var _chunkKVN3YEFFcjs = require('./chunk-KVN3YEFF.cjs');
14
+ var _chunkNFME7OKZcjs = require('./chunk-NFME7OKZ.cjs');
15
15
 
16
16
 
17
17
 
@@ -82,7 +82,7 @@ var _chunk2SJ4RQ6Pcjs = require('./chunk-2SJ4RQ6P.cjs');
82
82
 
83
83
 
84
84
 
85
- var _chunkSIVK2SRRcjs = require('./chunk-SIVK2SRR.cjs');
85
+ var _chunkQ5F32A26cjs = require('./chunk-Q5F32A26.cjs');
86
86
 
87
87
 
88
88
  var _chunk45QJHGZMcjs = require('./chunk-45QJHGZM.cjs');
@@ -109,7 +109,7 @@ var _chunk3XEMGDBFcjs = require('./chunk-3XEMGDBF.cjs');
109
109
 
110
110
 
111
111
 
112
- var _chunkUN4B2TXCcjs = require('./chunk-UN4B2TXC.cjs');
112
+ var _chunkXIZO5VDAcjs = require('./chunk-XIZO5VDA.cjs');
113
113
 
114
114
 
115
115
  var _chunkTI7UANHIcjs = require('./chunk-TI7UANHI.cjs');
@@ -224,7 +224,7 @@ var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
224
224
  var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
225
225
 
226
226
 
227
- var _chunk2DZOABRKcjs = require('./chunk-2DZOABRK.cjs');
227
+ var _chunkOF4TXHM4cjs = require('./chunk-OF4TXHM4.cjs');
228
228
 
229
229
 
230
230
  var _chunkC5GUTBZKcjs = require('./chunk-C5GUTBZK.cjs');
@@ -1965,7 +1965,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
1965
1965
  }
1966
1966
  const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
1967
1967
  await fs4.writeFile(fontCssPath, normalizedFontCss);
1968
- await fs4.writeFile(clientCssPath, _chunkSIVK2SRRcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
1968
+ await fs4.writeFile(clientCssPath, _chunkQ5F32A26cjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
1969
1969
  }
1970
1970
  _chunkS3JO3N4Hcjs.__name.call(void 0, mergeBuiltFontCss, "mergeBuiltFontCss");
1971
1971
  var _IncompleteClientBuildOutputError = class _IncompleteClientBuildOutputError extends Error {
@@ -2015,7 +2015,7 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
2015
2015
  const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${options.serverOwners === true}\0${_path2.default.resolve(modulePath)}`;
2016
2016
  let plan = cache.get(key);
2017
2017
  if (!plan) {
2018
- plan = _chunkSIVK2SRRcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
2018
+ plan = _chunkQ5F32A26cjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
2019
2019
  cache.set(key, plan);
2020
2020
  }
2021
2021
  return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
@@ -2044,14 +2044,14 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2044
2044
  `[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
2045
2045
  );
2046
2046
  }
2047
- const isolatedMode = _chunkSIVK2SRRcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
2047
+ const isolatedMode = _chunkQ5F32A26cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
2048
2048
  _optionalChain([config, 'access', _39 => _39.experimental, 'optionalAccess', _40 => _40.isolatedClientHydration]),
2049
2049
  {
2050
2050
  serverComponents: _chunkPDU4P2ICcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _41 => _41.experimental, 'optionalAccess', _42 => _42.serverComponents])) === "rsc",
2051
2051
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
2052
2052
  }
2053
2053
  );
2054
- const planOptions = _chunkSIVK2SRRcjs.getFarmClientHydrationPlanOptions.call(void 0,
2054
+ const planOptions = _chunkQ5F32A26cjs.getFarmClientHydrationPlanOptions.call(void 0,
2055
2055
  config.renderer,
2056
2056
  Boolean(unsupportedIntegrationProvider)
2057
2057
  );
@@ -2102,7 +2102,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2102
2102
  };
2103
2103
  }
2104
2104
  });
2105
- const layoutAppliesToRoute = _chunkUN4B2TXCcjs.routeBoundaryCoversDirectory;
2105
+ const layoutAppliesToRoute = _chunkXIZO5VDAcjs.routeBoundaryCoversDirectory;
2106
2106
  const routeDirectory = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (route) => _nullishCoalesce(route.directory, () => ( route.pattern)), "routeDirectory");
2107
2107
  const adapterOwnsDocsRuntime = Boolean(
2108
2108
  _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _45 => _45.docs, 'optionalAccess', _46 => _46.enabled]) && _optionalChain([config, 'access', _47 => _47.docs, 'access', _48 => _48.adapter, 'optionalAccess', _49 => _49.server]) && config.docs.adapter.react
@@ -2113,7 +2113,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2113
2113
  ), "isAdapterDocsRoute");
2114
2114
  const syntheticDocsEntry = _optionalChain([config, 'access', _52 => _52.docs, 'optionalAccess', _53 => _53.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
2115
2115
  const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
2116
- const markdownPagePlan = _chunkSIVK2SRRcjs.createMarkdownPageHydrationPlanner.call(void 0,
2116
+ const markdownPagePlan = _chunkQ5F32A26cjs.createMarkdownPageHydrationPlanner.call(void 0,
2117
2117
  _chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), root),
2118
2118
  root,
2119
2119
  isolatedMode,
@@ -2129,7 +2129,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2129
2129
  pagePlanOptions
2130
2130
  )
2131
2131
  }));
2132
- _chunkSIVK2SRRcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
2132
+ _chunkQ5F32A26cjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
2133
2133
  clientLayouts.map((layout) => ({
2134
2134
  pattern: layout.pattern,
2135
2135
  depth: layout.pattern.split("/").filter(Boolean).length,
@@ -2138,7 +2138,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2138
2138
  [
2139
2139
  ...routePlans.map(({ route, metadata }) => ({
2140
2140
  pattern: routeDirectory(route),
2141
- depth: _chunkUN4B2TXCcjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
2141
+ depth: _chunkXIZO5VDAcjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
2142
2142
  metadata
2143
2143
  })),
2144
2144
  ...syntheticDocsPatterns.map((pattern) => ({
@@ -2161,7 +2161,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2161
2161
  for (const layout of clientLayouts) {
2162
2162
  const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || Boolean(adapterDocsEntry && layoutAppliesToRoute(layout.pattern, adapterDocsEntry));
2163
2163
  if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
2164
- _chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${_chunkSIVK2SRRcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
2164
+ _chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${_chunkQ5F32A26cjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
2165
2165
  }
2166
2166
  }
2167
2167
  if (isolatedMode === "analyze") {
@@ -2185,7 +2185,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2185
2185
  );
2186
2186
  if (metadata.suppressedAsyncHydration) {
2187
2187
  _chunk5QIKR7RRcjs.logger.warn(
2188
- `\u26A0\uFE0F ${_chunkSIVK2SRRcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
2188
+ `\u26A0\uFE0F ${_chunkQ5F32A26cjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
2189
2189
  );
2190
2190
  }
2191
2191
  if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0) {
@@ -2210,7 +2210,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2210
2210
  ...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries).flatMap((layout) => layout.isolatedBoundaries)
2211
2211
  ],
2212
2212
  // The server renders a server tree only below a hydrating layout.
2213
- ..._chunkSIVK2SRRcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
2213
+ ..._chunkQ5F32A26cjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
2214
2214
  });
2215
2215
  _chunk5QIKR7RRcjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
2216
2216
  }
@@ -2246,7 +2246,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2246
2246
  }
2247
2247
  const clientRouteSlots = routeSlots.filter((slot) => {
2248
2248
  try {
2249
- return _chunkSIVK2SRRcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
2249
+ return _chunkQ5F32A26cjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
2250
2250
  } catch (error) {
2251
2251
  _chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
2252
2252
  return false;
@@ -2276,7 +2276,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2276
2276
  config.trailingSlash,
2277
2277
  _chunkB6XAA7V6cjs.getIntegrationProviders.call(void 0, config.integrations),
2278
2278
  config.basePath,
2279
- _chunkSIVK2SRRcjs.generateClientCachePersistenceCode.call(void 0, _chunkSIVK2SRRcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
2279
+ _chunkQ5F32A26cjs.generateClientCachePersistenceCode.call(void 0, _chunkQ5F32A26cjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
2280
2280
  adapterOwnsDocsRuntime ? _chunkCY2ZQ5C6cjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
2281
2281
  _chunkPDU4P2ICcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _59 => _59.experimental, 'optionalAccess', _60 => _60.serverComponents])) === "islands"
2282
2282
  );
@@ -2365,7 +2365,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2365
2365
  }
2366
2366
  },
2367
2367
  plugins: [
2368
- _chunkSIVK2SRRcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
2368
+ _chunkQ5F32A26cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
2369
2369
  createFarmPrivateClientSourcemapsPlugin({
2370
2370
  outDir: _path2.default.join(_path2.default.dirname(outputDir), FARM_CLIENT_SOURCEMAPS_DIR)
2371
2371
  }),
@@ -2390,7 +2390,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2390
2390
  ...rendererVitePlugins,
2391
2391
  ...config.vite.plugins || [],
2392
2392
  farmServerOnlyEntriesPlugin(),
2393
- _chunkSIVK2SRRcjs.farmDocsClientConfigPlugin.call(void 0,
2393
+ _chunkQ5F32A26cjs.farmDocsClientConfigPlugin.call(void 0,
2394
2394
  adapterOwnsDocsRuntime ? _chunkCY2ZQ5C6cjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
2395
2395
  ),
2396
2396
  // Plugin to redirect @farm.js/core imports to client-only exports
@@ -2452,7 +2452,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2452
2452
  } : void 0,
2453
2453
  // Ensure React is bundled for client
2454
2454
  resolve: {
2455
- alias: _chunkSIVK2SRRcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
2455
+ alias: _chunkQ5F32A26cjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
2456
2456
  dedupe: [...config.renderer.dedupe || []]
2457
2457
  },
2458
2458
  // Optimize dependencies - exclude server-side code from client bundle
@@ -2465,7 +2465,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2465
2465
  ]
2466
2466
  }
2467
2467
  };
2468
- await viteBuild(_chunkSIVK2SRRcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
2468
+ await viteBuild(_chunkQ5F32A26cjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
2469
2469
  await mergeBuiltFontCss(outputDir);
2470
2470
  await validateClientBuildOutput(root, srcDir, outputDir);
2471
2471
  } finally {
@@ -3260,7 +3260,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
3260
3260
  direction: {}
3261
3261
  }, plugins = [], renderer = _chunkPSV6XKPOcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false) {
3262
3262
  const toImportPath = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (targetPath) => targetPath.replace(/\\/g, "/"), "toImportPath");
3263
- const clientPluginEntry = _chunkSIVK2SRRcjs.generateFarmClientPluginEntryCode.call(void 0,
3263
+ const clientPluginEntry = _chunkQ5F32A26cjs.generateFarmClientPluginEntryCode.call(void 0,
3264
3264
  plugins,
3265
3265
  root,
3266
3266
  srcDir,
@@ -3271,7 +3271,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
3271
3271
  import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
3272
3272
  import __farmAppSetup from ${JSON.stringify(_chunk5QIKR7RRcjs.toPosixPath.call(void 0, appSetupPath))};
3273
3273
  __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
3274
- const providerClientCode = _chunkSIVK2SRRcjs.generateFarmIntegrationProviderClientCode.call(void 0,
3274
+ const providerClientCode = _chunkQ5F32A26cjs.generateFarmIntegrationProviderClientCode.call(void 0,
3275
3275
  integrationProviders,
3276
3276
  root,
3277
3277
  _nullishCoalesce(renderer.componentExtensions, () => ( []))
@@ -3283,12 +3283,12 @@ __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot
3283
3283
  const hydratingLayoutPatterns = layoutRoutes.filter((layout) => layout.shouldHydrate).map((layout) => layout.pattern);
3284
3284
  layoutRoutes.forEach((layout, index) => {
3285
3285
  const relativePath = toImportPath(layout.modulePath);
3286
- const rendersOnClient = !layout.hasIsolatedClientBoundaries && hydratingLayoutPatterns.some((pattern) => _chunkKVN3YEFFcjs.layoutsCanCoverSamePage.call(void 0, layout.pattern, pattern));
3286
+ const rendersOnClient = !layout.hasIsolatedClientBoundaries && hydratingLayoutPatterns.some((pattern) => _chunkNFME7OKZcjs.layoutsCanCoverSamePage.call(void 0, layout.pattern, pattern));
3287
3287
  if (rendersOnClient) {
3288
3288
  layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
3289
3289
  }
3290
- const groupScope = _chunkUN4B2TXCcjs.getRouteGroupScope.call(void 0, layout.pattern);
3291
- const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(_chunkUN4B2TXCcjs.stripRouteGroups.call(void 0, layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
3290
+ const groupScope = _chunkXIZO5VDAcjs.getRouteGroupScope.call(void 0, layout.pattern);
3291
+ const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(_chunkXIZO5VDAcjs.stripRouteGroups.call(void 0, layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
3292
3292
  layoutRegistrations.push(
3293
3293
  ` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${rendersOnClient ? `Layout${index}` : "null"}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)} }`
3294
3294
  );
@@ -3585,7 +3585,7 @@ void farmClientRuntime.start();
3585
3585
  spaRouter.initializeHistory();
3586
3586
  window.__FARM_SPA_ROUTER__ = spaRouter;
3587
3587
 
3588
- void hydrateFarmDocsAdapterRuntime();
3588
+ ${islandValues ? "void farmDocumentParsed().then(hydrateFarmDocsAdapterRuntime);" : "void hydrateFarmDocsAdapterRuntime();"}
3589
3589
 
3590
3590
  window.addEventListener("beforeunload", function(event) {
3591
3591
  if (spaRouter.shouldBlockUnload()) {
@@ -3791,7 +3791,7 @@ function hasHydratableLayout(pathname) {
3791
3791
  });
3792
3792
  }
3793
3793
 
3794
- ${_chunkSIVK2SRRcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
3794
+ ${_chunkQ5F32A26cjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
3795
3795
  // Wrap a page element with applicable layouts
3796
3796
  function wrapWithLayouts(pageElement, pathname, params) {
3797
3797
  const layouts = getApplicableLayouts(pathname);
@@ -4123,19 +4123,37 @@ function resetReactRoot() {
4123
4123
  isHydrated = false;
4124
4124
  }
4125
4125
 
4126
- // Hydrate client components
4126
+ ${islandValues ? `// Islands mode starts the client while the body streams (an async entry): a page of islands
4127
+ // hydrates them as they arrive; anything else waits for the whole document.
4128
+ function farmDocumentParsed() {
4129
+ if (document.readyState !== "loading") return Promise.resolve();
4130
+ return new Promise(function(resolve) {
4131
+ document.addEventListener("DOMContentLoaded", function() { resolve(); }, { once: true });
4132
+ });
4133
+ }
4134
+
4135
+ ` : ""}// Hydrate client components
4127
4136
  async function hydrate() {
4128
4137
  await window.__FARM_PPR_REFRESH_PROMISE__;
4129
4138
  // A PPR refresh that is still retrying must not replace DOM once hydration starts.
4130
4139
  window.__FARM_PPR_HYDRATING__ = true;
4131
4140
  await farmClientRuntime.start();
4132
4141
 
4142
+ const pathname = window.location.pathname;
4143
+ const matched = matchRoute(pathname);
4144
+ ${islandValues ? `if (
4145
+ !matched ||
4146
+ !matched.route.hasIsolatedClientBoundaries ||
4147
+ matched.route.pageShouldHydrate ||
4148
+ hasHydratableLayout(pathname)
4149
+ ) {
4150
+ await farmDocumentParsed();
4151
+ }` : ""}
4152
+
4133
4153
  if (await hydrateFarmDocsAdapterRuntime()) {
4134
4154
  return;
4135
4155
  }
4136
4156
 
4137
- const pathname = window.location.pathname;
4138
- const matched = matchRoute(pathname);
4139
4157
  hydrateInitialRouteSlots();
4140
4158
 
4141
4159
  if (!matched) {
@@ -4938,7 +4956,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4938
4956
  }
4939
4957
  const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
4940
4958
  const instrumentationPath = _chunkKCMTCM6Icjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
4941
- const notFoundPath = _chunkSIVK2SRRcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
4959
+ const notFoundPath = _chunkQ5F32A26cjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
4942
4960
  if (notFoundPath) _chunk5QIKR7RRcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
4943
4961
  layoutRoutes.sort((a, b) => {
4944
4962
  const depthA = a.pattern.split("/").filter(Boolean).length;
@@ -4960,7 +4978,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4960
4978
  );
4961
4979
  const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
4962
4980
  const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _67 => _67.mdx, 'optionalAccess', _68 => _68.components]));
4963
- const hasMiddlewareConfig = _chunkUN4B2TXCcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
4981
+ const hasMiddlewareConfig = _chunkXIZO5VDAcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
4964
4982
  const hasRouteContextConfig = _chunkLPE3ED4Rcjs.hasCustomFarmRouteContext.call(void 0, config);
4965
4983
  const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
4966
4984
  const hasPluginRoutes = hasFarmPluginRoutes(config);
@@ -5144,7 +5162,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5144
5162
  __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _79 => _79.env, 'optionalAccess', _80 => _80.public]) || {})
5145
5163
  },
5146
5164
  plugins: [
5147
- _chunkSIVK2SRRcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
5165
+ _chunkQ5F32A26cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
5148
5166
  ...tailwindVitePlugin ? [tailwindVitePlugin] : [],
5149
5167
  ...rendererVitePlugins,
5150
5168
  ...config.vite.plugins || [],
@@ -5197,7 +5215,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5197
5215
  resolve: {
5198
5216
  alias: [
5199
5217
  ...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
5200
- ...Object.entries(_chunkSIVK2SRRcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
5218
+ ...Object.entries(_chunkQ5F32A26cjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
5201
5219
  ([find, replacement]) => ({ find, replacement })
5202
5220
  )
5203
5221
  ],
@@ -5205,7 +5223,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5205
5223
  dedupe: [...config.renderer.dedupe || []]
5206
5224
  }
5207
5225
  };
5208
- await viteBuild(_chunkSIVK2SRRcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
5226
+ await viteBuild(_chunkQ5F32A26cjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
5209
5227
  } finally {
5210
5228
  if (postcssConfigDir) {
5211
5229
  try {
@@ -5253,7 +5271,7 @@ function getFarmDocsGuardedPaths(config, middlewareRoutes) {
5253
5271
  config: { middleware: config.middleware, integrations: config.integrations },
5254
5272
  middlewareRoutes
5255
5273
  };
5256
- return _chunkMY5PZYADcjs.discoverFarmDocsPages.call(void 0, contentDir, config.docs).flatMap((page) => [page.href, _chunkMY5PZYADcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunkUN4B2TXCcjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
5274
+ return _chunkMY5PZYADcjs.discoverFarmDocsPages.call(void 0, contentDir, config.docs).flatMap((page) => [page.href, _chunkMY5PZYADcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunkXIZO5VDAcjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
5257
5275
  }
5258
5276
  _chunkS3JO3N4Hcjs.__name.call(void 0, getFarmDocsGuardedPaths, "getFarmDocsGuardedPaths");
5259
5277
  function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
@@ -5655,7 +5673,7 @@ function renderFarmRouteServerTree(element, extra) { return element; }`;
5655
5673
  const hasGeneratedMetadataImages = metadataImageRoutes.some(
5656
5674
  (image) => image.sourceType === "module"
5657
5675
  );
5658
- const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunkUN4B2TXCcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
5676
+ const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunkXIZO5VDAcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
5659
5677
  const farmDocsFontAssets = _optionalChain([config, 'access', _108 => _108.docs, 'optionalAccess', _109 => _109.enabled]) ? _chunkHREOKQWTcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkHREOKQWTcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
5660
5678
  const integrationProviders = _chunkB6XAA7V6cjs.getIntegrationProviders.call(void 0, config.integrations);
5661
5679
  const renderedIntegrationProviders = integrationProviders.filter(
@@ -5666,7 +5684,7 @@ function renderFarmRouteServerTree(element, extra) { return element; }`;
5666
5684
  `Integration provider components are not supported by the "${config.renderer.name}" renderer.`
5667
5685
  );
5668
5686
  }
5669
- const providerServerModules = _chunkSIVK2SRRcjs.generateFarmIntegrationProviderServerModules.call(void 0,
5687
+ const providerServerModules = _chunkQ5F32A26cjs.generateFarmIntegrationProviderServerModules.call(void 0,
5670
5688
  renderedIntegrationProviders,
5671
5689
  config.root,
5672
5690
  _nullishCoalesce(config.renderer.componentExtensions, () => ( []))
@@ -5686,14 +5704,14 @@ function renderFarmRouteServerTree(element, extra) { return element; }`;
5686
5704
  const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
5687
5705
  (provider) => provider.supportsIsolatedHydration !== true
5688
5706
  );
5689
- const isolatedHydrationMode = _chunkSIVK2SRRcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
5707
+ const isolatedHydrationMode = _chunkQ5F32A26cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
5690
5708
  _optionalChain([config, 'access', _112 => _112.experimental, 'optionalAccess', _113 => _113.isolatedClientHydration]),
5691
5709
  {
5692
5710
  serverComponents: _chunkPDU4P2ICcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _114 => _114.experimental, 'optionalAccess', _115 => _115.serverComponents])) === "rsc",
5693
5711
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
5694
5712
  }
5695
5713
  );
5696
- const hydrationPlanOptions = _chunkSIVK2SRRcjs.getFarmClientHydrationPlanOptions.call(void 0,
5714
+ const hydrationPlanOptions = _chunkQ5F32A26cjs.getFarmClientHydrationPlanOptions.call(void 0,
5697
5715
  config.renderer,
5698
5716
  Boolean(unsupportedIntegrationProvider)
5699
5717
  );
@@ -5711,7 +5729,7 @@ function renderFarmRouteServerTree(element, extra) { return element; }`;
5711
5729
  hydrationPlanOptions
5712
5730
  )
5713
5731
  }));
5714
- const markdownPagePlan = _chunkSIVK2SRRcjs.createMarkdownPageHydrationPlanner.call(void 0,
5732
+ const markdownPagePlan = _chunkQ5F32A26cjs.createMarkdownPageHydrationPlanner.call(void 0,
5715
5733
  _chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
5716
5734
  config.root,
5717
5735
  isolatedHydrationMode,
@@ -5729,7 +5747,7 @@ function renderFarmRouteServerTree(element, extra) { return element; }`;
5729
5747
  )
5730
5748
  ])
5731
5749
  );
5732
- _chunkSIVK2SRRcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
5750
+ _chunkQ5F32A26cjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
5733
5751
  layoutHydrationPlans.map((layout) => ({
5734
5752
  pattern: layout.pattern,
5735
5753
  depth: layout.pattern.split("/").filter(Boolean).length,
@@ -5738,10 +5756,10 @@ function renderFarmRouteServerTree(element, extra) { return element; }`;
5738
5756
  pageRoutes.map((route) => ({
5739
5757
  // Compared by directory so a grouped layout applies only inside its group.
5740
5758
  pattern: _nullishCoalesce(route.directory, () => ( route.pattern)),
5741
- depth: _chunkUN4B2TXCcjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
5759
+ depth: _chunkXIZO5VDAcjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
5742
5760
  metadata: pageHydrationPlans.get(route.modulePath)
5743
5761
  })),
5744
- _chunkUN4B2TXCcjs.routeBoundaryCoversDirectory
5762
+ _chunkXIZO5VDAcjs.routeBoundaryCoversDirectory
5745
5763
  );
5746
5764
  const providerServerImports = [
5747
5765
  providerServerModules.hasClerkProvider ? `import { ClerkProvider as FarmClerkProvider } from "@clerk/react";` : "",
@@ -5803,7 +5821,7 @@ function renderFarmRouteServerTree(element, extra) { return element; }`;
5803
5821
  module: ${varName},
5804
5822
  shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
5805
5823
  clientModule: ${JSON.stringify(_chunk5QIKR7RRcjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
5806
- islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkSIVK2SRRcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${renderingDirective ? `
5824
+ islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkQ5F32A26cjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${renderingDirective ? `
5807
5825
  rendering: ${JSON.stringify(renderingDirective)},` : ""}
5808
5826
  ${route.source !== void 0 ? `markdownSource: {
5809
5827
  source: ${JSON.stringify(route.source)},
@@ -5860,12 +5878,12 @@ function renderFarmRouteServerTree(element, extra) { return element; }`;
5860
5878
  errorImports.push(
5861
5879
  `import * as ${varName} from ${toVirtualEntryImportSpecifier(errorRoute.modulePath)};`
5862
5880
  );
5863
- const groupScope = _chunkUN4B2TXCcjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
5881
+ const groupScope = _chunkXIZO5VDAcjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
5864
5882
  errorRegistrations.push(`
5865
5883
  {
5866
- pattern: ${JSON.stringify(_chunkUN4B2TXCcjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
5884
+ pattern: ${JSON.stringify(_chunkXIZO5VDAcjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
5867
5885
  groupScope: ${JSON.stringify(groupScope)},
5868
- directoryDepth: ${_chunkUN4B2TXCcjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
5886
+ directoryDepth: ${_chunkXIZO5VDAcjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
5869
5887
  module: ${varName},
5870
5888
  }`);
5871
5889
  });
@@ -6061,7 +6079,7 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
6061
6079
  const integrationRuntimeImport = integrationRuntimeExports.length ? `import { ${integrationRuntimeExports.join(", ")} } from "@farm.js/core/integrations";` : "";
6062
6080
  const instrumentationImport = instrumentationPath ? `import * as FarmInstrumentationModule from ${toVirtualEntryImportSpecifier(instrumentationPath)};` : "";
6063
6081
  const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
6064
- const nativeMCP = _chunkKVN3YEFFcjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
6082
+ const nativeMCP = _chunkNFME7OKZcjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
6065
6083
  const integrationImports = `
6066
6084
  ${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
6067
6085
  ${layerConfigImports}
@@ -6069,7 +6087,7 @@ ${integrationRuntimeImport}
6069
6087
  ${nativeAuth.importSource}
6070
6088
  ${nativeMCP.importSource}
6071
6089
  `;
6072
- const imageRuntime = _chunkSIVK2SRRcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
6090
+ const imageRuntime = _chunkQ5F32A26cjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
6073
6091
  const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
6074
6092
  const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
6075
6093
  const apiHandlerCode = apiRoutes.length > 0 ? `
@@ -6248,7 +6266,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
6248
6266
 
6249
6267
  function FarmDefault404Page() {
6250
6268
  return React.createElement(React.Fragment, null,
6251
- React.createElement("style", null, ${JSON.stringify(_chunkSIVK2SRRcjs.DEFAULT_NOT_FOUND_STYLES)}),
6269
+ React.createElement("style", null, ${JSON.stringify(_chunkQ5F32A26cjs.DEFAULT_NOT_FOUND_STYLES)}),
6252
6270
  React.createElement("main", {
6253
6271
  className: "farm-default-not-found",
6254
6272
  "aria-labelledby": "farm-default-not-found-title",
@@ -6551,12 +6569,12 @@ function fetchFarmInnerRequest(request, context) {
6551
6569
  }
6552
6570
  const farmLocalAPIBasePath = ${JSON.stringify(_chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, config.api))};
6553
6571
  const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
6554
- ${_optionalChain([config, 'access', _147 => _147.agent, 'optionalAccess', _148 => _148.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkUN4B2TXCcjs.resolveFarmApiCatalogInput.call(void 0, config))};
6572
+ ${_optionalChain([config, 'access', _147 => _147.agent, 'optionalAccess', _148 => _148.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkXIZO5VDAcjs.resolveFarmApiCatalogInput.call(void 0, config))};
6555
6573
  ` : ""}${_optionalChain([config, 'access', _149 => _149.agent, 'optionalAccess', _150 => _150.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
6556
- _chunkUN4B2TXCcjs.resolveFarmAppManifestInput.call(void 0, config, {
6574
+ _chunkXIZO5VDAcjs.resolveFarmAppManifestInput.call(void 0, config, {
6557
6575
  build: config.deploymentId,
6558
- packages: _chunkSIVK2SRRcjs.resolveFarmAppPackages.call(void 0, config.root),
6559
- webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkSIVK2SRRcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
6576
+ packages: _chunkQ5F32A26cjs.resolveFarmAppPackages.call(void 0, config.root),
6577
+ webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkQ5F32A26cjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
6560
6578
  })
6561
6579
  )};
6562
6580
  ${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
@@ -6678,8 +6696,9 @@ function renderFarmRendererHydrationScript() {
6678
6696
  : "";
6679
6697
  }
6680
6698
 
6681
- function renderFarmClientEntryScript() {
6682
- return stampFarmCspNonce('<script type="module" src="/__farm_client_js_src__"></script>');
6699
+ function renderFarmClientEntryScript(early) {
6700
+ // An early entry runs as soon as it loads, while the body still streams.
6701
+ return stampFarmCspNonce('<script type="module"' + (early ? ' async' : '') + ' src="/__farm_client_js_src__"></script>');
6683
6702
  }
6684
6703
 
6685
6704
  // Renderer options for the response being rendered: its CSP nonce, which the
@@ -7020,6 +7039,73 @@ function createFarmDocumentStream(contentStream, prefix, suffix, onComplete) {
7020
7039
  });
7021
7040
  }
7022
7041
 
7042
+ // Streams a layout's own <html> document. React's output is held until the opening <body>, so
7043
+ // Farm's head assets go into the document's head (openDocument); the body then streams through.
7044
+ // The closing </body></html> React writes with its shell is held back: Suspense content React
7045
+ // streams later belongs inside the body, before Farm's footer (closeDocument) and the closing tags.
7046
+ function createFarmFullDocumentStream(contentStream, openDocument, closeDocument, onComplete) {
7047
+ const encoder = new TextEncoder();
7048
+ const decoder = new TextDecoder();
7049
+ const reader = contentStream.getReader();
7050
+ // The footer renders after the handler returned, outside its async scope.
7051
+ const cspNonce = _resolveCurrentCspNonce();
7052
+ let opening = "";
7053
+ let opened = false;
7054
+ let rootOpened = false;
7055
+ let closing = false;
7056
+ return new ReadableStream({
7057
+ async pull(controller) {
7058
+ try {
7059
+ for (;;) {
7060
+ const result = await reader.read();
7061
+ let text = result.done ? decoder.decode() : decoder.decode(result.value, { stream: true });
7062
+ if (!opened) {
7063
+ opening += text;
7064
+ if (!result.done && !/<body\\b[^>]*>/i.test(opening)) continue;
7065
+ opened = true;
7066
+ text = opening;
7067
+ opening = "";
7068
+ const closeAt = text.search(/<\\/body>/i);
7069
+ const head = closeAt >= 0 ? text.slice(0, closeAt) : text;
7070
+ const rest = closeAt >= 0 ? text.slice(closeAt) : "";
7071
+ // ensureFarmDocumentRoot opens #root unless the layout's body already does.
7072
+ rootOpened = !/<body\\b[^>]*>\\s*<div\\b[^>]*\\sid=["']root["']/i.test(head);
7073
+ text = openDocument(head) + rest;
7074
+ }
7075
+ if (!closing) {
7076
+ const closeAt = text.search(/<\\/body>/i);
7077
+ if (closeAt >= 0) {
7078
+ closing = true;
7079
+ // Drop the closing tags and Farm's wrapper divs around the document; keep what React
7080
+ // wrote after them.
7081
+ text = text.slice(0, closeAt) +
7082
+ text.slice(closeAt).replace(/^<\\/body>\\s*(?:<\\/html>)?(?:\\s*<\\/div>)*/i, "");
7083
+ }
7084
+ }
7085
+ if (result.done) {
7086
+ const footer = await _runWithFarmCspNonce(cspNonce, function() {
7087
+ return closeDocument(rootOpened);
7088
+ });
7089
+ controller.enqueue(encoder.encode(text + footer + "</body>\\n</html>"));
7090
+ if (onComplete) onComplete();
7091
+ controller.close();
7092
+ return;
7093
+ }
7094
+ if (text) {
7095
+ controller.enqueue(encoder.encode(text));
7096
+ return;
7097
+ }
7098
+ }
7099
+ } catch (error) {
7100
+ controller.error(error);
7101
+ }
7102
+ },
7103
+ cancel(reason) {
7104
+ return reader.cancel(reason);
7105
+ },
7106
+ });
7107
+ }
7108
+
7023
7109
  function stripFarmDocumentWrappers(markup) {
7024
7110
  return peelFarmDocumentPrefix(markup).inner;
7025
7111
  }
@@ -7031,7 +7117,7 @@ function peelFarmDocumentPrefix(markup) {
7031
7117
  let inner = markup.replace(/^\\s+/, "");
7032
7118
  let hoisted = "";
7033
7119
  const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents;?\\s*["'][^>]*>/i;
7034
- const hoistable = /${_chunkUN4B2TXCcjs.HOISTED_HEAD_ELEMENT.source}/i;
7120
+ const hoistable = /${_chunkXIZO5VDAcjs.HOISTED_HEAD_ELEMENT.source}/i;
7035
7121
  let match;
7036
7122
  while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
7037
7123
  if (!/^<div/i.test(match[0])) hoisted += match[0];
@@ -7562,7 +7648,7 @@ function createFarmAgentRobotsResponse(request) {
7562
7648
  // a route guard.
7563
7649
  const farmAgentGuardedPages = new Set(${JSON.stringify(
7564
7650
  pageRoutes.map((route) => route.pattern).filter(
7565
- (pattern) => !pattern.includes("[") && _chunkUN4B2TXCcjs.farmPathGuardCoversPage.call(void 0,
7651
+ (pattern) => !pattern.includes("[") && _chunkXIZO5VDAcjs.farmPathGuardCoversPage.call(void 0,
7566
7652
  {
7567
7653
  config: { middleware: config.middleware, integrations: config.integrations },
7568
7654
  middlewareRoutes
@@ -7609,7 +7695,7 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
7609
7695
  // aside for a page route that answers /mcp and for any MCP server published or
7610
7696
  // registered at runtime, such as the docs engine's.
7611
7697
  const farmDefaultMCPServer = ${JSON.stringify(
7612
- _chunkBMOBTMDRcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunk2DZOABRKcjs.FARM_VERSION)
7698
+ _chunkBMOBTMDRcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunkOF4TXHM4cjs.FARM_VERSION)
7613
7699
  )};
7614
7700
  let farmDefaultMCPRouteFree;
7615
7701
  function getFarmDefaultMCPServer() {
@@ -8646,7 +8732,7 @@ ${hasServerRuntimeIntegrations ? `
8646
8732
  // agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
8647
8733
  // public manifest, the same document for every request.
8648
8734
  if (
8649
- [${JSON.stringify(_chunkUN4B2TXCcjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkUN4B2TXCcjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
8735
+ [${JSON.stringify(_chunkXIZO5VDAcjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkXIZO5VDAcjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
8650
8736
  normalizeRuntimePath(routePathname),
8651
8737
  )
8652
8738
  ) {
@@ -8658,7 +8744,7 @@ ${hasServerRuntimeIntegrations ? `
8658
8744
  ` : ""}
8659
8745
  ${_optionalChain([config, 'access', _167 => _167.agent, 'optionalAccess', _168 => _168.apiCatalog]) ? `
8660
8746
  // agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
8661
- if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkUN4B2TXCcjs.FARM_API_CATALOG_PATH)}) {
8747
+ if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkXIZO5VDAcjs.FARM_API_CATALOG_PATH)}) {
8662
8748
  return applyProductionMiddlewareHeaders(
8663
8749
  createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
8664
8750
  middlewareHeaders,
@@ -9306,15 +9392,60 @@ ${hasServerRuntimeIntegrations ? `
9306
9392
  const initialHtml = html !== undefined ? html : renderedPage.shellHtml || "";
9307
9393
  const hasFullDocument = opensFarmFullDocument(initialHtml);
9308
9394
 
9309
- // Stream a suspended body as soon as React's shell is ready. Full-document
9310
- // layouts, localized documents, and cacheable PPR shells still use the
9311
- // buffered path because they require whole-document transformation, and so
9312
- // does the anonymous check behind a page's Markdown source: there, a
9313
- // redirect() under a loading boundary must still decide the status.
9395
+ const rendererHead = renderedPage.head || "";
9396
+ const rendererHasTitle = /<title[\\s>]/i.test(rendererHead);
9397
+ // First <title> wins: the fallback framework title yields to a
9398
+ // renderer-emitted one; explicit metadata titles still come first.
9399
+ const suppressDefaultTitle =
9400
+ !renderedMetadata.hasExplicitTitle && rendererHasTitle;
9401
+ // A layout's own <html> document with Farm's head assets merged in and the #root the client
9402
+ // hydrates opening its body: the whole document, or a streamed one's opening.
9403
+ const composeFarmFullDocument = function(markup) {
9404
+ let composed = addFarmFallbackIcon(
9405
+ ensureFarmDocumentRoot(ensureFarmDocumentHead(markup)),
9406
+ hasFavicon,
9407
+ );
9408
+ composed = composed
9409
+ // Inject CSS link after opening head tag or first meta tag
9410
+ .replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n <link rel="stylesheet" href="/__farm_client_css_href__">' + renderFarmClientModulePreloads(composed, route.clientModule); })
9411
+ .replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n</head>')
9412
+ // Explicit metadata wins over renderer and layout titles. Without
9413
+ // explicit metadata, a renderer title wins over the layout title.
9414
+ .replace(/<head([^>]*)>([\\s\\S]*?)<\\/head>/i, (match, attrs, headContent) => {
9415
+ const hasAuthoritativeTitle = renderedMetadata.hasExplicitTitle || rendererHasTitle;
9416
+ let nextHeadContent = hasAuthoritativeTitle
9417
+ ? headContent.replace(/<title\\b[^>]*>[\\s\\S]*?<\\/title>\\s*/gi, "")
9418
+ : headContent;
9419
+ if (renderedMetadata.hasExplicitTitle) {
9420
+ nextHeadContent += "\\n <title>" + title + "</title>";
9421
+ }
9422
+ if (metaTags) nextHeadContent += metaTags;
9423
+ // Renderer-emitted head markup (e.g. <svelte:head>). Function
9424
+ // replacement below keeps $-sequences literal.
9425
+ const effectiveRendererHead = renderedMetadata.hasExplicitTitle
9426
+ ? rendererHead.replace(/<title\\b[^>]*>[\\s\\S]*?<\\/title>\\s*/gi, "")
9427
+ : rendererHead;
9428
+ if (effectiveRendererHead) nextHeadContent += "\\n " + effectiveRendererHead;
9429
+ return nextHeadContent === headContent
9430
+ ? match
9431
+ : "<head" + attrs + ">" + nextHeadContent + "\\n</head>";
9432
+ });
9433
+ // Last, so the charset (and the viewport, unless the layout wrote one) open the head.
9434
+ composed = ensureFarmDocumentMeta(composed, viewportTags);
9435
+ if (!composed.trim().startsWith('<!DOCTYPE')) {
9436
+ composed = '<!DOCTYPE html>\\n' + composed;
9437
+ }
9438
+ return composed;
9439
+ };
9440
+
9441
+ // Stream a suspended body as soon as React's shell is ready, a layout's own <html> document
9442
+ // included. Localized documents and cacheable PPR shells still use the buffered path
9443
+ // because they require whole-document transformation, and so does the anonymous check
9444
+ // behind a page's Markdown source: there, a redirect() under a loading boundary must still
9445
+ // decide the status.
9314
9446
  if (
9315
9447
  pageStatus === 200 &&
9316
9448
  renderedPage.stream &&
9317
- !hasFullDocument &&
9318
9449
  !farmI18nSnapshot &&
9319
9450
  !pprCacheKey &&
9320
9451
  !_isFarmMarkdownPageCheck(request.headers.get(FARM_MARKDOWN_PAGE_CHECK_HEADER))
@@ -9324,6 +9455,18 @@ ${hasServerRuntimeIntegrations ? `
9324
9455
  farmResolvedRuntimeConfig.basePath,
9325
9456
  getFarmTheme(request)
9326
9457
  );
9458
+ // The page's client data and entry. Islands mode starts the client while the body streams
9459
+ // (an async entry right after <body>), so islands that arrive early hydrate before slow
9460
+ // Suspense content resolves; other modes keep them at the end.
9461
+ const farmClientScripts = function(early) {
9462
+ return ' ' + renderFarmClientBootstrapScript(
9463
+ pageProps.__farmCanonicalPath,
9464
+ routeSlotPayload,
9465
+ clientPageProps
9466
+ ) + '\\n' +
9467
+ ' ' + renderFarmClientEntryScript(early) + '\\n';
9468
+ };
9469
+ const farmEarlyClientScripts = ${farmIslandsMode ? "farmClientScripts(true)" : '""'};
9327
9470
  const streamPrefix = '<!DOCTYPE html>\\n<html lang="en">\\n<head>\\n' +
9328
9471
  farmThemeDocument.head + '\\n' +
9329
9472
  ' <meta charset="utf-8">\\n' +
@@ -9333,33 +9476,25 @@ ${hasServerRuntimeIntegrations ? `
9333
9476
  ' <link rel="stylesheet" href="/__farm_client_css_href__">\\n' +
9334
9477
  ' <link rel="modulepreload" href="/__farm_client_js_src__">' + renderFarmClientModulePreloads(null, route.clientModule) + '\\n' +
9335
9478
  renderFarmRendererHydrationScript() + '\\n' +
9336
- '</head>\\n<body>\\n <div id="root">';
9479
+ '</head>\\n<body>\\n' + farmEarlyClientScripts + ' <div id="root">';
9337
9480
  const streamSuffix = '</div>\\n' +
9338
- ' ' + renderFarmClientBootstrapScript(
9339
- pageProps.__farmCanonicalPath,
9340
- routeSlotPayload,
9341
- clientPageProps
9342
- ) + '\\n' +
9343
- ' ' + renderFarmClientEntryScript() + '\\n' +
9481
+ (farmEarlyClientScripts ? '' : farmClientScripts()) +
9344
9482
  '</body>\\n</html>';
9345
9483
  const themedStreamPrefix = streamPrefix.replace(
9346
9484
  '<html lang="en">',
9347
9485
  () => '<html lang="en"' + farmThemeDocument.attributes + '>'
9348
9486
  );
9349
- const streamedDocument = createFarmDocumentStream(
9350
- renderedPage.stream,
9351
- themedStreamPrefix,
9352
- async function() {
9487
+ const lateNavigationRecovery = async function() {
9353
9488
  // A redirect()/notFound() after the 200 shell went out can only
9354
9489
  // be recovered in the document.
9355
9490
  const lateNavigationError = renderedPage.streamErrors.find(function(error) {
9356
9491
  return isFarmRedirectError(error) || isFarmNotFoundError(error);
9357
9492
  });
9358
- if (!lateNavigationError) return streamSuffix;
9493
+ if (!lateNavigationError) return "";
9359
9494
  if (isFarmRedirectError(lateNavigationError)) {
9360
9495
  return createLateRedirectRecovery(
9361
9496
  getFarmRedirectError(lateNavigationError).url
9362
- ) + streamSuffix;
9497
+ );
9363
9498
  }
9364
9499
  try {
9365
9500
  return createLateNotFoundRecovery(
@@ -9367,7 +9502,7 @@ ${hasServerRuntimeIntegrations ? `
9367
9502
  wrapWithFarmIntegrationProviders(createFarmNotFoundElement(pathname)),
9368
9503
  getFarmRendererRenderOptions()
9369
9504
  )
9370
- ) + streamSuffix;
9505
+ );
9371
9506
  } catch (error) {
9372
9507
  // The layouts are already in the shell; a not-found page that
9373
9508
  // needs their context cannot render alone, so use Farm's.
@@ -9377,10 +9512,10 @@ ${hasServerRuntimeIntegrations ? `
9377
9512
  React.createElement(FarmDefault404Page),
9378
9513
  getFarmRendererRenderOptions()
9379
9514
  )
9380
- ) + streamSuffix;
9515
+ );
9381
9516
  }
9382
- },
9383
- function() {
9517
+ };
9518
+ const onStreamComplete = function() {
9384
9519
  if (pprBypassReason === "refresh") {
9385
9520
  emitFarmEvent({
9386
9521
  type: "ppr.refresh.complete",
@@ -9395,8 +9530,43 @@ ${hasServerRuntimeIntegrations ? `
9395
9530
  status: pageStatus,
9396
9531
  durationMs: Date.now() - requestStartTime,
9397
9532
  });
9398
- }
9399
- );
9533
+ };
9534
+ const streamedDocument = hasFullDocument
9535
+ ? createFarmFullDocumentStream(
9536
+ renderedPage.stream,
9537
+ function(opening) {
9538
+ // Farm's wrappers and the head elements React hoisted ahead of the layout's <html>.
9539
+ const peeled = peelFarmDocumentPrefix(opening);
9540
+ const start = opening.search(/<!doctype|<html[\\s>]/i);
9541
+ return applyFarmThemeDocument(
9542
+ composeFarmFullDocument(
9543
+ restoreFarmHoistedHead(opening.slice(Math.max(start, 0)), peeled.hoisted)
9544
+ // The client entry arrives last: fetch it while the body streams.
9545
+ ).replace(/<\\/head>/i, function() {
9546
+ return ' <link rel="modulepreload" href="/__farm_client_js_src__">\\n</head>';
9547
+ }).replace(/<body\\b[^>]*>/i, function(open) {
9548
+ return open + (farmEarlyClientScripts ? '\\n' + farmEarlyClientScripts : '');
9549
+ }),
9550
+ farmThemeConfig,
9551
+ farmResolvedRuntimeConfig.basePath,
9552
+ getFarmTheme(request)
9553
+ );
9554
+ },
9555
+ async function(rootOpened) {
9556
+ return (await lateNavigationRecovery()) +
9557
+ (rootOpened ? '</div>\\n' : '') +
9558
+ (farmEarlyClientScripts ? '' : farmClientScripts());
9559
+ },
9560
+ onStreamComplete
9561
+ )
9562
+ : createFarmDocumentStream(
9563
+ renderedPage.stream,
9564
+ themedStreamPrefix,
9565
+ async function() {
9566
+ return (await lateNavigationRecovery()) + streamSuffix;
9567
+ },
9568
+ onStreamComplete
9569
+ );
9400
9570
  return applyProductionMiddlewareHeaders(farmOwnedResponse(streamedDocument, {
9401
9571
  status: pageStatus,
9402
9572
  headers: { ...responseHeaders, "x-farm-preload-streaming": "1" },
@@ -9410,44 +9580,10 @@ ${hasServerRuntimeIntegrations ? `
9410
9580
  }
9411
9581
  }
9412
9582
 
9413
- const rendererHead = renderedPage.head || "";
9414
- const rendererHasTitle = /<title[\\s>]/i.test(rendererHead);
9415
- // First <title> wins: the fallback framework title yields to a
9416
- // renderer-emitted one; explicit metadata titles still come first.
9417
- const suppressDefaultTitle =
9418
- !renderedMetadata.hasExplicitTitle && rendererHasTitle;
9419
9583
  let fullHtml;
9420
9584
  if (hasFullDocument) {
9421
9585
  // Layout provides full HTML structure - inject CSS and client script
9422
- html = addFarmFallbackIcon(
9423
- ensureFarmDocumentRoot(ensureFarmDocumentHead(extractFarmFullDocument(html) || html)),
9424
- hasFavicon,
9425
- );
9426
- fullHtml = html
9427
- // Inject CSS link after opening head tag or first meta tag
9428
- .replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n <link rel="stylesheet" href="/__farm_client_css_href__">' + renderFarmClientModulePreloads(html, route.clientModule); })
9429
- .replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n</head>')
9430
- // Explicit metadata wins over renderer and layout titles. Without
9431
- // explicit metadata, a renderer title wins over the layout title.
9432
- .replace(/<head([^>]*)>([\\s\\S]*?)<\\/head>/i, (match, attrs, headContent) => {
9433
- const hasAuthoritativeTitle = renderedMetadata.hasExplicitTitle || rendererHasTitle;
9434
- let nextHeadContent = hasAuthoritativeTitle
9435
- ? headContent.replace(/<title\\b[^>]*>[\\s\\S]*?<\\/title>\\s*/gi, "")
9436
- : headContent;
9437
- if (renderedMetadata.hasExplicitTitle) {
9438
- nextHeadContent += "\\n <title>" + title + "</title>";
9439
- }
9440
- if (metaTags) nextHeadContent += metaTags;
9441
- // Renderer-emitted head markup (e.g. <svelte:head>). Function
9442
- // replacement below keeps $-sequences literal.
9443
- const effectiveRendererHead = renderedMetadata.hasExplicitTitle
9444
- ? rendererHead.replace(/<title\\b[^>]*>[\\s\\S]*?<\\/title>\\s*/gi, "")
9445
- : rendererHead;
9446
- if (effectiveRendererHead) nextHeadContent += "\\n " + effectiveRendererHead;
9447
- return nextHeadContent === headContent
9448
- ? match
9449
- : "<head" + attrs + ">" + nextHeadContent + "\\n</head>";
9450
- })
9586
+ fullHtml = composeFarmFullDocument(extractFarmFullDocument(html) || html)
9451
9587
  // Inject client script before closing body tag. Function replacement:
9452
9588
  // serialized page props may contain $-sequences ($&, $', $$) that a
9453
9589
  // string replacement would expand into surrounding document markup,
@@ -9461,14 +9597,6 @@ ${hasServerRuntimeIntegrations ? `
9461
9597
  ) + '\\n' +
9462
9598
  ' ' + renderFarmClientEntryScript() + '\\n</body>',
9463
9599
  );
9464
-
9465
- // Last, so the charset (and the viewport, unless the layout wrote one) open the head.
9466
- fullHtml = ensureFarmDocumentMeta(fullHtml, viewportTags);
9467
-
9468
- // Add DOCTYPE if not present
9469
- if (!fullHtml.trim().startsWith('<!DOCTYPE')) {
9470
- fullHtml = '<!DOCTYPE html>\\n' + fullHtml;
9471
- }
9472
9600
  } else {
9473
9601
  // No layout with full document - wrap in HTML structure
9474
9602
  fullHtml = \`<!DOCTYPE html>
@@ -10109,8 +10237,8 @@ function getPhysicalPrerenderBypassReason(options) {
10109
10237
  if (rewriteSources.some((source) => middlewarePatternMatches(source, pathname))) {
10110
10238
  return "rewrite";
10111
10239
  }
10112
- if (_chunkUN4B2TXCcjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
10113
- if (_chunkUN4B2TXCcjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
10240
+ if (_chunkXIZO5VDAcjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
10241
+ if (_chunkXIZO5VDAcjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
10114
10242
  if (_chunkLPE3ED4Rcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
10115
10243
  if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
10116
10244
  const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
@@ -10149,7 +10277,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
10149
10277
  const outputDir = _chunkLPE3ED4Rcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
10150
10278
  const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
10151
10279
  const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
10152
- const imageRuntime = _chunkSIVK2SRRcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
10280
+ const imageRuntime = _chunkQ5F32A26cjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
10153
10281
  const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
10154
10282
  (image) => image.sourceType === "module"
10155
10283
  );
@@ -11011,7 +11139,7 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
11011
11139
  try {
11012
11140
  await copyPackage("sharp", sharpRequire);
11013
11141
  if (!copiedPackages.has("sharp")) {
11014
- throw new Error(`Farm image optimization requires sharp. ${_chunkSIVK2SRRcjs.SHARP_INSTALL_HINT}`);
11142
+ throw new Error(`Farm image optimization requires sharp. ${_chunkQ5F32A26cjs.SHARP_INSTALL_HINT}`);
11015
11143
  }
11016
11144
  } catch (error) {
11017
11145
  await fs4.rm(stageDir, { recursive: true, force: true });
@@ -11312,7 +11440,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
11312
11440
  };
11313
11441
  config = {
11314
11442
  ...config,
11315
- images: _chunkSIVK2SRRcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
11443
+ images: _chunkQ5F32A26cjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
11316
11444
  root: targets.root,
11317
11445
  preset: targets.preset
11318
11446
  })
@@ -11340,7 +11468,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
11340
11468
  root,
11341
11469
  rendererBuild.signal
11342
11470
  );
11343
- const farmApp = _chunkSIVK2SRRcjs.createFarmApp.call(void 0, config, projectModuleServer);
11471
+ const farmApp = _chunkQ5F32A26cjs.createFarmApp.call(void 0, config, projectModuleServer);
11344
11472
  await farmApp.initialize();
11345
11473
  const routeManager = farmApp.getRouteManager();
11346
11474
  const serverRenderer = farmApp.getServerRenderer();
@@ -11447,7 +11575,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
11447
11575
  ssr: true,
11448
11576
  buildLifetime
11449
11577
  });
11450
- const viteConfig = _chunkSIVK2SRRcjs.mergeFarmViteConfig.call(void 0,
11578
+ const viteConfig = _chunkQ5F32A26cjs.mergeFarmViteConfig.call(void 0,
11451
11579
  {
11452
11580
  root,
11453
11581
  appType: "custom",
@@ -11459,7 +11587,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
11459
11587
  },
11460
11588
  plugins: [
11461
11589
  ...rendererVitePlugins,
11462
- _chunkSIVK2SRRcjs.farmFontImportsPlugin.call(void 0, {
11590
+ _chunkQ5F32A26cjs.farmFontImportsPlugin.call(void 0, {
11463
11591
  root,
11464
11592
  basePath: config.basePath,
11465
11593
  publicDir: config.publicDir
@@ -11471,7 +11599,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
11471
11599
  hmr: false
11472
11600
  },
11473
11601
  resolve: {
11474
- alias: _chunkSIVK2SRRcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
11602
+ alias: _chunkQ5F32A26cjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
11475
11603
  dedupe: [...config.renderer.dedupe || []]
11476
11604
  },
11477
11605
  optimizeDeps: {