@farm.js/core 0.1.81 → 0.1.83

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 (290) hide show
  1. package/dist/{agent-mcp.d-Cxi3214_.d.ts → agent-mcp.d-7uKdOttc.d.ts} +1 -1
  2. package/dist/{agent-mcp.d-DMqOqnOA.d.mts → agent-mcp.d-LChlR2au.d.mts} +1 -1
  3. package/dist/agent-runtime.cjs +4 -3
  4. package/dist/agent-runtime.d.mts +2 -1
  5. package/dist/agent-runtime.d.ts +2 -1
  6. package/dist/agent-runtime.mjs +3 -2
  7. package/dist/analyzer-WGH6J2HN.cjs +17 -0
  8. package/dist/{analyzer-IC66UJCU.mjs → analyzer-Y6IY26HI.mjs} +2 -2
  9. package/dist/api/node.cjs +5 -4
  10. package/dist/api/node.d.mts +4 -3
  11. package/dist/api/node.d.ts +4 -3
  12. package/dist/api/node.mjs +4 -3
  13. package/dist/api/route-manager.cjs +5 -4
  14. package/dist/api/route-manager.d.mts +4 -3
  15. package/dist/api/route-manager.d.ts +4 -3
  16. package/dist/api/route-manager.mjs +4 -3
  17. package/dist/api/runtime.cjs +4 -3
  18. package/dist/api/runtime.d.mts +3 -2
  19. package/dist/api/runtime.d.ts +3 -2
  20. package/dist/api/runtime.mjs +3 -2
  21. package/dist/api.cjs +7 -6
  22. package/dist/api.d.mts +5 -4
  23. package/dist/api.d.ts +5 -4
  24. package/dist/api.mjs +6 -5
  25. package/dist/{app-manifest.d-C8Cswd31.d.ts → app-manifest.d-CRp21oAz.d.ts} +1 -1
  26. package/dist/{app-manifest.d-Bbxp5kes.d.mts → app-manifest.d-QMdmqqCr.d.mts} +1 -1
  27. package/dist/app-markdown.d.mts +3 -2
  28. package/dist/app-markdown.d.ts +3 -2
  29. package/dist/{app.d-DGIoFt5D.d.ts → app.d-CVPu_hoD.d.ts} +51 -4
  30. package/dist/{app.d-BJuSurgy.d.mts → app.d-eSm7jgoc.d.mts} +51 -4
  31. package/dist/{chunk-NSLRK5DK.cjs → chunk-3CZ4MJHW.cjs} +1 -1
  32. package/dist/{chunk-CPZZBCPO.cjs → chunk-3DAJXBSL.cjs} +2 -2
  33. package/dist/chunk-3DE6RK7K.cjs +36 -0
  34. package/dist/{chunk-XMHERKSE.mjs → chunk-42IBGQTN.mjs} +5 -12
  35. package/dist/{chunk-GY63XD6K.mjs → chunk-43N3X6OO.mjs} +1 -1
  36. package/dist/{chunk-MOGRRZMW.cjs → chunk-55UJGUBP.cjs} +35 -30
  37. package/dist/{chunk-BPWTSPK6.mjs → chunk-5AL2GXAU.mjs} +1 -1
  38. package/dist/{chunk-GAWSWJJ2.cjs → chunk-5GFTMTX3.cjs} +2 -2
  39. package/dist/{chunk-LKIG5SM6.cjs → chunk-5P65LXGU.cjs} +9 -9
  40. package/dist/{chunk-TPA2PV5J.mjs → chunk-5V6HSJFG.mjs} +24 -1
  41. package/dist/chunk-5X5GJU5A.cjs +426 -0
  42. package/dist/{chunk-UF4BNKKJ.mjs → chunk-6QYPP5KC.mjs} +2 -2
  43. package/dist/{chunk-ATISIC6G.mjs → chunk-7VJXYB6S.mjs} +7 -1
  44. package/dist/{chunk-OIWDEDUO.cjs → chunk-7X2CYE66.cjs} +419 -357
  45. package/dist/{chunk-XOGCNKB7.cjs → chunk-A5BHJHDF.cjs} +3 -3
  46. package/dist/{chunk-WGWWRV2M.cjs → chunk-B3HQTGXS.cjs} +6 -4
  47. package/dist/{chunk-HTNJ7A4D.mjs → chunk-B5SJYXJK.mjs} +177 -67
  48. package/dist/chunk-BUQR7KKO.mjs +17 -0
  49. package/dist/{chunk-OO4GVGM3.mjs → chunk-CA2HBLXP.mjs} +11 -1
  50. package/dist/{chunk-724WT3NI.mjs → chunk-CRE642TW.mjs} +1 -1
  51. package/dist/{chunk-Z5BANEQD.cjs → chunk-DMSXZNQR.cjs} +2 -2
  52. package/dist/{chunk-IPG6B25T.mjs → chunk-DPUZVGXH.mjs} +203 -54
  53. package/dist/{chunk-ZIYJWJV2.cjs → chunk-DZTWUEBB.cjs} +8 -8
  54. package/dist/{chunk-4OFWG4IK.cjs → chunk-EACD6ND7.cjs} +8 -2
  55. package/dist/{chunk-46UV2E7I.cjs → chunk-EFI6QWBQ.cjs} +200 -90
  56. package/dist/chunk-ELNRKD4V.mjs +426 -0
  57. package/dist/{chunk-XOXCQGAF.mjs → chunk-FFWSER54.mjs} +1 -1
  58. package/dist/chunk-FZ7OUN5M.cjs +30 -0
  59. package/dist/{chunk-5MMKNW7Q.cjs → chunk-H7REG7OX.cjs} +15 -8
  60. package/dist/{chunk-5ZHC6QGD.cjs → chunk-HQKCSJEH.cjs} +8 -2
  61. package/dist/{chunk-OUDNUFVR.cjs → chunk-HRH7OKBQ.cjs} +6 -4
  62. package/dist/{chunk-RHI67C2V.cjs → chunk-HUGPJFOC.cjs} +1 -35
  63. package/dist/{chunk-ADQ2LATR.cjs → chunk-IABI62FH.cjs} +2 -2
  64. package/dist/{chunk-TLSGRK7E.mjs → chunk-IAIRQAHA.mjs} +3 -1
  65. package/dist/{chunk-C2OLXVUC.mjs → chunk-IVP5Q4BX.mjs} +10 -3
  66. package/dist/{chunk-EX6ZSN5P.cjs → chunk-IZYFP7IN.cjs} +17 -24
  67. package/dist/chunk-J6RFB324.cjs +17 -0
  68. package/dist/{chunk-CL7BUGVB.cjs → chunk-JHRJ5V2F.cjs} +509 -360
  69. package/dist/{chunk-WIZRYFB2.cjs → chunk-JYQ6DGPW.cjs} +8 -6
  70. package/dist/{chunk-POL5RCVU.mjs → chunk-K3GHY7GY.mjs} +14 -9
  71. package/dist/{chunk-TYHWZOA2.mjs → chunk-KWI3SQFX.mjs} +4 -2
  72. package/dist/{chunk-UVV3I5QA.cjs → chunk-L2GUEYHR.cjs} +29 -6
  73. package/dist/{chunk-POVHO46S.mjs → chunk-L3RDECA5.mjs} +1 -1
  74. package/dist/{chunk-E3HBD2K3.cjs → chunk-LN6FAYNB.cjs} +36 -31
  75. package/dist/chunk-M6AJZ4XR.mjs +30 -0
  76. package/dist/{chunk-RPA45OQS.mjs → chunk-MO4UTDQ6.mjs} +1 -1
  77. package/dist/{chunk-6WVRVGKC.mjs → chunk-NAHDG6UX.mjs} +1 -1
  78. package/dist/{chunk-NOYKBGUK.mjs → chunk-NDWI6FDH.mjs} +558 -212
  79. package/dist/{chunk-OFVCWV2D.cjs → chunk-NEKO3HM2.cjs} +11 -1
  80. package/dist/{chunk-M6DAIE4T.cjs → chunk-NGTZHWBG.cjs} +78 -9
  81. package/dist/{chunk-D77OGI6X.mjs → chunk-NKVBWPXR.mjs} +1 -1
  82. package/dist/{chunk-SLEHAGGV.mjs → chunk-NQ3Y6E2T.mjs} +7 -1
  83. package/dist/{chunk-W6C3LEXX.cjs → chunk-OM6JIIJU.cjs} +155 -20
  84. package/dist/{chunk-S3IWDDQ3.mjs → chunk-ORBBAA7B.mjs} +1 -1
  85. package/dist/{chunk-7VCLTNED.mjs → chunk-PNMAD3OS.mjs} +1 -35
  86. package/dist/{chunk-BJWJP5A4.mjs → chunk-R3VLM2MW.mjs} +3 -3
  87. package/dist/{chunk-I4WZRG73.mjs → chunk-RB5IGN3N.mjs} +13 -6
  88. package/dist/{chunk-2HMSSPCZ.mjs → chunk-RGTZAM6Y.mjs} +71 -2
  89. package/dist/{chunk-IM3UINTZ.mjs → chunk-RNJX3MD6.mjs} +151 -16
  90. package/dist/{chunk-EJCVG25Z.mjs → chunk-S3R4JDRO.mjs} +17 -9
  91. package/dist/{chunk-2Y2HRZQY.cjs → chunk-SLIXHUMS.cjs} +931 -585
  92. package/dist/{chunk-WFVSAT7Y.cjs → chunk-T7HGXF7D.cjs} +3 -3
  93. package/dist/{chunk-ZKNXCRUQ.cjs → chunk-U54REWMJ.cjs} +23 -23
  94. package/dist/{chunk-YH7ENV3K.mjs → chunk-U56Z3755.mjs} +13 -8
  95. package/dist/chunk-U6XYBTUT.mjs +36 -0
  96. package/dist/{chunk-TCMRLW3K.cjs → chunk-VACYUMXW.cjs} +10 -3
  97. package/dist/{chunk-RZ6XUEQS.mjs → chunk-VQ6IXALL.mjs} +2 -2
  98. package/dist/{chunk-UGLTOLTJ.cjs → chunk-W76C7TCW.cjs} +2 -2
  99. package/dist/{chunk-FYZD7DUS.cjs → chunk-WCSBYQOT.cjs} +4 -4
  100. package/dist/{chunk-5N526T7Q.mjs → chunk-WZV2G2A6.mjs} +95 -33
  101. package/dist/{chunk-SM2SYWAR.cjs → chunk-XJDB564A.cjs} +18 -10
  102. package/dist/{chunk-6JWXHPVR.mjs → chunk-XRSNW4IU.mjs} +4 -2
  103. package/dist/{cli-runtime.d-D8O1v2_X.d.mts → cli-runtime.d-C7aMfoTq.d.mts} +8 -6
  104. package/dist/{cli-runtime.d-hf4L1MNP.d.ts → cli-runtime.d-DaElKjaL.d.ts} +8 -6
  105. package/dist/{client-component.d-DFwUHlOz.d.mts → client-component.d-DLMCzmUx.d.mts} +1 -1
  106. package/dist/{client-component.d-CX8UCQh-.d.ts → client-component.d-DLknFP8l.d.ts} +1 -1
  107. package/dist/{client-plugins.d-qWp8hNwd.d.ts → client-plugins.d-BVXjyIkY.d.ts} +20 -1
  108. package/dist/{client-plugins.d-BflSNO-b.d.mts → client-plugins.d-BwKwuO_0.d.mts} +20 -1
  109. package/dist/client-plugins.d.mts +2 -1
  110. package/dist/client-plugins.d.ts +2 -1
  111. package/dist/client.cjs +4 -3
  112. package/dist/client.d.mts +10 -9
  113. package/dist/client.d.ts +10 -9
  114. package/dist/client.mjs +3 -2
  115. package/dist/config.d.mts +2 -1
  116. package/dist/config.d.ts +2 -1
  117. package/dist/cron.cjs +2 -2
  118. package/dist/cron.mjs +1 -1
  119. package/dist/desktop.d.mts +3 -2
  120. package/dist/desktop.d.ts +3 -2
  121. package/dist/{devtools-XJHODO5H.mjs → devtools-OI52TCSD.mjs} +8 -7
  122. package/dist/{devtools-EI5N366Z.cjs → devtools-ZM2AR36W.cjs} +11 -10
  123. package/dist/docs.cjs +13 -11
  124. package/dist/docs.d.mts +15 -6
  125. package/dist/docs.d.ts +15 -6
  126. package/dist/docs.mjs +12 -10
  127. package/dist/environment/vite.cjs +4 -4
  128. package/dist/environment/vite.d.mts +1 -0
  129. package/dist/environment/vite.d.ts +1 -0
  130. package/dist/environment/vite.mjs +3 -3
  131. package/dist/{generate-route-types.d-CaGMIaNI.d.mts → generate-route-types.d-BFOMM8Ef.d.mts} +3 -0
  132. package/dist/{generate-route-types.d-B76M5R11.d.ts → generate-route-types.d-C2m8myHb.d.ts} +3 -0
  133. package/dist/{handler.d-DoH5Krkq.d.mts → handler.d-BKTWzzNA.d.mts} +1 -1
  134. package/dist/{handler.d-C2oRihfa.d.ts → handler.d-Dzpyg3-N.d.ts} +1 -1
  135. package/dist/{headers.d-BrX53wFQ.d.mts → headers.d-5opjyhXw.d.mts} +1 -1
  136. package/dist/{headers.d-Dj0mfYpb.d.ts → headers.d-PZyXcDAH.d.ts} +1 -1
  137. package/dist/index.cjs +38 -35
  138. package/dist/{index.d-DzDHOttz.d.mts → index.d-C0Mie66f.d.mts} +1 -1
  139. package/dist/{index.d-Dhc2scRl.d.ts → index.d-DV2q-0mE.d.ts} +1 -1
  140. package/dist/index.d.mts +26 -25
  141. package/dist/index.d.ts +26 -25
  142. package/dist/index.mjs +38 -35
  143. package/dist/integrations/orm.d.mts +2 -1
  144. package/dist/integrations/orm.d.ts +2 -1
  145. package/dist/integrations.cjs +4 -3
  146. package/dist/integrations.d.mts +2 -1
  147. package/dist/integrations.d.ts +2 -1
  148. package/dist/integrations.mjs +3 -2
  149. package/dist/internal/app-markdown-runtime.d.mts +3 -2
  150. package/dist/internal/app-markdown-runtime.d.ts +3 -2
  151. package/dist/internal/build-runtime.cjs +31 -30
  152. package/dist/internal/build-runtime.d.mts +5 -4
  153. package/dist/internal/build-runtime.d.ts +5 -4
  154. package/dist/internal/build-runtime.mjs +30 -29
  155. package/dist/internal/cli-runtime.cjs +12 -11
  156. package/dist/internal/cli-runtime.d.mts +8 -7
  157. package/dist/internal/cli-runtime.d.ts +8 -7
  158. package/dist/internal/cli-runtime.mjs +11 -10
  159. package/dist/internal/client-error-overlay.cjs +4 -4
  160. package/dist/internal/client-error-overlay.mjs +1 -1
  161. package/dist/internal/client-runtime.d.mts +5 -5
  162. package/dist/internal/client-runtime.d.ts +5 -5
  163. package/dist/internal/compression-runtime.d.mts +2 -1
  164. package/dist/internal/compression-runtime.d.ts +2 -1
  165. package/dist/internal/config-runtime.cjs +10 -9
  166. package/dist/internal/config-runtime.d.mts +6 -5
  167. package/dist/internal/config-runtime.d.ts +6 -5
  168. package/dist/internal/config-runtime.mjs +9 -8
  169. package/dist/internal/infra-analytics-runtime.cjs +8 -6
  170. package/dist/internal/infra-analytics-runtime.d.mts +8 -2
  171. package/dist/internal/infra-analytics-runtime.d.ts +8 -2
  172. package/dist/internal/infra-analytics-runtime.mjs +8 -6
  173. package/dist/internal/islands-action-client.cjs +18 -0
  174. package/dist/internal/islands-action-client.d.mts +18 -0
  175. package/dist/internal/islands-action-client.d.ts +18 -0
  176. package/dist/internal/islands-action-client.mjs +18 -0
  177. package/dist/internal/islands-boot.cjs +54 -20
  178. package/dist/internal/islands-boot.d.mts +5 -3
  179. package/dist/internal/islands-boot.d.ts +5 -3
  180. package/dist/internal/islands-boot.mjs +49 -15
  181. package/dist/internal/islands-runtime.cjs +3 -8
  182. package/dist/internal/islands-runtime.mjs +4 -9
  183. package/dist/internal/islx-actions-client.cjs +4 -3
  184. package/dist/internal/islx-actions-client.mjs +3 -2
  185. package/dist/internal/islx-actions-server.d.mts +0 -2
  186. package/dist/internal/islx-actions-server.d.ts +0 -2
  187. package/dist/internal/islx-client.cjs +13 -1
  188. package/dist/internal/islx-client.d.mts +11 -0
  189. package/dist/internal/islx-client.d.ts +11 -0
  190. package/dist/internal/islx-client.mjs +14 -0
  191. package/dist/internal/metadata-image-runtime.d.mts +1 -0
  192. package/dist/internal/metadata-image-runtime.d.ts +1 -0
  193. package/dist/internal/native-server-fns.cjs +4 -4
  194. package/dist/internal/native-server-fns.mjs +3 -3
  195. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  196. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  197. package/dist/internal/production-runtime.cjs +12 -7
  198. package/dist/internal/production-runtime.d.mts +14 -12
  199. package/dist/internal/production-runtime.d.ts +14 -12
  200. package/dist/internal/production-runtime.mjs +11 -6
  201. package/dist/internal/spa-router.d.mts +3 -3
  202. package/dist/internal/spa-router.d.ts +3 -3
  203. package/dist/internal/start-manifest.d.mts +2 -1
  204. package/dist/internal/start-manifest.d.ts +2 -1
  205. package/dist/markdown.d.mts +2 -1
  206. package/dist/markdown.d.ts +2 -1
  207. package/dist/middleware.d.mts +2 -1
  208. package/dist/middleware.d.ts +2 -1
  209. package/dist/mobile.d.mts +6 -3
  210. package/dist/mobile.d.ts +6 -3
  211. package/dist/{mount.d-DOaeUoWq.d.mts → mount.d-CZ_qL1iS.d.mts} +1 -1
  212. package/dist/{mount.d-DwXjaOHY.d.ts → mount.d-gWul1GA1.d.ts} +1 -1
  213. package/dist/{navigation-delegate.d-BElGUMgt.d.mts → navigation-delegate.d-BBTzhJLj.d.mts} +1 -1
  214. package/dist/{navigation-delegate.d-o3pPd9VI.d.ts → navigation-delegate.d-BZsYEAet.d.ts} +1 -1
  215. package/dist/navigation.d.mts +5 -5
  216. package/dist/navigation.d.ts +5 -5
  217. package/dist/{nitro-YLTGVGK4.mjs → nitro-FK3SZM4H.mjs} +1 -1
  218. package/dist/{nitro-XGIO6EQN.cjs → nitro-YDFMH5PY.cjs} +4 -4
  219. package/dist/{plugin-LN3JBZRR.cjs → plugin-3PT7I26P.cjs} +2 -2
  220. package/dist/{plugin-33I3V42N.mjs → plugin-QOTAPTVV.mjs} +1 -1
  221. package/dist/plugin.cjs +25 -23
  222. package/dist/plugin.d.mts +6 -6
  223. package/dist/plugin.d.ts +6 -6
  224. package/dist/plugin.mjs +24 -22
  225. package/dist/{render-plan.d-BD06tqFA.d.ts → render-plan.d-AaJsYPX-.d.ts} +1 -1
  226. package/dist/{render-plan.d-xWCRAJeR.d.mts → render-plan.d-bnWxS12w.d.mts} +1 -1
  227. package/dist/renderer-client.cjs +54 -10
  228. package/dist/renderer-client.d.mts +8 -7
  229. package/dist/renderer-client.d.ts +8 -7
  230. package/dist/renderer-client.mjs +50 -6
  231. package/dist/renderer.cjs +6 -2
  232. package/dist/renderer.d.mts +97 -4
  233. package/dist/renderer.d.ts +97 -4
  234. package/dist/renderer.mjs +5 -1
  235. package/dist/{request.d-Dx82V8bz.d.mts → request.d-C2HOn3Hi.d.mts} +1 -1
  236. package/dist/{request.d-DUMuWxSN.d.ts → request.d-CAeitOG1.d.ts} +1 -1
  237. package/dist/request.d.mts +3 -2
  238. package/dist/request.d.ts +3 -2
  239. package/dist/{route-rendering.d-BwBVpLtD.d.ts → route-rendering.d-A1dIkUK5.d.ts} +1 -1
  240. package/dist/{route-rendering.d-DJh6GauM.d.mts → route-rendering.d-CYA-ulnX.d.mts} +1 -1
  241. package/dist/{router.d-BtkKDxUB.d.mts → router.d-8lxnzlkr.d.mts} +1 -1
  242. package/dist/{router.d-CJBSG5jr.d.ts → router.d-A_Yt6jYz.d.ts} +1 -1
  243. package/dist/{routes.d-CCccJRrp.d.mts → routes.d-BWvpUoYu.d.mts} +1 -1
  244. package/dist/{routes.d-b7khoRoU.d.ts → routes.d-D7RWvfqL.d.ts} +1 -1
  245. package/dist/routes.d.mts +2 -1
  246. package/dist/routes.d.ts +2 -1
  247. package/dist/{rsc-pipeline-H5AXQA7A.cjs → rsc-pipeline-MFJZGDPE.cjs} +11 -10
  248. package/dist/{rsc-pipeline-GD6KLOIG.mjs → rsc-pipeline-TRZVFCBX.mjs} +10 -9
  249. package/dist/{runtime-YWQVBC3V.cjs → runtime-MJUG2HGR.cjs} +15 -13
  250. package/dist/{runtime-OJ7FXFUI.mjs → runtime-O4Y3Z6V3.mjs} +11 -9
  251. package/dist/{runtime.d-BQnD0cfC.d.ts → runtime.d-BPyvWrgQ.d.ts} +1 -1
  252. package/dist/{runtime.d-C4SuZXf6.d.mts → runtime.d-C_rZ9_DD.d.mts} +1 -1
  253. package/dist/{server-components-status.d-9rH7ZoEq.d.mts → server-components-status.d-BpxiEMQE.d.mts} +1 -1
  254. package/dist/{server-components-status.d-rfKOcE0N.d.ts → server-components-status.d-C2UEKJn7.d.ts} +1 -1
  255. package/dist/server-plugins.d.mts +4 -3
  256. package/dist/server-plugins.d.ts +4 -3
  257. package/dist/server-query-call.d-rVM_lsYk.d.mts +15 -0
  258. package/dist/server-query-call.d-rVM_lsYk.d.ts +15 -0
  259. package/dist/server-query-client.cjs +5 -3
  260. package/dist/server-query-client.d.mts +3 -2
  261. package/dist/server-query-client.d.ts +3 -2
  262. package/dist/server-query-client.mjs +5 -3
  263. package/dist/{server-query-runtime.d-DXRNhX_3.d.ts → server-query-runtime.d-BlHd90D0.d.ts} +2 -8
  264. package/dist/{server-query-runtime.d-aP52iuL5.d.mts → server-query-runtime.d-CCLGkQtE.d.mts} +2 -8
  265. package/dist/server.cjs +58 -52
  266. package/dist/server.d.mts +12 -12
  267. package/dist/server.d.ts +12 -12
  268. package/dist/server.mjs +34 -28
  269. package/dist/{spa-router.d-V6XLSTCy.d.mts → spa-router.d-BD-6WX1R.d.mts} +2 -2
  270. package/dist/{spa-router.d-DMKiBsHH.d.ts → spa-router.d-Cw5i_15e.d.ts} +2 -2
  271. package/dist/{ssg.d-MNedvvMB.d.ts → ssg.d-Bifiq0EL.d.ts} +2 -2
  272. package/dist/{ssg.d-BnCKPQL0.d.mts → ssg.d-CCE9aob5.d.mts} +2 -2
  273. package/dist/{store-core.d-Ad5biajo.d.ts → store-core.d-5tVn5vi1.d.ts} +12 -4
  274. package/dist/{store-core.d-BqJI1-ix.d.mts → store-core.d-BN2MxSG9.d.mts} +12 -4
  275. package/dist/testing.cjs +5 -4
  276. package/dist/testing.d.mts +2 -1
  277. package/dist/testing.d.ts +2 -1
  278. package/dist/testing.mjs +4 -3
  279. package/dist/{utils.d-BdjHKDuT.d.ts → utils.d-BUjpSNIO.d.ts} +1 -1
  280. package/dist/{utils.d-BEKLWa0Z.d.mts → utils.d-wGPLeVbq.d.mts} +1 -1
  281. package/dist/version.cjs +2 -2
  282. package/dist/version.mjs +1 -1
  283. package/dist/vite.cjs +25 -23
  284. package/dist/vite.d.mts +6 -6
  285. package/dist/vite.d.ts +6 -6
  286. package/dist/vite.mjs +24 -22
  287. package/package.json +7 -2
  288. package/dist/analyzer-435DCIQ6.cjs +0 -17
  289. package/dist/chunk-AHVF5GI2.cjs +0 -229
  290. package/dist/chunk-ONSZP5JK.mjs +0 -229
@@ -9,7 +9,6 @@
9
9
  var _chunkE5UN4OWXcjs = require('./chunk-E5UN4OWX.cjs');
10
10
 
11
11
 
12
- var _chunkMF3IA2AWcjs = require('./chunk-MF3IA2AW.cjs');
13
12
 
14
13
 
15
14
 
@@ -20,9 +19,10 @@ var _chunkMF3IA2AWcjs = require('./chunk-MF3IA2AW.cjs');
20
19
 
21
20
 
22
21
 
22
+ var _chunkNG2EZ6QScjs = require('./chunk-NG2EZ6QS.cjs');
23
23
 
24
24
 
25
- var _chunkNG2EZ6QScjs = require('./chunk-NG2EZ6QS.cjs');
25
+ var _chunkMF3IA2AWcjs = require('./chunk-MF3IA2AW.cjs');
26
26
 
27
27
 
28
28
  var _chunkVM57CK74cjs = require('./chunk-VM57CK74.cjs');
@@ -32,7 +32,7 @@ var _chunkMHKPXX3Jcjs = require('./chunk-MHKPXX3J.cjs');
32
32
 
33
33
 
34
34
 
35
- var _chunkXOGCNKB7cjs = require('./chunk-XOGCNKB7.cjs');
35
+ var _chunkA5BHJHDFcjs = require('./chunk-A5BHJHDF.cjs');
36
36
 
37
37
 
38
38
 
@@ -40,8 +40,7 @@ var _chunkXOGCNKB7cjs = require('./chunk-XOGCNKB7.cjs');
40
40
 
41
41
 
42
42
 
43
-
44
- var _chunkE3HBD2K3cjs = require('./chunk-E3HBD2K3.cjs');
43
+ var _chunkLN6FAYNBcjs = require('./chunk-LN6FAYNB.cjs');
45
44
 
46
45
 
47
46
 
@@ -65,16 +64,13 @@ var _chunkN3H7UPBMcjs = require('./chunk-N3H7UPBM.cjs');
65
64
  var _chunkYUQUGVSVcjs = require('./chunk-YUQUGVSV.cjs');
66
65
 
67
66
 
68
- var _chunkW6C3LEXXcjs = require('./chunk-W6C3LEXX.cjs');
69
-
70
-
71
67
  var _chunkNDOE76QCcjs = require('./chunk-NDOE76QC.cjs');
72
68
 
73
69
 
74
70
 
75
71
 
76
72
 
77
- var _chunkMOGRRZMWcjs = require('./chunk-MOGRRZMW.cjs');
73
+ var _chunk55UJGUBPcjs = require('./chunk-55UJGUBP.cjs');
78
74
 
79
75
 
80
76
  var _chunk3BTN3NP7cjs = require('./chunk-3BTN3NP7.cjs');
@@ -119,23 +115,23 @@ var _chunkO4JYMU5Ncjs = require('./chunk-O4JYMU5N.cjs');
119
115
 
120
116
 
121
117
 
122
- var _chunkCL7BUGVBcjs = require('./chunk-CL7BUGVB.cjs');
118
+ var _chunkJHRJ5V2Fcjs = require('./chunk-JHRJ5V2F.cjs');
123
119
 
124
120
 
125
121
 
126
122
 
127
123
 
128
124
 
129
- var _chunkZ5BANEQDcjs = require('./chunk-Z5BANEQD.cjs');
125
+ var _chunkDMSXZNQRcjs = require('./chunk-DMSXZNQR.cjs');
130
126
 
131
127
 
132
- var _chunkTCMRLW3Kcjs = require('./chunk-TCMRLW3K.cjs');
128
+ var _chunkVACYUMXWcjs = require('./chunk-VACYUMXW.cjs');
133
129
 
134
130
 
135
131
 
136
132
 
137
133
 
138
- var _chunkOUDNUFVRcjs = require('./chunk-OUDNUFVR.cjs');
134
+ var _chunkHRH7OKBQcjs = require('./chunk-HRH7OKBQ.cjs');
139
135
 
140
136
 
141
137
 
@@ -148,7 +144,7 @@ var _chunkOUDNUFVRcjs = require('./chunk-OUDNUFVR.cjs');
148
144
 
149
145
 
150
146
 
151
- var _chunkOFVCWV2Dcjs = require('./chunk-OFVCWV2D.cjs');
147
+ var _chunkNEKO3HM2cjs = require('./chunk-NEKO3HM2.cjs');
152
148
 
153
149
 
154
150
  var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
@@ -158,11 +154,15 @@ var _chunk47JV57DAcjs = require('./chunk-47JV57DA.cjs');
158
154
 
159
155
 
160
156
 
157
+ var _chunkOM6JIIJUcjs = require('./chunk-OM6JIIJU.cjs');
161
158
 
162
159
 
163
160
 
164
161
 
165
- var _chunkFYZD7DUScjs = require('./chunk-FYZD7DUS.cjs');
162
+
163
+
164
+
165
+ var _chunkWCSBYQOTcjs = require('./chunk-WCSBYQOT.cjs');
166
166
 
167
167
 
168
168
 
@@ -170,7 +170,7 @@ var _chunkFYZD7DUScjs = require('./chunk-FYZD7DUS.cjs');
170
170
  var _chunkW53Z4WDIcjs = require('./chunk-W53Z4WDI.cjs');
171
171
 
172
172
 
173
- var _chunkADQ2LATRcjs = require('./chunk-ADQ2LATR.cjs');
173
+ var _chunkIABI62FHcjs = require('./chunk-IABI62FH.cjs');
174
174
 
175
175
 
176
176
  var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
@@ -191,11 +191,11 @@ var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
191
191
 
192
192
 
193
193
 
194
- var _chunk46UV2E7Icjs = require('./chunk-46UV2E7I.cjs');
194
+ var _chunkEFI6QWBQcjs = require('./chunk-EFI6QWBQ.cjs');
195
195
 
196
196
 
197
197
 
198
- var _chunkSM2SYWARcjs = require('./chunk-SM2SYWAR.cjs');
198
+ var _chunkXJDB564Acjs = require('./chunk-XJDB564A.cjs');
199
199
 
200
200
 
201
201
 
@@ -203,6 +203,11 @@ var _chunkERMUL73Lcjs = require('./chunk-ERMUL73L.cjs');
203
203
 
204
204
 
205
205
 
206
+
207
+ var _chunkL2GUEYHRcjs = require('./chunk-L2GUEYHR.cjs');
208
+
209
+
210
+
206
211
  var _chunkIIHZ2BEEcjs = require('./chunk-IIHZ2BEE.cjs');
207
212
 
208
213
 
@@ -223,14 +228,14 @@ var _chunk52Q4OB4Acjs = require('./chunk-52Q4OB4A.cjs');
223
228
 
224
229
 
225
230
 
226
- var _chunkM6DAIE4Tcjs = require('./chunk-M6DAIE4T.cjs');
231
+ var _chunkNGTZHWBGcjs = require('./chunk-NGTZHWBG.cjs');
227
232
 
228
233
 
229
234
 
230
235
 
231
236
 
232
237
 
233
- var _chunk5ZHC6QGDcjs = require('./chunk-5ZHC6QGD.cjs');
238
+ var _chunkHQKCSJEHcjs = require('./chunk-HQKCSJEH.cjs');
234
239
 
235
240
 
236
241
  var _chunkXRFGOYXGcjs = require('./chunk-XRFGOYXG.cjs');
@@ -260,7 +265,7 @@ var _chunkBSX5OGSDcjs = require('./chunk-BSX5OGSD.cjs');
260
265
 
261
266
 
262
267
 
263
- var _chunkWGWWRV2Mcjs = require('./chunk-WGWWRV2M.cjs');
268
+ var _chunkB3HQTGXScjs = require('./chunk-B3HQTGXS.cjs');
264
269
 
265
270
 
266
271
  var _chunkQKW6DLDTcjs = require('./chunk-QKW6DLDT.cjs');
@@ -274,7 +279,7 @@ var _chunkNW3DL2PMcjs = require('./chunk-NW3DL2PM.cjs');
274
279
  var _chunkSHDCKRP4cjs = require('./chunk-SHDCKRP4.cjs');
275
280
 
276
281
 
277
- var _chunkLKIG5SM6cjs = require('./chunk-LKIG5SM6.cjs');
282
+ var _chunk5P65LXGUcjs = require('./chunk-5P65LXGU.cjs');
278
283
 
279
284
 
280
285
  var _chunkCYOTNHDFcjs = require('./chunk-CYOTNHDF.cjs');
@@ -302,7 +307,7 @@ var _chunk7U4XF76Rcjs = require('./chunk-7U4XF76R.cjs');
302
307
  var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
303
308
 
304
309
 
305
- var _chunkNSLRK5DKcjs = require('./chunk-NSLRK5DK.cjs');
310
+ var _chunk3CZ4MJHWcjs = require('./chunk-3CZ4MJHW.cjs');
306
311
 
307
312
 
308
313
  var _chunkY3DO7BIJcjs = require('./chunk-Y3DO7BIJ.cjs');
@@ -506,6 +511,7 @@ function toPosix(file) {
506
511
  var FARM_CLIENT_CSS_HREF_PLACEHOLDER = "/__farm_client_css_href__";
507
512
  var FARM_CLIENT_JS_SRC_PLACEHOLDER = "/__farm_client_js_src__";
508
513
  var FARM_CLIENT_BOOT_SRC_PLACEHOLDER = "/__farm_client_boot_src__";
514
+ var FARM_CLIENT_STYLESHEET_PLACEHOLDER = "__farm_client_stylesheet__";
509
515
  async function hashAndCopy(sourcePath, destinationDir, hashedName) {
510
516
  const fs5 = await import("fs/promises");
511
517
  try {
@@ -529,12 +535,21 @@ async function resolveHashedClientCssHref(clientOutputDir) {
529
535
  );
530
536
  return name ? `/assets/${name}` : "/farm-client.css";
531
537
  }
538
+ async function resolveClientStylesheetLinkHref(clientOutputDir, clientCssHref) {
539
+ const fs5 = await import("fs/promises");
540
+ try {
541
+ const stylesheet = await fs5.stat(_path2.default.join(clientOutputDir, "farm-client.css"));
542
+ return stylesheet.size > 0 ? clientCssHref : null;
543
+ } catch (e4) {
544
+ return null;
545
+ }
546
+ }
532
547
  async function findFingerprintedClientEntry(clientOutputDir) {
533
548
  const fs5 = await import("fs/promises");
534
549
  try {
535
550
  const entries = await fs5.readdir(clientOutputDir);
536
551
  return _nullishCoalesce(entries.find((name) => /^farm-client-h[0-9a-f]+\.js$/.test(name)), () => ( null));
537
- } catch (e4) {
552
+ } catch (e5) {
538
553
  return null;
539
554
  }
540
555
  }
@@ -544,7 +559,7 @@ async function resolveClientBootSrc(clientOutputDir) {
544
559
  const entries = await fs5.readdir(clientOutputDir);
545
560
  const name = entries.find((entry) => /^farm-client-boot-h[0-9a-f]+\.js$/.test(entry));
546
561
  return name ? `/${name}` : null;
547
- } catch (e5) {
562
+ } catch (e6) {
548
563
  return null;
549
564
  }
550
565
  }
@@ -616,7 +631,7 @@ function findSocialImagePath(html, basePath) {
616
631
  if (!_optionalChain([match, 'optionalAccess', _2 => _2[1]])) return null;
617
632
  try {
618
633
  return _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, new URL(match[1], FARM_DOCS_COMPILED_ORIGIN).pathname, basePath);
619
- } catch (e6) {
634
+ } catch (e7) {
620
635
  return null;
621
636
  }
622
637
  }
@@ -645,7 +660,7 @@ async function compileFarmDocsManifest(docs, options) {
645
660
  isPathGuarded: options.isPathGuarded,
646
661
  basePath
647
662
  });
