@farm.js/core 0.1.30 → 0.1.34

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 (286) hide show
  1. package/README.md +1 -1
  2. package/dist/agent-runtime.cjs +69 -14
  3. package/dist/agent-runtime.d.mts +1 -1
  4. package/dist/agent-runtime.d.ts +1 -1
  5. package/dist/agent-runtime.mjs +58 -3
  6. package/dist/api/route-manager.cjs +16 -13
  7. package/dist/api/route-manager.d.mts +1 -1
  8. package/dist/api/route-manager.d.ts +1 -1
  9. package/dist/api/route-manager.mjs +15 -12
  10. package/dist/api/runtime.cjs +9 -7
  11. package/dist/api/runtime.d.mts +1 -1
  12. package/dist/api/runtime.d.ts +1 -1
  13. package/dist/api/runtime.mjs +8 -6
  14. package/dist/api.cjs +19 -16
  15. package/dist/api.d.mts +2 -2
  16. package/dist/api.d.ts +2 -2
  17. package/dist/api.mjs +18 -15
  18. package/dist/{app-sUJ3jnTZ.d.ts → app-DgotYGbq.d.ts} +3 -3
  19. package/dist/app-markdown.cjs +8 -6
  20. package/dist/app-markdown.d.mts +3 -3
  21. package/dist/app-markdown.d.ts +3 -3
  22. package/dist/app-markdown.mjs +7 -5
  23. package/dist/{app-DAuUTIZf.d.mts → app-q4rmZlXK.d.mts} +3 -3
  24. package/dist/cache.cjs +2 -2
  25. package/dist/cache.d.mts +10 -1
  26. package/dist/cache.d.ts +10 -1
  27. package/dist/cache.mjs +1 -1
  28. package/dist/{chunk-YZTASLPQ.cjs → chunk-27ZWSI3W.cjs} +2 -2
  29. package/dist/{chunk-WBIH66JK.mjs → chunk-2ELDTQRN.mjs} +5 -2
  30. package/dist/{chunk-K7CELQLK.cjs → chunk-2F2ER724.cjs} +54 -29
  31. package/dist/{chunk-NRVGEI5I.mjs → chunk-2NNMOPDN.mjs} +4 -210
  32. package/dist/chunk-2NQQ5H5G.cjs +86 -0
  33. package/dist/{chunk-HPQC2LHF.cjs → chunk-36MK5YCW.cjs} +342 -163
  34. package/dist/chunk-3BU22U3M.cjs +237 -0
  35. package/dist/{chunk-MM5D6VLP.mjs → chunk-3KZS4SUS.mjs} +33 -14
  36. package/dist/chunk-3SDFA7UF.cjs +701 -0
  37. package/dist/{chunk-4IEPYMHF.mjs → chunk-3UEVPCGW.mjs} +1 -1
  38. package/dist/{chunk-6G3ZZ2IE.mjs → chunk-3VSKDFAT.mjs} +1 -1
  39. package/dist/{chunk-5HGR3W6O.mjs → chunk-5SJWVY6R.mjs} +8 -0
  40. package/dist/{chunk-X7WVQMIB.mjs → chunk-657WJNRY.mjs} +10 -4
  41. package/dist/{chunk-MKMBQSNQ.mjs → chunk-6VVL3MHY.mjs} +3 -3
  42. package/dist/{chunk-QZRVZSPN.cjs → chunk-77GNHH2Z.cjs} +3 -3
  43. package/dist/{chunk-KZLND3D2.cjs → chunk-7BT4H4P7.cjs} +7 -5
  44. package/dist/{chunk-A777V5WU.cjs → chunk-7M52YUMY.cjs} +2 -2
  45. package/dist/{chunk-VUMAE7NC.mjs → chunk-7Y6ZNFPX.mjs} +81 -30
  46. package/dist/{chunk-ZDILFMWN.cjs → chunk-A5FGU2WU.cjs} +74 -23
  47. package/dist/{chunk-BZ3CHOFX.mjs → chunk-AGC75XAE.mjs} +37 -1
  48. package/dist/{chunk-4ZQQL4IU.mjs → chunk-AHGECQEW.mjs} +1 -1
  49. package/dist/{chunk-RG3ZOTG5.cjs → chunk-AI7QMY7O.cjs} +10 -3
  50. package/dist/{chunk-O3DTUAX2.mjs → chunk-AQZFOP7S.mjs} +6 -77
  51. package/dist/{chunk-WNLBF77X.cjs → chunk-ATK2R4CH.cjs} +14 -12
  52. package/dist/{chunk-SORB3MAR.cjs → chunk-AWC4VUZL.cjs} +17 -17
  53. package/dist/{chunk-YMCXWPWK.mjs → chunk-BCMSYSN2.mjs} +4 -1
  54. package/dist/{chunk-BZAGKCKB.cjs → chunk-BTAG7LI7.cjs} +2 -2
  55. package/dist/{chunk-I6XDAKWQ.mjs → chunk-BTHHUD7Q.mjs} +14 -0
  56. package/dist/chunk-C4SPBWFM.cjs +26 -0
  57. package/dist/{chunk-JATSG2ZO.mjs → chunk-CLJYVZAD.mjs} +4 -2
  58. package/dist/{chunk-J3LOGE4T.cjs → chunk-DQQOKWYA.cjs} +5 -5
  59. package/dist/{chunk-JLRDISQL.cjs → chunk-DZ4DTRJ5.cjs} +7 -7
  60. package/dist/chunk-E5GNDG5F.mjs +701 -0
  61. package/dist/{chunk-E76XC6ZG.mjs → chunk-EZDQRNQ7.mjs} +2 -2
  62. package/dist/{chunk-TOVMYGYW.mjs → chunk-F2SE2VDO.mjs} +1 -1
  63. package/dist/{chunk-BSPQVJ4A.mjs → chunk-FDR64H6B.mjs} +13 -0
  64. package/dist/{chunk-5OVTOKGH.cjs → chunk-FFFW3OQ7.cjs} +2 -2
  65. package/dist/{chunk-D4JE5NNV.cjs → chunk-FNO7A7CM.cjs} +5 -5
  66. package/dist/chunk-FZ6YYU2W.mjs +65 -0
  67. package/dist/{chunk-PZNCMPJF.cjs → chunk-G26MUMKL.cjs} +14 -8
  68. package/dist/{chunk-IXUY2F5U.mjs → chunk-GCXWJJKH.mjs} +4 -7
  69. package/dist/{chunk-JLCQGPXE.mjs → chunk-GNSDTTWZ.mjs} +50 -61
  70. package/dist/{chunk-D234YWNA.mjs → chunk-GOABMOX3.mjs} +151 -3
  71. package/dist/{chunk-HBTUGXHS.cjs → chunk-HLJ6MBUZ.cjs} +7 -4
  72. package/dist/{chunk-GZYH4OER.mjs → chunk-HR5KPHC2.mjs} +1 -1
  73. package/dist/{chunk-ZCU4NZ3M.cjs → chunk-IE7XCHH3.cjs} +4 -4
  74. package/dist/{chunk-I26CZYPV.cjs → chunk-IHNIDL6H.cjs} +50 -7
  75. package/dist/{chunk-2FQHH5SC.mjs → chunk-IHNMMXHV.mjs} +49 -24
  76. package/dist/{chunk-VHJGDMCG.cjs → chunk-IWZKTWHZ.cjs} +2 -2
  77. package/dist/{chunk-DGXN3L4D.mjs → chunk-JDPAKVS4.mjs} +4 -4
  78. package/dist/chunk-JG6DJF5A.mjs +238 -0
  79. package/dist/{chunk-5TISYEQF.mjs → chunk-JM5XPKWH.mjs} +10 -3
  80. package/dist/{chunk-BJJATPEC.mjs → chunk-KN7K4VQN.mjs} +1 -1
  81. package/dist/{chunk-WPYFSQKK.cjs → chunk-KNBBQHO2.cjs} +15 -1
  82. package/dist/{chunk-XWAWFQFS.cjs → chunk-KXWRO25S.cjs} +7 -4
  83. package/dist/{chunk-QG5HNS7P.mjs → chunk-LHODW25H.mjs} +2 -2
  84. package/dist/{chunk-BXFWA23T.mjs → chunk-LMJ7VRHZ.mjs} +3 -3
  85. package/dist/{chunk-IVLUJUT4.mjs → chunk-LR5QSC2P.mjs} +388 -209
  86. package/dist/chunk-LSKZMJMP.cjs +65 -0
  87. package/dist/{chunk-2N5PX3LS.mjs → chunk-LYV44OIR.mjs} +7 -1
  88. package/dist/{chunk-5MKEDGLD.cjs → chunk-M64YUMA4.cjs} +11 -6
  89. package/dist/{chunk-EXLKRR4U.cjs → chunk-MIDIZJZC.cjs} +12 -12
  90. package/dist/{chunk-ES4B2IXW.cjs → chunk-MOKLYNHV.cjs} +2 -2
  91. package/dist/{chunk-IV6CQY7O.mjs → chunk-MSSFIQGM.mjs} +63 -13
  92. package/dist/{chunk-KH7BN726.cjs → chunk-N4UOK6ZI.cjs} +8 -2
  93. package/dist/{chunk-YMUE7L3D.mjs → chunk-NGVORZVZ.mjs} +1 -1
  94. package/dist/{chunk-JNGIWIY6.mjs → chunk-NPC7VWJE.mjs} +2 -2
  95. package/dist/{chunk-ILWLPEVO.mjs → chunk-NRSN7G7E.mjs} +2 -2
  96. package/dist/{chunk-PQD2AI3B.mjs → chunk-O27L4YAA.mjs} +1 -1
  97. package/dist/{chunk-X5TXZFMN.cjs → chunk-ODBZYBAB.cjs} +1 -1
  98. package/dist/{chunk-NPPL5YDT.cjs → chunk-P64MIF5B.cjs} +154 -6
  99. package/dist/{chunk-JFHKNFEO.cjs → chunk-PQDFUSXD.cjs} +14 -14
  100. package/dist/{chunk-F6XEGFHO.mjs → chunk-PXKIEXZD.mjs} +10 -0
  101. package/dist/{chunk-S5GDHOE4.mjs → chunk-PZNL3WEG.mjs} +48 -5
  102. package/dist/{chunk-FV45CKBC.mjs → chunk-QCFBDFRS.mjs} +1 -1
  103. package/dist/{chunk-75BRBIFP.cjs → chunk-QCVE2OCI.cjs} +5 -8
  104. package/dist/{chunk-6ZCMSZ5U.mjs → chunk-QE6VAKLT.mjs} +1 -1
  105. package/dist/{chunk-75DYEVXI.cjs → chunk-QGYRXFU2.cjs} +9 -9
  106. package/dist/{chunk-CTV2TTNP.cjs → chunk-QJ3J6MZT.cjs} +16 -87
  107. package/dist/{chunk-O6XNAMBV.mjs → chunk-QLQ32WC4.mjs} +8 -3
  108. package/dist/{chunk-GIWC4CFJ.cjs → chunk-SJVKK4JE.cjs} +839 -420
  109. package/dist/{chunk-3FCFQP5V.cjs → chunk-TA5G2HWD.cjs} +21 -21
  110. package/dist/{chunk-Z5HIWVDP.cjs → chunk-TDFPACVX.cjs} +62 -73
  111. package/dist/{chunk-ND224OE2.cjs → chunk-TKSCR644.cjs} +34 -15
  112. package/dist/{chunk-2UABTL3Y.mjs → chunk-U4PTAHW3.mjs} +64 -13
  113. package/dist/{chunk-ZHVYQL3H.cjs → chunk-U74I55WB.cjs} +86 -35
  114. package/dist/chunk-UBO4SGH4.mjs +86 -0
  115. package/dist/{chunk-IQXFRNY2.cjs → chunk-UFDAAQFX.cjs} +2 -2
  116. package/dist/{chunk-NXG66MR7.cjs → chunk-UX5S4JEO.cjs} +40 -4
  117. package/dist/{chunk-5ZSWG4UX.cjs → chunk-UXFQ3UDA.cjs} +14 -1
  118. package/dist/{chunk-L4DVIHOC.mjs → chunk-VCCUOMQN.mjs} +1 -1
  119. package/dist/{chunk-4V7GIE2U.mjs → chunk-VHANUNEG.mjs} +2 -2
  120. package/dist/{chunk-FXUUWYAX.cjs → chunk-VKNHTSAP.cjs} +10 -0
  121. package/dist/{chunk-2AKFKCHA.mjs → chunk-W7LF2J2S.mjs} +1 -1
  122. package/dist/{chunk-MNUGPHLN.mjs → chunk-WNNYOOIB.mjs} +5 -3
  123. package/dist/{chunk-K6V52QMI.mjs → chunk-X242HVD5.mjs} +1 -1
  124. package/dist/{chunk-UJ2C4ICS.cjs → chunk-XJXBIP67.cjs} +4 -4
  125. package/dist/{chunk-S4K74WI4.mjs → chunk-XV5DJTBX.mjs} +539 -121
  126. package/dist/{chunk-6CNX6Q3K.cjs → chunk-XXJU7FCC.cjs} +9 -5
  127. package/dist/{chunk-DYEJQTDN.cjs → chunk-YSCV4SJF.cjs} +4 -4
  128. package/dist/{chunk-2SDO73HK.cjs → chunk-YWN746US.cjs} +64 -14
  129. package/dist/chunk-Z2HLU4IX.cjs +238 -0
  130. package/dist/{chunk-Q5JFU33Q.cjs → chunk-Z2YLTERK.cjs} +4 -4
  131. package/dist/{chunk-XLTV4VOG.cjs → chunk-ZHPHJPQP.cjs} +4 -4
  132. package/dist/{chunk-7CXKSRKL.mjs → chunk-ZKP7C2B6.mjs} +4 -4
  133. package/dist/{chunk-ATXI6LGT.mjs → chunk-ZUSJDQ2Q.mjs} +8 -4
  134. package/dist/{client-plugins-BX2ptm4H.d.mts → client-plugins-CLObcuCq.d.mts} +26 -2
  135. package/dist/{client-plugins-BmxM5KW_.d.ts → client-plugins-DZjHC4Mi.d.ts} +26 -2
  136. package/dist/client-plugins.d.mts +1 -1
  137. package/dist/client-plugins.d.ts +1 -1
  138. package/dist/client.cjs +8 -8
  139. package/dist/client.d.mts +5 -5
  140. package/dist/client.d.ts +5 -5
  141. package/dist/client.mjs +7 -7
  142. package/dist/config.d.mts +1 -1
  143. package/dist/config.d.ts +1 -1
  144. package/dist/{devtools-GGVPZHJX.cjs → devtools-HU6Y2MNV.cjs} +11 -9
  145. package/dist/{devtools-THVNPI2M.mjs → devtools-RNXCTS4R.mjs} +10 -8
  146. package/dist/docs.cjs +13 -11
  147. package/dist/docs.d.mts +5 -0
  148. package/dist/docs.d.ts +5 -0
  149. package/dist/docs.mjs +12 -10
  150. package/dist/environment/vite.cjs +2 -2
  151. package/dist/environment/vite.mjs +1 -1
  152. package/dist/headers.cjs +4 -4
  153. package/dist/headers.mjs +3 -3
  154. package/dist/i18n/client.cjs +14 -13
  155. package/dist/i18n/client.mjs +5 -4
  156. package/dist/i18n/index.cjs +3 -2
  157. package/dist/i18n/index.mjs +2 -1
  158. package/dist/i18n/server.cjs +6 -5
  159. package/dist/i18n/server.mjs +5 -4
  160. package/dist/image/server.cjs +2 -2
  161. package/dist/image/server.mjs +1 -1
  162. package/dist/image/sharp.cjs +9 -9
  163. package/dist/image/sharp.mjs +1 -1
  164. package/dist/index.cjs +67 -55
  165. package/dist/index.d.mts +14 -14
  166. package/dist/index.d.ts +14 -14
  167. package/dist/index.mjs +70 -58
  168. package/dist/integrations.cjs +6 -3
  169. package/dist/integrations.d.mts +1 -1
  170. package/dist/integrations.d.ts +1 -1
  171. package/dist/integrations.mjs +7 -4
  172. package/dist/internal/app-markdown-runtime.cjs +7 -5
  173. package/dist/internal/app-markdown-runtime.d.mts +14 -3
  174. package/dist/internal/app-markdown-runtime.d.ts +14 -3
  175. package/dist/internal/app-markdown-runtime.mjs +6 -4
  176. package/dist/internal/build-runtime.cjs +38 -35
  177. package/dist/internal/build-runtime.d.mts +3 -3
  178. package/dist/internal/build-runtime.d.ts +3 -3
  179. package/dist/internal/build-runtime.mjs +37 -34
  180. package/dist/internal/cli-runtime.cjs +20 -17
  181. package/dist/internal/cli-runtime.mjs +19 -16
  182. package/dist/internal/client-error-overlay.cjs +4 -4
  183. package/dist/internal/client-error-overlay.mjs +1 -1
  184. package/dist/internal/client-runtime.cjs +4 -2
  185. package/dist/internal/client-runtime.d.mts +9 -1
  186. package/dist/internal/client-runtime.d.ts +9 -1
  187. package/dist/internal/client-runtime.mjs +3 -1
  188. package/dist/internal/compression-runtime.d.mts +1 -1
  189. package/dist/internal/compression-runtime.d.ts +1 -1
  190. package/dist/internal/config-runtime.cjs +11 -9
  191. package/dist/internal/config-runtime.d.mts +2 -2
  192. package/dist/internal/config-runtime.d.ts +2 -2
  193. package/dist/internal/config-runtime.mjs +10 -8
  194. package/dist/internal/infra-analytics-runtime.cjs +4 -4
  195. package/dist/internal/infra-analytics-runtime.mjs +2 -2
  196. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  197. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  198. package/dist/internal/production-runtime.cjs +20 -14
  199. package/dist/internal/production-runtime.d.mts +115 -8
  200. package/dist/internal/production-runtime.d.ts +115 -8
  201. package/dist/internal/production-runtime.mjs +19 -13
  202. package/dist/internal/request-cookies.cjs +4 -2
  203. package/dist/internal/request-cookies.d.mts +9 -1
  204. package/dist/internal/request-cookies.d.ts +9 -1
  205. package/dist/internal/request-cookies.mjs +3 -1
  206. package/dist/markdown.cjs +4 -4
  207. package/dist/markdown.d.mts +1 -1
  208. package/dist/markdown.d.ts +1 -1
  209. package/dist/markdown.mjs +3 -3
  210. package/dist/{metadata-DsEaK7mQ.d.mts → metadata-2HSU2i_w.d.mts} +1 -1
  211. package/dist/{metadata-fwZ3gfG6.d.ts → metadata-Cjs8JMRM.d.ts} +1 -1
  212. package/dist/middleware.cjs +18 -8
  213. package/dist/middleware.d.mts +24 -5
  214. package/dist/middleware.d.ts +24 -5
  215. package/dist/middleware.mjs +18 -8
  216. package/dist/navigation.cjs +6 -6
  217. package/dist/navigation.d.mts +4 -4
  218. package/dist/navigation.d.ts +4 -4
  219. package/dist/navigation.mjs +5 -5
  220. package/dist/{nitro-NAKCRVHX.mjs → nitro-4XGPNIK4.mjs} +3 -3
  221. package/dist/{nitro-VYDZGYFY.cjs → nitro-HSAQFXSS.cjs} +4 -4
  222. package/dist/plugin.cjs +33 -30
  223. package/dist/plugin.d.mts +1 -1
  224. package/dist/plugin.d.ts +1 -1
  225. package/dist/plugin.mjs +32 -29
  226. package/dist/{production-runtime-DNkpFnmg.d.ts → production-runtime-BU5ETAK9.d.ts} +8 -1
  227. package/dist/{production-runtime-Baqgwtvc.d.mts → production-runtime-CysZl3EV.d.mts} +8 -1
  228. package/dist/query/client.cjs +7 -7
  229. package/dist/query/client.mjs +3 -3
  230. package/dist/{render-plan-DhwQnmmX.d.mts → render-plan-CKr4ltOd.d.mts} +1 -1
  231. package/dist/{render-plan-rkIK9wd9.d.ts → render-plan-D72O1qm4.d.ts} +1 -1
  232. package/dist/renderer-client.cjs +39 -19
  233. package/dist/renderer-client.d.mts +3 -3
  234. package/dist/renderer-client.d.ts +3 -3
  235. package/dist/renderer-client.mjs +28 -8
  236. package/dist/{request-CFy1BltJ.d.mts → request-Be83WafN.d.mts} +7 -2
  237. package/dist/{request-BcY4RYPC.d.ts → request-DbyOYI2j.d.ts} +7 -2
  238. package/dist/request.cjs +2 -2
  239. package/dist/request.d.mts +2 -2
  240. package/dist/request.d.ts +2 -2
  241. package/dist/request.mjs +1 -1
  242. package/dist/{route-rendering-BkS0TBlB.d.mts → route-rendering-BG56SzvJ.d.mts} +1 -1
  243. package/dist/{route-rendering-D4XpMjam.d.ts → route-rendering-CtVMpV-k.d.ts} +1 -1
  244. package/dist/{router-C4zPlC3V.d.mts → router-ALUvm8gC.d.mts} +1 -1
  245. package/dist/{router-Cq7BcZxg.d.ts → router-D94-SDlW.d.ts} +1 -1
  246. package/dist/routes.cjs +3 -3
  247. package/dist/routes.d.mts +1 -1
  248. package/dist/routes.d.ts +1 -1
  249. package/dist/routes.mjs +2 -2
  250. package/dist/server-fn.cjs +3 -3
  251. package/dist/server-fn.mjs +2 -2
  252. package/dist/server-plugins.cjs +4 -4
  253. package/dist/server-plugins.d.mts +2 -2
  254. package/dist/server-plugins.d.ts +2 -2
  255. package/dist/server-plugins.mjs +3 -3
  256. package/dist/server-query-client.cjs +3 -3
  257. package/dist/server-query-client.mjs +2 -2
  258. package/dist/server-query.cjs +4 -4
  259. package/dist/server-query.mjs +3 -3
  260. package/dist/server.cjs +60 -57
  261. package/dist/server.d.mts +7 -7
  262. package/dist/server.d.ts +7 -7
  263. package/dist/server.mjs +37 -34
  264. package/dist/{spa-router-B1HI3X9k.d.ts → spa-router-CxK3USIz.d.ts} +2 -2
  265. package/dist/{spa-router-DzPZH-AO.d.mts → spa-router-DbxNRKOB.d.mts} +2 -2
  266. package/dist/testing.cjs +19 -17
  267. package/dist/testing.d.mts +1 -1
  268. package/dist/testing.d.ts +1 -1
  269. package/dist/testing.mjs +16 -14
  270. package/dist/theme/server.cjs +4 -3
  271. package/dist/theme/server.mjs +3 -2
  272. package/dist/{utils-DMD1Hzta.d.ts → utils-311Y8eoK.d.ts} +1 -1
  273. package/dist/{utils-CEBktlBG.d.mts → utils-4wVRcpOw.d.mts} +1 -1
  274. package/dist/version.cjs +2 -2
  275. package/dist/version.mjs +1 -1
  276. package/dist/vite.cjs +33 -30
  277. package/dist/vite.d.mts +1 -1
  278. package/dist/vite.d.ts +1 -1
  279. package/dist/vite.mjs +32 -29
  280. package/package.json +2 -2
  281. package/dist/chunk-22GUSVNJ.cjs +0 -351
  282. package/dist/chunk-SWN467MP.cjs +0 -18
  283. package/dist/chunk-XGC343EY.cjs +0 -443
  284. package/dist/chunk-ZSH2Y4LN.mjs +0 -351
  285. /package/dist/{chunk-SUIBNSNO.cjs → chunk-SJNMVDDF.cjs} +0 -0
  286. /package/dist/{chunk-LNZ7JZUS.mjs → chunk-UDNPLXW7.mjs} +0 -0
