@farm.js/core 0.1.73 → 0.1.75

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 (481) hide show
  1. package/dist/{agent-mcp-handler-VBCA3WZ6.cjs → agent-mcp-handler-73SGWVZT.cjs} +9 -9
  2. package/dist/{agent-mcp-handler-RK7LDYEL.mjs → agent-mcp-handler-PJKZHYSA.mjs} +8 -8
  3. package/dist/{agent-mcp.d-D_gHjCAE.d.ts → agent-mcp.d-Djvao5eV.d.ts} +24 -2
  4. package/dist/{agent-mcp.d-PvEf-1mi.d.mts → agent-mcp.d-wA13pwmS.d.mts} +24 -2
  5. package/dist/agent-runtime.cjs +9 -9
  6. package/dist/agent-runtime.d.mts +4 -4
  7. package/dist/agent-runtime.d.ts +4 -4
  8. package/dist/agent-runtime.mjs +8 -8
  9. package/dist/analyzer-23GCBYFI.cjs +16 -0
  10. package/dist/{analyzer-MFYCJT75.mjs → analyzer-LJHMFCDW.mjs} +2 -2
  11. package/dist/api/client.cjs +4 -4
  12. package/dist/api/client.d.mts +3 -3
  13. package/dist/api/client.d.ts +3 -3
  14. package/dist/api/client.mjs +3 -3
  15. package/dist/api/client.native.cjs +6 -6
  16. package/dist/api/client.native.d.mts +4 -4
  17. package/dist/api/client.native.d.ts +4 -4
  18. package/dist/api/client.native.mjs +3 -3
  19. package/dist/api/node.cjs +14 -13
  20. package/dist/api/node.d.mts +6 -6
  21. package/dist/api/node.d.ts +6 -6
  22. package/dist/api/node.mjs +13 -12
  23. package/dist/api/route-manager.cjs +23 -21
  24. package/dist/api/route-manager.d.mts +9 -7
  25. package/dist/api/route-manager.d.ts +9 -7
  26. package/dist/api/route-manager.mjs +22 -20
  27. package/dist/api/runtime.cjs +13 -12
  28. package/dist/api/runtime.d.mts +5 -5
  29. package/dist/api/runtime.d.ts +5 -5
  30. package/dist/api/runtime.mjs +12 -11
  31. package/dist/{api-client.d-Bp35zMqR.d.mts → api-client.d-CyVmI4Di.d.mts} +2 -2
  32. package/dist/{api-client.d-CFI_xL0V.d.ts → api-client.d-DrTM7BdH.d.ts} +2 -2
  33. package/dist/api.cjs +26 -24
  34. package/dist/api.d.mts +9 -9
  35. package/dist/api.d.ts +9 -9
  36. package/dist/api.mjs +25 -23
  37. package/dist/{app-manifest.d-BpVTg43i.d.ts → app-manifest.d-BukcP_EV.d.ts} +10 -1
  38. package/dist/{app-manifest.d-CN7cEWHX.d.mts → app-manifest.d-DIuqSi9k.d.mts} +10 -1
  39. package/dist/app-markdown.cjs +11 -7
  40. package/dist/app-markdown.d.mts +6 -6
  41. package/dist/app-markdown.d.ts +6 -6
  42. package/dist/app-markdown.mjs +10 -6
  43. package/dist/{app.d-DO4PTCWm.d.ts → app.d-BQqmM6Gy.d.ts} +55 -4
  44. package/dist/{app.d-BFWzAdTe.d.mts → app.d-YVuFb10p.d.mts} +55 -4
  45. package/dist/{base-path.d-BJ3SYpB8.d.mts → base-path.d-m7wvRMnG.d.mts} +15 -1
  46. package/dist/{base-path.d-BJ3SYpB8.d.ts → base-path.d-m7wvRMnG.d.ts} +15 -1
  47. package/dist/cache.cjs +2 -2
  48. package/dist/cache.d.mts +22 -1
  49. package/dist/cache.d.ts +22 -1
  50. package/dist/cache.mjs +1 -1
  51. package/dist/{chunk-JYNNIGQO.cjs → chunk-25JGHAGH.cjs} +11 -1
  52. package/dist/{chunk-GWXZS7K5.mjs → chunk-2LKUR5QJ.mjs} +1 -1
  53. package/dist/{chunk-Z3IN6GEX.mjs → chunk-2NQ3S2SJ.mjs} +69 -12
  54. package/dist/chunk-2PJVEL56.cjs +90 -0
  55. package/dist/{chunk-HDPT6OYE.cjs → chunk-2RSVYJT6.cjs} +28 -4
  56. package/dist/{chunk-HGB4PM2C.cjs → chunk-2YJ4DHTD.cjs} +104 -32
  57. package/dist/{chunk-MGZVDX4R.mjs → chunk-3AJQFVWW.mjs} +3 -3
  58. package/dist/{chunk-E3HDJCWF.mjs → chunk-3GMD2E4Q.mjs} +3 -3
  59. package/dist/{chunk-JWY66PID.cjs → chunk-42EUEYW6.cjs} +21 -13
  60. package/dist/{chunk-255J7K4X.mjs → chunk-47R7CX4A.mjs} +6 -6
  61. package/dist/chunk-4PWGLPL6.mjs +284 -0
  62. package/dist/{chunk-7S7AAK2D.mjs → chunk-4QBFYEDC.mjs} +2 -1
  63. package/dist/{chunk-6O6PAZZR.mjs → chunk-4T2RB4JA.mjs} +5 -5
  64. package/dist/{chunk-XGTFLG73.cjs → chunk-4VLXQ55O.cjs} +37 -25
  65. package/dist/{chunk-KTDG4THT.cjs → chunk-4ZSZI6XL.cjs} +17 -17
  66. package/dist/{chunk-XGJVRPYL.cjs → chunk-52LTENRE.cjs} +3 -3
  67. package/dist/{chunk-QIXEU2WV.cjs → chunk-5AMH6AFA.cjs} +5 -3
  68. package/dist/{chunk-AYP2YFVN.mjs → chunk-5KAEGBIL.mjs} +75 -42
  69. package/dist/{chunk-WW3LRNQV.mjs → chunk-5O3SK3ZC.mjs} +5 -5
  70. package/dist/{chunk-GPO3LJDJ.cjs → chunk-5QZT2EQN.cjs} +2 -2
  71. package/dist/{chunk-RLFGKJQ6.mjs → chunk-5WFPZG7K.mjs} +20 -8
  72. package/dist/chunk-5XD2ULJG.mjs +114 -0
  73. package/dist/{chunk-4HGLJOXZ.cjs → chunk-62DZHPDK.cjs} +16 -11
  74. package/dist/{chunk-YXIQYWOK.cjs → chunk-63EFR2WF.cjs} +27 -8
  75. package/dist/{chunk-2RCCFB2Y.cjs → chunk-6B44ZU5P.cjs} +11 -11
  76. package/dist/{chunk-HFUOLILA.cjs → chunk-6D3CJFNU.cjs} +37 -21
  77. package/dist/{chunk-JX5VOLAV.cjs → chunk-6DBBMQWT.cjs} +38 -38
  78. package/dist/{chunk-FRO4BB2T.mjs → chunk-6MATGOEF.mjs} +1 -1
  79. package/dist/{chunk-CLEWORVY.cjs → chunk-7564NP5Z.cjs} +40 -43
  80. package/dist/{chunk-7H45IJWO.mjs → chunk-7DBJ2SWK.mjs} +1 -1
  81. package/dist/chunk-7E4FDO5X.mjs +265 -0
  82. package/dist/{chunk-FPBOAG6N.cjs → chunk-7EOSFIPN.cjs} +3 -3
  83. package/dist/{chunk-ICFPTHXM.mjs → chunk-7FQFK3OA.mjs} +7 -3
  84. package/dist/{chunk-TUOO6IK3.mjs → chunk-7H2TXT2K.mjs} +11 -1
  85. package/dist/{chunk-A4PWGL46.mjs → chunk-7KDCVSTR.mjs} +4 -4
  86. package/dist/{chunk-GPICBTDV.cjs → chunk-7Q2YWZF7.cjs} +6 -6
  87. package/dist/{chunk-CFG4QERR.cjs → chunk-7Q7UB4TL.cjs} +2 -2
  88. package/dist/{chunk-GJEC5S4V.mjs → chunk-7VCLTNED.mjs} +1 -1
  89. package/dist/chunk-A3LNXQJJ.cjs +265 -0
  90. package/dist/{chunk-IBVN7SW5.mjs → chunk-A5F55ZFA.mjs} +472 -143
  91. package/dist/{chunk-S6O2L47H.mjs → chunk-AG27TI6Q.mjs} +67 -5
  92. package/dist/{chunk-DC2AXGNZ.mjs → chunk-AM2M56SL.mjs} +1 -1
  93. package/dist/{chunk-JRHGJVJH.mjs → chunk-B5QRNCIE.mjs} +1 -1
  94. package/dist/{chunk-OIP62QEL.mjs → chunk-BGUTIQII.mjs} +24 -9
  95. package/dist/{chunk-DMAP4RND.cjs → chunk-BNCKXPCU.cjs} +98 -16
  96. package/dist/{chunk-TDCP3Z4T.cjs → chunk-BNTRXJL4.cjs} +3 -3
  97. package/dist/{chunk-BPAXGCKX.mjs → chunk-BRNPLD22.mjs} +30 -17
  98. package/dist/{chunk-JZGL2PIH.mjs → chunk-CDT7CGQT.mjs} +2 -2
  99. package/dist/{chunk-FEFCISOX.cjs → chunk-CEVXKJKF.cjs} +2 -2
  100. package/dist/{chunk-YZLEOMMA.mjs → chunk-CF74ABRI.mjs} +10 -10
  101. package/dist/chunk-CIY74JLV.cjs +134 -0
  102. package/dist/{chunk-FETMUBIA.mjs → chunk-CLM73YYD.mjs} +2 -2
  103. package/dist/{chunk-ME7RVELR.mjs → chunk-CSAIIMY3.mjs} +21 -2
  104. package/dist/{chunk-YAEN3L2F.cjs → chunk-CYNQPKA4.cjs} +23 -4
  105. package/dist/{chunk-M53MIIXY.mjs → chunk-CZOXZ6WQ.mjs} +1 -1
  106. package/dist/{chunk-Y2LU4LE5.mjs → chunk-DASQJ5UD.mjs} +2 -2
  107. package/dist/{chunk-WVQNXXNE.cjs → chunk-DD22NQFX.cjs} +2 -2
  108. package/dist/{chunk-OBYM5S5G.mjs → chunk-DUSTJ6A5.mjs} +20 -17
  109. package/dist/{chunk-ZFEJ2SF2.cjs → chunk-DZ3AZ7UK.cjs} +52 -52
  110. package/dist/{chunk-6YFC3ZFX.mjs → chunk-DZXD6CYJ.mjs} +1 -1
  111. package/dist/{chunk-AZ6IW6SF.mjs → chunk-EMTN5ABC.mjs} +1 -1
  112. package/dist/{chunk-AQIO3RNL.mjs → chunk-ERT6HQAI.mjs} +8 -3
  113. package/dist/{chunk-JDO346NV.mjs → chunk-F35C3TJZ.mjs} +1 -1
  114. package/dist/{chunk-ODBM54RT.cjs → chunk-F4ID7BGO.cjs} +33 -30
  115. package/dist/{chunk-C7GJDVN4.mjs → chunk-F7MJWW6A.mjs} +1 -1
  116. package/dist/{chunk-5OFNUETM.mjs → chunk-FCAYYLAE.mjs} +27 -3
  117. package/dist/{chunk-PWKAX5MS.cjs → chunk-FDZZ6K3N.cjs} +6 -6
  118. package/dist/{chunk-MHLNWRCJ.cjs → chunk-FE6KYDHC.cjs} +3 -3
  119. package/dist/{chunk-PTLXHRJZ.mjs → chunk-FLMALEY2.mjs} +37 -4
  120. package/dist/{chunk-IHTDLCDJ.cjs → chunk-G7B6NU4X.cjs} +23 -10
  121. package/dist/{chunk-JZQS3ZOI.mjs → chunk-GAAK3HDZ.mjs} +36 -7
  122. package/dist/{chunk-QMNWKQL4.cjs → chunk-GC5ROI3A.cjs} +4 -4
  123. package/dist/{chunk-JXIYH2NO.cjs → chunk-GCJ4GNMC.cjs} +4 -4
  124. package/dist/{chunk-WX63N6C5.mjs → chunk-GFXKO4UW.mjs} +106 -37
  125. package/dist/{chunk-CYRIIVD4.mjs → chunk-GLF44JKY.mjs} +3 -3
  126. package/dist/{chunk-GUZC226X.mjs → chunk-GLVDXRG2.mjs} +1 -1
  127. package/dist/{chunk-GZOKWJIW.mjs → chunk-GNY7BO7R.mjs} +18 -11
  128. package/dist/{chunk-OWQV6MLM.cjs → chunk-GYJT2U7J.cjs} +2 -1
  129. package/dist/{chunk-MBCRWU3P.cjs → chunk-H7OFZJCV.cjs} +8 -8
  130. package/dist/{chunk-JMOCMXTQ.mjs → chunk-H7QY7ZE4.mjs} +1 -1
  131. package/dist/{chunk-5LOARKDP.cjs → chunk-HFJLMALC.cjs} +42 -30
  132. package/dist/{chunk-CROAFCMW.mjs → chunk-HONTCUK6.mjs} +1 -1
  133. package/dist/{chunk-7PJARAQQ.mjs → chunk-HQ2VAJLW.mjs} +1 -1
  134. package/dist/{chunk-SVQX5HYW.mjs → chunk-HT2SZKXG.mjs} +92 -10
  135. package/dist/{chunk-7GMBETHM.mjs → chunk-HV2WZFUW.mjs} +1 -1
  136. package/dist/{chunk-DMXMIE2C.cjs → chunk-HVJ7IACB.cjs} +15 -7
  137. package/dist/{chunk-S7MWSFFP.cjs → chunk-IBEHVSU4.cjs} +2 -2
  138. package/dist/{chunk-QGCSUC5O.mjs → chunk-IDOUCM2X.mjs} +521 -296
  139. package/dist/{chunk-FN5UEC7I.mjs → chunk-IG2JE6WJ.mjs} +1 -1
  140. package/dist/{chunk-MQ4DYVFS.cjs → chunk-IIHZ2BEE.cjs} +3 -3
  141. package/dist/{chunk-TAU3OF5B.cjs → chunk-IK33N2AN.cjs} +1373 -694
  142. package/dist/{chunk-UVQRMUAR.cjs → chunk-IVBDRAOR.cjs} +1 -1
  143. package/dist/{chunk-2AFW7673.cjs → chunk-IXO6O2EL.cjs} +8 -7
  144. package/dist/{chunk-U7VH3Q5E.cjs → chunk-IYFBLWXU.cjs} +56 -25
  145. package/dist/{chunk-NDDRTFN4.mjs → chunk-J7EUGGTY.mjs} +2 -2
  146. package/dist/{chunk-UVZMSRHF.mjs → chunk-JA6RML7C.mjs} +3 -3
  147. package/dist/{chunk-CL52PD6D.cjs → chunk-JHZ6HULQ.cjs} +12 -9
  148. package/dist/{chunk-HTXKSREF.cjs → chunk-JNZDTE75.cjs} +532 -203
  149. package/dist/{chunk-VT25ERQK.mjs → chunk-JRBWBMP2.mjs} +24 -5
  150. package/dist/{chunk-4CTCSKAF.mjs → chunk-K6DXKHFE.mjs} +1 -1
  151. package/dist/{chunk-AXVRUDMB.cjs → chunk-K6PGK7DC.cjs} +2 -2
  152. package/dist/{chunk-TY5KCYDE.mjs → chunk-KHS3T3E5.mjs} +20 -8
  153. package/dist/{chunk-ILQ5DKYF.cjs → chunk-KPYQ32BA.cjs} +2 -2
  154. package/dist/{chunk-CSLHNBPS.cjs → chunk-KQS27YN7.cjs} +6 -6
  155. package/dist/{chunk-XI3OXOMK.mjs → chunk-KUXEII7V.mjs} +1 -1
  156. package/dist/{chunk-CA7DNRHO.cjs → chunk-L6E5BSNU.cjs} +3 -3
  157. package/dist/{chunk-VNBDN5W2.cjs → chunk-L7Y65BQU.cjs} +128 -59
  158. package/dist/{chunk-73K53YPP.mjs → chunk-LPXJEZJK.mjs} +30 -14
  159. package/dist/{chunk-B67CW2LM.mjs → chunk-LQBV2Y37.mjs} +34 -37
  160. package/dist/chunk-LQWIIBI2.cjs +86 -0
  161. package/dist/chunk-LXTYJ2HW.mjs +139 -0
  162. package/dist/{chunk-I4KPA2C6.mjs → chunk-MFU7SXAB.mjs} +10 -2
  163. package/dist/{chunk-YTVSWXEZ.cjs → chunk-ML4TOUZP.cjs} +76 -43
  164. package/dist/{chunk-E46NXBNJ.mjs → chunk-NLATR3T3.mjs} +12 -7
  165. package/dist/{chunk-OXNZUCHN.cjs → chunk-NPGXX7HN.cjs} +37 -37
  166. package/dist/chunk-NRWEY2CM.mjs +25 -0
  167. package/dist/{chunk-VPETSSWN.cjs → chunk-NSNQLBHR.cjs} +2 -2
  168. package/dist/chunk-NU5XLYRN.cjs +139 -0
  169. package/dist/chunk-NUWUEXUD.mjs +55 -0
  170. package/dist/{chunk-53EHWHT2.cjs → chunk-O4JYMU5N.cjs} +35 -22
  171. package/dist/{chunk-TNYC3TYP.mjs → chunk-O7JEFGUV.mjs} +2 -2
  172. package/dist/{chunk-62ZRA7XU.mjs → chunk-OCLCA3X3.mjs} +1 -1
  173. package/dist/{chunk-MJEKMT6B.mjs → chunk-OFIFRB62.mjs} +917 -238
  174. package/dist/{chunk-OB45EAQL.mjs → chunk-OVUU2RCQ.mjs} +4 -3
  175. package/dist/{chunk-YZK64PZT.cjs → chunk-OZARLCYQ.cjs} +1742 -898
  176. package/dist/{chunk-W44X6IC2.cjs → chunk-PBJ7MEOV.cjs} +13 -9
  177. package/dist/{chunk-2W4GNXGX.cjs → chunk-PBQGIA27.cjs} +2 -2
  178. package/dist/{chunk-B6RBJJ5G.mjs → chunk-PDACTAVX.mjs} +16 -3
  179. package/dist/{chunk-DQ2DI3Y7.mjs → chunk-PE2LEWXA.mjs} +6 -3
  180. package/dist/{chunk-LGR7565L.cjs → chunk-PG7J7XYT.cjs} +39 -24
  181. package/dist/{chunk-MMK4MZUN.mjs → chunk-PKXGFQZS.mjs} +1 -1
  182. package/dist/{chunk-YBY34UHB.mjs → chunk-PL7MCYYD.mjs} +47 -16
  183. package/dist/chunk-PWHF2C6A.mjs +134 -0
  184. package/dist/{chunk-DZHTNSQ5.cjs → chunk-Q2EKSSEG.cjs} +21 -21
  185. package/dist/{chunk-SPP3EZTJ.cjs → chunk-QDHR54S6.cjs} +139 -69
  186. package/dist/{chunk-REK6HZSU.mjs → chunk-QGYHE6VJ.mjs} +1565 -721
  187. package/dist/{chunk-ZOYKJBP5.cjs → chunk-QKW6DLDT.cjs} +2 -2
  188. package/dist/{chunk-Y5LEPEVH.mjs → chunk-QSLGE2ZC.mjs} +1 -1
  189. package/dist/{chunk-FSODPZRT.cjs → chunk-QUEYL2WM.cjs} +10 -10
  190. package/dist/{chunk-ZDAEHG2O.cjs → chunk-QYOAGT3E.cjs} +3 -3
  191. package/dist/{chunk-CPMME66W.mjs → chunk-R5X7FDOG.mjs} +73 -1
  192. package/dist/{chunk-O47W53D3.cjs → chunk-RDADQG5S.cjs} +7 -77
  193. package/dist/chunk-RDSHEHBA.mjs +82 -0
  194. package/dist/{chunk-C6CUUBY5.cjs → chunk-RHI67C2V.cjs} +5 -5
  195. package/dist/chunk-RK3YYUX6.cjs +114 -0
  196. package/dist/{chunk-K3RU5MOR.mjs → chunk-RK4MGL6Q.mjs} +1 -1
  197. package/dist/{chunk-LRB5OVRT.cjs → chunk-RKQOMG2X.cjs} +2 -2
  198. package/dist/chunk-RQRTH57V.cjs +82 -0
  199. package/dist/{chunk-HY6IVQ54.mjs → chunk-S7QEQCVV.mjs} +2 -2
  200. package/dist/{chunk-EGIY4A7V.cjs → chunk-SFSTZ7TB.cjs} +8 -8
  201. package/dist/{chunk-4Z3YLMSW.cjs → chunk-SX535SU5.cjs} +12 -12
  202. package/dist/{chunk-NLBK37HI.cjs → chunk-SXXSQVKK.cjs} +4 -4
  203. package/dist/{chunk-JZBU7V4D.mjs → chunk-SYPEMXW2.mjs} +126 -56
  204. package/dist/{chunk-5CFHQ7HM.mjs → chunk-TFEODQLG.mjs} +1 -1
  205. package/dist/{chunk-3GNVIYPO.cjs → chunk-TZ2YPXLB.cjs} +7 -7
  206. package/dist/{chunk-OEL5EPOJ.mjs → chunk-UD6KTSJS.mjs} +6 -76
  207. package/dist/{chunk-2EVESLP3.mjs → chunk-UJIBSFUE.mjs} +4 -4
  208. package/dist/{chunk-QSTRBKHZ.mjs → chunk-UJWRXBVP.mjs} +2 -2
  209. package/dist/chunk-UNOXV37V.cjs +55 -0
  210. package/dist/{chunk-TXE4SAMV.mjs → chunk-UOE6ZZZP.mjs} +1 -1
  211. package/dist/{chunk-OAEDVXVE.mjs → chunk-URQW27KO.mjs} +14 -6
  212. package/dist/chunk-VDQZV6BX.mjs +17 -0
  213. package/dist/chunk-VJ6L7TII.cjs +284 -0
  214. package/dist/{chunk-TPYAYFMF.cjs → chunk-VJI2LWTL.cjs} +2 -2
  215. package/dist/chunk-VWIW47FW.cjs +25 -0
  216. package/dist/{chunk-CKQAQFF6.mjs → chunk-WGNGM6MJ.mjs} +2 -2
  217. package/dist/{chunk-ROCF6UQD.cjs → chunk-WHCNJVYU.cjs} +74 -17
  218. package/dist/{chunk-4YHGQDTT.cjs → chunk-WJ5CCQBM.cjs} +35 -28
  219. package/dist/chunk-WKVYF2B5.cjs +17 -0
  220. package/dist/{chunk-5PDMBWAF.cjs → chunk-WRWJ7IWT.cjs} +7 -7
  221. package/dist/{chunk-ACGBXN3U.cjs → chunk-WW62HKA2.cjs} +55 -26
  222. package/dist/{chunk-XVSBALOY.cjs → chunk-X3Y6JWJG.cjs} +3 -3
  223. package/dist/{chunk-PXAHSCR6.cjs → chunk-XGDI4OUB.cjs} +103 -21
  224. package/dist/{chunk-4P5634G6.cjs → chunk-XRFGOYXG.cjs} +16 -11
  225. package/dist/{chunk-42KMUIWZ.cjs → chunk-XX6ZA2IO.cjs} +3 -3
  226. package/dist/{chunk-6IOZPJ3I.cjs → chunk-Y3DO7BIJ.cjs} +69 -7
  227. package/dist/{chunk-L5JDKFMQ.cjs → chunk-YBXIVQCE.cjs} +4 -4
  228. package/dist/{chunk-462MUII7.mjs → chunk-YCNKS6SD.mjs} +12 -12
  229. package/dist/{chunk-XUSJVHHD.cjs → chunk-YL7BKHYE.cjs} +935 -710
  230. package/dist/{chunk-7PPLTD3P.cjs → chunk-YN7G22MP.cjs} +6 -6
  231. package/dist/{chunk-TU6VAH4V.cjs → chunk-YRXPDKMM.cjs} +10 -10
  232. package/dist/{chunk-IXZSBO76.mjs → chunk-YSTKSZD2.mjs} +1 -1
  233. package/dist/{chunk-QDWMCFTH.mjs → chunk-YT2ZMLXK.mjs} +1 -1
  234. package/dist/{chunk-QEJWNXRI.cjs → chunk-YTNE4KGC.cjs} +3 -3
  235. package/dist/{chunk-E7QOEV5Z.cjs → chunk-YUCU6XB4.cjs} +4 -4
  236. package/dist/{chunk-NLRAQXAA.mjs → chunk-YVVY276M.mjs} +1 -1
  237. package/dist/{chunk-SUQACHER.mjs → chunk-Z2FFLTF5.mjs} +3 -3
  238. package/dist/{chunk-JSDV2NUN.mjs → chunk-Z3QXQN4U.mjs} +1 -1
  239. package/dist/{chunk-EYPSKXO4.mjs → chunk-Z4IRG4RG.mjs} +96 -9
  240. package/dist/{chunk-GJ7QVFAG.mjs → chunk-ZEWWZJPZ.mjs} +3 -1
  241. package/dist/chunk-ZIAWO6BC.mjs +86 -0
  242. package/dist/{chunk-JWLRBDDC.cjs → chunk-ZIOFRBIU.cjs} +100 -13
  243. package/dist/{chunk-3OJNNCDL.cjs → chunk-ZNXU4E6A.cjs} +8 -8
  244. package/dist/{chunk-RLEALQEN.mjs → chunk-ZO6TOLHL.mjs} +87 -5
  245. package/dist/{chunk-KDOZORJD.cjs → chunk-ZPCZWEU3.cjs} +24 -24
  246. package/dist/{chunk-QKEZLYON.cjs → chunk-ZV76IQG7.cjs} +2 -2
  247. package/dist/client/lifecycle.d.mts +1 -1
  248. package/dist/client/lifecycle.d.ts +1 -1
  249. package/dist/{client-component.d-C71rMuHF.d.mts → client-component.d-BeqVuqy2.d.mts} +80 -3
  250. package/dist/{client-component.d-sF-Znk0j.d.ts → client-component.d-CZ1NpHAY.d.ts} +80 -3
  251. package/dist/{client-plugins.d-B-Gd9mWR.d.mts → client-plugins.d-ChceYO9t.d.mts} +42 -8
  252. package/dist/{client-plugins.d-MFibjgBg.d.ts → client-plugins.d-D9kWC0QB.d.ts} +42 -8
  253. package/dist/client-plugins.d.mts +4 -4
  254. package/dist/client-plugins.d.ts +4 -4
  255. package/dist/client.cjs +17 -14
  256. package/dist/client.d.mts +11 -11
  257. package/dist/client.d.ts +11 -11
  258. package/dist/client.mjs +16 -13
  259. package/dist/config.d.mts +4 -4
  260. package/dist/config.d.ts +4 -4
  261. package/dist/cron.cjs +8 -4
  262. package/dist/cron.d.mts +11 -2
  263. package/dist/cron.d.ts +11 -2
  264. package/dist/cron.mjs +9 -5
  265. package/dist/desktop.d.mts +5 -5
  266. package/dist/desktop.d.ts +5 -5
  267. package/dist/{devtools-TDIJ6HVC.mjs → devtools-B3W3DLPG.mjs} +20 -19
  268. package/dist/{devtools-6K4QXFRL.cjs → devtools-T5I2WHRX.cjs} +22 -21
  269. package/dist/docs.cjs +29 -22
  270. package/dist/docs.d.mts +20 -6
  271. package/dist/docs.d.ts +20 -6
  272. package/dist/docs.mjs +28 -21
  273. package/dist/{endpoint.d-BkMSCRf6.d.mts → endpoint.d-BXbBpKoh.d.mts} +42 -1
  274. package/dist/{endpoint.d-BgHn0lhl.d.ts → endpoint.d-Dx_1k6Du.d.ts} +42 -1
  275. package/dist/environment/vite.cjs +6 -6
  276. package/dist/environment/vite.mjs +5 -5
  277. package/dist/headers.cjs +3 -3
  278. package/dist/{headers.d-uQ6BR59u.d.ts → headers.d-Aux4JVnm.d.ts} +1 -1
  279. package/dist/{headers.d-BUxGJTsj.d.mts → headers.d-BawakaPv.d.mts} +1 -1
  280. package/dist/headers.mjs +2 -2
  281. package/dist/i18n/client.cjs +15 -16
  282. package/dist/i18n/client.mjs +5 -6
  283. package/dist/i18n/index.cjs +4 -4
  284. package/dist/i18n/index.mjs +3 -3
  285. package/dist/i18n/server.cjs +5 -5
  286. package/dist/i18n/server.mjs +4 -4
  287. package/dist/image/server.cjs +5 -4
  288. package/dist/image/server.d.mts +5 -1
  289. package/dist/image/server.d.ts +5 -1
  290. package/dist/image/server.mjs +4 -3
  291. package/dist/image/sharp.cjs +53 -89
  292. package/dist/image/sharp.d.mts +2 -1
  293. package/dist/image/sharp.d.ts +2 -1
  294. package/dist/image/sharp.mjs +50 -86
  295. package/dist/index.cjs +113 -96
  296. package/dist/{index.d-CuWOJ-un.d.mts → index.d-Ccq42CPU.d.mts} +1 -1
  297. package/dist/{index.d-BCGfxCXY.d.ts → index.d-r1MLpgeE.d.ts} +1 -1
  298. package/dist/index.d.mts +64 -30
  299. package/dist/index.d.ts +64 -30
  300. package/dist/index.mjs +111 -94
  301. package/dist/integrations/orm.d.mts +4 -4
  302. package/dist/integrations/orm.d.ts +4 -4
  303. package/dist/integrations.cjs +9 -9
  304. package/dist/integrations.d.mts +4 -4
  305. package/dist/integrations.d.ts +4 -4
  306. package/dist/integrations.mjs +8 -8
  307. package/dist/internal/app-markdown-runtime.cjs +10 -6
  308. package/dist/internal/app-markdown-runtime.d.mts +17 -6
  309. package/dist/internal/app-markdown-runtime.d.ts +17 -6
  310. package/dist/internal/app-markdown-runtime.mjs +9 -5
  311. package/dist/internal/build-runtime.cjs +71 -67
  312. package/dist/internal/build-runtime.d.mts +6 -6
  313. package/dist/internal/build-runtime.d.ts +6 -6
  314. package/dist/internal/build-runtime.mjs +70 -66
  315. package/dist/internal/cli-runtime.cjs +35 -34
  316. package/dist/internal/cli-runtime.mjs +34 -33
  317. package/dist/internal/client-error-overlay.cjs +6 -6
  318. package/dist/internal/client-error-overlay.mjs +2 -2
  319. package/dist/internal/client-runtime.cjs +28 -3
  320. package/dist/internal/client-runtime.d.mts +45 -12
  321. package/dist/internal/client-runtime.d.ts +45 -12
  322. package/dist/internal/client-runtime.mjs +28 -3
  323. package/dist/internal/compression-runtime.d.mts +4 -4
  324. package/dist/internal/compression-runtime.d.ts +4 -4
  325. package/dist/internal/config-runtime.cjs +22 -21
  326. package/dist/internal/config-runtime.d.mts +6 -6
  327. package/dist/internal/config-runtime.d.ts +6 -6
  328. package/dist/internal/config-runtime.mjs +21 -20
  329. package/dist/internal/form-actions.cjs +7 -6
  330. package/dist/internal/form-actions.d.mts +2 -2
  331. package/dist/internal/form-actions.d.ts +2 -2
  332. package/dist/internal/form-actions.mjs +6 -5
  333. package/dist/internal/infra-analytics-runtime.cjs +15 -15
  334. package/dist/internal/infra-analytics-runtime.mjs +13 -13
  335. package/dist/internal/islands-server.cjs +2 -2
  336. package/dist/internal/islands-server.mjs +1 -1
  337. package/dist/internal/metadata-image-runtime.cjs +4 -4
  338. package/dist/internal/metadata-image-runtime.mjs +3 -3
  339. package/dist/internal/native-server-fns.cjs +5 -5
  340. package/dist/internal/native-server-fns.mjs +4 -4
  341. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  342. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  343. package/dist/internal/production-runtime.cjs +73 -40
  344. package/dist/internal/production-runtime.d.mts +133 -15
  345. package/dist/internal/production-runtime.d.ts +133 -15
  346. package/dist/internal/production-runtime.mjs +76 -43
  347. package/dist/internal/react-cache.cjs +3 -3
  348. package/dist/internal/react-cache.mjs +1 -1
  349. package/dist/internal/start-manifest.cjs +54 -0
  350. package/dist/internal/start-manifest.d.mts +43 -0
  351. package/dist/internal/start-manifest.d.ts +43 -0
  352. package/dist/internal/start-manifest.mjs +54 -0
  353. package/dist/internal/vercel-edge-middleware.cjs +8 -8
  354. package/dist/internal/vercel-edge-middleware.mjs +7 -7
  355. package/dist/{lifecycle.d-keQs5Swc.d.mts → lifecycle.d-OtGWAvJT.d.mts} +4 -0
  356. package/dist/{lifecycle.d-keQs5Swc.d.ts → lifecycle.d-OtGWAvJT.d.ts} +4 -0
  357. package/dist/manager-R7FV4A56.cjs +18 -0
  358. package/dist/{manager-JIA66YJ2.mjs → manager-YO2RHDYU.mjs} +7 -4
  359. package/dist/markdown.cjs +5 -5
  360. package/dist/markdown.d.mts +4 -4
  361. package/dist/markdown.d.ts +4 -4
  362. package/dist/markdown.mjs +4 -4
  363. package/dist/middleware.cjs +14 -14
  364. package/dist/middleware.d.mts +4 -4
  365. package/dist/middleware.d.ts +4 -4
  366. package/dist/middleware.mjs +13 -13
  367. package/dist/{mount.d-BIYmcGGg.d.mts → mount.d-BomEt2kV.d.mts} +1 -1
  368. package/dist/{mount.d-q8k0cJV0.d.ts → mount.d-Ca8eb9GB.d.ts} +1 -1
  369. package/dist/{native-server-fn-handler-QRTXGZA4.cjs → native-server-fn-handler-IWNKQEXK.cjs} +10 -8
  370. package/dist/{native-server-fn-handler-EP5AFJYE.mjs → native-server-fn-handler-LII4MDRR.mjs} +9 -7
  371. package/dist/native-tree-D3PW64ZL.cjs +28 -0
  372. package/dist/{native-tree-OYGKP2NZ.mjs → native-tree-G6ZWS7IR.mjs} +5 -5
  373. package/dist/{navigation-delegate.d-CYBUupsv.d.mts → navigation-delegate.d-B1ujRkYo.d.mts} +1 -1
  374. package/dist/{navigation-delegate.d-Btfs6Uoa.d.ts → navigation-delegate.d-DJCC2jXF.d.ts} +1 -1
  375. package/dist/navigation.cjs +13 -11
  376. package/dist/navigation.d.mts +7 -7
  377. package/dist/navigation.d.ts +7 -7
  378. package/dist/navigation.mjs +12 -10
  379. package/dist/{nitro-2LMOMIST.cjs → nitro-HKMVYIXY.cjs} +13 -13
  380. package/dist/{nitro-72TFIGGO.mjs → nitro-RHLKLYXH.mjs} +8 -8
  381. package/dist/{plugin-5PIQQVRP.cjs → plugin-5BNPYCER.cjs} +2 -2
  382. package/dist/{plugin-QZT747YW.mjs → plugin-FD4S2QEJ.mjs} +1 -1
  383. package/dist/plugin.cjs +65 -60
  384. package/dist/plugin.d.mts +7 -7
  385. package/dist/plugin.d.ts +7 -7
  386. package/dist/plugin.mjs +64 -59
  387. package/dist/query/client.cjs +20 -9
  388. package/dist/query/client.mjs +16 -5
  389. package/dist/{render-plan.d-0FHusf1D.d.ts → render-plan.d-BxRbaxYA.d.ts} +1 -1
  390. package/dist/{render-plan.d-BlyxqKMu.d.mts → render-plan.d-CFod_Zf-.d.mts} +1 -1
  391. package/dist/renderer/react/server.cjs +9 -1
  392. package/dist/renderer/react/server.d.mts +9 -1
  393. package/dist/renderer/react/server.d.ts +9 -1
  394. package/dist/renderer/react/server.mjs +8 -0
  395. package/dist/renderer-client.cjs +25 -26
  396. package/dist/renderer-client.d.mts +7 -7
  397. package/dist/renderer-client.d.ts +7 -7
  398. package/dist/renderer-client.mjs +15 -16
  399. package/dist/request.cjs +2 -2
  400. package/dist/{request.d-CPdVjssg.d.ts → request.d-DG4TeXMM.d.mts} +14 -2
  401. package/dist/{request.d-CX-gks1l.d.mts → request.d-DRQgaXGG.d.ts} +14 -2
  402. package/dist/request.d.mts +5 -5
  403. package/dist/request.d.ts +5 -5
  404. package/dist/request.mjs +1 -1
  405. package/dist/{route-rendering.d-CcvZ_4N2.d.mts → route-rendering.d-BXtZKgqu.d.mts} +1 -1
  406. package/dist/{route-rendering.d-DcOoSNoG.d.ts → route-rendering.d-Db07UNVG.d.ts} +1 -1
  407. package/dist/{route.d-DrXkpvcg.d.mts → route.d-Cd4Fi6BA.d.ts} +3 -1
  408. package/dist/{route.d-hs-_cyHn.d.ts → route.d-ShmtqqVQ.d.mts} +3 -1
  409. package/dist/router.cjs +4 -4
  410. package/dist/{router.d-C8RHma4A.d.mts → router.d-B61kXqxJ.d.mts} +1 -1
  411. package/dist/{router.d-D2QnK8cM.d.ts → router.d-BC3hyjf0.d.ts} +1 -1
  412. package/dist/router.mjs +3 -3
  413. package/dist/routes.cjs +7 -5
  414. package/dist/routes.d.mts +4 -4
  415. package/dist/routes.d.ts +4 -4
  416. package/dist/routes.mjs +6 -4
  417. package/dist/{rsc-pipeline-LC2FBZAR.mjs → rsc-pipeline-LJ7YCGY6.mjs} +24 -23
  418. package/dist/{rsc-pipeline-NTAM65NT.cjs → rsc-pipeline-VENBFYXW.cjs} +25 -24
  419. package/dist/{runtime-MWAC7NWR.mjs → runtime-4DWUXZHS.mjs} +29 -29
  420. package/dist/{runtime-U4PAMTVH.cjs → runtime-UNDTYGQS.cjs} +40 -40
  421. package/dist/{runtime.d-BQUHHq8M.d.mts → runtime.d-Cl6EBGmC.d.mts} +3 -3
  422. package/dist/{runtime.d-1l_1bLrL.d.ts → runtime.d-SC95yDzr.d.ts} +3 -3
  423. package/dist/safe-fetch.cjs +15 -0
  424. package/dist/safe-fetch.d.mts +61 -0
  425. package/dist/safe-fetch.d.ts +61 -0
  426. package/dist/safe-fetch.mjs +15 -0
  427. package/dist/{schema-dev-notice-C2JINRZI.mjs → schema-dev-notice-CA55V57L.mjs} +2 -2
  428. package/dist/{schema-dev-notice-X7GG7QVB.cjs → schema-dev-notice-RWA2UTR6.cjs} +3 -3
  429. package/dist/server-action-security.cjs +7 -5
  430. package/dist/server-action-security.d.mts +11 -3
  431. package/dist/server-action-security.d.ts +11 -3
  432. package/dist/server-action-security.mjs +6 -4
  433. package/dist/server-fn-client.d.mts +3 -3
  434. package/dist/server-fn-client.d.ts +3 -3
  435. package/dist/server-fn.cjs +9 -7
  436. package/dist/server-fn.d.mts +1 -1
  437. package/dist/server-fn.d.ts +1 -1
  438. package/dist/server-fn.mjs +8 -6
  439. package/dist/server-plugins.cjs +8 -8
  440. package/dist/server-plugins.d.mts +53 -9
  441. package/dist/server-plugins.d.ts +53 -9
  442. package/dist/server-plugins.mjs +7 -7
  443. package/dist/server-query-client.d.mts +1 -1
  444. package/dist/server-query-client.d.ts +1 -1
  445. package/dist/server-query.cjs +10 -8
  446. package/dist/server-query.d.mts +1 -1
  447. package/dist/server-query.d.ts +1 -1
  448. package/dist/server-query.mjs +9 -7
  449. package/dist/server.cjs +105 -103
  450. package/dist/server.d.mts +17 -17
  451. package/dist/server.d.ts +17 -17
  452. package/dist/server.mjs +78 -76
  453. package/dist/{spa-router.d-BzPdi48R.d.mts → spa-router.d-DrlXgDqY.d.mts} +13 -6
  454. package/dist/{spa-router.d-BJtXNeqo.d.ts → spa-router.d-DwM02Mwd.d.ts} +13 -6
  455. package/dist/testing.cjs +34 -32
  456. package/dist/testing.d.mts +4 -4
  457. package/dist/testing.d.ts +4 -4
  458. package/dist/testing.mjs +26 -24
  459. package/dist/theme/server.cjs +3 -3
  460. package/dist/theme/server.mjs +2 -2
  461. package/dist/{utils.d-DquC6qxy.d.ts → utils.d-C6KXz3uB.d.ts} +1 -1
  462. package/dist/{utils.d-B4ZW-6z6.d.mts → utils.d-CHzxAshz.d.mts} +1 -1
  463. package/dist/version.cjs +2 -2
  464. package/dist/version.mjs +1 -1
  465. package/dist/vite.cjs +65 -60
  466. package/dist/vite.d.mts +18 -8
  467. package/dist/vite.d.ts +18 -8
  468. package/dist/vite.mjs +64 -59
  469. package/dist/workflows.cjs +7 -7
  470. package/dist/workflows.mjs +6 -6
  471. package/package.json +18 -1
  472. package/dist/analyzer-V5ZMRIIY.cjs +0 -16
  473. package/dist/chunk-6I4BFRE7.cjs +0 -51
  474. package/dist/chunk-D4XGKF67.cjs +0 -127
  475. package/dist/chunk-EIVGPQN5.mjs +0 -51
  476. package/dist/chunk-MFQGU5CC.mjs +0 -127
  477. package/dist/chunk-NCIAP562.mjs +0 -27
  478. package/dist/chunk-QQ44FYRO.cjs +0 -27
  479. package/dist/chunk-RI3EVPKD.cjs +0 -57
  480. package/dist/manager-JOHU6BQI.cjs +0 -15
  481. package/dist/native-tree-R6CQMDTI.cjs +0 -28
