@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
@@ -5,11 +5,12 @@
5
5
  var _chunk3QM74STYcjs = require('./chunk-3QM74STY.cjs');
6
6
 
7
7
 
8
- var _chunkO47W53D3cjs = require('./chunk-O47W53D3.cjs');
9
8
 
10
9
 
10
+ var _chunkVJ6L7TIIcjs = require('./chunk-VJ6L7TII.cjs');
11
11
 
12
12
 
13
+ var _chunkRDADQG5Scjs = require('./chunk-RDADQG5S.cjs');
13
14
 
14
15
 
15
16
 
@@ -33,12 +34,18 @@ var _chunkO47W53D3cjs = require('./chunk-O47W53D3.cjs');
33
34
 
34
35
 
35
36
 
36
- var _chunkTAU3OF5Bcjs = require('./chunk-TAU3OF5B.cjs');
37
37
 
38
38
 
39
39
 
40
40
 
41
- var _chunkDMXMIE2Ccjs = require('./chunk-DMXMIE2C.cjs');
41
+
42
+
43
+ var _chunkIK33N2ANcjs = require('./chunk-IK33N2AN.cjs');
44
+
45
+
46
+
47
+
48
+ var _chunkHVJ7IACBcjs = require('./chunk-HVJ7IACB.cjs');
42
49
 
43
50
 
44
51
  var _chunkPMU4U2W2cjs = require('./chunk-PMU4U2W2.cjs');
@@ -48,24 +55,23 @@ var _chunkAQLHD6HZcjs = require('./chunk-AQLHD6HZ.cjs');
48
55
 
49
56
 
50
57
 
51
- var _chunkCLEWORVYcjs = require('./chunk-CLEWORVY.cjs');
58
+ var _chunk7564NP5Zcjs = require('./chunk-7564NP5Z.cjs');
52
59
 
53
60
 
54
61
 
55
62
 
56
- var _chunkPIUTGRDIcjs = require('./chunk-PIUTGRDI.cjs');
57
63
 
58
64
 
59
65
 
60
66
 
67
+ var _chunkXGDI4OUBcjs = require('./chunk-XGDI4OUB.cjs');
61
68
 
62
69
 
70
+ var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
63
71
 
64
72
 
65
- var _chunkPXAHSCR6cjs = require('./chunk-PXAHSCR6.cjs');
66
73
 
67
74
 
68
- var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
69
75
 
70
76
 
71
77
 
@@ -76,17 +82,18 @@ var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
76
82
 
77
83
 
78
84
 
85
+ var _chunkWJ5CCQBMcjs = require('./chunk-WJ5CCQBM.cjs');
79
86
 
80
87
 
88
+ var _chunkYRXPDKMMcjs = require('./chunk-YRXPDKMM.cjs');
81
89
 
82
90
 
83
- var _chunk4YHGQDTTcjs = require('./chunk-4YHGQDTT.cjs');
91
+ var _chunkKPYQ32BAcjs = require('./chunk-KPYQ32BA.cjs');
84
92
 
85
93
 
86
- var _chunkTU6VAH4Vcjs = require('./chunk-TU6VAH4V.cjs');
87
94
 
88
95
 
89
- var _chunkILQ5DKYFcjs = require('./chunk-ILQ5DKYF.cjs');
96
+ var _chunkPIUTGRDIcjs = require('./chunk-PIUTGRDI.cjs');
90
97
 
91
98
 
92
99
  var _chunk7EPYN7GWcjs = require('./chunk-7EPYN7GW.cjs');
@@ -126,7 +133,13 @@ var _chunk7EPYN7GWcjs = require('./chunk-7EPYN7GW.cjs');
126
133
 
127
134
 
128
135
 
129
- var _chunkHTXKSREFcjs = require('./chunk-HTXKSREF.cjs');
136
+
137
+
138
+
139
+
140
+
141
+
142
+ var _chunkJNZDTE75cjs = require('./chunk-JNZDTE75.cjs');
130
143
 
131
144
 
132
145
 
@@ -140,7 +153,7 @@ var _chunkERMUL73Lcjs = require('./chunk-ERMUL73L.cjs');
140
153
  var _chunkUVV3I5QAcjs = require('./chunk-UVV3I5QA.cjs');
141
154
 
142
155
 
143
- var _chunkMQ4DYVFScjs = require('./chunk-MQ4DYVFS.cjs');
156
+ var _chunkIIHZ2BEEcjs = require('./chunk-IIHZ2BEE.cjs');
144
157
 
145
158
 
146
159
 
@@ -150,10 +163,10 @@ var _chunkSTF6VDYQcjs = require('./chunk-STF6VDYQ.cjs');
150
163
 
151
164
 
152
165
 
153
- var _chunkODBM54RTcjs = require('./chunk-ODBM54RT.cjs');
166
+ var _chunkF4ID7BGOcjs = require('./chunk-F4ID7BGO.cjs');
154
167
 
155
168
 
156
- var _chunk5PDMBWAFcjs = require('./chunk-5PDMBWAF.cjs');
169
+ var _chunkWRWJ7IWTcjs = require('./chunk-WRWJ7IWT.cjs');
157
170
 
158
171
 
159
172
  var _chunkRE5E2G5Scjs = require('./chunk-RE5E2G5S.cjs');
@@ -183,7 +196,7 @@ var _chunk3EIPOTZVcjs = require('./chunk-3EIPOTZV.cjs');
183
196
 
184
197
 
185
198
 
186
- var _chunkLGR7565Lcjs = require('./chunk-LGR7565L.cjs');
199
+ var _chunkPG7J7XYTcjs = require('./chunk-PG7J7XYT.cjs');
187
200
 
188
201
 
189
202
 
@@ -195,21 +208,21 @@ var _chunk2HW5LWAHcjs = require('./chunk-2HW5LWAH.cjs');
195
208
 
196
209
 
197
210
 
198
- var _chunkHGB4PM2Ccjs = require('./chunk-HGB4PM2C.cjs');
211
+ var _chunk2YJ4DHTDcjs = require('./chunk-2YJ4DHTD.cjs');
199
212
 
200
213
 
201
214
 
202
215
 
203
216
 
204
217
 
205
- var _chunkJX5VOLAVcjs = require('./chunk-JX5VOLAV.cjs');
218
+ var _chunk6DBBMQWTcjs = require('./chunk-6DBBMQWT.cjs');
206
219
 
207
220
 
208
221
 
209
222
  var _chunkX333W5KVcjs = require('./chunk-X333W5KV.cjs');
210
223
 
211
224
 
212
- var _chunkACGBXN3Ucjs = require('./chunk-ACGBXN3U.cjs');
225
+ var _chunkWW62HKA2cjs = require('./chunk-WW62HKA2.cjs');
213
226
 
214
227
 
215
228
 
@@ -225,10 +238,10 @@ var _chunkKBGZ5FD6cjs = require('./chunk-KBGZ5FD6.cjs');
225
238
  var _chunkP2355C6Ecjs = require('./chunk-P2355C6E.cjs');
226
239
 
227
240
 
228
- var _chunk5LOARKDPcjs = require('./chunk-5LOARKDP.cjs');
241
+ var _chunkHFJLMALCcjs = require('./chunk-HFJLMALC.cjs');
229
242
 
230
243
 
231
- var _chunkNLBK37HIcjs = require('./chunk-NLBK37HI.cjs');
244
+ var _chunkSXXSQVKKcjs = require('./chunk-SXXSQVKK.cjs');
232
245
 
233
246
 
234
247
 
@@ -237,15 +250,15 @@ var _chunkKORZ6PREcjs = require('./chunk-KORZ6PRE.cjs');
237
250
 
238
251
 
239
252
 
240
- var _chunkXGTFLG73cjs = require('./chunk-XGTFLG73.cjs');
253
+ var _chunk4VLXQ55Ocjs = require('./chunk-4VLXQ55O.cjs');
241
254
 
242
255
 
243
- var _chunkLRB5OVRTcjs = require('./chunk-LRB5OVRT.cjs');
256
+ var _chunkRKQOMG2Xcjs = require('./chunk-RKQOMG2X.cjs');
244
257
 
245
258
 
246
259
 
247
260
 
248
- var _chunkE7QOEV5Zcjs = require('./chunk-E7QOEV5Z.cjs');
261
+ var _chunkYUCU6XB4cjs = require('./chunk-YUCU6XB4.cjs');
249
262
 
250
263
 
251
264
  var _chunkY3WG64CPcjs = require('./chunk-Y3WG64CP.cjs');
@@ -258,7 +271,7 @@ var _chunkJRGR5Z4Kcjs = require('./chunk-JRGR5Z4K.cjs');
258
271
 
259
272
 
260
273
 
261
- var _chunkJYNNIGQOcjs = require('./chunk-JYNNIGQO.cjs');
274
+ var _chunk25JGHAGHcjs = require('./chunk-25JGHAGH.cjs');
262
275
 
263
276
 
264
277
 
@@ -267,7 +280,7 @@ var _chunkZMSVKVI3cjs = require('./chunk-ZMSVKVI3.cjs');
267
280
 
268
281
 
269
282
 
270
- var _chunkQMNWKQL4cjs = require('./chunk-QMNWKQL4.cjs');
283
+ var _chunkGC5ROI3Acjs = require('./chunk-GC5ROI3A.cjs');
271
284
 
272
285
 
273
286
  var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
@@ -277,7 +290,7 @@ var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
277
290
 
278
291
 
279
292
 
280
- var _chunkCFG4QERRcjs = require('./chunk-CFG4QERR.cjs');
293
+ var _chunk7Q7UB4TLcjs = require('./chunk-7Q7UB4TL.cjs');
281
294
 
282
295
 
283
296
 
@@ -288,7 +301,7 @@ var _chunkSUCDVKUBcjs = require('./chunk-SUCDVKUB.cjs');
288
301
  var _chunkEVIWKPJVcjs = require('./chunk-EVIWKPJV.cjs');
289
302
 
290
303
 
291
- var _chunkUVQRMUARcjs = require('./chunk-UVQRMUAR.cjs');
304
+ var _chunkIVBDRAORcjs = require('./chunk-IVBDRAOR.cjs');
292
305
 
293
306
 
294
307
  var _chunkPMJSG4JScjs = require('./chunk-PMJSG4JS.cjs');
@@ -300,7 +313,8 @@ var _chunkRWR7SMD7cjs = require('./chunk-RWR7SMD7.cjs');
300
313
 
301
314
 
302
315
 
303
- var _chunk6IOZPJ3Icjs = require('./chunk-6IOZPJ3I.cjs');
316
+
317
+ var _chunkY3DO7BIJcjs = require('./chunk-Y3DO7BIJ.cjs');
304
318
 
305
319
 
306
320
  var _chunkDBYNZIIQcjs = require('./chunk-DBYNZIIQ.cjs');
@@ -312,17 +326,19 @@ var _chunkDBYNZIIQcjs = require('./chunk-DBYNZIIQ.cjs');
312
326
  var _chunkNLBHLPEOcjs = require('./chunk-NLBHLPEO.cjs');
313
327
 
314
328
 
329
+
315
330
  var _chunkDVJM55D2cjs = require('./chunk-DVJM55D2.cjs');
316
331
 
317
332
 
318
333
 
319
334
 
320
335
 
321
- var _chunkMBCRWU3Pcjs = require('./chunk-MBCRWU3P.cjs');
336
+ var _chunkH7OFZJCVcjs = require('./chunk-H7OFZJCV.cjs');
322
337
 
323
338
 
324
339
 
325
- var _chunkHDPT6OYEcjs = require('./chunk-HDPT6OYE.cjs');
340
+
341
+ var _chunk2RSVYJT6cjs = require('./chunk-2RSVYJT6.cjs');
326
342
 
327
343
 
328
344
  var _chunk7JUIK547cjs = require('./chunk-7JUIK547.cjs');
@@ -611,7 +627,8 @@ var VITE_MODULE_QUERY_FLAGS = [
611
627
  ];
612
628
  var SCRIPT_FETCH_DESTINATIONS = /* @__PURE__ */ new Set(["script", "worker", "sharedworker", "serviceworker"]);
613
629
  function isViteModuleRequest(url, headers) {
614
- if (VITE_MODULE_QUERY_FLAGS.some((flag) => url.searchParams.has(flag))) return true;
630
+ if (VITE_MODULE_QUERY_FLAGS.some((flag) => url.searchParams.getAll(flag).includes("")))
631
+ return true;
615
632
  const destination = headers["sec-fetch-dest"];
616
633
  const value = Array.isArray(destination) ? destination[0] : destination;
617
634
  return value !== void 0 && SCRIPT_FETCH_DESTINATIONS.has(value.toLowerCase());
@@ -676,36 +693,197 @@ function findClientServerFnViolation(code, id) {
676
693
  const specifiers = match[1];
677
694
  for (const factory of SERVER_FN_FACTORIES) {
678
695
  if (!new RegExp(`(?:^|[\\s{,])${factory}(?:[\\s},]|$)`).test(specifiers)) continue;
679
- if (new RegExp(`(?<![\\w$.])${factory}\\s*(?:<[^>]*>)?\\s*\\(`).test(code)) {
680
- return { factory };
681
- }
696
+ const call = new RegExp(`(?<![\\w$.])${factory}\\s*(?:<[^>]*>)?\\s*\\(`).exec(code);
697
+ if (call) return { factory, start: call.index };
682
698
  }
683
699
  }
684
700
  return null;
685
701
  }
686
- function formatServerFnBoundaryError(violation, id) {
687
- return [
688
- `${violation.factory} handlers run only on the server, but ${id} is being bundled into the client.`,
689
- `Importing a ${violation.factory} module from client code executes the server handler (and its Node-only imports) in the browser.`,
690
- `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,`,
691
- `or keep the query on the server: call it from server components, or expose an API route and use createAPIClient from the client.`
692
- ].join("\n");
702
+ function createServerFnBoundaryDiagnostic(violation, id, location) {
703
+ return _chunkJNZDTE75cjs.createFarmDiagnostic.call(void 0,
704
+ "CLIENT_SERVER_FUNCTION",
705
+ id,
706
+ `${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.`,
707
+ location
708
+ );
693
709
  }
694
710
 
695
711
  // src/client-boundary-env.ts
712
+
696
713
  var FUNCTION_BODY_TYPES = /* @__PURE__ */ new Set([
697
714
  "FunctionDeclaration",
698
715
  "FunctionExpression",
699
716
  "ArrowFunctionExpression"
700
717
  ]);
718
+ var BARE_BUILTIN_NAMES = new Set(
719
+ _module.builtinModules.filter((name) => !name.startsWith("_") && !name.includes(":")).map((name) => name.split("/", 1)[0])
720
+ );
721
+ var BARE_BUILTIN_SPECIFIER_RE = new RegExp(
722
+ String.raw`(?:\bfrom|\bimport|\brequire)\s*\(?\s*["'](?:` + [...BARE_BUILTIN_NAMES].join("|") + String.raw`)(?:/[^"']*)?["']`
723
+ );
724
+ var SPECIFIER_POSITION_RE = /(?:\bfrom|\bimport|\brequire)\s*\(?\s*$/;
701
725
  function shouldInspectClientBoundary(id, code) {
702
726
  if (id.startsWith("\0") || id.startsWith("virtual:") || id.includes("node_modules")) return false;
703
- return code.includes("process.env") || code.includes("node:");
727
+ return mayUseServerOnlyApis(code);
728
+ }
729
+ var KEYWORDS_BEFORE_EXPRESSION = /* @__PURE__ */ new Set([
730
+ "await",
731
+ "case",
732
+ "delete",
733
+ "do",
734
+ "else",
735
+ "in",
736
+ "instanceof",
737
+ "new",
738
+ "of",
739
+ "return",
740
+ "throw",
741
+ "typeof",
742
+ "void",
743
+ "yield"
744
+ ]);
745
+ function isBuiltinNameCode(code) {
746
+ return code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 95;
747
+ }
748
+ function isIdentifierCode(code) {
749
+ return code >= 97 && code <= 122 || code >= 65 && code <= 90 || code >= 48 && code <= 57 || code === 95 || code === 36 || code > 127;
750
+ }
751
+ function mayUseServerOnlyApis(code) {
752
+ if (!code.includes("process.env") && !code.includes("node:") && !BARE_BUILTIN_SPECIFIER_RE.test(code)) {
753
+ return false;
754
+ }
755
+ const templateBraces = [];
756
+ let index = 0;
757
+ let previous = 0;
758
+ let previousWordStart = -1;
759
+ const startsBuiltinSpecifier = (quote) => {
760
+ const start = quote + 1;
761
+ if (code.startsWith("node:", start)) return true;
762
+ let end = start;
763
+ while (end < code.length && isBuiltinNameCode(code.charCodeAt(end))) end += 1;
764
+ const after = code.charCodeAt(end);
765
+ 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));
766
+ };
767
+ const skipTemplateText = () => {
768
+ while (index < code.length) {
769
+ const character = code.charCodeAt(index);
770
+ if (character === 92) {
771
+ index += 2;
772
+ } else if (character === 96) {
773
+ index += 1;
774
+ previous = 96;
775
+ return false;
776
+ } else if (character === 36 && code.charCodeAt(index + 1) === 123) {
777
+ index += 2;
778
+ templateBraces.push(0);
779
+ previous = 123;
780
+ return true;
781
+ } else {
782
+ index += 1;
783
+ }
784
+ }
785
+ return false;
786
+ };
787
+ while (index < code.length) {
788
+ const character = code.charCodeAt(index);
789
+ const next = code.charCodeAt(index + 1);
790
+ if (character === 47 && next === 47) {
791
+ const end = code.indexOf("\n", index);
792
+ index = end === -1 ? code.length : end;
793
+ continue;
794
+ }
795
+ if (character === 47 && next === 42) {
796
+ const end = code.indexOf("*/", index + 2);
797
+ index = end === -1 ? code.length : end + 2;
798
+ continue;
799
+ }
800
+ if (character === 39 || character === 34) {
801
+ if (startsBuiltinSpecifier(index)) return true;
802
+ index += 1;
803
+ while (index < code.length) {
804
+ const inner = code.charCodeAt(index);
805
+ if (inner === 92) {
806
+ index += 2;
807
+ continue;
808
+ }
809
+ index += 1;
810
+ if (inner === character || inner === 10) break;
811
+ }
812
+ previous = character;
813
+ continue;
814
+ }
815
+ if (character === 96) {
816
+ if (startsBuiltinSpecifier(index)) return true;
817
+ index += 1;
818
+ skipTemplateText();
819
+ continue;
820
+ }
821
+ if (character === 47) {
822
+ const word = previousWordStart === -1 ? "" : code.slice(previousWordStart, index).trim();
823
+ const startsExpression = !(isIdentifierCode(previous) || previous === 41 || previous === 93) || KEYWORDS_BEFORE_EXPRESSION.has(word);
824
+ index += 1;
825
+ if (startsExpression) {
826
+ let inClass = false;
827
+ while (index < code.length) {
828
+ const inner = code.charCodeAt(index);
829
+ if (inner === 10) break;
830
+ index += 1;
831
+ if (inner === 92) index += 1;
832
+ else if (inner === 91) inClass = true;
833
+ else if (inner === 93) inClass = false;
834
+ else if (inner === 47 && !inClass) break;
835
+ }
836
+ previous = 41;
837
+ previousWordStart = -1;
838
+ } else {
839
+ previous = 47;
840
+ previousWordStart = -1;
841
+ }
842
+ continue;
843
+ }
844
+ if (templateBraces.length > 0 && (character === 123 || character === 125)) {
845
+ const depth = templateBraces.length - 1;
846
+ if (character === 123) {
847
+ templateBraces[depth] += 1;
848
+ } else if (templateBraces[depth] === 0) {
849
+ templateBraces.pop();
850
+ index += 1;
851
+ skipTemplateText();
852
+ continue;
853
+ } else {
854
+ templateBraces[depth] -= 1;
855
+ }
856
+ }
857
+ if (isIdentifierCode(character)) {
858
+ const start = index;
859
+ if (character === 112 && code.startsWith("process.env", index) && !isIdentifierCode(previous === 0 ? 32 : code.charCodeAt(index - 1))) {
860
+ return true;
861
+ }
862
+ while (index < code.length && isIdentifierCode(code.charCodeAt(index))) index += 1;
863
+ previous = code.charCodeAt(index - 1);
864
+ previousWordStart = start;
865
+ continue;
866
+ }
867
+ if (character > 32) {
868
+ previous = character;
869
+ previousWordStart = -1;
870
+ }
871
+ index += 1;
872
+ }
873
+ return false;
704
874
  }