648
- const apiHandler = _chunkE3HBD2K3cjs.createFarmDocsAPIHandler.call(void 0, {
663
+ const apiHandler = _chunkLN6FAYNBcjs.createFarmDocsAPIHandler.call(void 0, {
649
664
  rootDir: options.root,
650
665
  srcDir: options.srcDir,
651
666
  docs,
@@ -800,13 +815,15 @@ function collectFarmClientModulePreloads(bundle, options) {
800
815
  ...staticImports(chunk, loaded, [])
801
816
  ].map(index);
802
817
  }
803
- const dynamicFiles = (moduleIds) => {
818
+ const dynamicFiles = (moduleIds, before = []) => {
804
819
  const into = [];
805
- const loaded = new Set(entryLoaded);
820
+ const loaded = /* @__PURE__ */ new Set([...entryLoaded, ...before]);
806
821
  for (const moduleId of _nullishCoalesce(moduleIds, () => ( []))) {
807
- const chunk = chunks.find(
808
- (candidate) => candidate.isDynamicEntry && candidate.facadeModuleId && _path2.default.resolve(candidate.facadeModuleId.split("?")[0]) === _path2.default.resolve(moduleId)
809
- );
822
+ const is = (id) => _path2.default.resolve(id.split("?")[0]) === _path2.default.resolve(moduleId);
823
+ const chunk = _nullishCoalesce(chunks.find(
824
+ (candidate) => candidate.isDynamicEntry && candidate.facadeModuleId && is(candidate.facadeModuleId)
825
+ ), () => ( // A module another dynamic import shares can land in a common chunk without a facade.
826
+ chunks.find((candidate) => !candidate.isEntry && _optionalChain([candidate, 'access', _7 => _7.moduleIds, 'optionalAccess', _8 => _8.some, 'call', _9 => _9(is)]))));
810
827
  if (!chunk || loaded.has(chunk.fileName)) continue;
811
828
  loaded.add(chunk.fileName);
812
829
  into.push(chunk.fileName);
@@ -815,11 +832,15 @@ function collectFarmClientModulePreloads(bundle, options) {
815
832
  return into;
816
833
  };
817
834
  const rendererFiles = dynamicFiles(options.rendererModules);
835
+ const rootFiles = dynamicFiles(options.rootModules);
836
+ const actionFiles = dynamicFiles(options.actionModules, rendererFiles);
818
837
  return {
819
838
  files,
820
839
  entry: entryFiles.map(index),
821
840
  router: dynamicFiles(options.routerModules).map(index),
822
841
  ...rendererFiles.length > 0 ? { renderer: rendererFiles.map(index) } : {},
842
+ ...rootFiles.length > 0 ? { root: rootFiles.map(index) } : {},
843
+ ...actionFiles.length > 0 ? { actions: actionFiles.map(index) } : {},
823
844
  modules
824
845
  };
825
846
  }
@@ -828,15 +849,22 @@ function createFarmClientModulePreloadPlugin(options) {
828
849
  name: "farm-client-module-preloads",
829
850
  enforce: "post",
830
851
  async generateBundle(_output, bundle) {
831
- const rendererModules = [];
832
- for (const specifier of _nullishCoalesce(options.rendererImports, () => ( []))) {
833
- const resolved = await this.resolve(specifier, options.rendererImporter);
834
- if (resolved) rendererModules.push(resolved.id);
835
- }
852
+ const resolve = async (specifiers) => {
853
+ const ids = [];
854
+ for (const specifier of _nullishCoalesce(specifiers, () => ( []))) {
855
+ const resolved = await this.resolve(specifier, options.rendererImporter);
856
+ if (resolved) ids.push(resolved.id);
857
+ }
858
+ return ids;
859
+ };
860
+ const rendererModules = await resolve(options.rendererImports);
861
+ const actionModules = await resolve(options.actionImports);
836
862
  await _promises2.default.mkdir(options.buildDir, { recursive: true });
837
863
  await _promises2.default.writeFile(
838
864
  _path2.default.join(options.buildDir, FARM_CLIENT_MODULE_PRELOADS_FILE),
839
- JSON.stringify(collectFarmClientModulePreloads(bundle, { ...options, rendererModules }))
865
+ JSON.stringify(
866
+ collectFarmClientModulePreloads(bundle, { ...options, rendererModules, actionModules })
867
+ )
840
868
  );
841
869
  }
842
870
  };
@@ -846,7 +874,7 @@ async function readFarmClientModulePreloads(buildDir) {
846
874
  return JSON.parse(
847
875
  await _promises2.default.readFile(_path2.default.join(buildDir, FARM_CLIENT_MODULE_PRELOADS_FILE), "utf8")
848
876
  );
849
- } catch (e7) {
877
+ } catch (e8) {
850
878
  return null;
851
879
  }
852
880
  }
@@ -909,8 +937,10 @@ function resolveFarmDocsClientRoutes(pages, docsPagePaths) {
909
937
  function isStatic(segment) {
910
938
  return segment === "static";
911
939
  }
912
- function generateFarmClientRouteTableModule(table) {
913
- return `export default JSON.parse(${JSON.stringify(JSON.stringify(table))});
940
+ function generateFarmClientRouteTableModule(table, options = {}) {
941
+ const matcher = options.matcher ? `export { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";
942
+ ` : "";
943
+ return `${matcher}export default JSON.parse(${JSON.stringify(JSON.stringify(table))});
914
944
  `;
915
945
  }
916
946
  async function writeFarmClientRouteTable(buildDir, table) {
@@ -922,7 +952,7 @@ async function readFarmClientRouteTable(buildDir) {
922
952
  return JSON.parse(
923
953
  await _promises2.default.readFile(_path2.default.join(buildDir, FARM_CLIENT_ROUTE_TABLE_FILE), "utf8")
924
954
  );
925
- } catch (e8) {
955
+ } catch (e9) {
926
956
  return null;
927
957
  }
928
958
  }
@@ -1006,7 +1036,7 @@ async function readFarmDocsModulePreloads(buildDir) {
1006
1036
  return JSON.parse(
1007
1037
  await _promises2.default.readFile(_path2.default.join(buildDir, FARM_DOCS_MODULE_PRELOADS_FILE), "utf8")
1008
1038
  );
1009
- } catch (e9) {
1039
+ } catch (e10) {
1010
1040
  return null;
1011
1041
  }
1012
1042
  }
@@ -1022,7 +1052,7 @@ async function createFarmRouteRuntimeManifest(options) {
1022
1052
  const routes = [];
1023
1053
  for (const [pattern, entry] of options.routeManager.getRoutes()) {
1024
1054
  const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
1025
- const rendering = await _chunkOUDNUFVRcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
1055
+ const rendering = await _chunkHRH7OKBQcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
1026
1056
  const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
1027
1057
  routes.push({
1028
1058
  kind: "page",
@@ -1109,7 +1139,7 @@ function validateFarmRouteRuntimeDeployment(manifest, preset) {
1109
1139
  `Route "${route.pattern}" requires the ${route.runtime} runtime, but preset "${preset}" emits ${runtime} functions. Choose a compatible preset or change the route runtime.`
1110
1140
  );
1111
1141
  }
1112
- if (_optionalChain([route, 'access', _7 => _7.regions, 'optionalAccess', _8 => _8.length]) && preset !== "vercel") {
1142
+ if (_optionalChain([route, 'access', _10 => _10.regions, 'optionalAccess', _11 => _11.length]) && preset !== "vercel") {
1113
1143
  warnings.add(
1114
1144
  `Preset "${preset}" does not map per-route regions; Farm kept them in ${FARM_ROUTE_RUNTIME_MANIFEST} for deployment adapters.`
1115
1145
  );
@@ -1156,7 +1186,7 @@ async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs5, b
1156
1186
  const destinations = /* @__PURE__ */ new Map();
1157
1187
  let groupIndex = 0;
1158
1188
  for (const [key, group] of groups) {
1159
- if (!_optionalChain([group, 'access', _9 => _9.config, 'access', _10 => _10.regions, 'optionalAccess', _11 => _11.length]) && !group.config.maxDuration) {
1189
+ if (!_optionalChain([group, 'access', _12 => _12.config, 'access', _13 => _13.regions, 'optionalAccess', _14 => _14.length]) && !group.config.maxDuration) {
1160
1190
  destinations.set(key, "/__nitro");
1161
1191
  continue;
1162
1192
  }
@@ -1206,14 +1236,14 @@ async function configureVercelFunction(functionDir, config, fs5) {
1206
1236
  const current = JSON.parse(await fs5.readFile(configPath, "utf8"));
1207
1237
  const next = {
1208
1238
  ...current,
1209
- ..._optionalChain([config, 'access', _12 => _12.regions, 'optionalAccess', _13 => _13.length]) ? { regions: config.regions } : {},
1239
+ ..._optionalChain([config, 'access', _15 => _15.regions, 'optionalAccess', _16 => _16.length]) ? { regions: config.regions } : {},
1210
1240
  ...config.maxDuration ? { maxDuration: config.maxDuration } : {}
1211
1241
  };
1212
1242
  await fs5.writeFile(configPath, `${JSON.stringify(next, null, 2)}
1213
1243
  `);
1214
1244
  }
1215
1245
  function hasVercelFunctionControls(route) {
1216
- return Boolean(_optionalChain([route, 'access', _14 => _14.regions, 'optionalAccess', _15 => _15.length]) || route.maxDuration);
1246
+ return Boolean(_optionalChain([route, 'access', _17 => _17.regions, 'optionalAccess', _18 => _18.length]) || route.maxDuration);
1217
1247
  }
1218
1248
  function compareRuntimeRoutes(left, right) {
1219
1249
  const kindOrder = { page: 0, api: 0, metadata: 0, rule: 1 };
@@ -1258,7 +1288,7 @@ var FARM_HASHED_ASSET_DIRS = ["assets", "chunks"];
1258
1288
  var LITERAL_ROUTE_PATH = /^\/[\w.~@/-]+$/;
1259
1289
  function planFarmImmutableAssets(options) {
1260
1290
  const cacheRulePatterns = Object.entries(_nullishCoalesce(options.routeRules, () => ( {}))).filter(
1261
- ([, rule]) => Object.keys(_nullishCoalesce(_optionalChain([rule, 'optionalAccess', _16 => _16.headers]), () => ( {}))).some((name) => name.toLowerCase() === "cache-control")
1291
+ ([, rule]) => Object.keys(_nullishCoalesce(_optionalChain([rule, 'optionalAccess', _19 => _19.headers]), () => ( {}))).some((name) => name.toLowerCase() === "cache-control")
1262
1292
  ).map(([pattern]) => pattern);
1263
1293
  const isImmutable = (file) => isFarmImmutableAssetPath(file) && !cacheRulePatterns.some((pattern) => _chunkIUKBPBM7cjs.farmRouteRuleMatches.call(void 0, pattern, file));
1264
1294
  const routeDirs = new Set(
@@ -1376,7 +1406,7 @@ function resolveBundleFileName(chunkFileName, relativeUrl) {
1376
1406
  let relativePath = relativeUrl.replace(/[?#].*$/, "");
1377
1407
  try {
1378
1408
  relativePath = decodeURI(relativePath);
1379
- } catch (e10) {
1409
+ } catch (e11) {
1380
1410
  }
1381
1411
  const fileName = _path2.default.posix.normalize(
1382
1412
  _path2.default.posix.join(_path2.default.posix.dirname(chunkFileName), relativePath)
@@ -1386,7 +1416,7 @@ function resolveBundleFileName(chunkFileName, relativeUrl) {
1386
1416
  function replaceServerFileReferences(bundle, chunkFileName, code, replace) {
1387
1417
  return code.replace(SERVER_FILE_URL_RE, (reference, _quote, relativeUrl) => {
1388
1418
  const target = resolveBundleFileName(chunkFileName, relativeUrl);
1389
- return target && _optionalChain([bundle, 'access', _17 => _17[target], 'optionalAccess', _18 => _18.type]) === "asset" ? replace(target) : reference;
1419
+ return target && _optionalChain([bundle, 'access', _20 => _20[target], 'optionalAccess', _21 => _21.type]) === "asset" ? replace(target) : reference;
1390
1420
  });
1391
1421
  }
1392
1422
  function collectServerReadSSRAssets(bundle) {
@@ -1439,7 +1469,7 @@ function assertServerReadSSRAssetsSupported(bundle, preset, root) {
1439
1469
  if (assets.length === 0) return;
1440
1470
  const sources = assets.map((fileName) => {
1441
1471
  const output = bundle[fileName];
1442
- const original = _optionalChain([output, 'optionalAccess', _19 => _19.type]) === "asset" ? _optionalChain([output, 'access', _20 => _20.originalFileNames, 'optionalAccess', _21 => _21[0]]) : void 0;
1472
+ const original = _optionalChain([output, 'optionalAccess', _22 => _22.type]) === "asset" ? _optionalChain([output, 'access', _23 => _23.originalFileNames, 'optionalAccess', _24 => _24[0]]) : void 0;
1443
1473
  if (!original) return fileName;
1444
1474
  return _path2.default.relative(root, _path2.default.resolve(root, original)).split(_path2.default.sep).join("/");
1445
1475
  });
@@ -1458,7 +1488,7 @@ function createServerReadSSRAssetsPlugin(bundle, ssrOutputDir) {
1458
1488
  transform(code, id) {
1459
1489
  if (!code.includes("import.meta.url")) return null;
1460
1490
  const chunkFileName = _path2.default.relative(ssrOutputDir, id.split("?", 1)[0]).split(_path2.default.sep).join("/");
1461
- if (_optionalChain([bundle, 'access', _22 => _22[chunkFileName], 'optionalAccess', _23 => _23.type]) !== "chunk") return null;
1491
+ if (_optionalChain([bundle, 'access', _25 => _25[chunkFileName], 'optionalAccess', _26 => _26.type]) !== "chunk") return null;
1462
1492
  let changed = false;
1463
1493
  const transformed = replaceServerFileReferences(
1464
1494
  bundle,
@@ -1554,7 +1584,7 @@ export default async function farmNetlifyHandler(request, context) {
1554
1584
  var PLATFORM_CONFIG_KEYS = /* @__PURE__ */ new Set(["desktop", "mobile"]);
1555
1585
  var CONFIG_FACTORIES = /* @__PURE__ */ new Set(["defineConfig", "defineFarmConfig"]);
1556
1586
  function isConfigObject(node) {
1557
- return _optionalChain([node, 'optionalAccess', _24 => _24.type]) === "ObjectExpression";
1587
+ return _optionalChain([node, 'optionalAccess', _27 => _27.type]) === "ObjectExpression";
1558
1588
  }
1559
1589
  function propertyName(property) {
1560
1590
  if (property.type !== "Property" || property.computed) return void 0;
@@ -1575,7 +1605,7 @@ function collectConfigObjects(node, found) {
1575
1605
  }
1576
1606
  if (current.type === "CallExpression") {
1577
1607
  const callee = current.callee;
1578
- const name = callee.type === "Identifier" ? callee.name : _optionalChain([callee, 'access', _25 => _25.property, 'optionalAccess', _26 => _26.name]);
1608
+ const name = callee.type === "Identifier" ? callee.name : _optionalChain([callee, 'access', _28 => _28.property, 'optionalAccess', _29 => _29.name]);
1579
1609
  const argument = current.arguments[0];
1580
1610
  if (name && CONFIG_FACTORIES.has(name) && isConfigObject(argument)) found.push(argument);
1581
1611
  }
@@ -1608,7 +1638,7 @@ function stripPlatformConfigSource(code, parse) {
1608
1638
  const trailingComma = /^\s*,/.exec(code.slice(properties[last].end));
1609
1639
  removals.push([
1610
1640
  properties[first].start,
1611
- properties[last].end + (_nullishCoalesce(_optionalChain([trailingComma, 'optionalAccess', _27 => _27[0], 'access', _28 => _28.length]), () => ( 0)))
1641
+ properties[last].end + (_nullishCoalesce(_optionalChain([trailingComma, 'optionalAccess', _30 => _30[0], 'access', _31 => _31.length]), () => ( 0)))
1612
1642
  ]);
1613
1643
  }
1614
1644
  first = last;
@@ -1623,7 +1653,7 @@ function stripPlatformConfigSource(code, parse) {
1623
1653
  function realPath(file) {
1624
1654
  try {
1625
1655
  return _fs.realpathSync.call(void 0, file);
1626
- } catch (e11) {
1656
+ } catch (e12) {
1627
1657
  return _path2.default.resolve(file);
1628
1658
  }
1629
1659
  }
@@ -1635,7 +1665,7 @@ function farmStripPlatformConfigPlugin(configFiles) {
1635
1665
  // removed block used (`readFileSync` for a version, say).
1636
1666
  enforce: "pre",
1637
1667
  transform: {
1638
- filter: { id: _chunkCL7BUGVBcjs.fileNamePattern.call(void 0, configFiles) },
1668
+ filter: { id: _chunkJHRJ5V2Fcjs.fileNamePattern.call(void 0, configFiles) },
1639
1669
  async handler(code, id) {
1640
1670
  const file = id.split("?", 1)[0];
1641
1671
  if (!files.has(_path2.default.resolve(file)) && !files.has(realPath(file))) return null;
@@ -1683,12 +1713,12 @@ function precompileFarmMarkdownPages(bodies, coreRoot) {
1683
1713
  eval: true,
1684
1714
  workerData: { runtime: _url.pathToFileURL.call(void 0, runtime).href, bodies: [...new Set(bodies)] }
1685
1715
  });
1686
- } catch (e12) {
1716
+ } catch (e13) {
1687
1717
  done();
1688
1718
  return;
1689
1719
  }
1690
1720
  worker.once("message", (entries) => {
1691
- void _optionalChain([worker, 'optionalAccess', _29 => _29.terminate, 'call', _30 => _30()]);
1721
+ void _optionalChain([worker, 'optionalAccess', _32 => _32.terminate, 'call', _33 => _33()]);
1692
1722
  done(entries);
1693
1723
  });
1694
1724
  worker.once("error", () => done());
@@ -1697,7 +1727,7 @@ function precompileFarmMarkdownPages(bodies, coreRoot) {
1697
1727
  return {
1698
1728
  pages,
1699
1729
  dispose() {
1700
- void _optionalChain([worker, 'optionalAccess', _31 => _31.terminate, 'call', _32 => _32()]);
1730
+ void _optionalChain([worker, 'optionalAccess', _34 => _34.terminate, 'call', _35 => _35()]);
1701
1731
  }
1702
1732
  };
1703
1733
  }
@@ -1779,7 +1809,7 @@ function literalMatcher(node) {
1779
1809
  if (node.type === "Literal" && node.regex)
1780
1810
  return new RegExp(node.regex.pattern, node.regex.flags);
1781
1811
  if (node.type === "TemplateLiteral" && node.expressions.length === 0) {
1782
- return _nullishCoalesce(_optionalChain([node, 'access', _33 => _33.quasis, 'access', _34 => _34[0], 'optionalAccess', _35 => _35.value, 'optionalAccess', _36 => _36.cooked]), () => ( void 0));
1812
+ return _nullishCoalesce(_optionalChain([node, 'access', _36 => _36.quasis, 'access', _37 => _37[0], 'optionalAccess', _38 => _38.value, 'optionalAccess', _39 => _39.cooked]), () => ( void 0));
1783
1813
  }
1784
1814
  return void 0;
1785
1815
  }
@@ -1803,7 +1833,7 @@ function readStaticMiddlewareConfig(program) {
1803
1833
  let found = null;
1804
1834
  for (const statement of program.body) {
1805
1835
  if (statement.type === "ExportNamedDeclaration" && !statement.declaration) {
1806
- if (statement.specifiers.some((specifier) => _optionalChain([specifier, 'access', _37 => _37.exported, 'optionalAccess', _38 => _38.name]) === "config")) {
1836
+ if (statement.specifiers.some((specifier) => _optionalChain([specifier, 'access', _40 => _40.exported, 'optionalAccess', _41 => _41.name]) === "config")) {
1807
1837
  return "unknown";
1808
1838
  }
1809
1839
  continue;
@@ -1811,14 +1841,14 @@ function readStaticMiddlewareConfig(program) {
1811
1841
  const declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : null;
1812
1842
  if (!declaration || declaration.type !== "VariableDeclaration") continue;
1813
1843
  for (const declarator of declaration.declarations) {
1814
- if (_optionalChain([declarator, 'access', _39 => _39.id, 'optionalAccess', _40 => _40.type]) !== "Identifier" || declarator.id.name !== "config") continue;
1844
+ if (_optionalChain([declarator, 'access', _42 => _42.id, 'optionalAccess', _43 => _43.type]) !== "Identifier" || declarator.id.name !== "config") continue;
1815
1845
  if (declaration.kind !== "const" || !declarator.init) return "unknown";
1816
1846
  const init = unwrap(declarator.init);
1817
1847
  if (init.type !== "ObjectExpression") return "unknown";
1818
1848
  const config = {};
1819
1849
  for (const property of init.properties) {
1820
1850
  if (property.type !== "Property" || property.computed) return "unknown";
1821
- const key = _nullishCoalesce(_optionalChain([property, 'access', _41 => _41.key, 'optionalAccess', _42 => _42.name]), () => ( _optionalChain([property, 'access', _43 => _43.key, 'optionalAccess', _44 => _44.value])));
1851
+ const key = _nullishCoalesce(_optionalChain([property, 'access', _44 => _44.key, 'optionalAccess', _45 => _45.name]), () => ( _optionalChain([property, 'access', _46 => _46.key, 'optionalAccess', _47 => _47.value])));
1822
1852
  if (key === "runtime") {
1823
1853
  const runtime = literalMatcher(unwrap(property.value));
1824
1854
  if (runtime === "edge" || runtime === "nodejs") config.runtime = runtime;
@@ -1839,9 +1869,9 @@ async function readMiddlewareFileConfig(filePath) {
1839
1869
  try {
1840
1870
  const [{ readFile: readFile2 }, vite] = await Promise.all([import("fs/promises"), import("vite")]);
1841
1871
  const parsed = vite.parseSync(filePath, await readFile2(filePath, "utf8"));
1842
- if (_optionalChain([parsed, 'access', _45 => _45.errors, 'optionalAccess', _46 => _46.length])) return "unknown";
1872
+ if (_optionalChain([parsed, 'access', _48 => _48.errors, 'optionalAccess', _49 => _49.length])) return "unknown";
1843
1873
  return readStaticMiddlewareConfig(parsed.program);
1844
- } catch (e13) {
1874
+ } catch (e14) {
1845
1875
  return "unknown";
1846
1876
  }
1847
1877
  }
@@ -1858,7 +1888,7 @@ function farmTargetRunsEdgeMiddleware(preset) {
1858
1888
  return preset === "vercel";
1859
1889
  }
1860
1890
  function isFarmEdgeMiddlewareRoute(route) {
1861
- return typeof route.config === "object" && _optionalChain([route, 'access', _47 => _47.config, 'optionalAccess', _48 => _48.runtime]) === "edge";
1891
+ return typeof route.config === "object" && _optionalChain([route, 'access', _50 => _50.config, 'optionalAccess', _51 => _51.runtime]) === "edge";
1862
1892
  }
1863
1893
  function escapeRegExp3(value) {
1864
1894
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -1895,7 +1925,7 @@ export default createFarmVercelEdgeMiddleware({
1895
1925
  ${modules.join("\n")}
1896
1926
  ],
1897
1927
  i18n: ${JSON.stringify(config.i18n)},
1898
- server: ${JSON.stringify({ trustProxy: _optionalChain([config, 'access', _49 => _49.server, 'optionalAccess', _50 => _50.trustProxy]) === true })},
1928
+ server: ${JSON.stringify({ trustProxy: _optionalChain([config, 'access', _52 => _52.server, 'optionalAccess', _53 => _53.trustProxy]) === true })},
1899
1929
  apiBasePath: ${JSON.stringify(_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))},
1900
1930
  notFoundPath: ${JSON.stringify(_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, FARM_VERCEL_EDGE_NOT_FOUND_PATH, config.basePath))},
1901
1931
  pages: ${JSON.stringify(toFarmVercelEdgeGuardedUrls(guardedPages, config.basePath))},
@@ -1954,7 +1984,7 @@ async function writeFarmVercelEdgeMiddlewareFunction(options) {
1954
1984
  logLevel: "silent",
1955
1985
  plugins: [edgeNodeModulesPlugin(coreDir, unsupported)],
1956
1986
  resolve: {
1957
- alias: _chunkCL7BUGVBcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
1987
+ alias: _chunkJHRJ5V2Fcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
1958
1988
  conditionNames: ["edge-light", "worker", "browser", "import", "module", "default"]
1959
1989
  },
1960
1990
  transform: {
@@ -2014,7 +2044,7 @@ async function readFarmNativeStylesheets(clientOutputDir, clientCssHref) {
2014
2044
  "utf8"
2015
2045
  )
2016
2046
  };
2017
- } catch (e14) {
2047
+ } catch (e15) {
2018
2048
  return {};
2019
2049
  }
2020
2050
  }
@@ -2033,7 +2063,7 @@ function findFarmCoreRoot(from) {
2033
2063
  if (_fs.existsSync.call(void 0, manifest)) {
2034
2064
  try {
2035
2065
  if (JSON.parse(_fs.readFileSync.call(void 0, manifest, "utf8")).name === "@farm.js/core") return dir;
2036
- } catch (e15) {
2066
+ } catch (e16) {
2037
2067
  }
2038
2068
  }
2039
2069
  dir = _path2.default.dirname(dir);
@@ -2051,7 +2081,7 @@ function findInstalledPackageDir(name, from) {
2051
2081
  if (_fs.existsSync.call(void 0, _path2.default.join(candidate, "package.json"))) {
2052
2082
  try {
2053
2083
  return _fs.realpathSync.call(void 0, candidate);
2054
- } catch (e16) {
2084
+ } catch (e17) {
2055
2085
  return null;
2056
2086
  }
2057
2087
  }
@@ -2067,7 +2097,7 @@ function collectFarmDependencyDirs(root) {
2067
2097
  let manifest;
2068
2098
  try {
2069
2099
  manifest = JSON.parse(_fs.readFileSync.call(void 0, _path2.default.join(dir, "package.json"), "utf8"));
2070
- } catch (e17) {
2100
+ } catch (e18) {
2071
2101
  return;
2072
2102
  }
2073
2103
  for (const field of ["dependencies", "optionalDependencies", "peerDependencies"]) {
@@ -2083,7 +2113,7 @@ function collectFarmDependencyDirs(root) {
2083
2113
  if (name.startsWith("@farm.js/")) queue.push({ name, from: root });
2084
2114
  }
2085
2115
  }
2086
- } catch (e18) {
2116
+ } catch (e19) {
2087
2117
  }
2088
2118
  for (let next = queue.pop(); next; next = queue.pop()) {
2089
2119
  const dir = findInstalledPackageDir(next.name, next.from);
@@ -2186,14 +2216,14 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
2186
2216
  return {
2187
2217
  name: "farm-prerender-runtime-resolver",
2188
2218
  async resolveId(id, _importer, options) {
2189
- if (_optionalChain([options, 'access', _51 => _51.custom, 'optionalAccess', _52 => _52.farmPrerenderRuntimeResolve])) return null;
2219
+ if (_optionalChain([options, 'access', _54 => _54.custom, 'optionalAccess', _55 => _55.farmPrerenderRuntimeResolve])) return null;
2190
2220
  if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || _path2.default.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
2191
2221
  return null;
2192
2222
  }
2193
2223
  if (nitroEntry === void 0) {
2194
2224
  try {
2195
2225
  nitroEntry = resolveNitroEntry(root);
2196
- } catch (e19) {
2226
+ } catch (e20) {
2197
2227
  nitroEntry = null;
2198
2228
  }
2199
2229
  }
@@ -2214,7 +2244,7 @@ function createFarmStorageModuleRegistration(config) {
2214
2244
  let runtimeRequire = projectRequire;
2215
2245
  try {
2216
2246
  runtimeRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
2217
- } catch (e20) {
2247
+ } catch (e21) {
2218
2248
  }
2219
2249
  const loaders = [];
2220
2250
  for (const specifier of modules) {
@@ -2223,7 +2253,7 @@ function createFarmStorageModuleRegistration(config) {
2223
2253
  try {
2224
2254
  resolved = require2.resolve(specifier);
2225
2255
  break;
2226
- } catch (e21) {
2256
+ } catch (e22) {
2227
2257
  }
2228
2258
  }
2229
2259
  if (resolved) {
@@ -2241,7 +2271,7 @@ function resolveNitroPackageEntry(root) {
2241
2271
  let runtimeRequire = projectRequire;
2242
2272
  try {
2243
2273
  runtimeRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
2244
- } catch (e22) {
2274
+ } catch (e23) {
2245
2275
  }
2246
2276
  return runtimeRequire.resolve("nitro");
2247
2277
  }
@@ -2295,7 +2325,7 @@ async function canUseRolldownBuilder() {
2295
2325
  try {
2296
2326
  await import("rolldown");
2297
2327
  return true;
2298
- } catch (e23) {
2328
+ } catch (e24) {
2299
2329
  return false;
2300
2330
  }
2301
2331
  }
@@ -2309,12 +2339,12 @@ function hasReactDomEdgeServerBuild(root) {
2309
2339
  try {
2310
2340
  _module.createRequire.call(void 0, _path2.default.join(root, "package.json")).resolve("react-dom/server.edge");
2311
2341
  return true;
2312
- } catch (e24) {
2342
+ } catch (e25) {
2313
2343
  return false;
2314
2344
  }
2315
2345
  }
2316
2346
  function shouldAliasReactServerToWebBuild(renderer, preset) {
2317
- return _chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, renderer) && _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge";
2347
+ return _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, renderer) && _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge";
2318
2348
  }
2319
2349
  function isCloudflareImagePreset(preset) {
2320
2350
  return preset === "cloudflare" || preset === "cloudflare-pages" || preset === "cloudflare-module";
@@ -2344,7 +2374,7 @@ function isFarmCoreModule(file) {
2344
2374
  if (_fs.existsSync.call(void 0, manifest)) {
2345
2375
  try {
2346
2376
  return JSON.parse(_fs.readFileSync.call(void 0, manifest, "utf8")).name === "@farm.js/core";
2347
- } catch (e25) {
2377
+ } catch (e26) {
2348
2378
  return false;
2349
2379
  }
2350
2380
  }
@@ -2356,7 +2386,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
2356
2386
  return {
2357
2387
  name: "farm-omitted-metadata-image-runtime",
2358
2388
  resolveId: {
2359
- filter: { id: _chunkCL7BUGVBcjs.exactIdPattern.call(void 0, ["@vercel/og"]) },
2389
+ filter: { id: _chunkJHRJ5V2Fcjs.exactIdPattern.call(void 0, ["@vercel/og"]) },
2360
2390
  handler(source, importer) {
2361
2391
  if (source !== "@vercel/og") return null;
2362
2392
  const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(_path2.default.basename(importer.split("?", 1)[0]));
@@ -2365,7 +2395,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
2365
2395
  }
2366
2396
  },
2367
2397
  load: {
2368
- filter: { id: _chunkCL7BUGVBcjs.exactIdPattern.call(void 0, [FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID]) },
2398
+ filter: { id: _chunkJHRJ5V2Fcjs.exactIdPattern.call(void 0, [FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID]) },
2369
2399
  handler(id) {
2370
2400
  if (id !== FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID) return null;
2371
2401
  return `
@@ -2393,8 +2423,8 @@ function readVercelOgManifest(file) {
2393
2423
  }
2394
2424
  function resolveVercelOgConditionEntry(resolvedId, condition) {
2395
2425
  const vercelOg = readVercelOgManifest(resolvedId);
2396
- const entry = _optionalChain([vercelOg, 'optionalAccess', _53 => _53.manifest, 'access', _54 => _54.exports, 'optionalAccess', _55 => _55["."], 'optionalAccess', _56 => _56[condition]]);
2397
- const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess', _57 => _57.default]);
2426
+ const entry = _optionalChain([vercelOg, 'optionalAccess', _56 => _56.manifest, 'access', _57 => _57.exports, 'optionalAccess', _58 => _58["."], 'optionalAccess', _59 => _59[condition]]);
2427
+ const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess', _60 => _60.default]);
2398
2428
  return vercelOg && typeof file === "string" ? _path2.default.join(vercelOg.dir, file) : null;
2399
2429
  }
2400
2430
  function createEdgeMetadataImageRuntimePlugin({
@@ -2410,7 +2440,7 @@ function createEdgeMetadataImageRuntimePlugin({
2410
2440
  const edgeEntry = resolveVercelOgConditionEntry(resolved.id, condition);
2411
2441
  return edgeEntry ? { ...resolved, id: edgeEntry } : resolved;
2412
2442
  }
2413
- if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _58 => _58.replace, 'call', _59 => _59(/\\/g, "/"), 'access', _60 => _60.includes, 'call', _61 => _61("/@vercel/og/")])) {
2443
+ if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _61 => _61.replace, 'call', _62 => _62(/\\/g, "/"), 'access', _63 => _63.includes, 'call', _64 => _64("/@vercel/og/")])) {
2414
2444
  return null;
2415
2445
  }
2416
2446
  const resolvedPath = _path2.default.resolve(_path2.default.dirname(importer.split("?", 1)[0]), source);
@@ -2432,7 +2462,7 @@ function createVercelOgFontInlinePlugin(runtime = "Cloudflare Workers") {
2432
2462
  return `Promise.resolve({ arrayBuffer: () => Uint8Array.from(atob(${JSON.stringify(encoded)}), (character) => character.charCodeAt(0)).buffer })`;
2433
2463
  });
2434
2464
  if (inlined !== code) return { code: inlined, map: null };
2435
- const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call', _62 => _62(file), 'optionalAccess', _63 => _63.manifest, 'access', _64 => _64.version]), () => ( "(unknown version)"));
2465
+ const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call', _65 => _65(file), 'optionalAccess', _66 => _66.manifest, 'access', _67 => _67.version]), () => ( "(unknown version)"));
2436
2466
  this.error(
2437
2467
  `@vercel/og ${version} cannot be bundled for ${runtime}: ${file} does not load its default font with fetch(new URL("./<font>.ttf", import.meta.url)), the pattern Farm inlines because an edge function cannot fetch it. Install a @vercel/og version whose edge build does, such as 1.0.1.`
2438
2468
  );
@@ -2443,7 +2473,7 @@ function createMetadataImageWasmPlugin() {
2443
2473
  return {
2444
2474
  name: "farm-metadata-image-wasm",
2445
2475
  resolveId(source, importer) {
2446
- if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _65 => _65.replace, 'call', _66 => _66(/\\/g, "/"), 'access', _67 => _67.includes, 'call', _68 => _68("/@vercel/og/")])) {
2476
+ if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _68 => _68.replace, 'call', _69 => _69(/\\/g, "/"), 'access', _70 => _70.includes, 'call', _71 => _71("/@vercel/og/")])) {
2447
2477
  return null;
2448
2478
  }
2449
2479
  const requestPath = source.slice(0, -"?module".length);
@@ -2519,9 +2549,9 @@ function hasFarmRuntimeConfigModule(config, configModulePath) {
2519
2549
  return Boolean(configModulePath || (config.layers || []).some((layer) => layer.configFile));
2520
2550
  }
2521
2551
  function nameCodeSplittingGroups(bundlerConfig) {
2522
- const outputs = _optionalChain([bundlerConfig, 'optionalAccess', _69 => _69.output]);
2552
+ const outputs = _optionalChain([bundlerConfig, 'optionalAccess', _72 => _72.output]);
2523
2553
  for (const output of Array.isArray(outputs) ? outputs : [outputs]) {
2524
- const groups = _optionalChain([output, 'optionalAccess', _70 => _70.codeSplitting, 'optionalAccess', _71 => _71.groups]);
2554
+ const groups = _optionalChain([output, 'optionalAccess', _73 => _73.codeSplitting, 'optionalAccess', _74 => _74.groups]);
2525
2555
  if (!Array.isArray(groups)) continue;
2526
2556
  groups.forEach((group, index) => {
2527
2557
  if (group && typeof group.name === "function" && !group.debugName) {
@@ -2553,7 +2583,7 @@ function lexDynamicImportArguments(code) {
2553
2583
  }
2554
2584
  try {
2555
2585
  return _esmodulelexer.parse.call(void 0, code)[0].filter((entry) => entry.d > -1).map((entry) => ({ start: entry.s, end: entry.e }));
2556
- } catch (e26) {
2586
+ } catch (e27) {
2557
2587
  return null;
2558
2588
  }
2559
2589
  }
@@ -2582,9 +2612,9 @@ function restoreLiteralModuleSpecifiers(code, fileName, { parseSync, Visitor })
2582
2612
  throw new Error(`Failed to minify ${fileName}: ${parsed.errors[0].message}`);
2583
2613
  }
2584
2614
  const restore = (node) => {
2585
- if (_optionalChain([node, 'optionalAccess', _72 => _72.type]) !== "TemplateLiteral") return;
2615
+ if (_optionalChain([node, 'optionalAccess', _75 => _75.type]) !== "TemplateLiteral") return;
2586
2616
  const template = node;
2587
- const value = _optionalChain([template, 'access', _73 => _73.quasis, 'access', _74 => _74[0], 'optionalAccess', _75 => _75.value, 'access', _76 => _76.cooked]);
2617
+ const value = _optionalChain([template, 'access', _76 => _76.quasis, 'access', _77 => _77[0], 'optionalAccess', _78 => _78.value, 'access', _79 => _79.cooked]);
2588
2618
  if (template.expressions.length > 0 || typeof value !== "string") return;
2589
2619
  replacements.push({
2590
2620
  start: template.start,
@@ -2662,7 +2692,7 @@ function hasProjectPostcssConfig(root) {
2662
2692
  try {
2663
2693
  projectRequire.resolve(`./${file}`);
2664
2694
  return true;
2665
- } catch (e27) {
2695
+ } catch (e28) {
2666
2696
  return false;
2667
2697
  }
2668
2698
  });
@@ -2684,7 +2714,7 @@ async function findFarmConfigPath(root) {
2684
2714
  try {
2685
2715
  await fs5.access(resolvedPath);
2686
2716
  return resolvedPath;
2687
- } catch (e28) {
2717
+ } catch (e29) {
2688
2718
  }
2689
2719
  }
2690
2720
  return null;
@@ -2694,7 +2724,7 @@ function hasFarmPluginRoutes(config) {
2694
2724
  }
2695
2725
  function farmServerRuntimePluginsMayHandlePath(config, pathname) {
2696
2726
  return (config.plugins || []).some(
2697
- (plugin) => _chunkWGWWRV2Mcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && // Mobile session tokens change only bearer requests and cookie-clearing responses, which a
2727
+ (plugin) => _chunkB3HQTGXScjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && // Mobile session tokens change only bearer requests and cookie-clearing responses, which a
2698
2728
  // prerendered file never answers or sends; its endpoints live under /__farm/.
2699
2729
  plugin.name !== _chunkMHKPXX3Jcjs.FARM_MOBILE_SESSION_PLUGIN && _chunk47JV57DAcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
2700
2730
  );
@@ -2707,7 +2737,7 @@ async function discoverMiddlewareRoutes(appDir) {
2707
2737
  let entries;
2708
2738
  try {
2709
2739
  entries = await fs5.readdir(dir, { withFileTypes: true });
2710
- } catch (e29) {
2740
+ } catch (e30) {
2711
2741
  return;
2712
2742
  }
2713
2743
  const middlewareFile = entries.find(
@@ -2742,7 +2772,7 @@ async function discoverMiddlewareRoutes(appDir) {
2742
2772
  return Array.from(routes.values()).sort(_chunkSHDCKRP4cjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
2743
2773
  }
2744
2774
  function assertFarmDocsRuntimeSupported(config, preset) {
2745
- if (!_optionalChain([config, 'access', _77 => _77.docs, 'optionalAccess', _78 => _78.enabled]) || !_optionalChain([config, 'access', _79 => _79.docs, 'access', _80 => _80.adapter, 'optionalAccess', _81 => _81.server]) || _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" || Boolean(config.docs.adapter.edgeCompiler)) {
2775
+ if (!_optionalChain([config, 'access', _80 => _80.docs, 'optionalAccess', _81 => _81.enabled]) || !_optionalChain([config, 'access', _82 => _82.docs, 'access', _83 => _83.adapter, 'optionalAccess', _84 => _84.server]) || _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" || Boolean(config.docs.adapter.edgeCompiler)) {
2746
2776
  return;
2747
2777
  }
2748
2778
  throw new Error(
@@ -2834,7 +2864,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
2834
2864
  const productionVite = productionViteResult.value;
2835
2865
  _chunk7U4XF76Rcjs.logger.info("\u26A1 Building application bundles with Vite Rolldown");
2836
2866
  const mobileClient = shouldBuildFarmMobileClient(config);
2837
- const rendererDisabled = _chunkM6DAIE4Tcjs.isFarmRendererDisabled.call(void 0, config.renderer);
2867
+ const rendererDisabled = _chunkNGTZHWBGcjs.isFarmRendererDisabled.call(void 0, config.renderer);
2838
2868
  const buildClientBundle = async () => {
2839
2869
  if (rendererDisabled) {
2840
2870
  await fs5.rm(clientOutputDir, { recursive: true, force: true });
@@ -2923,7 +2953,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
2923
2953
  );
2924
2954
  }
2925
2955
  }
2926
- _optionalChain([sourceSnapshot, 'optionalAccess', _82 => _82.clear, 'call', _83 => _83()]);
2956
+ _optionalChain([sourceSnapshot, 'optionalAccess', _85 => _85.clear, 'call', _86 => _86()]);
2927
2957
  const ssrResult = ssrBuildResult.value;
2928
2958
  const routeRuntimeManifest = routeRuntimeManifestResult.value;
2929
2959
  const runtimeValidation = validateFarmRouteRuntimeDeployment(routeRuntimeManifest, preset);
@@ -2955,7 +2985,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
2955
2985
  configuredHeaderRoutes,
2956
2986
  nitroBuilderResultPromise,
2957
2987
  lifecyclePluginManager,
2958
- _optionalChain([markdownPrecompile, 'optionalAccess', _84 => _84.pages])
2988
+ _optionalChain([markdownPrecompile, 'optionalAccess', _87 => _87.pages])
2959
2989
  );
2960
2990
  const runtimeManifestPath = await writeFarmRouteRuntimeManifest(
2961
2991
  _path2.default.join(root, distDir),
@@ -2976,8 +3006,8 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
2976
3006
  _chunk7U4XF76Rcjs.logger.error(`\u274C Build failed: ${error}`);
2977
3007
  throw error;
2978
3008
  } finally {
2979
- _optionalChain([rendererBuild, 'optionalAccess', _85 => _85.abort, 'call', _86 => _86()]);
2980
- _optionalChain([markdownPrecompile, 'optionalAccess', _87 => _87.dispose, 'call', _88 => _88()]);
3009
+ _optionalChain([rendererBuild, 'optionalAccess', _88 => _88.abort, 'call', _89 => _89()]);
3010
+ _optionalChain([markdownPrecompile, 'optionalAccess', _90 => _90.dispose, 'call', _91 => _91()]);
2981
3011
  }
2982
3012
  }
2983
3013
  function collectFarmPrerenderedMarkdownBodies(pageRoutes) {
@@ -2985,7 +3015,7 @@ function collectFarmPrerenderedMarkdownBodies(pageRoutes) {
2985
3015
  for (const route of pageRoutes) {
2986
3016
  if (route.source === void 0 || !_chunk26WP75W5cjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) continue;
2987
3017
  const { body } = _chunk26WP75W5cjs.parseMarkdownFrontmatter.call(void 0, route.source);
2988
- const rendering = _chunkOUDNUFVRcjs.resolveRouteRenderingConfig.call(void 0,
3018
+ const rendering = _chunkHRH7OKBQcjs.resolveRouteRenderingConfig.call(void 0,
2989
3019
  _chunk26WP75W5cjs.readFarmMarkdownRouteConfig.call(void 0, body),
2990
3020
  route.source
2991
3021
  );
@@ -3000,7 +3030,7 @@ function varyFarmNitroCacheRules(rules, headerNames) {
3000
3030
  if (headerNames.length === 0) return rules;
3001
3031
  return Object.fromEntries(
3002
3032
  Object.entries(rules).map(([source, rule]) => {
3003
- const cached = _optionalChain([rule, 'optionalAccess', _89 => _89.swr]) !== void 0 && rule.swr !== false || _optionalChain([rule, 'optionalAccess', _90 => _90.cache]) !== void 0 && rule.cache !== false;
3033
+ const cached = _optionalChain([rule, 'optionalAccess', _92 => _92.swr]) !== void 0 && rule.swr !== false || _optionalChain([rule, 'optionalAccess', _93 => _93.cache]) !== void 0 && rule.cache !== false;
3004
3034
  if (!cached || rule.cache === false) return [source, rule];
3005
3035
  const cache = rule.cache && typeof rule.cache === "object" ? rule.cache : {};
3006
3036
  const varies = [
@@ -3029,7 +3059,7 @@ async function writeFarmVideoPlayerToClient(outputDir) {
3029
3059
  const filePath = _path2.default.join(outputDir, _chunkY3DO7BIJcjs.FARM_VIDEO_PLAYER_PATH.slice(1));
3030
3060
  await fs5.mkdir(_path2.default.dirname(filePath), { recursive: true });
3031
3061
  try {
3032
- await fs5.writeFile(filePath, _chunkCL7BUGVBcjs.FARM_VIDEO_PLAYER_HTML, { flag: "wx" });
3062
+ await fs5.writeFile(filePath, _chunkJHRJ5V2Fcjs.FARM_VIDEO_PLAYER_HTML, { flag: "wx" });
3033
3063
  } catch (error) {
3034
3064
  if (error.code !== "EEXIST") throw error;
3035
3065
  }
@@ -3051,7 +3081,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
3051
3081
  if (fontCss === void 0) {
3052
3082
  try {
3053
3083
  fontCss = await fs5.readFile(fontCssPath);
3054
- } catch (e30) {
3084
+ } catch (e31) {
3055
3085
  return;
3056
3086
  }
3057
3087
  }
@@ -3059,11 +3089,11 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
3059
3089
  let clientCss = "";
3060
3090
  try {
3061
3091
  clientCss = await fs5.readFile(clientCssPath, "utf8");
3062
- } catch (e31) {
3092
+ } catch (e32) {
3063
3093
  }
3064
3094
  const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
3065
3095
  await fs5.writeFile(fontCssPath, normalizedFontCss);
3066
- await fs5.writeFile(clientCssPath, _chunkCL7BUGVBcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
3096
+ await fs5.writeFile(clientCssPath, _chunkJHRJ5V2Fcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
3067
3097
  }
3068
3098
  function importsFarmClientBlockedPackage(id, packageName) {
3069
3099
  return id === packageName || id.startsWith(`${packageName}/`);
@@ -3086,7 +3116,7 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
3086
3116
  try {
3087
3117
  const clientEntry = await fs5.stat(clientEntryPath);
3088
3118
  if (clientEntry.isFile()) clientEntrySize = clientEntry.size;
3089
- } catch (e32) {
3119
+ } catch (e33) {
3090
3120
  }
3091
3121
  if (clientEntrySize === 0) {
3092
3122
  throw new IncompleteClientBuildOutputError("farm-client.js is missing or empty");
@@ -3097,7 +3127,7 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
3097
3127
  try {
3098
3128
  const globalsCss = await fs5.readFile(globalsCssPath, "utf8");
3099
3129
  expectsCss = globalsCss.replace(/\/\*[\s\S]*?\*\//g, "").trim().length > 0;
3100
- } catch (e33) {
3130
+ } catch (e34) {
3101
3131
  }
3102
3132
  try {
3103
3133
  const clientCss = await fs5.stat(clientCssPath);
@@ -3113,10 +3143,10 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
3113
3143
  }
3114
3144
  }
3115
3145
  function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, options = {}) {
3116
- const key = _chunk46UV2E7Icjs.getClientModuleHydrationPlanKey.call(void 0, modulePath, root, mode, options);
3146
+ const key = _chunkEFI6QWBQcjs.getClientModuleHydrationPlanKey.call(void 0, modulePath, root, mode, options);
3117
3147
  let plan = cache.get(key);
3118
3148
  if (!plan) {
3119
- plan = _chunk46UV2E7Icjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
3149
+ plan = _chunkEFI6QWBQcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
3120
3150
  cache.set(key, plan);
3121
3151
  }
3122
3152
  return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
@@ -3130,7 +3160,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3130
3160
  farmPlugin,
3131
3161
  farmServerOnlyEntriesPlugin
3132
3162
  } = await import("./vite.cjs");
3133
- const { PluginManager: PluginManager2 } = await import("./plugin-LN3JBZRR.cjs");
3163
+ const { PluginManager: PluginManager2 } = await import("./plugin-3PT7I26P.cjs");
3134
3164
  const fs5 = await import("fs/promises");
3135
3165
  const pluginManager = new PluginManager2({
3136
3166
  config,
@@ -3139,52 +3169,50 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3139
3169
  });
3140
3170
  pluginManager.addPlugins(config.plugins || []);
3141
3171
  const clientPages = [];
3142
- const integrationProviders = _chunkWGWWRV2Mcjs.getIntegrationProviders.call(void 0, config.integrations).filter(
3172
+ const integrationProviders = _chunkB3HQTGXScjs.getIntegrationProviders.call(void 0, config.integrations).filter(
3143
3173
  (provider) => provider.component || provider.type === "clerk"
3144
3174
  );
3145
3175
  const unsupportedIntegrationProvider = integrationProviders.find(
3146
3176
  (provider) => provider.supportsIsolatedHydration !== true
3147
3177
  );
3148
- if (_optionalChain([config, 'access', _91 => _91.experimental, 'optionalAccess', _92 => _92.isolatedClientHydration]) === "enabled" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _93 => _93.experimental, 'optionalAccess', _94 => _94.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
3178
+ if (_optionalChain([config, 'access', _94 => _94.experimental, 'optionalAccess', _95 => _95.isolatedClientHydration]) === "enabled" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _96 => _96.experimental, 'optionalAccess', _97 => _97.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
3149
3179
  _chunk7U4XF76Rcjs.logger.warn(
3150
3180
  `[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
3151
3181
  );
3152
3182
  }
3153
- const isolatedMode = _chunk46UV2E7Icjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
3154
- _optionalChain([config, 'access', _95 => _95.experimental, 'optionalAccess', _96 => _96.isolatedClientHydration]),
3183
+ const isolatedMode = _chunkEFI6QWBQcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
3184
+ _optionalChain([config, 'access', _98 => _98.experimental, 'optionalAccess', _99 => _99.isolatedClientHydration]),
3155
3185
  {
3156
- serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _97 => _97.experimental, 'optionalAccess', _98 => _98.serverComponents])) === "rsc",
3186
+ serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _100 => _100.experimental, 'optionalAccess', _101 => _101.serverComponents])) === "rsc",
3157
3187
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
3158
3188
  }
3159
3189
  );
3160
- const planOptions = _chunk46UV2E7Icjs.getFarmClientHydrationPlanOptions.call(void 0,
3190
+ const planOptions = _chunkEFI6QWBQcjs.getFarmClientHydrationPlanOptions.call(void 0,
3161
3191
  config.renderer,
3162
3192
  Boolean(unsupportedIntegrationProvider)
3163
3193
  );
3164
3194
  const pagePlanOptions = {
3165
3195
  ...planOptions,
3166
- serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _99 => _99.experimental, 'optionalAccess', _100 => _100.serverComponents])) === "islands"
3196
+ serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _102 => _102.experimental, 'optionalAccess', _103 => _103.serverComponents])) === "islands"
3167
3197
  };
3168
3198
  const layoutPlanOptions = {
3169
3199
  ...planOptions,
3170
3200
  serverTreeLayouts: pagePlanOptions.serverOwners
3171
3201
  };
3172
- const layoutAppliesToRoute = _chunkOFVCWV2Dcjs.routeBoundaryCoversDirectory;
3202
+ const layoutAppliesToRoute = _chunkNEKO3HM2cjs.routeBoundaryCoversDirectory;
3173
3203
  const routeDirectory = (route) => _nullishCoalesce(route.directory, () => ( route.pattern));
3174
- const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _101 => _101.experimental, 'optionalAccess', _102 => _102.serverComponents])) === "islands";
3175
- const adapterOwnsDocsRuntime = Boolean(
3176
- _chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _103 => _103.docs, 'optionalAccess', _104 => _104.enabled]) && _optionalChain([config, 'access', _105 => _105.docs, 'access', _106 => _106.adapter, 'optionalAccess', _107 => _107.server]) && config.docs.adapter.react
3177
- );
3178
- const docsEntries = _optionalChain([config, 'access', _108 => _108.docs, 'optionalAccess', _109 => _109.enabled]) ? _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs).map(
3204
+ const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _104 => _104.experimental, 'optionalAccess', _105 => _105.serverComponents])) === "islands";
3205
+ const adapterOwnsDocsRuntime = _chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs);
3206
+ const docsEntries = _optionalChain([config, 'access', _106 => _106.docs, 'optionalAccess', _107 => _107.enabled]) ? _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs).map(
3179
3207
  (docsRoot) => `/${docsRoot.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/"
3180
3208
  ) : [];
3181
3209
  const adapterDocsEntry = _nullishCoalesce(docsEntries[0], () => ( null));
3182
3210
  const isAdapterDocsRoute = (routePattern) => adapterOwnsDocsRuntime && docsEntries.some(
3183
3211
  (docsEntry) => docsEntry === "/" || routePattern === docsEntry || routePattern.startsWith(`${docsEntry}/`)
3184
3212
  );
3185
- const syntheticDocsEntry = _optionalChain([config, 'access', _110 => _110.docs, 'optionalAccess', _111 => _111.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
3213
+ const syntheticDocsEntry = _optionalChain([config, 'access', _108 => _108.docs, 'optionalAccess', _109 => _109.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
3186
3214
  const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
3187
- const plan = (operation) => sourceSnapshot ? _chunk46UV2E7Icjs.withFarmSourceSnapshotOf.call(void 0, sourceSnapshot, operation) : _chunk46UV2E7Icjs.withFarmSourceSnapshot.call(void 0, operation);
3215
+ const plan = (operation) => sourceSnapshot ? _chunkEFI6QWBQcjs.withFarmSourceSnapshotOf.call(void 0, sourceSnapshot, operation) : _chunkEFI6QWBQcjs.withFarmSourceSnapshot.call(void 0, operation);
3188
3216
  const { clientLayouts, clientRouteSlots } = plan(() => {
3189
3217
  const clientLayouts2 = layoutRoutes.map((layout) => {
3190
3218
  try {
@@ -3231,7 +3259,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3231
3259
  };
3232
3260
  }
3233
3261
  });
3234
- const markdownPagePlan = _chunk46UV2E7Icjs.createMarkdownPageHydrationPlanner.call(void 0,
3262
+ const markdownPagePlan = _chunkEFI6QWBQcjs.createMarkdownPageHydrationPlanner.call(void 0,
3235
3263
  _chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), root),
3236
3264
  root,
3237
3265
  isolatedMode,
@@ -3247,7 +3275,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3247
3275
  pagePlanOptions
3248
3276
  )
3249
3277
  }));
3250
- _chunk46UV2E7Icjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
3278
+ _chunkEFI6QWBQcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
3251
3279
  clientLayouts2.map((layout) => ({
3252
3280
  pattern: layout.pattern,
3253
3281
  depth: layout.pattern.split("/").filter(Boolean).length,
@@ -3256,7 +3284,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3256
3284
  [
3257
3285
  ...routePlans.map(({ route, metadata }) => ({
3258
3286
  pattern: routeDirectory(route),
3259
- depth: _chunkOFVCWV2Dcjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
3287
+ depth: _chunkNEKO3HM2cjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
3260
3288
  metadata
3261
3289
  })),
3262
3290
  ...syntheticDocsPatterns.map((pattern) => ({
@@ -3281,7 +3309,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3281
3309
  const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || docsEntries.some((docsEntry) => layoutAppliesToRoute(layout.pattern, docsEntry));
3282
3310
  if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
3283
3311
  _chunk7U4XF76Rcjs.logger.warn(
3284
- `\u26A0\uFE0F ${_chunk46UV2E7Icjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`
3312
+ `\u26A0\uFE0F ${_chunkEFI6QWBQcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`
3285
3313
  );
3286
3314
  }
3287
3315
  }
@@ -3316,7 +3344,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3316
3344
  );
3317
3345
  if (metadata.suppressedAsyncHydration) {
3318
3346
  _chunk7U4XF76Rcjs.logger.warn(
3319
- `\u26A0\uFE0F ${_chunk46UV2E7Icjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
3347
+ `\u26A0\uFE0F ${_chunkEFI6QWBQcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
3320
3348
  );
3321
3349
  }
3322
3350
  const slotBoundaries = serverSlotPlans.filter(
@@ -3324,7 +3352,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3324
3352
  ).flatMap(({ plan: plan2 }) => plan2.isolatedBoundaries);
3325
3353
  if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0 || slotBoundaries.length > 0) {
3326
3354
  const relativePath = route.modulePath.replace(root, "").replace(/^\//, "");
3327
- const islandStrategy = _chunkCL7BUGVBcjs.resolveFarmRouteRootStrategy.call(void 0,
3355
+ const islandStrategy = _chunkJHRJ5V2Fcjs.resolveFarmRouteRootStrategy.call(void 0,
3328
3356
  route,
3329
3357
  metadata,
3330
3358
  clientLayouts2,
@@ -3343,7 +3371,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3343
3371
  ...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
3344
3372
  ],
3345
3373
  // The server renders a server tree only below a hydrating layout.
3346
- ..._chunk46UV2E7Icjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
3374
+ ..._chunkEFI6QWBQcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
3347
3375
  });
3348
3376
  _chunk7U4XF76Rcjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
3349
3377
  }
@@ -3380,7 +3408,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3380
3408
  }
3381
3409
  const clientRouteSlots2 = routeSlots.filter((slot) => {
3382
3410
  try {
3383
- const metadata = _chunk46UV2E7Icjs.getClientModuleMetadata.call(void 0, slot.modulePath, root);
3411
+ const metadata = _chunkEFI6QWBQcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root);
3384
3412
  return metadata.shouldHydrate && (!islandsMode || metadata.isClientComponent);
3385
3413
  } catch (error) {
3386
3414
  _chunk7U4XF76Rcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
@@ -3424,20 +3452,20 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3424
3452
  srcDir,
3425
3453
  adapterOwnsDocsRuntime ? false : _chunkN3H7UPBMcjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
3426
3454
  adapterOwnsDocsRuntime ? void 0 : _chunkN3H7UPBMcjs.resolveFarmDocsSearchClientModule.call(void 0, root),
3427
- _optionalChain([config, 'access', _112 => _112.docs, 'optionalAccess', _113 => _113.enabled]) ? _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
3428
- adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _114 => _114.docs, 'access', _115 => _115.adapter, 'optionalAccess', _116 => _116.react]) : void 0,
3455
+ _optionalChain([config, 'access', _110 => _110.docs, 'optionalAccess', _111 => _111.enabled]) ? _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
3456
+ adapterOwnsDocsRuntime ? _chunkL2GUEYHRcjs.getFarmDocsAdapterUIModule.call(void 0, config.docs.adapter) : void 0,
3429
3457
  config.i18n,
3430
3458
  config.plugins,
3431
3459
  config.renderer,
3432
3460
  config.publicRuntimeConfig,
3433
3461
  config.trailingSlash,
3434
- _chunkWGWWRV2Mcjs.getIntegrationProviders.call(void 0, config.integrations),
3462
+ _chunkB3HQTGXScjs.getIntegrationProviders.call(void 0, config.integrations),
3435
3463
  config.basePath,
3436
- _chunkCL7BUGVBcjs.generateClientCachePersistenceCode.call(void 0, _chunkCL7BUGVBcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
3437
- adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
3438
- _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _117 => _117.experimental, 'optionalAccess', _118 => _118.serverComponents])) === "islands",
3464
+ _chunkJHRJ5V2Fcjs.generateClientCachePersistenceCode.call(void 0, _chunkJHRJ5V2Fcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
3465
+ adapterOwnsDocsRuntime ? _chunkXJDB564Acjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
3466
+ _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _112 => _112.experimental, 'optionalAccess', _113 => _113.serverComponents])) === "islands",
3439
3467
  platform,
3440
- islandsMode ? _chunk46UV2E7Icjs.collectFarmServerStylesheets.call(void 0,
3468
+ islandsMode ? _chunkEFI6QWBQcjs.collectFarmServerStylesheets.call(void 0,
3441
3469
  [
3442
3470
  ...layoutRoutes.map((layout) => layout.modulePath),
3443
3471
  ...pageRoutes.filter((route) => !isAdapterDocsRoute(route.pattern)).map((route) => route.modulePath)
@@ -3446,17 +3474,22 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3446
3474
  ) : []
3447
3475
  );
3448
3476
  const entryName = platform === "mobile" ? _chunkE5UN4OWXcjs.FARM_MOBILE_CLIENT_ENTRY_NAME : "farm-client";
3449
- const clientEntry = islandsMode && platform === "web" && clientHydrationCode.includes("/*farm-router-stub*/") ? splitFarmClientRouter(clientHydrationCode) : { entry: clientHydrationCode, router: void 0 };
3477
+ const clientEntry = islandsMode && platform === "web" && clientHydrationCode.includes("/*farm-router-stub*/") ? splitFarmClientEntry(clientHydrationCode) : { entry: clientHydrationCode, router: void 0, root: void 0 };
3450
3478
  await fs5.writeFile(clientEntryPath, clientEntry.entry);
3451
3479
  await fs5.writeFile(
3452
3480
  _path2.default.join(clientEntryDir, `${FARM_CLIENT_ROUTE_TABLE_MODULE}.tsx`),
3453
- generateFarmClientRouteTableModule(clientRouteTable)
3481
+ generateFarmClientRouteTableModule(clientRouteTable, {
3482
+ matcher: islandsMode && platform !== "mobile"
3483
+ })
3454
3484
  );
3455
3485
  if (clientEntry.router !== void 0) {
3456
3486
  await fs5.writeFile(_path2.default.join(clientEntryDir, "farm-client-router.tsx"), clientEntry.router);
3457
3487
  }
3488
+ if (clientEntry.root !== void 0) {
3489
+ await fs5.writeFile(_path2.default.join(clientEntryDir, "farm-client-root.tsx"), clientEntry.root);
3490
+ }
3458
3491
  const clientInput = { [entryName]: clientEntryPath };
3459
- if (platform === "web" && _chunkCL7BUGVBcjs.canBootFarmIslandsClient.call(void 0, config)) {
3492
+ if (platform === "web" && _chunkJHRJ5V2Fcjs.canBootFarmIslandsClient.call(void 0, config)) {
3460
3493
  const clientBootPath = _path2.default.join(clientEntryDir, "farm-client-boot.tsx");
3461
3494
  await fs5.writeFile(
3462
3495
  clientBootPath,
@@ -3467,7 +3500,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3467
3500
  const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
3468
3501
  let postcssSearchPath;
3469
3502
  let tailwindVitePlugin = void 0;
3470
- const rendererVitePlugins = await _chunkM6DAIE4Tcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
3503
+ const rendererVitePlugins = await _chunkNGTZHWBGcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
3471
3504
  ssr: false,
3472
3505
  buildLifetime: rendererBuildLifetime
3473
3506
  });
@@ -3477,7 +3510,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3477
3510
  const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
3478
3511
  await fs5.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
3479
3512
  postcssSearchPath = clientEntryDir;
3480
- tailwindVitePlugin = await _chunkZ5BANEQDcjs.loadTailwindVitePlugin.call(void 0, {
3513
+ tailwindVitePlugin = await _chunkDMSXZNQRcjs.loadTailwindVitePlugin.call(void 0, {
3481
3514
  builder: productionVite.builder,
3482
3515
  announce: true
3483
3516
  });
@@ -3498,11 +3531,11 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3498
3531
  target: FARM_CLIENT_BUILD_TARGET,
3499
3532
  // Tailwind CSS 4 already requires newer browsers than that baseline. An app's own
3500
3533
  // `build.target` or `build.cssTarget` still decides, as Vite derives one from the other.
3501
- ..._optionalChain([config, 'access', _119 => _119.vite, 'optionalAccess', _120 => _120.build, 'optionalAccess', _121 => _121.target]) === void 0 && _optionalChain([config, 'access', _122 => _122.vite, 'optionalAccess', _123 => _123.build, 'optionalAccess', _124 => _124.cssTarget]) === void 0 && (_chunkZ5BANEQDcjs.includesTailwindVitePlugin.call(void 0, tailwindVitePlugin) || _chunkZ5BANEQDcjs.includesTailwindVitePlugin.call(void 0, _optionalChain([config, 'access', _125 => _125.vite, 'optionalAccess', _126 => _126.plugins]))) ? { cssTarget: _chunkZ5BANEQDcjs.TAILWIND_CSS_BROWSER_TARGET } : {},
3534
+ ..._optionalChain([config, 'access', _114 => _114.vite, 'optionalAccess', _115 => _115.build, 'optionalAccess', _116 => _116.target]) === void 0 && _optionalChain([config, 'access', _117 => _117.vite, 'optionalAccess', _118 => _118.build, 'optionalAccess', _119 => _119.cssTarget]) === void 0 && (_chunkDMSXZNQRcjs.includesTailwindVitePlugin.call(void 0, tailwindVitePlugin) || _chunkDMSXZNQRcjs.includesTailwindVitePlugin.call(void 0, _optionalChain([config, 'access', _120 => _120.vite, 'optionalAccess', _121 => _121.plugins]))) ? { cssTarget: _chunkDMSXZNQRcjs.TAILWIND_CSS_BROWSER_TARGET } : {},
3502
3535
  outDir: outputDir,
3503
3536
  emptyOutDir: platform === "web",
3504
3537
  // Never public: see resolveFarmClientSourcemap.
3505
- sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access', _127 => _127.vite, 'optionalAccess', _128 => _128.build, 'optionalAccess', _129 => _129.sourcemap])),
3538
+ sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access', _122 => _122.vite, 'optionalAccess', _123 => _123.build, 'optionalAccess', _124 => _124.sourcemap])),
3506
3539
  assetsInlineLimit: 0,
3507
3540
  cssCodeSplit: false,
3508
3541
  // Bundle all CSS into one file
@@ -3514,7 +3547,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3514
3547
  hashCharacters: "hex",
3515
3548
  // Use predictable name for CSS so we can reference it in SSR HTML
3516
3549
  assetFileNames: (assetInfo) => {
3517
- if (_optionalChain([assetInfo, 'access', _130 => _130.name, 'optionalAccess', _131 => _131.endsWith, 'call', _132 => _132(".css")])) {
3550
+ if (_optionalChain([assetInfo, 'access', _125 => _125.name, 'optionalAccess', _126 => _126.endsWith, 'call', _127 => _127(".css")])) {
3518
3551
  return `${entryName}.css`;
3519
3552
  }
3520
3553
  return "assets/[name]-h[hash][extname]";
@@ -3531,7 +3564,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3531
3564
  }
3532
3565
  },
3533
3566
  plugins: [
3534
- _chunkCL7BUGVBcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
3567
+ _chunkJHRJ5V2Fcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
3535
3568
  createFarmPrivateClientSourcemapsPlugin({
3536
3569
  outDir: _path2.default.join(
3537
3570
  _path2.default.dirname(outputDir),
@@ -3550,13 +3583,16 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3550
3583
  _path2.default.join(clientEntryDir, "farm-client-router.tsx"),
3551
3584
  _path2.default.join(clientEntryDir, `${FARM_CLIENT_ROUTE_TABLE_MODULE}.tsx`)
3552
3585
  ],
3586
+ rootModules: [_path2.default.join(clientEntryDir, "farm-client-root.tsx")],
3553
3587
  // What the islands entry loads with its first render or hydration (RFC 0010).
3554
- ...islandsMode && _chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, config.renderer) ? {
3588
+ ...islandsMode && _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? {
3555
3589
  rendererImports: [
3556
3590
  "react",
3557
3591
  "react-dom/client",
3558
3592
  "@farm.js/core/internal/islands-runtime"
3559
3593
  ],
3594
+ // What a call's result is handled with, imported on the first (RFC 0013).
3595
+ actionImports: ["@farm.js/core/internal/islands-action-client"],
3560
3596
  rendererImporter: clientEntryPath
3561
3597
  } : {}
3562
3598
  }),
@@ -3567,8 +3603,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3567
3603
  importer: clientEntryPath,
3568
3604
  entryName: "farm-client",
3569
3605
  modules: [
3570
- config.docs.adapter.react,
3571
- _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs)
3606
+ _chunkL2GUEYHRcjs.getFarmDocsAdapterUIModule.call(void 0, config.docs.adapter),
3607
+ _chunkXJDB564Acjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs)
3572
3608
  ].filter((specifier) => Boolean(specifier))
3573
3609
  })
3574
3610
  ] : [],
@@ -3577,8 +3613,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3577
3613
  ...config.vite.plugins || [],
3578
3614
  farmServerOnlyEntriesPlugin({ platform, distDir: config.distDir || ".farm" }),
3579
3615
  farmNavigationPlugin(config.renderer),
3580
- _chunkCL7BUGVBcjs.farmDocsClientConfigPlugin.call(void 0,
3581
- adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
3616
+ _chunkJHRJ5V2Fcjs.farmDocsClientConfigPlugin.call(void 0,
3617
+ adapterOwnsDocsRuntime ? _chunkXJDB564Acjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
3582
3618
  ),
3583
3619
  // Plugin to redirect @farm.js/core imports to client-only exports
3584
3620
  {
@@ -3610,7 +3646,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3610
3646
  },
3611
3647
  load: {
3612
3648
  filter: {
3613
- id: _chunkCL7BUGVBcjs.exactIdPattern.call(void 0, [
3649
+ id: _chunkJHRJ5V2Fcjs.exactIdPattern.call(void 0, [
3614
3650
  "\0empty-module",
3615
3651
  "\0empty-api-route",
3616
3652
  "\0farm-i18n-client-bridge",
@@ -3648,7 +3684,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3648
3684
  { ...config, isolatedClientBoundaryModules, programmaticClientRoutes, sourceSnapshot },
3649
3685
  pluginManager
3650
3686
  ),
3651
- _chunk46UV2E7Icjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
3687
+ _chunkEFI6QWBQcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
3652
3688
  ],
3653
3689
  mode: "production",
3654
3690
  css: postcssSearchPath ? {
@@ -3656,7 +3692,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3656
3692
  } : void 0,
3657
3693
  // Ensure React is bundled for client
3658
3694
  resolve: {
3659
- alias: _chunkCL7BUGVBcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
3695
+ alias: _chunkJHRJ5V2Fcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
3660
3696
  dedupe: [...config.renderer.dedupe || []]
3661
3697
  },
3662
3698
  // Optimize dependencies - exclude server-side code from client bundle
@@ -3670,7 +3706,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3670
3706
  }
3671
3707
  };
3672
3708
  await viteBuild(
3673
- _chunkCL7BUGVBcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite, { clientOutput: true })
3709
+ _chunkJHRJ5V2Fcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite, { clientOutput: true })
3674
3710
  );
3675
3711
  if (platform === "mobile") {
3676
3712
  await fs5.rm(_path2.default.join(outputDir, `${entryName}.css`), { force: true });
@@ -3686,7 +3722,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3686
3722
  } finally {
3687
3723
  try {
3688
3724
  await fs5.rm(clientEntryDir, { recursive: true, force: true });
3689
- } catch (e34) {
3725
+ } catch (e35) {
3690
3726
  }
3691
3727
  }
3692
3728
  };
@@ -3764,9 +3800,9 @@ async function fetchFarmNavigationDocument(url, headers, recover = true, signal)
3764
3800
  return response;
3765
3801
  }
3766
3802
 
3767
- ${streamNavigations ? `${_chunkCL7BUGVBcjs.FARM_NAVIGATION_STREAM_READER_SOURCE}
3803
+ ${streamNavigations ? `${_chunkJHRJ5V2Fcjs.FARM_NAVIGATION_STREAM_READER_SOURCE}
3768
3804
 
3769
- ${_chunkCL7BUGVBcjs.FARM_EARLY_NAVIGATION_SOURCE}` : ""}
3805
+ ${_chunkJHRJ5V2Fcjs.FARM_EARLY_NAVIGATION_SOURCE}` : ""}
3770
3806
 
3771
3807
  function clearFarmPrefetchCacheOnDeploymentMismatch(router, error) {
3772
3808
  if (error?.name === "FarmDeploymentMismatchError") {
@@ -3843,18 +3879,27 @@ function loadFarmClientRouteTable() { return null; }
3843
3879
  function prefetchFarmClientRouteTable() {}
3844
3880
  const farmClientRoutesBoot = null;`;
3845
3881
  }
3882
+ const lazy = options.lazyMatcher === true;
3883
+ const toClientRoute = `function(route) {
3884
+ const load = typeof route.loader === "number" ? farmClientRouteLoaders[route.loader] : undefined;
3885
+ return { ...route, navigation: "html-fragment", load: load || null };
3886
+ }`;
3846
3887
  return `${prefetch}
3847
3888
  let clientRoutes = [];
3848
- let clientRouteMatcher = createFarmRouter([]);
3849
- let clientPageRouteMatcher = clientRouteMatcher;
3889
+ ${lazy ? `// The matcher, which loads with the table. Until then the entry matches only the document's own
3890
+ // path (readFarmClientBootRoute).
3891
+ let createFarmRouter = null;
3892
+ let isFarmRouteActive = null;
3893
+ let matchFarmRoute = null;
3894
+ let clientRouteMatcher = null;
3895
+ let clientPageRouteMatcher = null;
3896
+ let farmClientBootRoute = null;` : `let clientRouteMatcher = createFarmRouter([]);
3897
+ let clientPageRouteMatcher = clientRouteMatcher;`}
3850
3898
  let farmClientRouteTableLoad = null;
3851
3899
  let farmClientRouteTableLoaded = false;
3852
3900
 
3853
3901
  function setFarmClientRoutes(routes) {
3854
- clientRoutes = routes.map(function(route) {
3855
- const load = typeof route.loader === "number" ? farmClientRouteLoaders[route.loader] : undefined;
3856
- return { ...route, navigation: "html-fragment", load: load || null };
3857
- });
3902
+ clientRoutes = routes.map(${lazy ? "toFarmClientRoute" : toClientRoute});
3858
3903
  clientRouteMatcher = createFarmRouter(clientRoutes.map(function(route) {
3859
3904
  return { path: route.pattern, meta: route };
3860
3905
  }));
@@ -3864,12 +3909,27 @@ function setFarmClientRoutes(routes) {
3864
3909
  return { path: route.pattern, meta: route };
3865
3910
  }))` : "clientRouteMatcher"};
3866
3911
  }
3912
+ ${lazy ? `
3913
+ function toFarmClientRoute(route) {
3914
+ const load = typeof route.loader === "number" ? farmClientRouteLoaders[route.loader] : undefined;
3915
+ return { ...route, navigation: "html-fragment", load: load || null };
3916
+ }
3867
3917
 
3918
+ // The document's own route, which it names with its params and layouts, until the table loads. A
3919
+ // match for another path waits for the table: the router loads it before it matches.
3920
+ function readFarmClientBootRoute(path) {
3921
+ if (farmClientBootRoute && farmClientBootRoute.path === path) return farmClientBootRoute;
3922
+ throw new Error("[Farm.js] " + path + " cannot be matched before the client route table loads.");
3923
+ }
3924
+ ` : ""}
3868
3925
  // Null once the whole table is in place, else a promise that settles when it is.
3869
3926
  function loadFarmClientRouteTable() {
3870
3927
  if (farmClientRouteTableLoaded) return null;
3871
3928
  return farmClientRouteTableLoad || (farmClientRouteTableLoad = import("./${FARM_CLIENT_ROUTE_TABLE_MODULE}").then(function(module) {
3872
- setFarmClientRoutes(module.default);
3929
+ ${lazy ? ` createFarmRouter = module.createFarmRouter;
3930
+ isFarmRouteActive = module.isFarmRouteActive;
3931
+ matchFarmRoute = module.matchFarmRoute;
3932
+ ` : ""} setFarmClientRoutes(module.default);
3873
3933
  farmClientRouteTableLoaded = true;
3874
3934
  }, function(error) {
3875
3935
  farmClientRouteTableLoad = null;
@@ -3885,8 +3945,9 @@ function prefetchFarmClientRouteTable() {
3885
3945
 
3886
3946
  const farmClientRoutesBoot = (function() {
3887
3947
  const boot = window.__FARM_CLIENT_ROUTES__;
3888
- if (boot && Array.isArray(boot.routes) && boot.path === getFarmRoutePathname(window.location.pathname)) {
3889
- setFarmClientRoutes(boot.routes);
3948
+ if (boot && Array.isArray(boot.routes) && boot.path === getFarmRoutePathname(window.location.pathname)${lazy ? " &&\n boot.params && Array.isArray(boot.layouts)" : ""}) {
3949
+ ${lazy ? ` clientRoutes = boot.routes.map(toFarmClientRoute);
3950
+ farmClientBootRoute = boot;` : " setFarmClientRoutes(boot.routes);"}
3890
3951
  return null;
3891
3952
  }
3892
3953
  return loadFarmClientRouteTable().catch(function(error) {
@@ -3909,7 +3970,75 @@ for (const type of FARM_ROUTE_TABLE_INTENT_EVENTS) {
3909
3970
  document.addEventListener(type, warmFarmClientRouteTable, { capture: true, passive: true });
3910
3971
  }`;
3911
3972
  }
3912
- function generateFarmClientBootRoutesServerSource(tableSource) {
3973
+ function getFarmClientLayoutMatch(pattern) {
3974
+ const groupScope = _chunkNEKO3HM2cjs.getRouteGroupScope.call(void 0, pattern);
3975
+ return groupScope ? { pattern, urlPattern: _chunkNEKO3HM2cjs.stripRouteGroups.call(void 0, pattern), groupScope } : { pattern };
3976
+ }
3977
+ function generateFarmClientLayoutSelectionSource() {
3978
+ return `function selectFarmClientLayouts(layouts, routePathname, readDirectory) {
3979
+ const normalizedPath = routePathname.replace(/\\/$/, '') || '/';
3980
+ let directory;
3981
+ return layouts.filter(function(layout) {
3982
+ // Route groups add no URL segment: match the layout's URL, then keep a
3983
+ // grouped layout to the pages inside its group directory.
3984
+ const urlPattern = layout.urlPattern || layout.pattern;
3985
+ if (urlPattern !== '/' && !isFarmRouteActive(urlPattern, normalizedPath, { exact: false })) return false;
3986
+ if (!layout.groupScope) return true;
3987
+ if (directory === undefined) directory = readDirectory();
3988
+ return typeof directory === 'string' &&
3989
+ (directory === layout.groupScope || directory.startsWith(layout.groupScope + '/'));
3990
+ });
3991
+ }`;
3992
+ }
3993
+ function generateFarmClientRouteMatchSource(options = {}) {
3994
+ const select = "selectFarmClientLayouts(layoutRoutes, path, function() { return getFarmPageDirectory(pathname); })";
3995
+ return `${generateFarmClientLayoutSelectionSource()}
3996
+ ${options.lazyMatcher ? `
3997
+ // The document's own layouts, which it names, until the table loads (readFarmClientBootRoute).
3998
+ function readFarmClientBootLayouts(path) {
3999
+ const names = readFarmClientBootRoute(path).layouts;
4000
+ return layoutRoutes.filter(function(layout) { return names.includes(layout.pattern); });
4001
+ }
4002
+ ` : ""}
4003
+ // Get applicable layouts for a pathname (sorted by depth, root first)
4004
+ function getApplicableLayouts(pathname) {
4005
+ const path = getFarmRoutePathname(pathname);
4006
+ const applicable = ${options.lazyMatcher ? `clientRouteMatcher
4007
+ ? ${select}
4008
+ : readFarmClientBootLayouts(path)` : select};
4009
+
4010
+ // Sort by depth (root first)
4011
+ applicable.sort(function(a, b) {
4012
+ const depthA = a.pattern.split('/').filter(Boolean).length;
4013
+ const depthB = b.pattern.split('/').filter(Boolean).length;
4014
+ return depthA - depthB;
4015
+ });
4016
+
4017
+ return applicable;
4018
+ }
4019
+
4020
+ function hasHydratableLayout(pathname) {
4021
+ return getApplicableLayouts(pathname).some(function(layout) {
4022
+ return layout.shouldHydrate === true;
4023
+ });
4024
+ }
4025
+
4026
+ // Match pathname to client route
4027
+ function matchRoute(pathname) {
4028
+ const path = getFarmRoutePathname(pathname);
4029
+ ${options.lazyMatcher ? ` if (!clientRouteMatcher) {
4030
+ // Without the document's route either (the table did not load), nothing matches, as with no table.
4031
+ if (!farmClientBootRoute) return null;
4032
+ const boot = readFarmClientBootRoute(path);
4033
+ return clientRoutes.length > 0 ? { route: clientRoutes[0], params: boot.params } : null;
4034
+ }
4035
+ ` : ""} const matched = clientRouteMatcher.match(path);
4036
+ return matched
4037
+ ? { route: matched.route.meta, params: matched.params }
4038
+ : null;
4039
+ }`;
4040
+ }
4041
+ function generateFarmClientBootRoutesServerSource(tableSource, layouts) {
3913
4042
  return `// The client route table (client-route-table.ts), filled in from the client build. The client
3914
4043
  // loads it on its first navigation; a document names the entries its page boots with, found
3915
4044
  // with the client's own matcher, so its page hydrates without the table.
@@ -3929,18 +4058,40 @@ const farmClientRouteTable = (() => {
3929
4058
  return null;
3930
4059
  }
3931
4060
  })();
3932
-
4061
+ ${layouts ? `
4062
+ // The client's layouts (layoutRoutes in the client entry), of which a document names those that
4063
+ // apply at its path.
4064
+ const farmClientLayoutTable = ${JSON.stringify(layouts)};
4065
+ ${generateFarmClientLayoutSelectionSource()}
4066
+
4067
+ // The layouts that apply at a route path, with the page directory the client's
4068
+ // getFarmPageDirectory reads from the route matched there.
4069
+ function getFarmClientBootLayouts(routePathname, matched, page) {
4070
+ const directory = !matched
4071
+ ? null
4072
+ : matched.route.meta.docs && !matched.route.meta.directory
4073
+ ? page ? page.route.meta.directory || page.route.meta.pattern : null
4074
+ : matched.route.meta.directory || matched.route.meta.pattern;
4075
+ return selectFarmClientLayouts(farmClientLayoutTable, routePathname, function() { return directory; })
4076
+ .map(function(layout) { return layout.pattern; });
4077
+ }
4078
+ ` : ""}
3933
4079
  // The entries the client's matchRoute and getFarmPageDirectory read for this route path.
3934
4080
  function getFarmClientBootRoutes(routePathname) {
3935
4081
  if (!farmClientRouteTable || typeof routePathname !== "string") return undefined;
3936
4082
  const routes = [];
3937
4083
  const matched = farmClientRouteTable.routes.match(routePathname);
4084
+ const page = matched && matched.route.meta.docs ? farmClientRouteTable.pages.match(routePathname) : null;
3938
4085
  if (matched) {
3939
4086
  routes.push(matched.route.meta);
3940
- const page = matched.route.meta.docs ? farmClientRouteTable.pages.match(routePathname) : null;
3941
4087
  if (page) routes.push(page.route.meta);
3942
4088
  }
3943
- return { path: routePathname, routes: routes };
4089
+ return { path: routePathname, routes: routes${layouts ? ", params: matched ? matched.params : {}, layouts: getFarmClientBootLayouts(routePathname, matched, page)" : ""} };
4090
+ }
4091
+
4092
+ // A status document's: no route matches at its path.
4093
+ function getFarmClientStatusBootRoutes(routePathname) {
4094
+ return { path: routePathname, routes: []${layouts ? ", params: {}, layouts: getFarmClientBootLayouts(routePathname, null, null)" : ""} };
3944
4095
  }`;
3945
4096
  }
3946
4097
  function generateClientPageDirectorySource() {
@@ -4824,7 +4975,7 @@ function readFarmEntryImports(source) {
4824
4975
  for (const match of source.matchAll(/^import\s+([^"';]+?)\s+from\s+(["'][^"']+["'])/gm)) {
4825
4976
  const from = match[2];
4826
4977
  const named = /\{([^}]*)\}/.exec(match[1]);
4827
- for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess', _133 => _133[1], 'optionalAccess', _134 => _134.split, 'call', _135 => _135(",")]), () => ( []))) {
4978
+ for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess', _128 => _128[1], 'optionalAccess', _129 => _129.split, 'call', _130 => _130(",")]), () => ( []))) {
4828
4979
  const [imported, local] = specifier.trim().split(/\s+as\s+/);
4829
4980
  if (imported)
4830
4981
  bindings.push({ local: _nullishCoalesce(local, () => ( imported)), clause: `{ ${specifier.trim()} }`, from });
@@ -4836,40 +4987,82 @@ function readFarmEntryImports(source) {
4836
4987
  }
4837
4988
  return bindings;
4838
4989
  }
4839
- function splitFarmClientRouter(code) {
4990
+ var FARM_LAZY_ROOT_STUB = `let farmRootLoading = null;
4991
+ function loadFarmRoot() {
4992
+ return farmRootLoading || (farmRootLoading = import("./farm-client-root").catch(function(error) {
4993
+ farmRootLoading = null;
4994
+ throw error;
4995
+ }));
4996
+ }
4997
+ `;
4998
+ var FARM_ROOT_MODULE_EXPORTS = [
4999
+ "createMatchedHydrationRoute",
5000
+ "hydrateFarmRoute",
5001
+ "renderFarmRoute",
5002
+ "farmTreeLayoutsReady",
5003
+ "loadRouteComponent",
5004
+ "createLayoutPageBoundary",
5005
+ "createFarmRouteState"
5006
+ ];
5007
+ function takeFarmEntryRegions(code, kind) {
4840
5008
  const regions = [];
4841
- const eager = code.replace(
4842
- /\/\*farm-router-start\*\/([\s\S]*?)\/\*farm-router-end\*\/\n?/g,
4843
- (_, body2) => {
4844
- regions.push(body2);
5009
+ const rest = code.replace(
5010
+ new RegExp(`/\\*farm-${kind}-start\\*/([\\s\\S]*?)/\\*farm-${kind}-end\\*/\\n?`, "g"),
5011
+ (_, body) => {
5012
+ regions.push(body);
4845
5013
  return "";
4846
5014
  }
4847
5015
  );
4848
- const body = regions.join("\n");
4849
- const moved = readFarmEntryDeclarations(body);
4850
- const usedByRouter = (name) => !moved.has(name) && bindingPattern(name).test(body);
5016
+ return { rest, body: regions.join("\n") };
5017
+ }
5018
+ function splitFarmClientEntry(code) {
5019
+ const router = takeFarmEntryRegions(code, "router");
5020
+ const root = takeFarmEntryRegions(router.rest, "root");
5021
+ const splitsRoot = root.body !== "";
5022
+ const eager = splitsRoot ? root.rest.replace(
5023
+ /\/\*farm-root-stub-start\*\/[\s\S]*?\/\*farm-root-stub-end\*\/\n?/,
5024
+ () => FARM_LAZY_ROOT_STUB
5025
+ ) : root.rest;
5026
+ const declared = {
5027
+ router: readFarmEntryDeclarations(router.body),
5028
+ root: readFarmEntryDeclarations(root.body),
5029
+ entry: readFarmEntryDeclarations(eager)
5030
+ };
4851
5031
  const eagerCode = eager.replace(/^import\s[^;]*;/gm, "");
4852
5032
  const usedByEntry = (name) => bindingPattern(name).test(eagerCode);
4853
- const bindings = readFarmEntryImports(eager).filter((binding) => usedByRouter(binding.local));
4854
- const imports = bindings.filter((binding) => !usedByEntry(binding.local));
4855
- const reexported = bindings.filter((binding) => usedByEntry(binding.local)).map((binding) => binding.local);
4856
- const shared = [
4857
- .../* @__PURE__ */ new Set([
4858
- ...reexported,
4859
- ...[...readFarmEntryDeclarations(eager)].filter((name) => usedByRouter(name))
4860
- ])
4861
- ];
5033
+ const eagerImports = readFarmEntryImports(eager);
5034
+ const fromEntry = /* @__PURE__ */ new Set();
5035
+ const link = (body, own) => {
5036
+ const uses = (name) => !own.has(name) && bindingPattern(name).test(body);
5037
+ const lines = [];
5038
+ const shared = [];
5039
+ for (const binding of eagerImports.filter((candidate) => uses(candidate.local))) {
5040
+ if (usedByEntry(binding.local)) shared.push(binding.local);
5041
+ else lines.push(`import ${binding.clause} from ${binding.from};`);
5042
+ }
5043
+ for (const name of declared.entry) if (uses(name)) shared.push(name);
5044
+ const names = [...new Set(shared)];
5045
+ for (const name of names) fromEntry.add(name);
5046
+ if (names.length > 0) lines.push(`import { ${names.join(", ")} } from "./farm-client-entry";`);
5047
+ return lines;
5048
+ };
5049
+ const routerImports = link(router.body, declared.router);
5050
+ const rootImports = splitsRoot ? link(root.body, declared.root) : [];
5051
+ const crossing = (body, names) => [...names].filter((name) => !declared.entry.has(name) && bindingPattern(name).test(body));
5052
+ const crossed = splitsRoot ? [...crossing(root.body, declared.router), ...crossing(router.body, declared.root)] : [];
5053
+ if (crossed.length > 0) {
5054
+ throw new Error(
5055
+ `The client entry's router and root code use ${crossed.join(", ")} from each other. Keep what both use outside the \`farm-router\` and \`farm-root\` regions.`
5056
+ );
5057
+ }
4862
5058
  return {
4863
5059
  entry: `${eager.replace("/*farm-router-stub*/", FARM_LAZY_ROUTER_STUB)}
4864
- export { ${shared.join(", ")} };
5060
+ export { ${[...fromEntry].join(", ")} };
4865
5061
  `,
4866
- router: [
4867
- ...imports.map((binding) => `import ${binding.clause} from ${binding.from};`),
4868
- `import { ${shared.join(", ")} } from "./farm-client-entry";`,
4869
- body,
4870
- "export { spaRouter };",
4871
- ""
4872
- ].join("\n")
5062
+ router: [...routerImports, router.body, "export { spaRouter };", ""].join("\n"),
5063
+ root: splitsRoot ? [...rootImports, root.body, `export { ${FARM_ROOT_MODULE_EXPORTS.join(", ")} };`, ""].join(
5064
+ "\n"
5065
+ ) : void 0
4873
5066
  };
4874
5067
  }
4875
5068
  var FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME = `
@@ -4899,7 +5092,7 @@ var FARM_DOCUMENT_PARSED_RUNTIME = `function farmDocumentParsed() {
4899
5092
  }
4900
5093
 
4901
5094
  `;
4902
- function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlots, root, srcDir, docsSearchEnabled, docsSearchModuleId, docsEntryPath, docsAdapterReact, i18nConfig = {
5095
+ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlots, root, srcDir, docsSearchEnabled, docsSearchModuleId, docsEntryPath, docsAdapterUI, i18nConfig = {
4903
5096
  enabled: false,
4904
5097
  basePath: "/",
4905
5098
  locales: ["en"],
@@ -4917,18 +5110,20 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
4917
5110
  secure: false
4918
5111
  },
4919
5112
  direction: {}
4920
- }, plugins = [], renderer = _chunkM6DAIE4Tcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false, platform, serverStylesheets = []) {
5113
+ }, plugins = [], renderer = _chunkNGTZHWBGcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false, platform, serverStylesheets = []) {
4921
5114
  const toImportPath = (targetPath) => targetPath.replace(/\\/g, "/");
4922
- const clientPluginEntry = _chunkZ5BANEQDcjs.generateFarmClientPluginEntryCode.call(void 0,
5115
+ const clientPluginEntry = _chunkDMSXZNQRcjs.generateFarmClientPluginEntryCode.call(void 0,
4923
5116
  plugins,
4924
5117
  root,
4925
5118
  srcDir,
4926
5119
  publicRuntimeConfig,
4927
5120
  platform
4928
5121
  );
4929
- const appSetupPath = _chunkM6DAIE4Tcjs.resolveFarmRendererAppSetup.call(void 0, root, renderer);
4930
- const lazyRenderer = islandValues && platform !== "mobile" && _chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, renderer) && clientRouteSlots.length === 0;
4931
- const rendererClientImports = lazyRenderer ? `import { holdFarmIslandInteractions, restorePagePosition, watchFarmIslandTriggers } from "@farm.js/core/internal/client-runtime";` : _chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, renderer) ? `import React from "react";
5122
+ const appSetupPath = _chunkNGTZHWBGcjs.resolveFarmRendererAppSetup.call(void 0, root, renderer);
5123
+ const lazyRenderer = islandValues && platform !== "mobile" && _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, renderer) && clientRouteSlots.length === 0;
5124
+ const lazyRoot = islandValues && platform !== "mobile";
5125
+ const lazyMatcher = lazyRoot && clientPages.length > 0;
5126
+ const rendererClientImports = lazyRenderer ? `import { holdFarmIslandInteractions, restorePagePosition, watchFarmIslandTriggers } from "@farm.js/core/internal/client-runtime";` : _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, renderer) ? `import React from "react";
4932
5127
  import { createRoot, hydrateRoot } from "react-dom/client";
4933
5128
  import { restorePagePosition } from "@farm.js/core/internal/client-runtime";` : (
4934
5129
  // Named exports only, as the server entry and the development client read them. A copy
@@ -4941,7 +5136,8 @@ __farmConfigureApp(__farmAppSetup);` : `import * as __farmRendererClient from ${
4941
5136
  import { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};
4942
5137
  const React = { ...__farmRendererClient };`
4943
5138
  );
4944
- const providerClientCode = _chunkCL7BUGVBcjs.generateFarmIntegrationProviderClientCode.call(void 0,
5139
+ const hydrateFarmRouteCall = _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, renderer) ? "return hydrateRoot(container, route.element);" : "return route.layouts.length > 0 ? hydrateRoot(container, route.element, route) : hydrateRoot(container, route.element);";
5140
+ const providerClientCode = _chunkJHRJ5V2Fcjs.generateFarmIntegrationProviderClientCode.call(void 0,
4945
5141
  integrationProviders,
4946
5142
  root,
4947
5143
  _nullishCoalesce(renderer.componentExtensions, () => ( []))
@@ -4963,24 +5159,35 @@ const React = { ...__farmRendererClient };`
4963
5159
  ).join("\n");
4964
5160
  const layoutImportStatements = [];
4965
5161
  const layoutRegistrations = [];
5162
+ const layoutComponents = [];
4966
5163
  const hydratingLayoutPatterns = layoutRoutes.filter((layout) => layout.shouldHydrate).map((layout) => layout.pattern);
4967
- const treeLayoutPatterns = islandValues ? _chunkOFVCWV2Dcjs.getFarmServerTreeLayoutPatterns.call(void 0, layoutRoutes) : /* @__PURE__ */ new Set();
5164
+ const treeLayoutPatterns = islandValues ? _chunkNEKO3HM2cjs.getFarmServerTreeLayoutPatterns.call(void 0, layoutRoutes) : /* @__PURE__ */ new Set();
4968
5165
  layoutRoutes.forEach((layout, index) => {
4969
5166
  const relativePath = toImportPath(layout.modulePath);
4970
5167
  const treeLayout = treeLayoutPatterns.has(layout.pattern);
4971
5168
  const rendersOnClient = treeLayout || !layout.hasIsolatedClientBoundaries && hydratingLayoutPatterns.some(
4972
- (pattern) => _chunkOFVCWV2Dcjs.layoutsCanCoverSamePage.call(void 0, layout.pattern, pattern)
5169
+ (pattern) => _chunkNEKO3HM2cjs.layoutsCanCoverSamePage.call(void 0, layout.pattern, pattern)
4973
5170
  );
4974
5171
  if (rendersOnClient && !treeLayout) {
4975
5172
  layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
4976
5173
  }
4977
- const groupScope = _chunkOFVCWV2Dcjs.getRouteGroupScope.call(void 0, layout.pattern);
4978
- const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(_chunkOFVCWV2Dcjs.stripRouteGroups.call(void 0, layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
5174
+ const { urlPattern, groupScope } = getFarmClientLayoutMatch(layout.pattern);
5175
+ const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(urlPattern)}, groupScope: ${JSON.stringify(groupScope)}` : "";
5176
+ const component = rendersOnClient ? treeLayout ? `getFarmTreeLayoutComponent(${JSON.stringify(layout.pattern)})` : `Layout${index}` : "null";
5177
+ layoutComponents.push(component);
4979
5178
  layoutRegistrations.push(
4980
- ` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${rendersOnClient ? treeLayout ? `getFarmTreeLayoutComponent(${JSON.stringify(layout.pattern)})` : `Layout${index}` : "null"}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)}${treeLayout ? ", serverTree: true" : ""} }`
5179
+ ` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${lazyRoot ? "null" : component}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)}${treeLayout ? ", serverTree: true" : ""} }`
4981
5180
  );
4982
5181
  });
4983
5182
  const layoutImports = layoutImportStatements.join("\n");
5183
+ const layoutComponentsRuntime = lazyRoot && layoutComponents.some((component) => component !== "null") ? `/*farm-root-start*/
5184
+ ${layoutImports}
5185
+ // The layouts' components, which only a page or layout root renders.
5186
+ [${layoutComponents.join(", ")}].forEach(function(Component, index) {
5187
+ layoutRoutes[index].Component = Component;
5188
+ });
5189
+ /*farm-root-end*/
5190
+ ` : "";
4984
5191
  const hasServerTreeLayouts = treeLayoutPatterns.size > 0;
4985
5192
  const i18nRoutingConfig = {
4986
5193
  locales: i18nConfig.locales,
@@ -5036,9 +5243,11 @@ function isFarmDocsPath() {
5036
5243
  return false;
5037
5244
  }
5038
5245
  `;
5039
- const docsAdapterRuntime = _chunkSM2SYWARcjs.generateFarmDocsAdapterClientRuntime.call(void 0,
5040
- docsAdapterReact,
5041
- docsConfigModule
5246
+ const docsAdapterRuntime = _chunkXJDB564Acjs.generateFarmDocsAdapterClientRuntime.call(void 0,
5247
+ docsAdapterUI,
5248
+ docsConfigModule,
5249
+ // Config resolution keeps an adapter to its UI's renderer, so this is the UI's renderer too.
5250
+ _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, renderer) ? void 0 : renderer.client
5042
5251
  );
5043
5252
  if (clientPages.length === 0 && clientRouteSlots.length === 0 && !providerClientCode.hasProviders) {
5044
5253
  return `
@@ -5062,7 +5271,7 @@ mountFarmDocsSearch();
5062
5271
 
5063
5272
  ${generateUniversalRouterStateRuntime()}
5064
5273
 
5065
- ${_chunkCL7BUGVBcjs.FARM_NAVIGATION_SCRIPT_SOURCE}
5274
+ ${_chunkJHRJ5V2Fcjs.FARM_NAVIGATION_SCRIPT_SOURCE}
5066
5275
 
5067
5276
  // SPA Router for server-rendered pages (HTML swap)
5068
5277
  const spaRouter = {
@@ -5215,11 +5424,12 @@ ${generateUniversalRouterStateProperties()}
5215
5424
 
5216
5425
  reconcileFarmDocumentHead(doc);
5217
5426
 
5218
- // Swap root content
5427
+ // Swap root content: the parsed nodes themselves, not markup the page parses again.
5219
5428
  const newRoot = doc.getElementById("root");
5220
5429
  const currentRoot = document.getElementById("root");
5221
5430
  if (!newRoot || !currentRoot) return this.swapDocument(doc);
5222
- currentRoot.innerHTML = newRoot.innerHTML;
5431
+ adoptFarmParsedNodes(newRoot);
5432
+ currentRoot.replaceChildren(...newRoot.childNodes);
5223
5433
  return true;
5224
5434
  },
5225
5435
 
@@ -5236,7 +5446,8 @@ ${generateUniversalRouterStateProperties()}
5236
5446
  });
5237
5447
 
5238
5448
  document.head.innerHTML = doc.head ? doc.head.innerHTML : "";
5239
- document.body.innerHTML = doc.body.innerHTML;
5449
+ adoptFarmParsedNodes(doc.body);
5450
+ document.body.replaceChildren(...doc.body.childNodes);
5240
5451
  delete window.__farmDocsRuntime;
5241
5452
  delete window.__farmDocsPageActionsRuntime;
5242
5453
 
@@ -5497,6 +5708,7 @@ async function hydrateFarmIsolatedClientBoundaries(scope = document, signal) {
5497
5708
  await farmIsolatedHydrationRuntime.hydrate(scope, signal);
5498
5709
  }
5499
5710
  ${serverTreeEnabled ? `
5711
+ /*farm-root-start*/
5500
5712
  // A server-tree page (an async page below a hydrating layout) rebuilds in the layout's root.
5501
5713
  async function createFarmServerTreePageElement(source, pathname) {
5502
5714
  try {
@@ -5510,7 +5722,10 @@ async function createFarmServerTreePageElement(source, pathname) {
5510
5722
  console.warn("[Farm.js] Could not rebuild the server tree of " + pathname + "; its server HTML was kept.", error);
5511
5723
  return null;
5512
5724
  }
5513
- }` : "async function createFarmServerTreePageElement() { return null; }"}` : `async function createFarmServerTreePageElement() { return null; }`;
5725
+ }
5726
+ /*farm-root-end*/` : "\n/*farm-root-start*/\nasync function createFarmServerTreePageElement() { return null; }\n/*farm-root-end*/"}` : `/*farm-root-start*/
5727
+ async function createFarmServerTreePageElement() { return null; }
5728
+ /*farm-root-end*/`;
5514
5729
  const routeClientGraphRuntime = isolatedHydrationEnabled ? `function wrapFarmRouteClientGraph(element) {
5515
5730
  return wrapFarmIsolatedClientGraph(React, element);
5516
5731
  }` : `function wrapFarmRouteClientGraph(element) { return element; }`;
@@ -5530,13 +5745,13 @@ async function createFarmServerTreePageElement(source, pathname) {
5530
5745
  return `
5531
5746
  // Farm.js Client Runtime - SPA with Hydration
5532
5747
  ${cssImport}
5533
- ${layoutImports}
5748
+ ${lazyRoot ? "" : layoutImports}
5534
5749
  ${rendererClientImports}
5535
5750
  ${isolatedHydrationImport}
5536
5751
  ${providerClientCode.imports}
5537
- import { createClientCancellation, createClientPluginManager, createPluginlessClientRuntime, getFarmIslandValueHeaders, getHashTargetElement, keepFarmIslandValues, installChunkErrorRecovery, installFarmLinkPrefetch, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, readFarmLinkNavigateOptions, rememberFarmLinkLocale, reconcileFarmDocumentHead, runFarmNavigationDelegates, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
5752
+ import { createClientCancellation, createClientPluginManager, createPluginlessClientRuntime, getFarmIslandValueHeaders, getHashTargetElement, keepFarmIslandValues, installChunkErrorRecovery, installFarmLinkPrefetch, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, readFarmLinkNavigateOptions, rememberFarmLinkLocale, reconcileFarmDocumentHead, replayFarmQueuedInteraction, runFarmNavigationDelegates, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
5538
5753
  import { createFarmDeploymentMismatchError, createFarmDeploymentRequestHeaders, isFarmDeploymentMismatchResponse } from "@farm.js/core/deployment";
5539
- import { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";
5754
+ ${lazyMatcher ? "" : 'import { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";'}
5540
5755
  ${clientPluginEntry.imports}
5541
5756
  ${clientCachePersistence.imports}
5542
5757
  ${i18nClientRuntime}
@@ -5560,7 +5775,8 @@ ${routeLoaders.join("\n")}
5560
5775
  ${generateFarmClientRouteTableRuntime({
5561
5776
  table: clientPages.length > 0,
5562
5777
  docs: clientPages.some((page) => page.docs),
5563
- streamNavigations: islandValues
5778
+ streamNavigations: islandValues,
5779
+ lazyMatcher
5564
5780
  })}
5565
5781
  ${generateClientPageDirectorySource()}
5566
5782
 
@@ -5576,44 +5792,10 @@ const layoutRoutes = [
5576
5792
  ${layoutRegistrations.join(",\n")}
5577
5793
  ];
5578
5794
 
5579
- // Get applicable layouts for a pathname (sorted by depth, root first)
5580
- function getApplicableLayouts(pathname) {
5581
- const applicable = [];
5582
- const normalizedPath = getFarmRoutePathname(pathname).replace(/\\/$/, '') || '/';
5583
- let directory;
5584
-
5585
- for (const layout of layoutRoutes) {
5586
- // Route groups add no URL segment: match the layout's URL, then keep a
5587
- // grouped layout to the pages inside its group directory.
5588
- const urlPattern = layout.urlPattern || layout.pattern;
5589
- if (urlPattern !== '/' && !isFarmRouteActive(urlPattern, normalizedPath, { exact: false })) continue;
5590
- if (layout.groupScope) {
5591
- if (directory === undefined) directory = getFarmPageDirectory(pathname);
5592
- if (
5593
- typeof directory !== 'string' ||
5594
- (directory !== layout.groupScope && !directory.startsWith(layout.groupScope + '/'))
5595
- ) continue;
5596
- }
5597
- applicable.push(layout);
5598
- }
5599
-
5600
- // Sort by depth (root first)
5601
- applicable.sort(function(a, b) {
5602
- const depthA = a.pattern.split('/').filter(Boolean).length;
5603
- const depthB = b.pattern.split('/').filter(Boolean).length;
5604
- return depthA - depthB;
5605
- });
5606
-
5607
- return applicable;
5608
- }
5609
-
5610
- function hasHydratableLayout(pathname) {
5611
- return getApplicableLayouts(pathname).some(function(layout) {
5612
- return layout.shouldHydrate === true;
5613
- });
5614
- }
5795
+ ${generateFarmClientRouteMatchSource({ lazyMatcher })}
5615
5796
 
5616
- ${_chunkCL7BUGVBcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
5797
+ ${layoutComponentsRuntime}/*farm-root-start*/
5798
+ ${_chunkJHRJ5V2Fcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
5617
5799
  // Wrap a page element with applicable layouts
5618
5800
  function wrapWithLayouts(pageElement, pathname, params) {
5619
5801
  const layouts = getApplicableLayouts(pathname);
@@ -5648,7 +5830,7 @@ function createLayoutPageBoundary(route, pageElement, serverHtml) {
5648
5830
  return React.createElement("div", props, pageElement);
5649
5831
  }
5650
5832
  let farmLastRouteState = null;
5651
- ${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkCL7BUGVBcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
5833
+ ${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkJHRJ5V2Fcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
5652
5834
  function farmTreeLayoutsOf(pathname) {
5653
5835
  return getApplicableLayouts(pathname).filter(function(layout) {
5654
5836
  return layout.serverTree === true;
@@ -5678,15 +5860,9 @@ function prepareFarmTreeLayouts(pathname, params, source) {
5678
5860
  );
5679
5861
  }` : `function farmTreeLayoutsReady() { return true; }
5680
5862
  async function prepareFarmTreeLayouts() { return true; }`}
5863
+ /*farm-root-end*/
5681
5864
 
5682
- // Match pathname to client route
5683
- function matchRoute(pathname) {
5684
- const matched = clientRouteMatcher.match(getFarmRoutePathname(pathname));
5685
- return matched
5686
- ? { route: matched.route.meta, params: matched.params }
5687
- : null;
5688
- }
5689
-
5865
+ /*farm-root-start*/
5690
5866
  async function loadRouteComponent(route) {
5691
5867
  if (!route.load) return null;${lazyRenderer ? `
5692
5868
  // A page component renders with React DOM, which loads beside it (RFC 0010).
@@ -5769,7 +5945,7 @@ async function createMatchedHydrationRoute(matched, pathname, searchParams, navi
5769
5945
 
5770
5946
  if (!pageElement) return null;
5771
5947
  if (!hydrateLayouts) {
5772
- ${_chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, renderer) ? "if (hydrationContainer) pageElement = restorePagePosition(React, hydrationContainer, pageElement);" : ""}
5948
+ ${_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, renderer) ? "if (hydrationContainer) pageElement = restorePagePosition(React, hydrationContainer, pageElement);" : ""}
5773
5949
  return createFarmRouteState(pageElement, pathname, params, false);
5774
5950
  }
5775
5951
  if (matched.route.pageShouldHydrate) {
@@ -5798,7 +5974,16 @@ function createFarmRouteState(page, pathname, params, includeLayouts) {
5798
5974
 
5799
5975
  function hydrateFarmRoute(container, route) {
5800
5976
  farmLastRouteState = route;
5801
- ${_chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, renderer) ? "return hydrateRoot(container, route.element);" : "return route.layouts.length > 0 ? hydrateRoot(container, route.element, route) : hydrateRoot(container, route.element);"}
5977
+ ${_chunkNGTZHWBGcjs.getFarmRendererCapabilities.call(void 0, renderer).hydrationFallback ? `try {
5978
+ ${hydrateFarmRouteCall}
5979
+ } catch (error) {
5980
+ // The renderer opted in with capabilities.hydrationFallback, as development always does. The
5981
+ // page still works, but the server's DOM, focus, and typed input are gone, so say so.
5982
+ console.error("[Farm.js] Hydration error; rendering the page on the client instead:", error);
5983
+ const root = createRoot(container);
5984
+ renderFarmRoute(root, route);
5985
+ return root;
5986
+ }` : hydrateFarmRouteCall}
5802
5987
  }
5803
5988
 
5804
5989
  function renderFarmRoute(root, route) {
@@ -5806,6 +5991,7 @@ function renderFarmRoute(root, route) {
5806
5991
  if (route.layouts.length > 0 && typeof root.renderRoute === "function") root.renderRoute(route);
5807
5992
  else root.render(route.element);
5808
5993
  }
5994
+ /*farm-root-end*/
5809
5995
 
5810
5996
  /*farm-router-start*/
5811
5997
  function matchesRoutePrefix(pathname, pattern) {
@@ -5956,6 +6142,26 @@ function renderClientRouteSlot(slot, registration, mode) {
5956
6142
  return true;
5957
6143
  }
5958
6144
 
6145
+ // The document's pre-hydration hold keeps clicks and submits until what they target hydrates, as in
6146
+ // development. A hydrated route slot stops holding its own and replays what it held, as the page's
6147
+ // scheduler does for the page.
6148
+ function replayPreHydrationClicks(container) {
6149
+ container.dataset.farmIslandHydrated = "true";
6150
+ const queue = Array.isArray(window.__FARM_PREHYDRATION_CLICK_QUEUE__)
6151
+ ? window.__FARM_PREHYDRATION_CLICK_QUEUE__
6152
+ : [];
6153
+ const held = queue.filter(function(item) {
6154
+ return item && item.target instanceof Element && container.contains(item.target);
6155
+ });
6156
+ if (held.length === 0) return;
6157
+ queue.splice(0, queue.length, ...queue.filter(function(item) { return held.indexOf(item) === -1; }));
6158
+ for (const item of held) {
6159
+ setTimeout(function() {
6160
+ if (item.target.isConnected) replayFarmQueuedInteraction(item.target, item.kind);
6161
+ }, 0);
6162
+ }
6163
+ }
6164
+
5959
6165
  function hydrateInitialRouteSlots() {
5960
6166
  const slots = Array.isArray(window.__FARM_ROUTE_SLOTS__)
5961
6167
  ? window.__FARM_ROUTE_SLOTS__
@@ -5964,7 +6170,9 @@ function hydrateInitialRouteSlots() {
5964
6170
  const registration = findClientRouteSlot(slot);
5965
6171
  if (!registration) continue;
5966
6172
  try {
5967
- renderClientRouteSlot(slot, registration, "hydrate");
6173
+ if (renderClientRouteSlot(slot, registration, "hydrate")) {
6174
+ replayPreHydrationClicks(document.getElementById(slot.containerId));
6175
+ }
5968
6176
  } catch (error) {
5969
6177
  console.warn("[Farm.js] Could not hydrate route slot:", slot.name, error);
5970
6178
  }
@@ -6033,6 +6241,15 @@ function setFarmHydrated() {
6033
6241
  isHydrated = true;
6034
6242
  }
6035
6243
 
6244
+ // The document's head script holds clicks and submits until the page hydrates. Once the first
6245
+ // hydration settles it holds nothing more, as in development: each root that hydrated replayed
6246
+ // what it held, and a navigation's page renders in a React root that takes its own clicks.
6247
+ function markFarmHydrated() {
6248
+ if (window.__FARM_HYDRATED__ !== false) return;
6249
+ window.__FARM_HYDRATED__ = true;
6250
+ document.documentElement.dataset.farmHydrated = "true";
6251
+ }
6252
+
6036
6253
  ${generateUniversalRouterStateRuntime(islandValues)}
6037
6254
 
6038
6255
  function cancelPendingPageHydration() {
@@ -6158,7 +6375,10 @@ function scheduleFarmRouteHydration(matched, pathname, container, serverProps) {
6158
6375
  }
6159
6376
  const searchParams = searchParamsToObject(new URLSearchParams(window.location.search));
6160
6377
  const shouldHydrate = !isHydrated && Boolean(container.innerHTML.trim());
6161
- const routeState = await createMatchedHydrationRoute(
6378
+ // The code that renders the root loads when its strategy is due (RFC 0013).
6379
+ const farmRoot = await loadFarmRoot();
6380
+ if (hydrationController.signal.aborted || !container.isConnected) return;
6381
+ const routeState = await farmRoot.createMatchedHydrationRoute(
6162
6382
  matched,
6163
6383
  pathname,
6164
6384
  searchParams,
@@ -6178,7 +6398,7 @@ function scheduleFarmRouteHydration(matched, pathname, container, serverProps) {
6178
6398
  // navigation, that is not a failure, so error hooks never see it.
6179
6399
  if (hydrationController.signal.aborted || !container.isConnected) return;
6180
6400
  if (shouldHydrate) {
6181
- reactRoot = hydrateFarmRoute(container, routeState);
6401
+ reactRoot = farmRoot.hydrateFarmRoute(container, routeState);
6182
6402
  reactRootContainer = container;
6183
6403
  isHydrated = true;
6184
6404
  } else {
@@ -6186,7 +6406,7 @@ function scheduleFarmRouteHydration(matched, pathname, container, serverProps) {
6186
6406
  reactRoot = createRoot(container);
6187
6407
  reactRootContainer = container;
6188
6408
  }
6189
- renderFarmRoute(reactRoot, routeState);
6409
+ farmRoot.renderFarmRoute(reactRoot, routeState);
6190
6410
  }
6191
6411
  await farmClientRuntime.completeHydration(hydrationSession);
6192
6412
  } catch (error) {
@@ -6201,6 +6421,14 @@ function scheduleFarmRouteHydration(matched, pathname, container, serverProps) {
6201
6421
  });
6202
6422
  }
6203
6423
 
6424
+ // The code that renders a page or layout root, which islands mode's web build loads on demand
6425
+ // (RFC 0013) and every other client has here.
6426
+ /*farm-root-stub-start*/
6427
+ function loadFarmRoot() {
6428
+ return Promise.resolve({ ${FARM_ROOT_MODULE_EXPORTS.join(", ")} });
6429
+ }
6430
+ /*farm-root-stub-end*/
6431
+
6204
6432
  /*farm-router-start*/
6205
6433
  // A layout boundary is the same layout when its key matches: islands mode keys it by pattern and
6206
6434
  // params, so a layout whose params change renders again. Other modes compare patterns.
@@ -6237,7 +6465,7 @@ function fitsSegmentResponse(currentRoot, nextRoot) {
6237
6465
  return true;
6238
6466
  }` : ""}
6239
6467
 
6240
- ${_chunkCL7BUGVBcjs.FARM_NAVIGATION_SCRIPT_SOURCE}
6468
+ ${_chunkJHRJ5V2Fcjs.FARM_NAVIGATION_SCRIPT_SOURCE}
6241
6469
 
6242
6470
  function activateNavigationScripts(root) {
6243
6471
  for (const script of Array.from(root?.querySelectorAll?.("script") || [])) {
@@ -6274,9 +6502,12 @@ async function streamFarmNavigation(stream, root, isCurrent) {
6274
6502
  for (let flush = await stream.next(); flush !== null; flush = await stream.next()) {
6275
6503
  if (!isCurrent()) return stream.cancel();
6276
6504
  html += flush;
6277
- const parsed = new DOMParser().parseFromString('<div id="root">' + flush, "text/html");
6505
+ const parsed = new DOMParser()
6506
+ .parseFromString('<div id="root">' + flush, "text/html")
6507
+ .getElementById("root");
6508
+ adoptFarmParsedNodes(parsed);
6278
6509
  const fragment = document.createDocumentFragment();
6279
- for (const node of Array.from(parsed.getElementById("root").childNodes)) fragment.appendChild(node);
6510
+ for (const node of Array.from(parsed.childNodes)) fragment.appendChild(node);
6280
6511
  activateNavigationScripts(fragment);
6281
6512
  root.appendChild(fragment);
6282
6513
  }
@@ -6340,7 +6571,7 @@ function getLayoutShell(root, patterns, index) {
6340
6571
  return shell.innerHTML;
6341
6572
  }
6342
6573
 
6343
- ${islandValues ? _chunkCL7BUGVBcjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
6574
+ ${islandValues ? _chunkJHRJ5V2Fcjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
6344
6575
  // A refresh keeps the islands still on the page: the ones in streamed Suspense content too.
6345
6576
  if (refresh) revealFarmStreamedContent(nextRoot);
6346
6577
  const currentPatterns = getLayoutPatterns(currentRoot);
@@ -6372,6 +6603,8 @@ ${islandValues ? _chunkCL7BUGVBcjs.FARM_REFRESH_FIELDS_SOURCE : ""}function repl
6372
6603
  ${isolatedHydrationEnabled ? `${islandValues ? `// A refresh keeps the islands still on the page, with their state and new props.
6373
6604
  if (refresh) farmIsolatedHydrationRuntime.carryOver(currentTarget, nextTarget);
6374
6605
  ` : ""}disposeFarmIsolatedClientBoundaries(currentTarget);` : ""}
6606
+ // After the comparison: a noscript turned to text serializes escaped in the parsed document.
6607
+ adoptFarmParsedNodes(nextRoot);
6375
6608
  currentTarget.replaceWith(nextTarget);${islandValues ? "\n if (fields) restoreFarmServerFields(fields, nextTarget);" : ""}
6376
6609
  activateNavigationScripts(nextTarget);
6377
6610
  if (nextTreeRoot && nextTreeRoot !== nextTarget) nextTreeRoot.remove();
@@ -6471,6 +6704,14 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
6471
6704
  }
6472
6705
  const pathname = url.pathname;
6473
6706
  const matched = matchRoute(pathname);
6707
+ // A root that hydrates on load renders with code that loads beside its page (RFC 0013).
6708
+ if (
6709
+ matched &&
6710
+ (matched.route.pageShouldHydrate || hasHydratableLayout(pathname)) &&
6711
+ (matched.route.islandStrategy || "load") === "load"
6712
+ ) {
6713
+ void loadFarmRoot().catch(function() {});
6714
+ }
6474
6715
  const from = this.currentPath;
6475
6716
  if (await this.shouldBlockNavigation({ from, to, action })) {
6476
6717
  if (action === "pop") this.revertBlockedPopState(from);
@@ -6560,23 +6801,22 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
6560
6801
  }
6561
6802
  }
6562
6803
 
6563
- if (
6564
- !options.refresh &&
6565
- matched?.route.navigation === "client-render" &&
6566
- farmTreeLayoutsReady(pathname, matched.params)
6567
- ) {
6804
+ // The code that renders a page loads with the navigation to one (RFC 0013).
6805
+ const farmRoot =
6806
+ !options.refresh && matched?.route.navigation === "client-render" ? await loadFarmRoot() : null;
6807
+ if (farmRoot && farmRoot.farmTreeLayoutsReady(pathname, matched.params)) {
6568
6808
  // Navigation itself signals intent, so destination routes load eagerly even
6569
6809
  // when their initial document hydration strategy is deferred.
6570
- const Component = await loadRouteComponent(matched.route);
6810
+ const Component = await farmRoot.loadRouteComponent(matched.route);
6571
6811
  if (!this.isCurrentNavigation(navigation, clientNavigation)) return;
6572
6812
  const params = matched.params;
6573
6813
  const searchParams = searchParamsToObject(url.searchParams);
6574
6814
  const props = { params: params, searchParams: createFarmSearchParams(searchParams) };
6575
6815
  let pageElement = React.createElement(Component, props);
6576
6816
  if (hasHydratableLayout(pathname)) {
6577
- pageElement = createLayoutPageBoundary(matched.route, pageElement);
6817
+ pageElement = farmRoot.createLayoutPageBoundary(matched.route, pageElement);
6578
6818
  }
6579
- const routeState = createFarmRouteState(
6819
+ const routeState = farmRoot.createFarmRouteState(
6580
6820
  pageElement,
6581
6821
  pathname,
6582
6822
  params,
@@ -6599,7 +6839,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
6599
6839
  if (!reactRoot) {
6600
6840
  setFarmReactRoot(createRoot(container), container);
6601
6841
  }
6602
- renderFarmRoute(reactRoot, routeState);
6842
+ farmRoot.renderFarmRoute(reactRoot, routeState);
6603
6843
  }
6604
6844
  this.currentPath = to;
6605
6845
  });
@@ -6747,12 +6987,22 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
6747
6987
  const matched = matchRoute(newPathname);
6748
6988
  const hydrateLayouts = hasHydratableLayout(newPathname);
6749
6989
  const nextPage = newRoot.querySelector("#__farm_page__");
6990
+ // A root that hydrates on load, or one React already renders, renders with code that loads
6991
+ // with the navigation to it (RFC 0013). One that waits for its trigger loads it then.
6992
+ const farmRoot =
6993
+ matched &&
6994
+ (hydrateLayouts || matched.route.pageShouldHydrate) &&
6995
+ ((matched.route.islandStrategy || "load") === "load" ||
6996
+ (hydrateLayouts && reactRoot && reactRootContainer === currentRoot))
6997
+ ? await loadFarmRoot()
6998
+ : null;
6999
+ if (!isNavigationCurrent()) return false;
6750
7000
 
6751
7001
  // If React already owns the shared layout, update that root. React keeps
6752
7002
  // matching layout component instances and their state mounted.
6753
- if (matched && hydrateLayouts && reactRoot && reactRootContainer === currentRoot) {
7003
+ if (matched && hydrateLayouts && reactRoot && reactRootContainer === currentRoot && farmRoot) {
6754
7004
  const searchParams = searchParamsToObject(targetUrl.searchParams);
6755
- const routeState = await createMatchedHydrationRoute(
7005
+ const routeState = await farmRoot.createMatchedHydrationRoute(
6756
7006
  matched,
6757
7007
  newPathname,
6758
7008
  searchParams,
@@ -6762,7 +7012,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
6762
7012
  );
6763
7013
  if (!isNavigationCurrent()) return false;
6764
7014
  if (routeState) {
6765
- renderFarmRoute(reactRoot, routeState);
7015
+ farmRoot.renderFarmRoute(reactRoot, routeState);
6766
7016
  window.__FARM_ROUTE_SLOTS__ = nextRouteSlots;
6767
7017
  setFarmHydrated();
6768
7018
  return true;
@@ -6784,7 +7034,9 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
6784
7034
  ${islandValues ? 'if (!replacedSharedBoundary && isSegment) return "segment-mismatch";' : ""}
6785
7035
  if (!replacedSharedBoundary) {
6786
7036
  ${isolatedHydrationEnabled ? "disposeFarmIsolatedClientBoundaries(currentRoot);" : ""}
6787
- currentRoot.innerHTML = newRoot.innerHTML;
7037
+ // The parsed nodes themselves, not markup the page parses again.
7038
+ adoptFarmParsedNodes(newRoot);
7039
+ currentRoot.replaceChildren(...newRoot.childNodes);
6788
7040
  activateNavigationScripts(currentRoot);
6789
7041
  isolatedHydrationScope = currentRoot;
6790
7042
  }
@@ -6809,7 +7061,8 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
6809
7061
  );
6810
7062
  } else {
6811
7063
  const searchParams = searchParamsToObject(targetUrl.searchParams);
6812
- const routeState = await createMatchedHydrationRoute(
7064
+ // Without a page or layout root to hydrate, there is no route state.
7065
+ const routeState = farmRoot && await farmRoot.createMatchedHydrationRoute(
6813
7066
  matched,
6814
7067
  newPathname,
6815
7068
  searchParams,
@@ -6820,7 +7073,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
6820
7073
  );
6821
7074
  if (!isNavigationCurrent()) return false;
6822
7075
  if (routeState) {
6823
- setFarmReactRoot(hydrateFarmRoute(pageContainer, routeState), pageContainer);
7076
+ setFarmReactRoot(farmRoot.hydrateFarmRoute(pageContainer, routeState), pageContainer);
6824
7077
  setFarmHydrated();
6825
7078
  }
6826
7079
  }
@@ -6866,7 +7119,8 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
6866
7119
  });
6867
7120
 
6868
7121
  document.head.innerHTML = doc.head ? doc.head.innerHTML : "";
6869
- document.body.innerHTML = doc.body.innerHTML;
7122
+ adoptFarmParsedNodes(doc.body);
7123
+ document.body.replaceChildren(...doc.body.childNodes);
6870
7124
  delete window.__farmDocsRuntime;
6871
7125
  delete window.__farmDocsPageActionsRuntime;
6872
7126
 
@@ -6985,7 +7239,7 @@ document.addEventListener("click", function(e) {
6985
7239
  if (isFarmDocsSearchPage()) {
6986
7240
  mountFarmDocsSearch();
6987
7241
  }
6988
- void hydrate();
7242
+ void hydrate().finally(markFarmHydrated);
6989
7243
  `.trim();
6990
7244
  }
6991
7245
  async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache, rendererBuildLifetime, sourceSnapshot) {
@@ -6996,7 +7250,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
6996
7250
  farmPlugin,
6997
7251
  farmServerOnlyEntriesPlugin
6998
7252
  } = await import("./vite.cjs");
6999
- const { PluginManager: PluginManager2 } = await import("./plugin-LN3JBZRR.cjs");
7253
+ const { PluginManager: PluginManager2 } = await import("./plugin-3PT7I26P.cjs");
7000
7254
  const fs5 = await import("fs/promises");
7001
7255
  const pluginManager = new PluginManager2({
7002
7256
  config,
@@ -7007,7 +7261,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7007
7261
  const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
7008
7262
  let postcssConfigDir;
7009
7263
  let tailwindVitePlugin = void 0;
7010
- const rendererVitePlugins = await _chunkM6DAIE4Tcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
7264
+ const rendererVitePlugins = await _chunkNGTZHWBGcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
7011
7265
  ssr: true,
7012
7266
  buildLifetime: rendererBuildLifetime
7013
7267
  });
@@ -7017,7 +7271,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7017
7271
  _path2.default.join(postcssConfigDir, "postcss.config.cjs"),
7018
7272
  "module.exports = { plugins: [] };\n"
7019
7273
  );
7020
- tailwindVitePlugin = await _chunkZ5BANEQDcjs.loadTailwindVitePlugin.call(void 0, {
7274
+ tailwindVitePlugin = await _chunkDMSXZNQRcjs.loadTailwindVitePlugin.call(void 0, {
7021
7275
  builder: productionVite.builder,
7022
7276
  label: "for SSR"
7023
7277
  });
@@ -7124,7 +7378,11 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7124
7378
  }))
7125
7379
  );
7126
7380
  const instrumentationPath = _chunk3BTN3NP7cjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
7127
- const notFoundPath = _chunkCL7BUGVBcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
7381
+ const notFoundPath = _chunkJHRJ5V2Fcjs.resolveFarmNotFoundComponentPath.call(void 0,
7382
+ config,
7383
+ appDirs,
7384
+ routeManager.getRendererNotFoundPath()
7385
+ );
7128
7386
  if (notFoundPath) _chunk7U4XF76Rcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
7129
7387
  layoutRoutes.sort((a, b) => {
7130
7388
  const depthA = a.pattern.split("/").filter(Boolean).length;
@@ -7141,14 +7399,14 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7141
7399
  const hasServerRuntimeIntegrations = configuredIntegrationValues.some(
7142
7400
  (integration) => typeof integration === "object" && integration !== null && (!("serverRuntime" in integration) || integration.serverRuntime !== false)
7143
7401
  );
7144
- const hasIntegrationProviders = _chunkWGWWRV2Mcjs.getIntegrationProviders.call(void 0, config.integrations).some(
7402
+ const hasIntegrationProviders = _chunkB3HQTGXScjs.getIntegrationProviders.call(void 0, config.integrations).some(
7145
7403
  (provider) => provider.component || provider.type === "clerk"
7146
7404
  );
7147
7405
  const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
7148
- const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _136 => _136.mdx, 'optionalAccess', _137 => _137.components]));
7149
- const hasMiddlewareConfig = _chunkOFVCWV2Dcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
7150
- const hasRouteContextConfig = _chunkMOGRRZMWcjs.hasCustomFarmRouteContext.call(void 0, config);
7151
- const hasServerRuntimePlugins = _chunkZ5BANEQDcjs.hasFarmServerRuntimePlugins.call(void 0, config.plugins);
7406
+ const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _131 => _131.mdx, 'optionalAccess', _132 => _132.components]));
7407
+ const hasMiddlewareConfig = _chunkNEKO3HM2cjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
7408
+ const hasRouteContextConfig = _chunk55UJGUBPcjs.hasCustomFarmRouteContext.call(void 0, config);
7409
+ const hasServerRuntimePlugins = _chunkDMSXZNQRcjs.hasFarmServerRuntimePlugins.call(void 0, config.plugins);
7152
7410
  const hasPluginRoutes = hasFarmPluginRoutes(config);
7153
7411
  const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
7154
7412
  const configModulePath = hasServerRuntimeIntegrations || hasObservabilityHandler || hasMdxComponentConfig || hasMiddlewareConfig || hasRouteContextConfig || hasServerRuntimePlugins || hasPluginRoutes || hasServerCacheConfig || hasFarmServerStorageConfig(config.storage) || hasIntegrationProviders ? await findFarmConfigPath(root) : null;
@@ -7157,9 +7415,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7157
7415
  const hasConfiguredRuntimePlugins = Boolean(
7158
7416
  hasRuntimeConfigModule && (config.plugins || []).length > 0
7159
7417
  );
7160
- if (_chunkE3HBD2K3cjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
7418
+ if (_chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
7161
7419
  const adapterGuardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
7162
- _chunkE3HBD2K3cjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
7420
+ _chunkLN6FAYNBcjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
7163
7421
  config.docs,
7164
7422
  { root, srcDir: config.srcDir },
7165
7423
  (pathname) => adapterGuardedPaths.has(pathname),
@@ -7167,9 +7425,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7167
7425
  );
7168
7426
  }
7169
7427
  const farmDocsCspNonceMarker = _chunk6JHZPB52cjs.createFarmCspNonce.call(void 0, config.security);
7170
- const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _138 => _138.docs, 'optionalAccess', _139 => _139.enabled]) && _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunk2RSVYJT6cjs._runWithFarmCspNonce.call(void 0,
7428
+ const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _133 => _133.docs, 'optionalAccess', _134 => _134.enabled]) && _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunk2RSVYJT6cjs._runWithFarmCspNonce.call(void 0,
7171
7429
  farmDocsCspNonceMarker,
7172
- async () => _optionalChain([config, 'access', _140 => _140.docs, 'access', _141 => _141.adapter, 'optionalAccess', _142 => _142.server]) ? await _chunkE3HBD2K3cjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
7430
+ async () => _optionalChain([config, 'access', _135 => _135.docs, 'access', _136 => _136.adapter, 'optionalAccess', _137 => _137.server]) ? await _chunkLN6FAYNBcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
7173
7431
  root,
7174
7432
  srcDir: config.srcDir,
7175
7433
  clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
@@ -7229,7 +7487,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7229
7487
  (image) => image.sourceType === "module"
7230
7488
  );
7231
7489
  const externalMetadataImageRuntime = useExternalMetadataImageRuntime && !omitCoreMetadataImageRuntime ? ["@vercel/og"] : [];
7232
- const rendererOptionalExternals = _chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, config.renderer) ? [] : [
7490
+ const rendererOptionalExternals = _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? [] : [
7233
7491
  "react",
7234
7492
  "react/jsx-runtime",
7235
7493
  "react/jsx-dev-runtime",
@@ -7283,7 +7541,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7283
7541
  // Adapters can render provider scripts by serializing function source.
7284
7542
  // keepNames injects helper calls into those functions; after Nitro
7285
7543
  // minifies the server chunk the helper is no longer in script scope.
7286
- keepNames: !(_optionalChain([config, 'access', _143 => _143.docs, 'optionalAccess', _144 => _144.enabled]) && _optionalChain([config, 'access', _145 => _145.docs, 'access', _146 => _146.adapter, 'optionalAccess', _147 => _147.server])),
7544
+ keepNames: !(_optionalChain([config, 'access', _138 => _138.docs, 'optionalAccess', _139 => _139.enabled]) && _optionalChain([config, 'access', _140 => _140.docs, 'access', _141 => _141.adapter, 'optionalAccess', _142 => _142.server])),
7287
7545
  jsxDev: false
7288
7546
  },
7289
7547
  // SSR configuration to externalize problematic modules
@@ -7333,10 +7591,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7333
7591
  define: {
7334
7592
  __FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
7335
7593
  __FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
7336
- __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _148 => _148.env, 'optionalAccess', _149 => _149.public]) || {})
7594
+ __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _143 => _143.env, 'optionalAccess', _144 => _144.public]) || {})
7337
7595
  },
7338
7596
  plugins: [
7339
- _chunkCL7BUGVBcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
7597
+ _chunkJHRJ5V2Fcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
7340
7598
  ...tailwindVitePlugin ? [tailwindVitePlugin] : [],
7341
7599
  ...rendererVitePlugins,
7342
7600
  ...config.vite.plugins || [],
@@ -7368,7 +7626,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7368
7626
  },
7369
7627
  pluginManager
7370
7628
  ),
7371
- _chunk46UV2E7Icjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
7629
+ _chunkEFI6QWBQcjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
7372
7630
  ...hasRuntimeConfigModule ? [
7373
7631
  farmStripPlatformConfigPlugin(
7374
7632
  [
@@ -7380,7 +7638,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7380
7638
  {
7381
7639
  name: "farm-virtual-ssr-entry",
7382
7640
  resolveId: {
7383
- filter: { id: _chunkCL7BUGVBcjs.exactIdPattern.call(void 0, [virtualEntryId, "\0virtual:farm-ssr-entry"]) },
7641
+ filter: { id: _chunkJHRJ5V2Fcjs.exactIdPattern.call(void 0, [virtualEntryId, "\0virtual:farm-ssr-entry"]) },
7384
7642
  handler(id) {
7385
7643
  if (id === virtualEntryId || id === "\0virtual:farm-ssr-entry") {
7386
7644
  return virtualEntryId;
@@ -7389,7 +7647,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7389
7647
  }
7390
7648
  },
7391
7649
  load: {
7392
- filter: { id: _chunkCL7BUGVBcjs.exactIdPattern.call(void 0, [virtualEntryId]) },
7650
+ filter: { id: _chunkJHRJ5V2Fcjs.exactIdPattern.call(void 0, [virtualEntryId]) },
7393
7651
  handler(id) {
7394
7652
  if (id === virtualEntryId) {
7395
7653
  return virtualEntryCode;
@@ -7421,7 +7679,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7421
7679
  resolve: {
7422
7680
  alias: [
7423
7681
  ...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
7424
- ...Object.entries(_chunkCL7BUGVBcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
7682
+ ...Object.entries(_chunkJHRJ5V2Fcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
7425
7683
  ([find, replacement]) => ({ find, replacement })
7426
7684
  )
7427
7685
  ],
@@ -7429,12 +7687,12 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7429
7687
  dedupe: [...config.renderer.dedupe || []]
7430
7688
  }
7431
7689
  };
7432
- await viteBuild(_chunkCL7BUGVBcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
7690
+ await viteBuild(_chunkJHRJ5V2Fcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
7433
7691
  } finally {
7434
7692
  if (postcssConfigDir) {
7435
7693
  try {
7436
7694
  await fs5.rm(postcssConfigDir, { recursive: true, force: true });
7437
- } catch (e35) {
7695
+ } catch (e36) {
7438
7696
  }
7439
7697
  }
7440
7698
  }
@@ -7447,7 +7705,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7447
7705
  function readFarmAppPackageIdentity(root) {
7448
7706
  try {
7449
7707
  return JSON.parse(_fs.readFileSync.call(void 0, _path2.default.join(root, "package.json"), "utf8"));
7450
- } catch (e36) {
7708
+ } catch (e37) {
7451
7709
  return {};
7452
7710
  }
7453
7711
  }
@@ -7459,13 +7717,13 @@ function readFarmPageLastModified(pageRoutes) {
7459
7717
  lastModified[route.pattern] = _fs.statSync.call(void 0,
7460
7718
  _nullishCoalesce(route.markdownSourcePath, () => ( route.modulePath))
7461
7719
  ).mtime.toISOString();
7462
- } catch (e37) {
7720
+ } catch (e38) {
7463
7721
  }
7464
7722
  }
7465
7723
  return lastModified;
7466
7724
  }
7467
7725
  function getFarmDocsGuardedPaths(config, middlewareRoutes) {
7468
- if (!_optionalChain([config, 'access', _150 => _150.docs, 'optionalAccess', _151 => _151.enabled])) return [];
7726
+ if (!_optionalChain([config, 'access', _145 => _145.docs, 'optionalAccess', _146 => _146.enabled])) return [];
7469
7727
  const options = { root: config.root, srcDir: config.srcDir };
7470
7728
  const guards = {
7471
7729
  config: { middleware: config.middleware, integrations: config.integrations },
@@ -7473,18 +7731,18 @@ function getFarmDocsGuardedPaths(config, middlewareRoutes) {
7473
7731
  };
7474
7732
  return _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs).flatMap(
7475
7733
  (docsRoot) => _chunkHR5GU4UUcjs.discoverFarmDocsPages.call(void 0, _chunkHR5GU4UUcjs.resolveFarmDocsContentDir.call(void 0, docsRoot, options), docsRoot)
7476
- ).flatMap((page) => [page.href, _chunkHR5GU4UUcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunkOFVCWV2Dcjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
7734
+ ).flatMap((page) => [page.href, _chunkHR5GU4UUcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunkNEKO3HM2cjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
7477
7735
  }
7478
7736
  function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
7479
- const llmsTxt = _optionalChain([agent, 'optionalAccess', _152 => _152.llmsTxt]);
7737
+ const llmsTxt = _optionalChain([agent, 'optionalAccess', _147 => _147.llmsTxt]);
7480
7738
  const ownedByFile = (kind) => applicationMetadataRoutes.some(
7481
7739
  (metadata) => metadata.kind === kind && metadata.pattern === "/"
7482
7740
  );
7483
7741
  return [
7484
- ..._optionalChain([llmsTxt, 'optionalAccess', _153 => _153.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
7485
- ..._optionalChain([llmsTxt, 'optionalAccess', _154 => _154.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
7486
- ..._optionalChain([agent, 'optionalAccess', _155 => _155.sitemap, 'optionalAccess', _156 => _156.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
7487
- ..._optionalChain([agent, 'optionalAccess', _157 => _157.crawlers, 'optionalAccess', _158 => _158.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
7742
+ ..._optionalChain([llmsTxt, 'optionalAccess', _148 => _148.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
7743
+ ..._optionalChain([llmsTxt, 'optionalAccess', _149 => _149.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
7744
+ ..._optionalChain([agent, 'optionalAccess', _150 => _150.sitemap, 'optionalAccess', _151 => _151.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
7745
+ ..._optionalChain([agent, 'optionalAccess', _152 => _152.crawlers, 'optionalAccess', _153 => _153.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
7488
7746
  ];
7489
7747
  }
7490
7748
  function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
@@ -7495,7 +7753,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
7495
7753
  docsPath: ${root}.entry,
7496
7754
  contentDir: ${root}.contentDir || ${root}.config?.contentDir,
7497
7755
  }`;
7498
- if (_optionalChain([docs, 'optionalAccess', _159 => _159.roots, 'optionalAccess', _160 => _160.length])) {
7756
+ if (_optionalChain([docs, 'optionalAccess', _154 => _154.roots, 'optionalAccess', _155 => _155.length])) {
7499
7757
  return {
7500
7758
  factory: "createFarmDocsAdapterMultiRuntimeHandler",
7501
7759
  config: `[farmDocsResolvedConfig, ...farmDocsResolvedConfig.roots].map((farmDocsRoot) => (${runtimeConfig("farmDocsRoot")}))`
@@ -7508,7 +7766,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
7508
7766
  }
7509
7767
  function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
7510
7768
  if (!docs.enabled) return "null";
7511
- const serializableDocs = _optionalChain([docs, 'access', _161 => _161.roots, 'optionalAccess', _162 => _162.length]) ? {
7769
+ const serializableDocs = _optionalChain([docs, 'access', _156 => _156.roots, 'optionalAccess', _157 => _157.length]) ? {
7512
7770
  ...docs,
7513
7771
  // React elements and functions do not survive JSON; see runtimeConfig below.
7514
7772
  roots: docs.roots.map((docsRoot) => ({ ...docsRoot, runtimeConfig: void 0 }))
@@ -7542,7 +7800,7 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
7542
7800
  },
7543
7801
  }
7544
7802
  : ${JSON.stringify({ ...serializableDocs, runtimeConfig: void 0 })}`;
7545
- if (!_optionalChain([docs, 'access', _163 => _163.roots, 'optionalAccess', _164 => _164.length])) return expression;
7803
+ if (!_optionalChain([docs, 'access', _158 => _158.roots, 'optionalAccess', _159 => _159.length])) return expression;
7546
7804
  return `((farmDocs) => ({
7547
7805
  ...farmDocs,
7548
7806
  roots: farmDocs.roots.map((farmDocsRoot, index) => {
@@ -7559,7 +7817,7 @@ function toVirtualEntryImportSpecifier(modulePath) {
7559
7817
  return JSON.stringify(modulePath.replace(/\\/g, "/"));
7560
7818
  }
7561
7819
  function generateNativeAuthIntegrationSource(auth) {
7562
- if (_optionalChain([auth, 'optionalAccess', _165 => _165.enabled]) !== true) {
7820
+ if (_optionalChain([auth, 'optionalAccess', _160 => _160.enabled]) !== true) {
7563
7821
  return { importSource: "", registerSource: "" };
7564
7822
  }
7565
7823
  return {
@@ -7791,7 +8049,7 @@ function getFarmBufferedPreloadMarker(html) {
7791
8049
  // Prove eligibility while Farm still owns the complete document string.
7792
8050
  // Candidate-bearing or unknown bodies must retain the full parser path.
7793
8051
  // Response.text() strips a leading UTF-8 BOM; retain that legacy behavior.
7794
- return typeof html === "string" && html.charCodeAt(0) !== 0xfeff && !/\\bpreload\\b/i.test(html) ? "none" : "1";
8052
+ return typeof html === "string" && html.charCodeAt(0) !== 0xfeff && !hasFarmHtmlPreloadToken(html) ? "none" : "1";
7795
8053
  }
7796
8054
 
7797
8055
  async function applyFarmPreloadBudget(response, pathname, request) {
@@ -7863,7 +8121,7 @@ async function applyFarmPreloadBudget(response, pathname, request) {
7863
8121
  `.trim();
7864
8122
  }
7865
8123
  function generateFarmRendererAppSetupServerCode(config) {
7866
- const appSetupPath = _chunkM6DAIE4Tcjs.resolveFarmRendererAppSetup.call(void 0, config.root || process.cwd(), config.renderer);
8124
+ const appSetupPath = _chunkNGTZHWBGcjs.resolveFarmRendererAppSetup.call(void 0, config.root || process.cwd(), config.renderer);
7867
8125
  if (!appSetupPath) return "";
7868
8126
  return `
7869
8127
  import __farmAppSetup from ${JSON.stringify(_chunk7U4XF76Rcjs.toPosixPath.call(void 0, appSetupPath))};
@@ -7873,45 +8131,44 @@ if (typeof ReactDOMServer.configureApp !== "function") {
7873
8131
  ReactDOMServer.configureApp(__farmAppSetup);`;
7874
8132
  }
7875
8133
  function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache, mobileShellLoadingRoutes = [], farmDocsAnalyticsPages = []) {
7876
- const farmRendererDisabled = _chunkM6DAIE4Tcjs.isFarmRendererDisabled.call(void 0, config.renderer);
8134
+ const farmRendererDisabled = _chunkNGTZHWBGcjs.isFarmRendererDisabled.call(void 0, config.renderer);
7877
8135
  const searchPreserveRoutes = pageRoutes.flatMap(
7878
8136
  (route) => route.searchPreserve ? [route.searchPreserve] : []
7879
8137
  );
7880
8138
  const searchPreserveRoutesSource = searchPreserveRoutes.length > 0 ? JSON.stringify(searchPreserveRoutes) : "";
7881
- const farmIslandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _166 => _166.experimental, 'optionalAccess', _167 => _167.serverComponents])) === "islands";
7882
- const farmRendererActions = _chunkCL7BUGVBcjs.resolveFarmIslxActionsMode.call(void 0, config) === "renderer";
7883
- const farmClientBoot = _chunkCL7BUGVBcjs.canBootFarmIslandsClient.call(void 0, config);
8139
+ const farmIslandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _161 => _161.experimental, 'optionalAccess', _162 => _162.serverComponents])) === "islands";
8140
+ const farmRendererActions = _chunkJHRJ5V2Fcjs.resolveFarmIslxActionsMode.call(void 0, config) === "renderer";
8141
+ const farmClientBoot = _chunkJHRJ5V2Fcjs.canBootFarmIslandsClient.call(void 0, config);
7884
8142
  const farmMobileClient = shouldBuildFarmMobileClient(config);
7885
8143
  const farmMobileShells = farmMobileClient && config.mobileShells ? config.mobileShells : null;
7886
- const hasCompressionRuntime = config.compress && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
7887
- const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _168 => _168.agent, 'optionalAccess', _169 => _169.crawlers, 'optionalAccess', _170 => _170.enabled])) && !applicationMetadataRoutes.some(
8144
+ const hasCompressionRuntime = config.compress && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) !== "edge";
8145
+ const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _163 => _163.agent, 'optionalAccess', _164 => _164.crawlers, 'optionalAccess', _165 => _165.enabled])) && !applicationMetadataRoutes.some(
7888
8146
  (metadata) => metadata.kind === "robots" && metadata.pattern === "/"
7889
8147
  );
7890
- const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _171 => _171.agent, 'optionalAccess', _172 => _172.sitemap, 'optionalAccess', _173 => _173.enabled])) && !applicationMetadataRoutes.some(
8148
+ const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _166 => _166.agent, 'optionalAccess', _167 => _167.sitemap, 'optionalAccess', _168 => _168.enabled])) && !applicationMetadataRoutes.some(
7891
8149
  (metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
7892
8150
  );
7893
- const servesDefaultMCP = _optionalChain([config, 'access', _174 => _174.agent, 'optionalAccess', _175 => _175.mcp]) === true && !_chunkW53Z4WDIcjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
7894
- const servesAiCatalog = _optionalChain([config, 'access', _176 => _176.agent, 'optionalAccess', _177 => _177.aiCatalog]) !== false;
8151
+ const servesDefaultMCP = _optionalChain([config, 'access', _169 => _169.agent, 'optionalAccess', _170 => _170.mcp]) === true && !_chunkW53Z4WDIcjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
8152
+ const servesAiCatalog = _optionalChain([config, 'access', _171 => _171.agent, 'optionalAccess', _172 => _172.aiCatalog]) !== false;
7895
8153
  const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
7896
8154
  const hasInfraAnalyticsRuntime = config.analytics !== false && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
8155
+ const reportsWebMCPCalls = hasInfraAnalyticsRuntime && _chunkOM6JIIJUcjs._farmWebMCPReportsEnabled.call(void 0, config.plugins);
7897
8156
  const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
7898
- const adapterOwnsDocsRuntime = Boolean(
7899
- _chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _178 => _178.docs, 'optionalAccess', _179 => _179.enabled]) && _optionalChain([config, 'access', _180 => _180.docs, 'access', _181 => _181.adapter, 'optionalAccess', _182 => _182.server]) && config.docs.adapter.react
7900
- );
7901
- if (_optionalChain([config, 'access', _183 => _183.docs, 'optionalAccess', _184 => _184.enabled]) && _optionalChain([config, 'access', _185 => _185.docs, 'access', _186 => _186.roots, 'optionalAccess', _187 => _187.length]) && !adapterOwnsDocsRuntime) {
8157
+ const adapterOwnsDocsRuntime = _chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs);
8158
+ if (_optionalChain([config, 'access', _173 => _173.docs, 'optionalAccess', _174 => _174.enabled]) && _optionalChain([config, 'access', _175 => _175.docs, 'access', _176 => _176.roots, 'optionalAccess', _177 => _177.length]) && !adapterOwnsDocsRuntime) {
7902
8159
  throw new Error(
7903
- "Several docs roots need the docs adapter, which serves the React renderer only; Farm's built-in docs renderer serves a single docs root."
8160
+ "Several docs roots need a docs adapter; Farm's built-in docs renderer serves a single docs root."
7904
8161
  );
7905
8162
  }
7906
8163
  const docsConfigModulePath = adapterOwnsDocsRuntime && !hasPrecompiledDocs && config.docs.configPath && !config.docs.configPath.endsWith(".json") ? config.docs.configPath : void 0;
7907
8164
  const adapterHandler = generateFarmDocsAdapterHandlerArguments(config.docs, docsConfigModulePath);
7908
- const hasIsolatedClientGraphRuntime = _chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, config.renderer) && isolatedClientBoundaryModules.size > 0;
7909
- const rendererStreamingCapabilities = _chunkM6DAIE4Tcjs.getFarmRendererStreamingCapabilitiesForRuntime.call(void 0,
8165
+ const hasIsolatedClientGraphRuntime = _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) && isolatedClientBoundaryModules.size > 0;
8166
+ const rendererStreamingCapabilities = _chunkNGTZHWBGcjs.getFarmRendererStreamingCapabilitiesForRuntime.call(void 0,
7910
8167
  config.renderer,
7911
8168
  _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset)
7912
8169
  );
7913
- const hasReactSyncRender = _chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, config.renderer);
7914
- const rendererServerImports = _chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, config.renderer) ? `import * as React from "react";
8170
+ const hasReactSyncRender = _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer);
8171
+ const rendererServerImports = _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? `import * as React from "react";
7915
8172
  import * as ReactDOMServer from "react-dom/server";
7916
8173
  import { markPagePosition, markLayoutPosition } from "@farm.js/core/internal/production-runtime";${hasIsolatedClientGraphRuntime ? farmIslandsMode ? '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph, renderFarmServerTreePage, renderFarmServerTreeLayout, withFarmIslandsRender } from "@farm.js/core/internal/islands-runtime";' : '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";\nimport { renderFarmServerTreePage } from "@farm.js/core/internal/server-tree";' : ""}` : (
7917
8174
  // The renderer contract is the server module's named exports, which the development
@@ -7957,27 +8214,27 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
7957
8214
  (image) => image.sourceType === "module"
7958
8215
  );
7959
8216
  const edgeMiddlewareFilePaths = farmTargetRunsEdgeMiddleware(preset) ? middlewareRoutes.filter(isFarmEdgeMiddlewareRoute).map((route) => route.filePath) : [];
7960
- const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunkOFVCWV2Dcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
7961
- const farmDocsFontAssets = _optionalChain([config, 'access', _188 => _188.docs, 'optionalAccess', _189 => _189.enabled]) ? _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
7962
- const integrationProviders = _chunkWGWWRV2Mcjs.getIntegrationProviders.call(void 0, config.integrations);
8217
+ const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunkNEKO3HM2cjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
8218
+ const farmDocsFontAssets = _optionalChain([config, 'access', _178 => _178.docs, 'optionalAccess', _179 => _179.enabled]) ? _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
8219
+ const integrationProviders = _chunkB3HQTGXScjs.getIntegrationProviders.call(void 0, config.integrations);
7963
8220
  const renderedIntegrationProviders = integrationProviders.filter(
7964
8221
  (provider) => provider.component || provider.type === "clerk"
7965
8222
  );
7966
- if (renderedIntegrationProviders.length > 0 && !_chunkM6DAIE4Tcjs.getFarmRendererCapabilities.call(void 0, config.renderer).functionComponents) {
8223
+ if (renderedIntegrationProviders.length > 0 && !_chunkNGTZHWBGcjs.getFarmRendererCapabilities.call(void 0, config.renderer).functionComponents) {
7967
8224
  throw new Error(
7968
8225
  `Integration provider components are not supported by the "${config.renderer.name}" renderer.`
7969
8226
  );
7970
8227
  }
7971
- const providerServerModules = _chunkCL7BUGVBcjs.generateFarmIntegrationProviderServerModules.call(void 0,
8228
+ const providerServerModules = _chunkJHRJ5V2Fcjs.generateFarmIntegrationProviderServerModules.call(void 0,
7972
8229
  renderedIntegrationProviders,
7973
8230
  config.root,
7974
8231
  _nullishCoalesce(config.renderer.componentExtensions, () => ( []))
7975
8232
  );
7976
8233
  const resolvedIntegrationProviderFallback = Object.fromEntries(
7977
8234
  Object.entries(config.integrations).flatMap(([name, integration]) => {
7978
- const configuredProviders = _optionalChain([integration, 'optionalAccess', _190 => _190.providers]);
8235
+ const configuredProviders = _optionalChain([integration, 'optionalAccess', _180 => _180.providers]);
7979
8236
  const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
7980
- if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _191 => _191.component]) === "function")) {
8237
+ if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _181 => _181.component]) === "function")) {
7981
8238
  throw new Error(
7982
8239
  `Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
7983
8240
  );
@@ -7988,22 +8245,22 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
7988
8245
  const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
7989
8246
  (provider) => provider.supportsIsolatedHydration !== true
7990
8247
  );
7991
- const isolatedHydrationMode = _chunk46UV2E7Icjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
7992
- _optionalChain([config, 'access', _192 => _192.experimental, 'optionalAccess', _193 => _193.isolatedClientHydration]),
8248
+ const isolatedHydrationMode = _chunkEFI6QWBQcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
8249
+ _optionalChain([config, 'access', _182 => _182.experimental, 'optionalAccess', _183 => _183.isolatedClientHydration]),
7993
8250
  {
7994
- serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _194 => _194.experimental, 'optionalAccess', _195 => _195.serverComponents])) === "rsc",
8251
+ serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _184 => _184.experimental, 'optionalAccess', _185 => _185.serverComponents])) === "rsc",
7995
8252
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
7996
8253
  }
7997
8254
  );
7998
- const hydrationPlanOptions = _chunk46UV2E7Icjs.getFarmClientHydrationPlanOptions.call(void 0,
8255
+ const hydrationPlanOptions = _chunkEFI6QWBQcjs.getFarmClientHydrationPlanOptions.call(void 0,
7999
8256
  config.renderer,
8000
8257
  Boolean(unsupportedIntegrationProvider)
8001
8258
  );
8002
8259
  const pageHydrationPlanOptions = {
8003
8260
  ...hydrationPlanOptions,
8004
- serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _196 => _196.experimental, 'optionalAccess', _197 => _197.serverComponents])) === "islands"
8261
+ serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _186 => _186.experimental, 'optionalAccess', _187 => _187.serverComponents])) === "islands"
8005
8262
  };
8006
- const { layoutHydrationPlans, pageHydrationPlans } = _chunk46UV2E7Icjs.withFarmSourceSnapshot.call(void 0, () => {
8263
+ const { layoutHydrationPlans, pageHydrationPlans } = _chunkEFI6QWBQcjs.withFarmSourceSnapshot.call(void 0, () => {
8007
8264
  const layoutHydrationPlans2 = layoutRoutes.map((layout) => ({
8008
8265
  ...layout,
8009
8266
  hydration: getCachedClientModuleHydrationPlan(
@@ -8014,7 +8271,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8014
8271
  { ...hydrationPlanOptions, serverTreeLayouts: pageHydrationPlanOptions.serverOwners }
8015
8272
  )
8016
8273
  }));
8017
- const markdownPagePlan = _chunk46UV2E7Icjs.createMarkdownPageHydrationPlanner.call(void 0,
8274
+ const markdownPagePlan = _chunkEFI6QWBQcjs.createMarkdownPageHydrationPlanner.call(void 0,
8018
8275
  _chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
8019
8276
  config.root,
8020
8277
  isolatedHydrationMode,
@@ -8034,7 +8291,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8034
8291
  );
8035
8292
  return { layoutHydrationPlans: layoutHydrationPlans2, pageHydrationPlans: pageHydrationPlans2 };
8036
8293
  });
8037
- _chunk46UV2E7Icjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
8294
+ _chunkEFI6QWBQcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
8038
8295
  layoutHydrationPlans.map((layout) => ({
8039
8296
  pattern: layout.pattern,
8040
8297
  depth: layout.pattern.split("/").filter(Boolean).length,
@@ -8043,10 +8300,10 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8043
8300
  pageRoutes.map((route) => ({
8044
8301
  // Compared by directory so a grouped layout applies only inside its group.
8045
8302
  pattern: _nullishCoalesce(route.directory, () => ( route.pattern)),
8046
- depth: _chunkOFVCWV2Dcjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
8303
+ depth: _chunkNEKO3HM2cjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
8047
8304
  metadata: pageHydrationPlans.get(route.modulePath)
8048
8305
  })),
8049
- _chunkOFVCWV2Dcjs.routeBoundaryCoversDirectory,
8306
+ _chunkNEKO3HM2cjs.routeBoundaryCoversDirectory,
8050
8307
  { serverOwners: pageHydrationPlanOptions.serverOwners }
8051
8308
  );
8052
8309
  const providerServerImports = [
@@ -8064,7 +8321,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8064
8321
  apiRegistrations.push(`
8065
8322
  {
8066
8323
  path: ${JSON.stringify(route.path)},
8067
- methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _198 => _198.pluginMethods, 'optionalAccess', _199 => _199.includes, 'call', _200 => _200(method)])))},
8324
+ methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _188 => _188.pluginMethods, 'optionalAccess', _189 => _189.includes, 'call', _190 => _190(method)])))},
8068
8325
  endpoints: ${varName},
8069
8326
  }`);
8070
8327
  });
@@ -8078,8 +8335,8 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8078
8335
  orderedPageRoutes.forEach((route, index) => {
8079
8336
  const varName = `pageRoute${index}`;
8080
8337
  if (_chunk26WP75W5cjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
8081
- const renderingDirective2 = _chunkOUDNUFVRcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
8082
- const markdownServerTree = pageHydrationPlanOptions.serverOwners && _chunk46UV2E7Icjs.usesFarmServerTree.call(void 0, pageHydrationPlans.get(route.modulePath));
8338
+ const renderingDirective2 = _chunkHRH7OKBQcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
8339
+ const markdownServerTree = pageHydrationPlanOptions.serverOwners && _chunkEFI6QWBQcjs.usesFarmServerTree.call(void 0, pageHydrationPlans.get(route.modulePath));
8083
8340
  pageRegistrations.push(`
8084
8341
  {
8085
8342
  pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
@@ -8087,14 +8344,14 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8087
8344
  rendering: ${JSON.stringify(renderingDirective2)},` : ""}${markdownServerTree ? "\n serverTree: true," : ""}
8088
8345
  module: createFarmMarkdownRouteModule({
8089
8346
  source: ${JSON.stringify(_nullishCoalesce(route.source, () => ( "")))},
8090
- filePath: ${JSON.stringify(_chunkCL7BUGVBcjs.toBakedMarkdownSourcePath.call(void 0, config.root, route.modulePath))},
8347
+ filePath: ${JSON.stringify(_chunkJHRJ5V2Fcjs.toBakedMarkdownSourcePath.call(void 0, config.root, route.modulePath))},
8091
8348
  components: farmMdxComponents,
8092
- config: farmMdxConfig,${_chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, config.renderer) ? "" : "\n renderer: React,"}
8349
+ config: farmMdxConfig,${_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? "" : "\n renderer: React,"}
8093
8350
  }),
8094
8351
  markdownSource: {
8095
8352
  source: ${JSON.stringify(_nullishCoalesce(route.source, () => ( "")))},
8096
8353
  filePath: ${JSON.stringify(
8097
- _chunkCL7BUGVBcjs.toBakedMarkdownSourcePath.call(void 0, config.root, _nullishCoalesce(route.markdownSourcePath, () => ( route.modulePath)))
8354
+ _chunkJHRJ5V2Fcjs.toBakedMarkdownSourcePath.call(void 0, config.root, _nullishCoalesce(route.markdownSourcePath, () => ( route.modulePath)))
8098
8355
  )},
8099
8356
  },
8100
8357
  }`);
@@ -8104,7 +8361,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8104
8361
  `import * as ${varName} from ${toVirtualEntryImportSpecifier(route.modulePath)};`
8105
8362
  );
8106
8363
  const clientMetadata = pageHydrationPlans.get(route.modulePath);
8107
- const renderingDirective = _chunkOUDNUFVRcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
8364
+ const renderingDirective = _chunkHRH7OKBQcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
8108
8365
  pageRegistrations.push(`
8109
8366
  {
8110
8367
  pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
@@ -8112,8 +8369,8 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8112
8369
  module: ${varName},
8113
8370
  shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
8114
8371
  clientModule: ${JSON.stringify(_chunk7U4XF76Rcjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
8115
- islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunk46UV2E7Icjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${(() => {
8116
- const rootStrategy = _chunkCL7BUGVBcjs.resolveFarmRouteRootStrategy.call(void 0,
8372
+ islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkEFI6QWBQcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${(() => {
8373
+ const rootStrategy = _chunkJHRJ5V2Fcjs.resolveFarmRouteRootStrategy.call(void 0,
8117
8374
  route,
8118
8375
  clientMetadata,
8119
8376
  layoutHydrationPlans.map((layout) => ({ ...layout, ...layout.hydration })),
@@ -8126,13 +8383,13 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8126
8383
  rendering: ${JSON.stringify(renderingDirective)},` : ""}
8127
8384
  ${route.source !== void 0 ? `markdownSource: {
8128
8385
  source: ${JSON.stringify(route.source)},
8129
- filePath: ${JSON.stringify(_chunkCL7BUGVBcjs.toBakedMarkdownSourcePath.call(void 0, config.root, route.markdownSourcePath))},
8386
+ filePath: ${JSON.stringify(_chunkJHRJ5V2Fcjs.toBakedMarkdownSourcePath.call(void 0, config.root, route.markdownSourcePath))},
8130
8387
  },` : ""}
8131
8388
  }`);
8132
8389
  });
8133
8390
  const layoutImports = [];
8134
8391
  const layoutRegistrations = [];
8135
- const treeLayoutPatterns = farmIslandsMode ? _chunkOFVCWV2Dcjs.getFarmServerTreeLayoutPatterns.call(void 0,
8392
+ const treeLayoutPatterns = farmIslandsMode ? _chunkNEKO3HM2cjs.getFarmServerTreeLayoutPatterns.call(void 0,
8136
8393
  layoutHydrationPlans.map((layout) => ({
8137
8394
  pattern: layout.pattern,
8138
8395
  shouldHydrate: layout.hydration.shouldHydrate,
@@ -8150,7 +8407,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8150
8407
  pattern: ${JSON.stringify(layout.pattern)},
8151
8408
  module: ${varName},
8152
8409
  shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},
8153
- islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${treeLayoutPatterns.has(layout.pattern) ? "\n serverTree: true," : ""}${farmIslandsMode && _chunkCL7BUGVBcjs.canFarmSkipKeptLayoutRender.call(void 0, layout.modulePath, config.root) ? "\n skipKeptRender: true," : ""}${// A layout whose client components hydrate as islands of their own (islands mode,
8410
+ islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${treeLayoutPatterns.has(layout.pattern) ? "\n serverTree: true," : ""}${farmIslandsMode && _chunkJHRJ5V2Fcjs.canFarmSkipKeptLayoutRender.call(void 0, layout.modulePath, config.root) ? "\n skipKeptRender: true," : ""}${// A layout whose client components hydrate as islands of their own (islands mode,
8154
8411
  // isolatedClientHydration, or an async layout): it wraps a docs page as an app page.
8155
8412
  clientMetadata.hasIsolatedClientBoundaries ? "\n islands: true," : ""}
8156
8413
  }`);
@@ -8178,7 +8435,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8178
8435
  containerId: ${JSON.stringify(slot.containerId)},
8179
8436
  interception: ${JSON.stringify(slot.interception)},
8180
8437
  fallback: ${JSON.stringify(slot.fallback)},
8181
- hydrates: ${!farmIslandsMode || _chunk46UV2E7Icjs.getClientModuleMetadata.call(void 0, slot.modulePath, config.root).isClientComponent},
8438
+ hydrates: ${!farmIslandsMode || _chunkEFI6QWBQcjs.getClientModuleMetadata.call(void 0, slot.modulePath, config.root).isClientComponent},
8182
8439
  module: ${varName},
8183
8440
  }`);
8184
8441
  });
@@ -8189,12 +8446,12 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8189
8446
  errorImports.push(
8190
8447
  `import * as ${varName} from ${toVirtualEntryImportSpecifier(errorRoute.modulePath)};`
8191
8448
  );
8192
- const groupScope = _chunkOFVCWV2Dcjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
8449
+ const groupScope = _chunkNEKO3HM2cjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
8193
8450
  errorRegistrations.push(`
8194
8451
  {
8195
- pattern: ${JSON.stringify(_chunkOFVCWV2Dcjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
8452
+ pattern: ${JSON.stringify(_chunkNEKO3HM2cjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
8196
8453
  groupScope: ${JSON.stringify(groupScope)},
8197
- directoryDepth: ${_chunkOFVCWV2Dcjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
8454
+ directoryDepth: ${_chunkNEKO3HM2cjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
8198
8455
  module: ${varName},
8199
8456
  }`);
8200
8457
  });
@@ -8206,12 +8463,12 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8206
8463
  loadingImports.push(
8207
8464
  `import * as ${varName} from ${toVirtualEntryImportSpecifier(loadingRoute.modulePath)};`
8208
8465
  );
8209
- const groupScope = _chunkOFVCWV2Dcjs.getRouteGroupScope.call(void 0, loadingRoute.pattern);
8466
+ const groupScope = _chunkNEKO3HM2cjs.getRouteGroupScope.call(void 0, loadingRoute.pattern);
8210
8467
  loadingRegistrations.push(`
8211
8468
  {
8212
- pattern: ${JSON.stringify(_chunkOFVCWV2Dcjs.stripRouteGroups.call(void 0, loadingRoute.pattern))},${groupScope ? `
8469
+ pattern: ${JSON.stringify(_chunkNEKO3HM2cjs.stripRouteGroups.call(void 0, loadingRoute.pattern))},${groupScope ? `
8213
8470
  groupScope: ${JSON.stringify(groupScope)},
8214
- directoryDepth: ${_chunkOFVCWV2Dcjs.getRouteDirectoryDepth.call(void 0, loadingRoute.pattern)},` : ""}
8471
+ directoryDepth: ${_chunkNEKO3HM2cjs.getRouteDirectoryDepth.call(void 0, loadingRoute.pattern)},` : ""}
8215
8472
  module: ${varName},
8216
8473
  }`);
8217
8474
  });
@@ -8224,7 +8481,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8224
8481
  metadataImageImports.push(
8225
8482
  `import * as ${varName} from ${toVirtualEntryImportSpecifier(image.modulePath)};`
8226
8483
  );
8227
- const component = !_chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, config.renderer) && _chunkCL7BUGVBcjs.isRendererCompiledComponent.call(void 0, image.modulePath, _nullishCoalesce(_optionalChain([config, 'access', _201 => _201.renderer, 'optionalAccess', _202 => _202.componentExtensions]), () => ( [])));
8484
+ const component = !_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) && _chunkJHRJ5V2Fcjs.isRendererCompiledComponent.call(void 0, image.modulePath, _nullishCoalesce(_optionalChain([config, 'access', _191 => _191.renderer, 'optionalAccess', _192 => _192.componentExtensions]), () => ( [])));
8228
8485
  metadataImageRegistrations.push(`
8229
8486
  {
8230
8487
  pattern: ${JSON.stringify(image.pattern)},
@@ -8285,6 +8542,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8285
8542
  applyFarmBasePath,
8286
8543
  applyFarmCspNonceToResponse,
8287
8544
  createFarmCspNonce,
8545
+ createPreHydrationClickQueueScript,
8288
8546
  stampFarmCspNonce,
8289
8547
  isDeferred,
8290
8548
  prepareDeferredData,
@@ -8299,7 +8557,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8299
8557
  createDefaultErrorMarkup,
8300
8558
  createFarmInstrumentationLifecycle,
8301
8559
  createFarmLayoutSelector,
8302
- createFarmLayoutBoundary,${_optionalChain([config, 'access', _203 => _203.docs, 'optionalAccess', _204 => _204.enabled]) ? "\n createFarmDocsLayoutTree,\n farmDocsLayoutsWrapPage,\n placeFarmDocsLayoutRoot," : ""}
8560
+ createFarmLayoutBoundary,${_optionalChain([config, 'access', _193 => _193.docs, 'optionalAccess', _194 => _194.enabled]) ? "\n createFarmDocsLayoutTree,\n farmDocsLayoutsWrapPage,\n placeFarmDocsLayoutRoot," : ""}
8303
8561
  isInFarmRouteGroupScope,
8304
8562
  routeBoundaryCoversDirectory,
8305
8563
  createFarmCacheKey,
@@ -8344,6 +8602,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8344
8602
  isFarmNotFoundError,
8345
8603
  isFarmRedirectError,
8346
8604
  localizeFarmHref,
8605
+ hasFarmHtmlPreloadToken,
8347
8606
  manageFarmDocumentPreloads,
8348
8607
  mergeRouteRenderingDirectiveConfig,
8349
8608
  resolveRouteSharedCacheControl,
@@ -8382,7 +8641,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8382
8641
  createFarmDeploymentMismatchResponse,
8383
8642
  FARM_DEPLOYMENT_ID_HEADER,
8384
8643
  getFarmDeploymentMismatch,
8385
- withoutFarmDeploymentCookie,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${config.trailingSlash && (_optionalChain([config, 'access', _205 => _205.md, 'optionalAccess', _206 => _206.enabled]) || hasMarkdownPages) ? "\n toFarmTrailingSlashPageRequest," : ""}${hasInfraAnalyticsRuntime ? "\n resolveFarmDocsEngineRouteLabel,\n resolveFarmDocsRouteLabel,\n resolveFarmMarkdownRouteLabel,\n resolveFarmMCPRouteLabel,\n setFarmRouteLabel," : ""}${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}${searchPreserveRoutesSource ? "\n _setFarmSearchPreserveRoutes," : ""}
8644
+ withoutFarmDeploymentCookie,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${config.trailingSlash && (_optionalChain([config, 'access', _195 => _195.md, 'optionalAccess', _196 => _196.enabled]) || hasMarkdownPages) ? "\n toFarmTrailingSlashPageRequest," : ""}${hasInfraAnalyticsRuntime ? "\n resolveFarmDocsEngineRouteLabel,\n resolveFarmDocsRouteLabel,\n resolveFarmMarkdownRouteLabel,\n resolveFarmMCPRouteLabel,\n setFarmRouteLabel," : ""}${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}${searchPreserveRoutesSource ? "\n _setFarmSearchPreserveRoutes," : ""}
8386
8645
  } from "@farm.js/core/internal/production-runtime";${farmMobileClient ? `
8387
8646
  import { _applyFarmMobileShellClient } from "@farm.js/core/internal/production-runtime";
8388
8647
  // The mobile client documents load when a mobile shell asks for them (RFC 0004, 7.2), filled in
@@ -8454,25 +8713,25 @@ function farmFormStateScript() { return ""; }`}`;
8454
8713
  const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
8455
8714
  const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
8456
8715
  const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
8457
- const docsHandlerImport = _optionalChain([config, 'access', _207 => _207.docs, 'optionalAccess', _208 => _208.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
8716
+ const docsHandlerImport = _optionalChain([config, 'access', _197 => _197.docs, 'optionalAccess', _198 => _198.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
8458
8717
  const isFarmDocsAPIRequest = (requestOrPathname) => {
8459
8718
  const pathname = typeof requestOrPathname === "string"
8460
8719
  ? requestOrPathname
8461
8720
  : new URL(requestOrPathname.url).pathname;
8462
- const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _209 => _209.apiPath]) || "/api/docs")};
8721
+ const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _199 => _199.apiPath]) || "/api/docs")};
8463
8722
  return pathname === apiPath || pathname.startsWith(apiPath + "/");
8464
8723
  };` : adapterOwnsDocsRuntime ? `import { ${docsConfigModulePath ? "getFarmDocsConfigModuleRoot, " : ""}isFarmDocsAPIRequest } from "@farm.js/core/docs";
8465
- import { ${_optionalChain([config, 'access', _210 => _210.docs, 'access', _211 => _211.roots, 'optionalAccess', _212 => _212.length]) ? "createFarmDocsMultiRuntimeHandler as createFarmDocsAdapterMultiRuntimeHandler" : "createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler"} } from ${JSON.stringify(config.docs.adapter.server)};
8466
- import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
8724
+ import { ${_optionalChain([config, 'access', _200 => _200.docs, 'access', _201 => _201.roots, 'optionalAccess', _202 => _202.length]) ? "createFarmDocsMultiRuntimeHandler as createFarmDocsAdapterMultiRuntimeHandler" : "createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler"} } from ${JSON.stringify(config.docs.adapter.server)};
8725
+ import * as FarmDocsAdapterUI from ${JSON.stringify(_chunkL2GUEYHRcjs.getFarmDocsAdapterUIModule.call(void 0, config.docs.adapter))};${docsConfigModulePath ? `
8467
8726
  import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
8468
- const docsFontImport = _optionalChain([config, 'access', _213 => _213.docs, 'optionalAccess', _214 => _214.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
8469
- const docsRuntimeImport = _optionalChain([config, 'access', _215 => _215.docs, 'optionalAccess', _216 => _216.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
8727
+ const docsFontImport = _optionalChain([config, 'access', _203 => _203.docs, 'optionalAccess', _204 => _204.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
8728
+ const docsRuntimeImport = _optionalChain([config, 'access', _205 => _205.docs, 'optionalAccess', _206 => _206.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
8470
8729
  import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
8471
8730
  import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
8472
- const markdownHandlerImport = _optionalChain([config, 'access', _217 => _217.md, 'optionalAccess', _218 => _218.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
8731
+ const markdownHandlerImport = _optionalChain([config, 'access', _207 => _207.md, 'optionalAccess', _208 => _208.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
8473
8732
  const appMarkdownImport = hasMarkdownPages ? `import { FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS, createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
8474
8733
  const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
8475
- const mdxComponentsPath = typeof _optionalChain([config, 'access', _219 => _219.mdx, 'optionalAccess', _220 => _220.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
8734
+ const mdxComponentsPath = typeof _optionalChain([config, 'access', _209 => _209.mdx, 'optionalAccess', _210 => _210.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
8476
8735
  const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
8477
8736
  const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
8478
8737
  const layerConfigImports = layerConfigPaths.map(
@@ -8492,14 +8751,14 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
8492
8751
  const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
8493
8752
  const nativeMCP = _chunkVM57CK74cjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
8494
8753
  const mobileSession = (config.plugins || []).some(
8495
- (plugin) => _optionalChain([plugin, 'optionalAccess', _221 => _221.name]) === _chunkMHKPXX3Jcjs.FARM_MOBILE_SESSION_PLUGIN
8754
+ (plugin) => _optionalChain([plugin, 'optionalAccess', _211 => _211.name]) === _chunkMHKPXX3Jcjs.FARM_MOBILE_SESSION_PLUGIN
8496
8755
  );
8497
8756
  const nativeServerFns = (config.plugins || []).some(
8498
- (plugin) => _optionalChain([plugin, 'optionalAccess', _222 => _222.name]) === _chunk4EBC7EMWcjs.FARM_NATIVE_SERVER_FN_PLUGIN
8499
- ) ? _chunkXOGCNKB7cjs.collectFarmNativeServerFns.call(void 0, {
8757
+ (plugin) => _optionalChain([plugin, 'optionalAccess', _212 => _212.name]) === _chunk4EBC7EMWcjs.FARM_NATIVE_SERVER_FN_PLUGIN
8758
+ ) ? _chunkA5BHJHDFcjs.collectFarmNativeServerFns.call(void 0, {
8500
8759
  root: config.root,
8501
8760
  srcDir: config.srcDir,
8502
- entries: _chunkXOGCNKB7cjs.findFarmNativeScreenFiles.call(void 0, _chunk52Q4OB4Acjs.getFarmAppDirectories.call(void 0, config))
8761
+ entries: _chunkA5BHJHDFcjs.findFarmNativeScreenFiles.call(void 0, _chunk52Q4OB4Acjs.getFarmAppDirectories.call(void 0, config))
8503
8762
  }) : void 0;
8504
8763
  const integrationImports = `
8505
8764
  ${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
@@ -8514,7 +8773,7 @@ ${nativeServerFns ? `const __farmNativeServerFnRegistry = Object.assign(Object.c
8514
8773
  ${nativeServerFns.flatMap((module, index) => module.exports.map((entry) => ` ${JSON.stringify(entry.id)}: __farmNativeServerFns${index}[${JSON.stringify(entry.name)}],`)).join("\n")}
8515
8774
  });` : ""}
8516
8775
  `;
8517
- const imageRuntime = _chunkCL7BUGVBcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
8776
+ const imageRuntime = _chunkJHRJ5V2Fcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
8518
8777
  const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
8519
8778
  const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
8520
8779
  const apiHandlerCode = apiRoutes.length > 0 ? `
@@ -8696,7 +8955,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
8696
8955
 
8697
8956
  function renderFarmDefault404Page() {
8698
8957
  return React.createElement(React.Fragment, null,
8699
- React.createElement("style", null, ${JSON.stringify(_chunkCL7BUGVBcjs.DEFAULT_NOT_FOUND_STYLES)}),
8958
+ React.createElement("style", null, ${JSON.stringify(_chunkJHRJ5V2Fcjs.DEFAULT_NOT_FOUND_STYLES)}),
8700
8959
  React.createElement("main", {
8701
8960
  className: "farm-default-not-found",
8702
8961
  "aria-labelledby": "farm-default-not-found-title",
@@ -8788,6 +9047,12 @@ function wrapWithFarmIntegrationProviders(element) {
8788
9047
  }
8789
9048
  return wrapped;
8790
9049
  }
9050
+ // The browser hydrates a page island or a route slot as its own root, inside the integration
9051
+ // providers, so the server renders them inside it too. React lines an island up with its tree
9052
+ // position instead, and its providers render no markup.
9053
+ function wrapFarmIslandIntegrationProviders(element) {
9054
+ return ${_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? "element" : "wrapWithFarmIntegrationProviders(element)"};
9055
+ }
8791
9056
  const serverRuntimeIntegrations = Object.fromEntries(
8792
9057
  Object.entries(configuredIntegrations).filter(([, integration]) =>
8793
9058
  integration && typeof integration === "object" && integration.serverRuntime !== false
@@ -8797,7 +9062,14 @@ const integrationRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs, {
8797
9062
  integrations: configuredIntegrations,
8798
9063
  ${JSON.stringify(_chunkQKW6DLDTcjs.FARM_INTEGRATION_API_BASE_PATH_KEY)}: ${JSON.stringify(_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))},
8799
9064
  });
8800
- const farmInfraAnalytics = ${hasInfraAnalyticsRuntime ? hasPluginRuntime ? "createFarmInfraAnalyticsPlugin()" : "createFarmInfraAnalyticsRecorder()" : "null"};
9065
+ const farmInfraAnalytics = ${hasInfraAnalyticsRuntime ? `${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"}(${reportsWebMCPCalls ? "{ webmcp: { route: farmWebMCPCallRoute } }" : ""})` : "null"};${reportsWebMCPCalls ? `
9066
+ // A WebMCP tool call a page reports goes under that page's route, matched and labeled as a
9067
+ // request for the page is.
9068
+ function farmWebMCPCallRoute(pathname) {
9069
+ return labelFarmRequestOptions(
9070
+ getFarmPluginRequestOptions(new Request(new URL(pathname, "http://farm.invalid"))),
9071
+ ).route;
9072
+ }` : ""}
8801
9073
  const configuredPlugins = [
8802
9074
  ${hasCompressionRuntime && hasPluginRuntime ? "createCompressionPlugin()," : ""}
8803
9075
  ${hasRuntimeIntegrationConfig ? "...resolveIntegrationPlugins(serverRuntimeIntegrations)," : ""}
@@ -8839,24 +9111,24 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
8839
9111
  validateRemoteUrl: createNodeImageUrlValidator(${JSON.stringify(config.images)}),
8840
9112
  onError(error) { console.error("[Farm Image]", error); },
8841
9113
  })`};
8842
- const farmMarkdownConfig = ${JSON.stringify(config.md)};${_optionalChain([config, 'access', _223 => _223.md, 'optionalAccess', _224 => _224.enabled]) || hasMarkdownPages ? config.trailingSlash ? `
9114
+ const farmMarkdownConfig = ${JSON.stringify(config.md)};${_optionalChain([config, 'access', _213 => _213.md, 'optionalAccess', _214 => _214.enabled]) || hasMarkdownPages ? config.trailingSlash ? `
8843
9115
  // A Markdown mirror, and a page.md source's page check, read the page at the URL it answers at
8844
9116
  // ('/about/'), so the trailing-slash 308 never answers in its place.
8845
9117
  const toFarmMarkdownPageRequest = (request) => toFarmTrailingSlashPageRequest(request, true);` : `
8846
9118
  const toFarmMarkdownPageRequest = (request) => request;` : ""}
8847
- const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _225 => _225.agent, 'optionalAccess', _226 => _226.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
8848
- ${_optionalChain([config, 'access', _227 => _227.agent, 'optionalAccess', _228 => _228.llmsTxt, 'optionalAccess', _229 => _229.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
9119
+ const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _215 => _215.agent, 'optionalAccess', _216 => _216.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
9120
+ ${_optionalChain([config, 'access', _217 => _217.agent, 'optionalAccess', _218 => _218.llmsTxt, 'optionalAccess', _219 => _219.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
8849
9121
  const farmMdxConfig = ${JSON.stringify({
8850
9122
  ...config.mdx,
8851
- components: typeof _optionalChain([config, 'access', _230 => _230.mdx, 'optionalAccess', _231 => _231.components]) === "string" ? config.mdx.components : void 0
9123
+ components: typeof _optionalChain([config, 'access', _220 => _220.mdx, 'optionalAccess', _221 => _221.components]) === "string" ? config.mdx.components : void 0
8852
9124
  })};
8853
9125
  const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
8854
- ${_optionalChain([config, 'access', _232 => _232.agent, 'optionalAccess', _233 => _233.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
9126
+ ${_optionalChain([config, 'access', _222 => _222.agent, 'optionalAccess', _223 => _223.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
8855
9127
  // environment this was built in, since Netlify exposes its deploy context only
8856
9128
  // to the build.
8857
9129
  const farmNoindexPreview = resolveFarmPreviewDeployment(
8858
9130
  globalThis.process?.env,
8859
- ${JSON.stringify(_chunkADQ2LATRcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env))},
9131
+ ${JSON.stringify(_chunkIABI62FHcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env))},
8860
9132
  );` : ""}
8861
9133
  const farmMdxComponents = ${mdxComponentsPath ? `(FarmMdxComponentsModule.components || Reflect.get(FarmMdxComponentsModule, "default") || {})` : `(configuredFarmMdxComponents && typeof configuredFarmMdxComponents === "object" ? configuredFarmMdxComponents : {})`};
8862
9134
  const farmObservabilityConfig = farmUserConfig?.observability ?? ${JSON.stringify(
@@ -8902,7 +9174,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
8902
9174
  });
8903
9175
  const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
8904
9176
  ${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
8905
- const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _234 => _234.docs, 'optionalAccess', _235 => _235.enabled]) && !hasPrecompiledDocs ? `(() => {
9177
+ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _224 => _224.docs, 'optionalAccess', _225 => _225.enabled]) && !hasPrecompiledDocs ? `(() => {
8906
9178
  try {
8907
9179
  const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
8908
9180
  const candidates = [
@@ -8914,7 +9186,7 @@ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _234 => _2
8914
9186
  } catch {
8915
9187
  return null;
8916
9188
  }
8917
- })()` : "null"};${_optionalChain([config, 'access', _236 => _236.docs, 'optionalAccess', _237 => _237.enabled]) && !hasPrecompiledDocs && _optionalChain([config, 'access', _238 => _238.docs, 'access', _239 => _239.roots, 'optionalAccess', _240 => _240.length]) ? `
9189
+ })()` : "null"};${_optionalChain([config, 'access', _226 => _226.docs, 'optionalAccess', _227 => _227.enabled]) && !hasPrecompiledDocs && _optionalChain([config, 'access', _228 => _228.docs, 'access', _229 => _229.roots, 'optionalAccess', _230 => _230.length]) ? `
8918
9190
  const farmDocsBundledRootsDir = (() => {
8919
9191
  try {
8920
9192
  const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
@@ -8966,7 +9238,9 @@ const farmDocsModulePreloadPaths = farmDocsModulePreloads
8966
9238
  ),
8967
9239
  }
8968
9240
  : undefined;
8969
- const farmDocsHandler = ${_optionalChain([config, 'access', _241 => _241.docs, 'optionalAccess', _242 => _242.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {
9241
+ ${adapterOwnsDocsRuntime && !hasPrecompiledDocs ? `// The renderer contract's server exports, for a docs UI that builds its pages with them.
9242
+ const farmDocsAppRenderer = ${_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? '{ name: "react", createElement: React.createElement, Fragment: React.Fragment, renderToString: ReactDOMServer.renderToString }' : "__farmRendererServer"};
9243
+ ` : ""}const farmDocsHandler = ${_optionalChain([config, 'access', _231 => _231.docs, 'optionalAccess', _232 => _232.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {
8970
9244
  rootDir: farmDocsRuntimeRoot,
8971
9245
  // A production build's content cannot change, so the adapter reads its
8972
9246
  // navigation once instead of scanning the content directory per request.
@@ -8982,12 +9256,15 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _241 => _241.docs, '
8982
9256
  resolveFarmLayoutFonts(
8983
9257
  getApplicableLayouts(getFarmRoutePathname(pathname)).map((layout) => layout.module),
8984
9258
  ),
8985
- loadReactModule: async () => FarmDocsAdapterReact,
9259
+ loadUIModule: async () => FarmDocsAdapterUI,
9260
+ // The app's renderer, for a UI that builds its pages with it.
9261
+ loadRenderer: async () => farmDocsAppRenderer,${_chunkL2GUEYHRcjs.getFarmDocsAdapterRenderer.call(void 0, config.docs.adapter) === "react" ? `
9262
+ loadReactModule: async () => FarmDocsAdapterUI,` : ""}
8986
9263
  // Lists the docs MCP endpoint in /.well-known/ai-catalog.json for the server's lifetime.
8987
9264
  registerMCPServer: registerFarmMCPServer,
8988
9265
  // A page built with this keeps its HTML string, so the preload budget and the response
8989
9266
  // writer use it instead of reading and re-encoding the body. Older adapters ignore it.
8990
- createHtmlResponse: farmOwnedHtmlResponse,${_chunkE3HBD2K3cjs.farmDocsAdapterServesGuardedPages.call(void 0, config.docs) ? `
9267
+ createHtmlResponse: farmOwnedHtmlResponse,${_chunkLN6FAYNBcjs.farmDocsAdapterServesGuardedPages.call(void 0, config.docs) ? `
8991
9268
  // The adapter keeps pages a path guard covers off search, llms.txt, the sitemap and MCP. It
8992
9269
  // asks about any path its own content lists, so the guards decide here, not a page list.
8993
9270
  isPathGuarded: (pathname) =>
@@ -9013,7 +9290,7 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _241 => _241.docs, '
9013
9290
  isPathGuarded: isFarmDocsPathGuarded,
9014
9291
  basePath: ${JSON.stringify(config.basePath)},
9015
9292
  })` : "null"};
9016
- const farmDocsAPIHandler = ${_optionalChain([config, 'access', _243 => _243.docs, 'optionalAccess', _244 => _244.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded, basePath: ${JSON.stringify(config.basePath)} })` : "null"};
9293
+ const farmDocsAPIHandler = ${_optionalChain([config, 'access', _233 => _233.docs, 'optionalAccess', _234 => _234.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded, basePath: ${JSON.stringify(config.basePath)} })` : "null"};
9017
9294
 
9018
9295
  // API routes bundled at build time
9019
9296
  const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
@@ -9048,12 +9325,12 @@ const farmDeploymentCookiePath = ${JSON.stringify(config.basePath || "/")};
9048
9325
  // runtime request.
9049
9326
  const farmRuntimeErrorSlot = Symbol("farm.runtime.error.slot");
9050
9327
  const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
9051
- ${_optionalChain([config, 'access', _245 => _245.agent, 'optionalAccess', _246 => _246.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkFYZD7DUScjs.resolveFarmApiCatalogInput.call(void 0, config))};
9052
- ` : ""}${_optionalChain([config, 'access', _247 => _247.agent, 'optionalAccess', _248 => _248.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
9053
- _chunkFYZD7DUScjs.resolveFarmAppManifestInput.call(void 0, config, {
9328
+ ${_optionalChain([config, 'access', _235 => _235.agent, 'optionalAccess', _236 => _236.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkWCSBYQOTcjs.resolveFarmApiCatalogInput.call(void 0, config))};
9329
+ ` : ""}${_optionalChain([config, 'access', _237 => _237.agent, 'optionalAccess', _238 => _238.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
9330
+ _chunkWCSBYQOTcjs.resolveFarmAppManifestInput.call(void 0, config, {
9054
9331
  build: config.deploymentId,
9055
- packages: _chunkCL7BUGVBcjs.resolveFarmAppPackages.call(void 0, config.root),
9056
- webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkCL7BUGVBcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
9332
+ packages: _chunkJHRJ5V2Fcjs.resolveFarmAppPackages.call(void 0, config.root),
9333
+ webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkJHRJ5V2Fcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
9057
9334
  })
9058
9335
  )};
9059
9336
  ${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
@@ -9066,7 +9343,7 @@ farmAppManifestInput.guardCoversPath = (path) =>
9066
9343
  path,
9067
9344
  farmLocalAPIBasePath,
9068
9345
  );
9069
- ${_optionalChain([config, 'access', _249 => _249.docs, 'optionalAccess', _250 => _250.enabled]) ? `// A docs runtime's MCP server lists its tools when asked over MCP, in process. A build
9346
+ ${_optionalChain([config, 'access', _239 => _239.docs, 'optionalAccess', _240 => _240.enabled]) ? `// A docs runtime's MCP server lists its tools when asked over MCP, in process. A build
9070
9347
  // can't change them, so they are read once.
9071
9348
  if (farmDocsHandler) {
9072
9349
  farmAppManifestInput.registeredMCP = (request) =>
@@ -9175,7 +9452,7 @@ function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, page
9175
9452
  'window[Symbol.for("farm.searchPreserveRoutes")]=' + serializeFarmInlineValue(farmSearchPreserveRoutes) + ';'` : ""};
9176
9453
  // The client boots at the canonical path when the script below moves it there.
9177
9454
  const bootRoutes = statusDocument
9178
- ? typeof routePathname === "string" ? { path: routePathname, routes: [] } : undefined
9455
+ ? typeof routePathname === "string" ? getFarmClientStatusBootRoutes(routePathname) : undefined
9179
9456
  : getFarmClientBootRoutes(
9180
9457
  typeof canonicalPath === "string" && canonicalPath.startsWith("/")
9181
9458
  ? getFarmRoutePathname(canonicalPath.split(/[?#]/)[0])
@@ -9841,7 +10118,7 @@ function peelFarmDocumentPrefix(markup) {
9841
10118
  let inner = markup.replace(/^\\s+/, "");
9842
10119
  let hoisted = "";
9843
10120
  const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents;?\\s*["'][^>]*>/i;
9844
- const hoistable = /${_chunkOFVCWV2Dcjs.HOISTED_HEAD_ELEMENT.source}/i;
10121
+ const hoistable = /${_chunkNEKO3HM2cjs.HOISTED_HEAD_ELEMENT.source}/i;
9845
10122
  let match;
9846
10123
  while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
9847
10124
  if (!/^<div/i.test(match[0])) hoisted += match[0];
@@ -9870,7 +10147,7 @@ function opensFarmFullDocument(markup) {
9870
10147
  // them: its own head takes them. Matches the dev renderer's takeFarmHoistedHead.
9871
10148
  function takeFarmHoistedHead(markup) {
9872
10149
  if (opensFarmFullDocument(markup)) return { head: "", body: markup };
9873
- const hoistable = /${_chunkOFVCWV2Dcjs.HOISTED_HEAD_ELEMENT.source}/i;
10150
+ const hoistable = /${_chunkNEKO3HM2cjs.HOISTED_HEAD_ELEMENT.source}/i;
9874
10151
  let head = "";
9875
10152
  let body = markup;
9876
10153
  let match;
@@ -9979,7 +10256,7 @@ function createFarmErrorDocument(html, title, routePathname) {
9979
10256
  ' <meta name="viewport" content="width=device-width, initial-scale=1">\\n' +
9980
10257
  ' <link rel="icon" href="data:,">\\n' +
9981
10258
  ' <title>' + escapedTitle + '</title>\\n' +
9982
- ' <link rel="stylesheet" href="/__farm_client_css_href__">' + renderFarmClientModulePreloads(html) + '\\n' +
10259
+ ' ' + renderFarmClientStylesheet() + renderFarmClientModulePreloads(html) + '\\n' +
9983
10260
  renderFarmRendererHydrationScript() + '\\n' +
9984
10261
  '</head>\\n<body>\\n' +
9985
10262
  ' <div id="root">' + html + '</div>\\n' +
@@ -9990,7 +10267,7 @@ function createFarmErrorDocument(html, title, routePathname) {
9990
10267
 
9991
10268
  let fullHtml = ensureFarmDocumentRoot(ensureFarmDocumentHead(fullDocument));
9992
10269
  fullHtml = fullHtml
9993
- .replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n <link rel="stylesheet" href="/__farm_client_css_href__">' + renderFarmClientModulePreloads(fullDocument); })
10270
+ .replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n ' + renderFarmClientStylesheet() + renderFarmClientModulePreloads(fullDocument); })
9994
10271
  // Function replacements: dynamic markup may contain $-sequences ($&, $', $$)
9995
10272
  // that a string replacement would expand, corrupting the document.
9996
10273
  .replace(/<\\/head>/i, function() { return renderFarmRendererHydrationScript() + '\\n</head>'; })
@@ -10014,6 +10291,23 @@ function createFarmErrorDocument(html, title, routePathname) {
10014
10291
  : "<!DOCTYPE html>\\n" + fullHtml;
10015
10292
  }
10016
10293
 
10294
+ // The client stylesheet a document links, filled in from the client build once it has finished
10295
+ // (see buildNitroUniversal): null for an app without CSS, whose empty stylesheet would still hold
10296
+ // the first paint for a round trip. Parsed at runtime, so the bundler cannot fold the stand-in.
10297
+ const farmClientStylesheetHref = (() => {
10298
+ try {
10299
+ return JSON.parse("${FARM_CLIENT_STYLESHEET_PLACEHOLDER}");
10300
+ } catch {
10301
+ return "${FARM_CLIENT_CSS_HREF_PLACEHOLDER}";
10302
+ }
10303
+ })();
10304
+
10305
+ function renderFarmClientStylesheet() {
10306
+ return farmClientStylesheetHref
10307
+ ? '<link rel="stylesheet" href="' + farmClientStylesheetHref + '">'
10308
+ : "";
10309
+ }
10310
+
10017
10311
  // The client modules a page needs before it hydrates, filled in from the client
10018
10312
  // build once it has finished (see buildNitroUniversal).
10019
10313
  const farmClientModulePreloads = (() => {
@@ -10023,7 +10317,10 @@ const farmClientModulePreloads = (() => {
10023
10317
  return null;
10024
10318
  }
10025
10319
  })();
10026
- ${generateFarmClientBootRoutesServerSource(`"${FARM_CLIENT_ROUTE_TABLE_PLACEHOLDER}"`)}
10320
+ ${generateFarmClientBootRoutesServerSource(
10321
+ `"${FARM_CLIENT_ROUTE_TABLE_PLACEHOLDER}"`,
10322
+ farmIslandsMode ? layoutRoutes.map((layout) => getFarmClientLayoutMatch(layout.pattern)) : void 0
10323
+ )}
10027
10324
 
10028
10325
  const farmClientEntryPreloadTags = farmClientModulePreloads
10029
10326
  ? farmClientModulePreloads.entry.map(renderFarmClientModulePreload).join("")
@@ -10033,10 +10330,18 @@ const farmClientEntryPreloadTags = farmClientModulePreloads
10033
10330
  const farmClientRendererPreloadTags = farmClientModulePreloads
10034
10331
  ? (farmClientModulePreloads.renderer || []).map(renderFarmClientModulePreload).join("")
10035
10332
  : "";
10333
+ // Islands mode's entry imports the code that renders a page or layout root when one hydrates (RFC
10334
+ // 0013), so a document that has one lists that code.
10335
+ const farmClientRootPreloadTags = farmClientModulePreloads
10336
+ ? (farmClientModulePreloads.root || []).map(renderFarmClientModulePreload).join("")
10337
+ : "";
10036
10338
  // The client modules a document's markup loads: its islands' boundaries and the
10037
10339
  // client references of its server tree. An island with a deferred strategy loads its
10038
10340
  // module on its own trigger, so it is not preloaded.
10039
10341
  const FARM_CLIENT_MODULE_REFERENCE_PATTERN = /<f-island src="([^"]+)"([^>]*)>|"r":"(\\/[^"]+)"/g;
10342
+ // A server action reference in a document's markup: an action in an island's or a client
10343
+ // component's props (islx's \`{"$":"a",...}\`), or a server form posting one (its \`$F_REF_\` field).
10344
+ const FARM_ACTION_REFERENCE_PATTERN = /"\\$":"a"|name="\\$F_REF_/;
10040
10345
 
10041
10346
  function renderFarmClientModulePreload(index) {
10042
10347
  return '\\n <link rel="modulepreload" href="/' +
@@ -10067,15 +10372,28 @@ function collectFarmClientDocumentModules(markup, pageModule, listed) {
10067
10372
  return indexes;
10068
10373
  }
10069
10374
 
10375
+ // The manifest indexes of islands mode's action client, which handles a call's result (RFC 0013),
10376
+ // for a document whose markup holds an action reference, leaving out those already listed. Its
10377
+ // islands import it on their first call otherwise.
10378
+ function collectFarmClientActionModules(markup, listed) {
10379
+ const actions = farmClientModulePreloads.actions;
10380
+ if (!actions || typeof markup !== "string" || !FARM_ACTION_REFERENCE_PATTERN.test(markup)) return [];
10381
+ return actions.filter((index) => !listed.has(index) && listed.add(index));
10382
+ }
10383
+
10070
10384
  // The modulepreload links for a document: the entry's static imports and, unless it answers a
10071
- // client navigation, the renderer, then the modules its hydrating page and its markup load.
10072
- function renderFarmClientModulePreloads(markup, pageModule, navigation) {
10385
+ // client navigation, the renderer and, when a page or layout root hydrates in it (\`hydratesRoot\`),
10386
+ // the code that renders it; then the modules its hydrating page and its markup load.
10387
+ function renderFarmClientModulePreloads(markup, pageModule, navigation, hydratesRoot) {
10073
10388
  // A nonce policy blocks parser-inserted links without the nonce, and the
10074
10389
  // response filter manages nonces on script elements only, so CSP nonce mode
10075
10390
  // keeps the documents it had.
10076
10391
  if (!farmClientModulePreloads || (farmSecurityConfig.csp && farmSecurityConfig.csp.nonce)) return "";
10392
+ const listed = new Set();
10077
10393
  return farmClientEntryPreloadTags + (navigation ? "" : farmClientRendererPreloadTags) +
10078
- collectFarmClientDocumentModules(markup, pageModule, new Set())
10394
+ (hydratesRoot && !navigation ? farmClientRootPreloadTags : "") +
10395
+ collectFarmClientDocumentModules(markup, pageModule, listed)
10396
+ .concat(collectFarmClientActionModules(markup, listed))
10079
10397
  .map(renderFarmClientModulePreload)
10080
10398
  .join("");
10081
10399
  }
@@ -10097,13 +10415,26 @@ function renderFarmClientBootPreloads(markup, pageModule, root, rootStrategy, na
10097
10415
  ) + '"';
10098
10416
  };
10099
10417
  const entry = farmClientModulePreloads.entry;
10418
+ // The root hydrates with the code that hydrates roots (RFC 0013) and its page's modules.
10100
10419
  const rootModules = root
10101
- ? collectFarmClientDocumentModules(markup, pageModule, new Set(entry))
10420
+ ? (farmClientModulePreloads.root || []).concat(
10421
+ collectFarmClientDocumentModules(
10422
+ markup,
10423
+ pageModule,
10424
+ new Set(entry.concat(farmClientModulePreloads.root || [])),
10425
+ ),
10426
+ )
10102
10427
  : [];
10103
10428
  const waitsForClick = rootStrategy === "interaction";
10429
+ // A call needs a hydrated island, so the action client comes with the renderer.
10430
+ const renderer = navigation
10431
+ ? []
10432
+ : (farmClientModulePreloads.renderer || []).concat(
10433
+ collectFarmClientActionModules(markup, new Set(entry.concat(rootModules))),
10434
+ );
10104
10435
  return attribute("data-farm-preload", waitsForClick ? entry : entry.concat(rootModules)) +
10105
10436
  attribute("data-farm-preload-router", farmClientModulePreloads.router || []) +
10106
- attribute("data-farm-preload-renderer", navigation ? [] : farmClientModulePreloads.renderer || []) +
10437
+ attribute("data-farm-preload-renderer", renderer) +
10107
10438
  (waitsForClick ? attribute("data-farm-preload-root", rootModules) : "");
10108
10439
  }
10109
10440
 
@@ -10356,10 +10687,10 @@ async function handleMetadataImageRequest(request, routePathname) {
10356
10687
  path: match.pagePath,
10357
10688
  };
10358
10689
 
10359
- ${hasGeneratedMetadataImages ? `const value = await resolveFarmMetadataImageValue(imageModule, props${_chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, config.renderer) ? "" : ", {\n renderer: ReactDOMServer,\n component: image.component === true,\n }"});
10690
+ ${hasGeneratedMetadataImages ? `const value = await resolveFarmMetadataImageValue(imageModule, props${_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? "" : ", {\n renderer: ReactDOMServer,\n component: image.component === true,\n }"});
10360
10691
  return createFarmMetadataImageResponse(value, imageModule, {
10361
10692
  method,
10362
- ifNoneMatch: request.headers.get("if-none-match"),${_chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, config.renderer) ? "" : "\n renderer: ReactDOMServer,"}
10693
+ ifNoneMatch: request.headers.get("if-none-match"),${_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? "" : "\n renderer: ReactDOMServer,"}
10363
10694
  });` : 'throw new Error("Generated metadata image runtime is unavailable");'}
10364
10695
  } catch (error) {
10365
10696
  console.error("Metadata image render failed:", error);
@@ -10438,7 +10769,7 @@ function createFarmAgentRobotsResponse(request) {
10438
10769
  // its nearest layout's.
10439
10770
  const farmAgentGuardedPages = new Set(${JSON.stringify(
10440
10771
  pageRoutes.map((route) => route.pattern).filter(
10441
- (pattern) => !pattern.includes("[") && _chunkOFVCWV2Dcjs.farmPathGuardCoversPage.call(void 0,
10772
+ (pattern) => !pattern.includes("[") && _chunkNEKO3HM2cjs.farmPathGuardCoversPage.call(void 0,
10442
10773
  {
10443
10774
  config: { middleware: config.middleware, integrations: config.integrations },
10444
10775
  middlewareRoutes
@@ -10493,7 +10824,7 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
10493
10824
  // aside for a page route that answers /mcp and for any MCP server published or
10494
10825
  // registered at runtime, such as the docs engine's.
10495
10826
  const farmDefaultMCPServer = ${JSON.stringify(
10496
- _chunkW53Z4WDIcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunkNSLRK5DKcjs.FARM_VERSION)
10827
+ _chunkW53Z4WDIcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunk3CZ4MJHWcjs.FARM_VERSION)
10497
10828
  )};
10498
10829
  let farmDefaultMCPRouteFree;
10499
10830
  function getFarmDefaultMCPServer() {
@@ -10687,7 +11018,7 @@ ${edgeMiddlewareFilePaths.length > 0 ? `
10687
11018
  // middleware guards is never prerendered. Read once: Nitro's prerender worker sets the variable.
10688
11019
  const farmEdgeMiddlewareFiles = new Set(${JSON.stringify(edgeMiddlewareFilePaths)});
10689
11020
  const farmPrerendering =
10690
- typeof process !== "undefined" && process.env?.${_chunkW6C3LEXXcjs.FARM_PRERENDER_ENV} === "1";
11021
+ typeof process !== "undefined" && process.env?.${_chunkOM6JIIJUcjs.FARM_PRERENDER_ENV} === "1";
10691
11022
  ` : ""}
10692
11023
  const farmMiddlewareRunner = ${hasMiddlewareRuntime ? `createProductionMiddlewareRunner({
10693
11024
  config: farmMiddlewareConfig,
@@ -10831,7 +11162,7 @@ function hasLocalRequestRoute(request, routePathname) {
10831
11162
  if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
10832
11163
  return true;
10833
11164
  }
10834
- ${_optionalChain([config, 'access', _251 => _251.docs, 'optionalAccess', _252 => _252.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
11165
+ ${_optionalChain([config, 'access', _241 => _241.docs, 'optionalAccess', _242 => _242.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
10835
11166
  // The docs answer below the basePath; their API stays at /api/docs, as API routes do.
10836
11167
  const docsRoutePathname = stripFarmBasePath(pathname);
10837
11168
  if (
@@ -10859,7 +11190,7 @@ function getFarmPluginRequestOptions(request) {
10859
11190
  route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
10860
11191
  };
10861
11192
  }
10862
- const isDocsAPIRequest = ${_optionalChain([config, 'access', _253 => _253.docs, 'optionalAccess', _254 => _254.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
11193
+ const isDocsAPIRequest = ${_optionalChain([config, 'access', _243 => _243.docs, 'optionalAccess', _244 => _244.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
10863
11194
  const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
10864
11195
  pathname,
10865
11196
  method: request.method,
@@ -10943,7 +11274,7 @@ ${hasInfraAnalyticsRuntime ? `
10943
11274
  // endpoints, Markdown mirrors, and docs pages have no app route pattern, so they are
10944
11275
  // labeled here; route.pattern keeps meaning the matched app route for plugins.
10945
11276
  const farmBuiltInRoutePaths = new Set(${JSON.stringify(
10946
- _chunkFYZD7DUScjs.listFarmBuiltInRoutePaths.call(void 0, {
11277
+ _chunkWCSBYQOTcjs.listFarmBuiltInRoutePaths.call(void 0, {
10947
11278
  agent: {
10948
11279
  ...config.agent,
10949
11280
  aiCatalog: servesAiCatalog,
@@ -10954,9 +11285,9 @@ const farmBuiltInRoutePaths = new Set(${JSON.stringify(
10954
11285
  openapi: openAPIReference
10955
11286
  })
10956
11287
  )});
10957
- ${_optionalChain([config, 'access', _255 => _255.docs, 'optionalAccess', _256 => _256.enabled]) ? `const farmDocsRouteLabelInput = {
11288
+ ${_optionalChain([config, 'access', _245 => _245.docs, 'optionalAccess', _246 => _246.enabled]) ? `const farmDocsRouteLabelInput = {
10958
11289
  path: normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs"),
10959
- apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _257 => _257.apiPath]) || "/api/docs")},${_optionalChain([config, 'access', _258 => _258.docs, 'access', _259 => _259.roots, 'optionalAccess', _260 => _260.length]) ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}${farmDocsAnalyticsPages.length ? `
11290
+ apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _247 => _247.apiPath]) || "/api/docs")},${_optionalChain([config, 'access', _248 => _248.docs, 'access', _249 => _249.roots, 'optionalAccess', _250 => _250.length]) ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}${farmDocsAnalyticsPages.length ? `
10960
11291
  pages: new Set(${JSON.stringify(farmDocsAnalyticsPages)}),` : ""}
10961
11292
  };
10962
11293
  ` : ""}// The request's route payload, for a handler that learns what answered while it handles.
@@ -10972,11 +11303,11 @@ function labelFarmRequestOptions(options) {
10972
11303
  setFarmRouteLabel(options.route, mcpLabel);
10973
11304
  return options;
10974
11305
  }
10975
- ${_optionalChain([config, 'access', _261 => _261.docs, 'optionalAccess', _262 => _262.enabled]) ? `if (options.kind === "docs") {
11306
+ ${_optionalChain([config, 'access', _251 => _251.docs, 'optionalAccess', _252 => _252.enabled]) ? `if (options.kind === "docs") {
10976
11307
  setFarmRouteLabel(options.route, resolveFarmDocsRouteLabel(routePathname, farmDocsRouteLabelInput));
10977
11308
  return options;
10978
11309
  }` : ""}
10979
- ${_optionalChain([config, 'access', _263 => _263.md, 'optionalAccess', _264 => _264.enabled]) || hasMarkdownPages ? `const markdownLabel = resolveFarmMarkdownRouteLabel(
11310
+ ${_optionalChain([config, 'access', _253 => _253.md, 'optionalAccess', _254 => _254.enabled]) || hasMarkdownPages ? `const markdownLabel = resolveFarmMarkdownRouteLabel(
10980
11311
  routePathname,
10981
11312
  (page) => matchPageRoute(page)?.route.pattern,
10982
11313
  );
@@ -11011,7 +11342,7 @@ function getApplicableLayouts(pathname, directory) {
11011
11342
  return applicable;
11012
11343
  }
11013
11344
 
11014
- ${_optionalChain([config, 'access', _265 => _265.docs, 'optionalAccess', _266 => _266.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
11345
+ ${_optionalChain([config, 'access', _255 => _255.docs, 'optionalAccess', _256 => _256.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
11015
11346
  if (request.method === "HEAD") return response;
11016
11347
  if (response.headers.get("x-farm-docs-adapter")) return response;
11017
11348
 
@@ -11085,8 +11416,8 @@ ${_optionalChain([config, 'access', _265 => _265.docs, 'optionalAccess', _266 =>
11085
11416
  }
11086
11417
  html = html.replace(/<[/]head>/i, function() { return renderedRoot.head + "\\n</head>"; });
11087
11418
  }
11088
- if (!html.includes('href="/__farm_client_css_href__"')) {
11089
- const clientStylesheet = ' <link rel="stylesheet" href="/__farm_client_css_href__">\\n';
11419
+ if (farmClientStylesheetHref && !html.includes('href="' + farmClientStylesheetHref + '"')) {
11420
+ const clientStylesheet = ' ' + renderFarmClientStylesheet() + '\\n';
11090
11421
  const firstStyleIndex = html.search(/<style(?:\\s|>)/i);
11091
11422
  html =
11092
11423
  firstStyleIndex >= 0
@@ -11117,7 +11448,7 @@ ${_optionalChain([config, 'access', _265 => _265.docs, 'optionalAccess', _266 =>
11117
11448
 
11118
11449
  // Shells keep their own LRU so query-string variants never evict app cache entries.
11119
11450
  const pprShellCache = getFarmDataCache().pprShellCache;
11120
- const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _267 => _267.experimental, 'optionalAccess', _268 => _268.ppr]) === true)};
11451
+ const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _257 => _257.experimental, 'optionalAccess', _258 => _258.ppr]) === true)};
11121
11452
 
11122
11453
  function resolveRouteRenderingView(route) {
11123
11454
  // The same merge development uses: baked directive config under the
@@ -11237,7 +11568,7 @@ async function handleFarmRequest(request, adapterContext) {
11237
11568
  },
11238
11569
  { redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
11239
11570
  )` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
11240
- ${_optionalChain([config, 'access', _269 => _269.md, 'optionalAccess', _270 => _270.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
11571
+ ${_optionalChain([config, 'access', _259 => _259.md, 'optionalAccess', _260 => _260.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
11241
11572
  if (matchPageRoute(pathname)) {
11242
11573
  // The Link header advertises the public .md URL, like the head alternate.
11243
11574
  return applyMarkdownNegotiationHeaders(response, {
@@ -11454,7 +11785,7 @@ ${hasServerRuntimeIntegrations ? `
11454
11785
  return renderFarmErrorJSONResponse();` : `
11455
11786
  if (isFarmLocalAPIPathname(pathname)) return renderFarmErrorJSONResponse();
11456
11787
  // No page was selected, so only the root error boundary and layouts apply.
11457
- const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access', _271 => _271.md, 'optionalAccess', _272 => _272.enabled]) ? `
11788
+ const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access', _261 => _261.md, 'optionalAccess', _262 => _262.enabled]) ? `
11458
11789
  // An agent asking for Markdown reads the error document as Markdown, as it
11459
11790
  // does when a page throws. The helper answers null when Markdown is off.
11460
11791
  const markdownErrorResponse = await createMarkdownMirrorResponse({
@@ -11496,7 +11827,7 @@ ${hasServerRuntimeIntegrations ? `
11496
11827
  }
11497
11828
  ` : ""}
11498
11829
 
11499
- ${_optionalChain([config, 'access', _273 => _273.docs, 'optionalAccess', _274 => _274.enabled]) ? `
11830
+ ${_optionalChain([config, 'access', _263 => _263.docs, 'optionalAccess', _264 => _264.enabled]) ? `
11500
11831
  // Docs responses are served after app middleware so route guards and
11501
11832
  // middleware headers apply to the docs engine like any other page content.
11502
11833
  // An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
@@ -11612,7 +11943,7 @@ ${hasServerRuntimeIntegrations ? `
11612
11943
  }
11613
11944
  ` : ""}
11614
11945
 
11615
- ${_optionalChain([config, 'access', _275 => _275.md, 'optionalAccess', _276 => _276.enabled]) ? `
11946
+ ${_optionalChain([config, 'access', _265 => _265.md, 'optionalAccess', _266 => _266.enabled]) ? `
11616
11947
  if (farmMarkdownConfig?.enabled) {
11617
11948
  const markdownResponse = await createMarkdownMirrorResponse({
11618
11949
  // The mirror helper only reads metadata and creates its own GET request.
@@ -11716,11 +12047,11 @@ ${hasServerRuntimeIntegrations ? `
11716
12047
  return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
11717
12048
  }
11718
12049
  ` : ""}
11719
- ${_optionalChain([config, 'access', _277 => _277.agent, 'optionalAccess', _278 => _278.manifest]) !== false ? `
12050
+ ${_optionalChain([config, 'access', _267 => _267.agent, 'optionalAccess', _268 => _268.manifest]) !== false ? `
11720
12051
  // agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
11721
12052
  // public manifest, the same document for every request.
11722
12053
  if (
11723
- [${JSON.stringify(_chunkFYZD7DUScjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkFYZD7DUScjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
12054
+ [${JSON.stringify(_chunkWCSBYQOTcjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkWCSBYQOTcjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
11724
12055
  normalizeRuntimePath(routePathname),
11725
12056
  )
11726
12057
  ) {
@@ -11730,9 +12061,9 @@ ${hasServerRuntimeIntegrations ? `
11730
12061
  );
11731
12062
  }
11732
12063
  ` : ""}
11733
- ${_optionalChain([config, 'access', _279 => _279.agent, 'optionalAccess', _280 => _280.apiCatalog]) ? `
12064
+ ${_optionalChain([config, 'access', _269 => _269.agent, 'optionalAccess', _270 => _270.apiCatalog]) ? `
11734
12065
  // agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
11735
- if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkFYZD7DUScjs.FARM_API_CATALOG_PATH)}) {
12066
+ if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkWCSBYQOTcjs.FARM_API_CATALOG_PATH)}) {
11736
12067
  return applyProductionMiddlewareHeaders(
11737
12068
  createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
11738
12069
  middlewareHeaders,
@@ -11757,11 +12088,11 @@ ${hasServerRuntimeIntegrations ? `
11757
12088
  );
11758
12089
  }
11759
12090
  ` : ""}
11760
- ${_optionalChain([config, 'access', _281 => _281.agent, 'optionalAccess', _282 => _282.llmsTxt, 'optionalAccess', _283 => _283.enabled]) ? `
12091
+ ${_optionalChain([config, 'access', _271 => _271.agent, 'optionalAccess', _272 => _272.llmsTxt, 'optionalAccess', _273 => _273.enabled]) ? `
11761
12092
  // agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
11762
12093
  const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
11763
12094
  ? "llms"
11764
- : ${_optionalChain([config, 'access', _284 => _284.agent, 'optionalAccess', _285 => _285.llmsTxt, 'optionalAccess', _286 => _286.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
12095
+ : ${_optionalChain([config, 'access', _274 => _274.agent, 'optionalAccess', _275 => _275.llmsTxt, 'optionalAccess', _276 => _276.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
11765
12096
  if (farmGeneratedLlmsKind) {
11766
12097
  const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
11767
12098
  // Renders are shared per origin the request reached, which is where pages are read.
@@ -11797,7 +12128,7 @@ ${hasServerRuntimeIntegrations ? `
11797
12128
  }
11798
12129
  ` : ""}
11799
12130
 
11800
- ${_optionalChain([config, 'access', _287 => _287.docs, 'optionalAccess', _288 => _288.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
12131
+ ${_optionalChain([config, 'access', _277 => _277.docs, 'optionalAccess', _278 => _278.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
11801
12132
  const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
11802
12133
  if (docsAPIResponse) {
11803
12134
  return applyProductionMiddlewareHeaders(
@@ -12267,7 +12598,7 @@ ${hasServerRuntimeIntegrations ? `
12267
12598
  }
12268
12599
 
12269
12600
  if (route.shouldHydrate && !shouldHydrateLayout) {
12270
- pageElement = wrapFarmRouteClientGraph(pageElement);
12601
+ pageElement = wrapFarmRouteClientGraph(wrapFarmIslandIntegrationProviders(pageElement));
12271
12602
  } else if (shouldHydrateLayout && !route.shouldHydrate) {
12272
12603
  pageElement = route.serverTree
12273
12604
  ? await renderFarmRouteServerTree(
@@ -12292,7 +12623,7 @@ ${hasServerRuntimeIntegrations ? `
12292
12623
  pageElement,
12293
12624
  );
12294
12625
 
12295
- ${_chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, config.renderer) ? "if (route.shouldHydrate && !shouldHydrateLayout) pageElement = markPagePosition(React, pageElement);" : ""}
12626
+ ${_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? "if (route.shouldHydrate && !shouldHydrateLayout) pageElement = markPagePosition(React, pageElement);" : ""}
12296
12627
  // Wrap with layouts (from innermost to outermost)
12297
12628
  // Layouts are sorted by depth (root first), so we process in reverse
12298
12629
  let wrappedElement = pageElement;
@@ -12328,7 +12659,9 @@ ${hasServerRuntimeIntegrations ? `
12328
12659
  },
12329
12660
  slot.hydrates
12330
12661
  ? wrapFarmRouteClientGraph(
12331
- React.createElement(slot.module.default, slot.props),
12662
+ wrapFarmIslandIntegrationProviders(
12663
+ React.createElement(slot.module.default, slot.props),
12664
+ ),
12332
12665
  )
12333
12666
  : React.createElement(slot.module.default, slot.props),
12334
12667
  );
@@ -12364,7 +12697,7 @@ ${hasServerRuntimeIntegrations ? `
12364
12697
  wrappedElement = wrapFarmRouteClientGraph(wrappedElement);
12365
12698
  }
12366
12699
 
12367
- ${_chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, config.renderer) ? "if (route.shouldHydrate && !shouldHydrateLayout) wrappedElement = markLayoutPosition(React, wrappedElement);" : ""}
12700
+ ${_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? "if (route.shouldHydrate && !shouldHydrateLayout) wrappedElement = markLayoutPosition(React, wrappedElement);" : ""}
12368
12701
  wrappedElement = wrapWithFarmIntegrationProviders(wrappedElement);
12369
12702
  return renderFarmElement(ReactDOMServer, wrappedElement, route.pattern, farmFlushToken);
12370
12703
  };
@@ -12435,7 +12768,7 @@ ${hasServerRuntimeIntegrations ? `
12435
12768
  );
12436
12769
  }
12437
12770
  }
12438
- ${_optionalChain([config, 'access', _289 => _289.md, 'optionalAccess', _290 => _290.enabled]) ? `
12771
+ ${_optionalChain([config, 'access', _279 => _279.md, 'optionalAccess', _280 => _280.enabled]) ? `
12439
12772
  // Advertise the Markdown mirror in the head as well as the Link header,
12440
12773
  // using the public path the .md request will be resolved against.
12441
12774
  mergedMetadata = addMetadataMarkdownAlternate(
@@ -12464,7 +12797,7 @@ ${hasServerRuntimeIntegrations ? `
12464
12797
  emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "cookie" });
12465
12798
  }
12466
12799
 
12467
- const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _291 => _291.agent, 'optionalAccess', _292 => _292.jsonLd]), () => ( false)))} });
12800
+ const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _281 => _281.agent, 'optionalAccess', _282 => _282.jsonLd]), () => ( false)))} });
12468
12801
  const title = renderedMetadata.title;
12469
12802
  const metaTags = renderedMetadata.tags;
12470
12803
  const hasFavicon = renderedMetadata.hasFavicon;
@@ -12542,6 +12875,17 @@ ${hasServerRuntimeIntegrations ? `
12542
12875
  // Set once the whole document is rendered: whether it starts with the boot entry, which
12543
12876
  // preloads nothing.
12544
12877
  let farmBootsClient = false;
12878
+ // A document something hydrates over holds the clicks and submits made before it hydrates,
12879
+ // for the client entry to replay, as development does. One that starts with the boot entry
12880
+ // holds its own.
12881
+ const farmHydratesRoot = route.shouldHydrate || shouldHydrateLayout;
12882
+ const farmHoldsInteractions =
12883
+ farmHydratesRoot || renderedRouteSlots.some(function(slot) { return slot.hydrates; });
12884
+ const renderFarmPreHydrationHoldScript = function() {
12885
+ return farmHoldsInteractions && !farmBootsClient
12886
+ ? stampFarmCspNonce(createPreHydrationClickQueueScript()) + '\\n'
12887
+ : '';
12888
+ };
12545
12889
  // A client navigation swaps this document in without running its scripts. A route a
12546
12890
  // shared cache stores renders the same for every request.
12547
12891
  const farmNavigationRequest = ${farmIslandsMode ? `!farmSharedCacheableRoute &&
@@ -12555,8 +12899,8 @@ ${hasServerRuntimeIntegrations ? `
12555
12899
  );
12556
12900
  composed = composed
12557
12901
  // Inject CSS link after opening head tag or first meta tag
12558
- .replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n <link rel="stylesheet" href="/__farm_client_css_href__">' + (farmBootsClient ? "" : renderFarmClientModulePreloads(composed, route.clientModule, farmNavigationRequest)); })
12559
- .replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n</head>')
12902
+ .replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n ' + renderFarmClientStylesheet() + (farmBootsClient ? "" : renderFarmClientModulePreloads(composed, route.clientModule, farmNavigationRequest, farmHydratesRoot)); })
12903
+ .replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n' + renderFarmPreHydrationHoldScript() + '</head>')
12560
12904
  // Explicit metadata wins over renderer and layout titles. Without
12561
12905
  // explicit metadata, a renderer title wins over the layout title.
12562
12906
  .replace(/<head([^>]*)>([\\s\\S]*?)<\\/head>/i, (match, attrs, headContent) => {
@@ -12628,9 +12972,10 @@ ${hasServerRuntimeIntegrations ? `
12628
12972
  (hasFavicon ? '' : ' <link rel="icon" href="data:,">\\n') +
12629
12973
  (suppressDefaultTitle ? '' : ' <title>' + title + '</title>') + metaTags +
12630
12974
  (rendererHead ? '\\n ' + rendererHead : '') + '\\n' +
12631
- ' <link rel="stylesheet" href="/__farm_client_css_href__">\\n' +
12632
- ' <link rel="modulepreload" href="/__farm_client_js_src__">' + renderFarmClientModulePreloads(null, route.clientModule) + '\\n' +
12975
+ ' ' + renderFarmClientStylesheet() + '\\n' +
12976
+ ' <link rel="modulepreload" href="/__farm_client_js_src__">' + renderFarmClientModulePreloads(null, route.clientModule, false, farmHydratesRoot) + '\\n' +
12633
12977
  renderFarmRendererHydrationScript() + '\\n' +
12978
+ renderFarmPreHydrationHoldScript() +
12634
12979
  '</head>\\n<body>\\n' + farmEarlyClientScripts + ' <div id="root">';
12635
12980
  const streamClientScripts = farmEarlyClientScripts ? '' : farmClientScripts();
12636
12981
  const streamSuffix = function() {
@@ -12742,7 +13087,6 @@ ${hasServerRuntimeIntegrations ? `
12742
13087
  }
12743
13088
  }
12744
13089
  // A route that hydrates as one root starts with the boot entry only when that root waits.
12745
- const farmHydratesRoot = route.shouldHydrate || shouldHydrateLayout;
12746
13090
  farmBootsClient = farmDocumentBootsClient(
12747
13091
  html,
12748
13092
  (farmHydratesRoot && !route.rootStrategy) || Boolean(pprCacheKey),
@@ -12785,9 +13129,9 @@ ${hasServerRuntimeIntegrations ? `
12785
13129
  \${viewportTags}
12786
13130
  \${hasFavicon ? "" : '<link rel="icon" href="data:,">'}
12787
13131
  \${suppressDefaultTitle ? "" : "<title>" + title + "</title>"}\${metaTags}\${rendererHead ? "\\n " + rendererHead : ""}
12788
- <link rel="stylesheet" href="/__farm_client_css_href__">\${farmBootsClient ? "" : renderFarmClientModulePreloads(html, route.clientModule, farmNavigationRequest)}
13132
+ \${renderFarmClientStylesheet()}\${farmBootsClient ? "" : renderFarmClientModulePreloads(html, route.clientModule, farmNavigationRequest, farmHydratesRoot)}
12789
13133
  \${renderFarmRendererHydrationScript()}
12790
- </head>
13134
+ \${renderFarmPreHydrationHoldScript()}</head>
12791
13135
  <body>
12792
13136
  <div id="root">\${html}</div>
12793
13137
  \${renderFarmClientBootstrapScript(pageProps.__farmCanonicalPath, farmDeferredData.data.slots, farmDeferredData.data.page, routePathname)}\${renderFarmDeferredDataScript(farmDeferredData.records)}
@@ -13146,7 +13490,7 @@ ${farmRendererDisabled ? `
13146
13490
  "<head" + attrs + ">" +
13147
13491
  headContent.replace(/<title\\b[^>]*>[\\s\\S]*?<\\/title>\\s*/gi, "") +
13148
13492
  "\\n <title>" + notFoundMetadata.title + "</title>" + notFoundMetadata.tags + "\\n</head>")
13149
- .replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n <link rel="stylesheet" href="/__farm_client_css_href__">' + renderFarmClientModulePreloads(fullDocument); })
13493
+ .replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n ' + renderFarmClientStylesheet() + renderFarmClientModulePreloads(fullDocument); })
13150
13494
  .replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n</head>')
13151
13495
  .replace(
13152
13496
  /<\\/body>/i,
@@ -13164,7 +13508,7 @@ ${farmRendererDisabled ? `
13164
13508
  <meta charset="UTF-8">
13165
13509
  \${notFoundMetadata.viewport}
13166
13510
  \${notFoundMetadata.hasFavicon ? "" : '<link rel="icon" href="data:,">'}
13167
- <link rel="stylesheet" href="/__farm_client_css_href__">\${renderFarmClientModulePreloads(html)}
13511
+ \${renderFarmClientStylesheet()}\${renderFarmClientModulePreloads(html)}
13168
13512
  <title>\${notFoundMetadata.title}</title>\${notFoundMetadata.tags}
13169
13513
  \${renderFarmRendererHydrationScript()}
13170
13514
  </head>
@@ -13298,11 +13642,11 @@ function createFarmRuntimeHookErrorResponse(request, error) {
13298
13642
  export async function fetch(request, context) {${imageRuntime === "none" ? "" : `
13299
13643
  // The image optimizer's fetch of a local source is not a loopback visitor.
13300
13644
  context = _withFarmImageSourceClientAddress(request, context);`}
13301
- ${_optionalChain([config, 'access', _293 => _293.agent, 'optionalAccess', _294 => _294.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
13645
+ ${_optionalChain([config, 'access', _283 => _283.agent, 'optionalAccess', _284 => _284.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
13302
13646
  basePath: farmLocalAPIBasePath,
13303
13647
  dispatch: async (localRequest) =>
13304
13648
  (await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
13305
- }, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _295 => _295.agent, 'optionalAccess', _296 => _296.noindexPreviews]) ? `
13649
+ }, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _285 => _285.agent, 'optionalAccess', _286 => _286.noindexPreviews]) ? `
13306
13650
  // Keep every response of a preview deployment out of search indexes.
13307
13651
  return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
13308
13652
  }
@@ -13512,7 +13856,7 @@ function getManifestPageEntry(manifest, pathname) {
13512
13856
  })).sort((left, right) => _chunkML4TOUZPcjs.compareRouteSpecificity.call(void 0, left.specificity, right.specificity)).map(({ entry, matches }) => ({ entry, matches }));
13513
13857
  manifestPageMatchers.set(manifest.routes, pages);
13514
13858
  }
13515
- return _optionalChain([pages, 'access', _297 => _297.find, 'call', _298 => _298((page) => page.matches(pathname)), 'optionalAccess', _299 => _299.entry]);
13859
+ return _optionalChain([pages, 'access', _287 => _287.find, 'call', _288 => _288((page) => page.matches(pathname)), 'optionalAccess', _289 => _289.entry]);
13516
13860
  }
13517
13861
  function withFarmEdgeGuardedPrerenderHeaders(headers, edgeGuarded) {
13518
13862
  if (!edgeGuarded) return headers;
@@ -13528,7 +13872,7 @@ function prerenderWouldChangePageUrl(pathname) {
13528
13872
  if (/%(?:23|25|2F|3F)/i.test(pathname)) return true;
13529
13873
  try {
13530
13874
  return decodeURI(pathname) !== pathname;
13531
- } catch (e38) {
13875
+ } catch (e39) {
13532
13876
  return true;
13533
13877
  }
13534
13878
  }
@@ -13549,13 +13893,13 @@ function getPhysicalPrerenderBypassReason(options) {
13549
13893
  if (rewriteSources.some((source) => middlewarePatternMatches(source, pathname))) {
13550
13894
  return "rewrite";
13551
13895
  }
13552
- if (_chunkOFVCWV2Dcjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
13553
- if (_chunkOFVCWV2Dcjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
13554
- if (_chunkMOGRRZMWcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
13896
+ if (_chunkNEKO3HM2cjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
13897
+ if (_chunkNEKO3HM2cjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
13898
+ if (_chunk55UJGUBPcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
13555
13899
  if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
13556
13900
  const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
13557
- if (_optionalChain([manifestEntry, 'optionalAccess', _300 => _300.rendering]) === "dynamic") return "dynamic runtime manifest";
13558
- if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _301 => _301.regions, 'optionalAccess', _302 => _302.length])) || manifestEntry.maxDuration !== void 0)) {
13901
+ if (_optionalChain([manifestEntry, 'optionalAccess', _290 => _290.rendering]) === "dynamic") return "dynamic runtime manifest";
13902
+ if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _291 => _291.regions, 'optionalAccess', _292 => _292.length])) || manifestEntry.maxDuration !== void 0)) {
13559
13903
  return "route runtime controls";
13560
13904
  }
13561
13905
  const routeRule = getEffectiveRouteRule(config, pathname);
@@ -13568,14 +13912,14 @@ function getPhysicalPrerenderBypassReason(options) {
13568
13912
  return void 0;
13569
13913
  }
13570
13914
  async function getFarmDocsPrerenderPages(config, root, preset) {
13571
- if (!_optionalChain([config, 'access', _303 => _303.docs, 'optionalAccess', _304 => _304.enabled]) || !config.docs.prerender) return [];
13915
+ if (!_optionalChain([config, 'access', _293 => _293.docs, 'optionalAccess', _294 => _294.enabled]) || !config.docs.prerender) return [];
13572
13916
  if (_chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge") {
13573
13917
  _chunk7U4XF76Rcjs.logger.info(
13574
13918
  `\u21AA Keeping docs pages in the edge docs snapshot: docs.prerender writes static files on Node and serverless targets, not "${preset}".`
13575
13919
  );
13576
13920
  return [];
13577
13921
  }
13578
- if (!_chunkE3HBD2K3cjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
13922
+ if (!_chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
13579
13923
  const { pages: pages2, originDependent } = _chunkHR5GU4UUcjs.listFarmDocsBuiltInPrerenderPages.call(void 0, config.docs, {
13580
13924
  root,
13581
13925
  srcDir: config.srcDir
@@ -13587,13 +13931,7 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
13587
13931
  }
13588
13932
  return pages2;
13589
13933
  }
13590
- if (!_chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, config.renderer)) {
13591
- _chunk7U4XF76Rcjs.logger.warn(
13592
- `The docs adapter ${JSON.stringify(config.docs.adapter.id)} renders with React; docs.prerender keeps its pages rendering on request with the "${config.renderer.name}" renderer.`
13593
- );
13594
- return [];
13595
- }
13596
- const pages = await _chunkE3HBD2K3cjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
13934
+ const pages = await _chunkLN6FAYNBcjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
13597
13935
  if (!pages) {
13598
13936
  _chunk7U4XF76Rcjs.logger.warn(
13599
13937
  `The docs adapter ${JSON.stringify(config.docs.adapter.id)} does not list its pages for prerendering; upgrade it to prerender docs pages. They render on request until then.`
@@ -13603,14 +13941,14 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
13603
13941
  return pages;
13604
13942
  }
13605
13943
  async function listFarmDocsAnalyticsPages(config, root, preset) {
13606
- if (!_optionalChain([config, 'access', _305 => _305.docs, 'optionalAccess', _306 => _306.enabled]) || config.analytics === false || _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) !== "nodejs") {
13944
+ if (!_optionalChain([config, 'access', _295 => _295.docs, 'optionalAccess', _296 => _296.enabled]) || config.analytics === false || _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) !== "nodejs") {
13607
13945
  return [];
13608
13946
  }
13609
13947
  try {
13610
- return await _chunkE3HBD2K3cjs.listFarmDocsPagePaths.call(void 0, config.docs, {
13948
+ return await _chunkLN6FAYNBcjs.listFarmDocsPagePaths.call(void 0, config.docs, {
13611
13949
  root,
13612
13950
  srcDir: config.srcDir,
13613
- adapter: _chunkM6DAIE4Tcjs.isReactRenderer.call(void 0, config.renderer) && _chunkE3HBD2K3cjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)
13951
+ adapter: _chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)
13614
13952
  });
13615
13953
  } catch (error) {
13616
13954
  _chunk7U4XF76Rcjs.logger.warn(
@@ -13621,9 +13959,9 @@ async function listFarmDocsAnalyticsPages(config, root, preset) {
13621
13959
  }
13622
13960
  function hasFarmNitroCacheRouteRule(routeRules) {
13623
13961
  return Object.values(routeRules || {}).some((rule) => {
13624
- const swr = _optionalChain([rule, 'optionalAccess', _307 => _307.swr]);
13625
- const cache = _optionalChain([rule, 'optionalAccess', _308 => _308.cache]);
13626
- const headers = _optionalChain([rule, 'optionalAccess', _309 => _309.headers]);
13962
+ const swr = _optionalChain([rule, 'optionalAccess', _297 => _297.swr]);
13963
+ const cache = _optionalChain([rule, 'optionalAccess', _298 => _298.cache]);
13964
+ const headers = _optionalChain([rule, 'optionalAccess', _299 => _299.headers]);
13627
13965
  return swr !== void 0 && swr !== false || cache !== void 0 && cache !== false || !!headers && typeof headers === "object" && Object.keys(headers).length > 0;
13628
13966
  });
13629
13967
  }
@@ -13636,10 +13974,10 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
13636
13974
  const nitroBuilder = nitroBuilderResult.value;
13637
13975
  const isVercel = preset === "vercel";
13638
13976
  const isCloudflareWorker = preset === "cloudflare-module";
13639
- const outputDir = _chunkMOGRRZMWcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
13977
+ const outputDir = _chunk55UJGUBPcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
13640
13978
  const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
13641
13979
  const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
13642
- const imageRuntime = _chunkCL7BUGVBcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
13980
+ const imageRuntime = _chunkJHRJ5V2Fcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
13643
13981
  const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
13644
13982
  (image) => image.sourceType === "module"
13645
13983
  );
@@ -13665,7 +14003,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
13665
14003
  const configuredResponseRoutesPromise = Promise.all([config.redirects(), config.rewrites()]);
13666
14004
  const docsPrerenderPagesPromise = getFarmDocsPrerenderPages(config, root, preset);
13667
14005
  const farmWorkflows = await _chunkBSX5OGSDcjs.prepareFarmWorkflowsForNitro.call(void 0, config);
13668
- const farmCron = await _chunk5ZHC6QGDcjs.prepareFarmCronForNitro.call(void 0, config);
14006
+ const farmCron = await _chunkHQKCSJEHcjs.prepareFarmCronForNitro.call(void 0, config);
13669
14007
  const [
13670
14008
  { ssg: ssgPages },
13671
14009
  middlewareRoutes,
@@ -13695,7 +14033,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
13695
14033
  const edgeGuardedPrerenderRoutes = [];
13696
14034
  const addPrerenderRoute = (pathname) => {
13697
14035
  prerenderRoutes.push(pathname);
13698
- if (_chunkOFVCWV2Dcjs.appMiddlewareMayHandlePath.call(void 0, edgeMiddlewareRoutes, pathname)) {
14036
+ if (_chunkNEKO3HM2cjs.appMiddlewareMayHandlePath.call(void 0, edgeMiddlewareRoutes, pathname)) {
13699
14037
  edgeGuardedPrerenderRoutes.push(pathname);
13700
14038
  }
13701
14039
  };
@@ -13754,12 +14092,12 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
13754
14092
  "Cloudflare Pages does not install Cron Triggers. Use the cloudflare-module preset or an external scheduler with .farm/cron-manifest.json."
13755
14093
  );
13756
14094
  }
13757
- const portableScheduledTasks = _chunk5ZHC6QGDcjs.mergeScheduledTasks.call(void 0,
14095
+ const portableScheduledTasks = _chunkHQKCSJEHcjs.mergeScheduledTasks.call(void 0,
13758
14096
  farmWorkflows.scheduledTasks,
13759
14097
  farmCron.scheduledTasks
13760
14098
  );
13761
- const scheduledTasks = preset.startsWith("cloudflare") ? _chunk5ZHC6QGDcjs.toFarmCronCloudflareScheduledTasks.call(void 0, portableScheduledTasks) : portableScheduledTasks;
13762
- const cloudflareCronConfig = farmCron.provider === "host" ? _chunk5ZHC6QGDcjs.createFarmCronCloudflareConfig.call(void 0, farmCron.jobs) : void 0;
14099
+ const scheduledTasks = preset.startsWith("cloudflare") ? _chunkHQKCSJEHcjs.toFarmCronCloudflareScheduledTasks.call(void 0, portableScheduledTasks) : portableScheduledTasks;
14100
+ const cloudflareCronConfig = farmCron.provider === "host" ? _chunkHQKCSJEHcjs.createFarmCronCloudflareConfig.call(void 0, farmCron.jobs) : void 0;
13763
14101
  const [
13764
14102
  clientCssHref,
13765
14103
  clientJsSrc,
@@ -13779,6 +14117,9 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
13779
14117
  const encodedDocsModulePreloads = encodeFarmDocsModulePreloads(docsModulePreloads);
13780
14118
  const encodedClientModulePreloads = encodeFarmClientModulePreloads(clientModulePreloads);
13781
14119
  const encodedClientRouteTable = encodeFarmBuildJSONPlaceholder(clientRouteTable);
14120
+ const encodedClientStylesheet = encodeFarmBuildJSONPlaceholder(
14121
+ await resolveClientStylesheetLinkHref(clientOutputDir, clientCssHref)
14122
+ );
13782
14123
  const encodedMobileShellClient = shouldBuildFarmMobileClient(config) ? _chunkE5UN4OWXcjs.encodeFarmMobileShellClient.call(void 0,
13783
14124
  await _chunkE5UN4OWXcjs.finalizeFarmMobileClient.call(void 0, {
13784
14125
  buildDir: _path2.default.join(root, distDir),
@@ -13786,7 +14127,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
13786
14127
  webEntry: clientJsSrc,
13787
14128
  webBoot: clientBootSrc,
13788
14129
  stylesheet: clientCssHref,
13789
- webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess', _310 => _310.files]), () => ( []))
14130
+ webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess', _300 => _300.files]), () => ( []))
13790
14131
  })
13791
14132
  ) : null;
13792
14133
  for (const output of Object.values(ssrBundle)) {
@@ -13803,6 +14144,9 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
13803
14144
  if (output.code.includes(FARM_CLIENT_ROUTE_TABLE_PLACEHOLDER)) {
13804
14145
  output.code = output.code.split(FARM_CLIENT_ROUTE_TABLE_PLACEHOLDER).join(encodedClientRouteTable);
13805
14146
  }
14147
+ if (output.code.includes(FARM_CLIENT_STYLESHEET_PLACEHOLDER)) {
14148
+ output.code = output.code.split(FARM_CLIENT_STYLESHEET_PLACEHOLDER).join(encodedClientStylesheet);
14149
+ }
13806
14150
  if (output.code.includes(FARM_CLIENT_CSS_HREF_PLACEHOLDER)) {
13807
14151
  output.code = output.code.split(FARM_CLIENT_CSS_HREF_PLACEHOLDER).join(clientCssHref);
13808
14152
  }
@@ -14109,7 +14453,7 @@ function toFarmNodeResponse(request, response) {
14109
14453
  varyFarmNitroCacheRules(_chunkIIHZ2BEEcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules), [
14110
14454
  ...config.md.enabled ? ["accept"] : [],
14111
14455
  ...shouldBuildFarmMobileClient(config) ? ["x-farm-shell"] : [],
14112
- ..._chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _311 => _311.experimental, 'optionalAccess', _312 => _312.serverComponents])) === "islands" ? ["f-layouts"] : []
14456
+ ..._chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _301 => _301.experimental, 'optionalAccess', _302 => _302.serverComponents])) === "islands" ? ["f-layouts"] : []
14113
14457
  ]),
14114
14458
  config.basePath,
14115
14459
  _chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api)
@@ -14137,7 +14481,9 @@ function toFarmNodeResponse(request, response) {
14137
14481
  ];
14138
14482
  })
14139
14483
  );
14140
- if (preset === "node-server") await writeFarmClientBrotliAssets(clientOutputDir);
14484
+ if (preset === "node-server" || preset === "bun") {
14485
+ await writeFarmClientBrotliAssets(clientOutputDir);
14486
+ }
14141
14487
  const immutableAssets = isVercel ? { publicAssets: [], routeRules: {} } : planFarmImmutableAssets({
14142
14488
  clientOutputDir,
14143
14489
  files: await listFarmClientOutputFiles(clientOutputDir),
@@ -14174,9 +14520,8 @@ function toFarmNodeResponse(request, response) {
14174
14520
  // A self-hosted Node or Bun server sends static files itself, so precompress
14175
14521
  // them with gzip and let Nitro serve that by Accept-Encoding. Brotli at Nitro's
14176
14522
  // fixed top quality on every file cost a docs app ~20 s of build CPU, so only
14177
- // client scripts and stylesheets get a brotli copy, on node-server
14178
- // (writeFarmClientBrotliAssets). Serverless and edge targets sit behind a CDN
14179
- // that compresses.
14523
+ // client scripts and stylesheets get a brotli copy (writeFarmClientBrotliAssets).
14524
+ // Serverless and edge targets sit behind a CDN that compresses.
14180
14525
  ...preset === "node-server" || preset === "bun" ? { compressPublicAssets: { gzip: true } } : {},
14181
14526
  // Nitro gzips every server output file at level 9, node_modules included, to
14182
14527
  // print sizes after the build. A self-hosted server is never shipped compressed,
@@ -14273,22 +14618,22 @@ function toFarmNodeResponse(request, response) {
14273
14618
  snapshotSSRRebundleOptions(nitroConfig)
14274
14619
  );
14275
14620
  const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
14276
- const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _313 => _313.rollupConfig, 'optionalAccess', _314 => _314.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _315 => _315.rollupConfig, 'optionalAccess', _316 => _316.plugins])) && customRollupKeys.length === 0 && Boolean(
14277
- _optionalChain([nitroConfig, 'access', _317 => _317.handlers, 'optionalAccess', _318 => _318.some, 'call', _319 => _319(
14278
- (handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _320 => _320.handler]) || "") === nitroEntryPath
14621
+ const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _303 => _303.rollupConfig, 'optionalAccess', _304 => _304.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _305 => _305.rollupConfig, 'optionalAccess', _306 => _306.plugins])) && customRollupKeys.length === 0 && Boolean(
14622
+ _optionalChain([nitroConfig, 'access', _307 => _307.handlers, 'optionalAccess', _308 => _308.some, 'call', _309 => _309(
14623
+ (handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _310 => _310.handler]) || "") === nitroEntryPath
14279
14624
  )])
14280
14625
  );
14281
- const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _321 => _321.output, 'optionalAccess', _322 => _322.serverDir]) || "") === _path2.default.resolve(expectedServerDir);
14626
+ const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _311 => _311.output, 'optionalAccess', _312 => _312.serverDir]) || "") === _path2.default.resolve(expectedServerDir);
14282
14627
  const prerenderReusesPrebuiltSSR = prerenderRoutes.length > 0 && ssrExternalsArePackaged && nitroBuildIsFarms;
14283
14628
  const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
14284
14629
  if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
14285
14630
  const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
14286
14631
  const shouldMinify = nitroConfig.minify !== false;
14287
- const keepServerNames = !(_optionalChain([config, 'access', _323 => _323.docs, 'optionalAccess', _324 => _324.enabled]) && _optionalChain([config, 'access', _325 => _325.docs, 'access', _326 => _326.adapter, 'optionalAccess', _327 => _327.server]));
14632
+ const keepServerNames = !(_optionalChain([config, 'access', _313 => _313.docs, 'optionalAccess', _314 => _314.enabled]) && _optionalChain([config, 'access', _315 => _315.docs, 'access', _316 => _316.adapter, 'optionalAccess', _317 => _317.server]));
14288
14633
  const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
14289
14634
  const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
14290
14635
  const ssrRollupPlugin = canReusePrebuiltSSR ? prebuiltSSRPlugin : createServerReadSSRAssetsPlugin(ssrBundle, ssrOutputDir);
14291
- const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _328 => _328.rollupConfig, 'optionalAccess', _329 => _329.plugins]);
14636
+ const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _318 => _318.rollupConfig, 'optionalAccess', _319 => _319.plugins]);
14292
14637
  nitroConfig.rollupConfig = {
14293
14638
  ...nitroConfig.rollupConfig,
14294
14639
  plugins: [
@@ -14313,7 +14658,7 @@ function toFarmNodeResponse(request, response) {
14313
14658
  Array.from(routes, (route, index) => {
14314
14659
  try {
14315
14660
  return [decodeURI(route), index];
14316
- } catch (e39) {
14661
+ } catch (e40) {
14317
14662
  return [route, index];
14318
14663
  }
14319
14664
  })
@@ -14327,7 +14672,7 @@ function toFarmNodeResponse(request, response) {
14327
14672
  let skippedNonHtmlPrerenderRoute = false;
14328
14673
  nitroInstance.hooks.hook("prerender:generate", (route) => {
14329
14674
  if (route.error || !prerenderPagePaths.has(route.route)) return;
14330
- if (_optionalChain([route, 'access', _330 => _330.contentType, 'optionalAccess', _331 => _331.toLowerCase, 'call', _332 => _332(), 'access', _333 => _333.includes, 'call', _334 => _334("html")])) return;
14675
+ if (_optionalChain([route, 'access', _320 => _320.contentType, 'optionalAccess', _321 => _321.toLowerCase, 'call', _322 => _322(), 'access', _323 => _323.includes, 'call', _324 => _324("html")])) return;
14331
14676
  route.skip = true;
14332
14677
  skippedNonHtmlPrerenderRoute = true;
14333
14678
  const configuredRule = configuredNitroRouteRules[route.route];
@@ -14338,9 +14683,9 @@ function toFarmNodeResponse(request, response) {
14338
14683
  nitroInstance.hooks.hook("prerender:done", () => {
14339
14684
  if (skippedNonHtmlPrerenderRoute) nitroInstance.routing.sync();
14340
14685
  });
14341
- if (_optionalChain([config, 'access', _335 => _335.md, 'optionalAccess', _336 => _336.enabled])) {
14686
+ if (_optionalChain([config, 'access', _325 => _325.md, 'optionalAccess', _326 => _326.enabled])) {
14342
14687
  nitroInstance.hooks.hook("prerender:generate", (route) => {
14343
- if (!route.contents || !_optionalChain([route, 'access', _337 => _337.contentType, 'optionalAccess', _338 => _338.toLowerCase, 'call', _339 => _339(), 'access', _340 => _340.includes, 'call', _341 => _341("html")])) return;
14688
+ if (!route.contents || !_optionalChain([route, 'access', _327 => _327.contentType, 'optionalAccess', _328 => _328.toLowerCase, 'call', _329 => _329(), 'access', _330 => _330.includes, 'call', _331 => _331("html")])) return;
14344
14689
  const alternatePath = _chunk2NOHVIJ3cjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route, {
14345
14690
  routePathname: (pathname) => routeManager.toRoutePathname(pathname)
14346
14691
  });
@@ -14363,7 +14708,7 @@ function toFarmNodeResponse(request, response) {
14363
14708
  }
14364
14709
  if (config.security.csp && config.security.csp.nonce) {
14365
14710
  nitroInstance.hooks.hook("prerender:generate", async (route) => {
14366
- if (!route.contents || !_optionalChain([route, 'access', _342 => _342.contentType, 'optionalAccess', _343 => _343.toLowerCase, 'call', _344 => _344(), 'access', _345 => _345.includes, 'call', _346 => _346("html")])) return;
14711
+ if (!route.contents || !_optionalChain([route, 'access', _332 => _332.contentType, 'optionalAccess', _333 => _333.toLowerCase, 'call', _334 => _334(), 'access', _335 => _335.includes, 'call', _336 => _336("html")])) return;
14367
14712
  const staticCsp = await _chunk6JHZPB52cjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
14368
14713
  if (!staticCsp) return;
14369
14714
  route.contents = staticCsp.html;
@@ -14399,7 +14744,7 @@ function toFarmNodeResponse(request, response) {
14399
14744
  await nitroBuilder.copyPublicAssets(nitroInstance);
14400
14745
  if (prerenderReusesPrebuiltSSR && !canReusePrebuiltSSR) {
14401
14746
  nitroInstance.hooks.hook("prerender:config", (prerendererConfig) => {
14402
- const configuredPlugins = _optionalChain([prerendererConfig, 'access', _347 => _347.rollupConfig, 'optionalAccess', _348 => _348.plugins]);
14747
+ const configuredPlugins = _optionalChain([prerendererConfig, 'access', _337 => _337.rollupConfig, 'optionalAccess', _338 => _338.plugins]);
14403
14748
  const plugins = Array.isArray(configuredPlugins) ? configuredPlugins : configuredPlugins ? [configuredPlugins] : [];
14404
14749
  prerendererConfig.rollupConfig = {
14405
14750
  ...prerendererConfig.rollupConfig,
@@ -14456,13 +14801,13 @@ function toFarmNodeResponse(request, response) {
14456
14801
  }
14457
14802
  if (prerenderRoutes.length > 0) {
14458
14803
  _chunk7U4XF76Rcjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
14459
- const previousPrerender = process.env[_chunkW6C3LEXXcjs.FARM_PRERENDER_ENV];
14460
- process.env[_chunkW6C3LEXXcjs.FARM_PRERENDER_ENV] = "1";
14804
+ const previousPrerender = process.env[_chunkOM6JIIJUcjs.FARM_PRERENDER_ENV];
14805
+ process.env[_chunkOM6JIIJUcjs.FARM_PRERENDER_ENV] = "1";
14461
14806
  try {
14462
14807
  await nitroBuilder.prerender(nitroInstance);
14463
14808
  } finally {
14464
- if (previousPrerender === void 0) delete process.env[_chunkW6C3LEXXcjs.FARM_PRERENDER_ENV];
14465
- else process.env[_chunkW6C3LEXXcjs.FARM_PRERENDER_ENV] = previousPrerender;
14809
+ if (previousPrerender === void 0) delete process.env[_chunkOM6JIIJUcjs.FARM_PRERENDER_ENV];
14810
+ else process.env[_chunkOM6JIIJUcjs.FARM_PRERENDER_ENV] = previousPrerender;
14466
14811
  }
14467
14812
  }
14468
14813
  const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs5, preset) : Promise.resolve(null);
@@ -14639,7 +14984,7 @@ async function moveVercelOutputPath(src, dest, fs5) {
14639
14984
  await fs5.rename(src, dest);
14640
14985
  return;
14641
14986
  } catch (error) {
14642
- const code = _optionalChain([error, 'optionalAccess', _349 => _349.code]);
14987
+ const code = _optionalChain([error, 'optionalAccess', _339 => _339.code]);
14643
14988
  if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
14644
14989
  throw error;
14645
14990
  }
@@ -14665,7 +15010,7 @@ async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflo
14665
15010
  try {
14666
15011
  await moveVercelOutputPath(publicDir, staticDir, fs5);
14667
15012
  } catch (error) {
14668
- if (_optionalChain([error, 'optionalAccess', _350 => _350.code]) !== "ENOENT") throw error;
15013
+ if (_optionalChain([error, 'optionalAccess', _340 => _340.code]) !== "ENOENT") throw error;
14669
15014
  }
14670
15015
  await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5);
14671
15016
  await copyPrismaClientForVercel(root, nitroFuncDir, fs5);
@@ -14679,7 +15024,7 @@ async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflo
14679
15024
  config.basePath
14680
15025
  );
14681
15026
  const edgeMiddlewareRoutes = edgeMiddleware.middlewareRoutes.filter(
14682
- (route) => edgeMiddleware.guardedPages.some((pathname) => _chunkOFVCWV2Dcjs.appMiddlewareMayHandlePath.call(void 0, [route], pathname))
15027
+ (route) => edgeMiddleware.guardedPages.some((pathname) => _chunkNEKO3HM2cjs.appMiddlewareMayHandlePath.call(void 0, [route], pathname))
14683
15028
  );
14684
15029
  if (edgeMiddlewareRoutes.length > 0) {
14685
15030
  await writeFarmVercelEdgeMiddlewareFunction({
@@ -14702,12 +15047,12 @@ async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflo
14702
15047
  vercelConfig,
14703
15048
  farmWorkflows.workflows
14704
15049
  );
14705
- const vercelConfigWithCrons = _chunk5ZHC6QGDcjs.applyFarmCronVercelCrons.call(void 0, vercelConfigWithWorkflowCrons, cronJobs);
15050
+ const vercelConfigWithCrons = _chunkHQKCSJEHcjs.applyFarmCronVercelCrons.call(void 0, vercelConfigWithWorkflowCrons, cronJobs);
14706
15051
  await fs5.writeFile(configPath, JSON.stringify(vercelConfigWithCrons, null, 2));
14707
15052
  _chunk7U4XF76Rcjs.logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
14708
15053
  }
14709
15054
  async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5) {
14710
- if (!_optionalChain([config, 'access', _351 => _351.docs, 'optionalAccess', _352 => _352.enabled])) return;
15055
+ if (!_optionalChain([config, 'access', _341 => _341.docs, 'optionalAccess', _342 => _342.enabled])) return;
14711
15056
  const [mainRoot, ...extraRoots] = _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs);
14712
15057
  await copyFarmDocsRootContent(
14713
15058
  mainRoot,
@@ -14732,7 +15077,7 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
14732
15077
  const lastModifiedManifest = _chunkHR5GU4UUcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
14733
15078
  fallback: "now"
14734
15079
  });
14735
- const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access', _353 => _353.unknown, 'optionalAccess', _354 => _354.length]), () => ( 0));
15080
+ const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access', _343 => _343.unknown, 'optionalAccess', _344 => _344.length]), () => ( 0));
14736
15081
  if (undatedPages > 0) {
14737
15082
  _chunk7U4XF76Rcjs.logger.warn(
14738
15083
  `${undatedPages} docs page(s) were last changed before this shallow clone's Git history, so they show no "Last updated" date. Build from a full clone (git fetch --unshallow) or set lastModified in the page's frontmatter.`
@@ -14772,7 +15117,7 @@ async function stageSharpRuntime(config, root, distDir, fs5, preset) {
14772
15117
  if (!resolvePackageJson(projectRequire, "sharp")) {
14773
15118
  try {
14774
15119
  sharpRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
14775
- } catch (e40) {
15120
+ } catch (e41) {
14776
15121
  }
14777
15122
  }
14778
15123
  const copiedPackages = /* @__PURE__ */ new Map();
@@ -14817,7 +15162,7 @@ async function stageSharpRuntime(config, root, distDir, fs5, preset) {
14817
15162
  try {
14818
15163
  await copyPackage("sharp", sharpRequire);
14819
15164
  if (!copiedPackages.has("sharp")) {
14820
- throw new Error(`Farm image optimization requires sharp. ${_chunkCL7BUGVBcjs.SHARP_INSTALL_HINT}`);
15165
+ throw new Error(`Farm image optimization requires sharp. ${_chunkJHRJ5V2Fcjs.SHARP_INSTALL_HINT}`);
14821
15166
  }
14822
15167
  } catch (error) {
14823
15168
  await fs5.rm(stageDir, { recursive: true, force: true });
@@ -14899,7 +15244,7 @@ function resolveMetadataImageRuntimePackageJson(root) {
14899
15244
  if (packageJsonPath) return packageJsonPath;
14900
15245
  try {
14901
15246
  return resolvePackageJson(_module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core")), "@vercel/og");
14902
- } catch (e41) {
15247
+ } catch (e42) {
14903
15248
  return null;
14904
15249
  }
14905
15250
  }
@@ -14946,7 +15291,7 @@ function resolvePackageJson(parentRequire, packageName) {
14946
15291
  const resolved = parentRequire.resolve(request);
14947
15292
  if (resolved.endsWith(".json")) return resolved;
14948
15293
  _nullishCoalesce(metadataModule, () => ( (metadataModule = resolved)));
14949
- } catch (e42) {
15294
+ } catch (e43) {
14950
15295
  }
14951
15296
  }
14952
15297
  try {
@@ -14957,13 +15302,13 @@ function resolvePackageJson(parentRequire, packageName) {
14957
15302
  try {
14958
15303
  const manifest = JSON.parse(_fs.readFileSync.call(void 0, candidate, "utf8"));
14959
15304
  if (manifest.name === packageName) return candidate;
14960
- } catch (e43) {
15305
+ } catch (e44) {
14961
15306
  }
14962
15307
  }
14963
15308
  if (_path2.default.basename(directory) === "node_modules") break;
14964
15309
  directory = _path2.default.dirname(directory);
14965
15310
  }
14966
- } catch (e44) {
15311
+ } catch (e45) {
14967
15312
  }
14968
15313
  return null;
14969
15314
  }
@@ -14974,7 +15319,7 @@ async function resolveProjectInstalledPackageDir(root, packageName, fs5) {
14974
15319
  try {
14975
15320
  const packageDir = await fs5.realpath(candidate);
14976
15321
  if ((await fs5.stat(_path2.default.join(packageDir, "package.json"))).isFile()) return packageDir;
14977
- } catch (e45) {
15322
+ } catch (e46) {
14978
15323
  }
14979
15324
  const parent = _path2.default.dirname(directory);
14980
15325
  if (parent === directory) return null;
@@ -14988,7 +15333,7 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs5) {
14988
15333
  const generatedClientDir = _path2.default.join(prismaClientDir, "..", "..", ".prisma", "client");
14989
15334
  try {
14990
15335
  await fs5.access(generatedClientDir);
14991
- } catch (e46) {
15336
+ } catch (e47) {
14992
15337
  return;
14993
15338
  }
14994
15339
  const targetNodeModules = _path2.default.join(nitroFuncDir, "node_modules");
@@ -15050,7 +15395,7 @@ async function createFarmProjectModuleSsrEnvironment() {
15050
15395
  // src/build/index.ts
15051
15396
  async function build(config, options = {}) {
15052
15397
  return _chunkNG2EZ6QScjs.withProductionNodeEnv.call(void 0,
15053
- () => _chunk46UV2E7Icjs.withPackageClientBoundaryCache.call(void 0, () => buildWithProductionNodeEnv(config, options))
15398
+ () => _chunkEFI6QWBQcjs.withPackageClientBoundaryCache.call(void 0, () => buildWithProductionNodeEnv(config, options))
15054
15399
  );
15055
15400
  }
15056
15401
  function createBuildTargetBaseline(config) {
@@ -15061,7 +15406,7 @@ function createBuildTargetBaseline(config) {
15061
15406
  preset,
15062
15407
  distDir,
15063
15408
  outputDir,
15064
- outputWasDerived: outputDir === _chunkMOGRRZMWcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
15409
+ outputWasDerived: outputDir === _chunk55UJGUBPcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
15065
15410
  };
15066
15411
  }
15067
15412
  function resolveBuildTargets(config, options, baseline) {
@@ -15070,8 +15415,8 @@ function resolveBuildTargets(config, options, baseline) {
15070
15415
  const distDir = config.distDir || ".farm";
15071
15416
  const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
15072
15417
  const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
15073
- const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkMOGRRZMWcjs.getDeployTargetForPreset.call(void 0, preset);
15074
- const outputDir = shouldRefreshDerivedOutput ? _chunkMOGRRZMWcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
15418
+ const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunk55UJGUBPcjs.getDeployTargetForPreset.call(void 0, preset);
15419
+ const outputDir = shouldRefreshDerivedOutput ? _chunk55UJGUBPcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
15075
15420
  return {
15076
15421
  root,
15077
15422
  preset,
@@ -15079,7 +15424,7 @@ function resolveBuildTargets(config, options, baseline) {
15079
15424
  distDir,
15080
15425
  deployTarget,
15081
15426
  outputDir,
15082
- deployOutputDir: _chunkMOGRRZMWcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
15427
+ deployOutputDir: _chunk55UJGUBPcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
15083
15428
  };
15084
15429
  }
15085
15430
  async function buildWithProductionNodeEnv(inputConfig, options) {
@@ -15087,7 +15432,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
15087
15432
  const targetBaseline = createBuildTargetBaseline(config);
15088
15433
  let targets;
15089
15434
  const productionViteResultPromise = options.universal === false ? void 0 : Promise.allSettled([Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkMF3IA2AWcjs.loadFarmProductionVite.call(void 0, ))))]);
15090
- const pluginManager = new (0, _chunkTCMRLW3Kcjs.PluginManager)({
15435
+ const pluginManager = new (0, _chunkVACYUMXWcjs.PluginManager)({
15091
15436
  config,
15092
15437
  isDev: false,
15093
15438
  isProd: true
@@ -15116,15 +15461,15 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
15116
15461
  };
15117
15462
  config = {
15118
15463
  ...config,
15119
- images: _chunkCL7BUGVBcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
15464
+ images: _chunkJHRJ5V2Fcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
15120
15465
  root: targets.root,
15121
15466
  preset: targets.preset
15122
15467
  })
15123
15468
  };
15124
- if (_optionalChain([config, 'access', _355 => _355.docs, 'optionalAccess', _356 => _356.enabled])) await _chunkNDOE76QCcjs.loadFarmDocsEngine.call(void 0, );
15469
+ if (_optionalChain([config, 'access', _345 => _345.docs, 'optionalAccess', _346 => _346.enabled])) await _chunkNDOE76QCcjs.loadFarmDocsEngine.call(void 0, );
15125
15470
  pluginManager.updateContext({ config });
15126
15471
  const { root, preset, srcDir, distDir, deployOutputDir } = targets;
15127
- _chunk46UV2E7Icjs.usePackageClientBoundaryCacheFile.call(void 0, _chunk46UV2E7Icjs.resolvePackageClientBoundaryCacheFile.call(void 0, root, distDir));
15472
+ _chunkEFI6QWBQcjs.usePackageClientBoundaryCacheFile.call(void 0, _chunkEFI6QWBQcjs.resolvePackageClientBoundaryCacheFile.call(void 0, root, distDir));
15128
15473
  _chunk7U4XF76Rcjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
15129
15474
  await pluginManager.setupPlugins();
15130
15475
  await pluginManager.runHookParallel("beforeBundle", {
@@ -15136,8 +15481,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
15136
15481
  });
15137
15482
  _chunk7U4XF76Rcjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
15138
15483
  const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
15139
- if (_optionalChain([productionViteResult, 'optionalAccess', _357 => _357.status]) === "rejected") throw productionViteResult.reason;
15140
- const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _358 => _358.value]);
15484
+ if (_optionalChain([productionViteResult, 'optionalAccess', _347 => _347.status]) === "rejected") throw productionViteResult.reason;
15485
+ const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _348 => _348.value]);
15141
15486
  const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
15142
15487
  projectModuleServer = await createProjectModuleServer(
15143
15488
  createViteServer,
@@ -15145,29 +15490,30 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
15145
15490
  root,
15146
15491
  rendererBuild.signal
15147
15492
  );
15148
- const farmApp = _chunkCL7BUGVBcjs.createFarmApp.call(void 0, config, projectModuleServer);
15493
+ const farmApp = _chunkJHRJ5V2Fcjs.createFarmApp.call(void 0, config, projectModuleServer);
15149
15494
  if (options.universal !== false) farmApp.getRouteManager().keepBuildSourceSnapshot();
15150
15495
  await farmApp.initialize();
15151
15496
  const routeManager = farmApp.getRouteManager();
15152
15497
  const serverRenderer = farmApp.getServerRenderer();
15153
- const typeArtifacts = _chunkOUDNUFVRcjs.generateFarmTypeArtifacts.call(void 0, {
15498
+ const typeArtifacts = _chunkHRH7OKBQcjs.generateFarmTypeArtifacts.call(void 0, {
15154
15499
  root,
15155
15500
  srcDir,
15156
15501
  layers: config.layers,
15157
15502
  storage: config.storage,
15158
15503
  plugins: config.plugins,
15159
15504
  extraRoutes: [
15160
- ..._optionalChain([config, 'access', _359 => _359.openapi, 'optionalAccess', _360 => _360.enabled]) && config.openapi.route ? [config.openapi.route] : [],
15505
+ ..._optionalChain([config, 'access', _349 => _349.openapi, 'optionalAccess', _350 => _350.enabled]) && config.openapi.route ? [config.openapi.route] : [],
15161
15506
  ..._chunkHR5GU4UUcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
15162
15507
  ],
15163
15508
  suppressLintOnLink: config.suppressLintOnLink,
15164
15509
  componentExtensions: config.renderer.componentExtensions,
15510
+ renderer: config.renderer,
15165
15511
  i18nConfig: config.i18n
15166
15512
  }).catch((error) => {
15167
15513
  const message = error instanceof Error ? error.message : String(error);
15168
15514
  _chunk7U4XF76Rcjs.logger.warn(`Route type generation failed (farm.d.ts may be stale): ${message}`);
15169
15515
  });
15170
- const apiRouteManager = new (0, _chunkLKIG5SM6cjs.APIRouteManager)(
15516
+ const apiRouteManager = new (0, _chunk5P65LXGUcjs.APIRouteManager)(
15171
15517
  _chunk52Q4OB4Acjs.getFarmAppDirectories.call(void 0, config),
15172
15518
  projectModuleServer,
15173
15519
  {
@@ -15242,7 +15588,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
15242
15588
  throw error;
15243
15589
  } finally {
15244
15590
  try {
15245
- await _optionalChain([projectModuleServer, 'optionalAccess', _361 => _361.close, 'call', _362 => _362()]);
15591
+ await _optionalChain([projectModuleServer, 'optionalAccess', _351 => _351.close, 'call', _352 => _352()]);
15246
15592
  } finally {
15247
15593
  rendererBuild.abort();
15248
15594
  }
@@ -15250,11 +15596,11 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
15250
15596
  }
15251
15597
  async function createProjectModuleServer(createViteServer, config, root, buildLifetime) {
15252
15598
  const { farmNavigationPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
15253
- const rendererVitePlugins = await _chunkM6DAIE4Tcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
15599
+ const rendererVitePlugins = await _chunkNGTZHWBGcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
15254
15600
  ssr: true,
15255
15601
  buildLifetime
15256
15602
  });
15257
- const viteConfig = _chunkCL7BUGVBcjs.mergeFarmViteConfig.call(void 0,
15603
+ const viteConfig = _chunkJHRJ5V2Fcjs.mergeFarmViteConfig.call(void 0,
15258
15604
  {
15259
15605
  root,
15260
15606
  appType: "custom",
@@ -15266,12 +15612,12 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
15266
15612
  },
15267
15613
  plugins: [
15268
15614
  ...rendererVitePlugins,
15269
- _chunkCL7BUGVBcjs.farmFontImportsPlugin.call(void 0, {
15615
+ _chunkJHRJ5V2Fcjs.farmFontImportsPlugin.call(void 0, {
15270
15616
  root,
15271
15617
  basePath: config.basePath,
15272
15618
  publicDir: config.publicDir
15273
15619
  }),
15274
- _chunk46UV2E7Icjs.farmEnvironmentFunctionsPlugin.call(void 0, { renderer: config.renderer }),
15620
+ _chunkEFI6QWBQcjs.farmEnvironmentFunctionsPlugin.call(void 0, { renderer: config.renderer }),
15275
15621
  // Route modules load here at build time (rendering config, prerendering): `server-only`
15276
15622
  // resolves as it does in the server build. Module-entry packages load pre-bundled, as in
15277
15623
  // `farm dev`: unbundled, lucide-react alone is ~1,750 modules through the module runner,
@@ -15287,7 +15633,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
15287
15633
  hmr: false
15288
15634
  },
15289
15635
  resolve: {
15290
- alias: _chunkCL7BUGVBcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
15636
+ alias: _chunkJHRJ5V2Fcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
15291
15637
  dedupe: [...config.renderer.dedupe || []]
15292
15638
  },
15293
15639
  optimizeDeps: {
@@ -15326,10 +15672,10 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
15326
15672
  noDiscovery: true
15327
15673
  },
15328
15674
  // An app or plugin that brings its own SSR environment keeps it.
15329
- environments: _optionalChain([viteConfig, 'access', _363 => _363.environments, 'optionalAccess', _364 => _364.ssr, 'optionalAccess', _365 => _365.dev, 'optionalAccess', _366 => _366.createEnvironment]) ? viteConfig.environments : {
15675
+ environments: _optionalChain([viteConfig, 'access', _353 => _353.environments, 'optionalAccess', _354 => _354.ssr, 'optionalAccess', _355 => _355.dev, 'optionalAccess', _356 => _356.createEnvironment]) ? viteConfig.environments : {
15330
15676
  ...viteConfig.environments,
15331
15677
  ssr: {
15332
- ..._optionalChain([viteConfig, 'access', _367 => _367.environments, 'optionalAccess', _368 => _368.ssr]),
15678
+ ..._optionalChain([viteConfig, 'access', _357 => _357.environments, 'optionalAccess', _358 => _358.ssr]),
15333
15679
  ...await createFarmProjectModuleSsrEnvironment()
15334
15680
  }
15335
15681
  }
@@ -15343,7 +15689,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
15343
15689
  farmPlugin,
15344
15690
  farmServerOnlyEntriesPlugin
15345
15691
  } = await import("./vite.cjs");
15346
- const { PluginManager: PluginManager2 } = await import("./plugin-LN3JBZRR.cjs");
15692
+ const { PluginManager: PluginManager2 } = await import("./plugin-3PT7I26P.cjs");
15347
15693
  const pluginManager = new PluginManager2({
15348
15694
  config,
15349
15695
  isDev: false,
@@ -15365,14 +15711,14 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
15365
15711
  farmNavigationPlugin(config.renderer),
15366
15712
  farmIslandContainersPlugin(config),
15367
15713
  farmPlugin(config, pluginManager),
15368
- _chunk46UV2E7Icjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
15714
+ _chunkEFI6QWBQcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
15369
15715
  ],
15370
15716
  mode: "production"
15371
15717
  });
15372
15718
  }
15373
15719
  async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
15374
15720
  const { farmI18nClientBridgePlugin, farmIslandContainersPlugin, farmPlugin } = await import("./vite.cjs");
15375
- const { PluginManager: PluginManager2 } = await import("./plugin-LN3JBZRR.cjs");
15721
+ const { PluginManager: PluginManager2 } = await import("./plugin-3PT7I26P.cjs");
15376
15722
  const pluginManager = new PluginManager2({
15377
15723
  config,
15378
15724
  isDev: false,
@@ -15393,20 +15739,20 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
15393
15739
  define: {
15394
15740
  __FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
15395
15741
  __FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
15396
- __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _369 => _369.env, 'optionalAccess', _370 => _370.public]) || {})
15742
+ __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _359 => _359.env, 'optionalAccess', _360 => _360.public]) || {})
15397
15743
  },
15398
15744
  plugins: [
15399
15745
  farmI18nClientBridgePlugin(),
15400
15746
  farmIslandContainersPlugin(config),
15401
15747
  farmPlugin(config, pluginManager),
15402
- _chunk46UV2E7Icjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
15748
+ _chunkEFI6QWBQcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
15403
15749
  ],
15404
15750
  mode: "production"
15405
15751
  });
15406
15752
  }
15407
15753
  function resolveLegacyPageEntry(config, root, srcDir) {
15408
15754
  const appDir = _path2.default.join(root, srcDir, "app");
15409
- for (const extension of _chunkM6DAIE4Tcjs.getFarmRendererComponentExtensions.call(void 0, config.renderer)) {
15755
+ for (const extension of _chunkNGTZHWBGcjs.getFarmRendererComponentExtensions.call(void 0, config.renderer)) {
15410
15756
  const candidate = _path2.default.join(appDir, `page${extension}`);
15411
15757
  if (_fs.existsSync.call(void 0, candidate)) return candidate;
15412
15758
  }
@@ -15414,7 +15760,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
15414
15760
  }
15415
15761
  async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
15416
15762
  const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
15417
- import("./nitro-XGIO6EQN.cjs"),
15763
+ import("./nitro-YDFMH5PY.cjs"),
15418
15764
  import("nitro/builder")
15419
15765
  ]);
15420
15766
  let nitroConfig = await createNitroConfig(
@@ -15427,7 +15773,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
15427
15773
  if (pluginManager) {
15428
15774
  nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
15429
15775
  }
15430
- const outputDir = _chunkMOGRRZMWcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
15776
+ const outputDir = _chunk55UJGUBPcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
15431
15777
  const serverOutputDir = _path2.default.join(outputDir, "server");
15432
15778
  const publicOutputDir = _path2.default.join(outputDir, "public");
15433
15779
  const { mkdir, cp } = await import("fs/promises");
@@ -15486,7 +15832,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
15486
15832
  const { readFile: readFile2 } = await import("fs/promises");
15487
15833
  const manifestContent = await readFile2(clientManifestPath, "utf-8");
15488
15834
  farmRegistry.clientManifest = JSON.parse(manifestContent);
15489
- } catch (e47) {
15835
+ } catch (e48) {
15490
15836
  farmRegistry.clientManifest = {};
15491
15837
  }
15492
15838
  } catch (error) {
@@ -15498,7 +15844,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
15498
15844
  root,
15499
15845
  preset,
15500
15846
  distDir,
15501
- outputDir: _chunkMOGRRZMWcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
15847
+ outputDir: _chunk55UJGUBPcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
15502
15848
  });
15503
15849
  }
15504
15850
  }