@farm.js/core 0.1.66 → 0.1.68

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 (494) hide show
  1. package/dist/{agent-mcp-handler-QLFDDTYN.mjs → agent-mcp-handler-AZ7QW4UP.mjs} +5 -5
  2. package/dist/{agent-mcp-handler-OXT73ZBY.cjs → agent-mcp-handler-FER4MQDF.cjs} +6 -6
  3. package/dist/{agent-mcp.d-QD2WZ9BS.d.ts → agent-mcp.d-Uh5xr7aX.d.ts} +1 -1
  4. package/dist/{agent-mcp.d-CO_ABmNK.d.mts → agent-mcp.d-wkVPK1GA.d.mts} +1 -1
  5. package/dist/agent-runtime.cjs +6 -5
  6. package/dist/agent-runtime.d.mts +10 -8
  7. package/dist/agent-runtime.d.ts +10 -8
  8. package/dist/agent-runtime.mjs +5 -4
  9. package/dist/{analyzer-4UFP4HVP.mjs → analyzer-CQDU7E3Y.mjs} +2 -2
  10. package/dist/analyzer-PPAHM4AW.cjs +16 -0
  11. package/dist/api/client.cjs +12 -2
  12. package/dist/api/client.d.mts +4 -4
  13. package/dist/api/client.d.ts +4 -4
  14. package/dist/api/client.mjs +12 -2
  15. package/dist/api/client.native.cjs +12 -2
  16. package/dist/api/client.native.d.mts +5 -5
  17. package/dist/api/client.native.d.ts +5 -5
  18. package/dist/api/client.native.mjs +12 -2
  19. package/dist/api/node.cjs +223 -0
  20. package/dist/api/node.d.mts +61 -0
  21. package/dist/api/node.d.ts +61 -0
  22. package/dist/api/node.mjs +223 -0
  23. package/dist/api/route-manager.cjs +11 -11
  24. package/dist/api/route-manager.d.mts +14 -11
  25. package/dist/api/route-manager.d.ts +14 -11
  26. package/dist/api/route-manager.mjs +10 -10
  27. package/dist/api/runtime.cjs +11 -7
  28. package/dist/api/runtime.d.mts +11 -9
  29. package/dist/api/runtime.d.ts +11 -9
  30. package/dist/api/runtime.mjs +10 -6
  31. package/dist/{api-client.d-BNLXNCXJ.d.mts → api-client.d-Bp35zMqR.d.mts} +1 -1
  32. package/dist/{api-client.d-ddQBNGtu.d.ts → api-client.d-CFI_xL0V.d.ts} +1 -1
  33. package/dist/api.cjs +17 -13
  34. package/dist/api.d.mts +15 -12
  35. package/dist/api.d.ts +15 -12
  36. package/dist/api.mjs +16 -12
  37. package/dist/{app-manifest.d-DDmNkYQQ.d.ts → app-manifest.d-BT5i2F-o.d.ts} +1 -1
  38. package/dist/{app-manifest.d-BpKxiU_E.d.mts → app-manifest.d-Dd4q5CFx.d.mts} +1 -1
  39. package/dist/app-markdown.cjs +5 -5
  40. package/dist/app-markdown.d.mts +15 -15
  41. package/dist/app-markdown.d.ts +15 -15
  42. package/dist/app-markdown.mjs +4 -4
  43. package/dist/{app.d-x68Cwr0_.d.ts → app.d-BVOpL_f2.d.ts} +52 -11
  44. package/dist/{app.d-kuoVWhWM.d.mts → app.d-BhiDXex_.d.mts} +52 -11
  45. package/dist/{chunk-RY4ABNPE.cjs → chunk-225APHKC.cjs} +3 -3
  46. package/dist/{chunk-JGAE5XPL.cjs → chunk-23VJEGKC.cjs} +4 -2
  47. package/dist/{chunk-5C7XMKQ4.cjs → chunk-2AFW7673.cjs} +6 -1
  48. package/dist/{chunk-SYW346ZN.cjs → chunk-2LHZD3OP.cjs} +1 -21
  49. package/dist/{chunk-ZZI56IUY.mjs → chunk-2ZOYOYEE.mjs} +13 -13
  50. package/dist/{chunk-7XGWBPQQ.cjs → chunk-3EEINK7G.cjs} +24 -10
  51. package/dist/{chunk-BRWIVOV4.cjs → chunk-3GNHJ3RN.cjs} +10 -8
  52. package/dist/{chunk-HCGWDRZO.mjs → chunk-3Y52TWYU.mjs} +18 -7
  53. package/dist/{chunk-CBOEJ5Z4.cjs → chunk-437QZIC2.cjs} +133 -46
  54. package/dist/{chunk-O6L3YYPM.cjs → chunk-4E57QHPW.cjs} +8 -16
  55. package/dist/{chunk-WKPBIT5Q.cjs → chunk-4HGLJOXZ.cjs} +6 -6
  56. package/dist/{chunk-CJNAUEVC.mjs → chunk-4QENVMG7.mjs} +1 -1
  57. package/dist/{chunk-EMNKZGF4.mjs → chunk-4UAQB5LB.mjs} +556 -462
  58. package/dist/{chunk-BQWBHWEW.mjs → chunk-4ZXKYCYK.mjs} +1 -1
  59. package/dist/{chunk-N35YPV4N.mjs → chunk-57QAQU4F.mjs} +9 -7
  60. package/dist/{chunk-ZEXE4TGY.mjs → chunk-5FBZJJGA.mjs} +247 -110
  61. package/dist/{chunk-4OSOLDPL.cjs → chunk-5JKDFRTK.cjs} +2 -2
  62. package/dist/{chunk-OLIGNTWU.cjs → chunk-5NFQ6AZI.cjs} +7 -7
  63. package/dist/{chunk-6HRAK7I5.mjs → chunk-5OFNUETM.mjs} +8 -2
  64. package/dist/{chunk-RD623KW4.cjs → chunk-67MZTLTF.cjs} +21 -3
  65. package/dist/chunk-6I4BFRE7.cjs +51 -0
  66. package/dist/{chunk-UBMHQVWN.mjs → chunk-6OFOIMNS.mjs} +1 -1
  67. package/dist/{chunk-K5EW7GUU.mjs → chunk-7BIW7VCW.mjs} +13 -5
  68. package/dist/{chunk-CHYTADNK.cjs → chunk-7LK5CTUM.cjs} +70 -53
  69. package/dist/{chunk-HPP2II4Z.mjs → chunk-7PJARAQQ.mjs} +1 -1
  70. package/dist/{chunk-LEJDW34D.cjs → chunk-7PPLTD3P.cjs} +3 -3
  71. package/dist/{chunk-BYRZ5VTH.mjs → chunk-A3T445WK.mjs} +47 -34
  72. package/dist/{chunk-TGULJSHD.mjs → chunk-AJNBTOVQ.mjs} +20 -9
  73. package/dist/{chunk-FBEBSAVI.cjs → chunk-AKIQ54FK.cjs} +82 -63
  74. package/dist/{chunk-2NGZFOKG.mjs → chunk-AOIUYHPH.mjs} +2 -2
  75. package/dist/{chunk-NKRZLQUK.mjs → chunk-AQIO3RNL.mjs} +1 -1
  76. package/dist/chunk-AQIRXBBY.cjs +26 -0
  77. package/dist/{chunk-DQJ2CIH7.cjs → chunk-ASYOWPSR.cjs} +2 -1
  78. package/dist/chunk-AZ6IW6SF.mjs +28 -0
  79. package/dist/{chunk-QMDU6QHN.mjs → chunk-B6RBJJ5G.mjs} +1 -1
  80. package/dist/{chunk-I32V5CZL.cjs → chunk-BDYM2TN3.cjs} +28 -17
  81. package/dist/{chunk-JLDNXURZ.cjs → chunk-BZWTBELF.cjs} +32 -32
  82. package/dist/{chunk-ITV4QQL2.cjs → chunk-C6CUUBY5.cjs} +14 -3
  83. package/dist/{chunk-QGJ4FI2G.mjs → chunk-C6HGUTXB.mjs} +113 -29
  84. package/dist/{chunk-YN6BHOYY.cjs → chunk-CL52PD6D.cjs} +10 -3
  85. package/dist/{chunk-VQJHT2ND.mjs → chunk-CRVSYDHV.mjs} +2 -2
  86. package/dist/{chunk-XURDCXNH.cjs → chunk-CSLHNBPS.cjs} +6 -6
  87. package/dist/{chunk-XQSYOVCW.cjs → chunk-DBYNZIIQ.cjs} +13 -5
  88. package/dist/{chunk-AZUUKA66.mjs → chunk-DIXFKAPM.mjs} +1251 -389
  89. package/dist/{chunk-QTD6EMN2.mjs → chunk-DQ2DI3Y7.mjs} +11 -4
  90. package/dist/{chunk-NHQM2Q4I.cjs → chunk-DWLNLU55.cjs} +2 -2
  91. package/dist/chunk-DXZ57EPE.mjs +375 -0
  92. package/dist/{chunk-SA7MLSP4.mjs → chunk-E3HDJCWF.mjs} +3 -3
  93. package/dist/{chunk-52Y3C3HG.mjs → chunk-E7VF3LQ5.mjs} +3 -2
  94. package/dist/{chunk-752XUZIM.cjs → chunk-EGIY4A7V.cjs} +6 -6
  95. package/dist/chunk-EIVGPQN5.mjs +51 -0
  96. package/dist/{chunk-KPAJWD3N.mjs → chunk-EYPSKXO4.mjs} +1 -1
  97. package/dist/{chunk-E4UDLFWR.cjs → chunk-F36LS2C7.cjs} +796 -702
  98. package/dist/{chunk-MPIGW42F.mjs → chunk-F6CMGWAL.mjs} +1 -1
  99. package/dist/{chunk-GL7N5UHF.cjs → chunk-FJMC24KG.cjs} +21 -10
  100. package/dist/{chunk-QISW423S.cjs → chunk-FPBOAG6N.cjs} +2 -2
  101. package/dist/{chunk-3CCAICF7.cjs → chunk-FSODPZRT.cjs} +5 -5
  102. package/dist/{chunk-2C5L5RPM.cjs → chunk-FT6KJHS3.cjs} +71 -38
  103. package/dist/{chunk-WMTBBQHY.cjs → chunk-FVYBEMOD.cjs} +288 -151
  104. package/dist/{chunk-BM2LH2JM.mjs → chunk-G7NBPP7H.mjs} +14 -13
  105. package/dist/{chunk-ES2LD2YD.mjs → chunk-GCRT6GJG.mjs} +18 -0
  106. package/dist/{chunk-5OJVKXFV.cjs → chunk-GDM3ZD2O.cjs} +10 -8
  107. package/dist/{chunk-25T5VXOE.mjs → chunk-GFPS7MNE.mjs} +106 -19
  108. package/dist/{chunk-EMDGXYUD.mjs → chunk-GJ7QVFAG.mjs} +16 -7
  109. package/dist/{chunk-TGSEVBPO.mjs → chunk-GJEC5S4V.mjs} +11 -0
  110. package/dist/{chunk-HNAISJFD.cjs → chunk-HDPT6OYE.cjs} +9 -3
  111. package/dist/{chunk-RVGSVQWT.mjs → chunk-HEJM46HQ.mjs} +21 -7
  112. package/dist/chunk-HHLEYA4B.cjs +17 -0
  113. package/dist/{chunk-ZNH6NR3H.cjs → chunk-HJZZSBVK.cjs} +2 -2
  114. package/dist/{chunk-E552H232.cjs → chunk-I7J5RLGO.cjs} +16 -2
  115. package/dist/chunk-ICFPTHXM.mjs +97 -0
  116. package/dist/{chunk-K7OZAVOI.mjs → chunk-IFR74W6S.mjs} +46 -13
  117. package/dist/{chunk-MPJEIHW2.cjs → chunk-IGDYL2IA.cjs} +2 -2
  118. package/dist/{chunk-5A77OEIG.cjs → chunk-IHTDLCDJ.cjs} +5 -5
  119. package/dist/{chunk-OYZXVBZP.cjs → chunk-IUKBPBM7.cjs} +2 -1
  120. package/dist/chunk-J6TZRYCO.cjs +22 -0
  121. package/dist/{chunk-E4RDMG3K.mjs → chunk-JL2YW5KX.mjs} +5 -4
  122. package/dist/chunk-JSOCDYER.cjs +375 -0
  123. package/dist/{chunk-UPYIFH2H.cjs → chunk-JWLRBDDC.cjs} +2 -2
  124. package/dist/{chunk-OLGQZRW6.mjs → chunk-JZBU7V4D.mjs} +37 -17
  125. package/dist/{chunk-ONG4RDW3.mjs → chunk-JZGL2PIH.mjs} +13 -3
  126. package/dist/chunk-K63OWRY2.mjs +22 -0
  127. package/dist/{chunk-TUPKMMXT.mjs → chunk-K6HIIWUB.mjs} +1 -1
  128. package/dist/{chunk-MESQF2JC.mjs → chunk-K6SXMVXO.mjs} +2 -2
  129. package/dist/{chunk-L2JG337G.cjs → chunk-K6VFYFOY.cjs} +33 -31
  130. package/dist/{chunk-TKK5QHKZ.mjs → chunk-KDO6T6OB.mjs} +3 -3
  131. package/dist/{chunk-EZ34EHQP.mjs → chunk-KI3MU7B5.mjs} +1 -1
  132. package/dist/{chunk-GHNW564E.mjs → chunk-KSZK34HU.mjs} +30 -10
  133. package/dist/{chunk-IT6WRNGB.cjs → chunk-KWCZKJYU.cjs} +1541 -679
  134. package/dist/{chunk-DVKH2RVN.cjs → chunk-LDEXTX4I.cjs} +70 -57
  135. package/dist/{chunk-ECKQFEX2.mjs → chunk-LENKRGBV.mjs} +8 -6
  136. package/dist/{chunk-XBSKPLHF.cjs → chunk-LR4KP3I7.cjs} +2 -2
  137. package/dist/{chunk-HEPJIKKQ.cjs → chunk-MCSRMEQV.cjs} +2 -2
  138. package/dist/{chunk-DQF3QLOH.mjs → chunk-ME7RVELR.mjs} +3 -2
  139. package/dist/{chunk-VFXE6NWR.mjs → chunk-MGKWYPE3.mjs} +2 -1
  140. package/dist/{chunk-TZVUF5JJ.mjs → chunk-MGZVDX4R.mjs} +5 -5
  141. package/dist/{chunk-MGKW5XZE.cjs → chunk-MMDKYJ5V.cjs} +7 -7
  142. package/dist/{chunk-SK7QSNWE.mjs → chunk-MNJDNTGO.mjs} +1 -1
  143. package/dist/{chunk-5Y2P454O.cjs → chunk-MTBDJ326.cjs} +6 -5
  144. package/dist/{chunk-FIR62CR3.mjs → chunk-MV7NWU23.mjs} +1 -1
  145. package/dist/{chunk-7ONGIFYX.cjs → chunk-MZ4CRSY7.cjs} +481 -171
  146. package/dist/{chunk-O4F3JUST.mjs → chunk-NDDRTFN4.mjs} +4 -0
  147. package/dist/{chunk-4IHMHFQB.cjs → chunk-NG2EZ6QS.cjs} +28 -1
  148. package/dist/{chunk-XBSLKXBL.mjs → chunk-NT4W4H52.mjs} +52 -35
  149. package/dist/{chunk-UAQD67HM.mjs → chunk-NVOMQLI2.mjs} +16 -2
  150. package/dist/{chunk-R62SF5R4.mjs → chunk-OB45EAQL.mjs} +6 -1
  151. package/dist/{chunk-V56632LA.cjs → chunk-OCNV4CI2.cjs} +39 -6
  152. package/dist/{chunk-SYXPWJ7N.cjs → chunk-OFBLGH6V.cjs} +17 -18
  153. package/dist/{chunk-VQ4NWOWO.mjs → chunk-OGVTUGMU.mjs} +5 -13
  154. package/dist/{chunk-3UZVPO72.mjs → chunk-OIOPQ25L.mjs} +6 -7
  155. package/dist/{chunk-2XGBJSDV.cjs → chunk-OO7DYIJD.cjs} +73 -24
  156. package/dist/{chunk-27FPUFWR.mjs → chunk-P2NBQ5JI.mjs} +1 -1
  157. package/dist/{chunk-HZPKJRYA.cjs → chunk-PDFFYZAT.cjs} +2 -2
  158. package/dist/{chunk-GSVJ3IIF.cjs → chunk-PHCJJJZV.cjs} +2 -2
  159. package/dist/{chunk-EVMXPJCB.mjs → chunk-PKMUQ7LM.mjs} +2 -1
  160. package/dist/{chunk-OAJOQU5J.mjs → chunk-PLJKJJ2H.mjs} +82 -63
  161. package/dist/{chunk-72KCTHLV.cjs → chunk-PRL7FXG4.cjs} +113 -29
  162. package/dist/{chunk-6XQSPIN6.cjs → chunk-PWKAX5MS.cjs} +13 -3
  163. package/dist/{chunk-4ZJ5C7UJ.cjs → chunk-QIXEU2WV.cjs} +19 -10
  164. package/dist/{chunk-FJWN7RV4.cjs → chunk-QO43L7Z4.cjs} +38 -8
  165. package/dist/{chunk-X4K7TYN6.cjs → chunk-QOGIZKSO.cjs} +26 -25
  166. package/dist/{chunk-CNNBFGL5.cjs → chunk-QSUYB3RH.cjs} +14 -14
  167. package/dist/chunk-QYNZ3CTI.mjs +17 -0
  168. package/dist/{chunk-X3XUZWRB.mjs → chunk-R2ZHU37O.mjs} +36 -3
  169. package/dist/{chunk-ZIHWAN55.cjs → chunk-RE5E2G5S.cjs} +1 -1
  170. package/dist/{chunk-O75GQVUK.mjs → chunk-RLH5AH2M.mjs} +1 -1
  171. package/dist/chunk-RWR7SMD7.cjs +50 -0
  172. package/dist/{chunk-7PTISZSQ.cjs → chunk-S7MWSFFP.cjs} +4 -0
  173. package/dist/chunk-SD6JGJOM.mjs +50 -0
  174. package/dist/{chunk-7H4SVNC4.cjs → chunk-SPP3EZTJ.cjs} +46 -26
  175. package/dist/{chunk-BIF5MLTH.cjs → chunk-SQ6IWJ3H.cjs} +1 -1
  176. package/dist/{chunk-WVYRLP5E.mjs → chunk-T5XFZQCL.mjs} +1 -1
  177. package/dist/{chunk-WAY6LOQH.mjs → chunk-TEJ67GD2.mjs} +1 -1
  178. package/dist/{chunk-OP7LHY4Y.cjs → chunk-TNK2TVRS.cjs} +2005 -800
  179. package/dist/{chunk-IFTGERT3.mjs → chunk-TTXIITYA.mjs} +49 -0
  180. package/dist/{chunk-ZFWYCVKS.mjs → chunk-TY5KCYDE.mjs} +22 -4
  181. package/dist/{chunk-WYAXRIYP.cjs → chunk-UKZ6AWKZ.cjs} +10 -9
  182. package/dist/{chunk-UJ3R2AH2.cjs → chunk-UPOYKX4S.cjs} +5 -5
  183. package/dist/{chunk-VBCQ5WOI.cjs → chunk-URN7VFO7.cjs} +105 -16
  184. package/dist/{chunk-2DLGV2ZG.mjs → chunk-UTUS6JUH.mjs} +1 -21
  185. package/dist/{chunk-435QJNC2.mjs → chunk-VFNAK6A5.mjs} +4 -4
  186. package/dist/{chunk-WFWFECDW.mjs → chunk-VRGY3X2I.mjs} +100 -11
  187. package/dist/{chunk-LQNW3ABP.cjs → chunk-VX2HZGC7.cjs} +14 -14
  188. package/dist/chunk-W44X6IC2.cjs +97 -0
  189. package/dist/{chunk-A2MN5PQJ.mjs → chunk-WMLSZAKN.mjs} +9 -9
  190. package/dist/{chunk-672ISQIG.mjs → chunk-WPB67LE5.mjs} +379 -69
  191. package/dist/{chunk-3EEET2Q5.cjs → chunk-WUTFJOV7.cjs} +32 -12
  192. package/dist/chunk-WVQNXXNE.cjs +28 -0
  193. package/dist/{chunk-Y5TOT5F6.cjs → chunk-X3MHKLCO.cjs} +5 -5
  194. package/dist/{chunk-W2ZXMMHA.mjs → chunk-XCAQTCGK.mjs} +1 -1
  195. package/dist/{chunk-Z7P2BTZ3.cjs → chunk-XGTFLG73.cjs} +30 -12
  196. package/dist/{chunk-XCXHQBMM.mjs → chunk-Y2LU4LE5.mjs} +1 -1
  197. package/dist/{chunk-5J45H65F.mjs → chunk-Y5LEPEVH.mjs} +1 -1
  198. package/dist/{chunk-D4MRNBVF.cjs → chunk-Y6KHPJDB.cjs} +2 -2
  199. package/dist/{chunk-BT4SEFLC.cjs → chunk-YAEN3L2F.cjs} +3 -2
  200. package/dist/chunk-YFTGIHNC.mjs +26 -0
  201. package/dist/{chunk-KL7SHLQB.mjs → chunk-YGJ5P3TJ.mjs} +31 -1
  202. package/dist/{chunk-752IHQTD.cjs → chunk-YTNBCXCW.cjs} +12 -12
  203. package/dist/{chunk-RFKTJTWZ.mjs → chunk-YVPX5PI5.mjs} +3 -1
  204. package/dist/{chunk-4TVPYN32.cjs → chunk-Z3PW3DIR.cjs} +7 -7
  205. package/dist/{chunk-OB7VKCUZ.mjs → chunk-Z6SOXHAD.mjs} +1851 -646
  206. package/dist/{chunk-72KABRWN.mjs → chunk-ZJGFAW5U.mjs} +5 -3
  207. package/dist/{chunk-TNBJ4LZG.mjs → chunk-ZPKJPM7K.mjs} +4 -4
  208. package/dist/{chunk-5FE5YT2N.mjs → chunk-ZZGQD3LL.mjs} +28 -1
  209. package/dist/client/lifecycle.cjs +2 -2
  210. package/dist/client/lifecycle.d.mts +1 -1
  211. package/dist/client/lifecycle.d.ts +1 -1
  212. package/dist/client/lifecycle.mjs +1 -1
  213. package/dist/{client-component.d-D74pqdea.d.mts → client-component.d-BvQOxSqh.d.mts} +2 -2
  214. package/dist/{client-component.d-D8VcypQA.d.ts → client-component.d-DNVSLEPi.d.ts} +2 -2
  215. package/dist/client-plugins.cjs +2 -2
  216. package/dist/{client-plugins.d-D4-6hNx7.d.mts → client-plugins.d-CE1lVK2R.d.mts} +116 -373
  217. package/dist/{client-plugins.d-CXElzotB.d.ts → client-plugins.d-CNDqcAuf.d.ts} +116 -373
  218. package/dist/client-plugins.d.mts +10 -8
  219. package/dist/client-plugins.d.ts +10 -8
  220. package/dist/client-plugins.mjs +1 -1
  221. package/dist/client.cjs +11 -9
  222. package/dist/client.d.mts +17 -15
  223. package/dist/client.d.ts +17 -15
  224. package/dist/client.mjs +10 -8
  225. package/dist/{config.d-qt-mE8O5.d.mts → config.d-BKIhJtmr.d.mts} +7 -2
  226. package/dist/{config.d-qt-mE8O5.d.ts → config.d-BKIhJtmr.d.ts} +7 -2
  227. package/dist/config.d.mts +10 -8
  228. package/dist/config.d.ts +10 -8
  229. package/dist/cron.cjs +2 -2
  230. package/dist/cron.mjs +1 -1
  231. package/dist/deferred.cjs +2 -2
  232. package/dist/deferred.mjs +1 -1
  233. package/dist/deployment.cjs +4 -2
  234. package/dist/deployment.d.mts +15 -1
  235. package/dist/deployment.d.ts +15 -1
  236. package/dist/deployment.mjs +3 -1
  237. package/dist/desktop.d.mts +11 -9
  238. package/dist/desktop.d.ts +11 -9
  239. package/dist/{devtools-NZUVNUP3.mjs → devtools-2A2GPC7B.mjs} +33 -29
  240. package/dist/{devtools-N2JQCMXB.cjs → devtools-R27T3BRY.cjs} +38 -34
  241. package/dist/docs.cjs +28 -27
  242. package/dist/docs.d.mts +24 -10
  243. package/dist/docs.d.ts +24 -10
  244. package/dist/docs.mjs +27 -26
  245. package/dist/env-types.cjs +3 -3
  246. package/dist/env-types.mjs +2 -2
  247. package/dist/environment/vite.cjs +7 -7
  248. package/dist/environment/vite.d.mts +1 -1
  249. package/dist/environment/vite.d.ts +1 -1
  250. package/dist/environment/vite.mjs +6 -6
  251. package/dist/{generate-route-types.d-BL2pq6xC.d.ts → generate-route-types.d-B76M5R11.d.ts} +1 -1
  252. package/dist/{generate-route-types.d-BoVDU8qX.d.mts → generate-route-types.d-CaGMIaNI.d.mts} +1 -1
  253. package/dist/headers.cjs +3 -3
  254. package/dist/headers.mjs +2 -2
  255. package/dist/image/server.d.mts +1 -1
  256. package/dist/image/server.d.ts +1 -1
  257. package/dist/image/sharp.d.mts +1 -1
  258. package/dist/image/sharp.d.ts +1 -1
  259. package/dist/{image-config.d-CeDgNyX4.d.mts → image-config.d-ByhQ0TT7.d.mts} +3 -1
  260. package/dist/{image-config.d-CeDgNyX4.d.ts → image-config.d-ByhQ0TT7.d.ts} +3 -1
  261. package/dist/image.cjs +6 -6
  262. package/dist/image.d.mts +1 -1
  263. package/dist/image.d.ts +1 -1
  264. package/dist/image.mjs +1 -1
  265. package/dist/index.cjs +148 -128
  266. package/dist/{index.d-SSgYDv4D.d.mts → index.d-Bt3kl19W.d.mts} +1 -1
  267. package/dist/{index.d-A_x10zGS.d.ts → index.d-Cx_-DaKV.d.ts} +1 -1
  268. package/dist/index.d.mts +39 -87
  269. package/dist/index.d.ts +39 -87
  270. package/dist/index.mjs +224 -204
  271. package/dist/instrumentation.cjs +3 -3
  272. package/dist/instrumentation.mjs +2 -2
  273. package/dist/{integration-orm-52GPGTHO.cjs → integrations/orm.cjs} +5 -5
  274. package/dist/integrations/orm.d.mts +35 -0
  275. package/dist/integrations/orm.d.ts +35 -0
  276. package/dist/{integration-orm-CO23MSFE.mjs → integrations/orm.mjs} +5 -5
  277. package/dist/integrations.cjs +6 -5
  278. package/dist/integrations.d.mts +10 -8
  279. package/dist/integrations.d.ts +10 -8
  280. package/dist/integrations.mjs +5 -4
  281. package/dist/internal/app-markdown-runtime.cjs +4 -4
  282. package/dist/internal/app-markdown-runtime.d.mts +27 -11
  283. package/dist/internal/app-markdown-runtime.d.ts +27 -11
  284. package/dist/internal/app-markdown-runtime.mjs +3 -3
  285. package/dist/internal/build-runtime.cjs +76 -71
  286. package/dist/internal/build-runtime.d.mts +12 -10
  287. package/dist/internal/build-runtime.d.ts +12 -10
  288. package/dist/internal/build-runtime.mjs +75 -70
  289. package/dist/internal/cli-runtime.cjs +47 -46
  290. package/dist/internal/cli-runtime.mjs +46 -45
  291. package/dist/internal/client-error-overlay.cjs +6 -6
  292. package/dist/internal/client-error-overlay.mjs +2 -2
  293. package/dist/internal/client-runtime.cjs +85 -36
  294. package/dist/internal/client-runtime.d.mts +44 -13
  295. package/dist/internal/client-runtime.d.ts +44 -13
  296. package/dist/internal/client-runtime.mjs +79 -30
  297. package/dist/internal/compression-runtime.d.mts +10 -8
  298. package/dist/internal/compression-runtime.d.ts +10 -8
  299. package/dist/internal/config-runtime.cjs +27 -26
  300. package/dist/internal/config-runtime.d.mts +14 -12
  301. package/dist/internal/config-runtime.d.ts +14 -12
  302. package/dist/internal/config-runtime.mjs +26 -25
  303. package/dist/internal/docs-precompiled-runtime.cjs +16 -5
  304. package/dist/internal/docs-precompiled-runtime.d.mts +7 -0
  305. package/dist/internal/docs-precompiled-runtime.d.ts +7 -0
  306. package/dist/internal/docs-precompiled-runtime.mjs +15 -4
  307. package/dist/internal/form-actions.cjs +7 -2
  308. package/dist/internal/form-actions.d.mts +10 -3
  309. package/dist/internal/form-actions.d.ts +10 -3
  310. package/dist/internal/form-actions.mjs +8 -3
  311. package/dist/internal/infra-analytics-runtime.cjs +11 -11
  312. package/dist/internal/infra-analytics-runtime.mjs +9 -9
  313. package/dist/internal/islands-boot.cjs +6 -1
  314. package/dist/internal/islands-boot.mjs +6 -1
  315. package/dist/internal/islands-runtime.cjs +33 -4
  316. package/dist/internal/islands-runtime.d.mts +1 -1
  317. package/dist/internal/islands-runtime.d.ts +1 -1
  318. package/dist/internal/islands-runtime.mjs +31 -2
  319. package/dist/internal/native-server-fns.cjs +5 -5
  320. package/dist/internal/native-server-fns.mjs +4 -4
  321. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  322. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  323. package/dist/internal/production-node-env.cjs +4 -2
  324. package/dist/internal/production-node-env.d.mts +22 -1
  325. package/dist/internal/production-node-env.d.ts +22 -1
  326. package/dist/internal/production-node-env.mjs +3 -1
  327. package/dist/internal/production-runtime.cjs +57 -39
  328. package/dist/internal/production-runtime.d.mts +27 -21
  329. package/dist/internal/production-runtime.d.ts +27 -21
  330. package/dist/internal/production-runtime.mjs +72 -54
  331. package/dist/internal/react-cache.cjs +3 -3
  332. package/dist/internal/react-cache.mjs +1 -1
  333. package/dist/internal/server-tree.cjs +2 -2
  334. package/dist/internal/server-tree.d.mts +0 -5
  335. package/dist/internal/server-tree.d.ts +0 -5
  336. package/dist/internal/server-tree.mjs +1 -1
  337. package/dist/internal/vercel-edge-middleware.cjs +87 -0
  338. package/dist/internal/vercel-edge-middleware.d.mts +39 -0
  339. package/dist/internal/vercel-edge-middleware.d.ts +39 -0
  340. package/dist/internal/vercel-edge-middleware.mjs +87 -0
  341. package/dist/layers-7P4RLKVX.cjs +20 -0
  342. package/dist/{layers-T55SA47E.mjs → layers-XQ7VFMWO.mjs} +4 -2
  343. package/dist/{layers.d-CcS42OGR.d.mts → layers.d-CH0bC4QL.d.mts} +2 -1
  344. package/dist/{layers.d-CcS42OGR.d.ts → layers.d-CH0bC4QL.d.ts} +2 -1
  345. package/dist/{lifecycle.d-C2aLBOwu.d.ts → lifecycle.d-keQs5Swc.d.mts} +7 -1
  346. package/dist/{lifecycle.d-C2aLBOwu.d.mts → lifecycle.d-keQs5Swc.d.ts} +7 -1
  347. package/dist/{manager-H5ZM3HAM.mjs → manager-JIA66YJ2.mjs} +4 -3
  348. package/dist/manager-JOHU6BQI.cjs +15 -0
  349. package/dist/markdown.cjs +7 -3
  350. package/dist/markdown.d.mts +10 -8
  351. package/dist/markdown.d.ts +10 -8
  352. package/dist/markdown.mjs +6 -2
  353. package/dist/middleware.cjs +11 -11
  354. package/dist/middleware.d.mts +13 -10
  355. package/dist/middleware.d.ts +13 -10
  356. package/dist/middleware.mjs +13 -13
  357. package/dist/mobile.d.mts +6 -6
  358. package/dist/mobile.d.ts +6 -6
  359. package/dist/mount.d-Bki4pOaJ.d.mts +38 -0
  360. package/dist/mount.d-DjR5aerM.d.ts +38 -0
  361. package/dist/{native-server-fn-handler-GLRHAYWV.mjs → native-server-fn-handler-EP5AFJYE.mjs} +5 -5
  362. package/dist/{native-server-fn-handler-J5MYRXN6.cjs → native-server-fn-handler-QRTXGZA4.cjs} +6 -6
  363. package/dist/{native-tree-7LPH57Z4.cjs → native-tree-W2SSJB3Y.cjs} +4 -4
  364. package/dist/{native-tree-VV6WN3GX.mjs → native-tree-Y5YQANW7.mjs} +3 -3
  365. package/dist/{navigation-delegate.d-GghbHJuK.d.ts → navigation-delegate.d-CtghaSP3.d.ts} +1 -1
  366. package/dist/{navigation-delegate.d-DQVYKoaZ.d.mts → navigation-delegate.d-VDkziXTK.d.mts} +1 -1
  367. package/dist/navigation.cjs +8 -7
  368. package/dist/navigation.d.mts +13 -11
  369. package/dist/navigation.d.ts +13 -11
  370. package/dist/navigation.mjs +7 -6
  371. package/dist/{nitro-DD4QCA66.mjs → nitro-NSTXT7LB.mjs} +11 -11
  372. package/dist/{nitro-VRDX2H4M.cjs → nitro-Y3LGITW3.cjs} +13 -13
  373. package/dist/node-module-bundle-LIZ2KMVW.cjs +13 -0
  374. package/dist/node-module-bundle-VR6NV6AI.mjs +13 -0
  375. package/dist/{plugin-53SY5YBS.mjs → plugin-SAS22JL7.mjs} +4 -3
  376. package/dist/{plugin-HZIBL3DW.cjs → plugin-WIU4GDD4.cjs} +5 -4
  377. package/dist/plugin.cjs +65 -63
  378. package/dist/plugin.d.mts +12 -10
  379. package/dist/plugin.d.ts +12 -10
  380. package/dist/plugin.mjs +64 -62
  381. package/dist/{production-runtime.d-Bzns3NW9.d.ts → production-runtime.d-BMyyLGBB.d.ts} +3 -57
  382. package/dist/{production-runtime.d-DiFa5vHW.d.mts → production-runtime.d-DMZY3OgV.d.mts} +3 -57
  383. package/dist/query/client.cjs +9 -7
  384. package/dist/query/client.mjs +5 -3
  385. package/dist/{render-plan.d-CcF0MeCf.d.mts → render-plan.d-BSwV8PE4.d.mts} +1 -1
  386. package/dist/{render-plan.d-CL_Ikfg_.d.ts → render-plan.d-i9sI4tc9.d.ts} +1 -1
  387. package/dist/renderer/none/server.cjs +35 -0
  388. package/dist/renderer/none/server.d.mts +21 -0
  389. package/dist/renderer/none/server.d.ts +21 -0
  390. package/dist/renderer/none/server.mjs +35 -0
  391. package/dist/renderer/react/server.cjs +3 -3
  392. package/dist/renderer/react/server.mjs +3 -3
  393. package/dist/renderer-client.cjs +8 -6
  394. package/dist/renderer-client.d.mts +13 -11
  395. package/dist/renderer-client.d.ts +13 -11
  396. package/dist/renderer-client.mjs +5 -3
  397. package/dist/renderer.cjs +6 -2
  398. package/dist/renderer.d.mts +25 -2
  399. package/dist/renderer.d.ts +25 -2
  400. package/dist/renderer.mjs +5 -1
  401. package/dist/request.cjs +2 -2
  402. package/dist/{request.d-DarDOCk9.d.mts → request.d-C24FNQ_7.d.mts} +1 -1
  403. package/dist/{request.d-B1RnTLri.d.ts → request.d-Dgln8tuI.d.ts} +1 -1
  404. package/dist/request.d.mts +11 -9
  405. package/dist/request.d.ts +11 -9
  406. package/dist/request.mjs +1 -1
  407. package/dist/{route-rendering.d-BTUYCIj4.d.ts → route-rendering.d-CUylZKJA.d.ts} +1 -1
  408. package/dist/{route-rendering.d-D_2Ual0-.d.mts → route-rendering.d-Ds0BfwQi.d.mts} +1 -1
  409. package/dist/{route.d-BaVH3V0w.d.mts → route.d-DrXkpvcg.d.mts} +1 -1
  410. package/dist/{route.d-DBTEqifW.d.ts → route.d-hs-_cyHn.d.ts} +1 -1
  411. package/dist/{router.d-CMANF6da.d.ts → router.d-B56rMOFm.d.ts} +1 -1
  412. package/dist/{router.d-Cuv1jntg.d.mts → router.d-CFPcbqzc.d.mts} +1 -1
  413. package/dist/routes.cjs +3 -3
  414. package/dist/{routes.d-B6yFe6jm.d.ts → routes.d-9GFFNioh.d.ts} +2 -2
  415. package/dist/{routes.d-c2HKfrfL.d.mts → routes.d-CrEy0lJS.d.mts} +2 -2
  416. package/dist/routes.d.mts +10 -8
  417. package/dist/routes.d.ts +10 -8
  418. package/dist/routes.mjs +2 -2
  419. package/dist/{rsc-pipeline-Z7QBZOIJ.cjs → rsc-pipeline-3T7V6OUT.cjs} +30 -28
  420. package/dist/{rsc-pipeline-7PNVJSTR.mjs → rsc-pipeline-GA4AQWZI.mjs} +29 -27
  421. package/dist/{runtime-FKFCUHSK.cjs → runtime-REUTNTI5.cjs} +72 -46
  422. package/dist/{runtime-QQHX4BP3.mjs → runtime-ZYCKKY7L.mjs} +60 -34
  423. package/dist/{runtime.d-wvh4ngU0.d.mts → runtime.d-DLRO-ExG.d.mts} +11 -3
  424. package/dist/{runtime.d-C3RQUj6_.d.ts → runtime.d-H7k9hOQE.d.ts} +11 -3
  425. package/dist/{schema-dev-notice-JMXEQWIQ.mjs → schema-dev-notice-C2JINRZI.mjs} +3 -2
  426. package/dist/{schema-dev-notice-PLBFDTOF.cjs → schema-dev-notice-X7GG7QVB.cjs} +5 -4
  427. package/dist/schema.cjs +6 -2
  428. package/dist/schema.d-Dny9pnrm.d.mts +298 -0
  429. package/dist/schema.d-Dny9pnrm.d.ts +298 -0
  430. package/dist/schema.d.mts +1 -115
  431. package/dist/schema.d.ts +1 -115
  432. package/dist/schema.mjs +5 -1
  433. package/dist/server-fn-client.d.mts +2 -2
  434. package/dist/server-fn-client.d.ts +2 -2
  435. package/dist/server-fn.cjs +5 -5
  436. package/dist/server-fn.mjs +4 -4
  437. package/dist/server-http.d-rAe7lAQc.d.mts +70 -0
  438. package/dist/server-http.d-rAe7lAQc.d.ts +70 -0
  439. package/dist/server-plugins.cjs +7 -7
  440. package/dist/server-plugins.d.mts +20 -12
  441. package/dist/server-plugins.d.ts +20 -12
  442. package/dist/server-plugins.mjs +8 -8
  443. package/dist/server-query.cjs +6 -6
  444. package/dist/server-query.mjs +5 -5
  445. package/dist/server.cjs +168 -126
  446. package/dist/server.d-C5FFrZAo.d.ts +57 -0
  447. package/dist/server.d-DgC8xew5.d.mts +57 -0
  448. package/dist/server.d.mts +24 -16
  449. package/dist/server.d.ts +24 -16
  450. package/dist/server.mjs +144 -102
  451. package/dist/{spa-router.d-m8H_Kl_B.d.ts → spa-router.d-Dr7oanhl.d.ts} +15 -5
  452. package/dist/{spa-router.d-WU_qS5gJ.d.mts → spa-router.d-g4CzhEH1.d.mts} +15 -5
  453. package/dist/testing.cjs +17 -17
  454. package/dist/testing.d.mts +10 -8
  455. package/dist/testing.d.ts +10 -8
  456. package/dist/testing.mjs +13 -13
  457. package/dist/theme/server.cjs +3 -3
  458. package/dist/theme/server.mjs +2 -2
  459. package/dist/types.d-xCIhyjOq.d.mts +233 -0
  460. package/dist/types.d-xCIhyjOq.d.ts +233 -0
  461. package/dist/{utils.d-C9dQD5Zg.d.ts → utils.d-BxxyDEb8.d.ts} +1 -1
  462. package/dist/{utils.d-W9IiEqmW.d.mts → utils.d-HIla3pD_.d.mts} +1 -1
  463. package/dist/version.cjs +2 -2
  464. package/dist/version.mjs +1 -1
  465. package/dist/vite.cjs +65 -63
  466. package/dist/vite.d.mts +36 -14
  467. package/dist/vite.d.ts +36 -14
  468. package/dist/vite.mjs +64 -62
  469. package/dist/workflows.cjs +4 -4
  470. package/dist/workflows.d.mts +121 -1
  471. package/dist/workflows.d.ts +121 -1
  472. package/dist/workflows.mjs +3 -3
  473. package/package.json +37 -2
  474. package/dist/analyzer-H7SIX6BJ.cjs +0 -16
  475. package/dist/chunk-5YPBFMBN.cjs +0 -19
  476. package/dist/chunk-CLFEQGET.cjs +0 -60
  477. package/dist/chunk-MK5E44WP.mjs +0 -60
  478. package/dist/chunk-OM7WILES.mjs +0 -100
  479. package/dist/chunk-Q5B4LNON.mjs +0 -19
  480. package/dist/chunk-QPJ4MZTO.mjs +0 -60
  481. package/dist/chunk-R53QDV6T.cjs +0 -100
  482. package/dist/chunk-UYTAP4FQ.cjs +0 -60
  483. package/dist/layers-DMRXRL7F.cjs +0 -18
  484. package/dist/manager-2LUKNX2N.cjs +0 -14
  485. package/dist/node-module-bundle-7JHPPF6B.mjs +0 -11
  486. package/dist/node-module-bundle-YJGYBOGK.cjs +0 -11
  487. package/dist/workflows.d-CRMzQZ3k.d.mts +0 -188
  488. package/dist/workflows.d-CRMzQZ3k.d.ts +0 -188
  489. /package/dist/{chunk-QGOZLGVP.mjs → chunk-I6FIAWNT.mjs} +0 -0
  490. /package/dist/{chunk-XPIPMWY3.cjs → chunk-K5NI5YQR.cjs} +0 -0
  491. /package/dist/{chunk-NWUHS6GV.cjs → chunk-QEJWNXRI.cjs} +0 -0
  492. /package/dist/{chunk-FSXSQQTV.mjs → chunk-TXE4SAMV.mjs} +0 -0
  493. /package/dist/{chunk-ZXK2EYQW.cjs → chunk-UUQNJDGH.cjs} +0 -0
  494. /package/dist/{chunk-46P5KNTE.mjs → chunk-VZBAW44S.mjs} +0 -0