705
875
  function analyzeClientBoundary(program, publicKeys) {
706
- const envKeys = /* @__PURE__ */ new Set();
707
- const publicEnvKeys = /* @__PURE__ */ new Set();
708
- const builtinImports = /* @__PURE__ */ new Set();
876
+ const findings = [];
877
+ const seen = /* @__PURE__ */ new Set();
878
+ const add = (kind, name, node) => {
879
+ const key = `${kind}\0${name}`;
880
+ if (seen.has(key)) return;
881
+ seen.add(key);
882
+ findings.push({ kind, name, start: _nullishCoalesce(node.start, () => ( 0)) });
883
+ };
884
+ const addEnvKey = (key, node) => {
885
+ if (key !== "NODE_ENV") add(publicKeys.has(key) ? "public-env" : "server-env", key, node);
886
+ };
709
887
  const visit = (node, inFunction) => {
710
888
  if (!node || typeof node !== "object") return;
711
889
  if (Array.isArray(node)) {
@@ -715,13 +893,20 @@ function analyzeClientBoundary(program, publicKeys) {
715
893
  const estree = node;
716
894
  if (typeof estree.type !== "string") return;
717
895
  if (!inFunction) {
718
- const builtin = readNodeBuiltinSource(estree);
719
- if (builtin !== void 0) builtinImports.add(builtin);
896
+ const builtin = readBuiltinSource(estree);
897
+ if (builtin !== void 0) add("builtin", builtin, estree);
720
898
  const key = readProcessEnvKey(estree);
721
899
  if (key !== void 0) {
722
- if (key !== "NODE_ENV") {
723
- (publicKeys.has(key) ? publicEnvKeys : envKeys).add(key);
900
+ addEnvKey(key, estree);
901
+ return;
902
+ }
903
+ if (estree.type === "VariableDeclarator" && isProcessEnv(estree.init) && _optionalChain([estree, 'access', _30 => _30.id, 'optionalAccess', _31 => _31.type]) === "ObjectPattern") {
904
+ for (const property of _nullishCoalesce(estree.id.properties, () => ( []))) {
905
+ if (property.type !== "Property") continue;
906
+ const name = readPropertyKey(property);
907
+ if (name !== void 0) addEnvKey(name, property);
724
908
  }
909
+ visit(estree.id.properties, inFunction);
725
910
  return;
726
911
  }
727
912
  }
@@ -732,31 +917,26 @@ function analyzeClientBoundary(program, publicKeys) {
732
917
  }
733
918
  };
734
919
  visit(program.body, false);
735
- return {
736
- envKeys: [...envKeys],
737
- publicEnvKeys: [...publicEnvKeys],
738
- builtinImports: [...builtinImports]
739
- };
920
+ return findings;
740
921
  }
741
- function readNodeBuiltinSource(node) {
922
+ function readBuiltinSource(node) {
923
+ let value;
742
924
  if (node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ImportExpression") {
743
- const value = _optionalChain([node, 'access', _30 => _30.source, 'optionalAccess', _31 => _31.value]);
744
- return typeof value === "string" && value.startsWith("node:") ? value : void 0;
745
- }
746
- if (node.type === "CallExpression") {
925
+ value = _optionalChain([node, 'access', _32 => _32.source, 'optionalAccess', _33 => _33.value]);
926
+ } else if (node.type === "CallExpression") {
747
927
  const callee = node.callee;
748
- if (_optionalChain([callee, 'optionalAccess', _32 => _32.type]) === "Identifier" && callee.name === "require") {
749
- const arg = _optionalChain([node, 'access', _33 => _33.arguments, 'optionalAccess', _34 => _34[0]]);
750
- const value = _optionalChain([arg, 'optionalAccess', _35 => _35.type]) === "Literal" ? arg.value : void 0;
751
- return typeof value === "string" && value.startsWith("node:") ? value : void 0;
928
+ if (_optionalChain([callee, 'optionalAccess', _34 => _34.type]) === "Identifier" && callee.name === "require") {
929
+ const arg = _optionalChain([node, 'access', _35 => _35.arguments, 'optionalAccess', _36 => _36[0]]);
930
+ value = _optionalChain([arg, 'optionalAccess', _37 => _37.type]) === "Literal" ? arg.value : void 0;
752
931
  }
753
932
  }
754
- return void 0;
933
+ return typeof value === "string" && _module.isBuiltin.call(void 0, value) ? value : void 0;
934
+ }
935
+ function isProcessEnv(node) {
936
+ return _optionalChain([node, 'optionalAccess', _38 => _38.type]) === "MemberExpression" && !node.computed && _optionalChain([node, 'access', _39 => _39.object, 'optionalAccess', _40 => _40.type]) === "Identifier" && node.object.name === "process" && _optionalChain([node, 'access', _41 => _41.property, 'optionalAccess', _42 => _42.name]) === "env";
755
937
  }
756
938
  function readProcessEnvKey(node) {
757
- if (node.type !== "MemberExpression") return void 0;
758
- const object = node.object;
759
- if (!object || object.type !== "MemberExpression" || _optionalChain([object, 'access', _36 => _36.object, 'optionalAccess', _37 => _37.type]) !== "Identifier" || object.object.name !== "process" || _optionalChain([object, 'access', _38 => _38.property, 'optionalAccess', _39 => _39.name]) !== "env") {
939
+ if (node.type !== "MemberExpression" || !isProcessEnv(node.object)) {
760
940
  return void 0;
761
941
  }
762
942
  const property = node.property;
@@ -770,25 +950,36 @@ function readProcessEnvKey(node) {
770
950
  }
771
951
  return void 0;
772
952
  }
773
- function formatClientBoundaryWarning(id, findings) {
774
- const { envKeys, publicEnvKeys, builtinImports } = findings;
775
- const lines = [`${id} is compiled for the client but uses server-only APIs:`];
776
- if (envKeys.length > 0) {
777
- lines.push(
778
- `- 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.`
779
- );
780
- }
781
- if (publicEnvKeys.length > 0) {
782
- lines.push(
783
- `- 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".`
784
- );
785
- }
786
- if (builtinImports.length > 0) {
787
- lines.push(
788
- `- 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.`
789
- );
953
+ function readPropertyKey(property) {
954
+ const key = property.key;
955
+ if (!property.computed && _optionalChain([key, 'optionalAccess', _43 => _43.type]) === "Identifier") return key.name;
956
+ const value = _optionalChain([key, 'optionalAccess', _44 => _44.type]) === "Literal" ? key.value : void 0;
957
+ return typeof value === "string" ? value : void 0;
958
+ }
959
+ function createClientBoundaryDiagnostic(file, finding, location) {
960
+ switch (finding.kind) {
961
+ case "server-env":
962
+ return _chunkJNZDTE75cjs.createFarmDiagnostic.call(void 0,
963
+ "CLIENT_SERVER_ENV",
964
+ file,
965
+ `process.env.${finding.name} is read at module scope in a module compiled for the browser, where it is undefined.`,
966
+ location
967
+ );
968
+ case "public-env":
969
+ return _chunkJNZDTE75cjs.createFarmDiagnostic.call(void 0,
970
+ "CLIENT_PROCESS_ENV_PUBLIC",
971
+ file,
972
+ `process.env.${finding.name} is declared public, but process.env is not populated in the browser, so this module-scope read is undefined there.`,
973
+ location
974
+ );
975
+ case "builtin":
976
+ return _chunkJNZDTE75cjs.createFarmDiagnostic.call(void 0,
977
+ "CLIENT_NODE_BUILTIN",
978
+ file,
979
+ `"${finding.name}" is imported into a module compiled for the browser, which gets a stub whose exports without a Web API equivalent are undefined.`,
980
+ location
981
+ );
790
982
  }
791
- return lines.join("\n");
792
983
  }
793
984
 
794
985
  // src/image-vite.ts
@@ -819,7 +1010,7 @@ function farmImageImportsPlugin() {
819
1010
  async transform(code, id) {
820
1011
  const filePath = id.split("?", 1)[0];
821
1012
  if (id.includes("?") || !STATIC_IMAGE_RE.test(filePath)) return null;
822
- const defaultExport = _optionalChain([code, 'access', _40 => _40.match, 'call', _41 => _41(/^\s*export\s+default\s+(.+?);?\s*$/s), 'optionalAccess', _42 => _42[1]]);
1013
+ const defaultExport = _optionalChain([code, 'access', _45 => _45.match, 'call', _46 => _46(/^\s*export\s+default\s+(.+?);?\s*$/s), 'optionalAccess', _47 => _47[1]]);
823
1014
  if (!defaultExport) return null;
824
1015
  return createStaticImageModule(filePath, `const src = ${defaultExport};`);
825
1016
  }
@@ -917,7 +1108,7 @@ function rewriteFarmReactCacheImport(code, file, cacheModule = FARM_REACT_CACHE_
917
1108
  }
918
1109
  const edits = [];
919
1110
  const declarations = (_nullishCoalesce(program.body, () => ( []))).filter(
920
- (node) => node.type === "ImportDeclaration" && _optionalChain([node, 'access', _43 => _43.source, 'optionalAccess', _44 => _44.value]) === "react" && node.importKind !== "type"
1111
+ (node) => node.type === "ImportDeclaration" && _optionalChain([node, 'access', _48 => _48.source, 'optionalAccess', _49 => _49.value]) === "react" && node.importKind !== "type"
921
1112
  );
922
1113
  const namespaces = /* @__PURE__ */ new Set();
923
1114
  let memberImportAt = null;
@@ -932,7 +1123,7 @@ function rewriteFarmReactCacheImport(code, file, cacheModule = FARM_REACT_CACHE_
932
1123
  const caches = specifiers.filter(
933
1124
  (specifier) => specifier.type === "ImportSpecifier" && specifier.importKind !== "type" && Object.prototype.hasOwnProperty.call(
934
1125
  REACT_CACHE_APIS,
935
- _nullishCoalesce(_nullishCoalesce(_optionalChain([specifier, 'access', _45 => _45.imported, 'optionalAccess', _46 => _46.name]), () => ( _optionalChain([specifier, 'access', _47 => _47.imported, 'optionalAccess', _48 => _48.value]))), () => ( ""))
1126
+ _nullishCoalesce(_nullishCoalesce(_optionalChain([specifier, 'access', _50 => _50.imported, 'optionalAccess', _51 => _51.name]), () => ( _optionalChain([specifier, 'access', _52 => _52.imported, 'optionalAccess', _53 => _53.value]))), () => ( ""))
936
1127
  )
937
1128
  );
938
1129
  if (caches.length === 0) continue;
@@ -946,7 +1137,7 @@ function rewriteFarmReactCacheImport(code, file, cacheModule = FARM_REACT_CACHE_
946
1137
  ].join(", ");
947
1138
  const lines = [
948
1139
  ...clause ? [`import ${clause} from "react";`] : [],
949
- `import { ${caches.map((specifier) => `${_nullishCoalesce(_optionalChain([specifier, 'access', _49 => _49.imported, 'optionalAccess', _50 => _50.name]), () => ( _optionalChain([specifier, 'access', _51 => _51.imported, 'optionalAccess', _52 => _52.value])))} as ${specifier.local.name}`).join(", ")} } from ${JSON.stringify(cacheModule)};`
1140
+ `import { ${caches.map((specifier) => `${_nullishCoalesce(_optionalChain([specifier, 'access', _54 => _54.imported, 'optionalAccess', _55 => _55.name]), () => ( _optionalChain([specifier, 'access', _56 => _56.imported, 'optionalAccess', _57 => _57.value])))} as ${specifier.local.name}`).join(", ")} } from ${JSON.stringify(cacheModule)};`
950
1141
  ];
951
1142
  edits.push({ start: node.start, end: node.end, text: lines.join("\n") });
952
1143
  }
@@ -961,7 +1152,7 @@ function rewriteFarmReactCacheImport(code, file, cacheModule = FARM_REACT_CACHE_
961
1152
  const current = node;
962
1153
  if (typeof current.type !== "string") return;
963
1154
  if (current.type === "ImportDeclaration") return;
964
- if (current.type === "MemberExpression" && !current.computed && _optionalChain([current, 'access', _53 => _53.object, 'optionalAccess', _54 => _54.type]) === "Identifier" && namespaces.has(current.object.name) && Object.prototype.hasOwnProperty.call(REACT_CACHE_APIS, _nullishCoalesce(_optionalChain([current, 'access', _55 => _55.property, 'optionalAccess', _56 => _56.name]), () => ( "")))) {
1155
+ if (current.type === "MemberExpression" && !current.computed && _optionalChain([current, 'access', _58 => _58.object, 'optionalAccess', _59 => _59.type]) === "Identifier" && namespaces.has(current.object.name) && Object.prototype.hasOwnProperty.call(REACT_CACHE_APIS, _nullishCoalesce(_optionalChain([current, 'access', _60 => _60.property, 'optionalAccess', _61 => _61.name]), () => ( "")))) {
965
1156
  const name = current.property.name;
966
1157
  edits.push({ start: current.start, end: current.end, text: REACT_CACHE_APIS[name] });
967
1158
  used.add(name);
@@ -1021,7 +1212,7 @@ function resolveFarmPageDataFailure(error) {
1021
1212
  }
1022
1213
 
1023
1214
  // src/openapi/dev-status.ts
1024
- function reportOpenAPIDevGenerationResult(spec, output = _chunkQMNWKQL4cjs.logger) {
1215
+ function reportOpenAPIDevGenerationResult(spec, output = _chunkGC5ROI3Acjs.logger) {
1025
1216
  if (spec) {
1026
1217
  output.success("\u2705 OpenAPI documentation enabled");
1027
1218
  return;
@@ -1032,13 +1223,13 @@ function reportOpenAPIDevGenerationResult(spec, output = _chunkQMNWKQL4cjs.logge
1032
1223
  // src/vite.ts
1033
1224
  var SERVER_FN_TRANSFORM_PLUGIN = "@farm.js/plugin/rsc:server-fn-actions";
1034
1225
  function farmLlmsTxtGeneratedPaths(config) {
1035
- const llms = _chunk5PDMBWAFcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([config, 'access', _57 => _57.agent, 'optionalAccess', _58 => _58.llmsTxt]));
1226
+ const llms = _chunkWRWJ7IWTcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([config, 'access', _62 => _62.agent, 'optionalAccess', _63 => _63.llmsTxt]));
1036
1227
  if (!llms.enabled) return [];
1037
1228
  return llms.full ? ["/llms.txt", "/llms-full.txt"] : ["/llms.txt"];
1038
1229
  }
1039
1230
  function farmAgentGeneratedPaths(config) {
1040
- const crawlers = _chunkODBM54RTcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([config, 'access', _59 => _59.agent, 'optionalAccess', _60 => _60.crawlers]));
1041
- const sitemap = _chunkODBM54RTcjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([config, 'access', _61 => _61.agent, 'optionalAccess', _62 => _62.sitemap]));
1231
+ const crawlers = _chunkF4ID7BGOcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([config, 'access', _64 => _64.agent, 'optionalAccess', _65 => _65.crawlers]));
1232
+ const sitemap = _chunkF4ID7BGOcjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([config, 'access', _66 => _66.agent, 'optionalAccess', _67 => _67.sitemap]));
1042
1233
  return [
1043
1234
  ...farmLlmsTxtGeneratedPaths(config),
1044
1235
  ...sitemap.enabled ? ["/sitemap.xml"] : [],
@@ -1077,13 +1268,13 @@ function loadFarmDocsSearchDevRuntime() {
1077
1268
  return import("./search-client-ZZLKVO5R.cjs");
1078
1269
  }
1079
1270
  function loadFarmOpenAPIDevRuntime() {
1080
- return import("./manager-JOHU6BQI.cjs");
1271
+ return import("./manager-R7FV4A56.cjs");
1081
1272
  }
1082
1273
  function loadFarmWorkflowsDevRuntime() {
1083
1274
  return import("./workflows.cjs");
1084
1275
  }
1085
1276
  function loadFarmDevtoolsSnapshotRuntime() {
1086
- return import("./devtools-6K4QXFRL.cjs");
1277
+ return import("./devtools-T5I2WHRX.cjs");
1087
1278
  }
1088
1279
  function loadFarmDevtoolsUIRuntime() {
1089
1280
  return import("./devtools-ui-SYRUXUA7.cjs");
@@ -1096,7 +1287,7 @@ function farmI18nClientBridgePlugin() {
1096
1287
  name: "farm:i18n-client-bridge",
1097
1288
  enforce: "pre",
1098
1289
  resolveId(id, _importer, options) {
1099
- if (id === "@farm.js/core/i18n/server" && !_optionalChain([options, 'optionalAccess', _63 => _63.ssr])) {
1290
+ if (id === "@farm.js/core/i18n/server" && !_optionalChain([options, 'optionalAccess', _68 => _68.ssr])) {
1100
1291
  return FARM_I18N_CLIENT_BRIDGE_ID;
1101
1292
  }
1102
1293
  return null;
@@ -1114,16 +1305,16 @@ var FARM_SERVER_ONLY_PACKAGE_ID = "\0farm:server-only";
1114
1305
  var FARM_PLATFORM_ENTRY = "@farm.js/core/platform";
1115
1306
  var FARM_PLATFORM_CLIENT_ID = "\0farm:platform-client";
1116
1307
  var FARM_SERVER_ONLY_ENTRIES_RESOLVE_FILTER = [
1117
- _chunkTAU3OF5Bcjs.exactIdPattern.call(void 0, [FARM_PLATFORM_ENTRY, SERVER_ONLY_PACKAGE, ...FARM_SERVER_ONLY_ENTRIES]),
1118
- new RegExp(`^${_chunkHTXKSREFcjs.FARM_RESOLVE_FROM_PREFIX}`),
1308
+ _chunkIK33N2ANcjs.exactIdPattern.call(void 0, [FARM_PLATFORM_ENTRY, SERVER_ONLY_PACKAGE, ...FARM_SERVER_ONLY_ENTRIES]),
1309
+ new RegExp(`^${_chunkJNZDTE75cjs.FARM_RESOLVE_FROM_PREFIX}`),
1119
1310
  // What isBuiltin() accepts: `node:` ids and the builtin names, subpaths such as fs/promises
1120
1311
  // included.
1121
1312
  /^node:/,
1122
- _chunkTAU3OF5Bcjs.exactIdPattern.call(void 0, _module.builtinModules)
1313
+ _chunkIK33N2ANcjs.exactIdPattern.call(void 0, _module.builtinModules)
1123
1314
  ];
1124
1315
  var FARM_SERVER_ONLY_ENTRIES_LOAD_FILTER = [
1125
- _chunkTAU3OF5Bcjs.exactIdPattern.call(void 0, [FARM_SERVER_ONLY_PACKAGE_ID, FARM_PLATFORM_CLIENT_ID]),
1126
- new RegExp(`^${_chunkHTXKSREFcjs.FARM_BROWSER_BUILTIN_PREFIX}`)
1316
+ _chunkIK33N2ANcjs.exactIdPattern.call(void 0, [FARM_SERVER_ONLY_PACKAGE_ID, FARM_PLATFORM_CLIENT_ID]),
1317
+ new RegExp(`^${_chunkJNZDTE75cjs.FARM_BROWSER_BUILTIN_PREFIX}`)
1127
1318
  ];
1128
1319
  function createFarmPlatformClientModule(platform) {
1129
1320
  return `export function platform() { return ${JSON.stringify(platform)}; }
@@ -1153,24 +1344,24 @@ function farmIslandContainersPlugin(config) {
1153
1344
  root = config.root || resolved.root;
1154
1345
  },
1155
1346
  transform(code, id) {
1156
- if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _64 => _64.experimental, 'optionalAccess', _65 => _65.serverComponents])) !== "islands") {
1347
+ if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _69 => _69.experimental, 'optionalAccess', _70 => _70.serverComponents])) !== "islands") {
1157
1348
  return null;
1158
1349
  }
1159
1350
  if (id.startsWith("\0") || id.includes("/node_modules/") || !/\.[jt]sx(?:$|\?)/.test(id)) {
1160
1351
  return null;
1161
1352
  }
1162
- if (_chunkHTXKSREFcjs.hasUseClientDirective.call(void 0, code)) return null;
1353
+ if (_chunkJNZDTE75cjs.hasUseClientDirective.call(void 0, code)) return null;
1163
1354
  const file = id.split("?", 1)[0];
1164
- const bindings = _chunkHTXKSREFcjs.getFarmClientRenderingBindings.call(void 0, code, file, root);
1355
+ const bindings = _chunkJNZDTE75cjs.getFarmClientRenderingBindings.call(void 0, code, file, root);
1165
1356
  if (bindings.length === 0) return null;
1166
- const grown = _chunkHTXKSREFcjs.wrapFarmIslandContainers.call(void 0, {
1357
+ const grown = _chunkJNZDTE75cjs.wrapFarmIslandContainers.call(void 0, {
1167
1358
  code,
1168
1359
  file,
1169
1360
  bindings,
1170
- reference: _chunkHTXKSREFcjs.farmIslandContainerReferencePath.call(void 0, root)
1361
+ reference: _chunkJNZDTE75cjs.farmIslandContainerReferencePath.call(void 0, root)
1171
1362
  });
1172
1363
  if (grown === null) return null;
1173
- _chunkHTXKSREFcjs.ensureFarmIslandContainerReference.call(void 0, root);
1364
+ _chunkJNZDTE75cjs.ensureFarmIslandContainerReference.call(void 0, root);
1174
1365
  return { code: grown, map: null };
1175
1366
  }
1176
1367
  };
@@ -1182,11 +1373,17 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1182
1373
  name: "farm:server-only-entries",
1183
1374
  enforce: "pre",
1184
1375
  config(config) {
1185
- const bundledPackages = _chunkHTXKSREFcjs.collectFarmServerBundledPackageInfo.call(void 0,
1186
- path6.resolve(_nullishCoalesce(config.root, () => ( process.cwd())))
1187
- );
1376
+ const appRoot = path6.resolve(_nullishCoalesce(config.root, () => ( process.cwd())));
1377
+ if (options.distDir) {
1378
+ _chunkJNZDTE75cjs.usePackageScanCacheFile.call(void 0,
1379
+ path6.resolve(appRoot, options.distDir, "cache", "package-scans.json")
1380
+ );
1381
+ }
1382
+ const bundledPackages = _chunkJNZDTE75cjs.collectFarmServerBundledPackageInfo.call(void 0, appRoot);
1383
+ const prebundle = options.prebundleServerPackages ? createFarmServerPrebundleConfig(bundledPackages) : {};
1384
+ _chunkJNZDTE75cjs.persistPackageScanCache.call(void 0, );
1188
1385
  return {
1189
- optimizeDeps: { rolldownOptions: { plugins: [_chunkHTXKSREFcjs.farmBrowserBuiltinsOptimizerPlugin.call(void 0, )] } },
1386
+ optimizeDeps: { rolldownOptions: { plugins: [_chunkJNZDTE75cjs.farmBrowserBuiltinsOptimizerPlugin.call(void 0, )] } },
1190
1387
  ssr: {
1191
1388
  noExternal: [
1192
1389
  // Resolve `server-only` here rather than in Node, which would load its throwing build.
@@ -1194,7 +1391,7 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1194
1391
  // Packages Node cannot load as a bundler does (stylesheet imports, `module`-only ESM).
1195
1392
  ...bundledPackages.map(({ name }) => name)
1196
1393
  ],
1197
- ...options.prebundleServerPackages ? createFarmServerPrebundleConfig(bundledPackages) : {}
1394
+ ...prebundle
1198
1395
  }
1199
1396
  };
1200
1397
  },
@@ -1204,19 +1401,26 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1204
1401
  resolveId: {
1205
1402
  filter: { id: FARM_SERVER_ONLY_ENTRIES_RESOLVE_FILTER },
1206
1403
  handler(id, importer, options2) {
1207
- if (id === FARM_PLATFORM_ENTRY) return _optionalChain([options2, 'optionalAccess', _66 => _66.ssr]) ? null : FARM_PLATFORM_CLIENT_ID;
1404
+ if (id === FARM_PLATFORM_ENTRY) return _optionalChain([options2, 'optionalAccess', _71 => _71.ssr]) ? null : FARM_PLATFORM_CLIENT_ID;
1208
1405
  if (id === SERVER_ONLY_PACKAGE) {
1209
- if (_optionalChain([options2, 'optionalAccess', _67 => _67.ssr]) || _optionalChain([options2, 'optionalAccess', _68 => _68.scan])) {
1406
+ if (_optionalChain([options2, 'optionalAccess', _72 => _72.ssr]) || _optionalChain([options2, 'optionalAccess', _73 => _73.scan])) {
1210
1407
  return FARM_SERVER_ONLY_PACKAGE_ID;
1211
1408
  }
1212
1409
  this.error(
1213
- `${_nullishCoalesce(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.`
1410
+ _chunkJNZDTE75cjs.formatFarmDiagnostic.call(void 0,
1411
+ _chunkJNZDTE75cjs.createFarmDiagnostic.call(void 0,
1412
+ "CLIENT_SERVER_ONLY_IMPORT",
1413
+ _nullishCoalesce(importer, () => ( "<unknown module>")),
1414
+ `${importer ? "This module" : "A module"} imports "server-only", so it must not reach the browser, but client code imports it.`
1415
+ ),
1416
+ root
1417
+ )
1214
1418
  );
1215
1419
  }
1216
- if (!_optionalChain([options2, 'optionalAccess', _69 => _69.ssr]) && _module.isBuiltin.call(void 0, id)) {
1217
- return _chunkHTXKSREFcjs.resolveFarmBrowserBuiltin.call(void 0, this, id, importer, options2);
1420
+ if (!_optionalChain([options2, 'optionalAccess', _74 => _74.ssr]) && _module.isBuiltin.call(void 0, id)) {
1421
+ return _chunkJNZDTE75cjs.resolveFarmBrowserBuiltin.call(void 0, this, id, importer, options2);
1218
1422
  }
1219
- const resolveFrom = importer ? _chunkHTXKSREFcjs.parseFarmResolveFrom.call(void 0, id, importer.split("?", 1)[0]) : null;
1423
+ const resolveFrom = importer ? _chunkJNZDTE75cjs.parseFarmResolveFrom.call(void 0, id, importer.split("?", 1)[0]) : null;
1220
1424
  if (resolveFrom) {
1221
1425
  const directory = path6.dirname(resolveFrom.importer);
1222
1426
  return this.resolve(resolveFrom.specifier, resolveFrom.importer, {
@@ -1231,9 +1435,16 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1231
1435
  }
1232
1436
  if (!FARM_SERVER_ONLY_ENTRIES.has(id)) return null;
1233
1437
  const importedBy = importer ? ` (imported by ${importer})` : "";
1234
- if (!_optionalChain([options2, 'optionalAccess', _70 => _70.ssr])) {
1438
+ if (!_optionalChain([options2, 'optionalAccess', _75 => _75.ssr])) {
1235
1439
  this.error(
1236
- `${id} is server-only and cannot be imported into client code${importedBy}. Use it from an API route or another server module.`
1440
+ _chunkJNZDTE75cjs.formatFarmDiagnostic.call(void 0,
1441
+ _chunkJNZDTE75cjs.createFarmDiagnostic.call(void 0,
1442
+ "CLIENT_SERVER_ONLY_ENTRY",
1443
+ _nullishCoalesce(importer, () => ( id)),
1444
+ `${id} is server-only and cannot be imported into client code.`
1445
+ ),
1446
+ root
1447
+ )
1237
1448
  );
1238
1449
  }
1239
1450
  vercelOgInstalled || (vercelOgInstalled = _chunkKORZ6PREcjs.isOptionalPeerInstalled.call(void 0, root, "@vercel/og"));
@@ -1252,7 +1463,7 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1252
1463
  if (id === FARM_PLATFORM_CLIENT_ID) {
1253
1464
  return createFarmPlatformClientModule(_nullishCoalesce(options.platform, () => ( _chunkAQLHD6HZcjs.resolveFarmPlatform.call(void 0, ))));
1254
1465
  }
1255
- return _nullishCoalesce(_chunkHTXKSREFcjs.loadFarmBrowserBuiltin.call(void 0, id), () => ( null));
1466
+ return _nullishCoalesce(_chunkJNZDTE75cjs.loadFarmBrowserBuiltin.call(void 0, id), () => ( null));
1256
1467
  }
1257
1468
  }
1258
1469
  };
@@ -1285,10 +1496,10 @@ function renderFarmI18nStaticHead(requestPath, snapshot) {
1285
1496
  if (!snapshot) return "";
1286
1497
  const runtime = `<script>window.__FARM_I18N__ = ${serializeFarmInlineValue(snapshot)};</script>`;
1287
1498
  if (snapshot.routing === "none") return runtime;
1288
- return `${_chunkPXAHSCR6cjs.renderFarmLocaleAlternateLinks.call(void 0, requestPath, snapshot)}${runtime}`;
1499
+ return `${_chunkXGDI4OUBcjs.renderFarmLocaleAlternateLinks.call(void 0, requestPath, snapshot)}${runtime}`;
1289
1500
  }
1290
1501
  function getPublicEnvDefine(config) {
1291
- const publicEnv = _optionalChain([config, 'access', _71 => _71.env, 'optionalAccess', _72 => _72.public]);
1502
+ const publicEnv = _optionalChain([config, 'access', _76 => _76.env, 'optionalAccess', _77 => _77.public]);
1292
1503
  if (!isResolvedEnvScope(publicEnv)) {
1293
1504
  return {};
1294
1505
  }
@@ -1309,7 +1520,7 @@ function createRequestFromNodeRequest(req, url, signal) {
1309
1520
  signal
1310
1521
  });
1311
1522
  }
1312
- function withFarmRequestTracing(handler, apiRuntime, resolveTraceUrl = (request) => _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, request)) {
1523
+ function withFarmRequestTracing(handler, apiRuntime, resolveTraceUrl = (request) => _chunk2RSVYJT6cjs.resolveFarmRequestURL.call(void 0, request)) {
1313
1524
  const middleware = _chunkP2355C6Ecjs._withAfterNodeMiddleware.call(void 0, handler);
1314
1525
  return (req, res, next) => {
1315
1526
  const traceUrl = resolveTraceUrl(req);
@@ -1327,12 +1538,12 @@ function withFarmRequestTracing(handler, apiRuntime, resolveTraceUrl = (request)
1327
1538
  return;
1328
1539
  }
1329
1540
  if (res.headersSent) {
1330
- _optionalChain([res, 'access', _73 => _73.destroy, 'optionalCall', _74 => _74(error instanceof Error ? error : new Error(String(error)))]);
1541
+ _optionalChain([res, 'access', _78 => _78.destroy, 'optionalCall', _79 => _79(error instanceof Error ? error : new Error(String(error)))]);
1331
1542
  return;
1332
1543
  }
1333
1544
  res.statusCode = 500;
1334
1545
  res.setHeader("Content-Type", "application/json");
1335
- res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
1546
+ res.end(_chunk4VLXQ55Ocjs.FARM_INTERNAL_SERVER_ERROR_BODY);
1336
1547
  });
1337
1548
  };
1338
1549
  }
@@ -1340,10 +1551,10 @@ function sendFarmDevErrorJSON(res) {
1340
1551
  res.statusCode = 500;
1341
1552
  res.setHeader("Content-Type", "application/json");
1342
1553
  res.setHeader("Cache-Control", "private, no-store");
1343
- res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
1554
+ res.end(_chunk4VLXQ55Ocjs.FARM_INTERNAL_SERVER_ERROR_BODY);
1344
1555
  }
1345
1556
  function createFarmDevMiddlewareErrorResponse() {
1346
- return new Response(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY, {
1557
+ return new Response(_chunk4VLXQ55Ocjs.FARM_INTERNAL_SERVER_ERROR_BODY, {
1347
1558
  status: 500,
1348
1559
  headers: { "Content-Type": "application/json", "Cache-Control": "private, no-store" }
1349
1560
  });
@@ -1355,15 +1566,15 @@ function setFarmDevRuntimeHookErrorHead(res, json) {
1355
1566
  }
1356
1567
  function sendFarmDevRuntimeHookError(res, json) {
1357
1568
  setFarmDevRuntimeHookErrorHead(res, json);
1358
- res.end(json ? _chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY : "Internal Server Error");
1569
+ res.end(json ? _chunk4VLXQ55Ocjs.FARM_INTERNAL_SERVER_ERROR_BODY : "Internal Server Error");
1359
1570
  }
1360
1571
  function opensFarmDevRuntimeSession(pm) {
1361
- return pm.hasRuntimeRequestHooks() || _chunkDMXMIE2Ccjs.hasFarmServerRuntimePlugins.call(void 0, pm.getPlugins());
1572
+ return pm.hasRuntimeRequestHooks() || _chunkHVJ7IACBcjs.hasFarmServerRuntimePlugins.call(void 0, pm.getPlugins());
1362
1573
  }
1363
1574
  var FARM_CONFIG_ROUTE_PLUGIN_NAMES = /* @__PURE__ */ new Set([
1364
- _chunkMBCRWU3Pcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME,
1365
- _chunkMBCRWU3Pcjs.FARM_CONFIG_REDIRECTS_PLUGIN_NAME,
1366
- _chunkMBCRWU3Pcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME
1575
+ _chunkH7OFZJCVcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME,
1576
+ _chunkH7OFZJCVcjs.FARM_CONFIG_REDIRECTS_PLUGIN_NAME,
1577
+ _chunkH7OFZJCVcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME
1367
1578
  ]);
1368
1579
  function isFarmConfigRoutePlugin(plugin) {
1369
1580
  return FARM_CONFIG_ROUTE_PLUGIN_NAMES.has(plugin.name);
@@ -1374,7 +1585,7 @@ async function proxyFarmExternalRewrite(req, res, bodySizeLimit) {
1374
1585
  if (!destination || !/^https?:\/\//i.test(destination)) return false;
1375
1586
  let request = createRequestFromNodeRequest(req, new URL(destination));
1376
1587
  if (request.method !== "GET" && request.method !== "HEAD") {
1377
- const body = await _chunkCFG4QERRcjs.readNodeRequestBody.call(void 0, req, bodySizeLimit);
1588
+ const body = await _chunk7Q7UB4TLcjs.readNodeRequestBody.call(void 0, req, bodySizeLimit);
1378
1589
  request = new Request(request, { method: request.method, body: toRequestBody(body) });
1379
1590
  }
1380
1591
  await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, await _chunkJRGR5Z4Kcjs.fetchFarmExternalRewrite.call(void 0, request));
@@ -1463,7 +1674,7 @@ function interceptFarmDevPageResponse(options) {
1463
1674
  const originalWrite = res.write.bind(res);
1464
1675
  const originalEnd = res.end.bind(res);
1465
1676
  const originalWriteHead = res.writeHead.bind(res);
1466
- const originalFlushHeaders = _optionalChain([res, 'access', _75 => _75.flushHeaders, 'optionalAccess', _76 => _76.bind, 'call', _77 => _77(res)]);
1677
+ const originalFlushHeaders = _optionalChain([res, 'access', _80 => _80.flushHeaders, 'optionalAccess', _81 => _81.bind, 'call', _82 => _82(res)]);
1467
1678
  let afterResponseCalled = false;
1468
1679
  let interceptedEnd = false;
1469
1680
  const restore = () => {
@@ -1485,7 +1696,7 @@ function interceptFarmDevPageResponse(options) {
1485
1696
  const writeRuntimeHookFailure = () => {
1486
1697
  setFarmDevRuntimeHookErrorHead(res, Boolean(options.jsonError));
1487
1698
  originalWriteHead(500);
1488
- originalWrite(options.jsonError ? _chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY : "Internal Server Error");
1699
+ originalWrite(options.jsonError ? _chunk4VLXQ55Ocjs.FARM_INTERNAL_SERVER_ERROR_BODY : "Internal Server Error");
1489
1700
  };
1490
1701
  const htmlChunks = [];
1491
1702
  const responseChunks = [];
@@ -1525,7 +1736,7 @@ function interceptFarmDevPageResponse(options) {
1525
1736
  ).then(async (runtimeResponse) => {
1526
1737
  applyWebResponseToNodeResponse(runtimeResponse, res);
1527
1738
  if (!res.headersSent) originalWriteHead(res.statusCode);
1528
- _optionalChain([originalFlushHeaders, 'optionalCall', _78 => _78()]);
1739
+ _optionalChain([originalFlushHeaders, 'optionalCall', _83 => _83()]);
1529
1740
  if (!runtimeResponse.body) return;
1530
1741
  const reader = runtimeResponse.body.getReader();
1531
1742
  for (; ; ) {
@@ -1574,7 +1785,7 @@ function interceptFarmDevPageResponse(options) {
1574
1785
  if (streamsThroughRuntime()) {
1575
1786
  streamRuntimeChunk(bufferChunk);
1576
1787
  const callback = args.find((arg) => typeof arg === "function");
1577
- _optionalChain([callback, 'optionalCall', _79 => _79()]);
1788
+ _optionalChain([callback, 'optionalCall', _84 => _84()]);
1578
1789
  return true;
1579
1790
  }
1580
1791
  if (isHtmlResponse && bufferChunk) {
@@ -1586,7 +1797,7 @@ function interceptFarmDevPageResponse(options) {
1586
1797
  const shouldBufferResponse = isHtmlResponse ? bufferPluginResponse : Boolean(runtimeSession && hasRuntimeAfterHook);
1587
1798
  if (shouldBufferResponse) {
1588
1799
  const callback = args.find((arg) => typeof arg === "function");
1589
- _optionalChain([callback, 'optionalCall', _80 => _80()]);
1800
+ _optionalChain([callback, 'optionalCall', _85 => _85()]);
1590
1801
  return true;
1591
1802
  }
1592
1803
  const writeResult = originalWrite(chunk, ...args);
@@ -1738,13 +1949,13 @@ function getEnvDefines(config, configEnv) {
1738
1949
  )
1739
1950
  )
1740
1951
  };
1741
- if (_optionalChain([configEnv, 'optionalAccess', _81 => _81.isSsrBuild])) {
1952
+ if (_optionalChain([configEnv, 'optionalAccess', _86 => _86.isSsrBuild])) {
1742
1953
  defines.__FARM_ENV__ = JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, getFullEnvDefine(config)));
1743
1954
  }
1744
1955
  return defines;
1745
1956
  }
1746
1957
  function getFarmAPIBaseURLDefine(config) {
1747
- const baseURL = _optionalChain([config, 'access', _82 => _82.api, 'optionalAccess', _83 => _83.baseURL]);
1958
+ const baseURL = _optionalChain([config, 'access', _87 => _87.api, 'optionalAccess', _88 => _88.baseURL]);
1748
1959
  return typeof baseURL === "string" && baseURL ? baseURL : _chunkPMJSG4JScjs.DEFAULT_FARM_API_BASE_PATH;
1749
1960
  }
1750
1961
  function isResolvedEnvScope(value) {
@@ -1763,7 +1974,7 @@ function fileContainsProgrammaticPageRoute(file) {
1763
1974
  return false;
1764
1975
  }
1765
1976
  try {
1766
- return _chunkE7QOEV5Zcjs.scanProgrammaticPagePaths.call(void 0, fs2.readFileSync(file, "utf8")).length > 0;
1977
+ return _chunkYUCU6XB4cjs.scanProgrammaticPagePaths.call(void 0, fs2.readFileSync(file, "utf8")).length > 0;
1767
1978
  } catch (e15) {
1768
1979
  return false;
1769
1980
  }
@@ -1823,8 +2034,8 @@ function rewriteEarlySsrRelativeImports(options) {
1823
2034
  const sourcePath = suffixIndex === -1 ? source.value : source.value.slice(0, suffixIndex);
1824
2035
  const suffix = suffixIndex === -1 ? "" : source.value.slice(suffixIndex);
1825
2036
  const resolvedPath = path6.resolve(path6.dirname(cleanId), sourcePath);
1826
- const moduleId = _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, resolvedPath, options.root);
1827
- const specifier = moduleId.startsWith("/@fs/") ? _chunkQMNWKQL4cjs.toPosixPath.call(void 0, resolvedPath) : moduleId;
2037
+ const moduleId = _chunkGC5ROI3Acjs.toViteModuleId.call(void 0, resolvedPath, options.root);
2038
+ const specifier = moduleId.startsWith("/@fs/") ? _chunkGC5ROI3Acjs.toPosixPath.call(void 0, resolvedPath) : moduleId;
1828
2039
  replacements.push({
1829
2040
  start: source.start,
1830
2041
  end: source.end,
@@ -1866,7 +2077,7 @@ function transformIsolatedClientBoundaryModule(options) {
1866
2077
  return null;
1867
2078
  }
1868
2079
  const body = Array.isArray(ast.body) ? ast.body : [];
1869
- const everyExportIsComponent = options.code.includes(_chunkHTXKSREFcjs.FARM_CLIENT_REFERENCE_PRAGMA) || options.moduleReference.includes(_chunkHTXKSREFcjs.FARM_CLIENT_REFERENCE_DIRECTORY);
2080
+ const everyExportIsComponent = options.code.includes(_chunkJNZDTE75cjs.FARM_CLIENT_REFERENCE_PRAGMA) || options.moduleReference.includes(_chunkJNZDTE75cjs.FARM_CLIENT_REFERENCE_DIRECTORY);
1870
2081
  const replacements = [];
1871
2082
  const wrapperStatements = [];
1872
2083
  const originalEntries = [];
@@ -1885,9 +2096,9 @@ function transformIsolatedClientBoundaryModule(options) {
1885
2096
  transformedExports++;
1886
2097
  };
1887
2098
  for (const node of body) {
1888
- if (_optionalChain([node, 'optionalAccess', _84 => _84.type]) === "ExportDefaultDeclaration" && node.declaration) {
2099
+ if (_optionalChain([node, 'optionalAccess', _89 => _89.type]) === "ExportDefaultDeclaration" && node.declaration) {
1889
2100
  const declaration2 = node.declaration;
1890
- if ((declaration2.type === "FunctionDeclaration" || declaration2.type === "ClassDeclaration") && _optionalChain([declaration2, 'access', _85 => _85.id, 'optionalAccess', _86 => _86.name])) {
2101
+ if ((declaration2.type === "FunctionDeclaration" || declaration2.type === "ClassDeclaration") && _optionalChain([declaration2, 'access', _90 => _90.id, 'optionalAccess', _91 => _91.name])) {
1891
2102
  replacements.push({
1892
2103
  start: node.start,
1893
2104
  end: node.end,
@@ -1905,11 +2116,11 @@ function transformIsolatedClientBoundaryModule(options) {
1905
2116
  }
1906
2117
  continue;
1907
2118
  }
1908
- if (_optionalChain([node, 'optionalAccess', _87 => _87.type]) === "ExportNamedDeclaration" && !node.declaration && node.exportKind !== "type") {
2119
+ if (_optionalChain([node, 'optionalAccess', _92 => _92.type]) === "ExportNamedDeclaration" && !node.declaration && node.exportKind !== "type") {
1909
2120
  const specifiers = (node.specifiers || []).filter(
1910
2121
  (specifier) => specifier.type === "ExportSpecifier" && specifier.exportKind !== "type"
1911
2122
  );
1912
- const specifierName = (name) => _nullishCoalesce(_optionalChain([name, 'optionalAccess', _88 => _88.name]), () => ( String(_nullishCoalesce(_optionalChain([name, 'optionalAccess', _89 => _89.value]), () => ( "")))));
2123
+ const specifierName = (name) => _nullishCoalesce(_optionalChain([name, 'optionalAccess', _93 => _93.name]), () => ( String(_nullishCoalesce(_optionalChain([name, 'optionalAccess', _94 => _94.value]), () => ( "")))));
1913
2124
  const isComponentExport = (specifier) => {
1914
2125
  const exported = specifierName(specifier.exported);
1915
2126
  return everyExportIsComponent || exported === "default" || /^[A-Z]/.test(exported);
@@ -1936,14 +2147,14 @@ function transformIsolatedClientBoundaryModule(options) {
1936
2147
  if (kept.length > 0) wrapperStatements.push(`export { ${kept.join(", ")} };`);
1937
2148
  continue;
1938
2149
  }
1939
- if (_optionalChain([node, 'optionalAccess', _90 => _90.type]) !== "ExportNamedDeclaration" || !node.declaration) continue;
2150
+ if (_optionalChain([node, 'optionalAccess', _95 => _95.type]) !== "ExportNamedDeclaration" || !node.declaration) continue;
1940
2151
  const declaration = node.declaration;
1941
2152
  const declaredNames = [];
1942
- if ((declaration.type === "FunctionDeclaration" || declaration.type === "ClassDeclaration") && _optionalChain([declaration, 'access', _91 => _91.id, 'optionalAccess', _92 => _92.name])) {
2153
+ if ((declaration.type === "FunctionDeclaration" || declaration.type === "ClassDeclaration") && _optionalChain([declaration, 'access', _96 => _96.id, 'optionalAccess', _97 => _97.name])) {
1943
2154
  declaredNames.push(declaration.id.name);
1944
2155
  } else if (declaration.type === "VariableDeclaration") {
1945
2156
  for (const declarator of declaration.declarations || []) {
1946
- if (_optionalChain([declarator, 'access', _93 => _93.id, 'optionalAccess', _94 => _94.type]) === "Identifier") declaredNames.push(declarator.id.name);
2157
+ if (_optionalChain([declarator, 'access', _98 => _98.id, 'optionalAccess', _99 => _99.type]) === "Identifier") declaredNames.push(declarator.id.name);
1947
2158
  }
1948
2159
  }
1949
2160
  const componentNames = declaredNames.filter((name) => /^[A-Z]/.test(name));
@@ -2004,7 +2215,7 @@ function isFarmConfigFile(file, root) {
2004
2215
  return FARM_CONFIG_FILENAMES.has(relative4);
2005
2216
  }
2006
2217
  var warnedClientBoundaryIds = /* @__PURE__ */ new Set();
2007
- function warnClientBoundaryOnce(context, id, code, config) {
2218
+ async function warnClientBoundaryOnce(context, id, code, config) {
2008
2219
  if (warnedClientBoundaryIds.has(id)) return;
2009
2220
  let program;
2010
2221
  try {
@@ -2012,13 +2223,26 @@ function warnClientBoundaryOnce(context, id, code, config) {
2012
2223
  } catch (e20) {
2013
2224
  return;
2014
2225
  }
2015
- const publicKeys = new Set(Object.keys(_nullishCoalesce(_optionalChain([config, 'access', _95 => _95.env, 'optionalAccess', _96 => _96.public]), () => ( {}))));
2016
- const findings = analyzeClientBoundary(program, publicKeys);
2017
- if (findings.envKeys.length === 0 && findings.publicEnvKeys.length === 0 && findings.builtinImports.length === 0) {
2018
- return;
2226
+ const publicKeys = new Set(Object.keys(_nullishCoalesce(_optionalChain([config, 'access', _100 => _100.env, 'optionalAccess', _101 => _101.public]), () => ( {}))));
2227
+ const findings = [];
2228
+ for (const finding of analyzeClientBoundary(program, publicKeys)) {
2229
+ if (finding.kind === "builtin" && !finding.name.startsWith("node:")) {
2230
+ const resolved = await context.resolve(finding.name, id).catch(() => null);
2231
+ if (!_optionalChain([resolved, 'optionalAccess', _102 => _102.id, 'access', _103 => _103.startsWith, 'call', _104 => _104(_chunkJNZDTE75cjs.FARM_BROWSER_BUILTIN_PREFIX)])) continue;
2232
+ }
2233
+ findings.push(finding);
2019
2234
  }
2235
+ if (findings.length === 0) return;
2020
2236
  warnedClientBoundaryIds.add(id);
2021
- _chunkQMNWKQL4cjs.logger.warn(formatClientBoundaryWarning(id, findings));
2237
+ const locate = _chunkJNZDTE75cjs.createFarmSourceLocator.call(void 0, code, () => context.getCombinedSourcemap());
2238
+ _chunkGC5ROI3Acjs.logger.warn(
2239
+ findings.map(
2240
+ (finding) => _chunkJNZDTE75cjs.formatFarmDiagnostic.call(void 0,
2241
+ createClientBoundaryDiagnostic(id, finding, locate(finding.start)),
2242
+ config.root
2243
+ )
2244
+ ).join("\n")
2245
+ );
2022
2246
  }
2023
2247
  function shouldEmitFarmClientRootHmr(renderer) {
2024
2248
  return _chunk67MZTLTFcjs.getFarmRendererCapabilities.call(void 0, _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, renderer)).reconcilesRerenders;
@@ -2054,21 +2278,21 @@ function hasFarmSourceAliasOverride(alias) {
2054
2278
  function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2055
2279
  const rendererDisabled = _chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, options.renderer);
2056
2280
  const imageImports = farmImageImportsPlugin();
2057
- const fontImports = _chunkTAU3OF5Bcjs.farmFontImportsPlugin.call(void 0, {
2281
+ const fontImports = _chunkIK33N2ANcjs.farmFontImportsPlugin.call(void 0, {
2058
2282
  root: options.root,
2059
2283
  basePath: options.basePath,
2060
2284
  publicDir: options.publicDir
2061
2285
  });
2062
2286
  let farmApp;
2063
2287
  const isFarmGeneratedOutput = (file) => {
2064
- const root = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _97 => _97.getConfig, 'call', _98 => _98(), 'access', _99 => _99.root]), () => ( options.root));
2288
+ const root = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _105 => _105.getConfig, 'call', _106 => _106(), 'access', _107 => _107.root]), () => ( options.root));
2065
2289
  if (!root) return file.includes("/.farm/");
2066
- const output = _chunkQMNWKQL4cjs.toPosixPath.call(void 0, path6.resolve(root, options.distDir || ".farm"));
2290
+ const output = _chunkGC5ROI3Acjs.toPosixPath.call(void 0, path6.resolve(root, options.distDir || ".farm"));
2067
2291
  return file === output || file.startsWith(`${output}/`);
2068
2292
  };
2069
2293
  let serverFnTransformActive = false;
2070
2294
  const getFarmRenderedServerModules = () => {
2071
- const routeManager = _optionalChain([farmApp, 'optionalAccess', _100 => _100.getRouteManager, 'call', _101 => _101()]);
2295
+ const routeManager = _optionalChain([farmApp, 'optionalAccess', _108 => _108.getRouteManager, 'call', _109 => _109()]);
2072
2296
  if (!routeManager) return /* @__PURE__ */ new Set();
2073
2297
  const files = /* @__PURE__ */ new Set();
2074
2298
  for (const entries of [
@@ -2089,8 +2313,8 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2089
2313
  return files;
2090
2314
  };
2091
2315
  const islandsServerFns = () => {
2092
- const config = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _102 => _102.getConfig, 'call', _103 => _103()]), () => ( options));
2093
- return _optionalChain([config, 'access', _104 => _104.experimental, 'optionalAccess', _105 => _105.serverActions]) === true && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _106 => _106.experimental, 'optionalAccess', _107 => _107.serverComponents])) === "islands";
2316
+ const config = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _110 => _110.getConfig, 'call', _111 => _111()]), () => ( options));
2317
+ return _optionalChain([config, 'access', _112 => _112.experimental, 'optionalAccess', _113 => _113.serverActions]) === true && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _114 => _114.experimental, 'optionalAccess', _115 => _115.serverComponents])) === "islands";
2094
2318
  };
2095
2319
  let reactRefreshActive = false;
2096
2320
  let server;
@@ -2119,9 +2343,9 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2119
2343
  ].join(" ");
2120
2344
  console.log(log);
2121
2345
  };
2122
- const getProgrammaticClientRoutes = () => _nullishCoalesce(options.programmaticClientRoutes, () => ( _optionalChain([farmApp, 'optionalAccess', _108 => _108.getRouteManager, 'call', _109 => _109(), 'access', _110 => _110.getProgrammaticClientRoutes, 'call', _111 => _111()])));
2346
+ const getProgrammaticClientRoutes = () => _nullishCoalesce(options.programmaticClientRoutes, () => ( _optionalChain([farmApp, 'optionalAccess', _116 => _116.getRouteManager, 'call', _117 => _117(), 'access', _118 => _118.getProgrammaticClientRoutes, 'call', _119 => _119()])));
2123
2347
  const isOutsideAppRoot = (file) => {
2124
- const root = _optionalChain([farmApp, 'optionalAccess', _112 => _112.getConfig, 'call', _113 => _113(), 'access', _114 => _114.root]) || _optionalChain([server, 'optionalAccess', _115 => _115.config, 'access', _116 => _116.root]) || options.root;
2348
+ const root = _optionalChain([farmApp, 'optionalAccess', _120 => _120.getConfig, 'call', _121 => _121(), 'access', _122 => _122.root]) || _optionalChain([server, 'optionalAccess', _123 => _123.config, 'access', _124 => _124.root]) || options.root;
2125
2349
  if (!root) return false;
2126
2350
  const relative4 = path6.relative(root, file.split("?", 1)[0]);
2127
2351
  return relative4.startsWith("..") || path6.isAbsolute(relative4);
@@ -2133,14 +2357,14 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2133
2357
  isBuild = configEnv.command === "build";
2134
2358
  const farmAliases = {
2135
2359
  ..._chunkMTBDJ326cjs.getFarmLayerAliases.call(void 0, options.layers),
2136
- ...hasFarmSourceAliasOverride(_optionalChain([userConfig, 'access', _117 => _117.resolve, 'optionalAccess', _118 => _118.alias])) ? {} : _chunkTAU3OF5Bcjs.createFarmSourceAlias.call(void 0, options.root || process.cwd(), options.srcDir)
2360
+ ...hasFarmSourceAliasOverride(_optionalChain([userConfig, 'access', _125 => _125.resolve, 'optionalAccess', _126 => _126.alias])) ? {} : _chunkIK33N2ANcjs.createFarmSourceAlias.call(void 0, options.root || process.cwd(), options.srcDir)
2137
2361
  };
2138
2362
  if (Object.keys(farmAliases).length > 0) {
2139
2363
  _nullishCoalesce(userConfig.resolve, () => ( (userConfig.resolve = {})));
2140
- userConfig.resolve.alias = _chunkTAU3OF5Bcjs.mergeFarmViteAlias.call(void 0, farmAliases, userConfig.resolve.alias);
2364
+ userConfig.resolve.alias = _chunkIK33N2ANcjs.mergeFarmViteAlias.call(void 0, farmAliases, userConfig.resolve.alias);
2141
2365
  }
2142
2366
  const layerRoots = (_nullishCoalesce(options.layers, () => ( []))).map((layer) => layer.root);
2143
- farmOwnsDevCors = !isBuild && _optionalChain([userConfig, 'access', _119 => _119.server, 'optionalAccess', _120 => _120.cors]) === void 0;
2367
+ farmOwnsDevCors = !isBuild && _optionalChain([userConfig, 'access', _127 => _127.server, 'optionalAccess', _128 => _128.cors]) === void 0;
2144
2368
  return {
2145
2369
  // Honor Farm's publicDir so the dev server serves the same static
2146
2370
  // directory the production client build emits.
@@ -2153,13 +2377,13 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2153
2377
  ...farmOwnsDevCors ? { cors: false } : {},
2154
2378
  fs: {
2155
2379
  ...layerRoots.length ? { allow: [path6.resolve(options.root || process.cwd()), ...layerRoots] } : {},
2156
- deny: getFarmDevFsDeny(_optionalChain([userConfig, 'access', _121 => _121.server, 'optionalAccess', _122 => _122.fs, 'optionalAccess', _123 => _123.deny]), options)
2380
+ deny: getFarmDevFsDeny(_optionalChain([userConfig, 'access', _129 => _129.server, 'optionalAccess', _130 => _130.fs, 'optionalAccess', _131 => _131.deny]), options)
2157
2381
  }
2158
2382
  }
2159
2383
  };
2160
2384
  },
2161
2385
  configEnvironment(name, environmentConfig, env) {
2162
- if (env.command !== "serve" || name !== "ssr" && name !== "rsc" || _optionalChain([environmentConfig, 'access', _124 => _124.dev, 'optionalAccess', _125 => _125.createEnvironment])) {
2386
+ if (env.command !== "serve" || name !== "ssr" && name !== "rsc" || _optionalChain([environmentConfig, 'access', _132 => _132.dev, 'optionalAccess', _133 => _133.createEnvironment])) {
2163
2387
  return;
2164
2388
  }
2165
2389
  return {
@@ -2178,8 +2402,8 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2178
2402
  (plugin2) => plugin2.name === SERVER_FN_TRANSFORM_PLUGIN
2179
2403
  );
2180
2404
  reactRefreshActive = _chunk3QM74STYcjs.isFarmReactRefreshActive.call(void 0, config);
2181
- if (_optionalChain([options, 'access', _126 => _126.experimental, 'optionalAccess', _127 => _127.serverActions]) === true && !serverFnTransformActive && !islandsServerFns()) {
2182
- _chunkQMNWKQL4cjs.logger.warn(
2405
+ if (_optionalChain([options, 'access', _134 => _134.experimental, 'optionalAccess', _135 => _135.serverActions]) === true && !serverFnTransformActive && !islandsServerFns()) {
2406
+ _chunkGC5ROI3Acjs.logger.warn(
2183
2407
  "experimental.serverActions has no effect without @farm.js/plugin/rsc in the Vite plugins. Server functions stay server-only, and importing one from client code is a build error."
2184
2408
  );
2185
2409
  }
@@ -2187,21 +2411,21 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2187
2411
  async configureServer(viteServer) {
2188
2412
  viteServer.middlewares.use(
2189
2413
  createFarmDevPreviewGuard(viteServer, {
2190
- getSourceRoots: () => _chunkMTBDJ326cjs.getFarmSourceRoots.call(void 0, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _128 => _128.getConfig, 'call', _129 => _129()]), () => ( options)))
2414
+ getSourceRoots: () => _chunkMTBDJ326cjs.getFarmSourceRoots.call(void 0, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _136 => _136.getConfig, 'call', _137 => _137()]), () => ( options)))
2191
2415
  })
2192
2416
  );
2193
2417
  if (typeof fontImports.configureServer === "function") {
2194
2418
  await fontImports.configureServer.call(this, viteServer);
2195
2419
  }
2196
2420
  server = viteServer;
2197
- const farmMiddlewares = _nullishCoalesce(_optionalChain([deferredGates, 'optionalAccess', _130 => _130.pre, 'access', _131 => _131.target]), () => ( viteServer.middlewares));
2198
- const farmPostMiddlewares = _nullishCoalesce(_optionalChain([deferredGates, 'optionalAccess', _132 => _132.post, 'access', _133 => _133.target]), () => ( viteServer.middlewares));
2421
+ const farmMiddlewares = _nullishCoalesce(_optionalChain([deferredGates, 'optionalAccess', _138 => _138.pre, 'access', _139 => _139.target]), () => ( viteServer.middlewares));
2422
+ const farmPostMiddlewares = _nullishCoalesce(_optionalChain([deferredGates, 'optionalAccess', _140 => _140.post, 'access', _141 => _141.target]), () => ( viteServer.middlewares));
2199
2423
  const pm = initialPluginManager;
2200
2424
  const configRoutePlugins = new Set(
2201
- _optionalChain([pm, 'optionalAccess', _134 => _134.getPlugins, 'call', _135 => _135(), 'access', _136 => _136.filter, 'call', _137 => _137(isFarmConfigRoutePlugin), 'access', _138 => _138.map, 'call', _139 => _139((plugin2) => plugin2.name)])
2425
+ _optionalChain([pm, 'optionalAccess', _142 => _142.getPlugins, 'call', _143 => _143(), 'access', _144 => _144.filter, 'call', _145 => _145(isFarmConfigRoutePlugin), 'access', _146 => _146.map, 'call', _147 => _147((plugin2) => plugin2.name)])
2202
2426
  );
2203
- const configRedirectMatchers = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _140 => _140.getPlugins, 'call', _141 => _141()]), () => ( []))).flatMap((plugin2) => {
2204
- const matcher = _chunkMBCRWU3Pcjs.getConfigRedirectMatcher.call(void 0, plugin2);
2427
+ const configRedirectMatchers = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _148 => _148.getPlugins, 'call', _149 => _149()]), () => ( []))).flatMap((plugin2) => {
2428
+ const matcher = _chunkH7OFZJCVcjs.getConfigRedirectMatcher.call(void 0, plugin2);
2205
2429
  return matcher ? [matcher] : [];
2206
2430
  });
2207
2431
  const emitPluginError = async (phase, error, meta) => {
@@ -2211,7 +2435,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2211
2435
  } catch (e21) {
2212
2436
  }
2213
2437
  };
2214
- farmApp = new (0, _chunkTAU3OF5Bcjs.FarmApp)(
2438
+ farmApp = new (0, _chunkIK33N2ANcjs.FarmApp)(
2215
2439
  {
2216
2440
  ...options,
2217
2441
  root: resolveDevelopmentRoot(options.root, server.config.root)
@@ -2219,7 +2443,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2219
2443
  server
2220
2444
  );
2221
2445
  farmApp.getRouteManager().usePackageClientBoundaryCacheFile(
2222
- _chunkHTXKSREFcjs.resolvePackageClientBoundaryCacheFile.call(void 0,
2446
+ _chunkJNZDTE75cjs.resolvePackageClientBoundaryCacheFile.call(void 0,
2223
2447
  farmApp.getConfig().root,
2224
2448
  options.distDir || ".farm"
2225
2449
  )
@@ -2228,17 +2452,17 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2228
2452
  await farmApp.initialize();
2229
2453
  const farmConfig = farmApp.getConfig();
2230
2454
  let farmAppPackages;
2231
- if (_optionalChain([farmConfig, 'access', _142 => _142.agent, 'optionalAccess', _143 => _143.noindexPreviews])) {
2455
+ if (_optionalChain([farmConfig, 'access', _150 => _150.agent, 'optionalAccess', _151 => _151.noindexPreviews])) {
2232
2456
  farmMiddlewares.use((_req, res, next) => {
2233
- if (_chunkILQ5DKYFcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env)) {
2234
- res.setHeader("X-Robots-Tag", _chunkODBM54RTcjs.FARM_PREVIEW_ROBOTS_TAG);
2457
+ if (_chunkKPYQ32BAcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env)) {
2458
+ res.setHeader("X-Robots-Tag", _chunkF4ID7BGOcjs.FARM_PREVIEW_ROBOTS_TAG);
2235
2459
  }
2236
2460
  next();
2237
2461
  });
2238
2462
  }
2239
2463
  const apiServerBasePath = _chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, farmConfig.api);
2240
2464
  const devBuiltInRoutePaths = new Set(
2241
- _chunk4YHGQDTTcjs.listFarmBuiltInRoutePaths.call(void 0, {
2465
+ _chunkWJ5CCQBMcjs.listFarmBuiltInRoutePaths.call(void 0, {
2242
2466
  agent: {
2243
2467
  apiCatalog: true,
2244
2468
  mcp: true,
@@ -2249,20 +2473,20 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2249
2473
  openapi: options.openapi
2250
2474
  })
2251
2475
  );
2252
- const serverConfig = _chunkCFG4QERRcjs.resolveFarmServerConfig.call(void 0, farmConfig.server);
2476
+ const serverConfig = _chunk7Q7UB4TLcjs.resolveFarmServerConfig.call(void 0, farmConfig.server);
2253
2477
  globalThis.__FARM_IMAGE_CONFIG__ = _chunkMCSRMEQVcjs.getPublicFarmImageConfig.call(void 0, farmConfig.images);
2254
2478
  let imageHandler = null;
2255
2479
  if (farmConfig.images.provider !== "none") {
2256
2480
  const { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } = await import("./image/sharp.cjs");
2257
- imageHandler = _chunkO47W53D3cjs.createFarmImageHandler.call(void 0, farmConfig.images, {
2481
+ imageHandler = _chunkRDADQG5Scjs.createFarmImageHandler.call(void 0, farmConfig.images, {
2258
2482
  transform: createSharpImageTransformer(),
2259
2483
  fetchRemote: createNodeImageFetcher(farmConfig.images),
2260
2484
  validateRemoteUrl: createNodeImageUrlValidator(farmConfig.images),
2261
2485
  // Vite owns this address. Unlike request.url, it cannot be replaced by
2262
2486
  // a caller-controlled Host header.
2263
- trustedLocalOrigin: () => _optionalChain([server, 'access', _144 => _144.resolvedUrls, 'optionalAccess', _145 => _145.local, 'access', _146 => _146[0]]),
2487
+ trustedLocalOrigin: () => _optionalChain([server, 'access', _152 => _152.resolvedUrls, 'optionalAccess', _153 => _153.local, 'access', _154 => _154[0]]),
2264
2488
  onError(error) {
2265
- _chunkQMNWKQL4cjs.logger.error(
2489
+ _chunkGC5ROI3Acjs.logger.error(
2266
2490
  `Image optimization failed: ${error instanceof Error ? error.message : String(error)}`
2267
2491
  );
2268
2492
  }
@@ -2280,15 +2504,15 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2280
2504
  const workflowConfig = farmConfig.workflows;
2281
2505
  const farmDocsDevRuntime = farmConfig.docs.enabled ? await loadFarmDocsDevRuntime() : null;
2282
2506
  const getExtraRouteTypes = () => [
2283
- ..._optionalChain([options, 'access', _147 => _147.openapi, 'optionalAccess', _148 => _148.enabled]) && options.openapi.route ? [options.openapi.route] : [],
2284
- ..._nullishCoalesce(_optionalChain([farmDocsDevRuntime, 'optionalAccess', _149 => _149.getFarmDocsRouteTypeEntries, 'call', _150 => _150(farmConfig.docs)]), () => ( []))
2507
+ ..._optionalChain([options, 'access', _155 => _155.openapi, 'optionalAccess', _156 => _156.enabled]) && options.openapi.route ? [options.openapi.route] : [],
2508
+ ..._nullishCoalesce(_optionalChain([farmDocsDevRuntime, 'optionalAccess', _157 => _157.getFarmDocsRouteTypeEntries, 'call', _158 => _158(farmConfig.docs)]), () => ( []))
2285
2509
  ];
2286
2510
  const appDirSlugs = sourceRoots.map(
2287
2511
  (source) => path6.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
2288
2512
  );
2289
2513
  const generateTypeArtifacts = async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
2290
2514
  try {
2291
- const result = await _chunkCLEWORVYcjs.generateFarmTypeArtifacts.call(void 0, {
2515
+ const result = await _chunk7564NP5Zcjs.generateFarmTypeArtifacts.call(void 0, {
2292
2516
  root: farmConfig.root,
2293
2517
  srcDir: farmConfig.srcDir,
2294
2518
  layers: farmConfig.layers,
@@ -2317,7 +2541,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2317
2541
  }
2318
2542
  } catch (e) {
2319
2543
  const message = e instanceof Error ? e.message : String(e);
2320
- _chunkQMNWKQL4cjs.logger.warn(`Route type generation failed (farm.d.ts may be stale): ${message}`);
2544
+ _chunkGC5ROI3Acjs.logger.warn(`Route type generation failed (farm.d.ts may be stale): ${message}`);
2321
2545
  if (pm) {
2322
2546
  await emitPluginError("type-artifact-generation", e, { reason });
2323
2547
  }
@@ -2328,7 +2552,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2328
2552
  (source) => path6.join(source.root, source.srcDir).replace(/\\/g, "/")
2329
2553
  );
2330
2554
  const layerConfigFiles = new Set(
2331
- farmConfig.layers.map((layer) => _optionalChain([layer, 'access', _151 => _151.configFile, 'optionalAccess', _152 => _152.replace, 'call', _153 => _153(/\\/g, "/")])).filter((file) => Boolean(file))
2555
+ farmConfig.layers.map((layer) => _optionalChain([layer, 'access', _159 => _159.configFile, 'optionalAccess', _160 => _160.replace, 'call', _161 => _161(/\\/g, "/")])).filter((file) => Boolean(file))
2332
2556
  );
2333
2557
  const routeModuleExtensions = /* @__PURE__ */ new Set([
2334
2558
  ..._chunk67MZTLTFcjs.resolveFarmComponentExtensions.call(void 0, farmConfig.renderer.componentExtensions),
@@ -2346,7 +2570,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2346
2570
  };
2347
2571
  const isProgrammaticRouteFile = (file) => {
2348
2572
  const normalized = file.replace(/\\/g, "/");
2349
- return srcDirSlugs.some((srcDir) => normalized.startsWith(`${srcDir}/`)) && _chunkE7QOEV5Zcjs.isProgrammaticRoutesFileName.call(void 0, normalized);
2573
+ return srcDirSlugs.some((srcDir) => normalized.startsWith(`${srcDir}/`)) && _chunkYUCU6XB4cjs.isProgrammaticRoutesFileName.call(void 0, normalized);
2350
2574
  };
2351
2575
  const isProgrammaticRouteSourceFile = (file) => {
2352
2576
  const normalized = file.replace(/\\/g, "/");
@@ -2370,7 +2594,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2370
2594
  let routeRefreshScheduled = null;
2371
2595
  let pendingRouteRefreshIncludesMiddleware = false;
2372
2596
  const scheduleTypeArtifactGen = (file, event, selection) => {
2373
- const normalizedFile = _chunkQMNWKQL4cjs.toPosixPath.call(void 0, file);
2597
+ const normalizedFile = _chunkGC5ROI3Acjs.toPosixPath.call(void 0, file);
2374
2598
  for (const [artifact, enabled] of Object.entries(selection)) {
2375
2599
  if (enabled) {
2376
2600
  pendingTypeArtifacts[artifact] = true;
@@ -2391,7 +2615,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2391
2615
  ["add", "change", "unlink"].forEach((ev) => {
2392
2616
  server.watcher.on(ev, (file) => {
2393
2617
  if (ev === "add") {
2394
- _chunkJYNNIGQOcjs.invalidateFailedFarmDevModules.call(void 0, server);
2618
+ _chunk25JGHAGHcjs.invalidateFailedFarmDevModules.call(void 0, server);
2395
2619
  }
2396
2620
  const normalizedFile = file.replace(/\\/g, "/");
2397
2621
  const configChanged = isFarmConfigFile(file, farmConfig.root) || layerConfigFiles.has(normalizedFile);
@@ -2407,7 +2631,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2407
2631
  scheduleTypeArtifactGen(file, ev, typeArtifacts);
2408
2632
  }
2409
2633
  if (isI18nCatalogFile(file)) {
2410
- _optionalChain([farmApp, 'optionalAccess', _154 => _154.getI18nRuntime, 'call', _155 => _155(), 'access', _156 => _156.reload, 'call', _157 => _157(), 'access', _158 => _158.then, 'call', _159 => _159(() => server.ws.send({ type: "full-reload", path: "*" })), 'access', _160 => _160.catch, 'call', _161 => _161((error) => _chunkQMNWKQL4cjs.logger.warn(`i18n catalog reload failed: ${error.message}`))]);
2634
+ _optionalChain([farmApp, 'optionalAccess', _162 => _162.getI18nRuntime, 'call', _163 => _163(), 'access', _164 => _164.reload, 'call', _165 => _165(), 'access', _166 => _166.then, 'call', _167 => _167(() => server.ws.send({ type: "full-reload", path: "*" })), 'access', _168 => _168.catch, 'call', _169 => _169((error) => _chunkGC5ROI3Acjs.logger.warn(`i18n catalog reload failed: ${error.message}`))]);
2411
2635
  }
2412
2636
  const isRouteRefreshEvent = (ev !== "change" || isStaticMetadataImageFile(file)) && (isAppRuntimeFile(file) || isProgrammaticRouteFile(file) || isProgrammaticRouteSourceFile(file) && (ev === "unlink" || fileContainsProgrammaticPageRoute(file)));
2413
2637
  if (isRouteRefreshEvent) {
@@ -2420,9 +2644,9 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2420
2644
  const reloadsMiddleware = pendingRouteRefreshIncludesMiddleware;
2421
2645
  pendingRouteRefreshIncludesMiddleware = false;
2422
2646
  Promise.all([
2423
- _optionalChain([refreshRouteDiscovery, 'optionalCall', _162 => _162(`${ev} ${file}`)]),
2424
- reloadsMiddleware ? _optionalChain([middlewareManager, 'optionalAccess', _163 => _163.reload, 'call', _164 => _164()]) : void 0
2425
- ]).then(() => server.ws.send({ type: "full-reload", path: "*" })).catch((error) => _chunkQMNWKQL4cjs.logger.warn(`Route refresh failed: ${error.message}`));
2647
+ _optionalChain([refreshRouteDiscovery, 'optionalCall', _170 => _170(`${ev} ${file}`)]),
2648
+ reloadsMiddleware ? _optionalChain([middlewareManager, 'optionalAccess', _171 => _171.reload, 'call', _172 => _172()]) : void 0
2649
+ ]).then(() => server.ws.send({ type: "full-reload", path: "*" })).catch((error) => _chunkGC5ROI3Acjs.logger.warn(`Route refresh failed: ${error.message}`));
2426
2650
  }, 50);
2427
2651
  }
2428
2652
  }
@@ -2458,16 +2682,16 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2458
2682
  const dispatchToDevServer = _chunkBNH53KOTcjs.createFarmDevServerDispatch.call(void 0, server);
2459
2683
  if (options.mobileClient) {
2460
2684
  const { FARM_DEV_SERVER_MODULE_LOADER } = await import("./internal/native-server-fns.cjs");
2461
- const load = (file) => _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, file);
2685
+ const load = (file) => _chunk25JGHAGHcjs.loadFarmDevModule.call(void 0, server, file);
2462
2686
  globalThis[FARM_DEV_SERVER_MODULE_LOADER] = load;
2463
- _optionalChain([server, 'access', _165 => _165.httpServer, 'optionalAccess', _166 => _166.once, 'call', _167 => _167("close", () => {
2687
+ _optionalChain([server, 'access', _173 => _173.httpServer, 'optionalAccess', _174 => _174.once, 'call', _175 => _175("close", () => {
2464
2688
  const globals = globalThis;
2465
2689
  if (globals[FARM_DEV_SERVER_MODULE_LOADER] === load) {
2466
2690
  delete globals[FARM_DEV_SERVER_MODULE_LOADER];
2467
2691
  }
2468
2692
  })]);
2469
2693
  }
2470
- apiRouteManager = new (0, _chunk5LOARKDPcjs.APIRouteManager)(appDirs, server, {
2694
+ apiRouteManager = new (0, _chunkHFJLMALCcjs.APIRouteManager)(appDirs, server, {
2471
2695
  plugins: farmConfig.plugins,
2472
2696
  i18n: farmApp.getI18nRuntime(),
2473
2697
  bodySizeLimit: serverConfig.bodySizeLimit,
@@ -2491,17 +2715,17 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2491
2715
  discoveredWorkflows = await discoverFarmWorkflows(
2492
2716
  { ...farmConfig, workflows: workflowConfig },
2493
2717
  {
2494
- loadModule: async (filePath) => _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, filePath)
2718
+ loadModule: async (filePath) => _chunk25JGHAGHcjs.loadFarmDevModule.call(void 0, server, filePath)
2495
2719
  }
2496
2720
  );
2497
2721
  if (discoveredWorkflows.length > 0) {
2498
2722
  workflowHandler = createFarmWorkflowRequestHandler({
2499
2723
  workflows: discoveredWorkflows,
2500
2724
  config: workflowConfig,
2501
- loadModule: async (workflow) => _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, workflow.filePath),
2725
+ loadModule: async (workflow) => _chunk25JGHAGHcjs.loadFarmDevModule.call(void 0, server, workflow.filePath),
2502
2726
  server: farmConfig.server
2503
2727
  });
2504
- _chunkQMNWKQL4cjs.logger.success(`\u2705 Discovered ${discoveredWorkflows.length} Farm workflow task(s)`);
2728
+ _chunkGC5ROI3Acjs.logger.success(`\u2705 Discovered ${discoveredWorkflows.length} Farm workflow task(s)`);
2505
2729
  }
2506
2730
  }
2507
2731
  if (pm) {
@@ -2513,7 +2737,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2513
2737
  });
2514
2738
  }
2515
2739
  }
2516
- middlewareManager = new (0, _chunkACGBXN3Ucjs.MiddlewareManager)(
2740
+ middlewareManager = new (0, _chunkWW62HKA2cjs.MiddlewareManager)(
2517
2741
  appDirs,
2518
2742
  server,
2519
2743
  farmConfig.middleware,
@@ -2534,11 +2758,12 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2534
2758
  });
2535
2759
  }
2536
2760
  }
2537
- if (_optionalChain([options, 'access', _168 => _168.openapi, 'optionalAccess', _169 => _169.enabled])) {
2761
+ if (_optionalChain([options, 'access', _176 => _176.openapi, 'optionalAccess', _177 => _177.enabled])) {
2538
2762
  const { OpenAPIManager } = await loadFarmOpenAPIDevRuntime();
2539
2763
  openAPIManager = new OpenAPIManager(appDirs, options.openapi, {
2540
2764
  mode: "development",
2541
- apiBaseURL: typeof _optionalChain([options, 'access', _170 => _170.api, 'optionalAccess', _171 => _171.baseURL]) === "string" ? options.api.baseURL : void 0,
2765
+ apiBaseURL: typeof _optionalChain([options, 'access', _178 => _178.api, 'optionalAccess', _179 => _179.baseURL]) === "string" ? options.api.baseURL : void 0,
2766
+ routes: () => apiRouteManager.getRoutes().values(),
2542
2767
  loadModule: (filePath) => apiRouteManager.loadModule(filePath)
2543
2768
  });
2544
2769
  const spec = await openAPIManager.generateSpec();
@@ -2556,7 +2781,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2556
2781
  await openAPIManager.invalidateCache();
2557
2782
  }
2558
2783
  if (process.env.FARM_VERBOSE) {
2559
- _chunkQMNWKQL4cjs.logger.info(`Refreshed routes: ${reason}`);
2784
+ _chunkGC5ROI3Acjs.logger.info(`Refreshed routes: ${reason}`);
2560
2785
  }
2561
2786
  };
2562
2787
  const farmDocsFontAssetList = farmDocsDevRuntime ? _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, farmConfig.root) : [];
@@ -2568,7 +2793,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2568
2793
  return _chunk7EPYN7GWcjs.resolveFarmLayoutFonts.call(void 0, layoutModules);
2569
2794
  };
2570
2795
  releaseDocsMCPServers();
2571
- const isFarmDocsPathGuarded = (href) => _chunkPXAHSCR6cjs.farmPathGuardCoversPage.call(void 0,
2796
+ const isFarmDocsPathGuarded = (href) => _chunkXGDI4OUBcjs.farmPathGuardCoversPage.call(void 0,
2572
2797
  {
2573
2798
  config: farmConfig,
2574
2799
  middlewareRoutes: middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
@@ -2581,23 +2806,23 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2581
2806
  clientEntry: "/@farm/client.js",
2582
2807
  resolveLayoutFonts: resolveDocsLayoutFonts,
2583
2808
  fontStylesheetHref: "/@farm/fonts.css",
2584
- globalStylesheetHref: _chunkTAU3OF5Bcjs.resolveDevGlobalStylesheetHref.call(void 0,
2809
+ globalStylesheetHref: _chunkIK33N2ANcjs.resolveDevGlobalStylesheetHref.call(void 0,
2585
2810
  farmConfig.root,
2586
2811
  farmConfig.srcDir
2587
2812
  ),
2588
2813
  loadModule: async (specifier) => {
2589
2814
  const resolved = await server.environments.ssr.pluginContainer.resolveId(specifier);
2590
- if (specifier === _optionalChain([farmConfig, 'access', _172 => _172.docs, 'access', _173 => _173.adapter, 'optionalAccess', _174 => _174.server]) && _optionalChain([resolved, 'optionalAccess', _175 => _175.id])) {
2815
+ if (specifier === _optionalChain([farmConfig, 'access', _180 => _180.docs, 'access', _181 => _181.adapter, 'optionalAccess', _182 => _182.server]) && _optionalChain([resolved, 'optionalAccess', _183 => _183.id])) {
2591
2816
  const file = resolved.id.split("?", 1)[0];
2592
2817
  return import(
2593
2818
  /* @vite-ignore */
2594
2819
  _url.pathToFileURL.call(void 0, file).href
2595
2820
  );
2596
2821
  }
2597
- return _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, _nullishCoalesce(_optionalChain([resolved, 'optionalAccess', _176 => _176.id]), () => ( specifier)));
2822
+ return _chunk25JGHAGHcjs.loadFarmDevModule.call(void 0, server, _nullishCoalesce(_optionalChain([resolved, 'optionalAccess', _184 => _184.id]), () => ( specifier)));
2598
2823
  },
2599
2824
  registerMCPServer: (mcpServer) => {
2600
- const dispose = _chunkLRB5OVRTcjs.registerFarmMCPServer.call(void 0, mcpServer);
2825
+ const dispose = _chunkRKQOMG2Xcjs.registerFarmMCPServer.call(void 0, mcpServer);
2601
2826
  docsMCPServerDisposers.add(dispose);
2602
2827
  return () => {
2603
2828
  docsMCPServerDisposers.delete(dispose);
@@ -2612,7 +2837,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2612
2837
  fontAssets: _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, farmDocsFontAssetList),
2613
2838
  resolveLayoutFonts: resolveDocsLayoutFonts,
2614
2839
  fontStylesheetHref: "/@farm/fonts.css",
2615
- globalStylesheetHref: _chunkTAU3OF5Bcjs.resolveDevGlobalStylesheetHref.call(void 0,
2840
+ globalStylesheetHref: _chunkIK33N2ANcjs.resolveDevGlobalStylesheetHref.call(void 0,
2616
2841
  farmConfig.root,
2617
2842
  farmConfig.srcDir
2618
2843
  ),
@@ -2620,7 +2845,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2620
2845
  basePath: farmConfig.basePath
2621
2846
  }) : null;
2622
2847
  const farmDocsListsPages = Boolean(
2623
- farmDocsDevRuntime && _optionalChain([pm, 'optionalAccess', _177 => _177.getPlugins, 'call', _178 => _178(), 'access', _179 => _179.some, 'call', _180 => _180((plugin2) => plugin2.name === "farm:infra-analytics")])
2848
+ farmDocsDevRuntime && _optionalChain([pm, 'optionalAccess', _185 => _185.getPlugins, 'call', _186 => _186(), 'access', _187 => _187.some, 'call', _188 => _188((plugin2) => plugin2.name === "farm:infra-analytics")])
2624
2849
  );
2625
2850
  let farmDocsPagePaths;
2626
2851
  const getFarmDocsPagePaths = () => {
@@ -2632,7 +2857,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2632
2857
  }).then(
2633
2858
  (pages) => new Set(pages),
2634
2859
  (error) => {
2635
- _chunkQMNWKQL4cjs.logger.warn(
2860
+ _chunkGC5ROI3Acjs.logger.warn(
2636
2861
  `Farm Infra analytics reports docs pages by the docs route, not each page's path: listing them failed (${error instanceof Error ? error.message : String(error)}).`
2637
2862
  );
2638
2863
  return void 0;
@@ -2647,108 +2872,32 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2647
2872
  });
2648
2873
  }
2649
2874
  }
2650
- const wrapFarmDocsResponseWithLayouts = async (request, response) => {
2651
- if (request.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !_optionalChain([response, 'access', _181 => _181.headers, 'access', _182 => _182.get, 'call', _183 => _183("content-type"), 'optionalAccess', _184 => _184.toLowerCase, 'call', _185 => _185(), 'access', _186 => _186.includes, 'call', _187 => _187("text/html")])) {
2652
- return response;
2653
- }
2654
- const pathname = new URL(request.url).pathname;
2655
- const matchedRoute = routeManager.matchRoute(pathname);
2656
- const layoutEntries = matchedRoute.layouts.map((layout) => ({
2657
- ...layout,
2658
- metadata: _chunkHTXKSREFcjs.getClientModuleMetadata.call(void 0, layout.modulePath, farmConfig.root)
2659
- }));
2660
- if (!layoutEntries.some((layout) => layout.metadata.shouldHydrate)) {
2661
- return response;
2662
- }
2663
- const source = await response.text();
2664
- const bodyMatch = source.match(/<body([^>]*)>([\s\S]*?)<\/body>/i);
2665
- if (!bodyMatch) {
2666
- return new Response(source, {
2667
- status: response.status,
2668
- statusText: response.statusText,
2669
- headers: response.headers
2670
- });
2671
- }
2672
- const docsRenderer = _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, (_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _188 => _188.getConfig, 'call', _189 => _189()]), () => ( options))).renderer);
2673
- const [rendererRuntime, layoutModules] = await Promise.all([
2674
- _chunk67MZTLTFcjs.isReactRenderer.call(void 0, docsRenderer) ? import("./renderer/react/server.cjs") : _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, docsRenderer.server),
2675
- Promise.all(
2676
- layoutEntries.map((layout) => routeManager.loadLayoutModule(layout.modulePath))
2677
- )
2678
- ]);
2679
- const hydrationStrategies = layoutEntries.flatMap(
2680
- (layout) => layout.metadata.shouldHydrate && layout.metadata.islandStrategy ? [layout.metadata.islandStrategy] : []
2681
- );
2682
- const islandStrategy = hydrationStrategies.every(
2683
- (strategy) => strategy === hydrationStrategies[0]
2684
- ) ? _nullishCoalesce(hydrationStrategies[0], () => ( "load")) : "load";
2685
- const params = matchedRoute.params || {};
2686
- const toUrlPath = (absolutePath) => _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, absolutePath, farmConfig.root);
2687
- const clientLayouts = Object.fromEntries(
2688
- layoutEntries.map((layout) => [
2689
- layout.pattern,
2690
- {
2691
- modulePath: toUrlPath(layout.modulePath),
2692
- pattern: layout.pattern,
2693
- shouldHydrate: layout.metadata.shouldHydrate,
2694
- islandStrategy: layout.metadata.islandStrategy,
2695
- preloads: [toUrlPath(layout.modulePath)],
2696
- assets: []
2697
- }
2698
- ])
2699
- );
2700
- const inlineValue = (value) => JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
2701
- const pageModulePath = _optionalChain([matchedRoute, 'access', _190 => _190.route, 'optionalAccess', _191 => _191.modulePath]) ? toUrlPath(matchedRoute.route.modulePath) : "";
2702
- const bootstrapScript = `<script>
2703
- window.__FARM_PROPS__ = ${inlineValue({ params })};
2704
- window.__FARM_ROUTE_SLOTS__ = [];
2705
- window.__FARM_DEPLOYMENT_ID__ = ${inlineValue(farmConfig.deploymentId)};
2706
- window.__FARM_PATH__ = ${inlineValue(pathname)};
2707
- window.__FARM_IS_CLIENT__ = false;
2708
- window.__FARM_PAGE_SHOULD_HYDRATE__ = false;
2709
- window.__FARM_LAYOUT_SHOULD_HYDRATE__ = true;
2710
- window.__FARM_SHOULD_HYDRATE__ = true;
2711
- window.__FARM_ISLAND_STRATEGY__ = ${inlineValue(islandStrategy)};
2712
- window.__FARM_PAGE_MODULE__ = ${inlineValue(pageModulePath)};
2713
- window.__FARM_LOADING_MODULE__ = null;
2714
- window.__FARM_MANIFEST__ = ${inlineValue({
2715
- routes: {},
2716
- layouts: clientLayouts,
2717
- slots: [],
2718
- clientEntry: "/@farm/client.js",
2719
- sharedAssets: []
2720
- })};
2721
- </script>`;
2722
- let wrappedElement = rendererRuntime.createElement("div", {
2723
- id: "__farm_page__",
2724
- "data-farm-client": "false",
2725
- "data-farm-layout-client": "true",
2726
- "data-farm-island": "page",
2727
- "data-farm-island-strategy": islandStrategy,
2728
- dangerouslySetInnerHTML: { __html: bootstrapScript + bodyMatch[2] }
2875
+ if (farmDocsDevRuntime && !farmDocsDevRuntime.hasFarmDocsRuntimeAdapter(farmConfig.docs)) {
2876
+ const docsContentDirs = farmDocsDevRuntime.getFarmDocsContentDirs(farmConfig.docs, {
2877
+ root: farmConfig.root,
2878
+ srcDir: farmConfig.srcDir
2729
2879
  });
2730
- for (let index = layoutModules.length - 1; index >= 0; index--) {
2731
- const LayoutComponent = layoutModules[index].default;
2732
- if (LayoutComponent) {
2733
- wrappedElement = rendererRuntime.createElement(LayoutComponent, {
2734
- children: wrappedElement,
2735
- params
2736
- });
2737
- }
2880
+ server.watcher.add(docsContentDirs);
2881
+ for (const event of ["add", "change", "unlink"]) {
2882
+ server.watcher.on(event, (file) => {
2883
+ const normalizedFile = _chunkGC5ROI3Acjs.toPosixPath.call(void 0, file);
2884
+ if (appDirSlugs.some((appDir) => normalizedFile.startsWith(`${appDir}/`))) return;
2885
+ const contentDirs = docsContentDirs.filter(
2886
+ (contentDir) => farmDocsDevRuntime.isFarmDocsContentFile(contentDir, file)
2887
+ );
2888
+ if (contentDirs.length === 0) return;
2889
+ for (const contentDir of contentDirs) {
2890
+ farmDocsDevRuntime.invalidateFarmDocsLastModified(contentDir);
2891
+ }
2892
+ logUpdate(
2893
+ "PAGE",
2894
+ `${event === "add" ? "added" : event === "unlink" ? "removed" : "updated"} ${_chunkGC5ROI3Acjs.toPosixPath.call(void 0, path6.relative(farmConfig.root, file))}`
2895
+ );
2896
+ server.ws.send({ type: "full-reload", path: "*" });
2897
+ });
2738
2898
  }
2739
- const rootMarkup = await rendererRuntime.renderToString(
2740
- rendererRuntime.createElement("div", { id: "root" }, wrappedElement)
2741
- );
2742
- const html = source.replace(bodyMatch[0], `<body${bodyMatch[1]}>${rootMarkup}</body>`);
2743
- const headers = new Headers(response.headers);
2744
- headers.delete("content-length");
2745
- headers.delete("etag");
2746
- return new Response(html, {
2747
- status: response.status,
2748
- statusText: response.statusText,
2749
- headers
2750
- });
2751
- };
2899
+ }
2900
+ const wrapFarmDocsResponseWithLayouts = (request, response) => farmApp.getServerRenderer().wrapDocsResponseWithLayouts(request, response);
2752
2901
  const farmDocsAPIHandler = farmDocsDevRuntime && !farmDocsDevRuntime.hasFarmDocsRuntimeAdapter(farmConfig.docs) ? farmDocsDevRuntime.createFarmDocsAPIHandler({
2753
2902
  rootDir: farmConfig.root,
2754
2903
  srcDir: farmConfig.srcDir,
@@ -2795,9 +2944,9 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2795
2944
  }
2796
2945
  },
2797
2946
  (request) => {
2798
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _192 => _192.getConfig, 'call', _193 => _193()]), () => ( options));
2799
- const currentServerConfig = _chunkCFG4QERRcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
2800
- return _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, request, {
2947
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _189 => _189.getConfig, 'call', _190 => _190()]), () => ( options));
2948
+ const currentServerConfig = _chunk7Q7UB4TLcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
2949
+ return _chunk2RSVYJT6cjs.resolveFarmRequestURL.call(void 0, request, {
2801
2950
  trustProxy: currentServerConfig.trustProxy
2802
2951
  });
2803
2952
  }
@@ -2811,9 +2960,9 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2811
2960
  withAPIRequestTracing(async function handleFarmDevRequest(req, res, next) {
2812
2961
  const requestUrl = req.url || "/";
2813
2962
  const requestMethod = req.method || "GET";
2814
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _194 => _194.getConfig, 'call', _195 => _195()]), () => ( options));
2815
- const currentServerConfig = _chunkCFG4QERRcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
2816
- const parsedRequestUrl = _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, {
2963
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _191 => _191.getConfig, 'call', _192 => _192()]), () => ( options));
2964
+ const currentServerConfig = _chunk7Q7UB4TLcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
2965
+ const parsedRequestUrl = _chunk2RSVYJT6cjs.resolveFarmRequestURL.call(void 0, req, {
2817
2966
  trustProxy: currentServerConfig.trustProxy
2818
2967
  });
2819
2968
  const fullUrl = parsedRequestUrl.toString();
@@ -2834,7 +2983,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2834
2983
  }
2835
2984
  }
2836
2985
  if (requestMethod === "OPTIONS" && req.headers.origin && req.headers["access-control-request-method"]) {
2837
- const preflightHeaders = _chunkMQ4DYVFScjs.resolveRouteRuleCorsPreflightHeaders.call(void 0,
2986
+ const preflightHeaders = _chunkIIHZ2BEEcjs.resolveRouteRuleCorsPreflightHeaders.call(void 0,
2838
2987
  currentConfig.routeRules,
2839
2988
  requestPathname
2840
2989
  );
@@ -2853,6 +3002,12 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2853
3002
  return;
2854
3003
  }
2855
3004
  }
3005
+ if (!rendererDisabled && (requestMethod === "GET" || requestMethod === "HEAD") && requestPathname === _chunkY3DO7BIJcjs.FARM_VIDEO_PLAYER_PATH) {
3006
+ res.statusCode = 200;
3007
+ res.setHeader("Content-Type", "text/html; charset=utf-8");
3008
+ res.end(requestMethod === "HEAD" ? void 0 : _chunkIK33N2ANcjs.FARM_VIDEO_PLAYER_HTML);
3009
+ return;
3010
+ }
2856
3011
  const farmDocsFontPath = farmDocsFontAssets.get(requestPathname);
2857
3012
  if ((requestMethod === "GET" || requestMethod === "HEAD") && farmDocsFontPath && fs2.existsSync(farmDocsFontPath)) {
2858
3013
  res.statusCode = 200;
@@ -2905,7 +3060,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2905
3060
  openapi: options.openapi
2906
3061
  },
2907
3062
  workflows: discoveredWorkflows,
2908
- plugins: _optionalChain([pm, 'optionalAccess', _196 => _196.getSortedPlugins, 'call', _197 => _197()])
3063
+ plugins: _optionalChain([pm, 'optionalAccess', _193 => _193.getSortedPlugins, 'call', _194 => _194()])
2909
3064
  });