@@ -3,15 +3,21 @@ import {
3
3
  farmDesktopDevGuardPlugin,
4
4
  isFarmReactRefreshActive
5
5
  } from "./chunk-QVBXTSIZ.mjs";
6
+ import {
7
+ _listFarmRegisteredMCPServerTools,
8
+ _observeFarmRegisteredMCPResponse,
9
+ _readFarmRegisteredMCPCalls
10
+ } from "./chunk-4PWGLPL6.mjs";
6
11
  import {
7
12
  createFarmImageHandler
8
- } from "./chunk-OEL5EPOJ.mjs";
13
+ } from "./chunk-UD6KTSJS.mjs";
9
14
  import {
10
15
  FARM_LAYOUT_ELEMENT_CLIENT_SOURCE,
11
16
  FARM_NAVIGATION_SCRIPT_SOURCE,
12
17
  FARM_NAVIGATION_STREAM_READER_SOURCE,
13
18
  FARM_REFRESH_FIELDS_SOURCE,
14
19
  FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE,
20
+ FARM_VIDEO_PLAYER_HTML,
15
21
  FarmApp,
16
22
  collectFarmWebMCPTools,
17
23
  createFarmClientOptimizeDepsConfig,
@@ -32,13 +38,14 @@ import {
32
38
  resolveFarmAppPackages,
33
39
  resolveFarmClientCacheAdapterEntry,
34
40
  resolveFarmImageProviderForRuntime,
35
- resolveFarmRouteRootStrategy
36
- } from "./chunk-MJEKMT6B.mjs";
41
+ resolveFarmRouteRootStrategy,
42
+ toBakedMarkdownSourcePath
43
+ } from "./chunk-OFIFRB62.mjs";
37
44
  import {
38
45
  generateFarmClientPluginEntryCode,
39
46
  hasFarmServerRuntimePlugins,
40
47
  loadTailwindVitePlugin
41
- } from "./chunk-I4KPA2C6.mjs";
48
+ } from "./chunk-MFU7SXAB.mjs";
42
49
  import {
43
50
  FARM_NODE_RESPONSE_END_PENDING
44
51
  } from "./chunk-Z5ZZAGIH.mjs";
