@farm.js/core 0.1.35 → 0.1.37

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 (285) hide show
  1. package/dist/{metadata-BnLDsUOS.d.ts → agent-mcp-BC0bAGVF.d.mts} +45 -2
  2. package/dist/agent-mcp-handler-LPJ2CADR.mjs +19 -0
  3. package/dist/agent-mcp-handler-SJAHFSPI.cjs +19 -0
  4. package/dist/{metadata-WGpBYcGn.d.mts → agent-mcp-jyDHbQKe.d.ts} +45 -2
  5. package/dist/agent-runtime.cjs +6 -4
  6. package/dist/agent-runtime.d.mts +1 -1
  7. package/dist/agent-runtime.d.ts +1 -1
  8. package/dist/agent-runtime.mjs +5 -3
  9. package/dist/api/client.cjs +3 -3
  10. package/dist/api/client.mjs +2 -2
  11. package/dist/api/route-manager.cjs +9 -9
  12. package/dist/api/route-manager.d.mts +10 -4
  13. package/dist/api/route-manager.d.ts +10 -4
  14. package/dist/api/route-manager.mjs +8 -8
  15. package/dist/api/runtime.cjs +6 -6
  16. package/dist/api/runtime.d.mts +4 -62
  17. package/dist/api/runtime.d.ts +4 -62
  18. package/dist/api/runtime.mjs +5 -5
  19. package/dist/api.cjs +13 -12
  20. package/dist/api.d.mts +3 -3
  21. package/dist/api.d.ts +3 -3
  22. package/dist/api.mjs +12 -11
  23. package/dist/{app-BXB3JZYc.d.ts → app-CKO3iN1c.d.ts} +17 -3
  24. package/dist/{app-D_j9AAVL.d.mts → app-Cbkj9ufe.d.mts} +17 -3
  25. package/dist/app-markdown.cjs +6 -4
  26. package/dist/app-markdown.d.mts +3 -3
  27. package/dist/app-markdown.d.ts +3 -3
  28. package/dist/app-markdown.mjs +5 -3
  29. package/dist/{chunk-F7JZENPF.cjs → chunk-3A4KGQYI.cjs} +38 -30
  30. package/dist/{chunk-4MMGO7YW.cjs → chunk-3IP27TCG.cjs} +43 -32
  31. package/dist/{chunk-FDR64H6B.mjs → chunk-3KGDJLJK.mjs} +41 -2
  32. package/dist/{chunk-UJD4PHYB.mjs → chunk-4E5WBPEG.mjs} +72 -354
  33. package/dist/{chunk-KXWRO25S.cjs → chunk-4GPOC4LN.cjs} +3 -3
  34. package/dist/{chunk-Z2HLU4IX.cjs → chunk-4GWRFP22.cjs} +23 -2
  35. package/dist/{chunk-4KU5Q7C2.mjs → chunk-4P6ULFMD.mjs} +253 -67
  36. package/dist/chunk-4WQ6PGSJ.cjs +367 -0
  37. package/dist/{chunk-SMHH4VDG.mjs → chunk-4WVJLURN.mjs} +1 -1
  38. package/dist/{chunk-2F2ER724.cjs → chunk-5BXGGEC7.cjs} +27 -22
  39. package/dist/{chunk-3BHT4WMP.cjs → chunk-5D2JIPLH.cjs} +8 -8
  40. package/dist/{chunk-AHGECQEW.mjs → chunk-666CKENS.mjs} +1 -1
  41. package/dist/{chunk-GFHLGIYC.cjs → chunk-6LGFV2CQ.cjs} +8 -8
  42. package/dist/chunk-6SJ2KJTA.mjs +314 -0
  43. package/dist/{chunk-PFQKNERH.cjs → chunk-6TJITR2B.cjs} +457 -218
  44. package/dist/{chunk-73MC7ZL6.cjs → chunk-75X755YZ.cjs} +2 -2
  45. package/dist/{chunk-3UH7MRCP.cjs → chunk-7DWNJI73.cjs} +13 -13
  46. package/dist/{chunk-7L5V3KQO.cjs → chunk-7O5M4UKW.cjs} +2 -2
  47. package/dist/{chunk-BJPBQNIE.cjs → chunk-7SQ5SGYZ.cjs} +2 -2
  48. package/dist/{chunk-27ZWSI3W.cjs → chunk-ADOAUDQ6.cjs} +2 -2
  49. package/dist/{chunk-CP6X4AEU.mjs → chunk-AJQTP4OO.mjs} +1 -1
  50. package/dist/{chunk-YKX5BK66.cjs → chunk-ATWHHSY2.cjs} +7 -7
  51. package/dist/{chunk-EFCQPQMG.cjs → chunk-B5PFZLKV.cjs} +89 -8
  52. package/dist/{chunk-FNO7A7CM.cjs → chunk-BHY547NB.cjs} +34 -16
  53. package/dist/{chunk-JHWOVJ3M.mjs → chunk-BUGNQIHC.mjs} +5 -0
  54. package/dist/{chunk-7GLPRTTF.cjs → chunk-CGBDNNSM.cjs} +2 -2
  55. package/dist/chunk-CI6E3UOH.cjs +314 -0
  56. package/dist/{chunk-2G2NNLE2.mjs → chunk-CQMVIOYP.mjs} +5 -5
  57. package/dist/{chunk-X6W5FFH6.cjs → chunk-CVH2BXPY.cjs} +8 -8
  58. package/dist/{chunk-TKSCR644.cjs → chunk-D3C5LBQY.cjs} +2 -2
  59. package/dist/{chunk-PZNL3WEG.mjs → chunk-DMEPTZTI.mjs} +22 -11
  60. package/dist/chunk-DTSROJ5J.mjs +367 -0
  61. package/dist/{chunk-DBNKI4NF.cjs → chunk-ECKF2BAM.cjs} +6 -2
  62. package/dist/{chunk-GQ3Z3IZI.cjs → chunk-EMMQ64QW.cjs} +18 -18
  63. package/dist/{chunk-6DU6UFUE.mjs → chunk-EXG5LD6B.mjs} +16 -8
  64. package/dist/{chunk-HUMR6LSU.mjs → chunk-F5QO4FNE.mjs} +1 -1
  65. package/dist/{chunk-YULD7ICZ.mjs → chunk-FBOJ55OM.mjs} +1 -1
  66. package/dist/{chunk-IHNMMXHV.mjs → chunk-FGRYBX5X.mjs} +15 -10
  67. package/dist/{chunk-D227TIEN.cjs → chunk-FWE7LEQC.cjs} +13 -13
  68. package/dist/{chunk-3BU22U3M.cjs → chunk-G2TEB74S.cjs} +5 -2
  69. package/dist/{chunk-G5RT7EXW.mjs → chunk-HEVMCTSR.mjs} +21 -6
  70. package/dist/{chunk-W7LF2J2S.mjs → chunk-HMRSWN47.mjs} +1 -1
  71. package/dist/{chunk-JG6DJF5A.mjs → chunk-HZFM2LWQ.mjs} +22 -1
  72. package/dist/{chunk-UAORZ7QA.mjs → chunk-IAIYV4RZ.mjs} +2 -2
  73. package/dist/{chunk-F2SE2VDO.mjs → chunk-IHQIOZLC.mjs} +1 -1
  74. package/dist/{chunk-2NNMOPDN.mjs → chunk-J3ANCZKA.mjs} +4 -1
  75. package/dist/{chunk-C4SPBWFM.cjs → chunk-JEZO6VUR.cjs} +10 -1
  76. package/dist/{chunk-SC2WYWPF.mjs → chunk-JPNFPAZ4.mjs} +3 -3
  77. package/dist/{chunk-F6Z3Y5KL.mjs → chunk-K3SAEIM3.mjs} +5 -2
  78. package/dist/{chunk-QAU5JD57.mjs → chunk-K4I4O5TS.mjs} +289 -50
  79. package/dist/{chunk-KN7K4VQN.mjs → chunk-KDTBF3UU.mjs} +1 -1
  80. package/dist/{chunk-OMVAU7NT.cjs → chunk-KIIMAWOJ.cjs} +11 -1
  81. package/dist/{chunk-43FMW62B.mjs → chunk-KMTGADN3.mjs} +28 -0
  82. package/dist/{chunk-QORUJDIV.mjs → chunk-KPFKMDM7.mjs} +2 -2
  83. package/dist/{chunk-YSCV4SJF.cjs → chunk-L5H2GSUC.cjs} +4 -4
  84. package/dist/{chunk-YDQZGSDS.mjs → chunk-LBDP3YT3.mjs} +1 -1
  85. package/dist/{chunk-6ETPZTJI.mjs → chunk-LBGILORX.mjs} +116 -55
  86. package/dist/{chunk-IPXLADVO.cjs → chunk-LOFKRKO7.cjs} +122 -61
  87. package/dist/{chunk-ULAWS2PA.cjs → chunk-LPFV45AY.cjs} +29 -26
  88. package/dist/{chunk-3KZS4SUS.mjs → chunk-MCIZVNOQ.mjs} +1 -1
  89. package/dist/{chunk-RU3M2FIK.cjs → chunk-MRMI32SN.cjs} +87 -369
  90. package/dist/{chunk-XCMCS4DA.mjs → chunk-ND2CWPOD.mjs} +2 -2
  91. package/dist/{chunk-XCACDAZZ.cjs → chunk-NDILNQ4L.cjs} +25 -10
  92. package/dist/{chunk-6TJOML4E.mjs → chunk-NFMDCAOS.mjs} +14 -11
  93. package/dist/{chunk-UXFQ3UDA.cjs → chunk-NICDYKBS.cjs} +42 -3
  94. package/dist/{chunk-EZDQRNQ7.mjs → chunk-NNSAQX3U.mjs} +23 -5
  95. package/dist/{chunk-YC6V7PWE.cjs → chunk-NQ6QFZWD.cjs} +1 -1
  96. package/dist/{chunk-PDOCJ6RY.mjs → chunk-O6WAEAX3.mjs} +1 -1
  97. package/dist/{chunk-U4KT7QP3.cjs → chunk-OW67PDDS.cjs} +14 -1
  98. package/dist/{chunk-77GNHH2Z.cjs → chunk-PMQHMWZU.cjs} +3 -3
  99. package/dist/chunk-PTZ2TVNE.cjs +178 -0
  100. package/dist/{chunk-6WCPV6G2.mjs → chunk-Q2KB32T4.mjs} +1 -1
  101. package/dist/{chunk-ICUQICNC.cjs → chunk-Q5FYSK45.cjs} +718 -532
  102. package/dist/{chunk-5SJWVY6R.mjs → chunk-QHSH7IH4.mjs} +9 -0
  103. package/dist/{chunk-Q3VLETLE.mjs → chunk-RRMVL6CJ.mjs} +4 -4
  104. package/dist/{chunk-IZY3V5XW.mjs → chunk-S3VWVTVA.mjs} +14 -1
  105. package/dist/{chunk-FFFW3OQ7.cjs → chunk-S6FJO323.cjs} +2 -2
  106. package/dist/{chunk-VFQT3LAO.cjs → chunk-SDOTRX3V.cjs} +5 -5
  107. package/dist/chunk-SGBZPZUW.mjs +75 -0
  108. package/dist/{chunk-BMWDEBXO.cjs → chunk-SHLXACIO.cjs} +31 -3
  109. package/dist/{chunk-ZXGAFZDO.cjs → chunk-T5OJPTVN.cjs} +2 -2
  110. package/dist/{chunk-2ELDTQRN.mjs → chunk-TDNWPAVR.mjs} +1 -1
  111. package/dist/{chunk-VZJR7UTG.cjs → chunk-TE2G5ION.cjs} +2 -2
  112. package/dist/{chunk-IHNIDL6H.cjs → chunk-TO4GJ56K.cjs} +22 -11
  113. package/dist/{chunk-4JHOT46A.mjs → chunk-TPLJVC7E.mjs} +86 -5
  114. package/dist/{chunk-NRSN7G7E.mjs → chunk-TW4GYDBJ.mjs} +1 -1
  115. package/dist/{chunk-XBML5KMG.cjs → chunk-U6MPZ35Q.cjs} +24 -14
  116. package/dist/chunk-UH6QN5NL.mjs +178 -0
  117. package/dist/{chunk-FTFYRMQQ.cjs → chunk-UJZLSXUB.cjs} +53 -28
  118. package/dist/chunk-UXHS27O6.cjs +75 -0
  119. package/dist/{chunk-DQQOKWYA.cjs → chunk-VR4GD5I3.cjs} +3 -3
  120. package/dist/{chunk-22LTEMGQ.mjs → chunk-VXAWRDK7.mjs} +14 -4
  121. package/dist/{chunk-62XKI4Z3.cjs → chunk-W2YDNK66.cjs} +6 -3
  122. package/dist/{chunk-VPTDD5XF.cjs → chunk-WBKEZXWE.cjs} +5 -0
  123. package/dist/{chunk-EJQT6KZN.cjs → chunk-WC5UV2HQ.cjs} +2 -2
  124. package/dist/{chunk-SAZVVAJH.mjs → chunk-WQ7T2263.mjs} +18 -7
  125. package/dist/chunk-WRPHYQVY.mjs +109 -0
  126. package/dist/chunk-WT4TGLXT.cjs +109 -0
  127. package/dist/{chunk-SOMHP6GF.mjs → chunk-XOPOIFTJ.mjs} +2 -2
  128. package/dist/{chunk-3PXS2MHU.mjs → chunk-YCKO6FRS.mjs} +1 -1
  129. package/dist/{chunk-C35ZBVRD.mjs → chunk-YWMZUGIS.mjs} +6 -2
  130. package/dist/{chunk-HMIJDL7S.mjs → chunk-Z5BEWYVO.mjs} +31 -6
  131. package/dist/{chunk-OKZUAXHF.mjs → chunk-Z7LA7MHQ.mjs} +1 -1
  132. package/dist/{chunk-Y7RKTKYI.mjs → chunk-ZMMBIVQM.mjs} +10 -0
  133. package/dist/{client-plugins-HIyulDym.d.ts → client-plugins-C8DjftDF.d.ts} +112 -5
  134. package/dist/{client-plugins-CvIslxWi.d.mts → client-plugins-CV4eJ9De.d.mts} +112 -5
  135. package/dist/client-plugins.d.mts +1 -1
  136. package/dist/client-plugins.d.ts +1 -1
  137. package/dist/client.cjs +8 -8
  138. package/dist/client.d.mts +5 -5
  139. package/dist/client.d.ts +5 -5
  140. package/dist/client.mjs +7 -7
  141. package/dist/config.d.mts +1 -1
  142. package/dist/config.d.ts +1 -1
  143. package/dist/{devtools-EAUY43BS.cjs → devtools-JXFQNWSH.cjs} +11 -10
  144. package/dist/{devtools-EE5RIBTH.mjs → devtools-KVOY2TCZ.mjs} +10 -9
  145. package/dist/docs.cjs +13 -12
  146. package/dist/docs.d.mts +2 -2
  147. package/dist/docs.d.ts +2 -2
  148. package/dist/docs.mjs +12 -11
  149. package/dist/headers.cjs +4 -4
  150. package/dist/headers.mjs +3 -3
  151. package/dist/i18n/client.cjs +11 -11
  152. package/dist/i18n/client.mjs +3 -3
  153. package/dist/image/server.cjs +3 -3
  154. package/dist/image/server.mjs +2 -2
  155. package/dist/image/sharp.cjs +10 -10
  156. package/dist/image/sharp.mjs +2 -2
  157. package/dist/index.cjs +61 -54
  158. package/dist/index.d.mts +14 -14
  159. package/dist/index.d.ts +14 -14
  160. package/dist/index.mjs +60 -53
  161. package/dist/integrations.cjs +8 -4
  162. package/dist/integrations.d.mts +1 -1
  163. package/dist/integrations.d.ts +1 -1
  164. package/dist/integrations.mjs +7 -3
  165. package/dist/internal/app-markdown-runtime.cjs +5 -3
  166. package/dist/internal/app-markdown-runtime.d.mts +19 -5
  167. package/dist/internal/app-markdown-runtime.d.ts +19 -5
  168. package/dist/internal/app-markdown-runtime.mjs +4 -2
  169. package/dist/internal/build-runtime.cjs +38 -34
  170. package/dist/internal/build-runtime.d.mts +3 -3
  171. package/dist/internal/build-runtime.d.ts +3 -3
  172. package/dist/internal/build-runtime.mjs +37 -33
  173. package/dist/internal/cli-runtime.cjs +17 -16
  174. package/dist/internal/cli-runtime.mjs +16 -15
  175. package/dist/internal/client-error-overlay.cjs +4 -4
  176. package/dist/internal/client-error-overlay.mjs +1 -1
  177. package/dist/internal/client-runtime.cjs +2 -2
  178. package/dist/internal/client-runtime.mjs +1 -1
  179. package/dist/internal/compression-runtime.d.mts +1 -1
  180. package/dist/internal/compression-runtime.d.ts +1 -1
  181. package/dist/internal/config-runtime.cjs +11 -10
  182. package/dist/internal/config-runtime.d.mts +2 -2
  183. package/dist/internal/config-runtime.d.ts +2 -2
  184. package/dist/internal/config-runtime.mjs +10 -9
  185. package/dist/internal/infra-analytics-runtime.cjs +5 -5
  186. package/dist/internal/infra-analytics-runtime.mjs +3 -3
  187. package/dist/internal/isolated-boundary.cjs +2 -2
  188. package/dist/internal/isolated-boundary.d.mts +0 -1
  189. package/dist/internal/isolated-boundary.d.ts +0 -1
  190. package/dist/internal/isolated-boundary.mjs +1 -1
  191. package/dist/internal/metadata-image-runtime.cjs +3 -3
  192. package/dist/internal/metadata-image-runtime.mjs +2 -2
  193. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  194. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  195. package/dist/internal/production-runtime.cjs +27 -48
  196. package/dist/internal/production-runtime.d.mts +67 -27
  197. package/dist/internal/production-runtime.d.ts +67 -27
  198. package/dist/internal/production-runtime.mjs +34 -55
  199. package/dist/{layers-BRQF5ETU.mjs → layers-UTB43B7A.mjs} +1 -1
  200. package/dist/layers-VUWIOFEO.cjs +18 -0
  201. package/dist/markdown.cjs +1 -1
  202. package/dist/markdown.d.mts +1 -1
  203. package/dist/markdown.d.ts +1 -1
  204. package/dist/markdown.mjs +1 -1
  205. package/dist/middleware.cjs +10 -10
  206. package/dist/middleware.d.mts +6 -4
  207. package/dist/middleware.d.ts +6 -4
  208. package/dist/middleware.mjs +9 -9
  209. package/dist/navigation.cjs +7 -7
  210. package/dist/navigation.d.mts +4 -4
  211. package/dist/navigation.d.ts +4 -4
  212. package/dist/navigation.mjs +6 -6
  213. package/dist/{nitro-OVPLKPE2.cjs → nitro-7F65EZZS.cjs} +3 -3
  214. package/dist/{nitro-MXRDCXWZ.mjs → nitro-MPZJGPXK.mjs} +2 -2
  215. package/dist/plugin.cjs +31 -28
  216. package/dist/plugin.d.mts +1 -1
  217. package/dist/plugin.d.ts +1 -1
  218. package/dist/plugin.mjs +30 -27
  219. package/dist/{production-runtime-Crq6CJ-2.d.ts → production-runtime-C2kkrPVZ.d.ts} +1 -1
  220. package/dist/{production-runtime-0sRnuYc-.d.mts → production-runtime-Du_FHb2-.d.mts} +1 -1
  221. package/dist/query/client.cjs +9 -9
  222. package/dist/query/client.mjs +4 -4
  223. package/dist/{render-plan-8ozZh2Qv.d.ts → render-plan-BnnPTpus.d.ts} +1 -1
  224. package/dist/{render-plan-gs9GGPzw.d.mts → render-plan-Cgx7v8tJ.d.mts} +1 -1
  225. package/dist/renderer/react/server.cjs +3 -3
  226. package/dist/renderer/react/server.mjs +1 -1
  227. package/dist/renderer-client.cjs +12 -12
  228. package/dist/renderer-client.d.mts +3 -3
  229. package/dist/renderer-client.d.ts +3 -3
  230. package/dist/renderer-client.mjs +4 -4
  231. package/dist/{request-B5G8rLBH.d.ts → request-BNWr7r5e.d.ts} +1 -1
  232. package/dist/{request-fkhiynXe.d.mts → request-sKayKcop.d.mts} +1 -1
  233. package/dist/request.cjs +3 -3
  234. package/dist/request.d.mts +2 -2
  235. package/dist/request.d.ts +2 -2
  236. package/dist/request.mjs +2 -2
  237. package/dist/{route-rendering-lS5nUMua.d.ts → route-rendering-Bx4Auw6Q.d.ts} +1 -1
  238. package/dist/{route-rendering-CLnS7AZj.d.mts → route-rendering-DWFp3Yq4.d.mts} +1 -1
  239. package/dist/{router-ifU8Dui1.d.mts → router-BK6K42Ij.d.mts} +1 -1
  240. package/dist/{router-4iuiYnOW.d.ts → router-DnW_2tQi.d.ts} +1 -1
  241. package/dist/routes.cjs +2 -2
  242. package/dist/routes.d.mts +1 -1
  243. package/dist/routes.d.ts +1 -1
  244. package/dist/routes.mjs +1 -1
  245. package/dist/runtime-CA3Ei5k_.d.ts +69 -0
  246. package/dist/runtime-DJDaCMd_.d.mts +69 -0
  247. package/dist/server-action-security.cjs +3 -3
  248. package/dist/server-action-security.mjs +2 -2
  249. package/dist/server-fn.cjs +5 -5
  250. package/dist/server-fn.mjs +4 -4
  251. package/dist/server-plugins.cjs +5 -5
  252. package/dist/server-plugins.d.mts +2 -2
  253. package/dist/server-plugins.d.ts +2 -2
  254. package/dist/server-plugins.mjs +4 -4
  255. package/dist/server-query.cjs +6 -6
  256. package/dist/server-query.mjs +5 -5
  257. package/dist/server.cjs +57 -54
  258. package/dist/server.d.mts +7 -7
  259. package/dist/server.d.ts +7 -7
  260. package/dist/server.mjs +35 -32
  261. package/dist/{spa-router-Bq7VCOwx.d.mts → spa-router-D6fUA4Rn.d.mts} +2 -2
  262. package/dist/{spa-router-DaJk5Re4.d.ts → spa-router-Mwbd7g2L.d.ts} +2 -2
  263. package/dist/testing.cjs +13 -13
  264. package/dist/testing.d.mts +1 -1
  265. package/dist/testing.d.ts +1 -1
  266. package/dist/testing.mjs +10 -10
  267. package/dist/theme/server.cjs +4 -4
  268. package/dist/theme/server.mjs +3 -3
  269. package/dist/{utils-BXLmFsVR.d.ts → utils-BwVcAfUR.d.ts} +1 -1
  270. package/dist/{utils-XJn0c9bj.d.mts → utils-p9Hs-jCc.d.mts} +1 -1
  271. package/dist/version.cjs +2 -2
  272. package/dist/version.mjs +1 -1
  273. package/dist/vite.cjs +31 -28
  274. package/dist/vite.d.mts +1 -1
  275. package/dist/vite.d.ts +1 -1
  276. package/dist/vite.mjs +30 -27
  277. package/dist/workflows.cjs +3 -3
  278. package/dist/workflows.mjs +2 -2
  279. package/package.json +1 -1
  280. package/types/middleware.d.ts +5 -1
  281. package/dist/chunk-FXEF4PPL.mjs +0 -47
  282. package/dist/chunk-XD32KALF.cjs +0 -47
  283. package/dist/layers-4PNE2HOY.cjs +0 -18
  284. /package/dist/{chunk-SJNMVDDF.cjs → chunk-FUCSUGDM.cjs} +0 -0
  285. /package/dist/{chunk-UDNPLXW7.mjs → chunk-MYIZXDZA.mjs} +0 -0
