@farm.js/core 0.1.69 → 0.1.71

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 (314) hide show
  1. package/dist/{agent-mcp-handler-FER4MQDF.cjs → agent-mcp-handler-KE4J3W7S.cjs} +8 -5
  2. package/dist/{agent-mcp-handler-AZ7QW4UP.mjs → agent-mcp-handler-VIT4GOSR.mjs} +7 -4
  3. package/dist/{agent-mcp.d-DOfBMEzP.d.mts → agent-mcp.d-BzNw6JI8.d.ts} +24 -5
  4. package/dist/{agent-mcp.d-DnIgriX1.d.ts → agent-mcp.d-CgFen3EH.d.mts} +24 -5
  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-LPIVRSTJ.cjs +16 -0
  10. package/dist/{analyzer-NAL5TJUP.mjs → analyzer-VK3BAOFI.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 -7
  21. package/dist/api.d.ts +8 -7
  22. package/dist/api.mjs +5 -5
  23. package/dist/{app-manifest.d-CaAcaukR.d.ts → app-manifest.d-DY4JfJxi.d.ts} +1 -1
  24. package/dist/{app-manifest.d-_BVbI0xp.d.mts → app-manifest.d-DpDK_B1k.d.mts} +1 -1
  25. package/dist/app-markdown.cjs +7 -4
  26. package/dist/app-markdown.d.mts +5 -4
  27. package/dist/app-markdown.d.ts +5 -4
  28. package/dist/app-markdown.mjs +6 -3
  29. package/dist/{app.d-BWeDqOaF.d.ts → app.d-BeK6bb1c.d.ts} +22 -10
  30. package/dist/{app.d-CaPwtytN.d.mts → app.d-D-5UNrFd.d.mts} +22 -10
  31. package/dist/{base-path.d-CTDVF0Fc.d.mts → base-path.d-BJ3SYpB8.d.mts} +6 -1
  32. package/dist/{base-path.d-CTDVF0Fc.d.ts → base-path.d-BJ3SYpB8.d.ts} +6 -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-5TOWKGV3.mjs → chunk-2CQC5CMD.mjs} +1 -1
  36. package/dist/{chunk-VO65MYJD.cjs → chunk-2IFT2CSA.cjs} +4 -4
  37. package/dist/{chunk-UPOYKX4S.cjs → chunk-2MR4MABG.cjs} +4 -4
  38. package/dist/chunk-2RCCFB2Y.cjs +129 -0
  39. package/dist/{chunk-K6VFYFOY.cjs → chunk-2W4GNXGX.cjs} +2 -2
  40. package/dist/{chunk-CV6MFQ4Y.mjs → chunk-3AUINHFG.mjs} +1 -1
  41. package/dist/{chunk-TKYOJ5G2.cjs → chunk-3BQ7QHUH.cjs} +5 -5
  42. package/dist/{chunk-MMDKYJ5V.cjs → chunk-3GNVIYPO.cjs} +7 -7
  43. package/dist/{chunk-65Y5SIBH.cjs → chunk-3QM74STY.cjs} +1 -1
  44. package/dist/{chunk-FJMC24KG.cjs → chunk-42KMUIWZ.cjs} +0 -3
  45. package/dist/{chunk-YVPX5PI5.mjs → chunk-4O26BPUY.mjs} +8 -0
  46. package/dist/{chunk-PDQ6EGPK.mjs → chunk-4OD2LXF2.mjs} +2 -2
  47. package/dist/{chunk-LENKRGBV.mjs → chunk-5CFHQ7HM.mjs} +1 -1
  48. package/dist/{chunk-3Y52TWYU.mjs → chunk-62ZRA7XU.mjs} +0 -3
  49. package/dist/{chunk-K76CBYQM.mjs → chunk-7A3URI2F.mjs} +20 -0
  50. package/dist/{chunk-UHU4QALN.mjs → chunk-7BUE2GM6.mjs} +294 -164
  51. package/dist/{chunk-L6NWQ3DR.cjs → chunk-7OHJWFLB.cjs} +600 -469
  52. package/dist/{chunk-VX2HZGC7.cjs → chunk-ACGBXN3U.cjs} +2 -2
  53. package/dist/{chunk-MV7NWU23.mjs → chunk-AYVGD3PK.mjs} +1 -1
  54. package/dist/{chunk-FT6KJHS3.cjs → chunk-C2JOS77Z.cjs} +4 -1
  55. package/dist/{chunk-CRVSYDHV.mjs → chunk-CKQAQFF6.mjs} +2 -2
  56. package/dist/{chunk-QOGIZKSO.cjs → chunk-CSQPMV3Q.cjs} +21 -11
  57. package/dist/chunk-DC2AXGNZ.mjs +129 -0
  58. package/dist/{chunk-Q4HH5Q6A.cjs → chunk-DMXMIE2C.cjs} +2 -2
  59. package/dist/{chunk-MAGFDK4Q.mjs → chunk-DPIGYXSV.mjs} +1 -1
  60. package/dist/{chunk-GUMKIQJL.cjs → chunk-DPYBVVL3.cjs} +2 -2
  61. package/dist/{chunk-23VJEGKC.cjs → chunk-DVJM55D2.cjs} +9 -1
  62. package/dist/{chunk-QSUYB3RH.cjs → chunk-DZHTNSQ5.cjs} +14 -14
  63. package/dist/{chunk-OIOPQ25L.mjs → chunk-E77IA5IF.mjs} +46 -33
  64. package/dist/{chunk-EZTKXD6P.cjs → chunk-FDGYDQGL.cjs} +8 -1
  65. package/dist/{chunk-PLJKJJ2H.mjs → chunk-FETMUBIA.mjs} +27 -82
  66. package/dist/{chunk-HJZZSBVK.cjs → chunk-FILXOEWD.cjs} +2 -2
  67. package/dist/{chunk-PDFFYZAT.cjs → chunk-GF22VGMS.cjs} +2 -2
  68. package/dist/{chunk-IYLZZTP6.mjs → chunk-GUU3IZSM.mjs} +167 -77
  69. package/dist/{chunk-OOJBBHYW.cjs → chunk-GVYZCJZH.cjs} +30 -1
  70. package/dist/{chunk-YOHHL2UE.mjs → chunk-I4KPA2C6.mjs} +1 -1
  71. package/dist/{chunk-PEYDQMSA.mjs → chunk-IGXS54GC.mjs} +6 -6
  72. package/dist/{chunk-NVOMQLI2.mjs → chunk-IWJONXPF.mjs} +11 -0
  73. package/dist/{chunk-SZORL7EW.mjs → chunk-IYDJNCR7.mjs} +6 -6
  74. package/dist/{chunk-HEJM46HQ.mjs → chunk-J5ASGNKF.mjs} +28 -2
  75. package/dist/{chunk-RLH5AH2M.mjs → chunk-JDO346NV.mjs} +1 -1
  76. package/dist/{chunk-K6SXMVXO.mjs → chunk-JMFTKNBA.mjs} +22 -7
  77. package/dist/{chunk-YIHRZBD7.cjs → chunk-JRGR5Z4K.cjs} +1 -1
  78. package/dist/{chunk-4W4ZWSV2.cjs → chunk-JVA4PIYN.cjs} +604 -434
  79. package/dist/{chunk-UKZ6AWKZ.cjs → chunk-JWY66PID.cjs} +44 -1
  80. package/dist/{chunk-BDYM2TN3.cjs → chunk-JX5VOLAV.cjs} +8 -8
  81. package/dist/{chunk-WMLSZAKN.mjs → chunk-JZQS3ZOI.mjs} +1 -1
  82. package/dist/{chunk-OFBLGH6V.cjs → chunk-K66JILV3.cjs} +47 -34
  83. package/dist/{chunk-6GQJVY4E.cjs → chunk-KEB7AGS6.cjs} +17 -17
  84. package/dist/{chunk-IFR74W6S.mjs → chunk-KPJYBSHL.mjs} +4 -1
  85. package/dist/{chunk-TEJ67GD2.mjs → chunk-KQAB5LML.mjs} +28 -6
  86. package/dist/{chunk-DHR2WDSL.cjs → chunk-KWST2O22.cjs} +387 -297
  87. package/dist/{chunk-3EEINK7G.cjs → chunk-L6E4SHUB.cjs} +41 -15
  88. package/dist/{chunk-KI3MU7B5.mjs → chunk-LDVJIBGN.mjs} +1 -1
  89. package/dist/{chunk-5FBZJJGA.mjs → chunk-LXEJNWF5.mjs} +2 -2
  90. package/dist/{chunk-AKIQ54FK.cjs → chunk-MBCRWU3P.cjs} +26 -81
  91. package/dist/{chunk-22LGTSBA.cjs → chunk-MEJCP2LX.cjs} +1 -1
  92. package/dist/{chunk-ZR2QB45W.mjs → chunk-MITIAOUQ.mjs} +4 -4
  93. package/dist/{chunk-OCNV4CI2.cjs → chunk-MQ4DYVFS.cjs} +26 -0
  94. package/dist/{chunk-P2NBQ5JI.mjs → chunk-MWUDEYBI.mjs} +1 -1
  95. package/dist/{chunk-LR4KP3I7.cjs → chunk-N3XO5AL5.cjs} +2 -2
  96. package/dist/{chunk-ZPKJPM7K.mjs → chunk-NA77GEIU.mjs} +2 -2
  97. package/dist/{chunk-FVYBEMOD.cjs → chunk-NAXKOTPP.cjs} +6 -6
  98. package/dist/{chunk-I7J5RLGO.cjs → chunk-NLBHLPEO.cjs} +12 -1
  99. package/dist/{chunk-R2ZHU37O.mjs → chunk-NLRAQXAA.mjs} +26 -0
  100. package/dist/{chunk-QO43L7Z4.cjs → chunk-O32QPFVV.cjs} +25 -7
  101. package/dist/{chunk-CO6UYM2D.mjs → chunk-O5QUJEWT.mjs} +1 -1
  102. package/dist/{chunk-JL2YW5KX.mjs → chunk-OAEDVXVE.mjs} +44 -1
  103. package/dist/{chunk-F6YLXK5L.cjs → chunk-PLXD2MJV.cjs} +19 -19
  104. package/dist/{chunk-JFPKARWM.cjs → chunk-PMU4U2W2.cjs} +1 -0
  105. package/dist/{chunk-GTQOEEE7.cjs → chunk-Q5HMVGR5.cjs} +13 -13
  106. package/dist/{chunk-ZYCEEE3V.mjs → chunk-QUFENL7Q.mjs} +2 -2
  107. package/dist/{chunk-QOSDWGKT.mjs → chunk-QVBXTSIZ.mjs} +1 -1
  108. package/dist/{chunk-OGVTUGMU.mjs → chunk-REP6HWJN.mjs} +13 -3
  109. package/dist/{chunk-ANMIR6US.mjs → chunk-RJUCNO7R.mjs} +1 -1
  110. package/dist/{chunk-WYL4ODZ4.mjs → chunk-SE7HPBYK.mjs} +30 -1
  111. package/dist/{chunk-GQ6QOH7T.cjs → chunk-SXMWVP2L.cjs} +12 -12
  112. package/dist/{chunk-D5F7RPZP.mjs → chunk-THG2TVDH.mjs} +3 -3
  113. package/dist/{chunk-X3MHKLCO.cjs → chunk-TP4RAV7Y.cjs} +25 -10
  114. package/dist/{chunk-DWLNLU55.cjs → chunk-TPYAYFMF.cjs} +2 -2
  115. package/dist/{chunk-Y6KHPJDB.cjs → chunk-U7VH3Q5E.cjs} +2 -2
  116. package/dist/{chunk-4JRAMCUP.cjs → chunk-UISZLYKY.cjs} +22 -22
  117. package/dist/{chunk-CKCKCUYO.mjs → chunk-UQUOSNRN.mjs} +511 -341
  118. package/dist/{chunk-2P7UYHZP.mjs → chunk-V25GSH43.mjs} +1 -1
  119. package/dist/{chunk-437QZIC2.cjs → chunk-VNBDN5W2.cjs} +5 -5
  120. package/dist/{chunk-ABIBASLJ.cjs → chunk-VXB5CMNC.cjs} +2 -2
  121. package/dist/{chunk-G7NBPP7H.mjs → chunk-W2T6NDNP.mjs} +11 -1
  122. package/dist/{chunk-AJNBTOVQ.mjs → chunk-WW3LRNQV.mjs} +1 -1
  123. package/dist/{chunk-GFPS7MNE.mjs → chunk-WX63N6C5.mjs} +4 -4
  124. package/dist/{chunk-ULMXZYOA.mjs → chunk-X7LGLF33.mjs} +1 -1
  125. package/dist/{chunk-VOQ7XZZT.cjs → chunk-Y2SZVIVH.cjs} +20 -0
  126. package/dist/{chunk-XCAQTCGK.mjs → chunk-YBY34UHB.mjs} +1 -1
  127. package/dist/{chunk-5NFQ6AZI.cjs → chunk-YCNHUIPR.cjs} +33 -11
  128. package/dist/{chunk-YGJ5P3TJ.mjs → chunk-Z3GPAFIA.mjs} +21 -3
  129. package/dist/{chunk-PJQ5W356.mjs → chunk-Z5ZZAGIH.mjs} +1 -0
  130. package/dist/{chunk-L5OZN6YW.cjs → chunk-ZPUAOKHV.cjs} +3 -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-CnEeVvGG.d.mts → client-component.d-DwpH251K.d.mts} +2 -2
  134. package/dist/{client-component.d-CfJxuXZl.d.ts → client-component.d-fYupugbZ.d.ts} +2 -2
  135. package/dist/{client-plugins.d-D7dHV1Nf.d.ts → client-plugins.d-BxqFfHpM.d.ts} +39 -3
  136. package/dist/{client-plugins.d-Do5ULA0x.d.mts → client-plugins.d-k3bOT5gz.d.mts} +39 -3
  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-BP4EBTKQ.mjs → devtools-6MXPFPNJ.mjs} +9 -8
  154. package/dist/{devtools-7HNDS4SY.cjs → devtools-O5625KCK.cjs} +10 -9
  155. package/dist/docs.cjs +13 -12
  156. package/dist/docs.d.mts +4 -3
  157. package/dist/docs.d.ts +4 -3
  158. package/dist/docs.mjs +12 -11
  159. package/dist/environment/vite.cjs +3 -3
  160. package/dist/environment/vite.mjs +2 -2
  161. package/dist/headers.d-DalIGbVO.d.ts +18 -0
  162. package/dist/headers.d-sNT7ZQiU.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/index.cjs +50 -45
  176. package/dist/{index.d-CVFk37uX.d.ts → index.d-BcA-secm.d.ts} +1 -1
  177. package/dist/{index.d-B1MpEJAo.d.mts → index.d-DDHHAv7j.d.mts} +1 -1
  178. package/dist/index.d.mts +26 -24
  179. package/dist/index.d.ts +26 -24
  180. package/dist/index.mjs +63 -58
  181. package/dist/integrations/orm.d.mts +3 -2
  182. package/dist/integrations/orm.d.ts +3 -2
  183. package/dist/integrations.cjs +3 -3
  184. package/dist/integrations.d.mts +3 -2
  185. package/dist/integrations.d.ts +3 -2
  186. package/dist/integrations.mjs +2 -2
  187. package/dist/internal/app-markdown-runtime.cjs +6 -3
  188. package/dist/internal/app-markdown-runtime.d.mts +13 -4
  189. package/dist/internal/app-markdown-runtime.d.ts +13 -4
  190. package/dist/internal/app-markdown-runtime.mjs +5 -2
  191. package/dist/internal/build-runtime.cjs +37 -37
  192. package/dist/internal/build-runtime.d.mts +5 -4
  193. package/dist/internal/build-runtime.d.ts +5 -4
  194. package/dist/internal/build-runtime.mjs +36 -36
  195. package/dist/internal/cli-runtime.cjs +18 -15
  196. package/dist/internal/cli-runtime.mjs +17 -14
  197. package/dist/internal/client-error-overlay.cjs +4 -4
  198. package/dist/internal/client-error-overlay.mjs +1 -1
  199. package/dist/internal/client-runtime.cjs +5 -3
  200. package/dist/internal/client-runtime.d.mts +17 -7
  201. package/dist/internal/client-runtime.d.ts +17 -7
  202. package/dist/internal/client-runtime.mjs +4 -2
  203. package/dist/internal/compression-runtime.d.mts +3 -2
  204. package/dist/internal/compression-runtime.d.ts +3 -2
  205. package/dist/internal/config-runtime.cjs +11 -10
  206. package/dist/internal/config-runtime.d.mts +6 -5
  207. package/dist/internal/config-runtime.d.ts +6 -5
  208. package/dist/internal/config-runtime.mjs +10 -9
  209. package/dist/internal/infra-analytics-runtime.cjs +12 -9
  210. package/dist/internal/infra-analytics-runtime.mjs +10 -7
  211. package/dist/internal/native-server-fns.cjs +4 -4
  212. package/dist/internal/native-server-fns.mjs +3 -3
  213. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  214. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  215. package/dist/internal/production-runtime.cjs +48 -17
  216. package/dist/internal/production-runtime.d.mts +53 -18
  217. package/dist/internal/production-runtime.d.ts +53 -18
  218. package/dist/internal/production-runtime.mjs +50 -19
  219. package/dist/internal/vercel-edge-middleware.cjs +3 -2
  220. package/dist/internal/vercel-edge-middleware.d.mts +2 -2
  221. package/dist/internal/vercel-edge-middleware.d.ts +2 -2
  222. package/dist/internal/vercel-edge-middleware.mjs +2 -1
  223. package/dist/markdown.cjs +3 -2
  224. package/dist/markdown.d.mts +3 -2
  225. package/dist/markdown.d.ts +3 -2
  226. package/dist/markdown.mjs +2 -1
  227. package/dist/middleware.cjs +6 -5
  228. package/dist/middleware.d.mts +4 -3
  229. package/dist/middleware.d.ts +4 -3
  230. package/dist/middleware.mjs +5 -4
  231. package/dist/mobile.d.mts +3 -3
  232. package/dist/mobile.d.ts +3 -3
  233. package/dist/{mount.d-CBqr-LfI.d.mts → mount.d-C1PONsEe.d.mts} +1 -1
  234. package/dist/{mount.d-CGzN61Kq.d.ts → mount.d-D3JOux2V.d.ts} +1 -1
  235. package/dist/{native-tree-W2SSJB3Y.cjs → native-tree-GF4BH33L.cjs} +4 -3
  236. package/dist/{native-tree-Y5YQANW7.mjs → native-tree-L2IIEBXH.mjs} +3 -2
  237. package/dist/{navigation-delegate.d-BwCOhpj7.d.mts → navigation-delegate.d-CJQQHboA.d.mts} +1 -1
  238. package/dist/{navigation-delegate.d-CLH2dXjy.d.ts → navigation-delegate.d-CQQPbdkE.d.ts} +1 -1
  239. package/dist/navigation.cjs +5 -5
  240. package/dist/navigation.d.mts +6 -5
  241. package/dist/navigation.d.ts +6 -5
  242. package/dist/navigation.mjs +4 -4
  243. package/dist/{nitro-Y3LGITW3.cjs → nitro-2LMOMIST.cjs} +2 -2
  244. package/dist/{nitro-NSTXT7LB.mjs → nitro-72TFIGGO.mjs} +1 -1
  245. package/dist/{plugin-F2O4BFTK.cjs → plugin-5PIQQVRP.cjs} +2 -2
  246. package/dist/{plugin-VEBRN7A3.mjs → plugin-QZT747YW.mjs} +1 -1
  247. package/dist/plugin.cjs +30 -29
  248. package/dist/plugin.d.mts +6 -4
  249. package/dist/plugin.d.ts +6 -4
  250. package/dist/plugin.mjs +29 -28
  251. package/dist/{production-runtime.d-DMZY3OgV.d.mts → production-runtime.d-B0IeWWyO.d.mts} +23 -2
  252. package/dist/{production-runtime.d-BMyyLGBB.d.ts → production-runtime.d-q3aHIv5Y.d.ts} +23 -2
  253. package/dist/query/client.cjs +6 -6
  254. package/dist/query/client.mjs +2 -2
  255. package/dist/{render-plan.d-CzGDjcT0.d.mts → render-plan.d-CiUj0rq5.d.mts} +1 -1
  256. package/dist/{render-plan.d-W6LmjD6y.d.ts → render-plan.d-DHuJMJRP.d.ts} +1 -1
  257. package/dist/renderer-client.cjs +7 -7
  258. package/dist/renderer-client.d.mts +6 -5
  259. package/dist/renderer-client.d.ts +6 -5
  260. package/dist/renderer-client.mjs +3 -3
  261. package/dist/{request.d-CgNVderU.d.mts → request.d-D-F7o7tb.d.mts} +1 -1
  262. package/dist/{request.d-CTVRZiQv.d.ts → request.d-DRUbOmYD.d.ts} +1 -1
  263. package/dist/request.d.mts +4 -3
  264. package/dist/request.d.ts +4 -3
  265. package/dist/{resolver.d-JnZKKsc5.d.mts → resolver.d-9iKC79CU.d.mts} +1 -1
  266. package/dist/{resolver.d-BHyZgpa7.d.ts → resolver.d-CY6mEa_F.d.ts} +1 -1
  267. package/dist/response.d-B_MtBCnF.d.mts +12 -0
  268. package/dist/response.d-B_MtBCnF.d.ts +12 -0
  269. package/dist/{route-rendering.d-D0bmZVJA.d.mts → route-rendering.d-6smgwT2t.d.mts} +9 -2
  270. package/dist/{route-rendering.d-FDSNtCMg.d.ts → route-rendering.d-KwqM_mlK.d.ts} +9 -2
  271. package/dist/{router.d-DZ3ldniI.d.ts → router.d-B6sesMRD.d.ts} +1 -1
  272. package/dist/{router.d-GRKm_uAV.d.mts → router.d-BYmDeDlp.d.mts} +1 -1
  273. package/dist/{routes.d-CrEy0lJS.d.mts → routes.d-D3aJw1H5.d.mts} +1 -1
  274. package/dist/{routes.d-9GFFNioh.d.ts → routes.d-K-Qg79AA.d.ts} +1 -1
  275. package/dist/routes.d.mts +3 -2
  276. package/dist/routes.d.ts +3 -2
  277. package/dist/{index.d-BNNDpql4.d.ts → routing.d-BxOZ2YWc.d.ts} +1 -2
  278. package/dist/{index.d-BqcfqJvt.d.mts → routing.d-DwSUVZbF.d.mts} +1 -2
  279. package/dist/{rsc-pipeline-J4KKBSCH.cjs → rsc-pipeline-P4PCWDO2.cjs} +14 -13
  280. package/dist/{rsc-pipeline-PJZOVYSY.mjs → rsc-pipeline-R2GOKIMU.mjs} +13 -12
  281. package/dist/{runtime-QDBSE4H6.mjs → runtime-DP5DYGW5.mjs} +12 -11
  282. package/dist/{runtime-OLEO5NXF.cjs → runtime-WA2Q4SLG.cjs} +20 -19
  283. package/dist/{runtime.d-DqXihlxm.d.mts → runtime.d-BFSJf-ww.d.mts} +1 -1
  284. package/dist/{runtime.d-BtL3PCL3.d.ts → runtime.d-B_uPfMjA.d.ts} +2 -2
  285. package/dist/{runtime.d-pqFQBU2N.d.ts → runtime.d-CbdMI0Oy.d.ts} +1 -1
  286. package/dist/{runtime.d-3iJAKptR.d.mts → runtime.d-nUz0HAL4.d.mts} +2 -2
  287. package/dist/server-plugins.cjs +3 -2
  288. package/dist/server-plugins.d.mts +6 -12
  289. package/dist/server-plugins.d.ts +6 -12
  290. package/dist/server-plugins.mjs +2 -1
  291. package/dist/server.cjs +64 -56
  292. package/dist/server.d.mts +23 -14
  293. package/dist/server.d.ts +23 -14
  294. package/dist/server.mjs +40 -32
  295. package/dist/{spa-router.d-Dhvy60p4.d.mts → spa-router.d-D4EDwR20.d.mts} +3 -3
  296. package/dist/{spa-router.d-DhOhaQ-7.d.ts → spa-router.d-mC1D5cTN.d.ts} +3 -3
  297. package/dist/testing.cjs +3 -3
  298. package/dist/testing.d.mts +3 -2
  299. package/dist/testing.d.ts +3 -2
  300. package/dist/testing.mjs +3 -3
  301. package/dist/{types.d-C41ePjvP.d.ts → types.d-wVRlLtBf.d.mts} +1 -1
  302. package/dist/{types.d-C41ePjvP.d.mts → types.d-wVRlLtBf.d.ts} +1 -1
  303. package/dist/{utils.d-BVCMRRau.d.ts → utils.d-A2X3a6z_.d.ts} +1 -1
  304. package/dist/{utils.d-Q8EHCpkF.d.mts → utils.d-DxMzteqE.d.mts} +1 -1
  305. package/dist/version.cjs +2 -2
  306. package/dist/version.mjs +1 -1
  307. package/dist/vite.cjs +37 -29
  308. package/dist/vite.d.mts +28 -6
  309. package/dist/vite.d.ts +28 -6
  310. package/dist/vite.mjs +36 -28
  311. package/package.json +3 -3
  312. package/dist/analyzer-SAJSV6SP.cjs +0 -16
  313. package/dist/response.d-BolW0Vx_.d.mts +0 -10
  314. package/dist/response.d-BolW0Vx_.d.ts +0 -10
@@ -2,7 +2,7 @@
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
8
  var _chunkO47W53D3cjs = require('./chunk-O47W53D3.cjs');
@@ -30,22 +30,23 @@ var _chunkO47W53D3cjs = require('./chunk-O47W53D3.cjs');
30
30
 
31
31
 
32
32
 
33
- var _chunkDHR2WDSLcjs = require('./chunk-DHR2WDSL.cjs');
34
33
 
34
+ var _chunkKWST2O22cjs = require('./chunk-KWST2O22.cjs');
35
35
 
36
36
 
37
37
 
38
- var _chunkQ4HH5Q6Acjs = require('./chunk-Q4HH5Q6A.cjs');
39
38
 
39
+ var _chunkDMXMIE2Ccjs = require('./chunk-DMXMIE2C.cjs');
40
40
 
41
- var _chunkJFPKARWMcjs = require('./chunk-JFPKARWM.cjs');
41
+
42
+ var _chunkPMU4U2W2cjs = require('./chunk-PMU4U2W2.cjs');
42
43
 
43
44
 
44
45
  var _chunkAQLHD6HZcjs = require('./chunk-AQLHD6HZ.cjs');
45
46
 
46
47
 
47
48
 
48
- var _chunkQOGIZKSOcjs = require('./chunk-QOGIZKSO.cjs');
49
+ var _chunkCSQPMV3Qcjs = require('./chunk-CSQPMV3Q.cjs');
49
50
 
50
51
 
51
52
 
@@ -61,7 +62,7 @@ var _chunkPIUTGRDIcjs = require('./chunk-PIUTGRDI.cjs');
61
62
 
62
63
 
63
64
 
64
- var _chunkUPOYKX4Scjs = require('./chunk-UPOYKX4S.cjs');
65
+ var _chunk2MR4MABGcjs = require('./chunk-2MR4MABG.cjs');
65
66
 
66
67
 
67
68
  var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
@@ -79,13 +80,13 @@ var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
79
80
 
80
81
 
81
82
 
82
- var _chunkGQ6QOH7Tcjs = require('./chunk-GQ6QOH7T.cjs');
83
+ var _chunkSXMWVP2Lcjs = require('./chunk-SXMWVP2L.cjs');
83
84
 
84
85
 