@@ -1,6 +1,7 @@
1
1
  import {
2
- createFarmMetadataImageResponse
3
- } from "./chunk-CROAFCMW.mjs";
2
+ resolveFarmAppClientEntry,
3
+ resolveFarmClientPlugins
4
+ } from "./chunk-DXZ57EPE.mjs";
4
5
  import {
5
6
  resolveFarmPlatform
6
7
  } from "./chunk-SMUW7UST.mjs";
@@ -8,7 +9,10 @@ import {
8
9
  collectSSGPages,
9
10
  matchSSGPage,
10
11
  resolveRouteRenderingConfigFromFile
11
- } from "./chunk-BM2LH2JM.mjs";
12
+ } from "./chunk-G7NBPP7H.mjs";
13
+ import {
14
+ createFarmMetadataImageResponse
15
+ } from "./chunk-CROAFCMW.mjs";
12
16
  import {
13
17
  classifyFarmDocumentPrefix,
14
18
  composeFarmFullDocument,
@@ -35,13 +39,10 @@ import {
35
39
  renderFarmLocaleAlternateLinks,
36
40
  resolveDefaultErrorStatus,
37
41
  routeBoundaryCoversDirectory
38
- } from "./chunk-TNBJ4LZG.mjs";
39
- import {
40
- handleFarmFormActionRequest
41
- } from "./chunk-MK5E44WP.mjs";
42
+ } from "./chunk-ZPKJPM7K.mjs";
42
43
  import {
43
44
  listFarmMCPLlmsTxtLinks
44
- } from "./chunk-435QJNC2.mjs";
45
+ } from "./chunk-VFNAK6A5.mjs";
45
46
  import {
46
47
  FARM_DEFAULT_MCP_PATH,
47
48
  collectFarmDefaultMCPPages,
@@ -49,7 +50,12 @@ import {
49
50
  farmConfigMountsMCP,
50
51
  isFarmDefaultMCPPathname,
51
52
  resolveFarmDefaultMCPServer
52
- } from "./chunk-MESQF2JC.mjs";
53
+ } from "./chunk-K6SXMVXO.mjs";
54
+ import {
55
+ getFarmFormState,
56
+ handleFarmFormActionRequest,
57
+ renderFarmFormStateScript
58
+ } from "./chunk-ICFPTHXM.mjs";
53
59
  import {
54
60
  installFarmIslandValues,
55
61
  uninstallFarmIslandValues
@@ -68,11 +74,16 @@ import {
68
74
  resolveFarmIsolatedClientHydrationMode,
69
75
  resolveImportedModule,
70
76
  resolveProgrammaticClientRoutes,
77
+ runWithPackageClientBoundaryCacheFile,
71
78
  usesFarmServerTree
72
- } from "./chunk-672ISQIG.mjs";
79
+ } from "./chunk-WPB67LE5.mjs";
73
80
  import {
74
81
  FARM_ISLAND_REPLAYABLE_SELECTOR
75
82
  } from "./chunk-S32PDOLO.mjs";