2910
3065
  res.statusCode = 200;
2911
3066
  res.setHeader(
@@ -2918,7 +3073,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2918
3073
  } else {
2919
3074
  if (!warnedDeprecatedDevtoolsDashboard) {
2920
3075
  warnedDeprecatedDevtoolsDashboard = true;
2921
- _chunkQMNWKQL4cjs.logger.warn(
3076
+ _chunkGC5ROI3Acjs.logger.warn(
2922
3077
  "The built-in DevTools dashboard is deprecated. Install @farm.js/devtools and add devtools() to plugins in farm.config.ts."
2923
3078
  );
2924
3079
  }
@@ -2929,7 +3084,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2929
3084
  }
2930
3085
  const isViteOwnedRequest = () => requestUrl.startsWith("/@") || requestUrl.startsWith("/node_modules/") || requestUrl.startsWith("/__farm/") || isViteModuleRequest(parsedRequestUrl, req.headers) || (requestMethod === "GET" || requestMethod === "HEAD") && requestPathname.includes(".") && (devServableFileExists(requestPathname, [server.config.publicDir]) || isViteDevClientRequest(parsedRequestUrl, req.headers) && devServableFileExists(requestPathname, [server.config.root]));
2931
3086
  const configRewriteSource = req[FARM_DEV_CONFIG_REWRITE_SOURCE];
2932
- const runtimeHookErrorAnswersJSON = rendererDisabled || _chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath);
3087
+ const runtimeHookErrorAnswersJSON = rendererDisabled || _chunk4VLXQ55Ocjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath);
2933
3088
  const requestedPagePathname = configRewriteSource === void 0 ? requestPathname : new URL(configRewriteSource).pathname;