85
- var _chunkX3MHKLCOcjs = require('./chunk-X3MHKLCO.cjs');
86
+ var _chunkTP4RAV7Ycjs = require('./chunk-TP4RAV7Y.cjs');
86
87
 
87
88
 
88
- var _chunkGUMKIQJLcjs = require('./chunk-GUMKIQJL.cjs');
89
+ var _chunkDPYBVVL3cjs = require('./chunk-DPYBVVL3.cjs');
89
90
 
90
91
 
91
92
  var _chunk7EPYN7GWcjs = require('./chunk-7EPYN7GW.cjs');
@@ -120,7 +121,7 @@ var _chunk7EPYN7GWcjs = require('./chunk-7EPYN7GW.cjs');
120
121
 
121
122
 
122
123
 
123
- var _chunkVO65MYJDcjs = require('./chunk-VO65MYJD.cjs');
124
+ var _chunk2IFT2CSAcjs = require('./chunk-2IFT2CSA.cjs');
124
125
 
125
126
 
126
127
 
@@ -134,7 +135,7 @@ var _chunkERMUL73Lcjs = require('./chunk-ERMUL73L.cjs');
134
135
  var _chunkUVV3I5QAcjs = require('./chunk-UVV3I5QA.cjs');
135
136
 
136
137
 
137
- var _chunkOCNV4CI2cjs = require('./chunk-OCNV4CI2.cjs');
138
+ var _chunkMQ4DYVFScjs = require('./chunk-MQ4DYVFS.cjs');
138
139
 
139
140
 
140
141
 
@@ -144,10 +145,10 @@ var _chunkSTF6VDYQcjs = require('./chunk-STF6VDYQ.cjs');
144
145
 
145
146
 
146
147
 
147
- var _chunk4E57QHPWcjs = require('./chunk-4E57QHPW.cjs');
148
+ var _chunkZUVAGMQ5cjs = require('./chunk-ZUVAGMQ5.cjs');
148
149
 
149
150
 
150
- var _chunkQO43L7Z4cjs = require('./chunk-QO43L7Z4.cjs');
151
+ var _chunkO32QPFVVcjs = require('./chunk-O32QPFVV.cjs');
151
152
 
152
153
 
153
154
  var _chunkRE5E2G5Scjs = require('./chunk-RE5E2G5S.cjs');
@@ -177,7 +178,7 @@ var _chunk3EIPOTZVcjs = require('./chunk-3EIPOTZV.cjs');
177
178
 
178
179
 
179
180
 
180
- var _chunk3EEINK7Gcjs = require('./chunk-3EEINK7G.cjs');
181
+ var _chunkL6E4SHUBcjs = require('./chunk-L6E4SHUB.cjs');
181
182
 
182
183
 
183
184
 
@@ -185,21 +186,21 @@ var _chunk3EEINK7Gcjs = require('./chunk-3EEINK7G.cjs');
185
186
 
186
187
 
187
188
 
188
- var _chunkFT6KJHS3cjs = require('./chunk-FT6KJHS3.cjs');
189
+ var _chunkC2JOS77Zcjs = require('./chunk-C2JOS77Z.cjs');
189
190
 
190
191
 
191
192
 
192
193
 
193
194
 
194
195
 
195
- var _chunkBDYM2TN3cjs = require('./chunk-BDYM2TN3.cjs');
196
+ var _chunkJX5VOLAVcjs = require('./chunk-JX5VOLAV.cjs');
196
197
 
197
198
 
198
199
 
199
200
  var _chunkX333W5KVcjs = require('./chunk-X333W5KV.cjs');
200
201
 
201
202
 
202
- var _chunkVX2HZGC7cjs = require('./chunk-VX2HZGC7.cjs');
203
+ var _chunkACGBXN3Ucjs = require('./chunk-ACGBXN3U.cjs');
203
204
 
204
205
 
205
206
 
@@ -215,10 +216,10 @@ var _chunkKBGZ5FD6cjs = require('./chunk-KBGZ5FD6.cjs');
215
216
  var _chunkP2355C6Ecjs = require('./chunk-P2355C6E.cjs');
216
217
 
217
218
 
218
- var _chunkOFBLGH6Vcjs = require('./chunk-OFBLGH6V.cjs');
219
+ var _chunkK66JILV3cjs = require('./chunk-K66JILV3.cjs');
219
220
 
220
221
 
221
- var _chunkRVGLYMJMcjs = require('./chunk-RVGLYMJM.cjs');
222
+ var _chunk2AM26UGIcjs = require('./chunk-2AM26UGI.cjs');
222
223
 
223
224
 
224
225
 
@@ -243,7 +244,7 @@ var _chunkY3WG64CPcjs = require('./chunk-Y3WG64CP.cjs');
243
244
 
244
245
 
245
246
 
246
- var _chunkYIHRZBD7cjs = require('./chunk-YIHRZBD7.cjs');
247
+ var _chunkJRGR5Z4Kcjs = require('./chunk-JRGR5Z4K.cjs');
247
248
 
248
249
 
249
250
 
@@ -278,7 +279,10 @@ var _chunkSUCDVKUBcjs = require('./chunk-SUCDVKUB.cjs');
278
279
  var _chunkEVIWKPJVcjs = require('./chunk-EVIWKPJV.cjs');
279
280
 
280
281
 
281
- var _chunk22LGTSBAcjs = require('./chunk-22LGTSBA.cjs');
282
+ var _chunkMEJCP2LXcjs = require('./chunk-MEJCP2LX.cjs');
283
+
284
+
285
+ var _chunkDVJM55D2cjs = require('./chunk-DVJM55D2.cjs');
282
286
 
283
287
 
284
288
  var _chunkPMJSG4JScjs = require('./chunk-PMJSG4JS.cjs');
@@ -293,19 +297,19 @@ var _chunkRWR7SMD7cjs = require('./chunk-RWR7SMD7.cjs');
293
297
  var _chunk6IOZPJ3Icjs = require('./chunk-6IOZPJ3I.cjs');
294
298
 
295
299
 
300
+ var _chunkDBYNZIIQcjs = require('./chunk-DBYNZIIQ.cjs');
296
301
 
297
302
 
298
303
 
299
- var _chunkI7J5RLGOcjs = require('./chunk-I7J5RLGO.cjs');
300
304
 
301
305
 
302
- var _chunkDBYNZIIQcjs = require('./chunk-DBYNZIIQ.cjs');
306
+ var _chunkNLBHLPEOcjs = require('./chunk-NLBHLPEO.cjs');
303
307
 
304
308
 
305
309
 
306
310
 
307
311
 
308
- var _chunkAKIQ54FKcjs = require('./chunk-AKIQ54FK.cjs');
312
+ var _chunkMBCRWU3Pcjs = require('./chunk-MBCRWU3P.cjs');
309
313
 
310
314
 
311
315
 
@@ -319,6 +323,7 @@ var _chunk7JUIK547cjs = require('./chunk-7JUIK547.cjs');
319
323
  var _chunkD22BUQKWcjs = require('./chunk-D22BUQKW.cjs');
320
324
 
321
325
 
326
+
322
327
  var _chunkBTZ5O6VMcjs = require('./chunk-BTZ5O6VM.cjs');
323
328
 
324
329
  // src/form-actions-transform.ts
@@ -326,6 +331,7 @@ var _crypto = require('crypto');
326
331
  var _compiler = require('@farm.js/islx/compiler');
327
332
  var _path2 = require('path'); var path2 = _interopRequireWildcard(_path2); var path6 = _interopRequireWildcard(_path2); var path3 = _interopRequireWildcard(_path2);