@@ -10,7 +10,7 @@ var _chunkXD32KALFcjs = require('./chunk-XD32KALF.cjs');
10
10
 
11
11
 
12
12
 
13
- var _chunkZDILFMWNcjs = require('./chunk-ZDILFMWN.cjs');
13
+ var _chunkA5FGU2WUcjs = require('./chunk-A5FGU2WU.cjs');
14
14
 
15
15
 
16
16
 
@@ -20,7 +20,7 @@ var _chunkZDILFMWNcjs = require('./chunk-ZDILFMWN.cjs');
20
20
 
21
21
 
22
22
 
23
- var _chunkQ5JFU33Qcjs = require('./chunk-Q5JFU33Q.cjs');
23
+ var _chunkZ2YLTERKcjs = require('./chunk-Z2YLTERK.cjs');
24
24
 
25
25
 
26
26
 
@@ -28,7 +28,7 @@ var _chunkQ5JFU33Qcjs = require('./chunk-Q5JFU33Q.cjs');
28
28
  var _chunkMWWVKDW3cjs = require('./chunk-MWWVKDW3.cjs');
29
29
 
30
30
 
31
- var _chunkND224OE2cjs = require('./chunk-ND224OE2.cjs');
31
+ var _chunkTKSCR644cjs = require('./chunk-TKSCR644.cjs');
32
32
 
33
33
 
34
34
  var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
@@ -37,7 +37,7 @@ var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
37
37
 
38
38
 
39
39
 
40
- var _chunkJFHKNFEOcjs = require('./chunk-JFHKNFEO.cjs');
40
+ var _chunkPQDFUSXDcjs = require('./chunk-PQDFUSXD.cjs');
41
41
 
42
42
 
43
43
  var _chunkKCMTCM6Icjs = require('./chunk-KCMTCM6I.cjs');
@@ -73,23 +73,27 @@ var _chunk2SJ4RQ6Pcjs = require('./chunk-2SJ4RQ6P.cjs');
73
73
 
74
74
 
75
75
 
76
- var _chunkGIWC4CFJcjs = require('./chunk-GIWC4CFJ.cjs');
77
76
 
78
77
 
78
+ var _chunkSJVKK4JEcjs = require('./chunk-SJVKK4JE.cjs');
79
79
 
80
80
 
81
81
 
82
- var _chunkCTV2TTNPcjs = require('./chunk-CTV2TTNP.cjs');
83
82
 
84
83
 
84
+ var _chunkQJ3J6MZTcjs = require('./chunk-QJ3J6MZT.cjs');
85
85
 
86
- var _chunkNPPL5YDTcjs = require('./chunk-NPPL5YDT.cjs');
86
+
87
+
88
+
89
+
90
+ var _chunkP64MIF5Bcjs = require('./chunk-P64MIF5B.cjs');
87
91
 
88
92
 
89
93
  var _chunkCXP5U3RWcjs = require('./chunk-CXP5U3RW.cjs');
90
94
 
91
95
 
92
- var _chunk22GUSVNJcjs = require('./chunk-22GUSVNJ.cjs');
96
+ var _chunk3SDFA7UFcjs = require('./chunk-3SDFA7UF.cjs');
93
97
 
94
98
 
95
99
 
@@ -115,7 +119,7 @@ var _chunkVPTDD5XFcjs = require('./chunk-VPTDD5XF.cjs');
115
119
  var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
116
120
 
117
121
 
118
- var _chunkXLTV4VOGcjs = require('./chunk-XLTV4VOG.cjs');
122
+ var _chunkZHPHJPQPcjs = require('./chunk-ZHPHJPQP.cjs');
119
123
 
120
124
 
121
125
 
@@ -127,14 +131,14 @@ var _chunk6EXBPJ24cjs = require('./chunk-6EXBPJ24.cjs');
127
131
  var _chunkVEKFLAQMcjs = require('./chunk-VEKFLAQM.cjs');
128
132
 
129
133
 
130
- var _chunkNXG66MR7cjs = require('./chunk-NXG66MR7.cjs');
134
+ var _chunkUX5S4JEOcjs = require('./chunk-UX5S4JEO.cjs');
131
135
 
132
136
 
133
137
 
134
138
  var _chunkOHY2ZWUGcjs = require('./chunk-OHY2ZWUG.cjs');
135
139
 
136
140
 
137
- var _chunk6CNX6Q3Kcjs = require('./chunk-6CNX6Q3K.cjs');
141
+ var _chunkXXJU7FCCcjs = require('./chunk-XXJU7FCC.cjs');
138
142
 
139
143
 
140
144
 
@@ -142,23 +146,26 @@ var _chunkMPEYMSCFcjs = require('./chunk-MPEYMSCF.cjs');
142
146
 
143
147
 
144
148
 
145
- var _chunkZ5HIWVDPcjs = require('./chunk-Z5HIWVDP.cjs');
149
+ var _chunkTDFPACVXcjs = require('./chunk-TDFPACVX.cjs');
146
150
 