83
+ import {
84
+ _setDefaultFarmThemeConfig,
85
+ getTheme
86
+ } from "./chunk-GJ7QVFAG.mjs";
76
87
  import {
77
88
  isSecretDocsConfigKey
78
89
  } from "./chunk-EJCVG25Z.mjs";
@@ -82,7 +93,7 @@ import {
82
93
  } from "./chunk-TPA2PV5J.mjs";
83
94
  import {
84
95
  normalizeRouteRules
85
- } from "./chunk-X3XUZWRB.mjs";
96
+ } from "./chunk-R2ZHU37O.mjs";
86
97
  import {
87
98
  resolveFarmDevtoolsConfig
88
99
  } from "./chunk-CU5SYTJG.mjs";
@@ -92,7 +103,17 @@ import {
92
103
  resolveFarmAgentCrawlers,
93
104
  resolveFarmAgentSitemap,
94
105
  resolveFarmPerformanceConfig
95
- } from "./chunk-VQ4NWOWO.mjs";
106
+ } from "./chunk-OGVTUGMU.mjs";
107
+ import {
108
+ collectFarmLlmsTxtPages,
109
+ createFarmDefaultLlmsTxt,
110
+ createFarmLlmsMarkdownReader,
111
+ isFarmPageNoIndex,
112
+ readFarmLlmsMarkdownFrom,
113
+ renderFarmLlmsFullTxt,
114
+ resolveFarmAgentOrigin,
115
+ resolveFarmLlmsTxtConfig
116
+ } from "./chunk-YGJ5P3TJ.mjs";
96
117
  import {
97
118
  createFarmCspNonce,
98
119
  createFarmCspNonceRewriter,
@@ -101,42 +122,42 @@ import {
101
122
  resolveFarmSecurityConfig,
102
123
  stampFarmCspNonce
103
124
  } from "./chunk-22W4FNTG.mjs";
104
- import {
105
- collectFarmLlmsTxtPages,
106
- createFarmDefaultLlmsTxt,
107
- createFarmLlmsMarkdownReader,
108
- renderFarmLlmsFullTxt,
109
- resolveFarmLlmsTxtConfig
110
- } from "./chunk-KL7SHLQB.mjs";
111
125
  import {
112
126
  resolveFarmServerComponentsMode
113
- } from "./chunk-CJNAUEVC.mjs";
127
+ } from "./chunk-4QENVMG7.mjs";
114
128
  import {
115
129
  getFarmAppDirectories,
116
130
  getFarmSourceRoots
117
- } from "./chunk-52Y3C3HG.mjs";
131
+ } from "./chunk-E7VF3LQ5.mjs";
118
132
  import {
119
133
  assertFarmRendererStreamingRuntime,
120
134
  getFarmRendererCapabilities,
121
135
  getFarmRendererComponentExtensions,
122
136
  getFarmRendererStreamingCapabilitiesForRuntime,
137
+ isFarmRendererDisabled,
123
138
  isReactRenderer,
124
139
  readFarmRendererWebStream,
125
140
  resolveFarmComponentExtensions,
126
141
  resolveFarmRenderer,
127
142
  resolveFarmRendererAppSetup,
128
143
  resolveFarmRendererModule
129
- } from "./chunk-ES2LD2YD.mjs";
144
+ } from "./chunk-GCRT6GJG.mjs";
130
145
  import {
131
146
  resolveFarmImageConfig
132
- } from "./chunk-2NGZFOKG.mjs";
147
+ } from "./chunk-AOIUYHPH.mjs";
148
+ import {
149
+ resolveCronConfig
150
+ } from "./chunk-ME7RVELR.mjs";
151
+ import {
152
+ resolveServerActionsConfig
153
+ } from "./chunk-E46NXBNJ.mjs";
133
154
  import {
134
155
  createFarmMarkdownRouteModuleFromFile,
135
156
  loadFarmMdxComponents
136
- } from "./chunk-FIR62CR3.mjs";
157
+ } from "./chunk-MV7NWU23.mjs";
137
158
  import {
138
159
  isFarmMarkdownPageFile
139
- } from "./chunk-RVGSVQWT.mjs";
160
+ } from "./chunk-HEJM46HQ.mjs";
140
161
  import {
141
162
  resolveFarmMdxComponentsModulePath,
142
163
  resolveMdxConfig
@@ -149,23 +170,18 @@ import {
149
170
  farmRequestWantsMarkdown,
150
171
  getFarmMarkdownAlternatePath,
151
172
  resolveMarkdownConfig
152
- } from "./chunk-K7OZAVOI.mjs";
173
+ } from "./chunk-IFR74W6S.mjs";
153
174
  import {
154
175
  resolveWorkflowsConfig
155
- } from "./chunk-TZVUF5JJ.mjs";
156
- import {
157
- resolveCronConfig
158
- } from "./chunk-DQF3QLOH.mjs";
159
- import {
160
- resolveServerActionsConfig
161
- } from "./chunk-E46NXBNJ.mjs";
162
- import {
163
- _setDefaultFarmThemeConfig,
164
- getTheme
165
- } from "./chunk-EMDGXYUD.mjs";
176
+ } from "./chunk-MGZVDX4R.mjs";
166
177
  import {
167
178
  resolveFarmThemeConfig
168
179
  } from "./chunk-YWPNIYUP.mjs";
180
+ import {
181
+ getIntegrationProviders,
182
+ getRegisteredIntegrationAPIManifest,
183
+ isFarmIntegrationProviderComponentReference
184
+ } from "./chunk-AJNBTOVQ.mjs";
169
185
  import {
170
186
  initStorage
171
187
  } from "./chunk-TJVUTGED.mjs";
@@ -173,11 +189,6 @@ import {
173
189
  resolveFarmRouteContext,
174
190
  withFarmRouteContext
175
191
  } from "./chunk-BMQAPZXD.mjs";
