@farm.js/core 0.1.51-beta.3 → 0.1.60

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 (320) hide show
  1. package/dist/{agent-mcp-handler-7JSKGSOW.mjs → agent-mcp-handler-7QMX2LUY.mjs} +7 -7
  2. package/dist/agent-mcp-handler-OV4WRFBL.cjs +18 -0
  3. package/dist/{agent-mcp.d-BJKChOrO.d.mts → agent-mcp.d-C-2S9bnP.d.mts} +1 -1
  4. package/dist/{agent-mcp.d-BAR9njbJ.d.ts → agent-mcp.d-SIoCUP1I.d.ts} +1 -1
  5. package/dist/agent-runtime.cjs +5 -5
  6. package/dist/agent-runtime.d.mts +2 -2
  7. package/dist/agent-runtime.d.ts +2 -2
  8. package/dist/agent-runtime.mjs +4 -4
  9. package/dist/{analyzer-OTPEWH5W.mjs → analyzer-22BEYV7S.mjs} +116 -13
  10. package/dist/{analyzer-TSQXZCZN.cjs → analyzer-LCSI3NSH.cjs} +123 -20
  11. package/dist/api/client.cjs +5 -4
  12. package/dist/api/client.d.mts +1 -1
  13. package/dist/api/client.d.ts +1 -1
  14. package/dist/api/client.mjs +3 -2
  15. package/dist/api/client.native.cjs +45 -0
  16. package/dist/api/client.native.d.mts +23 -0
  17. package/dist/api/client.native.d.ts +23 -0
  18. package/dist/api/client.native.mjs +45 -0
  19. package/dist/api/route-manager.cjs +7 -7
  20. package/dist/api/route-manager.d.mts +4 -4
  21. package/dist/api/route-manager.d.ts +4 -4
  22. package/dist/api/route-manager.mjs +6 -6
  23. package/dist/api/runtime.cjs +5 -5
  24. package/dist/api/runtime.d.mts +3 -3
  25. package/dist/api/runtime.d.ts +3 -3
  26. package/dist/api/runtime.mjs +4 -4
  27. package/dist/{api-client.d-CeA6tNA6.d.mts → api-client.d-BNLXNCXJ.d.mts} +1 -1
  28. package/dist/{api-client.d-BWcqZciH.d.ts → api-client.d-ddQBNGtu.d.ts} +1 -1
  29. package/dist/api.cjs +11 -11
  30. package/dist/api.d.mts +5 -5
  31. package/dist/api.d.ts +5 -5
  32. package/dist/api.mjs +10 -10
  33. package/dist/{app-manifest.d-DEQNnNhV.d.mts → app-manifest.d-DrSAHskY.d.mts} +1 -1
  34. package/dist/{app-manifest.d-BLFbaqx8.d.ts → app-manifest.d-Tb3CJpL4.d.ts} +1 -1
  35. package/dist/app-markdown.cjs +7 -7
  36. package/dist/app-markdown.d.mts +3 -3
  37. package/dist/app-markdown.d.ts +3 -3
  38. package/dist/app-markdown.mjs +6 -6
  39. package/dist/{app.d-CNPaUYaa.d.ts → app.d-CmWlYpZJ.d.ts} +9 -4
  40. package/dist/{app.d-CT7xDkj2.d.mts → app.d-D6QQM_kk.d.mts} +9 -4
  41. package/dist/{chunk-SN5VSO3Q.mjs → chunk-25T5VXOE.mjs} +7 -9
  42. package/dist/{chunk-OAMUSC7H.cjs → chunk-2FRLSDBT.cjs} +1 -1
  43. package/dist/{chunk-LM2YOGDK.mjs → chunk-2I6PUKWJ.mjs} +1 -1
  44. package/dist/{chunk-ZD2VKAUI.mjs → chunk-2KTYMMWT.mjs} +1 -1
  45. package/dist/{chunk-B5BBTPJQ.cjs → chunk-2OF5RPVU.cjs} +14 -14
  46. package/dist/{chunk-UQF3OJVE.mjs → chunk-37PYUEK5.mjs} +173 -29
  47. package/dist/{chunk-VSLM6BHX.cjs → chunk-3OJNNCDL.cjs} +9 -9
  48. package/dist/{chunk-X3JNB2TB.mjs → chunk-3PX4AIXO.mjs} +36 -5
  49. package/dist/{chunk-UQHIWZZ6.cjs → chunk-3TL3AH25.cjs} +12 -6
  50. package/dist/chunk-3YMLUNL2.cjs +251 -0
  51. package/dist/chunk-4JTQPOKO.cjs +137 -0
  52. package/dist/{chunk-7MD37P5V.cjs → chunk-4P23B7DU.cjs} +5 -5
  53. package/dist/{chunk-3BLEXUGE.mjs → chunk-55U5QIXQ.mjs} +1 -1
  54. package/dist/{chunk-TWHXBMLJ.cjs → chunk-5JNUYGNF.cjs} +4 -4
  55. package/dist/{chunk-53SACYBY.cjs → chunk-6BJJYOFL.cjs} +7 -7
  56. package/dist/chunk-6UUH4N4J.mjs +251 -0
  57. package/dist/{chunk-2NHOYYUT.mjs → chunk-7H45IJWO.mjs} +2 -2
  58. package/dist/{chunk-NN3MOPSI.mjs → chunk-A2MN5PQJ.mjs} +7 -7
  59. package/dist/{chunk-KY32FWK7.mjs → chunk-BHJAYPYU.mjs} +2 -2
  60. package/dist/{chunk-VAHBCI6X.mjs → chunk-BQWBHWEW.mjs} +26 -1
  61. package/dist/{chunk-KJMWAUKE.mjs → chunk-C7GJDVN4.mjs} +1 -1
  62. package/dist/{chunk-OYNNA4DD.cjs → chunk-CBKRS3M4.cjs} +9 -9
  63. package/dist/{chunk-I2DQGS56.cjs → chunk-CBOEJ5Z4.cjs} +39 -41
  64. package/dist/{chunk-UJL4JOXV.cjs → chunk-CI4UNQHO.cjs} +2 -2
  65. package/dist/{chunk-S5AQ7CAC.cjs → chunk-CNNBFGL5.cjs} +39 -14
  66. package/dist/chunk-D2X5MUF5.cjs +1457 -0
  67. package/dist/{chunk-LEIXUFJN.cjs → chunk-D4MRNBVF.cjs} +10 -9
  68. package/dist/{chunk-2KVDHNQS.mjs → chunk-D7LTCK3U.mjs} +2 -2
  69. package/dist/{chunk-4SEHMBL4.cjs → chunk-DPJ66FSI.cjs} +22 -22
  70. package/dist/{chunk-FFE2EMF7.cjs → chunk-DZPR2W6U.cjs} +5 -5
  71. package/dist/{chunk-3Z63X45F.mjs → chunk-E72UD6ME.mjs} +1 -1
  72. package/dist/{chunk-XXXRRVY6.mjs → chunk-EGVC4LIG.mjs} +5 -5
  73. package/dist/{chunk-72NBDVWQ.mjs → chunk-EXUONJYV.mjs} +3 -3
  74. package/dist/{chunk-VS7EHLLW.mjs → chunk-EZ34EHQP.mjs} +1 -1
  75. package/dist/{chunk-5FXPJIOT.mjs → chunk-F6Y7ZAPQ.mjs} +2 -2
  76. package/dist/{chunk-LMFJCXDD.mjs → chunk-FN5UEC7I.mjs} +1 -1
  77. package/dist/{chunk-3SMXQNFD.mjs → chunk-FORSVMEJ.mjs} +2 -2
  78. package/dist/{chunk-R4PHCZ3G.mjs → chunk-HPWB57PZ.mjs} +1 -1
  79. package/dist/{chunk-Y2G5SJFB.mjs → chunk-IFHPDLIS.mjs} +1 -1
  80. package/dist/{chunk-3XQ57EFI.cjs → chunk-IFXSBJPN.cjs} +16 -16
  81. package/dist/{chunk-3WSIYBMG.mjs → chunk-ILMTRGBG.mjs} +279 -48
  82. package/dist/{chunk-HLWOWZFX.cjs → chunk-JBK7UJOI.cjs} +14 -11
  83. package/dist/chunk-JI5D7MXY.mjs +137 -0
  84. package/dist/{chunk-QXJADAQB.cjs → chunk-JIBEFLQ7.cjs} +6 -2
  85. package/dist/{chunk-LZ4SB57H.mjs → chunk-JPIUGDK4.mjs} +1 -1
  86. package/dist/{chunk-Y3N5BFRJ.mjs → chunk-JSDV2NUN.mjs} +1 -1
  87. package/dist/{chunk-IRSS4HS4.mjs → chunk-K3RU5MOR.mjs} +1 -1
  88. package/dist/chunk-KPOMS5RO.cjs +237 -0
  89. package/dist/{chunk-YAJTD3ZG.mjs → chunk-KVW2M6PI.mjs} +1 -1
  90. package/dist/{chunk-5IONBVJY.cjs → chunk-LB3DPQP6.cjs} +22 -22
  91. package/dist/{chunk-CZ35L6PL.mjs → chunk-LJVNMGE3.mjs} +10 -4
  92. package/dist/{chunk-X2AMN2WV.cjs → chunk-LQNW3ABP.cjs} +10 -10
  93. package/dist/{chunk-6ONBZGVH.cjs → chunk-LRB5OVRT.cjs} +3 -3
  94. package/dist/{chunk-D7UQC4O6.cjs → chunk-LT4VAF5Z.cjs} +2 -2
  95. package/dist/{chunk-F6TLUMH7.mjs → chunk-M53MIIXY.mjs} +1 -1
  96. package/dist/{chunk-H33PJEXN.cjs → chunk-MEQN6DDA.cjs} +5 -5
  97. package/dist/{chunk-XLRLSTJ6.cjs → chunk-MGKW5XZE.cjs} +7 -7
  98. package/dist/{chunk-B3GZAQSC.cjs → chunk-MHLNWRCJ.cjs} +3 -3
  99. package/dist/{chunk-5ENW27SL.mjs → chunk-MMK4MZUN.mjs} +1 -1
  100. package/dist/{chunk-WGUHDWT5.cjs → chunk-MTWXOEI4.cjs} +527 -366
  101. package/dist/chunk-NHD7BAKD.mjs +1457 -0
  102. package/dist/{chunk-KLNFJDFM.cjs → chunk-NQJDO7K7.cjs} +31 -31
  103. package/dist/{chunk-TSFMFPRU.cjs → chunk-O27PLNQZ.cjs} +10 -10
  104. package/dist/{chunk-PIHKO25G.mjs → chunk-OM7WILES.mjs} +1 -1
  105. package/dist/{chunk-YUEYBL35.mjs → chunk-PCXIJKPM.mjs} +8 -8
  106. package/dist/{chunk-IWFV5ZED.cjs → chunk-PMJSG4JS.cjs} +1 -1
  107. package/dist/{chunk-B3GM5I6N.cjs → chunk-PRFNLQSP.cjs} +4 -4
  108. package/dist/{chunk-46KXZBOG.cjs → chunk-QAS7KE7J.cjs} +7 -7
  109. package/dist/chunk-QGOZLGVP.mjs +0 -0
  110. package/dist/{chunk-VQJYGZNX.cjs → chunk-QMNWKQL4.cjs} +1 -1
  111. package/dist/{chunk-XB24LZWI.cjs → chunk-QRX4JRBO.cjs} +3 -3
  112. package/dist/{chunk-LNM57D3H.cjs → chunk-R53QDV6T.cjs} +4 -4
  113. package/dist/{chunk-SUV6YO4Q.cjs → chunk-RAWWCDCT.cjs} +5 -5
  114. package/dist/{chunk-LJDIFIJ2.mjs → chunk-RPUJHJHE.mjs} +4 -4
  115. package/dist/{chunk-G2KTRMWA.mjs → chunk-RSEAX5MW.mjs} +4 -0
  116. package/dist/chunk-SJRCWF4Z.mjs +237 -0
  117. package/dist/{chunk-4353ZRE5.mjs → chunk-SX7EECTS.mjs} +8 -5
  118. package/dist/{chunk-LDNSSHEG.mjs → chunk-T4TBK5NY.mjs} +2 -2
  119. package/dist/{chunk-NOTSHVRN.mjs → chunk-T7I62A4C.mjs} +293 -132
  120. package/dist/{chunk-E36C43IX.cjs → chunk-U4BJKNIR.cjs} +6 -6
  121. package/dist/{chunk-4CGOMZP3.cjs → chunk-UDJY2ZGY.cjs} +487 -256
  122. package/dist/{chunk-SHS6KXOZ.mjs → chunk-UR25Z5Z6.mjs} +1 -1
  123. package/dist/{chunk-TQMI6BYO.cjs → chunk-UYSTTPYJ.cjs} +1262 -936
  124. package/dist/{chunk-E5DXF5GE.mjs → chunk-UZZ6IEQP.mjs} +3 -3
  125. package/dist/{chunk-EKJYE4Y7.cjs → chunk-VGG74PSU.cjs} +25 -25
  126. package/dist/{chunk-GAO7MS5O.mjs → chunk-VPTWKOCY.mjs} +19 -19
  127. package/dist/{chunk-UN6N623E.mjs → chunk-VQJHT2ND.mjs} +2 -2
  128. package/dist/{chunk-SJ23LJ3N.cjs → chunk-VVTJTMGQ.cjs} +3 -3
  129. package/dist/{chunk-KHXAJ2KA.cjs → chunk-W2RZ73IU.cjs} +12 -12
  130. package/dist/{chunk-JWI5PUO2.mjs → chunk-W2ZXMMHA.mjs} +2 -1
  131. package/dist/{chunk-BLD5GVCG.mjs → chunk-W6QLRQ3V.mjs} +1 -1
  132. package/dist/{chunk-AV26KHTG.mjs → chunk-X2CZTWQA.mjs} +2 -2
  133. package/dist/chunk-XPIPMWY3.cjs +1 -0
  134. package/dist/{chunk-JXEPLIXD.cjs → chunk-XTG73QZA.cjs} +183 -39
  135. package/dist/{chunk-XPMC4E2G.cjs → chunk-XVSBALOY.cjs} +3 -3
  136. package/dist/{chunk-XYL4HSVC.cjs → chunk-YI6FKTTN.cjs} +38 -7
  137. package/dist/{chunk-LPDKG6RA.mjs → chunk-YSXTNSXS.mjs} +1 -1
  138. package/dist/{chunk-EHB77D5U.cjs → chunk-ZDAEHG2O.cjs} +3 -3
  139. package/dist/{chunk-3TLKUBXG.mjs → chunk-ZFUKPWFC.mjs} +912 -586
  140. package/dist/{chunk-4TKAIO2F.mjs → chunk-ZMHAFH4R.mjs} +8 -8
  141. package/dist/{chunk-ZOWNWHK6.cjs → chunk-ZNH6NR3H.cjs} +2 -2
  142. package/dist/{chunk-PFV2KPDZ.cjs → chunk-ZOYKJBP5.cjs} +3 -3
  143. package/dist/{chunk-CECUDGXQ.cjs → chunk-ZP32GNJQ.cjs} +13 -13
  144. package/dist/{chunk-MRNDAJEV.mjs → chunk-ZZ2QKCKW.mjs} +1 -1
  145. package/dist/{client-plugins.d-DllmH8eM.d.mts → client-plugins.d-CgQQ-EAv.d.mts} +10 -2
  146. package/dist/{client-plugins.d-n3iWY1EJ.d.ts → client-plugins.d-vXrbcfJ1.d.ts} +10 -2
  147. package/dist/client-plugins.d.mts +2 -2
  148. package/dist/client-plugins.d.ts +2 -2
  149. package/dist/client.cjs +9 -9
  150. package/dist/client.d.mts +9 -9
  151. package/dist/client.d.ts +9 -9
  152. package/dist/client.mjs +9 -9
  153. package/dist/{config.d-DqKaCr1r.d.ts → config.d-DqZkLwef.d.mts} +139 -1
  154. package/dist/{config.d-DqKaCr1r.d.mts → config.d-DqZkLwef.d.ts} +139 -1
  155. package/dist/config.d.mts +2 -2
  156. package/dist/config.d.ts +2 -2
  157. package/dist/cron.cjs +3 -3
  158. package/dist/cron.d.mts +10 -0
  159. package/dist/cron.d.ts +10 -0
  160. package/dist/cron.mjs +2 -2
  161. package/dist/desktop.d.mts +3 -3
  162. package/dist/desktop.d.ts +3 -3
  163. package/dist/{devtools-UESYARTF.mjs → devtools-KQZ6SRCJ.mjs} +16 -16
  164. package/dist/{devtools-TO6TAO32.cjs → devtools-UF6JYHUN.cjs} +18 -18
  165. package/dist/docs.cjs +19 -19
  166. package/dist/docs.d.mts +3 -3
  167. package/dist/docs.d.ts +3 -3
  168. package/dist/docs.mjs +18 -18
  169. package/dist/index.cjs +96 -96
  170. package/dist/{index.d-BXsAXm1U.d.ts → index.d-DlCELfhf.d.ts} +1 -1
  171. package/dist/{index.d-BL7KKiwa.d.mts → index.d-Dmfb7Kb_.d.mts} +1 -1
  172. package/dist/index.d.mts +18 -18
  173. package/dist/index.d.ts +18 -18
  174. package/dist/index.mjs +139 -139
  175. package/dist/integrations.cjs +5 -5
  176. package/dist/integrations.d.mts +2 -2
  177. package/dist/integrations.d.ts +2 -2
  178. package/dist/integrations.mjs +4 -4
  179. package/dist/internal/app-markdown-runtime.cjs +6 -6
  180. package/dist/internal/app-markdown-runtime.d.mts +3 -3
  181. package/dist/internal/app-markdown-runtime.d.ts +3 -3
  182. package/dist/internal/app-markdown-runtime.mjs +5 -5
  183. package/dist/internal/build-runtime.cjs +50 -50
  184. package/dist/internal/build-runtime.d.mts +4 -4
  185. package/dist/internal/build-runtime.d.ts +4 -4
  186. package/dist/internal/build-runtime.mjs +49 -49
  187. package/dist/internal/cli-runtime.cjs +28 -28
  188. package/dist/internal/cli-runtime.mjs +28 -28
  189. package/dist/internal/client-error-overlay.cjs +4 -4
  190. package/dist/internal/client-error-overlay.mjs +1 -1
  191. package/dist/internal/client-runtime.cjs +20 -15
  192. package/dist/internal/client-runtime.d.mts +5 -5
  193. package/dist/internal/client-runtime.d.ts +5 -5
  194. package/dist/internal/client-runtime.mjs +8 -3
  195. package/dist/internal/compression-runtime.d.mts +2 -2
  196. package/dist/internal/compression-runtime.d.ts +2 -2
  197. package/dist/internal/config-runtime.cjs +18 -18
  198. package/dist/internal/config-runtime.d.mts +94 -6
  199. package/dist/internal/config-runtime.d.ts +94 -6
  200. package/dist/internal/config-runtime.mjs +17 -17
  201. package/dist/internal/infra-analytics-runtime.cjs +11 -11
  202. package/dist/internal/infra-analytics-runtime.mjs +9 -9
  203. package/dist/internal/islands-boot.cjs +211 -0
  204. package/dist/internal/islands-boot.d.mts +8 -0
  205. package/dist/internal/islands-boot.d.ts +8 -0
  206. package/dist/internal/islands-boot.mjs +211 -0
  207. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  208. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  209. package/dist/internal/production-runtime.cjs +37 -101
  210. package/dist/internal/production-runtime.d.mts +17 -11
  211. package/dist/internal/production-runtime.d.ts +17 -11
  212. package/dist/internal/production-runtime.mjs +47 -111
  213. package/dist/markdown.cjs +5 -5
  214. package/dist/markdown.d.mts +2 -2
  215. package/dist/markdown.d.ts +2 -2
  216. package/dist/markdown.mjs +4 -4
  217. package/dist/middleware.cjs +10 -10
  218. package/dist/middleware.d.mts +4 -4
  219. package/dist/middleware.d.ts +4 -4
  220. package/dist/middleware.mjs +9 -9
  221. package/dist/mobile.d.mts +27 -5
  222. package/dist/mobile.d.ts +27 -5
  223. package/dist/modules-VHD7BELU.mjs +13 -0
  224. package/dist/modules-WT5D3AWY.cjs +13 -0
  225. package/dist/native-specs-BD7HOTMJ.mjs +15 -0
  226. package/dist/native-specs-IQQRJOOW.cjs +15 -0
  227. package/dist/native-tree-6G5O53O3.cjs +27 -0
  228. package/dist/{native-tree-EBPDFTRW.mjs → native-tree-VWNW2MQ2.mjs} +10 -8
  229. package/dist/native.cjs +87 -0
  230. package/dist/native.d.mts +72 -0
  231. package/dist/native.d.ts +72 -0
  232. package/dist/native.mjs +87 -0
  233. package/dist/{navigation-delegate.d-C76gXTmO.d.mts → navigation-delegate.d-CnOTWOyi.d.mts} +1 -1
  234. package/dist/{navigation-delegate.d-DIyDslxt.d.ts → navigation-delegate.d-JXx40JzR.d.ts} +1 -1
  235. package/dist/navigation.cjs +5 -5
  236. package/dist/navigation.d.mts +5 -5
  237. package/dist/navigation.d.ts +5 -5
  238. package/dist/navigation.mjs +4 -4
  239. package/dist/{nitro-R444AF3O.mjs → nitro-FLN6DRGJ.mjs} +7 -7
  240. package/dist/{nitro-CK7M4RMY.cjs → nitro-HXAZZQKY.cjs} +12 -12
  241. package/dist/plugin.cjs +42 -42
  242. package/dist/plugin.d.mts +4 -4
  243. package/dist/plugin.d.ts +4 -4
  244. package/dist/plugin.mjs +41 -41
  245. package/dist/port-C6GBH4C6.cjs +419 -0
  246. package/dist/port-WOOQ3V56.mjs +419 -0
  247. package/dist/{production-runtime.d-CDHztggO.d.mts → production-runtime.d-CP5s6RuY.d.mts} +1 -1
  248. package/dist/{production-runtime.d-tyaGdbk6.d.ts → production-runtime.d-N-cE3pmy.d.ts} +1 -1
  249. package/dist/{programmatic-routes-client.d-XfmIrCK1.d.ts → programmatic-routes-client.d-CLG2N1yH.d.ts} +2 -2
  250. package/dist/{programmatic-routes-client.d-aAWiDd64.d.mts → programmatic-routes-client.d-CPbNqtIi.d.mts} +2 -2
  251. package/dist/query/client.cjs +6 -6
  252. package/dist/query/client.mjs +2 -2
  253. package/dist/{render-plan.d-Dr5WRjoV.d.ts → render-plan.d-B9lAP3uX.d.ts} +1 -1
  254. package/dist/{render-plan.d-Diwybxo8.d.mts → render-plan.d-DZ-qjjdG.d.mts} +1 -1
  255. package/dist/renderer/react/server.cjs +2 -2
  256. package/dist/renderer/react/server.mjs +3 -3
  257. package/dist/renderer-client.cjs +6 -6
  258. package/dist/renderer-client.d.mts +5 -5
  259. package/dist/renderer-client.d.ts +5 -5
  260. package/dist/renderer-client.mjs +2 -2
  261. package/dist/{request.d-D01fRn--.d.ts → request.d-BiicaNxb.d.ts} +1 -1
  262. package/dist/{request.d-Dd3AFR79.d.mts → request.d-DV0oeUit.d.mts} +1 -1
  263. package/dist/request.d.mts +3 -3
  264. package/dist/request.d.ts +3 -3
  265. package/dist/{route-rendering.d-BQ53lJ_D.d.mts → route-rendering.d-BrIKA51A.d.mts} +1 -1
  266. package/dist/{route-rendering.d-Bhx4QoJt.d.ts → route-rendering.d-Iss0C7GR.d.ts} +1 -1
  267. package/dist/{router.d-DQ3k7EYn.d.ts → router.d-DjGn_al7.d.ts} +1 -1
  268. package/dist/{router.d-Bi23a6Xc.d.mts → router.d-mNTbOGV_.d.mts} +1 -1
  269. package/dist/{routes.d-C7jMJFvP.d.ts → routes.d-BKSjHuH9.d.ts} +25 -2
  270. package/dist/{routes.d-BgTd7vI4.d.mts → routes.d-qd8Qf4LG.d.mts} +25 -2
  271. package/dist/routes.d.mts +2 -2
  272. package/dist/routes.d.ts +2 -2
  273. package/dist/{rsc-pipeline-OCZIT5OF.cjs → rsc-pipeline-SVLBTY7H.cjs} +21 -21
  274. package/dist/{rsc-pipeline-K3ER3Q4N.mjs → rsc-pipeline-WBLBDQXA.mjs} +20 -20
  275. package/dist/{runtime-DKNSIH7V.cjs → runtime-DGUOWSMF.cjs} +293 -41
  276. package/dist/{runtime-MKYDEUZT.mjs → runtime-HFZTVNFF.mjs} +283 -31
  277. package/dist/{runtime.d-B2Js6qZ2.d.mts → runtime.d-BNVbojF1.d.mts} +1 -1
  278. package/dist/{runtime.d-BL-CGwoi.d.ts → runtime.d-Bm_4hP5T.d.ts} +1 -1
  279. package/dist/{schema-dev-notice-F6QYSOAI.mjs → schema-dev-notice-JMXEQWIQ.mjs} +3 -3
  280. package/dist/{schema-dev-notice-UU7DMZEU.cjs → schema-dev-notice-PLBFDTOF.cjs} +6 -6
  281. package/dist/server-fn-client.d.mts +1 -1
  282. package/dist/server-fn-client.d.ts +1 -1
  283. package/dist/server-plugins.cjs +1 -1
  284. package/dist/server-plugins.d.mts +3 -3
  285. package/dist/server-plugins.d.ts +3 -3
  286. package/dist/server-plugins.mjs +1 -1
  287. package/dist/server.cjs +81 -81
  288. package/dist/server.d.mts +11 -11
  289. package/dist/server.d.ts +11 -11
  290. package/dist/server.mjs +64 -64
  291. package/dist/session-2Q72D4QV.cjs +23 -0
  292. package/dist/{session-IGEDQ5PY.mjs → session-QZXZOPR2.mjs} +2 -2
  293. package/dist/shell-render.d-CG6bPiiA.d.mts +41 -0
  294. package/dist/shell-render.d-CG6bPiiA.d.ts +41 -0
  295. package/dist/{spa-router.d-DqZ6Lfs0.d.ts → spa-router.d-DAtnNoBe.d.ts} +11 -2
  296. package/dist/{spa-router.d-B2rIFGs0.d.mts → spa-router.d-DHDoXxDE.d.mts} +11 -2
  297. package/dist/testing.cjs +7 -7
  298. package/dist/testing.d.mts +2 -2
  299. package/dist/testing.d.ts +2 -2
  300. package/dist/testing.mjs +6 -6
  301. package/dist/{utils.d-Bv2MPeLR.d.ts → utils.d-DwZ-KLSB.d.ts} +7 -1
  302. package/dist/{utils.d-fqXe8lNc.d.mts → utils.d-uKZcKJk4.d.mts} +7 -1
  303. package/dist/version.cjs +2 -2
  304. package/dist/version.mjs +1 -1
  305. package/dist/vite.cjs +42 -42
  306. package/dist/vite.d.mts +10 -5
  307. package/dist/vite.d.ts +10 -5
  308. package/dist/vite.mjs +41 -41
  309. package/dist/workflows.cjs +3 -3
  310. package/dist/workflows.mjs +2 -2
  311. package/package.json +17 -3
  312. package/dist/agent-mcp-handler-YE4AGWHN.cjs +0 -18
  313. package/dist/chunk-MIGFX2FN.mjs +0 -758
  314. package/dist/chunk-P6MHI5O2.cjs +0 -758
  315. package/dist/native-tree-MMZS7S6W.cjs +0 -25
  316. package/dist/session-AAU7RNRO.cjs +0 -23
  317. package/dist/{chunk-7FVVQEVL.cjs → chunk-4BS3HSY7.cjs} +2 -2
  318. package/dist/{chunk-N7JQXQAV.cjs → chunk-5OJVKXFV.cjs} +2 -2
  319. package/dist/{chunk-WSDKXV4E.mjs → chunk-72KABRWN.mjs} +4 -4
  320. package/dist/{chunk-C3BOESDW.mjs → chunk-B4CWYGCG.mjs} +3 -3
@@ -5,7 +5,7 @@ var _chunkAQLHD6HZcjs = require('./chunk-AQLHD6HZ.cjs');
5
5
 
6
6
 
7
7
 
8
- var _chunkUQHIWZZ6cjs = require('./chunk-UQHIWZZ6.cjs');
8
+ var _chunk3TL3AH25cjs = require('./chunk-3TL3AH25.cjs');
9
9
 
10
10
 
11
11
 
@@ -30,28 +30,30 @@ var _chunkUQHIWZZ6cjs = require('./chunk-UQHIWZZ6.cjs');
30
30
 
31
31
 
32
32
 
33
- var _chunkTSFMFPRUcjs = require('./chunk-TSFMFPRU.cjs');
34
33
 
35
34
 
36
- var _chunk4SEHMBL4cjs = require('./chunk-4SEHMBL4.cjs');
35
+ var _chunkO27PLNQZcjs = require('./chunk-O27PLNQZ.cjs');
37
36
 
38
37
 
38
+ var _chunk3OWVWZ6Rcjs = require('./chunk-3OWVWZ6R.cjs');
39
39
 
40
40
 
41
+ var _chunkDPJ66FSIcjs = require('./chunk-DPJ66FSI.cjs');
41
42
 
42
43
 
43
44
 
44
- var _chunk46KXZBOGcjs = require('./chunk-46KXZBOG.cjs');
45
45
 
46
46
 
47
- var _chunkYB44NKC2cjs = require('./chunk-YB44NKC2.cjs');
48
47
 
49
48
 
49
+ var _chunkQAS7KE7Jcjs = require('./chunk-QAS7KE7J.cjs');
50
50
 
51
- var _chunkXGJVRPYLcjs = require('./chunk-XGJVRPYL.cjs');
51
+
52
+ var _chunkYB44NKC2cjs = require('./chunk-YB44NKC2.cjs');
52
53
 
53
54
 
54
- var _chunk3OWVWZ6Rcjs = require('./chunk-3OWVWZ6R.cjs');
55
+
56
+ var _chunkXGJVRPYLcjs = require('./chunk-XGJVRPYL.cjs');
55
57
 
56
58
 
57
59
 
@@ -63,96 +65,96 @@ var _chunk7KJJ4SBScjs = require('./chunk-7KJJ4SBS.cjs');
63
65
  var _chunkNK2VWS7Pcjs = require('./chunk-NK2VWS7P.cjs');
64
66
 
65
67
 
68
+ var _chunkSM2SYWARcjs = require('./chunk-SM2SYWAR.cjs');
66
69
 
67
- var _chunkUJL4JOXVcjs = require('./chunk-UJL4JOXV.cjs');
68
70
 
69
71
 
70
- var _chunkB3GM5I6Ncjs = require('./chunk-B3GM5I6N.cjs');
71
72
 
72
73
 
74
+ var _chunkBPNOYILCcjs = require('./chunk-BPNOYILC.cjs');
73
75
 
74
- var _chunk4ZJ5C7UJcjs = require('./chunk-4ZJ5C7UJ.cjs');
75
76
 
77
+ var _chunkV56632LAcjs = require('./chunk-V56632LA.cjs');
76
78
 
77
- var _chunkSM2SYWARcjs = require('./chunk-SM2SYWAR.cjs');
78
79
 
80
+ var _chunkSTF6VDYQcjs = require('./chunk-STF6VDYQ.cjs');
79
81
 
80
82
 
81
83
 
82
84
 
83
- var _chunkBPNOYILCcjs = require('./chunk-BPNOYILC.cjs');
84
85
 
85
86
 
86
- var _chunkV56632LAcjs = require('./chunk-V56632LA.cjs');
87
87
 
88
88
 
89
- var _chunkSTF6VDYQcjs = require('./chunk-STF6VDYQ.cjs');
90
89
 
91
90
 
92
91
 
92
+ var _chunkRD623KW4cjs = require('./chunk-RD623KW4.cjs');
93
93
 
94
94
 
95
95
 
96
96
 
97
97
 
98
98
 
99
+ var _chunkDZPR2W6Ucjs = require('./chunk-DZPR2W6U.cjs');
99
100
 
100
101
 
101
- var _chunkRD623KW4cjs = require('./chunk-RD623KW4.cjs');
102
102
 
103
103
 
104
104
 
105
105
 
106
106
 
107
+ var _chunk6JHZPB52cjs = require('./chunk-6JHZPB52.cjs');
107
108
 
108
- var _chunkFFE2EMF7cjs = require('./chunk-FFE2EMF7.cjs');
109
109
 
110
110
 
111
111
 
112
112
 
113
113
 
114
+ var _chunkMEQN6DDAcjs = require('./chunk-MEQN6DDA.cjs');
114
115
 
115
- var _chunkH33PJEXNcjs = require('./chunk-H33PJEXN.cjs');
116
116
 
117
117
 
118
+ var _chunk5Y2P454Ocjs = require('./chunk-5Y2P454O.cjs');
118
119
 
119
120
 
121
+ var _chunkHEPJIKKQcjs = require('./chunk-HEPJIKKQ.cjs');
120
122
 
121
123
 
122
124
 
123
- var _chunk6JHZPB52cjs = require('./chunk-6JHZPB52.cjs');
125
+ var _chunkCI4UNQHOcjs = require('./chunk-CI4UNQHO.cjs');
124
126
 
125
127
 
126
- var _chunkHEPJIKKQcjs = require('./chunk-HEPJIKKQ.cjs');
128
+ var _chunkPRFNLQSPcjs = require('./chunk-PRFNLQSP.cjs');
127
129
 
128
130
 
129
131
 
130
- var _chunk5Y2P454Ocjs = require('./chunk-5Y2P454O.cjs');
132
+ var _chunk2HW5LWAHcjs = require('./chunk-2HW5LWAH.cjs');
131
133
 
132
134
 
133
135
 
134
- var _chunk2HW5LWAHcjs = require('./chunk-2HW5LWAH.cjs');
135
136
 
136
137
 
137
- var _chunkXB24LZWIcjs = require('./chunk-XB24LZWI.cjs');
138
138
 
139
139
 
140
- var _chunkXYL4HSVCcjs = require('./chunk-XYL4HSVC.cjs');
141
140
 
141
+ var _chunkLT4VAF5Zcjs = require('./chunk-LT4VAF5Z.cjs');
142
142
 
143
- var _chunkFK25QSVCcjs = require('./chunk-FK25QSVC.cjs');
144
143
 
144
+ var _chunkQRX4JRBOcjs = require('./chunk-QRX4JRBO.cjs');
145
145
 
146
- var _chunkWT6RAN2Icjs = require('./chunk-WT6RAN2I.cjs');
147
146
 
147
+ var _chunkYI6FKTTNcjs = require('./chunk-YI6FKTTN.cjs');
148
148
 
149
149
 
150
+ var _chunkFK25QSVCcjs = require('./chunk-FK25QSVC.cjs');
150
151
 
151
152
 
152
153
 
154
+ var _chunk4ZJ5C7UJcjs = require('./chunk-4ZJ5C7UJ.cjs');
153
155
 
154
156
 
155
- var _chunkD7UQC4O6cjs = require('./chunk-D7UQC4O6.cjs');
157
+ var _chunkWT6RAN2Icjs = require('./chunk-WT6RAN2I.cjs');
156
158
 
157
159
 
158
160
  var _chunkJMYXO572cjs = require('./chunk-JMYXO572.cjs');
@@ -164,11 +166,11 @@ var _chunkX333W5KVcjs = require('./chunk-X333W5KV.cjs');
164
166
 
165
167
 
166
168
 
167
- var _chunkCECUDGXQcjs = require('./chunk-CECUDGXQ.cjs');
169
+ var _chunkZP32GNJQcjs = require('./chunk-ZP32GNJQ.cjs');
168
170
 
169
171
 
170
172
 
171
- var _chunkEHB77D5Ucjs = require('./chunk-EHB77D5U.cjs');
173
+ var _chunkZDAEHG2Ocjs = require('./chunk-ZDAEHG2O.cjs');
172
174
 
173
175
 
174
176
 
@@ -230,7 +232,7 @@ var _chunkLNVGXUL3cjs = require('./chunk-LNVGXUL3.cjs');
230
232
 
231
233
 
232
234
 
233
- var _chunkVQJYGZNXcjs = require('./chunk-VQJYGZNX.cjs');
235
+ var _chunkQMNWKQL4cjs = require('./chunk-QMNWKQL4.cjs');
234
236
 
235
237
 
236
238
 
@@ -244,24 +246,24 @@ var _chunkEVIWKPJVcjs = require('./chunk-EVIWKPJV.cjs');
244
246
  var _chunkYIHRZBD7cjs = require('./chunk-YIHRZBD7.cjs');
245
247
 
246
248
 
249
+ var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
247
250
 
248
- var _chunkLIFUPCXWcjs = require('./chunk-LIFUPCXW.cjs');
249
251
 
250
252
 
251
- var _chunkJYT7AN37cjs = require('./chunk-JYT7AN37.cjs');
253
+ var _chunkLIFUPCXWcjs = require('./chunk-LIFUPCXW.cjs');
252
254
 
253
255
 
254
- var _chunkB5BBTPJQcjs = require('./chunk-B5BBTPJQ.cjs');
256
+ var _chunkJYT7AN37cjs = require('./chunk-JYT7AN37.cjs');
255
257
 
256
258
 
257
- var _chunkOAMUSC7Hcjs = require('./chunk-OAMUSC7H.cjs');
259
+ var _chunk2FRLSDBTcjs = require('./chunk-2FRLSDBT.cjs');
258
260
 
259
261
 
260
262
 
261
263
  var _chunkJGAE5XPLcjs = require('./chunk-JGAE5XPL.cjs');
262
264
 
263
265
 
264
- var _chunkIWFV5ZEDcjs = require('./chunk-IWFV5ZED.cjs');
266
+ var _chunkPMJSG4JScjs = require('./chunk-PMJSG4JS.cjs');
265
267
 
266
268
 
267
269
 
@@ -329,8 +331,8 @@ var _chunkYTVSWXEZcjs = require('./chunk-YTVSWXEZ.cjs');
329
331
  var _chunkBTZ5O6VMcjs = require('./chunk-BTZ5O6VM.cjs');
330
332
 
331
333
  // src/utils/client-component.ts
332
- var _fs = require('fs'); var fs3 = _interopRequireWildcard(_fs); var fs6 = _interopRequireWildcard(_fs); var fs5 = _interopRequireWildcard(_fs);
333
- var _path = require('path'); var path5 = _interopRequireWildcard(_path); var path10 = _interopRequireWildcard(_path); var path9 = _interopRequireWildcard(_path);
334
+ var _fs = require('fs'); var fs3 = _interopRequireWildcard(_fs); var fs8 = _interopRequireWildcard(_fs); var fs7 = _interopRequireWildcard(_fs);
335
+ var _path = require('path'); var path5 = _interopRequireWildcard(_path); var path12 = _interopRequireWildcard(_path); var path11 = _interopRequireWildcard(_path);
334
336
  var _url = require('url');
335
337
 
336
338
  // src/utils/package-client-boundary-cache.ts
@@ -455,7 +457,7 @@ var PackageClientBoundaryCache = class {
455
457
  }
456
458
  const contents = JSON.stringify({
457
459
  schema: SCHEMA_VERSION,
458
- farm: _chunkOAMUSC7Hcjs.FARM_VERSION,
460
+ farm: _chunk2FRLSDBTcjs.FARM_VERSION,
459
461
  paths,
460
462
  entries
461
463
  });
@@ -503,7 +505,7 @@ function readStoredCache(file) {
503
505
  } catch (e3) {
504
506
  return null;
505
507
  }
506
- if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !== _chunkOAMUSC7Hcjs.FARM_VERSION) {
508
+ if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !== _chunk2FRLSDBTcjs.FARM_VERSION) {
507
509
  return null;
508
510
  }
509
511
  const { paths, entries } = value;
@@ -514,7 +516,7 @@ function readStoredCache(file) {
514
516
  const usable = variants.filter((entry) => isStoredEntry(entry, paths.length));
515
517
  if (usable.length > 0) valid[key] = usable;
516
518
  }
517
- return { schema: SCHEMA_VERSION, farm: _chunkOAMUSC7Hcjs.FARM_VERSION, paths, entries: valid };
519
+ return { schema: SCHEMA_VERSION, farm: _chunk2FRLSDBTcjs.FARM_VERSION, paths, entries: valid };
518
520
  }
519
521
  function isRecord(value) {
520
522
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -935,6 +937,41 @@ function resolveOwnerSourcePath(resolvedPath, root) {
935
937
  }
936
938
  return current;
937
939
  }
940
+ function collectFarmRenderedClientModules(modulePath, root) {
941
+ const resolvedPath = resolveOwnerSourcePath(resolveModuleSourcePath(modulePath, root), root);
942
+ if (!resolvedPath) return null;
943
+ if (hasUseClientDirective(readIfExists(resolvedPath))) return [resolvedPath];
944
+ const collected = collectIsolatedClientBoundaries(resolvedPath, root, {
945
+ allowDynamicCardinality: true,
946
+ allowElementProps: true
947
+ });
948
+ if (collected.fallbackReason || collected.costGuardExceeded) return null;
949
+ return collected.boundaries.map((boundary) => boundary.modulePath);
950
+ }
951
+ var SERVER_MODULE_SOURCE = /\.[cm]?[jt]sx?$/;
952
+ var STYLESHEET_SOURCE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)$/;
953
+ function collectFarmServerStylesheets(modulePaths, root) {
954
+ const stylesheets = /* @__PURE__ */ new Set();
955
+ const visited = /* @__PURE__ */ new Set();
956
+ const visit = (file) => {
957
+ if (visited.has(file) || !SERVER_MODULE_SOURCE.test(file)) return;
958
+ visited.add(file);
959
+ const content = readIfExists(file);
960
+ if (!content || hasUseClientDirective(content)) return;
961
+ for (const specifier of getImportSpecifiers(content)) {
962
+ if (specifier.includes("?")) continue;
963
+ const imported = resolveImportedModule(file, specifier, root);
964
+ if (!imported.path) continue;
965
+ if (STYLESHEET_SOURCE.test(imported.path)) stylesheets.add(imported.path);
966
+ else if (imported.local) visit(imported.path);
967
+ }
968
+ };
969
+ for (const modulePath of modulePaths) {
970
+ const resolved = resolveOwnerSourcePath(resolveModuleSourcePath(modulePath, root), root);
971
+ if (resolved) visit(resolved);
972
+ }
973
+ return [...stylesheets];
974
+ }
938
975
  function getClientModuleMetadata(modulePath, root) {
939
976
  const resolvedPath = resolveModuleSourcePath(modulePath, root);
940
977
  return inspectClientModuleMetadata(resolvedPath, root, /* @__PURE__ */ new Set(), true);
@@ -949,7 +986,8 @@ function getClientModuleHydrationPlan(modulePath, root, mode = "off", options =
949
986
  if (!resolvedPath || owner.isClientComponent || owner.hasHydrateExport) return plan;
950
987
  const layout = collectIsolatedClientBoundaries(resolvedPath, root, {
951
988
  allowDynamicCardinality: true,
952
- allowElementProps: true
989
+ allowElementProps: true,
990
+ staticPackageLeaves: true
953
991
  });
954
992
  const routeWide = {
955
993
  ...plan,
@@ -967,7 +1005,16 @@ function getClientModuleHydrationPlan(modulePath, root, mode = "off", options =
967
1005
  islandsError: layout.fallbackHint ? `${layout.fallbackReason}. ${layout.fallbackHint}` : layout.fallbackReason
968
1006
  };
969
1007
  }
970
- return { ...routeWide, serverTreeLayout: true, isolatedBoundaries: layout.boundaries };
1008
+ const staticPackages = layout.staticPackages.length > 0 ? { staticPackageBoundaries: layout.staticPackages } : {};
1009
+ if (layout.boundaries.length === 0) {
1010
+ return { ...routeWide, shouldHydrate: false, islandStrategy: null, ...staticPackages };
1011
+ }
1012
+ return {
1013
+ ...routeWide,
1014
+ serverTreeLayout: true,
1015
+ isolatedBoundaries: layout.boundaries,
1016
+ ...staticPackages
1017
+ };
971
1018
  }
972
1019
  function planClientModuleHydration(modulePath, root, mode, options) {
973
1020
  const metadata = getClientModuleMetadata(modulePath, root);
@@ -998,7 +1045,8 @@ function planClientModuleHydration(modulePath, root, mode, options) {
998
1045
  const inspection = collectIsolatedClientBoundaries(resolvedPath, root, {
999
1046
  allowDynamicCardinality: asyncOwner,
1000
1047
  allowElementProps: asyncOwner,
1001
- staticPackageBoundaries: asyncOwner
1048
+ staticPackageBoundaries: asyncOwner,
1049
+ staticPackageLeaves: options.serverTreeLayouts === true && options.asyncOwnerIslands === true
1002
1050
  });
1003
1051
  if (inspection.fallbackReason && asyncOwner && options.serverOwners === true) {
1004
1052
  return {
@@ -1042,9 +1090,9 @@ function planClientModuleHydration(modulePath, root, mode, options) {
1042
1090
  if (asyncOwner) {
1043
1091
  delete plan.suppressedAsyncHydration;
1044
1092
  plan.asyncOwnerIslands = true;
1045
- if (inspection.staticPackages.length > 0)
1046
- plan.staticPackageBoundaries = inspection.staticPackages;
1047
1093
  }
1094
+ if (inspection.staticPackages.length > 0)
1095
+ plan.staticPackageBoundaries = inspection.staticPackages;
1048
1096
  return plan;
1049
1097
  }
1050
1098
  function usesFarmServerTree(plan) {
@@ -1107,10 +1155,10 @@ function restoreRouteWideHydration(metadata, fallbackReason) {
1107
1155
  metadata.fallbackReason = fallbackReason;
1108
1156
  }
1109
1157
  }
1110
- function enforceFarmIsolatedHydrationRouteBudget(layouts, routes, layoutAppliesToRoute) {
1158
+ function enforceFarmIsolatedHydrationRouteBudget(layouts, routes, layoutAppliesToRoute, options = {}) {
1111
1159
  const boundaryLimit = isolatedHydrationBoundaryLimit();
1112
1160
  const sortedLayouts = [...layouts].sort((left, right) => left.depth - right.depth);
1113
- for (const route of routes) {
1161
+ for (const route of options.serverOwners ? [] : routes) {
1114
1162
  if (route.metadata.mode !== "enabled") continue;
1115
1163
  const applicableLayouts = sortedLayouts.filter(
1116
1164
  (layout) => layoutAppliesToRoute(layout.pattern, route.pattern)
@@ -1417,6 +1465,25 @@ function passesElementValuedProps(content, localBindings) {
1417
1465
  }
1418
1466
  return false;
1419
1467
  }
1468
+ function rendersOnlyLeafElements(content, localBindings) {
1469
+ if (!content) return false;
1470
+ const names = new Set(localBindings);
1471
+ const tokens = tokenizeModuleSource(content);
1472
+ for (let index = 0; index < tokens.length - 1; index++) {
1473
+ if (tokens[index].value !== "<" || !names.has(tokens[index + 1].value)) continue;
1474
+ let braceDepth = 0;
1475
+ let cursor = index + 2;
1476
+ for (; cursor < tokens.length; cursor++) {
1477
+ const value = tokens[cursor].value;
1478
+ if (value === "{") braceDepth++;
1479
+ else if (value === "}") braceDepth--;
1480
+ else if (value === "<" && braceDepth > 0) return false;
1481
+ else if (value === ">" && braceDepth === 0) break;
1482
+ }
1483
+ if (cursor >= tokens.length || _optionalChain([tokens, 'access', _71 => _71[cursor - 1], 'optionalAccess', _72 => _72.value]) !== "/") return false;
1484
+ }
1485
+ return true;
1486
+ }
1420
1487
  function hasDynamicJsxCardinality(content, localBindings) {
1421
1488
  if (!content || localBindings.length === 0) return false;
1422
1489
  const clientBindings = new Set(localBindings);
@@ -1425,9 +1492,9 @@ function hasDynamicJsxCardinality(content, localBindings) {
1425
1492
  const containsDynamicRenderer = (start, end) => containsClientJsx(tokens, start, end, clientBindings) || tokens.slice(start, end).some((token) => renderingHelpers.has(token.value));
1426
1493
  for (let index = 0; index < tokens.length; index++) {
1427
1494
  let callStart = -1;
1428
- if (tokens[index].value === "." && (_optionalChain([tokens, 'access', _71 => _71[index + 1], 'optionalAccess', _72 => _72.value]) === "map" || _optionalChain([tokens, 'access', _73 => _73[index + 1], 'optionalAccess', _74 => _74.value]) === "flatMap") && _optionalChain([tokens, 'access', _75 => _75[index + 2], 'optionalAccess', _76 => _76.value]) === "(") {
1495
+ if (tokens[index].value === "." && (_optionalChain([tokens, 'access', _73 => _73[index + 1], 'optionalAccess', _74 => _74.value]) === "map" || _optionalChain([tokens, 'access', _75 => _75[index + 1], 'optionalAccess', _76 => _76.value]) === "flatMap") && _optionalChain([tokens, 'access', _77 => _77[index + 2], 'optionalAccess', _78 => _78.value]) === "(") {
1429
1496
  callStart = index + 2;
1430
- } else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access', _77 => _77[index + 1], 'optionalAccess', _78 => _78.value]) === "." && _optionalChain([tokens, 'access', _79 => _79[index + 2], 'optionalAccess', _80 => _80.value]) === "from" && _optionalChain([tokens, 'access', _81 => _81[index + 3], 'optionalAccess', _82 => _82.value]) === "(") {
1497
+ } else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access', _79 => _79[index + 1], 'optionalAccess', _80 => _80.value]) === "." && _optionalChain([tokens, 'access', _81 => _81[index + 2], 'optionalAccess', _82 => _82.value]) === "from" && _optionalChain([tokens, 'access', _83 => _83[index + 3], 'optionalAccess', _84 => _84.value]) === "(") {
1431
1498
  callStart = index + 3;
1432
1499
  }
1433
1500
  if (callStart !== -1) {
@@ -1436,10 +1503,10 @@ function hasDynamicJsxCardinality(content, localBindings) {
1436
1503
  index = callEnd;
1437
1504
  continue;
1438
1505
  }
1439
- if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access', _83 => _83[index + 1], 'optionalAccess', _84 => _84.value]) === "(") {
1506
+ if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access', _85 => _85[index + 1], 'optionalAccess', _86 => _86.value]) === "(") {
1440
1507
  const conditionEnd = findMatchingToken(tokens, index + 1, "(", ")");
1441
1508
  const bodyStart = conditionEnd + 1;
1442
- const bodyEnd = _optionalChain([tokens, 'access', _85 => _85[bodyStart], 'optionalAccess', _86 => _86.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : tokens.findIndex((token, tokenIndex) => tokenIndex > bodyStart && token.value === ";");
1509
+ const bodyEnd = _optionalChain([tokens, 'access', _87 => _87[bodyStart], 'optionalAccess', _88 => _88.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : tokens.findIndex((token, tokenIndex) => tokenIndex > bodyStart && token.value === ";");
1443
1510
  if (containsDynamicRenderer(bodyStart, bodyEnd === -1 ? tokens.length : bodyEnd)) return true;
1444
1511
  }
1445
1512
  }
@@ -1495,7 +1562,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
1495
1562
  if (!imported.local) {
1496
1563
  const packageMetadata = inspectPackageClientBoundary(importedPath, root, /* @__PURE__ */ new Set());
1497
1564
  if (packageMetadata.shouldHydrate) {
1498
- if (options.staticPackageBoundaries) {
1565
+ if (options.staticPackageBoundaries || options.staticPackageLeaves && rendersOnlyLeafElements(content, _nullishCoalesce(importedBindings.get(specifier), () => ( [])))) {
1499
1566
  staticPackages.add(specifier);
1500
1567
  continue;
1501
1568
  }
@@ -1613,7 +1680,7 @@ function inspectPackageClientBoundary(resolvedPath, root, visited) {
1613
1680
  }
1614
1681
  function traversePackageClientBoundary(resolvedPath, root, visited, trace) {
1615
1682
  if (!resolvedPath || visited.has(resolvedPath)) {
1616
- if (resolvedPath) _optionalChain([trace, 'optionalAccess', _87 => _87.stop, 'call', _88 => _88(resolvedPath)]);
1683
+ if (resolvedPath) _optionalChain([trace, 'optionalAccess', _89 => _89.stop, 'call', _90 => _90(resolvedPath)]);
1617
1684
  return {
1618
1685
  isClientComponent: false,
1619
1686
  shouldHydrate: false,
@@ -1621,7 +1688,7 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace) {
1621
1688
  };
1622
1689
  }
1623
1690
  visited.add(resolvedPath);
1624
- _optionalChain([trace, 'optionalAccess', _89 => _89.visit, 'call', _90 => _90(resolvedPath)]);
1691
+ _optionalChain([trace, 'optionalAccess', _91 => _91.visit, 'call', _92 => _92(resolvedPath)]);
1625
1692
  const content = readIfExists(resolvedPath);
1626
1693
  const parsed = parseClientModuleMetadata(content, false);
1627
1694
  let importsClientBoundary = false;
@@ -1665,7 +1732,7 @@ function getImportSpecifiers(content) {
1665
1732
  continue;
1666
1733
  }
1667
1734
  const previous = tokens[index - 1];
1668
- if (_optionalChain([previous, 'optionalAccess', _91 => _91.value]) === ".") continue;
1735
+ if (_optionalChain([previous, 'optionalAccess', _93 => _93.value]) === ".") continue;
1669
1736
  const first = tokens[index + 1];
1670
1737
  if (!first || first.value === "type" || first.value === "(" || first.value === ".") {
1671
1738
  continue;
@@ -1681,7 +1748,7 @@ function getImportSpecifiers(content) {
1681
1748
  for (let cursor = index + 1; cursor < tokens.length; cursor++) {
1682
1749
  const token = tokens[cursor];
1683
1750
  if (token.value === ";") break;
1684
- if (token.value === "from" && _optionalChain([tokens, 'access', _92 => _92[cursor + 1], 'optionalAccess', _93 => _93.kind]) === "string") {
1751
+ if (token.value === "from" && _optionalChain([tokens, 'access', _94 => _94[cursor + 1], 'optionalAccess', _95 => _95.kind]) === "string") {
1685
1752
  fromIndex = cursor;
1686
1753
  break;
1687
1754
  }
@@ -1699,14 +1766,14 @@ function getImportSpecifiers(content) {
1699
1766
  return Array.from(matches);
1700
1767
  }
1701
1768
  function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
1702
- if (_optionalChain([tokens, 'access', _94 => _94[startIndex], 'optionalAccess', _95 => _95.value]) !== "{") return false;
1769
+ if (_optionalChain([tokens, 'access', _96 => _96[startIndex], 'optionalAccess', _97 => _97.value]) !== "{") return false;
1703
1770
  const closingBraceIndex = tokens.findIndex(
1704
1771
  (token, index) => index > startIndex && index < endIndex && token.value === "}"
1705
1772
  );
1706
1773
  if (closingBraceIndex === -1) return false;
1707
1774
  let entryStartsAt = startIndex + 1;
1708
1775
  for (let index = entryStartsAt; index <= closingBraceIndex; index++) {
1709
- if (index !== closingBraceIndex && _optionalChain([tokens, 'access', _96 => _96[index], 'optionalAccess', _97 => _97.value]) !== ",") continue;
1776
+ if (index !== closingBraceIndex && _optionalChain([tokens, 'access', _98 => _98[index], 'optionalAccess', _99 => _99.value]) !== ",") continue;
1710
1777
  const entry = tokens.slice(entryStartsAt, index);
1711
1778
  if (entry.length > 0 && entry[0].value !== "type") return false;
1712
1779
  entryStartsAt = index + 1;
@@ -1729,7 +1796,7 @@ function warnUnresolvedAliasImport(importerPath, specifier, root) {
1729
1796
  if (!ALIAS_IMPORT.test(specifier) || warnedUnresolvedAliasImports.has(specifier)) return;
1730
1797
  warnedUnresolvedAliasImports.add(specifier);
1731
1798
  const importer = root ? path5.default.relative(root, importerPath) : importerPath;
1732
- _chunkVQJYGZNXcjs.logger.warn(
1799
+ _chunkQMNWKQL4cjs.logger.warn(
1733
1800
  `Could not resolve "${specifier}" (imported by ${importer}) while checking which pages need client JavaScript. If it holds client components, they will not hydrate. Map the alias in tsconfig.json "paths" or package.json "imports".`
1734
1801
  );
1735
1802
  }
@@ -1770,7 +1837,7 @@ function getProjectImportAliases(projectRoot) {
1770
1837
  const sourceDir = _chunkBPNOYILCcjs.getFarmProjectSourceDir.call(void 0, projectRoot);
1771
1838
  const cacheStamp = `${stamp}:${sourceDir}`;
1772
1839
  const cached = projectImportAliasCache.get(projectRoot);
1773
- if (_optionalChain([cached, 'optionalAccess', _98 => _98.stamp]) === cacheStamp) return cached.aliases;
1840
+ if (_optionalChain([cached, 'optionalAccess', _100 => _100.stamp]) === cacheStamp) return cached.aliases;
1774
1841
  const aliases = [
1775
1842
  ...readTsconfigPathAliases(projectRoot),
1776
1843
  ...readPackageImportAliases(projectRoot)
@@ -1791,7 +1858,7 @@ function readTsconfigPathAliases(projectRoot) {
1791
1858
  const configPath = path5.default.join(projectRoot, name);
1792
1859
  if (!fs3.default.existsSync(configPath)) continue;
1793
1860
  const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
1794
- if (!_optionalChain([resolved, 'optionalAccess', _99 => _99.paths])) return [];
1861
+ if (!_optionalChain([resolved, 'optionalAccess', _101 => _101.paths])) return [];
1795
1862
  const base = _nullishCoalesce(resolved.baseUrl, () => ( resolved.pathsDirectory));
1796
1863
  return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
1797
1864
  if (!Array.isArray(targets)) return [];
@@ -1826,18 +1893,18 @@ function readTsconfigPaths(configPath, visited) {
1826
1893
  inherited = _nullishCoalesce(readTsconfigPaths(parentPath, visited), () => ( inherited));
1827
1894
  }
1828
1895
  const options = _nullishCoalesce(config.compilerOptions, () => ( {}));
1829
- const baseUrl = typeof options.baseUrl === "string" ? path5.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess', _100 => _100.baseUrl]);
1896
+ const baseUrl = typeof options.baseUrl === "string" ? path5.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess', _102 => _102.baseUrl]);
1830
1897
  if (options.paths && typeof options.paths === "object") {
1831
1898
  return { paths: options.paths, pathsDirectory: directory, baseUrl };
1832
1899
  }
1833
1900
  return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
1834
1901
  }
1835
1902
  function readPackageImportAliases(projectRoot) {
1836
- const imports = _optionalChain([readPackageJson, 'call', _101 => _101(path5.default.join(projectRoot, "package.json")), 'optionalAccess', _102 => _102.imports]);
1903
+ const imports = _optionalChain([readPackageJson, 'call', _103 => _103(path5.default.join(projectRoot, "package.json")), 'optionalAccess', _104 => _104.imports]);
1837
1904
  if (!imports || typeof imports !== "object") return [];
1838
1905
  return Object.entries(imports).flatMap(([pattern, value]) => {
1839
1906
  const target = resolveConditionalExportTarget(value);
1840
- if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess', _103 => _103.startsWith, 'call', _104 => _104("./")])) return [];
1907
+ if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess', _105 => _105.startsWith, 'call', _106 => _106("./")])) return [];
1841
1908
  const wildcardIndex = pattern.indexOf("*");
1842
1909
  return [
1843
1910
  {
@@ -1903,15 +1970,15 @@ function resolvePackageModuleSourcePath(importerPath, specifier, root) {
1903
1970
  const packageJsonPath = path5.default.join(packageDirectory, "package.json");
1904
1971
  const packageJson = readPackageJson(packageJsonPath);
1905
1972
  const exportKey = packageSubpath ? `./${packageSubpath}` : ".";
1906
- const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess', _105 => _105.exports]), exportKey);
1973
+ const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess', _107 => _107.exports]), exportKey);
1907
1974
  const candidates = /* @__PURE__ */ new Set();
1908
- if (_optionalChain([exportTarget, 'optionalAccess', _106 => _106.startsWith, 'call', _107 => _107("./")])) {
1975
+ if (_optionalChain([exportTarget, 'optionalAccess', _108 => _108.startsWith, 'call', _109 => _109("./")])) {
1909
1976
  candidates.add(path5.default.resolve(packageDirectory, exportTarget));
1910
1977
  }
1911
1978
  if (packageSubpath) {
1912
1979
  candidates.add(path5.default.join(packageDirectory, packageSubpath));
1913
1980
  } else {
1914
- for (const entry of [_optionalChain([packageJson, 'optionalAccess', _108 => _108.browser]), _optionalChain([packageJson, 'optionalAccess', _109 => _109.module]), _optionalChain([packageJson, 'optionalAccess', _110 => _110.main])]) {
1981
+ for (const entry of [_optionalChain([packageJson, 'optionalAccess', _110 => _110.browser]), _optionalChain([packageJson, 'optionalAccess', _111 => _111.module]), _optionalChain([packageJson, 'optionalAccess', _112 => _112.main])]) {
1915
1982
  if (typeof entry === "string") candidates.add(path5.default.resolve(packageDirectory, entry));
1916
1983
  }
1917
1984
  candidates.add(path5.default.join(packageDirectory, "index"));
@@ -1976,7 +2043,7 @@ function resolvePackageExport(exportsField, exportKey) {
1976
2043
  if (!exportKey.startsWith(prefix) || !exportKey.endsWith(suffix)) continue;
1977
2044
  const wildcard = exportKey.slice(prefix.length, exportKey.length - suffix.length);
1978
2045
  const target = resolveConditionalExportTarget(value);
1979
- return _nullishCoalesce(_optionalChain([target, 'optionalAccess', _111 => _111.replace, 'call', _112 => _112("*", wildcard)]), () => ( null));
2046
+ return _nullishCoalesce(_optionalChain([target, 'optionalAccess', _113 => _113.replace, 'call', _114 => _114("*", wildcard)]), () => ( null));
1980
2047
  }
1981
2048
  return null;
1982
2049
  }
@@ -2168,18 +2235,18 @@ var RouteManager = class {
2168
2235
  )
2169
2236
  );
2170
2237
  this.orderedLayouts = Array.from(this.layouts.values()).sort(
2171
- (left, right) => _chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, left.pattern) - _chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, right.pattern)
2172
- ).map((entry) => ({ entry, groupScope: _chunkTSFMFPRUcjs.getRouteGroupScope.call(void 0, entry.pattern) }));
2238
+ (left, right) => _chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, left.pattern) - _chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, right.pattern)
2239
+ ).map((entry) => ({ entry, groupScope: _chunkO27PLNQZcjs.getRouteGroupScope.call(void 0, entry.pattern) }));
2173
2240
  for (const slot of this.routeSlots.values()) {
2174
2241
  if (!this.routeSlotOwnerSegments.has(slot.ownerPattern)) {
2175
2242
  this.routeSlotOwnerSegments.set(
2176
2243
  slot.ownerPattern,
2177
- _chunkVQJYGZNXcjs.parseRoutePath.call(void 0, `${slot.ownerPattern}/page.tsx`).segments
2244
+ _chunkQMNWKQL4cjs.parseRoutePath.call(void 0, `${slot.ownerPattern}/page.tsx`).segments
2178
2245
  );
2179
2246
  }
2180
2247
  }
2181
2248
  if (process.env.FARM_VERBOSE) {
2182
- _chunkVQJYGZNXcjs.logger.info(
2249
+ _chunkQMNWKQL4cjs.logger.info(
2183
2250
  `Discovered ${this.routes.size} pages, ${this.layouts.size} layouts, and ${this.metadataRoutes.size} metadata routes`
2184
2251
  );
2185
2252
  }
@@ -2193,11 +2260,11 @@ var RouteManager = class {
2193
2260
  matchRoute(pathname, options = {}) {
2194
2261
  const routePathname = this.toRoutePathname(pathname);
2195
2262
  const normalizedPath = routePathname === "/" ? "/" : routePathname.replace(/\/$/, "");
2196
- const pathParts = _chunkVQJYGZNXcjs.splitRoutePath.call(void 0, normalizedPath);
2263
+ const pathParts = _chunkQMNWKQL4cjs.splitRoutePath.call(void 0, normalizedPath);
2197
2264
  let matchedRoute = null;
2198
2265
  let params = {};
2199
2266
  for (const routeEntry of this.routes.values()) {
2200
- const match = _chunkVQJYGZNXcjs.matchRouteParts.call(void 0, pathParts, routeEntry.route.segments);
2267
+ const match = _chunkQMNWKQL4cjs.matchRouteParts.call(void 0, pathParts, routeEntry.route.segments);
2201
2268
  if (match.matches) {
2202
2269
  matchedRoute = routeEntry;
2203
2270
  params = match.params;
@@ -2235,7 +2302,7 @@ var RouteManager = class {
2235
2302
  throw new Error(`Cannot resolve runtime configuration for unknown route "${pattern}"`);
2236
2303
  }
2237
2304
  const inherited = _chunkOYZXVBZPcjs.resolveFarmRouteRuleRuntimeConfig.call(void 0, pattern, this.config.routeRules);
2238
- const layouts = this.findMatchingLayouts(_chunkVQJYGZNXcjs.splitRoutePath.call(void 0, pattern), routeEntry);
2305
+ const layouts = this.findMatchingLayouts(_chunkQMNWKQL4cjs.splitRoutePath.call(void 0, pattern), routeEntry);
2239
2306
  const layoutConfigs = [];
2240
2307
  for (const layout of layouts) {
2241
2308
  const layoutModule = await this.loadLayoutModule(layout.modulePath);
@@ -2280,10 +2347,10 @@ var RouteManager = class {
2280
2347
  matchRedirect(pathname, search = "") {
2281
2348
  const i18n = this.getI18nConfig();
2282
2349
  const localeMatch = i18n ? _chunkOWQV6MLMcjs.resolveFarmLocalePath.call(void 0, pathname, i18n) : void 0;
2283
- const routePathname = _optionalChain([localeMatch, 'optionalAccess', _113 => _113.pathname]) || pathname;
2350
+ const routePathname = _optionalChain([localeMatch, 'optionalAccess', _115 => _115.pathname]) || pathname;
2284
2351
  const normalizedPath = routePathname === "/" ? "/" : routePathname.replace(/\/$/, "");
2285
2352
  for (const redirectEntry of this.redirects.values()) {
2286
- const match = _chunkVQJYGZNXcjs.matchRoute.call(void 0, normalizedPath, redirectEntry.route.segments);
2353
+ const match = _chunkQMNWKQL4cjs.matchRoute.call(void 0, normalizedPath, redirectEntry.route.segments);
2287
2354
  if (!match.matches) continue;
2288
2355
  const statusCode = redirectEntry.definition.statusCode || (redirectEntry.definition.permanent ? 308 : 307);
2289
2356
  return {
@@ -2291,7 +2358,7 @@ var RouteManager = class {
2291
2358
  destination: _chunkHXNLKCWHcjs.appendFarmRedirectQuery.call(void 0,
2292
2359
  this.localizeRedirectDestination(
2293
2360
  interpolateRedirectDestination(redirectEntry.definition.destination, match.params),
2294
- _optionalChain([localeMatch, 'optionalAccess', _114 => _114.locale])
2361
+ _optionalChain([localeMatch, 'optionalAccess', _116 => _116.locale])
2295
2362
  ),
2296
2363
  search
2297
2364
  ),
@@ -2324,7 +2391,7 @@ var RouteManager = class {
2324
2391
  const pagePath = normalizedPath.slice(0, -suffix.fileName.length - 1) || "/";
2325
2392
  for (const imageEntry of this.metadataImages.values()) {
2326
2393
  if (imageEntry.kind !== suffix.kind) continue;
2327
- const match = _chunkVQJYGZNXcjs.matchRoute.call(void 0, pagePath, imageEntry.route.segments);
2394
+ const match = _chunkQMNWKQL4cjs.matchRoute.call(void 0, pagePath, imageEntry.route.segments);
2328
2395
  if (!match.matches) continue;
2329
2396
  return {
2330
2397
  image: imageEntry,
@@ -2342,7 +2409,7 @@ var RouteManager = class {
2342
2409
  const routePath = normalizedPath.slice(0, -suffix.outputName.length - 1) || "/";
2343
2410
  for (const metadata of this.metadataRoutes.values()) {
2344
2411
  if (metadata.kind !== suffix.kind) continue;
2345
- const match = _chunkVQJYGZNXcjs.matchRoute.call(void 0, routePath, metadata.route.segments);
2412
+ const match = _chunkQMNWKQL4cjs.matchRoute.call(void 0, routePath, metadata.route.segments);
2346
2413
  if (!match.matches) continue;
2347
2414
  return { metadata, params: match.params, routePath };
2348
2415
  }
@@ -2356,7 +2423,7 @@ var RouteManager = class {
2356
2423
  for (const metadata of this.metadataRoutes.values()) {
2357
2424
  if (metadata.kind !== kind || metadata.route.segments.length > pathSegments.length) continue;
2358
2425
  const routePath = metadata.route.segments.length === 0 ? "/" : `/${pathSegments.slice(0, metadata.route.segments.length).join("/")}`;
2359
- const match = _chunkVQJYGZNXcjs.matchRoute.call(void 0, routePath, metadata.route.segments);
2426
+ const match = _chunkQMNWKQL4cjs.matchRoute.call(void 0, routePath, metadata.route.segments);
2360
2427
  if (!match.matches) continue;
2361
2428
  if (!bestMatch || metadata.route.segments.length > bestMatch.metadata.route.segments.length) {
2362
2429
  bestMatch = { metadata, params: match.params, routePath };
@@ -2377,7 +2444,7 @@ var RouteManager = class {
2377
2444
  if (imageEntry.kind !== kind) continue;
2378
2445
  if (imageEntry.route.segments.length > pathSegments.length) continue;
2379
2446
  const candidatePath = imageEntry.route.segments.length === 0 ? "/" : `/${pathSegments.slice(0, imageEntry.route.segments.length).join("/")}`;
2380
- const match = _chunkVQJYGZNXcjs.matchRoute.call(void 0, candidatePath, imageEntry.route.segments);
2447
+ const match = _chunkQMNWKQL4cjs.matchRoute.call(void 0, candidatePath, imageEntry.route.segments);
2381
2448
  if (!match.matches) continue;
2382
2449
  if (!bestMatch || imageEntry.route.segments.length > bestMatch.image.route.segments.length) {
2383
2450
  bestMatch = {
@@ -2399,11 +2466,11 @@ var RouteManager = class {
2399
2466
  */
2400
2467
  generateClientManifest(projectRoot = this.config.root) {
2401
2468
  const normalizedProjectRoot = path5.default.resolve(projectRoot);
2402
- if (_optionalChain([this, 'access', _115 => _115.clientManifestCache, 'optionalAccess', _116 => _116.projectRoot]) === normalizedProjectRoot) {
2469
+ if (_optionalChain([this, 'access', _117 => _117.clientManifestCache, 'optionalAccess', _118 => _118.projectRoot]) === normalizedProjectRoot) {
2403
2470
  return this.clientManifestCache.manifest;
2404
2471
  }
2405
2472
  const toUrlPath = (absolutePath) => {
2406
- const rootRelative = _chunkVQJYGZNXcjs.toRootRelativeUrlPath.call(void 0, absolutePath, normalizedProjectRoot);
2473
+ const rootRelative = _chunkQMNWKQL4cjs.toRootRelativeUrlPath.call(void 0, absolutePath, normalizedProjectRoot);
2407
2474
  if (rootRelative !== void 0) return rootRelative;
2408
2475
  if (path5.default.isAbsolute(absolutePath)) {
2409
2476
  const normalized = absolutePath.replace(/\\/g, "/");
@@ -2411,21 +2478,21 @@ var RouteManager = class {
2411
2478
  }
2412
2479
  return absolutePath;
2413
2480
  };
2414
- const integrationProviders = _chunkCECUDGXQcjs.getIntegrationProviders.call(void 0, this.config.integrations).filter(
2481
+ const integrationProviders = _chunkZP32GNJQcjs.getIntegrationProviders.call(void 0, this.config.integrations).filter(
2415
2482
  (provider) => provider.component || provider.type === "clerk"
2416
2483
  );
2417
2484
  const unsupportedIntegrationProvider = integrationProviders.find(
2418
2485
  (provider) => provider.supportsIsolatedHydration !== true
2419
2486
  );
2420
- if (_optionalChain([this, 'access', _117 => _117.config, 'access', _118 => _118.experimental, 'optionalAccess', _119 => _119.isolatedClientHydration]) === "enabled" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _120 => _120.config, 'access', _121 => _121.experimental, 'optionalAccess', _122 => _122.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
2421
- _chunkVQJYGZNXcjs.logger.warn(
2487
+ if (_optionalChain([this, 'access', _119 => _119.config, 'access', _120 => _120.experimental, 'optionalAccess', _121 => _121.isolatedClientHydration]) === "enabled" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _122 => _122.config, 'access', _123 => _123.experimental, 'optionalAccess', _124 => _124.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
2488
+ _chunkQMNWKQL4cjs.logger.warn(
2422
2489
  `[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
2423
2490
  );
2424
2491
  }
2425
2492
  const isolatedMode = resolveFarmIsolatedClientHydrationMode(
2426
- _optionalChain([this, 'access', _123 => _123.config, 'access', _124 => _124.experimental, 'optionalAccess', _125 => _125.isolatedClientHydration]),
2493
+ _optionalChain([this, 'access', _125 => _125.config, 'access', _126 => _126.experimental, 'optionalAccess', _127 => _127.isolatedClientHydration]),
2427
2494
  {
2428
- serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _126 => _126.config, 'access', _127 => _127.experimental, 'optionalAccess', _128 => _128.serverComponents])) === "rsc",
2495
+ serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _128 => _128.config, 'access', _129 => _129.experimental, 'optionalAccess', _130 => _130.serverComponents])) === "rsc",
2429
2496
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
2430
2497
  }
2431
2498
  );
@@ -2433,7 +2500,7 @@ var RouteManager = class {
2433
2500
  this.config.renderer,
2434
2501
  Boolean(unsupportedIntegrationProvider)
2435
2502
  );
2436
- const islandsMode = _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _129 => _129.config, 'access', _130 => _130.experimental, 'optionalAccess', _131 => _131.serverComponents])) === "islands";
2503
+ const islandsMode = _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _131 => _131.config, 'access', _132 => _132.experimental, 'optionalAccess', _133 => _133.serverComponents])) === "islands";
2437
2504
  const layoutEntries = Array.from(this.layouts.values()).map((entry) => ({
2438
2505
  entry,
2439
2506
  metadata: getClientModuleHydrationPlan(
@@ -2451,56 +2518,57 @@ var RouteManager = class {
2451
2518
  );
2452
2519
  const routeEntries = Array.from(this.routes.values()).map((entry) => ({
2453
2520
  entry,
2454
- metadata: _chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? markdownPagePlan() : getClientModuleHydrationPlan(entry.modulePath, normalizedProjectRoot, isolatedMode, {
2521
+ metadata: _chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? markdownPagePlan() : getClientModuleHydrationPlan(entry.modulePath, normalizedProjectRoot, isolatedMode, {
2455
2522
  ...planOptions,
2456
- serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _132 => _132.config, 'access', _133 => _133.experimental, 'optionalAccess', _134 => _134.serverComponents])) === "islands"
2523
+ serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _134 => _134.config, 'access', _135 => _135.experimental, 'optionalAccess', _136 => _136.serverComponents])) === "islands"
2457
2524
  })
2458
2525
  }));
2459
2526
  const markdownFallback = routeEntries.find(
2460
- ({ entry, metadata }) => _chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.fallbackReason
2527
+ ({ entry, metadata }) => _chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.fallbackReason
2461
2528
  );
2462
2529
  if (markdownFallback) {
2463
- _chunkVQJYGZNXcjs.logger.warn(
2530
+ _chunkQMNWKQL4cjs.logger.warn(
2464
2531
  `[Farm.js] client components in Markdown pages stay static: ${markdownFallback.metadata.fallbackReason}.`
2465
2532
  );
2466
2533
  }
2467
- const markdownStaticPackages = _optionalChain([routeEntries, 'access', _135 => _135.find, 'call', _136 => _136(
2468
- ({ entry, metadata }) => _chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.staticPackageBoundaries
2469
- ), 'optionalAccess', _137 => _137.metadata, 'access', _138 => _138.staticPackageBoundaries]);
2534
+ const markdownStaticPackages = _optionalChain([routeEntries, 'access', _137 => _137.find, 'call', _138 => _138(
2535
+ ({ entry, metadata }) => _chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.staticPackageBoundaries
2536
+ ), 'optionalAccess', _139 => _139.metadata, 'access', _140 => _140.staticPackageBoundaries]);
2470
2537
  if (markdownStaticPackages) {
2471
- _chunkVQJYGZNXcjs.logger.info(
2538
+ _chunkQMNWKQL4cjs.logger.info(
2472
2539
  `[Farm.js] Markdown pages render client components from ${markdownStaticPackages.join(", ")} as static HTML: package client components cannot be isolated yet.`
2473
2540
  );
2474
2541
  }
2475
2542
  for (const { entry, metadata } of [...layoutEntries, ...routeEntries]) {
2476
- if (_chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) || !metadata.staticPackageBoundaries) continue;
2477
- _chunkVQJYGZNXcjs.logger.info(
2478
- `[Farm.js] ${entry.pattern} is async, so it renders client components from ${metadata.staticPackageBoundaries.join(", ")} as static HTML: package client components cannot be isolated yet.`
2543
+ if (_chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) || !metadata.staticPackageBoundaries) continue;
2544
+ _chunkQMNWKQL4cjs.logger.info(
2545
+ `[Farm.js] ${entry.pattern} renders client components from ${metadata.staticPackageBoundaries.join(", ")} as static HTML: package client components cannot be isolated yet.`
2479
2546
  );
2480
2547
  }
2481
2548
  enforceFarmIsolatedHydrationRouteBudget(
2482
2549
  layoutEntries.map(({ entry, metadata }) => ({
2483
2550
  pattern: entry.pattern,
2484
- depth: _chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, entry.pattern),
2551
+ depth: _chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, entry.pattern),
2485
2552
  metadata
2486
2553
  })),
2487
2554
  routeEntries.map(({ entry, metadata }) => ({
2488
2555
  pattern: getRouteEntryDirectory(entry),
2489
- depth: _chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, getRouteEntryDirectory(entry)),
2556
+ depth: _chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, getRouteEntryDirectory(entry)),
2490
2557
  metadata
2491
2558
  })),
2492
- _chunkTSFMFPRUcjs.routeBoundaryCoversDirectory
2559
+ _chunkO27PLNQZcjs.routeBoundaryCoversDirectory,
2560
+ { serverOwners: islandsMode }
2493
2561
  );
2494
2562
  for (const { entry, metadata } of [...layoutEntries, ...routeEntries]) {
2495
2563
  if (!metadata.costGuardExceeded) continue;
2496
- _chunkVQJYGZNXcjs.logger.warn(
2564
+ _chunkQMNWKQL4cjs.logger.warn(
2497
2565
  `[Farm.js] isolated hydration kept route-wide for ${entry.modulePath}: ${metadata.fallbackReason}.`
2498
2566
  );
2499
2567
  }
2500
2568
  if (isolatedMode === "analyze") {
2501
2569
  for (const { entry, metadata } of [...layoutEntries, ...routeEntries]) {
2502
2570
  if (!metadata.isolatedHydrationEligible) continue;
2503
- _chunkVQJYGZNXcjs.logger.info(
2571
+ _chunkQMNWKQL4cjs.logger.info(
2504
2572
  `[Farm.js] isolated hydration analysis: ${entry.modulePath} can keep ${metadata.isolatedBoundaries.length} client ${metadata.isolatedBoundaries.length === 1 ? "boundary" : "boundaries"} while excluding its server owner from the browser graph.`
2505
2573
  );
2506
2574
  }
@@ -2508,7 +2576,7 @@ var RouteManager = class {
2508
2576
  const routes = routeEntries.map(({ entry, metadata }) => {
2509
2577
  const programmaticPage = this.programmaticPages.get(entry.modulePath);
2510
2578
  const layoutShouldHydrate = layoutEntries.some(
2511
- ({ entry: layout, metadata: layoutMetadata }) => layoutMetadata.shouldHydrate && _chunkTSFMFPRUcjs.routeBoundaryCoversDirectory.call(void 0, layout.pattern, getRouteEntryDirectory(entry))
2579
+ ({ entry: layout, metadata: layoutMetadata }) => layoutMetadata.shouldHydrate && _chunkO27PLNQZcjs.routeBoundaryCoversDirectory.call(void 0, layout.pattern, getRouteEntryDirectory(entry))
2512
2580
  );
2513
2581
  return {
2514
2582
  pattern: entry.pattern,
@@ -2525,14 +2593,14 @@ var RouteManager = class {
2525
2593
  }))
2526
2594
  } : {},
2527
2595
  ...usesFarmServerTree(metadata) ? { serverTree: true } : {},
2528
- renderPlan: _chunkTSFMFPRUcjs.createFarmRouteRenderPlan.call(void 0, {
2596
+ renderPlan: _chunkO27PLNQZcjs.createFarmRouteRenderPlan.call(void 0, {
2529
2597
  pageShouldHydrate: metadata.shouldHydrate,
2530
2598
  layoutShouldHydrate,
2531
2599
  islandStrategy: metadata.islandStrategy
2532
2600
  }),
2533
2601
  suppressedAsyncHydration: metadata.suppressedAsyncHydration,
2534
2602
  ...metadata.suppressedAsyncHydration && metadata.fallbackReason ? { suppressedAsyncHydrationReason: metadata.fallbackReason } : {},
2535
- search: _chunkE7QOEV5Zcjs.getProgrammaticRouteSearchClientOptions.call(void 0, _optionalChain([programmaticPage, 'optionalAccess', _139 => _139.search])),
2603
+ search: _chunkE7QOEV5Zcjs.getProgrammaticRouteSearchClientOptions.call(void 0, _optionalChain([programmaticPage, 'optionalAccess', _141 => _141.search])),
2536
2604
  segments: entry.route.segments.map((seg) => ({
2537
2605
  segment: seg.segment,
2538
2606
  isDynamic: seg.isDynamic,
@@ -2541,7 +2609,7 @@ var RouteManager = class {
2541
2609
  }))
2542
2610
  };
2543
2611
  });
2544
- const treeLayoutPatterns = islandsMode ? _chunkTSFMFPRUcjs.getFarmServerTreeLayoutPatterns.call(void 0,
2612
+ const treeLayoutPatterns = islandsMode ? _chunkO27PLNQZcjs.getFarmServerTreeLayoutPatterns.call(void 0,
2545
2613
  layoutEntries.map(({ entry, metadata }) => ({
2546
2614
  pattern: entry.pattern,
2547
2615
  shouldHydrate: metadata.shouldHydrate,
@@ -2598,7 +2666,7 @@ var RouteManager = class {
2598
2666
  for (const error of islandsErrors) {
2599
2667
  if (this.reportedIslandsErrors.has(error)) continue;
2600
2668
  this.reportedIslandsErrors.add(error);
2601
- _chunkVQJYGZNXcjs.logger.error(`[Farm.js] islands mode cannot hydrate ${error}`);
2669
+ _chunkQMNWKQL4cjs.logger.error(`[Farm.js] islands mode cannot hydrate ${error}`);
2602
2670
  }
2603
2671
  const manifest = { routes, layouts, slots };
2604
2672
  this.clientManifestCache = {
@@ -2637,7 +2705,7 @@ var RouteManager = class {
2637
2705
  getIsolatedClientBoundaryModules(projectRoot = this.config.root) {
2638
2706
  const normalizedProjectRoot = path5.default.resolve(projectRoot);
2639
2707
  this.generateClientManifest(normalizedProjectRoot);
2640
- return _nullishCoalesce(_optionalChain([this, 'access', _140 => _140.clientManifestCache, 'optionalAccess', _141 => _141.isolatedClientBoundaryModules]), () => ( /* @__PURE__ */ new Set()));
2708
+ return _nullishCoalesce(_optionalChain([this, 'access', _142 => _142.clientManifestCache, 'optionalAccess', _143 => _143.isolatedClientBoundaryModules]), () => ( /* @__PURE__ */ new Set()));
2641
2709
  }
2642
2710
  /**
2643
2711
  * @internal Islands-mode pages with a client component that cannot become an island. Hydrating
@@ -2645,7 +2713,7 @@ var RouteManager = class {
2645
2713
  */
2646
2714
  getIslandsErrors(projectRoot = this.config.root) {
2647
2715
  this.generateClientManifest(path5.default.resolve(projectRoot));
2648
- return _nullishCoalesce(_optionalChain([this, 'access', _142 => _142.clientManifestCache, 'optionalAccess', _143 => _143.islandsErrors]), () => ( []));
2716
+ return _nullishCoalesce(_optionalChain([this, 'access', _144 => _144.clientManifestCache, 'optionalAccess', _145 => _145.islandsErrors]), () => ( []));
2649
2717
  }
2650
2718
  /**
2651
2719
  * Invalidate build-time route metadata after a page or layout changes in dev.
@@ -2664,13 +2732,13 @@ var RouteManager = class {
2664
2732
  const { createRouteModuleFromProgrammaticPage } = await import("./routes.cjs");
2665
2733
  return createRouteModuleFromProgrammaticPage(programmaticPage, this.rendererRuntime);
2666
2734
  }
2667
- if (_chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, modulePath)) {
2735
+ if (_chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, modulePath)) {
2668
2736
  const mdxConfig = _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, this.config.mdx);
2669
- const components = await _chunkUJL4JOXVcjs.loadFarmMdxComponents.call(void 0, mdxConfig, {
2737
+ const components = await _chunkCI4UNQHOcjs.loadFarmMdxComponents.call(void 0, mdxConfig, {
2670
2738
  root: this.config.root,
2671
2739
  loadModule: this.viteServer ? (componentModulePath) => _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, this.viteServer, componentModulePath) : void 0
2672
2740
  });
2673
- return await _chunkUJL4JOXVcjs.createFarmMarkdownRouteModuleFromFile.call(void 0, modulePath, {
2741
+ return await _chunkCI4UNQHOcjs.createFarmMarkdownRouteModuleFromFile.call(void 0, modulePath, {
2674
2742
  components,
2675
2743
  config: mdxConfig
2676
2744
  });
@@ -2686,7 +2754,7 @@ var RouteManager = class {
2686
2754
  return module;
2687
2755
  }
2688
2756
  } catch (error) {
2689
- _chunkVQJYGZNXcjs.logger.error(`Failed to load route module: ${modulePath}`);
2757
+ _chunkQMNWKQL4cjs.logger.error(`Failed to load route module: ${modulePath}`);
2690
2758
  throw error;
2691
2759
  }
2692
2760
  }
@@ -2711,7 +2779,7 @@ var RouteManager = class {
2711
2779
  return module;
2712
2780
  }
2713
2781
  } catch (error) {
2714
- _chunkVQJYGZNXcjs.logger.error(`Failed to load layout module: ${modulePath}`);
2782
+ _chunkQMNWKQL4cjs.logger.error(`Failed to load layout module: ${modulePath}`);
2715
2783
  throw error;
2716
2784
  }
2717
2785
  }
@@ -2720,7 +2788,7 @@ var RouteManager = class {
2720
2788
  */
2721
2789
  createRoutePattern(route) {
2722
2790
  if (route.segments.length === 0) return "/";
2723
- return "/" + route.segments.map(_chunkTSFMFPRUcjs.formatRouteSegment).join("/");
2791
+ return "/" + route.segments.map(_chunkO27PLNQZcjs.formatRouteSegment).join("/");
2724
2792
  }
2725
2793
  registerPageRoute(entry) {
2726
2794
  _chunkYTVSWXEZcjs.assertUniqueRouteParameters.call(void 0, entry.pattern);
@@ -2738,7 +2806,7 @@ var RouteManager = class {
2738
2806
  this.pageRouteShapes.set(shape, entry);
2739
2807
  }
2740
2808
  async discoverFileRoutes(source) {
2741
- const appDir = _chunkVQJYGZNXcjs.resolveAppPath.call(void 0, source.root, source.srcDir, "app");
2809
+ const appDir = _chunkQMNWKQL4cjs.resolveAppPath.call(void 0, source.root, source.srcDir, "app");
2742
2810
  const componentExtensions = _chunkRD623KW4cjs.getFarmRendererComponentExtensions.call(void 0, this.config.renderer).map(
2743
2811
  (extension) => extension.slice(1)
2744
2812
  );
@@ -2757,8 +2825,8 @@ var RouteManager = class {
2757
2825
  appDir
2758
2826
  );
2759
2827
  const canonicalPageGroups = /* @__PURE__ */ new Map();
2760
- for (const file of pageFiles.filter((candidate) => _chunkEHB77D5Ucjs.parseRouteSlotFile.call(void 0, candidate) === null)) {
2761
- const route = _chunkVQJYGZNXcjs.parseRoutePath.call(void 0, file);
2828
+ for (const file of pageFiles.filter((candidate) => _chunkZDAEHG2Ocjs.parseRouteSlotFile.call(void 0, candidate) === null)) {
2829
+ const route = _chunkQMNWKQL4cjs.parseRoutePath.call(void 0, file);
2762
2830
  const pattern = this.createRoutePattern(route);
2763
2831
  const group = canonicalPageGroups.get(pattern);
2764
2832
  if (group) {
@@ -2771,8 +2839,8 @@ var RouteManager = class {
2771
2839
  }
2772
2840
  }
2773
2841
  for (const [pattern, group] of canonicalPageGroups) {
2774
- const componentFiles = group.files.filter((file) => !_chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, file));
2775
- const markdownFiles = group.files.filter(_chunkB3GM5I6Ncjs.isFarmMarkdownPageFile);
2842
+ const componentFiles = group.files.filter((file) => !_chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, file));
2843
+ const markdownFiles = group.files.filter(_chunkPRFNLQSPcjs.isFarmMarkdownPageFile);
2776
2844
  if (componentFiles.length > 1) {
2777
2845
  throw new Error(
2778
2846
  `Duplicate page route "${pattern}". Found ${componentFiles.map((file) => path5.default.join(appDir, file)).join(" and ")}.`
@@ -2789,7 +2857,7 @@ var RouteManager = class {
2789
2857
  if (!primaryFile) continue;
2790
2858
  const modulePath = path5.default.join(appDir, primaryFile);
2791
2859
  const existing = this.routes.get(pattern);
2792
- if (_optionalChain([existing, 'optionalAccess', _144 => _144.sourceRoot]) === source.root) {
2860
+ if (_optionalChain([existing, 'optionalAccess', _146 => _146.sourceRoot]) === source.root) {
2793
2861
  throw new Error(
2794
2862
  `Duplicate page route "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
2795
2863
  );
@@ -2812,11 +2880,11 @@ var RouteManager = class {
2812
2880
  ["error", errorFiles, this.errors]
2813
2881
  ]) {
2814
2882
  for (const file of files) {
2815
- const route = _chunkVQJYGZNXcjs.parseRoutePath.call(void 0, file);
2883
+ const route = _chunkQMNWKQL4cjs.parseRoutePath.call(void 0, file);
2816
2884
  const modulePath = path5.default.join(appDir, file);
2817
- const pattern = _chunkTSFMFPRUcjs.createRouteDirectoryPattern.call(void 0, route);
2885
+ const pattern = _chunkO27PLNQZcjs.createRouteDirectoryPattern.call(void 0, route);
2818
2886
  const existing = target.get(pattern);
2819
- if (_optionalChain([existing, 'optionalAccess', _145 => _145.sourceRoot]) === source.root) {
2887
+ if (_optionalChain([existing, 'optionalAccess', _147 => _147.sourceRoot]) === source.root) {
2820
2888
  throw new Error(
2821
2889
  `Duplicate ${kind} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
2822
2890
  );
@@ -2831,15 +2899,15 @@ var RouteManager = class {
2831
2899
  }
2832
2900
  }
2833
2901
  for (const file of [...pageFiles, ...slotDefaultFiles]) {
2834
- const slot = _chunkEHB77D5Ucjs.parseRouteSlotFile.call(void 0, file);
2902
+ const slot = _chunkZDAEHG2Ocjs.parseRouteSlotFile.call(void 0, file);
2835
2903
  if (!slot) continue;
2836
2904
  const modulePath = path5.default.join(appDir, file);
2837
2905
  const pattern = this.createRoutePattern(slot.route);
2838
2906
  const ownerPattern = this.createRoutePattern(slot.ownerRoute);
2839
- const ownerDirectory = _chunkTSFMFPRUcjs.createRouteDirectoryPattern.call(void 0, slot.ownerRoute);
2907
+ const ownerDirectory = _chunkO27PLNQZcjs.createRouteDirectoryPattern.call(void 0, slot.ownerRoute);
2840
2908
  const key = `${ownerPattern}:${slot.name}:${slot.interception ? "intercept" : "slot"}:${slot.fallback ? "default" : pattern}`;
2841
2909
  const existing = this.routeSlots.get(key);
2842
- if (_optionalChain([existing, 'optionalAccess', _146 => _146.sourceRoot]) === source.root) {
2910
+ if (_optionalChain([existing, 'optionalAccess', _148 => _148.sourceRoot]) === source.root) {
2843
2911
  throw new Error(
2844
2912
  `Duplicate route slot "${slot.name}" for "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
2845
2913
  );
@@ -2855,20 +2923,20 @@ var RouteManager = class {
2855
2923
  ...ownerDirectory === ownerPattern ? {} : { ownerDirectory },
2856
2924
  interception: slot.interception,
2857
2925
  fallback: slot.fallback,
2858
- containerId: _chunkEHB77D5Ucjs.createRouteSlotContainerId.call(void 0, slot.name, ownerPattern)
2926
+ containerId: _chunkZDAEHG2Ocjs.createRouteSlotContainerId.call(void 0, slot.name, ownerPattern)
2859
2927
  });
2860
2928
  }
2861
2929
  for (const file of metadataImageFiles) {
2862
2930
  const fileBase = path5.default.basename(file, path5.default.extname(file));
2863
2931
  const kind = fileBase === "twitter-image" ? "twitter" : "opengraph";
2864
2932
  const fileName = kind === "twitter" ? "twitter-image" : "opengraph-image";
2865
- const route = _chunkVQJYGZNXcjs.parseRoutePath.call(void 0, file);
2933
+ const route = _chunkQMNWKQL4cjs.parseRoutePath.call(void 0, file);
2866
2934
  const modulePath = path5.default.join(appDir, file);
2867
2935
  const pattern = this.createRoutePattern(route);
2868
2936
  const key = `${kind}:${pattern}`;
2869
2937
  const existing = this.metadataImages.get(key);
2870
2938
  const sourceType = isStaticMetadataImageFile(file) ? "static" : "module";
2871
- if (_optionalChain([existing, 'optionalAccess', _147 => _147.sourceRoot]) === source.root) {
2939
+ if (_optionalChain([existing, 'optionalAccess', _149 => _149.sourceRoot]) === source.root) {
2872
2940
  throw new Error(
2873
2941
  `Duplicate ${fileName} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}. Keep only one static image or module per route segment.`
2874
2942
  );
@@ -2891,12 +2959,12 @@ var RouteManager = class {
2891
2959
  path5.default.basename(file, path5.default.extname(file))
2892
2960
  );
2893
2961
  if (!descriptor) continue;
2894
- const route = _chunkVQJYGZNXcjs.parseRoutePath.call(void 0, file);
2962
+ const route = _chunkQMNWKQL4cjs.parseRoutePath.call(void 0, file);
2895
2963
  const modulePath = path5.default.join(appDir, file);
2896
2964
  const pattern = this.createRoutePattern(route);
2897
2965
  const key = `${descriptor.kind}:${pattern}`;
2898
2966
  const existing = this.metadataRoutes.get(key);
2899
- if (_optionalChain([existing, 'optionalAccess', _148 => _148.sourceRoot]) === source.root) {
2967
+ if (_optionalChain([existing, 'optionalAccess', _150 => _150.sourceRoot]) === source.root) {
2900
2968
  throw new Error(
2901
2969
  `Duplicate ${descriptor.fileName} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}. Keep only one .ts or .js metadata route per segment.`
2902
2970
  );
@@ -2935,7 +3003,7 @@ var RouteManager = class {
2935
3003
  const route = _chunkE7QOEV5Zcjs.parseProgrammaticRoutePath.call(void 0, definition.path, "page");
2936
3004
  const pattern = this.createRoutePattern(route);
2937
3005
  const existing = this.routes.get(pattern);
2938
- if (_optionalChain([existing, 'optionalAccess', _149 => _149.sourceRoot]) === source.root) {
3006
+ if (_optionalChain([existing, 'optionalAccess', _151 => _151.sourceRoot]) === source.root) {
2939
3007
  throw new Error(
2940
3008
  `Duplicate page route "${pattern}". Found both ${existing.modulePath} and programmatic route in ${filePath}.`
2941
3009
  );
@@ -2953,9 +3021,9 @@ var RouteManager = class {
2953
3021
  }
2954
3022
  if (definition.kind === "layout") {
2955
3023
  const route = _chunkE7QOEV5Zcjs.parseProgrammaticRoutePath.call(void 0, definition.path, "layout");
2956
- const pattern = _chunkTSFMFPRUcjs.createRouteDirectoryPattern.call(void 0, route);
3024
+ const pattern = _chunkO27PLNQZcjs.createRouteDirectoryPattern.call(void 0, route);
2957
3025
  const existing = this.layouts.get(pattern);
2958
- if (_optionalChain([existing, 'optionalAccess', _150 => _150.sourceRoot]) === source.root) {
3026
+ if (_optionalChain([existing, 'optionalAccess', _152 => _152.sourceRoot]) === source.root) {
2959
3027
  throw new Error(
2960
3028
  `Duplicate layout route "${pattern}". Found both ${existing.modulePath} and programmatic route in ${filePath}.`
2961
3029
  );
@@ -2984,8 +3052,8 @@ var RouteManager = class {
2984
3052
  }
2985
3053
  async loadProgrammaticRoutesModule(filePath) {
2986
3054
  if (this.viteServer) {
2987
- const viteRoot = _optionalChain([this, 'access', _151 => _151.viteServer, 'access', _152 => _152.config, 'optionalAccess', _153 => _153.root]) || this.config.root || process.cwd();
2988
- return await _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, this.viteServer, _chunkVQJYGZNXcjs.toViteModuleId.call(void 0, filePath, viteRoot));
3055
+ const viteRoot = _optionalChain([this, 'access', _153 => _153.viteServer, 'access', _154 => _154.config, 'optionalAccess', _155 => _155.root]) || this.config.root || process.cwd();
3056
+ return await _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, this.viteServer, _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, filePath, viteRoot));
2989
3057
  }
2990
3058
  return await import(
2991
3059
  /* @vite-ignore */
@@ -2999,8 +3067,8 @@ var RouteManager = class {
2999
3067
  findMatchingLayouts(pathnameParts, route) {
3000
3068
  const matchingLayouts = [];
3001
3069
  for (const { entry, groupScope } of this.orderedLayouts) {
3002
- if (!_chunkVQJYGZNXcjs.matchRoutePrefixParts.call(void 0, pathnameParts, entry.route.segments)) continue;
3003
- if (groupScope !== null && !_chunkTSFMFPRUcjs.isInRouteGroupScope.call(void 0, route && getRouteEntryDirectory(route), groupScope)) {
3070
+ if (!_chunkQMNWKQL4cjs.matchRoutePrefixParts.call(void 0, pathnameParts, entry.route.segments)) continue;
3071
+ if (groupScope !== null && !_chunkO27PLNQZcjs.isInRouteGroupScope.call(void 0, route && getRouteEntryDirectory(route), groupScope)) {
3004
3072
  continue;
3005
3073
  }
3006
3074
  matchingLayouts.push(entry);
@@ -3009,7 +3077,7 @@ var RouteManager = class {
3009
3077
  }
3010
3078
  matchPageRoute(pathnameParts) {
3011
3079
  for (const routeEntry of this.routes.values()) {
3012
- if (_chunkVQJYGZNXcjs.matchRouteParts.call(void 0, pathnameParts, routeEntry.route.segments).matches) return routeEntry;
3080
+ if (_chunkQMNWKQL4cjs.matchRouteParts.call(void 0, pathnameParts, routeEntry.route.segments).matches) return routeEntry;
3013
3081
  }
3014
3082
  return null;
3015
3083
  }
@@ -3023,14 +3091,14 @@ var RouteManager = class {
3023
3091
  groups.set(key, entries);
3024
3092
  }
3025
3093
  const normalizedFrom = interceptFrom ? this.toRoutePathname(new URL(interceptFrom, "http://farm.local").pathname) : void 0;
3026
- const normalizedFromParts = normalizedFrom ? _chunkVQJYGZNXcjs.splitRoutePath.call(void 0, normalizedFrom) : void 0;
3094
+ const normalizedFromParts = normalizedFrom ? _chunkQMNWKQL4cjs.splitRoutePath.call(void 0, normalizedFrom) : void 0;
3027
3095
  const matches = [];
3028
3096
  for (const entries of groups.values()) {
3029
3097
  const candidates = entries.filter((entry) => !entry.fallback).filter(
3030
3098
  (entry) => !entry.interception || normalizedFrom !== void 0 && this.matchesRoutePrefix(normalizedFrom, entry.ownerPattern, normalizedFromParts)
3031
3099
  ).map((entry) => ({
3032
3100
  entry,
3033
- match: _chunkVQJYGZNXcjs.matchRouteParts.call(void 0, pathnameParts, entry.route.segments)
3101
+ match: _chunkQMNWKQL4cjs.matchRouteParts.call(void 0, pathnameParts, entry.route.segments)
3034
3102
  })).filter((candidate) => candidate.match.matches).sort((left, right) => {
3035
3103
  if (left.entry.interception !== right.entry.interception) {
3036
3104
  return left.entry.interception ? -1 : 1;
@@ -3070,25 +3138,25 @@ var RouteManager = class {
3070
3138
  return ownerDifference || left.name.localeCompare(right.name);
3071
3139
  });
3072
3140
  }
3073
- matchesRoutePrefix(pathname, pattern, pathnameParts = _chunkVQJYGZNXcjs.splitRoutePath.call(void 0, pathname)) {
3141
+ matchesRoutePrefix(pathname, pattern, pathnameParts = _chunkQMNWKQL4cjs.splitRoutePath.call(void 0, pathname)) {
3074
3142
  if (pattern === "/") return true;
3075
- const patternSegments = _nullishCoalesce(this.routeSlotOwnerSegments.get(pattern), () => ( _chunkVQJYGZNXcjs.parseRoutePath.call(void 0, `${pattern}/page.tsx`).segments));
3076
- return _chunkVQJYGZNXcjs.matchRoutePrefixParts.call(void 0, pathnameParts, patternSegments);
3143
+ const patternSegments = _nullishCoalesce(this.routeSlotOwnerSegments.get(pattern), () => ( _chunkQMNWKQL4cjs.parseRoutePath.call(void 0, `${pattern}/page.tsx`).segments));
3144
+ return _chunkQMNWKQL4cjs.matchRoutePrefixParts.call(void 0, pathnameParts, patternSegments);
3077
3145
  }
3078
3146
  findNearestBoundary(pathname, boundaries, route) {
3079
3147
  const normalizedPath = pathname === "/" ? "/" : pathname.replace(/\/$/, "");
3080
3148
  let bestMatch = null;
3081
3149
  let page = route;
3082
3150
  for (const boundaryEntry of boundaries.values()) {
3083
- if (!_chunkVQJYGZNXcjs.matchRoutePrefix.call(void 0, normalizedPath, boundaryEntry.route.segments)) continue;
3084
- const groupScope = _chunkTSFMFPRUcjs.getRouteGroupScope.call(void 0, boundaryEntry.pattern);
3151
+ if (!_chunkQMNWKQL4cjs.matchRoutePrefix.call(void 0, normalizedPath, boundaryEntry.route.segments)) continue;
3152
+ const groupScope = _chunkO27PLNQZcjs.getRouteGroupScope.call(void 0, boundaryEntry.pattern);
3085
3153
  if (groupScope !== null) {
3086
- if (page === void 0) page = this.matchPageRoute(_chunkVQJYGZNXcjs.splitRoutePath.call(void 0, normalizedPath));
3087
- if (!_chunkTSFMFPRUcjs.isInRouteGroupScope.call(void 0, page && getRouteEntryDirectory(page), groupScope)) continue;
3154
+ if (page === void 0) page = this.matchPageRoute(_chunkQMNWKQL4cjs.splitRoutePath.call(void 0, normalizedPath));
3155
+ if (!_chunkO27PLNQZcjs.isInRouteGroupScope.call(void 0, page && getRouteEntryDirectory(page), groupScope)) continue;
3088
3156
  }
3089
3157
  const depth = boundaryEntry.route.segments.length;
3090
- const bestDepth = _nullishCoalesce(_optionalChain([bestMatch, 'optionalAccess', _154 => _154.route, 'access', _155 => _155.segments, 'access', _156 => _156.length]), () => ( -1));
3091
- if (!bestMatch || depth > bestDepth || depth === bestDepth && _chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, boundaryEntry.pattern) > _chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, bestMatch.pattern)) {
3158
+ const bestDepth = _nullishCoalesce(_optionalChain([bestMatch, 'optionalAccess', _156 => _156.route, 'access', _157 => _157.segments, 'access', _158 => _158.length]), () => ( -1));
3159
+ if (!bestMatch || depth > bestDepth || depth === bestDepth && _chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, boundaryEntry.pattern) > _chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, bestMatch.pattern)) {
3092
3160
  bestMatch = boundaryEntry;
3093
3161
  }
3094
3162
  }
@@ -3099,13 +3167,13 @@ var RouteManager = class {
3099
3167
  */
3100
3168
  logRoutes() {
3101
3169
  if (this.routes.size > 0) {
3102
- _chunkVQJYGZNXcjs.logger.info("Registered routes:");
3170
+ _chunkQMNWKQL4cjs.logger.info("Registered routes:");
3103
3171
  for (const [pattern, entry] of this.routes) {
3104
3172
  console.log(` ${pattern} -> ${entry.modulePath}`);
3105
3173
  }
3106
3174
  }
3107
3175
  if (this.layouts.size > 0) {
3108
- _chunkVQJYGZNXcjs.logger.info("Registered layouts:");
3176
+ _chunkQMNWKQL4cjs.logger.info("Registered layouts:");
3109
3177
  for (const [pattern, entry] of this.layouts) {
3110
3178
  console.log(` ${pattern} -> ${entry.modulePath}`);
3111
3179
  }
@@ -3138,7 +3206,7 @@ var RouteManager = class {
3138
3206
  }));
3139
3207
  const i18n = this.getI18nConfig();
3140
3208
  const docsAdapterRoutes = this.getDocsAdapterRoutes();
3141
- const result = await _chunkUQHIWZZ6cjs.collectSSGPages.call(void 0, routes, (filePath) => this.loadRouteModule(filePath), {
3209
+ const result = await _chunk3TL3AH25cjs.collectSSGPages.call(void 0, routes, (filePath) => this.loadRouteModule(filePath), {
3142
3210
  suggestStaticRendering: shouldSuggestStaticRenderingForI18n(i18n),
3143
3211
  ...docsAdapterRoutes ? { docsAdapterRoutes } : {}
3144
3212
  });
@@ -3184,7 +3252,7 @@ var RouteManager = class {
3184
3252
  async isRouteSSG(modulePath) {
3185
3253
  try {
3186
3254
  const mod = await this.loadRouteModule(modulePath);
3187
- const rendering = await _chunkUQHIWZZ6cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
3255
+ const rendering = await _chunk3TL3AH25cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
3188
3256
  return rendering.ssg;
3189
3257
  } catch (e11) {
3190
3258
  return false;
@@ -3196,7 +3264,7 @@ var RouteManager = class {
3196
3264
  async hasRouteISR(modulePath) {
3197
3265
  try {
3198
3266
  const mod = await this.loadRouteModule(modulePath);
3199
- const rendering = await _chunkUQHIWZZ6cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
3267
+ const rendering = await _chunk3TL3AH25cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
3200
3268
  return rendering.ssg && typeof rendering.revalidate === "number" && rendering.revalidate > 0;
3201
3269
  } catch (e12) {
3202
3270
  return false;
@@ -3208,7 +3276,7 @@ var RouteManager = class {
3208
3276
  async getRouteRevalidateInterval(modulePath) {
3209
3277
  try {
3210
3278
  const mod = await this.loadRouteModule(modulePath);
3211
- const rendering = await _chunkUQHIWZZ6cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
3279
+ const rendering = await _chunk3TL3AH25cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
3212
3280
  return rendering.revalidate;
3213
3281
  } catch (e13) {
3214
3282
  return void 0;
@@ -3216,7 +3284,7 @@ var RouteManager = class {
3216
3284
  }
3217
3285
  };
3218
3286
  function getPageDirectoryField(route, pattern) {
3219
- const directory = _chunkTSFMFPRUcjs.createRouteDirectoryPattern.call(void 0, route);
3287
+ const directory = _chunkO27PLNQZcjs.createRouteDirectoryPattern.call(void 0, route);
3220
3288
  return directory === pattern ? {} : { directory };
3221
3289
  }
3222
3290
  function interpolateRedirectDestination(destination, params) {
@@ -3289,7 +3357,7 @@ function replaceAll(input, search, replacement) {
3289
3357
  }
3290
3358
  async function safeGlobFiles(pattern, cwd) {
3291
3359
  try {
3292
- return await _chunkVQJYGZNXcjs.globFiles.call(void 0, pattern, cwd);
3360
+ return await _chunkQMNWKQL4cjs.globFiles.call(void 0, pattern, cwd);
3293
3361
  } catch (e14) {
3294
3362
  return [];
3295
3363
  }
@@ -3312,17 +3380,18 @@ function resolveDevGlobalStylesheetHref(root, srcDir = "src") {
3312
3380
  }
3313
3381
  var STYLE_EXTENSIONS = /\.(css|scss|sass|less|styl|stylus)(?:$|\?)/;
3314
3382
  var ALREADY_LINKED = "/src/app/globals.css";
3315
- function collectDevStylesheetUrls(modules, alreadyLinked = ALREADY_LINKED) {
3383
+ function collectDevStylesheetUrls(modules, alreadyLinked = ALREADY_LINKED, options = {}) {
3316
3384
  const seen = /* @__PURE__ */ new Set();
3317
3385
  for (const mod of modules) {
3318
3386
  const id = _nullishCoalesce(_nullishCoalesce(mod.id, () => ( mod.file)), () => ( ""));
3319
3387
  if (!STYLE_EXTENSIONS.test(id)) continue;
3320
- if (id.includes(".module.")) continue;
3388
+ const cssModule = id.includes(".module.");
3389
+ if (cssModule && !options.cssModules) continue;
3321
3390
  const url = mod.url;
3322
3391
  if (!url || !url.startsWith("/")) continue;
3323
3392
  const bare = url.split("?")[0];
3324
3393
  if (bare === alreadyLinked) continue;
3325
- seen.add(bare);
3394
+ seen.add(cssModule ? `${bare}?direct` : bare);
3326
3395
  }
3327
3396
  return [...seen].sort();
3328
3397
  }
@@ -3387,7 +3456,7 @@ function farmFontImportsPlugin(options = {}) {
3387
3456
  return;
3388
3457
  }
3389
3458
  const resource = registry.getDevResource(pathname);
3390
- if (!_optionalChain([resource, 'optionalAccess', _157 => _157.bytes])) {
3459
+ if (!_optionalChain([resource, 'optionalAccess', _159 => _159.bytes])) {
3391
3460
  next();
3392
3461
  return;
3393
3462
  }
@@ -3905,7 +3974,7 @@ function readFontOptions(code, id, call) {
3905
3974
  const declaration = call.ancestors.at(-2);
3906
3975
  const statement = call.ancestors.at(-3);
3907
3976
  const statementParent = call.ancestors.at(-4);
3908
- const isModuleScope = _optionalChain([declaration, 'optionalAccess', _158 => _158.type]) === "VariableDeclaration" && (_optionalChain([statement, 'optionalAccess', _159 => _159.type]) === "Program" || _optionalChain([statement, 'optionalAccess', _160 => _160.type]) === "ExportNamedDeclaration" && _optionalChain([statementParent, 'optionalAccess', _161 => _161.type]) === "Program");
3977
+ const isModuleScope = _optionalChain([declaration, 'optionalAccess', _160 => _160.type]) === "VariableDeclaration" && (_optionalChain([statement, 'optionalAccess', _161 => _161.type]) === "Program" || _optionalChain([statement, 'optionalAccess', _162 => _162.type]) === "ExportNamedDeclaration" && _optionalChain([statementParent, 'optionalAccess', _163 => _163.type]) === "Program");
3909
3978
  if (!isModuleScope || call.ancestors.some((ancestor) => isFunctionNode(ancestor))) {
3910
3979
  throw fontError(id, `${call.kind}() must be declared directly at module scope`);
3911
3980
  }
@@ -4341,7 +4410,7 @@ function generateFarmIntegrationProviderClientCode(providers, root, rendererComp
4341
4410
  let hasClerkProvider = false;
4342
4411
  renderedProviders.forEach((provider, index) => {
4343
4412
  let componentExpression = "null";
4344
- if (_chunkCECUDGXQcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
4413
+ if (_chunkZP32GNJQcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
4345
4414
  const namespace = `FarmIntegrationProviderModule${index}`;
4346
4415
  imports.push(
4347
4416
  `import * as ${namespace} from ${JSON.stringify(resolveProviderModule(provider.component.module, root))};`
@@ -4398,7 +4467,7 @@ function generateFarmIntegrationProviderServerModules(providers, root, rendererC
4398
4467
  const entries = [];
4399
4468
  let needsMarkHelper = false;
4400
4469
  providers.forEach((provider, index) => {
4401
- if (!_chunkCECUDGXQcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) return;
4470
+ if (!_chunkZP32GNJQcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) return;
4402
4471
  const namespace = `FarmServerIntegrationProviderModule${index}`;
4403
4472
  imports.push(
4404
4473
  `import * as ${namespace} from ${JSON.stringify(resolveProviderModule(provider.component.module, root))};`
@@ -4423,151 +4492,548 @@ function generateFarmIntegrationProviderServerModules(providers, root, rendererC
4423
4492
  }
4424
4493
  function resolveProviderModule(moduleId, root) {
4425
4494
  if (!moduleId.startsWith(".")) return moduleId;
4426
- return _chunkVQJYGZNXcjs.toViteModuleId.call(void 0, path5.default.resolve(root, moduleId), root);
4495
+ return _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, path5.default.resolve(root, moduleId), root);
4427
4496
  }
4428
4497
 
4429
- // src/server/renderer.ts
4430
-
4431
- var _https = require('https'); var https = _interopRequireWildcard(_https);
4432
- var _net = require('net');
4433
-
4434
- var _tls = require('tls'); var tls = _interopRequireWildcard(_tls);
4435
- var _stream = require('stream');
4436
-
4437
- // src/not-found.ts
4498
+ // src/island-inference.ts
4438
4499
 
4439
4500
 
4440
- function resolveFarmNotFoundComponentPath(config, appDirs) {
4441
- const extensions = _chunkRD623KW4cjs.getFarmRendererComponentExtensions.call(void 0, config.renderer);
4442
- const configuredPath = _optionalChain([config, 'access', _162 => _162.notFound, 'optionalAccess', _163 => _163.component, 'optionalAccess', _164 => _164.trim, 'call', _165 => _165()]);
4443
- if (configuredPath) {
4444
- const componentPath = path5.default.isAbsolute(configuredPath) ? path5.default.normalize(configuredPath) : path5.default.resolve(config.root, configuredPath);
4445
- if (!extensions.some((extension) => componentPath.endsWith(extension))) {
4446
- throw new Error(
4447
- `notFound.component must use one of the configured renderer extensions: ${extensions.join(", ")}`
4448
- );
4501
+ var _compiler = require('@farm.js/islx/compiler');
4502
+ var _parseAst = require('rolldown/parseAst');
4503
+ var PARSE_LANGS = /* @__PURE__ */ new Map([
4504
+ [".tsx", "tsx"],
4505
+ [".ts", "ts"],
4506
+ [".jsx", "jsx"],
4507
+ [".js", "jsx"],
4508
+ [".mjs", "js"]
4509
+ ]);
4510
+ function parseFarmIslandSource(file, code) {
4511
+ const lang = PARSE_LANGS.get(path5.default.extname(file));
4512
+ if (!lang) throw new Error(`${path5.default.basename(file)} is not a script module`);
4513
+ return _parseAst.parseAst.call(void 0, code, { lang });
4514
+ }
4515
+ function modifiedAt(file) {
4516
+ try {
4517
+ return fs3.default.statSync(file).mtimeMs;
4518
+ } catch (e18) {
4519
+ return -1;
4520
+ }
4521
+ }
4522
+ var inferences = /* @__PURE__ */ new Map();
4523
+ function inferFarmIslandStrategy(filePath, root) {
4524
+ const file = path5.default.resolve(filePath);
4525
+ const cached = inferences.get(file);
4526
+ if (cached && cached.stamps.every(([read, stamp]) => modifiedAt(read) === stamp)) {
4527
+ return cached.result;
4528
+ }
4529
+ let code;
4530
+ try {
4531
+ code = fs3.default.readFileSync(file, "utf8");
4532
+ } catch (e19) {
4533
+ return { strategy: null, files: [file], reason: `${path5.default.basename(file)} could not be read` };
4534
+ }
4535
+ const result = _compiler.inferStrategy.call(void 0, file, code, {
4536
+ parse: parseFarmIslandSource,
4537
+ resolve: (specifier, importer) => {
4538
+ const resolved = resolveImportedModule(importer, specifier, root);
4539
+ return resolved.local ? resolved.path : null;
4449
4540
  }
4450
- if (!fs3.default.existsSync(componentPath) || !fs3.default.statSync(componentPath).isFile()) {
4451
- throw new Error(`notFound.component was not found: ${componentPath}`);
4541
+ });
4542
+ inferences.set(file, {
4543
+ stamps: result.files.map((read) => [read, modifiedAt(read)]),
4544
+ result
4545
+ });
4546
+ return result;
4547
+ }
4548
+ function inferFarmRouteRootStrategy(owners, root) {
4549
+ const files = [];
4550
+ const modules = [];
4551
+ for (const owner of owners) {
4552
+ const rendered = collectFarmRenderedClientModules(owner, root);
4553
+ if (!rendered) {
4554
+ return {
4555
+ strategy: null,
4556
+ files,
4557
+ reason: `${path5.default.basename(owner)}: its client components could not be listed`
4558
+ };
4452
4559
  }
4453
- return componentPath;
4560
+ modules.push(...rendered);
4454
4561
  }
4455
- let discoveredPath = null;
4456
- for (const appDir of appDirs) {
4457
- for (const extension of extensions) {
4458
- const candidate = path5.default.join(appDir, `not-found${extension}`);
4459
- if (fs3.default.existsSync(candidate) && fs3.default.statSync(candidate).isFile()) {
4460
- discoveredPath = candidate;
4461
- break;
4462
- }
4562
+ for (const module of modules) {
4563
+ let source = null;
4564
+ try {
4565
+ source = fs3.default.readFileSync(module, "utf8");
4566
+ } catch (e20) {
4463
4567
  }
4568
+ if (getIslandStrategyExport(source) !== null) return { strategy: null, files, declared: true };
4464
4569
  }
4465
- return discoveredPath;
4466
- }
4467
-
4468
- // src/components/not-found-styles.ts
4469
- var DEFAULT_NOT_FOUND_STYLES = `
4470
- body {
4471
- margin: 0;
4472
- }
4473
-
4474
- .farm-default-not-found {
4475
- --farm-not-found-bg: #fafafa;
4476
- --farm-not-found-fg: #171717;
4477
- --farm-not-found-muted: #737373;
4478
- --farm-not-found-line: rgba(0, 0, 0, 0.16);
4479
- --farm-not-found-button-fg: #ffffff;
4480
- min-height: 100vh;
4481
- min-height: 100svh;
4482
- display: grid;
4483
- place-items: center;
4484
- padding: 24px;
4485
- color: var(--farm-not-found-fg);
4486
- background: var(--farm-not-found-bg);
4487
- font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
4488
- color-scheme: light;
4489
- }
4490
-
4491
- .farm-default-not-found,
4492
- .farm-default-not-found * {
4493
- box-sizing: border-box;
4494
- }
4495
-
4496
- .farm-default-not-found__content {
4497
- width: min(100%, 280px);
4498
- display: flex;
4499
- flex-direction: column;
4500
- align-items: center;
4501
- }
4502
-
4503
- .farm-default-not-found__code {
4504
- margin: 0;
4505
- color: var(--farm-not-found-fg);
4506
- font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
4507
- font-size: clamp(88px, 20vw, 140px);
4508
- font-weight: 800;
4509
- line-height: 0.75;
4510
- letter-spacing: -0.1em;
4511
- transform: translateX(-3px);
4512
- }
4513
-
4514
- @supports (-webkit-text-stroke: 1px currentColor) {
4515
- .farm-default-not-found__code {
4516
- color: var(--farm-not-found-bg);
4517
- -webkit-text-stroke: 2px var(--farm-not-found-fg);
4518
- text-shadow: 5px 5px 0 var(--farm-not-found-fg);
4570
+ for (const module of modules) {
4571
+ const result = inferFarmIslandStrategy(module, root);
4572
+ files.push(...result.files);
4573
+ if (!result.strategy) return { strategy: null, files, reason: result.reason };
4519
4574
  }
4575
+ return { strategy: "interaction", files };
4520
4576
  }
4521
-
4522
- .farm-default-not-found__description {
4523
- width: 100%;
4524
- display: flex;
4525
- align-items: center;
4526
- gap: 12px;
4527
- margin: 34px 0 30px;
4528
- color: var(--farm-not-found-muted);
4529
- font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
4530
- font-size: 10px;
4531
- line-height: 1;
4532
- letter-spacing: 0.14em;
4533
- text-transform: uppercase;
4534
- white-space: nowrap;
4577
+ function resolveFarmRouteRootStrategy(route, page, layouts, root, islandsMode) {
4578
+ const directory = _nullishCoalesce(route.directory, () => ( route.pattern));
4579
+ const onRoute = layouts.filter(
4580
+ (layout) => _chunkO27PLNQZcjs.routeBoundaryCoversDirectory.call(void 0, layout.pattern, directory)
4581
+ );
4582
+ const declared = [
4583
+ ...page.islandStrategy ? [page.islandStrategy] : [],
4584
+ ...onRoute.flatMap(
4585
+ (layout) => (layout.shouldHydrate || layout.hasIsolatedClientBoundaries) && layout.islandStrategy ? [layout.islandStrategy] : []
4586
+ )
4587
+ ];
4588
+ const combined = declared.every((strategy) => strategy === declared[0]) ? _nullishCoalesce(declared[0], () => ( "load")) : "load";
4589
+ const layoutHydrates = onRoute.some((layout) => layout.shouldHydrate);
4590
+ if (!islandsMode || !page.shouldHydrate && !layoutHydrates) return combined;
4591
+ const owners = [
4592
+ route.modulePath,
4593
+ ...layoutHydrates ? onRoute.map((layout) => layout.modulePath) : []
4594
+ ];
4595
+ const inference = inferFarmRouteRootStrategy(owners, root);
4596
+ if (inference.declared) return combined;
4597
+ return _nullishCoalesce(inference.strategy, () => ( "load"));
4535
4598
  }
4536
4599
 
4537
- .farm-default-not-found__description::before,
4538
- .farm-default-not-found__description::after {
4539
- content: "";
4540
- height: 1px;
4541
- flex: 1 1 auto;
4542
- background: var(--farm-not-found-line);
4543
- }
4600
+ // src/client-plugin-build.ts
4544
4601
 
4545
- .farm-default-not-found__home {
4546
- min-width: 132px;
4547
- min-height: 44px;
4548
- display: inline-flex;
4549
- align-items: center;
4550
- justify-content: center;
4551
- padding: 0 20px;
4552
- border: 1px solid var(--farm-not-found-fg);
4553
- border-radius: 0;
4554
- color: var(--farm-not-found-button-fg);
4555
- background: var(--farm-not-found-fg);
4556
- font-size: 14px;
4557
- font-weight: 500;
4558
- line-height: 1;
4559
- text-decoration: none;
4560
- transition: opacity 150ms ease-out, transform 100ms ease-out;
4561
- }
4562
4602
 
4563
- @media (hover: hover) and (pointer: fine) {
4564
- .farm-default-not-found__home:hover {
4565
- opacity: 0.78;
4603
+ var CLIENT_KEYS = [
4604
+ "public",
4605
+ "setup",
4606
+ "hydration",
4607
+ "navigation",
4608
+ "error",
4609
+ "performance",
4610
+ "close"
4611
+ ];
4612
+ var HYDRATION_KEYS = ["before", "after"];
4613
+ var NAVIGATION_KEYS = ["before", "loaded", "resolved", "rendered", "error"];
4614
+ var MOBILE_SHELL_CLIENT_IMPORT = 'import { farmMobileShellClient as __farmMobileShellClient } from "@farm.js/core/internal/client-runtime";';
4615
+ var MOBILE_SHELL_CLIENT_REGISTRATION = ` {
4616
+ name: "farm:mobile-shell",
4617
+ enforce: "pre",
4618
+ definition: __farmMobileShellClient,
4619
+ }`;
4620
+ var APP_CLIENT_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
4621
+ function resolveFarmAppClientEntry(root = process.cwd(), srcDir = "src") {
4622
+ const sourceRoot = path5.default.resolve(root, srcDir);
4623
+ for (const extension of APP_CLIENT_EXTENSIONS) {
4624
+ const candidate = path5.default.join(sourceRoot, `client.${extension}`);
4625
+ if (fs3.default.existsSync(candidate) && fs3.default.statSync(candidate).isFile()) return candidate;
4566
4626
  }
4627
+ return void 0;
4567
4628
  }
4568
-
4569
- .farm-default-not-found__home:active {
4570
- transform: translateY(1px);
4629
+ function resolveFarmClientPlugins(plugins, _root) {
4630
+ if (!_optionalChain([plugins, 'optionalAccess', _164 => _164.length])) return [];
4631
+ return plugins.flatMap((plugin) => {
4632
+ if (!plugin.client) return [];
4633
+ assertClientLifecycle(plugin.client, plugin.name);
4634
+ assertPublicData(plugin.client.public, plugin.name);
4635
+ return [
4636
+ {
4637
+ name: plugin.name,
4638
+ version: plugin.version,
4639
+ enforce: plugin.enforce,
4640
+ definition: plugin.client,
4641
+ publicData: plugin.client.public
4642
+ }
4643
+ ];
4644
+ });
4645
+ }
4646
+ function generateFarmClientPluginEntryCode(plugins, root, srcDir = "src", appPublicData, platform = _chunkAQLHD6HZcjs.resolveFarmPlatform.call(void 0, )) {
4647
+ const resolved = resolveFarmClientPlugins(plugins, root);
4648
+ const appClientEntry = root ? resolveFarmAppClientEntry(root, srcDir) : void 0;
4649
+ const appImport = appClientEntry ? `import farmAppClientDefinition from ${JSON.stringify(appClientEntry.replace(/\\/g, "/"))};` : "";
4650
+ const mobileShell = platform === "mobile";
4651
+ const imports = mobileShell ? [MOBILE_SHELL_CLIENT_IMPORT, appImport].filter(Boolean).join("\n") : appImport;
4652
+ const serializedPlugins = mobileShell ? [MOBILE_SHELL_CLIENT_REGISTRATION] : [];
4653
+ serializedPlugins.push(
4654
+ ...resolved.map(
4655
+ (plugin) => ` {
4656
+ name: ${JSON.stringify(plugin.name)},
4657
+ version: ${serializeOptionalString(plugin.version)},
4658
+ enforce: ${serializeOptionalString(plugin.enforce)},
4659
+ definition: ${serializeClientLifecycle(plugin.definition, plugin.name)},
4660
+ public: ${serializePublicData(plugin.publicData)},
4661
+ }`
4662
+ )
4663
+ );
4664
+ if (appClientEntry) {
4665
+ assertPublicData(appPublicData, "farm:app-client");
4666
+ serializedPlugins.push(` {
4667
+ name: "farm:app-client",
4668
+ enforce: "post",
4669
+ definition: farmAppClientDefinition,
4670
+ public: ${serializePublicData(appPublicData)},
4671
+ }`);
4672
+ }
4673
+ const registrations = `[
4674
+ ${serializedPlugins.join(",\n")}
4675
+ ]`;
4676
+ return { imports, registrations, plugins: resolved };
4677
+ }
4678
+ function assertClientLifecycle(client, pluginName) {
4679
+ assertLifecycleObject(client, pluginName, "client", CLIENT_KEYS);
4680
+ assertHook(client.setup, pluginName, "client.setup");
4681
+ assertHook(client.error, pluginName, "client.error");
4682
+ assertHook(client.performance, pluginName, "client.performance");
4683
+ assertHook(client.close, pluginName, "client.close");
4684
+ if (client.hydration !== void 0) {
4685
+ assertLifecycleObject(client.hydration, pluginName, "client.hydration", HYDRATION_KEYS);
4686
+ assertHook(client.hydration.before, pluginName, "client.hydration.before");
4687
+ assertHook(client.hydration.after, pluginName, "client.hydration.after");
4688
+ }
4689
+ if (client.navigation !== void 0) {
4690
+ assertLifecycleObject(client.navigation, pluginName, "client.navigation", NAVIGATION_KEYS);
4691
+ for (const key of NAVIGATION_KEYS) {
4692
+ assertHook(client.navigation[key], pluginName, `client.navigation.${key}`);
4693
+ }
4694
+ }
4695
+ }
4696
+ function assertLifecycleObject(value, pluginName, location, allowedKeys) {
4697
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
4698
+ throw new TypeError(`Client plugin "${pluginName}" ${location} must be an object`);
4699
+ }
4700
+ const prototype = Object.getPrototypeOf(value);
4701
+ if (prototype !== Object.prototype && prototype !== null) {
4702
+ throw new TypeError(`Client plugin "${pluginName}" ${location} must be a plain object`);
4703
+ }
4704
+ for (const key of Reflect.ownKeys(value)) {
4705
+ if (typeof key === "symbol") {
4706
+ throw new TypeError(`Client plugin "${pluginName}" ${location} cannot contain symbol keys`);
4707
+ }
4708
+ if (!allowedKeys.includes(key)) {
4709
+ throw new TypeError(`Client plugin "${pluginName}" has an unknown ${location}.${key} option`);
4710
+ }
4711
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
4712
+ if (!_optionalChain([descriptor, 'optionalAccess', _165 => _165.enumerable])) {
4713
+ throw new TypeError(`Client plugin "${pluginName}" ${location}.${key} must be enumerable`);
4714
+ }
4715
+ if (!("value" in descriptor)) {
4716
+ throw new TypeError(`Client plugin "${pluginName}" ${location}.${key} cannot be an accessor`);
4717
+ }
4718
+ }
4719
+ }
4720
+ function assertHook(value, pluginName, location) {
4721
+ if (value === void 0) return;
4722
+ if (typeof value !== "function") {
4723
+ throw new TypeError(`Client plugin "${pluginName}" ${location} must be a function`);
4724
+ }
4725
+ functionSource(value, pluginName, location);
4726
+ }
4727
+ function serializeClientLifecycle(definition, pluginName) {
4728
+ const fields = [];
4729
+ pushHook(fields, "setup", definition.setup, pluginName, "client.setup", 2);
4730
+ pushHookGroup(fields, "hydration", definition.hydration, HYDRATION_KEYS, pluginName, 2);
4731
+ pushHookGroup(fields, "navigation", definition.navigation, NAVIGATION_KEYS, pluginName, 2);
4732
+ pushHook(fields, "error", definition.error, pluginName, "client.error", 2);
4733
+ pushHook(fields, "performance", definition.performance, pluginName, "client.performance", 2);
4734
+ pushHook(fields, "close", definition.close, pluginName, "client.close", 2);
4735
+ return fields.length ? `{
4736
+ ${fields.join(",\n")}
4737
+ }` : "{}";
4738
+ }
4739
+ function pushHookGroup(fields, groupName, group, keys, pluginName, indent) {
4740
+ if (!group) return;
4741
+ const hooks = [];
4742
+ for (const key of keys) {
4743
+ pushHook(hooks, key, group[key], pluginName, `client.${groupName}.${key}`, indent + 2);
4744
+ }
4745
+ fields.push(
4746
+ `${" ".repeat(indent)}${JSON.stringify(groupName)}: {
4747
+ ${hooks.join(",\n")}
4748
+ ${" ".repeat(indent)}}`
4749
+ );
4750
+ }
4751
+ function pushHook(fields, key, hook, pluginName, location, indent) {
4752
+ if (hook === void 0) return;
4753
+ fields.push(
4754
+ `${" ".repeat(indent)}${JSON.stringify(key)}: ${functionSource(hook, pluginName, location)}`
4755
+ );
4756
+ }
4757
+ function functionSource(value, pluginName, location) {
4758
+ if (typeof value !== "function") {
4759
+ throw new TypeError(`Client plugin "${pluginName}" ${location} must be a function`);
4760
+ }
4761
+ const source = Function.prototype.toString.call(value).trim();
4762
+ if (!source || source.includes("[native code]")) {
4763
+ throw new TypeError(
4764
+ `Client plugin "${pluginName}" ${location} must be authored inline and cannot be native or bound`
4765
+ );
4766
+ }
4767
+ if (/^(?:async\s+)?function(?:\s*\*)?(?:\s+|\()/.test(source)) {
4768
+ return `(${source})`;
4769
+ }
4770
+ const method = source.match(/^(async\s+)?(\*\s*)?[$A-Z_a-z][$\w]*\s*(\([\s\S]*)$/);
4771
+ if (method) {
4772
+ const asyncPrefix = _nullishCoalesce(method[1], () => ( ""));
4773
+ const generator = method[2] ? "*" : "";
4774
+ return `(${asyncPrefix}function${generator}${method[3]})`;
4775
+ }
4776
+ if (source.includes("=>")) return `(${source})`;
4777
+ throw new TypeError(
4778
+ `Client plugin "${pluginName}" ${location} must use a function, method, or arrow function`
4779
+ );
4780
+ }
4781
+ function assertPublicData(value, pluginName) {
4782
+ if (value === void 0) return;
4783
+ const seen = /* @__PURE__ */ new WeakSet();
4784
+ const visit = (current, pathSegments) => {
4785
+ if (current === null || typeof current === "string" || typeof current === "boolean") {
4786
+ return;
4787
+ }
4788
+ if (typeof current === "number") {
4789
+ if (Number.isFinite(current)) return;
4790
+ throwPublicDataError(pluginName, pathSegments, "must be a finite number");
4791
+ }
4792
+ if (typeof current !== "object") {
4793
+ throwPublicDataError(pluginName, pathSegments, `cannot contain ${typeof current} values`);
4794
+ }
4795
+ if (seen.has(current)) {
4796
+ throwPublicDataError(pluginName, pathSegments, "cannot contain circular references");
4797
+ }
4798
+ seen.add(current);
4799
+ if (Array.isArray(current)) {
4800
+ for (let index = 0; index < current.length; index += 1) {
4801
+ if (!Object.prototype.hasOwnProperty.call(current, index)) {
4802
+ throwPublicDataError(
4803
+ pluginName,
4804
+ [...pathSegments, String(index)],
4805
+ "cannot contain sparse array slots"
4806
+ );
4807
+ }
4808
+ visit(current[index], [...pathSegments, String(index)]);
4809
+ }
4810
+ for (const key of Reflect.ownKeys(current)) {
4811
+ if (key === "length" || typeof key === "string" && isArrayIndex(key)) continue;
4812
+ throwPublicDataError(
4813
+ pluginName,
4814
+ pathSegments,
4815
+ typeof key === "symbol" ? "cannot contain symbol keys" : `cannot contain non-index array property ${key}`
4816
+ );
4817
+ }
4818
+ seen.delete(current);
4819
+ return;
4820
+ }
4821
+ const prototype = Object.getPrototypeOf(current);
4822
+ if (prototype !== Object.prototype && prototype !== null) {
4823
+ throwPublicDataError(pluginName, pathSegments, "must contain only plain objects and arrays");
4824
+ }
4825
+ for (const key of Reflect.ownKeys(current)) {
4826
+ if (typeof key === "symbol") {
4827
+ throwPublicDataError(pluginName, pathSegments, "cannot contain symbol keys");
4828
+ }
4829
+ const descriptor = Object.getOwnPropertyDescriptor(current, key);
4830
+ if (!_optionalChain([descriptor, 'optionalAccess', _166 => _166.enumerable])) {
4831
+ throwPublicDataError(
4832
+ pluginName,
4833
+ [...pathSegments, key],
4834
+ "cannot contain non-enumerable properties"
4835
+ );
4836
+ }
4837
+ if (!("value" in descriptor)) {
4838
+ throwPublicDataError(
4839
+ pluginName,
4840
+ [...pathSegments, key],
4841
+ "cannot contain accessor properties"
4842
+ );
4843
+ }
4844
+ visit(descriptor.value, [...pathSegments, key]);
4845
+ }
4846
+ seen.delete(current);
4847
+ };
4848
+ visit(value, []);
4849
+ }
4850
+ function throwPublicDataError(pluginName, pathSegments, message) {
4851
+ const location = pathSegments.length ? ` at client.public.${pathSegments.join(".")}` : "";
4852
+ throw new TypeError(`Client plugin "${pluginName}"${location} ${message}`);
4853
+ }
4854
+ function serializePublicData(value) {
4855
+ if (value === void 0) return "undefined";
4856
+ return `JSON.parse(${JSON.stringify(JSON.stringify(value))})`;
4857
+ }
4858
+ function serializeOptionalString(value) {
4859
+ return value === void 0 ? "undefined" : JSON.stringify(value);
4860
+ }
4861
+ function isArrayIndex(key) {
4862
+ const value = Number(key);
4863
+ return Number.isInteger(value) && value >= 0 && value < 4294967295 && String(value) === key;
4864
+ }
4865
+
4866
+ // src/server/renderer.ts
4867
+
4868
+ var _https = require('https'); var https = _interopRequireWildcard(_https);
4869
+ var _net = require('net');
4870
+
4871
+ var _tls = require('tls'); var tls = _interopRequireWildcard(_tls);
4872
+ var _stream = require('stream');
4873
+
4874
+ // src/not-found.ts
4875
+
4876
+
4877
+ function resolveFarmNotFoundComponentPath(config, appDirs) {
4878
+ const extensions = _chunkRD623KW4cjs.getFarmRendererComponentExtensions.call(void 0, config.renderer);
4879
+ const configuredPath = _optionalChain([config, 'access', _167 => _167.notFound, 'optionalAccess', _168 => _168.component, 'optionalAccess', _169 => _169.trim, 'call', _170 => _170()]);
4880
+ if (configuredPath) {
4881
+ const componentPath = path5.default.isAbsolute(configuredPath) ? path5.default.normalize(configuredPath) : path5.default.resolve(config.root, configuredPath);
4882
+ if (!extensions.some((extension) => componentPath.endsWith(extension))) {
4883
+ throw new Error(
4884
+ `notFound.component must use one of the configured renderer extensions: ${extensions.join(", ")}`
4885
+ );
4886
+ }
4887
+ if (!fs3.default.existsSync(componentPath) || !fs3.default.statSync(componentPath).isFile()) {
4888
+ throw new Error(`notFound.component was not found: ${componentPath}`);
4889
+ }
4890
+ return componentPath;
4891
+ }
4892
+ let discoveredPath = null;
4893
+ for (const appDir of appDirs) {
4894
+ for (const extension of extensions) {
4895
+ const candidate = path5.default.join(appDir, `not-found${extension}`);
4896
+ if (fs3.default.existsSync(candidate) && fs3.default.statSync(candidate).isFile()) {
4897
+ discoveredPath = candidate;
4898
+ break;
4899
+ }
4900
+ }
4901
+ }
4902
+ return discoveredPath;
4903
+ }
4904
+
4905
+ // src/navigation/segment-navigation.ts
4906
+ function getFarmLayoutKey(pattern, params) {
4907
+ return pattern.replace(
4908
+ /\[\[?\.\.\.([^\]]+)\]?\]|\[([^\]]+)\]/g,
4909
+ (_match, rest, name) => {
4910
+ const value = params ? params[rest || name] : void 0;
4911
+ if (Array.isArray(value)) return value.map(encodeURIComponent).join("/");
4912
+ return value === void 0 ? "" : encodeURIComponent(String(value));
4913
+ }
4914
+ );
4915
+ }
4916
+ function countFarmKeptLayouts(layoutsHeader, layouts, params) {
4917
+ const chain = _chunkO27PLNQZcjs.parseFarmLayoutChainHeader.call(void 0, _nullishCoalesce(layoutsHeader, () => ( null)));
4918
+ if (chain.length === 0) return 0;
4919
+ const keys = layouts.map((layout) => getFarmLayoutKey(layout.pattern, params));
4920
+ if (chain[0] === keys[0]) return _chunkO27PLNQZcjs.getSharedLayoutPrefixLength.call(void 0, chain, keys);
4921
+ return keys.length > 1 ? 1 + _chunkO27PLNQZcjs.getSharedLayoutPrefixLength.call(void 0, chain, keys.slice(1)) : 0;
4922
+ }
4923
+ function createFarmFlushToken() {
4924
+ const bytes = new Uint8Array(16);
4925
+ globalThis.crypto.getRandomValues(bytes);
4926
+ let token = "";
4927
+ for (const byte of bytes) token += byte.toString(16).padStart(2, "0");
4928
+ return token;
4929
+ }
4930
+ function farmFlushMarker(token) {
4931
+ return `<!--farm-flush:${token}-->`;
4932
+ }
4933
+
4934
+ // src/components/not-found-styles.ts
4935
+ var DEFAULT_NOT_FOUND_STYLES = `
4936
+ body {
4937
+ margin: 0;
4938
+ }
4939
+
4940
+ .farm-default-not-found {
4941
+ --farm-not-found-bg: #fafafa;
4942
+ --farm-not-found-fg: #171717;
4943
+ --farm-not-found-muted: #737373;
4944
+ --farm-not-found-line: rgba(0, 0, 0, 0.16);
4945
+ --farm-not-found-button-fg: #ffffff;
4946
+ min-height: 100vh;
4947
+ min-height: 100svh;
4948
+ display: grid;
4949
+ place-items: center;
4950
+ padding: 24px;
4951
+ color: var(--farm-not-found-fg);
4952
+ background: var(--farm-not-found-bg);
4953
+ font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
4954
+ color-scheme: light;
4955
+ }
4956
+
4957
+ .farm-default-not-found,
4958
+ .farm-default-not-found * {
4959
+ box-sizing: border-box;
4960
+ }
4961
+
4962
+ .farm-default-not-found__content {
4963
+ width: min(100%, 280px);
4964
+ display: flex;
4965
+ flex-direction: column;
4966
+ align-items: center;
4967
+ }
4968
+
4969
+ .farm-default-not-found__code {
4970
+ margin: 0;
4971
+ color: var(--farm-not-found-fg);
4972
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
4973
+ font-size: clamp(88px, 20vw, 140px);
4974
+ font-weight: 800;
4975
+ line-height: 0.75;
4976
+ letter-spacing: -0.1em;
4977
+ transform: translateX(-3px);
4978
+ }
4979
+
4980
+ @supports (-webkit-text-stroke: 1px currentColor) {
4981
+ .farm-default-not-found__code {
4982
+ color: var(--farm-not-found-bg);
4983
+ -webkit-text-stroke: 2px var(--farm-not-found-fg);
4984
+ text-shadow: 5px 5px 0 var(--farm-not-found-fg);
4985
+ }
4986
+ }
4987
+
4988
+ .farm-default-not-found__description {
4989
+ width: 100%;
4990
+ display: flex;
4991
+ align-items: center;
4992
+ gap: 12px;
4993
+ margin: 34px 0 30px;
4994
+ color: var(--farm-not-found-muted);
4995
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
4996
+ font-size: 10px;
4997
+ line-height: 1;
4998
+ letter-spacing: 0.14em;
4999
+ text-transform: uppercase;
5000
+ white-space: nowrap;
5001
+ }
5002
+
5003
+ .farm-default-not-found__description::before,
5004
+ .farm-default-not-found__description::after {
5005
+ content: "";
5006
+ height: 1px;
5007
+ flex: 1 1 auto;
5008
+ background: var(--farm-not-found-line);
5009
+ }
5010
+
5011
+ .farm-default-not-found__home {
5012
+ min-width: 132px;
5013
+ min-height: 44px;
5014
+ display: inline-flex;
5015
+ align-items: center;
5016
+ justify-content: center;
5017
+ padding: 0 20px;
5018
+ border: 1px solid var(--farm-not-found-fg);
5019
+ border-radius: 0;
5020
+ color: var(--farm-not-found-button-fg);
5021
+ background: var(--farm-not-found-fg);
5022
+ font-size: 14px;
5023
+ font-weight: 500;
5024
+ line-height: 1;
5025
+ text-decoration: none;
5026
+ transition: opacity 150ms ease-out, transform 100ms ease-out;
5027
+ }
5028
+
5029
+ @media (hover: hover) and (pointer: fine) {
5030
+ .farm-default-not-found__home:hover {
5031
+ opacity: 0.78;
5032
+ }
5033
+ }
5034
+
5035
+ .farm-default-not-found__home:active {
5036
+ transform: translateY(1px);
4571
5037
  }
4572
5038
 
4573
5039
  .farm-default-not-found__home:focus-visible {
@@ -4632,14 +5098,14 @@ function redactErrorText(value) {
4632
5098
  return value.replace(BEARER_PATTERN, "$1[REDACTED]").replace(SECRET_VALUE_PATTERN, "$1=[REDACTED]");
4633
5099
  }
4634
5100
  function isPathInsideRoot(root, filePath) {
4635
- const relative3 = path9.relative(root, filePath);
4636
- return relative3 === "" || !relative3.startsWith("..") && !path9.isAbsolute(relative3);
5101
+ const relative3 = path11.relative(root, filePath);
5102
+ return relative3 === "" || !relative3.startsWith("..") && !path11.isAbsolute(relative3);
4637
5103
  }
4638
5104
  function normalizeStackPath(value) {
4639
5105
  const withoutQuery = value.replace(/[?#].*$/, "");
4640
5106
  try {
4641
5107
  return withoutQuery.startsWith("file://") ? _url.fileURLToPath.call(void 0, withoutQuery) : withoutQuery;
4642
- } catch (e18) {
5108
+ } catch (e21) {
4643
5109
  return void 0;
4644
5110
  }
4645
5111
  }
@@ -4650,13 +5116,13 @@ function findStackLocation(stack, root) {
4650
5116
  );
4651
5117
  if (!match) continue;
4652
5118
  const candidate = normalizeStackPath(match[1]);
4653
- if (!candidate || candidate.includes(`${path9.sep}node_modules${path9.sep}`)) continue;
4654
- const absolutePath = path9.resolve(candidate);
4655
- if (!isPathInsideRoot(root, absolutePath) || !fs5.existsSync(absolutePath)) continue;
4656
- const relativePath = path9.relative(root, absolutePath).split(path9.sep).join("/");
5119
+ if (!candidate || candidate.includes(`${path11.sep}node_modules${path11.sep}`)) continue;
5120
+ const absolutePath = path11.resolve(candidate);
5121
+ if (!isPathInsideRoot(root, absolutePath) || !fs7.existsSync(absolutePath)) continue;
5122
+ const relativePath = path11.relative(root, absolutePath).split(path11.sep).join("/");
4657
5123
  return {
4658
5124
  absolutePath,
4659
- displayPath: relativePath || path9.basename(absolutePath),
5125
+ displayPath: relativePath || path11.basename(absolutePath),
4660
5126
  line: Number(match[2]),
4661
5127
  column: Number(match[3])
4662
5128
  };
@@ -4665,7 +5131,7 @@ function findStackLocation(stack, root) {
4665
5131
  }
4666
5132
  function createSourceFrame(location) {
4667
5133
  try {
4668
- const sourceLines = fs5.readFileSync(location.absolutePath, "utf8").split(/\r?\n/);
5134
+ const sourceLines = fs7.readFileSync(location.absolutePath, "utf8").split(/\r?\n/);
4669
5135
  if (location.line < 1 || location.line > sourceLines.length) return void 0;
4670
5136
  const start = Math.max(1, location.line - 2);
4671
5137
  const end = Math.min(sourceLines.length, location.line + 2);
@@ -4683,18 +5149,18 @@ function createSourceFrame(location) {
4683
5149
  column: location.column,
4684
5150
  lines
4685
5151
  };
4686
- } catch (e19) {
5152
+ } catch (e22) {
4687
5153
  return void 0;
4688
5154
  }
4689
5155
  }
4690
5156
  function sanitizeStack(stack, root) {
4691
- const normalizedRoot = path9.resolve(root);
5157
+ const normalizedRoot = path11.resolve(root);
4692
5158
  return redactErrorText(stack).split(normalizedRoot).join("<project>").replace(/<project>[^\s)]*/g, (segment) => segment.split("\\").join("/")).split("\n").filter((line, index) => index === 0 || !line.includes("node:internal")).slice(0, 14).join("\n");
4693
5159
  }
4694
5160
  function createDefaultErrorDiagnostics(error, root) {
4695
5161
  const normalizedError = error instanceof Error ? error : new Error(typeof error === "string" ? error : "Unknown server rendering error");
4696
5162
  const rawStack = normalizedError.stack || `${normalizedError.name}: ${normalizedError.message}`;
4697
- const location = findStackLocation(rawStack, path9.resolve(root));
5163
+ const location = findStackLocation(rawStack, path11.resolve(root));
4698
5164
  return {
4699
5165
  name: redactErrorText(normalizedError.name || "Error"),
4700
5166
  message: redactErrorText(normalizedError.message || "Unknown server rendering error"),
@@ -4703,6 +5169,13 @@ function createDefaultErrorDiagnostics(error, root) {
4703
5169
  };
4704
5170
  }
4705
5171
 
5172
+ // src/islands-client-boot.ts
5173
+ function canBootFarmIslandsClient(config) {
5174
+ const docs = config.docs;
5175
+ const docsEnabled = docs === true || typeof docs === "object" && docs !== null && docs.enabled !== false;
5176
+ return _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _171 => _171.experimental, 'optionalAccess', _172 => _172.serverComponents])) === "islands" && !docsEnabled && resolveFarmClientPlugins(config.plugins, config.root).length === 0 && !resolveFarmAppClientEntry(config.root, config.srcDir || "src");
5177
+ }
5178
+
4706
5179
  // src/server/renderer.ts
4707
5180
  var islands;
4708
5181
  function withFarmIslandsRenders(runtime, islandsRuntime) {
@@ -4779,7 +5252,7 @@ var warnedSuppressedAsyncHydrationModules = /* @__PURE__ */ new Set();
4779
5252
  function warnSuppressedAsyncHydrationOnce(modulePath, reason) {
4780
5253
  if (warnedSuppressedAsyncHydrationModules.has(modulePath)) return;
4781
5254
  warnedSuppressedAsyncHydrationModules.add(modulePath);
4782
- _chunkVQJYGZNXcjs.logger.warn(describeSuppressedAsyncHydration(modulePath, reason));
5255
+ _chunkQMNWKQL4cjs.logger.warn(describeSuppressedAsyncHydration(modulePath, reason));
4783
5256
  }
4784
5257
  var fullDocumentRoutes = /* @__PURE__ */ new Set();
4785
5258
  var documentLayouts = /* @__PURE__ */ new WeakMap();
@@ -4809,6 +5282,10 @@ function appendResponseHeader(res, name, value) {
4809
5282
  res.setHeader(name, [String(current), value]);
4810
5283
  }
4811
5284
  }
5285
+ function requestHeader(req, name) {
5286
+ const value = _optionalChain([req, 'access', _173 => _173.headers, 'optionalAccess', _174 => _174[name]]);
5287
+ return Array.isArray(value) ? value[0] : value;
5288
+ }
4812
5289
  function appendResponseVary(res, value) {
4813
5290
  const current = res.getHeader("Vary");
4814
5291
  const values = new Set(
@@ -4820,7 +5297,7 @@ function appendResponseVary(res, value) {
4820
5297
  function renderI18nAlternateLinks(requestPath, snapshot, options) {
4821
5298
  if (snapshot.routing === "none") return "";
4822
5299
  const url = new URL(requestPath, "http://farm.local");
4823
- return _chunkTSFMFPRUcjs.renderFarmLocaleAlternateLinks.call(void 0, url.pathname, snapshot, options);
5300
+ return _chunkO27PLNQZcjs.renderFarmLocaleAlternateLinks.call(void 0, url.pathname, snapshot, options);
4824
5301
  }
4825
5302
  var PPR_REFRESH_MAX_ATTEMPTS = 3;
4826
5303
  function createPPRRefreshScript() {
@@ -4835,6 +5312,10 @@ function rendererRenderOptions() {
4835
5312
  return nonce ? { nonce } : void 0;
4836
5313
  }
4837
5314
  var FARM_DEV_EARLY_CLIENT_SCRIPT = `<script type="module" async src="/@farm/client.js"></script>`;
5315
+ function createFarmDevBootScript(root, strategy) {
5316
+ const rootAttributes = root ? ` data-farm-root="${root}" data-farm-root-strategy="${escapeHtmlAttribute2(_nullishCoalesce(strategy, () => ( "load")))}"` : "";
5317
+ return `<script type="module" async src="/@farm/client-boot.js" data-farm-runtime="/@farm/client.js"${rootAttributes}></script>`;
5318
+ }
4838
5319
  function createDocumentFooter(options) {
4839
5320
  return `${options.closeRoot === false ? "" : "</div>"}
4840
5321
  ${options.suspenseRevealFallback}
@@ -4911,12 +5392,12 @@ async function parseRouteModuleProps(routeModule, input) {
4911
5392
  }
4912
5393
  const schemas = routeModule.__farmRouteSchemas;
4913
5394
  const params = parseRouteModuleSchema(
4914
- _optionalChain([schemas, 'optionalAccess', _166 => _166.params]),
5395
+ _optionalChain([schemas, 'optionalAccess', _175 => _175.params]),
4915
5396
  input.props.params,
4916
5397
  "params",
4917
5398
  input.routePath
4918
5399
  );
4919
- const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _167 => _167.search]), input.search, "search", input.routePath);
5400
+ const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _176 => _176.search]), input.search, "search", input.routePath);
4920
5401
  return {
4921
5402
  ...input.props,
4922
5403
  params,
@@ -4948,9 +5429,9 @@ function createRouteStateProps(input) {
4948
5429
  function readAppPackageIdentity(root) {
4949
5430
  try {
4950
5431
  return JSON.parse(
4951
- fs6.readFileSync(path10.join(root || process.cwd(), "package.json"), "utf8")
5432
+ fs8.readFileSync(path12.join(root || process.cwd(), "package.json"), "utf8")
4952
5433
  );
4953
- } catch (e20) {
5434
+ } catch (e23) {
4954
5435
  return {};
4955
5436
  }
4956
5437
  }
@@ -4974,7 +5455,7 @@ var ServerRenderer = class {
4974
5455
  } else {
4975
5456
  _chunkXGJVRPYLcjs.uninstallFarmIslandValues.call(void 0, );
4976
5457
  }
4977
- if (_optionalChain([this, 'access', _168 => _168.config, 'access', _169 => _169.notFound, 'optionalAccess', _170 => _170.component, 'optionalAccess', _171 => _171.trim, 'call', _172 => _172()])) {
5458
+ if (_optionalChain([this, 'access', _177 => _177.config, 'access', _178 => _178.notFound, 'optionalAccess', _179 => _179.component, 'optionalAccess', _180 => _180.trim, 'call', _181 => _181()])) {
4978
5459
  resolveFarmNotFoundComponentPath(this.config, _chunk5Y2P454Ocjs.getFarmAppDirectories.call(void 0, this.config));
4979
5460
  }
4980
5461
  const loaded = _chunkRD623KW4cjs.isReactRenderer.call(void 0, this.config.renderer) ? await import("./renderer/react/server.cjs") : this.viteServer ? await _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, this.viteServer, this.config.renderer.server) : await import(_url.pathToFileURL.call(void 0,
@@ -4999,7 +5480,7 @@ var ServerRenderer = class {
4999
5480
  "node"
5000
5481
  );
5001
5482
  this.rendererRuntime = islands && this.islandValues() ? withFarmIslandsRenders(runtime, islands) : runtime;
5002
- _optionalChain([this, 'access', _173 => _173.routeManager, 'access', _174 => _174.setRendererRuntime, 'optionalCall', _175 => _175(this.rendererRuntime)]);
5483
+ _optionalChain([this, 'access', _182 => _182.routeManager, 'access', _183 => _183.setRendererRuntime, 'optionalCall', _184 => _184(this.rendererRuntime)]);
5003
5484
  await this.applyRendererAppSetup();
5004
5485
  }
5005
5486
  /**
@@ -5056,11 +5537,12 @@ var ServerRenderer = class {
5056
5537
  /// Stylesheets the app imported through JS (fontsource packages, component
5057
5538
  /// CSS) that the document must link alongside globals.css — see #658.
5058
5539
  collectDevStyleHrefs() {
5059
- const graph = _optionalChain([this, 'access', _176 => _176.viteServer, 'optionalAccess', _177 => _177.moduleGraph]);
5540
+ const graph = _optionalChain([this, 'access', _185 => _185.viteServer, 'optionalAccess', _186 => _186.moduleGraph]);
5060
5541
  if (!graph) return [];
5061
5542
  return collectDevStylesheetUrls(
5062
5543
  graph.idToModuleMap.values(),
5063
- _nullishCoalesce(this.devGlobalStylesheetHref(), () => ( void 0))
5544
+ _nullishCoalesce(this.devGlobalStylesheetHref(), () => ( void 0)),
5545
+ { cssModules: this.islandValues() }
5064
5546
  );
5065
5547
  }
5066
5548
  collectDevStyleLinks() {
@@ -5068,12 +5550,19 @@ var ServerRenderer = class {
5068
5550
  (href) => `<link rel="stylesheet" href="${escapeHtmlAttribute2(href)}">`
5069
5551
  );
5070
5552
  }
5071
- createLayoutBoundary(pattern, layoutElement) {
5553
+ /**
5554
+ * A layout's boundary. Islands mode keys it (the pattern with its params, as the production
5555
+ * server does), so a navigation can name the layouts the browser shows; a layout the browser
5556
+ * keeps is sent as its boundary alone (`kept`).
5557
+ */
5558
+ createLayoutBoundary(pattern, layoutElement, segment) {
5072
5559
  return this.rendererRuntime.createElement(
5073
5560
  "div",
5074
5561
  {
5075
5562
  "data-farm-layout-boundary": "true",
5076
5563
  "data-farm-layout-pattern": pattern,
5564
+ ...segment ? { "data-farm-layout-key": segment.key } : {},
5565
+ ..._optionalChain([segment, 'optionalAccess', _187 => _187.kept]) ? { "data-farm-layout-kept": "true" } : {},
5077
5566
  style: { display: "contents" }
5078
5567
  },
5079
5568
  layoutElement
@@ -5160,7 +5649,7 @@ var ServerRenderer = class {
5160
5649
  }
5161
5650
  /** Islands mode sends large prop values once, keyed by content (RFC 0003). */
5162
5651
  islandValues() {
5163
- return _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _178 => _178.config, 'access', _179 => _179.experimental, 'optionalAccess', _180 => _180.serverComponents])) === "islands";
5652
+ return _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _188 => _188.config, 'access', _189 => _189.experimental, 'optionalAccess', _190 => _190.serverComponents])) === "islands";
5164
5653
  }
5165
5654
  /**
5166
5655
  * Render the route tree used by client navigation without producing a second
@@ -5235,7 +5724,7 @@ var ServerRenderer = class {
5235
5724
  async runWithRequestContext(request2, fn) {
5236
5725
  return _chunkHNAISJFDcjs._runWithCurrentRequest.call(void 0,
5237
5726
  request2,
5238
- () => _optionalChain([this, 'access', _181 => _181.i18nRuntime, 'optionalAccess', _182 => _182.config, 'access', _183 => _183.enabled]) ? _chunkRVGLYMJMcjs._runWithFarmI18nRequest.call(void 0, this.i18nRuntime, request2, fn, {
5727
+ () => _optionalChain([this, 'access', _191 => _191.i18nRuntime, 'optionalAccess', _192 => _192.config, 'access', _193 => _193.enabled]) ? _chunkRVGLYMJMcjs._runWithFarmI18nRequest.call(void 0, this.i18nRuntime, request2, fn, {
5239
5728
  redirect: false
5240
5729
  }) : fn()
5241
5730
  );
@@ -5247,10 +5736,10 @@ var ServerRenderer = class {
5247
5736
  * Load SSG manifest from build output
5248
5737
  */
5249
5738
  loadSSGManifest() {
5250
- const manifestPath = path10.join(this.config.root, this.config.outDir, "__ssg_manifest.json");
5739
+ const manifestPath = path12.join(this.config.root, this.config.outDir, "__ssg_manifest.json");
5251
5740
  let content;
5252
5741
  try {
5253
- content = fs6.readFileSync(manifestPath, "utf-8");
5742
+ content = fs8.readFileSync(manifestPath, "utf-8");
5254
5743
  } catch (error) {
5255
5744
  if (error.code === "ENOENT") {
5256
5745
  return;
@@ -5260,13 +5749,13 @@ var ServerRenderer = class {
5260
5749
  );
5261
5750
  }
5262
5751
  this.ssgManifest = parseSSGManifest(content, manifestPath);
5263
- _chunkVQJYGZNXcjs.logger.info(`Loaded SSG manifest: ${this.ssgManifest.length} pages`);
5752
+ _chunkQMNWKQL4cjs.logger.info(`Loaded SSG manifest: ${this.ssgManifest.length} pages`);
5264
5753
  }
5265
5754
  /**
5266
5755
  * Check if a path should be served from SSG cache
5267
5756
  */
5268
5757
  async shouldServeSSG(pathname) {
5269
- const ssgPage = _chunkUQHIWZZ6cjs.matchSSGPage.call(void 0, pathname, this.ssgManifest);
5758
+ const ssgPage = _chunk3TL3AH25cjs.matchSSGPage.call(void 0, pathname, this.ssgManifest);
5270
5759
  if (!ssgPage) return null;
5271
5760
  const cached = await this.getCachedSSGPage(pathname);
5272
5761
  if (cached && await this.dataCache.isStaleAsync(cached)) {
@@ -5383,7 +5872,7 @@ var ServerRenderer = class {
5383
5872
  setImmediate(async () => {
5384
5873
  try {
5385
5874
  const mod = await this.routeManager.loadRouteModule(page.filePath);
5386
- if (!_optionalChain([mod, 'optionalAccess', _184 => _184.default])) return;
5875
+ if (!_optionalChain([mod, 'optionalAccess', _194 => _194.default])) return;
5387
5876
  const { route, layouts } = this.routeManager.matchRoute(page.urlPath);
5388
5877
  const layoutModules = await Promise.all(
5389
5878
  layouts.map((l) => this.routeManager.loadLayoutModule(l.modulePath))
@@ -5397,7 +5886,7 @@ var ServerRenderer = class {
5397
5886
  };
5398
5887
  let pageElement = this.rendererRuntime.createElement(PageComponent, pageProps);
5399
5888
  const pageMetadata = _nullishCoalesce(routeManifest.routes.find(
5400
- (entry) => entry.pattern === _optionalChain([route, 'optionalAccess', _185 => _185.pattern])
5889
+ (entry) => entry.pattern === _optionalChain([route, 'optionalAccess', _195 => _195.pattern])
5401
5890
  ), () => ( {
5402
5891
  shouldHydrate: false,
5403
5892
  islandStrategy: null
@@ -5442,13 +5931,13 @@ var ServerRenderer = class {
5442
5931
  { metadata: mergedMetadata }
5443
5932
  );
5444
5933
  await this.cacheSSGPage(page, fullDocument, { document: true });
5445
- _chunkVQJYGZNXcjs.logger.info(`ISR: Regenerated ${page.urlPath}`);
5934
+ _chunkQMNWKQL4cjs.logger.info(`ISR: Regenerated ${page.urlPath}`);
5446
5935
  } catch (error) {
5447
- _chunkVQJYGZNXcjs.logger.error(`ISR regeneration failed for ${page.urlPath}: ${error}`);
5936
+ _chunkQMNWKQL4cjs.logger.error(`ISR regeneration failed for ${page.urlPath}: ${error}`);
5448
5937
  }
5449
5938
  });
5450
5939
  } catch (error) {
5451
- _chunkVQJYGZNXcjs.logger.error(`ISR trigger failed: ${error}`);
5940
+ _chunkQMNWKQL4cjs.logger.error(`ISR trigger failed: ${error}`);
5452
5941
  }
5453
5942
  }
5454
5943
  /**
@@ -5469,10 +5958,10 @@ var ServerRenderer = class {
5469
5958
  return true;
5470
5959
  }
5471
5960
  try {
5472
- const htmlPath = page.urlPath === "/" ? path10.join(this.config.root, this.config.outDir, "client", "index.html") : path10.join(this.config.root, this.config.outDir, "client", page.urlPath + ".html");
5473
- if (fs6.existsSync(htmlPath)) {
5474
- const stat = fs6.statSync(htmlPath);
5475
- const html = fs6.readFileSync(htmlPath, "utf-8");
5961
+ const htmlPath = page.urlPath === "/" ? path12.join(this.config.root, this.config.outDir, "client", "index.html") : path12.join(this.config.root, this.config.outDir, "client", page.urlPath + ".html");
5962
+ if (fs8.existsSync(htmlPath)) {
5963
+ const stat = fs8.statSync(htmlPath);
5964
+ const html = fs8.readFileSync(htmlPath, "utf-8");
5476
5965
  await this.cacheSSGPage(page, html, {
5477
5966
  document: true,
5478
5967
  createdAt: stat.mtimeMs
@@ -5491,7 +5980,7 @@ var ServerRenderer = class {
5491
5980
  return true;
5492
5981
  }
5493
5982
  } catch (error) {
5494
- _chunkVQJYGZNXcjs.logger.error(`Failed to serve SSG page ${page.urlPath}: ${error}`);
5983
+ _chunkQMNWKQL4cjs.logger.error(`Failed to serve SSG page ${page.urlPath}: ${error}`);
5495
5984
  }
5496
5985
  return false;
5497
5986
  }
@@ -5507,10 +5996,10 @@ var ServerRenderer = class {
5507
5996
  res.setHeader(header.key, header.value);
5508
5997
  }
5509
5998
  const request2 = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
5510
- trustProxy: _optionalChain([this, 'access', _186 => _186.config, 'access', _187 => _187.server, 'optionalAccess', _188 => _188.trustProxy])
5999
+ trustProxy: _optionalChain([this, 'access', _196 => _196.config, 'access', _197 => _197.server, 'optionalAccess', _198 => _198.trustProxy])
5511
6000
  });
5512
6001
  const runtime = this.i18nRuntime;
5513
- if (_optionalChain([runtime, 'optionalAccess', _189 => _189.config, 'access', _190 => _190.enabled])) {
6002
+ if (_optionalChain([runtime, 'optionalAccess', _199 => _199.config, 'access', _200 => _200.enabled])) {
5514
6003
  const resolution = runtime.resolveRequest(request2);
5515
6004
  const varyHeaders = _chunkVOQ7XZZTcjs.getFarmLocaleVaryHeaders.call(void 0, runtime.config, resolution);
5516
6005
  for (const header of varyHeaders) appendResponseVary(res, header);
@@ -5556,7 +6045,7 @@ var ServerRenderer = class {
5556
6045
  });
5557
6046
  };
5558
6047
  try {
5559
- const url = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _191 => _191.config, 'access', _192 => _192.server, 'optionalAccess', _193 => _193.trustProxy]) });
6048
+ const url = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _201 => _201.config, 'access', _202 => _202.server, 'optionalAccess', _203 => _203.trustProxy]) });
5560
6049
  pathname = url.pathname;
5561
6050
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, { type: "render.start", route: pathname, pathname });
5562
6051
  searchParamsObject = _chunkSUCDVKUBcjs.searchParamsToObject.call(void 0, url.searchParams);
@@ -5619,7 +6108,7 @@ var ServerRenderer = class {
5619
6108
  layouts = match.layouts;
5620
6109
  routeSlots = _nullishCoalesce(match.slots, () => ( []));
5621
6110
  if (!route) {
5622
- if (_chunk46KXZBOGcjs.isFarmDefaultMCPPathname.call(void 0, pathname) && this.getDefaultMCPServer()) {
6111
+ if (_chunkQAS7KE7Jcjs.isFarmDefaultMCPPathname.call(void 0, pathname) && this.getDefaultMCPServer()) {
5623
6112
  await this.renderDefaultMCP(req, res);
5624
6113
  completeRender(res.statusCode || 200, pathname);
5625
6114
  return;
@@ -5636,13 +6125,13 @@ var ServerRenderer = class {
5636
6125
  params
5637
6126
  });
5638
6127
  let actionRequest;
5639
- if (req.method === "POST" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _194 => _194.config, 'access', _195 => _195.experimental, 'optionalAccess', _196 => _196.serverComponents])) === "islands") {
6128
+ if (req.method === "POST" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _204 => _204.config, 'access', _205 => _205.experimental, 'optionalAccess', _206 => _206.serverComponents])) === "islands") {
5640
6129
  await Promise.all([
5641
6130
  this.routeManager.loadRouteModule(route.modulePath),
5642
6131
  ...layouts.map((layout) => this.routeManager.loadLayoutModule(layout.modulePath))
5643
6132
  ]);
5644
6133
  actionRequest = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
5645
- trustProxy: _optionalChain([this, 'access', _197 => _197.config, 'access', _198 => _198.server, 'optionalAccess', _199 => _199.trustProxy])
6134
+ trustProxy: _optionalChain([this, 'access', _207 => _207.config, 'access', _208 => _208.server, 'optionalAccess', _209 => _209.trustProxy])
5646
6135
  });
5647
6136
  const actionResponse = await _chunk3OWVWZ6Rcjs.handleFarmFormActionRequest.call(void 0,
5648
6137
  actionRequest,
@@ -5662,7 +6151,7 @@ var ServerRenderer = class {
5662
6151
  exposedOnly: true
5663
6152
  });
5664
6153
  const currentRequest = _nullishCoalesce(actionRequest, () => ( _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
5665
- trustProxy: _optionalChain([this, 'access', _200 => _200.config, 'access', _201 => _201.server, 'optionalAccess', _202 => _202.trustProxy])
6154
+ trustProxy: _optionalChain([this, 'access', _210 => _210.config, 'access', _211 => _211.server, 'optionalAccess', _212 => _212.trustProxy])
5666
6155
  })));
5667
6156
  const routeContext = await this.resolveRouteContext({
5668
6157
  request: currentRequest,
@@ -5704,11 +6193,11 @@ var ServerRenderer = class {
5704
6193
  searchParams: _chunkSUCDVKUBcjs.createFarmSearchParams.call(void 0, searchParamsObject),
5705
6194
  error
5706
6195
  };
5707
- if (_chunk7JUIK547cjs.isFarmNotFoundError.call(void 0, error) && _optionalChain([programmaticRouteComponents, 'optionalAccess', _203 => _203.notFound])) {
6196
+ if (_chunk7JUIK547cjs.isFarmNotFoundError.call(void 0, error) && _optionalChain([programmaticRouteComponents, 'optionalAccess', _213 => _213.notFound])) {
5708
6197
  res.statusCode = 404;
5709
6198
  PageComponent = programmaticRouteComponents.notFound;
5710
6199
  pageProps = routeStateProps;
5711
- } else if (_optionalChain([programmaticRouteComponents, 'optionalAccess', _204 => _204.error])) {
6200
+ } else if (_optionalChain([programmaticRouteComponents, 'optionalAccess', _214 => _214.error])) {
5712
6201
  res.statusCode = 500;
5713
6202
  PageComponent = programmaticRouteComponents.error;
5714
6203
  pageProps = routeStateProps;
@@ -5716,18 +6205,21 @@ var ServerRenderer = class {
5716
6205
  throw error;
5717
6206
  }
5718
6207
  }
5719
- const renderingConfig = await _chunkUQHIWZZ6cjs.resolveRouteRenderingConfigFromFile.call(void 0,
6208
+ const renderingConfig = await _chunk3TL3AH25cjs.resolveRouteRenderingConfigFromFile.call(void 0,
5720
6209
  routeModule,
5721
6210
  route.modulePath,
5722
- { experimentalPPR: _optionalChain([this, 'access', _205 => _205.config, 'access', _206 => _206.experimental, 'optionalAccess', _207 => _207.ppr]) === true }
6211
+ { experimentalPPR: _optionalChain([this, 'access', _215 => _215.config, 'access', _216 => _216.experimental, 'optionalAccess', _217 => _217.ppr]) === true }
5723
6212
  );
5724
6213
  const pprBypassReason = renderingConfig.ppr ? this.getPPRShellBypassReason(req, middlewareMap, middlewareContext, pluginExposedContext) : void 0;
5725
- const canCachePPRShell = renderingConfig.ppr && !pprBypassReason;
6214
+ const islandsNavigationRequest = Boolean(
6215
+ islands && this.islandValues() && (requestHeader(req, "f-layouts") || requestHeader(req, "f-stream"))
6216
+ );
6217
+ const canCachePPRShell = renderingConfig.ppr && !pprBypassReason && !islandsNavigationRequest;
5726
6218
  const pprI18nSnapshot = canCachePPRShell ? _chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, ) : void 0;
5727
6219
  const pprShellOptions = canCachePPRShell ? {
5728
6220
  pathname,
5729
6221
  search: url.search,
5730
- locale: _nullishCoalesce(_optionalChain([pprI18nSnapshot, 'optionalAccess', _208 => _208.locale]), () => ( "")),
6222
+ locale: _nullishCoalesce(_optionalChain([pprI18nSnapshot, 'optionalAccess', _218 => _218.locale]), () => ( "")),
5731
6223
  origin: pprI18nSnapshot && pprI18nSnapshot.routing !== "none" ? url.origin : "",
5732
6224
  revalidate: renderingConfig.revalidate
5733
6225
  } : void 0;
@@ -5850,20 +6342,20 @@ var ServerRenderer = class {
5850
6342
  if (moduleMetadata.suppressedAsyncHydration) {
5851
6343
  warnSuppressedAsyncHydrationOnce(
5852
6344
  route.modulePath,
5853
- _optionalChain([routeManifestEntry, 'optionalAccess', _209 => _209.suppressedAsyncHydrationReason])
6345
+ _optionalChain([routeManifestEntry, 'optionalAccess', _219 => _219.suppressedAsyncHydrationReason])
5854
6346
  );
5855
6347
  }
5856
6348
  const layoutHydrationMetadata = layouts.map((layout) => {
5857
6349
  const manifestEntry = routeManifest.layouts.find(
5858
6350
  (entry) => entry.pattern === layout.pattern
5859
6351
  );
5860
- if (_optionalChain([manifestEntry, 'optionalAccess', _210 => _210.suppressedAsyncHydration])) {
6352
+ if (_optionalChain([manifestEntry, 'optionalAccess', _220 => _220.suppressedAsyncHydration])) {
5861
6353
  warnSuppressedAsyncHydrationOnce(
5862
6354
  layout.modulePath,
5863
6355
  manifestEntry.suppressedAsyncHydrationReason
5864
6356
  );
5865
6357
  }
5866
- if (typeof _optionalChain([manifestEntry, 'optionalAccess', _211 => _211.shouldHydrate]) === "boolean") {
6358
+ if (typeof _optionalChain([manifestEntry, 'optionalAccess', _221 => _221.shouldHydrate]) === "boolean") {
5867
6359
  return {
5868
6360
  isClientComponent: manifestEntry.isClientComponent === true,
5869
6361
  shouldHydrate: manifestEntry.shouldHydrate,
@@ -5883,12 +6375,12 @@ var ServerRenderer = class {
5883
6375
  );
5884
6376
  const clientLayouts = layouts.map((layout, index) => ({
5885
6377
  pattern: layout.pattern,
5886
- modulePath: _chunkVQJYGZNXcjs.toViteModuleId.call(void 0, layout.modulePath, this.config.root),
5887
- shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _212 => _212[index], 'optionalAccess', _213 => _213.shouldHydrate]) === true,
5888
- islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _214 => _214[index], 'optionalAccess', _215 => _215.islandStrategy]), () => ( null)),
5889
- ..._optionalChain([layoutHydrationMetadata, 'access', _216 => _216[index], 'optionalAccess', _217 => _217.hasIsolatedClientBoundaries]) === true ? { hasIsolatedClientBoundaries: true } : {},
6378
+ modulePath: _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, layout.modulePath, this.config.root),
6379
+ shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _222 => _222[index], 'optionalAccess', _223 => _223.shouldHydrate]) === true,
6380
+ islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _224 => _224[index], 'optionalAccess', _225 => _225.islandStrategy]), () => ( null)),
6381
+ ..._optionalChain([layoutHydrationMetadata, 'access', _226 => _226[index], 'optionalAccess', _227 => _227.hasIsolatedClientBoundaries]) === true ? { hasIsolatedClientBoundaries: true } : {},
5890
6382
  // Islands mode: the browser rebuilds this layout from its tree, not its module.
5891
- ...shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access', _218 => _218[index], 'optionalAccess', _219 => _219.serverTree]) === true ? { serverTree: true } : {}
6383
+ ...shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access', _228 => _228[index], 'optionalAccess', _229 => _229.serverTree]) === true ? { serverTree: true } : {}
5892
6384
  }));
5893
6385
  const hydrationStrategies = [
5894
6386
  ...shouldHydrate && moduleMetadata.islandStrategy ? [moduleMetadata.islandStrategy] : [],
@@ -5896,13 +6388,23 @@ var ServerRenderer = class {
5896
6388
  (metadata) => metadata.shouldHydrate && metadata.islandStrategy ? [metadata.islandStrategy] : []
5897
6389
  )
5898
6390
  ];
5899
- const hydrationIslandStrategy = hydrationStrategies.every(
5900
- (strategy) => strategy === hydrationStrategies[0]
5901
- ) ? _nullishCoalesce(hydrationStrategies[0], () => ( "load")) : "load";
6391
+ const hydrationIslandStrategy = this.islandValues() ? resolveFarmRouteRootStrategy(
6392
+ route,
6393
+ { shouldHydrate, islandStrategy: _nullishCoalesce(moduleMetadata.islandStrategy, () => ( null)) },
6394
+ layouts.map((layout, index) => ({
6395
+ pattern: layout.pattern,
6396
+ modulePath: layout.modulePath,
6397
+ shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _230 => _230[index], 'optionalAccess', _231 => _231.shouldHydrate]) === true,
6398
+ hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access', _232 => _232[index], 'optionalAccess', _233 => _233.hasIsolatedClientBoundaries]) === true,
6399
+ islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _234 => _234[index], 'optionalAccess', _235 => _235.islandStrategy]), () => ( null))
6400
+ })),
6401
+ this.config.root || process.cwd(),
6402
+ true
6403
+ ) : hydrationStrategies.every((strategy) => strategy === hydrationStrategies[0]) ? _nullishCoalesce(hydrationStrategies[0], () => ( "load")) : "load";
5902
6404
  const hasHydratableRouteSlots = renderedRouteSlots.some(
5903
6405
  (slot) => slot.isClientComponent || slot.shouldHydrate
5904
6406
  );
5905
- const hasIsolatedClientBoundaries = _optionalChain([routeManifestEntry, 'optionalAccess', _220 => _220.hasIsolatedClientBoundaries]) === true || layoutHydrationMetadata.some((metadata) => metadata.hasIsolatedClientBoundaries === true);
6407
+ const hasIsolatedClientBoundaries = _optionalChain([routeManifestEntry, 'optionalAccess', _236 => _236.hasIsolatedClientBoundaries]) === true || layoutHydrationMetadata.some((metadata) => metadata.hasIsolatedClientBoundaries === true);
5906
6408
  req.__FARM_PAGE_PATH__ = route.modulePath;
5907
6409
  req.__FARM_ROUTE__ = pathname;
5908
6410
  req.__FARM_IS_CLIENT_COMPONENT__ = isClientComponent;
@@ -5915,7 +6417,7 @@ var ServerRenderer = class {
5915
6417
  req.__FARM_SHOULD_HYDRATE__ = shouldHydrate || shouldHydrateLayout || hasIsolatedClientBoundaries;
5916
6418
  req.__FARM_ISLAND_STRATEGY__ = hydrationIslandStrategy;
5917
6419
  req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ = hasHydratableRouteSlots;
5918
- req.__FARM_LOADING_MODULE_PATH__ = _optionalChain([loadingBoundaryEntry, 'optionalAccess', _221 => _221.modulePath]) ? _chunkVQJYGZNXcjs.toViteModuleId.call(void 0, loadingBoundaryEntry.modulePath, this.config.root) : null;
6420
+ req.__FARM_LOADING_MODULE_PATH__ = _optionalChain([loadingBoundaryEntry, 'optionalAccess', _237 => _237.modulePath]) ? _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, loadingBoundaryEntry.modulePath, this.config.root) : null;
5919
6421
  req.__FARM_ROUTE_SLOTS__ = renderedRouteSlots.map((slot) => ({
5920
6422
  name: slot.name,
5921
6423
  ownerPattern: slot.ownerPattern,
@@ -5987,7 +6489,7 @@ var ServerRenderer = class {
5987
6489
  } else if (shouldHydrateLayout && !(isClientComponent || shouldHydrate) && this.rendererRuntime.isolateServerPageGraph) {
5988
6490
  pageElement = await this.isolateServerPage(
5989
6491
  pageElement,
5990
- _optionalChain([routeManifestEntry, 'optionalAccess', _222 => _222.serverTree]) === true
6492
+ _optionalChain([routeManifestEntry, 'optionalAccess', _238 => _238.serverTree]) === true
5991
6493
  );
5992
6494
  }
5993
6495
  pageElement = this.createPageBoundary(pageElement, {
@@ -5995,11 +6497,22 @@ var ServerRenderer = class {
5995
6497
  layoutShouldHydrate: shouldHydrateLayout,
5996
6498
  islandStrategy: hydrationIslandStrategy
5997
6499
  });
6500
+ const islandsSegments = Boolean(islands && this.islandValues());
6501
+ const keptLayoutCount = islandsSegments && !renderingConfig.ssg && !shouldHydrateLayout && renderedRouteSlots.length === 0 ? countFarmKeptLayouts(requestHeader(req, "f-layouts"), layouts, params) : 0;
6502
+ const keptLayouts = keptLayoutCount > 1 ? keptLayoutCount : 0;
5998
6503
  let wrappedElement = pageElement;
5999
6504
  for (let i = layoutModules.length - 1; i >= 0; i--) {
6000
6505
  const layoutModule = layoutModules[i];
6001
6506
  const layoutEntry = layouts[i];
6002
6507
  const LayoutComponent = layoutModule.default;
6508
+ const segment = islandsSegments && !shouldHydrateLayout ? { key: getFarmLayoutKey(layoutEntry.pattern, params) } : void 0;
6509
+ if (LayoutComponent && i > 0 && i < keptLayouts) {
6510
+ wrappedElement = this.createLayoutBoundary(layoutEntry.pattern, wrappedElement, {
6511
+ key: segment.key,
6512
+ kept: true
6513
+ });
6514
+ continue;
6515
+ }
6003
6516
  const slotProps = {};
6004
6517
  for (const slot of renderedRouteSlots) {
6005
6518
  if ((_nullishCoalesce(slot.ownerDirectory, () => ( slot.ownerPattern))) !== layoutEntry.pattern) continue;
@@ -6019,7 +6532,7 @@ var ServerRenderer = class {
6019
6532
  );
6020
6533
  slotProps[slot.name] = slotElement;
6021
6534
  }
6022
- wrappedElement = shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access', _223 => _223[i], 'optionalAccess', _224 => _224.serverTree]) === true && islands && this.islandValues() ? await islands.renderFarmServerTreeLayout(
6535
+ wrappedElement = shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access', _239 => _239[i], 'optionalAccess', _240 => _240.serverTree]) === true && islands && this.islandValues() ? await islands.renderFarmServerTreeLayout(
6023
6536
  LayoutComponent,
6024
6537
  { params },
6025
6538
  { children: wrappedElement, ...slotProps },
@@ -6029,7 +6542,11 @@ var ServerRenderer = class {
6029
6542
  params,
6030
6543
  ...slotProps
6031
6544
  });
6032
- wrappedElement = this.createLayoutBoundary(layoutEntry.pattern, wrappedElement);
6545
+ wrappedElement = this.createLayoutBoundary(
6546
+ layoutEntry.pattern,
6547
+ wrappedElement,
6548
+ segment
6549
+ );
6033
6550
  }
6034
6551
  if (shouldHydrateLayout) {
6035
6552
  wrappedElement = this.wrapClientGraph(wrappedElement);
@@ -6150,7 +6667,7 @@ var ServerRenderer = class {
6150
6667
  }
6151
6668
  }
6152
6669
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, { type: "render.error", route: pathname, error });
6153
- const errorStatus = _chunkTSFMFPRUcjs.resolveDefaultErrorStatus.call(void 0, error);
6670
+ const errorStatus = _chunkO27PLNQZcjs.resolveDefaultErrorStatus.call(void 0, error);
6154
6671
  if (pprRefreshRoute) {
6155
6672
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
6156
6673
  type: "ppr.refresh.error",
@@ -6158,7 +6675,7 @@ var ServerRenderer = class {
6158
6675
  error
6159
6676
  });
6160
6677
  }
6161
- _chunkVQJYGZNXcjs.logger.error(`Error rendering page: ${error}`);
6678
+ _chunkQMNWKQL4cjs.logger.error(`Error rendering page: ${error}`);
6162
6679
  if (res.headersSent || res.writableEnded) {
6163
6680
  if (!res.writableEnded) {
6164
6681
  res.end();
@@ -6186,7 +6703,7 @@ var ServerRenderer = class {
6186
6703
  }
6187
6704
  }
6188
6705
  async wrapWithIntegrationProviders(element) {
6189
- const providers = _chunkCECUDGXQcjs.getIntegrationProviders.call(void 0, this.config.integrations);
6706
+ const providers = _chunkZP32GNJQcjs.getIntegrationProviders.call(void 0, this.config.integrations);
6190
6707
  let wrapped = element;
6191
6708
  for (let i = providers.length - 1; i >= 0; i--) {
6192
6709
  const provider = providers[i];
@@ -6194,7 +6711,7 @@ var ServerRenderer = class {
6194
6711
  const rendererCapabilities = _chunkRD623KW4cjs.getFarmRendererCapabilities.call(void 0, this.config.renderer);
6195
6712
  if (!rendererCapabilities.functionComponents) {
6196
6713
  throw new Error(
6197
- `Integration provider \`${provider.name}\` requires a renderer that can host function components; \`${_nullishCoalesce(_optionalChain([this, 'access', _225 => _225.config, 'access', _226 => _226.renderer, 'optionalAccess', _227 => _227.name]), () => ( "the configured renderer"))}\` cannot.`
6714
+ `Integration provider \`${provider.name}\` requires a renderer that can host function components; \`${_nullishCoalesce(_optionalChain([this, 'access', _241 => _241.config, 'access', _242 => _242.renderer, 'optionalAccess', _243 => _243.name]), () => ( "the configured renderer"))}\` cannot.`
6198
6715
  );
6199
6716
  }
6200
6717
  if (provider.type === "clerk" && !_chunkRD623KW4cjs.isReactRenderer.call(void 0, this.config.renderer)) {
@@ -6204,14 +6721,14 @@ var ServerRenderer = class {
6204
6721
  }
6205
6722
  let ProviderComponent;
6206
6723
  let providerSourceModule;
6207
- if (_chunkCECUDGXQcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
6724
+ if (_chunkZP32GNJQcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
6208
6725
  providerSourceModule = provider.component.module;
6209
- const providerModuleId = provider.component.module.startsWith(".") ? _chunkVQJYGZNXcjs.toViteModuleId.call(void 0,
6210
- path10.resolve(this.config.root, provider.component.module),
6726
+ const providerModuleId = provider.component.module.startsWith(".") ? _chunkQMNWKQL4cjs.toViteModuleId.call(void 0,
6727
+ path12.resolve(this.config.root, provider.component.module),
6211
6728
  this.config.root
6212
6729
  ) : provider.component.module;
6213
6730
  const providerModule = this.viteServer ? await _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, this.viteServer, providerModuleId) : await importRuntimeModule(
6214
- provider.component.module.startsWith(".") ? _url.pathToFileURL.call(void 0, path10.resolve(this.config.root, provider.component.module)).href : provider.component.module
6731
+ provider.component.module.startsWith(".") ? _url.pathToFileURL.call(void 0, path12.resolve(this.config.root, provider.component.module)).href : provider.component.module
6215
6732
  );
6216
6733
  ProviderComponent = providerModule[provider.component.export || "default"];
6217
6734
  } else if (typeof provider.component === "function") {
@@ -6233,7 +6750,7 @@ var ServerRenderer = class {
6233
6750
  }
6234
6751
  if (provider.type !== "clerk" && typeof this.rendererRuntime.markFunctionComponent === "function" && !isRendererCompiledComponent(
6235
6752
  _nullishCoalesce(providerSourceModule, () => ( "")),
6236
- _chunkRD623KW4cjs.resolveFarmComponentExtensions.call(void 0, _optionalChain([this, 'access', _228 => _228.config, 'access', _229 => _229.renderer, 'optionalAccess', _230 => _230.componentExtensions]))
6753
+ _chunkRD623KW4cjs.resolveFarmComponentExtensions.call(void 0, _optionalChain([this, 'access', _244 => _244.config, 'access', _245 => _245.renderer, 'optionalAccess', _246 => _246.componentExtensions]))
6237
6754
  )) {
6238
6755
  ProviderComponent = this.rendererRuntime.markFunctionComponent(ProviderComponent);
6239
6756
  }
@@ -6302,7 +6819,7 @@ var ServerRenderer = class {
6302
6819
  );
6303
6820
  metadata = _chunk6IOZPJ3Icjs.addMetadataMarkdownAlternate.call(void 0,
6304
6821
  metadata,
6305
- _chunkD7UQC4O6cjs.getFarmMarkdownAlternatePath.call(void 0, _chunkD7UQC4O6cjs.resolveMarkdownConfig.call(void 0, this.config.md), publicPathname)
6822
+ _chunkLT4VAF5Zcjs.getFarmMarkdownAlternatePath.call(void 0, _chunkLT4VAF5Zcjs.resolveMarkdownConfig.call(void 0, this.config.md), publicPathname)
6306
6823
  );
6307
6824
  return metadata;
6308
6825
  }
@@ -6340,7 +6857,7 @@ var ServerRenderer = class {
6340
6857
  reference.contentType = imageModule.contentType;
6341
6858
  }
6342
6859
  } catch (error) {
6343
- _chunkVQJYGZNXcjs.logger.warn(`Failed to read ${kind} image metadata for ${pathname}: ${error}`);
6860
+ _chunkQMNWKQL4cjs.logger.warn(`Failed to read ${kind} image metadata for ${pathname}: ${error}`);
6344
6861
  }
6345
6862
  return reference;
6346
6863
  }
@@ -6360,7 +6877,7 @@ var ServerRenderer = class {
6360
6877
  );
6361
6878
  }
6362
6879
  const request2 = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
6363
- trustProxy: _optionalChain([this, 'access', _231 => _231.config, 'access', _232 => _232.server, 'optionalAccess', _233 => _233.trustProxy])
6880
+ trustProxy: _optionalChain([this, 'access', _247 => _247.config, 'access', _248 => _248.server, 'optionalAccess', _249 => _249.trustProxy])
6364
6881
  });
6365
6882
  const url = new URL(request2.url);
6366
6883
  const llmsContext = match.metadata.kind === "llms" || match.metadata.kind === "llms-full" ? await this.createLlmsTxtContext(request2, {
@@ -6374,17 +6891,17 @@ var ServerRenderer = class {
6374
6891
  path: match.routePath,
6375
6892
  ...llmsContext
6376
6893
  }) : routeModule.default;
6377
- const body = match.metadata.kind === "llms-full" && !(value instanceof Response) ? await _chunkH33PJEXNcjs.renderFarmLlmsFullTxt.call(void 0, value, {
6894
+ const body = match.metadata.kind === "llms-full" && !(value instanceof Response) ? await _chunkMEQN6DDAcjs.renderFarmLlmsFullTxt.call(void 0, value, {
6378
6895
  origin: url.origin,
6379
6896
  readMarkdown: llmsContext.markdown
6380
6897
  }) : value;
6381
- const response = _chunkTSFMFPRUcjs.createFarmMetadataRouteResponse.call(void 0, match.metadata.kind, body, routeModule, {
6898
+ const response = _chunkO27PLNQZcjs.createFarmMetadataRouteResponse.call(void 0, match.metadata.kind, body, routeModule, {
6382
6899
  method,
6383
6900
  request: request2
6384
6901
  });
6385
6902
  await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
6386
6903
  } catch (error) {
6387
- _chunkVQJYGZNXcjs.logger.error(`Metadata route render failed for ${match.metadata.modulePath}: ${error}`);
6904
+ _chunkQMNWKQL4cjs.logger.error(`Metadata route render failed for ${match.metadata.modulePath}: ${error}`);
6388
6905
  await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
6389
6906
  res,
6390
6907
  new Response("Internal Server Error", {
@@ -6396,7 +6913,7 @@ var ServerRenderer = class {
6396
6913
  }
6397
6914
  /** `/llms.txt` and `/llms-full.txt` from `agent.llmsTxt` when no file route owns them. */
6398
6915
  getGeneratedLlmsKind(pathname) {
6399
- const config = _chunkH33PJEXNcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _234 => _234.config, 'access', _235 => _235.agent, 'optionalAccess', _236 => _236.llmsTxt]));
6916
+ const config = _chunkMEQN6DDAcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _250 => _250.config, 'access', _251 => _251.agent, 'optionalAccess', _252 => _252.llmsTxt]));
6400
6917
  if (!config.enabled) return null;
6401
6918
  if (pathname === "/llms.txt") return "llms";
6402
6919
  return pathname === "/llms-full.txt" && config.full ? "llms-full" : null;
@@ -6404,17 +6921,17 @@ var ServerRenderer = class {
6404
6921
  async renderGeneratedLlmsTxt(req, res, kind) {
6405
6922
  try {
6406
6923
  const request2 = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
6407
- trustProxy: _optionalChain([this, 'access', _237 => _237.config, 'access', _238 => _238.server, 'optionalAccess', _239 => _239.trustProxy])
6924
+ trustProxy: _optionalChain([this, 'access', _253 => _253.config, 'access', _254 => _254.server, 'optionalAccess', _255 => _255.trustProxy])
6408
6925
  });
6409
- const config = _chunkH33PJEXNcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _240 => _240.config, 'access', _241 => _241.agent, 'optionalAccess', _242 => _242.llmsTxt]));
6926
+ const config = _chunkMEQN6DDAcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _256 => _256.config, 'access', _257 => _257.agent, 'optionalAccess', _258 => _258.llmsTxt]));
6410
6927
  const context = await this.createLlmsTxtContext(request2, { full: kind === "llms-full", req });
6411
- const body = kind === "llms-full" ? await _chunkH33PJEXNcjs.renderFarmLlmsFullTxt.call(void 0, context.defaults, {
6928
+ const body = kind === "llms-full" ? await _chunkMEQN6DDAcjs.renderFarmLlmsFullTxt.call(void 0, context.defaults, {
6412
6929
  origin: new URL(request2.url).origin,
6413
6930
  readMarkdown: context.markdown
6414
6931
  }) : context.defaults;
6415
6932
  await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
6416
6933
  res,
6417
- _chunkTSFMFPRUcjs.createFarmMetadataRouteResponse.call(void 0,
6934
+ _chunkO27PLNQZcjs.createFarmMetadataRouteResponse.call(void 0,
6418
6935
  kind,
6419
6936
  body,
6420
6937
  { revalidate: config.revalidate },
@@ -6422,7 +6939,7 @@ var ServerRenderer = class {
6422
6939
  )
6423
6940
  );
6424
6941
  } catch (error) {
6425
- _chunkVQJYGZNXcjs.logger.error(`Generated ${kind}.txt failed: ${error}`);
6942
+ _chunkQMNWKQL4cjs.logger.error(`Generated ${kind}.txt failed: ${error}`);
6426
6943
  await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
6427
6944
  res,
6428
6945
  new Response("Internal Server Error", {
@@ -6433,26 +6950,26 @@ var ServerRenderer = class {
6433
6950
  }
6434
6951
  }
6435
6952
  getAgentCrawlers() {
6436
- return _chunkFFE2EMF7cjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([this, 'access', _243 => _243.config, 'access', _244 => _244.agent, 'optionalAccess', _245 => _245.crawlers]));
6953
+ return _chunkDZPR2W6Ucjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([this, 'access', _259 => _259.config, 'access', _260 => _260.agent, 'optionalAccess', _261 => _261.crawlers]));
6437
6954
  }
6438
6955
  /** `/robots.txt` from `agent.crawlers` when no robots.ts owns it. */
6439
6956
  async renderGeneratedRobotsTxt(req, res) {
6440
6957
  try {
6441
- const sitemapPath = _optionalChain([this, 'access', _246 => _246.routeManager, 'access', _247 => _247.matchMetadataRoute, 'call', _248 => _248("/sitemap.xml"), 'optionalAccess', _249 => _249.metadata, 'access', _250 => _250.kind]) === "sitemap" || this.getAgentSitemap().enabled ? "/sitemap.xml" : void 0;
6958
+ const sitemapPath = _optionalChain([this, 'access', _262 => _262.routeManager, 'access', _263 => _263.matchMetadataRoute, 'call', _264 => _264("/sitemap.xml"), 'optionalAccess', _265 => _265.metadata, 'access', _266 => _266.kind]) === "sitemap" || this.getAgentSitemap().enabled ? "/sitemap.xml" : void 0;
6442
6959
  const rootLayout = this.routeManager.getLayouts().get("/");
6443
6960
  const rootMetadata = sitemapPath && rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
6444
- const robots = _chunkFFE2EMF7cjs.createFarmAgentRobots.call(void 0, {
6961
+ const robots = _chunkDZPR2W6Ucjs.createFarmAgentRobots.call(void 0, {
6445
6962
  crawlers: this.getAgentCrawlers(),
6446
6963
  sitemapPath,
6447
- metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _251 => _251.metadataBase]),
6964
+ metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _267 => _267.metadataBase]),
6448
6965
  basePath: this.config.basePath
6449
6966
  });
6450
6967
  await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
6451
6968
  res,
6452
- _chunkTSFMFPRUcjs.createFarmMetadataRouteResponse.call(void 0, "robots", robots, {}, { method: req.method })
6969
+ _chunkO27PLNQZcjs.createFarmMetadataRouteResponse.call(void 0, "robots", robots, {}, { method: req.method })
6453
6970
  );
6454
6971
  } catch (error) {
6455
- _chunkVQJYGZNXcjs.logger.error(`Generated robots.txt failed: ${error}`);
6972
+ _chunkQMNWKQL4cjs.logger.error(`Generated robots.txt failed: ${error}`);
6456
6973
  await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
6457
6974
  res,
6458
6975
  new Response("Internal Server Error", {
@@ -6463,40 +6980,40 @@ var ServerRenderer = class {
6463
6980
  }
6464
6981
  }
6465
6982
  getAgentSitemap() {
6466
- return _chunkFFE2EMF7cjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([this, 'access', _252 => _252.config, 'access', _253 => _253.agent, 'optionalAccess', _254 => _254.sitemap]));
6983
+ return _chunkDZPR2W6Ucjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([this, 'access', _268 => _268.config, 'access', _269 => _269.agent, 'optionalAccess', _270 => _270.sitemap]));
6467
6984
  }
6468
6985
  /** `/sitemap.xml` from `agent.sitemap` when no sitemap.ts owns it. */
6469
6986
  async renderGeneratedSitemap(req, res) {
6470
6987
  try {
6471
6988
  const request2 = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
6472
- trustProxy: _optionalChain([this, 'access', _255 => _255.config, 'access', _256 => _256.server, 'optionalAccess', _257 => _257.trustProxy])
6989
+ trustProxy: _optionalChain([this, 'access', _271 => _271.config, 'access', _272 => _272.server, 'optionalAccess', _273 => _273.trustProxy])
6473
6990
  });
6474
6991
  const sources = await Promise.all(
6475
6992
  this.getAgentListedRoutes().map(async ([pattern, route]) => {
6476
6993
  const [module, stat] = await Promise.all([
6477
6994
  this.routeManager.loadRouteModule(route.modulePath).catch((error) => {
6478
- _chunkVQJYGZNXcjs.logger.warn(`Could not read metadata for ${pattern} in sitemap.xml: ${error}`);
6995
+ _chunkQMNWKQL4cjs.logger.warn(`Could not read metadata for ${pattern} in sitemap.xml: ${error}`);
6479
6996
  return void 0;
6480
6997
  }),
6481
- fs6.promises.stat(route.modulePath).catch(() => void 0)
6998
+ fs8.promises.stat(route.modulePath).catch(() => void 0)
6482
6999
  ]);
6483
- return { pattern, module, lastModified: _optionalChain([stat, 'optionalAccess', _258 => _258.mtime, 'access', _259 => _259.toISOString, 'call', _260 => _260()]) };
7000
+ return { pattern, module, lastModified: _optionalChain([stat, 'optionalAccess', _274 => _274.mtime, 'access', _275 => _275.toISOString, 'call', _276 => _276()]) };
6484
7001
  })
6485
7002
  );
6486
7003
  const rootLayout = this.routeManager.getLayouts().get("/");
6487
7004
  const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
6488
- const sitemap = _chunkFFE2EMF7cjs.createFarmDefaultSitemap.call(void 0, sources, {
7005
+ const sitemap = _chunkDZPR2W6Ucjs.createFarmDefaultSitemap.call(void 0, sources, {
6489
7006
  origin: new URL(request2.url).origin,
6490
7007
  config: this.getAgentSitemap(),
6491
- metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _261 => _261.metadataBase]),
7008
+ metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _277 => _277.metadataBase]),
6492
7009
  basePath: this.config.basePath
6493
7010
  });
6494
7011
  await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
6495
7012
  res,
6496
- _chunkTSFMFPRUcjs.createFarmMetadataRouteResponse.call(void 0, "sitemap", sitemap, {}, { method: req.method })
7013
+ _chunkO27PLNQZcjs.createFarmMetadataRouteResponse.call(void 0, "sitemap", sitemap, {}, { method: req.method })
6497
7014
  );
6498
7015
  } catch (error) {
6499
- _chunkVQJYGZNXcjs.logger.error(`Generated sitemap.xml failed: ${error}`);
7016
+ _chunkQMNWKQL4cjs.logger.error(`Generated sitemap.xml failed: ${error}`);
6500
7017
  await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
6501
7018
  res,
6502
7019
  new Response("Internal Server Error", {
@@ -6520,9 +7037,9 @@ var ServerRenderer = class {
6520
7037
  * matcher) covers, as the production build decides.
6521
7038
  */
6522
7039
  getAgentListedRoutes() {
6523
- const guards = { config: this.config, middlewareRoutes: _nullishCoalesce(_optionalChain([this, 'access', _262 => _262.middlewareRoutes, 'optionalCall', _263 => _263()]), () => ( [])) };
7040
+ const guards = { config: this.config, middlewareRoutes: _nullishCoalesce(_optionalChain([this, 'access', _278 => _278.middlewareRoutes, 'optionalCall', _279 => _279()]), () => ( [])) };
6524
7041
  return [...this.routeManager.getRoutes()].filter(
6525
- ([pattern]) => !pattern.includes("[") && !_chunkTSFMFPRUcjs.farmPathGuardCoversPage.call(void 0, guards, pattern)
7042
+ ([pattern]) => !pattern.includes("[") && !_chunkO27PLNQZcjs.farmPathGuardCoversPage.call(void 0, guards, pattern)
6526
7043
  );
6527
7044
  }
6528
7045
  /**
@@ -6531,20 +7048,20 @@ var ServerRenderer = class {
6531
7048
  * or a registered server such as the docs engine's. Production applies the same rules.
6532
7049
  */
6533
7050
  getDefaultMCPServer() {
6534
- if (_optionalChain([this, 'access', _264 => _264.config, 'access', _265 => _265.agent, 'optionalAccess', _266 => _266.mcp]) !== true || _chunk46KXZBOGcjs.farmConfigMountsMCP.call(void 0, this.config)) return void 0;
6535
- if (_optionalChain([this, 'access', _267 => _267.apiRouteExists, 'optionalCall', _268 => _268("/api/mcp")])) return void 0;
6536
- if (this.routeManager.matchRoute(_chunk46KXZBOGcjs.FARM_DEFAULT_MCP_PATH).route) return void 0;
6537
- _nullishCoalesce(this.defaultMCPServer, () => ( (this.defaultMCPServer = _chunk46KXZBOGcjs.createFarmDefaultMCPServer.call(void 0,
7051
+ if (_optionalChain([this, 'access', _280 => _280.config, 'access', _281 => _281.agent, 'optionalAccess', _282 => _282.mcp]) !== true || _chunkQAS7KE7Jcjs.farmConfigMountsMCP.call(void 0, this.config)) return void 0;
7052
+ if (_optionalChain([this, 'access', _283 => _283.apiRouteExists, 'optionalCall', _284 => _284("/api/mcp")])) return void 0;
7053
+ if (this.routeManager.matchRoute(_chunkQAS7KE7Jcjs.FARM_DEFAULT_MCP_PATH).route) return void 0;
7054
+ _nullishCoalesce(this.defaultMCPServer, () => ( (this.defaultMCPServer = _chunkQAS7KE7Jcjs.createFarmDefaultMCPServer.call(void 0,
6538
7055
  readAppPackageIdentity(this.config.root),
6539
- _chunkOAMUSC7Hcjs.FARM_VERSION
7056
+ _chunk2FRLSDBTcjs.FARM_VERSION
6540
7057
  ))));
6541
- return _chunk46KXZBOGcjs.resolveFarmDefaultMCPServer.call(void 0, this.defaultMCPServer);
7058
+ return _chunkQAS7KE7Jcjs.resolveFarmDefaultMCPServer.call(void 0, this.defaultMCPServer);
6542
7059
  }
6543
7060
  async renderDefaultMCP(req, res) {
6544
7061
  const server = this.getDefaultMCPServer();
6545
- const request2 = _nullishCoalesce(_chunkHNAISJFDcjs.getCurrentRequestOrNull.call(void 0, ), () => ( _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _269 => _269.config, 'access', _270 => _270.server, 'optionalAccess', _271 => _271.trustProxy]) })));
7062
+ const request2 = _nullishCoalesce(_chunkHNAISJFDcjs.getCurrentRequestOrNull.call(void 0, ), () => ( _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _285 => _285.config, 'access', _286 => _286.server, 'optionalAccess', _287 => _287.trustProxy]) })));
6546
7063
  try {
6547
- const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-YE4AGWHN.cjs");
7064
+ const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-OV4WRFBL.cjs");
6548
7065
  const origin = new URL(request2.url).origin;
6549
7066
  const response = await handleFarmDefaultMCPRequest(request2, {
6550
7067
  server,
@@ -6558,10 +7075,10 @@ var ServerRenderer = class {
6558
7075
  module: await this.routeManager.loadRouteModule(route.modulePath).catch(() => ({ __farmRouteGuard: true }))
6559
7076
  }))
6560
7077
  );
6561
- return _chunk46KXZBOGcjs.collectFarmDefaultMCPPages.call(void 0, sources, {
7078
+ return _chunkQAS7KE7Jcjs.collectFarmDefaultMCPPages.call(void 0, sources, {
6562
7079
  origin,
6563
7080
  basePath: this.config.basePath,
6564
- markdown: _chunkD7UQC4O6cjs.resolveMarkdownConfig.call(void 0, this.config.md)
7081
+ markdown: _chunkLT4VAF5Zcjs.resolveMarkdownConfig.call(void 0, this.config.md)
6565
7082
  });
6566
7083
  },
6567
7084
  // Pages are read through this server's own socket, with no cookies, as llms-full.txt does.
@@ -6569,7 +7086,7 @@ var ServerRenderer = class {
6569
7086
  });
6570
7087
  await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
6571
7088
  } catch (error) {
6572
- _chunkVQJYGZNXcjs.logger.error(`Default MCP server failed: ${error}`);
7089
+ _chunkQMNWKQL4cjs.logger.error(`Default MCP server failed: ${error}`);
6573
7090
  await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
6574
7091
  res,
6575
7092
  new Response(
@@ -6585,7 +7102,7 @@ var ServerRenderer = class {
6585
7102
  }
6586
7103
  /** Same inputs the production server gives llms.txt: static pages and root metadata. */
6587
7104
  async createLlmsTxtContext(request2, options = {}) {
6588
- const config = _chunkH33PJEXNcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _272 => _272.config, 'access', _273 => _273.agent, 'optionalAccess', _274 => _274.llmsTxt]));
7105
+ const config = _chunkMEQN6DDAcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _288 => _288.config, 'access', _289 => _289.agent, 'optionalAccess', _290 => _290.llmsTxt]));
6589
7106
  const origin = new URL(request2.url).origin;
6590
7107
  const sources = await Promise.all(
6591
7108
  this.getAgentListedRoutes().map(async ([pattern, route]) => {
@@ -6594,34 +7111,34 @@ var ServerRenderer = class {
6594
7111
  if (module.__farmRouteGuard) return null;
6595
7112
  return { pattern, metadata: module.metadata };
6596
7113
  } catch (error) {
6597
- _chunkVQJYGZNXcjs.logger.warn(`Could not read metadata for ${pattern} in llms.txt: ${error}`);
7114
+ _chunkQMNWKQL4cjs.logger.warn(`Could not read metadata for ${pattern} in llms.txt: ${error}`);
6598
7115
  return { pattern };
6599
7116
  }
6600
7117
  })
6601
7118
  );
6602
7119
  const rootLayout = this.routeManager.getLayouts().get("/");
6603
7120
  const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
6604
- const pages = _chunkH33PJEXNcjs.collectFarmLlmsTxtPages.call(void 0,
7121
+ const pages = _chunkMEQN6DDAcjs.collectFarmLlmsTxtPages.call(void 0,
6605
7122
  sources.filter((source) => source !== null),
6606
7123
  {
6607
7124
  origin,
6608
7125
  basePath: this.config.basePath,
6609
- markdown: _chunkD7UQC4O6cjs.resolveMarkdownConfig.call(void 0, this.config.md),
7126
+ markdown: _chunkLT4VAF5Zcjs.resolveMarkdownConfig.call(void 0, this.config.md),
6610
7127
  include: config.include,
6611
7128
  exclude: config.exclude
6612
7129
  }
6613
7130
  );
6614
7131
  return {
6615
7132
  pages,
6616
- defaults: _chunkH33PJEXNcjs.createFarmDefaultLlmsTxt.call(void 0, {
7133
+ defaults: _chunkMEQN6DDAcjs.createFarmDefaultLlmsTxt.call(void 0, {
6617
7134
  origin,
6618
7135
  pages,
6619
7136
  config,
6620
7137
  rootMetadata,
6621
- mcp: _optionalChain([this, 'access', _275 => _275.config, 'access', _276 => _276.agent, 'optionalAccess', _277 => _277.aiCatalog]) === false ? [] : _chunk4SEHMBL4cjs.listFarmMCPLlmsTxtLinks.call(void 0, origin, {
7138
+ mcp: _optionalChain([this, 'access', _291 => _291.config, 'access', _292 => _292.agent, 'optionalAccess', _293 => _293.aiCatalog]) === false ? [] : _chunkDPJ66FSIcjs.listFarmMCPLlmsTxtLinks.call(void 0, origin, {
6622
7139
  basePath: this.config.basePath,
6623
- apiServerBasePath: _chunkB5BBTPJQcjs.resolveFarmAPIServerBasePath.call(void 0,
6624
- _chunkIWFV5ZEDcjs.normalizeFarmAPIConfig.call(void 0,
7140
+ apiServerBasePath: _chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0,
7141
+ _chunkPMJSG4JScjs.normalizeFarmAPIConfig.call(void 0,
6625
7142
  this.config.api
6626
7143
  )
6627
7144
  ),
@@ -6641,17 +7158,17 @@ var ServerRenderer = class {
6641
7158
  * body is discarded.
6642
7159
  */
6643
7160
  createDevMarkdownReader(req) {
6644
- const socket = _optionalChain([req, 'optionalAccess', _278 => _278.socket]);
6645
- if (_optionalChain([req, 'optionalAccess', _279 => _279.method, 'optionalAccess', _280 => _280.toUpperCase, 'call', _281 => _281()]) === "HEAD" || !_optionalChain([socket, 'optionalAccess', _282 => _282.localAddress]) || !socket.localPort) {
7161
+ const socket = _optionalChain([req, 'optionalAccess', _294 => _294.socket]);
7162
+ if (_optionalChain([req, 'optionalAccess', _295 => _295.method, 'optionalAccess', _296 => _296.toUpperCase, 'call', _297 => _297()]) === "HEAD" || !_optionalChain([socket, 'optionalAccess', _298 => _298.localAddress]) || !socket.localPort) {
6646
7163
  return async () => null;
6647
7164
  }
6648
7165
  if (socket.encrypted) {
6649
7166
  const address = { host: socket.localAddress, port: socket.localPort };
6650
- return _chunkH33PJEXNcjs.createFarmLlmsMarkdownReader.call(void 0, (page) => requestOwnHttpsServer(page, address));
7167
+ return _chunkMEQN6DDAcjs.createFarmLlmsMarkdownReader.call(void 0, (page) => requestOwnHttpsServer(page, address));
6651
7168
  }
6652
7169
  const host = socket.localAddress.includes(":") ? `[${socket.localAddress}]` : socket.localAddress;
6653
7170
  const localOrigin = `http://${host}:${socket.localPort}`;
6654
- const read = _chunkH33PJEXNcjs.createFarmLlmsMarkdownReader.call(void 0, (page) => fetch(page));
7171
+ const read = _chunkMEQN6DDAcjs.createFarmLlmsMarkdownReader.call(void 0, (page) => fetch(page));
6655
7172
  return (url) => {
6656
7173
  const target = new URL(url);
6657
7174
  return read(`${localOrigin}${target.pathname}${target.search}`);
@@ -6708,7 +7225,7 @@ var ServerRenderer = class {
6708
7225
  }
6709
7226
  const etag = `"${image.staticInfo.hash}"`;
6710
7227
  const requestUrl = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, {
6711
- trustProxy: _optionalChain([this, 'access', _283 => _283.config, 'access', _284 => _284.server, 'optionalAccess', _285 => _285.trustProxy])
7228
+ trustProxy: _optionalChain([this, 'access', _299 => _299.config, 'access', _300 => _300.server, 'optionalAccess', _301 => _301.trustProxy])
6712
7229
  });
6713
7230
  const isVersioned = requestUrl.searchParams.get("v") === image.staticInfo.hash;
6714
7231
  res.setHeader("Content-Type", image.staticInfo.contentType);
@@ -6729,7 +7246,7 @@ var ServerRenderer = class {
6729
7246
  res.end();
6730
7247
  return;
6731
7248
  }
6732
- res.write(await fs6.promises.readFile(image.modulePath));
7249
+ res.write(await fs8.promises.readFile(image.modulePath));
6733
7250
  res.end();
6734
7251
  }
6735
7252
  async renderRouteErrorBoundary(req, res, options) {
@@ -6792,7 +7309,7 @@ var ServerRenderer = class {
6792
7309
  res.end();
6793
7310
  return true;
6794
7311
  } catch (renderError) {
6795
- _chunkVQJYGZNXcjs.logger.warn(`Failed to render route-level error boundary: ${renderError}`);
7312
+ _chunkQMNWKQL4cjs.logger.warn(`Failed to render route-level error boundary: ${renderError}`);
6796
7313
  return false;
6797
7314
  }
6798
7315
  }
@@ -6855,7 +7372,7 @@ var ServerRenderer = class {
6855
7372
  const routeSlots = (req.__FARM_ROUTE_SLOTS__ || []).map(
6856
7373
  (slot) => ({
6857
7374
  ...slot,
6858
- modulePath: typeof slot.modulePath === "string" ? _chunkVQJYGZNXcjs.toViteModuleId.call(void 0, slot.modulePath, this.config.root) : slot.modulePath
7375
+ modulePath: typeof slot.modulePath === "string" ? _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, slot.modulePath, this.config.root) : slot.modulePath
6859
7376
  })
6860
7377
  );
6861
7378
  const deferredProps = _chunkXQSYOVCWcjs.prepareDeferredData.call(void 0, {
@@ -6863,7 +7380,7 @@ var ServerRenderer = class {
6863
7380
  slots: routeSlots
6864
7381
  });
6865
7382
  const pagePath = req.__FARM_PAGE_PATH__;
6866
- const relativePath = pagePath ? _chunkVQJYGZNXcjs.toViteModuleId.call(void 0, pagePath, this.config.root) : "/src/app/page.tsx";
7383
+ const relativePath = pagePath ? _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, pagePath, this.config.root) : "/src/app/page.tsx";
6867
7384
  const deploymentId = this.getDeploymentId();
6868
7385
  const farmScripts = (markup) => this.stampFarmScripts(req, markup);
6869
7386
  const bootstrapScript = farmScripts(`<script data-farm-refresh-state>
@@ -6883,12 +7400,12 @@ window.__FARM_ISLAND_STRATEGY__ = ${JSON.stringify(req.__FARM_ISLAND_STRATEGY__
6883
7400
  window.__FARM_PAGE_MODULE__ = ${JSON.stringify(relativePath)};
6884
7401
  window.__FARM_LOADING_MODULE__ = ${JSON.stringify(req.__FARM_LOADING_MODULE_PATH__ || null)};
6885
7402
  window.__FARM_MANIFEST__ = ${JSON.stringify(clientManifest)};
6886
- window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkCECUDGXQcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
7403
+ window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkZP32GNJQcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
6887
7404
  window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, ) ? serializeInlineValue(_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, )) : "null"};
6888
7405
  </script>`);
6889
7406
  const deferredScript = farmScripts(createDeferredHydrationScript(deferredProps.records));
6890
7407
  const rendererHydrationScript = farmScripts(
6891
- _optionalChain([this, 'access', _286 => _286.rendererRuntime, 'access', _287 => _287.generateHydrationScript, 'optionalCall', _288 => _288()]) || ""
7408
+ _optionalChain([this, 'access', _302 => _302.rendererRuntime, 'access', _303 => _303.generateHydrationScript, 'optionalCall', _304 => _304()]) || ""
6892
7409
  );
6893
7410
  const viteClientScript = farmScripts(`<script type="module" src="/@vite/client"></script>`);
6894
7411
  const farmClientScript = farmScripts(
@@ -6897,8 +7414,8 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
6897
7414
  const { html: content, head: rendererHead } = await this.renderElementToDocumentParts(
6898
7415
  element,
6899
7416
  {
6900
- rejectLateNavigation: _chunkD7UQC4O6cjs._isFarmMarkdownPageCheck.call(void 0,
6901
- _optionalChain([req, 'access', _289 => _289.headers, 'optionalAccess', _290 => _290[_chunkD7UQC4O6cjs.FARM_MARKDOWN_PAGE_CHECK_HEADER]])
7417
+ rejectLateNavigation: _chunkLT4VAF5Zcjs._isFarmMarkdownPageCheck.call(void 0,
7418
+ _optionalChain([req, 'access', _305 => _305.headers, 'optionalAccess', _306 => _306[_chunkLT4VAF5Zcjs.FARM_MARKDOWN_PAGE_CHECK_HEADER]])
6902
7419
  )
6903
7420
  }
6904
7421
  );
@@ -6910,7 +7427,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
6910
7427
  viewport: viewportTags
6911
7428
  } = _chunk6IOZPJ3Icjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
6912
7429
  pathname: getFarmMetadataPathname(req),
6913
- jsonLd: _optionalChain([this, 'access', _291 => _291.config, 'access', _292 => _292.agent, 'optionalAccess', _293 => _293.jsonLd])
7430
+ jsonLd: _optionalChain([this, 'access', _307 => _307.config, 'access', _308 => _308.agent, 'optionalAccess', _309 => _309.jsonLd])
6914
7431
  });
6915
7432
  const documentTitleTag = !hasExplicitTitle && /<title[\s>]/i.test(rendererHead) ? "" : `<title>${title}</title>`;
6916
7433
  const rendererHasTitle = /<title[\s>]/i.test(rendererHead);
@@ -6920,19 +7437,19 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
6920
7437
  i18nSnapshot,
6921
7438
  this.getI18nAlternateOptions(req, req.__FARM_METADATA__)
6922
7439
  ) : "";
6923
- const themeDocument = _chunkTSFMFPRUcjs.createFarmThemeDocumentParts.call(void 0,
7440
+ const themeDocument = _chunkO27PLNQZcjs.createFarmThemeDocumentParts.call(void 0,
6924
7441
  this.config.theme,
6925
7442
  this.config.basePath,
6926
7443
  _chunk4ZJ5C7UJcjs.getTheme.call(void 0, )
6927
7444
  );
6928
7445
  themeDocument.head = farmScripts(themeDocument.head);
6929
- const fullDocument = _chunkTSFMFPRUcjs.extractFarmFullDocument.call(void 0, content);
7446
+ const fullDocument = _chunkO27PLNQZcjs.extractFarmFullDocument.call(void 0, content);
6930
7447
  let html;
6931
7448
  if (fullDocument) {
6932
7449
  const shouldReplaceLayoutTitle = hasExplicitTitle || rendererHasTitle;
6933
- const documentHtml = shouldReplaceLayoutTitle ? _chunkTSFMFPRUcjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument;
6934
- const effectiveRendererHead = hasExplicitTitle ? _chunkTSFMFPRUcjs.removeFarmDocumentTitles.call(void 0, rendererHead) : rendererHead;
6935
- html = _chunkTSFMFPRUcjs.composeFarmFullDocument.call(void 0, documentHtml, {
7450
+ const documentHtml = shouldReplaceLayoutTitle ? _chunkO27PLNQZcjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument;
7451
+ const effectiveRendererHead = hasExplicitTitle ? _chunkO27PLNQZcjs.removeFarmDocumentTitles.call(void 0, rendererHead) : rendererHead;
7452
+ html = _chunkO27PLNQZcjs.composeFarmFullDocument.call(void 0, documentHtml, {
6936
7453
  fallbackIcon: !hasFavicon,
6937
7454
  viewport: viewportTags,
6938
7455
  htmlAttributes: `${i18nSnapshot ? ` lang="${escapeHtmlAttribute2(i18nSnapshot.locale)}" dir="${escapeHtmlAttribute2(i18nSnapshot.direction)}"` : ""}${themeDocument.attributes}`,
@@ -6958,7 +7475,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
6958
7475
  });
6959
7476
  } else {
6960
7477
  html = `<!DOCTYPE html>
6961
- <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _294 => _294.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
7478
+ <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _310 => _310.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
6962
7479
  <head>
6963
7480
  ${themeDocument.head}
6964
7481
  <meta charset="utf-8">
@@ -6989,7 +7506,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
6989
7506
  const securedHtml = this.secureDocumentHTML(req, html);
6990
7507
  if ((req.method || "GET").toUpperCase() !== "HEAD") res.write(securedHtml);
6991
7508
  res.end();
6992
- if (!options.captureStaticShell) await _optionalChain([options, 'access', _295 => _295.onComplete, 'optionalCall', _296 => _296(securedHtml)]);
7509
+ if (!options.captureStaticShell) await _optionalChain([options, 'access', _311 => _311.onComplete, 'optionalCall', _312 => _312(securedHtml)]);
6993
7510
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
6994
7511
  type: "render.stream.complete",
6995
7512
  route,
@@ -6999,7 +7516,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
6999
7516
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, { type: "render.error", route, error });
7000
7517
  throw error;
7001
7518
  } finally {
7002
- _optionalChain([clearMiddlewareData, 'optionalCall', _297 => _297()]);
7519
+ _optionalChain([clearMiddlewareData, 'optionalCall', _313 => _313()]);
7003
7520
  }
7004
7521
  }
7005
7522
  /**
@@ -7014,7 +7531,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7014
7531
  if (!rootLayout) return false;
7015
7532
  try {
7016
7533
  const Layout = (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).default;
7017
- if (typeof Layout !== "function" || _optionalChain([Layout, 'access', _298 => _298.prototype, 'optionalAccess', _299 => _299.isReactComponent]) || _optionalChain([Layout, 'access', _300 => _300.constructor, 'optionalAccess', _301 => _301.name]) === "AsyncFunction") {
7534
+ if (typeof Layout !== "function" || _optionalChain([Layout, 'access', _314 => _314.prototype, 'optionalAccess', _315 => _315.isReactComponent]) || _optionalChain([Layout, 'access', _316 => _316.constructor, 'optionalAccess', _317 => _317.name]) === "AsyncFunction") {
7018
7535
  return false;
7019
7536
  }
7020
7537
  const cached = documentLayouts.get(Layout);
@@ -7026,12 +7543,12 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7026
7543
  params: {}
7027
7544
  });
7028
7545
  rendersDocument = this.rendererRuntime.isValidElement(rendered) && rendered.type === "html";
7029
- } catch (e21) {
7546
+ } catch (e24) {
7030
7547
  rendersDocument = false;
7031
7548
  }
7032
7549
  documentLayouts.set(Layout, rendersDocument);
7033
7550
  return rendersDocument;
7034
- } catch (e22) {
7551
+ } catch (e25) {
7035
7552
  return false;
7036
7553
  }
7037
7554
  }
@@ -7039,7 +7556,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7039
7556
  const renderToPipeableStream = this.rendererRuntime.renderToPipeableStream;
7040
7557
  const fullDocumentRouteKey = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
7041
7558
  const streamDocument = fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument();
7042
- if (!renderToPipeableStream || _chunkD7UQC4O6cjs._isFarmMarkdownPageCheck.call(void 0, _optionalChain([req, 'access', _302 => _302.headers, 'optionalAccess', _303 => _303[_chunkD7UQC4O6cjs.FARM_MARKDOWN_PAGE_CHECK_HEADER]])) || streamDocument && (options.captureStaticShell || !_chunkRD623KW4cjs.isReactRenderer.call(void 0, this.config.renderer))) {
7559
+ if (!renderToPipeableStream || _chunkLT4VAF5Zcjs._isFarmMarkdownPageCheck.call(void 0, _optionalChain([req, 'access', _318 => _318.headers, 'optionalAccess', _319 => _319[_chunkLT4VAF5Zcjs.FARM_MARKDOWN_PAGE_CHECK_HEADER]])) || streamDocument && (options.captureStaticShell || !_chunkRD623KW4cjs.isReactRenderer.call(void 0, this.config.renderer))) {
7043
7560
  return this.renderBufferedSSR(element, req, res, clearMiddlewareData, options);
7044
7561
  }
7045
7562
  return new Promise((resolve3, reject) => {
@@ -7051,6 +7568,18 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7051
7568
  for (const [key, value] of Object.entries(options.responseHeaders || {})) {
7052
7569
  res.setHeader(key, value);
7053
7570
  }
7571
+ const islandsMode = Boolean(islands && this.islandValues());
7572
+ const flushToken = islandsMode && requestHeader(req, "f-stream") === "flush" ? createFarmFlushToken() : "";
7573
+ const flushMarker = flushToken ? Buffer.from(farmFlushMarker(flushToken)) : void 0;
7574
+ if (islandsMode) {
7575
+ for (const name of ["F-Values", "F-Layouts", "F-Render", "F-Stream"]) {
7576
+ appendResponseVary(res, name);
7577
+ }
7578
+ if (requestHeader(req, "f-layouts") || flushToken) {
7579
+ res.setHeader("Cache-Control", "private, no-store");
7580
+ }
7581
+ if (flushToken) res.setHeader("F-Flush", flushToken);
7582
+ }
7054
7583
  const htmlParts = [];
7055
7584
  const findStaticShellBoundary = this.rendererRuntime.findStaticShellBoundary;
7056
7585
  const staticShellParts = options.captureStaticShell && findStaticShellBoundary ? [] : void 0;
@@ -7062,7 +7591,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7062
7591
  let lateNavigationError = null;
7063
7592
  const pagePath = req.__FARM_PAGE_PATH__;
7064
7593
  const isClientComponent = req.__FARM_IS_CLIENT_COMPONENT__ === true;
7065
- const relativePath = pagePath ? _chunkVQJYGZNXcjs.toViteModuleId.call(void 0, pagePath, this.config.root) : "/src/app/page.tsx";
7594
+ const relativePath = pagePath ? _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, pagePath, this.config.root) : "/src/app/page.tsx";
7066
7595
  const manifest = _nullishCoalesce(options.routeManifest, () => ( this.routeManager.generateClientManifest(this.config.root)));
7067
7596
  const clientManifest = {
7068
7597
  clientEntry: "/@farm/client.js",
@@ -7113,7 +7642,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7113
7642
  const routeSlotPayload = (req.__FARM_ROUTE_SLOTS__ || []).map(
7114
7643
  (slot) => ({
7115
7644
  ...slot,
7116
- modulePath: typeof slot.modulePath === "string" ? _chunkVQJYGZNXcjs.toViteModuleId.call(void 0, slot.modulePath, this.config.root) : slot.modulePath
7645
+ modulePath: typeof slot.modulePath === "string" ? _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, slot.modulePath, this.config.root) : slot.modulePath
7117
7646
  })
7118
7647
  );
7119
7648
  const deferredProps = _chunkXQSYOVCWcjs.prepareDeferredData.call(void 0, {
@@ -7143,10 +7672,14 @@ window.__FARM_LOADING_MODULE__ = ${JSON.stringify(
7143
7672
  req.__FARM_LOADING_MODULE_PATH__ || null
7144
7673
  )};
7145
7674
  window.__FARM_MANIFEST__ = ${JSON.stringify(clientManifest)};
7146
- window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkCECUDGXQcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
7675
+ window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkZP32GNJQcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
7147
7676
  window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, ) ? serializeInlineValue(_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, )) : "null"};
7148
7677
  </script>`;
7149
- const hydrationClickQueueScript = isClientComponent || req.__FARM_SHOULD_HYDRATE__ === true || req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ === true ? createPreHydrationClickQueueScript() : "";
7678
+ const islandsOnlyPage = this.islandValues() && req.__FARM_PAGE_SHOULD_HYDRATE__ !== true && req.__FARM_LAYOUT_SHOULD_HYDRATE__ !== true && req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ !== true;
7679
+ const rootStrategy = req.__FARM_ISLAND_STRATEGY__;
7680
+ const waitingRoot = this.islandValues() && !islandsOnlyPage && req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ !== true && rootStrategy !== void 0 && rootStrategy !== "load" ? req.__FARM_LAYOUT_SHOULD_HYDRATE__ === true ? "root" : "__farm_page__" : null;
7681
+ const bootClient = (islandsOnlyPage || waitingRoot !== null) && !staticShellParts && canBootFarmIslandsClient(this.config);
7682
+ const hydrationClickQueueScript = !islandsOnlyPage && !bootClient && (isClientComponent || req.__FARM_SHOULD_HYDRATE__ === true || req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ === true) ? createPreHydrationClickQueueScript() : "";
7150
7683
  const {
7151
7684
  title,
7152
7685
  tags: metaTags,
@@ -7155,7 +7688,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7155
7688
  viewport: viewportTags
7156
7689
  } = _chunk6IOZPJ3Icjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
7157
7690
  pathname: getFarmMetadataPathname(req),
7158
- jsonLd: _optionalChain([this, 'access', _304 => _304.config, 'access', _305 => _305.agent, 'optionalAccess', _306 => _306.jsonLd])
7691
+ jsonLd: _optionalChain([this, 'access', _320 => _320.config, 'access', _321 => _321.agent, 'optionalAccess', _322 => _322.jsonLd])
7159
7692
  });
7160
7693
  const i18nSnapshot = _chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, );
7161
7694
  const i18nAlternateTags = i18nSnapshot ? renderI18nAlternateLinks(
@@ -7164,7 +7697,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7164
7697
  this.getI18nAlternateOptions(req, req.__FARM_METADATA__)
7165
7698
  ) : "";
7166
7699
  const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
7167
- const themeDocument = _chunkTSFMFPRUcjs.createFarmThemeDocumentParts.call(void 0,
7700
+ const themeDocument = _chunkO27PLNQZcjs.createFarmThemeDocumentParts.call(void 0,
7168
7701
  this.config.theme,
7169
7702
  this.config.basePath,
7170
7703
  _chunk4ZJ5C7UJcjs.getTheme.call(void 0, )
@@ -7177,11 +7710,12 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7177
7710
  const filterDocumentHTML = (html) => cspNonce ? _chunk6JHZPB52cjs.filterFarmCspNonces.call(void 0, html, cspNonce) : html;
7178
7711
  const createLateNavigationRecovery = (navigationError) => this.createLateNavigationRecoveryHTML(req, navigationError);
7179
7712
  const earlyClient = this.islandValues();
7713
+ const earlyClientScript = bootClient ? createFarmDevBootScript(waitingRoot, rootStrategy) : FARM_DEV_EARLY_CLIENT_SCRIPT;
7180
7714
  const { pipe, abort } = renderToPipeableStream(streamRoot, {
7181
7715
  nonce: cspNonce,
7182
7716
  onShellReady() {
7183
7717
  if (pendingNavigationError) {
7184
- _optionalChain([abort, 'optionalCall', _307 => _307(pendingNavigationError)]);
7718
+ _optionalChain([abort, 'optionalCall', _323 => _323(pendingNavigationError)]);
7185
7719
  if (clearMiddlewareData) {
7186
7720
  clearMiddlewareData();
7187
7721
  }
@@ -7199,7 +7733,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7199
7733
  console.log(`[FARM STREAM] onShellReady at ${shellReadyMs}ms`);
7200
7734
  }
7201
7735
  const shell = `<!DOCTYPE html>
7202
- <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _308 => _308.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
7736
+ <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _324 => _324.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
7203
7737
  <head>
7204
7738
  ${themeDocument.head}
7205
7739
  <meta charset="utf-8">
@@ -7215,25 +7749,25 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7215
7749
  ${hydrationClickQueueScript}
7216
7750
  </head>
7217
7751
  <body class="">${earlyClient ? `
7218
- ${FARM_DEV_EARLY_CLIENT_SCRIPT}` : ""}
7752
+ ${earlyClientScript}` : ""}
7219
7753
  <div id="root">`;
7220
7754
  const securedShell = streamDocument ? "" : stampDocumentHTML(shell);
7221
7755
  if (securedShell) {
7222
7756
  htmlParts.push(securedShell);
7223
- _optionalChain([staticShellParts, 'optionalAccess', _309 => _309.push, 'call', _310 => _310(securedShell)]);
7757
+ _optionalChain([staticShellParts, 'optionalAccess', _325 => _325.push, 'call', _326 => _326(securedShell)]);
7224
7758
  }
7225
7759
  const withEarlyClient = (document) => earlyClient ? {
7226
7760
  ...document,
7227
7761
  html: document.html.replace(
7228
7762
  /<body\b[^>]*>/i,
7229
7763
  (open) => `${open}
7230
- ${stampDocumentHTML(FARM_DEV_EARLY_CLIENT_SCRIPT)}`
7764
+ ${stampDocumentHTML(earlyClientScript)}`
7231
7765
  )
7232
7766
  } : document;
7233
- const documentTransform = streamDocument ? _chunkTSFMFPRUcjs.createFarmStreamedDocumentTransform.call(void 0,
7767
+ const documentTransform = streamDocument ? _chunkO27PLNQZcjs.createFarmStreamedDocumentTransform.call(void 0,
7234
7768
  (opening) => withEarlyClient(
7235
- _chunkTSFMFPRUcjs.openFarmStreamedDocument.call(void 0,
7236
- hasExplicitTitle ? _chunkTSFMFPRUcjs.removeFarmDocumentTitles.call(void 0, opening) : opening,
7769
+ _chunkO27PLNQZcjs.openFarmStreamedDocument.call(void 0,
7770
+ hasExplicitTitle ? _chunkO27PLNQZcjs.removeFarmDocumentTitles.call(void 0, opening) : opening,
7237
7771
  {
7238
7772
  fallbackIcon: !hasFavicon,
7239
7773
  viewport: viewportTags,
@@ -7272,7 +7806,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7272
7806
  const recordRenderedChunk = (chunkText, renderedText = chunkText) => {
7273
7807
  if (!checkedFullDocument && renderedText) {
7274
7808
  documentPrefix += renderedText;
7275
- const prefix = _chunkTSFMFPRUcjs.classifyFarmDocumentPrefix.call(void 0, documentPrefix);
7809
+ const prefix = _chunkO27PLNQZcjs.classifyFarmDocumentPrefix.call(void 0, documentPrefix);
7276
7810
  if (prefix !== "pending") {
7277
7811
  checkedFullDocument = true;
7278
7812
  documentPrefix = "";
@@ -7291,7 +7825,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7291
7825
  staticShellClosed = true;
7292
7826
  if (!suspenseHoleEmitted) {
7293
7827
  suspenseHoleEmitted = true;
7294
- _optionalChain([options, 'access', _311 => _311.onSuspenseHoleDetected, 'optionalCall', _312 => _312()]);
7828
+ _optionalChain([options, 'access', _327 => _327.onSuspenseHoleDetected, 'optionalCall', _328 => _328()]);
7295
7829
  }
7296
7830
  } else {
7297
7831
  staticShellParts.push(chunkText);
@@ -7300,6 +7834,14 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7300
7834
  };
7301
7835
  const writableStream = new (0, _stream.Writable)({
7302
7836
  write(chunk, encoding, callback) {
7837
+ if (flushMarker && chunk === flushMarker) {
7838
+ const marker = documentTransform ? documentTransform.write(flushMarker.toString()) : flushMarker;
7839
+ res.write(marker, () => {
7840
+ if (typeof res.flush === "function") res.flush();
7841
+ callback();
7842
+ });
7843
+ return;
7844
+ }
7303
7845
  if (firstChunk && process.env.FARM_VERBOSE) {
7304
7846
  console.log(`[FARM STREAM] first pipe chunk at ${Date.now() - streamStartTime}ms`);
7305
7847
  firstChunk = false;
@@ -7331,7 +7873,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7331
7873
  finishStream(callback);
7332
7874
  },
7333
7875
  (error) => {
7334
- _chunkVQJYGZNXcjs.logger.error(`Could not recover from a late navigation error: ${error}`);
7876
+ _chunkQMNWKQL4cjs.logger.error(`Could not recover from a late navigation error: ${error}`);
7335
7877
  finishStream(callback);
7336
7878
  }
7337
7879
  );
@@ -7347,8 +7889,8 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7347
7889
  recordRenderedChunk(tail, rewritten);
7348
7890
  if (tail) res.write(tail);
7349
7891
  }
7350
- const documentEnd = _optionalChain([documentTransform, 'optionalAccess', _313 => _313.end, 'call', _314 => _314()]);
7351
- if (_optionalChain([documentEnd, 'optionalAccess', _315 => _315.text])) {
7892
+ const documentEnd = _optionalChain([documentTransform, 'optionalAccess', _329 => _329.end, 'call', _330 => _330()]);
7893
+ if (_optionalChain([documentEnd, 'optionalAccess', _331 => _331.text])) {
7352
7894
  recordRenderedChunk(documentEnd.text, "");
7353
7895
  res.write(documentEnd.text);
7354
7896
  }
@@ -7359,7 +7901,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7359
7901
  deferredHydrationScript: createDeferredHydrationScript(deferredProps.records),
7360
7902
  earlyClient,
7361
7903
  // A full document: Farm's #root closes only where Farm opened it.
7362
- ..._optionalChain([documentEnd, 'optionalAccess', _316 => _316.document]) ? { closeRoot: documentEnd.rootOpened } : {}
7904
+ ..._optionalChain([documentEnd, 'optionalAccess', _332 => _332.document]) ? { closeRoot: documentEnd.rootOpened } : {}
7363
7905
  })
7364
7906
  );
7365
7907
  htmlParts.push(footer);
@@ -7381,7 +7923,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7381
7923
  }
7382
7924
  const cachedHtml = staticShellParts ? staticShellParts.join("") : htmlParts.join("");
7383
7925
  Promise.resolve(options.onComplete(cachedHtml)).catch((error) => {
7384
- _chunkVQJYGZNXcjs.logger.warn(`Failed to cache PPR shell: ${error}`);
7926
+ _chunkQMNWKQL4cjs.logger.warn(`Failed to cache PPR shell: ${error}`);
7385
7927
  });
7386
7928
  }
7387
7929
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
@@ -7395,12 +7937,13 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7395
7937
  if (typeof res.flush === "function") {
7396
7938
  res.flush();
7397
7939
  }
7940
+ if (flushMarker) writableStream.flush = () => writableStream.write(flushMarker);
7398
7941
  pipe(writableStream);
7399
7942
  },
7400
7943
  onShellError(error) {
7401
7944
  didError = true;
7402
7945
  if (!isWebResponse(error) && !_chunk7JUIK547cjs.isFarmRedirectError.call(void 0, error) && !_chunk7JUIK547cjs.isFarmNotFoundError.call(void 0, error)) {
7403
- _chunkVQJYGZNXcjs.logger.error(`SSR shell error: ${error}`);
7946
+ _chunkQMNWKQL4cjs.logger.error(`SSR shell error: ${error}`);
7404
7947
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
7405
7948
  type: "render.error",
7406
7949
  route: observabilityRoute,
@@ -7420,7 +7963,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7420
7963
  return;
7421
7964
  }
7422
7965
  if (!isWebResponse(error)) {
7423
- _chunkVQJYGZNXcjs.logger.error(`SSR streaming error: ${error}`);
7966
+ _chunkQMNWKQL4cjs.logger.error(`SSR streaming error: ${error}`);
7424
7967
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
7425
7968
  type: "render.error",
7426
7969
  route: observabilityRoute,
@@ -7463,7 +8006,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7463
8006
  return await this.routeManager.loadRouteModule(notFoundPath);
7464
8007
  }
7465
8008
  async loadNotFoundComponent() {
7466
- return await _asyncNullishCoalesce(await _asyncOptionalChain([(await this.loadNotFoundModule()), 'optionalAccess', async _317 => _317.default]), async () => ( null));
8009
+ return await _asyncNullishCoalesce(await _asyncOptionalChain([(await this.loadNotFoundModule()), 'optionalAccess', async _333 => _333.default]), async () => ( null));
7467
8010
  }
7468
8011
  /** The not-found document's head: layout and not-found metadata, as production renders it. */
7469
8012
  async notFoundMetadataHead(layoutModule, notFoundModule) {
@@ -7486,13 +8029,13 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7486
8029
  */
7487
8030
  async createLateNavigationRecoveryHTML(req, error) {
7488
8031
  if (_chunk7JUIK547cjs.isFarmRedirectError.call(void 0, error)) {
7489
- return _chunkTSFMFPRUcjs.createLateRedirectRecovery.call(void 0,
8032
+ return _chunkO27PLNQZcjs.createLateRedirectRecovery.call(void 0,
7490
8033
  this.localizeRedirectUrl(_chunk7JUIK547cjs.getFarmRedirectError.call(void 0, error).url),
7491
8034
  this.getCspNonce(req) || ""
7492
8035
  );
7493
8036
  }
7494
8037
  const pathname = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, {
7495
- trustProxy: _optionalChain([this, 'access', _318 => _318.config, 'access', _319 => _319.server, 'optionalAccess', _320 => _320.trustProxy])
8038
+ trustProxy: _optionalChain([this, 'access', _334 => _334.config, 'access', _335 => _335.server, 'optionalAccess', _336 => _336.trustProxy])
7496
8039
  }).pathname;
7497
8040
  let content = this.defaultNotFoundContent();
7498
8041
  const NotFoundComponent = await this.loadNotFoundComponent();
@@ -7505,32 +8048,32 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7505
8048
  rendererRenderOptions()
7506
8049
  );
7507
8050
  } catch (error2) {
7508
- _chunkVQJYGZNXcjs.logger.warn(`not-found page could not render outside its layout, using Farm's: ${error2}`);
8051
+ _chunkQMNWKQL4cjs.logger.warn(`not-found page could not render outside its layout, using Farm's: ${error2}`);
7509
8052
  }
7510
8053
  }
7511
- return _chunkTSFMFPRUcjs.createLateNotFoundRecovery.call(void 0, content, this.getCspNonce(req) || "");
8054
+ return _chunkO27PLNQZcjs.createLateNotFoundRecovery.call(void 0, content, this.getCspNonce(req) || "");
7512
8055
  }
7513
8056
  async render404(req, res) {
7514
8057
  res.statusCode = 404;
7515
8058
  const pathname = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, {
7516
- trustProxy: _optionalChain([this, 'access', _321 => _321.config, 'access', _322 => _322.server, 'optionalAccess', _323 => _323.trustProxy])
8059
+ trustProxy: _optionalChain([this, 'access', _337 => _337.config, 'access', _338 => _338.server, 'optionalAccess', _339 => _339.trustProxy])
7517
8060
  }).pathname;
7518
8061
  const acceptHeader = req.headers.accept;
7519
8062
  const accept = Array.isArray(acceptHeader) ? acceptHeader.join(",") : acceptHeader;
7520
- if (_chunkD7UQC4O6cjs.farmRequestWantsMarkdown.call(void 0, pathname, accept)) {
7521
- res.setHeader("Content-Type", _chunkD7UQC4O6cjs.FARM_MARKDOWN_CONTENT_TYPE);
8063
+ if (_chunkLT4VAF5Zcjs.farmRequestWantsMarkdown.call(void 0, pathname, accept)) {
8064
+ res.setHeader("Content-Type", _chunkLT4VAF5Zcjs.FARM_MARKDOWN_CONTENT_TYPE);
7522
8065
  res.setHeader("X-Farm-Markdown-Error", "404");
7523
8066
  res.setHeader("Cache-Control", "no-store");
7524
- res.end(_chunkD7UQC4O6cjs.createFarmMarkdownErrorBody.call(void 0, 404, pathname, this.config.basePath || "/"));
8067
+ res.end(_chunkLT4VAF5Zcjs.createFarmMarkdownErrorBody.call(void 0, 404, pathname, this.config.basePath || "/"));
7525
8068
  return;
7526
8069
  }
7527
- const appDir = path10.join(this.config.root, this.config.srcDir, "app");
8070
+ const appDir = path12.join(this.config.root, this.config.srcDir, "app");
7528
8071
  const notFoundExtensions = _chunkRD623KW4cjs.getFarmRendererComponentExtensions.call(void 0, this.config.renderer);
7529
8072
  let layoutModule = null;
7530
8073
  try {
7531
8074
  for (const ext of notFoundExtensions) {
7532
- const layoutPath = path10.join(appDir, `layout${ext}`);
7533
- if (fs6.existsSync(layoutPath)) {
8075
+ const layoutPath = path12.join(appDir, `layout${ext}`);
8076
+ if (fs8.existsSync(layoutPath)) {
7534
8077
  layoutModule = await this.routeManager.loadLayoutModule(layoutPath);
7535
8078
  break;
7536
8079
  }
@@ -7541,9 +8084,9 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7541
8084
  );
7542
8085
  if (notFoundPath) {
7543
8086
  const notFoundModule = await this.loadNotFoundModule();
7544
- const NotFoundComponent = _nullishCoalesce(_optionalChain([notFoundModule, 'optionalAccess', _324 => _324.default]), () => ( null));
8087
+ const NotFoundComponent = _nullishCoalesce(_optionalChain([notFoundModule, 'optionalAccess', _340 => _340.default]), () => ( null));
7545
8088
  if (NotFoundComponent) {
7546
- const LayoutComponent = _nullishCoalesce(_optionalChain([layoutModule, 'optionalAccess', _325 => _325.default]), () => ( null));
8089
+ const LayoutComponent = _nullishCoalesce(_optionalChain([layoutModule, 'optionalAccess', _341 => _341.default]), () => ( null));
7547
8090
  let element = this.rendererRuntime.createElement(NotFoundComponent, { pathname });
7548
8091
  if (LayoutComponent) {
7549
8092
  element = this.rendererRuntime.createElement(LayoutComponent, {
@@ -7583,23 +8126,23 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7583
8126
  res.statusCode = statusCode;
7584
8127
  const isDev = process.env.NODE_ENV === "development";
7585
8128
  const requestUrl = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, {
7586
- trustProxy: _optionalChain([this, 'access', _326 => _326.config, 'access', _327 => _327.server, 'optionalAccess', _328 => _328.trustProxy])
8129
+ trustProxy: _optionalChain([this, 'access', _342 => _342.config, 'access', _343 => _343.server, 'optionalAccess', _344 => _344.trustProxy])
7587
8130
  });
7588
8131
  const diagnostics = isDev ? createDefaultErrorDiagnostics(error, this.config.root || process.cwd()) : void 0;
7589
- const statusText = _chunkTSFMFPRUcjs.getDefaultErrorStatusText.call(void 0, statusCode);
8132
+ const statusText = _chunkO27PLNQZcjs.getDefaultErrorStatusText.call(void 0, statusCode);
7590
8133
  const content = this.stampFarmScripts(
7591
8134
  req,
7592
- _chunkTSFMFPRUcjs.createDefaultErrorMarkup.call(void 0, {
8135
+ _chunkO27PLNQZcjs.createDefaultErrorMarkup.call(void 0, {
7593
8136
  statusCode,
7594
8137
  statusText,
7595
8138
  requestPath: requestUrl.pathname,
7596
8139
  method: req.method || "GET",
7597
- message: _optionalChain([diagnostics, 'optionalAccess', _329 => _329.message]),
7598
- errorName: _optionalChain([diagnostics, 'optionalAccess', _330 => _330.name]),
7599
- stack: _optionalChain([diagnostics, 'optionalAccess', _331 => _331.stack]),
7600
- sourceFrame: _optionalChain([diagnostics, 'optionalAccess', _332 => _332.sourceFrame]),
8140
+ message: _optionalChain([diagnostics, 'optionalAccess', _345 => _345.message]),
8141
+ errorName: _optionalChain([diagnostics, 'optionalAccess', _346 => _346.name]),
8142
+ stack: _optionalChain([diagnostics, 'optionalAccess', _347 => _347.stack]),
8143
+ sourceFrame: _optionalChain([diagnostics, 'optionalAccess', _348 => _348.sourceFrame]),
7601
8144
  development: isDev,
7602
- farmVersion: _chunkOAMUSC7Hcjs.FARM_VERSION,
8145
+ farmVersion: _chunk2FRLSDBTcjs.FARM_VERSION,
7603
8146
  nodeVersion: process.version,
7604
8147
  mode: isDev ? "development" : "production"
7605
8148
  })
@@ -7625,8 +8168,8 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7625
8168
  */
7626
8169
  getI18nAlternateOptions(req, metadata) {
7627
8170
  return {
7628
- metadataBase: _optionalChain([metadata, 'optionalAccess', _333 => _333.metadataBase]),
7629
- origin: req ? _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _334 => _334.config, 'access', _335 => _335.server, 'optionalAccess', _336 => _336.trustProxy]) }).origin : void 0
8171
+ metadataBase: _optionalChain([metadata, 'optionalAccess', _349 => _349.metadataBase]),
8172
+ origin: req ? _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _350 => _350.config, 'access', _351 => _351.server, 'optionalAccess', _352 => _352.trustProxy]) }).origin : void 0
7630
8173
  };
7631
8174
  }
7632
8175
  createFullHTML(content, isClientComponent = false, requestPath = "/", metadataHead, alternates = {}) {
@@ -7636,7 +8179,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7636
8179
  const viteClientScript = farmScripts(`<script type="module" src="/@vite/client"></script>`);
7637
8180
  const integrationManifestScript = farmScripts(`<script>
7638
8181
  window.__FARM_DEPLOYMENT_ID__ = ${serializeInlineValue(this.getDeploymentId())};
7639
- window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkCECUDGXQcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
8182
+ window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkZP32GNJQcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
7640
8183
  ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};` : ""}
7641
8184
  </script>`);
7642
8185
  const alternateLinks = i18nSnapshot ? renderI18nAlternateLinks(
@@ -7645,20 +8188,20 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
7645
8188
  this.getI18nAlternateOptions(alternates.req, alternates.metadata)
7646
8189
  ) : "";
7647
8190
  const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
7648
- const themeDocument = _chunkTSFMFPRUcjs.createFarmThemeDocumentParts.call(void 0,
8191
+ const themeDocument = _chunkO27PLNQZcjs.createFarmThemeDocumentParts.call(void 0,
7649
8192
  this.config.theme,
7650
8193
  this.config.basePath,
7651
8194
  _chunk4ZJ5C7UJcjs.getTheme.call(void 0, )
7652
8195
  );
7653
8196
  themeDocument.head = farmScripts(themeDocument.head);
7654
8197
  const rendererHydrationScript = farmScripts(
7655
- _optionalChain([this, 'access', _337 => _337.rendererRuntime, 'access', _338 => _338.generateHydrationScript, 'optionalCall', _339 => _339()]) || ""
8198
+ _optionalChain([this, 'access', _353 => _353.rendererRuntime, 'access', _354 => _354.generateHydrationScript, 'optionalCall', _355 => _355()]) || ""
7656
8199
  );
7657
- const viewportTags = _chunk6IOZPJ3Icjs.renderViewportHead.call(void 0, _optionalChain([alternates, 'access', _340 => _340.metadata, 'optionalAccess', _341 => _341.viewport]));
7658
- const fullDocument = _chunkTSFMFPRUcjs.extractFarmFullDocument.call(void 0, content);
8200
+ const viewportTags = _chunk6IOZPJ3Icjs.renderViewportHead.call(void 0, _optionalChain([alternates, 'access', _356 => _356.metadata, 'optionalAccess', _357 => _357.viewport]));
8201
+ const fullDocument = _chunkO27PLNQZcjs.extractFarmFullDocument.call(void 0, content);
7659
8202
  if (fullDocument) {
7660
- return _chunkTSFMFPRUcjs.composeFarmFullDocument.call(void 0,
7661
- metadataHead ? _chunkTSFMFPRUcjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument,
8203
+ return _chunkO27PLNQZcjs.composeFarmFullDocument.call(void 0,
8204
+ metadataHead ? _chunkO27PLNQZcjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument,
7662
8205
  {
7663
8206
  fallbackIcon: !metadataHead,
7664
8207
  viewport: viewportTags,
@@ -7684,7 +8227,7 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
7684
8227
  );
7685
8228
  }
7686
8229
  return `<!DOCTYPE html>
7687
- <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _342 => _342.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
8230
+ <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _358 => _358.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
7688
8231
  <head>
7689
8232
  ${themeDocument.head}
7690
8233
  <meta charset="utf-8">
@@ -7726,7 +8269,7 @@ ${clientScript}
7726
8269
  res.setHeader(_chunkE552H232cjs.FARM_DEPLOYMENT_ID_HEADER, deploymentId);
7727
8270
  if ((req.method || "GET").toUpperCase() !== "GET") return;
7728
8271
  const forwardedProto = req.headers["x-forwarded-proto"];
7729
- const isSecure = _optionalChain([(Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto), 'optionalAccess', _343 => _343.split, 'call', _344 => _344(","), 'access', _345 => _345[0], 'optionalAccess', _346 => _346.trim, 'call', _347 => _347()]) === "https" || Boolean(_optionalChain([req, 'access', _348 => _348.socket, 'optionalAccess', _349 => _349.encrypted]));
8272
+ const isSecure = _optionalChain([(Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto), 'optionalAccess', _359 => _359.split, 'call', _360 => _360(","), 'access', _361 => _361[0], 'optionalAccess', _362 => _362.trim, 'call', _363 => _363()]) === "https" || Boolean(_optionalChain([req, 'access', _364 => _364.socket, 'optionalAccess', _365 => _365.encrypted]));
7730
8273
  const cookie = _chunkE552H232cjs.createFarmDeploymentCookie.call(void 0, deploymentId, this.config.basePath || "/", isSecure);
7731
8274
  const existing = res.getHeader("Set-Cookie");
7732
8275
  if (Array.isArray(existing)) {
@@ -7770,7 +8313,7 @@ var FarmApp = class {
7770
8313
  }
7771
8314
  async initialize() {
7772
8315
  if (process.env.FARM_VERBOSE) {
7773
- _chunkVQJYGZNXcjs.logger.info("Initializing Farm.js application...");
8316
+ _chunkQMNWKQL4cjs.logger.info("Initializing Farm.js application...");
7774
8317
  }
7775
8318
  await _chunkJMYXO572cjs.initStorage.call(void 0, this.config.storage);
7776
8319
  await _chunkDMAP4RNDcjs.configureFarmCache.call(void 0, this.config.cache);
@@ -7780,7 +8323,7 @@ var FarmApp = class {
7780
8323
  await this.routeManager.discoverRoutes();
7781
8324
  this.routeManager.generateClientManifest(this.config.root);
7782
8325
  if (process.env.FARM_VERBOSE) {
7783
- _chunkVQJYGZNXcjs.logger.success("Farm.js application initialized successfully!");
8326
+ _chunkQMNWKQL4cjs.logger.success("Farm.js application initialized successfully!");
7784
8327
  }
7785
8328
  }
7786
8329
  getRouteManager() {
@@ -7816,8 +8359,8 @@ var FarmApp = class {
7816
8359
  integrations: config.integrations || {},
7817
8360
  plugins: config.plugins || [],
7818
8361
  migrations: config.migrations || { commands: [] },
7819
- cron: _chunkXYL4HSVCcjs.resolveCronConfig.call(void 0, config.cron),
7820
- workflows: _chunkXB24LZWIcjs.resolveWorkflowsConfig.call(void 0, config.workflows),
8362
+ cron: _chunkYI6FKTTNcjs.resolveCronConfig.call(void 0, config.cron),
8363
+ workflows: _chunkQRX4JRBOcjs.resolveWorkflowsConfig.call(void 0, config.workflows),
7821
8364
  api: normalizeFarmAppAPIConfig(config.api),
7822
8365
  middleware: config.middleware || {},
7823
8366
  routeRules: _chunkV56632LAcjs.normalizeRouteRules.call(void 0, config.routeRules),
@@ -7826,7 +8369,7 @@ var FarmApp = class {
7826
8369
  serverActions: _chunkFK25QSVCcjs.resolveServerActionsConfig.call(void 0, config.serverActions),
7827
8370
  security: _chunk6JHZPB52cjs.resolveFarmSecurityConfig.call(void 0, config.security),
7828
8371
  images: _chunkHEPJIKKQcjs.resolveFarmImageConfig.call(void 0, config.images),
7829
- performance: _chunkFFE2EMF7cjs.resolveFarmPerformanceConfig.call(void 0, config.performance),
8372
+ performance: _chunkDZPR2W6Ucjs.resolveFarmPerformanceConfig.call(void 0, config.performance),
7830
8373
  theme: _chunkWT6RAN2Icjs.resolveFarmThemeConfig.call(void 0, config.theme, basePath),
7831
8374
  i18n: isResolvedI18nConfig(config.i18n) ? config.i18n : _chunkLNVGXUL3cjs.resolveFarmI18nConfig.call(void 0, config.i18n, {
7832
8375
  root,
@@ -7838,7 +8381,7 @@ var FarmApp = class {
7838
8381
  serverRuntimeConfig: config.serverRuntimeConfig || {},
7839
8382
  publicRuntimeConfig: config.publicRuntimeConfig || {},
7840
8383
  docs: isResolvedDocsConfig(config.docs) ? config.docs : defaultDocsConfig,
7841
- md: _chunkD7UQC4O6cjs.resolveMarkdownConfig.call(void 0, config.md),
8384
+ md: _chunkLT4VAF5Zcjs.resolveMarkdownConfig.call(void 0, config.md),
7842
8385
  mdx: _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx),
7843
8386
  observability: _nullishCoalesce(config.observability, () => ( false)),
7844
8387
  telemetry: config.telemetry !== false,
@@ -7854,10 +8397,10 @@ var FarmApp = class {
7854
8397
  env: config.env || { server: {}, public: {} },
7855
8398
  suppressLintOnLink: _nullishCoalesce(config.suppressLintOnLink, () => ( false)),
7856
8399
  experimental: {
7857
- serverComponents: _nullishCoalesce(_optionalChain([config, 'access', _350 => _350.experimental, 'optionalAccess', _351 => _351.serverComponents]), () => ( false)),
7858
- serverActions: _nullishCoalesce(_optionalChain([config, 'access', _352 => _352.experimental, 'optionalAccess', _353 => _353.serverActions]), () => ( false)),
7859
- isolatedClientHydration: _nullishCoalesce(_optionalChain([config, 'access', _354 => _354.experimental, 'optionalAccess', _355 => _355.isolatedClientHydration]), () => ( "off")),
7860
- ppr: _nullishCoalesce(_optionalChain([config, 'access', _356 => _356.experimental, 'optionalAccess', _357 => _357.ppr]), () => ( false)),
8400
+ serverComponents: _nullishCoalesce(_optionalChain([config, 'access', _366 => _366.experimental, 'optionalAccess', _367 => _367.serverComponents]), () => ( false)),
8401
+ serverActions: _nullishCoalesce(_optionalChain([config, 'access', _368 => _368.experimental, 'optionalAccess', _369 => _369.serverActions]), () => ( false)),
8402
+ isolatedClientHydration: _nullishCoalesce(_optionalChain([config, 'access', _370 => _370.experimental, 'optionalAccess', _371 => _371.isolatedClientHydration]), () => ( "off")),
8403
+ ppr: _nullishCoalesce(_optionalChain([config, 'access', _372 => _372.experimental, 'optionalAccess', _373 => _373.ppr]), () => ( false)),
7861
8404
  ...config.experimental
7862
8405
  },
7863
8406
  agent: _nullishCoalesce(config.agent, () => ( {})),
@@ -7866,7 +8409,7 @@ var FarmApp = class {
7866
8409
  }
7867
8410
  async verifyAppStructure() {
7868
8411
  const appDirs = _chunk5Y2P454Ocjs.getFarmAppDirectories.call(void 0, this.config);
7869
- const hasAppDirectory = (await Promise.all(appDirs.map((appDir) => _chunkVQJYGZNXcjs.fileExists.call(void 0, appDir)))).some(
8412
+ const hasAppDirectory = (await Promise.all(appDirs.map((appDir) => _chunkQMNWKQL4cjs.fileExists.call(void 0, appDir)))).some(
7870
8413
  Boolean
7871
8414
  );
7872
8415
  if (!hasAppDirectory) {
@@ -7876,7 +8419,7 @@ var FarmApp = class {
7876
8419
  if (routeFiles.length > 0) {
7877
8420
  return;
7878
8421
  }
7879
- const appDir = _chunkVQJYGZNXcjs.resolveAppPath.call(void 0, this.config.root, this.config.srcDir, "app");
8422
+ const appDir = _chunkQMNWKQL4cjs.resolveAppPath.call(void 0, this.config.root, this.config.srcDir, "app");
7880
8423
  throw new Error(
7881
8424
  `App directory not found at ${appDir}. Please create a src/app directory or extend a Farm layer containing routes.`
7882
8425
  );
@@ -7885,11 +8428,11 @@ var FarmApp = class {
7885
8428
  const rootLayoutPaths = appDirs.flatMap(
7886
8429
  (appDir) => componentExtensions.map((extension) => path5.default.join(appDir, `layout${extension}`))
7887
8430
  );
7888
- const hasRootLayout = await Promise.all(rootLayoutPaths.map((p) => _chunkVQJYGZNXcjs.fileExists.call(void 0, p))).then(
8431
+ const hasRootLayout = await Promise.all(rootLayoutPaths.map((p) => _chunkQMNWKQL4cjs.fileExists.call(void 0, p))).then(
7889
8432
  (results) => results.some(Boolean)
7890
8433
  );
7891
8434
  if (!hasRootLayout) {
7892
- _chunkVQJYGZNXcjs.logger.warn(
8435
+ _chunkQMNWKQL4cjs.logger.warn(
7893
8436
  `No root layout found. Consider creating src/app/layout${componentExtensions[0]} for consistent page structure.`
7894
8437
  );
7895
8438
  }
@@ -7904,12 +8447,12 @@ function isResolvedAuthConfig(value) {
7904
8447
  );
7905
8448
  }
7906
8449
  function normalizeFarmAppAPIConfig(config) {
7907
- if (typeof _optionalChain([config, 'optionalAccess', _358 => _358.baseURL]) === "function" || typeof _optionalChain([config, 'optionalAccess', _359 => _359.basePath]) === "function") {
8450
+ if (typeof _optionalChain([config, 'optionalAccess', _374 => _374.baseURL]) === "function" || typeof _optionalChain([config, 'optionalAccess', _375 => _375.basePath]) === "function") {
7908
8451
  throw new Error(
7909
8452
  "Farm API config resolver functions must be processed with resolveConfig() before creating a FarmApp."
7910
8453
  );
7911
8454
  }
7912
- return _chunkIWFV5ZEDcjs.normalizeFarmAPIConfig.call(void 0, config);
8455
+ return _chunkPMJSG4JScjs.normalizeFarmAPIConfig.call(void 0, config);
7913
8456
  }
7914
8457
  function createFarmApp(config, viteServer) {
7915
8458
  return new FarmApp(config, viteServer);
@@ -7919,7 +8462,7 @@ function createFarmApp(config, viteServer) {
7919
8462
  var SHARP_INSTALL_HINT = _chunkKORZ6PREcjs.formatOptionalPeerInstallHint.call(void 0, "sharp", "optimize images");
7920
8463
  var CLOUDFLARE_IMAGE_PRESETS = /* @__PURE__ */ new Set(["cloudflare", "cloudflare-pages", "cloudflare-module"]);
7921
8464
  function resolveFarmImageProviderForRuntime(images, options) {
7922
- const provider = _nullishCoalesce(_optionalChain([images, 'optionalAccess', _360 => _360.provider]), () => ( "auto"));
8465
+ const provider = _nullishCoalesce(_optionalChain([images, 'optionalAccess', _376 => _376.provider]), () => ( "auto"));
7923
8466
  if (provider === "none") return images;
7924
8467
  const usesSharp = options.dev ? true : provider === "node" || provider === "auto" && !CLOUDFLARE_IMAGE_PRESETS.has(options.preset || "");
7925
8468
  if (!usesSharp || _chunkKORZ6PREcjs.isOptionalPeerInstalled.call(void 0, options.root, "sharp")) return images;
@@ -7928,7 +8471,7 @@ function resolveFarmImageProviderForRuntime(images, options) {
7928
8471
  `images.provider "node" optimizes images with sharp, which is not installed. ${SHARP_INSTALL_HINT}`
7929
8472
  );
7930
8473
  }
7931
- _chunkVQJYGZNXcjs.logger.info(
8474
+ _chunkQMNWKQL4cjs.logger.info(
7932
8475
  `Image optimization is off because sharp is not installed; images use their original URLs. ${SHARP_INSTALL_HINT}, or set images.provider to "none".`
7933
8476
  );
7934
8477
  return Object.freeze({ ...images, provider: "none" });
@@ -7954,7 +8497,7 @@ function resolveFarmAppPackages(root) {
7954
8497
  let manifest;
7955
8498
  try {
7956
8499
  manifest = JSON.parse(fs3.default.readFileSync(path5.default.join(root, "package.json"), "utf8"));
7957
- } catch (e23) {
8500
+ } catch (e26) {
7958
8501
  return {};
7959
8502
  }
7960
8503
  const names = new Set(
@@ -7973,7 +8516,7 @@ function resolveFarmAppPackages(root) {
7973
8516
  if (typeof version === "string" && /^[0-9A-Za-z.+-]{1,64}$/.test(version))
7974
8517
  versions[name] = version;
7975
8518
  break;
7976
- } catch (e24) {
8519
+ } catch (e27) {
7977
8520
  const parent = path5.default.dirname(dir);
7978
8521
  if (parent === dir) break;
7979
8522
  dir = parent;
@@ -8004,7 +8547,7 @@ var LANGS = {
8004
8547
  cjs: "jsx",
8005
8548
  jsx: "jsx"
8006
8549
  };
8007
- var parseAst;
8550
+ var parseAst2;
8008
8551
  function staticValue(node) {
8009
8552
  if (!node) return NOT_STATIC;
8010
8553
  switch (node.type) {
@@ -8033,405 +8576,139 @@ function staticValue(node) {
8033
8576
  const key = property2.key.type === "Identifier" ? property2.key.name : staticValue(property2.key);
8034
8577
  if (typeof key !== "string" || key === "__proto__") return NOT_STATIC;
8035
8578
  const value = staticValue(property2.value);
8036
- if (value === NOT_STATIC) return NOT_STATIC;
8037
- object[key] = value;
8038
- }
8039
- return object;
8040
- }
8041
- case "TSAsExpression":
8042
- case "TSSatisfiesExpression":
8043
- case "TSNonNullExpression":
8044
- case "ParenthesizedExpression":
8045
- return staticValue(node.expression);
8046
- default:
8047
- return NOT_STATIC;
8048
- }
8049
- }
8050
- function property(object, name) {
8051
- return _optionalChain([object, 'access', _361 => _361.properties, 'access', _362 => _362.find, 'call', _363 => _363(
8052
- (entry) => entry.type === "Property" && !entry.computed && (entry.key.name === name || entry.key.value === name)
8053
- ), 'optionalAccess', _364 => _364.value]);
8054
- }
8055
- function toolFromObject(object) {
8056
- const name = staticValue(property(object, "name"));
8057
- if (typeof name !== "string" || !/^[A-Za-z0-9_.-]{1,128}$/.test(name)) return null;
8058
- const text = (key) => {
8059
- const value = staticValue(property(object, key));
8060
- return typeof value === "string" && value.length <= 2e3 ? value : void 0;
8061
- };
8062
- const annotations = staticValue(property(object, "annotations"));
8063
- const hints = annotations && typeof annotations === "object" && !Array.isArray(annotations) ? Object.fromEntries(
8064
- HINTS.filter(
8065
- (hint) => typeof annotations[hint] === "boolean"
8066
- ).map((hint) => [hint, annotations[hint]])
8067
- ) : {};
8068
- const schemaNode = property(object, "inputSchema");
8069
- const schema = staticValue(schemaNode);
8070
- const literal = schema !== NOT_STATIC && schema !== null && typeof schema === "object" && !Array.isArray(schema) && Buffer.byteLength(JSON.stringify(schema)) <= MAX_SCHEMA_BYTES;
8071
- const title = text("title");
8072
- const description = text("description");
8073
- return {
8074
- name,
8075
- ...title ? { title } : {},
8076
- ...description ? { description } : {},
8077
- ...hints,
8078
- ...literal ? { inputSchema: schema } : {},
8079
- inputSchemaSource: literal ? "literal" : schemaNode ? "computed" : "none"
8080
- };
8081
- }
8082
- function findFarmWebMCPTools(code, filename = "module.tsx") {
8083
- if (!code.includes(WEBMCP_CLIENT)) return [];
8084
- const lang = _nullishCoalesce(LANGS[path5.default.extname(filename).slice(1)], () => ( "tsx"));
8085
- _nullishCoalesce(parseAst, () => ( (parseAst = _module.createRequire.call(void 0, typeof __filename === "string" ? __filename : _chunkBTZ5O6VMcjs.define_import_meta_default.url)(
8086
- "rolldown/parseAst"
8087
- ).parseAst)));
8088
- let program;
8089
- try {
8090
- program = parseAst(code, { lang });
8091
- } catch (e25) {
8092
- return [];
8093
- }
8094
- const locals = /* @__PURE__ */ new Map();
8095
- for (const statement of program.body) {
8096
- if (statement.type !== "ImportDeclaration" || statement.source.value !== WEBMCP_CLIENT)
8097
- continue;
8098
- for (const specifier of statement.specifiers) {
8099
- const imported = _nullishCoalesce(_optionalChain([specifier, 'access', _365 => _365.imported, 'optionalAccess', _366 => _366.name]), () => ( _optionalChain([specifier, 'access', _367 => _367.imported, 'optionalAccess', _368 => _368.value])));
8100
- if (specifier.type === "ImportSpecifier" && DEFINERS.has(imported))
8101
- locals.set(specifier.local.name, imported);
8102
- }
8103
- }
8104
- if (!locals.size) return [];
8105
- const found = [];
8106
- const visit = (node) => {
8107
- if (!node || typeof node !== "object") return;
8108
- if (Array.isArray(node)) return node.forEach(visit);
8109
- const current = node;
8110
- if (current.type === "CallExpression" && current.callee.type === "Identifier") {
8111
- const definer = locals.get(current.callee.name);
8112
- const [argument] = current.arguments;
8113
- if (definer && argument) {
8114
- const objects = definer === "registerWebMCPTools" ? argument.type === "ArrayExpression" ? argument.elements.filter(
8115
- (element) => _optionalChain([element, 'optionalAccess', _369 => _369.type]) === "ObjectExpression"
8116
- ) : [] : argument.type === "ObjectExpression" ? [argument] : [];
8117
- for (const object of objects) {
8118
- const tool = toolFromObject(object);
8119
- if (tool) found.push({ start: object.start, tool });
8120
- }
8121
- }
8122
- }
8123
- for (const [key, value] of Object.entries(current))
8124
- if (key !== "type" && value && typeof value === "object") visit(value);
8125
- };
8126
- visit(program.body);
8127
- return found.sort((a, b) => a.start - b.start).map(({ tool }) => tool);
8128
- }
8129
- var cache = /* @__PURE__ */ new Map();
8130
- function collectFarmWebMCPTools(root, srcDir = "src") {
8131
- const base = path5.default.resolve(root, srcDir);
8132
- let files;
8133
- try {
8134
- files = _tinyglobby.globSync.call(void 0, "**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}", {
8135
- cwd: base,
8136
- absolute: true,
8137
- expandDirectories: false,
8138
- ignore: ["**/node_modules/**", "**/*.d.ts", "**/*.{test,spec}.*", "**/__tests__/**"]
8139
- });
8140
- } catch (e26) {
8141
- return [];
8142
- }
8143
- const seen = /* @__PURE__ */ new Set();
8144
- const tools = [];
8145
- for (const file of files.sort()) {
8146
- let mtimeMs;
8147
- try {
8148
- mtimeMs = fs3.default.statSync(file).mtimeMs;
8149
- } catch (e27) {
8150
- continue;
8151
- }
8152
- let entry = cache.get(file);
8153
- if (!entry || entry.mtimeMs !== mtimeMs) {
8154
- let code = "";
8155
- try {
8156
- code = fs3.default.readFileSync(file, "utf8");
8157
- } catch (e28) {
8158
- }
8159
- entry = { mtimeMs, tools: findFarmWebMCPTools(code, file) };
8160
- cache.set(file, entry);
8161
- }
8162
- for (const tool of entry.tools) {
8163
- if (seen.has(tool.name) || tools.length >= MAX_TOOLS) continue;
8164
- seen.add(tool.name);
8165
- tools.push(tool);
8166
- }
8167
- }
8168
- return tools;
8169
- }
8170
-
8171
- // src/client-plugin-build.ts
8172
-
8173
-
8174
- var CLIENT_KEYS = [
8175
- "public",
8176
- "setup",
8177
- "hydration",
8178
- "navigation",
8179
- "error",
8180
- "performance",
8181
- "close"
8182
- ];
8183
- var HYDRATION_KEYS = ["before", "after"];
8184
- var NAVIGATION_KEYS = ["before", "loaded", "resolved", "rendered", "error"];
8185
- var MOBILE_SHELL_CLIENT_IMPORT = 'import { farmMobileShellClient as __farmMobileShellClient } from "@farm.js/core/internal/client-runtime";';
8186
- var MOBILE_SHELL_CLIENT_REGISTRATION = ` {
8187
- name: "farm:mobile-shell",
8188
- enforce: "pre",
8189
- definition: __farmMobileShellClient,
8190
- }`;
8191
- var APP_CLIENT_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
8192
- function resolveFarmAppClientEntry(root = process.cwd(), srcDir = "src") {
8193
- const sourceRoot = path5.default.resolve(root, srcDir);
8194
- for (const extension of APP_CLIENT_EXTENSIONS) {
8195
- const candidate = path5.default.join(sourceRoot, `client.${extension}`);
8196
- if (fs3.default.existsSync(candidate) && fs3.default.statSync(candidate).isFile()) return candidate;
8197
- }
8198
- return void 0;
8199
- }
8200
- function resolveFarmClientPlugins(plugins, _root) {
8201
- if (!_optionalChain([plugins, 'optionalAccess', _370 => _370.length])) return [];
8202
- return plugins.flatMap((plugin) => {
8203
- if (!plugin.client) return [];
8204
- assertClientLifecycle(plugin.client, plugin.name);
8205
- assertPublicData(plugin.client.public, plugin.name);
8206
- return [
8207
- {
8208
- name: plugin.name,
8209
- version: plugin.version,
8210
- enforce: plugin.enforce,
8211
- definition: plugin.client,
8212
- publicData: plugin.client.public
8213
- }
8214
- ];
8215
- });
8216
- }
8217
- function generateFarmClientPluginEntryCode(plugins, root, srcDir = "src", appPublicData, platform = _chunkAQLHD6HZcjs.resolveFarmPlatform.call(void 0, )) {
8218
- const resolved = resolveFarmClientPlugins(plugins, root);
8219
- const appClientEntry = root ? resolveFarmAppClientEntry(root, srcDir) : void 0;
8220
- const appImport = appClientEntry ? `import farmAppClientDefinition from ${JSON.stringify(appClientEntry.replace(/\\/g, "/"))};` : "";
8221
- const mobileShell = platform === "mobile";
8222
- const imports = mobileShell ? [MOBILE_SHELL_CLIENT_IMPORT, appImport].filter(Boolean).join("\n") : appImport;
8223
- const serializedPlugins = mobileShell ? [MOBILE_SHELL_CLIENT_REGISTRATION] : [];
8224
- serializedPlugins.push(
8225
- ...resolved.map(
8226
- (plugin) => ` {
8227
- name: ${JSON.stringify(plugin.name)},
8228
- version: ${serializeOptionalString(plugin.version)},
8229
- enforce: ${serializeOptionalString(plugin.enforce)},
8230
- definition: ${serializeClientLifecycle(plugin.definition, plugin.name)},
8231
- public: ${serializePublicData(plugin.publicData)},
8232
- }`
8233
- )
8234
- );
8235
- if (appClientEntry) {
8236
- assertPublicData(appPublicData, "farm:app-client");
8237
- serializedPlugins.push(` {
8238
- name: "farm:app-client",
8239
- enforce: "post",
8240
- definition: farmAppClientDefinition,
8241
- public: ${serializePublicData(appPublicData)},
8242
- }`);
8243
- }
8244
- const registrations = `[
8245
- ${serializedPlugins.join(",\n")}
8246
- ]`;
8247
- return { imports, registrations, plugins: resolved };
8248
- }
8249
- function assertClientLifecycle(client, pluginName) {
8250
- assertLifecycleObject(client, pluginName, "client", CLIENT_KEYS);
8251
- assertHook(client.setup, pluginName, "client.setup");
8252
- assertHook(client.error, pluginName, "client.error");
8253
- assertHook(client.performance, pluginName, "client.performance");
8254
- assertHook(client.close, pluginName, "client.close");
8255
- if (client.hydration !== void 0) {
8256
- assertLifecycleObject(client.hydration, pluginName, "client.hydration", HYDRATION_KEYS);
8257
- assertHook(client.hydration.before, pluginName, "client.hydration.before");
8258
- assertHook(client.hydration.after, pluginName, "client.hydration.after");
8259
- }
8260
- if (client.navigation !== void 0) {
8261
- assertLifecycleObject(client.navigation, pluginName, "client.navigation", NAVIGATION_KEYS);
8262
- for (const key of NAVIGATION_KEYS) {
8263
- assertHook(client.navigation[key], pluginName, `client.navigation.${key}`);
8264
- }
8265
- }
8266
- }
8267
- function assertLifecycleObject(value, pluginName, location, allowedKeys) {
8268
- if (!value || typeof value !== "object" || Array.isArray(value)) {
8269
- throw new TypeError(`Client plugin "${pluginName}" ${location} must be an object`);
8270
- }
8271
- const prototype = Object.getPrototypeOf(value);
8272
- if (prototype !== Object.prototype && prototype !== null) {
8273
- throw new TypeError(`Client plugin "${pluginName}" ${location} must be a plain object`);
8274
- }
8275
- for (const key of Reflect.ownKeys(value)) {
8276
- if (typeof key === "symbol") {
8277
- throw new TypeError(`Client plugin "${pluginName}" ${location} cannot contain symbol keys`);
8278
- }
8279
- if (!allowedKeys.includes(key)) {
8280
- throw new TypeError(`Client plugin "${pluginName}" has an unknown ${location}.${key} option`);
8281
- }
8282
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
8283
- if (!_optionalChain([descriptor, 'optionalAccess', _371 => _371.enumerable])) {
8284
- throw new TypeError(`Client plugin "${pluginName}" ${location}.${key} must be enumerable`);
8285
- }
8286
- if (!("value" in descriptor)) {
8287
- throw new TypeError(`Client plugin "${pluginName}" ${location}.${key} cannot be an accessor`);
8288
- }
8289
- }
8290
- }
8291
- function assertHook(value, pluginName, location) {
8292
- if (value === void 0) return;
8293
- if (typeof value !== "function") {
8294
- throw new TypeError(`Client plugin "${pluginName}" ${location} must be a function`);
8579
+ if (value === NOT_STATIC) return NOT_STATIC;
8580
+ object[key] = value;
8581
+ }
8582
+ return object;
8583
+ }
8584
+ case "TSAsExpression":
8585
+ case "TSSatisfiesExpression":
8586
+ case "TSNonNullExpression":
8587
+ case "ParenthesizedExpression":
8588
+ return staticValue(node.expression);
8589
+ default:
8590
+ return NOT_STATIC;
8295
8591
  }
8296
- functionSource(value, pluginName, location);
8297
- }
8298
- function serializeClientLifecycle(definition, pluginName) {
8299
- const fields = [];
8300
- pushHook(fields, "setup", definition.setup, pluginName, "client.setup", 2);
8301
- pushHookGroup(fields, "hydration", definition.hydration, HYDRATION_KEYS, pluginName, 2);
8302
- pushHookGroup(fields, "navigation", definition.navigation, NAVIGATION_KEYS, pluginName, 2);
8303
- pushHook(fields, "error", definition.error, pluginName, "client.error", 2);
8304
- pushHook(fields, "performance", definition.performance, pluginName, "client.performance", 2);
8305
- pushHook(fields, "close", definition.close, pluginName, "client.close", 2);
8306
- return fields.length ? `{
8307
- ${fields.join(",\n")}
8308
- }` : "{}";
8309
8592
  }
8310
- function pushHookGroup(fields, groupName, group, keys, pluginName, indent) {
8311
- if (!group) return;
8312
- const hooks = [];
8313
- for (const key of keys) {
8314
- pushHook(hooks, key, group[key], pluginName, `client.${groupName}.${key}`, indent + 2);
8315
- }
8316
- fields.push(
8317
- `${" ".repeat(indent)}${JSON.stringify(groupName)}: {
8318
- ${hooks.join(",\n")}
8319
- ${" ".repeat(indent)}}`
8320
- );
8593
+ function property(object, name) {
8594
+ return _optionalChain([object, 'access', _377 => _377.properties, 'access', _378 => _378.find, 'call', _379 => _379(
8595
+ (entry) => entry.type === "Property" && !entry.computed && (entry.key.name === name || entry.key.value === name)
8596
+ ), 'optionalAccess', _380 => _380.value]);
8321
8597
  }
8322
- function pushHook(fields, key, hook, pluginName, location, indent) {
8323
- if (hook === void 0) return;
8324
- fields.push(
8325
- `${" ".repeat(indent)}${JSON.stringify(key)}: ${functionSource(hook, pluginName, location)}`
8326
- );
8598
+ function toolFromObject(object) {
8599
+ const name = staticValue(property(object, "name"));
8600
+ if (typeof name !== "string" || !/^[A-Za-z0-9_.-]{1,128}$/.test(name)) return null;
8601
+ const text = (key) => {
8602
+ const value = staticValue(property(object, key));
8603
+ return typeof value === "string" && value.length <= 2e3 ? value : void 0;
8604
+ };
8605
+ const annotations = staticValue(property(object, "annotations"));
8606
+ const hints = annotations && typeof annotations === "object" && !Array.isArray(annotations) ? Object.fromEntries(
8607
+ HINTS.filter(
8608
+ (hint) => typeof annotations[hint] === "boolean"
8609
+ ).map((hint) => [hint, annotations[hint]])
8610
+ ) : {};
8611
+ const schemaNode = property(object, "inputSchema");
8612
+ const schema = staticValue(schemaNode);
8613
+ const literal = schema !== NOT_STATIC && schema !== null && typeof schema === "object" && !Array.isArray(schema) && Buffer.byteLength(JSON.stringify(schema)) <= MAX_SCHEMA_BYTES;
8614
+ const title = text("title");
8615
+ const description = text("description");
8616
+ return {
8617
+ name,
8618
+ ...title ? { title } : {},
8619
+ ...description ? { description } : {},
8620
+ ...hints,
8621
+ ...literal ? { inputSchema: schema } : {},
8622
+ inputSchemaSource: literal ? "literal" : schemaNode ? "computed" : "none"
8623
+ };
8327
8624
  }
8328
- function functionSource(value, pluginName, location) {
8329
- if (typeof value !== "function") {
8330
- throw new TypeError(`Client plugin "${pluginName}" ${location} must be a function`);
8331
- }
8332
- const source = Function.prototype.toString.call(value).trim();
8333
- if (!source || source.includes("[native code]")) {
8334
- throw new TypeError(
8335
- `Client plugin "${pluginName}" ${location} must be authored inline and cannot be native or bound`
8336
- );
8337
- }
8338
- if (/^(?:async\s+)?function(?:\s*\*)?(?:\s+|\()/.test(source)) {
8339
- return `(${source})`;
8340
- }
8341
- const method = source.match(/^(async\s+)?(\*\s*)?[$A-Z_a-z][$\w]*\s*(\([\s\S]*)$/);
8342
- if (method) {
8343
- const asyncPrefix = _nullishCoalesce(method[1], () => ( ""));
8344
- const generator = method[2] ? "*" : "";
8345
- return `(${asyncPrefix}function${generator}${method[3]})`;
8625
+ function findFarmWebMCPTools(code, filename = "module.tsx") {
8626
+ if (!code.includes(WEBMCP_CLIENT)) return [];
8627
+ const lang = _nullishCoalesce(LANGS[path5.default.extname(filename).slice(1)], () => ( "tsx"));
8628
+ _nullishCoalesce(parseAst2, () => ( (parseAst2 = _module.createRequire.call(void 0, typeof __filename === "string" ? __filename : _chunkBTZ5O6VMcjs.define_import_meta_default.url)(
8629
+ "rolldown/parseAst"
8630
+ ).parseAst)));
8631
+ let program;
8632
+ try {
8633
+ program = parseAst2(code, { lang });
8634
+ } catch (e28) {
8635
+ return [];
8346
8636
  }
8347
- if (source.includes("=>")) return `(${source})`;
8348
- throw new TypeError(
8349
- `Client plugin "${pluginName}" ${location} must use a function, method, or arrow function`
8350
- );
8351
- }
8352
- function assertPublicData(value, pluginName) {
8353
- if (value === void 0) return;
8354
- const seen = /* @__PURE__ */ new WeakSet();
8355
- const visit = (current, pathSegments) => {
8356
- if (current === null || typeof current === "string" || typeof current === "boolean") {
8357
- return;
8358
- }
8359
- if (typeof current === "number") {
8360
- if (Number.isFinite(current)) return;
8361
- throwPublicDataError(pluginName, pathSegments, "must be a finite number");
8362
- }
8363
- if (typeof current !== "object") {
8364
- throwPublicDataError(pluginName, pathSegments, `cannot contain ${typeof current} values`);
8365
- }
8366
- if (seen.has(current)) {
8367
- throwPublicDataError(pluginName, pathSegments, "cannot contain circular references");
8637
+ const locals = /* @__PURE__ */ new Map();
8638
+ for (const statement of program.body) {
8639
+ if (statement.type !== "ImportDeclaration" || statement.source.value !== WEBMCP_CLIENT)
8640
+ continue;
8641
+ for (const specifier of statement.specifiers) {
8642
+ const imported = _nullishCoalesce(_optionalChain([specifier, 'access', _381 => _381.imported, 'optionalAccess', _382 => _382.name]), () => ( _optionalChain([specifier, 'access', _383 => _383.imported, 'optionalAccess', _384 => _384.value])));
8643
+ if (specifier.type === "ImportSpecifier" && DEFINERS.has(imported))
8644
+ locals.set(specifier.local.name, imported);
8368
8645
  }
8369
- seen.add(current);
8370
- if (Array.isArray(current)) {
8371
- for (let index = 0; index < current.length; index += 1) {
8372
- if (!Object.prototype.hasOwnProperty.call(current, index)) {
8373
- throwPublicDataError(
8374
- pluginName,
8375
- [...pathSegments, String(index)],
8376
- "cannot contain sparse array slots"
8377
- );
8646
+ }
8647
+ if (!locals.size) return [];
8648
+ const found = [];
8649
+ const visit = (node) => {
8650
+ if (!node || typeof node !== "object") return;
8651
+ if (Array.isArray(node)) return node.forEach(visit);
8652
+ const current = node;
8653
+ if (current.type === "CallExpression" && current.callee.type === "Identifier") {
8654
+ const definer = locals.get(current.callee.name);
8655
+ const [argument] = current.arguments;
8656
+ if (definer && argument) {
8657
+ const objects = definer === "registerWebMCPTools" ? argument.type === "ArrayExpression" ? argument.elements.filter(
8658
+ (element) => _optionalChain([element, 'optionalAccess', _385 => _385.type]) === "ObjectExpression"
8659
+ ) : [] : argument.type === "ObjectExpression" ? [argument] : [];
8660
+ for (const object of objects) {
8661
+ const tool = toolFromObject(object);
8662
+ if (tool) found.push({ start: object.start, tool });
8378
8663
  }
8379
- visit(current[index], [...pathSegments, String(index)]);
8380
- }
8381
- for (const key of Reflect.ownKeys(current)) {
8382
- if (key === "length" || typeof key === "string" && isArrayIndex(key)) continue;
8383
- throwPublicDataError(
8384
- pluginName,
8385
- pathSegments,
8386
- typeof key === "symbol" ? "cannot contain symbol keys" : `cannot contain non-index array property ${key}`
8387
- );
8388
8664
  }
8389
- seen.delete(current);
8390
- return;
8391
8665
  }
8392
- const prototype = Object.getPrototypeOf(current);
8393
- if (prototype !== Object.prototype && prototype !== null) {
8394
- throwPublicDataError(pluginName, pathSegments, "must contain only plain objects and arrays");
8666
+ for (const [key, value] of Object.entries(current))
8667
+ if (key !== "type" && value && typeof value === "object") visit(value);
8668
+ };
8669
+ visit(program.body);
8670
+ return found.sort((a, b) => a.start - b.start).map(({ tool }) => tool);
8671
+ }
8672
+ var cache = /* @__PURE__ */ new Map();
8673
+ function collectFarmWebMCPTools(root, srcDir = "src") {
8674
+ const base = path5.default.resolve(root, srcDir);
8675
+ let files;
8676
+ try {
8677
+ files = _tinyglobby.globSync.call(void 0, "**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}", {
8678
+ cwd: base,
8679
+ absolute: true,
8680
+ expandDirectories: false,
8681
+ ignore: ["**/node_modules/**", "**/*.d.ts", "**/*.{test,spec}.*", "**/__tests__/**"]
8682
+ });
8683
+ } catch (e29) {
8684
+ return [];
8685
+ }
8686
+ const seen = /* @__PURE__ */ new Set();
8687
+ const tools = [];
8688
+ for (const file of files.sort()) {
8689
+ let mtimeMs;
8690
+ try {
8691
+ mtimeMs = fs3.default.statSync(file).mtimeMs;
8692
+ } catch (e30) {
8693
+ continue;
8395
8694
  }
8396
- for (const key of Reflect.ownKeys(current)) {
8397
- if (typeof key === "symbol") {
8398
- throwPublicDataError(pluginName, pathSegments, "cannot contain symbol keys");
8399
- }
8400
- const descriptor = Object.getOwnPropertyDescriptor(current, key);
8401
- if (!_optionalChain([descriptor, 'optionalAccess', _372 => _372.enumerable])) {
8402
- throwPublicDataError(
8403
- pluginName,
8404
- [...pathSegments, key],
8405
- "cannot contain non-enumerable properties"
8406
- );
8407
- }
8408
- if (!("value" in descriptor)) {
8409
- throwPublicDataError(
8410
- pluginName,
8411
- [...pathSegments, key],
8412
- "cannot contain accessor properties"
8413
- );
8695
+ let entry = cache.get(file);
8696
+ if (!entry || entry.mtimeMs !== mtimeMs) {
8697
+ let code = "";
8698
+ try {
8699
+ code = fs3.default.readFileSync(file, "utf8");
8700
+ } catch (e31) {
8414
8701
  }
8415
- visit(descriptor.value, [...pathSegments, key]);
8702
+ entry = { mtimeMs, tools: findFarmWebMCPTools(code, file) };
8703
+ cache.set(file, entry);
8416
8704
  }
8417
- seen.delete(current);
8418
- };
8419
- visit(value, []);
8420
- }
8421
- function throwPublicDataError(pluginName, pathSegments, message) {
8422
- const location = pathSegments.length ? ` at client.public.${pathSegments.join(".")}` : "";
8423
- throw new TypeError(`Client plugin "${pluginName}"${location} ${message}`);
8424
- }
8425
- function serializePublicData(value) {
8426
- if (value === void 0) return "undefined";
8427
- return `JSON.parse(${JSON.stringify(JSON.stringify(value))})`;
8428
- }
8429
- function serializeOptionalString(value) {
8430
- return value === void 0 ? "undefined" : JSON.stringify(value);
8431
- }
8432
- function isArrayIndex(key) {
8433
- const value = Number(key);
8434
- return Number.isInteger(value) && value >= 0 && value < 4294967295 && String(value) === key;
8705
+ for (const tool of entry.tools) {
8706
+ if (seen.has(tool.name) || tools.length >= MAX_TOOLS) continue;
8707
+ seen.add(tool.name);
8708
+ tools.push(tool);
8709
+ }
8710
+ }
8711
+ return tools;
8435
8712
  }
8436
8713
 
8437
8714
  // src/client-cache-persistence-build.ts
@@ -8439,8 +8716,8 @@ function isArrayIndex(key) {
8439
8716
 
8440
8717
  var ADAPTER_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
8441
8718
  function resolveFarmClientCacheAdapterEntry(root, cache2) {
8442
- const client = _optionalChain([cache2, 'optionalAccess', _373 => _373.client]);
8443
- const adapter = _optionalChain([client, 'optionalAccess', _374 => _374.adapter]);
8719
+ const client = _optionalChain([cache2, 'optionalAccess', _386 => _386.client]);
8720
+ const adapter = _optionalChain([client, 'optionalAccess', _387 => _387.adapter]);
8444
8721
  if (adapter === void 0) return void 0;
8445
8722
  if (typeof adapter !== "string" || adapter.trim().length === 0) {
8446
8723
  throw new Error(
@@ -8455,8 +8732,8 @@ function resolveFarmClientCacheAdapterEntry(root, cache2) {
8455
8732
  );
8456
8733
  }
8457
8734
  const options = {};
8458
- if (_optionalChain([client, 'optionalAccess', _375 => _375.version]) !== void 0) options.version = client.version;
8459
- if (_optionalChain([client, 'optionalAccess', _376 => _376.flushDelayMs]) !== void 0) options.flushDelayMs = client.flushDelayMs;
8735
+ if (_optionalChain([client, 'optionalAccess', _388 => _388.version]) !== void 0) options.version = client.version;
8736
+ if (_optionalChain([client, 'optionalAccess', _389 => _389.flushDelayMs]) !== void 0) options.flushDelayMs = client.flushDelayMs;
8460
8737
  return { importPath: found.replace(/\\/g, "/"), options };
8461
8738
  }
8462
8739
  function resolveAdapterFile(resolved) {
@@ -8626,11 +8903,55 @@ async function buildFarmTreeLayouts(layouts, params, source, options) {
8626
8903
  }
8627
8904
  `;
8628
8905
 
8906
+ // src/client/navigation-stream-client.ts
8907
+ var FARM_NAVIGATION_STREAM_READER_SOURCE = `// Reads a streamed navigation (F-Stream) up to the end of React's shell. \`next\` then resolves
8908
+ // with each later flush as it ends, and null at the end; a document without a marker is all shell.
8909
+ // The marker carries the random token the server sent in the F-Flush header, so page content
8910
+ // cannot forge a boundary; a response without a valid token is all shell.
8911
+ async function readFarmNavigationStream(body, flushToken) {
8912
+ const reader = body.getReader();
8913
+ const decoder = new TextDecoder();
8914
+ const marker = typeof flushToken === "string" && /^[0-9a-f]{32}$/.test(flushToken)
8915
+ ? "<!--farm-flush:" + flushToken + "-->"
8916
+ : "";
8917
+ let text = "";
8918
+ let done = false;
8919
+ const next = async function() {
8920
+ for (;;) {
8921
+ const at = marker ? text.indexOf(marker) : -1;
8922
+ if (at !== -1) {
8923
+ const flush = text.slice(0, at);
8924
+ text = text.slice(at + marker.length);
8925
+ return flush;
8926
+ }
8927
+ if (done) {
8928
+ const flush = text;
8929
+ text = "";
8930
+ return flush ? flush : null;
8931
+ }
8932
+ const result = await reader.read();
8933
+ if (result.done) {
8934
+ done = true;
8935
+ text += decoder.decode();
8936
+ } else {
8937
+ text += decoder.decode(result.value, { stream: true });
8938
+ }
8939
+ }
8940
+ };
8941
+ const shell = await next();
8942
+ if (done && !text) return { shell: shell || "" };
8943
+ return {
8944
+ shell: shell,
8945
+ next: next,
8946
+ cancel: function() { reader.cancel().catch(function() {}); },
8947
+ };
8948
+ }`;
8949
+
8629
8950
  // src/docs/client-config.ts
8630
8951
 
8631
8952
 
8632
8953
 
8633
- var parseAst2;
8954
+ var parseAst3;
8634
8955
  function propertyKeyName(property2) {
8635
8956
  if (property2.computed) return void 0;
8636
8957
  const key = property2.key;
@@ -8639,11 +8960,11 @@ function propertyKeyName(property2) {
8639
8960
  return void 0;
8640
8961
  }
8641
8962
  function redactFarmDocsClientConfig(code, filename) {
8642
- _nullishCoalesce(parseAst2, () => ( (parseAst2 = _module.createRequire.call(void 0, typeof __filename === "string" ? __filename : _chunkBTZ5O6VMcjs.define_import_meta_default.url)(
8963
+ _nullishCoalesce(parseAst3, () => ( (parseAst3 = _module.createRequire.call(void 0, typeof __filename === "string" ? __filename : _chunkBTZ5O6VMcjs.define_import_meta_default.url)(
8643
8964
  "rolldown/parseAst"
8644
8965
  ).parseAst)));
8645
8966
  const extension = path5.default.extname(filename);
8646
- const program = parseAst2(code, {
8967
+ const program = parseAst3(code, {
8647
8968
  lang: extension === ".tsx" || extension === ".jsx" ? "tsx" : "ts"
8648
8969
  });
8649
8970
  const edits = [];
@@ -8656,7 +8977,7 @@ function redactFarmDocsClientConfig(code, filename) {
8656
8977
  const current = node;
8657
8978
  if (current.type === "Property") {
8658
8979
  const name = propertyKeyName(current);
8659
- const valueType = _optionalChain([current, 'access', _377 => _377.value, 'optionalAccess', _378 => _378.type]);
8980
+ const valueType = _optionalChain([current, 'access', _390 => _390.value, 'optionalAccess', _391 => _391.type]);
8660
8981
  const credential = name !== void 0 && (name.toLowerCase() === "headers" || _chunkSM2SYWARcjs.isSecretDocsConfigKey.call(void 0, name) && valueType !== "ObjectExpression" && valueType !== "ArrayExpression");
8661
8982
  if (name && credential) {
8662
8983
  edits.push(
@@ -8687,7 +9008,7 @@ function isFarmDocsClientConfigModule(id, configModule) {
8687
9008
  if (file === configModule) return true;
8688
9009
  try {
8689
9010
  return file === _fs.realpathSync.call(void 0, configModule).replace(/\\/g, "/");
8690
- } catch (e29) {
9011
+ } catch (e32) {
8691
9012
  return false;
8692
9013
  }
8693
9014
  }
@@ -8696,7 +9017,7 @@ function farmDocsClientConfigPlugin(configModule) {
8696
9017
  name: "farm:docs-client-config",
8697
9018
  enforce: "pre",
8698
9019
  transform(code, id, options) {
8699
- if (_optionalChain([options, 'optionalAccess', _379 => _379.ssr]) || !isFarmDocsClientConfigModule(id, configModule)) return null;
9020
+ if (_optionalChain([options, 'optionalAccess', _392 => _392.ssr]) || !isFarmDocsClientConfigModule(id, configModule)) return null;
8700
9021
  const redacted = redactFarmDocsClientConfig(code, id.split("?")[0]);
8701
9022
  return redacted === null ? null : { code: redacted, map: null };
8702
9023
  }
@@ -8727,7 +9048,7 @@ var FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE = [
8727
9048
  ];
8728
9049
  function getFarmClientOptimizeDepsInclude(renderer) {
8729
9050
  return Array.from(
8730
- /* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess', _380 => _380.optimizeDeps]) || []])
9051
+ /* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess', _393 => _393.optimizeDeps]) || []])
8731
9052
  );
8732
9053
  }
8733
9054
  function createFarmClientOptimizeDepsEntries(projectRoot, appDirectories) {
@@ -8750,7 +9071,7 @@ function createFarmClientOptimizeDepsConfig(entries, renderer) {
8750
9071
  // Farm's HTML boots through a virtual module and imports route UI lazily.
8751
9072
  // Explicit entries let Vite finish that crawl before a navigation can
8752
9073
  // rotate the optimizer hash underneath a hydrated React runtime.
8753
- ..._optionalChain([entries, 'optionalAccess', _381 => _381.length]) ? { entries: [...entries] } : {}
9074
+ ..._optionalChain([entries, 'optionalAccess', _394 => _394.length]) ? { entries: [...entries] } : {}
8754
9075
  };
8755
9076
  }
8756
9077
  function createFarmSourceAlias(projectRoot, srcDir = "src") {
@@ -8776,8 +9097,8 @@ function mergeAlias(farmValue, userValue) {
8776
9097
  return [...normalize(userValue), ...normalize(farmValue)];
8777
9098
  }
8778
9099
  function mergeFarmViteConfig(farmConfig, userConfig = {}) {
8779
- const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access', _382 => _382.optimizeDeps, 'optionalAccess', _383 => _383.noDiscovery]), () => ( _optionalChain([farmConfig, 'access', _384 => _384.optimizeDeps, 'optionalAccess', _385 => _385.noDiscovery])));
8780
- const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access', _386 => _386.optimizeDeps, 'optionalAccess', _387 => _387.holdUntilCrawlEnd]), () => ( (_optionalChain([userConfig, 'access', _388 => _388.optimizeDeps, 'optionalAccess', _389 => _389.noDiscovery]) === true ? false : _optionalChain([farmConfig, 'access', _390 => _390.optimizeDeps, 'optionalAccess', _391 => _391.holdUntilCrawlEnd]))));
9100
+ const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access', _395 => _395.optimizeDeps, 'optionalAccess', _396 => _396.noDiscovery]), () => ( _optionalChain([farmConfig, 'access', _397 => _397.optimizeDeps, 'optionalAccess', _398 => _398.noDiscovery])));
9101
+ const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access', _399 => _399.optimizeDeps, 'optionalAccess', _400 => _400.holdUntilCrawlEnd]), () => ( (_optionalChain([userConfig, 'access', _401 => _401.optimizeDeps, 'optionalAccess', _402 => _402.noDiscovery]) === true ? false : _optionalChain([farmConfig, 'access', _403 => _403.optimizeDeps, 'optionalAccess', _404 => _404.holdUntilCrawlEnd]))));
8781
9102
  return {
8782
9103
  ...farmConfig,
8783
9104
  ...userConfig,
@@ -8789,9 +9110,9 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
8789
9110
  resolve: {
8790
9111
  ...farmConfig.resolve,
8791
9112
  ...userConfig.resolve,
8792
- alias: mergeAlias(_optionalChain([farmConfig, 'access', _392 => _392.resolve, 'optionalAccess', _393 => _393.alias]), _optionalChain([userConfig, 'access', _394 => _394.resolve, 'optionalAccess', _395 => _395.alias])),
9113
+ alias: mergeAlias(_optionalChain([farmConfig, 'access', _405 => _405.resolve, 'optionalAccess', _406 => _406.alias]), _optionalChain([userConfig, 'access', _407 => _407.resolve, 'optionalAccess', _408 => _408.alias])),
8793
9114
  dedupe: Array.from(
8794
- /* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access', _396 => _396.resolve, 'optionalAccess', _397 => _397.dedupe]) || [], ..._optionalChain([userConfig, 'access', _398 => _398.resolve, 'optionalAccess', _399 => _399.dedupe]) || []])
9115
+ /* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access', _409 => _409.resolve, 'optionalAccess', _410 => _410.dedupe]) || [], ..._optionalChain([userConfig, 'access', _411 => _411.resolve, 'optionalAccess', _412 => _412.dedupe]) || []])
8795
9116
  )
8796
9117
  },
8797
9118
  optimizeDeps: {
@@ -8801,21 +9122,21 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
8801
9122
  holdUntilCrawlEnd,
8802
9123
  include: Array.from(
8803
9124
  /* @__PURE__ */ new Set([
8804
- ..._optionalChain([farmConfig, 'access', _400 => _400.optimizeDeps, 'optionalAccess', _401 => _401.include]) || [],
8805
- ..._optionalChain([userConfig, 'access', _402 => _402.optimizeDeps, 'optionalAccess', _403 => _403.include]) || []
9125
+ ..._optionalChain([farmConfig, 'access', _413 => _413.optimizeDeps, 'optionalAccess', _414 => _414.include]) || [],
9126
+ ..._optionalChain([userConfig, 'access', _415 => _415.optimizeDeps, 'optionalAccess', _416 => _416.include]) || []
8806
9127
  ])
8807
9128
  ),
8808
9129
  exclude: Array.from(
8809
9130
  /* @__PURE__ */ new Set([
8810
- ..._optionalChain([farmConfig, 'access', _404 => _404.optimizeDeps, 'optionalAccess', _405 => _405.exclude]) || [],
8811
- ..._optionalChain([userConfig, 'access', _406 => _406.optimizeDeps, 'optionalAccess', _407 => _407.exclude]) || []
9131
+ ..._optionalChain([farmConfig, 'access', _417 => _417.optimizeDeps, 'optionalAccess', _418 => _418.exclude]) || [],
9132
+ ..._optionalChain([userConfig, 'access', _419 => _419.optimizeDeps, 'optionalAccess', _420 => _420.exclude]) || []
8812
9133
  ])
8813
9134
  )
8814
9135
  },
8815
9136
  ssr: {
8816
9137
  ...farmConfig.ssr,
8817
9138
  ...userConfig.ssr,
8818
- noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access', _408 => _408.ssr, 'optionalAccess', _409 => _409.noExternal]), _optionalChain([userConfig, 'access', _410 => _410.ssr, 'optionalAccess', _411 => _411.noExternal]))
9139
+ noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access', _421 => _421.ssr, 'optionalAccess', _422 => _422.noExternal]), _optionalChain([userConfig, 'access', _423 => _423.ssr, 'optionalAccess', _424 => _424.noExternal]))
8819
9140
  }
8820
9141
  };
8821
9142
  }
@@ -8867,7 +9188,7 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
8867
9188
  ...farmConfig.build,
8868
9189
  rollupOptions: {
8869
9190
  ...userBundlerOptions,
8870
- ..._optionalChain([farmConfig, 'access', _412 => _412.build, 'optionalAccess', _413 => _413.rollupOptions])
9191
+ ..._optionalChain([farmConfig, 'access', _425 => _425.build, 'optionalAccess', _426 => _426.rollupOptions])
8871
9192
  }
8872
9193
  },
8873
9194
  css: farmConfig.css || userCss ? { ...farmConfig.css, ...userCss } : void 0,
@@ -8875,7 +9196,7 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
8875
9196
  esbuild: typeof userEsbuild === "object" && farmConfig.esbuild !== false ? { ...userEsbuild, ...farmConfig.esbuild } : _nullishCoalesce(farmConfig.esbuild, () => ( userEsbuild)),
8876
9197
  ssr: {
8877
9198
  ...merged.ssr,
8878
- external: mergeExternal(_optionalChain([farmConfig, 'access', _414 => _414.ssr, 'optionalAccess', _415 => _415.external]), _optionalChain([userConfig, 'access', _416 => _416.ssr, 'optionalAccess', _417 => _417.external]))
9199
+ external: mergeExternal(_optionalChain([farmConfig, 'access', _427 => _427.ssr, 'optionalAccess', _428 => _428.external]), _optionalChain([userConfig, 'access', _429 => _429.ssr, 'optionalAccess', _430 => _430.external]))
8879
9200
  }
8880
9201
  };
8881
9202
  }
@@ -8948,4 +9269,9 @@ ${FARM_DARK_VARIANT}
8948
9269
 
8949
9270
 
8950
9271
 
8951
- exports.withPackageClientBoundaryCache = withPackageClientBoundaryCache; exports.usePackageClientBoundaryCacheFile = usePackageClientBoundaryCacheFile; exports.resolveModuleSourcePath = resolveModuleSourcePath; exports.getFarmClientHydrationPlanOptions = getFarmClientHydrationPlanOptions; exports.describeSuppressedAsyncHydration = describeSuppressedAsyncHydration; exports.resolveFarmIsolatedClientHydrationMode = resolveFarmIsolatedClientHydrationMode; exports.hasUseClientDirective = hasUseClientDirective; exports.getIslandStrategyExport = getIslandStrategyExport; exports.stripUseClientDirective = stripUseClientDirective; exports.getClientModuleMetadata = getClientModuleMetadata; exports.getClientModuleHydrationPlan = getClientModuleHydrationPlan; exports.usesFarmServerTree = usesFarmServerTree; exports.createMarkdownPageHydrationPlanner = createMarkdownPageHydrationPlanner; exports.enforceFarmIsolatedHydrationRouteBudget = enforceFarmIsolatedHydrationRouteBudget; exports.isIsolatableClientBoundarySource = isIsolatableClientBoundarySource; exports.RouteManager = RouteManager; exports.resolveDevGlobalStylesheetHref = resolveDevGlobalStylesheetHref; exports.resolveFarmNotFoundComponentPath = resolveFarmNotFoundComponentPath; exports.farmFontImportsPlugin = farmFontImportsPlugin; exports.mergeFarmFontCss = mergeFarmFontCss; exports.DEFAULT_NOT_FOUND_STYLES = DEFAULT_NOT_FOUND_STYLES; exports.generateFarmIntegrationProviderClientCode = generateFarmIntegrationProviderClientCode; exports.generateFarmIntegrationProviderServerModules = generateFarmIntegrationProviderServerModules; exports.ServerRenderer = ServerRenderer; exports.FarmApp = FarmApp; exports.createFarmApp = createFarmApp; exports.SHARP_INSTALL_HINT = SHARP_INSTALL_HINT; exports.resolveFarmImageProviderForRuntime = resolveFarmImageProviderForRuntime; exports.resolveFarmImageServerRuntime = resolveFarmImageServerRuntime; exports.resolveFarmAppPackages = resolveFarmAppPackages; exports.collectFarmWebMCPTools = collectFarmWebMCPTools; exports.generateFarmClientPluginEntryCode = generateFarmClientPluginEntryCode; exports.resolveFarmClientCacheAdapterEntry = resolveFarmClientCacheAdapterEntry; exports.generateClientCachePersistenceCode = generateClientCachePersistenceCode; exports.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE = FARM_LAYOUT_ELEMENT_CLIENT_SOURCE; exports.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE = FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE; exports.redactFarmDocsClientConfig = redactFarmDocsClientConfig; exports.isFarmDocsClientConfigModule = isFarmDocsClientConfigModule; exports.farmDocsClientConfigPlugin = farmDocsClientConfigPlugin; exports.createFarmClientOptimizeDepsEntries = createFarmClientOptimizeDepsEntries; exports.createFarmClientOptimizeDepsConfig = createFarmClientOptimizeDepsConfig; exports.createFarmSourceAlias = createFarmSourceAlias; exports.mergeFarmViteConfig = mergeFarmViteConfig; exports.mergeFarmProductionViteConfig = mergeFarmProductionViteConfig; exports.createFarmThemeCssPlugin = createFarmThemeCssPlugin;
9272
+
9273
+
9274
+
9275
+
9276
+
9277
+ exports.withPackageClientBoundaryCache = withPackageClientBoundaryCache; exports.usePackageClientBoundaryCacheFile = usePackageClientBoundaryCacheFile; exports.resolveModuleSourcePath = resolveModuleSourcePath; exports.getFarmClientHydrationPlanOptions = getFarmClientHydrationPlanOptions; exports.describeSuppressedAsyncHydration = describeSuppressedAsyncHydration; exports.resolveFarmIsolatedClientHydrationMode = resolveFarmIsolatedClientHydrationMode; exports.hasUseClientDirective = hasUseClientDirective; exports.getIslandStrategyExport = getIslandStrategyExport; exports.stripUseClientDirective = stripUseClientDirective; exports.collectFarmServerStylesheets = collectFarmServerStylesheets; exports.getClientModuleMetadata = getClientModuleMetadata; exports.getClientModuleHydrationPlan = getClientModuleHydrationPlan; exports.usesFarmServerTree = usesFarmServerTree; exports.createMarkdownPageHydrationPlanner = createMarkdownPageHydrationPlanner; exports.enforceFarmIsolatedHydrationRouteBudget = enforceFarmIsolatedHydrationRouteBudget; exports.isIsolatableClientBoundarySource = isIsolatableClientBoundarySource; exports.RouteManager = RouteManager; exports.resolveDevGlobalStylesheetHref = resolveDevGlobalStylesheetHref; exports.resolveFarmNotFoundComponentPath = resolveFarmNotFoundComponentPath; exports.farmFontImportsPlugin = farmFontImportsPlugin; exports.mergeFarmFontCss = mergeFarmFontCss; exports.DEFAULT_NOT_FOUND_STYLES = DEFAULT_NOT_FOUND_STYLES; exports.generateFarmIntegrationProviderClientCode = generateFarmIntegrationProviderClientCode; exports.generateFarmIntegrationProviderServerModules = generateFarmIntegrationProviderServerModules; exports.inferFarmIslandStrategy = inferFarmIslandStrategy; exports.resolveFarmRouteRootStrategy = resolveFarmRouteRootStrategy; exports.generateFarmClientPluginEntryCode = generateFarmClientPluginEntryCode; exports.canBootFarmIslandsClient = canBootFarmIslandsClient; exports.ServerRenderer = ServerRenderer; exports.FarmApp = FarmApp; exports.createFarmApp = createFarmApp; exports.SHARP_INSTALL_HINT = SHARP_INSTALL_HINT; exports.resolveFarmImageProviderForRuntime = resolveFarmImageProviderForRuntime; exports.resolveFarmImageServerRuntime = resolveFarmImageServerRuntime; exports.resolveFarmAppPackages = resolveFarmAppPackages; exports.collectFarmWebMCPTools = collectFarmWebMCPTools; exports.resolveFarmClientCacheAdapterEntry = resolveFarmClientCacheAdapterEntry; exports.generateClientCachePersistenceCode = generateClientCachePersistenceCode; exports.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE = FARM_LAYOUT_ELEMENT_CLIENT_SOURCE; exports.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE = FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE; exports.FARM_NAVIGATION_STREAM_READER_SOURCE = FARM_NAVIGATION_STREAM_READER_SOURCE; exports.redactFarmDocsClientConfig = redactFarmDocsClientConfig; exports.isFarmDocsClientConfigModule = isFarmDocsClientConfigModule; exports.farmDocsClientConfigPlugin = farmDocsClientConfigPlugin; exports.createFarmClientOptimizeDepsEntries = createFarmClientOptimizeDepsEntries; exports.createFarmClientOptimizeDepsConfig = createFarmClientOptimizeDepsConfig; exports.createFarmSourceAlias = createFarmSourceAlias; exports.mergeFarmViteConfig = mergeFarmViteConfig; exports.mergeFarmProductionViteConfig = mergeFarmProductionViteConfig; exports.createFarmThemeCssPlugin = createFarmThemeCssPlugin;