@farm.js/core 0.1.68 → 0.1.70

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 (318) hide show
  1. package/dist/{agent-mcp-handler-FER4MQDF.cjs → agent-mcp-handler-6T2Z7TB6.cjs} +8 -5
  2. package/dist/{agent-mcp-handler-AZ7QW4UP.mjs → agent-mcp-handler-CPU354QQ.mjs} +7 -4
  3. package/dist/{agent-mcp.d-Uh5xr7aX.d.ts → agent-mcp.d-DulgFLBt.d.ts} +13 -4
  4. package/dist/{agent-mcp.d-wkVPK1GA.d.mts → agent-mcp.d-TAs1ES2F.d.mts} +13 -4
  5. package/dist/agent-runtime.cjs +3 -3
  6. package/dist/agent-runtime.d.mts +3 -2
  7. package/dist/agent-runtime.d.ts +3 -2
  8. package/dist/agent-runtime.mjs +2 -2
  9. package/dist/analyzer-GUIRJWZH.cjs +16 -0
  10. package/dist/{analyzer-CQDU7E3Y.mjs → analyzer-QGRBLETM.mjs} +2 -2
  11. package/dist/api/node.d.mts +5 -4
  12. package/dist/api/node.d.ts +5 -4
  13. package/dist/api/route-manager.cjs +4 -4
  14. package/dist/api/route-manager.d.mts +16 -7
  15. package/dist/api/route-manager.d.ts +16 -7
  16. package/dist/api/route-manager.mjs +3 -3
  17. package/dist/api/runtime.d.mts +4 -3
  18. package/dist/api/runtime.d.ts +4 -3
  19. package/dist/api.cjs +6 -6
  20. package/dist/api.d.mts +8 -24
  21. package/dist/api.d.ts +8 -24
  22. package/dist/api.mjs +5 -5
  23. package/dist/{app-manifest.d-Dd4q5CFx.d.mts → app-manifest.d-6zXb90o6.d.mts} +1 -1
  24. package/dist/{app-manifest.d-BT5i2F-o.d.ts → app-manifest.d-C-nf3Vmm.d.ts} +1 -1
  25. package/dist/app-markdown.cjs +5 -4
  26. package/dist/app-markdown.d.mts +4 -3
  27. package/dist/app-markdown.d.ts +4 -3
  28. package/dist/app-markdown.mjs +4 -3
  29. package/dist/{app.d-BVOpL_f2.d.ts → app.d-C2xeMIYT.d.ts} +18 -8
  30. package/dist/{app.d-BhiDXex_.d.mts → app.d-DF0aundc.d.mts} +18 -8
  31. package/dist/{base-path.d-BOUV5ozD.d.mts → base-path.d-BJ3SYpB8.d.mts} +7 -1
  32. package/dist/{base-path.d-BOUV5ozD.d.ts → base-path.d-BJ3SYpB8.d.ts} +7 -1
  33. package/dist/{chunk-4ZXKYCYK.mjs → chunk-255J7K4X.mjs} +1 -1
  34. package/dist/{chunk-RVGLYMJM.cjs → chunk-2AM26UGI.cjs} +2 -2
  35. package/dist/{chunk-UPOYKX4S.cjs → chunk-2MR4MABG.cjs} +4 -4
  36. package/dist/chunk-2RCCFB2Y.cjs +129 -0
  37. package/dist/{chunk-K6VFYFOY.cjs → chunk-2W4GNXGX.cjs} +2 -2
  38. package/dist/{chunk-URN7VFO7.cjs → chunk-32SYRIQ7.cjs} +21 -22
  39. package/dist/{chunk-CV6MFQ4Y.mjs → chunk-3AUINHFG.mjs} +1 -1
  40. package/dist/{chunk-KDO6T6OB.mjs → chunk-3EXCZJEN.mjs} +2 -2
  41. package/dist/{chunk-MMDKYJ5V.cjs → chunk-3GNVIYPO.cjs} +7 -7
  42. package/dist/{chunk-65Y5SIBH.cjs → chunk-3QM74STY.cjs} +1 -1
  43. package/dist/{chunk-NT4W4H52.mjs → chunk-3WS5AZ3R.mjs} +23 -18
  44. package/dist/{chunk-FJMC24KG.cjs → chunk-42KMUIWZ.cjs} +0 -3
  45. package/dist/{chunk-LR4KP3I7.cjs → chunk-4AC4PXZO.cjs} +2 -2
  46. package/dist/{chunk-YVPX5PI5.mjs → chunk-4O26BPUY.mjs} +8 -0
  47. package/dist/{chunk-LENKRGBV.mjs → chunk-5CFHQ7HM.mjs} +1 -1
  48. package/dist/{chunk-G7NBPP7H.mjs → chunk-5IJRJWJS.mjs} +1 -1
  49. package/dist/{chunk-MV7NWU23.mjs → chunk-5R3JQPWD.mjs} +1 -1
  50. package/dist/{chunk-3Y52TWYU.mjs → chunk-62ZRA7XU.mjs} +0 -3
  51. package/dist/{chunk-5JKDFRTK.cjs → chunk-65FPDDT4.cjs} +2 -2
  52. package/dist/{chunk-K6SXMVXO.mjs → chunk-75E5FDX2.mjs} +22 -7
  53. package/dist/{chunk-K76CBYQM.mjs → chunk-7A3URI2F.mjs} +20 -0
  54. package/dist/{chunk-VFNAK6A5.mjs → chunk-A2TH5MKE.mjs} +9 -5
  55. package/dist/{chunk-225APHKC.cjs → chunk-A7HCBHMC.cjs} +3 -3
  56. package/dist/{chunk-VX2HZGC7.cjs → chunk-ACGBXN3U.cjs} +2 -2
  57. package/dist/{chunk-Z3PW3DIR.cjs → chunk-BPUVDCGG.cjs} +5 -5
  58. package/dist/{chunk-FT6KJHS3.cjs → chunk-C2JOS77Z.cjs} +4 -1
  59. package/dist/{chunk-DIXFKAPM.mjs → chunk-CCHJWJGP.mjs} +297 -148
  60. package/dist/{chunk-CRVSYDHV.mjs → chunk-CKQAQFF6.mjs} +2 -2
  61. package/dist/chunk-DC2AXGNZ.mjs +129 -0
  62. package/dist/{chunk-TNK2TVRS.cjs → chunk-DIHBWZDZ.cjs} +449 -352
  63. package/dist/{chunk-JSOCDYER.cjs → chunk-DMXMIE2C.cjs} +15 -1
  64. package/dist/{chunk-23VJEGKC.cjs → chunk-DVJM55D2.cjs} +9 -1
  65. package/dist/{chunk-QSUYB3RH.cjs → chunk-DZHTNSQ5.cjs} +14 -14
  66. package/dist/{chunk-OIOPQ25L.mjs → chunk-E77IA5IF.mjs} +46 -33
  67. package/dist/{chunk-VRGY3X2I.mjs → chunk-EDZU7YRK.mjs} +8 -9
  68. package/dist/{chunk-EZTKXD6P.cjs → chunk-FDGYDQGL.cjs} +8 -1
  69. package/dist/{chunk-PLJKJJ2H.mjs → chunk-FETMUBIA.mjs} +27 -82
  70. package/dist/{chunk-HJZZSBVK.cjs → chunk-FILXOEWD.cjs} +2 -2
  71. package/dist/{chunk-KWCZKJYU.cjs → chunk-FJ5YCERM.cjs} +581 -432
  72. package/dist/{chunk-PDFFYZAT.cjs → chunk-GF22VGMS.cjs} +2 -2
  73. package/dist/{chunk-OOJBBHYW.cjs → chunk-GVYZCJZH.cjs} +30 -1
  74. package/dist/{chunk-MNJDNTGO.mjs → chunk-HAXFV2CD.mjs} +1 -1
  75. package/dist/{chunk-DXZ57EPE.mjs → chunk-I4KPA2C6.mjs} +14 -0
  76. package/dist/{chunk-LDEXTX4I.cjs → chunk-I7NUT24Z.cjs} +29 -22
  77. package/dist/{chunk-MZ4CRSY7.cjs → chunk-IEN2EFE5.cjs} +4 -4
  78. package/dist/{chunk-NVOMQLI2.mjs → chunk-IWJONXPF.mjs} +11 -0
  79. package/dist/{chunk-RLH5AH2M.mjs → chunk-JDO346NV.mjs} +1 -1
  80. package/dist/{chunk-WUTFJOV7.cjs → chunk-JFPKARWM.cjs} +16 -8
  81. package/dist/{chunk-A3T445WK.mjs → chunk-JFVT5ZZV.mjs} +9 -2
  82. package/dist/{chunk-WPB67LE5.mjs → chunk-JRF2SKCD.mjs} +1 -1
  83. package/dist/{chunk-YIHRZBD7.cjs → chunk-JRGR5Z4K.cjs} +1 -1
  84. package/dist/{chunk-UKZ6AWKZ.cjs → chunk-JWY66PID.cjs} +44 -1
  85. package/dist/{chunk-BDYM2TN3.cjs → chunk-JX5VOLAV.cjs} +8 -8
  86. package/dist/{chunk-WMLSZAKN.mjs → chunk-JZQS3ZOI.mjs} +1 -1
  87. package/dist/{chunk-YTNBCXCW.cjs → chunk-K4UGCUXX.cjs} +17 -13
  88. package/dist/{chunk-OFBLGH6V.cjs → chunk-K66JILV3.cjs} +47 -34
  89. package/dist/{chunk-QOGIZKSO.cjs → chunk-K7JMTAFH.cjs} +5 -5
  90. package/dist/{chunk-IFR74W6S.mjs → chunk-KPJYBSHL.mjs} +4 -1
  91. package/dist/{chunk-Z6SOXHAD.mjs → chunk-KPMLDT3B.mjs} +208 -111
  92. package/dist/{chunk-KI3MU7B5.mjs → chunk-LDVJIBGN.mjs} +1 -1
  93. package/dist/{chunk-IGDYL2IA.cjs → chunk-LECZ5DPZ.cjs} +2 -2
  94. package/dist/{chunk-5FBZJJGA.mjs → chunk-LXEJNWF5.mjs} +2 -2
  95. package/dist/{chunk-F36LS2C7.cjs → chunk-M6U6E4F7.cjs} +335 -285
  96. package/dist/{chunk-AKIQ54FK.cjs → chunk-MBCRWU3P.cjs} +26 -81
  97. package/dist/{chunk-P2NBQ5JI.mjs → chunk-MWUDEYBI.mjs} +1 -1
  98. package/dist/{chunk-SQ6IWJ3H.cjs → chunk-MZLJFNMH.cjs} +1 -1
  99. package/dist/{chunk-6OFOIMNS.mjs → chunk-N62IYXYD.mjs} +1 -1
  100. package/dist/{chunk-ZPKJPM7K.mjs → chunk-NA77GEIU.mjs} +2 -2
  101. package/dist/{chunk-FVYBEMOD.cjs → chunk-NAXKOTPP.cjs} +6 -6
  102. package/dist/{chunk-I7J5RLGO.cjs → chunk-NLBHLPEO.cjs} +12 -1
  103. package/dist/{chunk-3EEINK7G.cjs → chunk-NSZY3EWG.cjs} +10 -7
  104. package/dist/{chunk-F6CMGWAL.mjs → chunk-NYF7A4UW.mjs} +1 -1
  105. package/dist/{chunk-QO43L7Z4.cjs → chunk-O32QPFVV.cjs} +25 -7
  106. package/dist/{chunk-5IQ2ERQA.cjs → chunk-O47W53D3.cjs} +1 -1
  107. package/dist/{chunk-CO6UYM2D.mjs → chunk-O5QUJEWT.mjs} +1 -1
  108. package/dist/{chunk-JL2YW5KX.mjs → chunk-OAEDVXVE.mjs} +44 -1
  109. package/dist/{chunk-3TXKFRSO.mjs → chunk-OEL5EPOJ.mjs} +1 -1
  110. package/dist/{chunk-KSZK34HU.mjs → chunk-PJQ5W356.mjs} +16 -8
  111. package/dist/{chunk-BZWTBELF.cjs → chunk-Q5HMVGR5.cjs} +87 -17
  112. package/dist/{chunk-5NFQ6AZI.cjs → chunk-QEWWKYDL.cjs} +25 -10
  113. package/dist/{chunk-QOSDWGKT.mjs → chunk-QVBXTSIZ.mjs} +1 -1
  114. package/dist/{chunk-T5XFZQCL.mjs → chunk-QZHTDVH4.mjs} +1 -1
  115. package/dist/{chunk-HEJM46HQ.mjs → chunk-R7254L3R.mjs} +5 -2
  116. package/dist/{chunk-OGVTUGMU.mjs → chunk-REP6HWJN.mjs} +13 -3
  117. package/dist/{chunk-4UAQB5LB.mjs → chunk-RMOU3PR4.mjs} +112 -62
  118. package/dist/{chunk-WYL4ODZ4.mjs → chunk-SE7HPBYK.mjs} +30 -1
  119. package/dist/{chunk-2ZOYOYEE.mjs → chunk-THG2TVDH.mjs} +73 -3
  120. package/dist/{chunk-TEJ67GD2.mjs → chunk-TLSSIYAL.mjs} +20 -5
  121. package/dist/{chunk-DWLNLU55.cjs → chunk-TPYAYFMF.cjs} +2 -2
  122. package/dist/{chunk-Y6KHPJDB.cjs → chunk-U7VH3Q5E.cjs} +2 -2
  123. package/dist/{chunk-X3MHKLCO.cjs → chunk-VG6HYT5K.cjs} +26 -11
  124. package/dist/{chunk-437QZIC2.cjs → chunk-VNBDN5W2.cjs} +5 -5
  125. package/dist/{chunk-AJNBTOVQ.mjs → chunk-WW3LRNQV.mjs} +1 -1
  126. package/dist/{chunk-GFPS7MNE.mjs → chunk-WX63N6C5.mjs} +4 -4
  127. package/dist/{chunk-7LK5CTUM.cjs → chunk-XYVPTTUT.cjs} +31 -26
  128. package/dist/{chunk-VOQ7XZZT.cjs → chunk-Y2SZVIVH.cjs} +20 -0
  129. package/dist/{chunk-XCAQTCGK.mjs → chunk-YBY34UHB.mjs} +1 -1
  130. package/dist/{chunk-YGJ5P3TJ.mjs → chunk-Z3GPAFIA.mjs} +21 -3
  131. package/dist/{chunk-4E57QHPW.cjs → chunk-ZUVAGMQ5.cjs} +17 -7
  132. package/dist/{chunk-23LVFSID.mjs → chunk-ZXDX7VYZ.mjs} +7 -0
  133. package/dist/{client-component.d-BvQOxSqh.d.mts → client-component.d-Bk5qKJM-.d.mts} +2 -2
  134. package/dist/{client-component.d-DNVSLEPi.d.ts → client-component.d-DNbC4oWI.d.ts} +2 -2
  135. package/dist/{client-plugins.d-CNDqcAuf.d.ts → client-plugins.d-DwUqh4gp.d.ts} +50 -5
  136. package/dist/{client-plugins.d-CE1lVK2R.d.mts → client-plugins.d-Pi9nG0W0.d.mts} +50 -5
  137. package/dist/client-plugins.d.mts +3 -2
  138. package/dist/client-plugins.d.ts +3 -2
  139. package/dist/client.cjs +6 -6
  140. package/dist/client.d.mts +8 -7
  141. package/dist/client.d.ts +8 -7
  142. package/dist/client.mjs +5 -5
  143. package/dist/config.d.mts +3 -2
  144. package/dist/config.d.ts +3 -2
  145. package/dist/deployment.cjs +4 -2
  146. package/dist/deployment.d.mts +7 -1
  147. package/dist/deployment.d.ts +7 -1
  148. package/dist/deployment.mjs +5 -3
  149. package/dist/desktop.d.mts +4 -3
  150. package/dist/desktop.d.ts +4 -3
  151. package/dist/{dev-guard-ONNMVQUN.mjs → dev-guard-ZDIELV6Q.mjs} +1 -1
  152. package/dist/{dev-guard-2UW2KERP.cjs → dev-guard-ZLLKVO5T.cjs} +2 -2
  153. package/dist/{devtools-2A2GPC7B.mjs → devtools-CB43AHEP.mjs} +8 -7
  154. package/dist/{devtools-R27T3BRY.cjs → devtools-L5DUNDF3.cjs} +9 -8
  155. package/dist/docs.cjs +14 -11
  156. package/dist/docs.d.mts +17 -4
  157. package/dist/docs.d.ts +17 -4
  158. package/dist/docs.mjs +14 -11
  159. package/dist/environment/vite.cjs +3 -3
  160. package/dist/environment/vite.mjs +2 -2
  161. package/dist/headers.d-CE6OWB-n.d.ts +18 -0
  162. package/dist/headers.d-DED1hHh4.d.mts +18 -0
  163. package/dist/i18n/client.cjs +2 -2
  164. package/dist/i18n/client.d.mts +2 -2
  165. package/dist/i18n/client.d.ts +2 -2
  166. package/dist/i18n/client.mjs +1 -1
  167. package/dist/i18n/index.cjs +2 -2
  168. package/dist/i18n/index.d.mts +3 -3
  169. package/dist/i18n/index.d.ts +3 -3
  170. package/dist/i18n/index.mjs +1 -1
  171. package/dist/i18n/server.cjs +3 -3
  172. package/dist/i18n/server.d.mts +5 -5
  173. package/dist/i18n/server.d.ts +5 -5
  174. package/dist/i18n/server.mjs +2 -2
  175. package/dist/image/server.cjs +2 -2
  176. package/dist/image/server.mjs +1 -1
  177. package/dist/image/sharp.cjs +9 -9
  178. package/dist/image/sharp.mjs +1 -1
  179. package/dist/index.cjs +49 -45
  180. package/dist/{index.d-Bt3kl19W.d.mts → index.d-CbvOjJcp.d.mts} +1 -1
  181. package/dist/{index.d-Cx_-DaKV.d.ts → index.d-c9UwIqDy.d.ts} +1 -1
  182. package/dist/index.d.mts +26 -24
  183. package/dist/index.d.ts +26 -24
  184. package/dist/index.mjs +63 -59
  185. package/dist/integrations/orm.d.mts +3 -2
  186. package/dist/integrations/orm.d.ts +3 -2
  187. package/dist/integrations.cjs +3 -3
  188. package/dist/integrations.d.mts +3 -2
  189. package/dist/integrations.d.ts +3 -2
  190. package/dist/integrations.mjs +2 -2
  191. package/dist/internal/app-markdown-runtime.cjs +4 -3
  192. package/dist/internal/app-markdown-runtime.d.mts +4 -3
  193. package/dist/internal/app-markdown-runtime.d.ts +4 -3
  194. package/dist/internal/app-markdown-runtime.mjs +3 -2
  195. package/dist/internal/build-runtime.cjs +36 -37
  196. package/dist/internal/build-runtime.d.mts +5 -4
  197. package/dist/internal/build-runtime.d.ts +5 -4
  198. package/dist/internal/build-runtime.mjs +35 -36
  199. package/dist/internal/cli-runtime.cjs +15 -14
  200. package/dist/internal/cli-runtime.mjs +14 -13
  201. package/dist/internal/client-error-overlay.cjs +4 -4
  202. package/dist/internal/client-error-overlay.mjs +1 -1
  203. package/dist/internal/client-runtime.cjs +5 -3
  204. package/dist/internal/client-runtime.d.mts +17 -7
  205. package/dist/internal/client-runtime.d.ts +17 -7
  206. package/dist/internal/client-runtime.mjs +4 -2
  207. package/dist/internal/compression-runtime.d.mts +3 -2
  208. package/dist/internal/compression-runtime.d.ts +3 -2
  209. package/dist/internal/config-runtime.cjs +10 -9
  210. package/dist/internal/config-runtime.d.mts +6 -5
  211. package/dist/internal/config-runtime.d.ts +6 -5
  212. package/dist/internal/config-runtime.mjs +9 -8
  213. package/dist/internal/infra-analytics-runtime.cjs +12 -9
  214. package/dist/internal/infra-analytics-runtime.mjs +10 -7
  215. package/dist/internal/native-server-fns.cjs +4 -4
  216. package/dist/internal/native-server-fns.mjs +3 -3
  217. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  218. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  219. package/dist/internal/production-runtime.cjs +52 -17
  220. package/dist/internal/production-runtime.d.mts +57 -20
  221. package/dist/internal/production-runtime.d.ts +57 -20
  222. package/dist/internal/production-runtime.mjs +55 -20
  223. package/dist/internal/vercel-edge-middleware.cjs +3 -2
  224. package/dist/internal/vercel-edge-middleware.d.mts +2 -2
  225. package/dist/internal/vercel-edge-middleware.d.ts +2 -2
  226. package/dist/internal/vercel-edge-middleware.mjs +2 -1
  227. package/dist/markdown.cjs +3 -2
  228. package/dist/markdown.d.mts +3 -2
  229. package/dist/markdown.d.ts +3 -2
  230. package/dist/markdown.mjs +2 -1
  231. package/dist/middleware.cjs +6 -5
  232. package/dist/middleware.d.mts +4 -3
  233. package/dist/middleware.d.ts +4 -3
  234. package/dist/middleware.mjs +5 -4
  235. package/dist/mobile.d.mts +3 -3
  236. package/dist/mobile.d.ts +3 -3
  237. package/dist/{mount.d-Bki4pOaJ.d.mts → mount.d-BvWxf8ZE.d.mts} +1 -1
  238. package/dist/{mount.d-DjR5aerM.d.ts → mount.d-DngLY7NL.d.ts} +1 -1
  239. package/dist/{native-tree-W2SSJB3Y.cjs → native-tree-GF4BH33L.cjs} +4 -3
  240. package/dist/{native-tree-Y5YQANW7.mjs → native-tree-L2IIEBXH.mjs} +3 -2
  241. package/dist/{navigation-delegate.d-VDkziXTK.d.mts → navigation-delegate.d-CMyl1h2l.d.mts} +1 -1
  242. package/dist/{navigation-delegate.d-CtghaSP3.d.ts → navigation-delegate.d-zZogiDfa.d.ts} +1 -1
  243. package/dist/navigation.cjs +5 -5
  244. package/dist/navigation.d.mts +6 -5
  245. package/dist/navigation.d.ts +6 -5
  246. package/dist/navigation.mjs +4 -4
  247. package/dist/{plugin-WIU4GDD4.cjs → plugin-F2O4BFTK.cjs} +2 -2
  248. package/dist/{plugin-SAS22JL7.mjs → plugin-VEBRN7A3.mjs} +1 -1
  249. package/dist/plugin.cjs +30 -29
  250. package/dist/plugin.d.mts +6 -4
  251. package/dist/plugin.d.ts +6 -4
  252. package/dist/plugin.mjs +29 -28
  253. package/dist/{production-runtime.d-DMZY3OgV.d.mts → production-runtime.d-B0IeWWyO.d.mts} +23 -2
  254. package/dist/{production-runtime.d-BMyyLGBB.d.ts → production-runtime.d-q3aHIv5Y.d.ts} +23 -2
  255. package/dist/query/client.cjs +6 -6
  256. package/dist/query/client.mjs +2 -2
  257. package/dist/{render-plan.d-i9sI4tc9.d.ts → render-plan.d-DQj2bzd2.d.ts} +1 -1
  258. package/dist/{render-plan.d-BSwV8PE4.d.mts → render-plan.d-Di1znBDW.d.mts} +1 -1
  259. package/dist/renderer-client.cjs +7 -7
  260. package/dist/renderer-client.d.mts +6 -5
  261. package/dist/renderer-client.d.ts +6 -5
  262. package/dist/renderer-client.mjs +3 -3
  263. package/dist/{request.d-Dgln8tuI.d.ts → request.d-C5vyoYeL.d.ts} +1 -1
  264. package/dist/{request.d-C24FNQ_7.d.mts → request.d-CJWzfDYJ.d.mts} +1 -1
  265. package/dist/request.d.mts +4 -3
  266. package/dist/request.d.ts +4 -3
  267. package/dist/{resolver.d-JnZKKsc5.d.mts → resolver.d-9iKC79CU.d.mts} +1 -1
  268. package/dist/{resolver.d-BHyZgpa7.d.ts → resolver.d-CY6mEa_F.d.ts} +1 -1
  269. package/dist/response.d-B_MtBCnF.d.mts +12 -0
  270. package/dist/response.d-B_MtBCnF.d.ts +12 -0
  271. package/dist/{route-rendering.d-Ds0BfwQi.d.mts → route-rendering.d-C-et2TZ1.d.mts} +9 -2
  272. package/dist/{route-rendering.d-CUylZKJA.d.ts → route-rendering.d-DhsY5M2I.d.ts} +9 -2
  273. package/dist/{router.d-CFPcbqzc.d.mts → router.d-BMDS5s5X.d.mts} +1 -1
  274. package/dist/{router.d-B56rMOFm.d.ts → router.d-CJB-Ntni.d.ts} +1 -1
  275. package/dist/{routes.d-CrEy0lJS.d.mts → routes.d-D3aJw1H5.d.mts} +1 -1
  276. package/dist/{routes.d-9GFFNioh.d.ts → routes.d-K-Qg79AA.d.ts} +1 -1
  277. package/dist/routes.d.mts +3 -2
  278. package/dist/routes.d.ts +3 -2
  279. package/dist/{index.d-BNNDpql4.d.ts → routing.d-BxOZ2YWc.d.ts} +1 -2
  280. package/dist/{index.d-BqcfqJvt.d.mts → routing.d-DwSUVZbF.d.mts} +1 -2
  281. package/dist/{rsc-pipeline-GA4AQWZI.mjs → rsc-pipeline-AXQJCCHI.mjs} +12 -12
  282. package/dist/{rsc-pipeline-3T7V6OUT.cjs → rsc-pipeline-NJKLZ3YE.cjs} +13 -13
  283. package/dist/{runtime-REUTNTI5.cjs → runtime-DMW6DDOI.cjs} +19 -18
  284. package/dist/{runtime-ZYCKKY7L.mjs → runtime-JXNEKOSE.mjs} +11 -10
  285. package/dist/{runtime.d-BtL3PCL3.d.ts → runtime.d-B_uPfMjA.d.ts} +2 -2
  286. package/dist/{runtime.d-DLRO-ExG.d.mts → runtime.d-BonodRI9.d.mts} +1 -1
  287. package/dist/{runtime.d-3iJAKptR.d.mts → runtime.d-nUz0HAL4.d.mts} +2 -2
  288. package/dist/{runtime.d-H7k9hOQE.d.ts → runtime.d-uw4123iI.d.ts} +1 -1
  289. package/dist/server-plugins.cjs +3 -2
  290. package/dist/server-plugins.d.mts +6 -12
  291. package/dist/server-plugins.d.ts +6 -12
  292. package/dist/server-plugins.mjs +2 -1
  293. package/dist/server.cjs +64 -56
  294. package/dist/server.d.mts +23 -14
  295. package/dist/server.d.ts +23 -14
  296. package/dist/server.mjs +40 -32
  297. package/dist/{spa-router.d-Dr7oanhl.d.ts → spa-router.d-l0d9pPZj.d.ts} +3 -3
  298. package/dist/{spa-router.d-g4CzhEH1.d.mts → spa-router.d-rha3M95y.d.mts} +3 -3
  299. package/dist/testing.cjs +3 -3
  300. package/dist/testing.d.mts +3 -2
  301. package/dist/testing.d.ts +3 -2
  302. package/dist/testing.mjs +3 -3
  303. package/dist/{types.d-C41ePjvP.d.ts → types.d-wVRlLtBf.d.mts} +1 -1
  304. package/dist/{types.d-C41ePjvP.d.mts → types.d-wVRlLtBf.d.ts} +1 -1
  305. package/dist/{utils.d-BxxyDEb8.d.ts → utils.d-BK-PTOF8.d.ts} +1 -1
  306. package/dist/{utils.d-HIla3pD_.d.mts → utils.d-BzuTobEc.d.mts} +1 -1
  307. package/dist/version.cjs +2 -2
  308. package/dist/version.mjs +1 -1
  309. package/dist/vite.cjs +37 -29
  310. package/dist/vite.d.mts +26 -6
  311. package/dist/vite.d.ts +26 -6
  312. package/dist/vite.mjs +36 -28
  313. package/package.json +3 -3
  314. package/dist/analyzer-PPAHM4AW.cjs +0 -16
  315. package/dist/chunk-HHLEYA4B.cjs +0 -17
  316. package/dist/chunk-QYNZ3CTI.mjs +0 -17
  317. package/dist/response.d-BolW0Vx_.d.mts +0 -10
  318. package/dist/response.d-BolW0Vx_.d.ts +0 -10