176
- import {
177
- getIntegrationProviders,
178
- getRegisteredIntegrationAPIManifest,
179
- isFarmIntegrationProviderComponentReference
180
- } from "./chunk-TGULJSHD.mjs";
181
192
  import {
182
193
  createRouteSlotContainerId,
183
194
  parseRouteSlotFile
@@ -191,7 +202,7 @@ import {
191
202
  import {
192
203
  findProgrammaticRouteFiles,
193
204
  loadProgrammaticRouteManifests
194
- } from "./chunk-FSXSQQTV.mjs";
205
+ } from "./chunk-TXE4SAMV.mjs";
195
206
  import {
196
207
  _runWithFarmI18nRequest,
197
208
  _setDefaultFarmI18nRuntime,
@@ -215,12 +226,15 @@ import {
215
226
  normalizeFarmRouteRuntimeConfig,
216
227
  resolveFarmRouteRuleRuntimeConfig,
217
228
  resolveFarmRouteRuntimeConfig
218
- } from "./chunk-EVMXPJCB.mjs";
229
+ } from "./chunk-PKMUQ7LM.mjs";
219
230
  import {
220
231
  configureFarmCache,
221
232
  getFarmDataCache,
222
233
  normalizeRevalidatePath
223
234
  } from "./chunk-RLEALQEN.mjs";
235
+ import {
236
+ sendWebResponse
237
+ } from "./chunk-CO6UYM2D.mjs";
224
238
  import {
225
239
  toFileModuleUrl
226
240
  } from "./chunk-VHIXGZYH.mjs";
@@ -244,17 +258,6 @@ import {
244
258
  toRootRelativeUrlPath,
245
259
  toViteModuleId
246
260
  } from "./chunk-JSDV2NUN.mjs";
247
- import {
248
- createFarmSearchParams,
249
- searchParamsToObject
250
- } from "./chunk-H3ASZDT7.mjs";
251
- import {
252
- configureFarmObservability,
253
- emitFarmEvent
254
- } from "./chunk-2DA7CLY7.mjs";
255
- import {
256
- sendWebResponse
257
- } from "./chunk-CO6UYM2D.mjs";
258
261
  import {
259
262
  resolveFarmAPIServerBasePath
260
263
  } from "./chunk-2I6PUKWJ.mjs";
@@ -265,13 +268,21 @@ import {
265
268
  import {
266
269
  getRequestContextSnapshot
267
270
  } from "./chunk-D2LCAV6L.mjs";
271
+ import {
272
+ createFarmSearchParams,
273
+ searchParamsToObject
274
+ } from "./chunk-H3ASZDT7.mjs";
275
+ import {
276
+ configureFarmObservability,
277
+ emitFarmEvent
278
+ } from "./chunk-2DA7CLY7.mjs";
268
279
  import {
269
280
  FARM_VERSION
270
- } from "./chunk-MPIGW42F.mjs";
281
+ } from "./chunk-F6CMGWAL.mjs";
271
282
  import {
272
283
  resolveFarmTrailingSlashRedirect,
273
284
  setFarmTrailingSlashPreference
274
- } from "./chunk-RFKTJTWZ.mjs";
285
+ } from "./chunk-YVPX5PI5.mjs";
275
286
  import {
276
287
  normalizeFarmAPIConfig
277
288
  } from "./chunk-W6QLRQ3V.mjs";
@@ -279,6 +290,9 @@ import {
279
290
  createFarmLocaleCookie,
280
291
  getFarmLocaleVaryHeaders
281
292
  } from "./chunk-K76CBYQM.mjs";
293
+ import {
294
+ getFarmPageDataRedirect
295
+ } from "./chunk-SD6JGJOM.mjs";
282
296
  import {
283
297
  addMetadataImageReference,
284
298
  addMetadataMarkdownAlternate,
@@ -291,11 +305,11 @@ import {
291
305
  import {
292
306
  FARM_DEPLOYMENT_ID_HEADER,
293
307
  createFarmDeploymentCookie
294
- } from "./chunk-UAQD67HM.mjs";
308
+ } from "./chunk-NVOMQLI2.mjs";
295
309
  import {
296
310
  prepareDeferredData,
297
311
  snapshotDeferredData
298
- } from "./chunk-K5EW7GUU.mjs";
312
+ } from "./chunk-7BIW7VCW.mjs";
299
313
  import {
300
314
  createFarmCacheKey
301
315
  } from "./chunk-GLOICKDO.mjs";
@@ -303,10 +317,8 @@ import {
303
317
  appendFarmRedirectQuery
304
318
  } from "./chunk-XQ4DPO4G.mjs";
305
319
  import {
306
- getFarmRedirectError,
307
- isFarmNotFoundError,
308
- isFarmRedirectError
309
- } from "./chunk-JNYFXL7X.mjs";
320
+ encodeConfigRouteSegment
321
+ } from "./chunk-JZGL2PIH.mjs";
310
322
  import {
311
323
  _getRequestReadCount,
312
324
  _runWithCurrentRequest,
@@ -314,11 +326,16 @@ import {
314
326
  createWebRequestFromFarmRequest,
315
327
  getCurrentRequestOrNull,
316
328
  resolveFarmRequestURL
317
- } from "./chunk-6HRAK7I5.mjs";
329
+ } from "./chunk-5OFNUETM.mjs";
318
330
  import {
319
331
  _peekCurrentRequest,
320
332
  _resolveCurrentCspNonce
321
333
  } from "./chunk-VIXTAVEA.mjs";