2934
3089
  let pageHookRouteMatch;
2935
3090
  const pageHookRoute = () => {
@@ -2940,10 +3095,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2940
3095
  render: {
2941
3096
  pathname: pathname2,
2942
3097
  method: requestMethod,
2943
- routePattern: _optionalChain([match, 'optionalAccess', _198 => _198.route, 'optionalAccess', _199 => _199.pattern]) || null,
2944
- params: _optionalChain([match, 'optionalAccess', _200 => _200.params]) || {}
3098
+ routePattern: _optionalChain([match, 'optionalAccess', _195 => _195.route, 'optionalAccess', _196 => _196.pattern]) || null,
3099
+ params: _optionalChain([match, 'optionalAccess', _197 => _197.params]) || {}
2945
3100
  },
2946
- layoutPatterns: (_optionalChain([match, 'optionalAccess', _201 => _201.layouts]) || []).map((layout) => layout.pattern)
3101
+ layoutPatterns: (_optionalChain([match, 'optionalAccess', _198 => _198.layouts]) || []).map((layout) => layout.pattern)
2947
3102
  };
2948
3103
  return pageHookRouteMatch;
2949
3104
  };
@@ -2978,13 +3133,13 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2978
3133
  };
2979
3134
  const meetsRequestedURLRoutes = configRewriteSource === void 0 && !deferredDottedRequests.has(req);
2980
3135
  const routeRedirect = meetsRequestedURLRoutes ? farmApp.getRouteManager().matchRedirect(requestPathname, parsedRequestUrl.search) : null;