@@ -2,10 +2,10 @@
2
2
 
3
3
 
4
4
 
5
- var _chunk65Y5SIBHcjs = require('./chunk-65Y5SIBH.cjs');
5
+ var _chunk3QM74STYcjs = require('./chunk-3QM74STY.cjs');
6
6
 
7
7
 
8
- var _chunk5IQ2ERQAcjs = require('./chunk-5IQ2ERQA.cjs');
8
+ var _chunkO47W53D3cjs = require('./chunk-O47W53D3.cjs');
9
9
 
10
10
 
11
11
 
@@ -30,21 +30,22 @@ var _chunk5IQ2ERQAcjs = require('./chunk-5IQ2ERQA.cjs');
30
30
 
31
31
 
32
32
 
33
- var _chunkF36LS2C7cjs = require('./chunk-F36LS2C7.cjs');
33
+ var _chunkM6U6E4F7cjs = require('./chunk-M6U6E4F7.cjs');
34
34
 
35
35
 
36
36
 
37
- var _chunkJSOCDYERcjs = require('./chunk-JSOCDYER.cjs');
38
37
 
38
+ var _chunkDMXMIE2Ccjs = require('./chunk-DMXMIE2C.cjs');
39
39
 
40
- var _chunkWUTFJOV7cjs = require('./chunk-WUTFJOV7.cjs');
40
+
41
+ var _chunkJFPKARWMcjs = require('./chunk-JFPKARWM.cjs');
41
42
 
42
43
 
43
44
  var _chunkAQLHD6HZcjs = require('./chunk-AQLHD6HZ.cjs');
44
45
 
45
46
 
46
47
 
47
- var _chunkQOGIZKSOcjs = require('./chunk-QOGIZKSO.cjs');
48
+ var _chunkK7JMTAFHcjs = require('./chunk-K7JMTAFH.cjs');
48
49
 
49
50
 
50
51
 
@@ -60,7 +61,7 @@ var _chunkPIUTGRDIcjs = require('./chunk-PIUTGRDI.cjs');
60
61
 
61
62
 
62
63
 
63
- var _chunkUPOYKX4Scjs = require('./chunk-UPOYKX4S.cjs');
64
+ var _chunk2MR4MABGcjs = require('./chunk-2MR4MABG.cjs');
64
65
 
65
66
 
66
67
  var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
@@ -78,13 +79,13 @@ var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
78
79
 
79
80
 
80
81
 
81
- var _chunkYTNBCXCWcjs = require('./chunk-YTNBCXCW.cjs');
82
+ var _chunkK4UGCUXXcjs = require('./chunk-K4UGCUXX.cjs');
82
83
 
83
84
 
84
- var _chunkX3MHKLCOcjs = require('./chunk-X3MHKLCO.cjs');
85
+ var _chunkVG6HYT5Kcjs = require('./chunk-VG6HYT5K.cjs');
85
86
 
86
87
 
87
- var _chunkIGDYL2IAcjs = require('./chunk-IGDYL2IA.cjs');
88
+ var _chunkLECZ5DPZcjs = require('./chunk-LECZ5DPZ.cjs');
88
89
 
89
90
 
90
91
  var _chunk7EPYN7GWcjs = require('./chunk-7EPYN7GW.cjs');
@@ -119,7 +120,7 @@ var _chunk7EPYN7GWcjs = require('./chunk-7EPYN7GW.cjs');
119
120
 
120
121
 
121
122
 
122
- var _chunkMZ4CRSY7cjs = require('./chunk-MZ4CRSY7.cjs');
123
+ var _chunkIEN2EFE5cjs = require('./chunk-IEN2EFE5.cjs');
123
124
 
124
125
 
125
126
 
@@ -143,10 +144,10 @@ var _chunkSTF6VDYQcjs = require('./chunk-STF6VDYQ.cjs');
143
144
 
144
145
 
145
146
 
146
- var _chunk4E57QHPWcjs = require('./chunk-4E57QHPW.cjs');
147
+ var _chunkZUVAGMQ5cjs = require('./chunk-ZUVAGMQ5.cjs');
147
148
 
148
149
 
149
- var _chunkQO43L7Z4cjs = require('./chunk-QO43L7Z4.cjs');
150
+ var _chunkO32QPFVVcjs = require('./chunk-O32QPFVV.cjs');
150
151
 
151
152
 
152
153
  var _chunkRE5E2G5Scjs = require('./chunk-RE5E2G5S.cjs');
@@ -176,7 +177,7 @@ var _chunk3EIPOTZVcjs = require('./chunk-3EIPOTZV.cjs');
176
177
 
177
178
 
178
179
 
179
- var _chunk3EEINK7Gcjs = require('./chunk-3EEINK7G.cjs');
180
+ var _chunkNSZY3EWGcjs = require('./chunk-NSZY3EWG.cjs');
180
181
 
181
182
 
182
183
 
@@ -184,21 +185,21 @@ var _chunk3EEINK7Gcjs = require('./chunk-3EEINK7G.cjs');
184
185
 
185
186
 
186
187
 
187
- var _chunkFT6KJHS3cjs = require('./chunk-FT6KJHS3.cjs');
188
+ var _chunkC2JOS77Zcjs = require('./chunk-C2JOS77Z.cjs');
188
189
 
189
190
 
190
191
 
191
192
 
192
193
 
193
194
 
194
- var _chunkBDYM2TN3cjs = require('./chunk-BDYM2TN3.cjs');
195
+ var _chunkJX5VOLAVcjs = require('./chunk-JX5VOLAV.cjs');
195
196
 
196
197
 
197
198
 
198
199
  var _chunkX333W5KVcjs = require('./chunk-X333W5KV.cjs');
199
200
 
200
201
 
201
- var _chunkVX2HZGC7cjs = require('./chunk-VX2HZGC7.cjs');
202
+ var _chunkACGBXN3Ucjs = require('./chunk-ACGBXN3U.cjs');
202
203
 
203
204
 
204
205
 
@@ -214,10 +215,10 @@ var _chunkKBGZ5FD6cjs = require('./chunk-KBGZ5FD6.cjs');
214
215
  var _chunkP2355C6Ecjs = require('./chunk-P2355C6E.cjs');
215
216
 
216
217
 
217
- var _chunkOFBLGH6Vcjs = require('./chunk-OFBLGH6V.cjs');
218
+ var _chunkK66JILV3cjs = require('./chunk-K66JILV3.cjs');
218
219
 
219
220
 
220
- var _chunkRVGLYMJMcjs = require('./chunk-RVGLYMJM.cjs');
221
+ var _chunk2AM26UGIcjs = require('./chunk-2AM26UGI.cjs');
221
222
 
222
223
 
223
224
 
@@ -242,7 +243,7 @@ var _chunkY3WG64CPcjs = require('./chunk-Y3WG64CP.cjs');
242
243
 
243
244
 
244
245
 
245
- var _chunkYIHRZBD7cjs = require('./chunk-YIHRZBD7.cjs');
246
+ var _chunkJRGR5Z4Kcjs = require('./chunk-JRGR5Z4K.cjs');
246
247
 
247
248
 
248
249
 
@@ -277,7 +278,10 @@ var _chunkSUCDVKUBcjs = require('./chunk-SUCDVKUB.cjs');
277
278
  var _chunkEVIWKPJVcjs = require('./chunk-EVIWKPJV.cjs');
278
279
 
279
280
 
280
- var _chunkSQ6IWJ3Hcjs = require('./chunk-SQ6IWJ3H.cjs');
281
+ var _chunkMZLJFNMHcjs = require('./chunk-MZLJFNMH.cjs');
282
+
283
+
284
+ var _chunkDVJM55D2cjs = require('./chunk-DVJM55D2.cjs');
281
285
 
282
286
 
283
287
  var _chunkPMJSG4JScjs = require('./chunk-PMJSG4JS.cjs');
@@ -292,19 +296,19 @@ var _chunkRWR7SMD7cjs = require('./chunk-RWR7SMD7.cjs');
292
296
  var _chunk6IOZPJ3Icjs = require('./chunk-6IOZPJ3I.cjs');
293
297
 
294
298
 
299
+ var _chunkDBYNZIIQcjs = require('./chunk-DBYNZIIQ.cjs');
295
300
 
296
301
 
297
302
 
298
- var _chunkI7J5RLGOcjs = require('./chunk-I7J5RLGO.cjs');
299
303
 
300
304
 
301
- var _chunkDBYNZIIQcjs = require('./chunk-DBYNZIIQ.cjs');
305
+ var _chunkNLBHLPEOcjs = require('./chunk-NLBHLPEO.cjs');
302
306
 
303
307
 
304
308
 
305
309
 
306
310
 
307
- var _chunkAKIQ54FKcjs = require('./chunk-AKIQ54FK.cjs');
311
+ var _chunkMBCRWU3Pcjs = require('./chunk-MBCRWU3P.cjs');
308
312
 
309
313
 
310
314
 
@@ -1016,13 +1020,13 @@ function reportOpenAPIDevGenerationResult(spec, output = _chunkQMNWKQL4cjs.logge
1016
1020
  // src/vite.ts
1017
1021
  var SERVER_FN_TRANSFORM_PLUGIN = "@farm.js/plugin/rsc:server-fn-actions";
1018
1022
  function farmLlmsTxtGeneratedPaths(config) {
1019
- const llms = _chunkQO43L7Z4cjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([config, 'access', _57 => _57.agent, 'optionalAccess', _58 => _58.llmsTxt]));
1023
+ const llms = _chunkO32QPFVVcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([config, 'access', _57 => _57.agent, 'optionalAccess', _58 => _58.llmsTxt]));
1020
1024
  if (!llms.enabled) return [];
1021
1025
  return llms.full ? ["/llms.txt", "/llms-full.txt"] : ["/llms.txt"];
1022
1026
  }