328
333
  function transformFarmFormActionModule(options) {
334
+ const runtimeModule = _nullishCoalesce(options.runtimeModule, () => ( ((specifier) => specifier)));
329
335
  const result = _compiler.transformActions.call(void 0, {
330
336
  code: options.code,
331
337
  id: options.id,
@@ -333,8 +339,8 @@ function transformFarmFormActionModule(options) {
333
339
  environment: options.ssr ? "server" : "client",
334
340
  parse: options.parse,
335
341
  runtime: {
336
- server: "@farm.js/core/internal/islx-server",
337
- client: "@farm.js/core/internal/islx-client"
342
+ server: runtimeModule("@farm.js/core/internal/islx-server"),
343
+ client: runtimeModule("@farm.js/core/internal/islx-client")
338
344
  }
339
345
  });
340
346
  return result ? result.code : null;
@@ -890,7 +896,7 @@ var REACT_CACHE_APIS = {
890
896
  cache: REACT_CACHE_LOCAL,
891
897
  cacheSignal: "__farm_react_cache_signal__"
892
898
  };
893
- function rewriteFarmReactCacheImport(code, file) {
899
+ function rewriteFarmReactCacheImport(code, file, cacheModule = FARM_REACT_CACHE_MODULE) {
894
900
  if (!code.includes("cache") || !code.includes("react")) return null;
895
901
  const extension = path2.default.extname(file).slice(1);
896
902
  const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : "tsx";
@@ -931,7 +937,7 @@ function rewriteFarmReactCacheImport(code, file) {
931
937
  ].join(", ");
932
938
  const lines = [
933
939
  ...clause ? [`import ${clause} from "react";`] : [],
934
- `import { ${caches.map((specifier) => `${_nullishCoalesce(_optionalChain([specifier, 'access', _49 => _49.imported, 'optionalAccess', _50 => _50.name]), () => ( _optionalChain([specifier, 'access', _51 => _51.imported, 'optionalAccess', _52 => _52.value])))} as ${specifier.local.name}`).join(", ")} } from ${JSON.stringify(FARM_REACT_CACHE_MODULE)};`
940
+ `import { ${caches.map((specifier) => `${_nullishCoalesce(_optionalChain([specifier, 'access', _49 => _49.imported, 'optionalAccess', _50 => _50.name]), () => ( _optionalChain([specifier, 'access', _51 => _51.imported, 'optionalAccess', _52 => _52.value])))} as ${specifier.local.name}`).join(", ")} } from ${JSON.stringify(cacheModule)};`
935
941
  ];
936
942
  edits.push({ start: node.start, end: node.end, text: lines.join("\n") });
937
943
  }
@@ -963,7 +969,7 @@ function rewriteFarmReactCacheImport(code, file) {
963
969
  start: memberImportAt,
964
970
  end: memberImportAt,
965
971
  text: `
966
- import { ${[...used].map((name) => `${name} as ${REACT_CACHE_APIS[name]}`).join(", ")} } from ${JSON.stringify(FARM_REACT_CACHE_MODULE)};`
972
+ import { ${[...used].map((name) => `${name} as ${REACT_CACHE_APIS[name]}`).join(", ")} } from ${JSON.stringify(cacheModule)};`
967
973
  });
968
974
  }
969
975
  }
@@ -1017,13 +1023,13 @@ function reportOpenAPIDevGenerationResult(spec, output = _chunkQMNWKQL4cjs.logge
1017
1023
  // src/vite.ts
1018
1024
  var SERVER_FN_TRANSFORM_PLUGIN = "@farm.js/plugin/rsc:server-fn-actions";
1019
1025
  function farmLlmsTxtGeneratedPaths(config) {
1020
- const llms = _chunkQO43L7Z4cjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([config, 'access', _57 => _57.agent, 'optionalAccess', _58 => _58.llmsTxt]));
1026
+ const llms = _chunkO32QPFVVcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([config, 'access', _57 => _57.agent, 'optionalAccess', _58 => _58.llmsTxt]));
1021
1027
  if (!llms.enabled) return [];
1022
1028
  return llms.full ? ["/llms.txt", "/llms-full.txt"] : ["/llms.txt"];
1023
1029
  }
1024
1030
  function farmAgentGeneratedPaths(config) {
1025
- const crawlers = _chunk4E57QHPWcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([config, 'access', _59 => _59.agent, 'optionalAccess', _60 => _60.crawlers]));
1026
- const sitemap = _chunk4E57QHPWcjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([config, 'access', _61 => _61.agent, 'optionalAccess', _62 => _62.sitemap]));
1031
+ const crawlers = _chunkZUVAGMQ5cjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([config, 'access', _59 => _59.agent, 'optionalAccess', _60 => _60.crawlers]));
1032
+ const sitemap = _chunkZUVAGMQ5cjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([config, 'access', _61 => _61.agent, 'optionalAccess', _62 => _62.sitemap]));
1027
1033
  return [
1028
1034
  ...farmLlmsTxtGeneratedPaths(config),
1029
1035
  ...sitemap.enabled ? ["/sitemap.xml"] : [],
@@ -1068,7 +1074,7 @@ function loadFarmWorkflowsDevRuntime() {
1068
1074
  return import("./workflows.cjs");
1069
1075
  }
1070
1076
  function loadFarmDevtoolsSnapshotRuntime() {
1071
- return import("./devtools-7HNDS4SY.cjs");
1077
+ return import("./devtools-O5625KCK.cjs");
1072
1078
  }
1073
1079
  function loadFarmDevtoolsUIRuntime() {
1074
1080
  return import("./devtools-ui-SYRUXUA7.cjs");
@@ -1099,16 +1105,16 @@ var FARM_SERVER_ONLY_PACKAGE_ID = "\0farm:server-only";
1099
1105
  var FARM_PLATFORM_ENTRY = "@farm.js/core/platform";
1100
1106
  var FARM_PLATFORM_CLIENT_ID = "\0farm:platform-client";
1101
1107
  var FARM_SERVER_ONLY_ENTRIES_RESOLVE_FILTER = [
1102
- _chunkDHR2WDSLcjs.exactIdPattern.call(void 0, [FARM_PLATFORM_ENTRY, SERVER_ONLY_PACKAGE, ...FARM_SERVER_ONLY_ENTRIES]),
1103
- new RegExp(`^${_chunkVO65MYJDcjs.FARM_RESOLVE_FROM_PREFIX}`),
1108
+ _chunkKWST2O22cjs.exactIdPattern.call(void 0, [FARM_PLATFORM_ENTRY, SERVER_ONLY_PACKAGE, ...FARM_SERVER_ONLY_ENTRIES]),
1109
+ new RegExp(`^${_chunk2IFT2CSAcjs.FARM_RESOLVE_FROM_PREFIX}`),
1104
1110
  // What isBuiltin() accepts: `node:` ids and the builtin names, subpaths such as fs/promises
1105
1111
  // included.
1106
1112
  /^node:/,
1107
- _chunkDHR2WDSLcjs.exactIdPattern.call(void 0, _module.builtinModules)
1113
+ _chunkKWST2O22cjs.exactIdPattern.call(void 0, _module.builtinModules)
1108
1114
  ];
1109
1115
  var FARM_SERVER_ONLY_ENTRIES_LOAD_FILTER = [
1110
- _chunkDHR2WDSLcjs.exactIdPattern.call(void 0, [FARM_SERVER_ONLY_PACKAGE_ID, FARM_PLATFORM_CLIENT_ID]),
1111
- new RegExp(`^${_chunkVO65MYJDcjs.FARM_BROWSER_BUILTIN_PREFIX}`)
1116
+ _chunkKWST2O22cjs.exactIdPattern.call(void 0, [FARM_SERVER_ONLY_PACKAGE_ID, FARM_PLATFORM_CLIENT_ID]),
1117
+ new RegExp(`^${_chunk2IFT2CSAcjs.FARM_BROWSER_BUILTIN_PREFIX}`)
1112
1118
  ];
1113
1119
  function createFarmPlatformClientModule(platform) {
1114
1120
  return `export function platform() { return ${JSON.stringify(platform)}; }
@@ -1136,11 +1142,11 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1136
1142
  name: "farm:server-only-entries",
1137
1143
  enforce: "pre",
1138
1144
  config(config) {
1139
- const bundledPackages = _chunkVO65MYJDcjs.collectFarmServerBundledPackageInfo.call(void 0,
1145
+ const bundledPackages = _chunk2IFT2CSAcjs.collectFarmServerBundledPackageInfo.call(void 0,
1140
1146
  path6.resolve(_nullishCoalesce(config.root, () => ( process.cwd())))
1141
1147
  );
1142
1148
  return {
1143
- optimizeDeps: { rolldownOptions: { plugins: [_chunkVO65MYJDcjs.farmBrowserBuiltinsOptimizerPlugin.call(void 0, )] } },
1149
+ optimizeDeps: { rolldownOptions: { plugins: [_chunk2IFT2CSAcjs.farmBrowserBuiltinsOptimizerPlugin.call(void 0, )] } },
1144
1150
  ssr: {
1145
1151
  noExternal: [
1146
1152
  // Resolve `server-only` here rather than in Node, which would load its throwing build.
@@ -1168,9 +1174,9 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1168
1174
  );
1169
1175
  }
1170
1176
  if (!_optionalChain([options2, 'optionalAccess', _67 => _67.ssr]) && _module.isBuiltin.call(void 0, id)) {
1171
- return _chunkVO65MYJDcjs.resolveFarmBrowserBuiltin.call(void 0, this, id, importer, options2);
1177
+ return _chunk2IFT2CSAcjs.resolveFarmBrowserBuiltin.call(void 0, this, id, importer, options2);
1172
1178
  }
1173
- const resolveFrom = importer ? _chunkVO65MYJDcjs.parseFarmResolveFrom.call(void 0, id, importer.split("?", 1)[0]) : null;
1179
+ const resolveFrom = importer ? _chunk2IFT2CSAcjs.parseFarmResolveFrom.call(void 0, id, importer.split("?", 1)[0]) : null;
1174
1180
  if (resolveFrom) {
1175
1181
  const directory = path6.dirname(resolveFrom.importer);
1176
1182
  return this.resolve(resolveFrom.specifier, resolveFrom.importer, {
@@ -1206,7 +1212,7 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1206
1212
  if (id === FARM_PLATFORM_CLIENT_ID) {
1207
1213
  return createFarmPlatformClientModule(_nullishCoalesce(options.platform, () => ( _chunkAQLHD6HZcjs.resolveFarmPlatform.call(void 0, ))));
1208
1214
  }
1209
- return _nullishCoalesce(_chunkVO65MYJDcjs.loadFarmBrowserBuiltin.call(void 0, id), () => ( null));
1215
+ return _nullishCoalesce(_chunk2IFT2CSAcjs.loadFarmBrowserBuiltin.call(void 0, id), () => ( null));
1210
1216
  }
1211
1217
  }
1212
1218
  };
@@ -1239,7 +1245,7 @@ function renderFarmI18nStaticHead(requestPath, snapshot) {
1239
1245
  if (!snapshot) return "";
1240
1246
  const runtime = `<script>window.__FARM_I18N__ = ${serializeFarmInlineValue(snapshot)};</script>`;
1241
1247
  if (snapshot.routing === "none") return runtime;
1242
- return `${_chunkUPOYKX4Scjs.renderFarmLocaleAlternateLinks.call(void 0, requestPath, snapshot)}${runtime}`;
1248
+ return `${_chunk2MR4MABGcjs.renderFarmLocaleAlternateLinks.call(void 0, requestPath, snapshot)}${runtime}`;
1243
1249
  }
1244
1250
  function getPublicEnvDefine(config) {
1245
1251
  const publicEnv = _optionalChain([config, 'access', _69 => _69.env, 'optionalAccess', _70 => _70.public]);
@@ -1312,12 +1318,12 @@ function sendFarmDevRuntimeHookError(res, json) {
1312
1318
  res.end(json ? _chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY : "Internal Server Error");
1313
1319
  }
1314
1320
  function opensFarmDevRuntimeSession(pm) {
1315
- return pm.hasRuntimeRequestHooks() || _chunkQ4HH5Q6Acjs.hasFarmServerRuntimePlugins.call(void 0, pm.getPlugins());
1321
+ return pm.hasRuntimeRequestHooks() || _chunkDMXMIE2Ccjs.hasFarmServerRuntimePlugins.call(void 0, pm.getPlugins());
1316
1322
  }
1317
1323
  var FARM_CONFIG_ROUTE_PLUGIN_NAMES = /* @__PURE__ */ new Set([
1318
- _chunkAKIQ54FKcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME,
1319
- _chunkAKIQ54FKcjs.FARM_CONFIG_REDIRECTS_PLUGIN_NAME,
1320
- _chunkAKIQ54FKcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME
1324
+ _chunkMBCRWU3Pcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME,
1325
+ _chunkMBCRWU3Pcjs.FARM_CONFIG_REDIRECTS_PLUGIN_NAME,
1326
+ _chunkMBCRWU3Pcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME
1321
1327
  ]);
1322
1328
  function isFarmConfigRoutePlugin(plugin) {
1323
1329
  return FARM_CONFIG_ROUTE_PLUGIN_NAMES.has(plugin.name);
@@ -1329,9 +1335,9 @@ async function proxyFarmExternalRewrite(req, res, bodySizeLimit) {
1329
1335
  let request = createRequestFromNodeRequest(req, new URL(destination));
1330
1336
  if (request.method !== "GET" && request.method !== "HEAD") {
1331
1337
  const body = await _chunkCFG4QERRcjs.readNodeRequestBody.call(void 0, req, bodySizeLimit);
1332
- request = new Request(request, { body: toRequestBody(body) });
1338
+ request = new Request(request, { method: request.method, body: toRequestBody(body) });
1333
1339
  }
1334
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, await _chunkYIHRZBD7cjs.fetchFarmExternalRewrite.call(void 0, request));
1340
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, await _chunkJRGR5Z4Kcjs.fetchFarmExternalRewrite.call(void 0, request));
1335
1341
  return true;
1336
1342
  }
1337
1343
  function toRequestBody(body) {
@@ -1368,7 +1374,7 @@ function applyWebResponseToNodeResponse(response, res) {
1368
1374
  for (const name of res.getHeaderNames()) {
1369
1375
  res.removeHeader(name);
1370
1376
  }
1371
- _chunkYIHRZBD7cjs.applyWebResponseHeaders.call(void 0, res, response.headers);
1377
+ _chunkJRGR5Z4Kcjs.applyWebResponseHeaders.call(void 0, res, response.headers);
1372
1378
  }
1373
1379
  function toNodeResponseBuffer(chunk, encoding) {
1374
1380
  if (chunk === void 0 || chunk === null || typeof chunk === "function") return void 0;
@@ -1425,7 +1431,7 @@ function interceptFarmDevPageResponse(options) {
1425
1431
  res.end = originalEnd;
1426
1432
  res.writeHead = originalWriteHead;
1427
1433
  if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
1428
- delete res[_chunkJFPKARWMcjs.FARM_NODE_RESPONSE_END_PENDING];
1434
+ delete res[_chunkPMU4U2W2cjs.FARM_NODE_RESPONSE_END_PENDING];
1429
1435
  };
1430
1436
  let runtimeHookFailed = false;
1431
1437
  const endRuntimeRequest = (response) => pm.endRuntimeRequest(runtimeSession, response).catch((error) => {
@@ -1549,7 +1555,7 @@ function interceptFarmDevPageResponse(options) {
1549
1555
  });
1550
1556
  res.end = ((...args) => {
1551
1557
  interceptedEnd = true;
1552
- res[_chunkJFPKARWMcjs.FARM_NODE_RESPONSE_END_PENDING] = true;
1558
+ res[_chunkPMU4U2W2cjs.FARM_NODE_RESPONSE_END_PENDING] = true;
1553
1559
  if (afterResponseCalled) return res;
1554
1560
  afterResponseCalled = true;
1555
1561
  options.logResponse(method, urlPath, res.statusCode || 200, Date.now() - startTime, "PAGE");
@@ -1632,7 +1638,7 @@ function interceptFarmDevPageResponse(options) {
1632
1638
  res.end = originalEnd;
1633
1639
  res.writeHead = originalWriteHead;
1634
1640
  if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
1635
- delete res[_chunkJFPKARWMcjs.FARM_NODE_RESPONSE_END_PENDING];
1641
+ delete res[_chunkPMU4U2W2cjs.FARM_NODE_RESPONSE_END_PENDING];
1636
1642
  originalEnd(...originalEndArgs);
1637
1643
  }).catch((error) => {
1638
1644
  reportFailure(error);
@@ -1649,14 +1655,14 @@ function interceptFarmDevPageResponse(options) {
1649
1655
  res.end = originalEnd;
1650
1656
  res.writeHead = originalWriteHead;
1651
1657
  if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
1652
- delete res[_chunkJFPKARWMcjs.FARM_NODE_RESPONSE_END_PENDING];
1658
+ delete res[_chunkPMU4U2W2cjs.FARM_NODE_RESPONSE_END_PENDING];
1653
1659
  originalEnd(body, callback);
1654
1660
  } else {
1655
1661
  res.write = originalWrite;
1656
1662
  res.end = originalEnd;
1657
1663
  res.writeHead = originalWriteHead;
1658
1664
  if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
1659
- delete res[_chunkJFPKARWMcjs.FARM_NODE_RESPONSE_END_PENDING];
1665
+ delete res[_chunkPMU4U2W2cjs.FARM_NODE_RESPONSE_END_PENDING];
1660
1666
  originalEnd(...originalEndArgs);
1661
1667
  }
1662
1668
  });
@@ -1795,13 +1801,18 @@ function rewriteEarlySsrRelativeImports(options) {
1795
1801
  return output + options.code.slice(copied);
1796
1802
  }
1797
1803
  function transformIsolatedClientBoundaryModule(options) {
1804
+ const runtimeModule = _nullishCoalesce(options.runtimeModule, () => ( ((specifier) => specifier)));
1805
+ const islxReact = JSON.stringify(runtimeModule("@farm.js/core/internal/islx-react"));
1806
+ const isolatedBoundary = JSON.stringify(
1807
+ runtimeModule("@farm.js/core/internal/isolated-boundary")
1808
+ );
1798
1809
  if (options.slots) {
1799
1810
  try {
1800
1811
  const rewritten = _compiler.rewriteFormStatusImports.call(void 0, {
1801
1812
  code: options.code,
1802
1813
  id: options.moduleReference,
1803
1814
  parse: options.parse,
1804
- from: "@farm.js/core/internal/islx-react"
1815
+ from: runtimeModule("@farm.js/core/internal/islx-react")
1805
1816
  });
1806
1817
  if (rewritten) options = { ...options, code: rewritten.code };
1807
1818
  } catch (e18) {
@@ -1815,7 +1826,7 @@ function transformIsolatedClientBoundaryModule(options) {
1815
1826
  return null;
1816
1827
  }
1817
1828
  const body = Array.isArray(ast.body) ? ast.body : [];
1818
- const everyExportIsComponent = options.code.includes(_chunkVO65MYJDcjs.FARM_CLIENT_REFERENCE_PRAGMA) || options.moduleReference.includes(_chunkVO65MYJDcjs.FARM_CLIENT_REFERENCE_DIRECTORY);
1829
+ const everyExportIsComponent = options.code.includes(_chunk2IFT2CSAcjs.FARM_CLIENT_REFERENCE_PRAGMA) || options.moduleReference.includes(_chunk2IFT2CSAcjs.FARM_CLIENT_REFERENCE_DIRECTORY);
1819
1830
  const replacements = [];
1820
1831
  const wrapperStatements = [];
1821
1832
  const originalEntries = [];
@@ -1913,10 +1924,10 @@ function transformIsolatedClientBoundaryModule(options) {
1913
1924
  output = output.slice(0, replacement.start) + replacement.code + output.slice(replacement.end);
1914
1925
  }
1915
1926
  const isComponent = `(value) => typeof value === "function" || (typeof value === "object" && value !== null && [Symbol.for("react.memo"), Symbol.for("react.forward_ref"), Symbol.for("react.lazy")].includes(value.$$typeof))`;
1916
- const runtimeImport = options.slots ? options.browser ? "const __farm_islx_island__ = (component) => component;" : `import { createIsland as __farm_islx_create_island__ } from "@farm.js/core/internal/islx-react";
1927
+ const runtimeImport = options.slots ? options.browser ? "const __farm_islx_island__ = (component) => component;" : `import { createIsland as __farm_islx_create_island__ } from ${islxReact};
1917
1928
  const __farm_is_component__ = ${isComponent};
1918
1929
  const __farm_islx_island__ = (component, ...rest) => __farm_is_component__(component) ? __farm_islx_create_island__(component, ...rest) : component;` : `import * as __farm_isolated_react__ from "react";
1919
- import { createFarmIsolatedClientBoundary as __farm_create_boundary__ } from "@farm.js/core/internal/isolated-boundary";
1930
+ import { createFarmIsolatedClientBoundary as __farm_create_boundary__ } from ${isolatedBoundary};
1920
1931
  const __farm_is_component__ = ${isComponent};
1921
1932
  const __farm_create_isolated_boundary__ = (react, component, ...rest) => __farm_is_component__(component) ? __farm_create_boundary__(react, component, ...rest) : component;`;
1922
1933
  return `${runtimeImport}
@@ -1972,17 +1983,38 @@ function warnClientBoundaryOnce(context, id, code, config) {
1972
1983
  function shouldEmitFarmClientRootHmr(renderer) {
1973
1984
  return _chunk67MZTLTFcjs.getFarmRendererCapabilities.call(void 0, _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, renderer)).reconcilesRerenders;
1974
1985
  }
1975
- function hasViteAlias(alias, find) {
1986
+ var FARM_RUNTIME_MODULE_PREFIX = "/@farm/runtime/";
1987
+ function toFarmRuntimeModuleId(specifier) {
1988
+ return FARM_RUNTIME_MODULE_PREFIX + specifier;
1989
+ }
1990
+ function getFarmCoreFile() {
1991
+ return typeof __filename === "string" ? __filename : _url.fileURLToPath.call(void 0, _chunkBTZ5O6VMcjs.define_import_meta_default.url);
1992
+ }
1993
+ var FARM_SOURCE_ALIAS_PROBES = [
1994
+ "@/x",
1995
+ "@/index.ts",
1996
+ "@/components/button",
1997
+ "@/lib/utils/format.ts",
1998
+ "@/__farm__/probe"
1999
+ ];
2000
+ function matchesViteAlias(find, specifier) {
2001
+ if (typeof find === "string") return specifier === find || specifier.startsWith(`${find}/`);
2002
+ find.lastIndex = 0;
2003
+ const matched = find.test(specifier);
2004
+ find.lastIndex = 0;
2005
+ return matched;
2006
+ }
2007
+ function hasFarmSourceAliasOverride(alias) {
1976
2008
  if (!alias) return false;
1977
- if (!Array.isArray(alias)) return Object.prototype.hasOwnProperty.call(alias, find);
1978
- return alias.some(
1979
- (entry) => typeof entry.find === "string" ? entry.find === find : entry.find.test(`${find}/`)
2009
+ const finds = Array.isArray(alias) ? alias.map((entry) => entry.find) : Object.keys(alias);
2010
+ return finds.some(
2011
+ (find) => FARM_SOURCE_ALIAS_PROBES.every((probe) => matchesViteAlias(find, probe))
1980
2012
  );
1981
2013
  }
1982
2014
  function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
1983
2015
  const rendererDisabled = _chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, options.renderer);
1984
2016
  const imageImports = farmImageImportsPlugin();
1985
- const fontImports = _chunkDHR2WDSLcjs.farmFontImportsPlugin.call(void 0, {
2017
+ const fontImports = _chunkKWST2O22cjs.farmFontImportsPlugin.call(void 0, {
1986
2018
  root: options.root,
1987
2019
  basePath: options.basePath,
1988
2020
  publicDir: options.publicDir
@@ -2021,15 +2053,27 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2021
2053
  console.log(log);
2022
2054
  };
2023
2055
  const getProgrammaticClientRoutes = () => _nullishCoalesce(options.programmaticClientRoutes, () => ( _optionalChain([farmApp, 'optionalAccess', _101 => _101.getRouteManager, 'call', _102 => _102(), 'access', _103 => _103.getProgrammaticClientRoutes, 'call', _104 => _104()])));
2056
+ const isOutsideAppRoot = (file) => {
2057
+ const root = _optionalChain([farmApp, 'optionalAccess', _105 => _105.getConfig, 'call', _106 => _106(), 'access', _107 => _107.root]) || _optionalChain([server, 'optionalAccess', _108 => _108.config, 'access', _109 => _109.root]) || options.root;
2058
+ if (!root) return false;
2059
+ const relative4 = path6.relative(root, file.split("?", 1)[0]);
2060
+ return relative4.startsWith("..") || path6.isAbsolute(relative4);
2061
+ };
2024
2062
  const plugin = {
2025
2063
  name: "farm",
2026
2064
  api: { getProgrammaticClientRoutes },
2027
2065
  config(userConfig, configEnv) {
2028
2066
  isBuild = configEnv.command === "build";
2029
- const layerAliases = _chunkMTBDJ326cjs.getFarmLayerAliases.call(void 0, options.layers);
2030
- const sourceAlias = hasViteAlias(_optionalChain([userConfig, 'access', _105 => _105.resolve, 'optionalAccess', _106 => _106.alias]), "@") ? {} : _chunkDHR2WDSLcjs.createFarmSourceAlias.call(void 0, options.root || process.cwd(), options.srcDir);
2067
+ const farmAliases = {
2068
+ ..._chunkMTBDJ326cjs.getFarmLayerAliases.call(void 0, options.layers),
2069
+ ...hasFarmSourceAliasOverride(_optionalChain([userConfig, 'access', _110 => _110.resolve, 'optionalAccess', _111 => _111.alias])) ? {} : _chunkKWST2O22cjs.createFarmSourceAlias.call(void 0, options.root || process.cwd(), options.srcDir)
2070
+ };
2071
+ if (Object.keys(farmAliases).length > 0) {
2072
+ _nullishCoalesce(userConfig.resolve, () => ( (userConfig.resolve = {})));
2073
+ userConfig.resolve.alias = _chunkKWST2O22cjs.mergeFarmViteAlias.call(void 0, farmAliases, userConfig.resolve.alias);
2074
+ }
2031
2075
  const layerRoots = (_nullishCoalesce(options.layers, () => ( []))).map((layer) => layer.root);
2032
- farmOwnsDevCors = !isBuild && _optionalChain([userConfig, 'access', _107 => _107.server, 'optionalAccess', _108 => _108.cors]) === void 0;
2076
+ farmOwnsDevCors = !isBuild && _optionalChain([userConfig, 'access', _112 => _112.server, 'optionalAccess', _113 => _113.cors]) === void 0;
2033
2077
  return {
2034
2078
  // Honor Farm's publicDir so the dev server serves the same static
2035
2079
  // directory the production client build emits.
@@ -2038,14 +2082,11 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2038
2082
  // Keep development module ownership explicit; the RSC plugin adds its
2039
2083
  // environment only when enabled. Production environment setup is unchanged.
2040
2084
  ...!isBuild ? { environments: { client: {}, ssr: {} } } : {},
2041
- resolve: {
2042
- alias: { ...layerAliases, ...sourceAlias }
2043
- },
2044
2085
  server: {
2045
2086
  ...farmOwnsDevCors ? { cors: false } : {},
2046
2087
  fs: {
2047
2088
  ...layerRoots.length ? { allow: [path6.resolve(options.root || process.cwd()), ...layerRoots] } : {},
2048
- deny: getFarmDevFsDeny(_optionalChain([userConfig, 'access', _109 => _109.server, 'optionalAccess', _110 => _110.fs, 'optionalAccess', _111 => _111.deny]), options)
2089
+ deny: getFarmDevFsDeny(_optionalChain([userConfig, 'access', _114 => _114.server, 'optionalAccess', _115 => _115.fs, 'optionalAccess', _116 => _116.deny]), options)
2049
2090
  }
2050
2091
  }
2051
2092
  };
@@ -2057,8 +2098,8 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2057
2098
  serverFnTransformActive = config.plugins.some(
2058
2099
  (plugin2) => plugin2.name === SERVER_FN_TRANSFORM_PLUGIN
2059
2100
  );
2060
- reactRefreshActive = _chunk65Y5SIBHcjs.isFarmReactRefreshActive.call(void 0, config);
2061
- if (_optionalChain([options, 'access', _112 => _112.experimental, 'optionalAccess', _113 => _113.serverActions]) === true && !serverFnTransformActive && !islandsServerFns()) {
2101
+ reactRefreshActive = _chunk3QM74STYcjs.isFarmReactRefreshActive.call(void 0, config);
2102
+ if (_optionalChain([options, 'access', _117 => _117.experimental, 'optionalAccess', _118 => _118.serverActions]) === true && !serverFnTransformActive && !islandsServerFns()) {
2062
2103
  _chunkQMNWKQL4cjs.logger.warn(
2063
2104
  "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."
2064
2105
  );
@@ -2067,21 +2108,21 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2067
2108
  async configureServer(viteServer) {
2068
2109
  viteServer.middlewares.use(
2069
2110
  createFarmDevPreviewGuard(viteServer, {
2070
- getSourceRoots: () => _chunkMTBDJ326cjs.getFarmSourceRoots.call(void 0, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _114 => _114.getConfig, 'call', _115 => _115()]), () => ( options)))
2111
+ getSourceRoots: () => _chunkMTBDJ326cjs.getFarmSourceRoots.call(void 0, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _119 => _119.getConfig, 'call', _120 => _120()]), () => ( options)))
2071
2112
  })
2072
2113
  );
2073
2114
  if (typeof fontImports.configureServer === "function") {
2074
2115
  await fontImports.configureServer.call(this, viteServer);
2075
2116
  }
2076
2117
  server = viteServer;
2077
- const farmMiddlewares = _nullishCoalesce(_optionalChain([deferredGates, 'optionalAccess', _116 => _116.pre, 'access', _117 => _117.target]), () => ( viteServer.middlewares));
2078
- const farmPostMiddlewares = _nullishCoalesce(_optionalChain([deferredGates, 'optionalAccess', _118 => _118.post, 'access', _119 => _119.target]), () => ( viteServer.middlewares));
2118
+ const farmMiddlewares = _nullishCoalesce(_optionalChain([deferredGates, 'optionalAccess', _121 => _121.pre, 'access', _122 => _122.target]), () => ( viteServer.middlewares));
2119
+ const farmPostMiddlewares = _nullishCoalesce(_optionalChain([deferredGates, 'optionalAccess', _123 => _123.post, 'access', _124 => _124.target]), () => ( viteServer.middlewares));
2079
2120
  const pm = initialPluginManager;
2080
2121
  const configRoutePlugins = new Set(
2081
- _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)])
2122
+ _optionalChain([pm, 'optionalAccess', _125 => _125.getPlugins, 'call', _126 => _126(), 'access', _127 => _127.filter, 'call', _128 => _128(isFarmConfigRoutePlugin), 'access', _129 => _129.map, 'call', _130 => _130((plugin2) => plugin2.name)])
2082
2123
  );
2083
- const configRedirectMatchers = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _126 => _126.getPlugins, 'call', _127 => _127()]), () => ( []))).flatMap((plugin2) => {
2084
- const matcher = _chunkAKIQ54FKcjs.getConfigRedirectMatcher.call(void 0, plugin2);
2124
+ const configRedirectMatchers = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _131 => _131.getPlugins, 'call', _132 => _132()]), () => ( []))).flatMap((plugin2) => {
2125
+ const matcher = _chunkMBCRWU3Pcjs.getConfigRedirectMatcher.call(void 0, plugin2);
2085
2126
  return matcher ? [matcher] : [];
2086
2127
  });
2087
2128
  const emitPluginError = async (phase, error, meta) => {
@@ -2091,7 +2132,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2091
2132
  } catch (e21) {
2092
2133
  }
2093
2134
  };
2094
- farmApp = new (0, _chunkDHR2WDSLcjs.FarmApp)(
2135
+ farmApp = new (0, _chunkKWST2O22cjs.FarmApp)(
2095
2136
  {
2096
2137
  ...options,
2097
2138
  root: resolveDevelopmentRoot(options.root, server.config.root)
@@ -2099,7 +2140,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2099
2140
  server
2100
2141
  );
2101
2142
  farmApp.getRouteManager().usePackageClientBoundaryCacheFile(
2102
- _chunkVO65MYJDcjs.resolvePackageClientBoundaryCacheFile.call(void 0,
2143
+ _chunk2IFT2CSAcjs.resolvePackageClientBoundaryCacheFile.call(void 0,
2103
2144
  farmApp.getConfig().root,
2104
2145
  options.distDir || ".farm"
2105
2146
  )
@@ -2107,17 +2148,17 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2107
2148
  await farmApp.initialize();
2108
2149
  const farmConfig = farmApp.getConfig();
2109
2150
  let farmAppPackages;
2110
- if (_optionalChain([farmConfig, 'access', _128 => _128.agent, 'optionalAccess', _129 => _129.noindexPreviews])) {
2151
+ if (_optionalChain([farmConfig, 'access', _133 => _133.agent, 'optionalAccess', _134 => _134.noindexPreviews])) {
2111
2152
  farmMiddlewares.use((_req, res, next) => {
2112
- if (_chunkGUMKIQJLcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env)) {
2113
- res.setHeader("X-Robots-Tag", _chunk4E57QHPWcjs.FARM_PREVIEW_ROBOTS_TAG);
2153
+ if (_chunkDPYBVVL3cjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env)) {
2154
+ res.setHeader("X-Robots-Tag", _chunkZUVAGMQ5cjs.FARM_PREVIEW_ROBOTS_TAG);
2114
2155
  }
2115
2156
  next();
2116
2157
  });
2117
2158
  }
2118
2159
  const apiServerBasePath = _chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, farmConfig.api);
2119
2160
  const devBuiltInRoutePaths = new Set(
2120
- _chunkGQ6QOH7Tcjs.listFarmBuiltInRoutePaths.call(void 0, {
2161
+ _chunkSXMWVP2Lcjs.listFarmBuiltInRoutePaths.call(void 0, {
2121
2162
  agent: {
2122
2163
  apiCatalog: true,
2123
2164
  mcp: true,
@@ -2139,7 +2180,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2139
2180
  validateRemoteUrl: createNodeImageUrlValidator(farmConfig.images),
2140
2181
  // Vite owns this address. Unlike request.url, it cannot be replaced by
2141
2182
  // a caller-controlled Host header.
2142
- trustedLocalOrigin: () => _optionalChain([server, 'access', _130 => _130.resolvedUrls, 'optionalAccess', _131 => _131.local, 'access', _132 => _132[0]]),
2183
+ trustedLocalOrigin: () => _optionalChain([server, 'access', _135 => _135.resolvedUrls, 'optionalAccess', _136 => _136.local, 'access', _137 => _137[0]]),
2143
2184
  onError(error) {
2144
2185
  _chunkQMNWKQL4cjs.logger.error(
2145
2186
  `Image optimization failed: ${error instanceof Error ? error.message : String(error)}`
@@ -2159,15 +2200,15 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2159
2200
  const workflowConfig = farmConfig.workflows;
2160
2201
  const farmDocsDevRuntime = farmConfig.docs.enabled ? await loadFarmDocsDevRuntime() : null;
2161
2202
  const getExtraRouteTypes = () => [
2162
- ..._optionalChain([options, 'access', _133 => _133.openapi, 'optionalAccess', _134 => _134.enabled]) && options.openapi.route ? [options.openapi.route] : [],
2163
- ..._nullishCoalesce(_optionalChain([farmDocsDevRuntime, 'optionalAccess', _135 => _135.getFarmDocsRouteTypeEntries, 'call', _136 => _136(farmConfig.docs)]), () => ( []))
2203
+ ..._optionalChain([options, 'access', _138 => _138.openapi, 'optionalAccess', _139 => _139.enabled]) && options.openapi.route ? [options.openapi.route] : [],
2204
+ ..._nullishCoalesce(_optionalChain([farmDocsDevRuntime, 'optionalAccess', _140 => _140.getFarmDocsRouteTypeEntries, 'call', _141 => _141(farmConfig.docs)]), () => ( []))
2164
2205
  ];
2165
2206
  const appDirSlugs = sourceRoots.map(
2166
2207
  (source) => path6.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
2167
2208
  );
2168
2209
  const generateTypeArtifacts = async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
2169
2210
  try {
2170
- const result = await _chunkQOGIZKSOcjs.generateFarmTypeArtifacts.call(void 0, {
2211
+ const result = await _chunkCSQPMV3Qcjs.generateFarmTypeArtifacts.call(void 0, {
2171
2212
  root: farmConfig.root,
2172
2213
  srcDir: farmConfig.srcDir,
2173
2214
  layers: farmConfig.layers,
@@ -2207,7 +2248,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2207
2248
  (source) => path6.join(source.root, source.srcDir).replace(/\\/g, "/")
2208
2249
  );
2209
2250
  const layerConfigFiles = new Set(
2210
- farmConfig.layers.map((layer) => _optionalChain([layer, 'access', _137 => _137.configFile, 'optionalAccess', _138 => _138.replace, 'call', _139 => _139(/\\/g, "/")])).filter((file) => Boolean(file))
2251
+ farmConfig.layers.map((layer) => _optionalChain([layer, 'access', _142 => _142.configFile, 'optionalAccess', _143 => _143.replace, 'call', _144 => _144(/\\/g, "/")])).filter((file) => Boolean(file))
2211
2252
  );
2212
2253
  const routeModuleExtensions = /* @__PURE__ */ new Set([
2213
2254
  ..._chunk67MZTLTFcjs.resolveFarmComponentExtensions.call(void 0, farmConfig.renderer.componentExtensions),
@@ -2286,7 +2327,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2286
2327
  scheduleTypeArtifactGen(file, ev, typeArtifacts);
2287
2328
  }
2288
2329
  if (isI18nCatalogFile(file)) {
2289
- _optionalChain([farmApp, 'optionalAccess', _140 => _140.getI18nRuntime, 'call', _141 => _141(), 'access', _142 => _142.reload, 'call', _143 => _143(), 'access', _144 => _144.then, 'call', _145 => _145(() => server.ws.send({ type: "full-reload", path: "*" })), 'access', _146 => _146.catch, 'call', _147 => _147((error) => _chunkQMNWKQL4cjs.logger.warn(`i18n catalog reload failed: ${error.message}`))]);
2330
+ _optionalChain([farmApp, 'optionalAccess', _145 => _145.getI18nRuntime, 'call', _146 => _146(), 'access', _147 => _147.reload, 'call', _148 => _148(), 'access', _149 => _149.then, 'call', _150 => _150(() => server.ws.send({ type: "full-reload", path: "*" })), 'access', _151 => _151.catch, 'call', _152 => _152((error) => _chunkQMNWKQL4cjs.logger.warn(`i18n catalog reload failed: ${error.message}`))]);
2290
2331
  }
2291
2332
  const isRouteRefreshEvent = (ev !== "change" || isStaticMetadataImageFile(file)) && (isAppRuntimeFile(file) || isProgrammaticRouteFile(file) || isProgrammaticRouteSourceFile(file) && (ev === "unlink" || fileContainsProgrammaticPageRoute(file)));
2292
2333
  if (isRouteRefreshEvent) {
@@ -2299,8 +2340,8 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2299
2340
  const reloadsMiddleware = pendingRouteRefreshIncludesMiddleware;
2300
2341
  pendingRouteRefreshIncludesMiddleware = false;
2301
2342
  Promise.all([
2302
- _optionalChain([refreshRouteDiscovery, 'optionalCall', _148 => _148(`${ev} ${file}`)]),
2303
- reloadsMiddleware ? _optionalChain([middlewareManager, 'optionalAccess', _149 => _149.reload, 'call', _150 => _150()]) : void 0
2343
+ _optionalChain([refreshRouteDiscovery, 'optionalCall', _153 => _153(`${ev} ${file}`)]),
2344
+ reloadsMiddleware ? _optionalChain([middlewareManager, 'optionalAccess', _154 => _154.reload, 'call', _155 => _155()]) : void 0
2304
2345
  ]).then(() => server.ws.send({ type: "full-reload", path: "*" })).catch((error) => _chunkQMNWKQL4cjs.logger.warn(`Route refresh failed: ${error.message}`));
2305
2346
  }, 50);
2306
2347
  }
@@ -2339,14 +2380,14 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2339
2380
  const { FARM_DEV_SERVER_MODULE_LOADER } = await import("./internal/native-server-fns.cjs");
2340
2381
  const load = (file) => _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, file);
2341
2382
  globalThis[FARM_DEV_SERVER_MODULE_LOADER] = load;
2342
- _optionalChain([server, 'access', _151 => _151.httpServer, 'optionalAccess', _152 => _152.once, 'call', _153 => _153("close", () => {
2383
+ _optionalChain([server, 'access', _156 => _156.httpServer, 'optionalAccess', _157 => _157.once, 'call', _158 => _158("close", () => {
2343
2384
  const globals = globalThis;
2344
2385
  if (globals[FARM_DEV_SERVER_MODULE_LOADER] === load) {
2345
2386
  delete globals[FARM_DEV_SERVER_MODULE_LOADER];
2346
2387
  }
2347
2388
  })]);
2348
2389
  }
2349
- apiRouteManager = new (0, _chunkOFBLGH6Vcjs.APIRouteManager)(appDirs, server, {
2390
+ apiRouteManager = new (0, _chunkK66JILV3cjs.APIRouteManager)(appDirs, server, {
2350
2391
  plugins: farmConfig.plugins,
2351
2392
  i18n: farmApp.getI18nRuntime(),
2352
2393
  bodySizeLimit: serverConfig.bodySizeLimit,
@@ -2392,7 +2433,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2392
2433
  });
2393
2434
  }
2394
2435
  }
2395
- middlewareManager = new (0, _chunkVX2HZGC7cjs.MiddlewareManager)(
2436
+ middlewareManager = new (0, _chunkACGBXN3Ucjs.MiddlewareManager)(
2396
2437
  appDirs,
2397
2438
  server,
2398
2439
  farmConfig.middleware,
@@ -2413,11 +2454,11 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2413
2454
  });
2414
2455
  }
2415
2456
  }
2416
- if (_optionalChain([options, 'access', _154 => _154.openapi, 'optionalAccess', _155 => _155.enabled])) {
2457
+ if (_optionalChain([options, 'access', _159 => _159.openapi, 'optionalAccess', _160 => _160.enabled])) {
2417
2458
  const { OpenAPIManager } = await loadFarmOpenAPIDevRuntime();
2418
2459
  openAPIManager = new OpenAPIManager(appDirs, options.openapi, {
2419
2460
  mode: "development",
2420
- apiBaseURL: typeof _optionalChain([options, 'access', _156 => _156.api, 'optionalAccess', _157 => _157.baseURL]) === "string" ? options.api.baseURL : void 0,
2461
+ apiBaseURL: typeof _optionalChain([options, 'access', _161 => _161.api, 'optionalAccess', _162 => _162.baseURL]) === "string" ? options.api.baseURL : void 0,
2421
2462
  loadModule: (filePath) => apiRouteManager.loadModule(filePath)
2422
2463
  });
2423
2464
  const spec = await openAPIManager.generateSpec();
@@ -2447,7 +2488,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2447
2488
  return _chunk7EPYN7GWcjs.resolveFarmLayoutFonts.call(void 0, layoutModules);
2448
2489
  };
2449
2490
  releaseDocsMCPServers();
2450
- const isFarmDocsPathGuarded = (href) => _chunkUPOYKX4Scjs.farmPathGuardCoversPage.call(void 0,
2491
+ const isFarmDocsPathGuarded = (href) => _chunk2MR4MABGcjs.farmPathGuardCoversPage.call(void 0,
2451
2492
  {
2452
2493
  config: farmConfig,
2453
2494
  middlewareRoutes: middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
@@ -2460,20 +2501,20 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2460
2501
  clientEntry: "/@farm/client.js",
2461
2502
  resolveLayoutFonts: resolveDocsLayoutFonts,
2462
2503
  fontStylesheetHref: "/@farm/fonts.css",
2463
- globalStylesheetHref: _chunkDHR2WDSLcjs.resolveDevGlobalStylesheetHref.call(void 0,
2504
+ globalStylesheetHref: _chunkKWST2O22cjs.resolveDevGlobalStylesheetHref.call(void 0,
2464
2505
  farmConfig.root,
2465
2506
  farmConfig.srcDir
2466
2507
  ),
2467
2508
  loadModule: async (specifier) => {
2468
2509
  const resolved = await server.environments.ssr.pluginContainer.resolveId(specifier);
2469
- if (specifier === _optionalChain([farmConfig, 'access', _158 => _158.docs, 'access', _159 => _159.adapter, 'optionalAccess', _160 => _160.server]) && _optionalChain([resolved, 'optionalAccess', _161 => _161.id])) {
2510
+ if (specifier === _optionalChain([farmConfig, 'access', _163 => _163.docs, 'access', _164 => _164.adapter, 'optionalAccess', _165 => _165.server]) && _optionalChain([resolved, 'optionalAccess', _166 => _166.id])) {
2470
2511
  const file = resolved.id.split("?", 1)[0];
2471
2512
  return import(
2472
2513
  /* @vite-ignore */
2473
2514
  _url.pathToFileURL.call(void 0, file).href
2474
2515
  );
2475
2516
  }
2476
- return _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, _nullishCoalesce(_optionalChain([resolved, 'optionalAccess', _162 => _162.id]), () => ( specifier)));
2517
+ return _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, _nullishCoalesce(_optionalChain([resolved, 'optionalAccess', _167 => _167.id]), () => ( specifier)));
2477
2518
  },
2478
2519
  registerMCPServer: (mcpServer) => {
2479
2520
  const dispose = _chunkLRB5OVRTcjs.registerFarmMCPServer.call(void 0, mcpServer);
@@ -2491,7 +2532,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2491
2532
  fontAssets: _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, farmDocsFontAssetList),
2492
2533
  resolveLayoutFonts: resolveDocsLayoutFonts,
2493
2534
  fontStylesheetHref: "/@farm/fonts.css",
2494
- globalStylesheetHref: _chunkDHR2WDSLcjs.resolveDevGlobalStylesheetHref.call(void 0,
2535
+ globalStylesheetHref: _chunkKWST2O22cjs.resolveDevGlobalStylesheetHref.call(void 0,
2495
2536
  farmConfig.root,
2496
2537
  farmConfig.srcDir
2497
2538
  ),
@@ -2499,7 +2540,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2499
2540
  basePath: farmConfig.basePath
2500
2541
  }) : null;
2501
2542
  const farmDocsListsPages = Boolean(
2502
- farmDocsDevRuntime && _optionalChain([pm, 'optionalAccess', _163 => _163.getPlugins, 'call', _164 => _164(), 'access', _165 => _165.some, 'call', _166 => _166((plugin2) => plugin2.name === "farm:infra-analytics")])
2543
+ farmDocsDevRuntime && _optionalChain([pm, 'optionalAccess', _168 => _168.getPlugins, 'call', _169 => _169(), 'access', _170 => _170.some, 'call', _171 => _171((plugin2) => plugin2.name === "farm:infra-analytics")])
2503
2544
  );
2504
2545
  let farmDocsPagePaths;
2505
2546
  const getFarmDocsPagePaths = () => {
@@ -2527,14 +2568,14 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2527
2568
  }
2528
2569
  }
2529
2570
  const wrapFarmDocsResponseWithLayouts = async (request, response) => {
2530
- 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")])) {
2571
+ if (request.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !_optionalChain([response, 'access', _172 => _172.headers, 'access', _173 => _173.get, 'call', _174 => _174("content-type"), 'optionalAccess', _175 => _175.toLowerCase, 'call', _176 => _176(), 'access', _177 => _177.includes, 'call', _178 => _178("text/html")])) {
2531
2572
  return response;
2532
2573
  }
2533
2574
  const pathname = new URL(request.url).pathname;
2534
2575
  const matchedRoute = routeManager.matchRoute(pathname);
2535
2576
  const layoutEntries = matchedRoute.layouts.map((layout) => ({
2536
2577
  ...layout,
2537
- metadata: _chunkVO65MYJDcjs.getClientModuleMetadata.call(void 0, layout.modulePath, farmConfig.root)
2578
+ metadata: _chunk2IFT2CSAcjs.getClientModuleMetadata.call(void 0, layout.modulePath, farmConfig.root)
2538
2579
  }));
2539
2580
  if (!layoutEntries.some((layout) => layout.metadata.shouldHydrate)) {
2540
2581
  return response;
@@ -2548,7 +2589,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2548
2589
  headers: response.headers
2549
2590
  });
2550
2591
  }
2551
- const docsRenderer = _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, (_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _174 => _174.getConfig, 'call', _175 => _175()]), () => ( options))).renderer);
2592
+ const docsRenderer = _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, (_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _179 => _179.getConfig, 'call', _180 => _180()]), () => ( options))).renderer);
2552
2593
  const [rendererRuntime, layoutModules] = await Promise.all([
2553
2594
  _chunk67MZTLTFcjs.isReactRenderer.call(void 0, docsRenderer) ? import("./renderer/react/server.cjs") : _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, docsRenderer.server),
2554
2595
  Promise.all(
@@ -2577,7 +2618,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2577
2618
  ])
2578
2619
  );
2579
2620
  const inlineValue = (value) => JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
2580
- const pageModulePath = _optionalChain([matchedRoute, 'access', _176 => _176.route, 'optionalAccess', _177 => _177.modulePath]) ? toUrlPath(matchedRoute.route.modulePath) : "";
2621
+ const pageModulePath = _optionalChain([matchedRoute, 'access', _181 => _181.route, 'optionalAccess', _182 => _182.modulePath]) ? toUrlPath(matchedRoute.route.modulePath) : "";
2581
2622
  const bootstrapScript = `<script>
2582
2623
  window.__FARM_PROPS__ = ${inlineValue({ params })};
2583
2624
  window.__FARM_ROUTE_SLOTS__ = [];
@@ -2674,7 +2715,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2674
2715
  }
2675
2716
  },
2676
2717
  (request) => {
2677
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _178 => _178.getConfig, 'call', _179 => _179()]), () => ( options));
2718
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _183 => _183.getConfig, 'call', _184 => _184()]), () => ( options));
2678
2719
  const currentServerConfig = _chunkCFG4QERRcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
2679
2720
  return _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, request, {
2680
2721
  trustProxy: currentServerConfig.trustProxy
@@ -2690,7 +2731,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2690
2731
  withAPIRequestTracing(async function handleFarmDevRequest(req, res, next) {
2691
2732
  const requestUrl = req.url || "/";
2692
2733
  const requestMethod = req.method || "GET";
2693
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _180 => _180.getConfig, 'call', _181 => _181()]), () => ( options));
2734
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _185 => _185.getConfig, 'call', _186 => _186()]), () => ( options));
2694
2735
  const currentServerConfig = _chunkCFG4QERRcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
2695
2736
  const parsedRequestUrl = _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, {
2696
2737
  trustProxy: currentServerConfig.trustProxy
@@ -2713,7 +2754,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2713
2754
  }
2714
2755
  }
2715
2756
  if (requestMethod === "OPTIONS" && req.headers.origin && req.headers["access-control-request-method"]) {
2716
- const preflightHeaders = _chunkOCNV4CI2cjs.resolveRouteRuleCorsPreflightHeaders.call(void 0,
2757
+ const preflightHeaders = _chunkMQ4DYVFScjs.resolveRouteRuleCorsPreflightHeaders.call(void 0,
2717
2758
  currentConfig.routeRules,
2718
2759
  requestPathname
2719
2760
  );
@@ -2728,7 +2769,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2728
2769
  createRequestFromNodeRequest(req, new URL(fullUrl))
2729
2770
  );
2730
2771
  if (imageResponse) {
2731
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, imageResponse);
2772
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, imageResponse);
2732
2773
  return;
2733
2774
  }
2734
2775
  }
@@ -2784,7 +2825,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2784
2825
  openapi: options.openapi
2785
2826
  },
2786
2827
  workflows: discoveredWorkflows,
2787
- plugins: _optionalChain([pm, 'optionalAccess', _182 => _182.getSortedPlugins, 'call', _183 => _183()])
2828
+ plugins: _optionalChain([pm, 'optionalAccess', _187 => _187.getSortedPlugins, 'call', _188 => _188()])
2788
2829
  });
2789
2830
  res.statusCode = 200;
2790
2831
  res.setHeader(
@@ -2809,15 +2850,65 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2809
2850
  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]));
2810
2851
  const configRewriteSource = req[FARM_DEV_CONFIG_REWRITE_SOURCE];
2811
2852
  const runtimeHookErrorAnswersJSON = rendererDisabled || _chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath);
2812
- if (pm && configRewriteSource === void 0 && !deferredDottedRequests.has(req) && (configRoutePlugins.has(_chunkAKIQ54FKcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME) || configRedirectMatchers.length > 0) && !isViteOwnedRequest()) {
2813
- let redirect = null;
2853
+ const requestedPagePathname = configRewriteSource === void 0 ? requestPathname : new URL(configRewriteSource).pathname;
2854
+ let pageHookRouteMatch;
2855
+ const pageHookRoute = () => {
2856
+ if (pageHookRouteMatch) return pageHookRouteMatch;
2857
+ const pathname2 = requestedPagePathname;
2858
+ const match = farmApp.getRouteManager().matchRoute(pathname2);
2859
+ pageHookRouteMatch = {
2860
+ render: {
2861
+ pathname: pathname2,
2862
+ method: requestMethod,
2863
+ routePattern: _optionalChain([match, 'optionalAccess', _189 => _189.route, 'optionalAccess', _190 => _190.pattern]) || null,
2864
+ params: _optionalChain([match, 'optionalAccess', _191 => _191.params]) || {}
2865
+ },
2866
+ layoutPatterns: (_optionalChain([match, 'optionalAccess', _192 => _192.layouts]) || []).map((layout) => layout.pattern)
2867
+ };
2868
+ return pageHookRouteMatch;
2869
+ };
2870
+ const matchAppMetadataRoute = (pathname2) => {
2871
+ const routeManager3 = farmApp.getRouteManager();
2872
+ const image = routeManager3.matchMetadataImage(pathname2);
2873
+ if (image) return { pattern: image.image.pattern, params: image.params };
2874
+ const metadata = routeManager3.matchMetadataRoute(pathname2);
2875
+ return metadata ? { pattern: metadata.metadata.pattern, params: metadata.params } : null;
2876
+ };
2877
+ const runFarmDevPageHooks = async () => {
2878
+ if (!pm || !pm.hasHook("beforeRouteMatch") && !pm.hasHook("afterRouteMatch") && !pm.hasHook("beforeRender")) {
2879
+ return;
2880
+ }
2881
+ const { render, layoutPatterns } = pageHookRoute();
2882
+ if (matchAppMetadataRoute(render.pathname) || // A path no page route matches is a page only for a GET or HEAD request.
2883
+ !render.routePattern && requestMethod !== "GET" && requestMethod !== "HEAD") {
2884
+ return;
2885
+ }
2886
+ await pm.runHookParallel("beforeRouteMatch", {
2887
+ pathname: render.pathname,
2888
+ method: requestMethod
2889
+ });
2890
+ await pm.runHookParallel("afterRouteMatch", {
2891
+ pathname: render.pathname,
2892
+ matched: Boolean(render.routePattern),
2893
+ routePattern: render.routePattern,
2894
+ params: render.params,
2895
+ layoutPatterns
2896
+ });
2897
+ await pm.runHookParallel("beforeRender", render);
2898
+ };
2899
+ const meetsRequestedURLRoutes = configRewriteSource === void 0 && !deferredDottedRequests.has(req);
2900
+ const routeRedirect = meetsRequestedURLRoutes ? farmApp.getRouteManager().matchRedirect(requestPathname, parsedRequestUrl.search) : null;
2901
+ if (meetsRequestedURLRoutes && (routeRedirect || pm && (configRoutePlugins.has(_chunkMBCRWU3Pcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME) || configRedirectMatchers.length > 0)) && !isViteOwnedRequest()) {
2902
+ let redirect = routeRedirect;
2814
2903
  try {
2815
- await pm.runHookParallelFiltered(
2816
- "beforeRequest",
2817
- (plugin2) => plugin2.name === _chunkAKIQ54FKcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME,
2818
- req,
2819
- res
2820
- );
2904
+ if (pm) {
2905
+ await pm.runHookParallelFiltered(
2906
+ "beforeRequest",
2907
+ (plugin2) => plugin2.name === _chunkMBCRWU3Pcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME,
2908
+ req,
2909
+ res
2910
+ );
2911
+ }
2821
2912
  for (const matchRedirect of configRedirectMatchers) {
2822
2913
  _nullishCoalesce(redirect, () => ( (redirect = matchRedirect(parsedRequestUrl))));
2823
2914
  }
@@ -2835,16 +2926,18 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2835
2926
  status: redirect.statusCode,
2836
2927
  headers: { Location: redirect.destination }
2837
2928
  });
2838
- if (opensFarmDevRuntimeSession(pm)) {
2929
+ if (pm && opensFarmDevRuntimeSession(pm)) {
2839
2930
  const redirectResponse = response;
2840
2931
  try {
2932
+ const metadataRoute = matchAppMetadataRoute(requestPathname);
2933
+ const kind = metadataRoute ? "asset" : _chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath) ? "api" : requestMethod === "GET" || requestMethod === "HEAD" ? "page" : "request";
2841
2934
  response = await pm.runRuntimeRequest(
2842
2935
  createRequestFromNodeRequest(req, parsedRequestUrl),
2843
- () => redirectResponse,
2844
- {
2845
- kind: _chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath) ? "api" : requestMethod === "GET" || requestMethod === "HEAD" ? "page" : "request",
2846
- route: { pathname: requestPathname }
2847
- }
2936
+ async () => {
2937
+ if (kind === "page") await runFarmDevPageHooks();
2938
+ return redirectResponse;
2939
+ },
2940
+ { kind, route: { pathname: requestPathname, ...metadataRoute } }
2848
2941
  );
2849
2942
  } catch (e23) {
2850
2943
  sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
@@ -2852,13 +2945,13 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2852
2945
  return;
2853
2946
  }
2854
2947
  }
2855
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
2948
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
2856
2949
  logResponse(requestMethod, requestUrl, res.statusCode, 0, "PAGE");
2857
2950
  return;
2858
2951
  }
2859
2952
  }
2860
2953
  const runAppMiddlewareForContentRoute = async () => {
2861
- if (!_optionalChain([middlewareManager, 'optionalAccess', _184 => _184.hasMiddleware, 'call', _185 => _185()])) return false;
2954
+ if (!_optionalChain([middlewareManager, 'optionalAccess', _193 => _193.hasMiddleware, 'call', _194 => _194()])) return false;
2862
2955
  const middlewareRequest = createRequestFromNodeRequest(req, new URL(fullUrl));
2863
2956
  return runFarmMiddlewareWithNavigation(
2864
2957
  farmApp.getServerRenderer(),
@@ -2892,11 +2985,11 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2892
2985
  return 500;
2893
2986
  }
2894
2987
  }
2895
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
2988
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
2896
2989
  return response.status;
2897
2990
  };
2898
2991
  const runAppMiddlewareInRuntimeSession = async (runtimeSession2, logResponse2) => {
2899
- const interceptor = runtimeSession2 && _optionalChain([pm, 'optionalAccess', _186 => _186.hasRuntimeHook, 'call', _187 => _187("after")]) && _optionalChain([middlewareManager, 'optionalAccess', _188 => _188.hasMiddleware, 'call', _189 => _189()]) ? interceptFarmDevPageResponse({
2992
+ const interceptor = runtimeSession2 && _optionalChain([pm, 'optionalAccess', _195 => _195.hasRuntimeHook, 'call', _196 => _196("after")]) && _optionalChain([middlewareManager, 'optionalAccess', _197 => _197.hasMiddleware, 'call', _198 => _198()]) ? interceptFarmDevPageResponse({
2900
2993
  req,
2901
2994
  res,
2902
2995
  pm,
@@ -2909,7 +3002,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2909
3002
  urlPath: requestUrl,
2910
3003
  pathname: requestPathname,
2911
3004
  startTime: Date.now(),
2912
- logResponse: (_method, _path, status) => _optionalChain([logResponse2, 'optionalCall', _190 => _190(status)]),
3005
+ logResponse: (_method, _path, status) => _optionalChain([logResponse2, 'optionalCall', _199 => _199(status)]),
2913
3006
  // The runtime reports a runtime.after failure itself.
2914
3007
  emitError: async () => {
2915
3008
  },
@@ -2920,7 +3013,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2920
3013
  handled = await runAppMiddlewareForContentRoute();
2921
3014
  } catch (error) {
2922
3015
  if (runtimeHookErrorAnswersJSON || res.headersSent) {
2923
- _optionalChain([interceptor, 'optionalAccess', _191 => _191.release, 'call', _192 => _192()]);
3016
+ _optionalChain([interceptor, 'optionalAccess', _200 => _200.release, 'call', _201 => _201()]);
2924
3017
  throw error;
2925
3018
  }
2926
3019
  if (runtimeSession2) await pm.reportRuntimeRequestError(runtimeSession2, error);
@@ -2928,10 +3021,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2928
3021
  return true;
2929
3022
  }
2930
3023
  if (!handled) {
2931
- _optionalChain([interceptor, 'optionalAccess', _193 => _193.release, 'call', _194 => _194()]);
3024
+ _optionalChain([interceptor, 'optionalAccess', _202 => _202.release, 'call', _203 => _203()]);
2932
3025
  return false;
2933
3026
  }
2934
- if (!_optionalChain([interceptor, 'optionalAccess', _195 => _195.isEnded, 'call', _196 => _196()])) _optionalChain([logResponse2, 'optionalCall', _197 => _197(res.statusCode || 200)]);
3027
+ if (!_optionalChain([interceptor, 'optionalAccess', _204 => _204.isEnded, 'call', _205 => _205()])) _optionalChain([logResponse2, 'optionalCall', _206 => _206(res.statusCode || 200)]);
2935
3028
  return true;
2936
3029
  };
2937
3030
  const serveBuiltInRoute = async (respond, {
@@ -2940,7 +3033,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2940
3033
  label
2941
3034
  } = {}) => {
2942
3035
  const discard = async () => {
2943
- await _optionalChain([computed, 'optionalAccess', _198 => _198.body, 'optionalAccess', _199 => _199.cancel, 'call', _200 => _200(), 'access', _201 => _201.catch, 'call', _202 => _202(() => {
3036
+ await _optionalChain([computed, 'optionalAccess', _207 => _207.body, 'optionalAccess', _208 => _208.cancel, 'call', _209 => _209(), 'access', _210 => _210.catch, 'call', _211 => _211(() => {
2944
3037
  })]);
2945
3038
  };
2946
3039
  const sendRuntimeResponse = async (runtimeSession3, response2) => {
@@ -2951,15 +3044,15 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2951
3044
  sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
2952
3045
  return;
2953
3046
  }
2954
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, runtimeResponse);
3047
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, runtimeResponse);
2955
3048
  };
2956
3049
  let runtimeSession2;
2957
3050
  if (pm && opensFarmDevRuntimeSession(pm)) {
2958
3051
  try {
2959
3052
  const routePathname = _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath);
2960
- const route = _chunkGQ6QOH7Tcjs.setFarmRouteLabel.call(void 0,
3053
+ const route = _chunkSXMWVP2Lcjs.setFarmRouteLabel.call(void 0,
2961
3054
  { pathname: requestPathname },
2962
- label !== void 0 ? label : devBuiltInRoutePaths.has(routePathname) ? routePathname : _chunkGQ6QOH7Tcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath)
3055
+ label !== void 0 ? label : devBuiltInRoutePaths.has(routePathname) ? routePathname : _chunkSXMWVP2Lcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath)
2963
3056
  );
2964
3057
  runtimeSession2 = await pm.beginRuntimeRequest(
2965
3058
  createRequestFromNodeRequest(req, new URL(fullUrl)),
@@ -2977,6 +3070,16 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2977
3070
  }
2978
3071
  pm.copyRequestContext(runtimeSession2.request, req);
2979
3072
  applyWebRequestToNodeRequest(runtimeSession2.request, req);
3073
+ if (kind === "page") {
3074
+ try {
3075
+ await runFarmDevPageHooks();
3076
+ } catch (error) {
3077
+ await discard();
3078
+ await pm.failRuntimeRequest(runtimeSession2, error);
3079
+ sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
3080
+ return;
3081
+ }
3082
+ }
2980
3083
  }
2981
3084
  let response;
2982
3085
  let responding = false;
@@ -2987,7 +3090,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2987
3090
  }
2988
3091
  responding = true;
2989
3092
  response = await respond(
2990
- _nullishCoalesce(_optionalChain([runtimeSession2, 'optionalAccess', _203 => _203.request]), () => ( createRequestFromNodeRequest(req, new URL(fullUrl))))
3093
+ _nullishCoalesce(_optionalChain([runtimeSession2, 'optionalAccess', _212 => _212.request]), () => ( createRequestFromNodeRequest(req, new URL(fullUrl))))
2991
3094
  );
2992
3095
  } catch (error) {
2993
3096
  if (!responding && !res.headersSent) {
@@ -3004,10 +3107,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3004
3107
  }
3005
3108
  if (!response) return;
3006
3109
  if (runtimeSession2) await sendRuntimeResponse(runtimeSession2, response);
3007
- else await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
3110
+ else await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
3008
3111
  };
3009
3112
  const openAPIRequestPathname = openAPIManager ? _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) : requestPathname;
3010
- if (openAPIManager && _optionalChain([options, 'access', _204 => _204.openapi, 'optionalAccess', _205 => _205.specRoute]) && openAPIRequestPathname === options.openapi.specRoute) {
3113
+ if (openAPIManager && _optionalChain([options, 'access', _213 => _213.openapi, 'optionalAccess', _214 => _214.specRoute]) && openAPIRequestPathname === options.openapi.specRoute) {
3011
3114
  const specManager = openAPIManager;
3012
3115
  await serveBuiltInRoute(async () => {
3013
3116
  if (requestMethod !== "GET" && requestMethod !== "HEAD") {
@@ -3027,7 +3130,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3027
3130
  });
3028
3131
  return;
3029
3132
  }
3030
- if (openAPIManager && openAPIRequestPathname === _optionalChain([options, 'access', _206 => _206.openapi, 'optionalAccess', _207 => _207.route])) {
3133
+ if (openAPIManager && openAPIRequestPathname === _optionalChain([options, 'access', _215 => _215.openapi, 'optionalAccess', _216 => _216.route])) {
3031
3134
  const docsManager = openAPIManager;
3032
3135
  await serveBuiltInRoute(
3033
3136
  async () => {
@@ -3038,24 +3141,24 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3038
3141
  );
3039
3142
  return;
3040
3143
  }
3041
- if (_optionalChain([options, 'access', _208 => _208.agent, 'optionalAccess', _209 => _209.manifest]) !== false && _chunkGQ6QOH7Tcjs.isFarmAppManifestPath.call(void 0, _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath))) {
3144
+ if (_optionalChain([options, 'access', _217 => _217.agent, 'optionalAccess', _218 => _218.manifest]) !== false && _chunkSXMWVP2Lcjs.isFarmAppManifestPath.call(void 0, _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath))) {
3042
3145
  await serveBuiltInRoute(async () => {
3043
- _nullishCoalesce(farmAppPackages, () => ( (farmAppPackages = _chunkDHR2WDSLcjs.resolveFarmAppPackages.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd()))))));
3044
- const manifest = await _chunkGQ6QOH7Tcjs.createFarmAppManifestResponse.call(void 0,
3146
+ _nullishCoalesce(farmAppPackages, () => ( (farmAppPackages = _chunkKWST2O22cjs.resolveFarmAppPackages.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd()))))));
3147
+ const manifest = await _chunkSXMWVP2Lcjs.createFarmAppManifestResponse.call(void 0,
3045
3148
  new Request(parsedRequestUrl, {
3046
3149
  method: requestMethod,
3047
3150
  headers: { "if-none-match": String(_nullishCoalesce(req.headers["if-none-match"], () => ( ""))) }
3048
3151
  }),
3049
3152
  {
3050
- ..._chunkGQ6QOH7Tcjs.resolveFarmAppManifestInput.call(void 0, farmConfig, {
3153
+ ..._chunkSXMWVP2Lcjs.resolveFarmAppManifestInput.call(void 0, farmConfig, {
3051
3154
  build: "development",
3052
3155
  packages: farmAppPackages,
3053
3156
  // Read again on each request; unchanged files come from a cache.
3054
- webmcpTools: _optionalChain([farmConfig, 'access', _210 => _210.plugins, 'optionalAccess', _211 => _211.some, 'call', _212 => _212(({ name }) => name === "farm:webmcp")]) ? _chunkDHR2WDSLcjs.collectFarmWebMCPTools.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd())), farmConfig.srcDir) : []
3157
+ webmcpTools: _optionalChain([farmConfig, 'access', _219 => _219.plugins, 'optionalAccess', _220 => _220.some, 'call', _221 => _221(({ name }) => name === "farm:webmcp")]) ? _chunkKWST2O22cjs.collectFarmWebMCPTools.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd())), farmConfig.srcDir) : []
3055
3158
  }),
3056
3159
  defaultMCP: () => farmApp.getServerRenderer().getDefaultMCPServer(),
3057
3160
  // A guard written for an MCP server's path keeps its tools out of the public view.
3058
- guardCoversPath: (path7) => _chunkUPOYKX4Scjs.farmPathGuardCoversEndpoint.call(void 0,
3161
+ guardCoversPath: (path7) => _chunk2MR4MABGcjs.farmPathGuardCoversEndpoint.call(void 0,
3059
3162
  {
3060
3163
  config: farmConfig,
3061
3164
  middlewareRoutes: middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
@@ -3069,11 +3172,11 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3069
3172
  });
3070
3173
  return;
3071
3174
  }
3072
- if (_optionalChain([options, 'access', _213 => _213.agent, 'optionalAccess', _214 => _214.apiCatalog]) && _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) === _chunkGQ6QOH7Tcjs.FARM_API_CATALOG_PATH) {
3175
+ if (_optionalChain([options, 'access', _222 => _222.agent, 'optionalAccess', _223 => _223.apiCatalog]) && _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) === _chunkSXMWVP2Lcjs.FARM_API_CATALOG_PATH) {
3073
3176
  await serveBuiltInRoute(
3074
- () => _chunkGQ6QOH7Tcjs.createFarmApiCatalogResponse.call(void 0,
3177
+ () => _chunkSXMWVP2Lcjs.createFarmApiCatalogResponse.call(void 0,
3075
3178
  requestMethod,
3076
- _chunkGQ6QOH7Tcjs.resolveFarmApiCatalogInput.call(void 0, { ...options, api: farmConfig.api }),
3179
+ _chunkSXMWVP2Lcjs.resolveFarmApiCatalogInput.call(void 0, { ...options, api: farmConfig.api }),
3077
3180
  new Request(parsedRequestUrl, {
3078
3181
  headers: { "user-agent": String(_nullishCoalesce(req.headers["user-agent"], () => ( ""))) }
3079
3182
  })
@@ -3081,8 +3184,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3081
3184
  );
3082
3185
  return;
3083
3186
  }
3084
- if (_optionalChain([options, 'access', _215 => _215.agent, 'optionalAccess', _216 => _216.aiCatalog]) !== false) {
3085
- const aiCatalog = _chunkGQ6QOH7Tcjs.createFarmAiCatalogResponse.call(void 0,
3187
+ if (_optionalChain([options, 'access', _224 => _224.agent, 'optionalAccess', _225 => _225.aiCatalog]) !== false) {
3188
+ const aiCatalog = _chunkSXMWVP2Lcjs.createFarmAiCatalogResponse.call(void 0,
3086
3189
  new Request(parsedRequestUrl, {
3087
3190
  method: requestMethod,
3088
3191
  headers: {
@@ -3125,16 +3228,36 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3125
3228
  const docsBodyInit = requestMethod === "GET" || requestMethod === "HEAD" ? {} : { body: _chunkCFG4QERRcjs.createFarmNodeRequestBodyStream.call(void 0, req), duplex: "half" };
3126
3229
  const docsResponse = await farmDocsHandler(new Request(docsRequest, docsBodyInit));
3127
3230
  if (docsResponse) {
3231
+ const docsPage = _optionalChain([docsResponse, 'access', _226 => _226.headers, 'access', _227 => _227.get, 'call', _228 => _228("content-type"), 'optionalAccess', _229 => _229.toLowerCase, 'call', _230 => _230(), 'access', _231 => _231.includes, 'call', _232 => _232("text/html")]);
3128
3232
  await serveBuiltInRoute(
3129
- () => wrapFarmDocsResponseWithLayouts(docsRequest, docsResponse),
3233
+ async (request) => {
3234
+ if (!docsPage) return wrapFarmDocsResponseWithLayouts(docsRequest, docsResponse);
3235
+ const deploymentMismatch = _chunkNLBHLPEOcjs.getFarmDeploymentMismatch.call(void 0,
3236
+ request,
3237
+ farmConfig.deploymentId
3238
+ );
3239
+ if (deploymentMismatch) {
3240
+ await _optionalChain([docsResponse, 'access', _233 => _233.body, 'optionalAccess', _234 => _234.cancel, 'call', _235 => _235()]);
3241
+ return _chunkNLBHLPEOcjs.createFarmDeploymentMismatchResponse.call(void 0, deploymentMismatch);
3242
+ }
3243
+ return _chunkNLBHLPEOcjs.withFarmDeploymentResponse.call(void 0,
3244
+ await wrapFarmDocsResponseWithLayouts(docsRequest, docsResponse),
3245
+ farmConfig.deploymentId,
3246
+ {
3247
+ setCookie: request.method.toUpperCase() === "GET",
3248
+ cookiePath: farmConfig.basePath || "/",
3249
+ secureCookie: new URL(request.url).protocol === "https:"
3250
+ }
3251
+ );
3252
+ },
3130
3253
  {
3131
3254
  kind: "docs",
3132
3255
  computed: docsResponse,
3133
- label: _chunkGQ6QOH7Tcjs.resolveFarmDocsEngineRouteLabel.call(void 0,
3256
+ label: _chunkSXMWVP2Lcjs.resolveFarmDocsEngineRouteLabel.call(void 0,
3134
3257
  _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath),
3135
3258
  {
3136
- path: _optionalChain([farmConfig, 'access', _217 => _217.docs, 'optionalAccess', _218 => _218.entry]) || "/docs",
3137
- roots: _optionalChain([farmConfig, 'access', _219 => _219.docs, 'optionalAccess', _220 => _220.roots, 'optionalAccess', _221 => _221.map, 'call', _222 => _222((root) => root.entry)]),
3259
+ path: _optionalChain([farmConfig, 'access', _236 => _236.docs, 'optionalAccess', _237 => _237.entry]) || "/docs",
3260
+ roots: _optionalChain([farmConfig, 'access', _238 => _238.docs, 'optionalAccess', _239 => _239.roots, 'optionalAccess', _240 => _240.map, 'call', _241 => _241((root) => root.entry)]),
3138
3261
  pages: await getFarmDocsPagePaths()
3139
3262
  }
3140
3263
  )
@@ -3143,8 +3266,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3143
3266
  return;
3144
3267
  }
3145
3268
  }
3146
- if (options.mobileClient && !viteModuleRequest && (requestMethod === "GET" || requestMethod === "HEAD" || requestMethod === "POST") && _optionalChain([req, 'access', _223 => _223.headers, 'access', _224 => _224.accept, 'optionalAccess', _225 => _225.includes, 'call', _226 => _226(_chunk3HLQTOVUcjs.FARM_NATIVE_TREE_CONTENT_TYPE)])) {
3147
- const { createFarmNativeTreeResponse } = await import("./native-tree-W2SSJB3Y.cjs");
3269
+ if (options.mobileClient && !viteModuleRequest && (requestMethod === "GET" || requestMethod === "HEAD" || requestMethod === "POST") && _optionalChain([req, 'access', _242 => _242.headers, 'access', _243 => _243.accept, 'optionalAccess', _244 => _244.includes, 'call', _245 => _245(_chunk3HLQTOVUcjs.FARM_NATIVE_TREE_CONTENT_TYPE)])) {
3270
+ const { createFarmNativeTreeResponse } = await import("./native-tree-GF4BH33L.cjs");
3148
3271
  const treeBodyInit = requestMethod === "POST" ? { body: _chunkCFG4QERRcjs.createFarmNodeRequestBodyStream.call(void 0, req), duplex: "half" } : {};
3149
3272
  const treeResponse = await createFarmNativeTreeResponse({
3150
3273
  request: new Request(fullUrl, {
@@ -3161,18 +3284,18 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3161
3284
  });
3162
3285
  await serveBuiltInRoute(() => treeResponse, {
3163
3286
  computed: treeResponse,
3164
- label: _nullishCoalesce(_optionalChain([farmApp, 'access', _227 => _227.getRouteManager, 'call', _228 => _228(), 'access', _229 => _229.matchRoute, 'call', _230 => _230(_chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath)), 'access', _231 => _231.route, 'optionalAccess', _232 => _232.pattern]), () => ( null))
3287
+ label: _nullishCoalesce(_optionalChain([farmApp, 'access', _246 => _246.getRouteManager, 'call', _247 => _247(), 'access', _248 => _248.matchRoute, 'call', _249 => _249(_chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath)), 'access', _250 => _250.route, 'optionalAccess', _251 => _251.pattern]), () => ( null))
3165
3288
  });
3166
3289
  return;
3167
3290
  }
3168
3291
  const markdownRouteLabel = () => (
3169
3292
  // On the route path, as production labels it: /fr/index.md is /index.md.
3170
- _chunkGQ6QOH7Tcjs.resolveFarmMarkdownRouteLabel.call(void 0,
3293
+ _chunkSXMWVP2Lcjs.resolveFarmMarkdownRouteLabel.call(void 0,
3171
3294
  toRoutePathname(requestPathname),
3172
- (page) => _optionalChain([farmApp, 'access', _233 => _233.getRouteManager, 'call', _234 => _234(), 'access', _235 => _235.matchRoute, 'call', _236 => _236(page), 'access', _237 => _237.route, 'optionalAccess', _238 => _238.pattern])
3295
+ (page) => _optionalChain([farmApp, 'access', _252 => _252.getRouteManager, 'call', _253 => _253(), 'access', _254 => _254.matchRoute, 'call', _255 => _255(page), 'access', _256 => _256.route, 'optionalAccess', _257 => _257.pattern])
3173
3296
  )
3174
3297
  );
3175
- const markdownSourceResponse = viteModuleRequest ? null : await _chunk3EEINK7Gcjs.createFarmMarkdownSourceResponse.call(void 0, {
3298
+ const markdownSourceResponse = viteModuleRequest ? null : await _chunkL6E4SHUBcjs.createFarmMarkdownSourceResponse.call(void 0, {
3176
3299
  request: new Request(fullUrl, {
3177
3300
  method: requestMethod,
3178
3301
  headers: docsHeaders
@@ -3181,7 +3304,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3181
3304
  routePathname: toRoutePathname,
3182
3305
  resolveSource: async (pathname2) => {
3183
3306
  const match = farmApp.getRouteManager().matchRoute(pathname2);
3184
- const sourcePath = _optionalChain([match, 'access', _239 => _239.route, 'optionalAccess', _240 => _240.markdownSourcePath]) || (match.route && _chunk3EEINK7Gcjs.isFarmMarkdownPageFile.call(void 0, match.route.modulePath) ? match.route.modulePath : null);
3307
+ const sourcePath = _optionalChain([match, 'access', _258 => _258.route, 'optionalAccess', _259 => _259.markdownSourcePath]) || (match.route && _chunkL6E4SHUBcjs.isFarmMarkdownPageFile.call(void 0, match.route.modulePath) ? match.route.modulePath : null);
3185
3308
  if (!sourcePath) {
3186
3309
  return null;
3187
3310
  }
@@ -3192,11 +3315,18 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3192
3315
  },
3193
3316
  // The anonymous check goes through this server, so its guards and
3194
3317
  // middleware see the page's own path, as in production. It connects to
3195
- // this server's own listener, never the host the caller's Host names.
3318
+ // this server's own listener, never the host the caller's Host names. The
3319
+ // page is asked for at the URL it answers at, not through the trailing-slash 308.
3196
3320
  renderPage: async (request) => _chunkBNH53KOTcjs.createFarmDevServerDispatch.call(void 0, server)(
3197
- new Request(request, {
3198
- signal: res.destroyed ? AbortSignal.abort() : _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3199
- })
3321
+ new Request(
3322
+ _chunkDVJM55D2cjs.toFarmTrailingSlashPageRequest.call(void 0,
3323
+ request,
3324
+ farmApp.getConfig().trailingSlash === true
3325
+ ),
3326
+ {
3327
+ signal: res.destroyed ? AbortSignal.abort() : _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3328
+ }
3329
+ )
3200
3330
  )
3201
3331
  });
3202
3332
  if (markdownSourceResponse) {
@@ -3206,7 +3336,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3206
3336
  });
3207
3337
  return;
3208
3338
  }
3209
- const markdownResponse = viteModuleRequest ? null : await _chunkFT6KJHS3cjs.createMarkdownMirrorResponse.call(void 0, {
3339
+ const markdownResponse = viteModuleRequest ? null : await _chunkC2JOS77Zcjs.createMarkdownMirrorResponse.call(void 0, {
3210
3340
  request: new Request(fullUrl, {
3211
3341
  method: requestMethod,
3212
3342
  headers: docsHeaders
@@ -3216,17 +3346,24 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3216
3346
  routeExists: (pathname2) => Boolean(farmApp.getRouteManager().matchRoute(pathname2).route),
3217
3347
  // The page is rendered by this server's own listener, never the host the
3218
3348
  // caller's Host names. Redirects are not followed, so the mirror answers with
3219
- // the page's own (a sign-in gate, say), as production does.
3349
+ // the page's own (a sign-in gate, say), as production does. The page is read
3350
+ // at the URL it answers at ('/about/' with trailingSlash), not through the 308.
3220
3351
  renderPage: async (request) => {
3221
3352
  const headers = new Headers(request.headers);
3222
3353
  headers.delete("accept-encoding");
3223
3354
  return _chunkBNH53KOTcjs.createFarmDevServerDispatch.call(void 0, server)(
3224
- new Request(request, {
3225
- headers,
3226
- // Only accepted mirrors need disconnect listeners. An earlier
3227
- // close (for example while the docs handler ran) must also abort.
3228
- signal: res.destroyed ? AbortSignal.abort() : _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3229
- })
3355
+ new Request(
3356
+ _chunkDVJM55D2cjs.toFarmTrailingSlashPageRequest.call(void 0,
3357
+ request,
3358
+ farmApp.getConfig().trailingSlash === true
3359
+ ),
3360
+ {
3361
+ headers,
3362
+ // Only accepted mirrors need disconnect listeners. An earlier
3363
+ // close (for example while the docs handler ran) must also abort.
3364
+ signal: res.destroyed ? AbortSignal.abort() : _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3365
+ }
3366
+ )
3230
3367
  );
3231
3368
  },
3232
3369
  apiServerBasePath
@@ -3238,16 +3375,16 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3238
3375
  });
3239
3376
  return;
3240
3377
  }
3241
- if (!viteModuleRequest && _chunkFT6KJHS3cjs.farmRequestWantsMarkdown.call(void 0, requestPathname, req.headers.accept)) {
3242
- const markdownRoute = farmApp.getRouteManager().matchRoute(_chunk3EEINK7Gcjs.normalizeFarmMarkdownRoutePath.call(void 0, requestPathname, toRoutePathname));
3378
+ if (!viteModuleRequest && _chunkC2JOS77Zcjs.farmRequestWantsMarkdown.call(void 0, requestPathname, req.headers.accept)) {
3379
+ const markdownRoute = farmApp.getRouteManager().matchRoute(_chunkL6E4SHUBcjs.normalizeFarmMarkdownRoutePath.call(void 0, requestPathname, toRoutePathname));
3243
3380
  if (!markdownRoute.route) {
3244
3381
  await serveBuiltInRoute(
3245
3382
  () => new Response(
3246
- _chunkFT6KJHS3cjs.createFarmMarkdownErrorBody.call(void 0, 404, requestPathname, farmConfig.basePath || "/"),
3383
+ _chunkC2JOS77Zcjs.createFarmMarkdownErrorBody.call(void 0, 404, requestPathname, farmConfig.basePath || "/"),
3247
3384
  {
3248
3385
  status: 404,
3249
3386
  headers: {
3250
- "Content-Type": _chunkFT6KJHS3cjs.FARM_MARKDOWN_CONTENT_TYPE,
3387
+ "Content-Type": _chunkC2JOS77Zcjs.FARM_MARKDOWN_CONTENT_TYPE,
3251
3388
  "X-Farm-Markdown-Error": "404",
3252
3389
  "Cache-Control": "no-store"
3253
3390
  }
@@ -3257,7 +3394,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3257
3394
  return;
3258
3395
  }
3259
3396
  }
3260
- const markdownPageTarget = _chunkFT6KJHS3cjs.resolveMarkdownMirrorTarget.call(void 0,
3397
+ const markdownPageTarget = _chunkC2JOS77Zcjs.resolveMarkdownMirrorTarget.call(void 0,
3261
3398
  farmApp.getConfig().md,
3262
3399
  requestPathname,
3263
3400
  {
@@ -3290,7 +3427,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3290
3427
  } catch (error) {
3291
3428
  const response = _chunkCFG4QERRcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
3292
3429
  if (!response) throw error;
3293
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
3430
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
3294
3431
  return;
3295
3432
  }
3296
3433
  const workflowResponse = await workflowHandler(
@@ -3302,13 +3439,13 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3302
3439
  })
3303
3440
  );
3304
3441
  if (workflowResponse) {
3305
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, workflowResponse);
3442
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, workflowResponse);
3306
3443
  return;
3307
3444
  }
3308
3445
  }
3309
3446
  const configuredIntegrations = currentConfig.integrations;
3310
3447
  const tryConfiguredIntegrationRoute = async () => {
3311
- const matchedRoute = _chunkBDYM2TN3cjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
3448
+ const matchedRoute = _chunkJX5VOLAVcjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
3312
3449
  pathname: requestPathname,
3313
3450
  method: requestMethod
3314
3451
  });
@@ -3322,8 +3459,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3322
3459
  await pm.runHookParallelFiltered(
3323
3460
  "beforeRequest",
3324
3461
  (plugin2) => {
3325
- const owner = _chunkBDYM2TN3cjs.getFarmIntegrationPluginOwner.call(void 0, plugin2);
3326
- return !isFarmConfigRoutePlugin(plugin2) && (_optionalChain([owner, 'optionalAccess', _241 => _241.source]) !== "lifecycle" || owner.key !== matchedRoute.key);
3462
+ const owner = _chunkJX5VOLAVcjs.getFarmIntegrationPluginOwner.call(void 0, plugin2);
3463
+ return !isFarmConfigRoutePlugin(plugin2) && (_optionalChain([owner, 'optionalAccess', _260 => _260.source]) !== "lifecycle" || owner.key !== matchedRoute.key);
3327
3464
  },
3328
3465
  req,
3329
3466
  res
@@ -3352,7 +3489,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3352
3489
  });
3353
3490
  const dispatchIntegration = async (request, runtime) => {
3354
3491
  try {
3355
- const result = await _chunkBDYM2TN3cjs.dispatchIntegrationRequest.call(void 0,
3492
+ const result = await _chunkJX5VOLAVcjs.dispatchIntegrationRequest.call(void 0,
3356
3493
  {
3357
3494
  integration: matchedRoute.integration,
3358
3495
  config: currentConfig,
@@ -3360,7 +3497,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3360
3497
  isProd: false
3361
3498
  },
3362
3499
  request,
3363
- { clientAddress: _optionalChain([req, 'access', _242 => _242.socket, 'optionalAccess', _243 => _243.remoteAddress]) }
3500
+ { clientAddress: _optionalChain([req, 'access', _261 => _261.socket, 'optionalAccess', _262 => _262.remoteAddress]) }
3364
3501
  );
3365
3502
  if (!result) {
3366
3503
  throw new Error(`Matched integration route did not return a response`);
@@ -3368,7 +3505,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3368
3505
  return result;
3369
3506
  } catch (error) {
3370
3507
  _chunkQMNWKQL4cjs.logger.error(`Integration route error: ${error}`);
3371
- await _optionalChain([runtime, 'optionalAccess', _244 => _244.reportError, 'call', _245 => _245(error)]);
3508
+ await _optionalChain([runtime, 'optionalAccess', _263 => _263.reportError, 'call', _264 => _264(error)]);
3372
3509
  return _chunkXGTFLG73cjs.createFarmInternalServerErrorResponse.call(void 0, );
3373
3510
  }
3374
3511
  };
@@ -3385,12 +3522,12 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3385
3522
  }
3386
3523
  const duration = Date.now() - startTime2;
3387
3524
  logResponse(requestMethod, requestUrl, response.status, duration, "API");
3388
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
3525
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
3389
3526
  return true;
3390
3527
  } catch (error) {
3391
3528
  const bodyErrorResponse = _chunkCFG4QERRcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
3392
3529
  if (bodyErrorResponse) {
3393
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3530
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3394
3531
  return true;
3395
3532
  }
3396
3533
  const duration = Date.now() - startTime2;
@@ -3404,7 +3541,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3404
3541
  });
3405
3542
  }
3406
3543
  _chunkQMNWKQL4cjs.logger.error(`Integration route error: ${error}`);
3407
- if (!res.writableEnded) {
3544
+ if (runtimeReportsErrors) {
3545
+ if (!res.headersSent) sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
3546
+ else if (!res.writableEnded) res.end();
3547
+ } else if (!res.writableEnded) {
3408
3548
  res.statusCode = 500;
3409
3549
  res.setHeader("Content-Type", "application/json");
3410
3550
  res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
@@ -3412,20 +3552,20 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3412
3552
  return true;
3413
3553
  }
3414
3554
  };
3415
- if (pm && configRewriteSource === void 0 && configRoutePlugins.has(_chunkAKIQ54FKcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME)) {
3555
+ if (pm && configRewriteSource === void 0 && configRoutePlugins.has(_chunkMBCRWU3Pcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME)) {
3416
3556
  const hasLocalDevRoute = () => {
3417
3557
  const routeManager3 = farmApp.getRouteManager();
3418
3558
  return Boolean(
3419
- _chunkBDYM2TN3cjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
3559
+ _chunkJX5VOLAVcjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
3420
3560
  pathname: requestPathname,
3421
3561
  method: requestMethod
3422
- }) || routeManager3.matchRedirect(requestPathname) || apiRouteManager.matchRoute(requestPathname) || farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _246 => _246.isFarmDocsAPIRequest, 'call', _247 => _247(requestPathname)]) || routeManager3.matchRoute(requestPathname).route || routeManager3.matchMetadataRoute(requestPathname) || routeManager3.matchMetadataImage(requestPathname)
3562
+ }) || routeManager3.matchRedirect(requestPathname) || apiRouteManager.matchRoute(requestPathname) || farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _265 => _265.isFarmDocsAPIRequest, 'call', _266 => _266(requestPathname)]) || routeManager3.matchRoute(requestPathname).route || routeManager3.matchMetadataRoute(requestPathname) || routeManager3.matchMetadataImage(requestPathname)
3423
3563
  );
3424
3564
  };
3425
3565
  try {
3426
3566
  await pm.runHookParallelFiltered(
3427
3567
  "beforeRequest",
3428
- (plugin2) => plugin2.name === _chunkAKIQ54FKcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME,
3568
+ (plugin2) => plugin2.name === _chunkMBCRWU3Pcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME,
3429
3569
  req,
3430
3570
  res
3431
3571
  );
@@ -3451,13 +3591,6 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3451
3591
  if (await tryConfiguredIntegrationRoute()) {
3452
3592
  return;
3453
3593
  }
3454
- const redirectMatch = farmApp.getRouteManager().matchRedirect(requestPathname, parsedRequestUrl.search);
3455
- if (redirectMatch) {
3456
- res.statusCode = redirectMatch.statusCode;
3457
- res.setHeader("Location", redirectMatch.destination);
3458
- res.end(`Redirecting to ${redirectMatch.destination}`);
3459
- return;
3460
- }
3461
3594
  const matchedApiRoute = apiRouteManager.matchRoute(requestPathname);
3462
3595
  const hasMatchedApiRoute = Boolean(matchedApiRoute);
3463
3596
  if (hasMatchedApiRoute || _chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath)) {
@@ -3511,15 +3644,15 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3511
3644
  });
3512
3645
  };
3513
3646
  const isDocsAPIRequest = Boolean(
3514
- farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _248 => _248.isFarmDocsAPIRequest, 'call', _249 => _249(pathname2)])
3647
+ farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _267 => _267.isFarmDocsAPIRequest, 'call', _268 => _268(pathname2)])
3515
3648
  );
3516
3649
  const docsRuntimeOptions = () => ({
3517
3650
  kind: "docs",
3518
- route: _chunkGQ6QOH7Tcjs.setFarmRouteLabel.call(void 0,
3651
+ route: _chunkSXMWVP2Lcjs.setFarmRouteLabel.call(void 0,
3519
3652
  { pathname: pathname2, pattern: urlPath2 },
3520
- _chunkGQ6QOH7Tcjs.resolveFarmDocsRouteLabel.call(void 0, pathname2, {
3521
- path: _optionalChain([farmConfig, 'access', _250 => _250.docs, 'optionalAccess', _251 => _251.entry]) || "/docs",
3522
- roots: _optionalChain([farmConfig, 'access', _252 => _252.docs, 'optionalAccess', _253 => _253.roots, 'optionalAccess', _254 => _254.map, 'call', _255 => _255((root) => root.entry)])
3653
+ _chunkSXMWVP2Lcjs.resolveFarmDocsRouteLabel.call(void 0, pathname2, {
3654
+ path: _optionalChain([farmConfig, 'access', _269 => _269.docs, 'optionalAccess', _270 => _270.entry]) || "/docs",
3655
+ roots: _optionalChain([farmConfig, 'access', _271 => _271.docs, 'optionalAccess', _272 => _272.roots, 'optionalAccess', _273 => _273.map, 'call', _274 => _274((root) => root.entry)])
3523
3656
  })
3524
3657
  )
3525
3658
  });
@@ -3540,7 +3673,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3540
3673
  runtimeSession2.response
3541
3674
  );
3542
3675
  logResponse(method2, urlPath2, response.status, Date.now() - startTime2, "API");
3543
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
3676
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
3544
3677
  return;
3545
3678
  }
3546
3679
  } catch (error) {
@@ -3553,7 +3686,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3553
3686
  Date.now() - startTime2,
3554
3687
  "API"
3555
3688
  );
3556
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3689
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3557
3690
  return;
3558
3691
  }
3559
3692
  _chunkQMNWKQL4cjs.logger.error(`API route error: ${error}`);
@@ -3601,7 +3734,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3601
3734
  const routedApiRoute = rewritten ? apiRouteManager.matchRoute(routedPathname) : matchedApiRoute || apiRouteManager.matchRoute(pathname2);
3602
3735
  const hasExplicitAPIRoute = Boolean(routedApiRoute);
3603
3736
  if (apiHandler && hasExplicitAPIRoute) {
3604
- const apiRoutePattern = _optionalChain([routedApiRoute, 'optionalAccess', _256 => _256.route, 'access', _257 => _257.path]) || urlPath2;
3737
+ const apiRoutePattern = _optionalChain([routedApiRoute, 'optionalAccess', _275 => _275.route, 'access', _276 => _276.path]) || urlPath2;
3605
3738
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
3606
3739
  type: "route.matched",
3607
3740
  pathname: pathname2,
@@ -3613,6 +3746,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3613
3746
  route: apiRoutePattern,
3614
3747
  method: method2
3615
3748
  });
3749
+ let apiOutcomeReported = false;
3616
3750
  try {
3617
3751
  const url = `http://${req.headers.host || "localhost:3000"}${req.url}`;
3618
3752
  const request = await createHandlerRequest();
@@ -3621,7 +3755,6 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3621
3755
  method: method2,
3622
3756
  routePath: apiRoutePattern
3623
3757
  };
3624
- let apiHandlerFailed = false;
3625
3758
  const invokeAPIHandler = async (runtimeRequest, runtime) => {
3626
3759
  const handledRequest = pm ? await pm.runHookSerial(
3627
3760
  "beforeApiHandler",
@@ -3631,8 +3764,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3631
3764
  let response;
3632
3765
  try {
3633
3766
  response = await apiHandler(handledRequest);
3767
+ apiOutcomeReported = true;
3768
+ _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
3769
+ type: "api.request.complete",
3770
+ pathname: pathname2,
3771
+ route: apiRoutePattern,
3772
+ method: method2,
3773
+ status: response.status,
3774
+ durationMs: Date.now() - startTime2
3775
+ });
3634
3776
  } catch (error) {
3635
- apiHandlerFailed = true;
3777
+ apiOutcomeReported = true;
3636
3778
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
3637
3779
  type: "api.error",
3638
3780
  pathname: pathname2,
@@ -3642,7 +3784,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3642
3784
  error
3643
3785
  });
3644
3786
  _chunkQMNWKQL4cjs.logger.error(`API route error: ${error}`);
3645
- await _optionalChain([runtime, 'optionalAccess', _258 => _258.reportError, 'call', _259 => _259(error)]);
3787
+ await _optionalChain([runtime, 'optionalAccess', _277 => _277.reportError, 'call', _278 => _278(error)]);
3646
3788
  response = _chunkXGTFLG73cjs.createFarmInternalServerErrorResponse.call(void 0, );
3647
3789
  }
3648
3790
  return pm ? await pm.runHookSerial("afterApiHandler", response, apiLifecyclePayload) : response;
@@ -3655,33 +3797,25 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3655
3797
  }
3656
3798
  });
3657
3799
  const duration = Date.now() - startTime2;
3658
- if (!apiHandlerFailed) {
3800
+ logResponse(method2, urlPath2, handledResponse.status, duration, "API");
3801
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, handledResponse);
3802
+ return;
3803
+ } catch (error) {
3804
+ const duration = Date.now() - startTime2;
3805
+ if (!apiOutcomeReported) {
3659
3806
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
3660
- type: "api.request.complete",
3807
+ type: "api.error",
3661
3808
  pathname: pathname2,
3662
3809
  route: apiRoutePattern,
3663
3810
  method: method2,
3664
- status: handledResponse.status,
3665
- durationMs: duration
3811
+ durationMs: duration,
3812
+ error
3666
3813
  });
3667
3814
  }
3668
- logResponse(method2, urlPath2, handledResponse.status, duration, "API");
3669
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, handledResponse);
3670
- return;
3671
- } catch (error) {
3672
- const duration = Date.now() - startTime2;
3673
- _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
3674
- type: "api.error",
3675
- pathname: pathname2,
3676
- route: apiRoutePattern,
3677
- method: method2,
3678
- durationMs: duration,
3679
- error
3680
- });
3681
3815
  const bodyErrorResponse = _chunkCFG4QERRcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
3682
3816
  if (bodyErrorResponse) {
3683
3817
  logResponse(method2, urlPath2, bodyErrorResponse.status, duration, "API");
3684
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3818
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3685
3819
  return;
3686
3820
  }
3687
3821
  _chunkQMNWKQL4cjs.logger.error(`API route error: ${error}`);
@@ -3717,13 +3851,13 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3717
3851
  if (docsResponse) {
3718
3852
  const duration = Date.now() - startTime2;
3719
3853
  logResponse(method2, urlPath2, docsResponse.status, duration, "API");
3720
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, docsResponse);
3854
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, docsResponse);
3721
3855
  return;
3722
3856
  }