@@ -6,12 +6,12 @@ var _chunkA6WIQH5Zcjs = require('./chunk-A6WIQH5Z.cjs');
6
6
  var _chunkMT763TDWcjs = require('./chunk-MT763TDW.cjs');
7
7
 
8
8
 
9
- var _chunkXD32KALFcjs = require('./chunk-XD32KALF.cjs');
10
9
 
10
+ var _chunkWT4TGLXTcjs = require('./chunk-WT4TGLXT.cjs');
11
11
 
12
12
 
13
- var _chunk3UH7MRCPcjs = require('./chunk-3UH7MRCP.cjs');
14
13
 
14
+ var _chunk7DWNJI73cjs = require('./chunk-7DWNJI73.cjs');
15
15
 
16
16
 
17
17
 
@@ -20,7 +20,8 @@ var _chunk3UH7MRCPcjs = require('./chunk-3UH7MRCP.cjs');
20
20
 
21
21
 
22
22
 
23
- var _chunkVZJR7UTGcjs = require('./chunk-VZJR7UTG.cjs');
23
+
24
+ var _chunkTE2G5IONcjs = require('./chunk-TE2G5ION.cjs');
24
25
 
25
26
 
26
27
 
@@ -28,7 +29,7 @@ var _chunkVZJR7UTGcjs = require('./chunk-VZJR7UTG.cjs');
28
29
  var _chunkMWWVKDW3cjs = require('./chunk-MWWVKDW3.cjs');
29
30
 
30
31
 
31
- var _chunkTKSCR644cjs = require('./chunk-TKSCR644.cjs');
32
+ var _chunkD3C5LBQYcjs = require('./chunk-D3C5LBQY.cjs');
32
33
 
33
34
 
34
35
  var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
@@ -37,7 +38,7 @@ var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
37
38
 
38
39
 
39
40
 
40
- var _chunkF7JZENPFcjs = require('./chunk-F7JZENPF.cjs');
41
+ var _chunk3A4KGQYIcjs = require('./chunk-3A4KGQYI.cjs');
41
42
 
42
43
 
43
44
  var _chunkKCMTCM6Icjs = require('./chunk-KCMTCM6I.cjs');
@@ -76,13 +77,16 @@ var _chunk2SJ4RQ6Pcjs = require('./chunk-2SJ4RQ6P.cjs');
76
77
 
77
78
 
78
79
 
79
- var _chunkICUQICNCcjs = require('./chunk-ICUQICNC.cjs');
80
+ var _chunkQ5FYSK45cjs = require('./chunk-Q5FYSK45.cjs');
81
+
82
+
83
+
80
84
 
81
85
 
86
+ var _chunk5D2JIPLHcjs = require('./chunk-5D2JIPLH.cjs');
82
87
 
83
88
 
84
89
 
85
- var _chunk3BHT4WMPcjs = require('./chunk-3BHT4WMP.cjs');
86
90
 
87
91
 
88
92
 
@@ -91,9 +95,12 @@ var _chunk3BHT4WMPcjs = require('./chunk-3BHT4WMP.cjs');
91
95
 
92
96
 
93
97
 
98
+ var _chunkLOFKRKO7cjs = require('./chunk-LOFKRKO7.cjs');
94
99
 
95
100
 
96
- var _chunkIPXLADVOcjs = require('./chunk-IPXLADVO.cjs');
101
+
102
+
103
+ var _chunkPTZ2TVNEcjs = require('./chunk-PTZ2TVNE.cjs');
97
104
 
98
105
 
99
106
  var _chunkCXP5U3RWcjs = require('./chunk-CXP5U3RW.cjs');
@@ -113,7 +120,7 @@ var _chunkHREOKQWTcjs = require('./chunk-HREOKQWT.cjs');
113
120
  var _chunkQ5B3KJBPcjs = require('./chunk-Q5B3KJBP.cjs');
114
121
 
115
122
 
116
- var _chunkVPTDD5XFcjs = require('./chunk-VPTDD5XF.cjs');
123
+ var _chunkWBKEZXWEcjs = require('./chunk-WBKEZXWE.cjs');
117
124
 
118
125
 
119
126
 
@@ -125,7 +132,7 @@ var _chunkVPTDD5XFcjs = require('./chunk-VPTDD5XF.cjs');
125
132
  var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
126
133
 
127
134
 
128
- var _chunkRU3M2FIKcjs = require('./chunk-RU3M2FIK.cjs');
135
+ var _chunkMRMI32SNcjs = require('./chunk-MRMI32SN.cjs');
129
136
 
130
137
 
131
138
 
@@ -137,7 +144,7 @@ var _chunk6EXBPJ24cjs = require('./chunk-6EXBPJ24.cjs');
137
144
  var _chunkVEKFLAQMcjs = require('./chunk-VEKFLAQM.cjs');
138
145
 
139
146
 
140
- var _chunkEFCQPQMGcjs = require('./chunk-EFCQPQMG.cjs');
147
+ var _chunkB5PFZLKVcjs = require('./chunk-B5PFZLKV.cjs');
141
148
 
142
149
 
143
150
 
@@ -148,24 +155,25 @@ var _chunkEUV4YR3Vcjs = require('./chunk-EUV4YR3V.cjs');
148
155
 
149
156
 
150
157
 
151
- var _chunkVFQT3LAOcjs = require('./chunk-VFQT3LAO.cjs');
158
+ var _chunkSDOTRX3Vcjs = require('./chunk-SDOTRX3V.cjs');
159
+
152
160
 
153
161
 
154
162
 
155
- var _chunkFTFYRMQQcjs = require('./chunk-FTFYRMQQ.cjs');
163
+ var _chunkUJZLSXUBcjs = require('./chunk-UJZLSXUB.cjs');
156
164
 
157
165
 
158
166
 
159
167
 
160
- var _chunkULAWS2PAcjs = require('./chunk-ULAWS2PA.cjs');
168
+ var _chunkLPFV45AYcjs = require('./chunk-LPFV45AY.cjs');
161
169
 
162
170
 
163
171
 
164
172
 
165
- var _chunkZ2HLU4IXcjs = require('./chunk-Z2HLU4IX.cjs');
173
+ var _chunk4GWRFP22cjs = require('./chunk-4GWRFP22.cjs');
166
174
 
167
175
 
168
- var _chunkXBML5KMGcjs = require('./chunk-XBML5KMG.cjs');
176
+ var _chunkU6MPZ35Qcjs = require('./chunk-U6MPZ35Q.cjs');
169
177
 
170
178
 
171
179
  var _chunkUFDAAQFXcjs = require('./chunk-UFDAAQFX.cjs');
@@ -192,6 +200,9 @@ var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
192
200
  var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
193
201
 
194
202
 
203
+ var _chunkNQ6QFZWDcjs = require('./chunk-NQ6QFZWD.cjs');
204
+
205
+
195
206
  var _chunkC5GUTBZKcjs = require('./chunk-C5GUTBZK.cjs');
196
207
 
197
208
 
@@ -299,7 +310,7 @@ function getDocsTitle(docs) {
299
310
  }
300
311
  _chunkS3JO3N4Hcjs.__name.call(void 0, getDocsTitle, "getDocsTitle");
301
312
  function loadPages(contentDir, docs) {
302
- return _chunkVZJR7UTGcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunkVZJR7UTGcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
313
+ return _chunkTE2G5IONcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunkTE2G5IONcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
303
314
  }
304
315
  _chunkS3JO3N4Hcjs.__name.call(void 0, loadPages, "loadPages");