1023
1027
  function farmAgentGeneratedPaths(config) {
1024
- const crawlers = _chunk4E57QHPWcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([config, 'access', _59 => _59.agent, 'optionalAccess', _60 => _60.crawlers]));
1025
- const sitemap = _chunk4E57QHPWcjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([config, 'access', _61 => _61.agent, 'optionalAccess', _62 => _62.sitemap]));
1028
+ const crawlers = _chunkZUVAGMQ5cjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([config, 'access', _59 => _59.agent, 'optionalAccess', _60 => _60.crawlers]));
1029
+ const sitemap = _chunkZUVAGMQ5cjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([config, 'access', _61 => _61.agent, 'optionalAccess', _62 => _62.sitemap]));
1026
1030
  return [
1027
1031
  ...farmLlmsTxtGeneratedPaths(config),
1028
1032
  ...sitemap.enabled ? ["/sitemap.xml"] : [],
@@ -1067,7 +1071,7 @@ function loadFarmWorkflowsDevRuntime() {
1067
1071
  return import("./workflows.cjs");
1068
1072
  }
1069
1073
  function loadFarmDevtoolsSnapshotRuntime() {
1070
- return import("./devtools-R27T3BRY.cjs");
1074
+ return import("./devtools-L5DUNDF3.cjs");
1071
1075
  }
1072
1076
  function loadFarmDevtoolsUIRuntime() {
1073
1077
  return import("./devtools-ui-SYRUXUA7.cjs");
@@ -1098,16 +1102,16 @@ var FARM_SERVER_ONLY_PACKAGE_ID = "\0farm:server-only";
1098
1102
  var FARM_PLATFORM_ENTRY = "@farm.js/core/platform";
1099
1103
  var FARM_PLATFORM_CLIENT_ID = "\0farm:platform-client";
1100
1104
  var FARM_SERVER_ONLY_ENTRIES_RESOLVE_FILTER = [
1101
- _chunkF36LS2C7cjs.exactIdPattern.call(void 0, [FARM_PLATFORM_ENTRY, SERVER_ONLY_PACKAGE, ...FARM_SERVER_ONLY_ENTRIES]),
1102
- new RegExp(`^${_chunkMZ4CRSY7cjs.FARM_RESOLVE_FROM_PREFIX}`),
1105
+ _chunkM6U6E4F7cjs.exactIdPattern.call(void 0, [FARM_PLATFORM_ENTRY, SERVER_ONLY_PACKAGE, ...FARM_SERVER_ONLY_ENTRIES]),
1106
+ new RegExp(`^${_chunkIEN2EFE5cjs.FARM_RESOLVE_FROM_PREFIX}`),
1103
1107
  // What isBuiltin() accepts: `node:` ids and the builtin names, subpaths such as fs/promises
1104
1108
  // included.
1105
1109
  /^node:/,
1106
- _chunkF36LS2C7cjs.exactIdPattern.call(void 0, _module.builtinModules)
1110
+ _chunkM6U6E4F7cjs.exactIdPattern.call(void 0, _module.builtinModules)
1107
1111
  ];
1108
1112
  var FARM_SERVER_ONLY_ENTRIES_LOAD_FILTER = [
1109
- _chunkF36LS2C7cjs.exactIdPattern.call(void 0, [FARM_SERVER_ONLY_PACKAGE_ID, FARM_PLATFORM_CLIENT_ID]),
1110
- new RegExp(`^${_chunkMZ4CRSY7cjs.FARM_BROWSER_BUILTIN_PREFIX}`)
1113
+ _chunkM6U6E4F7cjs.exactIdPattern.call(void 0, [FARM_SERVER_ONLY_PACKAGE_ID, FARM_PLATFORM_CLIENT_ID]),
1114
+ new RegExp(`^${_chunkIEN2EFE5cjs.FARM_BROWSER_BUILTIN_PREFIX}`)
1111
1115
  ];
1112
1116
  function createFarmPlatformClientModule(platform) {
1113
1117
  return `export function platform() { return ${JSON.stringify(platform)}; }
@@ -1135,11 +1139,11 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1135
1139
  name: "farm:server-only-entries",
1136
1140
  enforce: "pre",
1137
1141
  config(config) {
1138
- const bundledPackages = _chunkMZ4CRSY7cjs.collectFarmServerBundledPackageInfo.call(void 0,
1142
+ const bundledPackages = _chunkIEN2EFE5cjs.collectFarmServerBundledPackageInfo.call(void 0,
1139
1143
  path6.resolve(_nullishCoalesce(config.root, () => ( process.cwd())))
1140
1144
  );
1141
1145
  return {
1142
- optimizeDeps: { rolldownOptions: { plugins: [_chunkMZ4CRSY7cjs.farmBrowserBuiltinsOptimizerPlugin.call(void 0, )] } },
1146
+ optimizeDeps: { rolldownOptions: { plugins: [_chunkIEN2EFE5cjs.farmBrowserBuiltinsOptimizerPlugin.call(void 0, )] } },
1143
1147
  ssr: {
1144
1148
  noExternal: [
1145
1149
  // Resolve `server-only` here rather than in Node, which would load its throwing build.
@@ -1167,9 +1171,9 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1167
1171
  );
1168
1172
  }
1169
1173
  if (!_optionalChain([options2, 'optionalAccess', _67 => _67.ssr]) && _module.isBuiltin.call(void 0, id)) {
1170
- return _chunkMZ4CRSY7cjs.resolveFarmBrowserBuiltin.call(void 0, this, id, importer, options2);
1174
+ return _chunkIEN2EFE5cjs.resolveFarmBrowserBuiltin.call(void 0, this, id, importer, options2);
1171
1175
  }
1172
- const resolveFrom = importer ? _chunkMZ4CRSY7cjs.parseFarmResolveFrom.call(void 0, id, importer.split("?", 1)[0]) : null;
1176
+ const resolveFrom = importer ? _chunkIEN2EFE5cjs.parseFarmResolveFrom.call(void 0, id, importer.split("?", 1)[0]) : null;
1173
1177
  if (resolveFrom) {
1174
1178
  const directory = path6.dirname(resolveFrom.importer);
1175
1179
  return this.resolve(resolveFrom.specifier, resolveFrom.importer, {
@@ -1205,7 +1209,7 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1205
1209
  if (id === FARM_PLATFORM_CLIENT_ID) {
1206
1210
  return createFarmPlatformClientModule(_nullishCoalesce(options.platform, () => ( _chunkAQLHD6HZcjs.resolveFarmPlatform.call(void 0, ))));
1207
1211
  }
1208
- return _nullishCoalesce(_chunkMZ4CRSY7cjs.loadFarmBrowserBuiltin.call(void 0, id), () => ( null));
1212
+ return _nullishCoalesce(_chunkIEN2EFE5cjs.loadFarmBrowserBuiltin.call(void 0, id), () => ( null));
1209
1213
  }
1210
1214
  }
1211
1215
  };
@@ -1238,7 +1242,7 @@ function renderFarmI18nStaticHead(requestPath, snapshot) {
1238
1242
  if (!snapshot) return "";
1239
1243
  const runtime = `<script>window.__FARM_I18N__ = ${serializeFarmInlineValue(snapshot)};</script>`;
1240
1244
  if (snapshot.routing === "none") return runtime;
1241
- return `${_chunkUPOYKX4Scjs.renderFarmLocaleAlternateLinks.call(void 0, requestPath, snapshot)}${runtime}`;
1245
+ return `${_chunk2MR4MABGcjs.renderFarmLocaleAlternateLinks.call(void 0, requestPath, snapshot)}${runtime}`;
1242
1246
  }
1243
1247
  function getPublicEnvDefine(config) {
1244
1248
  const publicEnv = _optionalChain([config, 'access', _69 => _69.env, 'optionalAccess', _70 => _70.public]);
@@ -1301,15 +1305,22 @@ function createFarmDevMiddlewareErrorResponse() {
1301
1305
  headers: { "Content-Type": "application/json", "Cache-Control": "private, no-store" }
1302
1306
  });
1303
1307
  }
1304
- function sendFarmDevRuntimeHookError(res, json) {
1308
+ function setFarmDevRuntimeHookErrorHead(res, json) {
1309
+ for (const name of res.getHeaderNames()) res.removeHeader(name);
1305
1310
  res.statusCode = 500;
1306
1311
  res.setHeader("Content-Type", json ? "application/json" : "text/plain; charset=utf-8");
1312
+ }
1313
+ function sendFarmDevRuntimeHookError(res, json) {
1314
+ setFarmDevRuntimeHookErrorHead(res, json);
1307
1315
  res.end(json ? _chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY : "Internal Server Error");
1308
1316
  }
1317
+ function opensFarmDevRuntimeSession(pm) {
1318
+ return pm.hasRuntimeRequestHooks() || _chunkDMXMIE2Ccjs.hasFarmServerRuntimePlugins.call(void 0, pm.getPlugins());
1319
+ }
1309
1320
  var FARM_CONFIG_ROUTE_PLUGIN_NAMES = /* @__PURE__ */ new Set([
1310
- _chunkAKIQ54FKcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME,
1311
- _chunkAKIQ54FKcjs.FARM_CONFIG_REDIRECTS_PLUGIN_NAME,
1312
- _chunkAKIQ54FKcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME
1321
+ _chunkMBCRWU3Pcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME,
1322
+ _chunkMBCRWU3Pcjs.FARM_CONFIG_REDIRECTS_PLUGIN_NAME,
1323
+ _chunkMBCRWU3Pcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME
1313
1324
  ]);
1314
1325
  function isFarmConfigRoutePlugin(plugin) {
1315
1326
  return FARM_CONFIG_ROUTE_PLUGIN_NAMES.has(plugin.name);
@@ -1323,7 +1334,7 @@ async function proxyFarmExternalRewrite(req, res, bodySizeLimit) {
1323
1334
  const body = await _chunkCFG4QERRcjs.readNodeRequestBody.call(void 0, req, bodySizeLimit);
1324
1335
  request = new Request(request, { body: toRequestBody(body) });
1325
1336
  }
1326
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, await _chunkYIHRZBD7cjs.fetchFarmExternalRewrite.call(void 0, request));
1337
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, await _chunkJRGR5Z4Kcjs.fetchFarmExternalRewrite.call(void 0, request));
1327
1338
  return true;
1328
1339
  }
1329
1340
  function toRequestBody(body) {
@@ -1360,7 +1371,7 @@ function applyWebResponseToNodeResponse(response, res) {
1360
1371
  for (const name of res.getHeaderNames()) {
1361
1372
  res.removeHeader(name);
1362
1373
  }
1363
- _chunkYIHRZBD7cjs.applyWebResponseHeaders.call(void 0, res, response.headers);
1374
+ _chunkJRGR5Z4Kcjs.applyWebResponseHeaders.call(void 0, res, response.headers);
1364
1375
  }
1365
1376
  function toNodeResponseBuffer(chunk, encoding) {
1366
1377
  if (chunk === void 0 || chunk === null || typeof chunk === "function") return void 0;
@@ -1417,7 +1428,7 @@ function interceptFarmDevPageResponse(options) {
1417
1428
  res.end = originalEnd;
1418
1429
  res.writeHead = originalWriteHead;
1419
1430
  if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
1420
- delete res[_chunkWUTFJOV7cjs.FARM_NODE_RESPONSE_END_PENDING];
1431
+ delete res[_chunkJFPKARWMcjs.FARM_NODE_RESPONSE_END_PENDING];
1421
1432
  };
1422
1433
  let runtimeHookFailed = false;
1423
1434
  const endRuntimeRequest = (response) => pm.endRuntimeRequest(runtimeSession, response).catch((error) => {
@@ -1429,12 +1440,7 @@ function interceptFarmDevPageResponse(options) {
1429
1440
  console.error("Error in afterResponse hook:", error);
1430
1441
  };
1431
1442
  const writeRuntimeHookFailure = () => {
1432
- res.statusCode = 500;
1433
- res.removeHeader("Content-Length");
1434
- res.setHeader(
1435
- "Content-Type",
1436
- options.jsonError ? "application/json" : "text/plain; charset=utf-8"
1437
- );
1443
+ setFarmDevRuntimeHookErrorHead(res, Boolean(options.jsonError));
1438
1444
  originalWriteHead(500);
1439
1445
  originalWrite(options.jsonError ? _chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY : "Internal Server Error");
1440
1446
  };
@@ -1546,7 +1552,7 @@ function interceptFarmDevPageResponse(options) {
1546
1552
  });
1547
1553
  res.end = ((...args) => {
1548
1554
  interceptedEnd = true;
1549
- res[_chunkWUTFJOV7cjs.FARM_NODE_RESPONSE_END_PENDING] = true;
1555
+ res[_chunkJFPKARWMcjs.FARM_NODE_RESPONSE_END_PENDING] = true;
1550
1556
  if (afterResponseCalled) return res;
1551
1557
  afterResponseCalled = true;
1552
1558
  options.logResponse(method, urlPath, res.statusCode || 200, Date.now() - startTime, "PAGE");
@@ -1629,7 +1635,7 @@ function interceptFarmDevPageResponse(options) {
1629
1635
  res.end = originalEnd;
1630
1636
  res.writeHead = originalWriteHead;
1631
1637
  if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
1632
- delete res[_chunkWUTFJOV7cjs.FARM_NODE_RESPONSE_END_PENDING];
1638
+ delete res[_chunkJFPKARWMcjs.FARM_NODE_RESPONSE_END_PENDING];
1633
1639
  originalEnd(...originalEndArgs);
1634
1640
  }).catch((error) => {
1635
1641
  reportFailure(error);
@@ -1646,14 +1652,14 @@ function interceptFarmDevPageResponse(options) {
1646
1652
  res.end = originalEnd;
1647
1653
  res.writeHead = originalWriteHead;
1648
1654
  if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
1649
- delete res[_chunkWUTFJOV7cjs.FARM_NODE_RESPONSE_END_PENDING];
1655
+ delete res[_chunkJFPKARWMcjs.FARM_NODE_RESPONSE_END_PENDING];
1650
1656
  originalEnd(body, callback);
1651
1657
  } else {
1652
1658
  res.write = originalWrite;
1653
1659
  res.end = originalEnd;
1654
1660
  res.writeHead = originalWriteHead;
1655
1661
  if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
1656
- delete res[_chunkWUTFJOV7cjs.FARM_NODE_RESPONSE_END_PENDING];
1662
+ delete res[_chunkJFPKARWMcjs.FARM_NODE_RESPONSE_END_PENDING];
1657
1663
  originalEnd(...originalEndArgs);
1658
1664
  }
1659
1665
  });
@@ -1812,7 +1818,7 @@ function transformIsolatedClientBoundaryModule(options) {
1812
1818
  return null;
1813
1819
  }
1814
1820
  const body = Array.isArray(ast.body) ? ast.body : [];
1815
- const everyExportIsComponent = options.code.includes(_chunkMZ4CRSY7cjs.FARM_CLIENT_REFERENCE_PRAGMA) || options.moduleReference.includes(_chunkMZ4CRSY7cjs.FARM_CLIENT_REFERENCE_DIRECTORY);
1821
+ const everyExportIsComponent = options.code.includes(_chunkIEN2EFE5cjs.FARM_CLIENT_REFERENCE_PRAGMA) || options.moduleReference.includes(_chunkIEN2EFE5cjs.FARM_CLIENT_REFERENCE_DIRECTORY);
1816
1822
  const replacements = [];
1817
1823
  const wrapperStatements = [];
1818
1824
  const originalEntries = [];
@@ -1979,7 +1985,7 @@ function hasViteAlias(alias, find) {
1979
1985
  function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
1980
1986
  const rendererDisabled = _chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, options.renderer);
1981
1987
  const imageImports = farmImageImportsPlugin();
1982
- const fontImports = _chunkF36LS2C7cjs.farmFontImportsPlugin.call(void 0, {
1988
+ const fontImports = _chunkM6U6E4F7cjs.farmFontImportsPlugin.call(void 0, {
1983
1989
  root: options.root,
1984
1990
  basePath: options.basePath,
1985
1991
  publicDir: options.publicDir
@@ -2024,7 +2030,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2024
2030
  config(userConfig, configEnv) {
2025
2031
  isBuild = configEnv.command === "build";
2026
2032
  const layerAliases = _chunkMTBDJ326cjs.getFarmLayerAliases.call(void 0, options.layers);
2027
- const sourceAlias = hasViteAlias(_optionalChain([userConfig, 'access', _105 => _105.resolve, 'optionalAccess', _106 => _106.alias]), "@") ? {} : _chunkF36LS2C7cjs.createFarmSourceAlias.call(void 0, options.root || process.cwd(), options.srcDir);
2033
+ const sourceAlias = hasViteAlias(_optionalChain([userConfig, 'access', _105 => _105.resolve, 'optionalAccess', _106 => _106.alias]), "@") ? {} : _chunkM6U6E4F7cjs.createFarmSourceAlias.call(void 0, options.root || process.cwd(), options.srcDir);
2028
2034
  const layerRoots = (_nullishCoalesce(options.layers, () => ( []))).map((layer) => layer.root);
2029
2035
  farmOwnsDevCors = !isBuild && _optionalChain([userConfig, 'access', _107 => _107.server, 'optionalAccess', _108 => _108.cors]) === void 0;
2030
2036
  return {
@@ -2054,7 +2060,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2054
2060
  serverFnTransformActive = config.plugins.some(
2055
2061
  (plugin2) => plugin2.name === SERVER_FN_TRANSFORM_PLUGIN
2056
2062
  );
2057
- reactRefreshActive = _chunk65Y5SIBHcjs.isFarmReactRefreshActive.call(void 0, config);
2063
+ reactRefreshActive = _chunk3QM74STYcjs.isFarmReactRefreshActive.call(void 0, config);
2058
2064
  if (_optionalChain([options, 'access', _112 => _112.experimental, 'optionalAccess', _113 => _113.serverActions]) === true && !serverFnTransformActive && !islandsServerFns()) {
2059
2065
  _chunkQMNWKQL4cjs.logger.warn(
2060
2066
  "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."
@@ -2078,7 +2084,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2078
2084
  _optionalChain([pm, 'optionalAccess', _120 => _120.getPlugins, 'call', _121 => _121(), 'access', _122 => _122.filter, 'call', _123 => _123(isFarmConfigRoutePlugin), 'access', _124 => _124.map, 'call', _125 => _125((plugin2) => plugin2.name)])
2079
2085
  );
2080
2086
  const configRedirectMatchers = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _126 => _126.getPlugins, 'call', _127 => _127()]), () => ( []))).flatMap((plugin2) => {
2081
- const matcher = _chunkAKIQ54FKcjs.getConfigRedirectMatcher.call(void 0, plugin2);
2087
+ const matcher = _chunkMBCRWU3Pcjs.getConfigRedirectMatcher.call(void 0, plugin2);
2082
2088
  return matcher ? [matcher] : [];
2083
2089
  });
2084
2090
  const emitPluginError = async (phase, error, meta) => {
@@ -2088,7 +2094,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2088
2094
  } catch (e21) {
2089
2095
  }
2090
2096
  };
2091
- farmApp = new (0, _chunkF36LS2C7cjs.FarmApp)(
2097
+ farmApp = new (0, _chunkM6U6E4F7cjs.FarmApp)(
2092
2098
  {
2093
2099
  ...options,
2094
2100
  root: resolveDevelopmentRoot(options.root, server.config.root)
@@ -2096,7 +2102,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2096
2102
  server
2097
2103
  );
2098
2104
  farmApp.getRouteManager().usePackageClientBoundaryCacheFile(
2099
- _chunkMZ4CRSY7cjs.resolvePackageClientBoundaryCacheFile.call(void 0,
2105
+ _chunkIEN2EFE5cjs.resolvePackageClientBoundaryCacheFile.call(void 0,
2100
2106
  farmApp.getConfig().root,
2101
2107
  options.distDir || ".farm"
2102
2108
  )
@@ -2106,15 +2112,15 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2106
2112
  let farmAppPackages;
2107
2113
  if (_optionalChain([farmConfig, 'access', _128 => _128.agent, 'optionalAccess', _129 => _129.noindexPreviews])) {
2108
2114
  farmMiddlewares.use((_req, res, next) => {
2109
- if (_chunkIGDYL2IAcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env)) {
2110
- res.setHeader("X-Robots-Tag", _chunk4E57QHPWcjs.FARM_PREVIEW_ROBOTS_TAG);
2115
+ if (_chunkLECZ5DPZcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env)) {
2116
+ res.setHeader("X-Robots-Tag", _chunkZUVAGMQ5cjs.FARM_PREVIEW_ROBOTS_TAG);
2111
2117
  }
2112
2118
  next();
2113
2119
  });
2114
2120
  }
2115
2121
  const apiServerBasePath = _chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, farmConfig.api);
2116
2122
  const devBuiltInRoutePaths = new Set(
2117
- _chunkYTNBCXCWcjs.listFarmBuiltInRoutePaths.call(void 0, {
2123
+ _chunkK4UGCUXXcjs.listFarmBuiltInRoutePaths.call(void 0, {
2118
2124
  agent: {
2119
2125
  apiCatalog: true,
2120
2126
  mcp: true,
@@ -2130,7 +2136,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2130
2136
  let imageHandler = null;
2131
2137
  if (farmConfig.images.provider !== "none") {
2132
2138
  const { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } = await import("./image/sharp.cjs");
2133
- imageHandler = _chunk5IQ2ERQAcjs.createFarmImageHandler.call(void 0, farmConfig.images, {
2139
+ imageHandler = _chunkO47W53D3cjs.createFarmImageHandler.call(void 0, farmConfig.images, {
2134
2140
  transform: createSharpImageTransformer(),
2135
2141
  fetchRemote: createNodeImageFetcher(farmConfig.images),
2136
2142
  validateRemoteUrl: createNodeImageUrlValidator(farmConfig.images),
@@ -2164,7 +2170,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2164
2170
  );
2165
2171
  const generateTypeArtifacts = async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
2166
2172
  try {
2167
- const result = await _chunkQOGIZKSOcjs.generateFarmTypeArtifacts.call(void 0, {
2173
+ const result = await _chunkK7JMTAFHcjs.generateFarmTypeArtifacts.call(void 0, {
2168
2174
  root: farmConfig.root,
2169
2175
  srcDir: farmConfig.srcDir,
2170
2176
  layers: farmConfig.layers,
@@ -2343,7 +2349,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2343
2349
  }
2344
2350
  })]);
2345
2351
  }
2346
- apiRouteManager = new (0, _chunkOFBLGH6Vcjs.APIRouteManager)(appDirs, server, {
2352
+ apiRouteManager = new (0, _chunkK66JILV3cjs.APIRouteManager)(appDirs, server, {
2347
2353
  plugins: farmConfig.plugins,
2348
2354
  i18n: farmApp.getI18nRuntime(),
2349
2355
  bodySizeLimit: serverConfig.bodySizeLimit,
@@ -2389,7 +2395,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2389
2395
  });
2390
2396
  }
2391
2397
  }
2392
- middlewareManager = new (0, _chunkVX2HZGC7cjs.MiddlewareManager)(
2398
+ middlewareManager = new (0, _chunkACGBXN3Ucjs.MiddlewareManager)(
2393
2399
  appDirs,
2394
2400
  server,
2395
2401
  farmConfig.middleware,
@@ -2444,7 +2450,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2444
2450
  return _chunk7EPYN7GWcjs.resolveFarmLayoutFonts.call(void 0, layoutModules);
2445
2451
  };
2446
2452
  releaseDocsMCPServers();
2447
- const isFarmDocsPathGuarded = (href) => _chunkUPOYKX4Scjs.farmPathGuardCoversPage.call(void 0,
2453
+ const isFarmDocsPathGuarded = (href) => _chunk2MR4MABGcjs.farmPathGuardCoversPage.call(void 0,
2448
2454
  {
2449
2455
  config: farmConfig,
2450
2456
  middlewareRoutes: middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
@@ -2457,7 +2463,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2457
2463
  clientEntry: "/@farm/client.js",
2458
2464
  resolveLayoutFonts: resolveDocsLayoutFonts,
2459
2465
  fontStylesheetHref: "/@farm/fonts.css",
2460
- globalStylesheetHref: _chunkF36LS2C7cjs.resolveDevGlobalStylesheetHref.call(void 0,
2466
+ globalStylesheetHref: _chunkM6U6E4F7cjs.resolveDevGlobalStylesheetHref.call(void 0,
2461
2467
  farmConfig.root,
2462
2468
  farmConfig.srcDir
2463
2469
  ),
@@ -2488,22 +2494,50 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2488
2494
  fontAssets: _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, farmDocsFontAssetList),
2489
2495
  resolveLayoutFonts: resolveDocsLayoutFonts,
2490
2496
  fontStylesheetHref: "/@farm/fonts.css",
2491
- globalStylesheetHref: _chunkF36LS2C7cjs.resolveDevGlobalStylesheetHref.call(void 0,
2497
+ globalStylesheetHref: _chunkM6U6E4F7cjs.resolveDevGlobalStylesheetHref.call(void 0,
2492
2498
  farmConfig.root,
2493
2499
  farmConfig.srcDir
2494
2500
  ),
2495
2501
  isPathGuarded: isFarmDocsPathGuarded,
2496
2502
  basePath: farmConfig.basePath
2497
2503
  }) : null;
2504
+ const farmDocsListsPages = Boolean(
2505
+ farmDocsDevRuntime && _optionalChain([pm, 'optionalAccess', _163 => _163.getPlugins, 'call', _164 => _164(), 'access', _165 => _165.some, 'call', _166 => _166((plugin2) => plugin2.name === "farm:infra-analytics")])
2506
+ );
2507
+ let farmDocsPagePaths;
2508
+ const getFarmDocsPagePaths = () => {
2509
+ if (!farmDocsDevRuntime || !farmDocsListsPages) return void 0;
2510
+ _nullishCoalesce(farmDocsPagePaths, () => ( (farmDocsPagePaths = farmDocsDevRuntime.listFarmDocsPagePaths(farmConfig.docs, {
2511
+ root: farmConfig.root,
2512
+ srcDir: farmConfig.srcDir,
2513
+ adapter: farmDocsDevRuntime.hasFarmDocsRuntimeAdapter(farmConfig.docs)
2514
+ }).then(
2515
+ (pages) => new Set(pages),
2516
+ (error) => {
2517
+ _chunkQMNWKQL4cjs.logger.warn(
2518
+ `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)}).`
2519
+ );
2520
+ return void 0;
2521
+ }
2522
+ ))));
2523
+ return farmDocsPagePaths;
2524
+ };
2525
+ if (farmDocsListsPages) {
2526
+ for (const event of ["add", "unlink"]) {
2527
+ server.watcher.on(event, () => {
2528
+ farmDocsPagePaths = void 0;
2529
+ });
2530
+ }
2531
+ }
2498
2532
  const wrapFarmDocsResponseWithLayouts = async (request, response) => {
2499
- if (request.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !_optionalChain([response, 'access', _163 => _163.headers, 'access', _164 => _164.get, 'call', _165 => _165("content-type"), 'optionalAccess', _166 => _166.toLowerCase, 'call', _167 => _167(), 'access', _168 => _168.includes, 'call', _169 => _169("text/html")])) {
2533
+ if (request.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !_optionalChain([response, 'access', _167 => _167.headers, 'access', _168 => _168.get, 'call', _169 => _169("content-type"), 'optionalAccess', _170 => _170.toLowerCase, 'call', _171 => _171(), 'access', _172 => _172.includes, 'call', _173 => _173("text/html")])) {
2500
2534
  return response;
2501
2535
  }
2502
2536
  const pathname = new URL(request.url).pathname;
2503
2537
  const matchedRoute = routeManager.matchRoute(pathname);
2504
2538
  const layoutEntries = matchedRoute.layouts.map((layout) => ({
2505
2539
  ...layout,
2506
- metadata: _chunkMZ4CRSY7cjs.getClientModuleMetadata.call(void 0, layout.modulePath, farmConfig.root)
2540
+ metadata: _chunkIEN2EFE5cjs.getClientModuleMetadata.call(void 0, layout.modulePath, farmConfig.root)
2507
2541
  }));
2508
2542
  if (!layoutEntries.some((layout) => layout.metadata.shouldHydrate)) {
2509
2543
  return response;
@@ -2517,7 +2551,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2517
2551
  headers: response.headers
2518
2552
  });
2519
2553
  }
2520
- const docsRenderer = _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, (_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _170 => _170.getConfig, 'call', _171 => _171()]), () => ( options))).renderer);
2554
+ const docsRenderer = _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, (_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _174 => _174.getConfig, 'call', _175 => _175()]), () => ( options))).renderer);
2521
2555
  const [rendererRuntime, layoutModules] = await Promise.all([
2522
2556
  _chunk67MZTLTFcjs.isReactRenderer.call(void 0, docsRenderer) ? import("./renderer/react/server.cjs") : _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, docsRenderer.server),
2523
2557
  Promise.all(
@@ -2546,7 +2580,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2546
2580
  ])
2547
2581
  );
2548
2582
  const inlineValue = (value) => JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
2549
- const pageModulePath = _optionalChain([matchedRoute, 'access', _172 => _172.route, 'optionalAccess', _173 => _173.modulePath]) ? toUrlPath(matchedRoute.route.modulePath) : "";
2583
+ const pageModulePath = _optionalChain([matchedRoute, 'access', _176 => _176.route, 'optionalAccess', _177 => _177.modulePath]) ? toUrlPath(matchedRoute.route.modulePath) : "";
2550
2584
  const bootstrapScript = `<script>
2551
2585
  window.__FARM_PROPS__ = ${inlineValue({ params })};
2552
2586
  window.__FARM_ROUTE_SLOTS__ = [];
@@ -2643,7 +2677,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2643
2677
  }
2644
2678
  },
2645
2679
  (request) => {
2646
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _174 => _174.getConfig, 'call', _175 => _175()]), () => ( options));
2680
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _178 => _178.getConfig, 'call', _179 => _179()]), () => ( options));
2647
2681
  const currentServerConfig = _chunkCFG4QERRcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
2648
2682
  return _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, request, {
2649
2683
  trustProxy: currentServerConfig.trustProxy
@@ -2659,7 +2693,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2659
2693
  withAPIRequestTracing(async function handleFarmDevRequest(req, res, next) {
2660
2694
  const requestUrl = req.url || "/";
2661
2695
  const requestMethod = req.method || "GET";
2662
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _176 => _176.getConfig, 'call', _177 => _177()]), () => ( options));
2696
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _180 => _180.getConfig, 'call', _181 => _181()]), () => ( options));
2663
2697
  const currentServerConfig = _chunkCFG4QERRcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
2664
2698
  const parsedRequestUrl = _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, {
2665
2699
  trustProxy: currentServerConfig.trustProxy
@@ -2697,7 +2731,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2697
2731
  createRequestFromNodeRequest(req, new URL(fullUrl))
2698
2732
  );
2699
2733
  if (imageResponse) {
2700
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, imageResponse);
2734
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, imageResponse);
2701
2735
  return;
2702
2736
  }
2703
2737
  }
@@ -2753,7 +2787,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2753
2787
  openapi: options.openapi
2754
2788
  },
2755
2789
  workflows: discoveredWorkflows,
2756
- plugins: _optionalChain([pm, 'optionalAccess', _178 => _178.getSortedPlugins, 'call', _179 => _179()])
2790
+ plugins: _optionalChain([pm, 'optionalAccess', _182 => _182.getSortedPlugins, 'call', _183 => _183()])
2757
2791
  });
2758
2792
  res.statusCode = 200;
2759
2793
  res.setHeader(
@@ -2778,12 +2812,51 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2778
2812
  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]));
2779
2813
  const configRewriteSource = req[FARM_DEV_CONFIG_REWRITE_SOURCE];
2780
2814
  const runtimeHookErrorAnswersJSON = rendererDisabled || _chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath);
2781
- if (pm && configRewriteSource === void 0 && !deferredDottedRequests.has(req) && (configRoutePlugins.has(_chunkAKIQ54FKcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME) || configRedirectMatchers.length > 0) && !isViteOwnedRequest()) {
2815
+ const requestedPagePathname = configRewriteSource === void 0 ? requestPathname : new URL(configRewriteSource).pathname;
2816
+ let pageHookRouteMatch;
2817
+ const pageHookRoute = (pathname2) => {
2818
+ if (_optionalChain([pageHookRouteMatch, 'optionalAccess', _184 => _184.render, 'access', _185 => _185.pathname]) === pathname2) return pageHookRouteMatch;
2819
+ const match = farmApp.getRouteManager().matchRoute(pathname2);
2820
+ pageHookRouteMatch = {
2821
+ render: {
2822
+ pathname: pathname2,
2823
+ method: requestMethod,
2824
+ routePattern: _optionalChain([match, 'optionalAccess', _186 => _186.route, 'optionalAccess', _187 => _187.pattern]) || null,
2825
+ params: _optionalChain([match, 'optionalAccess', _188 => _188.params]) || {}
2826
+ },
2827
+ layoutPatterns: (_optionalChain([match, 'optionalAccess', _189 => _189.layouts]) || []).map((layout) => layout.pattern)
2828
+ };
2829
+ return pageHookRouteMatch;
2830
+ };
2831
+ const runFarmDevPageHooks = async (pathname2 = requestedPagePathname) => {
2832
+ if (!pm || !pm.hasHook("beforeRouteMatch") && !pm.hasHook("afterRouteMatch") && !pm.hasHook("beforeRender")) {
2833
+ return;
2834
+ }
2835
+ const { render, layoutPatterns } = pageHookRoute(pathname2);
2836
+ const routeManager3 = farmApp.getRouteManager();
2837
+ if (routeManager3.matchMetadataRoute(render.pathname) || routeManager3.matchMetadataImage(render.pathname) || // A path no page route matches is a page only for a GET or HEAD request.
2838
+ !render.routePattern && requestMethod !== "GET" && requestMethod !== "HEAD") {
2839
+ return;
2840
+ }
2841
+ await pm.runHookParallel("beforeRouteMatch", {
2842
+ pathname: render.pathname,
2843
+ method: requestMethod
2844
+ });
2845
+ await pm.runHookParallel("afterRouteMatch", {
2846
+ pathname: render.pathname,
2847
+ matched: Boolean(render.routePattern),
2848
+ routePattern: render.routePattern,
2849
+ params: render.params,
2850
+ layoutPatterns
2851
+ });
2852
+ await pm.runHookParallel("beforeRender", render);
2853
+ };
2854
+ if (pm && configRewriteSource === void 0 && !deferredDottedRequests.has(req) && (configRoutePlugins.has(_chunkMBCRWU3Pcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME) || configRedirectMatchers.length > 0) && !isViteOwnedRequest()) {
2782
2855
  let redirect = null;
2783
2856
  try {
2784
2857
  await pm.runHookParallelFiltered(
2785
2858
  "beforeRequest",
2786
- (plugin2) => plugin2.name === _chunkAKIQ54FKcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME,
2859
+ (plugin2) => plugin2.name === _chunkMBCRWU3Pcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME,
2787
2860
  req,
2788
2861
  res
2789
2862
  );
@@ -2804,16 +2877,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2804
2877
  status: redirect.statusCode,
2805
2878
  headers: { Location: redirect.destination }
2806
2879
  });
2807
- if (pm.hasRuntimeRequestHooks()) {
2880
+ if (opensFarmDevRuntimeSession(pm)) {
2808
2881
  const redirectResponse = response;
2809
2882
  try {
2883
+ const kind = _chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath) ? "api" : requestMethod === "GET" || requestMethod === "HEAD" ? "page" : "request";
2810
2884
  response = await pm.runRuntimeRequest(
2811
2885
  createRequestFromNodeRequest(req, parsedRequestUrl),
2812
- () => redirectResponse,
2813
- {
2814
- kind: _chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath) ? "api" : requestMethod === "GET" || requestMethod === "HEAD" ? "page" : "request",
2815
- route: { pathname: requestPathname }
2816
- }
2886
+ async () => {
2887
+ if (kind === "page") await runFarmDevPageHooks();
2888
+ return redirectResponse;
2889
+ },
2890
+ { kind, route: { pathname: requestPathname } }
2817
2891
  );
2818
2892
  } catch (e23) {
2819
2893
  sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
@@ -2821,13 +2895,13 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2821
2895
  return;
2822
2896
  }
2823
2897
  }
2824
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
2898
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
2825
2899
  logResponse(requestMethod, requestUrl, res.statusCode, 0, "PAGE");
2826
2900
  return;
2827
2901
  }
2828
2902
  }
2829
2903
  const runAppMiddlewareForContentRoute = async () => {
2830
- if (!_optionalChain([middlewareManager, 'optionalAccess', _180 => _180.hasMiddleware, 'call', _181 => _181()])) return false;
2904
+ if (!_optionalChain([middlewareManager, 'optionalAccess', _190 => _190.hasMiddleware, 'call', _191 => _191()])) return false;
2831
2905
  const middlewareRequest = createRequestFromNodeRequest(req, new URL(fullUrl));
2832
2906
  return runFarmMiddlewareWithNavigation(
2833
2907
  farmApp.getServerRenderer(),
@@ -2837,8 +2911,35 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2837
2911
  () => middlewareManager.execute(req, res)
2838
2912
  );
2839
2913
  };