2981
- if (meetsRequestedURLRoutes && (routeRedirect || pm && (configRoutePlugins.has(_chunkMBCRWU3Pcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME) || configRedirectMatchers.length > 0)) && !isViteOwnedRequest()) {
3136
+ if (meetsRequestedURLRoutes && (routeRedirect || pm && (configRoutePlugins.has(_chunkH7OFZJCVcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME) || configRedirectMatchers.length > 0)) && !isViteOwnedRequest()) {
2982
3137
  let redirect = routeRedirect;
2983
3138
  try {
2984
3139
  if (pm) {
2985
3140
  await pm.runHookParallelFiltered(
2986
3141
  "beforeRequest",
2987
- (plugin2) => plugin2.name === _chunkMBCRWU3Pcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME,
3142
+ (plugin2) => plugin2.name === _chunkH7OFZJCVcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME,
2988
3143
  req,
2989
3144
  res
2990
3145
  );
@@ -3010,7 +3165,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3010
3165
  const redirectResponse = response;
3011
3166
  try {
3012
3167
  const metadataRoute = matchAppMetadataRoute(requestPathname);
3013
- const kind = metadataRoute ? "asset" : _chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath) ? "api" : requestMethod === "GET" || requestMethod === "HEAD" ? "page" : "request";
3168
+ const kind = metadataRoute ? "asset" : _chunk4VLXQ55Ocjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath) ? "api" : requestMethod === "GET" || requestMethod === "HEAD" ? "page" : "request";
3014
3169
  response = await pm.runRuntimeRequest(
3015
3170
  createRequestFromNodeRequest(req, parsedRequestUrl),
3016
3171
  async () => {
@@ -3031,7 +3186,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3031
3186
  }
3032
3187
  }
3033
3188
  const runAppMiddlewareForContentRoute = async () => {
3034
- if (!_optionalChain([middlewareManager, 'optionalAccess', _202 => _202.hasMiddleware, 'call', _203 => _203()])) return false;
3189
+ if (!_optionalChain([middlewareManager, 'optionalAccess', _199 => _199.hasMiddleware, 'call', _200 => _200()])) return false;
3035
3190
  const middlewareRequest = createRequestFromNodeRequest(req, new URL(fullUrl));
3036
3191
  return runFarmMiddlewareWithNavigation(
3037
3192
  farmApp.getServerRenderer(),
@@ -3069,7 +3224,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3069
3224
  return response.status;
3070
3225
  };
3071
3226
  const runAppMiddlewareInRuntimeSession = async (runtimeSession2, logResponse2) => {
3072
- const interceptor = runtimeSession2 && _optionalChain([pm, 'optionalAccess', _204 => _204.hasRuntimeHook, 'call', _205 => _205("after")]) && _optionalChain([middlewareManager, 'optionalAccess', _206 => _206.hasMiddleware, 'call', _207 => _207()]) ? interceptFarmDevPageResponse({
3227
+ const interceptor = runtimeSession2 && _optionalChain([pm, 'optionalAccess', _201 => _201.hasRuntimeHook, 'call', _202 => _202("after")]) && _optionalChain([middlewareManager, 'optionalAccess', _203 => _203.hasMiddleware, 'call', _204 => _204()]) ? interceptFarmDevPageResponse({
3073
3228
  req,
3074
3229
  res,
3075
3230
  pm,
@@ -3082,7 +3237,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3082
3237
  urlPath: requestUrl,
3083
3238
  pathname: requestPathname,
3084
3239
  startTime: Date.now(),
3085
- logResponse: (_method, _path, status) => _optionalChain([logResponse2, 'optionalCall', _208 => _208(status)]),
3240
+ logResponse: (_method, _path, status) => _optionalChain([logResponse2, 'optionalCall', _205 => _205(status)]),
3086
3241
  // The runtime reports a runtime.after failure itself.
3087
3242
  emitError: async () => {
3088
3243
  },
@@ -3093,7 +3248,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3093
3248
  handled = await runAppMiddlewareForContentRoute();
3094
3249
  } catch (error) {
3095
3250
  if (runtimeHookErrorAnswersJSON || res.headersSent) {
3096
- _optionalChain([interceptor, 'optionalAccess', _209 => _209.release, 'call', _210 => _210()]);
3251
+ _optionalChain([interceptor, 'optionalAccess', _206 => _206.release, 'call', _207 => _207()]);
3097
3252
  throw error;
3098
3253
  }
3099
3254
  if (runtimeSession2) await pm.reportRuntimeRequestError(runtimeSession2, error);
@@ -3101,10 +3256,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3101
3256
  return true;
3102
3257
  }
3103
3258
  if (!handled) {
3104
- _optionalChain([interceptor, 'optionalAccess', _211 => _211.release, 'call', _212 => _212()]);
3259
+ _optionalChain([interceptor, 'optionalAccess', _208 => _208.release, 'call', _209 => _209()]);
3105
3260
  return false;
3106
3261
  }
3107
- if (!_optionalChain([interceptor, 'optionalAccess', _213 => _213.isEnded, 'call', _214 => _214()])) _optionalChain([logResponse2, 'optionalCall', _215 => _215(res.statusCode || 200)]);
3262
+ if (!_optionalChain([interceptor, 'optionalAccess', _210 => _210.isEnded, 'call', _211 => _211()])) _optionalChain([logResponse2, 'optionalCall', _212 => _212(res.statusCode || 200)]);
3108
3263
  return true;
3109
3264
  };
3110
3265
  const serveBuiltInRoute = async (respond, {
@@ -3113,7 +3268,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3113
3268
  label
3114
3269
  } = {}) => {
3115
3270
  const discard = async () => {
3116
- await _optionalChain([computed, 'optionalAccess', _216 => _216.body, 'optionalAccess', _217 => _217.cancel, 'call', _218 => _218(), 'access', _219 => _219.catch, 'call', _220 => _220(() => {
3271
+ await _optionalChain([computed, 'optionalAccess', _213 => _213.body, 'optionalAccess', _214 => _214.cancel, 'call', _215 => _215(), 'access', _216 => _216.catch, 'call', _217 => _217(() => {
3117
3272
  })]);
3118
3273
  };
3119
3274
  const sendRuntimeResponse = async (runtimeSession3, response2) => {
@@ -3130,9 +3285,9 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3130
3285
  if (pm && opensFarmDevRuntimeSession(pm)) {
3131
3286
  try {
3132
3287
  const routePathname = _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath);
3133
- const route = _chunk4YHGQDTTcjs.setFarmRouteLabel.call(void 0,
3288
+ const route = _chunkWJ5CCQBMcjs.setFarmRouteLabel.call(void 0,
3134
3289
  { pathname: requestPathname },
3135
- label !== void 0 ? label : devBuiltInRoutePaths.has(routePathname) ? routePathname : _chunk4YHGQDTTcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath)
3290
+ label !== void 0 ? label : devBuiltInRoutePaths.has(routePathname) ? routePathname : _chunkWJ5CCQBMcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath)
3136
3291
  );
3137
3292
  runtimeSession2 = await pm.beginRuntimeRequest(
3138
3293
  createRequestFromNodeRequest(req, new URL(fullUrl)),
@@ -3170,11 +3325,11 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3170
3325
  }
3171
3326
  responding = true;
3172
3327
  response = await respond(
3173
- _nullishCoalesce(_optionalChain([runtimeSession2, 'optionalAccess', _221 => _221.request]), () => ( createRequestFromNodeRequest(req, new URL(fullUrl))))
3328
+ _nullishCoalesce(_optionalChain([runtimeSession2, 'optionalAccess', _218 => _218.request]), () => ( createRequestFromNodeRequest(req, new URL(fullUrl))))
3174
3329
  );
3175
3330
  } catch (error) {
3176
3331
  if (!responding && !res.headersSent) {
3177
- _chunkQMNWKQL4cjs.logger.error(`Middleware error: ${error}`);
3332
+ _chunkGC5ROI3Acjs.logger.error(`Middleware error: ${error}`);
3178
3333
  await discard();
3179
3334
  await sendMiddlewareErrorJSON(runtimeSession2, error);
3180
3335
  return;
@@ -3190,7 +3345,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3190
3345
  else await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
3191
3346
  };
3192
3347
  const openAPIRequestPathname = openAPIManager ? _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) : requestPathname;
3193
- if (openAPIManager && _optionalChain([options, 'access', _222 => _222.openapi, 'optionalAccess', _223 => _223.specRoute]) && openAPIRequestPathname === options.openapi.specRoute) {
3348
+ if (openAPIManager && _optionalChain([options, 'access', _219 => _219.openapi, 'optionalAccess', _220 => _220.specRoute]) && openAPIRequestPathname === options.openapi.specRoute) {
3194
3349
  const specManager = openAPIManager;
3195
3350
  await serveBuiltInRoute(async () => {
3196
3351
  if (requestMethod !== "GET" && requestMethod !== "HEAD") {
@@ -3210,7 +3365,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3210
3365
  });
3211
3366
  return;
3212
3367
  }
3213
- if (openAPIManager && openAPIRequestPathname === _optionalChain([options, 'access', _224 => _224.openapi, 'optionalAccess', _225 => _225.route])) {
3368
+ if (openAPIManager && openAPIRequestPathname === _optionalChain([options, 'access', _221 => _221.openapi, 'optionalAccess', _222 => _222.route])) {
3214
3369
  const docsManager = openAPIManager;
3215
3370
  await serveBuiltInRoute(
3216
3371
  async () => {
@@ -3221,42 +3376,50 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3221
3376
  );
3222
3377
  return;
3223
3378
  }
3224
- if (_optionalChain([options, 'access', _226 => _226.agent, 'optionalAccess', _227 => _227.manifest]) !== false && _chunk4YHGQDTTcjs.isFarmAppManifestPath.call(void 0, _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath))) {
3379
+ if (_optionalChain([options, 'access', _223 => _223.agent, 'optionalAccess', _224 => _224.manifest]) !== false && _chunkWJ5CCQBMcjs.isFarmAppManifestPath.call(void 0, _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath))) {
3380
+ const manifestGuardCoversPath = (path7) => _chunkXGDI4OUBcjs.farmPathGuardCoversEndpoint.call(void 0,
3381
+ {
3382
+ config: farmConfig,
3383
+ middlewareRoutes: middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
3384
+ },
3385
+ path7,
3386
+ apiServerBasePath
3387
+ );
3225
3388
  await serveBuiltInRoute(async () => {
3226
- _nullishCoalesce(farmAppPackages, () => ( (farmAppPackages = _chunkTAU3OF5Bcjs.resolveFarmAppPackages.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd()))))));
3227
- const manifest = await _chunk4YHGQDTTcjs.createFarmAppManifestResponse.call(void 0,
3389
+ _nullishCoalesce(farmAppPackages, () => ( (farmAppPackages = _chunkIK33N2ANcjs.resolveFarmAppPackages.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd()))))));
3390
+ const manifest = await _chunkWJ5CCQBMcjs.createFarmAppManifestResponse.call(void 0,
3228
3391
  new Request(parsedRequestUrl, {
3229
3392
  method: requestMethod,
3230
3393
  headers: { "if-none-match": String(_nullishCoalesce(req.headers["if-none-match"], () => ( ""))) }
3231
3394
  }),
3232
3395
  {
3233
- ..._chunk4YHGQDTTcjs.resolveFarmAppManifestInput.call(void 0, farmConfig, {
3396
+ ..._chunkWJ5CCQBMcjs.resolveFarmAppManifestInput.call(void 0, farmConfig, {
3234
3397
  build: "development",
3235
3398
  packages: farmAppPackages,
3236
3399
  // Read again on each request; unchanged files come from a cache.
3237
- webmcpTools: _optionalChain([farmConfig, 'access', _228 => _228.plugins, 'optionalAccess', _229 => _229.some, 'call', _230 => _230(({ name }) => name === "farm:webmcp")]) ? _chunkTAU3OF5Bcjs.collectFarmWebMCPTools.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd())), farmConfig.srcDir) : []
3400
+ webmcpTools: _optionalChain([farmConfig, 'access', _225 => _225.plugins, 'optionalAccess', _226 => _226.some, 'call', _227 => _227(({ name }) => name === "farm:webmcp")]) ? _chunkIK33N2ANcjs.collectFarmWebMCPTools.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd())), farmConfig.srcDir) : []
3238
3401
  }),
3239
3402
  defaultMCP: () => farmApp.getServerRenderer().getDefaultMCPServer(),
3240
3403
  // A guard written for an MCP server's path keeps its tools out of the public view.
3241
- guardCoversPath: (path7) => _chunkPXAHSCR6cjs.farmPathGuardCoversEndpoint.call(void 0,
3242
- {
3243
- config: farmConfig,
3244
- middlewareRoutes: middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
3245
- },
3246
- path7,
3247
- apiServerBasePath
3248
- )
3404
+ guardCoversPath: manifestGuardCoversPath,
3405
+ // A docs runtime's MCP server lists its tools when asked, read on each request.
3406
+ ...farmDocsHandler ? {
3407
+ registeredMCP: (request) => _chunkVJ6L7TIIcjs._listFarmRegisteredMCPServerTools.call(void 0, farmDocsHandler, request, {
3408
+ basePath: farmConfig.basePath,
3409
+ guardCoversPath: manifestGuardCoversPath
3410
+ })
3411
+ } : {}
3249
3412
  }
3250
3413
  );
3251
3414
  return manifest;
3252
3415
  });
3253
3416
  return;
3254
3417
  }
3255
- if (_optionalChain([options, 'access', _231 => _231.agent, 'optionalAccess', _232 => _232.apiCatalog]) && _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) === _chunk4YHGQDTTcjs.FARM_API_CATALOG_PATH) {
3418
+ if (_optionalChain([options, 'access', _228 => _228.agent, 'optionalAccess', _229 => _229.apiCatalog]) && _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) === _chunkWJ5CCQBMcjs.FARM_API_CATALOG_PATH) {
3256
3419
  await serveBuiltInRoute(
3257
- () => _chunk4YHGQDTTcjs.createFarmApiCatalogResponse.call(void 0,
3420
+ () => _chunkWJ5CCQBMcjs.createFarmApiCatalogResponse.call(void 0,
3258
3421
  requestMethod,
3259
- _chunk4YHGQDTTcjs.resolveFarmApiCatalogInput.call(void 0, { ...options, api: farmConfig.api }),
3422
+ _chunkWJ5CCQBMcjs.resolveFarmApiCatalogInput.call(void 0, { ...options, api: farmConfig.api }),
3260
3423
  new Request(parsedRequestUrl, {
3261
3424
  headers: { "user-agent": String(_nullishCoalesce(req.headers["user-agent"], () => ( ""))) }
3262
3425
  })
@@ -3264,8 +3427,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3264
3427
  );
3265
3428
  return;
3266
3429
  }
3267
- if (_optionalChain([options, 'access', _233 => _233.agent, 'optionalAccess', _234 => _234.aiCatalog]) !== false) {
3268
- const aiCatalog = _chunk4YHGQDTTcjs.createFarmAiCatalogResponse.call(void 0,
3430
+ if (_optionalChain([options, 'access', _230 => _230.agent, 'optionalAccess', _231 => _231.aiCatalog]) !== false) {
3431
+ const aiCatalog = _chunkWJ5CCQBMcjs.createFarmAiCatalogResponse.call(void 0,
3269
3432
  new Request(parsedRequestUrl, {
3270
3433
  method: requestMethod,
3271
3434
  headers: {
@@ -3305,19 +3468,33 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3305
3468
  method: requestMethod,
3306
3469
  headers: docsHeaders
3307
3470
  });
3308
- const docsBodyInit = requestMethod === "GET" || requestMethod === "HEAD" ? {} : { body: _chunkCFG4QERRcjs.createFarmNodeRequestBodyStream.call(void 0, req), duplex: "half" };
3309
- const docsResponse = await farmDocsHandler(new Request(docsRequest, docsBodyInit));
3471
+ const docsBodyInit = requestMethod === "GET" || requestMethod === "HEAD" ? {} : { body: _chunk7Q7UB4TLcjs.createFarmNodeRequestBodyStream.call(void 0, req), duplex: "half" };
3472
+ const docsHandlerRequest = new Request(docsRequest, docsBodyInit);
3473
+ const registeredMCPCalls = await _chunkVJ6L7TIIcjs._readFarmRegisteredMCPCalls.call(void 0,
3474
+ docsHandlerRequest,
3475
+ farmConfig.basePath
3476
+ );
3477
+ const docsResponse = await farmDocsHandler(docsHandlerRequest);
3310
3478
  if (docsResponse) {
3311
- const docsPage = _optionalChain([docsResponse, 'access', _235 => _235.headers, 'access', _236 => _236.get, 'call', _237 => _237("content-type"), 'optionalAccess', _238 => _238.toLowerCase, 'call', _239 => _239(), 'access', _240 => _240.includes, 'call', _241 => _241("text/html")]);
3479
+ const docsPage = _optionalChain([docsResponse, 'access', _232 => _232.headers, 'access', _233 => _233.get, 'call', _234 => _234("content-type"), 'optionalAccess', _235 => _235.toLowerCase, 'call', _236 => _236(), 'access', _237 => _237.includes, 'call', _238 => _238("text/html")]);
3312
3480
  await serveBuiltInRoute(
3313
3481
  async (request) => {
3314
- if (!docsPage) return wrapFarmDocsResponseWithLayouts(docsRequest, docsResponse);
3482
+ if (!docsPage) {
3483
+ const response = await wrapFarmDocsResponseWithLayouts(
3484
+ docsRequest,
3485
+ docsResponse
3486
+ );
3487
+ return _chunk2RSVYJT6cjs._runWithCurrentRequest.call(void 0,
3488
+ request,
3489
+ () => _chunkVJ6L7TIIcjs._observeFarmRegisteredMCPResponse.call(void 0, response, registeredMCPCalls)
3490
+ );
3491
+ }
3315
3492
  const deploymentMismatch = _chunkNLBHLPEOcjs.getFarmDeploymentMismatch.call(void 0,
3316
3493
  request,
3317
3494
  farmConfig.deploymentId
3318
3495
  );
3319
3496
  if (deploymentMismatch) {
3320
- await _optionalChain([docsResponse, 'access', _242 => _242.body, 'optionalAccess', _243 => _243.cancel, 'call', _244 => _244()]);
3497
+ await _optionalChain([docsResponse, 'access', _239 => _239.body, 'optionalAccess', _240 => _240.cancel, 'call', _241 => _241()]);
3321
3498
  return _chunkNLBHLPEOcjs.createFarmDeploymentMismatchResponse.call(void 0, deploymentMismatch);
3322
3499
  }
3323
3500
  return _chunkNLBHLPEOcjs.withFarmDeploymentResponse.call(void 0,
@@ -3333,11 +3510,11 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3333
3510
  {
3334
3511
  kind: "docs",
3335
3512
  computed: docsResponse,
3336
- label: _chunk4YHGQDTTcjs.resolveFarmDocsEngineRouteLabel.call(void 0,
3513
+ label: _chunkWJ5CCQBMcjs.resolveFarmDocsEngineRouteLabel.call(void 0,
3337
3514
  _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath),
3338
3515
  {
3339
- path: _optionalChain([farmConfig, 'access', _245 => _245.docs, 'optionalAccess', _246 => _246.entry]) || "/docs",
3340
- roots: _optionalChain([farmConfig, 'access', _247 => _247.docs, 'optionalAccess', _248 => _248.roots, 'optionalAccess', _249 => _249.map, 'call', _250 => _250((root) => root.entry)]),
3516
+ path: _optionalChain([farmConfig, 'access', _242 => _242.docs, 'optionalAccess', _243 => _243.entry]) || "/docs",
3517
+ roots: _optionalChain([farmConfig, 'access', _244 => _244.docs, 'optionalAccess', _245 => _245.roots, 'optionalAccess', _246 => _246.map, 'call', _247 => _247((root) => root.entry)]),
3341
3518
  pages: await getFarmDocsPagePaths()
3342
3519
  }
3343
3520
  )
@@ -3346,9 +3523,9 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3346
3523
  return;
3347
3524
  }
3348
3525
  }
3349
- if (options.mobileClient && !viteModuleRequest && (requestMethod === "GET" || requestMethod === "HEAD" || requestMethod === "POST") && _optionalChain([req, 'access', _251 => _251.headers, 'access', _252 => _252.accept, 'optionalAccess', _253 => _253.includes, 'call', _254 => _254(_chunk3HLQTOVUcjs.FARM_NATIVE_TREE_CONTENT_TYPE)])) {
3350
- const { createFarmNativeTreeResponse } = await import("./native-tree-R6CQMDTI.cjs");
3351
- const treeBodyInit = requestMethod === "POST" ? { body: _chunkCFG4QERRcjs.createFarmNodeRequestBodyStream.call(void 0, req), duplex: "half" } : {};
3526
+ if (options.mobileClient && !viteModuleRequest && (requestMethod === "GET" || requestMethod === "HEAD" || requestMethod === "POST") && _optionalChain([req, 'access', _248 => _248.headers, 'access', _249 => _249.accept, 'optionalAccess', _250 => _250.includes, 'call', _251 => _251(_chunk3HLQTOVUcjs.FARM_NATIVE_TREE_CONTENT_TYPE)])) {
3527
+ const { createFarmNativeTreeResponse } = await import("./native-tree-D3PW64ZL.cjs");
3528
+ const treeBodyInit = requestMethod === "POST" ? { body: _chunk7Q7UB4TLcjs.createFarmNodeRequestBodyStream.call(void 0, req), duplex: "half" } : {};
3352
3529
  const treeResponse = await createFarmNativeTreeResponse({
3353
3530
  request: new Request(fullUrl, {
3354
3531
  method: requestMethod,
@@ -3358,24 +3535,24 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3358
3535
  // As for the Markdown mirror: this server's own listener, redirects not followed.
3359
3536
  renderPage: (request) => _chunkBNH53KOTcjs.createFarmDevServerDispatch.call(void 0, server)(
3360
3537
  new Request(request, {
3361
- signal: res.destroyed ? AbortSignal.abort() : _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3538
+ signal: res.destroyed ? AbortSignal.abort() : _chunk7Q7UB4TLcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3362
3539
  })
3363
3540
  )
3364
3541
  });
3365
3542
  await serveBuiltInRoute(() => treeResponse, {
3366
3543
  computed: treeResponse,
3367
- label: _nullishCoalesce(_optionalChain([farmApp, 'access', _255 => _255.getRouteManager, 'call', _256 => _256(), 'access', _257 => _257.matchRoute, 'call', _258 => _258(_chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath)), 'access', _259 => _259.route, 'optionalAccess', _260 => _260.pattern]), () => ( null))
3544
+ label: _nullishCoalesce(_optionalChain([farmApp, 'access', _252 => _252.getRouteManager, 'call', _253 => _253(), 'access', _254 => _254.matchRoute, 'call', _255 => _255(_chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath)), 'access', _256 => _256.route, 'optionalAccess', _257 => _257.pattern]), () => ( null))
3368
3545
  });
3369
3546
  return;
3370
3547
  }
3371
3548
  const markdownRouteLabel = () => (
3372
3549
  // On the route path, as production labels it: /fr/index.md is /index.md.
3373
- _chunk4YHGQDTTcjs.resolveFarmMarkdownRouteLabel.call(void 0,
3550
+ _chunkWJ5CCQBMcjs.resolveFarmMarkdownRouteLabel.call(void 0,
3374
3551
  toRoutePathname(requestPathname),
3375
- (page) => _optionalChain([farmApp, 'access', _261 => _261.getRouteManager, 'call', _262 => _262(), 'access', _263 => _263.matchRoute, 'call', _264 => _264(page), 'access', _265 => _265.route, 'optionalAccess', _266 => _266.pattern])
3552
+ (page) => _optionalChain([farmApp, 'access', _258 => _258.getRouteManager, 'call', _259 => _259(), 'access', _260 => _260.matchRoute, 'call', _261 => _261(page), 'access', _262 => _262.route, 'optionalAccess', _263 => _263.pattern])
3376
3553
  )
3377
3554
  );
3378
- const markdownSourceResponse = viteModuleRequest ? null : await _chunkLGR7565Lcjs.createFarmMarkdownSourceResponse.call(void 0, {
3555
+ const markdownSourceResponse = viteModuleRequest ? null : await _chunkPG7J7XYTcjs.createFarmMarkdownSourceResponse.call(void 0, {
3379
3556
  request: new Request(fullUrl, {
3380
3557
  method: requestMethod,
3381
3558
  headers: docsHeaders
@@ -3384,13 +3561,14 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3384
3561
  routePathname: toRoutePathname,
3385
3562
  resolveSource: async (pathname2) => {
3386
3563
  const match = farmApp.getRouteManager().matchRoute(pathname2);
3387
- const sourcePath = _optionalChain([match, 'access', _267 => _267.route, 'optionalAccess', _268 => _268.markdownSourcePath]) || (match.route && _chunkLGR7565Lcjs.isFarmMarkdownPageFile.call(void 0, match.route.modulePath) ? match.route.modulePath : null);
3564
+ const sourcePath = _optionalChain([match, 'access', _264 => _264.route, 'optionalAccess', _265 => _265.markdownSourcePath]) || (match.route && _chunkPG7J7XYTcjs.isFarmMarkdownPageFile.call(void 0, match.route.modulePath) ? match.route.modulePath : null);
3388
3565
  if (!sourcePath) {
3389
3566
  return null;
3390
3567
  }
3391
3568
  return {
3392
3569
  source: await fs2.promises.readFile(sourcePath, "utf8"),
3393
- filePath: sourcePath
3570
+ // Project-relative, as production sends it: never the machine's path.
3571
+ filePath: _chunkIK33N2ANcjs.toBakedMarkdownSourcePath.call(void 0, farmApp.getConfig().root, sourcePath)
3394
3572
  };
3395
3573
  },
3396
3574
  // The anonymous check goes through this server, so its guards and
@@ -3404,7 +3582,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3404
3582
  farmApp.getConfig().trailingSlash === true
3405
3583
  ),
3406
3584
  {
3407
- signal: res.destroyed ? AbortSignal.abort() : _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3585
+ signal: res.destroyed ? AbortSignal.abort() : _chunk7Q7UB4TLcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3408
3586
  }
3409
3587
  )
3410
3588
  )
@@ -3416,7 +3594,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3416
3594
  });
3417
3595
  return;
3418
3596
  }
3419
- const markdownResponse = viteModuleRequest ? null : await _chunkHGB4PM2Ccjs.createMarkdownMirrorResponse.call(void 0, {
3597
+ const markdownResponse = viteModuleRequest ? null : await _chunk2YJ4DHTDcjs.createMarkdownMirrorResponse.call(void 0, {
3420
3598
  request: new Request(fullUrl, {
3421
3599
  method: requestMethod,
3422
3600
  headers: docsHeaders
@@ -3441,7 +3619,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3441
3619
  headers,
3442
3620
  // Only accepted mirrors need disconnect listeners. An earlier
3443
3621
  // close (for example while the docs handler ran) must also abort.
3444
- signal: res.destroyed ? AbortSignal.abort() : _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3622
+ signal: res.destroyed ? AbortSignal.abort() : _chunk7Q7UB4TLcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3445
3623
  }
3446
3624
  )
3447
3625
  );
@@ -3455,16 +3633,16 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3455
3633
  });
3456
3634
  return;
3457
3635
  }
3458
- if (!viteModuleRequest && _chunkHGB4PM2Ccjs.farmRequestWantsMarkdown.call(void 0, requestPathname, req.headers.accept)) {
3459
- const markdownRoute = farmApp.getRouteManager().matchRoute(_chunkLGR7565Lcjs.normalizeFarmMarkdownRoutePath.call(void 0, requestPathname, toRoutePathname));
3636
+ if (!viteModuleRequest && _chunk2YJ4DHTDcjs.farmRequestWantsMarkdown.call(void 0, requestPathname, req.headers.accept)) {
3637
+ const markdownRoute = farmApp.getRouteManager().matchRoute(_chunkPG7J7XYTcjs.normalizeFarmMarkdownRoutePath.call(void 0, requestPathname, toRoutePathname));
3460
3638
  if (!markdownRoute.route) {
3461
3639
  await serveBuiltInRoute(
3462
3640
  () => new Response(
3463
- _chunkHGB4PM2Ccjs.createFarmMarkdownErrorBody.call(void 0, 404, requestPathname, farmConfig.basePath || "/"),
3641
+ _chunk2YJ4DHTDcjs.createFarmMarkdownErrorBody.call(void 0, 404, requestPathname, farmConfig.basePath || "/"),
3464
3642
  {
3465
3643
  status: 404,
3466
3644
  headers: {
3467
- "Content-Type": _chunkHGB4PM2Ccjs.FARM_MARKDOWN_CONTENT_TYPE,
3645
+ "Content-Type": _chunk2YJ4DHTDcjs.FARM_MARKDOWN_CONTENT_TYPE,
3468
3646
  "X-Farm-Markdown-Error": "404",
3469
3647
  "Cache-Control": "no-store"
3470
3648
  }
@@ -3474,7 +3652,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3474
3652
  return;
3475
3653
  }
3476
3654
  }
3477
- const markdownPageTarget = _chunkHGB4PM2Ccjs.resolveMarkdownMirrorTarget.call(void 0,
3655
+ const markdownPageTarget = _chunk2YJ4DHTDcjs.resolveMarkdownMirrorTarget.call(void 0,
3478
3656
  farmApp.getConfig().md,
3479
3657
  requestPathname,
3480
3658
  {
@@ -3499,13 +3677,13 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3499
3677
  let workflowBody;
3500
3678
  try {
3501
3679
  if (requestMethod !== "GET" && requestMethod !== "HEAD") {
3502
- workflowBody = await _chunkCFG4QERRcjs.readNodeRequestBody.call(void 0,
3680
+ workflowBody = await _chunk7Q7UB4TLcjs.readNodeRequestBody.call(void 0,
3503
3681
  req,
3504
3682
  currentServerConfig.bodySizeLimit
3505
3683
  );
3506
3684
  }
3507
3685
  } catch (error) {
3508
- const response = _chunkCFG4QERRcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
3686
+ const response = _chunk7Q7UB4TLcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
3509
3687
  if (!response) throw error;
3510
3688
  await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
3511
3689
  return;
@@ -3515,7 +3693,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3515
3693
  method: requestMethod,
3516
3694
  headers: docsHeaders,
3517
3695
  body: toRequestBody(workflowBody),
3518
- signal: _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3696
+ signal: _chunk7Q7UB4TLcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3519
3697
  })
3520
3698
  );
3521
3699
  if (workflowResponse) {
@@ -3525,7 +3703,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3525
3703
  }
3526
3704
  const configuredIntegrations = currentConfig.integrations;
3527
3705
  const tryConfiguredIntegrationRoute = async () => {
3528
- const matchedRoute = _chunkJX5VOLAVcjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
3706
+ const matchedRoute = _chunk6DBBMQWTcjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
3529
3707
  pathname: requestPathname,
3530
3708
  method: requestMethod
3531
3709
  });
@@ -3539,8 +3717,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3539
3717
  await pm.runHookParallelFiltered(
3540
3718
  "beforeRequest",
3541
3719
  (plugin2) => {
3542
- const owner = _chunkJX5VOLAVcjs.getFarmIntegrationPluginOwner.call(void 0, plugin2);
3543
- return !isFarmConfigRoutePlugin(plugin2) && (_optionalChain([owner, 'optionalAccess', _269 => _269.source]) !== "lifecycle" || owner.key !== matchedRoute.key);
3720
+ const owner = _chunk6DBBMQWTcjs.getFarmIntegrationPluginOwner.call(void 0, plugin2);
3721
+ return !isFarmConfigRoutePlugin(plugin2) && (_optionalChain([owner, 'optionalAccess', _266 => _266.source]) !== "lifecycle" || owner.key !== matchedRoute.key);
3544
3722
  },
3545
3723
  req,
3546
3724
  res
@@ -3559,17 +3737,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3559
3737
  }
3560
3738
  let body;
3561
3739
  if (req.method !== "GET" && req.method !== "HEAD") {
3562
- body = await _chunkCFG4QERRcjs.readNodeRequestBody.call(void 0, req, currentServerConfig.bodySizeLimit);
3740
+ body = await _chunk7Q7UB4TLcjs.readNodeRequestBody.call(void 0, req, currentServerConfig.bodySizeLimit);
3563
3741
  }
3564
3742
  const integrationRequest = new Request(fullUrl, {
3565
3743
  method: req.method,
3566
3744
  headers,
3567
3745
  body: toRequestBody(body),
3568
- signal: _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3746
+ signal: _chunk7Q7UB4TLcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3569
3747
  });
3570
3748
  const dispatchIntegration = async (request, runtime) => {
3571
3749
  try {
3572
- const result = await _chunkJX5VOLAVcjs.dispatchIntegrationRequest.call(void 0,
3750
+ const result = await _chunk6DBBMQWTcjs.dispatchIntegrationRequest.call(void 0,
3573
3751
  {
3574
3752
  integration: matchedRoute.integration,
3575
3753
  config: currentConfig,
@@ -3577,16 +3755,16 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3577
3755
  isProd: false
3578
3756
  },
3579
3757
  request,
3580
- { clientAddress: _optionalChain([req, 'access', _270 => _270.socket, 'optionalAccess', _271 => _271.remoteAddress]) }
3758
+ { clientAddress: _optionalChain([req, 'access', _267 => _267.socket, 'optionalAccess', _268 => _268.remoteAddress]) }
3581
3759
  );
3582
3760
  if (!result) {
3583
3761
  throw new Error(`Matched integration route did not return a response`);
3584
3762
  }
3585
3763
  return result;
3586
3764
  } catch (error) {
3587
- _chunkQMNWKQL4cjs.logger.error(`Integration route error: ${error}`);
3588
- await _optionalChain([runtime, 'optionalAccess', _272 => _272.reportError, 'call', _273 => _273(error)]);
3589
- return _chunkXGTFLG73cjs.createFarmInternalServerErrorResponse.call(void 0, );
3765
+ _chunkGC5ROI3Acjs.logger.error(`Integration route error: ${error}`);
3766
+ await _optionalChain([runtime, 'optionalAccess', _269 => _269.reportError, 'call', _270 => _270(error)]);
3767
+ return _chunk4VLXQ55Ocjs.createFarmInternalServerErrorResponse.call(void 0, );
3590
3768
  }
3591
3769
  };
3592
3770
  runtimeReportsErrors = Boolean(pm);
@@ -3605,7 +3783,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3605
3783
  await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
3606
3784
  return true;
3607
3785
  } catch (error) {
3608
- const bodyErrorResponse = _chunkCFG4QERRcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
3786
+ const bodyErrorResponse = _chunk7Q7UB4TLcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
3609
3787
  if (bodyErrorResponse) {
3610
3788
  await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3611
3789
  return true;
@@ -3620,32 +3798,32 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3620
3798
  integration: matchedRoute.key
3621
3799
  });
3622
3800
  }
3623
- _chunkQMNWKQL4cjs.logger.error(`Integration route error: ${error}`);
3801
+ _chunkGC5ROI3Acjs.logger.error(`Integration route error: ${error}`);
3624
3802
  if (runtimeReportsErrors) {
3625
3803
  if (!res.headersSent) sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
3626
3804
  else if (!res.writableEnded) res.end();
3627
3805
  } else if (!res.writableEnded) {
3628
3806
  res.statusCode = 500;
3629
3807
  res.setHeader("Content-Type", "application/json");
3630
- res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
3808
+ res.end(_chunk4VLXQ55Ocjs.FARM_INTERNAL_SERVER_ERROR_BODY);
3631
3809
  }
3632
3810
  return true;
3633
3811
  }
3634
3812
  };
3635
- if (pm && configRewriteSource === void 0 && configRoutePlugins.has(_chunkMBCRWU3Pcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME)) {
3813
+ if (pm && configRewriteSource === void 0 && configRoutePlugins.has(_chunkH7OFZJCVcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME)) {
3636
3814
  const hasLocalDevRoute = () => {
3637
3815
  const routeManager3 = farmApp.getRouteManager();
3638
3816
  return Boolean(
3639
- _chunkJX5VOLAVcjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
3817
+ _chunk6DBBMQWTcjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
3640
3818
  pathname: requestPathname,
3641
3819
  method: requestMethod
3642
- }) || routeManager3.matchRedirect(requestPathname) || apiRouteManager.matchRoute(requestPathname) || farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _274 => _274.isFarmDocsAPIRequest, 'call', _275 => _275(requestPathname)]) || routeManager3.matchRoute(requestPathname).route || routeManager3.matchMetadataRoute(requestPathname) || routeManager3.matchMetadataImage(requestPathname)
3820
+ }) || routeManager3.matchRedirect(requestPathname) || apiRouteManager.matchRoute(requestPathname) || farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _271 => _271.isFarmDocsAPIRequest, 'call', _272 => _272(requestPathname)]) || routeManager3.matchRoute(requestPathname).route || routeManager3.matchMetadataRoute(requestPathname) || routeManager3.matchMetadataImage(requestPathname)
3643
3821
  );
3644
3822
  };
3645
3823
  try {
3646
3824
  await pm.runHookParallelFiltered(
3647
3825
  "beforeRequest",
3648
- (plugin2) => plugin2.name === _chunkMBCRWU3Pcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME,
3826
+ (plugin2) => plugin2.name === _chunkH7OFZJCVcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME,
3649
3827
  req,
3650
3828
  res
3651
3829
  );
@@ -3673,11 +3851,11 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3673
3851
  }
3674
3852
  const matchedApiRoute = apiRouteManager.matchRoute(requestPathname);
3675
3853
  const hasMatchedApiRoute = Boolean(matchedApiRoute);
3676
- if (hasMatchedApiRoute || _chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath)) {
3854
+ if (hasMatchedApiRoute || _chunk4VLXQ55Ocjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath)) {
3677
3855
  const startTime2 = Date.now();
3678
3856
  const method2 = req.method || "GET";
3679
3857
  const urlPath2 = req.url || "/";
3680
- const pathname2 = _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, {
3858
+ const pathname2 = _chunk2RSVYJT6cjs.resolveFarmRequestURL.call(void 0, req, {
3681
3859
  trustProxy: currentServerConfig.trustProxy
3682
3860
  }).pathname;
3683
3861
  try {
@@ -3699,10 +3877,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3699
3877
  urlPath: urlPath2,
3700
3878
  method: method2
3701
3879
  });
3702
- _chunkQMNWKQL4cjs.logger.error(`Request hook error: ${error}`);
3880
+ _chunkGC5ROI3Acjs.logger.error(`Request hook error: ${error}`);
3703
3881
  res.statusCode = 500;
3704
3882
  res.setHeader("Content-Type", "application/json");
3705
- res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
3883
+ res.end(_chunk4VLXQ55Ocjs.FARM_INTERNAL_SERVER_ERROR_BODY);
3706
3884
  return;
3707
3885
  }
3708
3886
  const createAPIRequest = async () => {
@@ -3714,25 +3892,30 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3714
3892
  }
3715
3893
  let body;
3716
3894
  if (req.method !== "GET" && req.method !== "HEAD") {
3717
- body = await _chunkCFG4QERRcjs.readNodeRequestBody.call(void 0, req, currentServerConfig.bodySizeLimit);
3895
+ body = await _chunk7Q7UB4TLcjs.readNodeRequestBody.call(void 0, req, currentServerConfig.bodySizeLimit);
3718
3896
  }
3719
- return new Request(`http://${req.headers.host || "localhost:3000"}${req.url}`, {
3720
- method: req.method,
3721
- headers,
3722
- body: toRequestBody(body),
3723
- signal: _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3724
- });
3897
+ return new Request(
3898
+ _chunk2RSVYJT6cjs.resolveFarmRequestURL.call(void 0, req, {
3899
+ trustProxy: currentServerConfig.trustProxy
3900
+ }),
3901
+ {
3902
+ method: req.method,
3903
+ headers,
3904
+ body: toRequestBody(body),
3905
+ signal: _chunk7Q7UB4TLcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3906
+ }
3907
+ );
3725
3908
  };
3726
3909
  const isDocsAPIRequest = Boolean(
3727
- farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _276 => _276.isFarmDocsAPIRequest, 'call', _277 => _277(pathname2)])
3910
+ farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _273 => _273.isFarmDocsAPIRequest, 'call', _274 => _274(pathname2)])
3728
3911
  );
3729
3912
  const docsRuntimeOptions = () => ({
3730
3913
  kind: "docs",
3731
- route: _chunk4YHGQDTTcjs.setFarmRouteLabel.call(void 0,
3914
+ route: _chunkWJ5CCQBMcjs.setFarmRouteLabel.call(void 0,
3732
3915
  { pathname: pathname2, pattern: urlPath2 },
3733
- _chunk4YHGQDTTcjs.resolveFarmDocsRouteLabel.call(void 0, pathname2, {
3734
- path: _optionalChain([farmConfig, 'access', _278 => _278.docs, 'optionalAccess', _279 => _279.entry]) || "/docs",
3735
- roots: _optionalChain([farmConfig, 'access', _280 => _280.docs, 'optionalAccess', _281 => _281.roots, 'optionalAccess', _282 => _282.map, 'call', _283 => _283((root) => root.entry)])
3916
+ _chunkWJ5CCQBMcjs.resolveFarmDocsRouteLabel.call(void 0, pathname2, {
3917
+ path: _optionalChain([farmConfig, 'access', _275 => _275.docs, 'optionalAccess', _276 => _276.entry]) || "/docs",
3918
+ roots: _optionalChain([farmConfig, 'access', _277 => _277.docs, 'optionalAccess', _278 => _278.roots, 'optionalAccess', _279 => _279.map, 'call', _280 => _280((root) => root.entry)])
3736
3919
  })
3737
3920
  )
3738
3921
  });
@@ -3757,7 +3940,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3757
3940
  return;
3758
3941
  }
3759
3942
  } catch (error) {
3760
- const bodyErrorResponse = _chunkCFG4QERRcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
3943
+ const bodyErrorResponse = _chunk7Q7UB4TLcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
3761
3944
  if (bodyErrorResponse) {
3762
3945
  logResponse(
3763
3946
  method2,
@@ -3769,7 +3952,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3769
3952
  await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3770
3953
  return;
3771
3954
  }
3772
- _chunkQMNWKQL4cjs.logger.error(`API route error: ${error}`);
3955
+ _chunkGC5ROI3Acjs.logger.error(`API route error: ${error}`);
3773
3956
  sendFarmDevRuntimeHookError(res, true);
3774
3957
  return;
3775
3958
  }
@@ -3789,7 +3972,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3789
3972
  if (runtimeSession2) await pm.failRuntimeRequest(runtimeSession2, error);
3790
3973
  throw error;
3791
3974
  }
3792
- _chunkQMNWKQL4cjs.logger.error(`Middleware error: ${error}`);
3975
+ _chunkGC5ROI3Acjs.logger.error(`Middleware error: ${error}`);
3793
3976
  const status = await sendMiddlewareErrorJSON(runtimeSession2, error);
3794
3977
  logResponse(method2, urlPath2, status, Date.now() - startTime2, "API");
3795
3978
  return;
@@ -3807,14 +3990,14 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3807
3990
  (_request, runtime) => handler(request, runtime)
3808
3991
  ) : pm ? pm.runRuntimeRequest(request, handler, options2) : handler(request);
3809
3992
  const apiHandler = apiRouteManager.getHandler({ throwOnError: true });
3810
- const routedPathname = _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, {
3993
+ const routedPathname = _chunk2RSVYJT6cjs.resolveFarmRequestURL.call(void 0, req, {
3811
3994
  trustProxy: currentServerConfig.trustProxy
3812
3995
  }).pathname;
3813
3996
  const rewritten = routedPathname !== pathname2;
3814
3997
  const routedApiRoute = rewritten ? apiRouteManager.matchRoute(routedPathname) : matchedApiRoute || apiRouteManager.matchRoute(pathname2);
3815
3998
  const hasExplicitAPIRoute = Boolean(routedApiRoute);
3816
3999
  if (apiHandler && hasExplicitAPIRoute) {
3817
- const apiRoutePattern = _optionalChain([routedApiRoute, 'optionalAccess', _284 => _284.route, 'access', _285 => _285.path]) || urlPath2;
4000
+ const apiRoutePattern = _optionalChain([routedApiRoute, 'optionalAccess', _281 => _281.route, 'access', _282 => _282.path]) || urlPath2;
3818
4001
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
3819
4002
  type: "route.matched",
3820
4003
  pathname: pathname2,
@@ -3863,9 +4046,9 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3863
4046
  durationMs: Date.now() - startTime2,
3864
4047
  error
3865
4048
  });
3866
- _chunkQMNWKQL4cjs.logger.error(`API route error: ${error}`);
3867
- await _optionalChain([runtime, 'optionalAccess', _286 => _286.reportError, 'call', _287 => _287(error)]);
3868
- response = _chunkXGTFLG73cjs.createFarmInternalServerErrorResponse.call(void 0, );
4049
+ _chunkGC5ROI3Acjs.logger.error(`API route error: ${error}`);
4050
+ await _optionalChain([runtime, 'optionalAccess', _283 => _283.reportError, 'call', _284 => _284(error)]);
4051
+ response = _chunk4VLXQ55Ocjs.createFarmInternalServerErrorResponse.call(void 0, );
3869
4052
  }
3870
4053
  return pm ? await pm.runHookSerial("afterApiHandler", response, apiLifecyclePayload) : response;
3871
4054
  };
@@ -3892,13 +4075,13 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3892
4075
  error
3893
4076
  });
3894
4077
  }
3895
- const bodyErrorResponse = _chunkCFG4QERRcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
4078
+ const bodyErrorResponse = _chunk7Q7UB4TLcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
3896
4079
  if (bodyErrorResponse) {
3897
4080
  logResponse(method2, urlPath2, bodyErrorResponse.status, duration, "API");
3898
4081
  await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3899
4082
  return;
3900
4083
  }
3901
- _chunkQMNWKQL4cjs.logger.error(`API route error: ${error}`);
4084
+ _chunkGC5ROI3Acjs.logger.error(`API route error: ${error}`);
3902
4085
  sendFarmDevRuntimeHookError(res, true);
3903
4086
  return;
3904
4087
  }
@@ -3935,12 +4118,12 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3935
4118
  return;
3936
4119
  }
3937
4120
  } catch (error) {
3938
- const bodyErrorResponse = _chunkCFG4QERRcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
4121
+ const bodyErrorResponse = _chunk7Q7UB4TLcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
3939
4122
  if (bodyErrorResponse) {
3940
4123
  await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3941
4124
  return;
3942
4125
  }
3943
- _chunkQMNWKQL4cjs.logger.error(`Docs API route error: ${error}`);
4126
+ _chunkGC5ROI3Acjs.logger.error(`Docs API route error: ${error}`);
3944
4127
  sendFarmDevRuntimeHookError(res, true);
3945
4128
  return;
3946
4129
  }
@@ -3964,17 +4147,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3964
4147
  logResponse(method2, urlPath2, response.status, Date.now() - startTime2, "API");
3965
4148
  await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
3966
4149
  } catch (error) {
3967
- _chunkQMNWKQL4cjs.logger.error(`API route error: ${error}`);
4150
+ _chunkGC5ROI3Acjs.logger.error(`API route error: ${error}`);
3968
4151
  sendFarmDevRuntimeHookError(res, true);
3969
4152
  }
3970
4153
  return;
3971
4154
  }