@@ -48,12 +55,7 @@ import {
48
55
  import {
49
56
  generateFarmTypeArtifacts,
50
57
  resolveRouteRenderingConfig
51
- } from "./chunk-B67CW2LM.mjs";
52
- import {
53
- createFarmServerFnBoundaryModule,
54
- isFarmServerFnBoundaryId,
55
- transformFarmServerFns
56
- } from "./chunk-GNZIAJGB.mjs";
58
+ } from "./chunk-LQBV2Y37.mjs";
57
59
  import {
58
60
  createFarmRouteRenderPlan,
59
61
  farmPathGuardCoversEndpoint,
@@ -62,7 +64,7 @@ import {
62
64
  getSharedLayoutPrefixLength,
63
65
  parseFarmLayoutChainHeader,
64
66
  renderFarmLocaleAlternateLinks
65
- } from "./chunk-SVQX5HYW.mjs";
67
+ } from "./chunk-HT2SZKXG.mjs";
66
68
  import {
67
69
  FARM_NATIVE_TREE_CONTENT_TYPE
68
70
  } from "./chunk-LLZSYFOM.mjs";
@@ -80,13 +82,18 @@ import {
80
82
  resolveFarmMCPRouteLabel,
81
83
  resolveFarmMarkdownRouteLabel,
82
84
  setFarmRouteLabel
83
- } from "./chunk-GZOKWJIW.mjs";
85
+ } from "./chunk-GNY7BO7R.mjs";
84
86
  import {
85
87
  FARM_DEFAULT_MCP_PATH
86
- } from "./chunk-UVZMSRHF.mjs";
88
+ } from "./chunk-JA6RML7C.mjs";
87
89
  import {
88
90
  isFarmPreviewDeploymentEnvironment
89
- } from "./chunk-IXZSBO76.mjs";
91
+ } from "./chunk-YSTKSZD2.mjs";
92
+ import {
93
+ createFarmServerFnBoundaryModule,
94
+ isFarmServerFnBoundaryId,
95
+ transformFarmServerFns
96
+ } from "./chunk-GNZIAJGB.mjs";
90
97
  import {
91
98
  resolveFarmLayoutFonts
92
99
  } from "./chunk-HZOMT5DY.mjs";