3723
3857
  } catch (error) {
3724
3858
  const bodyErrorResponse = _chunkCFG4QERRcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
3725
3859
  if (bodyErrorResponse) {
3726
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3860
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
3727
3861
  return;
3728
3862
  }
3729
3863
  _chunkQMNWKQL4cjs.logger.error(`Docs API route error: ${error}`);
@@ -3748,19 +3882,19 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3748
3882
  })
3749
3883
  );
3750
3884
  logResponse(method2, urlPath2, response.status, Date.now() - startTime2, "API");
3751
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
3885
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
3752
3886
  } catch (error) {
3753
3887
  _chunkQMNWKQL4cjs.logger.error(`API route error: ${error}`);
3754
3888
  sendFarmDevRuntimeHookError(res, true);
3755
3889
  }
3756
3890
  return;
3757
3891
  }
3758
- 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")])) {
3892
+ if (_optionalChain([req, 'access', _279 => _279.url, 'optionalAccess', _280 => _280.startsWith, 'call', _281 => _281("/@")]) || _optionalChain([req, 'access', _282 => _282.url, 'optionalAccess', _283 => _283.startsWith, 'call', _284 => _284("/node_modules")])) {
3759
3893
  return next();
3760
3894
  }
3761
3895
  if (!deferredDottedRequests.has(req) && shouldBypassFarmRouterForDottedPath(
3762
3896
  requestPathname,
3763
- _optionalChain([farmApp, 'optionalAccess', _266 => _266.getRouteManager, 'call', _267 => _267()]),
3897
+ _optionalChain([farmApp, 'optionalAccess', _285 => _285.getRouteManager, 'call', _286 => _286()]),
3764
3898
  [server.config.publicDir, server.config.root],
3765
3899
  farmAgentGeneratedPaths(farmConfig),
3766
3900
  requestMethod
@@ -3768,7 +3902,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3768
3902
  if (!viteModuleRequest) deferredDottedRequests.set(req, requestUrl);
3769
3903
  return next();
3770
3904
  }
3771
- if (_optionalChain([req, 'access', _268 => _268.url, 'optionalAccess', _269 => _269.startsWith, 'call', _270 => _270("/__farm/page-data")])) {
3905
+ if (_optionalChain([req, 'access', _287 => _287.url, 'optionalAccess', _288 => _288.startsWith, 'call', _289 => _289("/__farm/page-data")])) {
3772
3906
  const urlObj = parsedRequestUrl;
3773
3907
  const targetPath = urlObj.searchParams.get("path") || "/";
3774
3908
  let renderedRequest;
@@ -3778,14 +3912,14 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3778
3912
  urlObj,
3779
3913
  _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
3780
3914
  );
3781
- const deploymentMismatch = _chunkI7J5RLGOcjs.getFarmDeploymentMismatch.call(void 0,
3915
+ const deploymentMismatch = _chunkNLBHLPEOcjs.getFarmDeploymentMismatch.call(void 0,
3782
3916
  request,
3783
3917
  farmConfig.deploymentId
3784
3918
  );
3785
3919
  if (deploymentMismatch) {
3786
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
3920
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
3787
3921
  res,
3788
- _chunkI7J5RLGOcjs.createFarmDeploymentMismatchResponse.call(void 0, deploymentMismatch)
3922
+ _chunkNLBHLPEOcjs.createFarmDeploymentMismatchResponse.call(void 0, deploymentMismatch)
3789
3923
  );
3790
3924
  return;
3791
3925
  }
@@ -3798,7 +3932,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3798
3932
  renderedRequest = targetRequest;
3799
3933
  let middlewareMap = /* @__PURE__ */ new Map();
3800
3934
  let middlewareContext = /* @__PURE__ */ new Map();
3801
- if (_optionalChain([middlewareManager, 'optionalAccess', _271 => _271.hasMiddleware, 'call', _272 => _272()])) {
3935
+ if (_optionalChain([middlewareManager, 'optionalAccess', _290 => _290.hasMiddleware, 'call', _291 => _291()])) {
3802
3936
  const targetNodeRequest = createPageDataMiddlewareRequest(req, targetRequestUrl);
3803
3937
  const targetNodeResponse = createPageDataMiddlewareResponse(res);
3804
3938
  const handled = await runFarmMiddlewareWithNavigation(
@@ -3832,10 +3966,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3832
3966
  if (pm) {
3833
3967
  await pm.runHookParallel("afterRouteMatch", {
3834
3968
  pathname: targetPath,
3835
- matched: !!_optionalChain([match, 'optionalAccess', _273 => _273.route]),
3836
- routePattern: _optionalChain([match, 'optionalAccess', _274 => _274.route, 'optionalAccess', _275 => _275.pattern]) || null,
3837
- params: _optionalChain([match, 'optionalAccess', _276 => _276.params]) || {},
3838
- layoutPatterns: (_optionalChain([match, 'optionalAccess', _277 => _277.layouts]) || []).map((l) => l.pattern)
3969
+ matched: !!_optionalChain([match, 'optionalAccess', _292 => _292.route]),
3970
+ routePattern: _optionalChain([match, 'optionalAccess', _293 => _293.route, 'optionalAccess', _294 => _294.pattern]) || null,
3971
+ params: _optionalChain([match, 'optionalAccess', _295 => _295.params]) || {},
3972
+ layoutPatterns: (_optionalChain([match, 'optionalAccess', _296 => _296.layouts]) || []).map((l) => l.pattern)
3839
3973
  });
3840
3974
  }
3841
3975
  if (!match) {
@@ -3858,7 +3992,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3858
3992
  );
3859
3993
  const loadingModule = loadingBoundary ? await routeManager3.loadRouteModule(loadingBoundary.modulePath) : null;
3860
3994
  const navigationManifest = routeManager3.generateClientManifest(server.config.root);
3861
- const moduleMetadata = _nullishCoalesce(navigationManifest.routes.find((entry) => entry.pattern === route.pattern), () => ( _chunkVO65MYJDcjs.getClientModuleMetadata.call(void 0, route.modulePath, server.config.root)));
3995
+ const moduleMetadata = _nullishCoalesce(navigationManifest.routes.find((entry) => entry.pattern === route.pattern), () => ( _chunk2IFT2CSAcjs.getClientModuleMetadata.call(void 0, route.modulePath, server.config.root)));
3862
3996
  const isClientComponent = moduleMetadata.isClientComponent;
3863
3997
  const shouldHydrate = moduleMetadata.shouldHydrate;
3864
3998
  let mergedMetadata = {};
@@ -3866,7 +4000,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3866
4000
  layouts.map((layout) => routeManager3.loadLayoutModule(layout.modulePath))
3867
4001
  );
3868
4002
  const layoutHydrationMetadata = layouts.map(
3869
- (layout) => _nullishCoalesce(navigationManifest.layouts.find((entry) => entry.pattern === layout.pattern), () => ( _chunkVO65MYJDcjs.getClientModuleMetadata.call(void 0, layout.modulePath, server.config.root)))
4003
+ (layout) => _nullishCoalesce(navigationManifest.layouts.find((entry) => entry.pattern === layout.pattern), () => ( _chunk2IFT2CSAcjs.getClientModuleMetadata.call(void 0, layout.modulePath, server.config.root)))
3870
4004
  );
3871
4005
  const shouldHydrateLayout = layoutHydrationMetadata.some(
3872
4006
  (metadata) => metadata.shouldHydrate
@@ -3878,17 +4012,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3878
4012
  )
3879
4013
  ];
3880
4014
  const hydrationIslandStrategy = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0,
3881
- _optionalChain([(_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _278 => _278.getConfig, 'call', _279 => _279()]), () => ( options))), 'access', _280 => _280.experimental, 'optionalAccess', _281 => _281.serverComponents])
3882
- ) === "islands" ? _chunkDHR2WDSLcjs.resolveFarmRouteRootStrategy.call(void 0,
4015
+ _optionalChain([(_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _297 => _297.getConfig, 'call', _298 => _298()]), () => ( options))), 'access', _299 => _299.experimental, 'optionalAccess', _300 => _300.serverComponents])
4016
+ ) === "islands" ? _chunkKWST2O22cjs.resolveFarmRouteRootStrategy.call(void 0,
3883
4017
  route,
3884
4018
  { shouldHydrate, islandStrategy: _nullishCoalesce(moduleMetadata.islandStrategy, () => ( null)) },
3885
4019
  layouts.map((layout, index) => ({
3886
4020
  pattern: layout.pattern,
3887
4021
  modulePath: layout.modulePath,
3888
- shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _282 => _282[index], 'optionalAccess', _283 => _283.shouldHydrate]) === true,
4022
+ shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _301 => _301[index], 'optionalAccess', _302 => _302.shouldHydrate]) === true,
3889
4023
  // Manifest entries carry it; metadata read from source does not.