147
151
 
148
- var _chunkZHVYQL3Hcjs = require('./chunk-ZHVYQL3H.cjs');
149
152
 
150
153
 
151
- var _chunkEXLKRR4Ucjs = require('./chunk-EXLKRR4U.cjs');
154
+ var _chunkU74I55WBcjs = require('./chunk-U74I55WB.cjs');
152
155
 
153
156
 
154
- var _chunkIQXFRNY2cjs = require('./chunk-IQXFRNY2.cjs');
155
157
 
156
158
 
157
- var _chunkLYLEZIG3cjs = require('./chunk-LYLEZIG3.cjs');
159
+ var _chunkZ2HLU4IXcjs = require('./chunk-Z2HLU4IX.cjs');
158
160
 
159
161
 
162
+ var _chunkMIDIZJZCcjs = require('./chunk-MIDIZJZC.cjs');
160
163
 
161
- var _chunkWPYFSQKKcjs = require('./chunk-WPYFSQKK.cjs');
164
+
165
+ var _chunkUFDAAQFXcjs = require('./chunk-UFDAAQFX.cjs');
166
+
167
+
168
+ var _chunkLYLEZIG3cjs = require('./chunk-LYLEZIG3.cjs');
162
169
 
163
170
 
164
171
 
@@ -175,6 +182,10 @@ var _chunkSOR334EBcjs = require('./chunk-SOR334EB.cjs');
175
182
  var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
176
183
 
177
184
 
185
+
186
+ var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
187
+
188
+
178
189
  var _chunkC5GUTBZKcjs = require('./chunk-C5GUTBZK.cjs');
179
190
 
180
191
 
@@ -282,7 +293,7 @@ function getDocsTitle(docs) {
282
293
  }
283
294
  _chunkS3JO3N4Hcjs.__name.call(void 0, getDocsTitle, "getDocsTitle");
284
295
  function loadPages(contentDir, docs) {
285
- return _chunkQ5JFU33Qcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunkQ5JFU33Qcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
296
+ return _chunkZ2YLTERKcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunkZ2YLTERKcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
286
297
  }
287
298
  _chunkS3JO3N4Hcjs.__name.call(void 0, loadPages, "loadPages");