@@ -96,6 +103,8 @@ import {
96
103
  FARM_CLIENT_REFERENCE_PRAGMA,
97
104
  FARM_RESOLVE_FROM_PREFIX,
98
105
  collectFarmServerBundledPackageInfo,
106
+ createFarmDiagnostic,
107
+ createFarmSourceLocator,
99
108
  dropLatestPackageClientBoundaryCache,
100
109
  ensureFarmInternalClientReference,
101
110
  ensureFarmIslandContainerReference,
@@ -104,6 +113,7 @@ import {
104
113
  farmEnvironmentFunctionsPlugin,
105
114
  farmIslandContainerReferencePath,
106
115
  farmRelativeImportFiles,
116
+ formatFarmDiagnostic,
107
117
  generateProgrammaticClientRouteModule,
108
118
  getClientModuleMetadata,
109
119
  getFarmClientReachableModules,
@@ -116,6 +126,7 @@ import {
116
126
  isIsolatableClientBoundarySource,
117
127
  loadFarmBrowserBuiltin,
118
128
  parseFarmResolveFrom,
129
+ persistPackageScanCache,
119
130
  programmaticClientRouteKey,
120
131
  resolveFarmBrowserBuiltin,
121
132
  resolveFarmIsolatedClientHydrationMode,
@@ -125,8 +136,10 @@ import {
125
136
  rewriteFarmReactServerClientModuleImports,
126
137
  rewriteFarmReactServerImports,
127
138
  stripUseClientDirective,
139
+ usePackageScanCacheFile,
140
+ withFarmSourceSnapshotOf,
128
141
  wrapFarmIslandContainers
129
- } from "./chunk-IBVN7SW5.mjs";
142
+ } from "./chunk-A5F55ZFA.mjs";
130
143
  import {
131
144
  generateFarmDocsAdapterClientRuntime,
132
145
  getFarmDocsAdapterConfigModule
@@ -140,7 +153,7 @@ import {
140
153
  } from "./chunk-TPA2PV5J.mjs";
141
154
  import {
142
155
  resolveRouteRuleCorsPreflightHeaders
143
- } from "./chunk-NLRAQXAA.mjs";
156
+ } from "./chunk-YVVY276M.mjs";
144
157
  import {
145
158
  FARM_DEVTOOLS_LAUNCH_PARAM,
146
159
  FARM_DEVTOOLS_PATH,
@@ -150,10 +163,10 @@ import {
150
163
  FARM_PREVIEW_ROBOTS_TAG,
151
164
  resolveFarmAgentCrawlers,
152
165
  resolveFarmAgentSitemap
153
- } from "./chunk-OBYM5S5G.mjs";
166
+ } from "./chunk-DUSTJ6A5.mjs";
154
167
  import {
155
168
  resolveFarmLlmsTxtConfig
156
- } from "./chunk-HY6IVQ54.mjs";
169
+ } from "./chunk-S7QEQCVV.mjs";
157
170
  import {
158
171
  resolveFarmServerComponentsMode
159
172
  } from "./chunk-4QENVMG7.mjs";
@@ -183,7 +196,7 @@ import {
183
196
  createFarmMarkdownSourceResponse,
184
197
  isFarmMarkdownPageFile,
185
198
  normalizeFarmMarkdownRoutePath
186
- } from "./chunk-OIP62QEL.mjs";
199
+ } from "./chunk-BGUTIQII.mjs";
187
200
  import {
188
201
  resolveFarmMdxComponentsModulePath,
189
202
  resolveMdxConfig
@@ -195,21 +208,21 @@ import {
195
208
  farmRequestWantsMarkdown,
196
209
  getFarmMarkdownAlternatePath,
197
210
  resolveMarkdownMirrorTarget
198
- } from "./chunk-CPMME66W.mjs";
211
+ } from "./chunk-R5X7FDOG.mjs";
199
212
  import {
200
213
  dispatchIntegrationRequest,
201
214
  getFarmIntegrationPluginOwner,
202
215
  getIntegrationDocumentNavigationMatchers,
203
216
  getIntegrationProviders,
204
217
  matchIntegrationRoute
205
- } from "./chunk-WW3LRNQV.mjs";
218
+ } from "./chunk-5O3SK3ZC.mjs";
206
219
  import {
207
220
  resolveFarmRouteContext,
208
221
  withFarmRouteContext
209
222
  } from "./chunk-BMQAPZXD.mjs";
210
223
  import {
211
224
  MiddlewareManager
212
- } from "./chunk-JZQS3ZOI.mjs";
225
+ } from "./chunk-GAAK3HDZ.mjs";
213
226
  import {
214
227
  _runWithMiddlewareContext,
215
228
  _runWithMiddlewareData
@@ -225,10 +238,10 @@ import {
225
238
  } from "./chunk-IYEY3JWJ.mjs";
226
239
  import {
227
240
  APIRouteManager
228
- } from "./chunk-RLFGKJQ6.mjs";
241
+ } from "./chunk-5WFPZG7K.mjs";
229
242
  import {
230
243
  getFarmI18nClientSnapshot
231
- } from "./chunk-TNYC3TYP.mjs";
244
+ } from "./chunk-O7JEFGUV.mjs";
232
245
  import {
233
246
  VERCEL_OG_INSTALL_HINT,
234
247
  isOptionalPeerInstalled
@@ -237,15 +250,15 @@ import {
237
250
  FARM_INTERNAL_SERVER_ERROR_BODY,
238
251
  createFarmInternalServerErrorResponse,
239
252
  isFarmAPIPathname
240
- } from "./chunk-TY5KCYDE.mjs";
253
+ } from "./chunk-KHS3T3E5.mjs";
241
254
  import {
242
255
  registerFarmMCPServer
243
- } from "./chunk-C7GJDVN4.mjs";
256
+ } from "./chunk-F7MJWW6A.mjs";
244
257
  import {
245
258
  isProgrammaticRoutesFileName,
246
259
  parseProgrammaticRouteModuleId,
247
260
  scanProgrammaticPagePaths
248
- } from "./chunk-6YFC3ZFX.mjs";
261
+ } from "./chunk-DZXD6CYJ.mjs";
249
262
  import {
250
263
  createCliColors
251
264
  } from "./chunk-IGL6CO6M.mjs";
@@ -258,7 +271,7 @@ import {
258
271
  invalidateFailedFarmDevModules,
259
272
  invalidateFarmDevDependents,
260
273
  loadFarmDevModule
261
- } from "./chunk-TUOO6IK3.mjs";
274
+ } from "./chunk-7H2TXT2K.mjs";
262
275
  import {
263
276
  isFarmI18nCatalogFile,
264
277
  resolveFarmI18nMessagePath
@@ -267,7 +280,7 @@ import {
267
280
  logger,
268
281
  toPosixPath,
269
282
  toViteModuleId
270
- } from "./chunk-JSDV2NUN.mjs";
283
+ } from "./chunk-Z3QXQN4U.mjs";
271
284
  import {
272
285
  resolveFarmAPIServerBasePath
273
286
  } from "./chunk-2I6PUKWJ.mjs";
@@ -277,7 +290,7 @@ import {
277
290
  createFarmRequestBodyErrorResponse,
278
291
  readNodeRequestBody,
279
292
  resolveFarmServerConfig
280
- } from "./chunk-QDWMCFTH.mjs";
293
+ } from "./chunk-YT2ZMLXK.mjs";
281
294
  import {
282
295
  createFarmSearchParams,
283
296
  searchParamsToObject
@@ -288,7 +301,7 @@ import {
288
301
  } from "./chunk-2DA7CLY7.mjs";
289
302
  import {
290
303
  FARM_VERSION
291
- } from "./chunk-JMOCMXTQ.mjs";
304
+ } from "./chunk-H7QY7ZE4.mjs";
292
305
  import {
293
306
  DEFAULT_FARM_API_BASE_PATH
294
307
  } from "./chunk-W6QLRQ3V.mjs";
@@ -297,10 +310,11 @@ import {
297
310
  getFarmPageDataRedirectFromResponse
298
311
  } from "./chunk-SD6JGJOM.mjs";
299
312
  import {
313
+ FARM_VIDEO_PLAYER_PATH,
300
314
  addMetadataMarkdownAlternate,
301
315
  mergeMetadata,
302
316
  mergeModuleViewport
303
- } from "./chunk-S6O2L47H.mjs";
317
+ } from "./chunk-AG27TI6Q.mjs";
304
318
  import {
305
319
  createDeferredDataResponse
306
320
  } from "./chunk-7BIW7VCW.mjs";
@@ -311,6 +325,7 @@ import {
311
325
  withFarmDeploymentResponse
312
326
  } from "./chunk-IWJONXPF.mjs";
313
327
  import {
328
+ resolveFarmTrailingSlashRedirect,
314
329
  toFarmTrailingSlashPageRequest
315
330
  } from "./chunk-4O26BPUY.mjs";