3890
- hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access', _284 => _284[index], 'optionalAccess', _285 => _285.hasIsolatedClientBoundaries]) === true,
3891
- islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _286 => _286[index], 'optionalAccess', _287 => _287.islandStrategy]), () => ( null))
4024
+ hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access', _303 => _303[index], 'optionalAccess', _304 => _304.hasIsolatedClientBoundaries]) === true,
4025
+ islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _305 => _305[index], 'optionalAccess', _306 => _306.islandStrategy]), () => ( null))
3892
4026
  })),
3893
4027
  server.config.root,
3894
4028
  true
@@ -3936,7 +4070,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3936
4070
  mergedMetadata = await _chunk6IOZPJ3Icjs.mergeModuleViewport.call(void 0, mergedMetadata, routeModule, routeProps);
3937
4071
  mergedMetadata = _chunk6IOZPJ3Icjs.addMetadataMarkdownAlternate.call(void 0,
3938
4072
  mergedMetadata,
3939
- _chunkFT6KJHS3cjs.getFarmMarkdownAlternatePath.call(void 0, farmApp.getConfig().md, targetRequestUrl.pathname, {
4073
+ _chunkC2JOS77Zcjs.getFarmMarkdownAlternatePath.call(void 0, farmApp.getConfig().md, targetRequestUrl.pathname, {
3940
4074
  routePathname: (pathname2) => routeManager3.toRoutePathname(pathname2)
3941
4075
  })
3942
4076
  );
@@ -3945,7 +4079,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3945
4079
  const slotModule = await routeManager3.loadRouteModule(slot.route.modulePath);
3946
4080
  const slotMetadata = _nullishCoalesce(navigationManifest.slots.find(
3947
4081
  (entry) => entry.name === slot.name && entry.ownerPattern === slot.ownerPattern && entry.pattern === slot.route.pattern
3948
- ), () => ( _chunkVO65MYJDcjs.getClientModuleMetadata.call(void 0, slot.route.modulePath, server.config.root)));
4082
+ ), () => ( _chunk2IFT2CSAcjs.getClientModuleMetadata.call(void 0, slot.route.modulePath, server.config.root)));
3949
4083
  const slotContext = await _chunkX333W5KVcjs.resolveFarmRouteContext.call(void 0, farmApp.getConfig(), {
3950
4084
  request: targetRequest,
3951
4085
  params: slot.params,
@@ -3991,15 +4125,15 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3991
4125
  );
3992
4126
  const projectRoot = server.config.root;
3993
4127
  const toUrlPath = (absolutePath) => _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, absolutePath, projectRoot);