305
316
  function findSocialImagePath(html) {
@@ -320,14 +331,14 @@ async function addHandlerRoute(routes, pathname, handler, absolutePaths) {
320
331
  }
321
332
  _chunkS3JO3N4Hcjs.__name.call(void 0, addHandlerRoute, "addHandlerRoute");
322
333
  async function compileFarmDocsManifest(docs, options) {
323
- const contentDir = _chunkVZJR7UTGcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
334
+ const contentDir = _chunkTE2G5IONcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
324
335
  const pages = loadPages(contentDir, docs);
325
336
  const absolutePaths = [
326
337
  _path2.default.resolve(options.root),
327
338
  _path2.default.resolve(contentDir),
328
339
  docs.configPath || ""
329
340
  ];
330
- const handler = _chunkVZJR7UTGcjs.createFarmDocsHandler.call(void 0, docs, {
341
+ const handler = _chunkTE2G5IONcjs.createFarmDocsHandler.call(void 0, docs, {
331
342
  root: options.root,
332
343
  srcDir: options.srcDir,
333
344
  clientEntry: options.clientEntry,
@@ -335,7 +346,7 @@ async function compileFarmDocsManifest(docs, options) {
335
346
  fontStylesheetHref: options.fontStylesheetHref,
336
347
  globalStylesheetHref: options.globalStylesheetHref
337
348
  });
338
- const apiHandler = _chunk3UH7MRCPcjs.createFarmDocsAPIHandler.call(void 0, {
349
+ const apiHandler = _chunk7DWNJI73cjs.createFarmDocsAPIHandler.call(void 0, {
339
350
  rootDir: options.root,
340
351
  srcDir: options.srcDir,
341
352
  docs
@@ -427,7 +438,7 @@ async function compileFarmDocsManifest(docs, options) {
427
438
  post: await compileResponse(postResponse, absolutePaths),
428
439
  search: {
429
440
  pages: pages.map((page) => ({
430
- ..._chunkVZJR7UTGcjs.toFarmDocsMarkdownPage.call(void 0, page),
441
+ ..._chunkTE2G5IONcjs.toFarmDocsMarkdownPage.call(void 0, page),
431
442
  sourcePath: `farm-docs:${page.slug || "index"}`
432
443
  })),
433
444
  search: _nullishCoalesce(searchConfig, () => ( true)),
@@ -447,7 +458,7 @@ async function createFarmRouteRuntimeManifest(options) {
447
458
  const routes = [];
448
459
  for (const [pattern, entry] of options.routeManager.getRoutes()) {
449
460
  const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
450
- const rendering = await _chunk3BHT4WMPcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
461
+ const rendering = await _chunk5D2JIPLHcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
451
462
  const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
452
463
  routes.push({
453
464
  kind: "page",
@@ -750,15 +761,32 @@ function createFarmNetlifyEntry(options) {
750
761
  import nitroNetlifyHandler from ${JSON.stringify(options.nitroNetlifyEntry)};
751
762
 
752
763
  const PRIVATE_CACHE_DIRECTIVE = /(?:^|,)\\s*(?:private|no-store)\\s*(?:[,=]|$)/i;
764
+ const CREDENTIAL_VARY = /(?:^|,)\\s*(?:\\*|cookie|authorization)\\s*(?:,|$)/i;
765
+ // What Nitro's entry sets when the response has no Cache-Control of its own.
766
+ const NITRO_DEFAULT_CACHE_CONTROL = "public, max-age=0, must-revalidate";
767
+
768
+ function isSharedCacheable(request, response) {
769
+ return (
770
+ response.status === 200 &&
771
+ !request.headers.has("cookie") &&
772
+ !request.headers.has("authorization") &&
773
+ !response.headers.has("set-cookie") &&
774
+ !PRIVATE_CACHE_DIRECTIVE.test(response.headers.get("cache-control") || "") &&
775
+ !CREDENTIAL_VARY.test(response.headers.get("vary") || "")
776
+ );
777
+ }
753
778
 
754
779
  export default async function farmNetlifyHandler(request, context) {
755
780
  const response = await nitroNetlifyHandler(request, context);
756
781
  if (
757
782
  response &&
758
783
  response.headers.has("netlify-cdn-cache-control") &&
759
- PRIVATE_CACHE_DIRECTIVE.test(response.headers.get("cache-control") || "")
784
+ !isSharedCacheable(request, response)
760
785
  ) {
761
786
  response.headers.delete("netlify-cdn-cache-control");
787
+ if (response.headers.get("cache-control") === NITRO_DEFAULT_CACHE_CONTROL) {
788
+ response.headers.set("cache-control", "private, no-store");
789
+ }
762
790
  }
763
791
  return response;
764
792
  }
@@ -767,10 +795,14 @@ export default async function farmNetlifyHandler(request, context) {
767
795
  _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmNetlifyEntry, "createFarmNetlifyEntry");
768
796
 
769
797
  // src/nitro/node-server-entry.ts
798
+ var FARM_NODE_ENV_MODULE_FILE = "farm-node-env.mjs";
799
+ var FARM_NODE_ENV_MODULE_SOURCE = `if (!process.env.NODE_ENV) process.env.NODE_ENV = "production";
800
+ `;
770
801
  function createFarmNodeServerEntry(options) {
771
802
  const serverConfig = JSON.stringify(options.server);
772
803
  const nitroEntryImport = `./${options.nitroEntryFile.replace(/^\.\//, "")}`;
773
804
  return `
805
+ import "./${FARM_NODE_ENV_MODULE_FILE}";
774
806
  import "#nitro/virtual/polyfills";
775
807
  import { NodeRequest, serve } from ${JSON.stringify(options.nodeAdapterModule)};
776
808
  import wsAdapter from ${JSON.stringify(options.websocketAdapterModule)};
@@ -1586,7 +1618,7 @@ function hasFarmMiddlewareConfig(config) {
1586
1618
  _chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmMiddlewareConfig, "hasFarmMiddlewareConfig");
1587
1619
  function hasFarmServerRuntimePlugins(config) {
1588
1620
  return (config.plugins || []).some((plugin) => {
1589
- if (_chunkFTFYRMQQcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) === false) return false;
1621
+ if (_chunkUJZLSXUBcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) === false) return false;
1590
1622
  return Boolean(
1591
1623
  plugin.setup || plugin.init || plugin.ready || plugin.shutdown || plugin.runtime || plugin.router || plugin.render || plugin.beforeRouteMatch || plugin.afterRouteMatch || plugin.beforeRender || plugin.afterRender || plugin.onError || plugin.transformHTML
1592
1624
  );
@@ -1599,7 +1631,7 @@ function hasFarmPluginRoutes(config) {
1599
1631
  _chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmPluginRoutes, "hasFarmPluginRoutes");
1600
1632
  function farmServerRuntimePluginsMayHandlePath(config, pathname) {
1601
1633
  return (config.plugins || []).some(
1602
- (plugin) => _chunkFTFYRMQQcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && _chunkICUQICNCcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
1634
+ (plugin) => _chunkUJZLSXUBcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && _chunkQ5FYSK45cjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
1603
1635
  );
1604
1636
  }
1605
1637
  _chunkS3JO3N4Hcjs.__name.call(void 0, farmServerRuntimePluginsMayHandlePath, "farmServerRuntimePluginsMayHandlePath");
@@ -1630,8 +1662,8 @@ async function discoverMiddlewareRoutes(appDir) {
1630
1662
  }
1631
1663
  await walk(
1632
1664
  _path2.default.join(dir, entry.name),
1633
- _chunkULAWS2PAcjs.appendMiddlewareRoutePath.call(void 0, routePath, entry.name),
1634
- _chunkULAWS2PAcjs.appendMiddlewareDirectory.call(void 0, directory, entry.name),
1665
+ _chunkLPFV45AYcjs.appendMiddlewareRoutePath.call(void 0, routePath, entry.name),
1666
+ _chunkLPFV45AYcjs.appendMiddlewareDirectory.call(void 0, directory, entry.name),
1635
1667
  discovered
1636
1668
  );
1637
1669
  }
@@ -1644,7 +1676,7 @@ async function discoverMiddlewareRoutes(appDir) {
1644
1676
  routes.set(route.directory, route);
1645
1677
  }
1646
1678
  }
1647
- return Array.from(routes.values()).sort(_chunkULAWS2PAcjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
1679
+ return Array.from(routes.values()).sort(_chunkLPFV45AYcjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
1648
1680
  }
1649
1681
  _chunkS3JO3N4Hcjs.__name.call(void 0, discoverMiddlewareRoutes, "discoverMiddlewareRoutes");
1650
1682
  function assertFarmDocsRuntimeSupported(config, preset) {
@@ -1662,7 +1694,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
1662
1694
  assertFarmDocsRuntimeSupported(config, preset);
1663
1695
  const srcDir = config.srcDir || "src";
1664
1696
  const distDir = config.distDir || ".farm";
1665
- const deployOutputDir = _chunkF7JZENPFcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
1697
+ const deployOutputDir = _chunk3A4KGQYIcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
1666
1698
  const lifecyclePluginManager = options.pluginManager;
1667
1699
  const productionViteResultPromise = Promise.allSettled([
1668
1700
  Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))
@@ -1681,7 +1713,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
1681
1713
  const routeRuntimeManifestResultPromise = Promise.allSettled([routeRuntimeManifestPromise]);
1682
1714
  const pageRoutes = [];
1683
1715
  for (const [pattern, entry] of routeManager.getRoutes()) {
1684
- const markdownSourcePath = entry.markdownSourcePath || (_chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
1716
+ const markdownSourcePath = entry.markdownSourcePath || (_chunkB5PFZLKVcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
1685
1717
  pageRoutes.push({
1686
1718
  pattern,
1687
1719
  ...entry.directory ? { directory: entry.directory } : {},
@@ -1912,7 +1944,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
1912
1944
  }
1913
1945
  const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
1914
1946
  await fs.writeFile(fontCssPath, normalizedFontCss);
1915
- await fs.writeFile(clientCssPath, _chunkICUQICNCcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
1947
+ await fs.writeFile(clientCssPath, _chunkQ5FYSK45cjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
1916
1948
  }
1917
1949
  _chunkS3JO3N4Hcjs.__name.call(void 0, mergeBuiltFontCss, "mergeBuiltFontCss");
1918
1950
  var _IncompleteClientBuildOutputError = class _IncompleteClientBuildOutputError extends Error {
@@ -1962,7 +1994,7 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
1962
1994
  const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${_path2.default.resolve(modulePath)}`;
1963
1995
  let plan = cache.get(key);
1964
1996
  if (!plan) {
1965
- plan = _chunkICUQICNCcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
1997
+ plan = _chunkQ5FYSK45cjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
1966
1998
  cache.set(key, plan);
1967
1999
  }
1968
2000
  return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
@@ -1980,7 +2012,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
1980
2012
  });
1981
2013
  pluginManager.addPlugins(config.plugins || []);
1982
2014
  const clientPages = [];
1983
- const integrationProviders = _chunkFTFYRMQQcjs.getIntegrationProviders.call(void 0, config.integrations).filter(
2015
+ const integrationProviders = _chunkUJZLSXUBcjs.getIntegrationProviders.call(void 0, config.integrations).filter(
1984
2016
  (provider) => provider.component || provider.type === "clerk"
1985
2017
  );
1986
2018
  const unsupportedIntegrationProvider = integrationProviders.find(
@@ -1991,14 +2023,14 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
1991
2023
  `[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
1992
2024
  );
1993
2025
  }
1994
- const isolatedMode = _chunkICUQICNCcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
2026
+ const isolatedMode = _chunkQ5FYSK45cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
1995
2027
  _optionalChain([config, 'access', _35 => _35.experimental, 'optionalAccess', _36 => _36.isolatedClientHydration]),
1996
2028
  {
1997
2029
  serverComponents: _optionalChain([config, 'access', _37 => _37.experimental, 'optionalAccess', _38 => _38.serverComponents]) === true,
1998
2030
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
1999
2031
  }
2000
2032
  );
2001
- const planOptions = _chunkICUQICNCcjs.getFarmClientHydrationPlanOptions.call(void 0,
2033
+ const planOptions = _chunkQ5FYSK45cjs.getFarmClientHydrationPlanOptions.call(void 0,
2002
2034
  config.renderer,
2003
2035
  Boolean(unsupportedIntegrationProvider)
2004
2036
  );
@@ -2045,7 +2077,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2045
2077
  };
2046
2078
  }
2047
2079
  });
2048
- const layoutAppliesToRoute = _chunkIPXLADVOcjs.routeBoundaryCoversDirectory;
2080
+ const layoutAppliesToRoute = _chunkLOFKRKO7cjs.routeBoundaryCoversDirectory;
2049
2081
  const routeDirectory = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (route) => _nullishCoalesce(route.directory, () => ( route.pattern)), "routeDirectory");
2050
2082
  const adapterOwnsDocsRuntime = Boolean(
2051
2083
  _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _39 => _39.docs, 'optionalAccess', _40 => _40.enabled]) && _optionalChain([config, 'access', _41 => _41.docs, 'access', _42 => _42.adapter, 'optionalAccess', _43 => _43.server]) && config.docs.adapter.react
@@ -2056,7 +2088,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2056
2088
  ), "isAdapterDocsRoute");
2057
2089
  const syntheticDocsEntry = _optionalChain([config, 'access', _46 => _46.docs, 'optionalAccess', _47 => _47.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
2058
2090
  const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
2059
- const markdownPagePlan = _chunkICUQICNCcjs.createMarkdownPageHydrationPlanner.call(void 0,
2091
+ const markdownPagePlan = _chunkQ5FYSK45cjs.createMarkdownPageHydrationPlanner.call(void 0,
2060
2092
  _chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), root),
2061
2093
  root,
2062
2094
  isolatedMode,
@@ -2064,7 +2096,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2064
2096
  );
2065
2097
  const routePlans = pageRoutes.map((route) => ({
2066
2098
  route,
2067
- metadata: _chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
2099
+ metadata: _chunkB5PFZLKVcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
2068
2100
  route.modulePath,
2069
2101
  root,
2070
2102
  isolatedMode,
@@ -2072,7 +2104,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2072
2104
  planOptions
2073
2105
  )
2074
2106
  }));
2075
- _chunkICUQICNCcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
2107
+ _chunkQ5FYSK45cjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
2076
2108
  clientLayouts.map((layout) => ({
2077
2109
  pattern: layout.pattern,
2078
2110
  depth: layout.pattern.split("/").filter(Boolean).length,
@@ -2081,7 +2113,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2081
2113
  [
2082
2114
  ...routePlans.map(({ route, metadata }) => ({
2083
2115
  pattern: routeDirectory(route),
2084
- depth: _chunkIPXLADVOcjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
2116
+ depth: _chunkLOFKRKO7cjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
2085
2117
  metadata
2086
2118
  })),
2087
2119
  ...syntheticDocsPatterns.map((pattern) => ({
@@ -2104,7 +2136,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2104
2136
  for (const layout of clientLayouts) {
2105
2137
  const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || Boolean(adapterDocsEntry && layoutAppliesToRoute(layout.pattern, adapterDocsEntry));
2106
2138
  if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
2107
- _chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${_chunkICUQICNCcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
2139
+ _chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${_chunkQ5FYSK45cjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
2108
2140
  }
2109
2141
  }
2110
2142
  if (isolatedMode === "analyze") {
@@ -2128,7 +2160,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2128
2160
  );
2129
2161
  if (metadata.suppressedAsyncHydration) {
2130
2162
  _chunk5QIKR7RRcjs.logger.warn(
2131
- `\u26A0\uFE0F ${_chunkICUQICNCcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
2163
+ `\u26A0\uFE0F ${_chunkQ5FYSK45cjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
2132
2164
  );
2133
2165
  }
2134
2166
  if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0) {
@@ -2153,7 +2185,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2153
2185
  ...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries).flatMap((layout) => layout.isolatedBoundaries)
2154
2186
  ],
2155
2187
  // The server renders a server tree only below a hydrating layout.
2156
- ..._chunkICUQICNCcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
2188
+ ..._chunkQ5FYSK45cjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
2157
2189
  });
2158
2190
  _chunk5QIKR7RRcjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
2159
2191
  }
@@ -2189,7 +2221,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2189
2221
  }
2190
2222
  const clientRouteSlots = routeSlots.filter((slot) => {
2191
2223
  try {
2192
- return _chunkICUQICNCcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
2224
+ return _chunkQ5FYSK45cjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
2193
2225
  } catch (error) {
2194
2226
  _chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
2195
2227
  return false;
@@ -2217,9 +2249,9 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2217
2249
  config.renderer,
2218
2250
  config.publicRuntimeConfig,
2219
2251
  config.trailingSlash,
2220
- _chunkFTFYRMQQcjs.getIntegrationProviders.call(void 0, config.integrations),
2252
+ _chunkUJZLSXUBcjs.getIntegrationProviders.call(void 0, config.integrations),
2221
2253
  config.basePath,
2222
- _chunkICUQICNCcjs.generateClientCachePersistenceCode.call(void 0, _chunkICUQICNCcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
2254
+ _chunkQ5FYSK45cjs.generateClientCachePersistenceCode.call(void 0, _chunkQ5FYSK45cjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
2223
2255
  adapterOwnsDocsRuntime ? _chunkHITLGIAOcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
2224
2256
  );
2225
2257
  await fs.writeFile(clientEntryPath, clientHydrationCode);
@@ -2236,7 +2268,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2236
2268
  const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
2237
2269
  await fs.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
2238
2270
  postcssSearchPath = clientEntryDir;
2239
- tailwindVitePlugin = await _chunkICUQICNCcjs.loadTailwindVitePlugin.call(void 0, {
2271
+ tailwindVitePlugin = await _chunkQ5FYSK45cjs.loadTailwindVitePlugin.call(void 0, {
2240
2272
  builder: productionVite.builder,
2241
2273
  announce: true
2242
2274
  });
@@ -2305,12 +2337,12 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2305
2337
  }
2306
2338
  },
2307
2339
  plugins: [
2308
- _chunkICUQICNCcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
2340
+ _chunkQ5FYSK45cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
2309
2341
  ...tailwindVitePlugin ? [tailwindVitePlugin] : [],
2310
2342
  ...rendererVitePlugins,
2311
2343
  ...config.vite.plugins || [],
2312
2344
  farmServerOnlyEntriesPlugin(),
2313
- _chunkICUQICNCcjs.farmDocsClientConfigPlugin.call(void 0,
2345
+ _chunkQ5FYSK45cjs.farmDocsClientConfigPlugin.call(void 0,
2314
2346
  adapterOwnsDocsRuntime ? _chunkHITLGIAOcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
2315
2347
  ),
2316
2348
  // Plugin to redirect @farm.js/core imports to client-only exports
@@ -2369,7 +2401,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2369
2401
  } : void 0,
2370
2402
  // Ensure React is bundled for client
2371
2403
  resolve: {
2372
- alias: _chunkICUQICNCcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
2404
+ alias: _chunkQ5FYSK45cjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
2373
2405
  dedupe: [...config.renderer.dedupe || []]
2374
2406
  },
2375
2407
  // Optimize dependencies - exclude server-side code from client bundle
@@ -2382,7 +2414,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2382
2414
  ]
2383
2415
  }
2384
2416
  };
2385
- await viteBuild(_chunkICUQICNCcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
2417
+ await viteBuild(_chunkQ5FYSK45cjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
2386
2418
  await mergeBuiltFontCss(outputDir);
2387
2419
  await validateClientBuildOutput(root, srcDir, outputDir);
2388
2420
  } finally {
@@ -3141,7 +3173,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
3141
3173
  direction: {}
3142
3174
  }, plugins = [], renderer = _chunkPSV6XKPOcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule) {
3143
3175
  const toImportPath = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (targetPath) => targetPath.replace(/\\/g, "/"), "toImportPath");
3144
- const clientPluginEntry = _chunkICUQICNCcjs.generateFarmClientPluginEntryCode.call(void 0,
3176
+ const clientPluginEntry = _chunkQ5FYSK45cjs.generateFarmClientPluginEntryCode.call(void 0,
3145
3177
  plugins,
3146
3178
  root,
3147
3179
  srcDir,
@@ -3152,7 +3184,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
3152
3184
  import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
3153
3185
  import __farmAppSetup from ${JSON.stringify(_chunk5QIKR7RRcjs.toPosixPath.call(void 0, appSetupPath))};
3154
3186
  __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
3155
- const providerClientCode = _chunkICUQICNCcjs.generateFarmIntegrationProviderClientCode.call(void 0,
3187
+ const providerClientCode = _chunkQ5FYSK45cjs.generateFarmIntegrationProviderClientCode.call(void 0,
3156
3188
  integrationProviders,
3157
3189
  root,
3158
3190
  _nullishCoalesce(renderer.componentExtensions, () => ( []))
@@ -3161,15 +3193,17 @@ __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot
3161
3193
  const cssImport = _fs.existsSync.call(void 0, globalsCssPath) ? `import ${JSON.stringify(toImportPath(globalsCssPath))};` : "";
3162
3194
  const layoutImportStatements = [];
3163
3195
  const layoutRegistrations = [];
3196
+ const hydratingLayoutPatterns = layoutRoutes.filter((layout) => layout.shouldHydrate).map((layout) => layout.pattern);
3164
3197
  layoutRoutes.forEach((layout, index) => {
3165
3198
  const relativePath = toImportPath(layout.modulePath);
3166
- if (!layout.hasIsolatedClientBoundaries) {
3199
+ const rendersOnClient = !layout.hasIsolatedClientBoundaries && hydratingLayoutPatterns.some((pattern) => _chunkWT4TGLXTcjs.layoutsCanCoverSamePage.call(void 0, layout.pattern, pattern));
3200
+ if (rendersOnClient) {
3167
3201
  layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
3168
3202
  }
3169
- const groupScope = _chunkIPXLADVOcjs.getRouteGroupScope.call(void 0, layout.pattern);
3170
- const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(_chunkIPXLADVOcjs.stripRouteGroups.call(void 0, layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
3203
+ const groupScope = _chunkLOFKRKO7cjs.getRouteGroupScope.call(void 0, layout.pattern);
3204
+ const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(_chunkLOFKRKO7cjs.stripRouteGroups.call(void 0, layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
3171
3205
  layoutRegistrations.push(
3172
- ` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${layout.hasIsolatedClientBoundaries ? "null" : `Layout${index}`}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)} }`
3206
+ ` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${rendersOnClient ? `Layout${index}` : "null"}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)} }`
3173
3207
  );
3174
3208
  });
3175
3209
  const layoutImports = layoutImportStatements.join("\n");
@@ -3670,7 +3704,7 @@ function hasHydratableLayout(pathname) {
3670
3704
  });
3671
3705
  }
3672
3706
 
3673
- ${_chunkICUQICNCcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
3707
+ ${_chunkQ5FYSK45cjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
3674
3708
  // Wrap a page element with applicable layouts
3675
3709
  function wrapWithLayouts(pageElement, pathname, params) {
3676
3710
  const layouts = getApplicableLayouts(pathname);
@@ -4649,7 +4683,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4649
4683
  _path2.default.join(postcssConfigDir, "postcss.config.cjs"),
4650
4684
  "module.exports = { plugins: [] };\n"
4651
4685
  );
4652
- tailwindVitePlugin = await _chunkICUQICNCcjs.loadTailwindVitePlugin.call(void 0, {
4686
+ tailwindVitePlugin = await _chunkQ5FYSK45cjs.loadTailwindVitePlugin.call(void 0, {
4653
4687
  builder: productionVite.builder,
4654
4688
  label: "for SSR"
4655
4689
  });
@@ -4724,7 +4758,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4724
4758
  })
4725
4759
  );
4726
4760
  const i18nCatalogs = config.i18n.enabled ? (await _chunkUFDAAQFXcjs.readFarmI18nCatalogs.call(void 0, config.i18n)).catalogs : {};
4727
- const appDirs = _chunkVPTDD5XFcjs.getFarmAppDirectories.call(void 0, config);
4761
+ const appDirs = _chunkWBKEZXWEcjs.getFarmAppDirectories.call(void 0, config);
4728
4762
  let openAPIReference = null;
4729
4763
  if (config.openapi.enabled && config.openapi.route) {
4730
4764
  const { OpenAPIManager, renderOpenAPIReferenceHTML } = await import("./manager-XZ5TX7AO.cjs");
@@ -4745,7 +4779,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4745
4779
  }
4746
4780
  const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
4747
4781
  const instrumentationPath = _chunkKCMTCM6Icjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
4748
- const notFoundPath = _chunkICUQICNCcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
4782
+ const notFoundPath = _chunkQ5FYSK45cjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
4749
4783
  if (notFoundPath) _chunk5QIKR7RRcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
4750
4784
  layoutRoutes.sort((a, b) => {
4751
4785
  const depthA = a.pattern.split("/").filter(Boolean).length;
@@ -4762,13 +4796,13 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4762
4796
  const hasServerRuntimeIntegrations = configuredIntegrationValues.some(
4763
4797
  (integration) => typeof integration === "object" && integration !== null && (!("serverRuntime" in integration) || integration.serverRuntime !== false)
4764
4798
  );
4765
- const hasIntegrationProviders = _chunkFTFYRMQQcjs.getIntegrationProviders.call(void 0, config.integrations).some(
4799
+ const hasIntegrationProviders = _chunkUJZLSXUBcjs.getIntegrationProviders.call(void 0, config.integrations).some(
4766
4800
  (provider) => provider.component || provider.type === "clerk"
4767
4801
  );
4768
4802
  const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
4769
4803
  const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _56 => _56.mdx, 'optionalAccess', _57 => _57.components]));
4770
4804
  const hasMiddlewareConfig = hasFarmMiddlewareConfig(config.middleware);
4771
- const hasRouteContextConfig = _chunkF7JZENPFcjs.hasCustomFarmRouteContext.call(void 0, config);
4805
+ const hasRouteContextConfig = _chunk3A4KGQYIcjs.hasCustomFarmRouteContext.call(void 0, config);
4772
4806
  const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
4773
4807
  const hasPluginRoutes = hasFarmPluginRoutes(config);
4774
4808
  const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
@@ -4778,7 +4812,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4778
4812
  const hasConfiguredRuntimePlugins = Boolean(
4779
4813
  hasRuntimeConfigModule && (config.plugins || []).length > 0
4780
4814
  );
4781
- const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _58 => _58.docs, 'optionalAccess', _59 => _59.enabled]) && _chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? _optionalChain([config, 'access', _60 => _60.docs, 'access', _61 => _61.adapter, 'optionalAccess', _62 => _62.server]) ? await _chunk3UH7MRCPcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
4815
+ const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _58 => _58.docs, 'optionalAccess', _59 => _59.enabled]) && _chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? _optionalChain([config, 'access', _60 => _60.docs, 'access', _61 => _61.adapter, 'optionalAccess', _62 => _62.server]) ? await _chunk7DWNJI73cjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
4782
4816
  root,
4783
4817
  srcDir: config.srcDir,
4784
4818
  clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
@@ -4928,7 +4962,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4928
4962
  __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _68 => _68.env, 'optionalAccess', _69 => _69.public]) || {})
4929
4963
  },
4930
4964
  plugins: [
4931
- _chunkICUQICNCcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
4965
+ _chunkQ5FYSK45cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
4932
4966
  ...tailwindVitePlugin ? [tailwindVitePlugin] : [],
4933
4967
  ...rendererVitePlugins,
4934
4968
  ...config.vite.plugins || [],
@@ -4975,7 +5009,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4975
5009
  resolve: {
4976
5010
  alias: [
4977
5011
  ...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
4978
- ...Object.entries(_chunkICUQICNCcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
5012
+ ...Object.entries(_chunkQ5FYSK45cjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
4979
5013
  ([find, replacement]) => ({ find, replacement })
4980
5014
  )
4981
5015
  ],
@@ -4983,7 +5017,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4983
5017
  dedupe: [...config.renderer.dedupe || []]
4984
5018
  }
4985
5019
  };
4986
- await viteBuild(_chunkICUQICNCcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
5020
+ await viteBuild(_chunkQ5FYSK45cjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
4987
5021
  } finally {
4988
5022
  if (postcssConfigDir) {
4989
5023
  try {
@@ -4999,6 +5033,28 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4999
5033
  };
5000
5034
  }
5001
5035
  _chunkS3JO3N4Hcjs.__name.call(void 0, buildSSRInMemory, "buildSSRInMemory");
5036
+ function readFarmAppPackageIdentity(root) {
5037
+ try {
5038
+ return JSON.parse(_fs.readFileSync.call(void 0, _path2.default.join(root, "package.json"), "utf8"));
5039
+ } catch (e22) {
5040
+ return {};
5041
+ }
5042
+ }
5043
+ _chunkS3JO3N4Hcjs.__name.call(void 0, readFarmAppPackageIdentity, "readFarmAppPackageIdentity");
5044
+ function readFarmPageLastModified(pageRoutes) {
5045
+ const lastModified = {};
5046
+ for (const route of pageRoutes) {
5047
+ if (route.pattern.includes("[")) continue;
5048
+ try {
5049
+ lastModified[route.pattern] = _fs.statSync.call(void 0,
5050
+ _nullishCoalesce(route.markdownSourcePath, () => ( route.modulePath))
5051
+ ).mtime.toISOString();
5052
+ } catch (e23) {
5053
+ }
5054
+ }
5055
+ return lastModified;
5056
+ }
5057
+ _chunkS3JO3N4Hcjs.__name.call(void 0, readFarmPageLastModified, "readFarmPageLastModified");
5002
5058
  function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
5003
5059
  const llmsTxt = _optionalChain([agent, 'optionalAccess', _70 => _70.llmsTxt]);
5004
5060
  const ownedByFile = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (kind) => applicationMetadataRoutes.some(
@@ -5007,8 +5063,8 @@ function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
5007
5063
  return [
5008
5064
  ..._optionalChain([llmsTxt, 'optionalAccess', _71 => _71.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
5009
5065
  ..._optionalChain([llmsTxt, 'optionalAccess', _72 => _72.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
5010
- ...ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
5011
- ..._optionalChain([agent, 'optionalAccess', _73 => _73.crawlers, 'optionalAccess', _74 => _74.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
5066
+ ..._optionalChain([agent, 'optionalAccess', _73 => _73.sitemap, 'optionalAccess', _74 => _74.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
5067
+ ..._optionalChain([agent, 'optionalAccess', _75 => _75.crawlers, 'optionalAccess', _76 => _76.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
5012
5068
  ];
5013
5069
  }
5014
5070
  _chunkS3JO3N4Hcjs.__name.call(void 0, getFarmAppOwnedDocsEnginePaths, "getFarmAppOwnedDocsEnginePaths");
@@ -5050,7 +5106,7 @@ function toVirtualEntryImportSpecifier(modulePath) {
5050
5106
  }
5051
5107
  _chunkS3JO3N4Hcjs.__name.call(void 0, toVirtualEntryImportSpecifier, "toVirtualEntryImportSpecifier");
5052
5108
  function generateNativeAuthIntegrationSource(auth) {
5053
- if (_optionalChain([auth, 'optionalAccess', _75 => _75.enabled]) !== true) {
5109
+ if (_optionalChain([auth, 'optionalAccess', _77 => _77.enabled]) !== true) {
5054
5110
  return { importSource: "", registerSource: "" };
5055
5111
  }
5056
5112
  return {
@@ -5073,7 +5129,7 @@ function matchLocalIntegrationRequest(request) {
5073
5129
  });` : "return null;"}
5074
5130
  }
5075
5131
 
5076
- async function handleIntegrationRequest(request) {
5132
+ async function handleIntegrationRequest(request, ranMiddleware) {
5077
5133
  ${options.hasServerRuntimeIntegrations ? `return dispatchIntegrationRequests(
5078
5134
  serverRuntimeIntegrations,
5079
5135
  {
@@ -5082,6 +5138,7 @@ async function handleIntegrationRequest(request) {
5082
5138
  isProd: true,
5083
5139
  },
5084
5140
  request,
5141
+ { ranMiddleware },
5085
5142
  );` : `return { response: null, setCookies: [] };`}
5086
5143
  }
5087
5144
 
@@ -5169,10 +5226,10 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, generateConfiguredResponseHeadersRuntimeSo
5169
5226
  function parseRouteRenderingDirectiveFromDisk(modulePath) {
5170
5227
  try {
5171
5228
  const source = _fs.readFileSync.call(void 0, modulePath, "utf8");
5172
- const directive = _chunk3BHT4WMPcjs.parseRouteRenderingDirective.call(void 0, source);
5173
- if (_chunk3BHT4WMPcjs.findRequestBoundSourceBlockers.call(void 0, source).length === 0) return directive;
5229
+ const directive = _chunk5D2JIPLHcjs.parseRouteRenderingDirective.call(void 0, source);
5230
+ if (_chunk5D2JIPLHcjs.findRequestBoundSourceBlockers.call(void 0, source).length === 0) return directive;
5174
5231
  return { ..._nullishCoalesce(directive, () => ( { ssg: false, ppr: false, directive: "" })), requestBound: true };
5175
- } catch (e22) {
5232
+ } catch (e24) {
5176
5233
  return void 0;
5177
5234
  }
5178
5235
  }
@@ -5359,15 +5416,19 @@ ReactDOMServer.configureApp(__farmAppSetup);`;
5359
5416
  _chunkS3JO3N4Hcjs.__name.call(void 0, generateFarmRendererAppSetupServerCode, "generateFarmRendererAppSetupServerCode");
5360
5417
  function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache) {
5361
5418
  const hasCompressionRuntime = config.compress && _chunk2SJ4RQ6Pcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
5362
- const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _76 => _76.agent, 'optionalAccess', _77 => _77.crawlers, 'optionalAccess', _78 => _78.enabled])) && !applicationMetadataRoutes.some(
5419
+ const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _78 => _78.agent, 'optionalAccess', _79 => _79.crawlers, 'optionalAccess', _80 => _80.enabled])) && !applicationMetadataRoutes.some(
5363
5420
  (metadata) => metadata.kind === "robots" && metadata.pattern === "/"
5364
5421
  );
5365
- const servesAiCatalog = _optionalChain([config, 'access', _79 => _79.agent, 'optionalAccess', _80 => _80.aiCatalog]) !== false;
5422
+ const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _81 => _81.agent, 'optionalAccess', _82 => _82.sitemap, 'optionalAccess', _83 => _83.enabled])) && !applicationMetadataRoutes.some(
5423
+ (metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
5424
+ );
5425
+ const servesDefaultMCP = _optionalChain([config, 'access', _84 => _84.agent, 'optionalAccess', _85 => _85.mcp]) === true && !_chunkPTZ2TVNEcjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
5426
+ const servesAiCatalog = _optionalChain([config, 'access', _86 => _86.agent, 'optionalAccess', _87 => _87.aiCatalog]) !== false;
5366
5427
  const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
5367
5428
  const hasInfraAnalyticsRuntime = config.analytics !== false && _chunk2SJ4RQ6Pcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
5368
5429
  const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
5369
5430
  const adapterOwnsDocsRuntime = Boolean(
5370
- _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _81 => _81.docs, 'optionalAccess', _82 => _82.enabled]) && _optionalChain([config, 'access', _83 => _83.docs, 'access', _84 => _84.adapter, 'optionalAccess', _85 => _85.server]) && config.docs.adapter.react
5431
+ _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _88 => _88.docs, 'optionalAccess', _89 => _89.enabled]) && _optionalChain([config, 'access', _90 => _90.docs, 'access', _91 => _91.adapter, 'optionalAccess', _92 => _92.server]) && config.docs.adapter.react
5371
5432
  );
5372
5433
  const docsConfigModulePath = adapterOwnsDocsRuntime && !hasPrecompiledDocs && config.docs.configPath && !config.docs.configPath.endsWith(".json") ? config.docs.configPath : void 0;
5373
5434
  const hasIsolatedClientGraphRuntime = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && isolatedClientBoundaryModules.size > 0;
@@ -5401,8 +5462,8 @@ function renderFarmRouteServerTree(element) { return element; }`;
5401
5462
  (image) => image.sourceType === "module"
5402
5463
  );
5403
5464
  const hasMiddlewareRuntime = middlewareRoutes.length > 0 || hasFarmMiddlewareConfig(config.middleware);
5404
- const farmDocsFontAssets = _optionalChain([config, 'access', _86 => _86.docs, 'optionalAccess', _87 => _87.enabled]) ? _chunkHREOKQWTcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkHREOKQWTcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
5405
- const integrationProviders = _chunkFTFYRMQQcjs.getIntegrationProviders.call(void 0, config.integrations);
5465
+ const farmDocsFontAssets = _optionalChain([config, 'access', _93 => _93.docs, 'optionalAccess', _94 => _94.enabled]) ? _chunkHREOKQWTcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkHREOKQWTcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
5466
+ const integrationProviders = _chunkUJZLSXUBcjs.getIntegrationProviders.call(void 0, config.integrations);
5406
5467
  const renderedIntegrationProviders = integrationProviders.filter(
5407
5468
  (provider) => provider.component || provider.type === "clerk"
5408
5469
  );
@@ -5411,16 +5472,16 @@ function renderFarmRouteServerTree(element) { return element; }`;
5411
5472
  `Integration provider components are not supported by the "${config.renderer.name}" renderer.`
5412
5473
  );
5413
5474
  }
5414
- const providerServerModules = _chunkICUQICNCcjs.generateFarmIntegrationProviderServerModules.call(void 0,
5475
+ const providerServerModules = _chunkQ5FYSK45cjs.generateFarmIntegrationProviderServerModules.call(void 0,
5415
5476
  renderedIntegrationProviders,
5416
5477
  config.root,
5417
5478
  _nullishCoalesce(config.renderer.componentExtensions, () => ( []))
5418
5479
  );
5419
5480
  const resolvedIntegrationProviderFallback = Object.fromEntries(
5420
5481
  Object.entries(config.integrations).flatMap(([name, integration]) => {
5421
- const configuredProviders = _optionalChain([integration, 'optionalAccess', _88 => _88.providers]);
5482
+ const configuredProviders = _optionalChain([integration, 'optionalAccess', _95 => _95.providers]);
5422
5483
  const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
5423
- if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _89 => _89.component]) === "function")) {
5484
+ if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _96 => _96.component]) === "function")) {
5424
5485
  throw new Error(
5425
5486
  `Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
5426
5487
  );
@@ -5431,14 +5492,14 @@ function renderFarmRouteServerTree(element) { return element; }`;
5431
5492
  const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
5432
5493
  (provider) => provider.supportsIsolatedHydration !== true
5433
5494
  );
5434
- const isolatedHydrationMode = _chunkICUQICNCcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
5435
- _optionalChain([config, 'access', _90 => _90.experimental, 'optionalAccess', _91 => _91.isolatedClientHydration]),
5495
+ const isolatedHydrationMode = _chunkQ5FYSK45cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
5496
+ _optionalChain([config, 'access', _97 => _97.experimental, 'optionalAccess', _98 => _98.isolatedClientHydration]),
5436
5497
  {
5437
- serverComponents: _optionalChain([config, 'access', _92 => _92.experimental, 'optionalAccess', _93 => _93.serverComponents]) === true,
5498
+ serverComponents: _optionalChain([config, 'access', _99 => _99.experimental, 'optionalAccess', _100 => _100.serverComponents]) === true,
5438
5499
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
5439
5500
  }
5440
5501
  );
5441
- const hydrationPlanOptions = _chunkICUQICNCcjs.getFarmClientHydrationPlanOptions.call(void 0,
5502
+ const hydrationPlanOptions = _chunkQ5FYSK45cjs.getFarmClientHydrationPlanOptions.call(void 0,
5442
5503
  config.renderer,
5443
5504
  Boolean(unsupportedIntegrationProvider)
5444
5505
  );
@@ -5452,7 +5513,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
5452
5513
  hydrationPlanOptions
5453
5514
  )
5454
5515
  }));
5455
- const markdownPagePlan = _chunkICUQICNCcjs.createMarkdownPageHydrationPlanner.call(void 0,
5516
+ const markdownPagePlan = _chunkQ5FYSK45cjs.createMarkdownPageHydrationPlanner.call(void 0,
5456
5517
  _chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
5457
5518
  config.root,
5458
5519
  isolatedHydrationMode,
@@ -5461,7 +5522,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
5461
5522
  const pageHydrationPlans = new Map(
5462
5523
  pageRoutes.map((route) => [
5463
5524
  route.modulePath,
5464
- _chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
5525
+ _chunkB5PFZLKVcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
5465
5526
  route.modulePath,
5466
5527
  config.root,
5467
5528
  isolatedHydrationMode,
@@ -5470,7 +5531,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
5470
5531
  )
5471
5532
  ])
5472
5533
  );
5473
- _chunkICUQICNCcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
5534
+ _chunkQ5FYSK45cjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
5474
5535
  layoutHydrationPlans.map((layout) => ({
5475
5536
  pattern: layout.pattern,
5476
5537
  depth: layout.pattern.split("/").filter(Boolean).length,
@@ -5479,10 +5540,10 @@ function renderFarmRouteServerTree(element) { return element; }`;
5479
5540
  pageRoutes.map((route) => ({
5480
5541
  // Compared by directory so a grouped layout applies only inside its group.
5481
5542
  pattern: _nullishCoalesce(route.directory, () => ( route.pattern)),
5482
- depth: _chunkIPXLADVOcjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
5543
+ depth: _chunkLOFKRKO7cjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
5483
5544
  metadata: pageHydrationPlans.get(route.modulePath)
5484
5545
  })),
5485
- _chunkIPXLADVOcjs.routeBoundaryCoversDirectory
5546
+ _chunkLOFKRKO7cjs.routeBoundaryCoversDirectory
5486
5547
  );
5487
5548
  const providerServerImports = [
5488
5549
  providerServerModules.hasClerkProvider ? `import { ClerkProvider as FarmClerkProvider } from "@clerk/react";` : "",
@@ -5499,7 +5560,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
5499
5560
  apiRegistrations.push(`
5500
5561
  {
5501
5562
  path: ${JSON.stringify(route.path)},
5502
- methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _94 => _94.pluginMethods, 'optionalAccess', _95 => _95.includes, 'call', _96 => _96(method)])))},
5563
+ methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _101 => _101.pluginMethods, 'optionalAccess', _102 => _102.includes, 'call', _103 => _103(method)])))},
5503
5564
  endpoints: ${varName},
5504
5565
  }`);
5505
5566
  });
@@ -5512,7 +5573,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
5512
5573
  }).map(({ route }) => route);
5513
5574
  orderedPageRoutes.forEach((route, index) => {
5514
5575
  const varName = `pageRoute${index}`;
5515
- if (_chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
5576
+ if (_chunkB5PFZLKVcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
5516
5577
  pageRegistrations.push(`
5517
5578
  {
5518
5579
  pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
@@ -5543,7 +5604,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
5543
5604
  directory: ${JSON.stringify(route.directory)},` : ""}
5544
5605
  module: ${varName},
5545
5606
  shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},
5546
- islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkICUQICNCcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${renderingDirective ? `
5607
+ islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkQ5FYSK45cjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${renderingDirective ? `
5547
5608
  rendering: ${JSON.stringify(renderingDirective)},` : ""}
5548
5609
  ${route.source !== void 0 ? `markdownSource: {
5549
5610
  source: ${JSON.stringify(route.source)},
@@ -5600,12 +5661,12 @@ function renderFarmRouteServerTree(element) { return element; }`;
5600
5661
  errorImports.push(
5601
5662
  `import * as ${varName} from ${toVirtualEntryImportSpecifier(errorRoute.modulePath)};`
5602
5663
  );
5603
- const groupScope = _chunkIPXLADVOcjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
5664
+ const groupScope = _chunkLOFKRKO7cjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
5604
5665
  errorRegistrations.push(`
5605
5666
  {
5606
- pattern: ${JSON.stringify(_chunkIPXLADVOcjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
5667
+ pattern: ${JSON.stringify(_chunkLOFKRKO7cjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
5607
5668
  groupScope: ${JSON.stringify(groupScope)},
5608
- directoryDepth: ${_chunkIPXLADVOcjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
5669
+ directoryDepth: ${_chunkLOFKRKO7cjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
5609
5670
  module: ${varName},
5610
5671
  }`);
5611
5672
  });
@@ -5687,6 +5748,10 @@ function renderFarmRouteServerTree(element) { return element; }`;
5687
5748
  createFarmCacheKey,
5688
5749
  createFarmMetadataRouteResponse,
5689
5750
  createFarmAgentRobots,
5751
+ createFarmDefaultSitemap,
5752
+ collectFarmDefaultMCPPages,
5753
+ resolveFarmDefaultMCPServer,
5754
+ handleFarmDefaultMCPRequest,
5690
5755
  createFarmAiCatalogResponse,
5691
5756
  createFarmApiCatalogResponse,
5692
5757
  createFarmAppManifestResponse,
@@ -5747,25 +5812,25 @@ function renderFarmRouteServerTree(element) { return element; }`;
5747
5812
  const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
5748
5813
  const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
5749
5814
  const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
5750
- const docsHandlerImport = _optionalChain([config, 'access', _97 => _97.docs, 'optionalAccess', _98 => _98.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
5815
+ const docsHandlerImport = _optionalChain([config, 'access', _104 => _104.docs, 'optionalAccess', _105 => _105.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
5751
5816
  const isFarmDocsAPIRequest = (requestOrPathname) => {
5752
5817
  const pathname = typeof requestOrPathname === "string"
5753
5818
  ? requestOrPathname
5754
5819
  : new URL(requestOrPathname.url).pathname;
5755
- const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _99 => _99.apiPath]) || "/api/docs")};
5820
+ const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _106 => _106.apiPath]) || "/api/docs")};
5756
5821
  return pathname === apiPath || pathname.startsWith(apiPath + "/");
5757
5822
  };` : adapterOwnsDocsRuntime ? `import { isFarmDocsAPIRequest } from "@farm.js/core/docs";
5758
5823
  import { createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler } from ${JSON.stringify(config.docs.adapter.server)};
5759
5824
  import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
5760
5825
  import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
5761
- const docsFontImport = _optionalChain([config, 'access', _100 => _100.docs, 'optionalAccess', _101 => _101.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
5762
- const docsRuntimeImport = _optionalChain([config, 'access', _102 => _102.docs, 'optionalAccess', _103 => _103.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
5826
+ const docsFontImport = _optionalChain([config, 'access', _107 => _107.docs, 'optionalAccess', _108 => _108.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
5827
+ const docsRuntimeImport = _optionalChain([config, 'access', _109 => _109.docs, 'optionalAccess', _110 => _110.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
5763
5828
  import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
5764
5829
  import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
5765
- const markdownHandlerImport = _optionalChain([config, 'access', _104 => _104.md, 'optionalAccess', _105 => _105.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
5766
- const appMarkdownImport = hasMarkdownPages ? `import { createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
5830
+ const markdownHandlerImport = _optionalChain([config, 'access', _111 => _111.md, 'optionalAccess', _112 => _112.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
5831
+ const appMarkdownImport = hasMarkdownPages ? `import { FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS, createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
5767
5832
  const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
5768
- const mdxComponentsPath = typeof _optionalChain([config, 'access', _106 => _106.mdx, 'optionalAccess', _107 => _107.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
5833
+ const mdxComponentsPath = typeof _optionalChain([config, 'access', _113 => _113.mdx, 'optionalAccess', _114 => _114.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
5769
5834
  const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
5770
5835
  const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
5771
5836
  const layerConfigImports = layerConfigPaths.map(
@@ -5783,7 +5848,7 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
5783
5848
  const integrationRuntimeImport = integrationRuntimeExports.length ? `import { ${integrationRuntimeExports.join(", ")} } from "@farm.js/core/integrations";` : "";
5784
5849
  const instrumentationImport = instrumentationPath ? `import * as FarmInstrumentationModule from ${toVirtualEntryImportSpecifier(instrumentationPath)};` : "";
5785
5850
  const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
5786
- const nativeMCP = _chunkXD32KALFcjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
5851
+ const nativeMCP = _chunkWT4TGLXTcjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
5787
5852
  const integrationImports = `
5788
5853
  ${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
5789
5854
  ${layerConfigImports}
@@ -5970,7 +6035,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
5970
6035
 
5971
6036
  function FarmDefault404Page() {
5972
6037
  return React.createElement(React.Fragment, null,
5973
- React.createElement("style", null, ${JSON.stringify(_chunkICUQICNCcjs.DEFAULT_NOT_FOUND_STYLES)}),
6038
+ React.createElement("style", null, ${JSON.stringify(_chunkQ5FYSK45cjs.DEFAULT_NOT_FOUND_STYLES)}),
5974
6039
  React.createElement("main", {
5975
6040
  className: "farm-default-not-found",
5976
6041
  "aria-labelledby": "farm-default-not-found-title",
@@ -6063,6 +6128,7 @@ const serverRuntimeIntegrations = Object.fromEntries(
6063
6128
  );
6064
6129
  const integrationRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs, {
6065
6130
  integrations: configuredIntegrations,
6131
+ ${JSON.stringify(_chunkUJZLSXUBcjs.FARM_INTEGRATION_API_BASE_PATH_KEY)}: ${JSON.stringify(_chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, config.api))},
6066
6132
  });
6067
6133
  const farmInfraAnalytics = ${hasInfraAnalyticsRuntime ? hasPluginRuntime ? "createFarmInfraAnalyticsPlugin()" : "createFarmInfraAnalyticsRecorder()" : "null"};
6068
6134
  const configuredPlugins = [
@@ -6098,14 +6164,14 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
6098
6164
  onError(error) { console.error("[Farm Image]", error); },
6099
6165
  })`};
6100
6166
  const farmMarkdownConfig = ${JSON.stringify(config.md)};
6101
- const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _108 => _108.agent, 'optionalAccess', _109 => _109.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
6102
- ${_optionalChain([config, 'access', _110 => _110.agent, 'optionalAccess', _111 => _111.llmsTxt, 'optionalAccess', _112 => _112.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
6167
+ const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _115 => _115.agent, 'optionalAccess', _116 => _116.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
6168
+ ${_optionalChain([config, 'access', _117 => _117.agent, 'optionalAccess', _118 => _118.llmsTxt, 'optionalAccess', _119 => _119.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
6103
6169
  const farmMdxConfig = ${JSON.stringify({
6104
6170
  ...config.mdx,
6105
- components: typeof _optionalChain([config, 'access', _113 => _113.mdx, 'optionalAccess', _114 => _114.components]) === "string" ? config.mdx.components : void 0
6171
+ components: typeof _optionalChain([config, 'access', _120 => _120.mdx, 'optionalAccess', _121 => _121.components]) === "string" ? config.mdx.components : void 0
6106
6172
  })};
6107
6173
  const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
6108
- ${_optionalChain([config, 'access', _115 => _115.agent, 'optionalAccess', _116 => _116.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
6174
+ ${_optionalChain([config, 'access', _122 => _122.agent, 'optionalAccess', _123 => _123.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
6109
6175
  // environment this was built in, since Netlify exposes its deploy context only
6110
6176
  // to the build.
6111
6177
  const farmNoindexPreview = resolveFarmPreviewDeployment(
@@ -6153,7 +6219,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
6153
6219
  });
6154
6220
  const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
6155
6221
  ${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
6156
- const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _117 => _117.docs, 'optionalAccess', _118 => _118.enabled]) && !hasPrecompiledDocs ? `(() => {
6222
+ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _124 => _124.docs, 'optionalAccess', _125 => _125.enabled]) && !hasPrecompiledDocs ? `(() => {
6157
6223
  try {
6158
6224
  const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
6159
6225
  const candidates = [
@@ -6174,7 +6240,7 @@ globalThis.__FARM_DOCS_RUNTIME_CONFIG__ = {
6174
6240
  docs: farmDocsResolvedConfig,
6175
6241
  };
6176
6242
  const farmDocsPrecompiledRuntime = ${hasPrecompiledDocs ? `createFarmDocsPrecompiledRuntime(${JSON.stringify(farmDocsPrecompiledManifest)})` : "null"};
6177
- const farmDocsHandler = ${_optionalChain([config, 'access', _119 => _119.docs, 'optionalAccess', _120 => _120.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `createFarmDocsAdapterRuntimeHandler({
6243
+ const farmDocsHandler = ${_optionalChain([config, 'access', _126 => _126.docs, 'optionalAccess', _127 => _127.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `createFarmDocsAdapterRuntimeHandler({
6178
6244
  ${docsConfigModulePath ? "...(farmDocsConfigModule.default || farmDocsConfigModule),\n ...farmDocsResolvedConfig.configOverrides," : "...farmDocsResolvedConfig.config,"}
6179
6245
  entry: farmDocsResolvedConfig.config?.entry || String(farmDocsResolvedConfig.entry || "/docs").replace(/^\\/+|\\/+$/g, "") || "docs",
6180
6246
  docsPath: farmDocsResolvedConfig.entry,
@@ -6207,22 +6273,40 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _119 => _119.docs, '
6207
6273
  fontStylesheetHref: "/farm-fonts.css",
6208
6274
  globalStylesheetHref: "/assets/globals.css",
6209
6275
  })` : "null"};
6210
- const farmDocsAPIHandler = ${_optionalChain([config, 'access', _121 => _121.docs, 'optionalAccess', _122 => _122.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig })` : "null"};
6276
+ const farmDocsAPIHandler = ${_optionalChain([config, 'access', _128 => _128.docs, 'optionalAccess', _129 => _129.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig })` : "null"};
6211
6277
 
6212
6278
  // API routes bundled at build time
6213
6279
  const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
6214
- ]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path8, methods }) => ({ path: path8, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)} })` : ""};
6280
+ ]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path8, methods }) => ({ path: path8, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)}, dispatch: dispatchFarmPluginAPIRequest })` : ""};
6281
+ // A plugin calling an app endpoint (an MCP tool, say) goes through the whole
6282
+ // pipeline, so the endpoint's middleware and integration guards run for it.
6283
+ function dispatchFarmPluginAPIRequest(request) {
6284
+ const url = new URL(request.url);
6285
+ url.pathname = applyFarmBasePath(url.pathname);
6286
+ return fetchFarmInnerRequest(url.href === request.url ? request : new Request(url, request));
6287
+ }
6288
+ // A request the app makes to itself (a Markdown page check, a plugin's endpoint call) enters
6289
+ // through this module's outer \`fetch\`, as a direct request does: plugin runtime hooks run and
6290
+ // it gets its own request context, so \`cookies()\` and \`headers()\` are its own, never the
6291
+ // caller's. It asks for an identity body: the caller reads it, and the outer response is
6292
+ // compressed once.
6293
+ function fetchFarmInnerRequest(request, context) {
6294
+ if (!request.headers.has("accept-encoding")) return fetch(request, context);
6295
+ const headers = new Headers(request.headers);
6296
+ headers.delete("accept-encoding");
6297
+ return fetch(new Request(request, { headers }), context);
6298
+ }
6215
6299
  const farmLocalAPIBasePath = ${JSON.stringify(_chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, config.api))};
6216
6300
  const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
6217
- ${_optionalChain([config, 'access', _123 => _123.agent, 'optionalAccess', _124 => _124.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkIPXLADVOcjs.resolveFarmApiCatalogInput.call(void 0, config))};
6218
- ` : ""}${config.analytics !== false ? `const farmAppManifestInput = ${JSON.stringify(
6219
- _chunkIPXLADVOcjs.resolveFarmAppManifestInput.call(void 0, config, {
6301
+ ${_optionalChain([config, 'access', _130 => _130.agent, 'optionalAccess', _131 => _131.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkLOFKRKO7cjs.resolveFarmApiCatalogInput.call(void 0, config))};
6302
+ ` : ""}${_optionalChain([config, 'access', _132 => _132.agent, 'optionalAccess', _133 => _133.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
6303
+ _chunkLOFKRKO7cjs.resolveFarmAppManifestInput.call(void 0, config, {
6220
6304
  build: config.deploymentId,
6221
- packages: _chunkICUQICNCcjs.resolveFarmAppPackages.call(void 0, config.root),
6222
- webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkICUQICNCcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
6305
+ packages: _chunkQ5FYSK45cjs.resolveFarmAppPackages.call(void 0, config.root),
6306
+ webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkQ5FYSK45cjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
6223
6307
  })
6224
6308
  )};
6225
- ` : ""}
6309
+ ${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}` : ""}
6226
6310
  function isFarmLocalAPIPathname(pathname) {
6227
6311
  return farmLocalAPIBasePath !== "/" &&
6228
6312
  (pathname === farmLocalAPIBasePath ||
@@ -6664,7 +6748,7 @@ function peelFarmDocumentPrefix(markup) {
6664
6748
  let inner = markup.replace(/^\\s+/, "");
6665
6749
  let hoisted = "";
6666
6750
  const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents["'][^>]*>/i;
6667
- const hoistable = /${_chunkIPXLADVOcjs.HOISTED_HEAD_ELEMENT.source}/i;
6751
+ const hoistable = /${_chunkLOFKRKO7cjs.HOISTED_HEAD_ELEMENT.source}/i;
6668
6752
  let match;
6669
6753
  while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
6670
6754
  if (!/^<div/i.test(match[0])) hoisted += match[0];
@@ -6729,7 +6813,8 @@ function ensureFarmDocumentHead(markup) {
6729
6813
  }
6730
6814
 
6731
6815
  function ensureFarmDocumentRoot(markup) {
6732
- if (/\\sid=["']root["']/i.test(markup)) return markup;
6816
+ // Only a #root that opens the body is the container; page content can have id="root" too.
6817
+ if (/<body\\b[^>]*>\\s*<div\\b[^>]*\\sid=["']root["']/i.test(markup)) return markup;
6733
6818
  return markup
6734
6819
  .replace(/<body\\b([^>]*)>/i, function(_match, attributes) {
6735
6820
  return "<body" + attributes + '><div id="root">';
@@ -7108,7 +7193,7 @@ function createFarmAgentRobotsResponse(request) {
7108
7193
  "robots",
7109
7194
  createFarmAgentRobots({
7110
7195
  crawlers: farmAgentCrawlers,
7111
- sitemapPath: ${applicationMetadataRoutes.some(
7196
+ sitemapPath: ${servesAgentSitemap || applicationMetadataRoutes.some(
7112
7197
  (metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
7113
7198
  ) ? JSON.stringify("/sitemap.xml") : "undefined"},
7114
7199
  metadataBase: rootLayout && rootLayout.module && rootLayout.module.metadata
@@ -7121,6 +7206,70 @@ function createFarmAgentRobotsResponse(request) {
7121
7206
  );
7122
7207
  }
7123
7208
  ` : ""}
7209
+ ${servesAgentSitemap ? `// sitemap.xml from agent.sitemap, built the same way as in development. Each page's
7210
+ // lastmod is its file's modification time, read at build time.
7211
+ const farmAgentSitemapConfig = ${JSON.stringify(config.agent.sitemap)};
7212
+ const farmAgentSitemapLastModified = ${JSON.stringify(readFarmPageLastModified(pageRoutes))};
7213
+ function createFarmAgentSitemapResponse(request) {
7214
+ const rootLayout = layoutRoutes.find((layout) => layout.pattern === "/");
7215
+ return createFarmMetadataRouteResponse(
7216
+ "sitemap",
7217
+ createFarmDefaultSitemap(
7218
+ pageRoutes.map((route) => ({
7219
+ pattern: route.pattern,
7220
+ module: route.module,
7221
+ lastModified: farmAgentSitemapLastModified[route.pattern],
7222
+ })),
7223
+ {
7224
+ origin: new URL(request.url).origin,
7225
+ config: farmAgentSitemapConfig,
7226
+ metadataBase: rootLayout && rootLayout.module && rootLayout.module.metadata
7227
+ ? rootLayout.module.metadata.metadataBase
7228
+ : undefined,
7229
+ basePath: ${JSON.stringify(config.basePath)},
7230
+ },
7231
+ ),
7232
+ {},
7233
+ { method: request.method },
7234
+ );
7235
+ }
7236
+ ` : ""}
7237
+ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as in development. It steps
7238
+ // aside for a page route that answers /mcp and for any MCP server published or
7239
+ // registered at runtime, such as the docs engine's.
7240
+ const farmDefaultMCPServer = ${JSON.stringify(
7241
+ _chunkPTZ2TVNEcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunkNQ6QFZWDcjs.FARM_VERSION)
7242
+ )};
7243
+ let farmDefaultMCPRouteFree;
7244
+ function getFarmDefaultMCPServer() {
7245
+ if (farmDefaultMCPRouteFree === undefined) {
7246
+ farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(_chunkPTZ2TVNEcjs.FARM_DEFAULT_MCP_PATH)});
7247
+ }
7248
+ return farmDefaultMCPRouteFree ? resolveFarmDefaultMCPServer(farmDefaultMCPServer) : undefined;
7249
+ }
7250
+ async function handleFarmDefaultMCP(request) {
7251
+ const origin = new URL(request.url).origin;
7252
+ return handleFarmDefaultMCPRequest(request, {
7253
+ server: getFarmDefaultMCPServer(),
7254
+ basePath: ${JSON.stringify(config.basePath)},
7255
+ listPages: () =>
7256
+ collectFarmDefaultMCPPages(
7257
+ pageRoutes.map((route) => ({ pattern: route.pattern, module: route.module })),
7258
+ { origin, basePath: ${JSON.stringify(config.basePath)}, markdown: farmMarkdownConfig },
7259
+ ),
7260
+ // A fresh request through this handler, so the caller's cookies never shape a page.
7261
+ // The handler sees paths below the base path, as the server passes them in.
7262
+ readMarkdown: (url) => {
7263
+ const page = new URL(url);
7264
+ page.pathname = stripFarmBasePath(page.pathname);
7265
+ return farmDefaultMCPReadMarkdown(page.href);
7266
+ },
7267
+ });
7268
+ }
7269
+ // \`fetch\` is this module's outer request entry: plugin runtime hooks run and the page
7270
+ // gets its own request context, as for a direct request.
7271
+ const farmDefaultMCPReadMarkdown = createFarmLlmsMarkdownReader((page) => fetch(page));
7272
+ ` : ""}
7124
7273
  // Static pages and root metadata for llms.txt, built the same way as in development.
7125
7274
  function createFarmLlmsTxtContext(request, full) {
7126
7275
  const origin = new URL(request.url).origin;
@@ -7143,17 +7292,18 @@ function createFarmLlmsTxtContext(request, full) {
7143
7292
  rootMetadata: rootLayout && rootLayout.module && rootLayout.module.metadata,
7144
7293
  ${servesAiCatalog ? `mcp: listFarmMCPLlmsTxtLinks(origin, {
7145
7294
  basePath: ${JSON.stringify(config.basePath)},
7146
- apiServerBasePath: farmLocalAPIBasePath,
7295
+ apiServerBasePath: farmLocalAPIBasePath,${servesDefaultMCP ? "\n defaultMCP: getFarmDefaultMCPServer," : ""}
7147
7296
  }),` : ""}
7148
7297
  }),
7149
- // llms-full.txt reads each page's .md mirror through this same handler,
7150
- // with a fresh request so the caller's cookies never shape its content.
7151
- // HEAD discards the body, so it reads nothing.
7298
+ // llms-full.txt reads each page's .md mirror through this module's outer
7299
+ // request entry, so plugin runtime hooks run and each read has a fresh request
7300
+ // context: the caller's cookies never shape its content. HEAD discards the
7301
+ // body, so it reads nothing.
7152
7302
  ...(full
7153
7303
  ? {
7154
7304
  markdown: request.method.toUpperCase() === "HEAD"
7155
7305
  ? async () => null
7156
- : createFarmLlmsMarkdownReader((page) => handleFarmRequest(page)),
7306
+ : createFarmLlmsMarkdownReader((page) => fetch(page)),
7157
7307
  }
7158
7308
  : {}),
7159
7309
  };
@@ -7388,7 +7538,7 @@ function hasLocalRequestRoute(request, routePathname) {
7388
7538
  if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
7389
7539
  return true;
7390
7540
  }
7391
- ${_optionalChain([config, 'access', _125 => _125.docs, 'optionalAccess', _126 => _126.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
7541
+ ${_optionalChain([config, 'access', _134 => _134.docs, 'optionalAccess', _135 => _135.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
7392
7542
  if (
7393
7543
  isFarmDocsAPIRequest(pathname) ||
7394
7544
  docsPath === "/" ||
@@ -7414,7 +7564,7 @@ function getFarmPluginRequestOptions(request) {
7414
7564
  route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
7415
7565
  };
7416
7566
  }
7417
- const isDocsAPIRequest = ${_optionalChain([config, 'access', _127 => _127.docs, 'optionalAccess', _128 => _128.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
7567
+ const isDocsAPIRequest = ${_optionalChain([config, 'access', _136 => _136.docs, 'optionalAccess', _137 => _137.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
7418
7568
  const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
7419
7569
  pathname,
7420
7570
  method: request.method,
@@ -7511,7 +7661,7 @@ function getApplicableLayouts(pathname, directory) {
7511
7661
  return applicable;
7512
7662
  }
7513
7663
 
7514
- ${_optionalChain([config, 'access', _129 => _129.docs, 'optionalAccess', _130 => _130.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
7664
+ ${_optionalChain([config, 'access', _138 => _138.docs, 'optionalAccess', _139 => _139.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
7515
7665
  if (request.method === "HEAD") return response;
7516
7666
  if (response.headers.get("x-farm-docs-adapter")) return response;
7517
7667
 
@@ -7618,7 +7768,7 @@ ${_optionalChain([config, 'access', _129 => _129.docs, 'optionalAccess', _130 =>
7618
7768
  }` : ""}
7619
7769
 
7620
7770
  const pprShellCache = getFarmDataCache();
7621
- const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _131 => _131.experimental, 'optionalAccess', _132 => _132.ppr]) === true)};
7771
+ const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _140 => _140.experimental, 'optionalAccess', _141 => _141.ppr]) === true)};
7622
7772
 
7623
7773
  function resolveRouteRenderingView(route) {
7624
7774
  // The same merge development uses: baked directive config under the
@@ -7747,7 +7897,7 @@ async function handleFarmRequest(request, adapterContext) {
7747
7897
  },
7748
7898
  { redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
7749
7899
  )` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
7750
- ${_optionalChain([config, 'access', _133 => _133.md, 'optionalAccess', _134 => _134.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
7900
+ ${_optionalChain([config, 'access', _142 => _142.md, 'optionalAccess', _143 => _143.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
7751
7901
  if (matchPageRoute(pathname)) {
7752
7902
  // The Link header advertises the public .md URL, like the head alternate.
7753
7903
  return applyMarkdownNegotiationHeaders(response, {
@@ -7824,7 +7974,11 @@ async function handleFarmRequestInContext(
7824
7974
  }
7825
7975
 
7826
7976
  ${hasServerRuntimeIntegrations ? `
7827
- const integrationDispatch = await handleIntegrationRequest(cloneFarmRequestWithContext(request));
7977
+ const farmIntegrationRanMiddleware = new Set();
7978
+ const integrationDispatch = await handleIntegrationRequest(
7979
+ cloneFarmRequestWithContext(request),
7980
+ farmIntegrationRanMiddleware,
7981
+ );
7828
7982
  if (integrationDispatch.response) {
7829
7983
  return integrationDispatch.response;
7830
7984
  }
@@ -7832,7 +7986,7 @@ async function handleFarmRequestInContext(
7832
7986
  // its rotated Set-Cookie values back here. They belong on whatever response
7833
7987
  // the page or API handler produces, so they ride the same deferred-header
7834
7988
  // channel the file middleware runner already uses.
7835
- const farmIntegrationSetCookies = integrationDispatch.setCookies;
7989
+ let farmIntegrationSetCookies = integrationDispatch.setCookies;
7836
7990
  ` : ""}
7837
7991
 
7838
7992
  ${hasMiddlewareRuntime ? `
@@ -7843,7 +7997,23 @@ async function handleFarmRequestInContext(
7843
7997
  if (middlewareResult.response) {
7844
7998
  return middlewareResult.response;
7845
7999
  }
7846
- request = middlewareResult.request;
8000
+ request = middlewareResult.request;${hasServerRuntimeIntegrations ? `
8001
+ // A ctx.rewrite() target is guarded as a direct request for it is: integration
8002
+ // guards (protectedRoutes) and routes see the rewritten URL, as in dev. Guards
8003
+ // that already ran for the original URL are skipped, so each runs once.
8004
+ if (request.url !== url.href) {
8005
+ const rewrittenDispatch = await handleIntegrationRequest(
8006
+ cloneFarmRequestWithContext(request),
8007
+ farmIntegrationRanMiddleware,
8008
+ );
8009
+ farmIntegrationSetCookies = [...farmIntegrationSetCookies, ...rewrittenDispatch.setCookies];
8010
+ if (rewrittenDispatch.response) {
8011
+ return applyProductionMiddlewareHeaders(
8012
+ rewrittenDispatch.response,
8013
+ withFarmIntegrationSetCookies(middlewareResult.headers, integrationDispatch.setCookies),
8014
+ );
8015
+ }
8016
+ }` : ""}
7847
8017
  const middlewareData = middlewareResult.data;
7848
8018
  const middlewareContext = middlewareResult.context;
7849
8019
  const middlewareHeaders = ${hasServerRuntimeIntegrations ? "withFarmIntegrationSetCookies(middlewareResult.headers, farmIntegrationSetCookies)" : "middlewareResult.headers"};
@@ -7872,7 +8042,10 @@ async function handleFarmRequestInContext(
7872
8042
  // API routes, as in dev.
7873
8043
  const farmAiCatalogResponse = createFarmAiCatalogResponse(
7874
8044
  request,
7875
- { basePath: ${JSON.stringify(config.basePath)}, apiServerBasePath: farmLocalAPIBasePath },
8045
+ {
8046
+ basePath: ${JSON.stringify(config.basePath)},
8047
+ apiServerBasePath: farmLocalAPIBasePath,${servesDefaultMCP ? "\n defaultMCP: getFarmDefaultMCPServer," : ""}
8048
+ },
7876
8049
  url,
7877
8050
  );
7878
8051
  if (farmAiCatalogResponse) {
@@ -7880,7 +8053,7 @@ async function handleFarmRequestInContext(
7880
8053
  }
7881
8054
  ` : ""}
7882
8055
 
7883
- ${_optionalChain([config, 'access', _135 => _135.docs, 'optionalAccess', _136 => _136.enabled]) ? `
8056
+ ${_optionalChain([config, 'access', _144 => _144.docs, 'optionalAccess', _145 => _145.enabled]) ? `
7884
8057
  // Docs responses are served after app middleware so route guards and
7885
8058
  // middleware headers apply to the docs engine like any other page content.
7886
8059
  // An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
@@ -7920,7 +8093,13 @@ async function handleFarmRequestInContext(
7920
8093
  const match = matchPageRoute(getFarmRoutePathname(targetPathname));
7921
8094
  return match?.route?.markdownSource || null;
7922
8095
  },
7923
- renderPage: (targetRequest) => handleFarmRequest(targetRequest, adapterContext),
8096
+ clientAddress: adapterContext?.clientAddress,
8097
+ // An anonymous visitor's request: guards never see the caller's address.
8098
+ renderPage: (targetRequest) =>
8099
+ fetchFarmInnerRequest(targetRequest, {
8100
+ ...adapterContext,
8101
+ clientAddress: FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS,
8102
+ }),
7924
8103
  });
7925
8104
  if (markdownSourceResponse) {
7926
8105
  return isFarmMarkdownPublicSourceResponse(markdownSourceResponse)
@@ -7929,7 +8108,7 @@ async function handleFarmRequestInContext(
7929
8108
  }
7930
8109
  ` : ""}
7931
8110
 
7932
- ${_optionalChain([config, 'access', _137 => _137.md, 'optionalAccess', _138 => _138.enabled]) ? `
8111
+ ${_optionalChain([config, 'access', _146 => _146.md, 'optionalAccess', _147 => _147.enabled]) ? `
7933
8112
  if (farmMarkdownConfig?.enabled) {
7934
8113
  const markdownResponse = await createMarkdownMirrorResponse({
7935
8114
  // The mirror helper only reads metadata and creates its own GET request.
@@ -7940,7 +8119,7 @@ async function handleFarmRequestInContext(
7940
8119
  config: farmMarkdownConfig,
7941
8120
  routeExists: (targetPathname) =>
7942
8121
  Boolean(matchPageRoute(getFarmRoutePathname(targetPathname))),
7943
- renderPage: (targetRequest) => handleFarmRequest(targetRequest, adapterContext),
8122
+ renderPage: (targetRequest) => fetchFarmInnerRequest(targetRequest, adapterContext),
7944
8123
  apiServerBasePath: farmLocalAPIBasePath,
7945
8124
  });
7946
8125
  if (markdownResponse) {
@@ -8028,20 +8207,23 @@ async function handleFarmRequestInContext(
8028
8207
  return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
8029
8208
  }
8030
8209
  ` : ""}
8031
- ${config.analytics !== false ? `
8032
- // /.well-known/farmjs: the app's manifest, only for a request Farm Infra signed.
8033
- if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkIPXLADVOcjs.FARM_APP_MANIFEST_PATH)}) {
8034
- const farmAppManifest = await createFarmAppManifestResponse(request, farmAppManifestInput, {
8035
- development: false,
8036
- });
8037
- if (farmAppManifest) {
8038
- return applyProductionMiddlewareHeaders(farmAppManifest, middlewareHeaders);
8039
- }
8210
+ ${_optionalChain([config, 'access', _148 => _148.agent, 'optionalAccess', _149 => _149.manifest]) !== false ? `
8211
+ // agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
8212
+ // public manifest; Farm Infra's signed request gets the full view.
8213
+ if (
8214
+ [${JSON.stringify(_chunkLOFKRKO7cjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkLOFKRKO7cjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
8215
+ normalizeRuntimePath(routePathname),
8216
+ )
8217
+ ) {
8218
+ return applyProductionMiddlewareHeaders(
8219
+ await createFarmAppManifestResponse(request, farmAppManifestInput),
8220
+ middlewareHeaders,
8221
+ );
8040
8222
  }
8041
8223
  ` : ""}
8042
- ${_optionalChain([config, 'access', _139 => _139.agent, 'optionalAccess', _140 => _140.apiCatalog]) ? `
8224
+ ${_optionalChain([config, 'access', _150 => _150.agent, 'optionalAccess', _151 => _151.apiCatalog]) ? `
8043
8225
  // agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
8044
- if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkIPXLADVOcjs.FARM_API_CATALOG_PATH)}) {
8226
+ if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkLOFKRKO7cjs.FARM_API_CATALOG_PATH)}) {
8045
8227
  return applyProductionMiddlewareHeaders(
8046
8228
  createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
8047
8229
  middlewareHeaders,
@@ -8057,11 +8239,20 @@ async function handleFarmRequestInContext(
8057
8239
  );
8058
8240
  }
8059
8241
  ` : ""}
8060
- ${_optionalChain([config, 'access', _141 => _141.agent, 'optionalAccess', _142 => _142.llmsTxt, 'optionalAccess', _143 => _143.enabled]) ? `
8242
+ ${servesAgentSitemap ? `
8243
+ // agent.sitemap with no sitemap.ts: serve the generated file.
8244
+ if (normalizeRuntimePath(routePathname) === "/sitemap.xml") {
8245
+ return applyProductionMiddlewareHeaders(
8246
+ createFarmAgentSitemapResponse(request),
8247
+ middlewareHeaders,
8248
+ );
8249
+ }
8250
+ ` : ""}
8251
+ ${_optionalChain([config, 'access', _152 => _152.agent, 'optionalAccess', _153 => _153.llmsTxt, 'optionalAccess', _154 => _154.enabled]) ? `
8061
8252
  // agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
8062
8253
  const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
8063
8254
  ? "llms"
8064
- : ${_optionalChain([config, 'access', _144 => _144.agent, 'optionalAccess', _145 => _145.llmsTxt, 'optionalAccess', _146 => _146.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
8255
+ : ${_optionalChain([config, 'access', _155 => _155.agent, 'optionalAccess', _156 => _156.llmsTxt, 'optionalAccess', _157 => _157.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
8065
8256
  if (farmGeneratedLlmsKind) {
8066
8257
  const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
8067
8258
  const llmsOrigin = new URL(request.url).origin;
@@ -8096,7 +8287,7 @@ async function handleFarmRequestInContext(
8096
8287
  }
8097
8288
  ` : ""}
8098
8289
 
8099
- ${_optionalChain([config, 'access', _147 => _147.docs, 'optionalAccess', _148 => _148.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
8290
+ ${_optionalChain([config, 'access', _158 => _158.docs, 'optionalAccess', _159 => _159.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
8100
8291
  const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
8101
8292
  if (docsAPIResponse) {
8102
8293
  return applyProductionMiddlewareHeaders(docsAPIResponse, middlewareHeaders);
@@ -8554,7 +8745,7 @@ async function handleFarmRequestInContext(
8554
8745
  );
8555
8746
  }
8556
8747
  }
8557
- ${_optionalChain([config, 'access', _149 => _149.md, 'optionalAccess', _150 => _150.enabled]) ? `
8748
+ ${_optionalChain([config, 'access', _160 => _160.md, 'optionalAccess', _161 => _161.enabled]) ? `
8558
8749
  // Advertise the Markdown mirror in the head as well as the Link header,
8559
8750
  // using the public path the .md request will be resolved against.
8560
8751
  mergedMetadata = addMetadataMarkdownAlternate(
@@ -8573,7 +8764,7 @@ async function handleFarmRequestInContext(
8573
8764
  emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "request-read" });
8574
8765
  }
8575
8766
 
8576
- const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _151 => _151.agent, 'optionalAccess', _152 => _152.jsonLd]), () => ( false)))} });
8767
+ const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _162 => _162.agent, 'optionalAccess', _163 => _163.jsonLd]), () => ( false)))} });
8577
8768
  const title = renderedMetadata.title;
8578
8769
  const metaTags = renderedMetadata.tags;
8579
8770
  const hasFavicon = renderedMetadata.hasFavicon;
@@ -8990,6 +9181,18 @@ async function handleFarmRequestInContext(
8990
9181
  }
8991
9182
  }
8992
9183
 
9184
+ ${servesDefaultMCP ? `
9185
+ // agent.mcp: no app route answered /mcp, so the default read-only server may.
9186
+ if (
9187
+ normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkPTZ2TVNEcjs.FARM_DEFAULT_MCP_PATH)} &&
9188
+ getFarmDefaultMCPServer()
9189
+ ) {
9190
+ return applyProductionMiddlewareHeaders(
9191
+ await handleFarmDefaultMCP(request),
9192
+ middlewareHeaders,
9193
+ );
9194
+ }
9195
+ ` : ""}
8993
9196
  // 404 fallback - render proper HTML page
8994
9197
  return renderFarmNotFoundResponse();
8995
9198
 
@@ -9195,11 +9398,11 @@ ${generatePreloadResponseRuntimeSource()}
9195
9398
 
9196
9399
  // Export as Web Standard fetch API
9197
9400
  export async function fetch(request, context) {
9198
- ${_optionalChain([config, 'access', _153 => _153.agent, 'optionalAccess', _154 => _154.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
9401
+ ${_optionalChain([config, 'access', _164 => _164.agent, 'optionalAccess', _165 => _165.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
9199
9402
  basePath: farmLocalAPIBasePath,
9200
9403
  dispatch: async (localRequest) =>
9201
9404
  (await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
9202
- }, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _155 => _155.agent, 'optionalAccess', _156 => _156.noindexPreviews]) ? `
9405
+ }, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _166 => _166.agent, 'optionalAccess', _167 => _167.noindexPreviews]) ? `
9203
9406
  // Keep every response of a preview deployment out of search indexes.
9204
9407
  return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
9205
9408
  }
@@ -9349,13 +9552,13 @@ function configMiddlewareMayHandlePath(config, pathname) {
9349
9552
  typeof matcher === "function" ? () => true : matcher
9350
9553
  )
9351
9554
  ) : void 0;
9352
- const compiled = _chunkZ2HLU4IXcjs.compileMiddlewareConfig.call(void 0, { matcher: matchers, exclude: entry.exclude });
9353
- return _chunkZ2HLU4IXcjs.matchesCompiledMiddlewareConfig.call(void 0, pathname, compiled, {}).matched;
9555
+ const compiled = _chunk4GWRFP22cjs.compileMiddlewareConfig.call(void 0, { matcher: matchers, exclude: entry.exclude });
9556
+ return _chunk4GWRFP22cjs.matchesCompiledMiddlewareConfig.call(void 0, pathname, compiled, {}).matched;
9354
9557
  });
9355
9558
  }
9356
9559
  _chunkS3JO3N4Hcjs.__name.call(void 0, configMiddlewareMayHandlePath, "configMiddlewareMayHandlePath");
9357
9560
  function appMiddlewareMayHandlePath(middlewareRoutes, pathname) {
9358
- return middlewareRoutes.some((route) => _chunkZ2HLU4IXcjs.matchesMiddlewareRoute.call(void 0, pathname, route).matched);
9561
+ return middlewareRoutes.some((route) => _chunk4GWRFP22cjs.matchesMiddlewareRoute.call(void 0, pathname, route).matched);
9359
9562
  }
9360
9563
  _chunkS3JO3N4Hcjs.__name.call(void 0, appMiddlewareMayHandlePath, "appMiddlewareMayHandlePath");
9361
9564
  function routePatternSpecificity(pattern) {
@@ -9395,11 +9598,11 @@ function getPhysicalPrerenderBypassReason(options) {
9395
9598
  }
9396
9599
  if (appMiddlewareMayHandlePath(middlewareRoutes, pathname)) return "app middleware";
9397
9600
  if (configMiddlewareMayHandlePath(config.middleware, pathname)) return "configured middleware";
9398
- if (_chunkF7JZENPFcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
9601
+ if (_chunk3A4KGQYIcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
9399
9602
  if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
9400
9603
  const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
9401
- if (_optionalChain([manifestEntry, 'optionalAccess', _157 => _157.rendering]) === "dynamic") return "dynamic runtime manifest";
9402
- if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _158 => _158.regions, 'optionalAccess', _159 => _159.length])) || manifestEntry.maxDuration !== void 0)) {
9604
+ if (_optionalChain([manifestEntry, 'optionalAccess', _168 => _168.rendering]) === "dynamic") return "dynamic runtime manifest";
9605
+ if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _169 => _169.regions, 'optionalAccess', _170 => _170.length])) || manifestEntry.maxDuration !== void 0)) {
9403
9606
  return "route runtime controls";
9404
9607
  }