2914
+ const sendDevErrorPage = (error) => {
2915
+ if (!res.headersSent) {
2916
+ res.setHeader("Content-Type", "text/html; charset=utf-8");
2917
+ res.setHeader("Cache-Control", "private, no-store");
2918
+ }
2919
+ next(error);
2920
+ };
2921
+ const sendMiddlewareErrorJSON = async (runtimeSession2, error) => {
2922
+ let response = createFarmDevMiddlewareErrorResponse();
2923
+ if (runtimeSession2) {
2924
+ const errorResponse = response;
2925
+ try {
2926
+ response = await pm.completeRuntimeRequest(
2927
+ runtimeSession2,
2928
+ async (_request, runtime) => {
2929
+ await runtime.reportError(error);
2930
+ return errorResponse;
2931
+ }
2932
+ );
2933
+ } catch (e24) {
2934
+ sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
2935
+ return 500;
2936
+ }
2937
+ }
2938
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
2939
+ return response.status;
2940
+ };
2840
2941
  const runAppMiddlewareInRuntimeSession = async (runtimeSession2, logResponse2) => {
2841
- const interceptor = runtimeSession2 && _optionalChain([pm, 'optionalAccess', _182 => _182.hasRuntimeHook, 'call', _183 => _183("after")]) && _optionalChain([middlewareManager, 'optionalAccess', _184 => _184.hasMiddleware, 'call', _185 => _185()]) ? interceptFarmDevPageResponse({
2942
+ const interceptor = runtimeSession2 && _optionalChain([pm, 'optionalAccess', _192 => _192.hasRuntimeHook, 'call', _193 => _193("after")]) && _optionalChain([middlewareManager, 'optionalAccess', _194 => _194.hasMiddleware, 'call', _195 => _195()]) ? interceptFarmDevPageResponse({
2842
2943
  req,
2843
2944
  res,
2844
2945
  pm,
@@ -2851,7 +2952,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2851
2952
  urlPath: requestUrl,
2852
2953
  pathname: requestPathname,
2853
2954
  startTime: Date.now(),
2854
- logResponse: (_method, _path, status) => _optionalChain([logResponse2, 'optionalCall', _186 => _186(status)]),
2955
+ logResponse: (_method, _path, status) => _optionalChain([logResponse2, 'optionalCall', _196 => _196(status)]),
2855
2956
  // The runtime reports a runtime.after failure itself.
2856
2957
  emitError: async () => {
2857
2958
  },
@@ -2861,14 +2962,19 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2861
2962
  try {
2862
2963
  handled = await runAppMiddlewareForContentRoute();
2863
2964
  } catch (error) {
2864
- _optionalChain([interceptor, 'optionalAccess', _187 => _187.release, 'call', _188 => _188()]);
2865
- throw error;
2965
+ if (runtimeHookErrorAnswersJSON || res.headersSent) {
2966
+ _optionalChain([interceptor, 'optionalAccess', _197 => _197.release, 'call', _198 => _198()]);
2967
+ throw error;
2968
+ }
2969
+ if (runtimeSession2) await pm.reportRuntimeRequestError(runtimeSession2, error);
2970
+ sendDevErrorPage(error);
2971
+ return true;
2866
2972
  }
2867
2973
  if (!handled) {
2868
- _optionalChain([interceptor, 'optionalAccess', _189 => _189.release, 'call', _190 => _190()]);
2974
+ _optionalChain([interceptor, 'optionalAccess', _199 => _199.release, 'call', _200 => _200()]);
2869
2975
  return false;
2870
2976
  }
2871
- if (!_optionalChain([interceptor, 'optionalAccess', _191 => _191.isEnded, 'call', _192 => _192()])) _optionalChain([logResponse2, 'optionalCall', _193 => _193(res.statusCode || 200)]);
2977
+ if (!_optionalChain([interceptor, 'optionalAccess', _201 => _201.isEnded, 'call', _202 => _202()])) _optionalChain([logResponse2, 'optionalCall', _203 => _203(res.statusCode || 200)]);
2872
2978
  return true;
2873
2979
  };
2874
2980
  const serveBuiltInRoute = async (respond, {
@@ -2877,32 +2983,32 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2877
2983
  label
2878
2984
  } = {}) => {
2879
2985
  const discard = async () => {
2880
- await _optionalChain([computed, 'optionalAccess', _194 => _194.body, 'optionalAccess', _195 => _195.cancel, 'call', _196 => _196(), 'access', _197 => _197.catch, 'call', _198 => _198(() => {
2986
+ await _optionalChain([computed, 'optionalAccess', _204 => _204.body, 'optionalAccess', _205 => _205.cancel, 'call', _206 => _206(), 'access', _207 => _207.catch, 'call', _208 => _208(() => {
2881
2987
  })]);
2882
2988
  };
2883
2989
  const sendRuntimeResponse = async (runtimeSession3, response2) => {
2884
2990
  let runtimeResponse;
2885
2991
  try {
2886
2992
  runtimeResponse = await pm.endRuntimeRequest(runtimeSession3, response2);
2887
- } catch (e24) {
2993
+ } catch (e25) {
2888
2994
  sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
2889
2995
  return;
2890
2996
  }
2891
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, runtimeResponse);
2997
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, runtimeResponse);
2892
2998
  };
2893
2999
  let runtimeSession2;
2894
- if (_optionalChain([pm, 'optionalAccess', _199 => _199.hasRuntimeRequestHooks, 'call', _200 => _200()])) {
3000
+ if (pm && opensFarmDevRuntimeSession(pm)) {
2895
3001
  try {
2896
3002
  const routePathname = _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath);
2897
- const route = _chunkYTNBCXCWcjs.setFarmRouteLabel.call(void 0,
3003
+ const route = _chunkK4UGCUXXcjs.setFarmRouteLabel.call(void 0,
2898
3004
  { pathname: requestPathname },
2899
- label !== void 0 ? label : devBuiltInRoutePaths.has(routePathname) ? routePathname : _chunkYTNBCXCWcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath)
3005
+ label !== void 0 ? label : devBuiltInRoutePaths.has(routePathname) ? routePathname : _chunkK4UGCUXXcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath)
2900
3006
  );
2901
3007
  runtimeSession2 = await pm.beginRuntimeRequest(
2902
3008
  createRequestFromNodeRequest(req, new URL(fullUrl)),
2903
3009
  { kind, route }
2904
3010
  );
2905
- } catch (e25) {
3011
+ } catch (e26) {
2906
3012
  await discard();
2907
3013
  sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
2908
3014
  return;
@@ -2914,6 +3020,16 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2914
3020
  }
2915
3021
  pm.copyRequestContext(runtimeSession2.request, req);
2916
3022
  applyWebRequestToNodeRequest(runtimeSession2.request, req);
3023
+ if (kind === "page") {
3024
+ try {
3025
+ await runFarmDevPageHooks();
3026
+ } catch (error) {
3027
+ await discard();
3028
+ await pm.failRuntimeRequest(runtimeSession2, error);
3029
+ sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
3030
+ return;
3031
+ }
3032
+ }
2917
3033
  }
2918
3034
  let response;
2919
3035
  let responding = false;
@@ -2924,21 +3040,27 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2924
3040
  }
2925
3041
  responding = true;
2926
3042
  response = await respond(
2927
- _nullishCoalesce(_optionalChain([runtimeSession2, 'optionalAccess', _201 => _201.request]), () => ( createRequestFromNodeRequest(req, new URL(fullUrl))))
3043
+ _nullishCoalesce(_optionalChain([runtimeSession2, 'optionalAccess', _209 => _209.request]), () => ( createRequestFromNodeRequest(req, new URL(fullUrl))))
2928
3044
  );
2929
3045
  } catch (error) {
3046
+ if (!responding && !res.headersSent) {
3047
+ _chunkQMNWKQL4cjs.logger.error(`Middleware error: ${error}`);
3048
+ await discard();
3049
+ await sendMiddlewareErrorJSON(runtimeSession2, error);
3050
+ return;
3051
+ }
2930
3052
  if (runtimeSession2) await pm.failRuntimeRequest(runtimeSession2, error);
2931
- if (!runtimeSession2 || !responding || res.headersSent) throw error;
3053
+ if (!runtimeSession2 || res.headersSent) throw error;
2932
3054
  console.error("[FARM] Built-in route error:", error);
2933
3055
  sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
2934
3056
  return;
2935
3057
  }
2936
3058
  if (!response) return;
2937
3059
  if (runtimeSession2) await sendRuntimeResponse(runtimeSession2, response);
2938
- else await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
3060
+ else await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
2939
3061
  };
2940
3062
  const openAPIRequestPathname = openAPIManager ? _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) : requestPathname;
2941
- if (openAPIManager && _optionalChain([options, 'access', _202 => _202.openapi, 'optionalAccess', _203 => _203.specRoute]) && openAPIRequestPathname === options.openapi.specRoute) {
3063
+ if (openAPIManager && _optionalChain([options, 'access', _210 => _210.openapi, 'optionalAccess', _211 => _211.specRoute]) && openAPIRequestPathname === options.openapi.specRoute) {
2942
3064
  const specManager = openAPIManager;
2943
3065
  await serveBuiltInRoute(async () => {
2944
3066
  if (requestMethod !== "GET" && requestMethod !== "HEAD") {
@@ -2958,7 +3080,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2958
3080
  });
2959
3081
  return;
2960
3082
  }
2961
- if (openAPIManager && openAPIRequestPathname === _optionalChain([options, 'access', _204 => _204.openapi, 'optionalAccess', _205 => _205.route])) {
3083
+ if (openAPIManager && openAPIRequestPathname === _optionalChain([options, 'access', _212 => _212.openapi, 'optionalAccess', _213 => _213.route])) {
2962
3084
  const docsManager = openAPIManager;
2963
3085
  await serveBuiltInRoute(
2964
3086
  async () => {
@@ -2969,24 +3091,24 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2969
3091
  );
2970
3092
  return;
2971
3093
  }
2972
- if (_optionalChain([options, 'access', _206 => _206.agent, 'optionalAccess', _207 => _207.manifest]) !== false && _chunkYTNBCXCWcjs.isFarmAppManifestPath.call(void 0, _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath))) {
3094
+ if (_optionalChain([options, 'access', _214 => _214.agent, 'optionalAccess', _215 => _215.manifest]) !== false && _chunkK4UGCUXXcjs.isFarmAppManifestPath.call(void 0, _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath))) {
2973
3095
  await serveBuiltInRoute(async () => {
2974
- _nullishCoalesce(farmAppPackages, () => ( (farmAppPackages = _chunkF36LS2C7cjs.resolveFarmAppPackages.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd()))))));
2975
- const manifest = await _chunkYTNBCXCWcjs.createFarmAppManifestResponse.call(void 0,
3096
+ _nullishCoalesce(farmAppPackages, () => ( (farmAppPackages = _chunkM6U6E4F7cjs.resolveFarmAppPackages.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd()))))));
3097
+ const manifest = await _chunkK4UGCUXXcjs.createFarmAppManifestResponse.call(void 0,
2976
3098
  new Request(parsedRequestUrl, {
2977
3099
  method: requestMethod,
2978
3100
  headers: { "if-none-match": String(_nullishCoalesce(req.headers["if-none-match"], () => ( ""))) }
2979
3101
  }),
2980
3102
  {
2981
- ..._chunkYTNBCXCWcjs.resolveFarmAppManifestInput.call(void 0, farmConfig, {
3103
+ ..._chunkK4UGCUXXcjs.resolveFarmAppManifestInput.call(void 0, farmConfig, {
2982
3104
  build: "development",
2983
3105
  packages: farmAppPackages,
2984
3106
  // Read again on each request; unchanged files come from a cache.
2985
- webmcpTools: _optionalChain([farmConfig, 'access', _208 => _208.plugins, 'optionalAccess', _209 => _209.some, 'call', _210 => _210(({ name }) => name === "farm:webmcp")]) ? _chunkF36LS2C7cjs.collectFarmWebMCPTools.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd())), farmConfig.srcDir) : []
3107
+ webmcpTools: _optionalChain([farmConfig, 'access', _216 => _216.plugins, 'optionalAccess', _217 => _217.some, 'call', _218 => _218(({ name }) => name === "farm:webmcp")]) ? _chunkM6U6E4F7cjs.collectFarmWebMCPTools.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd())), farmConfig.srcDir) : []
2986
3108
  }),
2987
3109
  defaultMCP: () => farmApp.getServerRenderer().getDefaultMCPServer(),
2988
3110
  // A guard written for an MCP server's path keeps its tools out of the public view.
2989
- guardCoversPath: (path7) => _chunkUPOYKX4Scjs.farmPathGuardCoversEndpoint.call(void 0,
3111
+ guardCoversPath: (path7) => _chunk2MR4MABGcjs.farmPathGuardCoversEndpoint.call(void 0,
2990
3112
  {
2991
3113
  config: farmConfig,
2992
3114
  middlewareRoutes: middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
@@ -3000,11 +3122,11 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3000
3122
  });
3001
3123
  return;
3002
3124
  }
3003
- if (_optionalChain([options, 'access', _211 => _211.agent, 'optionalAccess', _212 => _212.apiCatalog]) && _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) === _chunkYTNBCXCWcjs.FARM_API_CATALOG_PATH) {
3125
+ if (_optionalChain([options, 'access', _219 => _219.agent, 'optionalAccess', _220 => _220.apiCatalog]) && _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) === _chunkK4UGCUXXcjs.FARM_API_CATALOG_PATH) {
3004
3126
  await serveBuiltInRoute(
3005
- () => _chunkYTNBCXCWcjs.createFarmApiCatalogResponse.call(void 0,
3127
+ () => _chunkK4UGCUXXcjs.createFarmApiCatalogResponse.call(void 0,
3006
3128
  requestMethod,
3007
- _chunkYTNBCXCWcjs.resolveFarmApiCatalogInput.call(void 0, { ...options, api: farmConfig.api }),
3129
+ _chunkK4UGCUXXcjs.resolveFarmApiCatalogInput.call(void 0, { ...options, api: farmConfig.api }),
3008
3130
  new Request(parsedRequestUrl, {
3009
3131
  headers: { "user-agent": String(_nullishCoalesce(req.headers["user-agent"], () => ( ""))) }
3010
3132
  })
@@ -3012,8 +3134,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3012
3134
  );
3013
3135
  return;
3014
3136
  }
3015
- if (_optionalChain([options, 'access', _213 => _213.agent, 'optionalAccess', _214 => _214.aiCatalog]) !== false) {
3016
- const aiCatalog = _chunkYTNBCXCWcjs.createFarmAiCatalogResponse.call(void 0,
3137
+ if (_optionalChain([options, 'access', _221 => _221.agent, 'optionalAccess', _222 => _222.aiCatalog]) !== false) {
3138
+ const aiCatalog = _chunkK4UGCUXXcjs.createFarmAiCatalogResponse.call(void 0,
3017
3139
  new Request(parsedRequestUrl, {
3018
3140
  method: requestMethod,
3019
3141
  headers: {
@@ -3056,16 +3178,37 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3056
3178
  const docsBodyInit = requestMethod === "GET" || requestMethod === "HEAD" ? {} : { body: _chunkCFG4QERRcjs.createFarmNodeRequestBodyStream.call(void 0, req), duplex: "half" };
3057
3179
  const docsResponse = await farmDocsHandler(new Request(docsRequest, docsBodyInit));
3058
3180
  if (docsResponse) {
3181
+ const docsPage = _optionalChain([docsResponse, 'access', _223 => _223.headers, 'access', _224 => _224.get, 'call', _225 => _225("content-type"), 'optionalAccess', _226 => _226.toLowerCase, 'call', _227 => _227(), 'access', _228 => _228.includes, 'call', _229 => _229("text/html")]);
3059
3182
  await serveBuiltInRoute(
3060
- () => wrapFarmDocsResponseWithLayouts(docsRequest, docsResponse),
3183
+ async (request) => {
3184
+ if (!docsPage) return wrapFarmDocsResponseWithLayouts(docsRequest, docsResponse);
3185
+ const deploymentMismatch = _chunkNLBHLPEOcjs.getFarmDeploymentMismatch.call(void 0,
3186
+ request,
3187
+ farmConfig.deploymentId
3188
+ );
3189
+ if (deploymentMismatch) {
3190
+ await _optionalChain([docsResponse, 'access', _230 => _230.body, 'optionalAccess', _231 => _231.cancel, 'call', _232 => _232()]);
3191
+ return _chunkNLBHLPEOcjs.createFarmDeploymentMismatchResponse.call(void 0, deploymentMismatch);
3192
+ }
3193
+ return _chunkNLBHLPEOcjs.withFarmDeploymentResponse.call(void 0,
3194
+ await wrapFarmDocsResponseWithLayouts(docsRequest, docsResponse),
3195
+ farmConfig.deploymentId,
3196
+ {
3197
+ setCookie: request.method.toUpperCase() === "GET",
3198
+ cookiePath: farmConfig.basePath || "/",
3199
+ secureCookie: new URL(request.url).protocol === "https:"
3200
+ }
3201
+ );
3202
+ },
3061
3203
  {
3062
3204
  kind: "docs",
3063
3205
  computed: docsResponse,
3064
- label: _chunkYTNBCXCWcjs.resolveFarmDocsEngineRouteLabel.call(void 0,
3206
+ label: _chunkK4UGCUXXcjs.resolveFarmDocsEngineRouteLabel.call(void 0,
3065
3207
  _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath),
3066
3208
  {
3067
- path: _optionalChain([farmConfig, 'access', _215 => _215.docs, 'optionalAccess', _216 => _216.entry]) || "/docs",
3068
- roots: _optionalChain([farmConfig, 'access', _217 => _217.docs, 'optionalAccess', _218 => _218.roots, 'optionalAccess', _219 => _219.map, 'call', _220 => _220((root) => root.entry)])
3209
+ path: _optionalChain([farmConfig, 'access', _233 => _233.docs, 'optionalAccess', _234 => _234.entry]) || "/docs",
3210
+ roots: _optionalChain([farmConfig, 'access', _235 => _235.docs, 'optionalAccess', _236 => _236.roots, 'optionalAccess', _237 => _237.map, 'call', _238 => _238((root) => root.entry)]),
3211
+ pages: await getFarmDocsPagePaths()
3069
3212
  }
3070
3213
  )
3071
3214
  }
@@ -3073,8 +3216,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3073
3216
  return;
3074
3217
  }
3075
3218
  }
3076
- if (options.mobileClient && !viteModuleRequest && (requestMethod === "GET" || requestMethod === "HEAD" || requestMethod === "POST") && _optionalChain([req, 'access', _221 => _221.headers, 'access', _222 => _222.accept, 'optionalAccess', _223 => _223.includes, 'call', _224 => _224(_chunk3HLQTOVUcjs.FARM_NATIVE_TREE_CONTENT_TYPE)])) {
3077
- const { createFarmNativeTreeResponse } = await import("./native-tree-W2SSJB3Y.cjs");
3219
+ if (options.mobileClient && !viteModuleRequest && (requestMethod === "GET" || requestMethod === "HEAD" || requestMethod === "POST") && _optionalChain([req, 'access', _239 => _239.headers, 'access', _240 => _240.accept, 'optionalAccess', _241 => _241.includes, 'call', _242 => _242(_chunk3HLQTOVUcjs.FARM_NATIVE_TREE_CONTENT_TYPE)])) {
3220
+ const { createFarmNativeTreeResponse } = await import("./native-tree-GF4BH33L.cjs");
3078
3221
  const treeBodyInit = requestMethod === "POST" ? { body: _chunkCFG4QERRcjs.createFarmNodeRequestBodyStream.call(void 0, req), duplex: "half" } : {};
3079
3222
  const treeResponse = await createFarmNativeTreeResponse({
3080
3223
  request: new Request(fullUrl, {
@@ -3091,18 +3234,18 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3091
3234
  });
3092
3235
  await serveBuiltInRoute(() => treeResponse, {
3093
3236
  computed: treeResponse,
3094
- label: _nullishCoalesce(_optionalChain([farmApp, 'access', _225 => _225.getRouteManager, 'call', _226 => _226(), 'access', _227 => _227.matchRoute, 'call', _228 => _228(_chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath)), 'access', _229 => _229.route, 'optionalAccess', _230 => _230.pattern]), () => ( null))
3237
+ label: _nullishCoalesce(_optionalChain([farmApp, 'access', _243 => _243.getRouteManager, 'call', _244 => _244(), 'access', _245 => _245.matchRoute, 'call', _246 => _246(_chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath)), 'access', _247 => _247.route, 'optionalAccess', _248 => _248.pattern]), () => ( null))
3095
3238
  });
3096
3239
  return;
3097
3240
  }
3098
3241
  const markdownRouteLabel = () => (
3099
3242
  // On the route path, as production labels it: /fr/index.md is /index.md.
3100
- _chunkYTNBCXCWcjs.resolveFarmMarkdownRouteLabel.call(void 0,
3243
+ _chunkK4UGCUXXcjs.resolveFarmMarkdownRouteLabel.call(void 0,
3101
3244
  toRoutePathname(requestPathname),
3102
- (page) => _optionalChain([farmApp, 'access', _231 => _231.getRouteManager, 'call', _232 => _232(), 'access', _233 => _233.matchRoute, 'call', _234 => _234(page), 'access', _235 => _235.route, 'optionalAccess', _236 => _236.pattern])
3245
+ (page) => _optionalChain([farmApp, 'access', _249 => _249.getRouteManager, 'call', _250 => _250(), 'access', _251 => _251.matchRoute, 'call', _252 => _252(page), 'access', _253 => _253.route, 'optionalAccess', _254 => _254.pattern])
3103
3246
  )
3104
3247
  );
3105
- const markdownSourceResponse = viteModuleRequest ? null : await _chunk3EEINK7Gcjs.createFarmMarkdownSourceResponse.call(void 0, {
3248
+ const markdownSourceResponse = viteModuleRequest ? null : await _chunkNSZY3EWGcjs.createFarmMarkdownSourceResponse.call(void 0, {
3106
3249
  request: new Request(fullUrl, {
3107
3250
  method: requestMethod,
3108
3251
  headers: docsHeaders
@@ -3111,7 +3254,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3111
3254
  routePathname: toRoutePathname,
3112
3255
  resolveSource: async (pathname2) => {
3113
3256
  const match = farmApp.getRouteManager().matchRoute(pathname2);
3114
- const sourcePath = _optionalChain([match, 'access', _237 => _237.route, 'optionalAccess', _238 => _238.markdownSourcePath]) || (match.route && _chunk3EEINK7Gcjs.isFarmMarkdownPageFile.call(void 0, match.route.modulePath) ? match.route.modulePath : null);
3257
+ const sourcePath = _optionalChain([match, 'access', _255 => _255.route, 'optionalAccess', _256 => _256.markdownSourcePath]) || (match.route && _chunkNSZY3EWGcjs.isFarmMarkdownPageFile.call(void 0, match.route.modulePath) ? match.route.modulePath : null);
3115
3258
  if (!sourcePath) {
3116
3259
  return null;
3117
3260
  }
@@ -3122,11 +3265,18 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3122
3265
  },
3123
3266
  // The anonymous check goes through this server, so its guards and
3124
3267
  // middleware see the page's own path, as in production. It connects to
3125
- // this server's own listener, never the host the caller's Host names.
3268
+ // this server's own listener, never the host the caller's Host names. The
3269
+ // page is asked for at the URL it answers at, not through the trailing-slash 308.
3126
3270
  renderPage: async (request) => _chunkBNH53KOTcjs.createFarmDevServerDispatch.call(void 0, server)(
3127
- new Request(request, {
3128
- signal: res.destroyed ? AbortSignal.abort() : _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3129
- })
3271
+ new Request(
3272
+ _chunkDVJM55D2cjs.toFarmTrailingSlashPageRequest.call(void 0,
3273
+ request,
3274
+ farmApp.getConfig().trailingSlash === true
3275
+ ),
3276
+ {
3277
+ signal: res.destroyed ? AbortSignal.abort() : _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3278
+ }
3279
+ )
3130
3280
  )
3131
3281
  });
3132
3282
  if (markdownSourceResponse) {
@@ -3136,7 +3286,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3136
3286
  });
3137
3287
  return;
3138
3288
  }
3139
- const markdownResponse = viteModuleRequest ? null : await _chunkFT6KJHS3cjs.createMarkdownMirrorResponse.call(void 0, {
3289
+ const markdownResponse = viteModuleRequest ? null : await _chunkC2JOS77Zcjs.createMarkdownMirrorResponse.call(void 0, {
3140
3290
  request: new Request(fullUrl, {
3141
3291
  method: requestMethod,
3142
3292
  headers: docsHeaders
@@ -3146,17 +3296,24 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3146
3296
  routeExists: (pathname2) => Boolean(farmApp.getRouteManager().matchRoute(pathname2).route),
3147
3297
  // The page is rendered by this server's own listener, never the host the
3148
3298
  // caller's Host names. Redirects are not followed, so the mirror answers with
3149
- // the page's own (a sign-in gate, say), as production does.
3299
+ // the page's own (a sign-in gate, say), as production does. The page is read
3300
+ // at the URL it answers at ('/about/' with trailingSlash), not through the 308.
3150
3301
  renderPage: async (request) => {
3151
3302
  const headers = new Headers(request.headers);
3152
3303
  headers.delete("accept-encoding");
3153
3304
  return _chunkBNH53KOTcjs.createFarmDevServerDispatch.call(void 0, server)(
3154
- new Request(request, {
3155
- headers,
3156
- // Only accepted mirrors need disconnect listeners. An earlier
3157
- // close (for example while the docs handler ran) must also abort.
3158
- signal: res.destroyed ? AbortSignal.abort() : _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3159
- })
3305
+ new Request(
3306
+ _chunkDVJM55D2cjs.toFarmTrailingSlashPageRequest.call(void 0,
3307
+ request,
3308
+ farmApp.getConfig().trailingSlash === true
3309
+ ),
3310
+ {
3311
+ headers,
3312
+ // Only accepted mirrors need disconnect listeners. An earlier
3313
+ // close (for example while the docs handler ran) must also abort.
3314
+ signal: res.destroyed ? AbortSignal.abort() : _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3315
+ }
3316
+ )
3160
3317
  );
3161
3318
  },
3162
3319
  apiServerBasePath
@@ -3168,16 +3325,16 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3168
3325
  });
3169
3326
  return;
3170
3327
  }
3171
- if (!viteModuleRequest && _chunkFT6KJHS3cjs.farmRequestWantsMarkdown.call(void 0, requestPathname, req.headers.accept)) {
3172
- const markdownRoute = farmApp.getRouteManager().matchRoute(_chunk3EEINK7Gcjs.normalizeFarmMarkdownRoutePath.call(void 0, requestPathname, toRoutePathname));
3328
+ if (!viteModuleRequest && _chunkC2JOS77Zcjs.farmRequestWantsMarkdown.call(void 0, requestPathname, req.headers.accept)) {
3329
+ const markdownRoute = farmApp.getRouteManager().matchRoute(_chunkNSZY3EWGcjs.normalizeFarmMarkdownRoutePath.call(void 0, requestPathname, toRoutePathname));
3173
3330
  if (!markdownRoute.route) {
3174
3331
  await serveBuiltInRoute(
3175
3332
  () => new Response(
3176
- _chunkFT6KJHS3cjs.createFarmMarkdownErrorBody.call(void 0, 404, requestPathname, farmConfig.basePath || "/"),
3333
+ _chunkC2JOS77Zcjs.createFarmMarkdownErrorBody.call(void 0, 404, requestPathname, farmConfig.basePath || "/"),
3177
3334
  {
3178
3335
  status: 404,
3179
3336
  headers: {
3180
- "Content-Type": _chunkFT6KJHS3cjs.FARM_MARKDOWN_CONTENT_TYPE,
3337
+ "Content-Type": _chunkC2JOS77Zcjs.FARM_MARKDOWN_CONTENT_TYPE,
3181
3338
  "X-Farm-Markdown-Error": "404",
3182
3339
  "Cache-Control": "no-store"
3183
3340
  }
@@ -3187,7 +3344,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3187
3344
  return;
3188
3345
  }
3189
3346
  }
3190
- const markdownPageTarget = _chunkFT6KJHS3cjs.resolveMarkdownMirrorTarget.call(void 0,
3347
+ const markdownPageTarget = _chunkC2JOS77Zcjs.resolveMarkdownMirrorTarget.call(void 0,
3191
3348
  farmApp.getConfig().md,
3192
3349
  requestPathname,
3193
3350
  {
@@ -3220,7 +3377,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3220
3377
  } catch (error) {
3221
3378
  const response = _chunkCFG4QERRcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
3222
3379
  if (!response) throw error;
3223
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
3380
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
3224
3381
  return;
3225
3382
  }
3226
3383
  const workflowResponse = await workflowHandler(
@@ -3232,13 +3389,13 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3232
3389
  })
3233
3390
  );
3234
3391
  if (workflowResponse) {
3235
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, workflowResponse);
3392
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, workflowResponse);
3236
3393
  return;
3237
3394
  }
3238
3395
  }
3239
3396
  const configuredIntegrations = currentConfig.integrations;
3240
3397
  const tryConfiguredIntegrationRoute = async () => {
3241
- const matchedRoute = _chunkBDYM2TN3cjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
3398
+ const matchedRoute = _chunkJX5VOLAVcjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
3242
3399
  pathname: requestPathname,
3243
3400
  method: requestMethod
3244
3401
  });
@@ -3252,8 +3409,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3252
3409
  await pm.runHookParallelFiltered(
3253
3410
  "beforeRequest",
3254
3411
  (plugin2) => {
3255
- const owner = _chunkBDYM2TN3cjs.getFarmIntegrationPluginOwner.call(void 0, plugin2);
3256
- return !isFarmConfigRoutePlugin(plugin2) && (_optionalChain([owner, 'optionalAccess', _239 => _239.source]) !== "lifecycle" || owner.key !== matchedRoute.key);
3412
+ const owner = _chunkJX5VOLAVcjs.getFarmIntegrationPluginOwner.call(void 0, plugin2);
3413
+ return !isFarmConfigRoutePlugin(plugin2) && (_optionalChain([owner, 'optionalAccess', _257 => _257.source]) !== "lifecycle" || owner.key !== matchedRoute.key);
3257
3414
  },
3258
3415
  req,
3259
3416
  res
@@ -3282,7 +3439,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3282
3439
  });
3283
3440
  const dispatchIntegration = async (request, runtime) => {
3284
3441
  try {
3285
- const result = await _chunkBDYM2TN3cjs.dispatchIntegrationRequest.call(void 0,
3442
+ const result = await _chunkJX5VOLAVcjs.dispatchIntegrationRequest.call(void 0,
3286
3443
  {
3287
3444
  integration: matchedRoute.integration,
3288
3445
  config: currentConfig,
@@ -3290,7 +3447,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3290
3447
  isProd: false
3291
3448
  },
3292
3449
  request,
3293
- { clientAddress: _optionalChain([req, 'access', _240 => _240.socket, 'optionalAccess', _241 => _241.remoteAddress]) }
3450
+ { clientAddress: _optionalChain([req, 'access', _258 => _258.socket, 'optionalAccess', _259 => _259.remoteAddress]) }
3294
3451
  );
3295
3452
  if (!result) {
3296
3453
  throw new Error(`Matched integration route did not return a response`);
@@ -3298,7 +3455,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3298
3455
  return result;
3299
3456
  } catch (error) {
3300
3457
  _chunkQMNWKQL4cjs.logger.error(`Integration route error: ${error}`);
3301
- await _optionalChain([runtime, 'optionalAccess', _242 => _242.reportError, 'call', _243 => _243(error)]);
3458
+ await _optionalChain([runtime, 'optionalAccess', _260 => _260.reportError, 'call', _261 => _261(error)]);
3302
3459
  return _chunkXGTFLG73cjs.createFarmInternalServerErrorResponse.call(void 0, );
3303
3460
  }
3304
3461
  };
@@ -3315,12 +3472,12 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3315
3472
  }
3316
3473
  const duration = Date.now() - startTime2;
3317
3474
  logResponse(requestMethod, requestUrl, response.status, duration, "API");
3318
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
3475
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
3319
3476
  return true;
3320
3477
  } catch (error) {
3321
3478
  const bodyErrorResponse = _chunkCFG4QERRcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
3322
3479
  if (bodyErrorResponse) {
3323
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3480
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3324
3481
  return true;
3325
3482
  }
3326
3483
  const duration = Date.now() - startTime2;
@@ -3334,7 +3491,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3334
3491
  });
3335
3492
  }
3336
3493
  _chunkQMNWKQL4cjs.logger.error(`Integration route error: ${error}`);
3337
- if (!res.writableEnded) {
3494
+ if (runtimeReportsErrors) {
3495
+ if (!res.headersSent) sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
3496
+ else if (!res.writableEnded) res.end();
3497
+ } else if (!res.writableEnded) {
3338
3498
  res.statusCode = 500;
3339
3499
  res.setHeader("Content-Type", "application/json");
3340
3500
  res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
@@ -3342,20 +3502,20 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3342
3502
  return true;
3343
3503
  }
3344
3504
  };
3345
- if (pm && configRewriteSource === void 0 && configRoutePlugins.has(_chunkAKIQ54FKcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME)) {
3505
+ if (pm && configRewriteSource === void 0 && configRoutePlugins.has(_chunkMBCRWU3Pcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME)) {
3346
3506
  const hasLocalDevRoute = () => {
3347
3507
  const routeManager3 = farmApp.getRouteManager();
3348
3508
  return Boolean(
3349
- _chunkBDYM2TN3cjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
3509
+ _chunkJX5VOLAVcjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
3350
3510
  pathname: requestPathname,
3351
3511
  method: requestMethod
3352
- }) || routeManager3.matchRedirect(requestPathname) || apiRouteManager.matchRoute(requestPathname) || farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _244 => _244.isFarmDocsAPIRequest, 'call', _245 => _245(requestPathname)]) || routeManager3.matchRoute(requestPathname).route || routeManager3.matchMetadataRoute(requestPathname) || routeManager3.matchMetadataImage(requestPathname)
3512
+ }) || routeManager3.matchRedirect(requestPathname) || apiRouteManager.matchRoute(requestPathname) || farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _262 => _262.isFarmDocsAPIRequest, 'call', _263 => _263(requestPathname)]) || routeManager3.matchRoute(requestPathname).route || routeManager3.matchMetadataRoute(requestPathname) || routeManager3.matchMetadataImage(requestPathname)
3353
3513
  );
3354
3514
  };
3355
3515
  try {
3356
3516
  await pm.runHookParallelFiltered(
3357
3517
  "beforeRequest",
3358
- (plugin2) => plugin2.name === _chunkAKIQ54FKcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME,
3518
+ (plugin2) => plugin2.name === _chunkMBCRWU3Pcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME,
3359
3519
  req,
3360
3520
  res
3361
3521
  );
@@ -3441,21 +3601,21 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3441
3601
  });
3442
3602
  };
3443
3603
  const isDocsAPIRequest = Boolean(
3444
- farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _246 => _246.isFarmDocsAPIRequest, 'call', _247 => _247(pathname2)])
3604
+ farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _264 => _264.isFarmDocsAPIRequest, 'call', _265 => _265(pathname2)])
3445
3605
  );
3446
3606
  const docsRuntimeOptions = () => ({
3447
3607
  kind: "docs",
3448
- route: _chunkYTNBCXCWcjs.setFarmRouteLabel.call(void 0,
3608
+ route: _chunkK4UGCUXXcjs.setFarmRouteLabel.call(void 0,
3449
3609
  { pathname: pathname2, pattern: urlPath2 },
3450
- _chunkYTNBCXCWcjs.resolveFarmDocsRouteLabel.call(void 0, pathname2, {
3451
- path: _optionalChain([farmConfig, 'access', _248 => _248.docs, 'optionalAccess', _249 => _249.entry]) || "/docs",
3452
- roots: _optionalChain([farmConfig, 'access', _250 => _250.docs, 'optionalAccess', _251 => _251.roots, 'optionalAccess', _252 => _252.map, 'call', _253 => _253((root) => root.entry)])
3610
+ _chunkK4UGCUXXcjs.resolveFarmDocsRouteLabel.call(void 0, pathname2, {
3611
+ path: _optionalChain([farmConfig, 'access', _266 => _266.docs, 'optionalAccess', _267 => _267.entry]) || "/docs",
3612
+ roots: _optionalChain([farmConfig, 'access', _268 => _268.docs, 'optionalAccess', _269 => _269.roots, 'optionalAccess', _270 => _270.map, 'call', _271 => _271((root) => root.entry)])
3453
3613
  })
3454
3614
  )
3455
3615
  });
3456
3616
  let runtimeSession2;
3457
3617
  let sessionRequestUrl;
3458
- if (_optionalChain([pm, 'optionalAccess', _254 => _254.hasRuntimeRequestHooks, 'call', _255 => _255()])) {
3618
+ if (pm && opensFarmDevRuntimeSession(pm)) {
3459
3619
  try {
3460
3620
  runtimeSession2 = await pm.beginRuntimeRequest(
3461
3621
  await createAPIRequest(),
@@ -3470,7 +3630,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3470
3630
  runtimeSession2.response
3471
3631
  );
3472
3632
  logResponse(method2, urlPath2, response.status, Date.now() - startTime2, "API");
3473
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
3633
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
3474
3634
  return;
3475
3635
  }
3476
3636
  } catch (error) {
@@ -3483,13 +3643,11 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3483
3643
  Date.now() - startTime2,
3484
3644
  "API"
3485
3645
  );
3486
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3646
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3487
3647
  return;
3488
3648
  }
3489
3649
  _chunkQMNWKQL4cjs.logger.error(`API route error: ${error}`);
3490
- res.statusCode = 500;
3491
- res.setHeader("Content-Type", "application/json");
3492
- res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
3650
+ sendFarmDevRuntimeHookError(res, true);
3493
3651
  return;
3494
3652
  }
3495
3653
  pm.copyRequestContext(runtimeSession2.request, req);
@@ -3509,25 +3667,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3509
3667
  throw error;
3510
3668
  }
3511
3669
  _chunkQMNWKQL4cjs.logger.error(`Middleware error: ${error}`);
3512
- let response = createFarmDevMiddlewareErrorResponse();
3513
- if (runtimeSession2) {
3514
- const errorResponse = response;
3515
- try {
3516
- response = await pm.completeRuntimeRequest(
3517
- runtimeSession2,
3518
- async (_request, runtime) => {
3519
- await runtime.reportError(error);
3520
- return errorResponse;
3521
- }
3522
- );
3523
- } catch (e26) {
3524
- logResponse(method2, urlPath2, 500, Date.now() - startTime2, "API");
3525
- sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
3526
- return;
3527
- }
3528
- }
3529
- logResponse(method2, urlPath2, response.status, Date.now() - startTime2, "API");
3530
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
3670
+ const status = await sendMiddlewareErrorJSON(runtimeSession2, error);
3671
+ logResponse(method2, urlPath2, status, Date.now() - startTime2, "API");
3531
3672
  return;
3532
3673
  }
3533
3674
  const createHandlerRequest = async () => {
@@ -3550,7 +3691,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3550
3691
  const routedApiRoute = rewritten ? apiRouteManager.matchRoute(routedPathname) : matchedApiRoute || apiRouteManager.matchRoute(pathname2);
3551
3692
  const hasExplicitAPIRoute = Boolean(routedApiRoute);
3552
3693
  if (apiHandler && hasExplicitAPIRoute) {
3553
- const apiRoutePattern = _optionalChain([routedApiRoute, 'optionalAccess', _256 => _256.route, 'access', _257 => _257.path]) || urlPath2;
3694
+ const apiRoutePattern = _optionalChain([routedApiRoute, 'optionalAccess', _272 => _272.route, 'access', _273 => _273.path]) || urlPath2;
3554
3695
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
3555
3696
  type: "route.matched",
3556
3697
  pathname: pathname2,
@@ -3562,6 +3703,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3562
3703
  route: apiRoutePattern,
3563
3704
  method: method2
3564
3705
  });
3706
+ let apiOutcomeReported = false;
3565
3707
  try {
3566
3708
  const url = `http://${req.headers.host || "localhost:3000"}${req.url}`;
3567
3709
  const request = await createHandlerRequest();
@@ -3570,7 +3712,6 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3570
3712
  method: method2,
3571
3713
  routePath: apiRoutePattern
3572
3714
  };
3573
- let apiHandlerFailed = false;
3574
3715
  const invokeAPIHandler = async (runtimeRequest, runtime) => {
3575
3716
  const handledRequest = pm ? await pm.runHookSerial(
3576
3717
  "beforeApiHandler",
@@ -3580,8 +3721,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3580
3721
  let response;
3581
3722
  try {
3582
3723
  response = await apiHandler(handledRequest);
3724
+ apiOutcomeReported = true;
3725
+ _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
3726
+ type: "api.request.complete",
3727
+ pathname: pathname2,
3728
+ route: apiRoutePattern,
3729
+ method: method2,
3730
+ status: response.status,
3731
+ durationMs: Date.now() - startTime2
3732
+ });
3583
3733
  } catch (error) {
3584
- apiHandlerFailed = true;
3734
+ apiOutcomeReported = true;
3585
3735
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
3586
3736
  type: "api.error",
3587
3737
  pathname: pathname2,
@@ -3591,7 +3741,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3591
3741
  error
3592
3742
  });