288
299
  function findSocialImagePath(html) {
@@ -303,14 +314,14 @@ async function addHandlerRoute(routes, pathname, handler, absolutePaths) {
303
314
  }
304
315
  _chunkS3JO3N4Hcjs.__name.call(void 0, addHandlerRoute, "addHandlerRoute");
305
316
  async function compileFarmDocsManifest(docs, options) {
306
- const contentDir = _chunkQ5JFU33Qcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
317
+ const contentDir = _chunkZ2YLTERKcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
307
318
  const pages = loadPages(contentDir, docs);
308
319
  const absolutePaths = [
309
320
  _path2.default.resolve(options.root),
310
321
  _path2.default.resolve(contentDir),
311
322
  docs.configPath || ""
312
323
  ];
313
- const handler = _chunkQ5JFU33Qcjs.createFarmDocsHandler.call(void 0, docs, {
324
+ const handler = _chunkZ2YLTERKcjs.createFarmDocsHandler.call(void 0, docs, {
314
325
  root: options.root,
315
326
  srcDir: options.srcDir,
316
327
  clientEntry: options.clientEntry,
@@ -318,7 +329,7 @@ async function compileFarmDocsManifest(docs, options) {
318
329
  fontStylesheetHref: options.fontStylesheetHref,
319
330
  globalStylesheetHref: options.globalStylesheetHref
320
331
  });
321
- const apiHandler = _chunkZDILFMWNcjs.createFarmDocsAPIHandler.call(void 0, {
332
+ const apiHandler = _chunkA5FGU2WUcjs.createFarmDocsAPIHandler.call(void 0, {
322
333
  rootDir: options.root,
323
334
  srcDir: options.srcDir,
324
335
  docs
@@ -410,7 +421,7 @@ async function compileFarmDocsManifest(docs, options) {
410
421
  post: await compileResponse(postResponse, absolutePaths),
411
422
  search: {
412
423
  pages: pages.map((page) => ({
413
- ..._chunkQ5JFU33Qcjs.toFarmDocsMarkdownPage.call(void 0, page),
424
+ ..._chunkZ2YLTERKcjs.toFarmDocsMarkdownPage.call(void 0, page),
414
425
  sourcePath: `farm-docs:${page.slug || "index"}`
415
426
  })),
416
427
  search: _nullishCoalesce(searchConfig, () => ( true)),
@@ -430,7 +441,7 @@ async function createFarmRouteRuntimeManifest(options) {
430
441
  const routes = [];
431
442
  for (const [pattern, entry] of options.routeManager.getRoutes()) {
432
443
  const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
433
- const rendering = await _chunkCTV2TTNPcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
444
+ const rendering = await _chunkQJ3J6MZTcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
434
445
  const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
435
446
  routes.push({
436
447
  kind: "page",
@@ -441,9 +452,9 @@ async function createFarmRouteRuntimeManifest(options) {
441
452
  });
442
453
  }
443
454
  for (const [pattern, route] of options.apiRouteManager.getRoutes()) {
444
- const publicPattern = _chunkWPYFSQKKcjs.resolveFarmAPIServerRoutePath.call(void 0,
455
+ const publicPattern = _chunkKNBBQHO2cjs.resolveFarmAPIServerRoutePath.call(void 0,
445
456
  pattern,
446
- _chunkWPYFSQKKcjs.resolveFarmAPIServerBasePath.call(void 0, options.config.api)
457
+ _chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, options.config.api)
447
458
  );
448
459
  const inherited = _chunkSOR334EBcjs.resolveFarmRouteRuleRuntimeConfig.call(void 0, publicPattern, options.config.routeRules);
449
460
  const own = _chunkSOR334EBcjs.normalizeFarmRouteRuntimeConfig.call(void 0,
@@ -708,6 +719,47 @@ function buildFarmVercelRoutes(options) {
708
719
  }
709
720
  _chunkS3JO3N4Hcjs.__name.call(void 0, buildFarmVercelRoutes, "buildFarmVercelRoutes");
710
721
 
722
+ // src/nitro/netlify-entry.ts
723
+
724
+
725
+ function resolveNitroNetlifyEntry(nitroRuntimeEntry) {
726
+ const entry = _path2.default.join(
727
+ _path2.default.dirname(nitroRuntimeEntry),
728
+ "..",
729
+ "presets",
730
+ "netlify",
731
+ "runtime",
732
+ "netlify.mjs"
733
+ );
734
+ if (!_fs.existsSync.call(void 0, entry)) {
735
+ throw new Error(
736
+ `[Farm.js] Could not find Nitro's Netlify function entry at ${entry}. Farm wraps it so private responses are never cached by Netlify's CDN; reinstall dependencies or report the installed Nitro version.`
737
+ );
738
+ }
739
+ return entry.split(_path2.default.sep).join("/");
740
+ }
741
+ _chunkS3JO3N4Hcjs.__name.call(void 0, resolveNitroNetlifyEntry, "resolveNitroNetlifyEntry");
742
+ function createFarmNetlifyEntry(options) {
743
+ return `
744
+ import nitroNetlifyHandler from ${JSON.stringify(options.nitroNetlifyEntry)};
745
+
746
+ const PRIVATE_CACHE_DIRECTIVE = /(?:^|,)\\s*(?:private|no-store)\\s*(?:[,=]|$)/i;
747
+
748
+ export default async function farmNetlifyHandler(request, context) {
749
+ const response = await nitroNetlifyHandler(request, context);
750
+ if (
751
+ response &&
752
+ response.headers.has("netlify-cdn-cache-control") &&
753
+ PRIVATE_CACHE_DIRECTIVE.test(response.headers.get("cache-control") || "")
754
+ ) {
755
+ response.headers.delete("netlify-cdn-cache-control");
756
+ }
757
+ return response;
758
+ }
759
+ `.trim();
760
+ }
761
+ _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmNetlifyEntry, "createFarmNetlifyEntry");
762
+
711
763
  // src/nitro/node-server-entry.ts
712
764
  function createFarmNodeServerEntry(options) {
713
765
  const serverConfig = JSON.stringify(options.server);
@@ -1345,6 +1397,11 @@ function hasRollupPlugins(plugins) {
1345
1397
  return Boolean(plugins);
1346
1398
  }
1347
1399
  _chunkS3JO3N4Hcjs.__name.call(void 0, hasRollupPlugins, "hasRollupPlugins");
1400
+ function hasFarmServerCacheConfig(cache) {
1401
+ if (!cache || typeof cache !== "object") return false;
1402
+ return cache.adapter !== void 0 || cache.namespace !== void 0 || cache.maxEntries !== void 0 || cache.lease !== void 0;
1403
+ }
1404
+ _chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmServerCacheConfig, "hasFarmServerCacheConfig");
1348
1405
  function hasFarmRuntimeConfigModule(config, configModulePath) {
1349
1406
  return Boolean(configModulePath || (config.layers || []).some((layer) => layer.configFile));
1350
1407
  }
@@ -1523,7 +1580,7 @@ function hasFarmMiddlewareConfig(config) {
1523
1580
  _chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmMiddlewareConfig, "hasFarmMiddlewareConfig");
1524
1581
  function hasFarmServerRuntimePlugins(config) {
1525
1582
  return (config.plugins || []).some((plugin) => {
1526
- if (_chunkZ5HIWVDPcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) === false) return false;
1583
+ if (_chunkTDFPACVXcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) === false) return false;
1527
1584
  return Boolean(
1528
1585
  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
1529
1586
  );
@@ -1536,7 +1593,7 @@ function hasFarmPluginRoutes(config) {
1536
1593
  _chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmPluginRoutes, "hasFarmPluginRoutes");
1537
1594
  function farmServerRuntimePluginsMayHandlePath(config, pathname) {
1538
1595
  return (config.plugins || []).some(
1539
- (plugin) => _chunkZ5HIWVDPcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && _chunkGIWC4CFJcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
1596
+ (plugin) => _chunkTDFPACVXcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && _chunkSJVKK4JEcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
1540
1597
  );
1541
1598
  }
1542
1599
  _chunkS3JO3N4Hcjs.__name.call(void 0, farmServerRuntimePluginsMayHandlePath, "farmServerRuntimePluginsMayHandlePath");
@@ -1544,7 +1601,7 @@ async function discoverMiddlewareRoutes(appDir) {
1544
1601
  const fs = await import("fs/promises");
1545
1602
  const appDirs = Array.isArray(appDir) ? [...appDir] : [appDir];
1546
1603
  const routes = /* @__PURE__ */ new Map();
1547
- async function walk(dir, routePath, discovered) {
1604
+ async function walk(dir, routePath, directory, discovered) {
1548
1605
  let entries;
1549
1606
  try {
1550
1607
  entries = await fs.readdir(dir, { withFileTypes: true });
@@ -1557,6 +1614,7 @@ async function discoverMiddlewareRoutes(appDir) {
1557
1614
  if (middlewareFile) {
1558
1615
  discovered.push({
1559
1616
  path: routePath,
1617
+ directory,
1560
1618
  filePath: _path2.default.join(dir, middlewareFile.name)
1561
1619
  });
1562
1620
  }
@@ -1564,23 +1622,23 @@ async function discoverMiddlewareRoutes(appDir) {
1564
1622
  if (!entry.isDirectory() || entry.name.startsWith(".") || entry.name.startsWith("_")) {
1565
1623
  continue;
1566
1624
  }
1567
- const childRoutePath = _chunkZHVYQL3Hcjs.appendMiddlewareRoutePath.call(void 0, routePath, entry.name);
1568
- await walk(_path2.default.join(dir, entry.name), childRoutePath, discovered);
1625
+ await walk(
1626
+ _path2.default.join(dir, entry.name),
1627
+ _chunkU74I55WBcjs.appendMiddlewareRoutePath.call(void 0, routePath, entry.name),
1628
+ _chunkU74I55WBcjs.appendMiddlewareDirectory.call(void 0, directory, entry.name),
1629
+ discovered
1630
+ );
1569
1631
  }
1570
1632
  }
1571
1633
  _chunkS3JO3N4Hcjs.__name.call(void 0, walk, "walk");
1572
1634
  for (const sourceAppDir of appDirs) {
1573
1635
  const discovered = [];
1574
- await walk(sourceAppDir, "/", discovered);
1636
+ await walk(sourceAppDir, "/", "", discovered);
1575
1637
  for (const route of discovered) {
1576
- routes.set(route.path, route);
1638
+ routes.set(route.directory, route);
1577
1639
  }
1578
1640
  }
1579
- return Array.from(routes.values()).sort((a, b) => {
1580
- const depthA = a.path.split("/").filter(Boolean).length;
1581
- const depthB = b.path.split("/").filter(Boolean).length;
1582
- return depthA - depthB || a.path.localeCompare(b.path);
1583
- });
1641
+ return Array.from(routes.values()).sort(_chunkU74I55WBcjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
1584
1642
  }
1585
1643
  _chunkS3JO3N4Hcjs.__name.call(void 0, discoverMiddlewareRoutes, "discoverMiddlewareRoutes");
1586
1644
  function assertFarmDocsRuntimeSupported(config, preset) {
@@ -1598,7 +1656,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
1598
1656
  assertFarmDocsRuntimeSupported(config, preset);
1599
1657
  const srcDir = config.srcDir || "src";
1600
1658
  const distDir = config.distDir || ".farm";
1601
- const deployOutputDir = _chunkJFHKNFEOcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
1659
+ const deployOutputDir = _chunkPQDFUSXDcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
1602
1660
  const lifecyclePluginManager = options.pluginManager;
1603
1661
  const productionViteResultPromise = Promise.allSettled([
1604
1662
  Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))
@@ -1617,7 +1675,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
1617
1675
  const routeRuntimeManifestResultPromise = Promise.allSettled([routeRuntimeManifestPromise]);
1618
1676
  const pageRoutes = [];
1619
1677
  for (const [pattern, entry] of routeManager.getRoutes()) {
1620
- const markdownSourcePath = entry.markdownSourcePath || (_chunkNXG66MR7cjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
1678
+ const markdownSourcePath = entry.markdownSourcePath || (_chunkUX5S4JEOcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
1621
1679
  pageRoutes.push({
1622
1680
  pattern,
1623
1681
  modulePath: entry.modulePath,
@@ -1846,7 +1904,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
1846
1904
  }
1847
1905
  const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
1848
1906
  await fs.writeFile(fontCssPath, normalizedFontCss);
1849
- await fs.writeFile(clientCssPath, _chunkGIWC4CFJcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
1907
+ await fs.writeFile(clientCssPath, _chunkSJVKK4JEcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
1850
1908
  }
1851
1909
  _chunkS3JO3N4Hcjs.__name.call(void 0, mergeBuiltFontCss, "mergeBuiltFontCss");
1852
1910
  var _IncompleteClientBuildOutputError = class _IncompleteClientBuildOutputError extends Error {
@@ -1896,7 +1954,7 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
1896
1954
  const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${_path2.default.resolve(modulePath)}`;
1897
1955
  let plan = cache.get(key);
1898
1956
  if (!plan) {
1899
- plan = _chunkGIWC4CFJcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
1957
+ plan = _chunkSJVKK4JEcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
1900
1958
  cache.set(key, plan);
1901
1959
  }
1902
1960
  return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
@@ -1914,7 +1972,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
1914
1972
  });
1915
1973
  pluginManager.addPlugins(config.plugins || []);
1916
1974
  const clientPages = [];
1917
- const integrationProviders = _chunkZ5HIWVDPcjs.getIntegrationProviders.call(void 0, config.integrations).filter(
1975
+ const integrationProviders = _chunkTDFPACVXcjs.getIntegrationProviders.call(void 0, config.integrations).filter(
1918
1976
  (provider) => provider.component || provider.type === "clerk"
1919
1977
  );
1920
1978
  const unsupportedIntegrationProvider = integrationProviders.find(
@@ -1925,14 +1983,14 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
1925
1983
  `[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
1926
1984
  );
1927
1985
  }
1928
- const isolatedMode = _chunkGIWC4CFJcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
1986
+ const isolatedMode = _chunkSJVKK4JEcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
1929
1987
  _optionalChain([config, 'access', _35 => _35.experimental, 'optionalAccess', _36 => _36.isolatedClientHydration]),
1930
1988
  {
1931
1989
  serverComponents: _optionalChain([config, 'access', _37 => _37.experimental, 'optionalAccess', _38 => _38.serverComponents]) === true,
1932
1990
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
1933
1991
  }
1934
1992
  );
1935
- const planOptions = _chunkGIWC4CFJcjs.getFarmClientHydrationPlanOptions.call(void 0,
1993
+ const planOptions = _chunkSJVKK4JEcjs.getFarmClientHydrationPlanOptions.call(void 0,
1936
1994
  config.renderer,
1937
1995
  Boolean(unsupportedIntegrationProvider)
1938
1996
  );
@@ -1989,7 +2047,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
1989
2047
  ), "isAdapterDocsRoute");
1990
2048
  const syntheticDocsEntry = _optionalChain([config, 'access', _46 => _46.docs, 'optionalAccess', _47 => _47.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
1991
2049
  const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
1992
- const markdownPagePlan = _chunkGIWC4CFJcjs.createMarkdownPageHydrationPlanner.call(void 0,
2050
+ const markdownPagePlan = _chunkSJVKK4JEcjs.createMarkdownPageHydrationPlanner.call(void 0,
1993
2051
  _chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), root),
1994
2052
  root,
1995
2053
  isolatedMode,
@@ -1997,7 +2055,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
1997
2055
  );
1998
2056
  const routePlans = pageRoutes.map((route) => ({
1999
2057
  route,
2000
- metadata: _chunkNXG66MR7cjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
2058
+ metadata: _chunkUX5S4JEOcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
2001
2059
  route.modulePath,
2002
2060
  root,
2003
2061
  isolatedMode,
@@ -2005,7 +2063,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2005
2063
  planOptions
2006
2064
  )
2007
2065
  }));
2008
- _chunkGIWC4CFJcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
2066
+ _chunkSJVKK4JEcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
2009
2067
  clientLayouts.map((layout) => ({
2010
2068
  pattern: layout.pattern,
2011
2069
  depth: layout.pattern.split("/").filter(Boolean).length,
@@ -2037,7 +2095,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2037
2095
  for (const layout of clientLayouts) {
2038
2096
  const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, route.pattern)) || Boolean(adapterDocsEntry && layoutAppliesToRoute(layout.pattern, adapterDocsEntry));
2039
2097
  if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
2040
- _chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${_chunkGIWC4CFJcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
2098
+ _chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${_chunkSJVKK4JEcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
2041
2099
  }
2042
2100
  }
2043
2101
  if (isolatedMode === "analyze") {
@@ -2061,7 +2119,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2061
2119
  );
2062
2120
  if (metadata.suppressedAsyncHydration) {
2063
2121
  _chunk5QIKR7RRcjs.logger.warn(
2064
- `\u26A0\uFE0F ${_chunkGIWC4CFJcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
2122
+ `\u26A0\uFE0F ${_chunkSJVKK4JEcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
2065
2123
  );
2066
2124
  }
2067
2125
  if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0) {
@@ -2120,7 +2178,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2120
2178
  }
2121
2179
  const clientRouteSlots = routeSlots.filter((slot) => {
2122
2180
  try {
2123
- return _chunkGIWC4CFJcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
2181
+ return _chunkSJVKK4JEcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
2124
2182
  } catch (error) {
2125
2183
  _chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
2126
2184
  return false;
@@ -2148,9 +2206,9 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2148
2206
  config.renderer,
2149
2207
  config.publicRuntimeConfig,
2150
2208
  config.trailingSlash,
2151
- _chunkZ5HIWVDPcjs.getIntegrationProviders.call(void 0, config.integrations),
2209
+ _chunkTDFPACVXcjs.getIntegrationProviders.call(void 0, config.integrations),
2152
2210
  config.basePath,
2153
- _chunkGIWC4CFJcjs.generateClientCachePersistenceCode.call(void 0, _chunkGIWC4CFJcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
2211
+ _chunkSJVKK4JEcjs.generateClientCachePersistenceCode.call(void 0, _chunkSJVKK4JEcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
2154
2212
  adapterOwnsDocsRuntime ? _chunk75WGQVQAcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
2155
2213
  );
2156
2214
  await fs.writeFile(clientEntryPath, clientHydrationCode);
@@ -2167,7 +2225,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2167
2225
  const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
2168
2226
  await fs.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
2169
2227
  postcssSearchPath = clientEntryDir;
2170
- tailwindVitePlugin = await _chunkGIWC4CFJcjs.loadTailwindVitePlugin.call(void 0, {
2228
+ tailwindVitePlugin = await _chunkSJVKK4JEcjs.loadTailwindVitePlugin.call(void 0, {
2171
2229
  builder: productionVite.builder,
2172
2230
  announce: true
2173
2231
  });
@@ -2236,7 +2294,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2236
2294
  }
2237
2295
  },
2238
2296
  plugins: [
2239
- _chunkGIWC4CFJcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
2297
+ _chunkSJVKK4JEcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
2240
2298
  ...tailwindVitePlugin ? [tailwindVitePlugin] : [],
2241
2299
  ...rendererVitePlugins,
2242
2300
  ...config.vite.plugins || [],
@@ -2289,7 +2347,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2289
2347
  }
2290
2348
  },
2291
2349
  farmPlugin({ ...config, isolatedClientBoundaryModules }, pluginManager),
2292
- _chunk22GUSVNJcjs.farmEnvironmentFunctionsPlugin.call(void 0, )
2350
+ _chunk3SDFA7UFcjs.farmEnvironmentFunctionsPlugin.call(void 0, )
2293
2351
  ],
2294
2352
  mode: "production",
2295
2353
  css: postcssSearchPath ? {
@@ -2297,7 +2355,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2297
2355
  } : void 0,
2298
2356
  // Ensure React is bundled for client
2299
2357
  resolve: {
2300
- alias: _chunkGIWC4CFJcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
2358
+ alias: _chunkSJVKK4JEcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
2301
2359
  dedupe: [...config.renderer.dedupe || []]
2302
2360
  },
2303
2361
  // Optimize dependencies - exclude server-side code from client bundle
@@ -2310,7 +2368,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2310
2368
  ]
2311
2369
  }
2312
2370
  };
2313
- await viteBuild(_chunkGIWC4CFJcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
2371
+ await viteBuild(_chunkSJVKK4JEcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
2314
2372
  await mergeBuiltFontCss(outputDir);
2315
2373
  await validateClientBuildOutput(root, srcDir, outputDir);
2316
2374
  } finally {
@@ -3069,7 +3127,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
3069
3127
  direction: {}
3070
3128
  }, plugins = [], renderer = _chunkPSV6XKPOcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule) {
3071
3129
  const toImportPath = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (targetPath) => targetPath.replace(/\\/g, "/"), "toImportPath");
3072
- const clientPluginEntry = _chunkGIWC4CFJcjs.generateFarmClientPluginEntryCode.call(void 0,
3130
+ const clientPluginEntry = _chunkSJVKK4JEcjs.generateFarmClientPluginEntryCode.call(void 0,
3073
3131
  plugins,
3074
3132
  root,
3075
3133
  srcDir,
@@ -3080,7 +3138,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
3080
3138
  import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
3081
3139
  import __farmAppSetup from ${JSON.stringify(_chunk5QIKR7RRcjs.toPosixPath.call(void 0, appSetupPath))};
3082
3140
  __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
3083
- const providerClientCode = _chunkGIWC4CFJcjs.generateFarmIntegrationProviderClientCode.call(void 0,
3141
+ const providerClientCode = _chunkSJVKK4JEcjs.generateFarmIntegrationProviderClientCode.call(void 0,
3084
3142
  integrationProviders,
3085
3143
  root,
3086
3144
  _nullishCoalesce(renderer.componentExtensions, () => ( []))
@@ -3152,7 +3210,7 @@ function isFarmDocsPath() {
3152
3210
  // Farm.js Client Runtime (no client components)
3153
3211
  ${cssImport}
3154
3212
  ${layoutImports}
3155
- import { createClientCancellation, createClientPluginManager, getHashTargetElement, installChunkErrorRecovery, isFarmExternalNavigationURL, reconcileFarmDocumentHead, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
3213
+ import { createClientCancellation, createClientPluginManager, getHashTargetElement, installChunkErrorRecovery, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, reconcileFarmDocumentHead, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
3156
3214
  import { createFarmDeploymentMismatchError, createFarmDeploymentRequestHeaders, isFarmDeploymentMismatchResponse } from "@farm.js/core/deployment";
3157
3215
  ${clientPluginEntry.imports}
3158
3216
  ${clientCachePersistence.imports}
@@ -3176,6 +3234,7 @@ ${generateUniversalRouterStateProperties()}
3176
3234
 
3177
3235
  navigate: async function(href, options = {}) {
3178
3236
  const url = new URL(href, window.location.href);
3237
+ if (isFarmBlockedNavigationURL(url)) return;
3179
3238
  if (isFarmExternalNavigationURL(url, window.location.origin)) {
3180
3239
  this.cancelActiveNavigation();
3181
3240
  if (options.replace || options.action === "replace") window.location.replace(href);
@@ -3499,7 +3558,7 @@ ${layoutImports}
3499
3558
  ${rendererClientImports}
3500
3559
  ${isolatedHydrationImport}
3501
3560
  ${providerClientCode.imports}
3502
- import { createClientCancellation, createClientPluginManager, getHashTargetElement, installChunkErrorRecovery, isFarmExternalNavigationURL, reconcileFarmDocumentHead, scheduleFarmIslandHydration, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
3561
+ import { createClientCancellation, createClientPluginManager, getHashTargetElement, installChunkErrorRecovery, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, reconcileFarmDocumentHead, scheduleFarmIslandHydration, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
3503
3562
  import { createFarmDeploymentMismatchError, createFarmDeploymentRequestHeaders, isFarmDeploymentMismatchResponse } from "@farm.js/core/deployment";
3504
3563
  import { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";
3505
3564
  ${clientPluginEntry.imports}
@@ -3565,7 +3624,7 @@ function hasHydratableLayout(pathname) {
3565
3624
  });
3566
3625
  }
3567
3626
 
3568
- ${_chunkGIWC4CFJcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
3627
+ ${_chunkSJVKK4JEcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
3569
3628
  // Wrap a page element with applicable layouts
3570
3629
  function wrapWithLayouts(pageElement, pathname, params) {
3571
3630
  const layouts = getApplicableLayouts(pathname);
@@ -3615,7 +3674,7 @@ async function loadRouteComponent(route) {
3615
3674
  return route.Component;
3616
3675
  }
3617
3676
 
3618
- async function createMatchedHydrationRoute(matched, pathname, searchParams, serverHtml) {
3677
+ async function createMatchedHydrationRoute(matched, pathname, searchParams, serverHtml, serverProps) {
3619
3678
  const hydrateLayouts = hasHydratableLayout(pathname);
3620
3679
  const params = matched.params;
3621
3680
  let pageElement = null;
@@ -3623,15 +3682,30 @@ async function createMatchedHydrationRoute(matched, pathname, searchParams, serv
3623
3682
  if (matched.route.pageShouldHydrate) {
3624
3683
  const Component = await loadRouteComponent(matched.route);
3625
3684
  if (!Component) return null;
3626
- if (typeof Component === "function" && Component.constructor && Component.constructor.name === "AsyncFunction") {
3685
+ // A programmatic page whose guard and data run only on the server renders
3686
+ // from the props the server resolved for this document. Without them (a
3687
+ // rejected guard, deferred data) its server-rendered HTML is kept.
3688
+ if (Component.__farmServerProps === true) {
3689
+ if (!serverProps || serverProps.__farmRoutePropsResolved !== true) return null;
3690
+ const middleware = serverProps.middleware;
3691
+ const props = {
3692
+ ...serverProps,
3693
+ ...(middleware && middleware.data && !(middleware.data instanceof Map)
3694
+ ? { middleware: { ...middleware, data: new Map(Object.entries(middleware.data)) } }
3695
+ : {}),
3696
+ searchParams: Promise.resolve(serverProps.search ?? searchParams),
3697
+ };
3698
+ pageElement = React.createElement(Component, props);
3699
+ } else if (typeof Component === "function" && Component.constructor && Component.constructor.name === "AsyncFunction") {
3627
3700
  console.warn(
3628
3701
  "[Farm.js] Skipping hydration for " + pathname +
3629
3702
  ": async server components cannot run in the browser. Server-rendered HTML is preserved."
3630
3703
  );
3631
3704
  return null;
3705
+ } else {
3706
+ const props = { params: params, searchParams: Promise.resolve(searchParams) };
3707
+ pageElement = React.createElement(Component, props);
3632
3708
  }
3633
- const props = { params: params, searchParams: Promise.resolve(searchParams) };
3634
- pageElement = React.createElement(Component, props);
3635
3709
  } else if (hydrateLayouts) {
3636
3710
  const serverPage = document.getElementById("__farm_page__");
3637
3711
  pageElement = createLayoutPageBoundary(
@@ -3702,6 +3776,32 @@ function findClientRouteSlot(slot) {
3702
3776
  });
3703
3777
  }
3704
3778
 
3779
+ /**
3780
+ * The page props a fetched document embeds in its bootstrap script, which a
3781
+ * client navigation does not execute. The JSON ends at the first statement
3782
+ * boundary where it parses, so the separator inside a string cannot cut it.
3783
+ */
3784
+ function readPagePropsPayload(doc) {
3785
+ const prefix = "window.__FARM_PROPS__=";
3786
+ const separator = ";window.__FARM_INTEGRATION_API_MANIFEST__=";
3787
+ for (const script of doc.querySelectorAll("script:not([src])")) {
3788
+ const source = script.textContent || "";
3789
+ if (!source.startsWith(prefix)) continue;
3790
+ for (
3791
+ let end = source.indexOf(separator, prefix.length);
3792
+ end !== -1;
3793
+ end = source.indexOf(separator, end + 1)
3794
+ ) {
3795
+ try {
3796
+ return JSON.parse(source.slice(prefix.length, end));
3797
+ } catch {
3798
+ // The separator was inside a string value; try the next one.
3799
+ }
3800
+ }
3801
+ }
3802
+ return undefined;
3803
+ }
3804
+
3705
3805
  function readRouteSlotPayload(doc) {
3706
3806
  const script = doc.getElementById("__farm_route_slots_data__");
3707
3807
  if (!script?.textContent) return [];
@@ -3898,6 +3998,8 @@ async function hydrate() {
3898
3998
  matched,
3899
3999
  pathname,
3900
4000
  searchParams,
4001
+ undefined,
4002
+ window.__FARM_PROPS__,
3901
4003
  );
3902
4004
  if (!routeState) return;
3903
4005
  const shouldHydrate = !isHydrated && Boolean(container.innerHTML.trim());
@@ -4012,6 +4114,7 @@ ${generateUniversalRouterStateProperties()}
4012
4114
 
4013
4115
  navigate: async function(href, options = {}) {
4014
4116
  const url = new URL(href, window.location.href);
4117
+ if (isFarmBlockedNavigationURL(url)) return;
4015
4118
  if (isFarmExternalNavigationURL(url, window.location.origin)) {
4016
4119
  this.cancelActiveNavigation();
4017
4120
  if (options.replace || options.action === "replace") window.location.replace(href);
@@ -4244,6 +4347,7 @@ ${generateUniversalRouterStateProperties()}
4244
4347
  if (isFarmLocaleDocumentChange(doc)) return false;
4245
4348
  if (doc.getElementById("nd-docs-layout")) return false;
4246
4349
  const nextRouteSlots = readRouteSlotPayload(doc);
4350
+ const nextPageProps = readPagePropsPayload(doc);
4247
4351
  const isNavigationCurrent = () =>
4248
4352
  this.isCurrentNavigation(navigation, clientNavigation);
4249
4353
 
@@ -4274,6 +4378,7 @@ ${generateUniversalRouterStateProperties()}
4274
4378
  newPathname,
4275
4379
  searchParams,
4276
4380
  nextPage ? nextPage.innerHTML : "",
4381
+ nextPageProps,
4277
4382
  );
4278
4383
  if (!isNavigationCurrent()) return false;
4279
4384
  if (routeState) {
@@ -4309,6 +4414,8 @@ ${generateUniversalRouterStateProperties()}
4309
4414
  matched,
4310
4415
  newPathname,
4311
4416
  searchParams,
4417
+ undefined,
4418
+ nextPageProps,
4312
4419
  );
4313
4420
  if (!isNavigationCurrent()) return false;
4314
4421
  if (routeState) {
@@ -4480,7 +4587,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4480
4587
  _path2.default.join(postcssConfigDir, "postcss.config.cjs"),
4481
4588
  "module.exports = { plugins: [] };\n"
4482
4589
  );
4483
- tailwindVitePlugin = await _chunkGIWC4CFJcjs.loadTailwindVitePlugin.call(void 0, {
4590
+ tailwindVitePlugin = await _chunkSJVKK4JEcjs.loadTailwindVitePlugin.call(void 0, {
4484
4591
  builder: productionVite.builder,
4485
4592
  label: "for SSR"
4486
4593
  });
@@ -4554,7 +4661,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4554
4661
  modulePath: entry.modulePath
4555
4662
  })
4556
4663
  );
4557
- const i18nCatalogs = config.i18n.enabled ? (await _chunkIQXFRNY2cjs.readFarmI18nCatalogs.call(void 0, config.i18n)).catalogs : {};
4664
+ const i18nCatalogs = config.i18n.enabled ? (await _chunkUFDAAQFXcjs.readFarmI18nCatalogs.call(void 0, config.i18n)).catalogs : {};
4558
4665
  const appDirs = _chunkVPTDD5XFcjs.getFarmAppDirectories.call(void 0, config);
4559
4666
  let openAPIReference = null;
4560
4667
  if (config.openapi.enabled && config.openapi.route) {
@@ -4576,7 +4683,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4576
4683
  }
4577
4684
  const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
4578
4685
  const instrumentationPath = _chunkKCMTCM6Icjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
4579
- const notFoundPath = _chunkGIWC4CFJcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
4686
+ const notFoundPath = _chunkSJVKK4JEcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
4580
4687
  if (notFoundPath) _chunk5QIKR7RRcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
4581
4688
  layoutRoutes.sort((a, b) => {
4582
4689
  const depthA = a.pattern.split("/").filter(Boolean).length;
@@ -4593,22 +4700,23 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4593
4700
  const hasServerRuntimeIntegrations = configuredIntegrationValues.some(
4594
4701
  (integration) => typeof integration === "object" && integration !== null && (!("serverRuntime" in integration) || integration.serverRuntime !== false)
4595
4702
  );
4596
- const hasIntegrationProviders = _chunkZ5HIWVDPcjs.getIntegrationProviders.call(void 0, config.integrations).some(
4703
+ const hasIntegrationProviders = _chunkTDFPACVXcjs.getIntegrationProviders.call(void 0, config.integrations).some(
4597
4704
  (provider) => provider.component || provider.type === "clerk"
4598
4705
  );
4599
4706
  const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
4600
4707
  const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _56 => _56.mdx, 'optionalAccess', _57 => _57.components]));
4601
4708
  const hasMiddlewareConfig = hasFarmMiddlewareConfig(config.middleware);
4602
- const hasRouteContextConfig = _chunkJFHKNFEOcjs.hasCustomFarmRouteContext.call(void 0, config);
4709
+ const hasRouteContextConfig = _chunkPQDFUSXDcjs.hasCustomFarmRouteContext.call(void 0, config);
4603
4710
  const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
4604
4711
  const hasPluginRoutes = hasFarmPluginRoutes(config);
4605
- const configModulePath = hasServerRuntimeIntegrations || hasObservabilityHandler || hasMdxComponentConfig || hasMiddlewareConfig || hasRouteContextConfig || hasServerRuntimePlugins || hasPluginRoutes || hasIntegrationProviders ? await findFarmConfigPath(root) : null;
4712
+ const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
4713
+ const configModulePath = hasServerRuntimeIntegrations || hasObservabilityHandler || hasMdxComponentConfig || hasMiddlewareConfig || hasRouteContextConfig || hasServerRuntimePlugins || hasPluginRoutes || hasServerCacheConfig || hasIntegrationProviders ? await findFarmConfigPath(root) : null;
4606
4714
  const hasRuntimeConfigModule = hasFarmRuntimeConfigModule(config, configModulePath);
4607
4715
  const hasRuntimeIntegrationConfig = hasRuntimeConfigModule && hasAnyConfiguredIntegrations;
4608
4716
  const hasConfiguredRuntimePlugins = Boolean(
4609
4717
  hasRuntimeConfigModule && (config.plugins || []).length > 0
4610
4718
  );
4611
- 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 _chunkZDILFMWNcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
4719
+ 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 _chunkA5FGU2WUcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
4612
4720
  root,
4613
4721
  srcDir: config.srcDir,
4614
4722
  clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
@@ -4758,7 +4866,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4758
4866
  __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _68 => _68.env, 'optionalAccess', _69 => _69.public]) || {})
4759
4867
  },
4760
4868
  plugins: [
4761
- _chunkGIWC4CFJcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
4869
+ _chunkSJVKK4JEcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
4762
4870
  ...tailwindVitePlugin ? [tailwindVitePlugin] : [],
4763
4871
  ...rendererVitePlugins,
4764
4872
  ...config.vite.plugins || [],
@@ -4766,7 +4874,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4766
4874
  { ...createReactProductionModePlugin(), enforce: "pre" },
4767
4875
  farmServerOnlyEntriesPlugin(),
4768
4876
  farmPlugin({ ...config, isolatedClientBoundaryModules }, pluginManager),
4769
- _chunk22GUSVNJcjs.farmEnvironmentFunctionsPlugin.call(void 0, ),
4877
+ _chunk3SDFA7UFcjs.farmEnvironmentFunctionsPlugin.call(void 0, ),
4770
4878
  {
4771
4879
  name: "farm-virtual-ssr-entry",
4772
4880
  resolveId(id) {
@@ -4805,7 +4913,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4805
4913
  resolve: {
4806
4914
  alias: [
4807
4915
  ...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
4808
- ...Object.entries(_chunkGIWC4CFJcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
4916
+ ...Object.entries(_chunkSJVKK4JEcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
4809
4917
  ([find, replacement]) => ({ find, replacement })
4810
4918
  )
4811
4919
  ],
@@ -4813,7 +4921,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4813
4921
  dedupe: [...config.renderer.dedupe || []]
4814
4922
  }
4815
4923
  };
4816
- await viteBuild(_chunkGIWC4CFJcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
4924
+ await viteBuild(_chunkSJVKK4JEcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
4817
4925
  } finally {
4818
4926
  if (postcssConfigDir) {
4819
4927
  try {
@@ -4999,8 +5107,8 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, generateConfiguredResponseHeadersRuntimeSo
4999
5107
  function parseRouteRenderingDirectiveFromDisk(modulePath) {
5000
5108
  try {
5001
5109
  const source = _fs.readFileSync.call(void 0, modulePath, "utf8");
5002
- const directive = _chunkCTV2TTNPcjs.parseRouteRenderingDirective.call(void 0, source);
5003
- if (_chunkCTV2TTNPcjs.findRequestBoundSourceBlockers.call(void 0, source).length === 0) return directive;
5110
+ const directive = _chunkQJ3J6MZTcjs.parseRouteRenderingDirective.call(void 0, source);
5111
+ if (_chunkQJ3J6MZTcjs.findRequestBoundSourceBlockers.call(void 0, source).length === 0) return directive;
5004
5112
  return { ..._nullishCoalesce(directive, () => ( { ssg: false, ppr: false, directive: "" })), requestBound: true };
5005
5113
  } catch (e22) {
5006
5114
  return void 0;
@@ -5223,7 +5331,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5223
5331
  );
5224
5332
  const hasMiddlewareRuntime = middlewareRoutes.length > 0 || hasFarmMiddlewareConfig(config.middleware);
5225
5333
  const farmDocsFontAssets = _optionalChain([config, 'access', _84 => _84.docs, 'optionalAccess', _85 => _85.enabled]) ? _chunkHREOKQWTcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkHREOKQWTcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
5226
- const integrationProviders = _chunkZ5HIWVDPcjs.getIntegrationProviders.call(void 0, config.integrations);
5334
+ const integrationProviders = _chunkTDFPACVXcjs.getIntegrationProviders.call(void 0, config.integrations);
5227
5335
  const renderedIntegrationProviders = integrationProviders.filter(
5228
5336
  (provider) => provider.component || provider.type === "clerk"
5229
5337
  );
@@ -5232,7 +5340,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5232
5340
  `Integration provider components are not supported by the "${config.renderer.name}" renderer.`
5233
5341
  );
5234
5342
  }
5235
- const providerServerModules = _chunkGIWC4CFJcjs.generateFarmIntegrationProviderServerModules.call(void 0,
5343
+ const providerServerModules = _chunkSJVKK4JEcjs.generateFarmIntegrationProviderServerModules.call(void 0,
5236
5344
  renderedIntegrationProviders,
5237
5345
  config.root,
5238
5346
  _nullishCoalesce(config.renderer.componentExtensions, () => ( []))
@@ -5252,14 +5360,14 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5252
5360
  const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
5253
5361
  (provider) => provider.supportsIsolatedHydration !== true
5254
5362
  );
5255
- const isolatedHydrationMode = _chunkGIWC4CFJcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
5363
+ const isolatedHydrationMode = _chunkSJVKK4JEcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
5256
5364
  _optionalChain([config, 'access', _88 => _88.experimental, 'optionalAccess', _89 => _89.isolatedClientHydration]),
5257
5365
  {
5258
5366
  serverComponents: _optionalChain([config, 'access', _90 => _90.experimental, 'optionalAccess', _91 => _91.serverComponents]) === true,
5259
5367
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
5260
5368
  }
5261
5369
  );
5262
- const hydrationPlanOptions = _chunkGIWC4CFJcjs.getFarmClientHydrationPlanOptions.call(void 0,
5370
+ const hydrationPlanOptions = _chunkSJVKK4JEcjs.getFarmClientHydrationPlanOptions.call(void 0,
5263
5371
  config.renderer,
5264
5372
  Boolean(unsupportedIntegrationProvider)
5265
5373
  );
@@ -5274,7 +5382,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5274
5382
  hydrationPlanOptions
5275
5383
  )
5276
5384
  }));
5277
- const markdownPagePlan = _chunkGIWC4CFJcjs.createMarkdownPageHydrationPlanner.call(void 0,
5385
+ const markdownPagePlan = _chunkSJVKK4JEcjs.createMarkdownPageHydrationPlanner.call(void 0,
5278
5386
  _chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
5279
5387
  config.root,
5280
5388
  isolatedHydrationMode,
@@ -5283,7 +5391,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5283
5391
  const pageHydrationPlans = new Map(
5284
5392
  pageRoutes.map((route) => [
5285
5393
  route.modulePath,
5286
- _chunkNXG66MR7cjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
5394
+ _chunkUX5S4JEOcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
5287
5395
  route.modulePath,
5288
5396
  config.root,
5289
5397
  isolatedHydrationMode,
@@ -5292,7 +5400,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5292
5400
  )
5293
5401
  ])
5294
5402
  );
5295
- _chunkGIWC4CFJcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
5403
+ _chunkSJVKK4JEcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
5296
5404
  layoutHydrationPlans.map((layout) => ({
5297
5405
  pattern: layout.pattern,
5298
5406
  depth: layout.pattern.split("/").filter(Boolean).length,
@@ -5333,7 +5441,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5333
5441
  }).map(({ route }) => route);
5334
5442
  orderedPageRoutes.forEach((route, index) => {
5335
5443
  const varName = `pageRoute${index}`;
5336
- if (_chunkNXG66MR7cjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
5444
+ if (_chunkUX5S4JEOcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
5337
5445
  pageRegistrations.push(`
5338
5446
  {
5339
5447
  pattern: ${JSON.stringify(route.pattern)},
@@ -5476,6 +5584,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5476
5584
  const notFoundImport = notFoundPath ? `import * as CustomNotFound from ${toVirtualEntryImportSpecifier(notFoundPath)};` : "";
5477
5585
  const apiRouteHelpersImport = apiRoutes.length > 0 ? `import { mergePluginAPIRoutes, getAllowedAPIRouteMethods, invokeAPIRouteEndpoint, createStaticAPIRouteMatcherAtBasePath, resolveAPIRouteEndpoint } from "@farm.js/core/api/runtime";` : "";
5478
5586
  const productionRuntimeImport = `import {
5587
+ _getRequestReadCount,
5479
5588
  _runWithAfterRequest,
5480
5589
  _runWithCurrentRequest,
5481
5590
  _runWithAPIRequestRuntime,
@@ -5501,6 +5610,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5501
5610
  createFarmMetadataRouteResponse,
5502
5611
  createFarmAgentRobots,
5503
5612
  createFarmApiCatalogResponse,
5613
+ createFarmAppManifestResponse,
5504
5614
  collectFarmLlmsTxtPages,
5505
5615
  createFarmDefaultLlmsTxt,
5506
5616
  createFarmLlmsMarkdownReader,
@@ -5569,7 +5679,7 @@ import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfig
5569
5679
  import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
5570
5680
  import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
5571
5681
  const markdownHandlerImport = _optionalChain([config, 'access', _102 => _102.md, 'optionalAccess', _103 => _103.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
5572
- const appMarkdownImport = hasMarkdownPages ? `import { createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;";
5682
+ const appMarkdownImport = hasMarkdownPages ? `import { createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
5573
5683
  const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
5574
5684
  const mdxComponentsPath = typeof _optionalChain([config, 'access', _104 => _104.mdx, 'optionalAccess', _105 => _105.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
5575
5685
  const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
@@ -5776,7 +5886,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
5776
5886
 
5777
5887
  function FarmDefault404Page() {
5778
5888
  return React.createElement(React.Fragment, null,
5779
- React.createElement("style", null, ${JSON.stringify(_chunkGIWC4CFJcjs.DEFAULT_NOT_FOUND_STYLES)}),
5889
+ React.createElement("style", null, ${JSON.stringify(_chunkSJVKK4JEcjs.DEFAULT_NOT_FOUND_STYLES)}),
5780
5890
  React.createElement("main", {
5781
5891
  className: "farm-default-not-found",
5782
5892
  "aria-labelledby": "farm-default-not-found-title",
@@ -5987,6 +6097,9 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _117 => _117.docs, '
5987
6097
  contentDir: farmDocsResolvedConfig.contentDir || farmDocsResolvedConfig.config?.contentDir,
5988
6098
  }, {
5989
6099
  rootDir: farmDocsRuntimeRoot,
6100
+ // A production build's content cannot change, so the adapter reads its
6101
+ // navigation once instead of scanning the content directory per request.
6102
+ immutableContent: true,
5990
6103
  clientEntry: "/__farm_client_js_src__",
5991
6104
  // Font CSS is merged into the client stylesheet; farm-fonts.css only exists when the
5992
6105
  // app has fonts, so linking it separately 404'd for apps without them.
@@ -6012,10 +6125,17 @@ const farmDocsAPIHandler = ${_optionalChain([config, 'access', _119 => _119.docs
6012
6125
 
6013
6126
  // API routes bundled at build time
6014
6127
  const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
6015
- ]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path7, methods }) => ({ path: path7, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)} })` : ""};
6016
- const farmLocalAPIBasePath = ${JSON.stringify(_chunkWPYFSQKKcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))};
6128
+ ]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path8, methods }) => ({ path: path8, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)} })` : ""};
6129
+ const farmLocalAPIBasePath = ${JSON.stringify(_chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, config.api))};
6017
6130
  const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
6018
- ${_optionalChain([config, 'access', _121 => _121.agent, 'optionalAccess', _122 => _122.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkNPPL5YDTcjs.resolveFarmApiCatalogInput.call(void 0, config))};
6131
+ ${_optionalChain([config, 'access', _121 => _121.agent, 'optionalAccess', _122 => _122.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkP64MIF5Bcjs.resolveFarmApiCatalogInput.call(void 0, config))};
6132
+ ` : ""}${config.analytics !== false ? `const farmAppManifestInput = ${JSON.stringify(
6133
+ _chunkP64MIF5Bcjs.resolveFarmAppManifestInput.call(void 0, config, {
6134
+ build: config.deploymentId,
6135
+ packages: _chunkSJVKK4JEcjs.resolveFarmAppPackages.call(void 0, config.root),
6136
+ webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkSJVKK4JEcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
6137
+ })
6138
+ )};
6019
6139
  ` : ""}
6020
6140
  function isFarmLocalAPIPathname(pathname) {
6021
6141
  return farmLocalAPIBasePath !== "/" &&
@@ -6084,9 +6204,12 @@ function getFarmI18nSnapshot() {
6084
6204
  return ${config.i18n.enabled ? "getFarmI18nClientSnapshot()" : "undefined"};
6085
6205
  }
6086
6206
 
6207
+ // The locale step strips farmI18nConfig.basePath itself. Stripping it first as
6208
+ // well removed it twice, so /console/console/secret served /secret while
6209
+ // middleware and integration guards, which strip it once, saw /console/secret.
6087
6210
  function getFarmRoutePathname(pathname) {
6088
6211
  return farmI18nRuntime
6089
- ? stripFarmLocaleFromPathname(stripFarmBasePath(pathname), farmI18nConfig)
6212
+ ? stripFarmLocaleFromPathname(pathname, farmI18nConfig)
6090
6213
  : stripFarmBasePath(pathname);
6091
6214
  }
6092
6215
 
@@ -6455,7 +6578,7 @@ function peelFarmDocumentPrefix(markup) {
6455
6578
  let inner = markup.replace(/^\\s+/, "");
6456
6579
  let hoisted = "";
6457
6580
  const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents["'][^>]*>/i;
6458
- const hoistable = /${_chunkGIWC4CFJcjs.HOISTED_HEAD_ELEMENT.source}/i;
6581
+ const hoistable = /${_chunkSJVKK4JEcjs.HOISTED_HEAD_ELEMENT.source}/i;
6459
6582
  let match;
6460
6583
  while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
6461
6584
  if (!/^<div/i.test(match[0])) hoisted += match[0];
@@ -7028,6 +7151,7 @@ const farmMiddlewareRunner = ${hasMiddlewareRuntime ? `createProductionMiddlewar
7028
7151
  modules: fileMiddlewareModules,
7029
7152
  i18n: farmI18nConfig,
7030
7153
  server: farmServerConfig,
7154
+ apiBasePath: farmLocalAPIBasePath,
7031
7155
  })` : "null"};
7032
7156
 
7033
7157
  ${apiHandlerCode}
@@ -7448,6 +7572,12 @@ function getPPRHeaders(status, config) {
7448
7572
  return headers;
7449
7573
  }
7450
7574
 
7575
+ function hasFarmUnserializableRouteData(data) {
7576
+ const isPromise = (value) => Boolean(value) && typeof value.then === "function";
7577
+ if (isPromise(data)) return true;
7578
+ return Boolean(data) && typeof data === "object" && Object.values(data).some(isPromise);
7579
+ }
7580
+
7451
7581
  function getRouteSharedCacheControl(route, pprCanCache) {
7452
7582
  if (!route || !route.module) {
7453
7583
  return null;
@@ -7660,7 +7790,8 @@ async function handleFarmRequestInContext(
7660
7790
 
7661
7791
  ${hasMarkdownPages ? `
7662
7792
  // The raw markdown source of a page route is the page's content in another
7663
- // representation; middleware guarding the route must run before serving it.
7793
+ // representation; it is only served for a page an anonymous visitor may open,
7794
+ // which renderPage asks the app with the page's own path.
7664
7795
  const markdownSourceResponse = await createFarmMarkdownSourceResponse?.({
7665
7796
  request: cloneFarmRequestWithContext(request),
7666
7797
  config: farmMdxConfig,
@@ -7668,9 +7799,12 @@ async function handleFarmRequestInContext(
7668
7799
  const match = matchPageRoute(getFarmRoutePathname(targetPathname));
7669
7800
  return match?.route?.markdownSource || null;
7670
7801
  },
7802
+ renderPage: (targetRequest) => handleFarmRequest(targetRequest, adapterContext),
7671
7803
  });
7672
7804
  if (markdownSourceResponse) {
7673
- return applyProductionMiddlewareHeaders(markdownSourceResponse, middlewareHeaders);
7805
+ return isFarmMarkdownPublicSourceResponse(markdownSourceResponse)
7806
+ ? markdownSourceResponse
7807
+ : applyProductionMiddlewareHeaders(markdownSourceResponse, middlewareHeaders);
7674
7808
  }
7675
7809
  ` : ""}
7676
7810
 
@@ -7773,9 +7907,20 @@ async function handleFarmRequestInContext(
7773
7907
  return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
7774
7908
  }
7775
7909
  ` : ""}
7910
+ ${config.analytics !== false ? `
7911
+ // /.well-known/farmjs: the app's manifest, only for a request Farm Infra signed.
7912
+ if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkP64MIF5Bcjs.FARM_APP_MANIFEST_PATH)}) {
7913
+ const farmAppManifest = await createFarmAppManifestResponse(request, farmAppManifestInput, {
7914
+ development: false,
7915
+ });
7916
+ if (farmAppManifest) {
7917
+ return applyProductionMiddlewareHeaders(farmAppManifest, middlewareHeaders);
7918
+ }
7919
+ }
7920
+ ` : ""}
7776
7921
  ${_optionalChain([config, 'access', _137 => _137.agent, 'optionalAccess', _138 => _138.apiCatalog]) ? `
7777
7922
  // agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
7778
- if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkNPPL5YDTcjs.FARM_API_CATALOG_PATH)}) {
7923
+ if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkP64MIF5Bcjs.FARM_API_CATALOG_PATH)}) {
7779
7924
  return applyProductionMiddlewareHeaders(
7780
7925
  createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
7781
7926
  middlewareHeaders,
@@ -7911,6 +8056,9 @@ async function handleFarmRequestInContext(
7911
8056
  emitFarmEvent({ type: "ppr.shell.miss", route: pathname, key: pprCacheKey });
7912
8057
  }
7913
8058
 
8059
+ // Reads from here on belong to the page render, not to middleware.
8060
+ const requestReadsBeforeRender = _getRequestReadCount();
8061
+
7914
8062
  // Get the page component and metadata
7915
8063
  let PageComponent = route.module.default;
7916
8064
  let pageStatus = 200;
@@ -7970,6 +8118,10 @@ async function handleFarmRequestInContext(
7970
8118
  });
7971
8119
  }
7972
8120
  let pageProps;
8121
+ // A rejected guard or loader renders the route's notFound/error
8122
+ // component, and the route's generateMetadata must not run for it:
8123
+ // it would describe the resource the caller was refused.
8124
+ let routeStateRejected = false;
7973
8125
  try {
7974
8126
  // Resolve top-level route state before starting the HTTP stream so
7975
8127
  // redirects, notFound(), and failures keep their real status. Route
@@ -8004,6 +8156,7 @@ async function handleFarmRequestInContext(
8004
8156
  } catch (routeStateError) {
8005
8157
  if (isFarmRedirectError(routeStateError)) throw routeStateError;
8006
8158
 
8159
+ routeStateRejected = true;
8007
8160
  const routeComponents = route.module.__farmRouteComponents;
8008
8161
  const routeStateProps = {
8009
8162
  ...rawPageProps,
@@ -8093,7 +8246,9 @@ async function handleFarmRequestInContext(
8093
8246
  ...(pageProps.__farmCanonicalPath
8094
8247
  ? { __farmCanonicalPath: pageProps.__farmCanonicalPath }
8095
8248
  : {}),
8096
- ...(pageProps.__farmRoutePropsResolved
8249
+ // Deferred values do not survive JSON, so the browser cannot render
8250
+ // a page from these props while one is still in flight.
8251
+ ...(pageProps.__farmRoutePropsResolved && !hasFarmUnserializableRouteData(pageProps.data)
8097
8252
  ? { __farmRoutePropsResolved: true }
8098
8253
  : {}),
8099
8254
  path: pathname,
@@ -8215,7 +8370,7 @@ async function handleFarmRequestInContext(
8215
8370
  // the request's resolved Suspense content. Until the production runtime
8216
8371
  // can persist and resume the partial shell itself, buffer streamed PPR
8217
8372
  // responses for late status errors but do not cache their dynamic HTML.
8218
- const shouldCachePPRShell = Boolean(pprCacheKey && !renderedPage.stream);
8373
+ let shouldCachePPRShell = Boolean(pprCacheKey && !renderedPage.stream);
8219
8374
  if (!shouldCachePPRShell && pprCacheKey) {
8220
8375
  pprCanCache = false;
8221
8376
  emitFarmEvent({
@@ -8239,7 +8394,7 @@ async function handleFarmRequestInContext(
8239
8394
  }
8240
8395
  }
8241
8396
  mergedMetadata = mergeMetadata(mergedMetadata, pageMetadata);
8242
- if (typeof route.module.generateMetadata === "function") {
8397
+ if (!routeStateRejected && typeof route.module.generateMetadata === "function") {
8243
8398
  mergedMetadata = mergeMetadata(
8244
8399
  mergedMetadata,
8245
8400
  await route.module.generateMetadata(pageProps),
@@ -8273,6 +8428,17 @@ async function handleFarmRequestInContext(
8273
8428
  getFarmMarkdownAlternatePath(farmMarkdownConfig, pathname),
8274
8429
  );` : ""}
8275
8430
 
8431
+ // headers(), cookies(), or getCurrentRequest() read during the render,
8432
+ // in the page, a layout, metadata, or anything they import, makes this
8433
+ // HTML one visitor's: never a shared PPR shell or CDN response.
8434
+ const renderReadRequest = _getRequestReadCount() !== requestReadsBeforeRender;
8435
+ if (renderReadRequest && shouldCachePPRShell) {
8436
+ shouldCachePPRShell = false;
8437
+ pprCanCache = false;
8438
+ emitFarmEvent({ type: "ppr.shell.bypass", route: pathname, reason: "request-read" });
8439
+ emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "request-read" });
8440
+ }
8441
+
8276
8442
  const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _149 => _149.agent, 'optionalAccess', _150 => _150.jsonLd]), () => ( false)))} });
8277
8443
  const title = renderedMetadata.title;
8278
8444
  const metaTags = renderedMetadata.tags;
@@ -8284,6 +8450,7 @@ async function handleFarmRequestInContext(
8284
8450
  );
8285
8451
  const hasRequestScopedRender = Boolean(
8286
8452
  pageStatus >= 400 ||
8453
+ renderReadRequest ||
8287
8454
  request.headers.get("x-farm-intercept-from") ||
8288
8455
  hasPrivateRequestHeaders ||
8289
8456
  hasConfiguredRouteContext ||
@@ -9035,23 +9202,20 @@ function configMiddlewareMayHandlePath(config, pathname) {
9035
9202
  if (!hasFarmMiddlewareConfig(config)) return false;
9036
9203
  const entries = Array.isArray(config) ? config : [config];
9037
9204
  return entries.some((entry) => {
9038
- if (_optionalChain([entry, 'access', _155 => _155.exclude, 'optionalAccess', _156 => _156.some, 'call', _157 => _157((pattern) => middlewarePatternMatches(pattern, pathname))])) {
9039
- return false;
9040
- }
9041
- if (!entry.matcher) return true;
9042
- const matchers = Array.isArray(entry.matcher) ? entry.matcher : [entry.matcher];
9043
- return matchers.some((matcher) => {
9044
- if (typeof matcher === "function") return true;
9045
- return (typeof matcher === "string" || matcher instanceof RegExp) && middlewarePatternMatches(matcher, pathname);
9046
- });
9205
+ if (!entry.matcher && !entry.exclude) return true;
9206
+ const matchers = entry.matcher ? (Array.isArray(entry.matcher) ? entry.matcher : [entry.matcher]).map(
9207
+ (matcher) => (
9208
+ // A request-aware matcher cannot be proven safe at build time.
9209
+ typeof matcher === "function" ? () => true : matcher
9210
+ )
9211
+ ) : void 0;
9212
+ const compiled = _chunkZ2HLU4IXcjs.compileMiddlewareConfig.call(void 0, { matcher: matchers, exclude: entry.exclude });
9213
+ return _chunkZ2HLU4IXcjs.matchesCompiledMiddlewareConfig.call(void 0, pathname, compiled, {}).matched;
9047
9214
  });
9048
9215
  }
9049
9216
  _chunkS3JO3N4Hcjs.__name.call(void 0, configMiddlewareMayHandlePath, "configMiddlewareMayHandlePath");
9050
9217
  function appMiddlewareMayHandlePath(middlewareRoutes, pathname) {
9051
- return middlewareRoutes.some((route) => {
9052
- if (route.path === "/") return true;
9053
- return middlewarePatternMatches(route.path, pathname) || middlewarePatternMatches(`${route.path}/**`, pathname);
9054
- });
9218
+ return middlewareRoutes.some((route) => _chunkZ2HLU4IXcjs.matchesMiddlewareRoute.call(void 0, pathname, route).matched);
9055
9219
  }
9056
9220
  _chunkS3JO3N4Hcjs.__name.call(void 0, appMiddlewareMayHandlePath, "appMiddlewareMayHandlePath");
9057
9221
  function routePatternSpecificity(pattern) {
@@ -9091,11 +9255,11 @@ function getPhysicalPrerenderBypassReason(options) {
9091
9255
  }
9092
9256
  if (appMiddlewareMayHandlePath(middlewareRoutes, pathname)) return "app middleware";
9093
9257
  if (configMiddlewareMayHandlePath(config.middleware, pathname)) return "configured middleware";
9094
- if (_chunkJFHKNFEOcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
9258
+ if (_chunkPQDFUSXDcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
9095
9259
  if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
9096
9260
  const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
9097
- if (_optionalChain([manifestEntry, 'optionalAccess', _158 => _158.rendering]) === "dynamic") return "dynamic runtime manifest";
9098
- if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _159 => _159.regions, 'optionalAccess', _160 => _160.length])) || manifestEntry.maxDuration !== void 0)) {
9261
+ if (_optionalChain([manifestEntry, 'optionalAccess', _155 => _155.rendering]) === "dynamic") return "dynamic runtime manifest";
9262
+ if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _156 => _156.regions, 'optionalAccess', _157 => _157.length])) || manifestEntry.maxDuration !== void 0)) {
9099
9263
  return "route runtime controls";
9100
9264
  }
9101
9265
  const routeRule = getEffectiveRouteRule(config, pathname);
@@ -9117,7 +9281,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
9117
9281
  const nitroBuilder = nitroBuilderResult.value;
9118
9282
  const isVercel = preset === "vercel" || preset === "vercel-edge";
9119
9283
  const isCloudflareWorker = preset === "cloudflare-module";
9120
- const outputDir = _chunkJFHKNFEOcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
9284
+ const outputDir = _chunkPQDFUSXDcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
9121
9285
  const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
9122
9286
  const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
9123
9287
  const imageRuntime = resolveImageRuntime(config, preset);
@@ -9372,6 +9536,15 @@ function toFarmNodeResponse(request, response) {
9372
9536
  })
9373
9537
  );
9374
9538
  }
9539
+ const farmNetlifyEntryPath = preset === "netlify" ? _path2.default.join(ssrOutputDir, "farm-netlify-entry.mjs") : null;
9540
+ if (farmNetlifyEntryPath) {
9541
+ await fs.writeFile(
9542
+ farmNetlifyEntryPath,
9543
+ createFarmNetlifyEntry({
9544
+ nitroNetlifyEntry: resolveNitroNetlifyEntry(resolveNitroPackageEntry(root))
9545
+ })
9546
+ );
9547
+ }
9375
9548
  const prebuiltSSRPlugin = createExternalSSRBundlePlugin(
9376
9549
  nitroEntryPath,
9377
9550
  ssrOutputDir,
@@ -9397,6 +9570,7 @@ function toFarmNodeResponse(request, response) {
9397
9570
  let nitroConfig = {
9398
9571
  preset,
9399
9572
  ...farmNodeServerEntryPath ? { entry: farmNodeServerEntryPath } : {},
9573
+ ...farmNetlifyEntryPath ? { entry: farmNetlifyEntryPath } : {},
9400
9574
  rootDir: root,
9401
9575
  // Farm registers every handler, task, and plugin explicitly. Scanning the
9402
9576
  // project root would bundle an app's own `middleware/`, `api/`, `routes/`,
@@ -9415,6 +9589,11 @@ function toFarmNodeResponse(request, response) {
9415
9589
  baseURL: "/"
9416
9590
  }
9417
9591
  ],
9592
+ // A self-hosted Node server sends static files itself, so precompress them
9593
+ // with gzip and let Nitro serve that by Accept-Encoding. Brotli at Nitro's
9594
+ // fixed top quality cost a docs app ~20 s of build CPU for a small further
9595
+ // saving. Serverless and edge targets sit behind a CDN that compresses.
9596
+ ...preset === "node-server" ? { compressPublicAssets: { gzip: true } } : {},
9418
9597
  ...prerenderRoutes.length > 0 ? {
9419
9598
  prerender: {
9420
9599
  crawlLinks: false,
@@ -9488,20 +9667,20 @@ function toFarmNodeResponse(request, response) {
9488
9667
  snapshotSSRRebundleOptions(nitroConfig)
9489
9668
  );
9490
9669
  const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
9491
- const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _161 => _161.rollupConfig, 'optionalAccess', _162 => _162.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _163 => _163.rollupConfig, 'optionalAccess', _164 => _164.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _165 => _165.output, 'optionalAccess', _166 => _166.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
9492
- _optionalChain([nitroConfig, 'access', _167 => _167.handlers, 'optionalAccess', _168 => _168.some, 'call', _169 => _169(
9493
- (handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _170 => _170.handler]) || "") === nitroEntryPath
9670
+ const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _158 => _158.rollupConfig, 'optionalAccess', _159 => _159.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _160 => _160.rollupConfig, 'optionalAccess', _161 => _161.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _162 => _162.output, 'optionalAccess', _163 => _163.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
9671
+ _optionalChain([nitroConfig, 'access', _164 => _164.handlers, 'optionalAccess', _165 => _165.some, 'call', _166 => _166(
9672
+ (handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _167 => _167.handler]) || "") === nitroEntryPath
9494
9673
  )])
9495
9674
  );
9496
9675
  const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
9497
9676
  if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
9498
9677
  const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
9499
9678
  const shouldMinify = nitroConfig.minify !== false;
9500
- const keepServerNames = !(_optionalChain([config, 'access', _171 => _171.docs, 'optionalAccess', _172 => _172.enabled]) && _optionalChain([config, 'access', _173 => _173.docs, 'access', _174 => _174.adapter, 'optionalAccess', _175 => _175.server]));
9679
+ const keepServerNames = !(_optionalChain([config, 'access', _168 => _168.docs, 'optionalAccess', _169 => _169.enabled]) && _optionalChain([config, 'access', _170 => _170.docs, 'access', _171 => _171.adapter, 'optionalAccess', _172 => _172.server]));
9501
9680
  const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
9502
9681
  const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
9503
9682
  if (canReusePrebuiltSSR) {
9504
- const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _176 => _176.rollupConfig, 'optionalAccess', _177 => _177.plugins]);
9683
+ const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _173 => _173.rollupConfig, 'optionalAccess', _174 => _174.plugins]);
9505
9684
  nitroConfig.rollupConfig = {
9506
9685
  ...nitroConfig.rollupConfig,
9507
9686
  plugins: [
@@ -9512,10 +9691,10 @@ function toFarmNodeResponse(request, response) {
9512
9691
  }
9513
9692
  nitroConfig.minify = useFarmServerMinifier ? false : shouldMinify;
9514
9693
  const nitroInstance = await nitroBuilder.createNitro(nitroConfig);
9515
- if (_optionalChain([config, 'access', _178 => _178.md, 'optionalAccess', _179 => _179.enabled])) {
9694
+ if (_optionalChain([config, 'access', _175 => _175.md, 'optionalAccess', _176 => _176.enabled])) {
9516
9695
  nitroInstance.hooks.hook("prerender:generate", (route) => {
9517
- if (!route.contents || !_optionalChain([route, 'access', _180 => _180.contentType, 'optionalAccess', _181 => _181.toLowerCase, 'call', _182 => _182(), 'access', _183 => _183.includes, 'call', _184 => _184("html")])) return;
9518
- const alternatePath = _chunk6CNX6Q3Kcjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route);
9696
+ if (!route.contents || !_optionalChain([route, 'access', _177 => _177.contentType, 'optionalAccess', _178 => _178.toLowerCase, 'call', _179 => _179(), 'access', _180 => _180.includes, 'call', _181 => _181("html")])) return;
9697
+ const alternatePath = _chunkXXJU7FCCcjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route);
9519
9698
  if (!alternatePath) return;
9520
9699
  const routeRule = nitroInstance.options.routeRules[route.route] || {};
9521
9700
  const alternate = `<${alternatePath}>; rel="alternate"; type="text/markdown"`;
@@ -9535,8 +9714,8 @@ function toFarmNodeResponse(request, response) {
9535
9714
  }
9536
9715
  if (config.security.csp && config.security.csp.nonce) {
9537
9716
  nitroInstance.hooks.hook("prerender:generate", async (route) => {
9538
- if (!route.contents || !_optionalChain([route, 'access', _185 => _185.contentType, 'optionalAccess', _186 => _186.toLowerCase, 'call', _187 => _187(), 'access', _188 => _188.includes, 'call', _189 => _189("html")])) return;
9539
- const staticCsp = await _chunkXLTV4VOGcjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
9717
+ if (!route.contents || !_optionalChain([route, 'access', _182 => _182.contentType, 'optionalAccess', _183 => _183.toLowerCase, 'call', _184 => _184(), 'access', _185 => _185.includes, 'call', _186 => _186("html")])) return;
9718
+ const staticCsp = await _chunkZHPHJPQPcjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
9540
9719
  if (!staticCsp) return;
9541
9720
  route.contents = staticCsp.html;
9542
9721
  const routeRule = nitroInstance.options.routeRules[route.route] || {};
@@ -9551,7 +9730,7 @@ function toFarmNodeResponse(request, response) {
9551
9730
  nitroInstance.routing.sync();
9552
9731
  });
9553
9732
  }
9554
- if (farmNodeServerEntryPath) {
9733
+ if (farmNodeServerEntryPath || farmNetlifyEntryPath) {
9555
9734
  nitroInstance.hooks.hook("prerender:config", (prerendererConfig) => {
9556
9735
  delete prerendererConfig.entry;
9557
9736
  });
@@ -9606,13 +9785,13 @@ function toFarmNodeResponse(request, response) {
9606
9785
  }
9607
9786
  if (prerenderRoutes.length > 0) {
9608
9787
  _chunk5QIKR7RRcjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
9609
- const previousPrerender = process.env[_chunkND224OE2cjs.FARM_PRERENDER_ENV];
9610
- process.env[_chunkND224OE2cjs.FARM_PRERENDER_ENV] = "1";
9788
+ const previousPrerender = process.env[_chunkTKSCR644cjs.FARM_PRERENDER_ENV];
9789
+ process.env[_chunkTKSCR644cjs.FARM_PRERENDER_ENV] = "1";
9611
9790
  try {
9612
9791
  await nitroBuilder.prerender(nitroInstance);
9613
9792
  } finally {
9614
- if (previousPrerender === void 0) delete process.env[_chunkND224OE2cjs.FARM_PRERENDER_ENV];
9615
- else process.env[_chunkND224OE2cjs.FARM_PRERENDER_ENV] = previousPrerender;
9793
+ if (previousPrerender === void 0) delete process.env[_chunkTKSCR644cjs.FARM_PRERENDER_ENV];
9794
+ else process.env[_chunkTKSCR644cjs.FARM_PRERENDER_ENV] = previousPrerender;
9616
9795
  }
9617
9796
  }
9618
9797
  const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs, preset) : Promise.resolve(null);
@@ -9743,7 +9922,7 @@ async function moveVercelOutputPath(src, dest, fs) {
9743
9922
  await fs.rename(src, dest);
9744
9923
  return;
9745
9924
  } catch (error) {
9746
- const code = _optionalChain([error, 'optionalAccess', _190 => _190.code]);
9925
+ const code = _optionalChain([error, 'optionalAccess', _187 => _187.code]);
9747
9926
  if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
9748
9927
  throw error;
9749
9928
  }
@@ -9770,7 +9949,7 @@ async function postProcessVercelOutput(root, outputDir, fs, config, farmWorkflow
9770
9949
  try {
9771
9950
  await moveVercelOutputPath(publicDir, staticDir, fs);
9772
9951
  } catch (error) {
9773
- if (_optionalChain([error, 'optionalAccess', _191 => _191.code]) !== "ENOENT") throw error;
9952
+ if (_optionalChain([error, 'optionalAccess', _188 => _188.code]) !== "ENOENT") throw error;
9774
9953
  }
9775
9954
  await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs);
9776
9955
  await copyPrismaClientForVercel(root, nitroFuncDir, fs);
@@ -9803,7 +9982,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs) {
9803
9982
  const docsContentDir = resolveBuildDocsContentDir(config, root);
9804
9983
  if (!docsContentDir) return;
9805
9984
  const bundledContentDir = _path2.default.join(nitroFuncDir, "farm-docs-content");
9806
- const lastModifiedManifest = _chunkQ5JFU33Qcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
9985
+ const lastModifiedManifest = _chunkZ2YLTERKcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
9807
9986
  fallback: "now"
9808
9987
  });
9809
9988
  await fs.rm(bundledContentDir, { recursive: true, force: true });
@@ -9813,7 +9992,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs) {
9813
9992
  force: true
9814
9993
  });
9815
9994
  await fs.writeFile(
9816
- _path2.default.join(bundledContentDir, _chunkQ5JFU33Qcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
9995
+ _path2.default.join(bundledContentDir, _chunkZ2YLTERKcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
9817
9996
  `${JSON.stringify(lastModifiedManifest, null, 2)}
9818
9997
  `
9819
9998
  );
@@ -9890,7 +10069,7 @@ async function stageSharpRuntime(config, root, distDir, fs, preset) {
9890
10069
  try {
9891
10070
  await copyPackage("sharp", sharpRequire);
9892
10071
  if (!copiedPackages.has("sharp")) {
9893
- throw new Error(`Farm image optimization requires sharp. ${_chunkGIWC4CFJcjs.SHARP_INSTALL_HINT}`);
10072
+ throw new Error(`Farm image optimization requires sharp. ${_chunkSJVKK4JEcjs.SHARP_INSTALL_HINT}`);
9894
10073
  }
9895
10074
  } catch (error) {
9896
10075
  await fs.rm(stageDir, { recursive: true, force: true });
@@ -10104,7 +10283,7 @@ function createBuildTargetBaseline(config) {
10104
10283
  preset,
10105
10284
  distDir,
10106
10285
  outputDir,
10107
- outputWasDerived: outputDir === _chunkJFHKNFEOcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
10286
+ outputWasDerived: outputDir === _chunkPQDFUSXDcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
10108
10287
  };
10109
10288
  }
10110
10289
  _chunkS3JO3N4Hcjs.__name.call(void 0, createBuildTargetBaseline, "createBuildTargetBaseline");
@@ -10114,8 +10293,8 @@ function resolveBuildTargets(config, options, baseline) {
10114
10293
  const distDir = config.distDir || ".farm";
10115
10294
  const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
10116
10295
  const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
10117
- const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkJFHKNFEOcjs.getDeployTargetForPreset.call(void 0, preset);
10118
- const outputDir = shouldRefreshDerivedOutput ? _chunkJFHKNFEOcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
10296
+ const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkPQDFUSXDcjs.getDeployTargetForPreset.call(void 0, preset);
10297
+ const outputDir = shouldRefreshDerivedOutput ? _chunkPQDFUSXDcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
10119
10298
  return {
10120
10299
  root,
10121
10300
  preset,
@@ -10123,7 +10302,7 @@ function resolveBuildTargets(config, options, baseline) {
10123
10302
  distDir,
10124
10303
  deployTarget,
10125
10304
  outputDir,
10126
- deployOutputDir: _chunkJFHKNFEOcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
10305
+ deployOutputDir: _chunkPQDFUSXDcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
10127
10306
  };
10128
10307
  }
10129
10308
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveBuildTargets, "resolveBuildTargets");
@@ -10132,7 +10311,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10132
10311
  const targetBaseline = createBuildTargetBaseline(config);
10133
10312
  let targets;
10134
10313
  const productionViteResultPromise = options.universal === false ? void 0 : Promise.allSettled([Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))]);
10135
- const pluginManager = new (0, _chunkGIWC4CFJcjs.PluginManager)({
10314
+ const pluginManager = new (0, _chunkSJVKK4JEcjs.PluginManager)({
10136
10315
  config,
10137
10316
  isDev: false,
10138
10317
  isProd: true
@@ -10161,12 +10340,12 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10161
10340
  };
10162
10341
  config = {
10163
10342
  ...config,
10164
- images: _chunkGIWC4CFJcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
10343
+ images: _chunkSJVKK4JEcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
10165
10344
  root: targets.root,
10166
10345
  preset: targets.preset
10167
10346
  })
10168
10347
  };
10169
- if (_optionalChain([config, 'access', _192 => _192.docs, 'optionalAccess', _193 => _193.enabled])) await _chunkIK6LVLKCcjs.loadFarmDocsEngine.call(void 0, );
10348
+ if (_optionalChain([config, 'access', _189 => _189.docs, 'optionalAccess', _190 => _190.enabled])) await _chunkIK6LVLKCcjs.loadFarmDocsEngine.call(void 0, );
10170
10349
  pluginManager.updateContext({ config });
10171
10350
  const { root, preset, srcDir, distDir, deployOutputDir } = targets;
10172
10351
  _chunk5QIKR7RRcjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
@@ -10180,8 +10359,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10180
10359
  });
10181
10360
  _chunk5QIKR7RRcjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
10182
10361
  const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
10183
- if (_optionalChain([productionViteResult, 'optionalAccess', _194 => _194.status]) === "rejected") throw productionViteResult.reason;
10184
- const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _195 => _195.value]);
10362
+ if (_optionalChain([productionViteResult, 'optionalAccess', _191 => _191.status]) === "rejected") throw productionViteResult.reason;
10363
+ const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _192 => _192.value]);
10185
10364
  const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
10186
10365
  projectModuleServer = await createProjectModuleServer(
10187
10366
  createViteServer,
@@ -10189,18 +10368,18 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10189
10368
  root,
10190
10369
  rendererBuild.signal
10191
10370
  );
10192
- const farmApp = _chunkGIWC4CFJcjs.createFarmApp.call(void 0, config, projectModuleServer);
10371
+ const farmApp = _chunkSJVKK4JEcjs.createFarmApp.call(void 0, config, projectModuleServer);
10193
10372
  await farmApp.initialize();
10194
10373
  const routeManager = farmApp.getRouteManager();
10195
10374
  const serverRenderer = farmApp.getServerRenderer();
10196
- const typeArtifacts = _chunkCTV2TTNPcjs.generateFarmTypeArtifacts.call(void 0, {
10375
+ const typeArtifacts = _chunkQJ3J6MZTcjs.generateFarmTypeArtifacts.call(void 0, {
10197
10376
  root,
10198
10377
  srcDir,
10199
10378
  layers: config.layers,
10200
10379
  plugins: config.plugins,
10201
10380
  extraRoutes: [
10202
- ..._optionalChain([config, 'access', _196 => _196.openapi, 'optionalAccess', _197 => _197.enabled]) && config.openapi.route ? [config.openapi.route] : [],
10203
- ..._chunkQ5JFU33Qcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
10381
+ ..._optionalChain([config, 'access', _193 => _193.openapi, 'optionalAccess', _194 => _194.enabled]) && config.openapi.route ? [config.openapi.route] : [],
10382
+ ..._chunkZ2YLTERKcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
10204
10383
  ],
10205
10384
  suppressLintOnLink: config.suppressLintOnLink,
10206
10385
  componentExtensions: config.renderer.componentExtensions,
@@ -10209,7 +10388,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10209
10388
  const message = error instanceof Error ? error.message : String(error);
10210
10389
  _chunk5QIKR7RRcjs.logger.warn(`Route type generation failed (farm.d.ts may be stale): ${message}`);
10211
10390
  });
10212
- const apiRouteManager = new (0, _chunkEXLKRR4Ucjs.APIRouteManager)(
10391
+ const apiRouteManager = new (0, _chunkMIDIZJZCcjs.APIRouteManager)(
10213
10392
  _chunkVPTDD5XFcjs.getFarmAppDirectories.call(void 0, config),
10214
10393
  projectModuleServer,
10215
10394
  {
@@ -10217,7 +10396,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10217
10396
  plugins: config.plugins,
10218
10397
  i18n: farmApp.getI18nRuntime(),
10219
10398
  bodySizeLimit: config.server.bodySizeLimit,
10220
- basePath: _chunkWPYFSQKKcjs.resolveFarmAPIServerBasePath.call(void 0, config.api)
10399
+ basePath: _chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, config.api)
10221
10400
  }
10222
10401
  );
10223
10402
  const [, apiDiscovery] = await Promise.allSettled([
@@ -10284,7 +10463,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10284
10463
  throw error;
10285
10464
  } finally {
10286
10465
  try {
10287
- await _optionalChain([projectModuleServer, 'optionalAccess', _198 => _198.close, 'call', _199 => _199()]);
10466
+ await _optionalChain([projectModuleServer, 'optionalAccess', _195 => _195.close, 'call', _196 => _196()]);
10288
10467
  } finally {
10289
10468
  rendererBuild.abort();
10290
10469
  }
@@ -10296,7 +10475,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
10296
10475
  ssr: true,
10297
10476
  buildLifetime
10298
10477
  });
10299
- const viteConfig = _chunkGIWC4CFJcjs.mergeFarmViteConfig.call(void 0,
10478
+ const viteConfig = _chunkSJVKK4JEcjs.mergeFarmViteConfig.call(void 0,
10300
10479
  {
10301
10480
  root,
10302
10481
  appType: "custom",
@@ -10308,19 +10487,19 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
10308
10487
  },
10309
10488
  plugins: [
10310
10489
  ...rendererVitePlugins,
10311
- _chunkGIWC4CFJcjs.farmFontImportsPlugin.call(void 0, {
10490
+ _chunkSJVKK4JEcjs.farmFontImportsPlugin.call(void 0, {
10312
10491
  root,
10313
10492
  basePath: config.basePath,
10314
10493
  publicDir: config.publicDir
10315
10494
  }),
10316
- _chunk22GUSVNJcjs.farmEnvironmentFunctionsPlugin.call(void 0, )
10495
+ _chunk3SDFA7UFcjs.farmEnvironmentFunctionsPlugin.call(void 0, )
10317
10496
  ],
10318
10497
  server: {
10319
10498
  middlewareMode: true,
10320
10499
  hmr: false
10321
10500
  },
10322
10501
  resolve: {
10323
- alias: _chunkGIWC4CFJcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
10502
+ alias: _chunkSJVKK4JEcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
10324
10503
  dedupe: [...config.renderer.dedupe || []]
10325
10504
  },
10326
10505
  optimizeDeps: {
@@ -10377,7 +10556,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
10377
10556
  farmI18nClientBridgePlugin(),
10378
10557
  farmServerOnlyEntriesPlugin(),
10379
10558
  farmPlugin(config, pluginManager),
10380
- _chunk22GUSVNJcjs.farmEnvironmentFunctionsPlugin.call(void 0, )
10559
+ _chunk3SDFA7UFcjs.farmEnvironmentFunctionsPlugin.call(void 0, )
10381
10560
  ],
10382
10561
  mode: "production"
10383
10562
  });
@@ -10406,12 +10585,12 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
10406
10585
  define: {
10407
10586
  __FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
10408
10587
  __FARM_ENV__: JSON.stringify(_chunkVEKFLAQMcjs.createBundledEnv.call(void 0, config.env)),
10409
- __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _200 => _200.env, 'optionalAccess', _201 => _201.public]) || {})
10588
+ __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _197 => _197.env, 'optionalAccess', _198 => _198.public]) || {})
10410
10589
  },
10411
10590
  plugins: [
10412
10591
  farmI18nClientBridgePlugin(),
10413
10592
  farmPlugin(config, pluginManager),
10414
- _chunk22GUSVNJcjs.farmEnvironmentFunctionsPlugin.call(void 0, )
10593
+ _chunk3SDFA7UFcjs.farmEnvironmentFunctionsPlugin.call(void 0, )
10415
10594
  ],
10416
10595
  mode: "production"
10417
10596
  });
@@ -10428,7 +10607,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
10428
10607
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveLegacyPageEntry, "resolveLegacyPageEntry");
10429
10608
  async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
10430
10609
  const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
10431
- import("./nitro-VYDZGYFY.cjs"),
10610
+ import("./nitro-HSAQFXSS.cjs"),
10432
10611
  import("nitro/builder")
10433
10612
  ]);
10434
10613
  let nitroConfig = await createNitroConfig(
@@ -10441,7 +10620,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
10441
10620
  if (pluginManager) {
10442
10621
  nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
10443
10622
  }
10444
- const outputDir = _chunkJFHKNFEOcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
10623
+ const outputDir = _chunkPQDFUSXDcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
10445
10624
  const serverOutputDir = _path2.default.join(outputDir, "server");
10446
10625
  const publicOutputDir = _path2.default.join(outputDir, "public");
10447
10626
  const { mkdir, cp } = await import("fs/promises");
@@ -10512,7 +10691,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
10512
10691
  root,
10513
10692
  preset,
10514
10693
  distDir,
10515
- outputDir: _chunkJFHKNFEOcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
10694
+ outputDir: _chunkPQDFUSXDcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
10516
10695
  });
10517
10696
  }
10518
10697
  }