9405
9608
  const routeRule = getEffectiveRouteRule(config, pathname);
@@ -9421,7 +9624,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
9421
9624
  const nitroBuilder = nitroBuilderResult.value;
9422
9625
  const isVercel = preset === "vercel" || preset === "vercel-edge";
9423
9626
  const isCloudflareWorker = preset === "cloudflare-module";
9424
- const outputDir = _chunkF7JZENPFcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
9627
+ const outputDir = _chunk3A4KGQYIcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
9425
9628
  const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
9426
9629
  const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
9427
9630
  const imageRuntime = resolveImageRuntime(config, preset);
@@ -9443,9 +9646,9 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
9443
9646
  _chunk5QIKR7RRcjs.logger.info(`\u{1F4E6} SSR entry file: ${ssrEntryFile}`);
9444
9647
  _chunk5QIKR7RRcjs.logger.info(`\u{1F4E6} Preset: ${preset}`);
9445
9648
  const ssgCollectionPromise = routeManager.collectSSGPages();
9446
- const middlewareRoutesPromise = discoverMiddlewareRoutes(_chunkVPTDD5XFcjs.getFarmAppDirectories.call(void 0, config));
9649
+ const middlewareRoutesPromise = discoverMiddlewareRoutes(_chunkWBKEZXWEcjs.getFarmAppDirectories.call(void 0, config));
9447
9650
  const configuredResponseRoutesPromise = Promise.all([config.redirects(), config.rewrites()]);