3593
3743
  _chunkQMNWKQL4cjs.logger.error(`API route error: ${error}`);
3594
- await _optionalChain([runtime, 'optionalAccess', _258 => _258.reportError, 'call', _259 => _259(error)]);
3744
+ await _optionalChain([runtime, 'optionalAccess', _274 => _274.reportError, 'call', _275 => _275(error)]);
3595
3745
  response = _chunkXGTFLG73cjs.createFarmInternalServerErrorResponse.call(void 0, );
3596
3746
  }
3597
3747
  return pm ? await pm.runHookSerial("afterApiHandler", response, apiLifecyclePayload) : response;
@@ -3604,39 +3754,29 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3604
3754
  }
3605
3755
  });
3606
3756
  const duration = Date.now() - startTime2;
3607
- if (!apiHandlerFailed) {
3757
+ logResponse(method2, urlPath2, handledResponse.status, duration, "API");
3758
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, handledResponse);
3759
+ return;
3760
+ } catch (error) {
3761
+ const duration = Date.now() - startTime2;
3762
+ if (!apiOutcomeReported) {
3608
3763
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
3609
- type: "api.request.complete",
3764
+ type: "api.error",
3610
3765
  pathname: pathname2,
3611
3766
  route: apiRoutePattern,
3612
3767
  method: method2,
3613
- status: handledResponse.status,
3614
- durationMs: duration
3768
+ durationMs: duration,
3769
+ error
3615
3770
  });
3616
3771
  }
3617
- logResponse(method2, urlPath2, handledResponse.status, duration, "API");
3618
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, handledResponse);
3619
- return;
3620
- } catch (error) {
3621
- const duration = Date.now() - startTime2;
3622
- _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
3623
- type: "api.error",
3624
- pathname: pathname2,
3625
- route: apiRoutePattern,
3626
- method: method2,
3627
- durationMs: duration,
3628
- error
3629
- });
3630
3772
  const bodyErrorResponse = _chunkCFG4QERRcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
3631
3773
  if (bodyErrorResponse) {
3632
3774
  logResponse(method2, urlPath2, bodyErrorResponse.status, duration, "API");
3633
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3775
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3634
3776
  return;
3635
3777
  }
3636
3778
  _chunkQMNWKQL4cjs.logger.error(`API route error: ${error}`);
3637
- res.statusCode = 500;
3638
- res.setHeader("Content-Type", "application/json");
3639
- res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
3779
+ sendFarmDevRuntimeHookError(res, true);
3640
3780
  return;
3641
3781
  }
3642
3782
  }
@@ -3668,19 +3808,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3668
3808
  if (docsResponse) {
3669
3809
  const duration = Date.now() - startTime2;
3670
3810
  logResponse(method2, urlPath2, docsResponse.status, duration, "API");
3671
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, docsResponse);
3811
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, docsResponse);
3672
3812
  return;
3673
3813
  }
3674
3814
  } catch (error) {
3675
3815
  const bodyErrorResponse = _chunkCFG4QERRcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
3676
3816
  if (bodyErrorResponse) {
3677
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3817
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3678
3818
  return;
3679
3819
  }
3680
3820
  _chunkQMNWKQL4cjs.logger.error(`Docs API route error: ${error}`);
3681
- res.statusCode = 500;
3682
- res.setHeader("Content-Type", "application/json");
3683
- res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
3821
+ sendFarmDevRuntimeHookError(res, true);
3684
3822
  return;
3685
3823
  }
3686
3824
  }
@@ -3701,21 +3839,19 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3701
3839
  })
3702
3840
  );
3703
3841
  logResponse(method2, urlPath2, response.status, Date.now() - startTime2, "API");
3704
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
3842
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
3705
3843
  } catch (error) {
3706
3844
  _chunkQMNWKQL4cjs.logger.error(`API route error: ${error}`);
3707
- res.statusCode = 500;
3708
- res.setHeader("Content-Type", "application/json");
3709
- res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
3845
+ sendFarmDevRuntimeHookError(res, true);
3710
3846
  }
3711
3847
  return;
3712
3848
  }
3713
- if (_optionalChain([req, 'access', _260 => _260.url, 'optionalAccess', _261 => _261.startsWith, 'call', _262 => _262("/@")]) || _optionalChain([req, 'access', _263 => _263.url, 'optionalAccess', _264 => _264.startsWith, 'call', _265 => _265("/node_modules")])) {
3849
+ if (_optionalChain([req, 'access', _276 => _276.url, 'optionalAccess', _277 => _277.startsWith, 'call', _278 => _278("/@")]) || _optionalChain([req, 'access', _279 => _279.url, 'optionalAccess', _280 => _280.startsWith, 'call', _281 => _281("/node_modules")])) {
3714
3850
  return next();
3715
3851
  }
3716
3852
  if (!deferredDottedRequests.has(req) && shouldBypassFarmRouterForDottedPath(
3717
3853
  requestPathname,
3718
- _optionalChain([farmApp, 'optionalAccess', _266 => _266.getRouteManager, 'call', _267 => _267()]),
3854
+ _optionalChain([farmApp, 'optionalAccess', _282 => _282.getRouteManager, 'call', _283 => _283()]),
3719
3855
  [server.config.publicDir, server.config.root],
3720
3856
  farmAgentGeneratedPaths(farmConfig),
3721
3857
  requestMethod
@@ -3723,7 +3859,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3723
3859
  if (!viteModuleRequest) deferredDottedRequests.set(req, requestUrl);
3724
3860
  return next();
3725
3861
  }
3726
- if (_optionalChain([req, 'access', _268 => _268.url, 'optionalAccess', _269 => _269.startsWith, 'call', _270 => _270("/__farm/page-data")])) {
3862
+ if (_optionalChain([req, 'access', _284 => _284.url, 'optionalAccess', _285 => _285.startsWith, 'call', _286 => _286("/__farm/page-data")])) {
3727
3863
  const urlObj = parsedRequestUrl;
3728
3864
  const targetPath = urlObj.searchParams.get("path") || "/";
3729
3865
  let renderedRequest;
@@ -3733,14 +3869,14 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3733
3869
  urlObj,
3734
3870
  _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3735
3871
  );
3736
- const deploymentMismatch = _chunkI7J5RLGOcjs.getFarmDeploymentMismatch.call(void 0,
3872
+ const deploymentMismatch = _chunkNLBHLPEOcjs.getFarmDeploymentMismatch.call(void 0,
3737
3873
  request,
3738
3874
  farmConfig.deploymentId
3739
3875
  );
3740
3876
  if (deploymentMismatch) {
3741
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
3877
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
3742
3878
  res,
3743
- _chunkI7J5RLGOcjs.createFarmDeploymentMismatchResponse.call(void 0, deploymentMismatch)
3879
+ _chunkNLBHLPEOcjs.createFarmDeploymentMismatchResponse.call(void 0, deploymentMismatch)
3744
3880
  );
3745
3881
  return;
3746
3882
  }
@@ -3753,7 +3889,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3753
3889
  renderedRequest = targetRequest;
3754
3890
  let middlewareMap = /* @__PURE__ */ new Map();
3755
3891
  let middlewareContext = /* @__PURE__ */ new Map();
3756
- if (_optionalChain([middlewareManager, 'optionalAccess', _271 => _271.hasMiddleware, 'call', _272 => _272()])) {
3892
+ if (_optionalChain([middlewareManager, 'optionalAccess', _287 => _287.hasMiddleware, 'call', _288 => _288()])) {
3757
3893
  const targetNodeRequest = createPageDataMiddlewareRequest(req, targetRequestUrl);
3758
3894
  const targetNodeResponse = createPageDataMiddlewareResponse(res);
3759
3895
  const handled = await runFarmMiddlewareWithNavigation(
@@ -3787,10 +3923,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3787
3923
  if (pm) {
3788
3924
  await pm.runHookParallel("afterRouteMatch", {
3789
3925
  pathname: targetPath,
3790
- matched: !!_optionalChain([match, 'optionalAccess', _273 => _273.route]),
3791
- routePattern: _optionalChain([match, 'optionalAccess', _274 => _274.route, 'optionalAccess', _275 => _275.pattern]) || null,
3792
- params: _optionalChain([match, 'optionalAccess', _276 => _276.params]) || {},
3793
- layoutPatterns: (_optionalChain([match, 'optionalAccess', _277 => _277.layouts]) || []).map((l) => l.pattern)
3926
+ matched: !!_optionalChain([match, 'optionalAccess', _289 => _289.route]),
3927
+ routePattern: _optionalChain([match, 'optionalAccess', _290 => _290.route, 'optionalAccess', _291 => _291.pattern]) || null,
3928
+ params: _optionalChain([match, 'optionalAccess', _292 => _292.params]) || {},
3929
+ layoutPatterns: (_optionalChain([match, 'optionalAccess', _293 => _293.layouts]) || []).map((l) => l.pattern)
3794
3930
  });
3795
3931
  }
3796
3932
  if (!match) {
@@ -3813,7 +3949,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3813
3949
  );
3814
3950
  const loadingModule = loadingBoundary ? await routeManager3.loadRouteModule(loadingBoundary.modulePath) : null;
3815
3951
  const navigationManifest = routeManager3.generateClientManifest(server.config.root);
3816
- const moduleMetadata = _nullishCoalesce(navigationManifest.routes.find((entry) => entry.pattern === route.pattern), () => ( _chunkMZ4CRSY7cjs.getClientModuleMetadata.call(void 0, route.modulePath, server.config.root)));
3952
+ const moduleMetadata = _nullishCoalesce(navigationManifest.routes.find((entry) => entry.pattern === route.pattern), () => ( _chunkIEN2EFE5cjs.getClientModuleMetadata.call(void 0, route.modulePath, server.config.root)));
3817
3953
  const isClientComponent = moduleMetadata.isClientComponent;
3818
3954
  const shouldHydrate = moduleMetadata.shouldHydrate;
3819
3955
  let mergedMetadata = {};
@@ -3821,7 +3957,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3821
3957
  layouts.map((layout) => routeManager3.loadLayoutModule(layout.modulePath))
3822
3958
  );
3823
3959
  const layoutHydrationMetadata = layouts.map(
3824
- (layout) => _nullishCoalesce(navigationManifest.layouts.find((entry) => entry.pattern === layout.pattern), () => ( _chunkMZ4CRSY7cjs.getClientModuleMetadata.call(void 0, layout.modulePath, server.config.root)))
3960
+ (layout) => _nullishCoalesce(navigationManifest.layouts.find((entry) => entry.pattern === layout.pattern), () => ( _chunkIEN2EFE5cjs.getClientModuleMetadata.call(void 0, layout.modulePath, server.config.root)))
3825
3961
  );
3826
3962
  const shouldHydrateLayout = layoutHydrationMetadata.some(
3827
3963
  (metadata) => metadata.shouldHydrate
@@ -3833,17 +3969,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3833
3969
  )
3834
3970
  ];
3835
3971
  const hydrationIslandStrategy = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0,
3836
- _optionalChain([(_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _278 => _278.getConfig, 'call', _279 => _279()]), () => ( options))), 'access', _280 => _280.experimental, 'optionalAccess', _281 => _281.serverComponents])
3837
- ) === "islands" ? _chunkF36LS2C7cjs.resolveFarmRouteRootStrategy.call(void 0,
3972
+ _optionalChain([(_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _294 => _294.getConfig, 'call', _295 => _295()]), () => ( options))), 'access', _296 => _296.experimental, 'optionalAccess', _297 => _297.serverComponents])
3973
+ ) === "islands" ? _chunkM6U6E4F7cjs.resolveFarmRouteRootStrategy.call(void 0,
3838
3974
  route,
3839
3975
  { shouldHydrate, islandStrategy: _nullishCoalesce(moduleMetadata.islandStrategy, () => ( null)) },
3840
3976
  layouts.map((layout, index) => ({
3841
3977
  pattern: layout.pattern,
3842
3978
  modulePath: layout.modulePath,
3843
- shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _282 => _282[index], 'optionalAccess', _283 => _283.shouldHydrate]) === true,
3979
+ shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _298 => _298[index], 'optionalAccess', _299 => _299.shouldHydrate]) === true,
3844
3980
  // Manifest entries carry it; metadata read from source does not.