316
331
  import {
@@ -318,11 +333,12 @@ import {
318
333
  FARM_CONFIG_REDIRECTS_PLUGIN_NAME,
319
334
  FARM_CONFIG_REWRITES_PLUGIN_NAME,
320
335
  getConfigRedirectMatcher
321
- } from "./chunk-FETMUBIA.mjs";
336
+ } from "./chunk-CLM73YYD.mjs";
322
337
  import {
338
+ _runWithCurrentRequest,
323
339
  parseFarmRequestTarget,
324
340
  resolveFarmRequestURL
325
- } from "./chunk-5OFNUETM.mjs";
341
+ } from "./chunk-FCAYYLAE.mjs";
326
342
  import {
327
343
  isFarmNotFoundError
328
344
  } from "./chunk-JNYFXL7X.mjs";
@@ -358,7 +374,7 @@ function transformFarmFormActionModule(options) {
358
374
  import { createRunnableDevEnvironment, parseSync } from "vite";
359
375
  import { initSync as initModuleLexer, parse as lexModule } from "es-module-lexer";
360
376
  import { AsyncLocalStorage } from "async_hooks";
361
- import { builtinModules, isBuiltin } from "module";
377
+ import { builtinModules as builtinModules2, isBuiltin as isBuiltin2 } from "module";
362
378
 
363
379
  // src/dev-preview-guard.ts
364
380
  import { promises as fsp } from "fs";
@@ -610,7 +626,8 @@ var VITE_MODULE_QUERY_FLAGS = [
610
626
  ];
611
627
  var SCRIPT_FETCH_DESTINATIONS = /* @__PURE__ */ new Set(["script", "worker", "sharedworker", "serviceworker"]);
612
628
  function isViteModuleRequest(url, headers) {
613
- if (VITE_MODULE_QUERY_FLAGS.some((flag) => url.searchParams.has(flag))) return true;
629
+ if (VITE_MODULE_QUERY_FLAGS.some((flag) => url.searchParams.getAll(flag).includes("")))
630
+ return true;
614
631
  const destination = headers["sec-fetch-dest"];
615
632
  const value = Array.isArray(destination) ? destination[0] : destination;
616
633
  return value !== void 0 && SCRIPT_FETCH_DESTINATIONS.has(value.toLowerCase());
@@ -675,36 +692,197 @@ function findClientServerFnViolation(code, id) {
675
692
  const specifiers = match[1];
676
693
  for (const factory of SERVER_FN_FACTORIES) {
677
694
  if (!new RegExp(`(?:^|[\\s{,])${factory}(?:[\\s},]|$)`).test(specifiers)) continue;
678
- if (new RegExp(`(?<![\\w$.])${factory}\\s*(?:<[^>]*>)?\\s*\\(`).test(code)) {
679
- return { factory };
680
- }
695
+ const call = new RegExp(`(?<![\\w$.])${factory}\\s*(?:<[^>]*>)?\\s*\\(`).exec(code);
696
+ if (call) return { factory, start: call.index };
681
697
  }
682
698
  }
683
699
  return null;
684
700
  }
685
- function formatServerFnBoundaryError(violation, id) {
686
- return [
687
- `${violation.factory} handlers run only on the server, but ${id} is being bundled into the client.`,
688
- `Importing a ${violation.factory} module from client code executes the server handler (and its Node-only imports) in the browser.`,
689
- `Either enable the server-function transform (add @farm.js/plugin/rsc and set experimental.serverActions: true in farm.config.ts) so client imports become server references,`,
690
- `or keep the query on the server: call it from server components, or expose an API route and use createAPIClient from the client.`
691
- ].join("\n");
701
+ function createServerFnBoundaryDiagnostic(violation, id, location) {
702
+ return createFarmDiagnostic(
703
+ "CLIENT_SERVER_FUNCTION",
704
+ id,
705
+ `${violation.factory} handlers run only on the server, but this module is bundled into the client, so the handler and its Node-only imports would run in the browser.`,
706
+ location
707
+ );
692
708
  }
693
709
 
694
710
  // src/client-boundary-env.ts
711
+ import { builtinModules, isBuiltin } from "module";
695
712
  var FUNCTION_BODY_TYPES = /* @__PURE__ */ new Set([
696
713
  "FunctionDeclaration",
697
714
  "FunctionExpression",
698
715
  "ArrowFunctionExpression"
699
716
  ]);
717
+ var BARE_BUILTIN_NAMES = new Set(
718
+ builtinModules.filter((name) => !name.startsWith("_") && !name.includes(":")).map((name) => name.split("/", 1)[0])
719
+ );
720
+ var BARE_BUILTIN_SPECIFIER_RE = new RegExp(
721
+ String.raw`(?:\bfrom|\bimport|\brequire)\s*\(?\s*["'](?:` + [...BARE_BUILTIN_NAMES].join("|") + String.raw`)(?:/[^"']*)?["']`
722
+ );
723
+ var SPECIFIER_POSITION_RE = /(?:\bfrom|\bimport|\brequire)\s*\(?\s*$/;
700
724
  function shouldInspectClientBoundary(id, code) {
701
725
  if (id.startsWith("\0") || id.startsWith("virtual:") || id.includes("node_modules")) return false;
702
- return code.includes("process.env") || code.includes("node:");
726
+ return mayUseServerOnlyApis(code);
727
+ }
728
+ var KEYWORDS_BEFORE_EXPRESSION = /* @__PURE__ */ new Set([
729
+ "await",
730
+ "case",
731
+ "delete",
732
+ "do",
733
+ "else",
734
+ "in",
735
+ "instanceof",
736
+ "new",
737
+ "of",
738
+ "return",
739
+ "throw",
740
+ "typeof",
741
+ "void",
742
+ "yield"
743
+ ]);
744
+ function isBuiltinNameCode(code) {
745
+ return code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 95;
746
+ }
747
+ function isIdentifierCode(code) {
748
+ return code >= 97 && code <= 122 || code >= 65 && code <= 90 || code >= 48 && code <= 57 || code === 95 || code === 36 || code > 127;
749
+ }
750
+ function mayUseServerOnlyApis(code) {
751
+ if (!code.includes("process.env") && !code.includes("node:") && !BARE_BUILTIN_SPECIFIER_RE.test(code)) {
752
+ return false;
753
+ }
754
+ const templateBraces = [];
755
+ let index = 0;
756
+ let previous = 0;
757
+ let previousWordStart = -1;
758
+ const startsBuiltinSpecifier = (quote) => {
759
+ const start = quote + 1;
760
+ if (code.startsWith("node:", start)) return true;
761
+ let end = start;
762
+ while (end < code.length && isBuiltinNameCode(code.charCodeAt(end))) end += 1;
763
+ const after = code.charCodeAt(end);
764
+ return end > start && (after === code.charCodeAt(quote) || after === 47) && BARE_BUILTIN_NAMES.has(code.slice(start, end)) && SPECIFIER_POSITION_RE.test(code.slice(Math.max(0, quote - 16), quote));
765
+ };
766
+ const skipTemplateText = () => {
767
+ while (index < code.length) {
768
+ const character = code.charCodeAt(index);
769
+ if (character === 92) {
770
+ index += 2;
771
+ } else if (character === 96) {
772
+ index += 1;
773
+ previous = 96;
774
+ return false;
775
+ } else if (character === 36 && code.charCodeAt(index + 1) === 123) {
776
+ index += 2;
777
+ templateBraces.push(0);
778
+ previous = 123;
779
+ return true;
780
+ } else {
781
+ index += 1;
782
+ }
783
+ }
784
+ return false;
785
+ };
786
+ while (index < code.length) {
787
+ const character = code.charCodeAt(index);
788
+ const next = code.charCodeAt(index + 1);
789
+ if (character === 47 && next === 47) {
790
+ const end = code.indexOf("\n", index);
791
+ index = end === -1 ? code.length : end;
792
+ continue;
793
+ }
794
+ if (character === 47 && next === 42) {
795
+ const end = code.indexOf("*/", index + 2);
796
+ index = end === -1 ? code.length : end + 2;
797
+ continue;
798
+ }
799
+ if (character === 39 || character === 34) {
800
+ if (startsBuiltinSpecifier(index)) return true;
801
+ index += 1;
802
+ while (index < code.length) {
803
+ const inner = code.charCodeAt(index);
804
+ if (inner === 92) {
805
+ index += 2;
806
+ continue;
807
+ }
808
+ index += 1;
809
+ if (inner === character || inner === 10) break;
810
+ }
811
+ previous = character;
812
+ continue;
813
+ }
814
+ if (character === 96) {
815
+ if (startsBuiltinSpecifier(index)) return true;
816
+ index += 1;
817
+ skipTemplateText();
818
+ continue;
819
+ }
820
+ if (character === 47) {
821
+ const word = previousWordStart === -1 ? "" : code.slice(previousWordStart, index).trim();
822
+ const startsExpression = !(isIdentifierCode(previous) || previous === 41 || previous === 93) || KEYWORDS_BEFORE_EXPRESSION.has(word);
823
+ index += 1;
824
+ if (startsExpression) {
825
+ let inClass = false;
826
+ while (index < code.length) {
827
+ const inner = code.charCodeAt(index);
828
+ if (inner === 10) break;
829
+ index += 1;
830
+ if (inner === 92) index += 1;
831
+ else if (inner === 91) inClass = true;
832
+ else if (inner === 93) inClass = false;
833
+ else if (inner === 47 && !inClass) break;
834
+ }
835
+ previous = 41;
836
+ previousWordStart = -1;
837
+ } else {
838
+ previous = 47;
839
+ previousWordStart = -1;
840
+ }
841
+ continue;
842
+ }
843
+ if (templateBraces.length > 0 && (character === 123 || character === 125)) {
844
+ const depth = templateBraces.length - 1;
845
+ if (character === 123) {
846
+ templateBraces[depth] += 1;
847
+ } else if (templateBraces[depth] === 0) {
848
+ templateBraces.pop();
849
+ index += 1;
850
+ skipTemplateText();
851
+ continue;
852
+ } else {
853
+ templateBraces[depth] -= 1;
854
+ }
855
+ }
856
+ if (isIdentifierCode(character)) {
857
+ const start = index;
858
+ if (character === 112 && code.startsWith("process.env", index) && !isIdentifierCode(previous === 0 ? 32 : code.charCodeAt(index - 1))) {
859
+ return true;
860
+ }
861
+ while (index < code.length && isIdentifierCode(code.charCodeAt(index))) index += 1;
862
+ previous = code.charCodeAt(index - 1);
863
+ previousWordStart = start;
864
+ continue;
865
+ }
866
+ if (character > 32) {
867
+ previous = character;
868
+ previousWordStart = -1;
869
+ }
870
+ index += 1;
871
+ }
872
+ return false;
703
873
  }
704
874
  function analyzeClientBoundary(program, publicKeys) {
705
- const envKeys = /* @__PURE__ */ new Set();
706
- const publicEnvKeys = /* @__PURE__ */ new Set();
707
- const builtinImports = /* @__PURE__ */ new Set();
875
+ const findings = [];
876
+ const seen = /* @__PURE__ */ new Set();
877
+ const add = (kind, name, node) => {
878
+ const key = `${kind}\0${name}`;
879
+ if (seen.has(key)) return;
880
+ seen.add(key);
881
+ findings.push({ kind, name, start: node.start ?? 0 });
882
+ };
883
+ const addEnvKey = (key, node) => {
884
+ if (key !== "NODE_ENV") add(publicKeys.has(key) ? "public-env" : "server-env", key, node);
885
+ };
708
886
  const visit = (node, inFunction) => {
709
887
  if (!node || typeof node !== "object") return;
710
888
  if (Array.isArray(node)) {
@@ -714,13 +892,20 @@ function analyzeClientBoundary(program, publicKeys) {
714
892
  const estree = node;
715
893
  if (typeof estree.type !== "string") return;
716
894
  if (!inFunction) {
717
- const builtin = readNodeBuiltinSource(estree);
718
- if (builtin !== void 0) builtinImports.add(builtin);
895
+ const builtin = readBuiltinSource(estree);
896
+ if (builtin !== void 0) add("builtin", builtin, estree);
719
897
  const key = readProcessEnvKey(estree);
720
898
  if (key !== void 0) {
721
- if (key !== "NODE_ENV") {
722
- (publicKeys.has(key) ? publicEnvKeys : envKeys).add(key);
899
+ addEnvKey(key, estree);
900
+ return;
901
+ }
902
+ if (estree.type === "VariableDeclarator" && isProcessEnv(estree.init) && estree.id?.type === "ObjectPattern") {
903
+ for (const property of estree.id.properties ?? []) {
904
+ if (property.type !== "Property") continue;
905
+ const name = readPropertyKey(property);
906
+ if (name !== void 0) addEnvKey(name, property);
723
907
  }
908
+ visit(estree.id.properties, inFunction);
724
909
  return;
725
910
  }
726
911
  }
@@ -731,31 +916,26 @@ function analyzeClientBoundary(program, publicKeys) {
731
916
  }
732
917
  };
733
918
  visit(program.body, false);
734
- return {
735
- envKeys: [...envKeys],
736
- publicEnvKeys: [...publicEnvKeys],
737
- builtinImports: [...builtinImports]
738
- };
919
+ return findings;
739
920
  }
740
- function readNodeBuiltinSource(node) {
921
+ function readBuiltinSource(node) {
922
+ let value;
741
923
  if (node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ImportExpression") {
742
- const value = node.source?.value;
743
- return typeof value === "string" && value.startsWith("node:") ? value : void 0;
744
- }
745
- if (node.type === "CallExpression") {
924
+ value = node.source?.value;
925
+ } else if (node.type === "CallExpression") {
746
926
  const callee = node.callee;
747
927
  if (callee?.type === "Identifier" && callee.name === "require") {
748
928
  const arg = node.arguments?.[0];
749
- const value = arg?.type === "Literal" ? arg.value : void 0;
750
- return typeof value === "string" && value.startsWith("node:") ? value : void 0;
929
+ value = arg?.type === "Literal" ? arg.value : void 0;
751
930
  }
752
931
  }
753
- return void 0;
932
+ return typeof value === "string" && isBuiltin(value) ? value : void 0;
933
+ }
934
+ function isProcessEnv(node) {
935
+ return node?.type === "MemberExpression" && !node.computed && node.object?.type === "Identifier" && node.object.name === "process" && node.property?.name === "env";
754
936
  }
755
937
  function readProcessEnvKey(node) {
756
- if (node.type !== "MemberExpression") return void 0;
757
- const object = node.object;
758
- if (!object || object.type !== "MemberExpression" || object.object?.type !== "Identifier" || object.object.name !== "process" || object.property?.name !== "env") {
938
+ if (node.type !== "MemberExpression" || !isProcessEnv(node.object)) {
759
939
  return void 0;
760
940
  }
761
941
  const property = node.property;
@@ -769,25 +949,36 @@ function readProcessEnvKey(node) {
769
949
  }
770
950
  return void 0;
771
951
  }
772
- function formatClientBoundaryWarning(id, findings) {
773
- const { envKeys, publicEnvKeys, builtinImports } = findings;
774
- const lines = [`${id} is compiled for the client but uses server-only APIs:`];
775
- if (envKeys.length > 0) {
776
- lines.push(
777
- `- module-scope read of process.env.${envKeys.join(", process.env.")} \u2014 undefined in the browser. Move the read behind a server boundary, or expose it through env.public in farm.config.ts.`
778
- );
779
- }
780
- if (publicEnvKeys.length > 0) {
781
- lines.push(
782
- `- module-scope read of process.env.${publicEnvKeys.join(", process.env.")} \u2014 process.env is not populated in the browser even for public keys. Read it through publicEnv from "@farm.js/core/env".`
783
- );
784
- }
785
- if (builtinImports.length > 0) {
786
- lines.push(
787
- `- import of ${builtinImports.join(", ")} \u2014 stubbed in the browser, where exports without a Web API equivalent are undefined. Move the import into server-only code.`
788
- );
952
+ function readPropertyKey(property) {
953
+ const key = property.key;
954
+ if (!property.computed && key?.type === "Identifier") return key.name;
955
+ const value = key?.type === "Literal" ? key.value : void 0;
956
+ return typeof value === "string" ? value : void 0;
957
+ }
958
+ function createClientBoundaryDiagnostic(file, finding, location) {
959
+ switch (finding.kind) {
960
+ case "server-env":
961
+ return createFarmDiagnostic(
962
+ "CLIENT_SERVER_ENV",
963
+ file,
964
+ `process.env.${finding.name} is read at module scope in a module compiled for the browser, where it is undefined.`,
965
+ location
966
+ );
967
+ case "public-env":
968
+ return createFarmDiagnostic(
969
+ "CLIENT_PROCESS_ENV_PUBLIC",
970
+ file,
971
+ `process.env.${finding.name} is declared public, but process.env is not populated in the browser, so this module-scope read is undefined there.`,
972
+ location
973
+ );
974
+ case "builtin":
975
+ return createFarmDiagnostic(
976
+ "CLIENT_NODE_BUILTIN",
977
+ file,
978
+ `"${finding.name}" is imported into a module compiled for the browser, which gets a stub whose exports without a Web API equivalent are undefined.`,
979
+ location
980
+ );
789
981
  }
790
- return lines.join("\n");
791
982
  }
792
983
 
793
984
  // src/image-vite.ts
@@ -1076,13 +1267,13 @@ function loadFarmDocsSearchDevRuntime() {
1076
1267
  return import("./search-client-OXH6GBNO.mjs");
1077
1268
  }
1078
1269
  function loadFarmOpenAPIDevRuntime() {
1079
- return import("./manager-JIA66YJ2.mjs");
1270
+ return import("./manager-YO2RHDYU.mjs");
1080
1271
  }
1081
1272
  function loadFarmWorkflowsDevRuntime() {
1082
1273
  return import("./workflows.mjs");
1083
1274
  }
1084
1275
  function loadFarmDevtoolsSnapshotRuntime() {
1085
- return import("./devtools-TDIJ6HVC.mjs");
1276
+ return import("./devtools-B3W3DLPG.mjs");
1086
1277
  }
1087
1278
  function loadFarmDevtoolsUIRuntime() {
1088
1279
  return import("./devtools-ui-CYBVFLPH.mjs");
@@ -1118,7 +1309,7 @@ var FARM_SERVER_ONLY_ENTRIES_RESOLVE_FILTER = [
1118
1309
  // What isBuiltin() accepts: `node:` ids and the builtin names, subpaths such as fs/promises
1119
1310
  // included.
1120
1311
  /^node:/,
1121
- exactIdPattern(builtinModules)
1312
+ exactIdPattern(builtinModules2)
1122
1313
  ];
1123
1314
  var FARM_SERVER_ONLY_ENTRIES_LOAD_FILTER = [
1124
1315
  exactIdPattern([FARM_SERVER_ONLY_PACKAGE_ID, FARM_PLATFORM_CLIENT_ID]),
@@ -1181,9 +1372,15 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1181
1372
  name: "farm:server-only-entries",
1182
1373
  enforce: "pre",
1183
1374
  config(config) {
1184
- const bundledPackages = collectFarmServerBundledPackageInfo(
1185
- path6.resolve(config.root ?? process.cwd())
1186
- );
1375
+ const appRoot = path6.resolve(config.root ?? process.cwd());
1376
+ if (options.distDir) {
1377
+ usePackageScanCacheFile(
1378
+ path6.resolve(appRoot, options.distDir, "cache", "package-scans.json")
1379
+ );
1380
+ }
1381
+ const bundledPackages = collectFarmServerBundledPackageInfo(appRoot);
1382
+ const prebundle = options.prebundleServerPackages ? createFarmServerPrebundleConfig(bundledPackages) : {};
1383
+ persistPackageScanCache();
1187
1384
  return {
1188
1385
  optimizeDeps: { rolldownOptions: { plugins: [farmBrowserBuiltinsOptimizerPlugin()] } },
1189
1386
  ssr: {
@@ -1193,7 +1390,7 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1193
1390
  // Packages Node cannot load as a bundler does (stylesheet imports, `module`-only ESM).
1194
1391
  ...bundledPackages.map(({ name }) => name)
1195
1392
  ],
1196
- ...options.prebundleServerPackages ? createFarmServerPrebundleConfig(bundledPackages) : {}
1393
+ ...prebundle
1197
1394
  }
1198
1395
  };
1199
1396
  },
@@ -1209,10 +1406,17 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1209
1406
  return FARM_SERVER_ONLY_PACKAGE_ID;
1210
1407
  }
1211
1408
  this.error(
1212
- `${importer ?? "A module"} imports "server-only", so it must not reach the browser, but client code imports it. Move what the client needs out of that module, or call it from a server component, server function or API route.`
1409
+ formatFarmDiagnostic(
1410
+ createFarmDiagnostic(
1411
+ "CLIENT_SERVER_ONLY_IMPORT",
1412
+ importer ?? "<unknown module>",
1413
+ `${importer ? "This module" : "A module"} imports "server-only", so it must not reach the browser, but client code imports it.`
1414
+ ),
1415
+ root
1416
+ )
1213
1417
  );
1214
1418
  }
1215
- if (!options2?.ssr && isBuiltin(id)) {
1419
+ if (!options2?.ssr && isBuiltin2(id)) {
1216
1420
  return resolveFarmBrowserBuiltin(this, id, importer, options2);
1217
1421
  }
1218
1422
  const resolveFrom = importer ? parseFarmResolveFrom(id, importer.split("?", 1)[0]) : null;
@@ -1232,7 +1436,14 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1232
1436
  const importedBy = importer ? ` (imported by ${importer})` : "";
1233
1437
  if (!options2?.ssr) {
1234
1438
  this.error(
1235
- `${id} is server-only and cannot be imported into client code${importedBy}. Use it from an API route or another server module.`
1439
+ formatFarmDiagnostic(
1440
+ createFarmDiagnostic(
1441
+ "CLIENT_SERVER_ONLY_ENTRY",
1442
+ importer ?? id,
1443
+ `${id} is server-only and cannot be imported into client code.`
1444
+ ),
1445
+ root
1446
+ )
1236
1447
  );
1237
1448
  }
1238
1449
  vercelOgInstalled || (vercelOgInstalled = isOptionalPeerInstalled(root, "@vercel/og"));
@@ -2003,7 +2214,7 @@ function isFarmConfigFile(file, root) {
2003
2214
  return FARM_CONFIG_FILENAMES.has(relative4);
2004
2215
  }
2005
2216
  var warnedClientBoundaryIds = /* @__PURE__ */ new Set();
2006
- function warnClientBoundaryOnce(context, id, code, config) {
2217
+ async function warnClientBoundaryOnce(context, id, code, config) {
2007
2218
  if (warnedClientBoundaryIds.has(id)) return;
2008
2219
  let program;
2009
2220
  try {
@@ -2012,12 +2223,25 @@ function warnClientBoundaryOnce(context, id, code, config) {
2012
2223
  return;
2013
2224
  }
2014
2225
  const publicKeys = new Set(Object.keys(config.env?.public ?? {}));
2015
- const findings = analyzeClientBoundary(program, publicKeys);
2016
- if (findings.envKeys.length === 0 && findings.publicEnvKeys.length === 0 && findings.builtinImports.length === 0) {
2017
- return;
2226
+ const findings = [];
2227
+ for (const finding of analyzeClientBoundary(program, publicKeys)) {
2228
+ if (finding.kind === "builtin" && !finding.name.startsWith("node:")) {
2229
+ const resolved = await context.resolve(finding.name, id).catch(() => null);
2230
+ if (!resolved?.id.startsWith(FARM_BROWSER_BUILTIN_PREFIX)) continue;
2231
+ }
2232
+ findings.push(finding);
2018
2233
  }
2234
+ if (findings.length === 0) return;
2019
2235
  warnedClientBoundaryIds.add(id);
2020
- logger.warn(formatClientBoundaryWarning(id, findings));
2236
+ const locate = createFarmSourceLocator(code, () => context.getCombinedSourcemap());
2237
+ logger.warn(
2238
+ findings.map(
2239
+ (finding) => formatFarmDiagnostic(
2240
+ createClientBoundaryDiagnostic(id, finding, locate(finding.start)),
2241
+ config.root
2242
+ )
2243
+ ).join("\n")
2244
+ );
2021
2245
  }
2022
2246
  function shouldEmitFarmClientRootHmr(renderer) {
2023
2247
  return getFarmRendererCapabilities(resolveFarmRenderer(renderer)).reconcilesRerenders;
@@ -2538,6 +2762,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2538
2762
  openAPIManager = new OpenAPIManager(appDirs, options.openapi, {
2539
2763
  mode: "development",
2540
2764
  apiBaseURL: typeof options.api?.baseURL === "string" ? options.api.baseURL : void 0,
2765
+ routes: () => apiRouteManager.getRoutes().values(),
2541
2766
  loadModule: (filePath) => apiRouteManager.loadModule(filePath)
2542
2767
  });
2543
2768
  const spec = await openAPIManager.generateSpec();
@@ -2646,108 +2871,32 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2646
2871
  });
2647
2872
  }
2648
2873
  }
2649
- const wrapFarmDocsResponseWithLayouts = async (request, response) => {
2650
- if (request.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !response.headers.get("content-type")?.toLowerCase().includes("text/html")) {
2651
- return response;
2652
- }
2653
- const pathname = new URL(request.url).pathname;
2654
- const matchedRoute = routeManager.matchRoute(pathname);
2655
- const layoutEntries = matchedRoute.layouts.map((layout) => ({
2656
- ...layout,
2657
- metadata: getClientModuleMetadata(layout.modulePath, farmConfig.root)
2658
- }));
2659
- if (!layoutEntries.some((layout) => layout.metadata.shouldHydrate)) {
2660
- return response;
2661
- }
2662
- const source = await response.text();
2663
- const bodyMatch = source.match(/<body([^>]*)>([\s\S]*?)<\/body>/i);
2664
- if (!bodyMatch) {
2665
- return new Response(source, {
2666
- status: response.status,
2667
- statusText: response.statusText,
2668
- headers: response.headers
2669
- });
2670
- }
2671
- const docsRenderer = resolveFarmRenderer((farmApp?.getConfig() ?? options).renderer);
2672
- const [rendererRuntime, layoutModules] = await Promise.all([
2673
- isReactRenderer(docsRenderer) ? import("./renderer/react/server.mjs") : loadFarmDevModule(server, docsRenderer.server),
2674
- Promise.all(
2675
- layoutEntries.map((layout) => routeManager.loadLayoutModule(layout.modulePath))
2676
- )
2677
- ]);
2678
- const hydrationStrategies = layoutEntries.flatMap(
2679
- (layout) => layout.metadata.shouldHydrate && layout.metadata.islandStrategy ? [layout.metadata.islandStrategy] : []
2680
- );
2681
- const islandStrategy = hydrationStrategies.every(
2682
- (strategy) => strategy === hydrationStrategies[0]
2683
- ) ? hydrationStrategies[0] ?? "load" : "load";
2684
- const params = matchedRoute.params || {};
2685
- const toUrlPath = (absolutePath) => toViteModuleId(absolutePath, farmConfig.root);
2686
- const clientLayouts = Object.fromEntries(
2687
- layoutEntries.map((layout) => [
2688
- layout.pattern,
2689
- {
2690
- modulePath: toUrlPath(layout.modulePath),
2691
- pattern: layout.pattern,
2692
- shouldHydrate: layout.metadata.shouldHydrate,
2693
- islandStrategy: layout.metadata.islandStrategy,
2694
- preloads: [toUrlPath(layout.modulePath)],
2695
- assets: []
2696
- }
2697
- ])
2698
- );
2699
- const inlineValue = (value) => JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
2700
- const pageModulePath = matchedRoute.route?.modulePath ? toUrlPath(matchedRoute.route.modulePath) : "";
2701
- const bootstrapScript = `<script>
2702
- window.__FARM_PROPS__ = ${inlineValue({ params })};
2703
- window.__FARM_ROUTE_SLOTS__ = [];
2704
- window.__FARM_DEPLOYMENT_ID__ = ${inlineValue(farmConfig.deploymentId)};
2705
- window.__FARM_PATH__ = ${inlineValue(pathname)};
2706
- window.__FARM_IS_CLIENT__ = false;
2707
- window.__FARM_PAGE_SHOULD_HYDRATE__ = false;
2708
- window.__FARM_LAYOUT_SHOULD_HYDRATE__ = true;
2709
- window.__FARM_SHOULD_HYDRATE__ = true;
2710
- window.__FARM_ISLAND_STRATEGY__ = ${inlineValue(islandStrategy)};
2711
- window.__FARM_PAGE_MODULE__ = ${inlineValue(pageModulePath)};
2712
- window.__FARM_LOADING_MODULE__ = null;
2713
- window.__FARM_MANIFEST__ = ${inlineValue({
2714
- routes: {},
2715
- layouts: clientLayouts,
2716
- slots: [],
2717
- clientEntry: "/@farm/client.js",
2718
- sharedAssets: []
2719
- })};
2720
- </script>`;
2721
- let wrappedElement = rendererRuntime.createElement("div", {
2722
- id: "__farm_page__",
2723
- "data-farm-client": "false",
2724
- "data-farm-layout-client": "true",
2725
- "data-farm-island": "page",
2726
- "data-farm-island-strategy": islandStrategy,
2727
- dangerouslySetInnerHTML: { __html: bootstrapScript + bodyMatch[2] }
2874
+ if (farmDocsDevRuntime && !farmDocsDevRuntime.hasFarmDocsRuntimeAdapter(farmConfig.docs)) {
2875
+ const docsContentDirs = farmDocsDevRuntime.getFarmDocsContentDirs(farmConfig.docs, {
2876
+ root: farmConfig.root,
2877
+ srcDir: farmConfig.srcDir
2728
2878
  });
2729
- for (let index = layoutModules.length - 1; index >= 0; index--) {
2730
- const LayoutComponent = layoutModules[index].default;
2731
- if (LayoutComponent) {
2732
- wrappedElement = rendererRuntime.createElement(LayoutComponent, {
2733
- children: wrappedElement,
2734
- params
2735
- });
2736
- }
2879
+ server.watcher.add(docsContentDirs);
2880
+ for (const event of ["add", "change", "unlink"]) {
2881
+ server.watcher.on(event, (file) => {
2882
+ const normalizedFile = toPosixPath(file);
2883
+ if (appDirSlugs.some((appDir) => normalizedFile.startsWith(`${appDir}/`))) return;
2884
+ const contentDirs = docsContentDirs.filter(
2885
+ (contentDir) => farmDocsDevRuntime.isFarmDocsContentFile(contentDir, file)
2886
+ );
2887
+ if (contentDirs.length === 0) return;
2888
+ for (const contentDir of contentDirs) {
2889
+ farmDocsDevRuntime.invalidateFarmDocsLastModified(contentDir);
2890
+ }
2891
+ logUpdate(
2892
+ "PAGE",
2893
+ `${event === "add" ? "added" : event === "unlink" ? "removed" : "updated"} ${toPosixPath(path6.relative(farmConfig.root, file))}`
2894
+ );
2895
+ server.ws.send({ type: "full-reload", path: "*" });
2896
+ });
2737
2897
  }
2738
- const rootMarkup = await rendererRuntime.renderToString(
2739
- rendererRuntime.createElement("div", { id: "root" }, wrappedElement)
2740
- );
2741
- const html = source.replace(bodyMatch[0], `<body${bodyMatch[1]}>${rootMarkup}</body>`);
2742
- const headers = new Headers(response.headers);
2743
- headers.delete("content-length");
2744
- headers.delete("etag");
2745
- return new Response(html, {
2746
- status: response.status,
2747
- statusText: response.statusText,
2748
- headers
2749
- });
2750
- };
2898
+ }
2899
+ const wrapFarmDocsResponseWithLayouts = (request, response) => farmApp.getServerRenderer().wrapDocsResponseWithLayouts(request, response);
2751
2900
  const farmDocsAPIHandler = farmDocsDevRuntime && !farmDocsDevRuntime.hasFarmDocsRuntimeAdapter(farmConfig.docs) ? farmDocsDevRuntime.createFarmDocsAPIHandler({
2752
2901
  rootDir: farmConfig.root,
2753
2902
  srcDir: farmConfig.srcDir,
@@ -2852,6 +3001,12 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2852
3001
  return;
2853
3002
  }
2854
3003
  }
3004
+ if (!rendererDisabled && (requestMethod === "GET" || requestMethod === "HEAD") && requestPathname === FARM_VIDEO_PLAYER_PATH) {
3005
+ res.statusCode = 200;
3006
+ res.setHeader("Content-Type", "text/html; charset=utf-8");
3007
+ res.end(requestMethod === "HEAD" ? void 0 : FARM_VIDEO_PLAYER_HTML);
3008
+ return;
3009
+ }
2855
3010
  const farmDocsFontPath = farmDocsFontAssets.get(requestPathname);
2856
3011
  if ((requestMethod === "GET" || requestMethod === "HEAD") && farmDocsFontPath && fs2.existsSync(farmDocsFontPath)) {
2857
3012
  res.statusCode = 200;
@@ -3221,6 +3376,14 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3221
3376
  return;
3222
3377
  }
3223
3378
  if (options.agent?.manifest !== false && isFarmAppManifestPath(stripFarmBasePath(requestPathname, farmConfig.basePath))) {
3379
+ const manifestGuardCoversPath = (path7) => farmPathGuardCoversEndpoint(
3380
+ {
3381
+ config: farmConfig,
3382
+ middlewareRoutes: middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
3383
+ },
3384
+ path7,
3385
+ apiServerBasePath
3386
+ );
3224
3387
  await serveBuiltInRoute(async () => {
3225
3388
  farmAppPackages ?? (farmAppPackages = resolveFarmAppPackages(farmConfig.root ?? process.cwd()));
3226
3389
  const manifest = await createFarmAppManifestResponse(
@@ -3237,14 +3400,14 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3237
3400
  }),
3238
3401
  defaultMCP: () => farmApp.getServerRenderer().getDefaultMCPServer(),
3239
3402
  // A guard written for an MCP server's path keeps its tools out of the public view.
3240
- guardCoversPath: (path7) => farmPathGuardCoversEndpoint(
3241
- {
3242
- config: farmConfig,
3243
- middlewareRoutes: middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
3244
- },
3245
- path7,
3246
- apiServerBasePath
3247
- )
3403
+ guardCoversPath: manifestGuardCoversPath,
3404
+ // A docs runtime's MCP server lists its tools when asked, read on each request.
3405
+ ...farmDocsHandler ? {
3406
+ registeredMCP: (request) => _listFarmRegisteredMCPServerTools(farmDocsHandler, request, {
3407
+ basePath: farmConfig.basePath,
3408
+ guardCoversPath: manifestGuardCoversPath
3409
+ })
3410
+ } : {}
3248
3411
  }
3249
3412
  );
3250
3413
  return manifest;
@@ -3305,12 +3468,26 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3305
3468
  headers: docsHeaders
3306
3469
  });
3307
3470
  const docsBodyInit = requestMethod === "GET" || requestMethod === "HEAD" ? {} : { body: createFarmNodeRequestBodyStream(req), duplex: "half" };
3308
- const docsResponse = await farmDocsHandler(new Request(docsRequest, docsBodyInit));
3471
+ const docsHandlerRequest = new Request(docsRequest, docsBodyInit);
3472
+ const registeredMCPCalls = await _readFarmRegisteredMCPCalls(
3473
+ docsHandlerRequest,
3474
+ farmConfig.basePath
3475
+ );
3476
+ const docsResponse = await farmDocsHandler(docsHandlerRequest);
3309
3477
  if (docsResponse) {
3310
3478
  const docsPage = docsResponse.headers.get("content-type")?.toLowerCase().includes("text/html");
3311
3479
  await serveBuiltInRoute(
3312
3480
  async (request) => {
3313
- if (!docsPage) return wrapFarmDocsResponseWithLayouts(docsRequest, docsResponse);
3481
+ if (!docsPage) {
3482
+ const response = await wrapFarmDocsResponseWithLayouts(
3483
+ docsRequest,
3484
+ docsResponse
3485
+ );
3486
+ return _runWithCurrentRequest(
3487
+ request,
3488
+ () => _observeFarmRegisteredMCPResponse(response, registeredMCPCalls)
3489
+ );
3490
+ }
3314
3491
  const deploymentMismatch = getFarmDeploymentMismatch(
3315
3492
  request,
3316
3493
  farmConfig.deploymentId
@@ -3346,7 +3523,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3346
3523
  }
3347
3524
  }
3348
3525
  if (options.mobileClient && !viteModuleRequest && (requestMethod === "GET" || requestMethod === "HEAD" || requestMethod === "POST") && req.headers.accept?.includes(FARM_NATIVE_TREE_CONTENT_TYPE)) {
3349
- const { createFarmNativeTreeResponse } = await import("./native-tree-OYGKP2NZ.mjs");
3526
+ const { createFarmNativeTreeResponse } = await import("./native-tree-G6ZWS7IR.mjs");
3350
3527
  const treeBodyInit = requestMethod === "POST" ? { body: createFarmNodeRequestBodyStream(req), duplex: "half" } : {};
3351
3528
  const treeResponse = await createFarmNativeTreeResponse({
3352
3529
  request: new Request(fullUrl, {
@@ -3389,7 +3566,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3389
3566
  }
3390
3567
  return {
3391
3568
  source: await fs2.promises.readFile(sourcePath, "utf8"),
3392
- filePath: sourcePath
3569
+ // Project-relative, as production sends it: never the machine's path.
3570
+ filePath: toBakedMarkdownSourcePath(farmApp.getConfig().root, sourcePath)
3393
3571
  };
3394
3572
  },
3395
3573
  // The anonymous check goes through this server, so its guards and
@@ -3715,12 +3893,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3715
3893
  if (req.method !== "GET" && req.method !== "HEAD") {
3716
3894
  body = await readNodeRequestBody(req, currentServerConfig.bodySizeLimit);
3717
3895
  }
3718
- return new Request(`http://${req.headers.host || "localhost:3000"}${req.url}`, {
3719
- method: req.method,
3720
- headers,
3721
- body: toRequestBody(body),
3722
- signal: createFarmNodeRequestAbortSignal(req, res)
3723
- });
3896
+ return new Request(
3897
+ resolveFarmRequestURL(req, {
3898
+ trustProxy: currentServerConfig.trustProxy
3899
+ }),
3900
+ {
3901
+ method: req.method,
3902
+ headers,
3903
+ body: toRequestBody(body),
3904
+ signal: createFarmNodeRequestAbortSignal(req, res)
3905
+ }
3906
+ );
3724
3907
  };
3725
3908
  const isDocsAPIRequest = Boolean(
3726
3909
  farmDocsAPIHandler && farmDocsDevRuntime?.isFarmDocsAPIRequest(pathname2)
@@ -4064,6 +4247,18 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4064
4247
  res.end(JSON.stringify({ error: "Route not found" }));
4065
4248
  return;
4066
4249
  }
4250
+ const trailingSlashLocation = resolveFarmTrailingSlashRedirect(
4251
+ targetRequestUrl,
4252
+ farmApp.getConfig().trailingSlash === true
4253
+ );
4254
+ if (trailingSlashLocation) {
4255
+ await sendFarmPageDataRedirect(
4256
+ res,
4257
+ { location: trailingSlashLocation, status: 308 },
4258
+ farmConfig.deploymentId
4259
+ );
4260
+ return;
4261
+ }
4067
4262
  const routeModule = await routeManager3.loadRouteModule(route.modulePath);
4068
4263
  const loadingBoundary = routeManager3.getMatchingLoading(
4069
4264
  targetRequestUrl.pathname,
@@ -4694,59 +4889,64 @@ export { manifest };
4694
4889
  if (resolveFarmServerComponentsMode(actionConfig.experimental?.serverComponents) === "islands" && (!id.includes("/node_modules/") || transformOptions?.ssr === true && farmReactServerFiles.has(id.split("?", 1)[0])) && !id.startsWith("\0") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id) && !hasUseClientDirective(code)) {
4695
4890
  const file = id.split("?", 1)[0];
4696
4891
  const projectRoot = actionConfig.root || server?.config.root || process.cwd();
4697
- if (transformOptions?.ssr === true) {
4698
- if (farmReactServerFiles.has(file)) {
4699
- for (const child of farmRelativeImportFiles(code, file))
4700
- farmReactServerFiles.add(child);
4892
+ const buildSnapshot = isBuild ? options.sourceSnapshot : void 0;
4893
+ const rewrite = () => {
4894
+ if (transformOptions?.ssr === true) {
4895
+ if (farmReactServerFiles.has(file)) {
4896
+ for (const child of farmRelativeImportFiles(code, file))
4897
+ farmReactServerFiles.add(child);
4898
+ }
4899
+ const serverModule = farmReactServerFiles.has(file) || !getFarmClientReachableModules(
4900
+ path6.resolve(projectRoot, actionConfig.srcDir || "src"),
4901
+ projectRoot
4902
+ ).has(path6.resolve(file));
4903
+ const reactServer = !serverModule ? null : rewriteFarmReactServerImports({
4904
+ code,
4905
+ file,
4906
+ reference: (specifier, exportName) => ensureFarmPackageClientReference(projectRoot, specifier, exportName, file),
4907
+ onServerFile: (serverFile) => farmReactServerFiles.add(serverFile)
4908
+ });
4909
+ if (reactServer !== null) {
4910
+ code = reactServer;
4911
+ rewrotePackageImports = true;
4912
+ }
4913
+ const internal = farmReactServerFiles.has(file) ? rewriteFarmReactServerClientModuleImports({
4914
+ code,
4915
+ file,
4916
+ reference: (clientFile) => ensureFarmInternalClientReference(projectRoot, clientFile)
4917
+ }) : null;
4918
+ if (internal !== null) {
4919
+ code = internal;
4920
+ rewrotePackageImports = true;
4921
+ }
4701
4922
  }
4702
- const serverModule = farmReactServerFiles.has(file) || !getFarmClientReachableModules(
4703
- path6.resolve(projectRoot, actionConfig.srcDir || "src"),
4704
- projectRoot
4705
- ).has(path6.resolve(file));
4706
- const reactServer = !serverModule ? null : rewriteFarmReactServerImports({
4707
- code,
4923
+ const rewritePackageImports = (source2) => rewriteFarmPackageClientImports({
4924
+ code: source2,
4708
4925
  file,
4709
- reference: (specifier, exportName) => ensureFarmPackageClientReference(projectRoot, specifier, exportName, file),
4710
- onServerFile: (serverFile) => farmReactServerFiles.add(serverFile)
4926
+ root: projectRoot,
4927
+ isClientPackage: (specifier) => isFarmPackageClientBoundary(file, specifier, projectRoot)
4711
4928
  });
4712
- if (reactServer !== null) {
4713
- code = reactServer;
4714
- rewrotePackageImports = true;
4715
- }
4716
- const internal = farmReactServerFiles.has(file) ? rewriteFarmReactServerClientModuleImports({
4717
- code,
4718
- file,
4719
- reference: (clientFile) => ensureFarmInternalClientReference(projectRoot, clientFile)
4720
- }) : null;
4721
- if (internal !== null) {
4722
- code = internal;
4929
+ const routeManager = farmApp?.getRouteManager();
4930
+ const source = code;
4931
+ const referenced = routeManager ? routeManager.inspectPackages(() => rewritePackageImports(source)) : rewritePackageImports(source);
4932
+ if (referenced !== null) {
4933
+ code = referenced;
4723
4934
  rewrotePackageImports = true;
4724
4935
  }
4725
- }
4726
- const rewritePackageImports = (source2) => rewriteFarmPackageClientImports({
4727
- code: source2,
4728
- file,
4729
- root: projectRoot,
4730
- isClientPackage: (specifier) => isFarmPackageClientBoundary(file, specifier, projectRoot)
4731
- });
4732
- const routeManager = farmApp?.getRouteManager();
4733
- const source = code;
4734
- const referenced = routeManager ? routeManager.inspectPackages(() => rewritePackageImports(source)) : rewritePackageImports(source);
4735
- if (referenced !== null) {
4736
- code = referenced;
4737
- rewrotePackageImports = true;
4738
- }
4739
- if (transformOptions?.ssr === true) {
4740
- const cached = rewriteFarmReactCacheImport(
4741
- code,
4742
- file,
4743
- runtimeModule?.(FARM_REACT_CACHE_MODULE)
4744
- );
4745
- if (cached !== null) {
4746
- code = cached;
4747
- rewrotePackageImports = true;
4936
+ if (transformOptions?.ssr === true) {
4937
+ const cached = rewriteFarmReactCacheImport(
4938
+ code,
4939
+ file,
4940
+ runtimeModule?.(FARM_REACT_CACHE_MODULE)
4941
+ );
4942
+ if (cached !== null) {
4943
+ code = cached;
4944
+ rewrotePackageImports = true;
4945
+ }
4748
4946
  }
4749
- }
4947
+ };
4948
+ if (buildSnapshot) withFarmSourceSnapshotOf(buildSnapshot, rewrite);
4949
+ else rewrite();
4750
4950
  }
4751
4951
  if (islandsServerFns() && !isFarmServerFnBoundaryId(id) && !id.includes("/node_modules/") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id)) {
4752
4952
  const serverFns = transformFarmServerFns(code, id, {
@@ -4782,12 +4982,18 @@ export { manifest };
4782
4982
  if ((currentConfig.experimental?.serverActions !== true || !serverFnTransformActive) && !islandsServerFns()) {
4783
4983
  const violation = findClientServerFnViolation(code, id);
4784
4984
  if (violation) {
4785
- this.error(formatServerFnBoundaryError(violation, id));
4985
+ const locate = createFarmSourceLocator(code, () => this.getCombinedSourcemap());
4986
+ this.error(
4987
+ formatFarmDiagnostic(
4988
+ createServerFnBoundaryDiagnostic(violation, id, locate(violation.start)),
4989
+ currentConfig.root
4990
+ )
4991
+ );
4786
4992
  }
4787
4993
  }
4788
4994
  }
4789
4995
  if (!transformOptions?.ssr && shouldInspectClientBoundary(id, code)) {
4790
- warnClientBoundaryOnce(this, id, code, farmApp?.getConfig() ?? options);
4996
+ await warnClientBoundaryOnce(this, id, code, farmApp?.getConfig() ?? options);
4791
4997
  }
4792
4998
  if (typeof imageImports.transform === "function") {
4793
4999
  const imageModule = await imageImports.transform.call(this, code, id, transformOptions);
@@ -5056,6 +5262,13 @@ if (import.meta.hot) {
5056
5262
  }
5057
5263
  const currentFarmConfig = farmApp?.getConfig();
5058
5264
  const normalizedFile = file.replace(/\\/g, "/");
5265
+ if (normalizedFile.includes(FARM_CLIENT_REFERENCE_DIRECTORY) && normalizedFile.startsWith(
5266
+ path6.posix.join(
5267
+ toPosixPath(currentFarmConfig?.root || options.root || server2.config.root),
5268
+ FARM_CLIENT_REFERENCE_DIRECTORY
5269
+ )
5270
+ ))
5271
+ return modules;
5059
5272
  if (currentFarmConfig && /\/route\.(?:ts|tsx|js|jsx)$/.test(normalizedFile) && getFarmAppDirectories(currentFarmConfig).some(
5060
5273
  (appDir) => normalizedFile.startsWith(`${toPosixPath(appDir)}/api/`)
5061
5274
  )) {
@@ -5720,7 +5933,8 @@ function generateClientCode(integrationProviders = [], documentNavigationMatcher
5720
5933
  );
5721
5934
  const appSetupPath = resolveFarmRendererAppSetup(root, renderer);
5722
5935
  const rendererClientImports = isReactRenderer(renderer) ? `import React from 'react'
5723
- import { hydrateRoot, createRoot } from 'react-dom/client'` : appSetupPath ? `import React, { hydrateRoot, createRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)}
5936
+ import { hydrateRoot, createRoot } from 'react-dom/client'
5937
+ import { restorePagePosition } from '@farm.js/core/internal/client-runtime'` : appSetupPath ? `import React, { hydrateRoot, createRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)}
5724
5938
  import __farmAppSetup from ${JSON.stringify(toViteModuleId(appSetupPath, root))}
5725
5939
  __farmConfigureApp(__farmAppSetup)` : `import React, { hydrateRoot, createRoot } from ${JSON.stringify(renderer.client)}`;
5726
5940
  const isolatedHydrationImport = isolatedHydrationEnabled ? `${islandValues ? "import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph, createFarmServerTreeElement, createFarmServerTreeLayout } from '@farm.js/core/internal/islands-runtime'" : "import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from '@farm.js/core/internal/isolated-boundary'\nimport { createFarmServerTreeElement } from '@farm.js/core/internal/server-tree'"}` : "";
@@ -5781,7 +5995,7 @@ ${isolatedHydrationImport}
5781
5995
  import { installChunkErrorRecovery, SPARouter } from '@farm.js/core/client'
5782
5996
  import { createClientPluginManager } from '@farm.js/core/plugin/client'
5783
5997
  import { isFarmRouteActive } from '@farm.js/core/router'
5784
- import { isFarmBlockedNavigationURL, replayFarmQueuedInteraction, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from '@farm.js/core/internal/client-runtime'
5998
+ import { installFarmLinkPrefetch, isFarmBlockedNavigationURL, readFarmLinkNavigateOptions, rememberFarmLinkLocale, replayFarmQueuedInteraction, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from '@farm.js/core/internal/client-runtime'
5785
5999
  import { reviveDeferredData } from '@farm.js/core/deferred'
5786
6000
  import {
5787
6001
  createFarmDeploymentMismatchError,
@@ -6726,12 +6940,13 @@ async function tryHydrateImportedPage(
6726
6940
  hydrationOptions = {},
6727
6941
  ) {
6728
6942
  const modulePath = route?.modulePath;
6729
- if (!modulePath || signal?.aborted) {
6943
+ const pageShouldHydrate = hydrationOptions.pageShouldHydrate !== false;
6944
+ const layoutShouldHydrate = hydrationOptions.layoutShouldHydrate === true;
6945
+ // Layouts that hydrate around server HTML need no page module: a docs runtime page has none.
6946
+ if ((!modulePath && (pageShouldHydrate || !layoutShouldHydrate)) || signal?.aborted) {
6730
6947
  return false;
6731
6948
  }
6732
6949
 
6733
- const pageShouldHydrate = hydrationOptions.pageShouldHydrate !== false;
6734
- const layoutShouldHydrate = hydrationOptions.layoutShouldHydrate === true;
6735
6950
  const islandStrategy = hydrationOptions.islandStrategy || route.islandStrategy || 'load';
6736
6951
  let pageElement = null;
6737
6952
  // Import layouts before the page, root first, so Vite injects their CSS in the same
@@ -6786,10 +7001,12 @@ async function tryHydrateImportedPage(
6786
7001
  );
6787
7002
  } else if (layoutShouldHydrate) {
6788
7003
  currentPageProps = existingProps || { params };
7004
+ // A navigation passes the page element of the document it fetched, read as it is rather
7005
+ // than serialized and parsed again; hydration reads the page in this document.
6789
7006
  const serverPage = document.getElementById('__farm_page__');
6790
- const pageSource = typeof hydrationOptions.serverHtml === 'string'
6791
- ? hydrationOptions.serverHtml
6792
- : serverPage;
7007
+ const pageSource = hydrationOptions.navigationPage === undefined
7008
+ ? serverPage
7009
+ : hydrationOptions.navigationPage;
6793
7010
  const serverTree = pageSource
6794
7011
  ? await createFarmServerTreePageElement(pageSource, window.location.pathname)
6795
7012
  : null;
@@ -6800,9 +7017,7 @@ async function tryHydrateImportedPage(
6800
7017
  false,
6801
7018
  islandStrategy,
6802
7019
  null,
6803
- typeof hydrationOptions.serverHtml === 'string'
6804
- ? hydrationOptions.serverHtml
6805
- : serverPage ? serverPage.innerHTML : '',
7020
+ pageSource ? pageSource.innerHTML : '',
6806
7021
  );
6807
7022
  }
6808
7023
  if (signal?.aborted || !container?.isConnected || !pageElement) return false;
@@ -6823,7 +7038,7 @@ async function tryHydrateImportedPage(
6823
7038
  wrap: wrapFarmClientRouteGraph,
6824
7039
  };
6825
7040
  } else if (useHydrate && container?.id === '__farm_page__') {
6826
- wrappedElement = wrapFarmClientRouteGraph(pageElement);
7041
+ wrappedElement = wrapFarmClientRouteGraph(${isReactRenderer(renderer) ? "restorePagePosition(React, container, pageElement)" : "pageElement"});
6827
7042
  } else {
6828
7043
  wrappedElement = await buildWrappedHydrationElement(
6829
7044
  currentPageComponent,
@@ -6880,10 +7095,22 @@ function findLayoutBoundary(root, pattern) {
6880
7095
  return null;
6881
7096
  }
6882
7097
 
7098
+ // A layout that renders the document itself has no boundary element: the document names it.
7099
+ function readDocumentLayoutPatterns() {
7100
+ try {
7101
+ const patterns = JSON.parse(document.documentElement.getAttribute('data-farm-document-layouts') || '[]');
7102
+ return Array.isArray(patterns) ? patterns.filter((pattern) => typeof pattern === 'string') : [];
7103
+ } catch {
7104
+ return [];
7105
+ }
7106
+ }
7107
+
6883
7108
  function readActiveLayoutPatterns() {
6884
- return Array.from(document.querySelectorAll('[data-farm-layout-boundary="true"]'))
6885
- .map((element) => element.getAttribute('data-farm-layout-pattern'))
6886
- .filter(Boolean);
7109
+ return readDocumentLayoutPatterns().concat(
7110
+ Array.from(document.querySelectorAll('[data-farm-layout-boundary="true"]'))
7111
+ .map((element) => element.getAttribute('data-farm-layout-pattern'))
7112
+ .filter(Boolean),
7113
+ );
6887
7114
  }
6888
7115
 
6889
7116
  ${FARM_NAVIGATION_SCRIPT_SOURCE}
@@ -7327,7 +7554,7 @@ async function renderPage(pageData, info) {
7327
7554
  pageShouldHydrate,
7328
7555
  layoutShouldHydrate,
7329
7556
  islandStrategy: route.islandStrategy,
7330
- serverHtml: nextPage ? nextPage.innerHTML : '',
7557
+ navigationPage: nextPage,
7331
7558
  layoutSource: fragment,
7332
7559
  loadingModulePath: route.loadingModulePath,
7333
7560
  },
@@ -7509,7 +7736,8 @@ function farmIslandsOnlyDocument() {
7509
7736
  if (hydratedSlots) replayPreHydrationClicks();
7510
7737
  return
7511
7738
  }
7512
- if (!modulePath) {
7739
+ // Layouts that hydrate around server HTML need no page module: a docs runtime page has none.
7740
+ if (!modulePath && (pageShouldHydrate || !layoutShouldHydrate)) {
7513
7741
  console.error('[Farm.js] No page module path found')
7514
7742
  return
7515
7743
  }
@@ -7677,16 +7905,13 @@ document.addEventListener('click', function(event) {
7677
7905
 
7678
7906
  // Use SPA router
7679
7907
  event.preventDefault();
7680
- const replace = target.hasAttribute('data-replace');
7681
- const scroll = !target.hasAttribute('data-no-scroll');
7682
- const viewTransitionValue = target.getAttribute('data-view-transition');
7683
- const viewTransition = viewTransitionValue === 'auto'
7684
- ? 'auto'
7685
- : viewTransitionValue === 'true';
7686
-
7687
- spaRouter.navigate(href, { replace, scroll, viewTransition });
7908
+ rememberFarmLinkLocale(target);
7909
+ spaRouter.navigate(href, readFarmLinkNavigateOptions(target));
7688
7910
  });
7689
7911
 
7912
+ // Link anchors on a page that does not hydrate prefetch through the router as Link would.
7913
+ installFarmLinkPrefetch();
7914
+
7690
7915
  if (import.meta.hot) {
7691
7916
  import.meta.hot.on('vite:beforeUpdate', () => {
7692
7917
  // Clear module cache on HMR to pick up changes
@@ -7867,7 +8092,7 @@ async function defineConfig(config = {}) {
7867
8092
  ...reactRefreshPlugins,
7868
8093
  viteBrowserExternalPlugin,
7869
8094
  farmI18nClientBridgePlugin(),
7870
- farmServerOnlyEntriesPlugin(),
8095
+ farmServerOnlyEntriesPlugin({ distDir: config.distDir || ".farm" }),
7871
8096
  farmIslandContainersPlugin(config),
7872
8097
  farmPlugin(config),
7873
8098
  farmEnvironmentFunctionsPlugin(config),