9448
- const farmWorkflows = await _chunkVFQT3LAOcjs.prepareFarmWorkflowsForNitro.call(void 0, config);
9651
+ const farmWorkflows = await _chunkSDOTRX3Vcjs.prepareFarmWorkflowsForNitro.call(void 0, config);
9449
9652
  const farmCron = await _chunk6EXBPJ24cjs.prepareFarmCronForNitro.call(void 0, config);
9450
9653
  const [{ ssg: ssgPages }, middlewareRoutes, [configuredRedirects, configuredRewrites]] = await Promise.all([
9451
9654
  ssgCollectionPromise,
@@ -9666,6 +9869,10 @@ function toFarmNodeResponse(request, response) {
9666
9869
  await fs.writeFile(nitroEntryPath, nitroEntryCode);
9667
9870
  const farmNodeServerEntryPath = preset === "node-server" ? _path2.default.join(ssrOutputDir, "farm-node-server-entry.mjs") : null;
9668
9871
  if (farmNodeServerEntryPath && nodeAdapterModule) {
9872
+ await fs.writeFile(
9873
+ _path2.default.join(ssrOutputDir, FARM_NODE_ENV_MODULE_FILE),
9874
+ FARM_NODE_ENV_MODULE_SOURCE
9875
+ );
9669
9876
  await fs.writeFile(
9670
9877
  farmNodeServerEntryPath,
9671
9878
  createFarmNodeServerEntry({
@@ -9807,20 +10014,20 @@ function toFarmNodeResponse(request, response) {
9807
10014
  snapshotSSRRebundleOptions(nitroConfig)
9808
10015
  );
9809
10016
  const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
9810
- const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _160 => _160.rollupConfig, 'optionalAccess', _161 => _161.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _162 => _162.rollupConfig, 'optionalAccess', _163 => _163.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _164 => _164.output, 'optionalAccess', _165 => _165.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
9811
- _optionalChain([nitroConfig, 'access', _166 => _166.handlers, 'optionalAccess', _167 => _167.some, 'call', _168 => _168(
9812
- (handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _169 => _169.handler]) || "") === nitroEntryPath
10017
+ const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _171 => _171.rollupConfig, 'optionalAccess', _172 => _172.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _173 => _173.rollupConfig, 'optionalAccess', _174 => _174.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _175 => _175.output, 'optionalAccess', _176 => _176.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
10018
+ _optionalChain([nitroConfig, 'access', _177 => _177.handlers, 'optionalAccess', _178 => _178.some, 'call', _179 => _179(
10019
+ (handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _180 => _180.handler]) || "") === nitroEntryPath
9813
10020
  )])
9814
10021
  );
9815
10022
  const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
9816
10023
  if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
9817
10024
  const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
9818
10025
  const shouldMinify = nitroConfig.minify !== false;
9819
- const keepServerNames = !(_optionalChain([config, 'access', _170 => _170.docs, 'optionalAccess', _171 => _171.enabled]) && _optionalChain([config, 'access', _172 => _172.docs, 'access', _173 => _173.adapter, 'optionalAccess', _174 => _174.server]));
10026
+ const keepServerNames = !(_optionalChain([config, 'access', _181 => _181.docs, 'optionalAccess', _182 => _182.enabled]) && _optionalChain([config, 'access', _183 => _183.docs, 'access', _184 => _184.adapter, 'optionalAccess', _185 => _185.server]));
9820
10027
  const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
9821
10028
  const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
9822
10029
  if (canReusePrebuiltSSR) {
9823
- const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _175 => _175.rollupConfig, 'optionalAccess', _176 => _176.plugins]);
10030
+ const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _186 => _186.rollupConfig, 'optionalAccess', _187 => _187.plugins]);
9824
10031
  nitroConfig.rollupConfig = {
9825
10032
  ...nitroConfig.rollupConfig,
9826
10033
  plugins: [
@@ -9831,9 +10038,9 @@ function toFarmNodeResponse(request, response) {
9831
10038
  }
9832
10039
  nitroConfig.minify = useFarmServerMinifier ? false : shouldMinify;
9833
10040
  const nitroInstance = await nitroBuilder.createNitro(nitroConfig);
9834
- if (_optionalChain([config, 'access', _177 => _177.md, 'optionalAccess', _178 => _178.enabled])) {
10041
+ if (_optionalChain([config, 'access', _188 => _188.md, 'optionalAccess', _189 => _189.enabled])) {
9835
10042
  nitroInstance.hooks.hook("prerender:generate", (route) => {
9836
- if (!route.contents || !_optionalChain([route, 'access', _179 => _179.contentType, 'optionalAccess', _180 => _180.toLowerCase, 'call', _181 => _181(), 'access', _182 => _182.includes, 'call', _183 => _183("html")])) return;
10043
+ if (!route.contents || !_optionalChain([route, 'access', _190 => _190.contentType, 'optionalAccess', _191 => _191.toLowerCase, 'call', _192 => _192(), 'access', _193 => _193.includes, 'call', _194 => _194("html")])) return;
9837
10044
  const alternatePath = _chunkEUV4YR3Vcjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route);
9838
10045
  if (!alternatePath) return;
9839
10046
  const routeRule = nitroInstance.options.routeRules[route.route] || {};
@@ -9854,8 +10061,8 @@ function toFarmNodeResponse(request, response) {
9854
10061
  }
9855
10062
  if (config.security.csp && config.security.csp.nonce) {
9856
10063
  nitroInstance.hooks.hook("prerender:generate", async (route) => {
9857
- if (!route.contents || !_optionalChain([route, 'access', _184 => _184.contentType, 'optionalAccess', _185 => _185.toLowerCase, 'call', _186 => _186(), 'access', _187 => _187.includes, 'call', _188 => _188("html")])) return;
9858
- const staticCsp = await _chunkRU3M2FIKcjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
10064
+ if (!route.contents || !_optionalChain([route, 'access', _195 => _195.contentType, 'optionalAccess', _196 => _196.toLowerCase, 'call', _197 => _197(), 'access', _198 => _198.includes, 'call', _199 => _199("html")])) return;
10065
+ const staticCsp = await _chunkMRMI32SNcjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
9859
10066
  if (!staticCsp) return;
9860
10067
  route.contents = staticCsp.html;
9861
10068
  const routeRule = nitroInstance.options.routeRules[route.route] || {};
@@ -9925,13 +10132,13 @@ function toFarmNodeResponse(request, response) {
9925
10132
  }
9926
10133
  if (prerenderRoutes.length > 0) {
9927
10134
  _chunk5QIKR7RRcjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
9928
- const previousPrerender = process.env[_chunkTKSCR644cjs.FARM_PRERENDER_ENV];
9929
- process.env[_chunkTKSCR644cjs.FARM_PRERENDER_ENV] = "1";
10135
+ const previousPrerender = process.env[_chunkD3C5LBQYcjs.FARM_PRERENDER_ENV];
10136
+ process.env[_chunkD3C5LBQYcjs.FARM_PRERENDER_ENV] = "1";
9930
10137
  try {
9931
10138
  await nitroBuilder.prerender(nitroInstance);
9932
10139
  } finally {
9933
- if (previousPrerender === void 0) delete process.env[_chunkTKSCR644cjs.FARM_PRERENDER_ENV];
9934
- else process.env[_chunkTKSCR644cjs.FARM_PRERENDER_ENV] = previousPrerender;
10140
+ if (previousPrerender === void 0) delete process.env[_chunkD3C5LBQYcjs.FARM_PRERENDER_ENV];
10141
+ else process.env[_chunkD3C5LBQYcjs.FARM_PRERENDER_ENV] = previousPrerender;
9935
10142
  }
9936
10143
  }
9937
10144
  const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs, preset) : Promise.resolve(null);
@@ -10062,7 +10269,7 @@ async function moveVercelOutputPath(src, dest, fs) {
10062
10269
  await fs.rename(src, dest);
10063
10270
  return;
10064
10271
  } catch (error) {
10065
- const code = _optionalChain([error, 'optionalAccess', _189 => _189.code]);
10272
+ const code = _optionalChain([error, 'optionalAccess', _200 => _200.code]);
10066
10273
  if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
10067
10274
  throw error;
10068
10275
  }
@@ -10089,7 +10296,7 @@ async function postProcessVercelOutput(root, outputDir, fs, config, farmWorkflow
10089
10296
  try {
10090
10297
  await moveVercelOutputPath(publicDir, staticDir, fs);
10091
10298
  } catch (error) {
10092
- if (_optionalChain([error, 'optionalAccess', _190 => _190.code]) !== "ENOENT") throw error;
10299
+ if (_optionalChain([error, 'optionalAccess', _201 => _201.code]) !== "ENOENT") throw error;
10093
10300
  }
10094
10301
  await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs);
10095
10302
  await copyPrismaClientForVercel(root, nitroFuncDir, fs);
@@ -10106,7 +10313,7 @@ async function postProcessVercelOutput(root, outputDir, fs, config, farmWorkflow
10106
10313
  presetRoutes: Array.isArray(vercelConfig.routes) ? vercelConfig.routes : [],
10107
10314
  runtimeRoutes
10108
10315
  });
10109
- const vercelConfigWithWorkflowCrons = _chunkVFQT3LAOcjs.applyFarmWorkflowVercelCrons.call(void 0,
10316
+ const vercelConfigWithWorkflowCrons = _chunkSDOTRX3Vcjs.applyFarmWorkflowVercelCrons.call(void 0,
10110
10317
  vercelConfig,
10111
10318
  farmWorkflows.workflows
10112
10319
  );
@@ -10122,7 +10329,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs) {
10122
10329
  const docsContentDir = resolveBuildDocsContentDir(config, root);
10123
10330
  if (!docsContentDir) return;
10124
10331
  const bundledContentDir = _path2.default.join(nitroFuncDir, "farm-docs-content");
10125
- const lastModifiedManifest = _chunkVZJR7UTGcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
10332
+ const lastModifiedManifest = _chunkTE2G5IONcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
10126
10333
  fallback: "now"
10127
10334
  });
10128
10335
  await fs.rm(bundledContentDir, { recursive: true, force: true });
@@ -10132,7 +10339,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs) {
10132
10339
  force: true
10133
10340
  });
10134
10341
  await fs.writeFile(
10135
- _path2.default.join(bundledContentDir, _chunkVZJR7UTGcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
10342
+ _path2.default.join(bundledContentDir, _chunkTE2G5IONcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
10136
10343
  `${JSON.stringify(lastModifiedManifest, null, 2)}
10137
10344
  `
10138
10345
  );
@@ -10162,7 +10369,7 @@ async function stageSharpRuntime(config, root, distDir, fs, preset) {
10162
10369
  if (!resolvePackageJson(projectRequire, "sharp")) {
10163
10370
  try {
10164
10371
  sharpRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
10165
- } catch (e23) {
10372
+ } catch (e25) {
10166
10373
  }
10167
10374
  }
10168
10375
  const copiedPackages = /* @__PURE__ */ new Map();
@@ -10209,7 +10416,7 @@ async function stageSharpRuntime(config, root, distDir, fs, preset) {
10209
10416
  try {
10210
10417
  await copyPackage("sharp", sharpRequire);
10211
10418
  if (!copiedPackages.has("sharp")) {
10212
- throw new Error(`Farm image optimization requires sharp. ${_chunkICUQICNCcjs.SHARP_INSTALL_HINT}`);
10419
+ throw new Error(`Farm image optimization requires sharp. ${_chunkQ5FYSK45cjs.SHARP_INSTALL_HINT}`);
10213
10420
  }
10214
10421
  } catch (error) {
10215
10422
  await fs.rm(stageDir, { recursive: true, force: true });
@@ -10296,7 +10503,7 @@ function resolveMetadataImageRuntimePackageJson(root) {
10296
10503
  if (packageJsonPath) return packageJsonPath;
10297
10504
  try {
10298
10505
  return resolvePackageJson(_module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core")), "@vercel/og");
10299
- } catch (e24) {
10506
+ } catch (e26) {
10300
10507
  return null;
10301
10508
  }
10302
10509
  }
@@ -10347,7 +10554,7 @@ function resolvePackageJson(parentRequire, packageName) {
10347
10554
  const resolved = parentRequire.resolve(request);
10348
10555
  if (resolved.endsWith(".json")) return resolved;
10349
10556
  _nullishCoalesce(metadataModule, () => ( (metadataModule = resolved)));
10350
- } catch (e25) {
10557
+ } catch (e27) {
10351
10558
  }
10352
10559
  }
10353
10560
  try {
@@ -10358,13 +10565,13 @@ function resolvePackageJson(parentRequire, packageName) {
10358
10565
  try {
10359
10566
  const manifest = JSON.parse(_fs.readFileSync.call(void 0, candidate, "utf8"));
10360
10567
  if (manifest.name === packageName) return candidate;
10361
- } catch (e26) {
10568
+ } catch (e28) {
10362
10569
  }
10363
10570
  }
10364
10571
  if (_path2.default.basename(directory) === "node_modules") break;
10365
10572
  directory = _path2.default.dirname(directory);
10366
10573
  }
10367
- } catch (e27) {
10574
+ } catch (e29) {
10368
10575
  }
10369
10576
  return null;
10370
10577
  }
@@ -10374,13 +10581,13 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs) {
10374
10581
  let prismaClientDir;
10375
10582
  try {
10376
10583
  prismaClientDir = _path2.default.dirname(projectRequire.resolve("@prisma/client/default.js"));
10377
- } catch (e28) {
10584
+ } catch (e30) {
10378
10585
  return;
10379
10586
  }
10380
10587
  const generatedClientDir = _path2.default.join(prismaClientDir, "..", "..", ".prisma", "client");
10381
10588
  try {
10382
10589
  await fs.access(generatedClientDir);
10383
- } catch (e29) {
10590
+ } catch (e31) {
10384
10591
  return;
10385
10592
  }
10386
10593
  const targetNodeModules = _path2.default.join(nitroFuncDir, "node_modules");
@@ -10410,6 +10617,30 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs) {
10410
10617
  }
10411
10618
  _chunkS3JO3N4Hcjs.__name.call(void 0, copyPrismaClientForVercel, "copyPrismaClientForVercel");
10412
10619
 
10620
+ // src/build/project-module-runner.ts
10621
+ async function createFarmProjectModuleSsrEnvironment() {
10622
+ const vite = await import("vite");
10623
+ const { ModuleRunner, createNodeImportMeta } = await import("vite/module-runner");
10624
+ return {
10625
+ dev: {
10626
+ createEnvironment(name, config) {
10627
+ return vite.createRunnableDevEnvironment(name, config, {
10628
+ runner: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (environment) => new ModuleRunner({
10629
+ transport: {
10630
+ ...vite.createServerModuleRunnerTransport({ channel: environment.hot }),
10631
+ timeout: 0
10632
+ },
10633
+ hmr: false,
10634
+ createImportMeta: createNodeImportMeta,
10635
+ sourcemapInterceptor: "node"
10636
+ }), "runner")
10637
+ });
10638
+ }
10639
+ }
10640
+ };
10641
+ }
10642
+ _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmProjectModuleSsrEnvironment, "createFarmProjectModuleSsrEnvironment");
10643
+
10413
10644
  // src/build/index.ts
10414
10645
  async function build(config, options = {}) {
10415
10646
  return _chunkMT763TDWcjs.withProductionNodeEnv.call(void 0, () => buildWithProductionNodeEnv(config, options));
@@ -10423,7 +10654,7 @@ function createBuildTargetBaseline(config) {
10423
10654
  preset,
10424
10655
  distDir,
10425
10656
  outputDir,
10426
- outputWasDerived: outputDir === _chunkF7JZENPFcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
10657
+ outputWasDerived: outputDir === _chunk3A4KGQYIcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
10427
10658
  };
10428
10659
  }
10429
10660
  _chunkS3JO3N4Hcjs.__name.call(void 0, createBuildTargetBaseline, "createBuildTargetBaseline");
@@ -10433,8 +10664,8 @@ function resolveBuildTargets(config, options, baseline) {
10433
10664
  const distDir = config.distDir || ".farm";
10434
10665
  const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
10435
10666
  const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
10436
- const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkF7JZENPFcjs.getDeployTargetForPreset.call(void 0, preset);
10437
- const outputDir = shouldRefreshDerivedOutput ? _chunkF7JZENPFcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
10667
+ const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunk3A4KGQYIcjs.getDeployTargetForPreset.call(void 0, preset);
10668
+ const outputDir = shouldRefreshDerivedOutput ? _chunk3A4KGQYIcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
10438
10669
  return {
10439
10670
  root,
10440
10671
  preset,
@@ -10442,7 +10673,7 @@ function resolveBuildTargets(config, options, baseline) {
10442
10673
  distDir,
10443
10674
  deployTarget,
10444
10675
  outputDir,
10445
- deployOutputDir: _chunkF7JZENPFcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
10676
+ deployOutputDir: _chunk3A4KGQYIcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
10446
10677
  };
10447
10678
  }
10448
10679
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveBuildTargets, "resolveBuildTargets");
@@ -10451,7 +10682,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10451
10682
  const targetBaseline = createBuildTargetBaseline(config);
10452
10683
  let targets;
10453
10684
  const productionViteResultPromise = options.universal === false ? void 0 : Promise.allSettled([Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))]);
10454
- const pluginManager = new (0, _chunkICUQICNCcjs.PluginManager)({
10685
+ const pluginManager = new (0, _chunkQ5FYSK45cjs.PluginManager)({
10455
10686
  config,
10456
10687
  isDev: false,
10457
10688
  isProd: true
@@ -10480,12 +10711,12 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10480
10711
  };
10481
10712
  config = {
10482
10713
  ...config,
10483
- images: _chunkICUQICNCcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
10714
+ images: _chunkQ5FYSK45cjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
10484
10715
  root: targets.root,
10485
10716
  preset: targets.preset
10486
10717
  })
10487
10718
  };
10488
- if (_optionalChain([config, 'access', _191 => _191.docs, 'optionalAccess', _192 => _192.enabled])) await _chunkIK6LVLKCcjs.loadFarmDocsEngine.call(void 0, );
10719
+ if (_optionalChain([config, 'access', _202 => _202.docs, 'optionalAccess', _203 => _203.enabled])) await _chunkIK6LVLKCcjs.loadFarmDocsEngine.call(void 0, );
10489
10720
  pluginManager.updateContext({ config });
10490
10721
  const { root, preset, srcDir, distDir, deployOutputDir } = targets;
10491
10722
  _chunk5QIKR7RRcjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
@@ -10499,8 +10730,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10499
10730
  });
10500
10731
  _chunk5QIKR7RRcjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
10501
10732
  const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
10502
- if (_optionalChain([productionViteResult, 'optionalAccess', _193 => _193.status]) === "rejected") throw productionViteResult.reason;
10503
- const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _194 => _194.value]);
10733
+ if (_optionalChain([productionViteResult, 'optionalAccess', _204 => _204.status]) === "rejected") throw productionViteResult.reason;
10734
+ const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _205 => _205.value]);
10504
10735
  const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