3845
- hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access', _284 => _284[index], 'optionalAccess', _285 => _285.hasIsolatedClientBoundaries]) === true,
3846
- islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _286 => _286[index], 'optionalAccess', _287 => _287.islandStrategy]), () => ( null))
3981
+ hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access', _300 => _300[index], 'optionalAccess', _301 => _301.hasIsolatedClientBoundaries]) === true,
3982
+ islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _302 => _302[index], 'optionalAccess', _303 => _303.islandStrategy]), () => ( null))
3847
3983
  })),
3848
3984
  server.config.root,
3849
3985
  true
@@ -3891,7 +4027,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3891
4027
  mergedMetadata = await _chunk6IOZPJ3Icjs.mergeModuleViewport.call(void 0, mergedMetadata, routeModule, routeProps);
3892
4028
  mergedMetadata = _chunk6IOZPJ3Icjs.addMetadataMarkdownAlternate.call(void 0,
3893
4029
  mergedMetadata,
3894
- _chunkFT6KJHS3cjs.getFarmMarkdownAlternatePath.call(void 0, farmApp.getConfig().md, targetRequestUrl.pathname, {
4030
+ _chunkC2JOS77Zcjs.getFarmMarkdownAlternatePath.call(void 0, farmApp.getConfig().md, targetRequestUrl.pathname, {
3895
4031
  routePathname: (pathname2) => routeManager3.toRoutePathname(pathname2)
3896
4032
  })
3897
4033
  );
@@ -3900,7 +4036,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3900
4036
  const slotModule = await routeManager3.loadRouteModule(slot.route.modulePath);
3901
4037
  const slotMetadata = _nullishCoalesce(navigationManifest.slots.find(
3902
4038
  (entry) => entry.name === slot.name && entry.ownerPattern === slot.ownerPattern && entry.pattern === slot.route.pattern
3903
- ), () => ( _chunkMZ4CRSY7cjs.getClientModuleMetadata.call(void 0, slot.route.modulePath, server.config.root)));
4039
+ ), () => ( _chunkIEN2EFE5cjs.getClientModuleMetadata.call(void 0, slot.route.modulePath, server.config.root)));
3904
4040
  const slotContext = await _chunkX333W5KVcjs.resolveFarmRouteContext.call(void 0, farmApp.getConfig(), {
3905
4041
  request: targetRequest,
3906
4042
  params: slot.params,
@@ -3946,15 +4082,15 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3946
4082
  );
3947
4083
  const projectRoot = server.config.root;
3948
4084
  const toUrlPath = (absolutePath) => _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, absolutePath, projectRoot);
3949
- const renderPlan = _chunkUPOYKX4Scjs.createFarmRouteRenderPlan.call(void 0, {
4085
+ const renderPlan = _chunk2MR4MABGcjs.createFarmRouteRenderPlan.call(void 0, {
3950
4086
  pageShouldHydrate: shouldHydrate,
3951
4087
  layoutShouldHydrate: shouldHydrateLayout,
3952
4088
  islandStrategy: hydrationIslandStrategy,
3953
- rendering: _chunkQOGIZKSOcjs.resolveRouteRenderingConfig.call(void 0, routeModule)
4089
+ rendering: _chunkK7JMTAFHcjs.resolveRouteRenderingConfig.call(void 0, routeModule)
3954
4090
  });
3955
4091
  const destinationLayoutPatterns = layouts.map((layout) => layout.pattern);
3956
- const layoutStartIndex = _chunkUPOYKX4Scjs.getSharedLayoutPrefixLength.call(void 0,
3957
- _chunkUPOYKX4Scjs.parseFarmLayoutChainHeader.call(void 0, request.headers.get("x-farm-layout-chain")),
4092
+ const layoutStartIndex = _chunk2MR4MABGcjs.getSharedLayoutPrefixLength.call(void 0,
4093
+ _chunk2MR4MABGcjs.parseFarmLayoutChainHeader.call(void 0, request.headers.get("x-farm-layout-chain")),
3958
4094
  destinationLayoutPatterns
3959
4095
  );
3960
4096
  const renderer = farmApp.getServerRenderer();
@@ -3964,7 +4100,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3964
4100
  middlewareContext,
3965
4101
  () => renderer.renderNavigationFragment({
3966
4102
  PageComponent: routeModule.default,
3967
- LoadingComponent: _optionalChain([loadingModule, 'optionalAccess', _288 => _288.default]),
4103
+ LoadingComponent: _optionalChain([loadingModule, 'optionalAccess', _304 => _304.default]),
3968
4104
  pageProps: routeProps,
3969
4105
  params,
3970
4106
  layouts: layouts.map((layout, index) => ({
@@ -4026,19 +4162,19 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4026
4162
  from: interceptFromHeader,
4027
4163
  slots: routeSlots.filter((slot) => slot.interception).map((slot) => slot.name)
4028
4164
  } : void 0,
4029
- i18n: _chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, )
4165
+ i18n: _chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0, )
4030
4166
  };
4031
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
4167
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
4032
4168
  res,
4033
4169
  _chunkDBYNZIIQcjs.createDeferredDataResponse.call(void 0,
4034
4170
  pageData,
4035
4171
  {
4036
4172
  status: 200,
4037
4173
  headers: {
4038
- "Cache-Control": _chunkUPOYKX4Scjs.getFarmFragmentCacheControl.call(void 0, renderPlan),
4174
+ "Cache-Control": _chunk2MR4MABGcjs.getFarmFragmentCacheControl.call(void 0, renderPlan),
4039
4175
  "X-Farm-Navigation": "html-fragment",
4040
4176
  Vary: "X-Farm-Layout-Chain",
4041
- [_chunkI7J5RLGOcjs.FARM_DEPLOYMENT_ID_HEADER]: farmConfig.deploymentId
4177
+ [_chunkNLBHLPEOcjs.FARM_DEPLOYMENT_ID_HEADER]: farmConfig.deploymentId
4042
4178
  }
4043
4179
  },
4044
4180
  {
@@ -4077,41 +4213,43 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4077
4213
  trustProxy: currentServerConfig.trustProxy
4078
4214
  }).pathname;
4079
4215
  const routeManager2 = farmApp.getRouteManager();
4080
- const hasBeforeRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _289 => _289.hasHook, 'call', _290 => _290("beforeRouteMatch")]), () => ( false));
4081
- const hasAfterRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _291 => _291.hasHook, 'call', _292 => _292("afterRouteMatch")]), () => ( false));
4082
- const hasBeforeRequestHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _293 => _293.hasHook, 'call', _294 => _294("beforeRequest")]), () => ( false));
4083
- const hasBeforeRenderHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _295 => _295.hasHook, 'call', _296 => _296("beforeRender")]), () => ( false));
4084
- const hasAfterResponseHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _297 => _297.hasHook, 'call', _298 => _298("afterResponse")]), () => ( false));
4085
- const hasHTMLTransformHook = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _299 => _299.hasHook, 'call', _300 => _300("transformHTML")]), () => ( false))) || (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _301 => _301.hasHook, 'call', _302 => _302("afterRender")]), () => ( false)));
4086
- const hasRuntimeRequestHooks = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _303 => _303.hasRuntimeRequestHooks, 'call', _304 => _304()]), () => ( false));
4087
- const hasRuntimeAfterHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _305 => _305.hasRuntimeHook, 'call', _306 => _306("after")]), () => ( false));
4216
+ const hasBeforeRequestHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _305 => _305.hasHook, 'call', _306 => _306("beforeRequest")]), () => ( false));
4217
+ const hasAfterResponseHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _307 => _307.hasHook, 'call', _308 => _308("afterResponse")]), () => ( false));
4218
+ const hasHTMLTransformHook = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _309 => _309.hasHook, 'call', _310 => _310("transformHTML")]), () => ( false))) || (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _311 => _311.hasHook, 'call', _312 => _312("afterRender")]), () => ( false)));
4219
+ const opensRuntimeSession = pm ? opensFarmDevRuntimeSession(pm) : false;
4220
+ const hasRuntimeAfterHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _313 => _313.hasRuntimeHook, 'call', _314 => _314("after")]), () => ( false));
4088
4221
  const requestedMatch = routeManager2.matchRoute(requestedPathname);
4089
4222
  const pageBuiltInRouteLabel = (pathname2) => {
4090
4223
  const routePathname = _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, pathname2, farmConfig.basePath);
4091
- const mcpLabel = _chunkYTNBCXCWcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath);
4224
+ const mcpLabel = _chunkK4UGCUXXcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath);
4092
4225
  if (mcpLabel) return mcpLabel;
4093
4226
  if (farmAgentGeneratedPaths(farmConfig).includes(routePathname)) return routePathname;
4094
- return routePathname === _chunkX3MHKLCOcjs.FARM_DEFAULT_MCP_PATH && farmApp.getServerRenderer().getDefaultMCPServer() ? _chunkX3MHKLCOcjs.FARM_DEFAULT_MCP_PATH : null;
4227
+ return routePathname === _chunkVG6HYT5Kcjs.FARM_DEFAULT_MCP_PATH && farmApp.getServerRenderer().getDefaultMCPServer() ? _chunkVG6HYT5Kcjs.FARM_DEFAULT_MCP_PATH : null;
4095
4228
  };
4096
4229
  let runtimeSession;
4097
4230
  let pathname = requestedPathname;
4098
- if (pm && hasRuntimeRequestHooks) {
4231
+ let pageHookPathname = requestedPagePathname;
4232
+ if (pm && opensRuntimeSession) {
4099
4233
  try {
4100
4234
  const sessionOptions = {
4101
4235
  kind: "page",
4102
- route: _chunkYTNBCXCWcjs.setFarmRouteLabel.call(void 0,
4236
+ route: _chunkK4UGCUXXcjs.setFarmRouteLabel.call(void 0,
4103
4237
  {
4104
4238
  pathname: requestedPathname,
4105
- pattern: _optionalChain([requestedMatch, 'optionalAccess', _307 => _307.route, 'optionalAccess', _308 => _308.pattern]) || null,
4106
- params: _optionalChain([requestedMatch, 'optionalAccess', _309 => _309.params]) || {}
4239
+ pattern: _optionalChain([requestedMatch, 'optionalAccess', _315 => _315.route, 'optionalAccess', _316 => _316.pattern]) || null,
4240
+ params: _optionalChain([requestedMatch, 'optionalAccess', _317 => _317.params]) || {}
4107
4241
  },
4108
- _optionalChain([requestedMatch, 'optionalAccess', _310 => _310.route]) ? null : pageBuiltInRouteLabel(requestedPathname)
4242
+ _optionalChain([requestedMatch, 'optionalAccess', _318 => _318.route]) ? null : pageBuiltInRouteLabel(requestedPathname)
4109
4243
  )
4110
4244
  };
4111
4245
  runtimeSession = await pm.beginRuntimeRequest(
4112
4246
  createRequestFromNodeRequest(req, new URL(_nullishCoalesce(configRewriteSource, () => ( fullUrl)))),
4113
4247
  sessionOptions
4114
4248
  );
4249
+ if (!runtimeSession.response) {
4250
+ pageHookPathname = configRewriteSource === void 0 ? new URL(runtimeSession.request.url).pathname : requestedPagePathname;
4251
+ await runFarmDevPageHooks(pageHookPathname);
4252
+ }
4115
4253
  const routedRequest = await _asyncNullishCoalesce(runtimeSession.response, async () => ( (configRewriteSource === void 0 ? runtimeSession.request : await pm.runRuntimeBeforeForRewrite(
4116
4254
  runtimeSession.request,
4117
4255
  createRequestFromNodeRequest(req, new URL(fullUrl)),
@@ -4119,7 +4257,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4119
4257
  ))));
4120
4258
  if (routedRequest instanceof Response) {
4121
4259
  const response = await pm.endRuntimeRequest(runtimeSession, routedRequest);
4122
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
4260
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
4123
4261
  return;
4124
4262
  }
4125
4263
  pm.copyRequestContext(routedRequest, req);
@@ -4131,28 +4269,27 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4131
4269
  return;
4132
4270
  }
4133
4271
  }
4134
- const routeMatch = pathname === requestedPathname ? requestedMatch : routeManager2.matchRoute(pathname);
4135
- if (pm && hasBeforeRouteMatchHook) {
4136
- await pm.runHookParallel("beforeRouteMatch", {
4137
- pathname,
4138
- method
4139
- });
4140
- }
4141
- if (pm && hasAfterRouteMatchHook) {
4142
- await pm.runHookParallel("afterRouteMatch", {
4143
- pathname,
4144
- matched: !!_optionalChain([routeMatch, 'optionalAccess', _311 => _311.route]),
4145
- routePattern: _optionalChain([routeMatch, 'optionalAccess', _312 => _312.route, 'optionalAccess', _313 => _313.pattern]) || null,
4146
- params: _optionalChain([routeMatch, 'optionalAccess', _314 => _314.params]) || {},
4147
- layoutPatterns: (_optionalChain([routeMatch, 'optionalAccess', _315 => _315.layouts]) || []).map((l) => l.pattern)
4148
- });
4149
- }
4150
- const renderPayload = {
4151
- pathname,
4152
- method,
4153
- routePattern: _optionalChain([routeMatch, 'optionalAccess', _316 => _316.route, 'optionalAccess', _317 => _317.pattern]) || null,
4154
- params: _optionalChain([routeMatch, 'optionalAccess', _318 => _318.params]) || {}
4272
+ const failPageHook = async (error) => {
4273
+ logResponse(method, urlPath, 500, Date.now() - startTime, "PAGE");
4274
+ if (runtimeSession) {
4275
+ await pm.failRuntimeRequest(runtimeSession, error);
4276
+ } else {
4277
+ await emitPluginError("runtime", error, {
4278
+ kind: "page",
4279
+ pathname,
4280
+ durationMs: Date.now() - startTime
4281
+ });
4282
+ }
4283
+ if (!res.headersSent) sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
4155
4284
  };
4285
+ if (!runtimeSession) {
4286
+ try {
4287
+ await runFarmDevPageHooks(pageHookPathname);
4288
+ } catch (error) {
4289
+ await failPageHook(error);
4290
+ return;
4291
+ }
4292
+ }
4156
4293
  const shouldInterceptResponse = Boolean(
4157
4294
  pm && (hasAfterResponseHook || hasHTMLTransformHook || runtimeSession && hasRuntimeAfterHook)
4158
4295
  );
@@ -4164,7 +4301,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4164
4301
  hasRuntimeAfterHook,
4165
4302
  hasAfterResponseHook,
4166
4303
  hasHTMLTransformHook,
4167
- renderPayload,
4304
+ // render.html gets the render info render.before got.
4305
+ renderPayload: pageHookRoute(pageHookPathname).render,
4168
4306
  method,
4169
4307
  urlPath,
4170
4308
  pathname,
@@ -4211,9 +4349,6 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4211
4349
  return;
4212
4350
  }
4213
4351
  const renderer = farmApp.getServerRenderer();
4214
- if (pm && hasBeforeRenderHook) {
4215
- await pm.runHookParallel("beforeRender", renderPayload);
4216
- }
4217
4352
  await renderer.renderPage(req, res);
4218
4353
  if (!shouldInterceptResponse) {
4219
4354
  logResponse(method, urlPath, res.statusCode || 200, Date.now() - startTime, "PAGE");
@@ -4222,24 +4357,29 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4222
4357
  const duration = Date.now() - startTime;
4223
4358
  logResponse(method, urlPath, 500, duration, "PAGE");
4224
4359
  if (pm && runtimeSession) {
4225
- await pm.failRuntimeRequest(runtimeSession, error);
4226
- }
4227
- if (!(middlewareFailed && runtimeSession)) {
4360
+ if (middlewareFailed) {
4361
+ await pm.reportRuntimeRequestError(runtimeSession, error);
4362
+ } else {
4363
+ await pm.failRuntimeRequest(runtimeSession, error);
4364
+ if (!res.headersSent && !_optionalChain([responseInterceptor, 'optionalAccess', _327 => _327.isEnded, 'call', _328 => _328()])) {
4365
+ _optionalChain([responseInterceptor, 'optionalAccess', _329 => _329.release, 'call', _330 => _330()]);
4366
+ console.error("[FARM] Page error:", error);
4367
+ sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
4368
+ return;
4369
+ }
4370
+ }
4371
+ } else {
4228
4372
  await emitPluginError("render-page", error, { pathname });
4229
4373
  }
4230
4374
  if (rendererDisabled && !res.headersSent) {
4231
4375
  sendFarmDevErrorJSON(res);
4232
4376
  return;
4233
4377
  }
4234
- if (!res.headersSent) {
4235
- res.setHeader("Content-Type", "text/html; charset=utf-8");
4236
- res.setHeader("Cache-Control", "private, no-store");
4237
- }
4238
- next(error);
4378
+ sendDevErrorPage(error);
4239
4379
  }
4240
4380
  })
4241
4381
  );
4242
- const farmRequestMiddleware = _optionalChain([farmMiddlewares, 'access', _327 => _327.stack, 'access', _328 => _328.at, 'call', _329 => _329(-1), 'optionalAccess', _330 => _330.handle]);
4382
+ const farmRequestMiddleware = _optionalChain([farmMiddlewares, 'access', _331 => _331.stack, 'access', _332 => _332.at, 'call', _333 => _333(-1), 'optionalAccess', _334 => _334.handle]);
4243
4383
  if (farmOwnsDevCors && viteServer.config.server.cors === false) {
4244
4384
  farmMiddlewares.use(createFarmDevViteCorsMiddleware());
4245
4385
  }
@@ -4262,7 +4402,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4262
4402
  },
4263
4403
  async resolveId(id, importer, resolveOptions) {
4264
4404
  if (id.startsWith("@farm.js/core/internal/") && importer) {
4265
- const root = _optionalChain([farmApp, 'optionalAccess', _331 => _331.getConfig, 'call', _332 => _332(), 'access', _333 => _333.root]) || _optionalChain([server, 'optionalAccess', _334 => _334.config, 'access', _335 => _335.root]) || options.root;
4405
+ const root = _optionalChain([farmApp, 'optionalAccess', _335 => _335.getConfig, 'call', _336 => _336(), 'access', _337 => _337.root]) || _optionalChain([server, 'optionalAccess', _338 => _338.config, 'access', _339 => _339.root]) || options.root;
4266
4406
  const relative4 = root ? path6.relative(root, importer.split("?", 1)[0]) : "";
4267
4407
  if (root && (relative4.startsWith("..") || path6.isAbsolute(relative4))) {
4268
4408
  return this.resolve(id, path6.join(root, "package.json"), {
@@ -4293,7 +4433,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4293
4433
  }
4294
4434
  },
4295
4435
  async load(id, loadOptions) {
4296
- if (pendingClientSetup && !_optionalChain([loadOptions, 'optionalAccess', _336 => _336.ssr]) && !farmSetupContext.getStore()) {
4436
+ if (pendingClientSetup && !_optionalChain([loadOptions, 'optionalAccess', _340 => _340.ssr]) && !farmSetupContext.getStore()) {
4297
4437
  await pendingClientSetup;
4298
4438
  }
4299
4439
  if (_chunkPIUTGRDIcjs.isFarmServerFnBoundaryId.call(void 0, id) && islandsServerFns()) {
@@ -4311,8 +4451,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4311
4451
  if (imageModule) return imageModule;
4312
4452
  }
4313
4453
  if (_chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
4314
- const renderer = _optionalChain([farmApp, 'optionalAccess', _337 => _337.getConfig, 'call', _338 => _338(), 'access', _339 => _339.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
4315
- const root = _optionalChain([server, 'optionalAccess', _340 => _340.config, 'access', _341 => _341.root]) || options.root;
4454
+ const renderer = _optionalChain([farmApp, 'optionalAccess', _341 => _341.getConfig, 'call', _342 => _342(), 'access', _343 => _343.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
4455
+ const root = _optionalChain([server, 'optionalAccess', _344 => _344.config, 'access', _345 => _345.root]) || options.root;
4316
4456
  if (isClientEnvironment(this, loadOptions)) {
4317
4457
  return generateProgrammaticClientRouteModuleForId(
4318
4458
  id,
@@ -4328,65 +4468,65 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4328
4468
  return FARM_DEV_CLIENT_BOOT_MODULE;
4329
4469
  }
4330
4470
  if (isFarmClientVirtualId(id)) {
4331
- const resolvedConfig = _optionalChain([farmApp, 'optionalAccess', _342 => _342.getConfig, 'call', _343 => _343()]);
4332
- const renderer = _optionalChain([resolvedConfig, 'optionalAccess', _344 => _344.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
4333
- const integrations = _optionalChain([resolvedConfig, 'optionalAccess', _345 => _345.integrations]) || options.integrations;
4334
- const root = _optionalChain([resolvedConfig, 'optionalAccess', _346 => _346.root]) || _optionalChain([server, 'optionalAccess', _347 => _347.config, 'access', _348 => _348.root]) || process.cwd();
4335
- const docs = _optionalChain([resolvedConfig, 'optionalAccess', _349 => _349.docs]);
4471
+ const resolvedConfig = _optionalChain([farmApp, 'optionalAccess', _346 => _346.getConfig, 'call', _347 => _347()]);
4472
+ const renderer = _optionalChain([resolvedConfig, 'optionalAccess', _348 => _348.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
4473
+ const integrations = _optionalChain([resolvedConfig, 'optionalAccess', _349 => _349.integrations]) || options.integrations;
4474
+ const root = _optionalChain([resolvedConfig, 'optionalAccess', _350 => _350.root]) || _optionalChain([server, 'optionalAccess', _351 => _351.config, 'access', _352 => _352.root]) || process.cwd();
4475
+ const docs = _optionalChain([resolvedConfig, 'optionalAccess', _353 => _353.docs]);
4336
4476
  const adapterOwnsDocsRuntime = Boolean(
4337
- _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([docs, 'optionalAccess', _350 => _350.adapter, 'optionalAccess', _351 => _351.server]) && docs.adapter.react
4477
+ _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([docs, 'optionalAccess', _354 => _354.adapter, 'optionalAccess', _355 => _355.server]) && docs.adapter.react
4338
4478
  );
4339
- const devtools = _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _352 => _352.devtools]), () => ( _chunkSTF6VDYQcjs.resolveFarmDevtoolsConfig.call(void 0, false, "production")));
4479
+ const devtools = _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _356 => _356.devtools]), () => ( _chunkSTF6VDYQcjs.resolveFarmDevtoolsConfig.call(void 0, false, "production")));
4340
4480
  const [docsRuntime, docsSearchRuntime, devtoolsClientRuntime] = await Promise.all([
4341
- _optionalChain([docs, 'optionalAccess', _353 => _353.enabled]) ? loadFarmDocsDevRuntime() : null,
4342
- _optionalChain([docs, 'optionalAccess', _354 => _354.enabled]) && !adapterOwnsDocsRuntime ? loadFarmDocsSearchDevRuntime() : null,
4481
+ _optionalChain([docs, 'optionalAccess', _357 => _357.enabled]) ? loadFarmDocsDevRuntime() : null,
4482
+ _optionalChain([docs, 'optionalAccess', _358 => _358.enabled]) && !adapterOwnsDocsRuntime ? loadFarmDocsSearchDevRuntime() : null,
4343
4483
  devtools.enabled ? loadFarmDevtoolsClientRuntime() : null
4344
4484
  ]);
4345
- const docsSearchEnabled = _nullishCoalesce(_optionalChain([docsSearchRuntime, 'optionalAccess', _355 => _355.isFarmDocsSearchEnabled, 'call', _356 => _356(docs)]), () => ( false));
4485
+ const docsSearchEnabled = _nullishCoalesce(_optionalChain([docsSearchRuntime, 'optionalAccess', _359 => _359.isFarmDocsSearchEnabled, 'call', _360 => _360(docs)]), () => ( false));
4346
4486
  const generatedDocsSearchRuntime = docsSearchRuntime ? docsSearchRuntime.generateFarmDocsSearchClientRuntime(
4347
4487
  docsSearchEnabled,
4348
4488
  docsSearchEnabled ? docsSearchRuntime.resolveFarmDocsSearchClientModule(root) : void 0
4349
4489
  ) : EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME;
4350
4490
  const generatedDevtoolsClientRuntime = devtoolsClientRuntime ? devtoolsClientRuntime.generateFarmDevtoolsClientRuntime(devtools) : "";
4351
4491
  const generatedDevIndicatorsClientRuntime = farmApp ? _chunkUVV3I5QAcjs.generateFarmDevIndicatorsClientRuntime.call(void 0, farmApp.getConfig().devIndicators) : "";
4352
- const integrationProviders = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _chunkBDYM2TN3cjs.getIntegrationProviders.call(void 0, integrations) : [];
4353
- const isolatedHydrationMode = _chunkMZ4CRSY7cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
4354
- _optionalChain([resolvedConfig, 'optionalAccess', _357 => _357.experimental, 'optionalAccess', _358 => _358.isolatedClientHydration]),
4492
+ const integrationProviders = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _chunkJX5VOLAVcjs.getIntegrationProviders.call(void 0, integrations) : [];
4493
+ const isolatedHydrationMode = _chunkIEN2EFE5cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
4494
+ _optionalChain([resolvedConfig, 'optionalAccess', _361 => _361.experimental, 'optionalAccess', _362 => _362.isolatedClientHydration]),
4355
4495
  {
4356
- serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _359 => _359.experimental, 'optionalAccess', _360 => _360.serverComponents])) === "rsc",
4496
+ serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _363 => _363.experimental, 'optionalAccess', _364 => _364.serverComponents])) === "rsc",
4357
4497
  hasUnsupportedIntegrationProvider: integrationProviders.filter((provider) => provider.component || provider.type === "clerk").some((provider) => provider.supportsIsolatedHydration !== true)
4358
4498
  }
4359
4499
  );
4360
4500
  return generateClientCode(
4361
4501
  integrationProviders,
4362
4502
  [
4363
- ..._chunkBDYM2TN3cjs.getIntegrationDocumentNavigationMatchers.call(void 0, integrations),
4364
- ..._nullishCoalesce(_optionalChain([docsRuntime, 'optionalAccess', _361 => _361.getFarmDocsDocumentNavigationMatchers, 'call', _362 => _362(docs)]), () => ( []))
4503
+ ..._chunkJX5VOLAVcjs.getIntegrationDocumentNavigationMatchers.call(void 0, integrations),
4504
+ ..._nullishCoalesce(_optionalChain([docsRuntime, 'optionalAccess', _365 => _365.getFarmDocsDocumentNavigationMatchers, 'call', _366 => _366(docs)]), () => ( []))
4365
4505
  ],
4366
4506
  generatedDocsSearchRuntime,
4367
4507
  `${generatedDevtoolsClientRuntime}
4368
4508
  ${generatedDevIndicatorsClientRuntime}`,
4369
- _optionalChain([resolvedConfig, 'optionalAccess', _363 => _363.plugins]) || [],
4509
+ _optionalChain([resolvedConfig, 'optionalAccess', _367 => _367.plugins]) || [],
4370
4510
  root,
4371
- _optionalChain([resolvedConfig, 'optionalAccess', _364 => _364.srcDir]) || options.srcDir || "src",
4372
- _optionalChain([resolvedConfig, 'optionalAccess', _365 => _365.publicRuntimeConfig]) || options.publicRuntimeConfig,
4373
- _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _optionalChain([docs, 'optionalAccess', _366 => _366.adapter, 'optionalAccess', _367 => _367.react]) : void 0,
4511
+ _optionalChain([resolvedConfig, 'optionalAccess', _368 => _368.srcDir]) || options.srcDir || "src",
4512
+ _optionalChain([resolvedConfig, 'optionalAccess', _369 => _369.publicRuntimeConfig]) || options.publicRuntimeConfig,
4513
+ _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _optionalChain([docs, 'optionalAccess', _370 => _370.adapter, 'optionalAccess', _371 => _371.react]) : void 0,
4374
4514
  renderer,
4375
- isolatedHydrationMode === "enabled" || _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([(_nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _368 => _368.getRouteManager, 'call', _369 => _369(), 'access', _370 => _370.getIsolatedClientBoundaryModules, 'call', _371 => _371(root)])))), 'optionalAccess', _372 => _372.size]) > 0,
4376
- _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _373 => _373.trailingSlash]), () => ( false)),
4377
- _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _374 => _374.basePath]), () => ( "/")),
4378
- _chunkF36LS2C7cjs.generateClientCachePersistenceCode.call(void 0,
4379
- _chunkF36LS2C7cjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, _optionalChain([resolvedConfig, 'optionalAccess', _375 => _375.cache]))
4515
+ isolatedHydrationMode === "enabled" || _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([(_nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _372 => _372.getRouteManager, 'call', _373 => _373(), 'access', _374 => _374.getIsolatedClientBoundaryModules, 'call', _375 => _375(root)])))), 'optionalAccess', _376 => _376.size]) > 0,
4516
+ _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _377 => _377.trailingSlash]), () => ( false)),
4517
+ _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _378 => _378.basePath]), () => ( "/")),
4518
+ _chunkM6U6E4F7cjs.generateClientCachePersistenceCode.call(void 0,
4519
+ _chunkM6U6E4F7cjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, _optionalChain([resolvedConfig, 'optionalAccess', _379 => _379.cache]))
4380
4520
  ),