3994
- const renderPlan = _chunkUPOYKX4Scjs.createFarmRouteRenderPlan.call(void 0, {
4128
+ const renderPlan = _chunk2MR4MABGcjs.createFarmRouteRenderPlan.call(void 0, {
3995
4129
  pageShouldHydrate: shouldHydrate,
3996
4130
  layoutShouldHydrate: shouldHydrateLayout,
3997
4131
  islandStrategy: hydrationIslandStrategy,
3998
- rendering: _chunkQOGIZKSOcjs.resolveRouteRenderingConfig.call(void 0, routeModule)
4132
+ rendering: _chunkCSQPMV3Qcjs.resolveRouteRenderingConfig.call(void 0, routeModule)
3999
4133
  });
4000
4134
  const destinationLayoutPatterns = layouts.map((layout) => layout.pattern);
4001
- const layoutStartIndex = _chunkUPOYKX4Scjs.getSharedLayoutPrefixLength.call(void 0,
4002
- _chunkUPOYKX4Scjs.parseFarmLayoutChainHeader.call(void 0, request.headers.get("x-farm-layout-chain")),
4135
+ const layoutStartIndex = _chunk2MR4MABGcjs.getSharedLayoutPrefixLength.call(void 0,
4136
+ _chunk2MR4MABGcjs.parseFarmLayoutChainHeader.call(void 0, request.headers.get("x-farm-layout-chain")),
4003
4137
  destinationLayoutPatterns
4004
4138
  );
4005
4139
  const renderer = farmApp.getServerRenderer();
@@ -4009,7 +4143,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4009
4143
  middlewareContext,
4010
4144
  () => renderer.renderNavigationFragment({
4011
4145
  PageComponent: routeModule.default,
4012
- LoadingComponent: _optionalChain([loadingModule, 'optionalAccess', _288 => _288.default]),
4146
+ LoadingComponent: _optionalChain([loadingModule, 'optionalAccess', _307 => _307.default]),
4013
4147
  pageProps: routeProps,
4014
4148
  params,
4015
4149
  layouts: layouts.map((layout, index) => ({
@@ -4071,19 +4205,19 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4071
4205
  from: interceptFromHeader,
4072
4206
  slots: routeSlots.filter((slot) => slot.interception).map((slot) => slot.name)
4073
4207
  } : void 0,
4074
- i18n: _chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, )
4208
+ i18n: _chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0, )
4075
4209
  };
4076
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
4210
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
4077
4211
  res,
4078
4212
  _chunkDBYNZIIQcjs.createDeferredDataResponse.call(void 0,
4079
4213
  pageData,
4080
4214
  {
4081
4215
  status: 200,
4082
4216
  headers: {
4083
- "Cache-Control": _chunkUPOYKX4Scjs.getFarmFragmentCacheControl.call(void 0, renderPlan),
4217
+ "Cache-Control": _chunk2MR4MABGcjs.getFarmFragmentCacheControl.call(void 0, renderPlan),
4084
4218
  "X-Farm-Navigation": "html-fragment",
4085
4219
  Vary: "X-Farm-Layout-Chain",
4086
- [_chunkI7J5RLGOcjs.FARM_DEPLOYMENT_ID_HEADER]: farmConfig.deploymentId
4220
+ [_chunkNLBHLPEOcjs.FARM_DEPLOYMENT_ID_HEADER]: farmConfig.deploymentId
4087
4221
  }
4088
4222
  },
4089
4223
  {
@@ -4122,49 +4256,53 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4122
4256
  trustProxy: currentServerConfig.trustProxy
4123
4257
  }).pathname;
4124
4258
  const routeManager2 = farmApp.getRouteManager();
4125
- const hasBeforeRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _289 => _289.hasHook, 'call', _290 => _290("beforeRouteMatch")]), () => ( false));
4126
- const hasAfterRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _291 => _291.hasHook, 'call', _292 => _292("afterRouteMatch")]), () => ( false));
4127
- const hasBeforeRequestHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _293 => _293.hasHook, 'call', _294 => _294("beforeRequest")]), () => ( false));
4128
- const hasBeforeRenderHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _295 => _295.hasHook, 'call', _296 => _296("beforeRender")]), () => ( false));
4129
- const hasAfterResponseHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _297 => _297.hasHook, 'call', _298 => _298("afterResponse")]), () => ( false));
4130
- 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)));
4259
+ const hasBeforeRequestHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _308 => _308.hasHook, 'call', _309 => _309("beforeRequest")]), () => ( false));
4260
+ const hasAfterResponseHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _310 => _310.hasHook, 'call', _311 => _311("afterResponse")]), () => ( false));
4261
+ const hasHTMLTransformHook = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _312 => _312.hasHook, 'call', _313 => _313("transformHTML")]), () => ( false))) || (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _314 => _314.hasHook, 'call', _315 => _315("afterRender")]), () => ( false)));
4131
4262
  const opensRuntimeSession = pm ? opensFarmDevRuntimeSession(pm) : false;
4132
- const hasRuntimeAfterHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _303 => _303.hasRuntimeHook, 'call', _304 => _304("after")]), () => ( false));
4133
- const requestedMatch = routeManager2.matchRoute(requestedPathname);
4263
+ const hasRuntimeAfterHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _316 => _316.hasRuntimeHook, 'call', _317 => _317("after")]), () => ( false));
4134
4264
  const pageBuiltInRouteLabel = (pathname2) => {
4135
4265
  const routePathname = _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, pathname2, farmConfig.basePath);
4136
- const mcpLabel = _chunkGQ6QOH7Tcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath);
4266
+ const mcpLabel = _chunkSXMWVP2Lcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath);
4137
4267
  if (mcpLabel) return mcpLabel;
4138
4268
  if (farmAgentGeneratedPaths(farmConfig).includes(routePathname)) return routePathname;
4139
- return routePathname === _chunkX3MHKLCOcjs.FARM_DEFAULT_MCP_PATH && farmApp.getServerRenderer().getDefaultMCPServer() ? _chunkX3MHKLCOcjs.FARM_DEFAULT_MCP_PATH : null;
4269
+ return routePathname === _chunkTP4RAV7Ycjs.FARM_DEFAULT_MCP_PATH && farmApp.getServerRenderer().getDefaultMCPServer() ? _chunkTP4RAV7Ycjs.FARM_DEFAULT_MCP_PATH : null;
4270
+ };
4271
+ const pageRuntimeOptions = (pathname2) => {
4272
+ const match = routeManager2.matchRoute(pathname2);
4273
+ return {
4274
+ kind: "page",
4275
+ route: _chunkSXMWVP2Lcjs.setFarmRouteLabel.call(void 0,
4276
+ {
4277
+ pathname: pathname2,
4278
+ pattern: _optionalChain([match, 'optionalAccess', _318 => _318.route, 'optionalAccess', _319 => _319.pattern]) || null,
4279
+ params: _optionalChain([match, 'optionalAccess', _320 => _320.params]) || {}
4280
+ },
4281
+ _optionalChain([match, 'optionalAccess', _321 => _321.route]) ? null : pageBuiltInRouteLabel(pathname2)
4282
+ )
4283
+ };
4140
4284
  };
4141
4285
  let runtimeSession;
4142
4286
  let pathname = requestedPathname;
4143
4287
  if (pm && opensRuntimeSession) {
4144
4288
  try {
4145
- const sessionOptions = {
4146
- kind: "page",
4147
- route: _chunkGQ6QOH7Tcjs.setFarmRouteLabel.call(void 0,
4148
- {
4149
- pathname: requestedPathname,
4150
- pattern: _optionalChain([requestedMatch, 'optionalAccess', _305 => _305.route, 'optionalAccess', _306 => _306.pattern]) || null,
4151
- params: _optionalChain([requestedMatch, 'optionalAccess', _307 => _307.params]) || {}
4152
- },
4153
- _optionalChain([requestedMatch, 'optionalAccess', _308 => _308.route]) ? null : pageBuiltInRouteLabel(requestedPathname)
4154
- )
4155
- };
4289
+ const metadataRoute = configRewriteSource === void 0 ? matchAppMetadataRoute(requestedPathname) : null;
4290
+ const sessionOptions = metadataRoute ? { kind: "asset", route: { pathname: requestedPathname, ...metadataRoute } } : pageRuntimeOptions(
4291
+ configRewriteSource === void 0 ? requestedPathname : requestedPagePathname
4292
+ );
4156
4293
  runtimeSession = await pm.beginRuntimeRequest(
4157
4294
  createRequestFromNodeRequest(req, new URL(_nullishCoalesce(configRewriteSource, () => ( fullUrl)))),
4158
4295
  sessionOptions
4159
4296
  );
4297
+ if (!runtimeSession.response) await runFarmDevPageHooks();
4160
4298
  const routedRequest = await _asyncNullishCoalesce(runtimeSession.response, async () => ( (configRewriteSource === void 0 ? runtimeSession.request : await pm.runRuntimeBeforeForRewrite(
4161
4299
  runtimeSession.request,
4162
4300
  createRequestFromNodeRequest(req, new URL(fullUrl)),
4163
- sessionOptions
4301
+ pageRuntimeOptions(requestedPathname)
4164
4302
  ))));
4165
4303
  if (routedRequest instanceof Response) {
4166
4304
  const response = await pm.endRuntimeRequest(runtimeSession, routedRequest);
4167
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
4305
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
4168
4306
  return;
4169
4307
  }
4170
4308
  pm.copyRequestContext(routedRequest, req);
@@ -4176,9 +4314,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4176
4314
  return;
4177
4315
  }
4178
4316
  }
4179
- const routeMatch = pathname === requestedPathname ? requestedMatch : routeManager2.matchRoute(pathname);
4180
- const failPageHook = async (error, interceptor) => {
4181
- _optionalChain([interceptor, 'optionalAccess', _309 => _309.release, 'call', _310 => _310()]);
4317
+ const failPageHook = async (error) => {
4182
4318
  logResponse(method, urlPath, 500, Date.now() - startTime, "PAGE");
4183
4319
  if (runtimeSession) {
4184
4320
  await pm.failRuntimeRequest(runtimeSession, error);
@@ -4191,32 +4327,14 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4191
4327
  }
4192
4328
  if (!res.headersSent) sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
4193
4329
  };
4194
- try {
4195
- if (pm && hasBeforeRouteMatchHook) {
4196
- await pm.runHookParallel("beforeRouteMatch", {
4197
- pathname,
4198
- method
4199
- });
4200
- }
4201
- if (pm && hasAfterRouteMatchHook) {
4202
- await pm.runHookParallel("afterRouteMatch", {
4203
- pathname,
4204
- matched: !!_optionalChain([routeMatch, 'optionalAccess', _311 => _311.route]),
4205
- routePattern: _optionalChain([routeMatch, 'optionalAccess', _312 => _312.route, 'optionalAccess', _313 => _313.pattern]) || null,
4206
- params: _optionalChain([routeMatch, 'optionalAccess', _314 => _314.params]) || {},
4207
- layoutPatterns: (_optionalChain([routeMatch, 'optionalAccess', _315 => _315.layouts]) || []).map((l) => l.pattern)
4208
- });
4330
+ if (!runtimeSession) {
4331
+ try {
4332
+ await runFarmDevPageHooks();
4333
+ } catch (error) {
4334
+ await failPageHook(error);
4335
+ return;
4209
4336
  }
4210
- } catch (error) {
4211
- await failPageHook(error);
4212
- return;
4213
4337
  }
4214
- const renderPayload = {
4215
- pathname,
4216
- method,
4217
- routePattern: _optionalChain([routeMatch, 'optionalAccess', _316 => _316.route, 'optionalAccess', _317 => _317.pattern]) || null,
4218
- params: _optionalChain([routeMatch, 'optionalAccess', _318 => _318.params]) || {}
4219
- };
4220
4338
  const shouldInterceptResponse = Boolean(
4221
4339
  pm && (hasAfterResponseHook || hasHTMLTransformHook || runtimeSession && hasRuntimeAfterHook)
4222
4340
  );
@@ -4228,7 +4346,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4228
4346
  hasRuntimeAfterHook,
4229
4347
  hasAfterResponseHook,
4230
4348
  hasHTMLTransformHook,
4231
- renderPayload,
4349
+ // render.html gets the render info render.before got.
4350
+ renderPayload: pageHookRoute().render,
4232
4351
  method,
4233
4352
  urlPath,
4234
4353
  pathname,
@@ -4239,7 +4358,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4239
4358
  }) : void 0;
4240
4359
  let middlewareFailed = false;
4241
4360
  try {
4242
- if (_optionalChain([middlewareManager, 'optionalAccess', _319 => _319.hasMiddleware, 'call', _320 => _320()])) {
4361
+ if (_optionalChain([middlewareManager, 'optionalAccess', _322 => _322.hasMiddleware, 'call', _323 => _323()])) {
4243
4362
  const middlewareRequest = createRequestFromNodeRequest(req, new URL(fullUrl));
4244
4363
  const handled = await runFarmMiddlewareWithNavigation(
4245
4364
  farmApp.getServerRenderer(),
@@ -4252,7 +4371,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4252
4371
  throw error;
4253
4372
  });
4254
4373
  if (handled) {
4255
- if (!_optionalChain([responseInterceptor, 'optionalAccess', _321 => _321.isEnded, 'call', _322 => _322()])) {
4374
+ if (!_optionalChain([responseInterceptor, 'optionalAccess', _324 => _324.isEnded, 'call', _325 => _325()])) {
4256
4375
  const duration = Date.now() - startTime;
4257
4376
  logResponse(method, urlPath, res.statusCode || 200, duration, "PAGE");
4258
4377
  }
@@ -4267,22 +4386,14 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4267
4386
  res
4268
4387
  );
4269
4388
  }
4270
- if (res.writableEnded || _optionalChain([responseInterceptor, 'optionalAccess', _323 => _323.isEnded, 'call', _324 => _324()])) {
4271
- if (!_optionalChain([responseInterceptor, 'optionalAccess', _325 => _325.isEnded, 'call', _326 => _326()])) {
4389
+ if (res.writableEnded || _optionalChain([responseInterceptor, 'optionalAccess', _326 => _326.isEnded, 'call', _327 => _327()])) {
4390
+ if (!_optionalChain([responseInterceptor, 'optionalAccess', _328 => _328.isEnded, 'call', _329 => _329()])) {
4272
4391
  const duration = Date.now() - startTime;
4273
4392
  logResponse(method, urlPath, res.statusCode || 200, duration, "PAGE");
4274
4393
  }
4275
4394
  return;
4276
4395
  }
4277
4396
  const renderer = farmApp.getServerRenderer();
4278
- if (pm && hasBeforeRenderHook) {
4279
- try {
4280
- await pm.runHookParallel("beforeRender", renderPayload);
4281
- } catch (error) {
4282
- await failPageHook(error, responseInterceptor);
4283
- return;
4284
- }
4285
- }
4286
4397
  await renderer.renderPage(req, res);
4287
4398
  if (!shouldInterceptResponse) {
4288
4399
  logResponse(method, urlPath, res.statusCode || 200, Date.now() - startTime, "PAGE");
@@ -4295,8 +4406,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4295
4406
  await pm.reportRuntimeRequestError(runtimeSession, error);
4296
4407
  } else {
4297
4408
  await pm.failRuntimeRequest(runtimeSession, error);
4298
- if (!res.headersSent && !_optionalChain([responseInterceptor, 'optionalAccess', _327 => _327.isEnded, 'call', _328 => _328()])) {
4299
- _optionalChain([responseInterceptor, 'optionalAccess', _329 => _329.release, 'call', _330 => _330()]);
4409
+ if (!res.headersSent && !_optionalChain([responseInterceptor, 'optionalAccess', _330 => _330.isEnded, 'call', _331 => _331()])) {
4410
+ _optionalChain([responseInterceptor, 'optionalAccess', _332 => _332.release, 'call', _333 => _333()]);
4300
4411
  console.error("[FARM] Page error:", error);
4301
4412
  sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
4302
4413
  return;
@@ -4313,7 +4424,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4313
4424
  }
4314
4425
  })
4315
4426
  );
4316
- const farmRequestMiddleware = _optionalChain([farmMiddlewares, 'access', _331 => _331.stack, 'access', _332 => _332.at, 'call', _333 => _333(-1), 'optionalAccess', _334 => _334.handle]);
4427
+ const farmRequestMiddleware = _optionalChain([farmMiddlewares, 'access', _334 => _334.stack, 'access', _335 => _335.at, 'call', _336 => _336(-1), 'optionalAccess', _337 => _337.handle]);
4317
4428
  if (farmOwnsDevCors && viteServer.config.server.cors === false) {
4318
4429
  farmMiddlewares.use(createFarmDevViteCorsMiddleware());
4319
4430
  }
@@ -4335,15 +4446,18 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4335
4446
  };
4336
4447
  },
4337
4448
  async resolveId(id, importer, resolveOptions) {
4338
- if (id.startsWith("@farm.js/core/internal/") && importer) {
4339
- 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;
4340
- const relative4 = root ? path6.relative(root, importer.split("?", 1)[0]) : "";
4341
- if (root && (relative4.startsWith("..") || path6.isAbsolute(relative4))) {
4342
- return this.resolve(id, path6.join(root, "package.json"), {
4343
- ...resolveOptions,
4344
- skipSelf: true
4345
- });
4346
- }
4449
+ if (id.startsWith(FARM_RUNTIME_MODULE_PREFIX)) {
4450
+ return this.resolve(id.slice(FARM_RUNTIME_MODULE_PREFIX.length), getFarmCoreFile(), {
4451
+ ...resolveOptions,
4452
+ skipSelf: true
4453
+ });
4454
+ }
4455
+ if (id.startsWith("@farm.js/core/internal/") && importer && isOutsideAppRoot(importer)) {
4456
+ const root = _optionalChain([farmApp, 'optionalAccess', _338 => _338.getConfig, 'call', _339 => _339(), 'access', _340 => _340.root]) || _optionalChain([server, 'optionalAccess', _341 => _341.config, 'access', _342 => _342.root]) || options.root;
4457
+ return this.resolve(id, path6.join(root, "package.json"), {
4458
+ ...resolveOptions,
4459
+ skipSelf: true
4460
+ });
4347
4461
  }
4348
4462
  if (typeof fontImports.resolveId === "function") {
4349
4463
  const fontId = await fontImports.resolveId.call(this, id, importer, resolveOptions);
@@ -4367,7 +4481,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4367
4481
  }
4368
4482
  },
4369
4483
  async load(id, loadOptions) {
4370
- if (pendingClientSetup && !_optionalChain([loadOptions, 'optionalAccess', _340 => _340.ssr]) && !farmSetupContext.getStore()) {
4484
+ if (pendingClientSetup && !_optionalChain([loadOptions, 'optionalAccess', _343 => _343.ssr]) && !farmSetupContext.getStore()) {
4371
4485
  await pendingClientSetup;
4372
4486
  }
4373
4487
  if (_chunkPIUTGRDIcjs.isFarmServerFnBoundaryId.call(void 0, id) && islandsServerFns()) {
@@ -4385,8 +4499,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4385
4499
  if (imageModule) return imageModule;
4386
4500
  }
4387
4501
  if (_chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
4388
- const renderer = _optionalChain([farmApp, 'optionalAccess', _341 => _341.getConfig, 'call', _342 => _342(), 'access', _343 => _343.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
4389
- const root = _optionalChain([server, 'optionalAccess', _344 => _344.config, 'access', _345 => _345.root]) || options.root;
4502
+ const renderer = _optionalChain([farmApp, 'optionalAccess', _344 => _344.getConfig, 'call', _345 => _345(), 'access', _346 => _346.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
4503
+ const root = _optionalChain([server, 'optionalAccess', _347 => _347.config, 'access', _348 => _348.root]) || options.root;
4390
4504
  if (isClientEnvironment(this, loadOptions)) {
4391
4505
  return generateProgrammaticClientRouteModuleForId(
4392
4506
  id,
@@ -4402,65 +4516,65 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4402
4516
  return FARM_DEV_CLIENT_BOOT_MODULE;
4403
4517
  }
4404
4518
  if (isFarmClientVirtualId(id)) {
4405
- const resolvedConfig = _optionalChain([farmApp, 'optionalAccess', _346 => _346.getConfig, 'call', _347 => _347()]);
4406
- const renderer = _optionalChain([resolvedConfig, 'optionalAccess', _348 => _348.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
4407
- const integrations = _optionalChain([resolvedConfig, 'optionalAccess', _349 => _349.integrations]) || options.integrations;
4408
- const root = _optionalChain([resolvedConfig, 'optionalAccess', _350 => _350.root]) || _optionalChain([server, 'optionalAccess', _351 => _351.config, 'access', _352 => _352.root]) || process.cwd();
4409
- const docs = _optionalChain([resolvedConfig, 'optionalAccess', _353 => _353.docs]);
4519
+ const resolvedConfig = _optionalChain([farmApp, 'optionalAccess', _349 => _349.getConfig, 'call', _350 => _350()]);
4520
+ const renderer = _optionalChain([resolvedConfig, 'optionalAccess', _351 => _351.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
4521
+ const integrations = _optionalChain([resolvedConfig, 'optionalAccess', _352 => _352.integrations]) || options.integrations;
4522
+ const root = _optionalChain([resolvedConfig, 'optionalAccess', _353 => _353.root]) || _optionalChain([server, 'optionalAccess', _354 => _354.config, 'access', _355 => _355.root]) || process.cwd();
4523
+ const docs = _optionalChain([resolvedConfig, 'optionalAccess', _356 => _356.docs]);
4410
4524
  const adapterOwnsDocsRuntime = Boolean(
4411
- _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([docs, 'optionalAccess', _354 => _354.adapter, 'optionalAccess', _355 => _355.server]) && docs.adapter.react
4525
+ _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([docs, 'optionalAccess', _357 => _357.adapter, 'optionalAccess', _358 => _358.server]) && docs.adapter.react
4412
4526
  );
4413
- const devtools = _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _356 => _356.devtools]), () => ( _chunkSTF6VDYQcjs.resolveFarmDevtoolsConfig.call(void 0, false, "production")));
4527
+ const devtools = _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _359 => _359.devtools]), () => ( _chunkSTF6VDYQcjs.resolveFarmDevtoolsConfig.call(void 0, false, "production")));
4414
4528
  const [docsRuntime, docsSearchRuntime, devtoolsClientRuntime] = await Promise.all([
4415
- _optionalChain([docs, 'optionalAccess', _357 => _357.enabled]) ? loadFarmDocsDevRuntime() : null,
4416
- _optionalChain([docs, 'optionalAccess', _358 => _358.enabled]) && !adapterOwnsDocsRuntime ? loadFarmDocsSearchDevRuntime() : null,
4529
+ _optionalChain([docs, 'optionalAccess', _360 => _360.enabled]) ? loadFarmDocsDevRuntime() : null,
4530
+ _optionalChain([docs, 'optionalAccess', _361 => _361.enabled]) && !adapterOwnsDocsRuntime ? loadFarmDocsSearchDevRuntime() : null,
4417
4531
  devtools.enabled ? loadFarmDevtoolsClientRuntime() : null
4418
4532
  ]);
4419
- const docsSearchEnabled = _nullishCoalesce(_optionalChain([docsSearchRuntime, 'optionalAccess', _359 => _359.isFarmDocsSearchEnabled, 'call', _360 => _360(docs)]), () => ( false));
4533
+ const docsSearchEnabled = _nullishCoalesce(_optionalChain([docsSearchRuntime, 'optionalAccess', _362 => _362.isFarmDocsSearchEnabled, 'call', _363 => _363(docs)]), () => ( false));
4420
4534
  const generatedDocsSearchRuntime = docsSearchRuntime ? docsSearchRuntime.generateFarmDocsSearchClientRuntime(
4421
4535
  docsSearchEnabled,
4422
4536
  docsSearchEnabled ? docsSearchRuntime.resolveFarmDocsSearchClientModule(root) : void 0
4423
4537
  ) : EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME;
4424
4538
  const generatedDevtoolsClientRuntime = devtoolsClientRuntime ? devtoolsClientRuntime.generateFarmDevtoolsClientRuntime(devtools) : "";
4425
4539
  const generatedDevIndicatorsClientRuntime = farmApp ? _chunkUVV3I5QAcjs.generateFarmDevIndicatorsClientRuntime.call(void 0, farmApp.getConfig().devIndicators) : "";
4426
- const integrationProviders = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _chunkBDYM2TN3cjs.getIntegrationProviders.call(void 0, integrations) : [];
4427
- const isolatedHydrationMode = _chunkVO65MYJDcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
4428
- _optionalChain([resolvedConfig, 'optionalAccess', _361 => _361.experimental, 'optionalAccess', _362 => _362.isolatedClientHydration]),
4540
+ const integrationProviders = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _chunkJX5VOLAVcjs.getIntegrationProviders.call(void 0, integrations) : [];
4541
+ const isolatedHydrationMode = _chunk2IFT2CSAcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
4542
+ _optionalChain([resolvedConfig, 'optionalAccess', _364 => _364.experimental, 'optionalAccess', _365 => _365.isolatedClientHydration]),
4429
4543
  {
4430
- serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _363 => _363.experimental, 'optionalAccess', _364 => _364.serverComponents])) === "rsc",
4544
+ serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _366 => _366.experimental, 'optionalAccess', _367 => _367.serverComponents])) === "rsc",
4431
4545
  hasUnsupportedIntegrationProvider: integrationProviders.filter((provider) => provider.component || provider.type === "clerk").some((provider) => provider.supportsIsolatedHydration !== true)
4432
4546
  }
4433
4547
  );
4434
4548
  return generateClientCode(
4435
4549
  integrationProviders,
4436
4550
  [
4437
- ..._chunkBDYM2TN3cjs.getIntegrationDocumentNavigationMatchers.call(void 0, integrations),
4438
- ..._nullishCoalesce(_optionalChain([docsRuntime, 'optionalAccess', _365 => _365.getFarmDocsDocumentNavigationMatchers, 'call', _366 => _366(docs)]), () => ( []))
4551
+ ..._chunkJX5VOLAVcjs.getIntegrationDocumentNavigationMatchers.call(void 0, integrations),
4552
+ ..._nullishCoalesce(_optionalChain([docsRuntime, 'optionalAccess', _368 => _368.getFarmDocsDocumentNavigationMatchers, 'call', _369 => _369(docs)]), () => ( []))
4439
4553
  ],
4440
4554
  generatedDocsSearchRuntime,
4441
4555
  `${generatedDevtoolsClientRuntime}
4442
4556
  ${generatedDevIndicatorsClientRuntime}`,
4443
- _optionalChain([resolvedConfig, 'optionalAccess', _367 => _367.plugins]) || [],
4557
+ _optionalChain([resolvedConfig, 'optionalAccess', _370 => _370.plugins]) || [],
4444
4558
  root,
4445
- _optionalChain([resolvedConfig, 'optionalAccess', _368 => _368.srcDir]) || options.srcDir || "src",
4446
- _optionalChain([resolvedConfig, 'optionalAccess', _369 => _369.publicRuntimeConfig]) || options.publicRuntimeConfig,
4447
- _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _optionalChain([docs, 'optionalAccess', _370 => _370.adapter, 'optionalAccess', _371 => _371.react]) : void 0,
4559
+ _optionalChain([resolvedConfig, 'optionalAccess', _371 => _371.srcDir]) || options.srcDir || "src",
4560
+ _optionalChain([resolvedConfig, 'optionalAccess', _372 => _372.publicRuntimeConfig]) || options.publicRuntimeConfig,
4561
+ _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _optionalChain([docs, 'optionalAccess', _373 => _373.adapter, 'optionalAccess', _374 => _374.react]) : void 0,
4448
4562
  renderer,
4449
- 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,
4450
- _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _377 => _377.trailingSlash]), () => ( false)),
4451
- _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _378 => _378.basePath]), () => ( "/")),
4452
- _chunkDHR2WDSLcjs.generateClientCachePersistenceCode.call(void 0,
4453
- _chunkDHR2WDSLcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, _optionalChain([resolvedConfig, 'optionalAccess', _379 => _379.cache]))
4563
+ isolatedHydrationMode === "enabled" || _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([(_nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _375 => _375.getRouteManager, 'call', _376 => _376(), 'access', _377 => _377.getIsolatedClientBoundaryModules, 'call', _378 => _378(root)])))), 'optionalAccess', _379 => _379.size]) > 0,
4564
+ _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _380 => _380.trailingSlash]), () => ( false)),
4565
+ _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _381 => _381.basePath]), () => ( "/")),
4566
+ _chunkKWST2O22cjs.generateClientCachePersistenceCode.call(void 0,
4567
+ _chunkKWST2O22cjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, _optionalChain([resolvedConfig, 'optionalAccess', _382 => _382.cache]))
4454
4568
  ),