10505
10736
  projectModuleServer = await createProjectModuleServer(
10506
10737
  createViteServer,
@@ -10508,18 +10739,18 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10508
10739
  root,
10509
10740
  rendererBuild.signal
10510
10741
  );
10511
- const farmApp = _chunkICUQICNCcjs.createFarmApp.call(void 0, config, projectModuleServer);
10742
+ const farmApp = _chunkQ5FYSK45cjs.createFarmApp.call(void 0, config, projectModuleServer);
10512
10743
  await farmApp.initialize();
10513
10744
  const routeManager = farmApp.getRouteManager();
10514
10745
  const serverRenderer = farmApp.getServerRenderer();
10515
- const typeArtifacts = _chunk3BHT4WMPcjs.generateFarmTypeArtifacts.call(void 0, {
10746
+ const typeArtifacts = _chunk5D2JIPLHcjs.generateFarmTypeArtifacts.call(void 0, {
10516
10747
  root,
10517
10748
  srcDir,
10518
10749
  layers: config.layers,
10519
10750
  plugins: config.plugins,
10520
10751
  extraRoutes: [
10521
- ..._optionalChain([config, 'access', _195 => _195.openapi, 'optionalAccess', _196 => _196.enabled]) && config.openapi.route ? [config.openapi.route] : [],
10522
- ..._chunkVZJR7UTGcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
10752
+ ..._optionalChain([config, 'access', _206 => _206.openapi, 'optionalAccess', _207 => _207.enabled]) && config.openapi.route ? [config.openapi.route] : [],
10753
+ ..._chunkTE2G5IONcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
10523
10754
  ],
10524
10755
  suppressLintOnLink: config.suppressLintOnLink,
10525
10756
  componentExtensions: config.renderer.componentExtensions,
@@ -10528,8 +10759,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10528
10759
  const message = error instanceof Error ? error.message : String(error);
10529
10760
  _chunk5QIKR7RRcjs.logger.warn(`Route type generation failed (farm.d.ts may be stale): ${message}`);
10530
10761
  });
10531
- const apiRouteManager = new (0, _chunkXBML5KMGcjs.APIRouteManager)(
10532
- _chunkVPTDD5XFcjs.getFarmAppDirectories.call(void 0, config),
10762
+ const apiRouteManager = new (0, _chunkU6MPZ35Qcjs.APIRouteManager)(
10763
+ _chunkWBKEZXWEcjs.getFarmAppDirectories.call(void 0, config),
10533
10764
  projectModuleServer,
10534
10765
  {
10535
10766
  throwOnLoadError: true,
@@ -10603,7 +10834,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10603
10834
  throw error;
10604
10835
  } finally {
10605
10836
  try {
10606
- await _optionalChain([projectModuleServer, 'optionalAccess', _197 => _197.close, 'call', _198 => _198()]);
10837
+ await _optionalChain([projectModuleServer, 'optionalAccess', _208 => _208.close, 'call', _209 => _209()]);
10607
10838
  } finally {
10608
10839
  rendererBuild.abort();
10609
10840
  }
@@ -10615,7 +10846,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
10615
10846
  ssr: true,
10616
10847
  buildLifetime
10617
10848
  });
10618
- const viteConfig = _chunkICUQICNCcjs.mergeFarmViteConfig.call(void 0,
10849
+ const viteConfig = _chunkQ5FYSK45cjs.mergeFarmViteConfig.call(void 0,
10619
10850
  {
10620
10851
  root,
10621
10852
  appType: "custom",
@@ -10627,7 +10858,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
10627
10858
  },
10628
10859
  plugins: [
10629
10860
  ...rendererVitePlugins,
10630
- _chunkICUQICNCcjs.farmFontImportsPlugin.call(void 0, {
10861
+ _chunkQ5FYSK45cjs.farmFontImportsPlugin.call(void 0, {
10631
10862
  root,
10632
10863
  basePath: config.basePath,
10633
10864
  publicDir: config.publicDir
@@ -10639,7 +10870,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
10639
10870
  hmr: false
10640
10871
  },
10641
10872
  resolve: {
10642
- alias: _chunkICUQICNCcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
10873
+ alias: _chunkQ5FYSK45cjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
10643
10874
  dedupe: [...config.renderer.dedupe || []]
10644
10875
  },
10645
10876
  optimizeDeps: {
@@ -10670,6 +10901,14 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
10670
10901
  optimizeDeps: {
10671
10902
  ...viteConfig.optimizeDeps,
10672
10903
  noDiscovery: true
10904
+ },
10905
+ // An app or plugin that brings its own SSR environment keeps it.
10906
+ environments: _optionalChain([viteConfig, 'access', _210 => _210.environments, 'optionalAccess', _211 => _211.ssr, 'optionalAccess', _212 => _212.dev, 'optionalAccess', _213 => _213.createEnvironment]) ? viteConfig.environments : {
10907
+ ...viteConfig.environments,
10908
+ ssr: {
10909
+ ..._optionalChain([viteConfig, 'access', _214 => _214.environments, 'optionalAccess', _215 => _215.ssr]),
10910
+ ...await createFarmProjectModuleSsrEnvironment()
10911
+ }
10673
10912
  }
10674
10913
  });
10675
10914
  }
@@ -10725,7 +10964,7 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
10725
10964
  define: {
10726
10965
  __FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
10727
10966
  __FARM_ENV__: JSON.stringify(_chunkVEKFLAQMcjs.createBundledEnv.call(void 0, config.env)),
10728
- __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _199 => _199.env, 'optionalAccess', _200 => _200.public]) || {})
10967
+ __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _216 => _216.env, 'optionalAccess', _217 => _217.public]) || {})
10729
10968
  },
10730
10969
  plugins: [
10731
10970
  farmI18nClientBridgePlugin(),
@@ -10747,7 +10986,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
10747
10986
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveLegacyPageEntry, "resolveLegacyPageEntry");
10748
10987
  async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
10749
10988
  const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
10750
- import("./nitro-OVPLKPE2.cjs"),
10989
+ import("./nitro-7F65EZZS.cjs"),
10751
10990
  import("nitro/builder")
10752
10991
  ]);