4381
4521
  _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, docs) : void 0,
4382
- _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _376 => _376.experimental, 'optionalAccess', _377 => _377.serverComponents])) === "islands"
4522
+ _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _380 => _380.experimental, 'optionalAccess', _381 => _381.serverComponents])) === "islands"
4383
4523
  );
4384
4524
  }
4385
4525
  if (id === "/@farm/server") {
4386
4526
  return generateServerCode();
4387
4527
  }
4388
4528
  if (id === "/@farm/manifest") {
4389
- const routeManager = _optionalChain([farmApp, 'optionalAccess', _378 => _378.getRouteManager, 'call', _379 => _379()]);
4529
+ const routeManager = _optionalChain([farmApp, 'optionalAccess', _382 => _382.getRouteManager, 'call', _383 => _383()]);
4390
4530
  if (!routeManager) {
4391
4531
  return `
4392
4532
  export const getManifest = () => ({
@@ -4399,9 +4539,9 @@ export const getManifest = () => ({
4399
4539
  `;
4400
4540
  }
4401
4541
  const manifest = routeManager.generateClientManifest(server.config.root);
4402
- const globalStylesheetHref = _chunkF36LS2C7cjs.resolveDevGlobalStylesheetHref.call(void 0,
4542
+ const globalStylesheetHref = _chunkM6U6E4F7cjs.resolveDevGlobalStylesheetHref.call(void 0,
4403
4543
  server.config.root,
4404
- _optionalChain([farmApp, 'optionalAccess', _380 => _380.getConfig, 'call', _381 => _381(), 'access', _382 => _382.srcDir])
4544
+ _optionalChain([farmApp, 'optionalAccess', _384 => _384.getConfig, 'call', _385 => _385(), 'access', _386 => _386.srcDir])
4405
4545
  );
4406
4546
  const fullManifest = {
4407
4547
  clientEntry: "/@farm/client.js",
@@ -4427,11 +4567,11 @@ export const getManifest = () => ({
4427
4567
  };
4428
4568
  }
4429
4569
  for (const layout of manifest.layouts) {
4430
- const groupScope = _chunkUPOYKX4Scjs.getRouteGroupScope.call(void 0, layout.pattern);
4570
+ const groupScope = _chunk2MR4MABGcjs.getRouteGroupScope.call(void 0, layout.pattern);
4431
4571
  fullManifest.layouts[layout.pattern] = {
4432
4572
  modulePath: layout.modulePath,
4433
4573
  pattern: layout.pattern,
4434
- ...groupScope ? { urlPattern: _chunkUPOYKX4Scjs.stripRouteGroups.call(void 0, layout.pattern), groupScope } : {},
4574
+ ...groupScope ? { urlPattern: _chunk2MR4MABGcjs.stripRouteGroups.call(void 0, layout.pattern), groupScope } : {},
4435
4575
  shouldHydrate: layout.shouldHydrate,
4436
4576
  islandStrategy: layout.islandStrategy,
4437
4577
  // Islands mode: rebuilt from its server tree, so its module is never preloaded.
@@ -4457,54 +4597,54 @@ export const manifest = getManifest();
4457
4597
  }
4458
4598
  },
4459
4599
  async transform(code, id, transformOptions) {
4460
- if (pendingClientSetup && !_optionalChain([transformOptions, 'optionalAccess', _383 => _383.ssr]) && !farmSetupContext.getStore()) {
4600
+ if (pendingClientSetup && !_optionalChain([transformOptions, 'optionalAccess', _387 => _387.ssr]) && !farmSetupContext.getStore()) {
4461
4601
  await pendingClientSetup;
4462
4602
  }
4463
- const actionConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _384 => _384.getConfig, 'call', _385 => _385()]), () => ( options));
4603
+ const actionConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _388 => _388.getConfig, 'call', _389 => _389()]), () => ( options));
4464
4604
  let rewrotePackageImports = false;
4465
- if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([actionConfig, 'access', _386 => _386.experimental, 'optionalAccess', _387 => _387.serverComponents])) === "islands" && (!id.includes("/node_modules/") || _optionalChain([transformOptions, 'optionalAccess', _388 => _388.ssr]) === true && farmReactServerFiles.has(id.split("?", 1)[0])) && !id.startsWith("\0") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id) && !_chunkMZ4CRSY7cjs.hasUseClientDirective.call(void 0, code)) {
4605
+ if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([actionConfig, 'access', _390 => _390.experimental, 'optionalAccess', _391 => _391.serverComponents])) === "islands" && (!id.includes("/node_modules/") || _optionalChain([transformOptions, 'optionalAccess', _392 => _392.ssr]) === true && farmReactServerFiles.has(id.split("?", 1)[0])) && !id.startsWith("\0") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id) && !_chunkIEN2EFE5cjs.hasUseClientDirective.call(void 0, code)) {
4466
4606
  const file = id.split("?", 1)[0];
4467
- const projectRoot = actionConfig.root || _optionalChain([server, 'optionalAccess', _389 => _389.config, 'access', _390 => _390.root]) || process.cwd();
4468
- if (_optionalChain([transformOptions, 'optionalAccess', _391 => _391.ssr]) === true) {
4607
+ const projectRoot = actionConfig.root || _optionalChain([server, 'optionalAccess', _393 => _393.config, 'access', _394 => _394.root]) || process.cwd();
4608
+ if (_optionalChain([transformOptions, 'optionalAccess', _395 => _395.ssr]) === true) {
4469
4609
  if (farmReactServerFiles.has(file)) {
4470
- for (const child of _chunkMZ4CRSY7cjs.farmRelativeImportFiles.call(void 0, code, file))
4610
+ for (const child of _chunkIEN2EFE5cjs.farmRelativeImportFiles.call(void 0, code, file))
4471
4611
  farmReactServerFiles.add(child);
4472
4612
  }
4473
- const serverModule = farmReactServerFiles.has(file) || !_chunkMZ4CRSY7cjs.getFarmClientReachableModules.call(void 0,
4613
+ const serverModule = farmReactServerFiles.has(file) || !_chunkIEN2EFE5cjs.getFarmClientReachableModules.call(void 0,
4474
4614
  path6.resolve(projectRoot, actionConfig.srcDir || "src"),
4475
4615
  projectRoot
4476
4616
  ).has(path6.resolve(file));
4477
- const reactServer = !serverModule ? null : _chunkMZ4CRSY7cjs.rewriteFarmReactServerImports.call(void 0, {
4617
+ const reactServer = !serverModule ? null : _chunkIEN2EFE5cjs.rewriteFarmReactServerImports.call(void 0, {
4478
4618
  code,
4479
4619
  file,
4480
- reference: (specifier, exportName) => _chunkMZ4CRSY7cjs.ensureFarmPackageClientReference.call(void 0, projectRoot, specifier, exportName, file),
4620
+ reference: (specifier, exportName) => _chunkIEN2EFE5cjs.ensureFarmPackageClientReference.call(void 0, projectRoot, specifier, exportName, file),
4481
4621
  onServerFile: (serverFile) => farmReactServerFiles.add(serverFile)
4482
4622
  });
4483
4623
  if (reactServer !== null) {
4484
4624
  code = reactServer;
4485
4625
  rewrotePackageImports = true;
4486
4626
  }
4487
- const internal = farmReactServerFiles.has(file) ? _chunkMZ4CRSY7cjs.rewriteFarmReactServerClientModuleImports.call(void 0, {
4627
+ const internal = farmReactServerFiles.has(file) ? _chunkIEN2EFE5cjs.rewriteFarmReactServerClientModuleImports.call(void 0, {
4488
4628
  code,
4489
4629
  file,
4490
- reference: (clientFile) => _chunkMZ4CRSY7cjs.ensureFarmInternalClientReference.call(void 0, projectRoot, clientFile)
4630
+ reference: (clientFile) => _chunkIEN2EFE5cjs.ensureFarmInternalClientReference.call(void 0, projectRoot, clientFile)
4491
4631
  }) : null;
4492
4632
  if (internal !== null) {
4493
4633
  code = internal;
4494
4634
  rewrotePackageImports = true;
4495
4635
  }
4496
4636
  }
4497
- const referenced = _chunkMZ4CRSY7cjs.rewriteFarmPackageClientImports.call(void 0, {
4637
+ const referenced = _chunkIEN2EFE5cjs.rewriteFarmPackageClientImports.call(void 0, {
4498
4638
  code,
4499
4639
  file,
4500
4640
  root: projectRoot,
4501
- isClientPackage: (specifier) => _chunkMZ4CRSY7cjs.isFarmPackageClientBoundary.call(void 0, file, specifier, projectRoot)
4641
+ isClientPackage: (specifier) => _chunkIEN2EFE5cjs.isFarmPackageClientBoundary.call(void 0, file, specifier, projectRoot)
4502
4642
  });
4503
4643
  if (referenced !== null) {
4504
4644
  code = referenced;
4505
4645
  rewrotePackageImports = true;
4506
4646
  }
4507
- if (_optionalChain([transformOptions, 'optionalAccess', _392 => _392.ssr]) === true) {
4647
+ if (_optionalChain([transformOptions, 'optionalAccess', _396 => _396.ssr]) === true) {
4508
4648
  const cached = rewriteFarmReactCacheImport(code, file);
4509
4649
  if (cached !== null) {
4510
4650
  code = cached;
@@ -4514,43 +4654,43 @@ export const manifest = getManifest();
4514
4654
  }
4515
4655
  if (islandsServerFns() && !_chunkPIUTGRDIcjs.isFarmServerFnBoundaryId.call(void 0, id) && !id.includes("/node_modules/") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id)) {
4516
4656
  const serverFns = _chunkPIUTGRDIcjs.transformFarmServerFns.call(void 0, code, id, {
4517
- environment: _optionalChain([transformOptions, 'optionalAccess', _393 => _393.ssr]) === true ? "rsc" : "client"
4657
+ environment: _optionalChain([transformOptions, 'optionalAccess', _397 => _397.ssr]) === true ? "rsc" : "client"
4518
4658
  });
4519
4659
  if (serverFns) {
4520
4660
  if (!serverFns.code.includes("use server")) return { code: serverFns.code, map: null };
4521
4661
  code = serverFns.code;
4522
4662
  }
4523
4663
  }
4524
- if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([actionConfig, 'access', _394 => _394.experimental, 'optionalAccess', _395 => _395.serverComponents])) === "islands" && code.includes("use server") && !id.includes("/node_modules/") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id)) {
4664
+ if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([actionConfig, 'access', _398 => _398.experimental, 'optionalAccess', _399 => _399.serverComponents])) === "islands" && code.includes("use server") && !id.includes("/node_modules/") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id)) {
4525
4665
  const file = id.split("?", 1)[0];
4526
4666
  const actionModule = transformFarmFormActionModule({
4527
4667
  code,
4528
4668
  id,
4529
- root: actionConfig.root || _optionalChain([server, 'optionalAccess', _396 => _396.config, 'access', _397 => _397.root]) || process.cwd(),
4530
- ssr: _optionalChain([transformOptions, 'optionalAccess', _398 => _398.ssr]) === true,
4669
+ root: actionConfig.root || _optionalChain([server, 'optionalAccess', _400 => _400.config, 'access', _401 => _401.root]) || process.cwd(),
4670
+ ssr: _optionalChain([transformOptions, 'optionalAccess', _402 => _402.ssr]) === true,
4531
4671
  // Parsed by file type: page components are TSX.
4532
4672
  parse: (source) => _vite.parseSync.call(void 0, file, source).program
4533
4673
  });
4534
4674
  if (actionModule) return { code: actionModule, map: null };
4535
4675
  }
4536
- if (!_optionalChain([transformOptions, 'optionalAccess', _399 => _399.ssr])) {
4537
- const docsConfigModule = _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, _optionalChain([farmApp, 'optionalAccess', _400 => _400.getConfig, 'call', _401 => _401(), 'optionalAccess', _402 => _402.docs]));
4538
- if (_chunkF36LS2C7cjs.isFarmDocsClientConfigModule.call(void 0, id, docsConfigModule)) {
4539
- const redacted = _chunkF36LS2C7cjs.redactFarmDocsClientConfig.call(void 0, code, id.split("?")[0]);
4676
+ if (!_optionalChain([transformOptions, 'optionalAccess', _403 => _403.ssr])) {
4677
+ const docsConfigModule = _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, _optionalChain([farmApp, 'optionalAccess', _404 => _404.getConfig, 'call', _405 => _405(), 'optionalAccess', _406 => _406.docs]));
4678
+ if (_chunkM6U6E4F7cjs.isFarmDocsClientConfigModule.call(void 0, id, docsConfigModule)) {
4679
+ const redacted = _chunkM6U6E4F7cjs.redactFarmDocsClientConfig.call(void 0, code, id.split("?")[0]);
4540
4680
  if (redacted !== null) return { code: redacted, map: null };
4541
4681
  }
4542
4682
  }
4543
- if (!_optionalChain([transformOptions, 'optionalAccess', _403 => _403.ssr])) {
4544
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _404 => _404.getConfig, 'call', _405 => _405()]), () => ( options));
4545
- if ((_optionalChain([currentConfig, 'access', _406 => _406.experimental, 'optionalAccess', _407 => _407.serverActions]) !== true || !serverFnTransformActive) && !islandsServerFns()) {
4683
+ if (!_optionalChain([transformOptions, 'optionalAccess', _407 => _407.ssr])) {
4684
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _408 => _408.getConfig, 'call', _409 => _409()]), () => ( options));
4685
+ if ((_optionalChain([currentConfig, 'access', _410 => _410.experimental, 'optionalAccess', _411 => _411.serverActions]) !== true || !serverFnTransformActive) && !islandsServerFns()) {
4546
4686
  const violation = findClientServerFnViolation(code, id);
4547
4687
  if (violation) {
4548
4688
  this.error(formatServerFnBoundaryError(violation, id));
4549
4689
  }
4550
4690
  }
4551
4691
  }
4552
- if (!_optionalChain([transformOptions, 'optionalAccess', _408 => _408.ssr]) && shouldInspectClientBoundary(id, code)) {
4553
- warnClientBoundaryOnce(this, id, code, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _409 => _409.getConfig, 'call', _410 => _410()]), () => ( options)));
4692
+ if (!_optionalChain([transformOptions, 'optionalAccess', _412 => _412.ssr]) && shouldInspectClientBoundary(id, code)) {
4693
+ warnClientBoundaryOnce(this, id, code, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _413 => _413.getConfig, 'call', _414 => _414()]), () => ( options)));
4554
4694
  }
4555
4695
  if (typeof imageImports.transform === "function") {
4556
4696
  const imageModule = await imageImports.transform.call(this, code, id, transformOptions);
@@ -4565,13 +4705,13 @@ export const manifest = getManifest();
4565
4705
  id,
4566
4706
  transformOptions
4567
4707
  );
4568
- const fontCode = typeof fontResult === "string" ? fontResult : _optionalChain([fontResult, 'optionalAccess', _411 => _411.code, 'optionalAccess', _412 => _412.toString, 'call', _413 => _413()]);
4708
+ const fontCode = typeof fontResult === "string" ? fontResult : _optionalChain([fontResult, 'optionalAccess', _415 => _415.code, 'optionalAccess', _416 => _416.toString, 'call', _417 => _417()]);
4569
4709
  if (fontCode) {
4570
4710
  transformedCode = fontCode;
4571
4711
  transformed = true;
4572
4712
  }
4573
4713
  }
4574
- if (_optionalChain([transformOptions, 'optionalAccess', _414 => _414.ssr]) && server) {
4714
+ if (_optionalChain([transformOptions, 'optionalAccess', _418 => _418.ssr]) && server) {
4575
4715
  const rewrittenImports = rewriteEarlySsrRelativeImports({
4576
4716
  code: transformedCode,
4577
4717
  id,
@@ -4583,26 +4723,26 @@ export const manifest = getManifest();
4583
4723
  transformed = true;
4584
4724
  }
4585
4725
  }
4586
- if (_chunkMZ4CRSY7cjs.hasUseClientDirective.call(void 0, transformedCode)) {
4726
+ if (_chunkIEN2EFE5cjs.hasUseClientDirective.call(void 0, transformedCode)) {
4587
4727
  const clientBoundarySource = transformedCode;
4588
4728
  const moduleInfo = this.getModuleInfo(id);
4589
4729
  if (moduleInfo) {
4590
4730
  moduleInfo.isClientComponent = true;
4591
4731
  }
4592
- transformedCode = _chunkMZ4CRSY7cjs.stripUseClientDirective.call(void 0, transformedCode);
4732
+ transformedCode = _chunkIEN2EFE5cjs.stripUseClientDirective.call(void 0, transformedCode);
4593
4733
  transformed = true;
4594
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _415 => _415.getConfig, 'call', _416 => _416()]), () => ( options));
4734
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _419 => _419.getConfig, 'call', _420 => _420()]), () => ( options));
4595
4735
  let isolatedModuleReference = null;
4596
- const root = currentConfig.root || _optionalChain([server, 'optionalAccess', _417 => _417.config, 'access', _418 => _418.root]) || process.cwd();
4736
+ const root = currentConfig.root || _optionalChain([server, 'optionalAccess', _421 => _421.config, 'access', _422 => _422.root]) || process.cwd();
4597
4737
  const cleanId = id.split("?", 1)[0];
4598
- const selectedIsolatedModules = _nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _419 => _419.getRouteManager, 'call', _420 => _420(), 'access', _421 => _421.getIsolatedClientBoundaryModules, 'call', _422 => _422(root)])));
4599
- const selectedForIsolatedHydration = _optionalChain([selectedIsolatedModules, 'optionalAccess', _423 => _423.has, 'call', _424 => _424(path6.resolve(cleanId))]) === true;
4600
- if (_chunk67MZTLTFcjs.isReactRenderer.call(void 0, _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, currentConfig.renderer)) && selectedForIsolatedHydration && (_chunkMZ4CRSY7cjs.isIsolatableClientBoundarySource.call(void 0, clientBoundarySource) || // A generated client reference, whose marker comment compiled TSX no longer has.
4601
- cleanId.replace(/\\/g, "/").includes(_chunkMZ4CRSY7cjs.FARM_CLIENT_REFERENCE_DIRECTORY))) {
4738
+ const selectedIsolatedModules = _nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _423 => _423.getRouteManager, 'call', _424 => _424(), 'access', _425 => _425.getIsolatedClientBoundaryModules, 'call', _426 => _426(root)])));
4739
+ const selectedForIsolatedHydration = _optionalChain([selectedIsolatedModules, 'optionalAccess', _427 => _427.has, 'call', _428 => _428(path6.resolve(cleanId))]) === true;
4740
+ if (_chunk67MZTLTFcjs.isReactRenderer.call(void 0, _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, currentConfig.renderer)) && selectedForIsolatedHydration && (_chunkIEN2EFE5cjs.isIsolatableClientBoundarySource.call(void 0, clientBoundarySource) || // A generated client reference, whose marker comment compiled TSX no longer has.
4741
+ cleanId.replace(/\\/g, "/").includes(_chunkIEN2EFE5cjs.FARM_CLIENT_REFERENCE_DIRECTORY))) {
4602
4742
  isolatedModuleReference = _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, cleanId, root);
4603
- const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([currentConfig, 'access', _425 => _425.experimental, 'optionalAccess', _426 => _426.serverComponents])) === "islands";
4604
- const explicitStrategy = _chunkMZ4CRSY7cjs.getIslandStrategyExport.call(void 0, clientBoundarySource);
4605
- const inference = islandsMode && explicitStrategy === null ? _chunkF36LS2C7cjs.inferFarmIslandStrategy.call(void 0, cleanId, root) : null;
4743
+ const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([currentConfig, 'access', _429 => _429.experimental, 'optionalAccess', _430 => _430.serverComponents])) === "islands";
4744
+ const explicitStrategy = _chunkIEN2EFE5cjs.getIslandStrategyExport.call(void 0, clientBoundarySource);
4745
+ const inference = islandsMode && explicitStrategy === null ? _chunkM6U6E4F7cjs.inferFarmIslandStrategy.call(void 0, cleanId, root) : null;
4606
4746
  if (inference) {
4607
4747
  for (const file of inference.files) {
4608
4748
  if (file !== path6.resolve(cleanId)) this.addWatchFile(file);
@@ -4615,8 +4755,8 @@ export const manifest = getManifest();
4615
4755
  islandStrategy: _nullishCoalesce(explicitStrategy, () => ( "load")),
4616
4756
  parse: (source) => this.parse(source),
4617
4757
  slots: islandsMode,
4618
- browser: _optionalChain([transformOptions, 'optionalAccess', _427 => _427.ssr]) !== true,
4619
- inferredInteraction: _optionalChain([inference, 'optionalAccess', _428 => _428.strategy]) === "interaction"
4758
+ browser: _optionalChain([transformOptions, 'optionalAccess', _431 => _431.ssr]) !== true,
4759
+ inferredInteraction: _optionalChain([inference, 'optionalAccess', _432 => _432.strategy]) === "interaction"
4620
4760
  });