3972
- if (_optionalChain([req, 'access', _288 => _288.url, 'optionalAccess', _289 => _289.startsWith, 'call', _290 => _290("/@")]) || _optionalChain([req, 'access', _291 => _291.url, 'optionalAccess', _292 => _292.startsWith, 'call', _293 => _293("/node_modules")])) {
4155
+ if (_optionalChain([req, 'access', _285 => _285.url, 'optionalAccess', _286 => _286.startsWith, 'call', _287 => _287("/@")]) || _optionalChain([req, 'access', _288 => _288.url, 'optionalAccess', _289 => _289.startsWith, 'call', _290 => _290("/node_modules")])) {
3973
4156
  return next();
3974
4157
  }
3975
4158
  if (!deferredDottedRequests.has(req) && shouldBypassFarmRouterForDottedPath(
3976
4159
  requestPathname,
3977
- _optionalChain([farmApp, 'optionalAccess', _294 => _294.getRouteManager, 'call', _295 => _295()]),
4160
+ _optionalChain([farmApp, 'optionalAccess', _291 => _291.getRouteManager, 'call', _292 => _292()]),
3978
4161
  [server.config.publicDir, server.config.root],
3979
4162
  farmAgentGeneratedPaths(farmConfig),
3980
4163
  requestMethod
@@ -3982,7 +4165,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3982
4165
  if (!viteModuleRequest) deferredDottedRequests.set(req, requestUrl);
3983
4166
  return next();
3984
4167
  }
3985
- if (_optionalChain([req, 'access', _296 => _296.url, 'optionalAccess', _297 => _297.startsWith, 'call', _298 => _298("/__farm/page-data")])) {
4168
+ if (_optionalChain([req, 'access', _293 => _293.url, 'optionalAccess', _294 => _294.startsWith, 'call', _295 => _295("/__farm/page-data")])) {
3986
4169
  const urlObj = parsedRequestUrl;
3987
4170
  const targetPath = urlObj.searchParams.get("path") || "/";
3988
4171
  let renderedRequest;
@@ -3990,7 +4173,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3990
4173
  const request = createRequestFromNodeRequest(
3991
4174
  req,
3992
4175
  urlObj,
3993
- _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
4176
+ _chunk7Q7UB4TLcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3994
4177
  );
3995
4178
  const deploymentMismatch = _chunkNLBHLPEOcjs.getFarmDeploymentMismatch.call(void 0,
3996
4179
  request,
@@ -4012,7 +4195,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4012
4195
  renderedRequest = targetRequest;
4013
4196
  let middlewareMap = /* @__PURE__ */ new Map();
4014
4197
  let middlewareContext = /* @__PURE__ */ new Map();
4015
- if (_optionalChain([middlewareManager, 'optionalAccess', _299 => _299.hasMiddleware, 'call', _300 => _300()])) {
4198
+ if (_optionalChain([middlewareManager, 'optionalAccess', _296 => _296.hasMiddleware, 'call', _297 => _297()])) {
4016
4199
  const targetNodeRequest = createPageDataMiddlewareRequest(req, targetRequestUrl);
4017
4200
  const targetNodeResponse = createPageDataMiddlewareResponse(res);
4018
4201
  const handled = await runFarmMiddlewareWithNavigation(
@@ -4046,10 +4229,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4046
4229
  if (pm) {
4047
4230
  await pm.runHookParallel("afterRouteMatch", {
4048
4231
  pathname: targetPath,
4049
- matched: !!_optionalChain([match, 'optionalAccess', _301 => _301.route]),
4050
- routePattern: _optionalChain([match, 'optionalAccess', _302 => _302.route, 'optionalAccess', _303 => _303.pattern]) || null,
4051
- params: _optionalChain([match, 'optionalAccess', _304 => _304.params]) || {},
4052
- layoutPatterns: (_optionalChain([match, 'optionalAccess', _305 => _305.layouts]) || []).map((l) => l.pattern)
4232
+ matched: !!_optionalChain([match, 'optionalAccess', _298 => _298.route]),
4233
+ routePattern: _optionalChain([match, 'optionalAccess', _299 => _299.route, 'optionalAccess', _300 => _300.pattern]) || null,
4234
+ params: _optionalChain([match, 'optionalAccess', _301 => _301.params]) || {},
4235
+ layoutPatterns: (_optionalChain([match, 'optionalAccess', _302 => _302.layouts]) || []).map((l) => l.pattern)
4053
4236
  });
4054
4237
  }
4055
4238
  if (!match) {
@@ -4065,6 +4248,18 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4065
4248
  res.end(JSON.stringify({ error: "Route not found" }));
4066
4249
  return;
4067
4250
  }
4251
+ const trailingSlashLocation = _chunkDVJM55D2cjs.resolveFarmTrailingSlashRedirect.call(void 0,
4252
+ targetRequestUrl,
4253
+ farmApp.getConfig().trailingSlash === true
4254
+ );
4255
+ if (trailingSlashLocation) {
4256
+ await sendFarmPageDataRedirect(
4257
+ res,
4258
+ { location: trailingSlashLocation, status: 308 },
4259
+ farmConfig.deploymentId
4260
+ );
4261
+ return;
4262
+ }
4068
4263
  const routeModule = await routeManager3.loadRouteModule(route.modulePath);
4069
4264
  const loadingBoundary = routeManager3.getMatchingLoading(
4070
4265
  targetRequestUrl.pathname,
@@ -4072,7 +4267,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4072
4267
  );
4073
4268
  const loadingModule = loadingBoundary ? await routeManager3.loadRouteModule(loadingBoundary.modulePath) : null;
4074
4269
  const navigationManifest = routeManager3.generateClientManifest(server.config.root);
4075
- const moduleMetadata = _nullishCoalesce(navigationManifest.routes.find((entry) => entry.pattern === route.pattern), () => ( _chunkHTXKSREFcjs.getClientModuleMetadata.call(void 0, route.modulePath, server.config.root)));
4270
+ const moduleMetadata = _nullishCoalesce(navigationManifest.routes.find((entry) => entry.pattern === route.pattern), () => ( _chunkJNZDTE75cjs.getClientModuleMetadata.call(void 0, route.modulePath, server.config.root)));
4076
4271
  const isClientComponent = moduleMetadata.isClientComponent;
4077
4272
  const shouldHydrate = moduleMetadata.shouldHydrate;
4078
4273
  let mergedMetadata = {};
@@ -4080,7 +4275,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4080
4275
  layouts.map((layout) => routeManager3.loadLayoutModule(layout.modulePath))
4081
4276
  );
4082
4277
  const layoutHydrationMetadata = layouts.map(
4083
- (layout) => _nullishCoalesce(navigationManifest.layouts.find((entry) => entry.pattern === layout.pattern), () => ( _chunkHTXKSREFcjs.getClientModuleMetadata.call(void 0, layout.modulePath, server.config.root)))
4278
+ (layout) => _nullishCoalesce(navigationManifest.layouts.find((entry) => entry.pattern === layout.pattern), () => ( _chunkJNZDTE75cjs.getClientModuleMetadata.call(void 0, layout.modulePath, server.config.root)))
4084
4279
  );
4085
4280
  const shouldHydrateLayout = layoutHydrationMetadata.some(
4086
4281
  (metadata) => metadata.shouldHydrate
@@ -4092,17 +4287,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4092
4287
  )
4093
4288
  ];
4094
4289
  const hydrationIslandStrategy = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0,
4095
- _optionalChain([(_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _306 => _306.getConfig, 'call', _307 => _307()]), () => ( options))), 'access', _308 => _308.experimental, 'optionalAccess', _309 => _309.serverComponents])
4096
- ) === "islands" ? _chunkTAU3OF5Bcjs.resolveFarmRouteRootStrategy.call(void 0,
4290
+ _optionalChain([(_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _303 => _303.getConfig, 'call', _304 => _304()]), () => ( options))), 'access', _305 => _305.experimental, 'optionalAccess', _306 => _306.serverComponents])
4291
+ ) === "islands" ? _chunkIK33N2ANcjs.resolveFarmRouteRootStrategy.call(void 0,
4097
4292
  route,
4098
4293
  { shouldHydrate, islandStrategy: _nullishCoalesce(moduleMetadata.islandStrategy, () => ( null)) },
4099
4294
  layouts.map((layout, index) => ({
4100
4295
  pattern: layout.pattern,
4101
4296
  modulePath: layout.modulePath,
4102
- shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _310 => _310[index], 'optionalAccess', _311 => _311.shouldHydrate]) === true,
4297
+ shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _307 => _307[index], 'optionalAccess', _308 => _308.shouldHydrate]) === true,
4103
4298
  // Manifest entries carry it; metadata read from source does not.
4104
- hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access', _312 => _312[index], 'optionalAccess', _313 => _313.hasIsolatedClientBoundaries]) === true,
4105
- islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _314 => _314[index], 'optionalAccess', _315 => _315.islandStrategy]), () => ( null))
4299
+ hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access', _309 => _309[index], 'optionalAccess', _310 => _310.hasIsolatedClientBoundaries]) === true,
4300
+ islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _311 => _311[index], 'optionalAccess', _312 => _312.islandStrategy]), () => ( null))
4106
4301
  })),
4107
4302
  server.config.root,
4108
4303
  true
@@ -4129,28 +4324,28 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4129
4324
  routePath: route.pattern
4130
4325
  });
4131
4326
  for (const layoutModule of layoutModules) {
4132
- mergedMetadata = _chunk6IOZPJ3Icjs.mergeMetadata.call(void 0, mergedMetadata, layoutModule.metadata);
4327
+ mergedMetadata = _chunkY3DO7BIJcjs.mergeMetadata.call(void 0, mergedMetadata, layoutModule.metadata);
4133
4328
  if (typeof layoutModule.generateMetadata === "function") {
4134
- mergedMetadata = _chunk6IOZPJ3Icjs.mergeMetadata.call(void 0,
4329
+ mergedMetadata = _chunkY3DO7BIJcjs.mergeMetadata.call(void 0,
4135
4330
  mergedMetadata,
4136
4331
  await layoutModule.generateMetadata({ params: routeProps.params })
4137
4332
  );
4138
4333
  }
4139
- mergedMetadata = await _chunk6IOZPJ3Icjs.mergeModuleViewport.call(void 0, mergedMetadata, layoutModule, {
4334
+ mergedMetadata = await _chunkY3DO7BIJcjs.mergeModuleViewport.call(void 0, mergedMetadata, layoutModule, {
4140
4335
  params: routeProps.params
4141
4336
  });
4142
4337
  }
4143
- mergedMetadata = _chunk6IOZPJ3Icjs.mergeMetadata.call(void 0, mergedMetadata, routeModule.metadata);
4338
+ mergedMetadata = _chunkY3DO7BIJcjs.mergeMetadata.call(void 0, mergedMetadata, routeModule.metadata);
4144
4339
  if (typeof routeModule.generateMetadata === "function") {
4145
- mergedMetadata = _chunk6IOZPJ3Icjs.mergeMetadata.call(void 0,
4340
+ mergedMetadata = _chunkY3DO7BIJcjs.mergeMetadata.call(void 0,
4146
4341
  mergedMetadata,
4147
4342
  await routeModule.generateMetadata(routeProps)
4148
4343
  );
4149
4344
  }
4150
- mergedMetadata = await _chunk6IOZPJ3Icjs.mergeModuleViewport.call(void 0, mergedMetadata, routeModule, routeProps);
4151
- mergedMetadata = _chunk6IOZPJ3Icjs.addMetadataMarkdownAlternate.call(void 0,
4345
+ mergedMetadata = await _chunkY3DO7BIJcjs.mergeModuleViewport.call(void 0, mergedMetadata, routeModule, routeProps);
4346
+ mergedMetadata = _chunkY3DO7BIJcjs.addMetadataMarkdownAlternate.call(void 0,
4152
4347
  mergedMetadata,
4153
- _chunkHGB4PM2Ccjs.getFarmMarkdownAlternatePath.call(void 0, farmApp.getConfig().md, targetRequestUrl.pathname, {
4348
+ _chunk2YJ4DHTDcjs.getFarmMarkdownAlternatePath.call(void 0, farmApp.getConfig().md, targetRequestUrl.pathname, {
4154
4349
  routePathname: (pathname2) => routeManager3.toRoutePathname(pathname2)
4155
4350
  })
4156
4351
  );
@@ -4159,7 +4354,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4159
4354
  const slotModule = await routeManager3.loadRouteModule(slot.route.modulePath);
4160
4355
  const slotMetadata = _nullishCoalesce(navigationManifest.slots.find(
4161
4356
  (entry) => entry.name === slot.name && entry.ownerPattern === slot.ownerPattern && entry.pattern === slot.route.pattern
4162
- ), () => ( _chunkHTXKSREFcjs.getClientModuleMetadata.call(void 0, slot.route.modulePath, server.config.root)));
4357
+ ), () => ( _chunkJNZDTE75cjs.getClientModuleMetadata.call(void 0, slot.route.modulePath, server.config.root)));
4163
4358
  const slotContext = await _chunkX333W5KVcjs.resolveFarmRouteContext.call(void 0, farmApp.getConfig(), {
4164
4359
  request: targetRequest,
4165
4360
  params: slot.params,
@@ -4204,16 +4399,16 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4204
4399
  })
4205
4400
  );
4206
4401
  const projectRoot = server.config.root;
4207
- const toUrlPath = (absolutePath) => _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, absolutePath, projectRoot);
4208
- const renderPlan = _chunkPXAHSCR6cjs.createFarmRouteRenderPlan.call(void 0, {
4402
+ const toUrlPath = (absolutePath) => _chunkGC5ROI3Acjs.toViteModuleId.call(void 0, absolutePath, projectRoot);
4403
+ const renderPlan = _chunkXGDI4OUBcjs.createFarmRouteRenderPlan.call(void 0, {
4209
4404
  pageShouldHydrate: shouldHydrate,
4210
4405
  layoutShouldHydrate: shouldHydrateLayout,
4211
4406
  islandStrategy: hydrationIslandStrategy,
4212
- rendering: _chunkCLEWORVYcjs.resolveRouteRenderingConfig.call(void 0, routeModule)
4407
+ rendering: _chunk7564NP5Zcjs.resolveRouteRenderingConfig.call(void 0, routeModule)
4213
4408
  });
4214
4409
  const destinationLayoutPatterns = layouts.map((layout) => layout.pattern);
4215
- const layoutStartIndex = _chunkPXAHSCR6cjs.getSharedLayoutPrefixLength.call(void 0,
4216
- _chunkPXAHSCR6cjs.parseFarmLayoutChainHeader.call(void 0, request.headers.get("x-farm-layout-chain")),
4410
+ const layoutStartIndex = _chunkXGDI4OUBcjs.getSharedLayoutPrefixLength.call(void 0,
4411
+ _chunkXGDI4OUBcjs.parseFarmLayoutChainHeader.call(void 0, request.headers.get("x-farm-layout-chain")),
4217
4412
  destinationLayoutPatterns
4218
4413
  );
4219
4414
  const renderer = farmApp.getServerRenderer();
@@ -4223,7 +4418,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4223
4418
  middlewareContext,
4224
4419
  () => renderer.renderNavigationFragment({
4225
4420
  PageComponent: routeModule.default,
4226
- LoadingComponent: _optionalChain([loadingModule, 'optionalAccess', _316 => _316.default]),
4421
+ LoadingComponent: _optionalChain([loadingModule, 'optionalAccess', _313 => _313.default]),
4227
4422
  pageProps: routeProps,
4228
4423
  params,
4229
4424
  layouts: layouts.map((layout, index) => ({
@@ -4285,7 +4480,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4285
4480
  from: interceptFromHeader,
4286
4481
  slots: routeSlots.filter((slot) => slot.interception).map((slot) => slot.name)
4287
4482
  } : void 0,
4288
- i18n: _chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0, )
4483
+ i18n: _chunkSXXSQVKKcjs.getFarmI18nClientSnapshot.call(void 0, )
4289
4484
  };
4290
4485
  await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
4291
4486
  res,
@@ -4294,7 +4489,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4294
4489
  {
4295
4490
  status: 200,
4296
4491
  headers: {
4297
- "Cache-Control": _chunkPXAHSCR6cjs.getFarmFragmentCacheControl.call(void 0, renderPlan),
4492
+ "Cache-Control": _chunkXGDI4OUBcjs.getFarmFragmentCacheControl.call(void 0, renderPlan),
4298
4493
  "X-Farm-Navigation": "html-fragment",
4299
4494
  Vary: "X-Farm-Layout-Chain",
4300
4495
  [_chunkNLBHLPEOcjs.FARM_DEPLOYMENT_ID_HEADER]: farmConfig.deploymentId
@@ -4302,7 +4497,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4302
4497
  },
4303
4498
  {
4304
4499
  onError(error, id) {
4305
- _chunkQMNWKQL4cjs.logger.error(`Deferred route data ${id} failed: ${error}`);
4500
+ _chunkGC5ROI3Acjs.logger.error(`Deferred route data ${id} failed: ${error}`);
4306
4501
  }
4307
4502
  }
4308
4503
  )
@@ -4332,33 +4527,33 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4332
4527
  const startTime = Date.now();
4333
4528
  const method = req.method || "GET";
4334
4529
  const urlPath = req.url || "/";
4335
- const requestedPathname = _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, {
4530
+ const requestedPathname = _chunk2RSVYJT6cjs.resolveFarmRequestURL.call(void 0, req, {
4336
4531
  trustProxy: currentServerConfig.trustProxy
4337
4532
  }).pathname;
4338
4533
  const routeManager2 = farmApp.getRouteManager();
4339
- const hasBeforeRequestHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _317 => _317.hasHook, 'call', _318 => _318("beforeRequest")]), () => ( false));
4340
- const hasAfterResponseHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _319 => _319.hasHook, 'call', _320 => _320("afterResponse")]), () => ( false));
4341
- const hasHTMLTransformHook = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _321 => _321.hasHook, 'call', _322 => _322("transformHTML")]), () => ( false))) || (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _323 => _323.hasHook, 'call', _324 => _324("afterRender")]), () => ( false)));
4534
+ const hasBeforeRequestHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _314 => _314.hasHook, 'call', _315 => _315("beforeRequest")]), () => ( false));
4535
+ const hasAfterResponseHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _316 => _316.hasHook, 'call', _317 => _317("afterResponse")]), () => ( false));
4536
+ const hasHTMLTransformHook = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _318 => _318.hasHook, 'call', _319 => _319("transformHTML")]), () => ( false))) || (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _320 => _320.hasHook, 'call', _321 => _321("afterRender")]), () => ( false)));
4342
4537
  const opensRuntimeSession = pm ? opensFarmDevRuntimeSession(pm) : false;
4343
- const hasRuntimeAfterHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _325 => _325.hasRuntimeHook, 'call', _326 => _326("after")]), () => ( false));
4538
+ const hasRuntimeAfterHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _322 => _322.hasRuntimeHook, 'call', _323 => _323("after")]), () => ( false));
4344
4539
  const pageBuiltInRouteLabel = (pathname2) => {
4345
4540
  const routePathname = _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, pathname2, farmConfig.basePath);
4346
- const mcpLabel = _chunk4YHGQDTTcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath);
4541
+ const mcpLabel = _chunkWJ5CCQBMcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath);
4347
4542
  if (mcpLabel) return mcpLabel;
4348
4543
  if (farmAgentGeneratedPaths(farmConfig).includes(routePathname)) return routePathname;
4349
- return routePathname === _chunkTU6VAH4Vcjs.FARM_DEFAULT_MCP_PATH && farmApp.getServerRenderer().getDefaultMCPServer() ? _chunkTU6VAH4Vcjs.FARM_DEFAULT_MCP_PATH : null;
4544
+ return routePathname === _chunkYRXPDKMMcjs.FARM_DEFAULT_MCP_PATH && farmApp.getServerRenderer().getDefaultMCPServer() ? _chunkYRXPDKMMcjs.FARM_DEFAULT_MCP_PATH : null;
4350
4545
  };
4351
4546
  const pageRuntimeOptions = (pathname2) => {
4352
4547
  const match = routeManager2.matchRoute(pathname2);
4353
4548
  return {
4354
4549
  kind: "page",
4355
- route: _chunk4YHGQDTTcjs.setFarmRouteLabel.call(void 0,
4550
+ route: _chunkWJ5CCQBMcjs.setFarmRouteLabel.call(void 0,
4356
4551
  {
4357
4552
  pathname: pathname2,
4358
- pattern: _optionalChain([match, 'optionalAccess', _327 => _327.route, 'optionalAccess', _328 => _328.pattern]) || null,
4359
- params: _optionalChain([match, 'optionalAccess', _329 => _329.params]) || {}
4553
+ pattern: _optionalChain([match, 'optionalAccess', _324 => _324.route, 'optionalAccess', _325 => _325.pattern]) || null,
4554
+ params: _optionalChain([match, 'optionalAccess', _326 => _326.params]) || {}
4360
4555
  },
4361
- _optionalChain([match, 'optionalAccess', _330 => _330.route]) ? null : pageBuiltInRouteLabel(pathname2)
4556
+ _optionalChain([match, 'optionalAccess', _327 => _327.route]) ? null : pageBuiltInRouteLabel(pathname2)
4362
4557
  )
4363
4558
  };
4364
4559
  };
@@ -4438,7 +4633,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4438
4633
  }) : void 0;
4439
4634
  let middlewareFailed = false;
4440
4635
  try {
4441
- if (_optionalChain([middlewareManager, 'optionalAccess', _331 => _331.hasMiddleware, 'call', _332 => _332()])) {
4636
+ if (_optionalChain([middlewareManager, 'optionalAccess', _328 => _328.hasMiddleware, 'call', _329 => _329()])) {
4442
4637
  const middlewareRequest = createRequestFromNodeRequest(req, new URL(fullUrl));
4443
4638
  const handled = await runFarmMiddlewareWithNavigation(
4444
4639
  farmApp.getServerRenderer(),
@@ -4451,7 +4646,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4451
4646
  throw error;
4452
4647
  });
4453
4648
  if (handled) {
4454
- if (!_optionalChain([responseInterceptor, 'optionalAccess', _333 => _333.isEnded, 'call', _334 => _334()])) {
4649
+ if (!_optionalChain([responseInterceptor, 'optionalAccess', _330 => _330.isEnded, 'call', _331 => _331()])) {
4455
4650
  const duration = Date.now() - startTime;
4456
4651
  logResponse(method, urlPath, res.statusCode || 200, duration, "PAGE");
4457
4652
  }
@@ -4466,8 +4661,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4466
4661
  res
4467
4662
  );
4468
4663
  }
4469
- if (res.writableEnded || _optionalChain([responseInterceptor, 'optionalAccess', _335 => _335.isEnded, 'call', _336 => _336()])) {
4470
- if (!_optionalChain([responseInterceptor, 'optionalAccess', _337 => _337.isEnded, 'call', _338 => _338()])) {
4664
+ if (res.writableEnded || _optionalChain([responseInterceptor, 'optionalAccess', _332 => _332.isEnded, 'call', _333 => _333()])) {
4665
+ if (!_optionalChain([responseInterceptor, 'optionalAccess', _334 => _334.isEnded, 'call', _335 => _335()])) {
4471
4666
  const duration = Date.now() - startTime;
4472
4667
  logResponse(method, urlPath, res.statusCode || 200, duration, "PAGE");
4473
4668
  }
@@ -4486,8 +4681,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4486
4681
  await pm.reportRuntimeRequestError(runtimeSession, error);
4487
4682
  } else {
4488
4683
  await pm.failRuntimeRequest(runtimeSession, error);
4489
- if (!res.headersSent && !_optionalChain([responseInterceptor, 'optionalAccess', _339 => _339.isEnded, 'call', _340 => _340()])) {
4490
- _optionalChain([responseInterceptor, 'optionalAccess', _341 => _341.release, 'call', _342 => _342()]);
4684
+ if (!res.headersSent && !_optionalChain([responseInterceptor, 'optionalAccess', _336 => _336.isEnded, 'call', _337 => _337()])) {
4685
+ _optionalChain([responseInterceptor, 'optionalAccess', _338 => _338.release, 'call', _339 => _339()]);
4491
4686
  console.error("[FARM] Page error:", error);
4492
4687
  sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
4493
4688
  return;
@@ -4504,7 +4699,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4504
4699
  }
4505
4700
  })
4506
4701
  );
4507
- const farmRequestMiddleware = _optionalChain([farmMiddlewares, 'access', _343 => _343.stack, 'access', _344 => _344.at, 'call', _345 => _345(-1), 'optionalAccess', _346 => _346.handle]);
4702
+ const farmRequestMiddleware = _optionalChain([farmMiddlewares, 'access', _340 => _340.stack, 'access', _341 => _341.at, 'call', _342 => _342(-1), 'optionalAccess', _343 => _343.handle]);
4508
4703
  if (farmOwnsDevCors && viteServer.config.server.cors === false) {
4509
4704
  farmMiddlewares.use(createFarmDevViteCorsMiddleware());
4510
4705
  }
@@ -4518,7 +4713,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4518
4713
  }
4519
4714
  if (!rendererDisabled) return next();
4520
4715
  const requested = _nullishCoalesce(_nullishCoalesce(req.originalUrl, () => ( req.url)), () => ( "/"));
4521
- const pathname = _chunkHDPT6OYEcjs.parseFarmRequestTarget.call(void 0, requested, "http://localhost").pathname;
4716
+ const pathname = _chunk2RSVYJT6cjs.parseFarmRequestTarget.call(void 0, requested, "http://localhost").pathname;
4522
4717
  res.statusCode = 404;
4523
4718
  res.setHeader("Content-Type", "application/json");
4524
4719
  res.end(JSON.stringify({ error: "Not found", pathname }));
@@ -4533,7 +4728,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4533
4728
  });
4534
4729
  }
4535
4730
  if (id.startsWith("@farm.js/core/internal/") && importer && isOutsideAppRoot(importer)) {
4536
- const root = _optionalChain([farmApp, 'optionalAccess', _347 => _347.getConfig, 'call', _348 => _348(), 'access', _349 => _349.root]) || _optionalChain([server, 'optionalAccess', _350 => _350.config, 'access', _351 => _351.root]) || options.root;
4731
+ const root = _optionalChain([farmApp, 'optionalAccess', _344 => _344.getConfig, 'call', _345 => _345(), 'access', _346 => _346.root]) || _optionalChain([server, 'optionalAccess', _347 => _347.config, 'access', _348 => _348.root]) || options.root;
4537
4732
  return this.resolve(id, path6.join(root, "package.json"), {
4538
4733
  ...resolveOptions,
4539
4734
  skipSelf: true
@@ -4547,7 +4742,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4547
4742
  const imageId = await imageImports.resolveId.call(this, id, importer, resolveOptions);
4548
4743
  if (imageId) return imageId;
4549
4744
  }
4550
- if (_chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
4745
+ if (_chunkYUCU6XB4cjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
4551
4746
  return id;
4552
4747
  }
4553
4748
  if (isFarmClientVirtualId(id) || id === FARM_DEV_CLIENT_BOOT_ID) {
@@ -4561,7 +4756,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4561
4756
  }
4562
4757
  },
4563
4758
  async load(id, loadOptions) {
4564
- if (pendingClientSetup && !_optionalChain([loadOptions, 'optionalAccess', _352 => _352.ssr]) && !farmSetupContext.getStore()) {
4759
+ if (pendingClientSetup && !_optionalChain([loadOptions, 'optionalAccess', _349 => _349.ssr]) && !farmSetupContext.getStore()) {
4565
4760
  await pendingClientSetup;
4566
4761
  }
4567
4762
  if (_chunkPIUTGRDIcjs.isFarmServerFnBoundaryId.call(void 0, id) && islandsServerFns()) {
@@ -4578,9 +4773,9 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4578
4773
  const imageModule = await imageImports.load.call(this, id);
4579
4774
  if (imageModule) return imageModule;
4580
4775
  }
4581
- if (_chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
4582
- const renderer = _optionalChain([farmApp, 'optionalAccess', _353 => _353.getConfig, 'call', _354 => _354(), 'access', _355 => _355.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
4583
- const root = _optionalChain([server, 'optionalAccess', _356 => _356.config, 'access', _357 => _357.root]) || options.root;
4776
+ if (_chunkYUCU6XB4cjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
4777
+ const renderer = _optionalChain([farmApp, 'optionalAccess', _350 => _350.getConfig, 'call', _351 => _351(), 'access', _352 => _352.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
4778
+ const root = _optionalChain([server, 'optionalAccess', _353 => _353.config, 'access', _354 => _354.root]) || options.root;
4584
4779
  if (isClientEnvironment(this, loadOptions)) {
4585
4780
  return generateProgrammaticClientRouteModuleForId(
4586
4781
  id,
@@ -4596,65 +4791,65 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4596
4791
  return FARM_DEV_CLIENT_BOOT_MODULE;
4597
4792
  }
4598
4793
  if (isFarmClientVirtualId(id)) {
4599
- const resolvedConfig = _optionalChain([farmApp, 'optionalAccess', _358 => _358.getConfig, 'call', _359 => _359()]);
4600
- const renderer = _optionalChain([resolvedConfig, 'optionalAccess', _360 => _360.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
4601
- const integrations = _optionalChain([resolvedConfig, 'optionalAccess', _361 => _361.integrations]) || options.integrations;
4602
- const root = _optionalChain([resolvedConfig, 'optionalAccess', _362 => _362.root]) || _optionalChain([server, 'optionalAccess', _363 => _363.config, 'access', _364 => _364.root]) || process.cwd();
4603
- const docs = _optionalChain([resolvedConfig, 'optionalAccess', _365 => _365.docs]);
4794
+ const resolvedConfig = _optionalChain([farmApp, 'optionalAccess', _355 => _355.getConfig, 'call', _356 => _356()]);
4795
+ const renderer = _optionalChain([resolvedConfig, 'optionalAccess', _357 => _357.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
4796
+ const integrations = _optionalChain([resolvedConfig, 'optionalAccess', _358 => _358.integrations]) || options.integrations;
4797
+ const root = _optionalChain([resolvedConfig, 'optionalAccess', _359 => _359.root]) || _optionalChain([server, 'optionalAccess', _360 => _360.config, 'access', _361 => _361.root]) || process.cwd();
4798
+ const docs = _optionalChain([resolvedConfig, 'optionalAccess', _362 => _362.docs]);
4604
4799
  const adapterOwnsDocsRuntime = Boolean(
4605
- _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([docs, 'optionalAccess', _366 => _366.adapter, 'optionalAccess', _367 => _367.server]) && docs.adapter.react
4800
+ _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([docs, 'optionalAccess', _363 => _363.adapter, 'optionalAccess', _364 => _364.server]) && docs.adapter.react
4606
4801
  );
4607
- const devtools = _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _368 => _368.devtools]), () => ( _chunkSTF6VDYQcjs.resolveFarmDevtoolsConfig.call(void 0, false, "production")));
4802
+ const devtools = _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _365 => _365.devtools]), () => ( _chunkSTF6VDYQcjs.resolveFarmDevtoolsConfig.call(void 0, false, "production")));
4608
4803
  const [docsRuntime, docsSearchRuntime, devtoolsClientRuntime] = await Promise.all([
4609
- _optionalChain([docs, 'optionalAccess', _369 => _369.enabled]) ? loadFarmDocsDevRuntime() : null,
4610
- _optionalChain([docs, 'optionalAccess', _370 => _370.enabled]) && !adapterOwnsDocsRuntime ? loadFarmDocsSearchDevRuntime() : null,
4804
+ _optionalChain([docs, 'optionalAccess', _366 => _366.enabled]) ? loadFarmDocsDevRuntime() : null,
4805
+ _optionalChain([docs, 'optionalAccess', _367 => _367.enabled]) && !adapterOwnsDocsRuntime ? loadFarmDocsSearchDevRuntime() : null,
4611
4806
  devtools.enabled ? loadFarmDevtoolsClientRuntime() : null
4612
4807
  ]);
4613
- const docsSearchEnabled = _nullishCoalesce(_optionalChain([docsSearchRuntime, 'optionalAccess', _371 => _371.isFarmDocsSearchEnabled, 'call', _372 => _372(docs)]), () => ( false));
4808
+ const docsSearchEnabled = _nullishCoalesce(_optionalChain([docsSearchRuntime, 'optionalAccess', _368 => _368.isFarmDocsSearchEnabled, 'call', _369 => _369(docs)]), () => ( false));
4614
4809
  const generatedDocsSearchRuntime = docsSearchRuntime ? docsSearchRuntime.generateFarmDocsSearchClientRuntime(
4615
4810
  docsSearchEnabled,
4616
4811
  docsSearchEnabled ? docsSearchRuntime.resolveFarmDocsSearchClientModule(root) : void 0
4617
4812
  ) : EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME;
4618
4813
  const generatedDevtoolsClientRuntime = devtoolsClientRuntime ? devtoolsClientRuntime.generateFarmDevtoolsClientRuntime(devtools) : "";
4619
4814
  const generatedDevIndicatorsClientRuntime = farmApp ? _chunkUVV3I5QAcjs.generateFarmDevIndicatorsClientRuntime.call(void 0, farmApp.getConfig().devIndicators) : "";
4620
- const integrationProviders = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _chunkJX5VOLAVcjs.getIntegrationProviders.call(void 0, integrations) : [];
4621
- const isolatedHydrationMode = _chunkHTXKSREFcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
4622
- _optionalChain([resolvedConfig, 'optionalAccess', _373 => _373.experimental, 'optionalAccess', _374 => _374.isolatedClientHydration]),
4815
+ const integrationProviders = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _chunk6DBBMQWTcjs.getIntegrationProviders.call(void 0, integrations) : [];
4816
+ const isolatedHydrationMode = _chunkJNZDTE75cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
4817
+ _optionalChain([resolvedConfig, 'optionalAccess', _370 => _370.experimental, 'optionalAccess', _371 => _371.isolatedClientHydration]),
4623
4818
  {
4624
- serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _375 => _375.experimental, 'optionalAccess', _376 => _376.serverComponents])) === "rsc",
4819
+ serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _372 => _372.experimental, 'optionalAccess', _373 => _373.serverComponents])) === "rsc",
4625
4820
  hasUnsupportedIntegrationProvider: integrationProviders.filter((provider) => provider.component || provider.type === "clerk").some((provider) => provider.supportsIsolatedHydration !== true)
4626
4821
  }
4627
4822
  );
4628
4823
  return generateClientCode(
4629
4824
  integrationProviders,
4630
4825
  [
4631
- ..._chunkJX5VOLAVcjs.getIntegrationDocumentNavigationMatchers.call(void 0, integrations),
4632
- ..._nullishCoalesce(_optionalChain([docsRuntime, 'optionalAccess', _377 => _377.getFarmDocsDocumentNavigationMatchers, 'call', _378 => _378(docs)]), () => ( []))
4826
+ ..._chunk6DBBMQWTcjs.getIntegrationDocumentNavigationMatchers.call(void 0, integrations),
4827
+ ..._nullishCoalesce(_optionalChain([docsRuntime, 'optionalAccess', _374 => _374.getFarmDocsDocumentNavigationMatchers, 'call', _375 => _375(docs)]), () => ( []))
4633
4828
  ],
4634
4829
  generatedDocsSearchRuntime,
4635
4830
  `${generatedDevtoolsClientRuntime}
4636
4831
  ${generatedDevIndicatorsClientRuntime}`,
4637
- _optionalChain([resolvedConfig, 'optionalAccess', _379 => _379.plugins]) || [],
4832
+ _optionalChain([resolvedConfig, 'optionalAccess', _376 => _376.plugins]) || [],
4638
4833
  root,
4639
- _optionalChain([resolvedConfig, 'optionalAccess', _380 => _380.srcDir]) || options.srcDir || "src",
4640
- _optionalChain([resolvedConfig, 'optionalAccess', _381 => _381.publicRuntimeConfig]) || options.publicRuntimeConfig,
4641
- _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _optionalChain([docs, 'optionalAccess', _382 => _382.adapter, 'optionalAccess', _383 => _383.react]) : void 0,
4834
+ _optionalChain([resolvedConfig, 'optionalAccess', _377 => _377.srcDir]) || options.srcDir || "src",
4835
+ _optionalChain([resolvedConfig, 'optionalAccess', _378 => _378.publicRuntimeConfig]) || options.publicRuntimeConfig,
4836
+ _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _optionalChain([docs, 'optionalAccess', _379 => _379.adapter, 'optionalAccess', _380 => _380.react]) : void 0,
4642
4837
  renderer,
4643
- isolatedHydrationMode === "enabled" || _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([(_nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _384 => _384.getRouteManager, 'call', _385 => _385(), 'access', _386 => _386.getIsolatedClientBoundaryModules, 'call', _387 => _387(root)])))), 'optionalAccess', _388 => _388.size]) > 0,
4644
- _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _389 => _389.trailingSlash]), () => ( false)),
4645
- _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _390 => _390.basePath]), () => ( "/")),
4646
- _chunkTAU3OF5Bcjs.generateClientCachePersistenceCode.call(void 0,
4647
- _chunkTAU3OF5Bcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, _optionalChain([resolvedConfig, 'optionalAccess', _391 => _391.cache]))
4838
+ isolatedHydrationMode === "enabled" || _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([(_nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _381 => _381.getRouteManager, 'call', _382 => _382(), 'access', _383 => _383.getIsolatedClientBoundaryModules, 'call', _384 => _384(root)])))), 'optionalAccess', _385 => _385.size]) > 0,
4839
+ _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _386 => _386.trailingSlash]), () => ( false)),
4840
+ _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _387 => _387.basePath]), () => ( "/")),
4841
+ _chunkIK33N2ANcjs.generateClientCachePersistenceCode.call(void 0,
4842
+ _chunkIK33N2ANcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, _optionalChain([resolvedConfig, 'optionalAccess', _388 => _388.cache]))
4648
4843
  ),