4455
4569
  _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, docs) : void 0,
4456
- _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _380 => _380.experimental, 'optionalAccess', _381 => _381.serverComponents])) === "islands"
4570
+ _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _383 => _383.experimental, 'optionalAccess', _384 => _384.serverComponents])) === "islands"
4457
4571
  );
4458
4572
  }
4459
4573
  if (id === "/@farm/server") {
4460
4574
  return generateServerCode();
4461
4575
  }
4462
4576
  if (id === "/@farm/manifest") {
4463
- const routeManager = _optionalChain([farmApp, 'optionalAccess', _382 => _382.getRouteManager, 'call', _383 => _383()]);
4577
+ const routeManager = _optionalChain([farmApp, 'optionalAccess', _385 => _385.getRouteManager, 'call', _386 => _386()]);
4464
4578
  if (!routeManager) {
4465
4579
  return `
4466
4580
  export const getManifest = () => ({
@@ -4473,9 +4587,9 @@ export const getManifest = () => ({
4473
4587
  `;
4474
4588
  }
4475
4589
  const manifest = routeManager.generateClientManifest(server.config.root);
4476
- const globalStylesheetHref = _chunkDHR2WDSLcjs.resolveDevGlobalStylesheetHref.call(void 0,
4590
+ const globalStylesheetHref = _chunkKWST2O22cjs.resolveDevGlobalStylesheetHref.call(void 0,
4477
4591
  server.config.root,
4478
- _optionalChain([farmApp, 'optionalAccess', _384 => _384.getConfig, 'call', _385 => _385(), 'access', _386 => _386.srcDir])
4592
+ _optionalChain([farmApp, 'optionalAccess', _387 => _387.getConfig, 'call', _388 => _388(), 'access', _389 => _389.srcDir])
4479
4593
  );
4480
4594
  const fullManifest = {
4481
4595
  clientEntry: "/@farm/client.js",
@@ -4501,11 +4615,11 @@ export const getManifest = () => ({
4501
4615
  };
4502
4616
  }
4503
4617
  for (const layout of manifest.layouts) {
4504
- const groupScope = _chunkUPOYKX4Scjs.getRouteGroupScope.call(void 0, layout.pattern);
4618
+ const groupScope = _chunk2MR4MABGcjs.getRouteGroupScope.call(void 0, layout.pattern);
4505
4619
  fullManifest.layouts[layout.pattern] = {
4506
4620
  modulePath: layout.modulePath,
4507
4621
  pattern: layout.pattern,
4508
- ...groupScope ? { urlPattern: _chunkUPOYKX4Scjs.stripRouteGroups.call(void 0, layout.pattern), groupScope } : {},
4622
+ ...groupScope ? { urlPattern: _chunk2MR4MABGcjs.stripRouteGroups.call(void 0, layout.pattern), groupScope } : {},
4509
4623
  shouldHydrate: layout.shouldHydrate,
4510
4624
  islandStrategy: layout.islandStrategy,
4511
4625
  // Islands mode: rebuilt from its server tree, so its module is never preloaded.
@@ -4531,55 +4645,60 @@ export const manifest = getManifest();
4531
4645
  }
4532
4646
  },
4533
4647
  async transform(code, id, transformOptions) {
4534
- if (pendingClientSetup && !_optionalChain([transformOptions, 'optionalAccess', _387 => _387.ssr]) && !farmSetupContext.getStore()) {
4648
+ if (pendingClientSetup && !_optionalChain([transformOptions, 'optionalAccess', _390 => _390.ssr]) && !farmSetupContext.getStore()) {
4535
4649
  await pendingClientSetup;
4536
4650
  }
4537
- const actionConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _388 => _388.getConfig, 'call', _389 => _389()]), () => ( options));
4651
+ const runtimeModule = !isBuild && _optionalChain([transformOptions, 'optionalAccess', _391 => _391.ssr]) === true && isOutsideAppRoot(id) ? toFarmRuntimeModuleId : void 0;
4652
+ const actionConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _392 => _392.getConfig, 'call', _393 => _393()]), () => ( options));
4538
4653
  let rewrotePackageImports = false;
4539
- 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) && !_chunkVO65MYJDcjs.hasUseClientDirective.call(void 0, code)) {
4654
+ if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([actionConfig, 'access', _394 => _394.experimental, 'optionalAccess', _395 => _395.serverComponents])) === "islands" && (!id.includes("/node_modules/") || _optionalChain([transformOptions, 'optionalAccess', _396 => _396.ssr]) === true && farmReactServerFiles.has(id.split("?", 1)[0])) && !id.startsWith("\0") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id) && !_chunk2IFT2CSAcjs.hasUseClientDirective.call(void 0, code)) {
4540
4655
  const file = id.split("?", 1)[0];
4541
- const projectRoot = actionConfig.root || _optionalChain([server, 'optionalAccess', _393 => _393.config, 'access', _394 => _394.root]) || process.cwd();
4542
- if (_optionalChain([transformOptions, 'optionalAccess', _395 => _395.ssr]) === true) {
4656
+ const projectRoot = actionConfig.root || _optionalChain([server, 'optionalAccess', _397 => _397.config, 'access', _398 => _398.root]) || process.cwd();
4657
+ if (_optionalChain([transformOptions, 'optionalAccess', _399 => _399.ssr]) === true) {
4543
4658
  if (farmReactServerFiles.has(file)) {
4544
- for (const child of _chunkVO65MYJDcjs.farmRelativeImportFiles.call(void 0, code, file))
4659
+ for (const child of _chunk2IFT2CSAcjs.farmRelativeImportFiles.call(void 0, code, file))
4545
4660
  farmReactServerFiles.add(child);
4546
4661
  }
4547
- const serverModule = farmReactServerFiles.has(file) || !_chunkVO65MYJDcjs.getFarmClientReachableModules.call(void 0,
4662
+ const serverModule = farmReactServerFiles.has(file) || !_chunk2IFT2CSAcjs.getFarmClientReachableModules.call(void 0,
4548
4663
  path6.resolve(projectRoot, actionConfig.srcDir || "src"),
4549
4664
  projectRoot
4550
4665
  ).has(path6.resolve(file));
4551
- const reactServer = !serverModule ? null : _chunkVO65MYJDcjs.rewriteFarmReactServerImports.call(void 0, {
4666
+ const reactServer = !serverModule ? null : _chunk2IFT2CSAcjs.rewriteFarmReactServerImports.call(void 0, {
4552
4667
  code,
4553
4668
  file,
4554
- reference: (specifier, exportName) => _chunkVO65MYJDcjs.ensureFarmPackageClientReference.call(void 0, projectRoot, specifier, exportName, file),
4669
+ reference: (specifier, exportName) => _chunk2IFT2CSAcjs.ensureFarmPackageClientReference.call(void 0, projectRoot, specifier, exportName, file),
4555
4670
  onServerFile: (serverFile) => farmReactServerFiles.add(serverFile)
4556
4671
  });
4557
4672
  if (reactServer !== null) {
4558
4673
  code = reactServer;
4559
4674
  rewrotePackageImports = true;
4560
4675
  }
4561
- const internal = farmReactServerFiles.has(file) ? _chunkVO65MYJDcjs.rewriteFarmReactServerClientModuleImports.call(void 0, {
4676
+ const internal = farmReactServerFiles.has(file) ? _chunk2IFT2CSAcjs.rewriteFarmReactServerClientModuleImports.call(void 0, {
4562
4677
  code,
4563
4678
  file,
4564
- reference: (clientFile) => _chunkVO65MYJDcjs.ensureFarmInternalClientReference.call(void 0, projectRoot, clientFile)
4679
+ reference: (clientFile) => _chunk2IFT2CSAcjs.ensureFarmInternalClientReference.call(void 0, projectRoot, clientFile)
4565
4680
  }) : null;
4566
4681
  if (internal !== null) {
4567
4682
  code = internal;
4568
4683
  rewrotePackageImports = true;
4569
4684
  }
4570
4685
  }
4571
- const referenced = _chunkVO65MYJDcjs.rewriteFarmPackageClientImports.call(void 0, {
4686
+ const referenced = _chunk2IFT2CSAcjs.rewriteFarmPackageClientImports.call(void 0, {
4572
4687
  code,
4573
4688
  file,
4574
4689
  root: projectRoot,
4575
- isClientPackage: (specifier) => _chunkVO65MYJDcjs.isFarmPackageClientBoundary.call(void 0, file, specifier, projectRoot)
4690
+ isClientPackage: (specifier) => _chunk2IFT2CSAcjs.isFarmPackageClientBoundary.call(void 0, file, specifier, projectRoot)
4576
4691
  });
4577
4692
  if (referenced !== null) {
4578
4693
  code = referenced;
4579
4694
  rewrotePackageImports = true;
4580
4695
  }
4581
- if (_optionalChain([transformOptions, 'optionalAccess', _396 => _396.ssr]) === true) {
4582
- const cached = rewriteFarmReactCacheImport(code, file);
4696
+ if (_optionalChain([transformOptions, 'optionalAccess', _400 => _400.ssr]) === true) {
4697
+ const cached = rewriteFarmReactCacheImport(
4698
+ code,
4699
+ file,
4700
+ _optionalChain([runtimeModule, 'optionalCall', _401 => _401(FARM_REACT_CACHE_MODULE)])
4701
+ );
4583
4702
  if (cached !== null) {
4584
4703
  code = cached;
4585
4704
  rewrotePackageImports = true;
@@ -4588,43 +4707,44 @@ export const manifest = getManifest();
4588
4707
  }
4589
4708
  if (islandsServerFns() && !_chunkPIUTGRDIcjs.isFarmServerFnBoundaryId.call(void 0, id) && !id.includes("/node_modules/") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id)) {
4590
4709
  const serverFns = _chunkPIUTGRDIcjs.transformFarmServerFns.call(void 0, code, id, {
4591
- environment: _optionalChain([transformOptions, 'optionalAccess', _397 => _397.ssr]) === true ? "rsc" : "client"
4710
+ environment: _optionalChain([transformOptions, 'optionalAccess', _402 => _402.ssr]) === true ? "rsc" : "client"
4592
4711
  });
4593
4712
  if (serverFns) {
4594
4713
  if (!serverFns.code.includes("use server")) return { code: serverFns.code, map: null };
4595
4714
  code = serverFns.code;
4596
4715
  }
4597
4716
  }
4598
- 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)) {
4717
+ if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([actionConfig, 'access', _403 => _403.experimental, 'optionalAccess', _404 => _404.serverComponents])) === "islands" && code.includes("use server") && !id.includes("/node_modules/") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id)) {
4599
4718
  const file = id.split("?", 1)[0];
4600
4719
  const actionModule = transformFarmFormActionModule({
4601
4720
  code,
4602
4721
  id,
4603
- root: actionConfig.root || _optionalChain([server, 'optionalAccess', _400 => _400.config, 'access', _401 => _401.root]) || process.cwd(),
4604
- ssr: _optionalChain([transformOptions, 'optionalAccess', _402 => _402.ssr]) === true,
4722
+ root: actionConfig.root || _optionalChain([server, 'optionalAccess', _405 => _405.config, 'access', _406 => _406.root]) || process.cwd(),
4723
+ ssr: _optionalChain([transformOptions, 'optionalAccess', _407 => _407.ssr]) === true,
4605
4724
  // Parsed by file type: page components are TSX.
4606
- parse: (source) => _vite.parseSync.call(void 0, file, source).program
4725
+ parse: (source) => _vite.parseSync.call(void 0, file, source).program,
4726
+ runtimeModule
4607
4727
  });
4608
4728
  if (actionModule) return { code: actionModule, map: null };
4609
4729
  }
4610
- if (!_optionalChain([transformOptions, 'optionalAccess', _403 => _403.ssr])) {
4611
- const docsConfigModule = _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, _optionalChain([farmApp, 'optionalAccess', _404 => _404.getConfig, 'call', _405 => _405(), 'optionalAccess', _406 => _406.docs]));
4612
- if (_chunkDHR2WDSLcjs.isFarmDocsClientConfigModule.call(void 0, id, docsConfigModule)) {
4613
- const redacted = _chunkDHR2WDSLcjs.redactFarmDocsClientConfig.call(void 0, code, id.split("?")[0]);
4730
+ if (!_optionalChain([transformOptions, 'optionalAccess', _408 => _408.ssr])) {
4731
+ const docsConfigModule = _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, _optionalChain([farmApp, 'optionalAccess', _409 => _409.getConfig, 'call', _410 => _410(), 'optionalAccess', _411 => _411.docs]));
4732
+ if (_chunkKWST2O22cjs.isFarmDocsClientConfigModule.call(void 0, id, docsConfigModule)) {
4733
+ const redacted = _chunkKWST2O22cjs.redactFarmDocsClientConfig.call(void 0, code, id.split("?")[0]);
4614
4734
  if (redacted !== null) return { code: redacted, map: null };
4615
4735
  }
4616
4736
  }
4617
- if (!_optionalChain([transformOptions, 'optionalAccess', _407 => _407.ssr])) {
4618
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _408 => _408.getConfig, 'call', _409 => _409()]), () => ( options));
4619
- if ((_optionalChain([currentConfig, 'access', _410 => _410.experimental, 'optionalAccess', _411 => _411.serverActions]) !== true || !serverFnTransformActive) && !islandsServerFns()) {
4737
+ if (!_optionalChain([transformOptions, 'optionalAccess', _412 => _412.ssr])) {
4738
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _413 => _413.getConfig, 'call', _414 => _414()]), () => ( options));
4739
+ if ((_optionalChain([currentConfig, 'access', _415 => _415.experimental, 'optionalAccess', _416 => _416.serverActions]) !== true || !serverFnTransformActive) && !islandsServerFns()) {
4620
4740
  const violation = findClientServerFnViolation(code, id);
4621
4741
  if (violation) {
4622
4742
  this.error(formatServerFnBoundaryError(violation, id));
4623
4743
  }
4624
4744
  }
4625
4745
  }
4626
- if (!_optionalChain([transformOptions, 'optionalAccess', _412 => _412.ssr]) && shouldInspectClientBoundary(id, code)) {
4627
- warnClientBoundaryOnce(this, id, code, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _413 => _413.getConfig, 'call', _414 => _414()]), () => ( options)));
4746
+ if (!_optionalChain([transformOptions, 'optionalAccess', _417 => _417.ssr]) && shouldInspectClientBoundary(id, code)) {
4747
+ warnClientBoundaryOnce(this, id, code, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _418 => _418.getConfig, 'call', _419 => _419()]), () => ( options)));
4628
4748
  }
4629
4749
  if (typeof imageImports.transform === "function") {
4630
4750
  const imageModule = await imageImports.transform.call(this, code, id, transformOptions);
@@ -4639,13 +4759,13 @@ export const manifest = getManifest();
4639
4759
  id,
4640
4760
  transformOptions
4641
4761
  );
4642
- const fontCode = typeof fontResult === "string" ? fontResult : _optionalChain([fontResult, 'optionalAccess', _415 => _415.code, 'optionalAccess', _416 => _416.toString, 'call', _417 => _417()]);
4762
+ const fontCode = typeof fontResult === "string" ? fontResult : _optionalChain([fontResult, 'optionalAccess', _420 => _420.code, 'optionalAccess', _421 => _421.toString, 'call', _422 => _422()]);
4643
4763
  if (fontCode) {
4644
4764
  transformedCode = fontCode;
4645
4765
  transformed = true;
4646
4766
  }
4647
4767
  }
4648
- if (_optionalChain([transformOptions, 'optionalAccess', _418 => _418.ssr]) && server) {
4768
+ if (_optionalChain([transformOptions, 'optionalAccess', _423 => _423.ssr]) && server) {
4649
4769
  const rewrittenImports = rewriteEarlySsrRelativeImports({
4650
4770
  code: transformedCode,
4651
4771
  id,
@@ -4657,26 +4777,26 @@ export const manifest = getManifest();
4657
4777
  transformed = true;
4658
4778
  }
4659
4779
  }
4660
- if (_chunkVO65MYJDcjs.hasUseClientDirective.call(void 0, transformedCode)) {
4780
+ if (_chunk2IFT2CSAcjs.hasUseClientDirective.call(void 0, transformedCode)) {
4661
4781
  const clientBoundarySource = transformedCode;
4662
4782
  const moduleInfo = this.getModuleInfo(id);
4663
4783
  if (moduleInfo) {
4664
4784
  moduleInfo.isClientComponent = true;
4665
4785
  }
4666
- transformedCode = _chunkVO65MYJDcjs.stripUseClientDirective.call(void 0, transformedCode);
4786
+ transformedCode = _chunk2IFT2CSAcjs.stripUseClientDirective.call(void 0, transformedCode);
4667
4787
  transformed = true;
4668
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _419 => _419.getConfig, 'call', _420 => _420()]), () => ( options));
4788
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _424 => _424.getConfig, 'call', _425 => _425()]), () => ( options));
4669
4789
  let isolatedModuleReference = null;
4670
- const root = currentConfig.root || _optionalChain([server, 'optionalAccess', _421 => _421.config, 'access', _422 => _422.root]) || process.cwd();
4790
+ const root = currentConfig.root || _optionalChain([server, 'optionalAccess', _426 => _426.config, 'access', _427 => _427.root]) || process.cwd();
4671
4791
  const cleanId = id.split("?", 1)[0];
4672
- const selectedIsolatedModules = _nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _423 => _423.getRouteManager, 'call', _424 => _424(), 'access', _425 => _425.getIsolatedClientBoundaryModules, 'call', _426 => _426(root)])));
4673
- const selectedForIsolatedHydration = _optionalChain([selectedIsolatedModules, 'optionalAccess', _427 => _427.has, 'call', _428 => _428(path6.resolve(cleanId))]) === true;
4674
- if (_chunk67MZTLTFcjs.isReactRenderer.call(void 0, _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, currentConfig.renderer)) && selectedForIsolatedHydration && (_chunkVO65MYJDcjs.isIsolatableClientBoundarySource.call(void 0, clientBoundarySource) || // A generated client reference, whose marker comment compiled TSX no longer has.
4675
- cleanId.replace(/\\/g, "/").includes(_chunkVO65MYJDcjs.FARM_CLIENT_REFERENCE_DIRECTORY))) {
4792
+ const selectedIsolatedModules = _nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _428 => _428.getRouteManager, 'call', _429 => _429(), 'access', _430 => _430.getIsolatedClientBoundaryModules, 'call', _431 => _431(root)])));
4793
+ const selectedForIsolatedHydration = _optionalChain([selectedIsolatedModules, 'optionalAccess', _432 => _432.has, 'call', _433 => _433(path6.resolve(cleanId))]) === true;
4794
+ if (_chunk67MZTLTFcjs.isReactRenderer.call(void 0, _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, currentConfig.renderer)) && selectedForIsolatedHydration && (_chunk2IFT2CSAcjs.isIsolatableClientBoundarySource.call(void 0, clientBoundarySource) || // A generated client reference, whose marker comment compiled TSX no longer has.
4795
+ cleanId.replace(/\\/g, "/").includes(_chunk2IFT2CSAcjs.FARM_CLIENT_REFERENCE_DIRECTORY))) {
4676
4796
  isolatedModuleReference = _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, cleanId, root);