4621
4761
  if (!transformedBoundary) {
4622
4762
  this.error(
@@ -4646,7 +4786,7 @@ export const manifest = getManifest();
4646
4786
  );
4647
4787
  return;
4648
4788
  }` : "";
4649
- const hmrCode = _optionalChain([transformOptions, 'optionalAccess', _429 => _429.ssr]) || reactRefreshActive || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
4789
+ const hmrCode = _optionalChain([transformOptions, 'optionalAccess', _433 => _433.ssr]) || reactRefreshActive || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
4650
4790
  if (import.meta.hot) {
4651
4791
  import.meta.hot.accept((newModule) => {
4652
4792
  ${isolatedHmrUpdate}
@@ -4702,14 +4842,14 @@ if (import.meta.hot) {
4702
4842
  }
4703
4843
  _chunkQMNWKQL4cjs.logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
4704
4844
  _chunkQMNWKQL4cjs.logger.info("Pre-rendering SSG pages...");
4705
- const outDir = path6.join(_optionalChain([server, 'optionalAccess', _430 => _430.config, 'access', _431 => _431.root]) || process.cwd(), options.outDir || "dist");
4845
+ const outDir = path6.join(_optionalChain([server, 'optionalAccess', _434 => _434.config, 'access', _435 => _435.root]) || process.cwd(), options.outDir || "dist");
4706
4846
  const clientDir = path6.join(outDir, "client");
4707
4847
  for (const page of ssgPages) {
4708
4848
  try {
4709
4849
  const staticRequest = new Request(new URL(page.urlPath, "http://farm.static"));
4710
4850
  await farmApp.getServerRenderer().runWithRequestContext(staticRequest, async () => {
4711
4851
  const mod = await routeManager.loadRouteModule(page.filePath);
4712
- if (!_optionalChain([mod, 'optionalAccess', _432 => _432.default])) return;
4852
+ if (!_optionalChain([mod, 'optionalAccess', _436 => _436.default])) return;
4713
4853
  const { layouts } = routeManager.matchRoute(page.urlPath);
4714
4854
  const layoutModules = await Promise.all(
4715
4855
  layouts.map((l) => routeManager.loadLayoutModule(l.modulePath))
@@ -4738,10 +4878,10 @@ if (import.meta.hot) {
4738
4878
  );
4739
4879
  }
4740
4880
  const html = renderToString(pageElement);
4741
- const i18nSnapshot = _chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, );
4881
+ const i18nSnapshot = _chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0, );
4742
4882
  const i18nHead = renderFarmI18nStaticHead(page.urlPath, i18nSnapshot);
4743
4883
  const fullHtml = `<!DOCTYPE html>
4744
- <html lang="${escapeFarmHtmlAttribute(_optionalChain([i18nSnapshot, 'optionalAccess', _433 => _433.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}>
4884
+ <html lang="${escapeFarmHtmlAttribute(_optionalChain([i18nSnapshot, 'optionalAccess', _437 => _437.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}>
4745
4885
  <head>
4746
4886
  <meta charset="utf-8">
4747
4887
  <meta name="viewport" content="width=device-width, initial-scale=1">
@@ -4784,8 +4924,8 @@ if (import.meta.hot) {
4784
4924
  }
4785
4925
  },
4786
4926
  watchChange() {
4787
- _chunkMZ4CRSY7cjs.invalidateFarmClientReachableModules.call(void 0, );
4788
- _chunkMZ4CRSY7cjs.invalidateFarmClientOnlyScan.call(void 0, );
4927
+ _chunkIEN2EFE5cjs.invalidateFarmClientReachableModules.call(void 0, );
4928
+ _chunkIEN2EFE5cjs.invalidateFarmClientOnlyScan.call(void 0, );
4789
4929
  },
4790
4930
  async handleHotUpdate(ctx) {
4791
4931
  if (pendingClientSetup && !farmSetupContext.getStore()) await pendingClientSetup;
@@ -4810,13 +4950,13 @@ if (import.meta.hot) {
4810
4950
  server2.moduleGraph.invalidateModule(mod);
4811
4951
  }
4812
4952
  }
4813
- const currentFarmConfig = _optionalChain([farmApp, 'optionalAccess', _434 => _434.getConfig, 'call', _435 => _435()]);
4953
+ const currentFarmConfig = _optionalChain([farmApp, 'optionalAccess', _438 => _438.getConfig, 'call', _439 => _439()]);
4814
4954
  const normalizedFile = file.replace(/\\/g, "/");
4815
4955
  if (currentFarmConfig && /\/route\.(?:ts|tsx|js|jsx)$/.test(normalizedFile) && _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, currentFarmConfig).some(
4816
4956
  (appDir) => normalizedFile.startsWith(`${_chunkQMNWKQL4cjs.toPosixPath.call(void 0, appDir)}/api/`)
4817
4957
  )) {
4818
4958
  for (const mod of modules) server2.moduleGraph.invalidateModule(mod);
4819
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _436 => _436(`updated ${file}`)]);
4959
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _440 => _440(`updated ${file}`)]);
4820
4960
  server2.ws.send({ type: "full-reload", path: "*" });
4821
4961
  return [];
4822
4962
  }
@@ -4826,7 +4966,7 @@ if (import.meta.hot) {
4826
4966
  for (const mod of modules) {
4827
4967
  server2.moduleGraph.invalidateModule(mod);
4828
4968
  }
4829
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _437 => _437(`updated ${file}`)]);
4969
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _441 => _441(`updated ${file}`)]);
4830
4970
  server2.ws.send({
4831
4971
  type: "full-reload",
4832
4972
  path: "*"
@@ -4839,7 +4979,7 @@ if (import.meta.hot) {
4839
4979
  for (const mod of modules) {
4840
4980
  server2.moduleGraph.invalidateModule(mod);
4841
4981
  }
4842
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _438 => _438(`updated ${file}`)]);
4982
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _442 => _442(`updated ${file}`)]);
4843
4983
  server2.ws.send({
4844
4984
  type: "full-reload",
4845
4985
  path: "*"
@@ -4847,12 +4987,12 @@ if (import.meta.hot) {
4847
4987
  return [];
4848
4988
  }
4849
4989
  if (apiRouteManager && _chunkJYNNIGQOcjs.invalidateFarmDevDependents.call(void 0, server2, file, apiRouteManager.getSourceFiles()).length > 0) {
4850
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _439 => _439(`updated ${file}`)]);
4990
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _443 => _443(`updated ${file}`)]);
4851
4991
  }
4852
- const isolatedHydrationMode = _optionalChain([currentFarmConfig, 'optionalAccess', _440 => _440.experimental, 'optionalAccess', _441 => _441.isolatedClientHydration]);
4853
- const planRouteManager = _optionalChain([farmApp, 'optionalAccess', _442 => _442.getRouteManager, 'call', _443 => _443()]);
4992
+ const isolatedHydrationMode = _optionalChain([currentFarmConfig, 'optionalAccess', _444 => _444.experimental, 'optionalAccess', _445 => _445.isolatedClientHydration]);
4993
+ const planRouteManager = _optionalChain([farmApp, 'optionalAccess', _446 => _446.getRouteManager, 'call', _447 => _447()]);
4854
4994
  const isHydrationPlanSource = currentSrcRoot !== null && normalizedFile.startsWith(`${currentSrcRoot}/`) && /\.[cm]?[jt]sx?$/.test(normalizedFile);
4855
- const tracksAsyncOwnerIslands = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, _optionalChain([currentFarmConfig, 'optionalAccess', _444 => _444.renderer])) && planRouteManager !== void 0;
4995
+ const tracksAsyncOwnerIslands = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, _optionalChain([currentFarmConfig, 'optionalAccess', _448 => _448.renderer])) && planRouteManager !== void 0;
4856
4996
  let clientPlanCurrent = false;
4857
4997
  if (isHydrationPlanSource && (isolatedHydrationMode === "enabled" || isolatedHydrationMode === "analyze" || tracksAsyncOwnerIslands)) {
4858
4998
  const routeManager = planRouteManager;
@@ -4914,7 +5054,7 @@ if (import.meta.hot) {
4914
5054
  }
4915
5055
  return [];
4916
5056
  }
4917
- if (!clientPlanCurrent) _optionalChain([farmApp, 'optionalAccess', _445 => _445.getRouteManager, 'call', _446 => _446(), 'access', _447 => _447.invalidateClientManifest, 'call', _448 => _448()]);
5057
+ if (!clientPlanCurrent) _optionalChain([farmApp, 'optionalAccess', _449 => _449.getRouteManager, 'call', _450 => _450(), 'access', _451 => _451.invalidateClientManifest, 'call', _452 => _452()]);
4918
5058
  const manifestModule = server2.moduleGraph.getModuleById("/@farm/manifest");
4919
5059
  if (manifestModule) {
4920
5060
  server2.moduleGraph.invalidateModule(manifestModule);
@@ -4972,10 +5112,17 @@ if (import.meta.hot) {
4972
5112
  }
4973
5113
  function runFarmMiddlewareWithNavigation(renderer, middlewareRequest, req, res, execute) {
4974
5114
  return renderer.runWithRequestContext(middlewareRequest, async () => {
5115
+ const headersBeforeMiddleware = res.getHeaders();
4975
5116
  try {
4976
5117
  return await execute();
4977
5118
  } catch (error) {
4978
5119
  if (await renderer.respondToNavigationError(req, res, error)) return true;
5120
+ if (!res.headersSent) {
5121
+ for (const name of res.getHeaderNames()) res.removeHeader(name);
5122
+ for (const [name, value] of Object.entries(headersBeforeMiddleware)) {
5123
+ if (value !== void 0) res.setHeader(name, value);
5124
+ }
5125
+ }
4979
5126
  throw error;
4980
5127
  }
4981
5128
  });
@@ -5018,7 +5165,7 @@ function createPageDataMiddlewareResponse(res) {
5018
5165
  return (...args) => {
5019
5166
  if (captures(target.statusCode, target.getHeader("location"))) {
5020
5167
  const callback = args.find((arg) => typeof arg === "function");
5021
- _optionalChain([callback, 'optionalCall', _449 => _449()]);
5168
+ _optionalChain([callback, 'optionalCall', _453 => _453()]);
5022
5169
  return property === "write" ? true : response;
5023
5170
  }
5024
5171
  return target[property](...args);
@@ -5051,9 +5198,9 @@ function readWriteHeadLocation(headers) {
5051
5198
  }
5052
5199
  async function sendFarmPageDataRedirect(res, redirect, deploymentId) {
5053
5200
  for (const name of ["location", "content-length", "content-type"]) res.removeHeader(name);
5054
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
5201
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
5055
5202
  res,
5056
- _chunkI7J5RLGOcjs.withFarmDeploymentResponse.call(void 0, _chunkRWR7SMD7cjs.createFarmPageDataRedirectResponse.call(void 0, redirect), deploymentId)
5203
+ _chunkNLBHLPEOcjs.withFarmDeploymentResponse.call(void 0, _chunkRWR7SMD7cjs.createFarmPageDataRedirectResponse.call(void 0, redirect), deploymentId)
5057
5204
  );
5058
5205
  }
5059
5206
  function resolveDevelopmentRoot(farmRoot, viteRoot) {
@@ -5082,12 +5229,12 @@ function isFarmClientVirtualId(id) {
5082
5229
  }
5083
5230
  function isClientEnvironment(context, loadOptions) {
5084
5231
  const environment = context.environment;
5085
- if (_optionalChain([environment, 'optionalAccess', _450 => _450.config, 'optionalAccess', _451 => _451.consumer])) return environment.config.consumer === "client";
5086
- if (_optionalChain([environment, 'optionalAccess', _452 => _452.name])) return environment.name === "client";
5087
- return _optionalChain([loadOptions, 'optionalAccess', _453 => _453.ssr]) !== true;
5232
+ if (_optionalChain([environment, 'optionalAccess', _454 => _454.config, 'optionalAccess', _455 => _455.consumer])) return environment.config.consumer === "client";
5233
+ if (_optionalChain([environment, 'optionalAccess', _456 => _456.name])) return environment.name === "client";
5234
+ return _optionalChain([loadOptions, 'optionalAccess', _457 => _457.ssr]) !== true;
5088
5235
  }
5089
5236
  function invalidateProgrammaticClientRouteModules(server) {
5090
- const graph = _optionalChain([server, 'access', _454 => _454.environments, 'optionalAccess', _455 => _455.client, 'optionalAccess', _456 => _456.moduleGraph]);
5237
+ const graph = _optionalChain([server, 'access', _458 => _458.environments, 'optionalAccess', _459 => _459.client, 'optionalAccess', _460 => _460.moduleGraph]);
5091
5238
  if (!graph) return;
5092
5239
  for (const [id, module] of graph.idToModuleMap) {
5093
5240
  if (_chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, id)) graph.invalidateModule(module);
@@ -5097,19 +5244,19 @@ function generateProgrammaticClientRouteModuleForId(moduleId, root, renderer, cl
5097
5244
  const parsed = _chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, moduleId);
5098
5245
  const routesFile = resolveRealModuleFile(parsed.filePath, root);
5099
5246
  watchFile(routesFile);
5100
- return _chunkMZ4CRSY7cjs.generateProgrammaticClientRouteModule.call(void 0, {
5247
+ return _chunkIEN2EFE5cjs.generateProgrammaticClientRouteModule.call(void 0, {
5101
5248
  kind: parsed.kind,
5102
5249
  routePath: parsed.routePath,
5103
5250
  routesFile,
5104
- route: parsed.kind === "api" ? void 0 : _optionalChain([clientRoutes, 'optionalAccess', _457 => _457.routes, 'access', _458 => _458.get, 'call', _459 => _459(
5105
- _chunkMZ4CRSY7cjs.programmaticClientRouteKey.call(void 0, routesFile, parsed.kind, parsed.routePath)
5251
+ route: parsed.kind === "api" ? void 0 : _optionalChain([clientRoutes, 'optionalAccess', _461 => _461.routes, 'access', _462 => _462.get, 'call', _463 => _463(
5252
+ _chunkIEN2EFE5cjs.programmaticClientRouteKey.call(void 0, routesFile, parsed.kind, parsed.routePath)
5106
5253
  )]),
5107
5254
  rendererServer: renderer.server,
5108
5255
  toImportSpecifier: (file) => toProgrammaticRouteImportSpecifier(file, root)
5109
5256
  });
5110
5257
  }
5111
5258
  function resolveRealModuleFile(filePath, root) {
5112
- const resolved = _nullishCoalesce(_chunkMZ4CRSY7cjs.resolveModuleSourcePath.call(void 0, filePath, root), () => ( filePath));
5259
+ const resolved = _nullishCoalesce(_chunkIEN2EFE5cjs.resolveModuleSourcePath.call(void 0, filePath, root), () => ( filePath));
5113
5260
  try {
5114
5261
  return _chunkQMNWKQL4cjs.toPosixPath.call(void 0, fs2.realpathSync(resolved));
5115
5262
  } catch (e28) {
@@ -5423,12 +5570,12 @@ async function parseRouteModuleProps(routeModule, input) {
5423
5570
  }
5424
5571
  const schemas = routeModule.__farmRouteSchemas;
5425
5572
  const params = parseRouteModuleSchema(
5426
- _optionalChain([schemas, 'optionalAccess', _460 => _460.params]),
5573
+ _optionalChain([schemas, 'optionalAccess', _464 => _464.params]),
5427
5574
  input.props.params,
5428
5575
  "params",
5429
5576
  input.routePath
5430
5577
  );
5431
- const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _461 => _461.search]), input.search, "search", input.routePath);
5578
+ const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _465 => _465.search]), input.search, "search", input.routePath);
5432
5579
  return {
5433
5580
  ...input.props,
5434
5581
  params,
@@ -5448,12 +5595,12 @@ function parseRouteModuleSchema(schema, value, label, routePath) {
5448
5595
  }
5449
5596
  }
5450
5597
  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) {
5451
- const providerClientCode = _chunkF36LS2C7cjs.generateFarmIntegrationProviderClientCode.call(void 0,
5598
+ const providerClientCode = _chunkM6U6E4F7cjs.generateFarmIntegrationProviderClientCode.call(void 0,
5452
5599
  integrationProviders,
5453
5600
  root,
5454
5601
  _nullishCoalesce(renderer.componentExtensions, () => ( []))
5455
5602
  );
5456
- const clientPluginEntry = _chunkJSOCDYERcjs.generateFarmClientPluginEntryCode.call(void 0,
5603
+ const clientPluginEntry = _chunkDMXMIE2Ccjs.generateFarmClientPluginEntryCode.call(void 0,
5457
5604
  plugins,
5458
5605
  root,
5459
5606
  srcDir,
@@ -5501,7 +5648,7 @@ async function createFarmServerTreePageElement(source, pathname) {
5501
5648
  return null;
5502
5649
  }
5503
5650
  }
5504
- ${islandValues ? `${_chunkF36LS2C7cjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
5651
+ ${islandValues ? `${_chunkM6U6E4F7cjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
5505
5652
  let farmLastRouteState = null;
5506
5653
 
5507
5654
  // A hot update to a layout tree's client module renders the route again.
@@ -6312,7 +6459,7 @@ async function loadLayoutComponents(layouts = [], params = {}, source) {
6312
6459
  return loadedLayouts;
6313
6460
  }
6314
6461
 
6315
- ${_chunkF36LS2C7cjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
6462
+ ${_chunkM6U6E4F7cjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
6316
6463
  function wrapWithLoadedLayouts(element, loadedLayouts, params) {
6317
6464
  let wrapped = element;
6318
6465
  for (let index = loadedLayouts.length - 1; index >= 0; index--) {
@@ -6597,7 +6744,7 @@ function readActiveLayoutPatterns() {
6597
6744
  .filter(Boolean);
6598
6745
  }
6599
6746
 
6600
- ${_chunkF36LS2C7cjs.FARM_NAVIGATION_SCRIPT_SOURCE}
6747
+ ${_chunkM6U6E4F7cjs.FARM_NAVIGATION_SCRIPT_SOURCE}
6601
6748
 
6602
6749
  function activateFragmentScripts(root) {
6603
6750
  for (const script of Array.from(root.querySelectorAll?.('script') || [])) {
@@ -6656,7 +6803,7 @@ function getLayoutShell(root, patterns, index, find) {
6656
6803
  return shell.innerHTML;
6657
6804
  }
6658
6805
 
6659
- ${islandValues ? _chunkF36LS2C7cjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceNavigationBoundary(
6806
+ ${islandValues ? _chunkM6U6E4F7cjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceNavigationBoundary(
6660
6807
  container,
6661
6808
  fragment,
6662
6809
  currentPatterns,
@@ -6729,7 +6876,7 @@ ${islandValues ? `
6729
6876
  return nextTarget;
6730
6877
  }
6731
6878
 
6732
- ${islandValues ? `${_chunkF36LS2C7cjs.FARM_NAVIGATION_STREAM_READER_SOURCE}
6879
+ ${islandValues ? `${_chunkM6U6E4F7cjs.FARM_NAVIGATION_STREAM_READER_SOURCE}
6733
6880
 
6734
6881
  // Islands mode navigates as the production client does: it fetches the page itself, names the
6735
6882
  // layouts it shows by key (F-Layouts), and asks for flush markers (F-Stream), so the shell arrives
@@ -7424,9 +7571,9 @@ function generateClientManifest(bundle) {
7424
7571
  return manifest;
7425
7572
  }
7426
7573
  async function defineConfig(config = {}) {
7427
- const tailwindVitePlugin = await _chunkJSOCDYERcjs.loadTailwindVitePlugin.call(void 0, );
7574
+ const tailwindVitePlugin = await _chunkDMXMIE2Ccjs.loadTailwindVitePlugin.call(void 0, );
7428
7575
  const appRoot = path6.resolve(config.root || process.cwd());
7429
- if (_optionalChain([config, 'access', _462 => _462.extends, 'optionalAccess', _463 => _463.length])) {
7576
+ if (_optionalChain([config, 'access', _466 => _466.extends, 'optionalAccess', _467 => _467.length])) {
7430
7577
  const { config: layeredConfig } = await import("./layers-7P4RLKVX.cjs").then(
7431
7578
  ({ resolveFarmLayers }) => resolveFarmLayers(config, {
7432
7579
  root: appRoot,
@@ -7436,11 +7583,11 @@ async function defineConfig(config = {}) {
7436
7583
  config = layeredConfig;
7437
7584
  }
7438
7585
  config.renderer = _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, config.renderer);
7439
- config.images = _chunkF36LS2C7cjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, { root: appRoot, dev: true });
7586
+ config.images = _chunkM6U6E4F7cjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, { root: appRoot, dev: true });
7440
7587
  const rendererVitePlugins = await _chunk67MZTLTFcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, appRoot, {
7441
7588
  ssr: true
7442
7589
  });
7443
- const reactRefreshPlugins = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) ? await _chunk65Y5SIBHcjs.createFarmReactRefreshPlugins.call(void 0, ) : [];
7590
+ const reactRefreshPlugins = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) ? await _chunk3QM74STYcjs.createFarmReactRefreshPlugins.call(void 0, ) : [];
7444
7591
  const nodeBuiltinStubs = {
7445
7592
  "node:string_decoder": "data:text/javascript,export class StringDecoder { write(buf) { return ''; } end() { return ''; } }; export default StringDecoder;",
7446
7593
  "node:buffer": "data:text/javascript,export const Buffer = { from: () => ({}), alloc: () => ({}), isBuffer: () => false }; export default { Buffer };",
@@ -7528,13 +7675,13 @@ async function defineConfig(config = {}) {
7528
7675
  if (!serverStarted) {
7529
7676
  serverStarted = true;
7530
7677
  const elapsed = Date.now() - startTime;
7531
- const address = _optionalChain([server, 'access', _464 => _464.httpServer, 'optionalAccess', _465 => _465.address, 'call', _466 => _466()]);
7678
+ const address = _optionalChain([server, 'access', _468 => _468.httpServer, 'optionalAccess', _469 => _469.address, 'call', _470 => _470()]);
7532
7679
  const resolvedPort = typeof address === "object" && address ? address.port : server.config.server.port || port || 3e3;
7533
7680
  const hostConfig = server.config.server.host;
7534
7681
  const isExposed = hostConfig === true || hostConfig === "0.0.0.0";
7535
7682
  console.log("");
7536
7683
  console.log(
7537
- ` ${pc.bold(pc.green("Farm.js"))} ${pc.dim(`v${_chunkSQ6IWJ3Hcjs.FARM_VERSION}`)} ${pc.dim(`ready in ${elapsed}ms`)}`
7684
+ ` ${pc.bold(pc.green("Farm.js"))} ${pc.dim(`v${_chunkMZLJFNMHcjs.FARM_VERSION}`)} ${pc.dim(`ready in ${elapsed}ms`)}`
7538
7685
  );
7539
7686
  console.log("");
7540
7687
  console.log(
@@ -7567,8 +7714,8 @@ async function defineConfig(config = {}) {
7567
7714
  return {
7568
7715
  plugins: [
7569
7716
  // `farm dev --desktop`: only the desktop window gets an answer, as in the packaged app.
7570
- _chunk65Y5SIBHcjs.farmDesktopDevGuardPlugin.call(void 0, config.basePath),
7571
- _chunkF36LS2C7cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
7717
+ _chunk3QM74STYcjs.farmDesktopDevGuardPlugin.call(void 0, config.basePath),
7718
+ _chunkM6U6E4F7cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
7572
7719
  tailwindVitePlugin,
7573
7720
  ...rendererVitePlugins,
7574
7721
  ...reactRefreshPlugins,
@@ -7576,14 +7723,14 @@ async function defineConfig(config = {}) {
7576
7723
  farmI18nClientBridgePlugin(),
7577
7724
  farmServerOnlyEntriesPlugin(),
7578
7725
  farmPlugin(config),
7579
- _chunkMZ4CRSY7cjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
7726
+ _chunkIEN2EFE5cjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
7580
7727
  farmBrandingPlugin
7581
7728
  ],
7582
7729
  customLogger: farmLogger,
7583
7730
  clearScreen: false,
7584
7731
  optimizeDeps: {
7585
- ..._chunkF36LS2C7cjs.createFarmClientOptimizeDepsConfig.call(void 0,
7586
- _chunkF36LS2C7cjs.createFarmClientOptimizeDepsEntries.call(void 0,
7732
+ ..._chunkM6U6E4F7cjs.createFarmClientOptimizeDepsConfig.call(void 0,
7733
+ _chunkM6U6E4F7cjs.createFarmClientOptimizeDepsEntries.call(void 0,
7587
7734
  appRoot,
7588
7735
  _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, { ...config, root: appRoot })
7589
7736
  ),
@@ -7626,7 +7773,7 @@ async function defineConfig(config = {}) {
7626
7773
  // Stub out problematic server-only modules during dev mode
7627
7774
  alias: {
7628
7775
  ..._chunkMTBDJ326cjs.getFarmLayerAliases.call(void 0, config.layers),
7629
- ..._chunkF36LS2C7cjs.createFarmSourceAlias.call(void 0, appRoot, config.srcDir),
7776
+ ..._chunkM6U6E4F7cjs.createFarmSourceAlias.call(void 0, appRoot, config.srcDir),
7630
7777
  // Nitro internals that should not be resolved in browser
7631
7778
  "supports-color": "data:text/javascript,export default false; export const supportsColor = false; export const stdout = false; export const stderr = false;",
7632
7779
  "@poppinss/dumper": "data:text/javascript,export default {};",
@@ -7655,4 +7802,6 @@ async function defineConfig(config = {}) {
7655
7802
 
7656
7803
 
7657
7804
 
7658
- exports.farmImageImportsPlugin = farmImageImportsPlugin; exports.farmI18nClientBridgePlugin = farmI18nClientBridgePlugin; exports.farmServerOnlyEntriesPlugin = farmServerOnlyEntriesPlugin; exports.withFarmRequestTracing = withFarmRequestTracing; exports.rewriteEarlySsrRelativeImports = rewriteEarlySsrRelativeImports; exports.transformIsolatedClientBoundaryModule = transformIsolatedClientBoundaryModule; exports.shouldEmitFarmClientRootHmr = shouldEmitFarmClientRootHmr; exports.farmPlugin = farmPlugin; exports.defineConfig = defineConfig;
7805
+
7806
+
7807
+ exports.isViteModuleRequest = isViteModuleRequest; exports.isViteDevClientRequest = isViteDevClientRequest; exports.farmImageImportsPlugin = farmImageImportsPlugin; exports.farmI18nClientBridgePlugin = farmI18nClientBridgePlugin; exports.farmServerOnlyEntriesPlugin = farmServerOnlyEntriesPlugin; exports.withFarmRequestTracing = withFarmRequestTracing; exports.rewriteEarlySsrRelativeImports = rewriteEarlySsrRelativeImports; exports.transformIsolatedClientBoundaryModule = transformIsolatedClientBoundaryModule; exports.shouldEmitFarmClientRootHmr = shouldEmitFarmClientRootHmr; exports.farmPlugin = farmPlugin; exports.defineConfig = defineConfig;