4649
4844
  _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, docs) : void 0,
4650
- _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _392 => _392.experimental, 'optionalAccess', _393 => _393.serverComponents])) === "islands"
4845
+ _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _389 => _389.experimental, 'optionalAccess', _390 => _390.serverComponents])) === "islands"
4651
4846
  );
4652
4847
  }
4653
4848
  if (id === "/@farm/server") {
4654
4849
  return generateServerCode();
4655
4850
  }
4656
4851
  if (id === "/@farm/manifest") {
4657
- const routeManager = _optionalChain([farmApp, 'optionalAccess', _394 => _394.getRouteManager, 'call', _395 => _395()]);
4852
+ const routeManager = _optionalChain([farmApp, 'optionalAccess', _391 => _391.getRouteManager, 'call', _392 => _392()]);
4658
4853
  if (!routeManager) {
4659
4854
  return `
4660
4855
  export const getManifest = () => ({
@@ -4666,11 +4861,11 @@ export const getManifest = () => ({
4666
4861
  });
4667
4862
  `;
4668
4863
  }
4669
- const globalStylesheetHref = _chunkTAU3OF5Bcjs.resolveDevGlobalStylesheetHref.call(void 0,
4864
+ const globalStylesheetHref = _chunkIK33N2ANcjs.resolveDevGlobalStylesheetHref.call(void 0,
4670
4865
  server.config.root,
4671
- _optionalChain([farmApp, 'optionalAccess', _396 => _396.getConfig, 'call', _397 => _397(), 'access', _398 => _398.srcDir])
4866
+ _optionalChain([farmApp, 'optionalAccess', _393 => _393.getConfig, 'call', _394 => _394(), 'access', _395 => _395.srcDir])
4672
4867
  );
4673
- const fullManifest = _chunkTAU3OF5Bcjs.createFarmDevClientManifest.call(void 0,
4868
+ const fullManifest = _chunkIK33N2ANcjs.createFarmDevClientManifest.call(void 0,
4674
4869
  routeManager.generateClientManifest(server.config.root),
4675
4870
  {
4676
4871
  sharedAssets: globalStylesheetHref ? [{ tag: "link", attrs: { rel: "stylesheet", href: globalStylesheetHref } }] : []
@@ -4686,109 +4881,120 @@ export { manifest };
4686
4881
  }
4687
4882
  },
4688
4883
  async transform(code, id, transformOptions) {
4689
- if (pendingClientSetup && !_optionalChain([transformOptions, 'optionalAccess', _399 => _399.ssr]) && !farmSetupContext.getStore()) {
4884
+ if (pendingClientSetup && !_optionalChain([transformOptions, 'optionalAccess', _396 => _396.ssr]) && !farmSetupContext.getStore()) {
4690
4885
  await pendingClientSetup;
4691
4886
  }
4692
- const runtimeModule = !isBuild && _optionalChain([transformOptions, 'optionalAccess', _400 => _400.ssr]) === true && isOutsideAppRoot(id) ? toFarmRuntimeModuleId : void 0;
4693
- const actionConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _401 => _401.getConfig, 'call', _402 => _402()]), () => ( options));
4887
+ const runtimeModule = !isBuild && _optionalChain([transformOptions, 'optionalAccess', _397 => _397.ssr]) === true && isOutsideAppRoot(id) ? toFarmRuntimeModuleId : void 0;
4888
+ const actionConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _398 => _398.getConfig, 'call', _399 => _399()]), () => ( options));
4694
4889
  let rewrotePackageImports = false;
4695
- if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([actionConfig, 'access', _403 => _403.experimental, 'optionalAccess', _404 => _404.serverComponents])) === "islands" && (!id.includes("/node_modules/") || _optionalChain([transformOptions, 'optionalAccess', _405 => _405.ssr]) === true && farmReactServerFiles.has(id.split("?", 1)[0])) && !id.startsWith("\0") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id) && !_chunkHTXKSREFcjs.hasUseClientDirective.call(void 0, code)) {
4890
+ if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([actionConfig, 'access', _400 => _400.experimental, 'optionalAccess', _401 => _401.serverComponents])) === "islands" && (!id.includes("/node_modules/") || _optionalChain([transformOptions, 'optionalAccess', _402 => _402.ssr]) === true && farmReactServerFiles.has(id.split("?", 1)[0])) && !id.startsWith("\0") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id) && !_chunkJNZDTE75cjs.hasUseClientDirective.call(void 0, code)) {
4696
4891
  const file = id.split("?", 1)[0];
4697
- const projectRoot = actionConfig.root || _optionalChain([server, 'optionalAccess', _406 => _406.config, 'access', _407 => _407.root]) || process.cwd();
4698
- if (_optionalChain([transformOptions, 'optionalAccess', _408 => _408.ssr]) === true) {
4699
- if (farmReactServerFiles.has(file)) {
4700
- for (const child of _chunkHTXKSREFcjs.farmRelativeImportFiles.call(void 0, code, file))
4701
- farmReactServerFiles.add(child);
4892
+ const projectRoot = actionConfig.root || _optionalChain([server, 'optionalAccess', _403 => _403.config, 'access', _404 => _404.root]) || process.cwd();
4893
+ const buildSnapshot = isBuild ? options.sourceSnapshot : void 0;
4894
+ const rewrite = () => {
4895
+ if (_optionalChain([transformOptions, 'optionalAccess', _405 => _405.ssr]) === true) {
4896
+ if (farmReactServerFiles.has(file)) {
4897
+ for (const child of _chunkJNZDTE75cjs.farmRelativeImportFiles.call(void 0, code, file))
4898
+ farmReactServerFiles.add(child);
4899
+ }
4900
+ const serverModule = farmReactServerFiles.has(file) || !_chunkJNZDTE75cjs.getFarmClientReachableModules.call(void 0,
4901
+ path6.resolve(projectRoot, actionConfig.srcDir || "src"),
4902
+ projectRoot
4903
+ ).has(path6.resolve(file));
4904
+ const reactServer = !serverModule ? null : _chunkJNZDTE75cjs.rewriteFarmReactServerImports.call(void 0, {
4905
+ code,
4906
+ file,
4907
+ reference: (specifier, exportName) => _chunkJNZDTE75cjs.ensureFarmPackageClientReference.call(void 0, projectRoot, specifier, exportName, file),
4908
+ onServerFile: (serverFile) => farmReactServerFiles.add(serverFile)
4909
+ });
4910
+ if (reactServer !== null) {
4911
+ code = reactServer;
4912
+ rewrotePackageImports = true;
4913
+ }
4914
+ const internal = farmReactServerFiles.has(file) ? _chunkJNZDTE75cjs.rewriteFarmReactServerClientModuleImports.call(void 0, {
4915
+ code,
4916
+ file,
4917
+ reference: (clientFile) => _chunkJNZDTE75cjs.ensureFarmInternalClientReference.call(void 0, projectRoot, clientFile)
4918
+ }) : null;
4919
+ if (internal !== null) {
4920
+ code = internal;
4921
+ rewrotePackageImports = true;
4922
+ }
4702
4923
  }
4703
- const serverModule = farmReactServerFiles.has(file) || !_chunkHTXKSREFcjs.getFarmClientReachableModules.call(void 0,
4704
- path6.resolve(projectRoot, actionConfig.srcDir || "src"),
4705
- projectRoot
4706
- ).has(path6.resolve(file));
4707
- const reactServer = !serverModule ? null : _chunkHTXKSREFcjs.rewriteFarmReactServerImports.call(void 0, {
4708
- code,
4924
+ const rewritePackageImports = (source2) => _chunkJNZDTE75cjs.rewriteFarmPackageClientImports.call(void 0, {
4925
+ code: source2,
4709
4926
  file,
4710
- reference: (specifier, exportName) => _chunkHTXKSREFcjs.ensureFarmPackageClientReference.call(void 0, projectRoot, specifier, exportName, file),
4711
- onServerFile: (serverFile) => farmReactServerFiles.add(serverFile)
4927
+ root: projectRoot,
4928
+ isClientPackage: (specifier) => _chunkJNZDTE75cjs.isFarmPackageClientBoundary.call(void 0, file, specifier, projectRoot)
4712
4929
  });
4713
- if (reactServer !== null) {
4714
- code = reactServer;
4930
+ const routeManager = _optionalChain([farmApp, 'optionalAccess', _406 => _406.getRouteManager, 'call', _407 => _407()]);
4931
+ const source = code;
4932
+ const referenced = routeManager ? routeManager.inspectPackages(() => rewritePackageImports(source)) : rewritePackageImports(source);
4933
+ if (referenced !== null) {
4934
+ code = referenced;
4715
4935
  rewrotePackageImports = true;
4716
4936
  }
4717
- const internal = farmReactServerFiles.has(file) ? _chunkHTXKSREFcjs.rewriteFarmReactServerClientModuleImports.call(void 0, {
4718
- code,
4719
- file,
4720
- reference: (clientFile) => _chunkHTXKSREFcjs.ensureFarmInternalClientReference.call(void 0, projectRoot, clientFile)
4721
- }) : null;
4722
- if (internal !== null) {
4723
- code = internal;
4724
- rewrotePackageImports = true;
4725
- }
4726
- }
4727
- const rewritePackageImports = (source2) => _chunkHTXKSREFcjs.rewriteFarmPackageClientImports.call(void 0, {
4728
- code: source2,
4729
- file,
4730
- root: projectRoot,
4731
- isClientPackage: (specifier) => _chunkHTXKSREFcjs.isFarmPackageClientBoundary.call(void 0, file, specifier, projectRoot)
4732
- });
4733
- const routeManager = _optionalChain([farmApp, 'optionalAccess', _409 => _409.getRouteManager, 'call', _410 => _410()]);
4734
- const source = code;
4735
- const referenced = routeManager ? routeManager.inspectPackages(() => rewritePackageImports(source)) : rewritePackageImports(source);
4736
- if (referenced !== null) {
4737
- code = referenced;
4738
- rewrotePackageImports = true;
4739
- }
4740
- if (_optionalChain([transformOptions, 'optionalAccess', _411 => _411.ssr]) === true) {
4741
- const cached = rewriteFarmReactCacheImport(
4742
- code,
4743
- file,
4744
- _optionalChain([runtimeModule, 'optionalCall', _412 => _412(FARM_REACT_CACHE_MODULE)])
4745
- );
4746
- if (cached !== null) {
4747
- code = cached;
4748
- rewrotePackageImports = true;
4937
+ if (_optionalChain([transformOptions, 'optionalAccess', _408 => _408.ssr]) === true) {
4938
+ const cached = rewriteFarmReactCacheImport(
4939
+ code,
4940
+ file,
4941
+ _optionalChain([runtimeModule, 'optionalCall', _409 => _409(FARM_REACT_CACHE_MODULE)])
4942
+ );
4943
+ if (cached !== null) {
4944
+ code = cached;
4945
+ rewrotePackageImports = true;
4946
+ }
4749
4947
  }
4750
- }
4948
+ };
4949
+ if (buildSnapshot) _chunkJNZDTE75cjs.withFarmSourceSnapshotOf.call(void 0, buildSnapshot, rewrite);
4950
+ else rewrite();
4751
4951
  }
4752
4952
  if (islandsServerFns() && !_chunkPIUTGRDIcjs.isFarmServerFnBoundaryId.call(void 0, id) && !id.includes("/node_modules/") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id)) {
4753
4953
  const serverFns = _chunkPIUTGRDIcjs.transformFarmServerFns.call(void 0, code, id, {
4754
- environment: _optionalChain([transformOptions, 'optionalAccess', _413 => _413.ssr]) === true ? "rsc" : "client"
4954
+ environment: _optionalChain([transformOptions, 'optionalAccess', _410 => _410.ssr]) === true ? "rsc" : "client"
4755
4955
  });
4756
4956
  if (serverFns) {
4757
4957
  if (!serverFns.code.includes("use server")) return { code: serverFns.code, map: null };
4758
4958
  code = serverFns.code;
4759
4959
  }
4760
4960
  }
4761
- if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([actionConfig, 'access', _414 => _414.experimental, 'optionalAccess', _415 => _415.serverComponents])) === "islands" && code.includes("use server") && !id.includes("/node_modules/") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id)) {
4961
+ if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([actionConfig, 'access', _411 => _411.experimental, 'optionalAccess', _412 => _412.serverComponents])) === "islands" && code.includes("use server") && !id.includes("/node_modules/") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id)) {
4762
4962
  const file = id.split("?", 1)[0];
4763
4963
  const actionModule = transformFarmFormActionModule({
4764
4964
  code,
4765
4965
  id,
4766
- root: actionConfig.root || _optionalChain([server, 'optionalAccess', _416 => _416.config, 'access', _417 => _417.root]) || process.cwd(),
4767
- ssr: _optionalChain([transformOptions, 'optionalAccess', _418 => _418.ssr]) === true,
4966
+ root: actionConfig.root || _optionalChain([server, 'optionalAccess', _413 => _413.config, 'access', _414 => _414.root]) || process.cwd(),
4967
+ ssr: _optionalChain([transformOptions, 'optionalAccess', _415 => _415.ssr]) === true,
4768
4968
  // Parsed by file type: page components are TSX.
4769
4969
  parse: (source) => _vite.parseSync.call(void 0, file, source).program,
4770
4970
  runtimeModule
4771
4971
  });
4772
4972
  if (actionModule) return { code: actionModule, map: null };
4773
4973
  }
4774
- if (!_optionalChain([transformOptions, 'optionalAccess', _419 => _419.ssr])) {
4775
- const docsConfigModule = _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, _optionalChain([farmApp, 'optionalAccess', _420 => _420.getConfig, 'call', _421 => _421(), 'optionalAccess', _422 => _422.docs]));
4776
- if (_chunkTAU3OF5Bcjs.isFarmDocsClientConfigModule.call(void 0, id, docsConfigModule)) {
4777
- const redacted = _chunkTAU3OF5Bcjs.redactFarmDocsClientConfig.call(void 0, code, id.split("?")[0]);
4974
+ if (!_optionalChain([transformOptions, 'optionalAccess', _416 => _416.ssr])) {
4975
+ const docsConfigModule = _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, _optionalChain([farmApp, 'optionalAccess', _417 => _417.getConfig, 'call', _418 => _418(), 'optionalAccess', _419 => _419.docs]));
4976
+ if (_chunkIK33N2ANcjs.isFarmDocsClientConfigModule.call(void 0, id, docsConfigModule)) {
4977
+ const redacted = _chunkIK33N2ANcjs.redactFarmDocsClientConfig.call(void 0, code, id.split("?")[0]);
4778
4978
  if (redacted !== null) return { code: redacted, map: null };
4779
4979
  }
4780
4980
  }
4781
- if (!_optionalChain([transformOptions, 'optionalAccess', _423 => _423.ssr])) {
4782
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _424 => _424.getConfig, 'call', _425 => _425()]), () => ( options));
4783
- if ((_optionalChain([currentConfig, 'access', _426 => _426.experimental, 'optionalAccess', _427 => _427.serverActions]) !== true || !serverFnTransformActive) && !islandsServerFns()) {
4981
+ if (!_optionalChain([transformOptions, 'optionalAccess', _420 => _420.ssr])) {
4982
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _421 => _421.getConfig, 'call', _422 => _422()]), () => ( options));
4983
+ if ((_optionalChain([currentConfig, 'access', _423 => _423.experimental, 'optionalAccess', _424 => _424.serverActions]) !== true || !serverFnTransformActive) && !islandsServerFns()) {
4784
4984
  const violation = findClientServerFnViolation(code, id);
4785
4985
  if (violation) {
4786
- this.error(formatServerFnBoundaryError(violation, id));
4986
+ const locate = _chunkJNZDTE75cjs.createFarmSourceLocator.call(void 0, code, () => this.getCombinedSourcemap());
4987
+ this.error(
4988
+ _chunkJNZDTE75cjs.formatFarmDiagnostic.call(void 0,
4989
+ createServerFnBoundaryDiagnostic(violation, id, locate(violation.start)),
4990
+ currentConfig.root
4991
+ )
4992
+ );
4787
4993
  }
4788
4994
  }
4789
4995
  }
4790
- if (!_optionalChain([transformOptions, 'optionalAccess', _428 => _428.ssr]) && shouldInspectClientBoundary(id, code)) {
4791
- warnClientBoundaryOnce(this, id, code, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _429 => _429.getConfig, 'call', _430 => _430()]), () => ( options)));
4996
+ if (!_optionalChain([transformOptions, 'optionalAccess', _425 => _425.ssr]) && shouldInspectClientBoundary(id, code)) {
4997
+ await warnClientBoundaryOnce(this, id, code, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _426 => _426.getConfig, 'call', _427 => _427()]), () => ( options)));
4792
4998
  }
4793
4999
  if (typeof imageImports.transform === "function") {
4794
5000
  const imageModule = await imageImports.transform.call(this, code, id, transformOptions);
@@ -4803,13 +5009,13 @@ export { manifest };
4803
5009
  id,
4804
5010
  transformOptions
4805
5011
  );
4806
- const fontCode = typeof fontResult === "string" ? fontResult : _optionalChain([fontResult, 'optionalAccess', _431 => _431.code, 'optionalAccess', _432 => _432.toString, 'call', _433 => _433()]);
5012
+ const fontCode = typeof fontResult === "string" ? fontResult : _optionalChain([fontResult, 'optionalAccess', _428 => _428.code, 'optionalAccess', _429 => _429.toString, 'call', _430 => _430()]);
4807
5013
  if (fontCode) {
4808
5014
  transformedCode = fontCode;
4809
5015
  transformed = true;
4810
5016
  }
4811
5017
  }
4812
- if (_optionalChain([transformOptions, 'optionalAccess', _434 => _434.ssr]) && server) {
5018
+ if (_optionalChain([transformOptions, 'optionalAccess', _431 => _431.ssr]) && server) {
4813
5019
  const rewrittenImports = rewriteEarlySsrRelativeImports({
4814
5020
  code: transformedCode,
4815
5021
  id,
@@ -4821,26 +5027,26 @@ export { manifest };
4821
5027
  transformed = true;
4822
5028
  }
4823
5029
  }
4824
- if (_chunkHTXKSREFcjs.hasUseClientDirective.call(void 0, transformedCode)) {
5030
+ if (_chunkJNZDTE75cjs.hasUseClientDirective.call(void 0, transformedCode)) {
4825
5031
  const clientBoundarySource = transformedCode;
4826
5032
  const moduleInfo = this.getModuleInfo(id);
4827
5033
  if (moduleInfo) {
4828
5034
  moduleInfo.isClientComponent = true;
4829
5035
  }
4830
- transformedCode = _chunkHTXKSREFcjs.stripUseClientDirective.call(void 0, transformedCode);
5036
+ transformedCode = _chunkJNZDTE75cjs.stripUseClientDirective.call(void 0, transformedCode);
4831
5037
  transformed = true;
4832
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _435 => _435.getConfig, 'call', _436 => _436()]), () => ( options));
5038
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _432 => _432.getConfig, 'call', _433 => _433()]), () => ( options));
4833
5039
  let isolatedModuleReference = null;
4834
- const root = currentConfig.root || _optionalChain([server, 'optionalAccess', _437 => _437.config, 'access', _438 => _438.root]) || process.cwd();
5040
+ const root = currentConfig.root || _optionalChain([server, 'optionalAccess', _434 => _434.config, 'access', _435 => _435.root]) || process.cwd();
4835
5041
  const cleanId = id.split("?", 1)[0];
4836
- const selectedIsolatedModules = _nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _439 => _439.getRouteManager, 'call', _440 => _440(), 'access', _441 => _441.getIsolatedClientBoundaryModules, 'call', _442 => _442(root)])));
4837
- const selectedForIsolatedHydration = _optionalChain([selectedIsolatedModules, 'optionalAccess', _443 => _443.has, 'call', _444 => _444(path6.resolve(cleanId))]) === true;
4838
- if (_chunk67MZTLTFcjs.isReactRenderer.call(void 0, _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, currentConfig.renderer)) && selectedForIsolatedHydration && (_chunkHTXKSREFcjs.isIsolatableClientBoundarySource.call(void 0, clientBoundarySource) || // A generated client reference, whose marker comment compiled TSX no longer has.
4839
- cleanId.replace(/\\/g, "/").includes(_chunkHTXKSREFcjs.FARM_CLIENT_REFERENCE_DIRECTORY))) {
4840
- isolatedModuleReference = _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, cleanId, root);
4841
- const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([currentConfig, 'access', _445 => _445.experimental, 'optionalAccess', _446 => _446.serverComponents])) === "islands";
4842
- const explicitStrategy = _chunkHTXKSREFcjs.getIslandStrategyExport.call(void 0, clientBoundarySource);
4843
- const inference = islandsMode && explicitStrategy === null ? _chunkTAU3OF5Bcjs.inferFarmIslandStrategy.call(void 0, cleanId, root) : null;
5042
+ const selectedIsolatedModules = _nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _436 => _436.getRouteManager, 'call', _437 => _437(), 'access', _438 => _438.getIsolatedClientBoundaryModules, 'call', _439 => _439(root)])));
5043
+ const selectedForIsolatedHydration = _optionalChain([selectedIsolatedModules, 'optionalAccess', _440 => _440.has, 'call', _441 => _441(path6.resolve(cleanId))]) === true;
5044
+ if (_chunk67MZTLTFcjs.isReactRenderer.call(void 0, _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, currentConfig.renderer)) && selectedForIsolatedHydration && (_chunkJNZDTE75cjs.isIsolatableClientBoundarySource.call(void 0, clientBoundarySource) || // A generated client reference, whose marker comment compiled TSX no longer has.
5045
+ cleanId.replace(/\\/g, "/").includes(_chunkJNZDTE75cjs.FARM_CLIENT_REFERENCE_DIRECTORY))) {
5046
+ isolatedModuleReference = _chunkGC5ROI3Acjs.toViteModuleId.call(void 0, cleanId, root);
5047
+ const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([currentConfig, 'access', _442 => _442.experimental, 'optionalAccess', _443 => _443.serverComponents])) === "islands";
5048
+ const explicitStrategy = _chunkJNZDTE75cjs.getIslandStrategyExport.call(void 0, clientBoundarySource);
5049
+ const inference = islandsMode && explicitStrategy === null ? _chunkIK33N2ANcjs.inferFarmIslandStrategy.call(void 0, cleanId, root) : null;
4844
5050
  if (inference) {
4845
5051
  for (const file of inference.files) {
4846
5052
  if (file !== path6.resolve(cleanId)) this.addWatchFile(file);
@@ -4853,8 +5059,8 @@ export { manifest };
4853
5059
  islandStrategy: _nullishCoalesce(explicitStrategy, () => ( "load")),
4854
5060
  parse: (source) => this.parse(source),
4855
5061
  slots: islandsMode,
4856
- browser: _optionalChain([transformOptions, 'optionalAccess', _447 => _447.ssr]) !== true,
4857
- inferredInteraction: _optionalChain([inference, 'optionalAccess', _448 => _448.strategy]) === "interaction",
5062
+ browser: _optionalChain([transformOptions, 'optionalAccess', _444 => _444.ssr]) !== true,
5063
+ inferredInteraction: _optionalChain([inference, 'optionalAccess', _445 => _445.strategy]) === "interaction",
4858
5064
  runtimeModule
4859
5065
  });
4860
5066
  if (!transformedBoundary) {
@@ -4885,7 +5091,7 @@ export { manifest };
4885
5091
  );
4886
5092
  return;
4887
5093
  }` : "";
4888
- const hmrCode = _optionalChain([transformOptions, 'optionalAccess', _449 => _449.ssr]) || reactRefreshActive || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
5094
+ const hmrCode = _optionalChain([transformOptions, 'optionalAccess', _446 => _446.ssr]) || reactRefreshActive || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
4889
5095
  if (import.meta.hot) {
4890
5096
  import.meta.hot.accept((newModule) => {
4891
5097
  ${isolatedHmrUpdate}
@@ -4936,19 +5142,19 @@ if (import.meta.hot) {
4936
5142
  if (!routeManager) return;
4937
5143
  const { ssg: ssgPages, ssr: ssrRoutes } = await routeManager.collectSSGPages();
4938
5144
  if (ssgPages.length === 0) {
4939
- _chunkQMNWKQL4cjs.logger.info("No SSG pages found - all pages will use SSR");
5145
+ _chunkGC5ROI3Acjs.logger.info("No SSG pages found - all pages will use SSR");
4940
5146
  return;
4941
5147
  }
4942
- _chunkQMNWKQL4cjs.logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
4943
- _chunkQMNWKQL4cjs.logger.info("Pre-rendering SSG pages...");
4944
- const outDir = path6.join(_optionalChain([server, 'optionalAccess', _450 => _450.config, 'access', _451 => _451.root]) || process.cwd(), options.outDir || "dist");
5148
+ _chunkGC5ROI3Acjs.logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
5149
+ _chunkGC5ROI3Acjs.logger.info("Pre-rendering SSG pages...");
5150
+ const outDir = path6.join(_optionalChain([server, 'optionalAccess', _447 => _447.config, 'access', _448 => _448.root]) || process.cwd(), options.outDir || "dist");
4945
5151
  const clientDir = path6.join(outDir, "client");
4946
5152
  for (const page of ssgPages) {
4947
5153
  try {
4948
5154
  const staticRequest = new Request(new URL(page.urlPath, "http://farm.static"));
4949
5155
  await farmApp.getServerRenderer().runWithRequestContext(staticRequest, async () => {
4950
5156
  const mod = await routeManager.loadRouteModule(page.filePath);
4951
- if (!_optionalChain([mod, 'optionalAccess', _452 => _452.default])) return;
5157
+ if (!_optionalChain([mod, 'optionalAccess', _449 => _449.default])) return;
4952
5158
  const { layouts } = routeManager.matchRoute(page.urlPath);
4953
5159
  const layoutModules = await Promise.all(
4954
5160
  layouts.map((l) => routeManager.loadLayoutModule(l.modulePath))
@@ -4977,10 +5183,10 @@ if (import.meta.hot) {
4977
5183
  );
4978
5184
  }
4979
5185
  const html = renderToString(pageElement);
4980
- const i18nSnapshot = _chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0, );
5186
+ const i18nSnapshot = _chunkSXXSQVKKcjs.getFarmI18nClientSnapshot.call(void 0, );
4981
5187
  const i18nHead = renderFarmI18nStaticHead(page.urlPath, i18nSnapshot);
4982
5188
  const fullHtml = `<!DOCTYPE html>
4983
- <html lang="${escapeFarmHtmlAttribute(_optionalChain([i18nSnapshot, 'optionalAccess', _453 => _453.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}>
5189
+ <html lang="${escapeFarmHtmlAttribute(_optionalChain([i18nSnapshot, 'optionalAccess', _450 => _450.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}>
4984
5190
  <head>
4985
5191
  <meta charset="utf-8">
4986
5192
  <meta name="viewport" content="width=device-width, initial-scale=1">
@@ -4998,10 +5204,10 @@ if (import.meta.hot) {
4998
5204
  fs2.mkdirSync(path6.dirname(outputPath), { recursive: true });
4999
5205
  fs2.writeFileSync(outputPath, fullHtml);
5000
5206
  const revalidateInfo = page.revalidate ? ` (revalidate: ${page.revalidate}s)` : "";
5001
- _chunkQMNWKQL4cjs.logger.success(` \u2713 ${page.urlPath}${revalidateInfo}`);
5207
+ _chunkGC5ROI3Acjs.logger.success(` \u2713 ${page.urlPath}${revalidateInfo}`);
5002
5208
  });
5003
5209
  } catch (error) {
5004
- _chunkQMNWKQL4cjs.logger.error(` \u2717 ${page.urlPath}: ${error}`);
5210
+ _chunkGC5ROI3Acjs.logger.error(` \u2717 ${page.urlPath}: ${error}`);
5005
5211
  }
5006
5212
  }
5007
5213
  const manifestPath = path6.join(outDir, "__ssg_manifest.json");
@@ -5017,20 +5223,20 @@ if (import.meta.hot) {
5017
5223
  2
5018
5224
  )
5019
5225
  );
5020
- _chunkQMNWKQL4cjs.logger.success(`SSG complete: ${ssgPages.length} pages pre-rendered`);
5226
+ _chunkGC5ROI3Acjs.logger.success(`SSG complete: ${ssgPages.length} pages pre-rendered`);
5021
5227
  } catch (error) {
5022
- _chunkQMNWKQL4cjs.logger.error(`SSG build failed: ${error}`);
5228
+ _chunkGC5ROI3Acjs.logger.error(`SSG build failed: ${error}`);
5023
5229
  }
5024
5230
  },
5025
5231
  watchChange(id, change) {
5026
- const watched = _chunkQMNWKQL4cjs.toPosixPath.call(void 0, id);
5232
+ const watched = _chunkGC5ROI3Acjs.toPosixPath.call(void 0, id);
5027
5233
  if (!watched.includes("/node_modules/") && !isFarmGeneratedOutput(watched)) {
5028
- _optionalChain([farmApp, 'optionalAccess', _454 => _454.getRouteManager, 'call', _455 => _455(), 'access', _456 => _456.noteSourceChange, 'call', _457 => _457(id, change.event)]);
5234
+ _optionalChain([farmApp, 'optionalAccess', _451 => _451.getRouteManager, 'call', _452 => _452(), 'access', _453 => _453.noteSourceChange, 'call', _454 => _454(id, change.event)]);
5029
5235
  }
5030
- _chunkHTXKSREFcjs.invalidateFarmClientReachableModules.call(void 0, );
5031
- _chunkHTXKSREFcjs.invalidateFarmClientOnlyScan.call(void 0, );
5032
- _chunkTAU3OF5Bcjs.invalidateFarmRouteRootInferences.call(void 0, );
5033
- _chunkHTXKSREFcjs.dropLatestPackageClientBoundaryCache.call(void 0, );
5236
+ _chunkJNZDTE75cjs.invalidateFarmClientReachableModules.call(void 0, );
5237
+ _chunkJNZDTE75cjs.invalidateFarmClientOnlyScan.call(void 0, );
5238
+ _chunkIK33N2ANcjs.invalidateFarmRouteRootInferences.call(void 0, );
5239
+ _chunkJNZDTE75cjs.dropLatestPackageClientBoundaryCache.call(void 0, );
5034
5240
  },
5035
5241
  async handleHotUpdate(ctx) {
5036
5242
  if (pendingClientSetup && !farmSetupContext.getStore()) await pendingClientSetup;
@@ -5051,27 +5257,34 @@ if (import.meta.hot) {
5051
5257
  }
5052
5258
  for (const island of _nullishCoalesce(farmIslandInferenceDependents.get(path6.resolve(file)), () => ( []))) {
5053
5259
  if (island === path6.resolve(file)) continue;
5054
- for (const mod of _nullishCoalesce(server2.moduleGraph.getModulesByFile(_chunkQMNWKQL4cjs.toPosixPath.call(void 0, island)), () => ( []))) {
5260
+ for (const mod of _nullishCoalesce(server2.moduleGraph.getModulesByFile(_chunkGC5ROI3Acjs.toPosixPath.call(void 0, island)), () => ( []))) {
5055
5261
  server2.moduleGraph.invalidateModule(mod);
5056
5262
  }
5057
5263
  }
5058
- const currentFarmConfig = _optionalChain([farmApp, 'optionalAccess', _458 => _458.getConfig, 'call', _459 => _459()]);
5264
+ const currentFarmConfig = _optionalChain([farmApp, 'optionalAccess', _455 => _455.getConfig, 'call', _456 => _456()]);
5059
5265
  const normalizedFile = file.replace(/\\/g, "/");
5266
+ if (normalizedFile.includes(_chunkJNZDTE75cjs.FARM_CLIENT_REFERENCE_DIRECTORY) && normalizedFile.startsWith(
5267
+ path6.posix.join(
5268
+ _chunkGC5ROI3Acjs.toPosixPath.call(void 0, _optionalChain([currentFarmConfig, 'optionalAccess', _457 => _457.root]) || options.root || server2.config.root),
5269
+ _chunkJNZDTE75cjs.FARM_CLIENT_REFERENCE_DIRECTORY
5270
+ )
5271
+ ))
5272
+ return modules;
5060
5273
  if (currentFarmConfig && /\/route\.(?:ts|tsx|js|jsx)$/.test(normalizedFile) && _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, currentFarmConfig).some(
5061
- (appDir) => normalizedFile.startsWith(`${_chunkQMNWKQL4cjs.toPosixPath.call(void 0, appDir)}/api/`)
5274
+ (appDir) => normalizedFile.startsWith(`${_chunkGC5ROI3Acjs.toPosixPath.call(void 0, appDir)}/api/`)
5062
5275
  )) {
5063
5276
  for (const mod of modules) server2.moduleGraph.invalidateModule(mod);
5064
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _460 => _460(`updated ${file}`)]);
5277
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _458 => _458(`updated ${file}`)]);
5065
5278
  server2.ws.send({ type: "full-reload", path: "*" });