334
+ import {
335
+ getFarmRedirectError,
336
+ isFarmNotFoundError,
337
+ isFarmRedirectError
338
+ } from "./chunk-JNYFXL7X.mjs";
322
339
  import {
323
340
  localizeFarmHref,
324
341
  localizeFarmPathname,
@@ -516,9 +533,14 @@ var RouteManager = class {
516
533
  const routePathname = this.toRoutePathname(pathname);
517
534
  const normalizedPath = routePathname === "/" ? "/" : routePathname.replace(/\/$/, "");
518
535
  const pathParts = splitRoutePath(normalizedPath);
536
+ const trimmedPathname = routePathname.replace(/\/+$/, "");
537
+ const hasEmptySegment = trimmedPathname.includes("//") || trimmedPathname === "" && routePathname.length > 1;
519
538
  let matchedRoute = null;
520
539
  let params = {};
521
540
  for (const routeEntry of this.routes.values()) {
541
+ if (hasEmptySegment && !routeEntry.route.segments.some((segment) => segment.isDynamic)) {
542
+ continue;
543
+ }
522
544
  const match = matchRouteParts(pathParts, routeEntry.route.segments);
523
545
  if (match.matches) {
524
546
  matchedRoute = routeEntry;
@@ -550,6 +572,11 @@ var RouteManager = class {
550
572
  getRouteSlots() {
551
573
  return new Map(this.routeSlots);
552
574
  }
575
+ /** The layouts that wrap a registered page, root first. */
576
+ getRouteLayouts(pattern) {
577
+ const routeEntry = this.routes.get(pattern);
578
+ return routeEntry ? this.findMatchingLayouts(splitRoutePath(pattern), routeEntry) : [];
579
+ }
553
580
  /** Resolve route rules, inherited layouts, and the page export in precedence order. */
554
581
  async resolveRouteRuntimeConfig(pattern) {
555
582
  const routeEntry = this.routes.get(pattern);
@@ -602,17 +629,22 @@ var RouteManager = class {
602
629
  matchRedirect(pathname, search = "") {
603
630
  const i18n = this.getI18nConfig();
604
631
  const localeMatch = i18n ? resolveFarmLocalePath(pathname, i18n) : void 0;
605
- const routePathname = localeMatch?.pathname || pathname;
632
+ const routePathname = localeMatch?.pathname || this.toRoutePathname(pathname);
606
633
  const normalizedPath = routePathname === "/" ? "/" : routePathname.replace(/\/$/, "");
634
+ const urlParts = splitRoutePath(normalizedPath);
607
635
  for (const redirectEntry of this.redirects.values()) {
608
- const match = matchRoute(normalizedPath, redirectEntry.route.segments);
636
+ const match = matchRouteParts(urlParts, redirectEntry.route.segments);
609
637
  if (!match.matches) continue;
610
638
  const statusCode = redirectEntry.definition.statusCode || (redirectEntry.definition.permanent ? 308 : 307);
611
639
  return {
612
640
  redirect: redirectEntry.definition,
613
641
  destination: appendFarmRedirectQuery(
614
642
  this.localizeRedirectDestination(
615
- interpolateRedirectDestination(redirectEntry.definition.destination, match.params),
643
+ interpolateRedirectDestination(
644
+ redirectEntry.definition.destination,
645
+ match.params,
646
+ getCatchAllParamSegments(redirectEntry.route.segments, urlParts)
647
+ ),
616
648
  localeMatch?.locale
617
649
  ),
618
650
  search
@@ -724,6 +756,20 @@ var RouteManager = class {
724
756
  if (this.clientManifestCache?.projectRoot === normalizedProjectRoot) {
725
757
  return this.clientManifestCache.manifest;
726
758
  }
759
+ const cacheFile = this.packageClientBoundaryCacheFile;
760
+ return cacheFile ? runWithPackageClientBoundaryCacheFile(
761
+ cacheFile,
762
+ () => this.computeClientManifest(normalizedProjectRoot)
763
+ ) : this.computeClientManifest(normalizedProjectRoot);
764
+ }
765
+ /**
766
+ * @internal Keep package client-boundary inspections in `file` between plans, as the dev server
767
+ * does. Without it, each plan outside a production build reads every package's sources again.
768
+ */
769
+ usePackageClientBoundaryCacheFile(file) {
770
+ this.packageClientBoundaryCacheFile = file;
771
+ }
772
+ computeClientManifest(normalizedProjectRoot) {
727
773
  const toUrlPath = (absolutePath) => {
728
774
  const rootRelative = toRootRelativeUrlPath(absolutePath, normalizedProjectRoot);
729
775
  if (rootRelative !== void 0) return rootRelative;
@@ -898,13 +944,22 @@ var RouteManager = class {
898
944
  containerId: entry.containerId,
899
945
  interception: entry.interception,
900
946
  fallback: entry.fallback,
901
- shouldHydrate: metadata.shouldHydrate,
947
+ // In islands mode a server slot stays on the server; its client components are islands.
948
+ shouldHydrate: metadata.shouldHydrate && (!islandsMode || metadata.isClientComponent),
902
949
  isClientComponent: metadata.isClientComponent,
903
950
  segments: entry.route.segments
904
951
  };
905
952
  });
953
+ const slotPlans = islandsMode ? Array.from(this.routeSlots.values()).map((entry) => ({
954
+ metadata: getClientModuleHydrationPlan(
955
+ entry.modulePath,
956
+ normalizedProjectRoot,
957
+ isolatedMode,
958
+ { ...planOptions, serverOwners: true }
959
+ )
960
+ })) : [];
906
961
  const isolatedClientBoundaryModules = /* @__PURE__ */ new Set();
907
- for (const { metadata } of [...layoutEntries, ...routeEntries]) {
962
+ for (const { metadata } of [...layoutEntries, ...routeEntries, ...slotPlans]) {
908
963
  if (!metadata.hasIsolatedClientBoundaries && !metadata.serverTreeLayout) continue;
909
964
  for (const boundary of metadata.isolatedBoundaries) {
910
965
  isolatedClientBoundaryModules.add(path2.resolve(boundary.modulePath));
@@ -989,12 +1044,13 @@ var RouteManager = class {
989
1044
  }
990
1045
  if (isFarmMarkdownPageFile(modulePath)) {
991
1046
  const mdxConfig = resolveMdxConfig(this.config.mdx);
992
- const components = await loadFarmMdxComponents(mdxConfig, {
993
- root: this.config.root,
994
- loadModule: this.viteServer ? (componentModulePath) => loadFarmDevModule(this.viteServer, componentModulePath) : void 0
995
- });
1047
+ const viteServer = this.viteServer;
996
1048
  return await createFarmMarkdownRouteModuleFromFile(modulePath, {
997
- components,
1049
+ // Loaded on render: the route runtime manifest only reads metadata and rendering config.
1050
+ components: () => loadFarmMdxComponents(mdxConfig, {
1051
+ root: this.config.root,
1052
+ loadModule: viteServer ? (componentModulePath) => loadFarmDevModule(viteServer, componentModulePath) : void 0
1053
+ }),
998
1054
  config: mdxConfig
999
1055
  });
1000
1056
  }
@@ -1434,12 +1490,12 @@ var RouteManager = class {
1434
1490
  }
1435
1491
  }
1436
1492
  }
1437
- /** The page routes a docs adapter answers before Farm's own page rendering. */
1493
+ /** The page routes the docs runtime answers before Farm's own page rendering. */
1438
1494
  getDocsAdapterRoutes() {
1439
1495
  const docs = this.config.docs;
1440
- if (!docs || typeof docs !== "object" || !docs.enabled || !docs.adapter || !docs.adapter.server || !docs.adapter.react || !isReactRenderer(this.config.renderer)) {
1441
- return void 0;
1442
- }
1496
+ if (!docs || typeof docs !== "object" || !docs.enabled) return void 0;
1497
+ const usesAdapter = Boolean(docs.adapter && docs.adapter.server && docs.adapter.react);
1498
+ if (usesAdapter && !isReactRenderer(this.config.renderer)) return void 0;
1443
1499
  const entry = `/${String(docs.entry || "docs").replace(/^\/+|\/+$/g, "")}`;
1444
1500
  return {
1445
1501
  owns: (routePath) => entry === "/" || routePath === entry || routePath.startsWith(`${entry}/`),
@@ -1486,16 +1542,17 @@ var RouteManager = class {
1486
1542
  )
1487
1543
  };
1488
1544
  }
1545
+ /** A request pathname as routes see it: without the basePath and, with i18n, the locale. */
1489
1546
  toRoutePathname(pathname) {
1490
1547
  const i18n = this.getI18nConfig();
1491
1548
  return i18n ? stripFarmLocaleFromPathname(pathname, i18n) : stripFarmBasePath(pathname, this.config.basePath);
1492
1549
  }
1493
1550
  localizeRedirectDestination(destination, locale) {
1494
- if (!locale || !destination.startsWith("/") || destination.startsWith("//")) {
1551
+ if (!destination.startsWith("/") || destination.startsWith("//")) {
1495
1552
  return destination;
1496
1553
  }
1497
1554
  const i18n = this.getI18nConfig();
1498
- return i18n ? localizeFarmHref(destination, locale, i18n) : destination;
1555
+ return locale && i18n ? localizeFarmHref(destination, locale, i18n) : this.config.basePath ? applyFarmBasePath(destination, this.config.basePath) : destination;
1499
1556
  }
1500
1557
  getI18nConfig() {
1501
1558
  const i18n = this.config.i18n;
@@ -1542,9 +1599,11 @@ function getPageDirectoryField(route, pattern) {
1542
1599
  const directory = createRouteDirectoryPattern(route);
1543
1600
  return directory === pattern ? {} : { directory };
1544
1601
  }
1545
- function interpolateRedirectDestination(destination, params) {
1602
+ function interpolateRedirectDestination(destination, params, catchAllSegments = {}) {
1546
1603
  let result = destination;
1547
- for (const [key, value] of Object.entries(params)) {
1604
+ for (const [key, rawValue] of Object.entries(params)) {
1605
+ const segments = catchAllSegments[key];
1606
+ const value = segments ? segments.map(encodeConfigRouteSegment).join("/") : encodeConfigRouteSegment(rawValue);
1548
1607
  result = replaceAll(result, `[[...${key}]]`, value);
1549
1608
  result = replaceAll(result, `[...${key}]`, value);
1550
1609
  result = replaceAll(result, `[${key}]`, value);
@@ -1553,6 +1612,10 @@ function interpolateRedirectDestination(destination, params) {
1553
1612
  }
1554
1613
  return result;
1555
1614
  }
1615
+ function getCatchAllParamSegments(segments, urlParts) {
1616
+ const index = segments.findIndex((segment) => segment.isCatchAll);
1617
+ return index === -1 ? {} : { [segments[index].segment]: urlParts.slice(index) };
1618
+ }
1556
1619
  function getMetadataImageSuffix(pathname) {
1557
1620
  if (pathname === "/opengraph-image" || pathname.endsWith("/opengraph-image")) {
1558
1621
  return { kind: "opengraph", fileName: "opengraph-image" };
@@ -1702,7 +1765,8 @@ function farmFontImportsPlugin(options = {}) {
1702
1765
  );
1703
1766
  registry.production = false;
1704
1767
  server.middlewares.use(async (req, res, next) => {
1705
- const pathname = new URL(req.url || "/", "http://farm.local").pathname;
1768
+ const target = req.url || "/";
1769
+ const pathname = (target.startsWith("/") ? new URL(`http://farm.local${target}`) : new URL(target, "http://farm.local")).pathname;
1706
1770
  if (pathname === "/@farm/fonts.css") {
1707
1771
  res.statusCode = 200;
1708
1772
  res.setHeader("Content-Type", "text/css; charset=utf-8");
@@ -2590,7 +2654,7 @@ function isFontLoaderKind(value) {
2590
2654
  return typeof value === "string" && FONT_FUNCTIONS.has(value);
2591
2655
  }
2592
2656
  function containsFontFunction(code) {
2593
- return Array.from(FONT_FUNCTIONS).some((name) => code.includes(name));
2657
+ return code.includes("@farm.js/core") && Array.from(FONT_FUNCTIONS).some((name) => code.includes(name));
2594
2658
  }
2595
2659
  function requireString(value, id, label) {
2596
2660
  if (typeof value !== "string" || value.trim() === "") {
@@ -2852,294 +2916,28 @@ function resolveFarmRouteRootStrategy(route, page, layouts, root, islandsMode) {
2852
2916
  return inference.strategy ?? "load";
2853
2917
  }
2854
2918
 
2855
- // src/client-plugin-build.ts
2856
- import fs3 from "fs";
2857
- import path7 from "path";
2858
- var CLIENT_KEYS = [
2859
- "public",
2860
- "setup",
2861
- "hydration",
2862
- "navigation",
2863
- "error",
2864
- "performance",
2865
- "close"
2866
- ];
2867
- var HYDRATION_KEYS = ["before", "after"];
2868
- var NAVIGATION_KEYS = ["before", "loaded", "resolved", "rendered", "error"];
2869
- var MOBILE_SHELL_CLIENT_IMPORT = 'import { farmMobileShellClient as __farmMobileShellClient } from "@farm.js/core/internal/client-runtime";';
2870
- var MOBILE_SHELL_CLIENT_REGISTRATION = ` {
2871
- name: "farm:mobile-shell",
2872
- enforce: "pre",
2873
- definition: __farmMobileShellClient,
2874
- }`;
2875
- var APP_CLIENT_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
2876
- function resolveFarmAppClientEntry(root = process.cwd(), srcDir = "src") {
2877
- const sourceRoot = path7.resolve(root, srcDir);
2878
- for (const extension of APP_CLIENT_EXTENSIONS) {
2879
- const candidate = path7.join(sourceRoot, `client.${extension}`);
2880
- if (fs3.existsSync(candidate) && fs3.statSync(candidate).isFile()) return candidate;
2881
- }
2882
- return void 0;
2883
- }
2884
- function resolveFarmClientPlugins(plugins, _root) {
2885
- if (!plugins?.length) return [];
2886
- return plugins.flatMap((plugin) => {
2887
- if (!plugin.client) return [];
2888
- assertClientLifecycle(plugin.client, plugin.name);
2889
- assertPublicData(plugin.client.public, plugin.name);
2890
- return [
2891
- {
2892
- name: plugin.name,
2893
- version: plugin.version,
2894
- enforce: plugin.enforce,
2895
- definition: plugin.client,
2896
- publicData: plugin.client.public
2897
- }
2898
- ];
2899
- });
2900
- }
2901
- function generateFarmClientPluginEntryCode(plugins, root, srcDir = "src", appPublicData, platform = resolveFarmPlatform()) {
2902
- const resolved = resolveFarmClientPlugins(plugins, root);
2903
- const appClientEntry = root ? resolveFarmAppClientEntry(root, srcDir) : void 0;
2904
- const appImport = appClientEntry ? `import farmAppClientDefinition from ${JSON.stringify(appClientEntry.replace(/\\/g, "/"))};` : "";
2905
- const mobileShell = platform === "mobile";
2906
- const imports = mobileShell ? [MOBILE_SHELL_CLIENT_IMPORT, appImport].filter(Boolean).join("\n") : appImport;
2907
- const serializedPlugins = mobileShell ? [MOBILE_SHELL_CLIENT_REGISTRATION] : [];
2908
- serializedPlugins.push(
2909
- ...resolved.map(
2910
- (plugin) => ` {
2911
- name: ${JSON.stringify(plugin.name)},
2912
- version: ${serializeOptionalString(plugin.version)},
2913
- enforce: ${serializeOptionalString(plugin.enforce)},
2914
- definition: ${serializeClientLifecycle(plugin.definition, plugin.name)},
2915
- public: ${serializePublicData(plugin.publicData)},
2916
- }`
2917
- )
2918
- );
2919
- if (appClientEntry) {
2920
- assertPublicData(appPublicData, "farm:app-client");
2921
- serializedPlugins.push(` {
2922
- name: "farm:app-client",
2923
- enforce: "post",
2924
- definition: farmAppClientDefinition,
2925
- public: ${serializePublicData(appPublicData)},
2926
- }`);
2927
- }
2928
- const registrations = `[
2929
- ${serializedPlugins.join(",\n")}
2930
- ]`;
2931
- return { imports, registrations, plugins: resolved };
2932
- }
2933
- function assertClientLifecycle(client, pluginName) {
2934
- assertLifecycleObject(client, pluginName, "client", CLIENT_KEYS);
2935
- assertHook(client.setup, pluginName, "client.setup");
2936
- assertHook(client.error, pluginName, "client.error");
2937
- assertHook(client.performance, pluginName, "client.performance");
2938
- assertHook(client.close, pluginName, "client.close");
2939
- if (client.hydration !== void 0) {
2940
- assertLifecycleObject(client.hydration, pluginName, "client.hydration", HYDRATION_KEYS);
2941
- assertHook(client.hydration.before, pluginName, "client.hydration.before");
2942
- assertHook(client.hydration.after, pluginName, "client.hydration.after");
2943
- }
2944
- if (client.navigation !== void 0) {
2945
- assertLifecycleObject(client.navigation, pluginName, "client.navigation", NAVIGATION_KEYS);
2946
- for (const key of NAVIGATION_KEYS) {
2947
- assertHook(client.navigation[key], pluginName, `client.navigation.${key}`);
2948
- }
2949
- }
2950
- }
2951
- function assertLifecycleObject(value, pluginName, location, allowedKeys) {
2952
- if (!value || typeof value !== "object" || Array.isArray(value)) {
2953
- throw new TypeError(`Client plugin "${pluginName}" ${location} must be an object`);
2954
- }
2955
- const prototype = Object.getPrototypeOf(value);
2956
- if (prototype !== Object.prototype && prototype !== null) {
2957
- throw new TypeError(`Client plugin "${pluginName}" ${location} must be a plain object`);
2958
- }
2959
- for (const key of Reflect.ownKeys(value)) {
2960
- if (typeof key === "symbol") {
2961
- throw new TypeError(`Client plugin "${pluginName}" ${location} cannot contain symbol keys`);
2962
- }
2963
- if (!allowedKeys.includes(key)) {
2964
- throw new TypeError(`Client plugin "${pluginName}" has an unknown ${location}.${key} option`);
2965
- }
2966
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
2967
- if (!descriptor?.enumerable) {
2968
- throw new TypeError(`Client plugin "${pluginName}" ${location}.${key} must be enumerable`);
2969
- }
2970
- if (!("value" in descriptor)) {
2971
- throw new TypeError(`Client plugin "${pluginName}" ${location}.${key} cannot be an accessor`);
2972
- }
2973
- }
2974
- }
2975
- function assertHook(value, pluginName, location) {
2976
- if (value === void 0) return;
2977
- if (typeof value !== "function") {
2978
- throw new TypeError(`Client plugin "${pluginName}" ${location} must be a function`);
2979
- }
2980
- functionSource(value, pluginName, location);
2981
- }
2982
- function serializeClientLifecycle(definition, pluginName) {
2983
- const fields = [];
2984
- pushHook(fields, "setup", definition.setup, pluginName, "client.setup", 2);
2985
- pushHookGroup(fields, "hydration", definition.hydration, HYDRATION_KEYS, pluginName, 2);
2986
- pushHookGroup(fields, "navigation", definition.navigation, NAVIGATION_KEYS, pluginName, 2);
2987
- pushHook(fields, "error", definition.error, pluginName, "client.error", 2);
2988
- pushHook(fields, "performance", definition.performance, pluginName, "client.performance", 2);
2989
- pushHook(fields, "close", definition.close, pluginName, "client.close", 2);
2990
- return fields.length ? `{
2991
- ${fields.join(",\n")}
2992
- }` : "{}";
2993
- }
2994
- function pushHookGroup(fields, groupName, group, keys, pluginName, indent) {
2995
- if (!group) return;
2996
- const hooks = [];
2997
- for (const key of keys) {
2998
- pushHook(hooks, key, group[key], pluginName, `client.${groupName}.${key}`, indent + 2);
2999
- }
3000
- fields.push(
3001
- `${" ".repeat(indent)}${JSON.stringify(groupName)}: {
3002
- ${hooks.join(",\n")}
3003
- ${" ".repeat(indent)}}`
3004
- );
3005
- }
3006
- function pushHook(fields, key, hook, pluginName, location, indent) {
3007
- if (hook === void 0) return;
3008
- fields.push(
3009
- `${" ".repeat(indent)}${JSON.stringify(key)}: ${functionSource(hook, pluginName, location)}`
3010
- );
3011
- }
3012
- function functionSource(value, pluginName, location) {
3013
- if (typeof value !== "function") {
3014
- throw new TypeError(`Client plugin "${pluginName}" ${location} must be a function`);
3015
- }
3016
- const source = Function.prototype.toString.call(value).trim();
3017
- if (!source || source.includes("[native code]")) {
3018
- throw new TypeError(
3019
- `Client plugin "${pluginName}" ${location} must be authored inline and cannot be native or bound`
3020
- );
3021
- }
3022
- if (/^(?:async\s+)?function(?:\s*\*)?(?:\s+|\()/.test(source)) {
3023
- return `(${source})`;
3024
- }
3025
- const method = source.match(/^(async\s+)?(\*\s*)?[$A-Z_a-z][$\w]*\s*(\([\s\S]*)$/);
3026
- if (method) {
3027
- const asyncPrefix = method[1] ?? "";
3028
- const generator = method[2] ? "*" : "";
3029
- return `(${asyncPrefix}function${generator}${method[3]})`;
3030
- }
3031
- if (source.includes("=>")) return `(${source})`;
3032
- throw new TypeError(
3033
- `Client plugin "${pluginName}" ${location} must use a function, method, or arrow function`
3034
- );
3035
- }
3036
- function assertPublicData(value, pluginName) {
3037
- if (value === void 0) return;
3038
- const seen = /* @__PURE__ */ new WeakSet();
3039
- const visit = (current, pathSegments) => {
3040
- if (current === null || typeof current === "string" || typeof current === "boolean") {
3041
- return;
3042
- }
3043
- if (typeof current === "number") {
3044
- if (Number.isFinite(current)) return;
3045
- throwPublicDataError(pluginName, pathSegments, "must be a finite number");
3046
- }
3047
- if (typeof current !== "object") {
3048
- throwPublicDataError(pluginName, pathSegments, `cannot contain ${typeof current} values`);
3049
- }
3050
- if (seen.has(current)) {
3051
- throwPublicDataError(pluginName, pathSegments, "cannot contain circular references");
3052
- }
3053
- seen.add(current);
3054
- if (Array.isArray(current)) {
3055
- for (let index = 0; index < current.length; index += 1) {
3056
- if (!Object.prototype.hasOwnProperty.call(current, index)) {
3057
- throwPublicDataError(
3058
- pluginName,
3059
- [...pathSegments, String(index)],
3060
- "cannot contain sparse array slots"
3061
- );
3062
- }
3063
- visit(current[index], [...pathSegments, String(index)]);
3064
- }
3065
- for (const key of Reflect.ownKeys(current)) {
3066
- if (key === "length" || typeof key === "string" && isArrayIndex(key)) continue;
3067
- throwPublicDataError(
3068
- pluginName,
3069
- pathSegments,
3070
- typeof key === "symbol" ? "cannot contain symbol keys" : `cannot contain non-index array property ${key}`
3071
- );
3072
- }
3073
- seen.delete(current);
3074
- return;
3075
- }
3076
- const prototype = Object.getPrototypeOf(current);
3077
- if (prototype !== Object.prototype && prototype !== null) {
3078
- throwPublicDataError(pluginName, pathSegments, "must contain only plain objects and arrays");
3079
- }
3080
- for (const key of Reflect.ownKeys(current)) {
3081
- if (typeof key === "symbol") {
3082
- throwPublicDataError(pluginName, pathSegments, "cannot contain symbol keys");
3083
- }
3084
- const descriptor = Object.getOwnPropertyDescriptor(current, key);
3085
- if (!descriptor?.enumerable) {
3086
- throwPublicDataError(
3087
- pluginName,
3088
- [...pathSegments, key],
3089
- "cannot contain non-enumerable properties"
3090
- );
3091
- }
3092
- if (!("value" in descriptor)) {
3093
- throwPublicDataError(
3094
- pluginName,
3095
- [...pathSegments, key],
3096
- "cannot contain accessor properties"
3097
- );
3098
- }
3099
- visit(descriptor.value, [...pathSegments, key]);
3100
- }
3101
- seen.delete(current);
3102
- };
3103
- visit(value, []);
3104
- }
3105
- function throwPublicDataError(pluginName, pathSegments, message) {
3106
- const location = pathSegments.length ? ` at client.public.${pathSegments.join(".")}` : "";
3107
- throw new TypeError(`Client plugin "${pluginName}"${location} ${message}`);
3108
- }
3109
- function serializePublicData(value) {
3110
- if (value === void 0) return "undefined";
3111
- return `JSON.parse(${JSON.stringify(JSON.stringify(value))})`;
3112
- }
3113
- function serializeOptionalString(value) {
3114
- return value === void 0 ? "undefined" : JSON.stringify(value);
3115
- }
3116
- function isArrayIndex(key) {
3117
- const value = Number(key);
3118
- return Number.isInteger(value) && value >= 0 && value < 4294967295 && String(value) === key;
3119
- }
3120
-
3121
2919
  // src/server/renderer.ts
3122
- import * as fs6 from "fs";
2920
+ import * as fs5 from "fs";
3123
2921
  import * as https from "https";
3124
2922
  import { isIP } from "net";
3125
- import * as path10 from "path";
2923
+ import * as path9 from "path";
3126
2924
  import * as tls from "tls";
3127
2925
  import { Readable, Writable } from "stream";
3128
2926
 
3129
2927
  // src/not-found.ts
3130
- import fs4 from "fs";
3131
- import path8 from "path";
2928
+ import fs3 from "fs";
2929
+ import path7 from "path";
3132
2930
  function resolveFarmNotFoundComponentPath(config, appDirs) {
3133
2931
  const extensions = getFarmRendererComponentExtensions(config.renderer);
3134
2932
  const configuredPath = config.notFound?.component?.trim();
3135
2933
  if (configuredPath) {
3136
- const componentPath = path8.isAbsolute(configuredPath) ? path8.normalize(configuredPath) : path8.resolve(config.root, configuredPath);
2934
+ const componentPath = path7.isAbsolute(configuredPath) ? path7.normalize(configuredPath) : path7.resolve(config.root, configuredPath);
3137
2935
  if (!extensions.some((extension) => componentPath.endsWith(extension))) {
3138
2936
  throw new Error(
3139
2937
  `notFound.component must use one of the configured renderer extensions: ${extensions.join(", ")}`
3140
2938
  );
3141
2939
  }
3142
- if (!fs4.existsSync(componentPath) || !fs4.statSync(componentPath).isFile()) {
2940
+ if (!fs3.existsSync(componentPath) || !fs3.statSync(componentPath).isFile()) {
3143
2941
  throw new Error(`notFound.component was not found: ${componentPath}`);
3144
2942
  }
3145
2943
  return componentPath;
@@ -3147,8 +2945,8 @@ function resolveFarmNotFoundComponentPath(config, appDirs) {
3147
2945
  let discoveredPath = null;
3148
2946
  for (const appDir of appDirs) {
3149
2947
  for (const extension of extensions) {
3150
- const candidate = path8.join(appDir, `not-found${extension}`);
3151
- if (fs4.existsSync(candidate) && fs4.statSync(candidate).isFile()) {
2948
+ const candidate = path7.join(appDir, `not-found${extension}`);
2949
+ if (fs3.existsSync(candidate) && fs3.statSync(candidate).isFile()) {
3152
2950
  discoveredPath = candidate;
3153
2951
  break;
3154
2952
  }
@@ -3344,8 +3142,8 @@ body {
3344
3142
  import { pathToFileURL as pathToFileURL2 } from "url";
3345
3143
 
3346
3144
  // src/server/error-diagnostics.ts
3347
- import * as fs5 from "fs";
3348
- import * as path9 from "path";
3145
+ import * as fs4 from "fs";
3146
+ import * as path8 from "path";
3349
3147
  import { fileURLToPath } from "url";
3350
3148
  var SECRET_VALUE_PATTERN = /\b(api[_-]?key|access[_-]?token|auth[_-]?token|client[_-]?secret|secret[_-]?key|token|password|secret)\s*[:=]\s*([^\s,;]+)/gi;
3351
3149
  var BEARER_PATTERN = /\b(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi;
@@ -3353,8 +3151,8 @@ function redactErrorText(value) {
3353
3151
  return value.replace(BEARER_PATTERN, "$1[REDACTED]").replace(SECRET_VALUE_PATTERN, "$1=[REDACTED]");
3354
3152
  }
3355
3153
  function isPathInsideRoot(root, filePath) {
3356
- const relative3 = path9.relative(root, filePath);
3357
- return relative3 === "" || !relative3.startsWith("..") && !path9.isAbsolute(relative3);
3154
+ const relative3 = path8.relative(root, filePath);
3155
+ return relative3 === "" || !relative3.startsWith("..") && !path8.isAbsolute(relative3);
3358
3156
  }
3359
3157
  function normalizeStackPath(value) {
3360
3158
  const withoutQuery = value.replace(/[?#].*$/, "");
@@ -3371,13 +3169,13 @@ function findStackLocation(stack, root) {
3371
3169
  );
3372
3170
  if (!match) continue;
3373
3171
  const candidate = normalizeStackPath(match[1]);
3374
- if (!candidate || candidate.includes(`${path9.sep}node_modules${path9.sep}`)) continue;
3375
- const absolutePath = path9.resolve(candidate);
3376
- if (!isPathInsideRoot(root, absolutePath) || !fs5.existsSync(absolutePath)) continue;
3377
- const relativePath = path9.relative(root, absolutePath).split(path9.sep).join("/");
3172
+ if (!candidate || candidate.includes(`${path8.sep}node_modules${path8.sep}`)) continue;
3173
+ const absolutePath = path8.resolve(candidate);
3174
+ if (!isPathInsideRoot(root, absolutePath) || !fs4.existsSync(absolutePath)) continue;
3175
+ const relativePath = path8.relative(root, absolutePath).split(path8.sep).join("/");
3378
3176
  return {
3379
3177
  absolutePath,
3380
- displayPath: relativePath || path9.basename(absolutePath),
3178
+ displayPath: relativePath || path8.basename(absolutePath),
3381
3179
  line: Number(match[2]),
3382
3180
  column: Number(match[3])
3383
3181
  };
@@ -3386,7 +3184,7 @@ function findStackLocation(stack, root) {
3386
3184
  }
3387
3185
  function createSourceFrame(location) {
3388
3186
  try {
3389
- const sourceLines = fs5.readFileSync(location.absolutePath, "utf8").split(/\r?\n/);
3187
+ const sourceLines = fs4.readFileSync(location.absolutePath, "utf8").split(/\r?\n/);
3390
3188
  if (location.line < 1 || location.line > sourceLines.length) return void 0;
3391
3189
  const start = Math.max(1, location.line - 2);
3392
3190
  const end = Math.min(sourceLines.length, location.line + 2);
@@ -3409,13 +3207,13 @@ function createSourceFrame(location) {
3409
3207
  }
3410
3208
  }
3411
3209
  function sanitizeStack(stack, root) {
3412
- const normalizedRoot = path9.resolve(root);
3210
+ const normalizedRoot = path8.resolve(root);
3413
3211
  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");
3414
3212
  }
3415
3213
  function createDefaultErrorDiagnostics(error, root) {
3416
3214
  const normalizedError = error instanceof Error ? error : new Error(typeof error === "string" ? error : "Unknown server rendering error");
3417
3215
  const rawStack = normalizedError.stack || `${normalizedError.name}: ${normalizedError.message}`;
3418
- const location = findStackLocation(rawStack, path9.resolve(root));
3216
+ const location = findStackLocation(rawStack, path8.resolve(root));
3419
3217
  return {
3420
3218
  name: redactErrorText(normalizedError.name || "Error"),
3421
3219
  message: redactErrorText(normalizedError.message || "Unknown server rendering error"),
@@ -3560,7 +3358,7 @@ function createPPRRefreshScript() {
3560
3358
  }
3561
3359
  function createPreHydrationClickQueueScript() {
3562
3360
  const selector = JSON.stringify(FARM_ISLAND_REPLAYABLE_SELECTOR);
3563
- return `<script>(function(){if(window.__FARM_PREHYDRATION_CLICK_QUEUE__)return;var queue=[];window.__FARM_PREHYDRATION_CLICK_QUEUE__=queue;window.__FARM_HYDRATED__=false;document.documentElement.dataset.farmHydrated="false";function isModified(event){return !!(event.metaKey||event.altKey||event.ctrlKey||event.shiftKey)}function inHydrated(node){return !!(node&&node.closest&&node.closest('[data-farm-island-hydrated="true"]'))}function closestQueuedTarget(target){while(target&&target!==document.documentElement){if(target.matches&&target.matches(${selector}))return target;target=target.parentElement}return null}function announce(target,kind){document.dispatchEvent(new CustomEvent("farm:island-interaction",{detail:{target:target,kind:kind||null}}))}function hold(event,target,kind){if(!queue.some(function(item){return item.target===target})){queue.push({target:target,kind:kind,createdAt:Date.now()});announce(target,kind)}event.preventDefault();event.stopImmediatePropagation()}document.addEventListener("click",function(event){if(window.__FARM_HYDRATED__)return;if(event.defaultPrevented||event.button!==0||isModified(event))return;var target=closestQueuedTarget(event.target);if(!target||target.closest&&target.closest("a[href]")||inHydrated(target))return;hold(event,target,"click")},true);document.addEventListener("submit",function(event){if(window.__FARM_HYDRATED__)return;if(event.defaultPrevented)return;var form=event.target;if(!form||form.nodeName!=="FORM"||inHydrated(form))return;hold(event,form,"submit")},true);function observe(event){if(window.__FARM_HYDRATED__)return;var target=event.target;if(!(target&&target.closest)||inHydrated(target))return;announce(target,null)}document.addEventListener("pointerdown",observe,true);document.addEventListener("focusin",observe,true);})();</script>`;
3361
+ return `<script>(function(){if(window.__FARM_PREHYDRATION_CLICK_QUEUE__)return;var queue=[];window.__FARM_PREHYDRATION_CLICK_QUEUE__=queue;window.__FARM_HYDRATED__=false;document.documentElement.dataset.farmHydrated="false";function isModified(event){return !!(event.metaKey||event.altKey||event.ctrlKey||event.shiftKey)}function inHydrated(node){return !!(node&&node.closest&&node.closest('[data-farm-island-hydrated="true"]'))}function closestQueuedTarget(target){while(target&&target!==document.documentElement){if(target.matches&&target.matches(${selector}))return target;target=target.parentElement}return null}function announce(target,kind){document.dispatchEvent(new CustomEvent("farm:island-interaction",{detail:{target:target,kind:kind||null}}))}function submits(target,kind){return kind==="submit"||!!(target.form&&target.type==="submit")}function hold(event,target,kind){if(!(submits(target,kind)&&queue.some(function(item){return item.target===target}))){queue.push({target:target,kind:kind,createdAt:Date.now()});announce(target,kind)}event.preventDefault();event.stopImmediatePropagation()}document.addEventListener("click",function(event){if(window.__FARM_HYDRATED__)return;if(event.defaultPrevented||event.button!==0||isModified(event))return;var target=closestQueuedTarget(event.target);if(!target||target.closest&&target.closest("a[href]")||inHydrated(target))return;hold(event,target,"click")},true);document.addEventListener("submit",function(event){if(window.__FARM_HYDRATED__)return;if(event.defaultPrevented)return;var form=event.target;if(!form||form.nodeName!=="FORM"||inHydrated(form))return;hold(event,form,"submit")},true);function observe(event){if(window.__FARM_HYDRATED__)return;var target=event.target;if(!(target&&target.closest)||inHydrated(target))return;announce(target,null)}document.addEventListener("pointerdown",observe,true);document.addEventListener("focusin",observe,true);})();</script>`;
3564
3362
  }
3565
3363
  function rendererRenderOptions() {
3566
3364
  const nonce = _resolveCurrentCspNonce();
@@ -3684,7 +3482,7 @@ function createRouteStateProps(input) {
3684
3482
  function readAppPackageIdentity(root) {
3685
3483
  try {
3686
3484
  return JSON.parse(
3687
- fs6.readFileSync(path10.join(root || process.cwd(), "package.json"), "utf8")
3485
+ fs5.readFileSync(path9.join(root || process.cwd(), "package.json"), "utf8")
3688
3486
  );
3689
3487
  } catch {
3690
3488
  return {};
@@ -3713,7 +3511,7 @@ var ServerRenderer = class {
3713
3511
  if (this.config.notFound?.component?.trim()) {
3714
3512
  resolveFarmNotFoundComponentPath(this.config, getFarmAppDirectories(this.config));
3715
3513
  }
3716
- const loaded = isReactRenderer(this.config.renderer) ? await import("./renderer/react/server.mjs") : this.viteServer ? await loadFarmDevModule(this.viteServer, this.config.renderer.server) : await import(pathToFileURL2(
3514
+ const loaded = isReactRenderer(this.config.renderer) ? await import("./renderer/react/server.mjs") : isFarmRendererDisabled(this.config.renderer) ? await import("./renderer/none/server.mjs") : this.viteServer ? await loadFarmDevModule(this.viteServer, this.config.renderer.server) : await import(pathToFileURL2(
3717
3515
  resolveFarmRendererModule(
3718
3516
  this.config.root || process.cwd(),
3719
3517
  this.config.renderer.server
@@ -3846,9 +3644,10 @@ var ServerRenderer = class {
3846
3644
  const streaming = getFarmRendererStreamingCapabilitiesForRuntime(this.config.renderer, "node");
3847
3645
  const renderToPipeableStream = streaming.node ? this.rendererRuntime.renderToPipeableStream : void 0;
3848
3646
  if (renderToPipeableStream) {
3647
+ const inlineBoundaries = isReactRenderer(this.config.renderer);
3849
3648
  return await new Promise((resolve3, reject) => {
3850
3649
  const chunks = [];
3851
- let started = false;
3650
+ let shellReady = false;
3852
3651
  let lateNavigation;
3853
3652
  const writable = new Writable({
3854
3653
  write(chunk, _encoding, callback) {
@@ -3863,16 +3662,23 @@ var ServerRenderer = class {
3863
3662
  writable.once("error", reject);
3864
3663
  const stream = renderToPipeableStream(element, {
3865
3664
  nonce: _resolveCurrentCspNonce(),
3665
+ formState: getFarmFormState(),
3666
+ ...inlineBoundaries ? {
3667
+ progressiveChunkSize: Number.MAX_SAFE_INTEGER,
3668
+ onAllReady() {
3669
+ stream.pipe(writable);
3670
+ }
3671
+ } : {},
3866
3672
  onShellReady() {
3867
- started = true;
3868
- stream.pipe(writable);
3673
+ shellReady = true;
3674
+ if (!inlineBoundaries) stream.pipe(writable);
3869
3675
  },
3870
3676
  onShellError(error) {
3871
3677
  reject(error);
3872
3678
  },
3873
3679
  onError(error) {
3874
- if (!started) reject(error);
3875
- else if (options.rejectLateNavigation && lateNavigation === void 0 && (isFarmRedirectError(error) || isFarmNotFoundError(error))) {
3680
+ if (!shellReady) reject(error);
3681
+ else if (lateNavigation === void 0 && (options.rejectLateErrors || options.rejectLateRedirects && isFarmRedirectError(error) || options.rejectLateNavigation && (isFarmRedirectError(error) || isFarmNotFoundError(error)))) {
3876
3682
  lateNavigation = error;
3877
3683
  }
3878
3684
  }
@@ -3953,7 +3759,7 @@ var ServerRenderer = class {
3953
3759
  continue;
3954
3760
  }
3955
3761
  let slotElement = this.rendererRuntime.createElement(slot.module.default, slot.props);
3956
- slotElement = this.wrapClientGraph(slotElement);
3762
+ if (slot.shouldHydrate !== false) slotElement = this.wrapClientGraph(slotElement);
3957
3763
  slotProps[slot.name] = this.rendererRuntime.createElement(
3958
3764
  "div",
3959
3765
  {
@@ -3974,7 +3780,9 @@ var ServerRenderer = class {
3974
3780
  if (input.layoutShouldHydrate) {
3975
3781
  element = this.wrapClientGraph(element);
3976
3782
  }
3977
- return this.renderElementToCompleteHTML(await this.wrapWithIntegrationProviders(element));
3783
+ return this.renderElementToCompleteHTML(await this.wrapWithIntegrationProviders(element), {
3784
+ rejectLateRedirects: true
3785
+ });
3978
3786
  }
3979
3787
  async runWithRequestContext(request2, fn) {
3980
3788
  return _runWithCurrentRequest(
@@ -3991,10 +3799,10 @@ var ServerRenderer = class {
3991
3799
  * Load SSG manifest from build output
3992
3800
  */
3993
3801
  loadSSGManifest() {
3994
- const manifestPath = path10.join(this.config.root, this.config.outDir, "__ssg_manifest.json");
3802
+ const manifestPath = path9.join(this.config.root, this.config.outDir, "__ssg_manifest.json");
3995
3803
  let content;
3996
3804
  try {
3997
- content = fs6.readFileSync(manifestPath, "utf-8");
3805
+ content = fs5.readFileSync(manifestPath, "utf-8");
3998
3806
  } catch (error) {
3999
3807
  if (error.code === "ENOENT") {
4000
3808
  return;
@@ -4213,10 +4021,10 @@ var ServerRenderer = class {
4213
4021
  return true;
4214
4022
  }
4215
4023
  try {
4216
- 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");
4217
- if (fs6.existsSync(htmlPath)) {
4218
- const stat = fs6.statSync(htmlPath);
4219
- const html = fs6.readFileSync(htmlPath, "utf-8");
4024
+ const htmlPath = page.urlPath === "/" ? path9.join(this.config.root, this.config.outDir, "client", "index.html") : path9.join(this.config.root, this.config.outDir, "client", page.urlPath + ".html");
4025
+ if (fs5.existsSync(htmlPath)) {
4026
+ const stat = fs5.statSync(htmlPath);
4027
+ const html = fs5.readFileSync(htmlPath, "utf-8");
4220
4028
  await this.cacheSSGPage(page, html, {
4221
4029
  document: true,
4222
4030
  createdAt: stat.mtimeMs
@@ -4310,18 +4118,19 @@ var ServerRenderer = class {
4310
4118
  completeRender(res.statusCode || 200, pathname);
4311
4119
  return;
4312
4120
  }
4313
- const generatedLlmsKind = this.getGeneratedLlmsKind(pathname);
4121
+ const routePathname = this.routeManager.toRoutePathname(pathname);
4122
+ const generatedLlmsKind = this.getGeneratedLlmsKind(routePathname);
4314
4123
  if (generatedLlmsKind) {
4315
4124
  await this.renderGeneratedLlmsTxt(req, res, generatedLlmsKind);
4316
4125
  completeRender(res.statusCode || 200, pathname);
4317
4126
  return;
4318
4127
  }
4319
- if (pathname === "/robots.txt" && this.getAgentCrawlers().enabled) {
4128
+ if (routePathname === "/robots.txt" && this.getAgentCrawlers().enabled) {
4320
4129
  await this.renderGeneratedRobotsTxt(req, res);
4321
4130
  completeRender(res.statusCode || 200, pathname);
4322
4131
  return;
4323
4132
  }
4324
- if (pathname === "/sitemap.xml" && this.getAgentSitemap().enabled) {
4133
+ if (routePathname === "/sitemap.xml" && this.getAgentSitemap().enabled) {
4325
4134
  await this.renderGeneratedSitemap(req, res);
4326
4135
  completeRender(res.statusCode || 200, pathname);
4327
4136
  return;
@@ -4388,9 +4197,21 @@ var ServerRenderer = class {
4388
4197
  actionRequest = createWebRequestFromFarmRequest(req, {
4389
4198
  trustProxy: this.config.server?.trustProxy
4390
4199
  });
4391
- const actionResponse = await handleFarmFormActionRequest(
4392
- actionRequest,
4393
- resolveServerActionsConfig(this.config.serverActions)
4200
+ const formActionRequest = actionRequest;
4201
+ const actionResponse = await _runWithMiddlewareData(
4202
+ toMiddlewareMap(req.__FARM_MIDDLEWARE_DATA__),
4203
+ () => _runWithMiddlewareContext(
4204
+ toMiddlewareMap(req.__FARM_MIDDLEWARE_CONTEXT__),
4205
+ () => handleFarmFormActionRequest(
4206
+ formActionRequest,
4207
+ resolveServerActionsConfig(this.config.serverActions),
4208
+ // Before a rewrite, the URL the browser posted to.
4209
+ new URL(
4210
+ req.originalUrl ?? req.url ?? "/",
4211
+ formActionRequest.url
4212
+ ).href
4213
+ )
4214
+ )
4394
4215
  );
4395
4216
  if (actionResponse) {
4396
4217
  await sendWebResponse(res, actionResponse);
@@ -4723,7 +4544,7 @@ var ServerRenderer = class {
4723
4544
  await _runWithMiddlewareContext(middlewareContext, async () => {
4724
4545
  await _runWithCurrentRequest(currentRequest, async () => {
4725
4546
  let pageElement = this.rendererRuntime.createElement(PageComponent, pageProps);
4726
- if (LoadingFallbackComponent) {
4547
+ if (LoadingFallbackComponent && !islandsNavigationRequest) {
4727
4548
  const loadingFallback = this.rendererRuntime.createElement(LoadingFallbackComponent, {
4728
4549
  ...createRouteStateProps({
4729
4550
  params,
@@ -4754,7 +4575,27 @@ var ServerRenderer = class {
4754
4575
  });
4755
4576
  const islandsSegments = Boolean(islands && this.islandValues());
4756
4577
  const keptLayoutCount = islandsSegments && !renderingConfig.ssg && !shouldHydrateLayout && renderedRouteSlots.length === 0 ? countFarmKeptLayouts(requestHeader(req, "f-layouts"), layouts, params) : 0;
4757
- const keptLayouts = keptLayoutCount > 1 ? keptLayoutCount : 0;
4578
+ let keptLayouts = keptLayoutCount > 1 ? keptLayoutCount : 0;
4579
+ if (keptLayouts > 0) {
4580
+ let keptElement = null;
4581
+ for (let i = keptLayouts - 1; i >= 0; i--) {
4582
+ const KeptLayout = layoutModules[i]?.default;
4583
+ if (KeptLayout) {
4584
+ keptElement = this.rendererRuntime.createElement(KeptLayout, {
4585
+ children: keptElement,
4586
+ params
4587
+ });
4588
+ }
4589
+ }
4590
+ try {
4591
+ await this.renderElementToCompleteHTML(
4592
+ await this.wrapWithIntegrationProviders(keptElement),
4593
+ { rejectLateErrors: true }
4594
+ );
4595
+ } catch {
4596
+ keptLayouts = 0;
4597
+ }
4598
+ }
4758
4599
  let wrappedElement = pageElement;
4759
4600
  for (let i = layoutModules.length - 1; i >= 0; i--) {
4760
4601
  const layoutModule = layoutModules[i];
@@ -4775,7 +4616,7 @@ var ServerRenderer = class {
4775
4616
  slot.module.default,
4776
4617
  slot.props
4777
4618
  );
4778
- slotElement = this.wrapClientGraph(slotElement);
4619
+ if (slot.shouldHydrate) slotElement = this.wrapClientGraph(slotElement);
4779
4620
  slotElement = this.rendererRuntime.createElement(
4780
4621
  "div",
4781
4622
  {
@@ -4979,11 +4820,11 @@ var ServerRenderer = class {
4979
4820
  if (isFarmIntegrationProviderComponentReference(provider.component)) {
4980
4821
  providerSourceModule = provider.component.module;
4981
4822
  const providerModuleId = provider.component.module.startsWith(".") ? toViteModuleId(
4982
- path10.resolve(this.config.root, provider.component.module),
4823
+ path9.resolve(this.config.root, provider.component.module),
4983
4824
  this.config.root
4984
4825
  ) : provider.component.module;
4985
4826
  const providerModule = this.viteServer ? await loadFarmDevModule(this.viteServer, providerModuleId) : await importRuntimeModule(
4986
- provider.component.module.startsWith(".") ? pathToFileURL2(path10.resolve(this.config.root, provider.component.module)).href : provider.component.module
4827
+ provider.component.module.startsWith(".") ? pathToFileURL2(path9.resolve(this.config.root, provider.component.module)).href : provider.component.module
4987
4828
  );
4988
4829
  ProviderComponent = providerModule[provider.component.export || "default"];
4989
4830
  } else if (typeof provider.component === "function") {
@@ -5074,7 +4915,9 @@ var ServerRenderer = class {
5074
4915
  );
5075
4916
  metadata = addMetadataMarkdownAlternate(
5076
4917
  metadata,
5077
- getFarmMarkdownAlternatePath(resolveMarkdownConfig(this.config.md), publicPathname)
4918
+ getFarmMarkdownAlternatePath(resolveMarkdownConfig(this.config.md), publicPathname, {
4919
+ routePathname: (pathname) => this.routeManager.toRoutePathname(pathname)
4920
+ })
5078
4921
  );
5079
4922
  return metadata;
5080
4923
  }
@@ -5147,7 +4990,7 @@ var ServerRenderer = class {
5147
4990
  ...llmsContext
5148
4991
  }) : routeModule.default;
5149
4992
  const body = match.metadata.kind === "llms-full" && !(value instanceof Response) ? await renderFarmLlmsFullTxt(value, {
5150
- origin: url.origin,
4993
+ origin: await this.getAgentOrigin(request2),
5151
4994
  readMarkdown: llmsContext.markdown
5152
4995
  }) : value;
5153
4996
  const response = createFarmMetadataRouteResponse(match.metadata.kind, body, routeModule, {
@@ -5181,7 +5024,7 @@ var ServerRenderer = class {
5181
5024
  const config = resolveFarmLlmsTxtConfig(this.config.agent?.llmsTxt);
5182
5025
  const context = await this.createLlmsTxtContext(request2, { full: kind === "llms-full", req });
5183
5026
  const body = kind === "llms-full" ? await renderFarmLlmsFullTxt(context.defaults, {
5184
- origin: new URL(request2.url).origin,
5027
+ origin: await this.getAgentOrigin(request2),
5185
5028
  readMarkdown: context.markdown
5186
5029
  }) : context.defaults;
5187
5030
  await sendWebResponse(
@@ -5250,19 +5093,23 @@ var ServerRenderer = class {
5250
5093
  logger.warn(`Could not read metadata for ${pattern} in sitemap.xml: ${error}`);
5251
5094
  return void 0;
5252
5095
  }),
5253
- fs6.promises.stat(route.modulePath).catch(() => void 0)
5096
+ fs5.promises.stat(route.modulePath).catch(() => void 0)
5254
5097
  ]);
5098
+ if (await this.isAgentPageNoIndex(pattern, module?.metadata)) return null;
5255
5099
  return { pattern, module, lastModified: stat?.mtime.toISOString() };
5256
5100
  })
5257
5101
  );
5258
5102
  const rootLayout = this.routeManager.getLayouts().get("/");
5259
5103
  const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
5260
- const sitemap = createFarmDefaultSitemap(sources, {
5261
- origin: new URL(request2.url).origin,
5262
- config: this.getAgentSitemap(),
5263
- metadataBase: rootMetadata?.metadataBase,
5264
- basePath: this.config.basePath
5265
- });
5104
+ const sitemap = createFarmDefaultSitemap(
5105
+ sources.filter((source) => source !== null),
5106
+ {
5107
+ origin: new URL(request2.url).origin,
5108
+ config: this.getAgentSitemap(),
5109
+ metadataBase: rootMetadata?.metadataBase,
5110
+ basePath: this.config.basePath
5111
+ }
5112
+ );
5266
5113
  await sendWebResponse(
5267
5114
  res,
5268
5115
  createFarmMetadataRouteResponse("sitemap", sitemap, {}, { method: req.method })
@@ -5297,6 +5144,21 @@ var ServerRenderer = class {
5297
5144
  ([pattern]) => !pattern.includes("[") && !farmPathGuardCoversPage(guards, pattern)
5298
5145
  );
5299
5146
  }
5147
+ /**
5148
+ * Whether a listed page renders noindex: its own `robots`, else its nearest layout's, as
5149
+ * the production server decides. A layout that fails to load is surfaced by the page.
5150
+ */
5151
+ async isAgentPageNoIndex(pattern, metadata) {
5152
+ const layoutMetadata = await Promise.all(
5153
+ this.routeManager.getRouteLayouts(pattern).map(
5154
+ (layout) => this.routeManager.loadLayoutModule(layout.modulePath).then(
5155
+ (module) => module.metadata,
5156
+ () => void 0
5157
+ )
5158
+ )
5159
+ );
5160
+ return isFarmPageNoIndex(metadata, layoutMetadata);
5161
+ }
5300
5162
  /**
5301
5163
  * The default read-only MCP server (`agent.mcp`), or undefined when the app has an MCP
5302
5164
  * server of its own: a route that answers /mcp, an API route at /api/mcp, `@farm.js/mcp`,
@@ -5316,25 +5178,27 @@ var ServerRenderer = class {
5316
5178
  const server = this.getDefaultMCPServer();
5317
5179
  const request2 = getCurrentRequestOrNull() ?? createWebRequestFromFarmRequest(req, { trustProxy: this.config.server?.trustProxy });
5318
5180
  try {
5319
- const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-QLFDDTYN.mjs");
5181
+ const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-AZ7QW4UP.mjs");
5320
5182
  const origin = new URL(request2.url).origin;
5321
5183
  const response = await handleFarmDefaultMCPRequest(request2, {
5322
5184
  server,
5323
5185
  basePath: this.config.basePath,
5324
5186
  listPages: async () => {
5325
5187
  const sources = await Promise.all(
5326
- this.getAgentListedRoutes().map(async ([pattern, route]) => ({
5327
- pattern,
5328
- // The page itself surfaces a load error. Without its module a guard cannot
5329
- // be ruled out, so the page is left out.
5330
- module: await this.routeManager.loadRouteModule(route.modulePath).catch(() => ({ __farmRouteGuard: true }))
5331
- }))
5188
+ this.getAgentListedRoutes().map(async ([pattern, route]) => {
5189
+ const module = await this.routeManager.loadRouteModule(route.modulePath).catch(() => ({ __farmRouteGuard: true }));
5190
+ const metadata = module.metadata;
5191
+ return await this.isAgentPageNoIndex(pattern, metadata) ? null : { pattern, module };
5192
+ })
5193
+ );
5194
+ return collectFarmDefaultMCPPages(
5195
+ sources.filter((source) => source !== null),
5196
+ {
5197
+ origin,
5198
+ basePath: this.config.basePath,
5199
+ markdown: resolveMarkdownConfig(this.config.md)
5200
+ }
5332
5201
  );
5333
- return collectFarmDefaultMCPPages(sources, {
5334
- origin,
5335
- basePath: this.config.basePath,
5336
- markdown: resolveMarkdownConfig(this.config.md)
5337
- });
5338
5202
  },
5339
5203
  // Pages are read through this server's own socket, with no cookies, as llms-full.txt does.
5340
5204
  readMarkdown: this.createDevMarkdownReader(req)
@@ -5358,12 +5222,13 @@ var ServerRenderer = class {
5358
5222
  /** Same inputs the production server gives llms.txt: static pages and root metadata. */
5359
5223
  async createLlmsTxtContext(request2, options = {}) {
5360
5224
  const config = resolveFarmLlmsTxtConfig(this.config.agent?.llmsTxt);
5361
- const origin = new URL(request2.url).origin;
5225
+ const origin = await this.getAgentOrigin(request2);
5362
5226
  const sources = await Promise.all(
5363
5227
  this.getAgentListedRoutes().map(async ([pattern, route]) => {
5364
5228
  try {
5365
5229
  const module = await this.routeManager.loadRouteModule(route.modulePath);
5366
5230
  if (module.__farmRouteGuard) return null;
5231
+ if (await this.isAgentPageNoIndex(pattern, module.metadata)) return null;
5367
5232
  return { pattern, metadata: module.metadata };
5368
5233
  } catch (error) {
5369
5234
  logger.warn(`Could not read metadata for ${pattern} in llms.txt: ${error}`);
@@ -5400,9 +5265,27 @@ var ServerRenderer = class {
5400
5265
  defaultMCP: () => this.getDefaultMCPServer()
5401
5266
  })
5402
5267
  }),
5403
- ...options.full ? { markdown: this.createDevMarkdownReader(options.req) } : {}
5268
+ ...options.full ? {
5269
+ markdown: readFarmLlmsMarkdownFrom(
5270
+ new URL(request2.url).origin,
5271
+ origin,
5272
+ this.createDevMarkdownReader(options.req)
5273
+ )
5274
+ } : {}
5404
5275
  };
5405
5276
  }
5277
+ /**
5278
+ * The origin llms.txt and llms-full.txt link to: the root layout's `metadataBase`, else the
5279
+ * request's origin, as for the sitemap and the production server.
5280
+ */
5281
+ async getAgentOrigin(request2) {
5282
+ const rootLayout = this.routeManager.getLayouts().get("/");
5283
+ const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
5284
+ return resolveFarmAgentOrigin(
5285
+ rootMetadata?.metadataBase,
5286
+ new URL(request2.url).origin
5287
+ );
5288
+ }
5406
5289
  /**
5407
5290
  * Reads page mirrors back through this dev server, the way its .md handler
5408
5291
  * renders pages, so Markdown sources and agent overrides are included. Requests
@@ -5501,7 +5384,7 @@ var ServerRenderer = class {
5501
5384
  res.end();
5502
5385
  return;
5503
5386
  }
5504
- res.write(await fs6.promises.readFile(image.modulePath));
5387
+ res.write(await fs5.promises.readFile(image.modulePath));
5505
5388
  res.end();
5506
5389
  }
5507
5390
  async renderRouteErrorBoundary(req, res, options) {
@@ -5929,7 +5812,7 @@ window.__FARM_LOADING_MODULE__ = ${JSON.stringify(
5929
5812
  window.__FARM_MANIFEST__ = ${JSON.stringify(clientManifest)};
5930
5813
  window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(getRegisteredIntegrationAPIManifest())};
5931
5814
  window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getFarmI18nClientSnapshot()) : "null"};
5932
- </script>`;
5815
+ </script>${renderFarmFormStateScript()}`;
5933
5816
  const islandsOnlyPage = this.islandValues() && req.__FARM_PAGE_SHOULD_HYDRATE__ !== true && req.__FARM_LAYOUT_SHOULD_HYDRATE__ !== true && req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ !== true;
5934
5817
  const rootStrategy = req.__FARM_ISLAND_STRATEGY__;
5935
5818
  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;
@@ -5968,6 +5851,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
5968
5851
  const earlyClientScript = bootClient ? createFarmDevBootScript(waitingRoot, rootStrategy) : FARM_DEV_EARLY_CLIENT_SCRIPT;
5969
5852
  const { pipe, abort } = renderToPipeableStream(streamRoot, {
5970
5853
  nonce: cspNonce,
5854
+ formState: getFarmFormState(),
5971
5855
  onShellReady() {
5972
5856
  if (pendingNavigationError) {
5973
5857
  abort?.(pendingNavigationError);
@@ -6247,6 +6131,22 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6247
6131
  }
6248
6132
  return false;
6249
6133
  }
6134
+ /**
6135
+ * The redirect a page-data request for `request` ended with. A `redirect()`
6136
+ * target is localized as a document render localizes it; a thrown 3xx
6137
+ * Response keeps its Location as written, as a document render sends it.
6138
+ */
6139
+ async resolvePageDataRedirect(request2, error) {
6140
+ const redirect = getFarmPageDataRedirect(error);
6141
+ if (!redirect || !isFarmRedirectError(error)) return redirect;
6142
+ return {
6143
+ status: redirect.status,
6144
+ location: await this.runWithRequestContext(
6145
+ request2,
6146
+ () => this.localizeRedirectUrl(redirect.location)
6147
+ )
6148
+ };
6149
+ }
6250
6150
  localizeRedirectUrl(url) {
6251
6151
  const snapshot = getFarmI18nClientSnapshot();
6252
6152
  return snapshot && url.startsWith("/") && !url.startsWith("//") ? localizeFarmHref(url, snapshot.locale, snapshot) : url;
@@ -6313,6 +6213,11 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6313
6213
  const pathname = resolveFarmRequestURL(req, {
6314
6214
  trustProxy: this.config.server?.trustProxy
6315
6215
  }).pathname;
6216
+ if (isFarmRendererDisabled(this.config.renderer)) {
6217
+ res.setHeader("Content-Type", "application/json");
6218
+ res.end(JSON.stringify({ error: "Not found", pathname }));
6219
+ return;
6220
+ }
6316
6221
  const acceptHeader = req.headers.accept;
6317
6222
  const accept = Array.isArray(acceptHeader) ? acceptHeader.join(",") : acceptHeader;
6318
6223
  if (farmRequestWantsMarkdown(pathname, accept)) {
@@ -6322,13 +6227,13 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6322
6227
  res.end(createFarmMarkdownErrorBody(404, pathname, this.config.basePath || "/"));
6323
6228
  return;
6324
6229
  }
6325
- const appDir = path10.join(this.config.root, this.config.srcDir, "app");
6230
+ const appDir = path9.join(this.config.root, this.config.srcDir, "app");
6326
6231
  const notFoundExtensions = getFarmRendererComponentExtensions(this.config.renderer);
6327
6232
  let layoutModule = null;
6328
6233
  try {
6329
6234
  for (const ext of notFoundExtensions) {
6330
- const layoutPath = path10.join(appDir, `layout${ext}`);
6331
- if (fs6.existsSync(layoutPath)) {
6235
+ const layoutPath = path9.join(appDir, `layout${ext}`);
6236
+ if (fs5.existsSync(layoutPath)) {
6332
6237
  layoutModule = await this.routeManager.loadLayoutModule(layoutPath);
6333
6238
  break;
6334
6239
  }
@@ -6541,7 +6446,7 @@ ${clientScript}
6541
6446
  };
6542
6447
 
6543
6448
  // src/app.ts
6544
- import path11 from "path";
6449
+ import path10 from "path";
6545
6450
  var defaultDocsConfig = {
6546
6451
  enabled: false,
6547
6452
  entry: "/docs",
@@ -6576,6 +6481,7 @@ var FarmApp = class {
6576
6481
  await this.serverRenderer.initialize();
6577
6482
  await this.verifyAppStructure();
6578
6483
  await this.routeManager.discoverRoutes();
6484
+ if (isFarmRendererDisabled(this.config.renderer)) this.assertNoPageRoutes();
6579
6485
  this.routeManager.generateClientManifest(this.config.root);
6580
6486
  if (process.env.FARM_VERBOSE) {
6581
6487
  logger.success("Farm.js application initialized successfully!");
@@ -6623,7 +6529,10 @@ var FarmApp = class {
6623
6529
  server: resolveFarmServerConfig(config.server),
6624
6530
  serverActions: resolveServerActionsConfig(config.serverActions),
6625
6531
  security: resolveFarmSecurityConfig(config.security),
6626
- images: resolveFarmImageConfig(config.images),
6532
+ images: resolveFarmImageConfig(
6533
+ config.images,
6534
+ isFarmRendererDisabled(config.renderer) ? "none" : void 0
6535
+ ),
6627
6536
  performance: resolveFarmPerformanceConfig(config.performance),
6628
6537
  theme: resolveFarmThemeConfig(config.theme, basePath),
6629
6538
  i18n: isResolvedI18nConfig(config.i18n) ? config.i18n : resolveFarmI18nConfig(config.i18n, {
@@ -6662,6 +6571,18 @@ var FarmApp = class {
6662
6571
  vite: config.vite || {}
6663
6572
  };
6664
6573
  }
6574
+ /** `renderer: false` serves no pages, so a page or layout file would silently never answer. */
6575
+ assertNoPageRoutes() {
6576
+ const files = [
6577
+ ...this.routeManager.getRoutes().values(),
6578
+ ...this.routeManager.getLayouts().values()
6579
+ ].map((entry) => path10.relative(this.config.root, entry.modulePath).split(path10.sep).join("/"));
6580
+ if (files.length === 0) return;
6581
+ throw new Error(
6582
+ `This app sets \`renderer: false\`, which serves API routes only, but it has pages or layouts:
6583
+ ` + [...new Set(files)].map((file) => ` - ${file}`).join("\n") + "\nRemove these files, or remove `renderer: false` to render pages."
6584
+ );
6585
+ }
6665
6586
  async verifyAppStructure() {
6666
6587
  const appDirs = getFarmAppDirectories(this.config);
6667
6588
  const hasAppDirectory = (await Promise.all(appDirs.map((appDir) => fileExists(appDir)))).some(
@@ -6681,12 +6602,12 @@ var FarmApp = class {
6681
6602
  }
6682
6603
  const componentExtensions = getFarmRendererComponentExtensions(this.config.renderer);
6683
6604
  const rootLayoutPaths = appDirs.flatMap(
6684
- (appDir) => componentExtensions.map((extension) => path11.join(appDir, `layout${extension}`))
6605
+ (appDir) => componentExtensions.map((extension) => path10.join(appDir, `layout${extension}`))
6685
6606
  );
6686
6607
  const hasRootLayout = await Promise.all(rootLayoutPaths.map((p) => fileExists(p))).then(
6687
6608
  (results) => results.some(Boolean)
6688
6609
  );
6689
- if (!hasRootLayout) {
6610
+ if (!hasRootLayout && !isFarmRendererDisabled(this.config.renderer)) {
6690
6611
  logger.warn(
6691
6612
  `No root layout found. Consider creating src/app/layout${componentExtensions[0]} for consistent page structure.`
6692
6613
  );
@@ -6745,13 +6666,13 @@ function resolveFarmImageServerRuntime(images, preset) {
6745
6666
  }
6746
6667
 
6747
6668
  // src/app-manifest-packages.ts
6748
- import fs7 from "fs";
6749
- import path12 from "path";
6669
+ import fs6 from "fs";
6670
+ import path11 from "path";
6750
6671
  var FARM_PACKAGE = /^@(?:farm\.js|farming-labs)\/[a-z0-9._-]+$/;
6751
6672
  function resolveFarmAppPackages(root) {
6752
6673
  let manifest;
6753
6674
  try {
6754
- manifest = JSON.parse(fs7.readFileSync(path12.join(root, "package.json"), "utf8"));
6675
+ manifest = JSON.parse(fs6.readFileSync(path11.join(root, "package.json"), "utf8"));
6755
6676
  } catch {
6756
6677
  return {};
6757
6678
  }
@@ -6766,13 +6687,13 @@ function resolveFarmAppPackages(root) {
6766
6687
  for (let dir = root; ; ) {
6767
6688
  try {
6768
6689
  const { version } = JSON.parse(
6769
- fs7.readFileSync(path12.join(dir, "node_modules", name, "package.json"), "utf8")
6690
+ fs6.readFileSync(path11.join(dir, "node_modules", name, "package.json"), "utf8")
6770
6691
  );
6771
6692
  if (typeof version === "string" && /^[0-9A-Za-z.+-]{1,64}$/.test(version))
6772
6693
  versions[name] = version;
6773
6694
  break;
6774
6695
  } catch {
6775
- const parent = path12.dirname(dir);
6696
+ const parent = path11.dirname(dir);
6776
6697
  if (parent === dir) break;
6777
6698
  dir = parent;
6778
6699
  }
@@ -6782,9 +6703,9 @@ function resolveFarmAppPackages(root) {
6782
6703
  }
6783
6704
 
6784
6705
  // src/app-manifest-webmcp.ts
6785
- import fs8 from "fs";
6706
+ import fs7 from "fs";
6786
6707
  import { createRequire as createRequire2 } from "module";
6787
- import path13 from "path";
6708
+ import path12 from "path";
6788
6709
  import { globSync } from "tinyglobby";
6789
6710
  var WEBMCP_CLIENT = "@farm.js/webmcp/client";
6790
6711
  var DEFINERS = /* @__PURE__ */ new Set(["defineWebMCPTool", "registerWebMCPTool", "registerWebMCPTools"]);
@@ -6879,7 +6800,7 @@ function toolFromObject(object) {
6879
6800
  }
6880
6801
  function findFarmWebMCPTools(code, filename = "module.tsx") {
6881
6802
  if (!code.includes(WEBMCP_CLIENT)) return [];
6882
- const lang = LANGS[path13.extname(filename).slice(1)] ?? "tsx";
6803
+ const lang = LANGS[path12.extname(filename).slice(1)] ?? "tsx";
6883
6804
  parseAst2 ?? (parseAst2 = createRequire2(typeof __filename === "string" ? __filename : import.meta.url)(
6884
6805
  "rolldown/parseAst"
6885
6806
  ).parseAst);
@@ -6926,7 +6847,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
6926
6847
  }
6927
6848
  var cache = /* @__PURE__ */ new Map();
6928
6849
  function collectFarmWebMCPTools(root, srcDir = "src") {
6929
- const base = path13.resolve(root, srcDir);
6850
+ const base = path12.resolve(root, srcDir);
6930
6851
  let files;
6931
6852
  try {
6932
6853
  files = globSync("**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}", {
@@ -6943,7 +6864,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
6943
6864
  for (const file of files.sort()) {
6944
6865
  let mtimeMs;
6945
6866
  try {
6946
- mtimeMs = fs8.statSync(file).mtimeMs;
6867
+ mtimeMs = fs7.statSync(file).mtimeMs;
6947
6868
  } catch {
6948
6869
  continue;
6949
6870
  }
@@ -6951,7 +6872,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
6951
6872
  if (!entry || entry.mtimeMs !== mtimeMs) {
6952
6873
  let code = "";
6953
6874
  try {
6954
- code = fs8.readFileSync(file, "utf8");
6875
+ code = fs7.readFileSync(file, "utf8");
6955
6876
  } catch {
6956
6877
  }
6957
6878
  entry = { mtimeMs, tools: findFarmWebMCPTools(code, file) };
@@ -6967,8 +6888,8 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
6967
6888
  }
6968
6889
 
6969
6890
  // src/client-cache-persistence-build.ts
6970
- import fs9 from "fs";
6971
- import path14 from "path";
6891
+ import fs8 from "fs";
6892
+ import path13 from "path";
6972
6893
  var ADAPTER_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
6973
6894
  function resolveFarmClientCacheAdapterEntry(root, cache2) {
6974
6895
  const client = cache2?.client;
@@ -6979,7 +6900,7 @@ function resolveFarmClientCacheAdapterEntry(root, cache2) {
6979
6900
  'cache.client.adapter must be a module path string, for example "./src/cache-adapter".'
6980
6901
  );
6981
6902
  }
6982
- const resolved = path14.resolve(root, adapter);
6903
+ const resolved = path13.resolve(root, adapter);
6983
6904
  const found = resolveAdapterFile(resolved);
6984
6905
  if (!found) {
6985
6906
  throw new Error(
@@ -6992,10 +6913,10 @@ function resolveFarmClientCacheAdapterEntry(root, cache2) {
6992
6913
  return { importPath: found.replace(/\\/g, "/"), options };
6993
6914
  }
6994
6915
  function resolveAdapterFile(resolved) {
6995
- if (fs9.existsSync(resolved) && fs9.statSync(resolved).isFile()) return resolved;
6916
+ if (fs8.existsSync(resolved) && fs8.statSync(resolved).isFile()) return resolved;
6996
6917
  for (const extension of ADAPTER_EXTENSIONS) {
6997
6918
  const candidate = `${resolved}.${extension}`;
6998
- if (fs9.existsSync(candidate) && fs9.statSync(candidate).isFile()) return candidate;
6919
+ if (fs8.existsSync(candidate) && fs8.statSync(candidate).isFile()) return candidate;
6999
6920
  }
7000
6921
  return void 0;
7001
6922
  }
@@ -7158,6 +7079,83 @@ async function buildFarmTreeLayouts(layouts, params, source, options) {
7158
7079
  }
7159
7080
  `;
7160
7081
 
7082
+ // src/client/navigation-scripts.ts
7083
+ var FARM_NAVIGATION_SCRIPT_SOURCE = `// The nonce the page's Content Security Policy trusts: the one of the response that loaded the
7084
+ // document, read once, before a navigation adds scripts that carry another response's nonce.
7085
+ const farmDocumentScriptNonce = (function() {
7086
+ if (typeof document === "undefined") return "";
7087
+ const script = document.querySelector("script[data-farm-runtime]") || document.querySelector("script[nonce]");
7088
+ return (script && script.nonce) || "";
7089
+ })();
7090
+
7091
+ // A runnable copy of a script a navigation inserted as markup. A script its response nonced runs
7092
+ // with the page's nonce; one it left without a nonce stays without, so the policy still blocks it.
7093
+ function createFarmNavigationScript(script) {
7094
+ const freshScript = document.createElement("script");
7095
+ for (const attribute of Array.from(script.attributes)) {
7096
+ if (attribute.name !== "nonce") freshScript.setAttribute(attribute.name, attribute.value);
7097
+ }
7098
+ if (farmDocumentScriptNonce && (script.nonce || script.getAttribute("nonce"))) {
7099
+ freshScript.nonce = farmDocumentScriptNonce;
7100
+ }
7101
+ freshScript.textContent = script.textContent || "";
7102
+ return freshScript;
7103
+ }
7104
+ // React streams Suspense content after its fallback, in a hidden segment that a reveal script
7105
+ // ($RC for a boundary, $RS for a segment placeholder) moves into place. This makes the same moves
7106
+ // in a parsed page, before it goes on screen, and drops the calls it made, so the islands in that
7107
+ // content are where the swap looks for them (a refresh keeps them).
7108
+ function revealFarmStreamedContent(root) {
7109
+ const find = function(id) {
7110
+ return root.querySelector('[id="' + id.replace(/"/g, "") + '"]');
7111
+ };
7112
+ for (const script of Array.from(root.querySelectorAll("script:not([type]), script[type='text/javascript']"))) {
7113
+ const source = script.textContent || "";
7114
+ if (source.indexOf("$RC(") === -1 && source.indexOf("$RS(") === -1) continue;
7115
+ let rest = source;
7116
+ for (const call of source.matchAll(/\\$R([CS])\\("([^"]+)","([^"]+)"\\);?/g)) {
7117
+ const [text, kind, first, second] = call;
7118
+ if (kind === "S") {
7119
+ const segment = find(first);
7120
+ const placeholder = find(second);
7121
+ if (!segment || !placeholder) continue;
7122
+ while (segment.firstChild) placeholder.parentNode.insertBefore(segment.firstChild, placeholder);
7123
+ placeholder.remove();
7124
+ segment.remove();
7125
+ } else {
7126
+ const boundary = find(first);
7127
+ const segment = find(second);
7128
+ if (!boundary || !segment) continue;
7129
+ const parent = boundary.parentNode;
7130
+ const start = boundary.previousSibling;
7131
+ // The fallback goes, up to the boundary's closing comment (nested boundaries skipped).
7132
+ let node = boundary;
7133
+ let depth = 0;
7134
+ while (node) {
7135
+ if (node.nodeType === 8) {
7136
+ const data = node.data;
7137
+ if (data === "/$" || data === "/&") {
7138
+ if (depth === 0) break;
7139
+ depth--;
7140
+ } else if (data === "$" || data === "$?" || data === "$~" || data === "$!" || data === "&") {
7141
+ depth++;
7142
+ }
7143
+ }
7144
+ const next = node.nextSibling;
7145
+ parent.removeChild(node);
7146
+ node = next;
7147
+ }
7148
+ while (segment.firstChild) parent.insertBefore(segment.firstChild, node);
7149
+ segment.remove();
7150
+ if (start && start.nodeType === 8) start.data = "$";
7151
+ }
7152
+ rest = rest.replace(text, "");
7153
+ }
7154
+ script.textContent = rest;
7155
+ }
7156
+ }
7157
+ `;
7158
+
7161
7159
  // src/client/navigation-stream-client.ts
7162
7160
  var FARM_NAVIGATION_STREAM_READER_SOURCE = `// Reads a streamed navigation (F-Stream) up to the end of React's shell. \`next\` then resolves
7163
7161
  // with each later flush as it ends, and null at the end; a document without a marker is all shell.
@@ -7202,8 +7200,93 @@ async function readFarmNavigationStream(body, flushToken) {
7202
7200
  };
7203
7201
  }`;
7204
7202
 
7205
- // src/docs/client-config.ts
7203
+ // src/client/refresh-fields.ts
7204
+ var FARM_REFRESH_FIELDS_SOURCE = `// The server-rendered fields of a tree: islands keep their own.
7205
+ function listFarmServerFields(root) {
7206
+ return Array.from(root.querySelectorAll("input, textarea, select")).filter(function(field) {
7207
+ return !field.closest("f-island");
7208
+ });
7209
+ }
7210
+
7211
+ // Reads the fields of a tree about to be replaced: their order, and which one has the focus.
7212
+ function captureFarmServerFields(root) {
7213
+ const fields = listFarmServerFields(root);
7214
+ const focused = fields.indexOf(document.activeElement);
7215
+ const field = fields[focused];
7216
+ let selection = null;
7217
+ try {
7218
+ if (field && typeof field.selectionStart === "number") {
7219
+ selection = [field.selectionStart, field.selectionEnd, field.selectionDirection];
7220
+ }
7221
+ } catch {}
7222
+ return { fields, focused, selection };
7223
+ }
7224
+
7225
+ function isSameFarmField(current, next) {
7226
+ return current.tagName === next.tagName &&
7227
+ current.type === next.type &&
7228
+ current.name === next.name &&
7229
+ current.id === next.id;
7230
+ }
7231
+
7232
+ // Gives the replacing tree's fields what the user changed in the replaced one, and the focus.
7233
+ function restoreFarmServerFields(captured, root) {
7234
+ const fields = listFarmServerFields(root);
7235
+ captured.fields.forEach(function(current, index) {
7236
+ const next = fields[index];
7237
+ if (!next || !isSameFarmField(current, next)) return;
7238
+ if (current.form && current.form.getAttribute("aria-busy") === "true") return;
7239
+ if (current.tagName === "SELECT") {
7240
+ const changed = Array.from(current.options).some(function(option) {
7241
+ return option.selected !== option.defaultSelected;
7242
+ });
7243
+ if (!changed) return;
7244
+ const values = new Set(Array.from(current.selectedOptions, function(option) {
7245
+ return option.value;
7246
+ }));
7247
+ Array.from(next.options).forEach(function(option) {
7248
+ option.selected = values.has(option.value);
7249
+ });
7250
+ } else if (current.type === "checkbox" || current.type === "radio") {
7251
+ if (current.checked !== current.defaultChecked) next.checked = current.checked;
7252
+ } else if (current.type !== "file" && current.value !== current.defaultValue) {
7253
+ next.value = current.value;
7254
+ }
7255
+ });
7256
+ const focused = fields[captured.focused];
7257
+ if (!focused || !isSameFarmField(captured.fields[captured.focused], focused)) return;
7258
+ focused.focus({ preventScroll: true });
7259
+ if (captured.selection) {
7260
+ try {
7261
+ focused.setSelectionRange(captured.selection[0], captured.selection[1], captured.selection[2]);
7262
+ } catch {}
7263
+ }
7264
+ }
7265
+ `;
7266
+
7267
+ // src/utils/hook-filters.ts
7206
7268
  import { realpathSync as realpathSync2 } from "fs";
7269
+ import path14 from "path";
7270
+ function escapeRegExp(value) {
7271
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
7272
+ }
7273
+ function exactIdPattern(ids) {
7274
+ return new RegExp(`^(?:${ids.map(escapeRegExp).join("|")})(?:\\?.*)?$`);
7275
+ }
7276
+ function fileNamePattern(files) {
7277
+ const names = /* @__PURE__ */ new Set();
7278
+ for (const file of files) {
7279
+ names.add(path14.basename(file));
7280
+ try {
7281
+ names.add(path14.basename(realpathSync2(file)));
7282
+ } catch {
7283
+ }
7284
+ }
7285
+ return new RegExp(`(?:^|/)(?:${[...names].map(escapeRegExp).join("|")})(?:\\?.*)?$`);
7286
+ }
7287
+
7288
+ // src/docs/client-config.ts
7289
+ import { realpathSync as realpathSync3 } from "fs";
7207
7290
  import { createRequire as createRequire3 } from "module";
7208
7291
  import path15 from "path";
7209
7292
  var parseAst3;
@@ -7262,7 +7345,7 @@ function isFarmDocsClientConfigModule(id, configModule) {
7262
7345
  const file = id.split("?")[0].replace(/\\/g, "/");
7263
7346
  if (file === configModule) return true;
7264
7347
  try {
7265
- return file === realpathSync2(configModule).replace(/\\/g, "/");
7348
+ return file === realpathSync3(configModule).replace(/\\/g, "/");
7266
7349
  } catch {
7267
7350
  return false;
7268
7351
  }
@@ -7271,10 +7354,14 @@ function farmDocsClientConfigPlugin(configModule) {
7271
7354
  return {
7272
7355
  name: "farm:docs-client-config",
7273
7356
  enforce: "pre",
7274
- transform(code, id, options) {
7275
- if (options?.ssr || !isFarmDocsClientConfigModule(id, configModule)) return null;
7276
- const redacted = redactFarmDocsClientConfig(code, id.split("?")[0]);
7277
- return redacted === null ? null : { code: redacted, map: null };
7357
+ transform: {
7358
+ // Never matches without a docs config module, so the bundler never calls the handler.
7359
+ filter: { id: configModule ? fileNamePattern([configModule]) : /(?!)/ },
7360
+ handler(code, id, options) {
7361
+ if (options?.ssr || !isFarmDocsClientConfigModule(id, configModule)) return null;
7362
+ const redacted = redactFarmDocsClientConfig(code, id.split("?")[0]);
7363
+ return redacted === null ? null : { code: redacted, map: null };
7364
+ }
7278
7365
  }
7279
7366
  };
7280
7367
  }
@@ -7315,6 +7402,7 @@ function createFarmClientOptimizeDepsEntries(projectRoot, appDirectories) {
7315
7402
  });
7316
7403
  }
7317
7404
  function createFarmClientOptimizeDepsConfig(entries, renderer) {
7405
+ if (isFarmRendererDisabled(renderer)) return { noDiscovery: true, include: [] };
7318
7406
  return {
7319
7407
  // Keep normal application dependency discovery for CJS-only packages, but
7320
7408
  // seed every Farm browser runtime so React is present in the first crawl.
@@ -7322,7 +7410,7 @@ function createFarmClientOptimizeDepsConfig(entries, renderer) {
7322
7410
  // Waiting for the crawl avoids serving a partial optimizer generation and
7323
7411
  // then changing browser hashes while hydration is already in progress.
7324
7412
  holdUntilCrawlEnd: true,
7325
- include: getFarmClientOptimizeDepsInclude(renderer),
7413
+ include: getFarmClientOptimizeDepsInclude(renderer || void 0),
7326
7414
  // Farm's HTML boots through a virtual module and imports route UI lazily.
7327
7415
  // Explicit entries let Vite finish that crawl before a navigation can
7328
7416
  // rotate the optimizer hash underneath a hydrated React runtime.
@@ -7463,17 +7551,20 @@ function createFarmThemeCssPlugin(input, basePath = "/") {
7463
7551
  return {
7464
7552
  name: "farm:theme-css",
7465
7553
  enforce: "pre",
7466
- transform(code, id) {
7467
- if (!config.enabled || !/\.css(?:\?.*)?$/.test(id) || !/@import\s+["']tailwindcss["']/.test(code) || /@custom-variant\s+dark\b/.test(code)) {
7468
- return null;
7469
- }
7470
- return {
7471
- code: `${code.trimEnd()}
7554
+ transform: {
7555
+ filter: { id: /\.css(?:\?.*)?$/, code: /@import\s+["']tailwindcss["']/ },
7556
+ handler(code, id) {
7557
+ if (!config.enabled || !/\.css(?:\?.*)?$/.test(id) || !/@import\s+["']tailwindcss["']/.test(code) || /@custom-variant\s+dark\b/.test(code)) {
7558
+ return null;
7559
+ }
7560
+ return {
7561
+ code: `${code.trimEnd()}
7472
7562
 
7473
7563
  ${FARM_DARK_VARIANT}
7474
7564
  `,
7475
- map: null
7476
- };
7565
+ map: null
7566
+ };
7567
+ }
7477
7568
  }
7478
7569
  };
7479
7570
  }
@@ -7490,7 +7581,6 @@ export {
7490
7581
  generateFarmIntegrationProviderServerModules,
7491
7582
  inferFarmIslandStrategy,
7492
7583
  resolveFarmRouteRootStrategy,
7493
- generateFarmClientPluginEntryCode,
7494
7584
  canBootFarmIslandsClient,
7495
7585
  ServerRenderer,
7496
7586
  FarmApp,
@@ -7504,7 +7594,11 @@ export {
7504
7594
  generateClientCachePersistenceCode,
7505
7595
  FARM_LAYOUT_ELEMENT_CLIENT_SOURCE,
7506
7596
  FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE,
7597
+ FARM_NAVIGATION_SCRIPT_SOURCE,
7507
7598
  FARM_NAVIGATION_STREAM_READER_SOURCE,
7599
+ FARM_REFRESH_FIELDS_SOURCE,
7600
+ exactIdPattern,
7601
+ fileNamePattern,
7508
7602
  redactFarmDocsClientConfig,
7509
7603
  isFarmDocsClientConfigModule,
7510
7604
  farmDocsClientConfigPlugin,