10753
10992
  let nitroConfig = await createNitroConfig(
@@ -10760,7 +10999,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
10760
10999
  if (pluginManager) {
10761
11000
  nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
10762
11001
  }
10763
- const outputDir = _chunkF7JZENPFcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
11002
+ const outputDir = _chunk3A4KGQYIcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
10764
11003
  const serverOutputDir = _path2.default.join(outputDir, "server");
10765
11004
  const publicOutputDir = _path2.default.join(outputDir, "public");
10766
11005
  const { mkdir, cp } = await import("fs/promises");
@@ -10819,7 +11058,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
10819
11058
  const { readFile } = await import("fs/promises");
10820
11059
  const manifestContent = await readFile(clientManifestPath, "utf-8");
10821
11060
  farmRegistry.clientManifest = JSON.parse(manifestContent);
10822
- } catch (e30) {
11061
+ } catch (e32) {
10823
11062
  farmRegistry.clientManifest = {};
10824
11063
  }
10825
11064
  } catch (error) {
@@ -10831,7 +11070,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
10831
11070
  root,
10832
11071
  preset,
10833
11072
  distDir,
10834
- outputDir: _chunkF7JZENPFcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
11073
+ outputDir: _chunk3A4KGQYIcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
10835
11074
  });
10836
11075
  }
10837
11076
  }