5066
5279
  return [];
5067
5280
  }
5068
5281
  const currentSrcRoot = currentFarmConfig ? _chunkMTBDJ326cjs.getFarmSourceRoots.call(void 0, currentFarmConfig).map((source) => path6.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
5069
- if (currentSrcRoot && normalizedFile.startsWith(`${currentSrcRoot}/`) && _chunkE7QOEV5Zcjs.isProgrammaticRoutesFileName.call(void 0, normalizedFile)) {
5282
+ if (currentSrcRoot && normalizedFile.startsWith(`${currentSrcRoot}/`) && _chunkYUCU6XB4cjs.isProgrammaticRoutesFileName.call(void 0, normalizedFile)) {
5070
5283
  logUpdate("PAGE", `updated ${path6.basename(file)}`);
5071
5284
  for (const mod of modules) {
5072
5285
  server2.moduleGraph.invalidateModule(mod);
5073
5286
  }
5074
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _461 => _461(`updated ${file}`)]);
5287
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _459 => _459(`updated ${file}`)]);
5075
5288
  server2.ws.send({
5076
5289
  type: "full-reload",
5077
5290
  path: "*"
@@ -5084,24 +5297,24 @@ if (import.meta.hot) {
5084
5297
  for (const mod of modules) {
5085
5298
  server2.moduleGraph.invalidateModule(mod);
5086
5299
  }
5087
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _462 => _462(`updated ${file}`)]);
5300
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _460 => _460(`updated ${file}`)]);
5088
5301
  server2.ws.send({
5089
5302
  type: "full-reload",
5090
5303
  path: "*"
5091
5304
  });
5092
5305
  return [];
5093
5306
  }
5094
- if (apiRouteManager && _chunkJYNNIGQOcjs.invalidateFarmDevDependents.call(void 0, server2, file, apiRouteManager.getSourceFiles()).length > 0) {
5095
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _463 => _463(`updated ${file}`)]);
5307
+ if (apiRouteManager && _chunk25JGHAGHcjs.invalidateFarmDevDependents.call(void 0, server2, file, apiRouteManager.getSourceFiles()).length > 0) {
5308
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _461 => _461(`updated ${file}`)]);
5096
5309
  }
5097
- const isolatedHydrationMode = _optionalChain([currentFarmConfig, 'optionalAccess', _464 => _464.experimental, 'optionalAccess', _465 => _465.isolatedClientHydration]);
5098
- const planRouteManager = _optionalChain([farmApp, 'optionalAccess', _466 => _466.getRouteManager, 'call', _467 => _467()]);
5310
+ const isolatedHydrationMode = _optionalChain([currentFarmConfig, 'optionalAccess', _462 => _462.experimental, 'optionalAccess', _463 => _463.isolatedClientHydration]);
5311
+ const planRouteManager = _optionalChain([farmApp, 'optionalAccess', _464 => _464.getRouteManager, 'call', _465 => _465()]);
5099
5312
  const isHydrationPlanSource = /\.[cm]?[jt]sx?$/.test(normalizedFile) && !normalizedFile.includes("/node_modules/") && !isFarmGeneratedOutput(normalizedFile);
5100
- const tracksAsyncOwnerIslands = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, _optionalChain([currentFarmConfig, 'optionalAccess', _468 => _468.renderer])) && planRouteManager !== void 0;
5313
+ const tracksAsyncOwnerIslands = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, _optionalChain([currentFarmConfig, 'optionalAccess', _466 => _466.renderer])) && planRouteManager !== void 0;
5101
5314
  let clientPlanCurrent = false;
5102
5315
  if (isHydrationPlanSource && (isolatedHydrationMode === "enabled" || isolatedHydrationMode === "analyze" || tracksAsyncOwnerIslands)) {
5103
5316
  const routeManager = planRouteManager;
5104
- if (_optionalChain([routeManager, 'optionalAccess', _469 => _469.isEditPlanNeutral, 'call', _470 => _470(file)])) {
5317
+ if (_optionalChain([routeManager, 'optionalAccess', _467 => _467.isEditPlanNeutral, 'call', _468 => _468(file)])) {
5105
5318
  clientPlanCurrent = true;
5106
5319
  } else if (routeManager) {
5107
5320
  routeManager.noteSourceChange(file, "update");
@@ -5125,7 +5338,7 @@ if (import.meta.hot) {
5125
5338
  for (const mod of modules) server2.moduleGraph.invalidateModule(mod);
5126
5339
  for (const boundary of /* @__PURE__ */ new Set([...previousBoundaries, ...nextBoundaries])) {
5127
5340
  if (previousBoundaries.has(boundary) === nextBoundaries.has(boundary)) continue;
5128
- for (const mod of _nullishCoalesce(server2.moduleGraph.getModulesByFile(_chunkQMNWKQL4cjs.toPosixPath.call(void 0, boundary)), () => ( []))) {
5341
+ for (const mod of _nullishCoalesce(server2.moduleGraph.getModulesByFile(_chunkGC5ROI3Acjs.toPosixPath.call(void 0, boundary)), () => ( []))) {
5129
5342
  server2.moduleGraph.invalidateModule(mod);
5130
5343
  }
5131
5344
  }
@@ -5138,7 +5351,7 @@ if (import.meta.hot) {
5138
5351
  }
5139
5352
  clientPlanCurrent = true;
5140
5353
  } catch (error) {
5141
- _chunkQMNWKQL4cjs.logger.warn(
5354
+ _chunkGC5ROI3Acjs.logger.warn(
5142
5355
  `[Farm.js] Could not refresh the client hydration plan after ${file}: ${error instanceof Error ? error.message : String(error)}`
5143
5356
  );
5144
5357
  return modules;
@@ -5149,7 +5362,7 @@ if (import.meta.hot) {
5149
5362
  if (normalizedFile.includes("middleware.")) {
5150
5363
  if (middlewareManager) {
5151
5364
  await middlewareManager.reload();
5152
- _chunkQMNWKQL4cjs.logger.success("\u2705 Middleware reloaded!");
5365
+ _chunkGC5ROI3Acjs.logger.success("\u2705 Middleware reloaded!");
5153
5366
  if (initialPluginManager) {
5154
5367
  for (const middleware of middlewareManager.getMiddlewares()) {
5155
5368
  await initialPluginManager.runHookParallel("middlewareDiscovered", {
@@ -5162,7 +5375,7 @@ if (import.meta.hot) {
5162
5375
  }
5163
5376
  return [];
5164
5377
  }
5165
- if (!clientPlanCurrent) _optionalChain([farmApp, 'optionalAccess', _471 => _471.getRouteManager, 'call', _472 => _472(), 'access', _473 => _473.invalidateClientManifest, 'call', _474 => _474()]);
5378
+ if (!clientPlanCurrent) _optionalChain([farmApp, 'optionalAccess', _469 => _469.getRouteManager, 'call', _470 => _470(), 'access', _471 => _471.invalidateClientManifest, 'call', _472 => _472()]);
5166
5379
  const manifestModule = server2.moduleGraph.getModuleById("/@farm/manifest");
5167
5380
  if (manifestModule) {
5168
5381
  server2.moduleGraph.invalidateModule(manifestModule);
@@ -5180,7 +5393,7 @@ if (import.meta.hot) {
5180
5393
  return [];
5181
5394
  }
5182
5395
  }
5183
- if (/\.[cm]?[jt]sx?$/.test(normalizedFile) && !_optionalChain([server2, 'access', _475 => _475.environments, 'access', _476 => _476.client, 'optionalAccess', _477 => _477.moduleGraph, 'access', _478 => _478.getModulesByFile, 'call', _479 => _479(normalizedFile), 'optionalAccess', _480 => _480.size]) && _chunkJYNNIGQOcjs.invalidateFarmDevDependents.call(void 0, server2, file, getFarmRenderedServerModules()).length > 0) {
5396
+ if (/\.[cm]?[jt]sx?$/.test(normalizedFile) && !_optionalChain([server2, 'access', _473 => _473.environments, 'access', _474 => _474.client, 'optionalAccess', _475 => _475.moduleGraph, 'access', _476 => _476.getModulesByFile, 'call', _477 => _477(normalizedFile), 'optionalAccess', _478 => _478.size]) && _chunk25JGHAGHcjs.invalidateFarmDevDependents.call(void 0, server2, file, getFarmRenderedServerModules()).length > 0) {
5184
5397
  logUpdate("PAGE", `updated ${path6.basename(file)}`);
5185
5398
  server2.ws.send({ type: "full-reload", path: "*" });
5186
5399
  return [];
@@ -5278,7 +5491,7 @@ function createPageDataMiddlewareResponse(res) {
5278
5491
  return (...args) => {
5279
5492
  if (captures(target.statusCode, target.getHeader("location"))) {
5280
5493
  const callback = args.find((arg) => typeof arg === "function");
5281
- _optionalChain([callback, 'optionalCall', _481 => _481()]);
5494
+ _optionalChain([callback, 'optionalCall', _479 => _479()]);
5282
5495
  return property === "write" ? true : response;
5283
5496
  }
5284
5497
  return target[property](...args);
@@ -5342,42 +5555,42 @@ function isFarmClientVirtualId(id) {
5342
5555
  }
5343
5556
  function isClientEnvironment(context, loadOptions) {
5344
5557
  const environment = context.environment;
5345
- if (_optionalChain([environment, 'optionalAccess', _482 => _482.config, 'optionalAccess', _483 => _483.consumer])) return environment.config.consumer === "client";
5346
- if (_optionalChain([environment, 'optionalAccess', _484 => _484.name])) return environment.name === "client";
5347
- return _optionalChain([loadOptions, 'optionalAccess', _485 => _485.ssr]) !== true;
5558
+ if (_optionalChain([environment, 'optionalAccess', _480 => _480.config, 'optionalAccess', _481 => _481.consumer])) return environment.config.consumer === "client";
5559
+ if (_optionalChain([environment, 'optionalAccess', _482 => _482.name])) return environment.name === "client";
5560
+ return _optionalChain([loadOptions, 'optionalAccess', _483 => _483.ssr]) !== true;
5348
5561
  }
5349
5562
  function invalidateProgrammaticClientRouteModules(server) {
5350
- const graph = _optionalChain([server, 'access', _486 => _486.environments, 'optionalAccess', _487 => _487.client, 'optionalAccess', _488 => _488.moduleGraph]);
5563
+ const graph = _optionalChain([server, 'access', _484 => _484.environments, 'optionalAccess', _485 => _485.client, 'optionalAccess', _486 => _486.moduleGraph]);
5351
5564
  if (!graph) return;
5352
5565
  for (const [id, module] of graph.idToModuleMap) {
5353
- if (_chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, id)) graph.invalidateModule(module);
5566
+ if (_chunkYUCU6XB4cjs.parseProgrammaticRouteModuleId.call(void 0, id)) graph.invalidateModule(module);
5354
5567
  }
5355
5568
  }
5356
5569
  function generateProgrammaticClientRouteModuleForId(moduleId, root, renderer, clientRoutes, watchFile) {
5357
- const parsed = _chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, moduleId);
5570
+ const parsed = _chunkYUCU6XB4cjs.parseProgrammaticRouteModuleId.call(void 0, moduleId);
5358
5571
  const routesFile = resolveRealModuleFile(parsed.filePath, root);
5359
5572
  watchFile(routesFile);
5360
- return _chunkHTXKSREFcjs.generateProgrammaticClientRouteModule.call(void 0, {
5573
+ return _chunkJNZDTE75cjs.generateProgrammaticClientRouteModule.call(void 0, {
5361
5574
  kind: parsed.kind,
5362
5575
  routePath: parsed.routePath,
5363
5576
  routesFile,
5364
- route: parsed.kind === "api" ? void 0 : _optionalChain([clientRoutes, 'optionalAccess', _489 => _489.routes, 'access', _490 => _490.get, 'call', _491 => _491(
5365
- _chunkHTXKSREFcjs.programmaticClientRouteKey.call(void 0, routesFile, parsed.kind, parsed.routePath)
5577
+ route: parsed.kind === "api" ? void 0 : _optionalChain([clientRoutes, 'optionalAccess', _487 => _487.routes, 'access', _488 => _488.get, 'call', _489 => _489(
5578
+ _chunkJNZDTE75cjs.programmaticClientRouteKey.call(void 0, routesFile, parsed.kind, parsed.routePath)
5366
5579
  )]),
5367
5580
  rendererServer: renderer.server,
5368
5581
  toImportSpecifier: (file) => toProgrammaticRouteImportSpecifier(file, root)
5369
5582
  });
5370
5583
  }
5371
5584
  function resolveRealModuleFile(filePath, root) {
5372
- const resolved = _nullishCoalesce(_chunkHTXKSREFcjs.resolveModuleSourcePath.call(void 0, filePath, root), () => ( filePath));
5585
+ const resolved = _nullishCoalesce(_chunkJNZDTE75cjs.resolveModuleSourcePath.call(void 0, filePath, root), () => ( filePath));
5373
5586
  try {
5374
- return _chunkQMNWKQL4cjs.toPosixPath.call(void 0, fs2.realpathSync(resolved));
5587
+ return _chunkGC5ROI3Acjs.toPosixPath.call(void 0, fs2.realpathSync(resolved));
5375
5588
  } catch (e28) {
5376
- return _chunkQMNWKQL4cjs.toPosixPath.call(void 0, resolved);
5589
+ return _chunkGC5ROI3Acjs.toPosixPath.call(void 0, resolved);
5377
5590
  }
5378
5591
  }
5379
5592
  function generateProgrammaticRouteModule(moduleId, root, renderer = _chunk67MZTLTFcjs.REACT_RENDERER) {
5380
- const parsed = _chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, moduleId);
5593
+ const parsed = _chunkYUCU6XB4cjs.parseProgrammaticRouteModuleId.call(void 0, moduleId);
5381
5594
  if (!parsed) {
5382
5595
  return "";
5383
5596
  }
@@ -5669,7 +5882,7 @@ export const OPTIONS = __farmRoute.methods.OPTIONS;
5669
5882
  `.trim();
5670
5883
  }
5671
5884
  function toProgrammaticRouteImportSpecifier(filePath, root) {
5672
- return root ? _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, filePath, root) : filePath;
5885
+ return root ? _chunkGC5ROI3Acjs.toViteModuleId.call(void 0, filePath, root) : filePath;
5673
5886
  }
5674
5887
  async function parseRouteModuleProps(routeModule, input) {
5675
5888
  if (typeof routeModule.__farmResolveRouteProps === "function") {
@@ -5683,12 +5896,12 @@ async function parseRouteModuleProps(routeModule, input) {
5683
5896
  }
5684
5897
  const schemas = routeModule.__farmRouteSchemas;
5685
5898
  const params = parseRouteModuleSchema(
5686
- _optionalChain([schemas, 'optionalAccess', _492 => _492.params]),
5899
+ _optionalChain([schemas, 'optionalAccess', _490 => _490.params]),
5687
5900
  input.props.params,
5688
5901
  "params",
5689
5902
  input.routePath
5690
5903
  );
5691
- const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _493 => _493.search]), input.search, "search", input.routePath);
5904
+ const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _491 => _491.search]), input.search, "search", input.routePath);
5692
5905
  return {
5693
5906
  ...input.props,
5694
5907
  params,
@@ -5708,12 +5921,12 @@ function parseRouteModuleSchema(schema, value, label, routePath) {
5708
5921
  }
5709
5922
  }
5710
5923
  function generateClientCode(integrationProviders = [], documentNavigationMatchers = [], docsSearchClientRuntime = EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME, devtoolsClientRuntime = "", plugins = [], root = process.cwd(), srcDir = "src", publicRuntimeConfig = void 0, docsAdapterReact, renderer = _chunk67MZTLTFcjs.REACT_RENDERER, isolatedHydrationEnabled = false, trailingSlash = false, basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false) {
5711
- const providerClientCode = _chunkTAU3OF5Bcjs.generateFarmIntegrationProviderClientCode.call(void 0,
5924
+ const providerClientCode = _chunkIK33N2ANcjs.generateFarmIntegrationProviderClientCode.call(void 0,
5712
5925
  integrationProviders,
5713
5926
  root,
5714
5927
  _nullishCoalesce(renderer.componentExtensions, () => ( []))
5715
5928
  );
5716
- const clientPluginEntry = _chunkDMXMIE2Ccjs.generateFarmClientPluginEntryCode.call(void 0,
5929
+ const clientPluginEntry = _chunkHVJ7IACBcjs.generateFarmClientPluginEntryCode.call(void 0,
5717
5930
  plugins,
5718
5931
  root,
5719
5932
  srcDir,
@@ -5721,8 +5934,9 @@ function generateClientCode(integrationProviders = [], documentNavigationMatcher
5721
5934
  );
5722
5935
  const appSetupPath = _chunk67MZTLTFcjs.resolveFarmRendererAppSetup.call(void 0, root, renderer);
5723
5936
  const rendererClientImports = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? `import React from 'react'
5724
- import { hydrateRoot, createRoot } from 'react-dom/client'` : appSetupPath ? `import React, { hydrateRoot, createRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)}
5725
- import __farmAppSetup from ${JSON.stringify(_chunkQMNWKQL4cjs.toViteModuleId.call(void 0, appSetupPath, root))}
5937
+ import { hydrateRoot, createRoot } from 'react-dom/client'
5938
+ import { restorePagePosition } from '@farm.js/core/internal/client-runtime'` : appSetupPath ? `import React, { hydrateRoot, createRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)}
5939
+ import __farmAppSetup from ${JSON.stringify(_chunkGC5ROI3Acjs.toViteModuleId.call(void 0, appSetupPath, root))}
5726
5940
  __farmConfigureApp(__farmAppSetup)` : `import React, { hydrateRoot, createRoot } from ${JSON.stringify(renderer.client)}`;
5727
5941
  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'"}` : "";
5728
5942
  const docsAdapterImportBlock = _chunkSM2SYWARcjs.generateFarmDocsAdapterClientRuntime.call(void 0,
@@ -5762,7 +5976,7 @@ async function createFarmServerTreePageElement(source, pathname) {
5762
5976
  return null;
5763
5977
  }
5764
5978
  }
5765
- ${islandValues ? `${_chunkTAU3OF5Bcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
5979
+ ${islandValues ? `${_chunkIK33N2ANcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
5766
5980
  let farmLastRouteState = null;
5767
5981
 
5768
5982
  // A hot update to a layout tree's client module renders the route again.
@@ -5782,7 +5996,7 @@ ${isolatedHydrationImport}
5782
5996
  import { installChunkErrorRecovery, SPARouter } from '@farm.js/core/client'
5783
5997
  import { createClientPluginManager } from '@farm.js/core/plugin/client'
5784
5998
  import { isFarmRouteActive } from '@farm.js/core/router'
5785
- import { isFarmBlockedNavigationURL, replayFarmQueuedInteraction, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from '@farm.js/core/internal/client-runtime'
5999
+ import { installFarmLinkPrefetch, isFarmBlockedNavigationURL, readFarmLinkNavigateOptions, rememberFarmLinkLocale, replayFarmQueuedInteraction, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from '@farm.js/core/internal/client-runtime'
5786
6000
  import { reviveDeferredData } from '@farm.js/core/deferred'
5787
6001
  import {
5788
6002
  createFarmDeploymentMismatchError,
@@ -6602,7 +6816,7 @@ async function loadLayoutComponents(layouts = [], params = {}, source) {
6602
6816
  return loadedLayouts;
6603
6817
  }
6604
6818
 
6605
- ${_chunkTAU3OF5Bcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
6819
+ ${_chunkIK33N2ANcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
6606
6820
  function wrapWithLoadedLayouts(element, loadedLayouts, params) {
6607
6821
  let wrapped = element;
6608
6822
  for (let index = loadedLayouts.length - 1; index >= 0; index--) {
@@ -6727,12 +6941,13 @@ async function tryHydrateImportedPage(
6727
6941
  hydrationOptions = {},
6728
6942
  ) {
6729
6943
  const modulePath = route?.modulePath;
6730
- if (!modulePath || signal?.aborted) {
6944
+ const pageShouldHydrate = hydrationOptions.pageShouldHydrate !== false;
6945
+ const layoutShouldHydrate = hydrationOptions.layoutShouldHydrate === true;
6946
+ // Layouts that hydrate around server HTML need no page module: a docs runtime page has none.
6947
+ if ((!modulePath && (pageShouldHydrate || !layoutShouldHydrate)) || signal?.aborted) {
6731
6948
  return false;
6732
6949
  }
6733
6950
 
6734
- const pageShouldHydrate = hydrationOptions.pageShouldHydrate !== false;
6735
- const layoutShouldHydrate = hydrationOptions.layoutShouldHydrate === true;
6736
6951
  const islandStrategy = hydrationOptions.islandStrategy || route.islandStrategy || 'load';
6737
6952
  let pageElement = null;
6738
6953
  // Import layouts before the page, root first, so Vite injects their CSS in the same
@@ -6787,10 +7002,12 @@ async function tryHydrateImportedPage(
6787
7002
  );
6788
7003
  } else if (layoutShouldHydrate) {
6789
7004
  currentPageProps = existingProps || { params };
7005
+ // A navigation passes the page element of the document it fetched, read as it is rather
7006
+ // than serialized and parsed again; hydration reads the page in this document.
6790
7007
  const serverPage = document.getElementById('__farm_page__');
6791
- const pageSource = typeof hydrationOptions.serverHtml === 'string'
6792
- ? hydrationOptions.serverHtml
6793
- : serverPage;
7008
+ const pageSource = hydrationOptions.navigationPage === undefined
7009
+ ? serverPage
7010
+ : hydrationOptions.navigationPage;
6794
7011
  const serverTree = pageSource
6795
7012
  ? await createFarmServerTreePageElement(pageSource, window.location.pathname)
6796
7013
  : null;
@@ -6801,9 +7018,7 @@ async function tryHydrateImportedPage(
6801
7018
  false,
6802
7019
  islandStrategy,
6803
7020
  null,
6804
- typeof hydrationOptions.serverHtml === 'string'
6805
- ? hydrationOptions.serverHtml
6806
- : serverPage ? serverPage.innerHTML : '',
7021
+ pageSource ? pageSource.innerHTML : '',
6807
7022
  );
6808
7023
  }
6809
7024
  if (signal?.aborted || !container?.isConnected || !pageElement) return false;
@@ -6824,7 +7039,7 @@ async function tryHydrateImportedPage(
6824
7039
  wrap: wrapFarmClientRouteGraph,
6825
7040
  };
6826
7041
  } else if (useHydrate && container?.id === '__farm_page__') {
6827
- wrappedElement = wrapFarmClientRouteGraph(pageElement);
7042
+ wrappedElement = wrapFarmClientRouteGraph(${_chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? "restorePagePosition(React, container, pageElement)" : "pageElement"});
6828
7043
  } else {
6829
7044
  wrappedElement = await buildWrappedHydrationElement(
6830
7045
  currentPageComponent,
@@ -6881,13 +7096,25 @@ function findLayoutBoundary(root, pattern) {
6881
7096
  return null;
6882
7097
  }
6883
7098
 
7099
+ // A layout that renders the document itself has no boundary element: the document names it.
7100
+ function readDocumentLayoutPatterns() {
7101
+ try {
7102
+ const patterns = JSON.parse(document.documentElement.getAttribute('data-farm-document-layouts') || '[]');
7103
+ return Array.isArray(patterns) ? patterns.filter((pattern) => typeof pattern === 'string') : [];
7104
+ } catch {
7105
+ return [];
7106
+ }
7107
+ }
7108
+
6884
7109
  function readActiveLayoutPatterns() {
6885
- return Array.from(document.querySelectorAll('[data-farm-layout-boundary="true"]'))
6886
- .map((element) => element.getAttribute('data-farm-layout-pattern'))
6887
- .filter(Boolean);
7110
+ return readDocumentLayoutPatterns().concat(
7111
+ Array.from(document.querySelectorAll('[data-farm-layout-boundary="true"]'))
7112
+ .map((element) => element.getAttribute('data-farm-layout-pattern'))
7113
+ .filter(Boolean),
7114
+ );
6888
7115
  }
6889
7116
 
6890
- ${_chunkTAU3OF5Bcjs.FARM_NAVIGATION_SCRIPT_SOURCE}
7117
+ ${_chunkIK33N2ANcjs.FARM_NAVIGATION_SCRIPT_SOURCE}
6891
7118
 
6892
7119
  function activateFragmentScripts(root) {
6893
7120
  for (const script of Array.from(root.querySelectorAll?.('script') || [])) {
@@ -6946,7 +7173,7 @@ function getLayoutShell(root, patterns, index, find) {
6946
7173
  return shell.innerHTML;
6947
7174
  }
6948
7175
 
6949
- ${islandValues ? _chunkTAU3OF5Bcjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceNavigationBoundary(
7176
+ ${islandValues ? _chunkIK33N2ANcjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceNavigationBoundary(
6950
7177
  container,
6951
7178
  fragment,
6952
7179
  currentPatterns,
@@ -7019,7 +7246,7 @@ ${islandValues ? `
7019
7246
  return nextTarget;
7020
7247
  }
7021
7248
 
7022
- ${islandValues ? `${_chunkTAU3OF5Bcjs.FARM_NAVIGATION_STREAM_READER_SOURCE}
7249
+ ${islandValues ? `${_chunkIK33N2ANcjs.FARM_NAVIGATION_STREAM_READER_SOURCE}
7023
7250
 
7024
7251
  // Islands mode navigates as the production client does: it fetches the page itself, names the
7025
7252
  // layouts it shows by key (F-Layouts), and asks for flush markers (F-Stream), so the shell arrives
@@ -7328,7 +7555,7 @@ async function renderPage(pageData, info) {
7328
7555
  pageShouldHydrate,
7329
7556
  layoutShouldHydrate,
7330
7557
  islandStrategy: route.islandStrategy,
7331
- serverHtml: nextPage ? nextPage.innerHTML : '',
7558
+ navigationPage: nextPage,
7332
7559
  layoutSource: fragment,
7333
7560
  loadingModulePath: route.loadingModulePath,
7334
7561
  },
@@ -7510,7 +7737,8 @@ function farmIslandsOnlyDocument() {
7510
7737
  if (hydratedSlots) replayPreHydrationClicks();
7511
7738
  return
7512
7739
  }
7513
- if (!modulePath) {
7740
+ // Layouts that hydrate around server HTML need no page module: a docs runtime page has none.
7741
+ if (!modulePath && (pageShouldHydrate || !layoutShouldHydrate)) {
7514
7742
  console.error('[Farm.js] No page module path found')
7515
7743
  return
7516
7744
  }
@@ -7678,16 +7906,13 @@ document.addEventListener('click', function(event) {
7678
7906
 
7679
7907
  // Use SPA router
7680
7908
  event.preventDefault();
7681
- const replace = target.hasAttribute('data-replace');
7682
- const scroll = !target.hasAttribute('data-no-scroll');
7683
- const viewTransitionValue = target.getAttribute('data-view-transition');
7684
- const viewTransition = viewTransitionValue === 'auto'
7685
- ? 'auto'
7686
- : viewTransitionValue === 'true';
7687
-
7688
- spaRouter.navigate(href, { replace, scroll, viewTransition });
7909
+ rememberFarmLinkLocale(target);
7910
+ spaRouter.navigate(href, readFarmLinkNavigateOptions(target));
7689
7911
  });
7690
7912
 
7913
+ // Link anchors on a page that does not hydrate prefetch through the router as Link would.
7914
+ installFarmLinkPrefetch();
7915
+
7691
7916
  if (import.meta.hot) {
7692
7917
  import.meta.hot.on('vite:beforeUpdate', () => {
7693
7918
  // Clear module cache on HMR to pick up changes
@@ -7718,9 +7943,9 @@ function generateClientManifest(bundle) {
7718
7943
  return manifest;
7719
7944
  }
7720
7945
  async function defineConfig(config = {}) {
7721
- const tailwindVitePlugin = await _chunkDMXMIE2Ccjs.loadTailwindVitePlugin.call(void 0, );
7946
+ const tailwindVitePlugin = await _chunkHVJ7IACBcjs.loadTailwindVitePlugin.call(void 0, );
7722
7947
  const appRoot = path6.resolve(config.root || process.cwd());
7723
- if (_optionalChain([config, 'access', _494 => _494.extends, 'optionalAccess', _495 => _495.length])) {
7948
+ if (_optionalChain([config, 'access', _492 => _492.extends, 'optionalAccess', _493 => _493.length])) {
7724
7949
  const { config: layeredConfig } = await import("./layers-7P4RLKVX.cjs").then(
7725
7950
  ({ resolveFarmLayers }) => resolveFarmLayers(config, {
7726
7951
  root: appRoot,
@@ -7730,7 +7955,7 @@ async function defineConfig(config = {}) {
7730
7955
  config = layeredConfig;
7731
7956
  }
7732
7957
  config.renderer = _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, config.renderer);
7733
- config.images = _chunkTAU3OF5Bcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, { root: appRoot, dev: true });
7958
+ config.images = _chunkIK33N2ANcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, { root: appRoot, dev: true });
7734
7959
  const rendererVitePlugins = await _chunk67MZTLTFcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, appRoot, {
7735
7960
  ssr: true
7736
7961
  });
@@ -7822,13 +8047,13 @@ async function defineConfig(config = {}) {
7822
8047
  if (!serverStarted) {
7823
8048
  serverStarted = true;
7824
8049
  const elapsed = Date.now() - startTime;
7825
- const address = _optionalChain([server, 'access', _496 => _496.httpServer, 'optionalAccess', _497 => _497.address, 'call', _498 => _498()]);
8050
+ const address = _optionalChain([server, 'access', _494 => _494.httpServer, 'optionalAccess', _495 => _495.address, 'call', _496 => _496()]);
7826
8051
  const resolvedPort = typeof address === "object" && address ? address.port : server.config.server.port || port || 3e3;
7827
8052
  const hostConfig = server.config.server.host;
7828
8053
  const isExposed = hostConfig === true || hostConfig === "0.0.0.0";
7829
8054
  console.log("");
7830
8055
  console.log(
7831
- ` ${pc.bold(pc.green("Farm.js"))} ${pc.dim(`v${_chunkUVQRMUARcjs.FARM_VERSION}`)} ${pc.dim(`ready in ${elapsed}ms`)}`
8056
+ ` ${pc.bold(pc.green("Farm.js"))} ${pc.dim(`v${_chunkIVBDRAORcjs.FARM_VERSION}`)} ${pc.dim(`ready in ${elapsed}ms`)}`
7832
8057
  );
7833
8058
  console.log("");
7834
8059
  console.log(
@@ -7862,23 +8087,23 @@ async function defineConfig(config = {}) {
7862
8087
  plugins: [
7863
8088
  // `farm dev --desktop`: only the desktop window gets an answer, as in the packaged app.
7864
8089
  _chunk3QM74STYcjs.farmDesktopDevGuardPlugin.call(void 0, config.basePath),
7865
- _chunkTAU3OF5Bcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
8090
+ _chunkIK33N2ANcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
7866
8091
  tailwindVitePlugin,
7867
8092
  ...rendererVitePlugins,
7868
8093
  ...reactRefreshPlugins,
7869
8094
  viteBrowserExternalPlugin,
7870
8095
  farmI18nClientBridgePlugin(),
7871
- farmServerOnlyEntriesPlugin(),
8096
+ farmServerOnlyEntriesPlugin({ distDir: config.distDir || ".farm" }),
7872
8097
  farmIslandContainersPlugin(config),
7873
8098
  farmPlugin(config),
7874
- _chunkHTXKSREFcjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
8099
+ _chunkJNZDTE75cjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
7875
8100
  farmBrandingPlugin
7876
8101
  ],
7877
8102
  customLogger: farmLogger,
7878
8103
  clearScreen: false,
7879
8104
  optimizeDeps: {
7880
- ..._chunkTAU3OF5Bcjs.createFarmClientOptimizeDepsConfig.call(void 0,
7881
- _chunkTAU3OF5Bcjs.createFarmClientOptimizeDepsEntries.call(void 0,
8105
+ ..._chunkIK33N2ANcjs.createFarmClientOptimizeDepsConfig.call(void 0,
8106
+ _chunkIK33N2ANcjs.createFarmClientOptimizeDepsEntries.call(void 0,
7882
8107
  appRoot,
7883
8108
  _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, { ...config, root: appRoot })
7884
8109
  ),
@@ -7921,7 +8146,7 @@ async function defineConfig(config = {}) {
7921
8146
  // Stub out problematic server-only modules during dev mode
7922
8147
  alias: {
7923
8148
  ..._chunkMTBDJ326cjs.getFarmLayerAliases.call(void 0, config.layers),
7924
- ..._chunkTAU3OF5Bcjs.createFarmSourceAlias.call(void 0, appRoot, config.srcDir),
8149
+ ..._chunkIK33N2ANcjs.createFarmSourceAlias.call(void 0, appRoot, config.srcDir),
7925
8150
  // Nitro internals that should not be resolved in browser
7926
8151
  "supports-color": "data:text/javascript,export default false; export const supportsColor = false; export const stdout = false; export const stderr = false;",
7927
8152
  "@poppinss/dumper": "data:text/javascript,export default {};",