4677
- const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([currentConfig, 'access', _429 => _429.experimental, 'optionalAccess', _430 => _430.serverComponents])) === "islands";
4678
- const explicitStrategy = _chunkVO65MYJDcjs.getIslandStrategyExport.call(void 0, clientBoundarySource);
4679
- const inference = islandsMode && explicitStrategy === null ? _chunkDHR2WDSLcjs.inferFarmIslandStrategy.call(void 0, cleanId, root) : null;
4797
+ const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([currentConfig, 'access', _434 => _434.experimental, 'optionalAccess', _435 => _435.serverComponents])) === "islands";
4798
+ const explicitStrategy = _chunk2IFT2CSAcjs.getIslandStrategyExport.call(void 0, clientBoundarySource);
4799
+ const inference = islandsMode && explicitStrategy === null ? _chunkKWST2O22cjs.inferFarmIslandStrategy.call(void 0, cleanId, root) : null;
4680
4800
  if (inference) {
4681
4801
  for (const file of inference.files) {
4682
4802
  if (file !== path6.resolve(cleanId)) this.addWatchFile(file);
@@ -4689,8 +4809,9 @@ export const manifest = getManifest();
4689
4809
  islandStrategy: _nullishCoalesce(explicitStrategy, () => ( "load")),
4690
4810
  parse: (source) => this.parse(source),
4691
4811
  slots: islandsMode,
4692
- browser: _optionalChain([transformOptions, 'optionalAccess', _431 => _431.ssr]) !== true,
4693
- inferredInteraction: _optionalChain([inference, 'optionalAccess', _432 => _432.strategy]) === "interaction"
4812
+ browser: _optionalChain([transformOptions, 'optionalAccess', _436 => _436.ssr]) !== true,
4813
+ inferredInteraction: _optionalChain([inference, 'optionalAccess', _437 => _437.strategy]) === "interaction",
4814
+ runtimeModule
4694
4815
  });
4695
4816
  if (!transformedBoundary) {
4696
4817
  this.error(
@@ -4720,7 +4841,7 @@ export const manifest = getManifest();
4720
4841
  );
4721
4842
  return;
4722
4843
  }` : "";
4723
- const hmrCode = _optionalChain([transformOptions, 'optionalAccess', _433 => _433.ssr]) || reactRefreshActive || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
4844
+ const hmrCode = _optionalChain([transformOptions, 'optionalAccess', _438 => _438.ssr]) || reactRefreshActive || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
4724
4845
  if (import.meta.hot) {
4725
4846
  import.meta.hot.accept((newModule) => {
4726
4847
  ${isolatedHmrUpdate}
@@ -4776,14 +4897,14 @@ if (import.meta.hot) {
4776
4897
  }
4777
4898
  _chunkQMNWKQL4cjs.logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
4778
4899
  _chunkQMNWKQL4cjs.logger.info("Pre-rendering SSG pages...");
4779
- const outDir = path6.join(_optionalChain([server, 'optionalAccess', _434 => _434.config, 'access', _435 => _435.root]) || process.cwd(), options.outDir || "dist");
4900
+ const outDir = path6.join(_optionalChain([server, 'optionalAccess', _439 => _439.config, 'access', _440 => _440.root]) || process.cwd(), options.outDir || "dist");
4780
4901
  const clientDir = path6.join(outDir, "client");
4781
4902
  for (const page of ssgPages) {
4782
4903
  try {
4783
4904
  const staticRequest = new Request(new URL(page.urlPath, "http://farm.static"));
4784
4905
  await farmApp.getServerRenderer().runWithRequestContext(staticRequest, async () => {
4785
4906
  const mod = await routeManager.loadRouteModule(page.filePath);
4786
- if (!_optionalChain([mod, 'optionalAccess', _436 => _436.default])) return;
4907
+ if (!_optionalChain([mod, 'optionalAccess', _441 => _441.default])) return;
4787
4908
  const { layouts } = routeManager.matchRoute(page.urlPath);
4788
4909
  const layoutModules = await Promise.all(
4789
4910
  layouts.map((l) => routeManager.loadLayoutModule(l.modulePath))
@@ -4812,10 +4933,10 @@ if (import.meta.hot) {
4812
4933
  );
4813
4934
  }
4814
4935
  const html = renderToString(pageElement);
4815
- const i18nSnapshot = _chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, );
4936
+ const i18nSnapshot = _chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0, );
4816
4937
  const i18nHead = renderFarmI18nStaticHead(page.urlPath, i18nSnapshot);
4817
4938
  const fullHtml = `<!DOCTYPE html>
4818
- <html lang="${escapeFarmHtmlAttribute(_optionalChain([i18nSnapshot, 'optionalAccess', _437 => _437.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}>
4939
+ <html lang="${escapeFarmHtmlAttribute(_optionalChain([i18nSnapshot, 'optionalAccess', _442 => _442.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}>
4819
4940
  <head>
4820
4941
  <meta charset="utf-8">
4821
4942
  <meta name="viewport" content="width=device-width, initial-scale=1">
@@ -4858,8 +4979,8 @@ if (import.meta.hot) {
4858
4979
  }
4859
4980
  },
4860
4981
  watchChange() {
4861
- _chunkVO65MYJDcjs.invalidateFarmClientReachableModules.call(void 0, );
4862
- _chunkVO65MYJDcjs.invalidateFarmClientOnlyScan.call(void 0, );
4982
+ _chunk2IFT2CSAcjs.invalidateFarmClientReachableModules.call(void 0, );
4983
+ _chunk2IFT2CSAcjs.invalidateFarmClientOnlyScan.call(void 0, );
4863
4984
  },
4864
4985
  async handleHotUpdate(ctx) {
4865
4986
  if (pendingClientSetup && !farmSetupContext.getStore()) await pendingClientSetup;
@@ -4884,13 +5005,13 @@ if (import.meta.hot) {
4884
5005
  server2.moduleGraph.invalidateModule(mod);
4885
5006
  }
4886
5007
  }
4887
- const currentFarmConfig = _optionalChain([farmApp, 'optionalAccess', _438 => _438.getConfig, 'call', _439 => _439()]);
5008
+ const currentFarmConfig = _optionalChain([farmApp, 'optionalAccess', _443 => _443.getConfig, 'call', _444 => _444()]);
4888
5009
  const normalizedFile = file.replace(/\\/g, "/");
4889
5010
  if (currentFarmConfig && /\/route\.(?:ts|tsx|js|jsx)$/.test(normalizedFile) && _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, currentFarmConfig).some(
4890
5011
  (appDir) => normalizedFile.startsWith(`${_chunkQMNWKQL4cjs.toPosixPath.call(void 0, appDir)}/api/`)
4891
5012
  )) {
4892
5013
  for (const mod of modules) server2.moduleGraph.invalidateModule(mod);
4893
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _440 => _440(`updated ${file}`)]);
5014
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _445 => _445(`updated ${file}`)]);
4894
5015
  server2.ws.send({ type: "full-reload", path: "*" });
4895
5016
  return [];
4896
5017
  }
@@ -4900,7 +5021,7 @@ if (import.meta.hot) {
4900
5021
  for (const mod of modules) {
4901
5022
  server2.moduleGraph.invalidateModule(mod);
4902
5023
  }
4903
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _441 => _441(`updated ${file}`)]);
5024
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _446 => _446(`updated ${file}`)]);
4904
5025
  server2.ws.send({
4905
5026
  type: "full-reload",
4906
5027
  path: "*"
@@ -4913,7 +5034,7 @@ if (import.meta.hot) {
4913
5034
  for (const mod of modules) {
4914
5035
  server2.moduleGraph.invalidateModule(mod);
4915
5036
  }
4916
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _442 => _442(`updated ${file}`)]);
5037
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _447 => _447(`updated ${file}`)]);
4917
5038
  server2.ws.send({
4918
5039
  type: "full-reload",
4919
5040
  path: "*"
@@ -4921,12 +5042,12 @@ if (import.meta.hot) {
4921
5042
  return [];
4922
5043
  }
4923
5044
  if (apiRouteManager && _chunkJYNNIGQOcjs.invalidateFarmDevDependents.call(void 0, server2, file, apiRouteManager.getSourceFiles()).length > 0) {
4924
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _443 => _443(`updated ${file}`)]);
5045
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _448 => _448(`updated ${file}`)]);
4925
5046
  }
4926
- const isolatedHydrationMode = _optionalChain([currentFarmConfig, 'optionalAccess', _444 => _444.experimental, 'optionalAccess', _445 => _445.isolatedClientHydration]);
4927
- const planRouteManager = _optionalChain([farmApp, 'optionalAccess', _446 => _446.getRouteManager, 'call', _447 => _447()]);
5047
+ const isolatedHydrationMode = _optionalChain([currentFarmConfig, 'optionalAccess', _449 => _449.experimental, 'optionalAccess', _450 => _450.isolatedClientHydration]);
5048
+ const planRouteManager = _optionalChain([farmApp, 'optionalAccess', _451 => _451.getRouteManager, 'call', _452 => _452()]);
4928
5049
  const isHydrationPlanSource = currentSrcRoot !== null && normalizedFile.startsWith(`${currentSrcRoot}/`) && /\.[cm]?[jt]sx?$/.test(normalizedFile);
4929
- const tracksAsyncOwnerIslands = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, _optionalChain([currentFarmConfig, 'optionalAccess', _448 => _448.renderer])) && planRouteManager !== void 0;
5050
+ const tracksAsyncOwnerIslands = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, _optionalChain([currentFarmConfig, 'optionalAccess', _453 => _453.renderer])) && planRouteManager !== void 0;
4930
5051
  let clientPlanCurrent = false;
4931
5052
  if (isHydrationPlanSource && (isolatedHydrationMode === "enabled" || isolatedHydrationMode === "analyze" || tracksAsyncOwnerIslands)) {
4932
5053
  const routeManager = planRouteManager;
@@ -4988,7 +5109,7 @@ if (import.meta.hot) {
4988
5109
  }
4989
5110
  return [];
4990
5111
  }
4991
- if (!clientPlanCurrent) _optionalChain([farmApp, 'optionalAccess', _449 => _449.getRouteManager, 'call', _450 => _450(), 'access', _451 => _451.invalidateClientManifest, 'call', _452 => _452()]);
5112
+ if (!clientPlanCurrent) _optionalChain([farmApp, 'optionalAccess', _454 => _454.getRouteManager, 'call', _455 => _455(), 'access', _456 => _456.invalidateClientManifest, 'call', _457 => _457()]);
4992
5113
  const manifestModule = server2.moduleGraph.getModuleById("/@farm/manifest");
4993
5114
  if (manifestModule) {
4994
5115
  server2.moduleGraph.invalidateModule(manifestModule);
@@ -5046,10 +5167,17 @@ if (import.meta.hot) {
5046
5167
  }
5047
5168
  function runFarmMiddlewareWithNavigation(renderer, middlewareRequest, req, res, execute) {
5048
5169
  return renderer.runWithRequestContext(middlewareRequest, async () => {
5170
+ const headersBeforeMiddleware = res.getHeaders();
5049
5171
  try {
5050
5172
  return await execute();
5051
5173
  } catch (error) {
5052
5174
  if (await renderer.respondToNavigationError(req, res, error)) return true;
5175
+ if (!res.headersSent) {
5176
+ for (const name of res.getHeaderNames()) res.removeHeader(name);
5177
+ for (const [name, value] of Object.entries(headersBeforeMiddleware)) {
5178
+ if (value !== void 0) res.setHeader(name, value);
5179
+ }
5180
+ }
5053
5181
  throw error;
5054
5182
  }
5055
5183
  });
@@ -5092,7 +5220,7 @@ function createPageDataMiddlewareResponse(res) {
5092
5220
  return (...args) => {
5093
5221
  if (captures(target.statusCode, target.getHeader("location"))) {
5094
5222
  const callback = args.find((arg) => typeof arg === "function");
5095
- _optionalChain([callback, 'optionalCall', _453 => _453()]);
5223
+ _optionalChain([callback, 'optionalCall', _458 => _458()]);
5096
5224
  return property === "write" ? true : response;
5097
5225
  }
5098
5226
  return target[property](...args);
@@ -5125,9 +5253,9 @@ function readWriteHeadLocation(headers) {
5125
5253
  }
5126
5254
  async function sendFarmPageDataRedirect(res, redirect, deploymentId) {
5127
5255
  for (const name of ["location", "content-length", "content-type"]) res.removeHeader(name);
5128
- await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
5256
+ await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
5129
5257
  res,
5130
- _chunkI7J5RLGOcjs.withFarmDeploymentResponse.call(void 0, _chunkRWR7SMD7cjs.createFarmPageDataRedirectResponse.call(void 0, redirect), deploymentId)
5258
+ _chunkNLBHLPEOcjs.withFarmDeploymentResponse.call(void 0, _chunkRWR7SMD7cjs.createFarmPageDataRedirectResponse.call(void 0, redirect), deploymentId)
5131
5259
  );
5132
5260
  }
5133
5261
  function resolveDevelopmentRoot(farmRoot, viteRoot) {
@@ -5156,12 +5284,12 @@ function isFarmClientVirtualId(id) {
5156
5284
  }
5157
5285
  function isClientEnvironment(context, loadOptions) {
5158
5286
  const environment = context.environment;
5159
- if (_optionalChain([environment, 'optionalAccess', _454 => _454.config, 'optionalAccess', _455 => _455.consumer])) return environment.config.consumer === "client";
5160
- if (_optionalChain([environment, 'optionalAccess', _456 => _456.name])) return environment.name === "client";
5161
- return _optionalChain([loadOptions, 'optionalAccess', _457 => _457.ssr]) !== true;
5287
+ if (_optionalChain([environment, 'optionalAccess', _459 => _459.config, 'optionalAccess', _460 => _460.consumer])) return environment.config.consumer === "client";
5288
+ if (_optionalChain([environment, 'optionalAccess', _461 => _461.name])) return environment.name === "client";
5289
+ return _optionalChain([loadOptions, 'optionalAccess', _462 => _462.ssr]) !== true;
5162
5290
  }
5163
5291
  function invalidateProgrammaticClientRouteModules(server) {
5164
- const graph = _optionalChain([server, 'access', _458 => _458.environments, 'optionalAccess', _459 => _459.client, 'optionalAccess', _460 => _460.moduleGraph]);
5292
+ const graph = _optionalChain([server, 'access', _463 => _463.environments, 'optionalAccess', _464 => _464.client, 'optionalAccess', _465 => _465.moduleGraph]);
5165
5293
  if (!graph) return;
5166
5294
  for (const [id, module] of graph.idToModuleMap) {
5167
5295
  if (_chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, id)) graph.invalidateModule(module);
@@ -5171,19 +5299,19 @@ function generateProgrammaticClientRouteModuleForId(moduleId, root, renderer, cl
5171
5299
  const parsed = _chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, moduleId);
5172
5300
  const routesFile = resolveRealModuleFile(parsed.filePath, root);
5173
5301
  watchFile(routesFile);
5174
- return _chunkVO65MYJDcjs.generateProgrammaticClientRouteModule.call(void 0, {
5302
+ return _chunk2IFT2CSAcjs.generateProgrammaticClientRouteModule.call(void 0, {
5175
5303
  kind: parsed.kind,
5176
5304
  routePath: parsed.routePath,
5177
5305
  routesFile,
5178
- route: parsed.kind === "api" ? void 0 : _optionalChain([clientRoutes, 'optionalAccess', _461 => _461.routes, 'access', _462 => _462.get, 'call', _463 => _463(
5179
- _chunkVO65MYJDcjs.programmaticClientRouteKey.call(void 0, routesFile, parsed.kind, parsed.routePath)
5306
+ route: parsed.kind === "api" ? void 0 : _optionalChain([clientRoutes, 'optionalAccess', _466 => _466.routes, 'access', _467 => _467.get, 'call', _468 => _468(
5307
+ _chunk2IFT2CSAcjs.programmaticClientRouteKey.call(void 0, routesFile, parsed.kind, parsed.routePath)
5180
5308
  )]),
5181
5309
  rendererServer: renderer.server,
5182
5310
  toImportSpecifier: (file) => toProgrammaticRouteImportSpecifier(file, root)
5183
5311
  });
5184
5312
  }
5185
5313
  function resolveRealModuleFile(filePath, root) {
5186
- const resolved = _nullishCoalesce(_chunkVO65MYJDcjs.resolveModuleSourcePath.call(void 0, filePath, root), () => ( filePath));
5314
+ const resolved = _nullishCoalesce(_chunk2IFT2CSAcjs.resolveModuleSourcePath.call(void 0, filePath, root), () => ( filePath));
5187
5315
  try {
5188
5316
  return _chunkQMNWKQL4cjs.toPosixPath.call(void 0, fs2.realpathSync(resolved));
5189
5317
  } catch (e28) {
@@ -5497,12 +5625,12 @@ async function parseRouteModuleProps(routeModule, input) {
5497
5625
  }
5498
5626
  const schemas = routeModule.__farmRouteSchemas;
5499
5627
  const params = parseRouteModuleSchema(
5500
- _optionalChain([schemas, 'optionalAccess', _464 => _464.params]),
5628
+ _optionalChain([schemas, 'optionalAccess', _469 => _469.params]),
5501
5629
  input.props.params,
5502
5630
  "params",
5503
5631
  input.routePath
5504
5632
  );
5505
- const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _465 => _465.search]), input.search, "search", input.routePath);
5633
+ const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _470 => _470.search]), input.search, "search", input.routePath);
5506
5634
  return {
5507
5635
  ...input.props,
5508
5636
  params,
@@ -5522,12 +5650,12 @@ function parseRouteModuleSchema(schema, value, label, routePath) {
5522
5650
  }
5523
5651
  }
5524
5652
  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) {
5525
- const providerClientCode = _chunkDHR2WDSLcjs.generateFarmIntegrationProviderClientCode.call(void 0,
5653
+ const providerClientCode = _chunkKWST2O22cjs.generateFarmIntegrationProviderClientCode.call(void 0,
5526
5654
  integrationProviders,
5527
5655
  root,
5528
5656
  _nullishCoalesce(renderer.componentExtensions, () => ( []))
5529
5657
  );
5530
- const clientPluginEntry = _chunkQ4HH5Q6Acjs.generateFarmClientPluginEntryCode.call(void 0,
5658
+ const clientPluginEntry = _chunkDMXMIE2Ccjs.generateFarmClientPluginEntryCode.call(void 0,
5531
5659
  plugins,
5532
5660
  root,
5533
5661
  srcDir,
@@ -5568,14 +5696,15 @@ async function createFarmServerTreePageElement(source, pathname) {
5568
5696
  return await createFarmServerTreeElement(React, source, {
5569
5697
  load: (reference) => import(/* @vite-ignore */ farmModuleUrl(reference)),
5570
5698
  ServerHtml: FarmServerPage,
5571
- key: pathname,
5699
+ // No key: the next page of the same layout updates this one in place, as React Server
5700
+ // Components do, instead of unmounting it and building every node again.
5572
5701
  });
5573
5702
  } catch (error) {
5574
5703
  console.warn('[Farm.js] Could not rebuild the server tree of ' + pathname + '; its server HTML was kept.', error);
5575
5704
  return null;
5576
5705
  }
5577
5706
  }
5578
- ${islandValues ? `${_chunkDHR2WDSLcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
5707
+ ${islandValues ? `${_chunkKWST2O22cjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
5579
5708
  let farmLastRouteState = null;
5580
5709
 
5581
5710
  // A hot update to a layout tree's client module renders the route again.
@@ -6386,7 +6515,7 @@ async function loadLayoutComponents(layouts = [], params = {}, source) {
6386
6515
  return loadedLayouts;
6387
6516
  }
6388
6517
 
6389
- ${_chunkDHR2WDSLcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
6518
+ ${_chunkKWST2O22cjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
6390
6519
  function wrapWithLoadedLayouts(element, loadedLayouts, params) {
6391
6520
  let wrapped = element;
6392
6521
  for (let index = loadedLayouts.length - 1; index >= 0; index--) {
@@ -6671,7 +6800,7 @@ function readActiveLayoutPatterns() {
6671
6800
  .filter(Boolean);
6672
6801
  }
6673
6802
 
6674
- ${_chunkDHR2WDSLcjs.FARM_NAVIGATION_SCRIPT_SOURCE}
6803
+ ${_chunkKWST2O22cjs.FARM_NAVIGATION_SCRIPT_SOURCE}
6675
6804
 
6676
6805
  function activateFragmentScripts(root) {
6677
6806
  for (const script of Array.from(root.querySelectorAll?.('script') || [])) {
@@ -6730,7 +6859,7 @@ function getLayoutShell(root, patterns, index, find) {
6730
6859
  return shell.innerHTML;
6731
6860
  }
6732
6861
 
6733
- ${islandValues ? _chunkDHR2WDSLcjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceNavigationBoundary(
6862
+ ${islandValues ? _chunkKWST2O22cjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceNavigationBoundary(
6734
6863
  container,
6735
6864
  fragment,
6736
6865
  currentPatterns,
@@ -6803,7 +6932,7 @@ ${islandValues ? `
6803
6932
  return nextTarget;
6804
6933
  }
6805
6934
 
6806
- ${islandValues ? `${_chunkDHR2WDSLcjs.FARM_NAVIGATION_STREAM_READER_SOURCE}
6935
+ ${islandValues ? `${_chunkKWST2O22cjs.FARM_NAVIGATION_STREAM_READER_SOURCE}
6807
6936
 
6808
6937
  // Islands mode navigates as the production client does: it fetches the page itself, names the
6809
6938
  // layouts it shows by key (F-Layouts), and asks for flush markers (F-Stream), so the shell arrives
@@ -7498,9 +7627,9 @@ function generateClientManifest(bundle) {
7498
7627
  return manifest;
7499
7628
  }
7500
7629
  async function defineConfig(config = {}) {
7501
- const tailwindVitePlugin = await _chunkQ4HH5Q6Acjs.loadTailwindVitePlugin.call(void 0, );
7630
+ const tailwindVitePlugin = await _chunkDMXMIE2Ccjs.loadTailwindVitePlugin.call(void 0, );
7502
7631
  const appRoot = path6.resolve(config.root || process.cwd());
7503
- if (_optionalChain([config, 'access', _466 => _466.extends, 'optionalAccess', _467 => _467.length])) {
7632
+ if (_optionalChain([config, 'access', _471 => _471.extends, 'optionalAccess', _472 => _472.length])) {
7504
7633
  const { config: layeredConfig } = await import("./layers-7P4RLKVX.cjs").then(
7505
7634
  ({ resolveFarmLayers }) => resolveFarmLayers(config, {
7506
7635
  root: appRoot,
@@ -7510,11 +7639,11 @@ async function defineConfig(config = {}) {
7510
7639
  config = layeredConfig;
7511
7640
  }
7512
7641
  config.renderer = _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, config.renderer);
7513
- config.images = _chunkDHR2WDSLcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, { root: appRoot, dev: true });
7642
+ config.images = _chunkKWST2O22cjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, { root: appRoot, dev: true });
7514
7643
  const rendererVitePlugins = await _chunk67MZTLTFcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, appRoot, {
7515
7644
  ssr: true
7516
7645
  });
7517
- const reactRefreshPlugins = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) ? await _chunk65Y5SIBHcjs.createFarmReactRefreshPlugins.call(void 0, ) : [];
7646
+ const reactRefreshPlugins = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) ? await _chunk3QM74STYcjs.createFarmReactRefreshPlugins.call(void 0, ) : [];
7518
7647
  const nodeBuiltinStubs = {
7519
7648
  "node:string_decoder": "data:text/javascript,export class StringDecoder { write(buf) { return ''; } end() { return ''; } }; export default StringDecoder;",
7520
7649
  "node:buffer": "data:text/javascript,export const Buffer = { from: () => ({}), alloc: () => ({}), isBuffer: () => false }; export default { Buffer };",
@@ -7602,13 +7731,13 @@ async function defineConfig(config = {}) {
7602
7731
  if (!serverStarted) {
7603
7732
  serverStarted = true;
7604
7733
  const elapsed = Date.now() - startTime;
7605
- const address = _optionalChain([server, 'access', _468 => _468.httpServer, 'optionalAccess', _469 => _469.address, 'call', _470 => _470()]);
7734
+ const address = _optionalChain([server, 'access', _473 => _473.httpServer, 'optionalAccess', _474 => _474.address, 'call', _475 => _475()]);
7606
7735
  const resolvedPort = typeof address === "object" && address ? address.port : server.config.server.port || port || 3e3;
7607
7736
  const hostConfig = server.config.server.host;
7608
7737
  const isExposed = hostConfig === true || hostConfig === "0.0.0.0";
7609
7738
  console.log("");
7610
7739
  console.log(
7611
- ` ${pc.bold(pc.green("Farm.js"))} ${pc.dim(`v${_chunk22LGTSBAcjs.FARM_VERSION}`)} ${pc.dim(`ready in ${elapsed}ms`)}`
7740
+ ` ${pc.bold(pc.green("Farm.js"))} ${pc.dim(`v${_chunkMEJCP2LXcjs.FARM_VERSION}`)} ${pc.dim(`ready in ${elapsed}ms`)}`
7612
7741
  );
7613
7742
  console.log("");
7614
7743
  console.log(
@@ -7641,8 +7770,8 @@ async function defineConfig(config = {}) {
7641
7770
  return {
7642
7771
  plugins: [
7643
7772
  // `farm dev --desktop`: only the desktop window gets an answer, as in the packaged app.
7644
- _chunk65Y5SIBHcjs.farmDesktopDevGuardPlugin.call(void 0, config.basePath),
7645
- _chunkDHR2WDSLcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
7773
+ _chunk3QM74STYcjs.farmDesktopDevGuardPlugin.call(void 0, config.basePath),
7774
+ _chunkKWST2O22cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
7646
7775
  tailwindVitePlugin,
7647
7776
  ...rendererVitePlugins,
7648
7777
  ...reactRefreshPlugins,
@@ -7650,14 +7779,14 @@ async function defineConfig(config = {}) {
7650
7779
  farmI18nClientBridgePlugin(),
7651
7780
  farmServerOnlyEntriesPlugin(),
7652
7781
  farmPlugin(config),
7653
- _chunkVO65MYJDcjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
7782
+ _chunk2IFT2CSAcjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
7654
7783
  farmBrandingPlugin
7655
7784
  ],
7656
7785
  customLogger: farmLogger,
7657
7786
  clearScreen: false,
7658
7787
  optimizeDeps: {
7659
- ..._chunkDHR2WDSLcjs.createFarmClientOptimizeDepsConfig.call(void 0,
7660
- _chunkDHR2WDSLcjs.createFarmClientOptimizeDepsEntries.call(void 0,
7788
+ ..._chunkKWST2O22cjs.createFarmClientOptimizeDepsConfig.call(void 0,
7789
+ _chunkKWST2O22cjs.createFarmClientOptimizeDepsEntries.call(void 0,
7661
7790
  appRoot,
7662
7791
  _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, { ...config, root: appRoot })
7663
7792
  ),
@@ -7700,7 +7829,7 @@ async function defineConfig(config = {}) {
7700
7829
  // Stub out problematic server-only modules during dev mode
7701
7830
  alias: {
7702
7831
  ..._chunkMTBDJ326cjs.getFarmLayerAliases.call(void 0, config.layers),
7703
- ..._chunkDHR2WDSLcjs.createFarmSourceAlias.call(void 0, appRoot, config.srcDir),
7832
+ ..._chunkKWST2O22cjs.createFarmSourceAlias.call(void 0, appRoot, config.srcDir),
7704
7833
  // Nitro internals that should not be resolved in browser
7705
7834
  "supports-color": "data:text/javascript,export default false; export const supportsColor = false; export const stdout = false; export const stderr = false;",
7706
7835
  "@poppinss/dumper": "data:text/javascript,export default {};",
@@ -7729,4 +7858,6 @@ async function defineConfig(config = {}) {
7729
7858
 
7730
7859
 
7731
7860
 
7732
- 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;
7861
+
7862
+
7863
+ 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;