@farm.js/core 0.1.34 → 0.1.35

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 (261) hide show
  1. package/dist/agent-runtime.cjs +3 -3
  2. package/dist/agent-runtime.d.mts +4 -5
  3. package/dist/agent-runtime.d.ts +4 -5
  4. package/dist/agent-runtime.mjs +2 -2
  5. package/dist/api/route-manager.cjs +5 -5
  6. package/dist/api/route-manager.d.mts +6 -7
  7. package/dist/api/route-manager.d.ts +6 -7
  8. package/dist/api/route-manager.mjs +4 -4
  9. package/dist/api/runtime.cjs +6 -4
  10. package/dist/api/runtime.d.mts +4 -5
  11. package/dist/api/runtime.d.ts +4 -5
  12. package/dist/api/runtime.mjs +6 -4
  13. package/dist/api.cjs +6 -6
  14. package/dist/api.d.mts +7 -8
  15. package/dist/api.d.ts +7 -8
  16. package/dist/api.mjs +5 -5
  17. package/dist/{app-DgotYGbq.d.ts → app-BXB3JZYc.d.ts} +38 -12
  18. package/dist/{app-q4rmZlXK.d.mts → app-D_j9AAVL.d.mts} +38 -12
  19. package/dist/app-markdown.cjs +5 -5
  20. package/dist/app-markdown.d.mts +5 -6
  21. package/dist/app-markdown.d.ts +5 -6
  22. package/dist/app-markdown.mjs +4 -4
  23. package/dist/{chunk-LMJ7VRHZ.mjs → chunk-22LTEMGQ.mjs} +1 -1
  24. package/dist/{chunk-AQZFOP7S.mjs → chunk-2G2NNLE2.mjs} +1 -1
  25. package/dist/{chunk-QJ3J6MZT.cjs → chunk-3BHT4WMP.cjs} +2 -2
  26. package/dist/{chunk-X242HVD5.mjs → chunk-3PXS2MHU.mjs} +1 -1
  27. package/dist/{chunk-A5FGU2WU.cjs → chunk-3UH7MRCP.cjs} +19 -23
  28. package/dist/{chunk-AGC75XAE.mjs → chunk-4JHOT46A.mjs} +1 -1
  29. package/dist/{chunk-XV5DJTBX.mjs → chunk-4KU5Q7C2.mjs} +424 -230
  30. package/dist/{chunk-TA5G2HWD.cjs → chunk-4MMGO7YW.cjs} +21 -21
  31. package/dist/{chunk-7BT4H4P7.cjs → chunk-62XKI4Z3.cjs} +2 -2
  32. package/dist/{chunk-ZKP7C2B6.mjs → chunk-6DU6UFUE.mjs} +12 -11
  33. package/dist/{chunk-GOABMOX3.mjs → chunk-6ETPZTJI.mjs} +366 -4
  34. package/dist/{chunk-7Y6ZNFPX.mjs → chunk-6TJOML4E.mjs} +13 -3
  35. package/dist/{chunk-3ATMYLLJ.mjs → chunk-6WCPV6G2.mjs} +1 -1
  36. package/dist/{chunk-BTAG7LI7.cjs → chunk-73MC7ZL6.cjs} +2 -2
  37. package/dist/chunk-75RZHGLS.cjs +135 -0
  38. package/dist/{chunk-VKNHTSAP.cjs → chunk-7GLPRTTF.cjs} +2 -2
  39. package/dist/{chunk-7M52YUMY.cjs → chunk-7L5V3KQO.cjs} +2 -2
  40. package/dist/{chunk-LI2LMOLR.mjs → chunk-C35ZBVRD.mjs} +12 -3
  41. package/dist/{chunk-YQVSHTMR.mjs → chunk-CP6X4AEU.mjs} +1 -1
  42. package/dist/{chunk-QZCT2CQ4.mjs → chunk-CXEN47J3.mjs} +64 -2
  43. package/dist/{chunk-ATK2R4CH.cjs → chunk-D227TIEN.cjs} +14 -4
  44. package/dist/{chunk-ROUTX2E5.cjs → chunk-DBNKI4NF.cjs} +12 -3
  45. package/dist/{chunk-UX5S4JEO.cjs → chunk-EFCQPQMG.cjs} +3 -3
  46. package/dist/{chunk-K3F2E6GS.cjs → chunk-EJQT6KZN.cjs} +2 -2
  47. package/dist/{chunk-3LUF2PE2.cjs → chunk-EK4QAEFZ.cjs} +67 -5
  48. package/dist/{chunk-VVBO3QH7.mjs → chunk-ENLZ4R3Y.mjs} +10 -1
  49. package/dist/{chunk-XXJU7FCC.cjs → chunk-EUV4YR3V.cjs} +2 -2
  50. package/dist/{chunk-WNNYOOIB.mjs → chunk-F6Z3Y5KL.mjs} +1 -1
  51. package/dist/{chunk-PQDFUSXD.cjs → chunk-F7JZENPF.cjs} +33 -32
  52. package/dist/{chunk-TDFPACVX.cjs → chunk-FTFYRMQQ.cjs} +18 -18
  53. package/dist/{chunk-657WJNRY.mjs → chunk-G5RT7EXW.mjs} +1 -1
  54. package/dist/{chunk-MOKLYNHV.cjs → chunk-GFHLGIYC.cjs} +6 -6
  55. package/dist/{chunk-AWC4VUZL.cjs → chunk-GQ3Z3IZI.cjs} +14 -14
  56. package/dist/{chunk-75WGQVQA.cjs → chunk-HITLGIAO.cjs} +10 -1
  57. package/dist/{chunk-GNSDTTWZ.mjs → chunk-HMIJDL7S.mjs} +1 -1
  58. package/dist/{chunk-PXKIEXZD.mjs → chunk-HUMR6LSU.mjs} +1 -1
  59. package/dist/{chunk-SJVKK4JE.cjs → chunk-ICUQICNC.cjs} +912 -718
  60. package/dist/{chunk-P64MIF5B.cjs → chunk-IPXLADVO.cjs} +387 -25
  61. package/dist/{chunk-KROWKCUH.cjs → chunk-JGLC4TO3.cjs} +8 -1
  62. package/dist/{chunk-2NQQ5H5G.cjs → chunk-M7MKQXAF.cjs} +2 -1
  63. package/dist/chunk-NRDBW4MP.mjs +45 -0
  64. package/dist/chunk-OFZUJMCU.mjs +601 -0
  65. package/dist/{chunk-VCCUOMQN.mjs → chunk-OKZUAXHF.mjs} +1 -1
  66. package/dist/{chunk-EM6SBQKM.cjs → chunk-OMVAU7NT.cjs} +27 -2
  67. package/dist/{chunk-O27L4YAA.mjs → chunk-PDOCJ6RY.mjs} +2 -2
  68. package/dist/{chunk-36MK5YCW.cjs → chunk-PFQKNERH.cjs} +346 -206
  69. package/dist/{chunk-HR5KPHC2.mjs → chunk-Q3VLETLE.mjs} +1 -1
  70. package/dist/{chunk-LR5QSC2P.mjs → chunk-QAU5JD57.mjs} +211 -71
  71. package/dist/{chunk-LHODW25H.mjs → chunk-QORUJDIV.mjs} +2 -2
  72. package/dist/{chunk-UBO4SGH4.mjs → chunk-RHAZ22ZN.mjs} +2 -1
  73. package/dist/{chunk-ZHPHJPQP.cjs → chunk-RU3M2FIK.cjs} +18 -14
  74. package/dist/{chunk-JDPAKVS4.mjs → chunk-SAZVVAJH.mjs} +3 -3
  75. package/dist/{chunk-6VVL3MHY.mjs → chunk-SC2WYWPF.mjs} +1 -1
  76. package/dist/{chunk-QCFFHV5H.mjs → chunk-SMHH4VDG.mjs} +1 -1
  77. package/dist/{chunk-U4PTAHW3.mjs → chunk-SOMHP6GF.mjs} +7 -11
  78. package/dist/{chunk-VHANUNEG.mjs → chunk-UAORZ7QA.mjs} +2 -2
  79. package/dist/{chunk-NGVORZVZ.mjs → chunk-UJD4PHYB.mjs} +15 -11
  80. package/dist/{chunk-U74I55WB.cjs → chunk-ULAWS2PA.cjs} +13 -3
  81. package/dist/{chunk-MPEYMSCF.cjs → chunk-VFQT3LAO.cjs} +5 -5
  82. package/dist/{chunk-Z2YLTERK.cjs → chunk-VZJR7UTG.cjs} +6 -6
  83. package/dist/chunk-WWFTAUFG.cjs +45 -0
  84. package/dist/{chunk-ZUSJDQ2Q.mjs → chunk-WWIKMBRN.mjs} +1 -1
  85. package/dist/{chunk-QGYRXFU2.cjs → chunk-X6W5FFH6.cjs} +8 -8
  86. package/dist/{chunk-MIDIZJZC.cjs → chunk-XBML5KMG.cjs} +8 -8
  87. package/dist/{chunk-G26MUMKL.cjs → chunk-XCACDAZZ.cjs} +4 -4
  88. package/dist/{chunk-CLJYVZAD.mjs → chunk-XCMCS4DA.mjs} +11 -1
  89. package/dist/{chunk-XF7Q24PF.mjs → chunk-Y7RKTKYI.mjs} +25 -0
  90. package/dist/{chunk-ODBZYBAB.cjs → chunk-YC6V7PWE.cjs} +1 -1
  91. package/dist/{chunk-F6OHXPWR.mjs → chunk-YFILVET3.mjs} +8 -1
  92. package/dist/{chunk-DZ4DTRJ5.cjs → chunk-YKX5BK66.cjs} +7 -7
  93. package/dist/chunk-YSLWRWWP.cjs +601 -0
  94. package/dist/{chunk-3VSKDFAT.mjs → chunk-YULD7ICZ.mjs} +1 -1
  95. package/dist/chunk-ZLAT2CWY.mjs +135 -0
  96. package/dist/{chunk-T5CERMEH.cjs → chunk-ZXGAFZDO.cjs} +2 -2
  97. package/dist/{client-plugins-CLObcuCq.d.mts → client-plugins-CvIslxWi.d.mts} +207 -7
  98. package/dist/{client-plugins-DZjHC4Mi.d.ts → client-plugins-HIyulDym.d.ts} +207 -7
  99. package/dist/client-plugins.d.mts +4 -5
  100. package/dist/client-plugins.d.ts +4 -5
  101. package/dist/client.cjs +5 -5
  102. package/dist/client.d.mts +8 -9
  103. package/dist/client.d.ts +8 -9
  104. package/dist/client.mjs +4 -4
  105. package/dist/config.d.mts +4 -5
  106. package/dist/config.d.ts +4 -5
  107. package/dist/{devtools-HU6Y2MNV.cjs → devtools-EAUY43BS.cjs} +9 -9
  108. package/dist/{devtools-RNXCTS4R.mjs → devtools-EE5RIBTH.mjs} +8 -8
  109. package/dist/docs.cjs +12 -12
  110. package/dist/docs.d.mts +41 -4
  111. package/dist/docs.d.ts +41 -4
  112. package/dist/docs.mjs +11 -11
  113. package/dist/i18n/client.d.mts +2 -2
  114. package/dist/i18n/client.d.ts +2 -2
  115. package/dist/i18n/index.d.mts +3 -3
  116. package/dist/i18n/index.d.ts +3 -3
  117. package/dist/i18n/server.d.mts +5 -5
  118. package/dist/i18n/server.d.ts +5 -5
  119. package/dist/image/server.cjs +3 -3
  120. package/dist/image/server.mjs +2 -2
  121. package/dist/image/sharp.cjs +10 -10
  122. package/dist/image/sharp.mjs +2 -2
  123. package/dist/{index-a-8Z5kZU.d.mts → index-BJJfLxJo.d.mts} +2 -2
  124. package/dist/{index-BWVfxIsO.d.ts → index-CwoOP-MW.d.ts} +2 -2
  125. package/dist/index.cjs +38 -35
  126. package/dist/index.d.mts +19 -20
  127. package/dist/index.d.ts +19 -20
  128. package/dist/index.mjs +37 -34
  129. package/dist/integrations.cjs +3 -3
  130. package/dist/integrations.d.mts +4 -5
  131. package/dist/integrations.d.ts +4 -5
  132. package/dist/integrations.mjs +2 -2
  133. package/dist/internal/app-markdown-runtime.cjs +4 -4
  134. package/dist/internal/app-markdown-runtime.d.mts +5 -6
  135. package/dist/internal/app-markdown-runtime.d.ts +5 -6
  136. package/dist/internal/app-markdown-runtime.mjs +3 -3
  137. package/dist/internal/build-runtime.cjs +26 -26
  138. package/dist/internal/build-runtime.d.mts +6 -7
  139. package/dist/internal/build-runtime.d.ts +6 -7
  140. package/dist/internal/build-runtime.mjs +25 -25
  141. package/dist/internal/cli-runtime.cjs +13 -13
  142. package/dist/internal/cli-runtime.mjs +12 -12
  143. package/dist/internal/client-error-overlay.cjs +6 -6
  144. package/dist/internal/client-error-overlay.mjs +2 -2
  145. package/dist/internal/client-runtime.cjs +2 -2
  146. package/dist/internal/client-runtime.mjs +1 -1
  147. package/dist/internal/compression-runtime.d.mts +4 -5
  148. package/dist/internal/compression-runtime.d.ts +4 -5
  149. package/dist/internal/config-runtime.cjs +9 -9
  150. package/dist/internal/config-runtime.d.mts +5 -6
  151. package/dist/internal/config-runtime.d.ts +5 -6
  152. package/dist/internal/config-runtime.mjs +8 -8
  153. package/dist/internal/isolated-boundary.cjs +3 -2
  154. package/dist/internal/isolated-boundary.d.mts +1 -0
  155. package/dist/internal/isolated-boundary.d.ts +1 -0
  156. package/dist/internal/isolated-boundary.mjs +2 -1
  157. package/dist/internal/metadata-image-runtime.cjs +3 -3
  158. package/dist/internal/metadata-image-runtime.mjs +2 -2
  159. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  160. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  161. package/dist/internal/production-runtime.cjs +47 -23
  162. package/dist/internal/production-runtime.d.mts +58 -18
  163. package/dist/internal/production-runtime.d.ts +58 -18
  164. package/dist/internal/production-runtime.mjs +43 -19
  165. package/dist/internal/server-tree.cjs +12 -0
  166. package/dist/internal/server-tree.d.mts +27 -0
  167. package/dist/internal/server-tree.d.ts +27 -0
  168. package/dist/internal/server-tree.mjs +12 -0
  169. package/dist/markdown.cjs +3 -3
  170. package/dist/markdown.d.mts +4 -5
  171. package/dist/markdown.d.ts +4 -5
  172. package/dist/markdown.mjs +2 -2
  173. package/dist/{metadata-Cjs8JMRM.d.ts → metadata-BnLDsUOS.d.ts} +16 -2
  174. package/dist/{metadata-2HSU2i_w.d.mts → metadata-WGpBYcGn.d.mts} +16 -2
  175. package/dist/middleware.cjs +4 -4
  176. package/dist/middleware.d.mts +6 -7
  177. package/dist/middleware.d.ts +6 -7
  178. package/dist/middleware.mjs +3 -3
  179. package/dist/navigation.cjs +5 -5
  180. package/dist/navigation.d.mts +7 -8
  181. package/dist/navigation.d.ts +7 -8
  182. package/dist/navigation.mjs +4 -4
  183. package/dist/{nitro-4XGPNIK4.mjs → nitro-MXRDCXWZ.mjs} +2 -2
  184. package/dist/{nitro-HSAQFXSS.cjs → nitro-OVPLKPE2.cjs} +3 -3
  185. package/dist/{observability-BupkiN0m.d.mts → observability-CoXunYhS.d.mts} +4 -3
  186. package/dist/{observability-BupkiN0m.d.ts → observability-CoXunYhS.d.ts} +4 -3
  187. package/dist/observability.d.mts +1 -1
  188. package/dist/observability.d.ts +1 -1
  189. package/dist/plugin.cjs +22 -22
  190. package/dist/plugin.d.mts +4 -5
  191. package/dist/plugin.d.ts +4 -5
  192. package/dist/plugin.mjs +21 -21
  193. package/dist/{production-runtime-CysZl3EV.d.mts → production-runtime-0sRnuYc-.d.mts} +4 -4
  194. package/dist/{production-runtime-BU5ETAK9.d.ts → production-runtime-Crq6CJ-2.d.ts} +4 -4
  195. package/dist/query/client.cjs +6 -6
  196. package/dist/query/client.mjs +2 -2
  197. package/dist/{render-plan-D72O1qm4.d.ts → render-plan-8ozZh2Qv.d.ts} +1 -1
  198. package/dist/{render-plan-CKr4ltOd.d.mts → render-plan-gs9GGPzw.d.mts} +1 -1
  199. package/dist/renderer/react/server.cjs +10 -4
  200. package/dist/renderer/react/server.d.mts +2 -1
  201. package/dist/renderer/react/server.d.ts +2 -1
  202. package/dist/renderer/react/server.mjs +7 -1
  203. package/dist/renderer-client.cjs +5 -5
  204. package/dist/renderer-client.d.mts +6 -7
  205. package/dist/renderer-client.d.ts +6 -7
  206. package/dist/renderer-client.mjs +2 -2
  207. package/dist/renderer.d.mts +2 -0
  208. package/dist/renderer.d.ts +2 -0
  209. package/dist/{request-DbyOYI2j.d.ts → request-B5G8rLBH.d.ts} +1 -1
  210. package/dist/{request-Be83WafN.d.mts → request-fkhiynXe.d.mts} +1 -1
  211. package/dist/request.d.mts +5 -6
  212. package/dist/request.d.ts +5 -6
  213. package/dist/{resolver-PPEeiJ6M.d.ts → resolver-DadfRL6F.d.ts} +1 -1
  214. package/dist/{resolver-DhW0CqZN.d.mts → resolver-khasx3fU.d.mts} +1 -1
  215. package/dist/{route-rendering-BG56SzvJ.d.mts → route-rendering-CLnS7AZj.d.mts} +1 -1
  216. package/dist/{route-rendering-CtVMpV-k.d.ts → route-rendering-lS5nUMua.d.ts} +1 -1
  217. package/dist/{router-D94-SDlW.d.ts → router-4iuiYnOW.d.ts} +1 -1
  218. package/dist/{router-ALUvm8gC.d.mts → router-ifU8Dui1.d.mts} +1 -1
  219. package/dist/routes.d.mts +4 -5
  220. package/dist/routes.d.ts +4 -5
  221. package/dist/{runtime-BirxPwbZ.d.ts → runtime-BgDQzBiu.d.ts} +2 -2
  222. package/dist/{runtime-AOJge4vQ.d.mts → runtime-CV2UCV-5.d.mts} +2 -2
  223. package/dist/server-action-security.cjs +3 -3
  224. package/dist/server-action-security.mjs +2 -2
  225. package/dist/server-fn.cjs +4 -4
  226. package/dist/server-fn.mjs +3 -3
  227. package/dist/server-plugins.d.mts +5 -6
  228. package/dist/server-plugins.d.ts +5 -6
  229. package/dist/server-query.cjs +5 -5
  230. package/dist/server-query.mjs +4 -4
  231. package/dist/server.cjs +41 -41
  232. package/dist/server.d.mts +13 -14
  233. package/dist/server.d.ts +13 -14
  234. package/dist/server.mjs +24 -24
  235. package/dist/{spa-router-DbxNRKOB.d.mts → spa-router-Bq7VCOwx.d.mts} +3 -3
  236. package/dist/{spa-router-CxK3USIz.d.ts → spa-router-DaJk5Re4.d.ts} +3 -3
  237. package/dist/testing.cjs +7 -7
  238. package/dist/testing.d.mts +4 -5
  239. package/dist/testing.d.ts +4 -5
  240. package/dist/testing.mjs +5 -5
  241. package/dist/{types-Z0aotQ8w.d.mts → types-CnH8DOqo.d.mts} +1 -1
  242. package/dist/{types-Z0aotQ8w.d.ts → types-CnH8DOqo.d.ts} +1 -1
  243. package/dist/{utils-311Y8eoK.d.ts → utils-BXLmFsVR.d.ts} +1 -1
  244. package/dist/{utils-4wVRcpOw.d.mts → utils-XJn0c9bj.d.mts} +1 -1
  245. package/dist/version.cjs +2 -2
  246. package/dist/version.mjs +1 -1
  247. package/dist/vite.cjs +22 -22
  248. package/dist/vite.d.mts +4 -5
  249. package/dist/vite.d.ts +4 -5
  250. package/dist/vite.mjs +21 -21
  251. package/dist/{workflows-CR9ex-gz.d.ts → workflows-jZ4BcdoZ.d.mts} +1 -1
  252. package/dist/{workflows-CR9ex-gz.d.mts → workflows-jZ4BcdoZ.d.ts} +1 -1
  253. package/dist/workflows.cjs +3 -3
  254. package/dist/workflows.d.mts +1 -1
  255. package/dist/workflows.d.ts +1 -1
  256. package/dist/workflows.mjs +2 -2
  257. package/package.json +9 -1
  258. package/dist/chunk-M64YUMA4.cjs +0 -58
  259. package/dist/chunk-QLQ32WC4.mjs +0 -58
  260. package/dist/types-DFbjpjXX.d.mts +0 -105
  261. package/dist/types-DFbjpjXX.d.ts +0 -105
@@ -10,7 +10,7 @@ var _chunkXD32KALFcjs = require('./chunk-XD32KALF.cjs');
10
10
 
11
11
 
12
12
 
13
- var _chunkA5FGU2WUcjs = require('./chunk-A5FGU2WU.cjs');
13
+ var _chunk3UH7MRCPcjs = require('./chunk-3UH7MRCP.cjs');
14
14
 
15
15
 
16
16
 
@@ -20,7 +20,7 @@ var _chunkA5FGU2WUcjs = require('./chunk-A5FGU2WU.cjs');
20
20
 
21
21
 
22
22
 
23
- var _chunkZ2YLTERKcjs = require('./chunk-Z2YLTERK.cjs');
23
+ var _chunkVZJR7UTGcjs = require('./chunk-VZJR7UTG.cjs');
24
24
 
25
25
 
26
26
 
@@ -37,7 +37,7 @@ var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
37
37
 
38
38
 
39
39
 
40
- var _chunkPQDFUSXDcjs = require('./chunk-PQDFUSXD.cjs');
40
+ var _chunkF7JZENPFcjs = require('./chunk-F7JZENPF.cjs');
41
41
 
42
42
 
43
43
  var _chunkKCMTCM6Icjs = require('./chunk-KCMTCM6I.cjs');
@@ -75,19 +75,25 @@ var _chunk2SJ4RQ6Pcjs = require('./chunk-2SJ4RQ6P.cjs');
75
75
 
76
76
 
77
77
 
78
- var _chunkSJVKK4JEcjs = require('./chunk-SJVKK4JE.cjs');
79
78
 
79
+ var _chunkICUQICNCcjs = require('./chunk-ICUQICNC.cjs');
80
80
 
81
81
 
82
82
 
83
83
 
84
- var _chunkQJ3J6MZTcjs = require('./chunk-QJ3J6MZT.cjs');
85
84
 
85
+ var _chunk3BHT4WMPcjs = require('./chunk-3BHT4WMP.cjs');
86
86
 
87
87
 
88
88
 
89
89
 
90
- var _chunkP64MIF5Bcjs = require('./chunk-P64MIF5B.cjs');
90
+
91
+
92
+
93
+
94
+
95
+
96
+ var _chunkIPXLADVOcjs = require('./chunk-IPXLADVO.cjs');
91
97
 
92
98
 
93
99
  var _chunkCXP5U3RWcjs = require('./chunk-CXP5U3RW.cjs');
@@ -97,7 +103,7 @@ var _chunk3SDFA7UFcjs = require('./chunk-3SDFA7UF.cjs');
97
103
 
98
104
 
99
105
 
100
- var _chunk75WGQVQAcjs = require('./chunk-75WGQVQA.cjs');
106
+ var _chunkHITLGIAOcjs = require('./chunk-HITLGIAO.cjs');
101
107
 
102
108
 
103
109
 
@@ -119,7 +125,7 @@ var _chunkVPTDD5XFcjs = require('./chunk-VPTDD5XF.cjs');
119
125
  var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
120
126
 
121
127
 
122
- var _chunkZHPHJPQPcjs = require('./chunk-ZHPHJPQP.cjs');
128
+ var _chunkRU3M2FIKcjs = require('./chunk-RU3M2FIK.cjs');
123
129
 
124
130
 
125
131
 
@@ -131,27 +137,27 @@ var _chunk6EXBPJ24cjs = require('./chunk-6EXBPJ24.cjs');
131
137
  var _chunkVEKFLAQMcjs = require('./chunk-VEKFLAQM.cjs');
132
138
 
133
139
 
134
- var _chunkUX5S4JEOcjs = require('./chunk-UX5S4JEO.cjs');
140
+ var _chunkEFCQPQMGcjs = require('./chunk-EFCQPQMG.cjs');
135
141
 
136
142
 
137
143
 
138
144
  var _chunkOHY2ZWUGcjs = require('./chunk-OHY2ZWUG.cjs');
139
145
 
140
146
 
141
- var _chunkXXJU7FCCcjs = require('./chunk-XXJU7FCC.cjs');
147
+ var _chunkEUV4YR3Vcjs = require('./chunk-EUV4YR3V.cjs');
142
148
 
143
149
 
144
150
 
145
- var _chunkMPEYMSCFcjs = require('./chunk-MPEYMSCF.cjs');
151
+ var _chunkVFQT3LAOcjs = require('./chunk-VFQT3LAO.cjs');
146
152
 
147
153
 
148
154
 
149
- var _chunkTDFPACVXcjs = require('./chunk-TDFPACVX.cjs');
155
+ var _chunkFTFYRMQQcjs = require('./chunk-FTFYRMQQ.cjs');
150
156
 
151
157
 
152
158
 
153
159
 
154
- var _chunkU74I55WBcjs = require('./chunk-U74I55WB.cjs');
160
+ var _chunkULAWS2PAcjs = require('./chunk-ULAWS2PA.cjs');
155
161
 
156
162
 
157
163
 
@@ -159,7 +165,7 @@ var _chunkU74I55WBcjs = require('./chunk-U74I55WB.cjs');
159
165
  var _chunkZ2HLU4IXcjs = require('./chunk-Z2HLU4IX.cjs');
160
166
 
161
167
 
162
- var _chunkMIDIZJZCcjs = require('./chunk-MIDIZJZC.cjs');
168
+ var _chunkXBML5KMGcjs = require('./chunk-XBML5KMG.cjs');
163
169
 
164
170
 
165
171
  var _chunkUFDAAQFXcjs = require('./chunk-UFDAAQFX.cjs');
@@ -293,7 +299,7 @@ function getDocsTitle(docs) {
293
299
  }
294
300
  _chunkS3JO3N4Hcjs.__name.call(void 0, getDocsTitle, "getDocsTitle");
295
301
  function loadPages(contentDir, docs) {
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));
302
+ return _chunkVZJR7UTGcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunkVZJR7UTGcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
297
303
  }
298
304
  _chunkS3JO3N4Hcjs.__name.call(void 0, loadPages, "loadPages");
299
305
  function findSocialImagePath(html) {
@@ -314,14 +320,14 @@ async function addHandlerRoute(routes, pathname, handler, absolutePaths) {
314
320
  }
315
321
  _chunkS3JO3N4Hcjs.__name.call(void 0, addHandlerRoute, "addHandlerRoute");
316
322
  async function compileFarmDocsManifest(docs, options) {
317
- const contentDir = _chunkZ2YLTERKcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
323
+ const contentDir = _chunkVZJR7UTGcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
318
324
  const pages = loadPages(contentDir, docs);
319
325
  const absolutePaths = [
320
326
  _path2.default.resolve(options.root),
321
327
  _path2.default.resolve(contentDir),
322
328
  docs.configPath || ""
323
329
  ];
324
- const handler = _chunkZ2YLTERKcjs.createFarmDocsHandler.call(void 0, docs, {
330
+ const handler = _chunkVZJR7UTGcjs.createFarmDocsHandler.call(void 0, docs, {
325
331
  root: options.root,
326
332
  srcDir: options.srcDir,
327
333
  clientEntry: options.clientEntry,
@@ -329,7 +335,7 @@ async function compileFarmDocsManifest(docs, options) {
329
335
  fontStylesheetHref: options.fontStylesheetHref,
330
336
  globalStylesheetHref: options.globalStylesheetHref
331
337
  });
332
- const apiHandler = _chunkA5FGU2WUcjs.createFarmDocsAPIHandler.call(void 0, {
338
+ const apiHandler = _chunk3UH7MRCPcjs.createFarmDocsAPIHandler.call(void 0, {
333
339
  rootDir: options.root,
334
340
  srcDir: options.srcDir,
335
341
  docs
@@ -421,7 +427,7 @@ async function compileFarmDocsManifest(docs, options) {
421
427
  post: await compileResponse(postResponse, absolutePaths),
422
428
  search: {
423
429
  pages: pages.map((page) => ({
424
- ..._chunkZ2YLTERKcjs.toFarmDocsMarkdownPage.call(void 0, page),
430
+ ..._chunkVZJR7UTGcjs.toFarmDocsMarkdownPage.call(void 0, page),
425
431
  sourcePath: `farm-docs:${page.slug || "index"}`
426
432
  })),
427
433
  search: _nullishCoalesce(searchConfig, () => ( true)),
@@ -441,7 +447,7 @@ async function createFarmRouteRuntimeManifest(options) {
441
447
  const routes = [];
442
448
  for (const [pattern, entry] of options.routeManager.getRoutes()) {
443
449
  const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
444
- const rendering = await _chunkQJ3J6MZTcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
450
+ const rendering = await _chunk3BHT4WMPcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
445
451
  const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
446
452
  routes.push({
447
453
  kind: "page",
@@ -1580,7 +1586,7 @@ function hasFarmMiddlewareConfig(config) {
1580
1586
  _chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmMiddlewareConfig, "hasFarmMiddlewareConfig");
1581
1587
  function hasFarmServerRuntimePlugins(config) {
1582
1588
  return (config.plugins || []).some((plugin) => {
1583
- if (_chunkTDFPACVXcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) === false) return false;
1589
+ if (_chunkFTFYRMQQcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) === false) return false;
1584
1590
  return Boolean(
1585
1591
  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
1586
1592
  );
@@ -1593,7 +1599,7 @@ function hasFarmPluginRoutes(config) {
1593
1599
  _chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmPluginRoutes, "hasFarmPluginRoutes");
1594
1600
  function farmServerRuntimePluginsMayHandlePath(config, pathname) {
1595
1601
  return (config.plugins || []).some(
1596
- (plugin) => _chunkTDFPACVXcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && _chunkSJVKK4JEcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
1602
+ (plugin) => _chunkFTFYRMQQcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && _chunkICUQICNCcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
1597
1603
  );
1598
1604
  }
1599
1605
  _chunkS3JO3N4Hcjs.__name.call(void 0, farmServerRuntimePluginsMayHandlePath, "farmServerRuntimePluginsMayHandlePath");
@@ -1619,13 +1625,13 @@ async function discoverMiddlewareRoutes(appDir) {
1619
1625
  });
1620
1626
  }
1621
1627
  for (const entry of entries) {
1622
- if (!entry.isDirectory() || entry.name.startsWith(".") || entry.name.startsWith("_")) {
1628
+ if (!entry.isDirectory() || entry.name.startsWith(".")) {
1623
1629
  continue;
1624
1630
  }
1625
1631
  await walk(
1626
1632
  _path2.default.join(dir, entry.name),
1627
- _chunkU74I55WBcjs.appendMiddlewareRoutePath.call(void 0, routePath, entry.name),
1628
- _chunkU74I55WBcjs.appendMiddlewareDirectory.call(void 0, directory, entry.name),
1633
+ _chunkULAWS2PAcjs.appendMiddlewareRoutePath.call(void 0, routePath, entry.name),
1634
+ _chunkULAWS2PAcjs.appendMiddlewareDirectory.call(void 0, directory, entry.name),
1629
1635
  discovered
1630
1636
  );
1631
1637
  }
@@ -1638,7 +1644,7 @@ async function discoverMiddlewareRoutes(appDir) {
1638
1644
  routes.set(route.directory, route);
1639
1645
  }
1640
1646
  }
1641
- return Array.from(routes.values()).sort(_chunkU74I55WBcjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
1647
+ return Array.from(routes.values()).sort(_chunkULAWS2PAcjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
1642
1648
  }
1643
1649
  _chunkS3JO3N4Hcjs.__name.call(void 0, discoverMiddlewareRoutes, "discoverMiddlewareRoutes");
1644
1650
  function assertFarmDocsRuntimeSupported(config, preset) {
@@ -1656,7 +1662,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
1656
1662
  assertFarmDocsRuntimeSupported(config, preset);
1657
1663
  const srcDir = config.srcDir || "src";
1658
1664
  const distDir = config.distDir || ".farm";
1659
- const deployOutputDir = _chunkPQDFUSXDcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
1665
+ const deployOutputDir = _chunkF7JZENPFcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
1660
1666
  const lifecyclePluginManager = options.pluginManager;
1661
1667
  const productionViteResultPromise = Promise.allSettled([
1662
1668
  Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))
@@ -1675,9 +1681,10 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
1675
1681
  const routeRuntimeManifestResultPromise = Promise.allSettled([routeRuntimeManifestPromise]);
1676
1682
  const pageRoutes = [];
1677
1683
  for (const [pattern, entry] of routeManager.getRoutes()) {
1678
- const markdownSourcePath = entry.markdownSourcePath || (_chunkUX5S4JEOcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
1684
+ const markdownSourcePath = entry.markdownSourcePath || (_chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
1679
1685
  pageRoutes.push({
1680
1686
  pattern,
1687
+ ...entry.directory ? { directory: entry.directory } : {},
1681
1688
  modulePath: entry.modulePath,
1682
1689
  ...markdownSourcePath ? {
1683
1690
  source: _fs.readFileSync.call(void 0, markdownSourcePath, "utf8"),
@@ -1690,6 +1697,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
1690
1697
  (entry) => ({
1691
1698
  name: entry.name,
1692
1699
  ownerPattern: entry.ownerPattern,
1700
+ ...entry.ownerDirectory ? { ownerDirectory: entry.ownerDirectory } : {},
1693
1701
  pattern: entry.pattern,
1694
1702
  modulePath: entry.modulePath,
1695
1703
  containerId: entry.containerId,
@@ -1904,7 +1912,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
1904
1912
  }
1905
1913
  const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
1906
1914
  await fs.writeFile(fontCssPath, normalizedFontCss);
1907
- await fs.writeFile(clientCssPath, _chunkSJVKK4JEcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
1915
+ await fs.writeFile(clientCssPath, _chunkICUQICNCcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
1908
1916
  }
1909
1917
  _chunkS3JO3N4Hcjs.__name.call(void 0, mergeBuiltFontCss, "mergeBuiltFontCss");
1910
1918
  var _IncompleteClientBuildOutputError = class _IncompleteClientBuildOutputError extends Error {
@@ -1954,7 +1962,7 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
1954
1962
  const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${_path2.default.resolve(modulePath)}`;
1955
1963
  let plan = cache.get(key);
1956
1964
  if (!plan) {
1957
- plan = _chunkSJVKK4JEcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
1965
+ plan = _chunkICUQICNCcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
1958
1966
  cache.set(key, plan);
1959
1967
  }
1960
1968
  return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
@@ -1972,7 +1980,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
1972
1980
  });
1973
1981
  pluginManager.addPlugins(config.plugins || []);
1974
1982
  const clientPages = [];
1975
- const integrationProviders = _chunkTDFPACVXcjs.getIntegrationProviders.call(void 0, config.integrations).filter(
1983
+ const integrationProviders = _chunkFTFYRMQQcjs.getIntegrationProviders.call(void 0, config.integrations).filter(
1976
1984
  (provider) => provider.component || provider.type === "clerk"
1977
1985
  );
1978
1986
  const unsupportedIntegrationProvider = integrationProviders.find(
@@ -1983,14 +1991,14 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
1983
1991
  `[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
1984
1992
  );
1985
1993
  }
1986
- const isolatedMode = _chunkSJVKK4JEcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
1994
+ const isolatedMode = _chunkICUQICNCcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
1987
1995
  _optionalChain([config, 'access', _35 => _35.experimental, 'optionalAccess', _36 => _36.isolatedClientHydration]),
1988
1996
  {
1989
1997
  serverComponents: _optionalChain([config, 'access', _37 => _37.experimental, 'optionalAccess', _38 => _38.serverComponents]) === true,
1990
1998
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
1991
1999
  }
1992
2000
  );
1993
- const planOptions = _chunkSJVKK4JEcjs.getFarmClientHydrationPlanOptions.call(void 0,
2001
+ const planOptions = _chunkICUQICNCcjs.getFarmClientHydrationPlanOptions.call(void 0,
1994
2002
  config.renderer,
1995
2003
  Boolean(unsupportedIntegrationProvider)
1996
2004
  );
@@ -2037,7 +2045,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2037
2045
  };
2038
2046
  }
2039
2047
  });
2040
- const layoutAppliesToRoute = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (layoutPattern, routePattern) => layoutPattern === "/" || routePattern === layoutPattern || routePattern.startsWith(`${layoutPattern}/`), "layoutAppliesToRoute");
2048
+ const layoutAppliesToRoute = _chunkIPXLADVOcjs.routeBoundaryCoversDirectory;
2049
+ const routeDirectory = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (route) => _nullishCoalesce(route.directory, () => ( route.pattern)), "routeDirectory");
2041
2050
  const adapterOwnsDocsRuntime = Boolean(
2042
2051
  _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _39 => _39.docs, 'optionalAccess', _40 => _40.enabled]) && _optionalChain([config, 'access', _41 => _41.docs, 'access', _42 => _42.adapter, 'optionalAccess', _43 => _43.server]) && config.docs.adapter.react
2043
2052
  );
@@ -2047,7 +2056,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2047
2056
  ), "isAdapterDocsRoute");
2048
2057
  const syntheticDocsEntry = _optionalChain([config, 'access', _46 => _46.docs, 'optionalAccess', _47 => _47.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
2049
2058
  const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
2050
- const markdownPagePlan = _chunkSJVKK4JEcjs.createMarkdownPageHydrationPlanner.call(void 0,
2059
+ const markdownPagePlan = _chunkICUQICNCcjs.createMarkdownPageHydrationPlanner.call(void 0,
2051
2060
  _chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), root),
2052
2061
  root,
2053
2062
  isolatedMode,
@@ -2055,7 +2064,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2055
2064
  );
2056
2065
  const routePlans = pageRoutes.map((route) => ({
2057
2066
  route,
2058
- metadata: _chunkUX5S4JEOcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
2067
+ metadata: _chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
2059
2068
  route.modulePath,
2060
2069
  root,
2061
2070
  isolatedMode,
@@ -2063,7 +2072,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2063
2072
  planOptions
2064
2073
  )
2065
2074
  }));
2066
- _chunkSJVKK4JEcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
2075
+ _chunkICUQICNCcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
2067
2076
  clientLayouts.map((layout) => ({
2068
2077
  pattern: layout.pattern,
2069
2078
  depth: layout.pattern.split("/").filter(Boolean).length,
@@ -2071,8 +2080,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2071
2080
  })),
2072
2081
  [
2073
2082
  ...routePlans.map(({ route, metadata }) => ({
2074
- pattern: route.pattern,
2075
- depth: route.pattern.split("/").filter(Boolean).length,
2083
+ pattern: routeDirectory(route),
2084
+ depth: _chunkIPXLADVOcjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
2076
2085
  metadata
2077
2086
  })),
2078
2087
  ...syntheticDocsPatterns.map((pattern) => ({
@@ -2093,9 +2102,9 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2093
2102
  layoutAppliesToRoute
2094
2103
  );
2095
2104
  for (const layout of clientLayouts) {
2096
- const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, route.pattern)) || Boolean(adapterDocsEntry && layoutAppliesToRoute(layout.pattern, adapterDocsEntry));
2105
+ const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || Boolean(adapterDocsEntry && layoutAppliesToRoute(layout.pattern, adapterDocsEntry));
2097
2106
  if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
2098
- _chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${_chunkSJVKK4JEcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
2107
+ _chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${_chunkICUQICNCcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
2099
2108
  }
2100
2109
  }
2101
2110
  if (isolatedMode === "analyze") {
@@ -2115,11 +2124,11 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2115
2124
  if (isAdapterDocsRoute(route.pattern)) continue;
2116
2125
  try {
2117
2126
  const applicableClientLayouts = clientLayouts.filter(
2118
- (layout) => (layout.shouldHydrate || layout.hasIsolatedClientBoundaries) && layoutAppliesToRoute(layout.pattern, route.pattern)
2127
+ (layout) => (layout.shouldHydrate || layout.hasIsolatedClientBoundaries) && layoutAppliesToRoute(layout.pattern, routeDirectory(route))
2119
2128
  );
2120
2129
  if (metadata.suppressedAsyncHydration) {
2121
2130
  _chunk5QIKR7RRcjs.logger.warn(
2122
- `\u26A0\uFE0F ${_chunkSJVKK4JEcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
2131
+ `\u26A0\uFE0F ${_chunkICUQICNCcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
2123
2132
  );
2124
2133
  }
2125
2134
  if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0) {
@@ -2142,7 +2151,9 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2142
2151
  isolatedBoundaries: [
2143
2152
  ...metadata.hasIsolatedClientBoundaries ? metadata.isolatedBoundaries : [],
2144
2153
  ...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries).flatMap((layout) => layout.isolatedBoundaries)
2145
- ]
2154
+ ],
2155
+ // The server renders a server tree only below a hydrating layout.
2156
+ ..._chunkICUQICNCcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
2146
2157
  });
2147
2158
  _chunk5QIKR7RRcjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
2148
2159
  }
@@ -2178,7 +2189,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2178
2189
  }
2179
2190
  const clientRouteSlots = routeSlots.filter((slot) => {
2180
2191
  try {
2181
- return _chunkSJVKK4JEcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
2192
+ return _chunkICUQICNCcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
2182
2193
  } catch (error) {
2183
2194
  _chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
2184
2195
  return false;
@@ -2206,10 +2217,10 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2206
2217
  config.renderer,
2207
2218
  config.publicRuntimeConfig,
2208
2219
  config.trailingSlash,
2209
- _chunkTDFPACVXcjs.getIntegrationProviders.call(void 0, config.integrations),
2220
+ _chunkFTFYRMQQcjs.getIntegrationProviders.call(void 0, config.integrations),
2210
2221
  config.basePath,
2211
- _chunkSJVKK4JEcjs.generateClientCachePersistenceCode.call(void 0, _chunkSJVKK4JEcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
2212
- adapterOwnsDocsRuntime ? _chunk75WGQVQAcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
2222
+ _chunkICUQICNCcjs.generateClientCachePersistenceCode.call(void 0, _chunkICUQICNCcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
2223
+ adapterOwnsDocsRuntime ? _chunkHITLGIAOcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
2213
2224
  );
2214
2225
  await fs.writeFile(clientEntryPath, clientHydrationCode);
2215
2226
  const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
@@ -2225,7 +2236,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2225
2236
  const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
2226
2237
  await fs.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
2227
2238
  postcssSearchPath = clientEntryDir;
2228
- tailwindVitePlugin = await _chunkSJVKK4JEcjs.loadTailwindVitePlugin.call(void 0, {
2239
+ tailwindVitePlugin = await _chunkICUQICNCcjs.loadTailwindVitePlugin.call(void 0, {
2229
2240
  builder: productionVite.builder,
2230
2241
  announce: true
2231
2242
  });
@@ -2294,11 +2305,14 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2294
2305
  }
2295
2306
  },
2296
2307
  plugins: [
2297
- _chunkSJVKK4JEcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
2308
+ _chunkICUQICNCcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
2298
2309
  ...tailwindVitePlugin ? [tailwindVitePlugin] : [],
2299
2310
  ...rendererVitePlugins,
2300
2311
  ...config.vite.plugins || [],
2301
2312
  farmServerOnlyEntriesPlugin(),
2313
+ _chunkICUQICNCcjs.farmDocsClientConfigPlugin.call(void 0,
2314
+ adapterOwnsDocsRuntime ? _chunkHITLGIAOcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
2315
+ ),
2302
2316
  // Plugin to redirect @farm.js/core imports to client-only exports
2303
2317
  {
2304
2318
  name: "farm-client-only-imports",
@@ -2355,7 +2369,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2355
2369
  } : void 0,
2356
2370
  // Ensure React is bundled for client
2357
2371
  resolve: {
2358
- alias: _chunkSJVKK4JEcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
2372
+ alias: _chunkICUQICNCcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
2359
2373
  dedupe: [...config.renderer.dedupe || []]
2360
2374
  },
2361
2375
  // Optimize dependencies - exclude server-side code from client bundle
@@ -2368,7 +2382,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2368
2382
  ]
2369
2383
  }
2370
2384
  };
2371
- await viteBuild(_chunkSJVKK4JEcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
2385
+ await viteBuild(_chunkICUQICNCcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
2372
2386
  await mergeBuiltFontCss(outputDir);
2373
2387
  await validateClientBuildOutput(root, srcDir, outputDir);
2374
2388
  } finally {
@@ -3127,7 +3141,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
3127
3141
  direction: {}
3128
3142
  }, plugins = [], renderer = _chunkPSV6XKPOcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule) {
3129
3143
  const toImportPath = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (targetPath) => targetPath.replace(/\\/g, "/"), "toImportPath");
3130
- const clientPluginEntry = _chunkSJVKK4JEcjs.generateFarmClientPluginEntryCode.call(void 0,
3144
+ const clientPluginEntry = _chunkICUQICNCcjs.generateFarmClientPluginEntryCode.call(void 0,
3131
3145
  plugins,
3132
3146
  root,
3133
3147
  srcDir,
@@ -3138,7 +3152,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
3138
3152
  import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
3139
3153
  import __farmAppSetup from ${JSON.stringify(_chunk5QIKR7RRcjs.toPosixPath.call(void 0, appSetupPath))};
3140
3154
  __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
3141
- const providerClientCode = _chunkSJVKK4JEcjs.generateFarmIntegrationProviderClientCode.call(void 0,
3155
+ const providerClientCode = _chunkICUQICNCcjs.generateFarmIntegrationProviderClientCode.call(void 0,
3142
3156
  integrationProviders,
3143
3157
  root,
3144
3158
  _nullishCoalesce(renderer.componentExtensions, () => ( []))
@@ -3152,8 +3166,10 @@ __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot
3152
3166
  if (!layout.hasIsolatedClientBoundaries) {
3153
3167
  layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
3154
3168
  }
3169
+ const groupScope = _chunkIPXLADVOcjs.getRouteGroupScope.call(void 0, layout.pattern);
3170
+ const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(_chunkIPXLADVOcjs.stripRouteGroups.call(void 0, layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
3155
3171
  layoutRegistrations.push(
3156
- ` { pattern: ${JSON.stringify(layout.pattern)}, Component: ${layout.hasIsolatedClientBoundaries ? "null" : `Layout${index}`}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)} }`
3172
+ ` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${layout.hasIsolatedClientBoundaries ? "null" : `Layout${index}`}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)} }`
3157
3173
  );
3158
3174
  });
3159
3175
  const layoutImports = layoutImportStatements.join("\n");
@@ -3201,7 +3217,7 @@ function isFarmDocsPath() {
3201
3217
  return false;
3202
3218
  }
3203
3219
  `;
3204
- const docsAdapterRuntime = _chunk75WGQVQAcjs.generateFarmDocsAdapterClientRuntime.call(void 0,
3220
+ const docsAdapterRuntime = _chunkHITLGIAOcjs.generateFarmDocsAdapterClientRuntime.call(void 0,
3205
3221
  docsAdapterReact,
3206
3222
  docsConfigModule
3207
3223
  );
@@ -3498,7 +3514,8 @@ document.addEventListener("click", function(e) {
3498
3514
  }
3499
3515
  const load = page.pageShouldHydrate ? `() => import(${JSON.stringify(toImportPath(page.modulePath))}).then((module) => module.default)` : "null";
3500
3516
  routeEntries.push(` {
3501
- pattern: ${JSON.stringify(page.pattern)},
3517
+ pattern: ${JSON.stringify(page.pattern)},${page.directory ? `
3518
+ directory: ${JSON.stringify(page.directory)},` : ""}
3502
3519
  pageShouldHydrate: ${JSON.stringify(page.pageShouldHydrate)},
3503
3520
  ${page.hasIsolatedClientBoundaries ? "hasIsolatedClientBoundaries: true," : ""}
3504
3521
  islandStrategy: ${JSON.stringify(page.islandStrategy)},
@@ -3507,20 +3524,22 @@ document.addEventListener("click", function(e) {
3507
3524
  }`);
3508
3525
  });
3509
3526
  const isolatedHydrationEnabled = isolatedBoundaryModules.size > 0;
3510
- const isolatedHydrationImport = isolatedHydrationEnabled ? `import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";` : "";
3527
+ const serverTreeEnabled = isolatedHydrationEnabled && clientPages.some((page) => page.serverTree);
3528
+ const isolatedHydrationImport = isolatedHydrationEnabled ? `import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";${serverTreeEnabled ? '\nimport { createFarmServerTreeElement } from "@farm.js/core/internal/server-tree";' : ""}` : "";
3511
3529
  const isolatedHydrationRuntime = isolatedHydrationEnabled ? `const farmIsolatedBoundaryLoaders = {
3512
3530
  ${Array.from(isolatedBoundaryModules.entries()).map(
3513
3531
  ([reference, modulePath]) => ` ${JSON.stringify(reference)}: () => import(${JSON.stringify(modulePath)}),`
3514
3532
  ).join("\n")}
3515
3533
  };
3534
+ async function loadFarmIsolatedBoundary(reference) {
3535
+ const loader = farmIsolatedBoundaryLoaders[reference];
3536
+ if (!loader) throw new Error("isolated client boundary loader was not found: " + reference);
3537
+ return loader();
3538
+ }
3516
3539
  const farmIsolatedHydrationRuntime = createFarmIsolatedHydrationRuntime({
3517
3540
  ReactRuntime: React,
3518
3541
  hydrateRoot,
3519
- load: async function(reference) {
3520
- const loader = farmIsolatedBoundaryLoaders[reference];
3521
- if (!loader) throw new Error("isolated client boundary loader was not found: " + reference);
3522
- return loader();
3523
- },
3542
+ load: loadFarmIsolatedBoundary,
3524
3543
  schedule: scheduleFarmIslandHydration,
3525
3544
  wrap: wrapWithIntegrationProviders,
3526
3545
  });
@@ -3534,7 +3553,21 @@ function disposeFarmIsolatedClientBoundaries(scope) {
3534
3553
 
3535
3554
  async function hydrateFarmIsolatedClientBoundaries(scope = document, signal) {
3536
3555
  await farmIsolatedHydrationRuntime.hydrate(scope, signal);
3537
- }` : "";
3556
+ }
3557
+ ${serverTreeEnabled ? `
3558
+ // A server-tree page (an async page below a hydrating layout) rebuilds in the layout's root.
3559
+ async function createFarmServerTreePageElement(source, pathname) {
3560
+ try {
3561
+ return await createFarmServerTreeElement(React, source, {
3562
+ load: loadFarmIsolatedBoundary,
3563
+ ServerHtml: FarmServerPage,
3564
+ key: pathname,
3565
+ });
3566
+ } catch (error) {
3567
+ console.warn("[Farm.js] Could not rebuild the server tree of " + pathname + "; its server HTML was kept.", error);
3568
+ return null;
3569
+ }
3570
+ }` : "async function createFarmServerTreePageElement() { return null; }"}` : `async function createFarmServerTreePageElement() { return null; }`;
3538
3571
  const routeClientGraphRuntime = isolatedHydrationEnabled ? `function wrapFarmRouteClientGraph(element) {
3539
3572
  return wrapFarmIsolatedClientGraph(React, element);
3540
3573
  }` : `function wrapFarmRouteClientGraph(element) { return element; }`;
@@ -3601,11 +3634,24 @@ ${layoutRegistrations.join(",\n")}
3601
3634
  function getApplicableLayouts(pathname) {
3602
3635
  const applicable = [];
3603
3636
  const normalizedPath = getFarmRoutePathname(pathname).replace(/\\/$/, '') || '/';
3637
+ let directory;
3604
3638
 
3605
3639
  for (const layout of layoutRoutes) {
3606
- if (layout.pattern === '/' || isFarmRouteActive(layout.pattern, normalizedPath, { exact: false })) {
3607
- applicable.push(layout);
3640
+ // Route groups add no URL segment: match the layout's URL, then keep a
3641
+ // grouped layout to the pages inside its group directory.
3642
+ const urlPattern = layout.urlPattern || layout.pattern;
3643
+ if (urlPattern !== '/' && !isFarmRouteActive(urlPattern, normalizedPath, { exact: false })) continue;
3644
+ if (layout.groupScope) {
3645
+ if (directory === undefined) {
3646
+ const matched = matchRoute(pathname);
3647
+ directory = matched ? matched.route.directory || matched.route.pattern : null;
3648
+ }
3649
+ if (
3650
+ typeof directory !== 'string' ||
3651
+ (directory !== layout.groupScope && !directory.startsWith(layout.groupScope + '/'))
3652
+ ) continue;
3608
3653
  }
3654
+ applicable.push(layout);
3609
3655
  }
3610
3656
 
3611
3657
  // Sort by depth (root first)
@@ -3624,7 +3670,7 @@ function hasHydratableLayout(pathname) {
3624
3670
  });
3625
3671
  }
3626
3672
 
3627
- ${_chunkSJVKK4JEcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
3673
+ ${_chunkICUQICNCcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
3628
3674
  // Wrap a page element with applicable layouts
3629
3675
  function wrapWithLayouts(pageElement, pathname, params) {
3630
3676
  const layouts = getApplicableLayouts(pathname);
@@ -3674,6 +3720,16 @@ async function loadRouteComponent(route) {
3674
3720
  return route.Component;
3675
3721
  }
3676
3722
 
3723
+ // The props the server rendered this document with, as the page receives them:
3724
+ // middleware data arrives as a plain object and is a Map again here.
3725
+ function reviveServerPageProps(serverProps) {
3726
+ if (!serverProps || typeof serverProps !== "object") return {};
3727
+ const middleware = serverProps.middleware;
3728
+ return middleware && middleware.data && !(middleware.data instanceof Map)
3729
+ ? { ...serverProps, middleware: { ...middleware, data: new Map(Object.entries(middleware.data)) } }
3730
+ : serverProps;
3731
+ }
3732
+
3677
3733
  async function createMatchedHydrationRoute(matched, pathname, searchParams, serverHtml, serverProps) {
3678
3734
  const hydrateLayouts = hasHydratableLayout(pathname);
3679
3735
  const params = matched.params;
@@ -3687,12 +3743,8 @@ async function createMatchedHydrationRoute(matched, pathname, searchParams, serv
3687
3743
  // rejected guard, deferred data) its server-rendered HTML is kept.
3688
3744
  if (Component.__farmServerProps === true) {
3689
3745
  if (!serverProps || serverProps.__farmRoutePropsResolved !== true) return null;
3690
- const middleware = serverProps.middleware;
3691
3746
  const props = {
3692
- ...serverProps,
3693
- ...(middleware && middleware.data && !(middleware.data instanceof Map)
3694
- ? { middleware: { ...middleware, data: new Map(Object.entries(middleware.data)) } }
3695
- : {}),
3747
+ ...reviveServerPageProps(serverProps),
3696
3748
  searchParams: Promise.resolve(serverProps.search ?? searchParams),
3697
3749
  };
3698
3750
  pageElement = React.createElement(Component, props);
@@ -3703,16 +3755,26 @@ async function createMatchedHydrationRoute(matched, pathname, searchParams, serv
3703
3755
  );
3704
3756
  return null;
3705
3757
  } else {
3706
- const props = { params: params, searchParams: Promise.resolve(searchParams) };
3758
+ // Keep what the server rendered with, such as middleware data, so the
3759
+ // first render matches the HTML. A navigation passes the fetched document's props.
3760
+ const props = {
3761
+ ...reviveServerPageProps(serverProps),
3762
+ params: params,
3763
+ searchParams: Promise.resolve(searchParams),
3764
+ };
3707
3765
  pageElement = React.createElement(Component, props);
3708
3766
  }
3709
3767
  } else if (hydrateLayouts) {
3710
3768
  const serverPage = document.getElementById("__farm_page__");
3711
- pageElement = createLayoutPageBoundary(
3712
- matched.route,
3713
- null,
3714
- typeof serverHtml === "string" ? serverHtml : serverPage ? serverPage.innerHTML : "",
3715
- );
3769
+ const pageSource = typeof serverHtml === "string" ? serverHtml : serverPage;
3770
+ const serverTree = pageSource ? await createFarmServerTreePageElement(pageSource, pathname) : null;
3771
+ pageElement = serverTree
3772
+ ? createLayoutPageBoundary(matched.route, serverTree)
3773
+ : createLayoutPageBoundary(
3774
+ matched.route,
3775
+ null,
3776
+ typeof serverHtml === "string" ? serverHtml : serverPage ? serverPage.innerHTML : "",
3777
+ );
3716
3778
  }
3717
3779
 
3718
3780
  if (!pageElement) return null;
@@ -4587,7 +4649,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4587
4649
  _path2.default.join(postcssConfigDir, "postcss.config.cjs"),
4588
4650
  "module.exports = { plugins: [] };\n"
4589
4651
  );
4590
- tailwindVitePlugin = await _chunkSJVKK4JEcjs.loadTailwindVitePlugin.call(void 0, {
4652
+ tailwindVitePlugin = await _chunkICUQICNCcjs.loadTailwindVitePlugin.call(void 0, {
4591
4653
  builder: productionVite.builder,
4592
4654
  label: "for SSR"
4593
4655
  });
@@ -4683,7 +4745,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4683
4745
  }
4684
4746
  const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
4685
4747
  const instrumentationPath = _chunkKCMTCM6Icjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
4686
- const notFoundPath = _chunkSJVKK4JEcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
4748
+ const notFoundPath = _chunkICUQICNCcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
4687
4749
  if (notFoundPath) _chunk5QIKR7RRcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
4688
4750
  layoutRoutes.sort((a, b) => {
4689
4751
  const depthA = a.pattern.split("/").filter(Boolean).length;
@@ -4700,13 +4762,13 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4700
4762
  const hasServerRuntimeIntegrations = configuredIntegrationValues.some(
4701
4763
  (integration) => typeof integration === "object" && integration !== null && (!("serverRuntime" in integration) || integration.serverRuntime !== false)
4702
4764
  );
4703
- const hasIntegrationProviders = _chunkTDFPACVXcjs.getIntegrationProviders.call(void 0, config.integrations).some(
4765
+ const hasIntegrationProviders = _chunkFTFYRMQQcjs.getIntegrationProviders.call(void 0, config.integrations).some(
4704
4766
  (provider) => provider.component || provider.type === "clerk"
4705
4767
  );
4706
4768
  const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
4707
4769
  const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _56 => _56.mdx, 'optionalAccess', _57 => _57.components]));
4708
4770
  const hasMiddlewareConfig = hasFarmMiddlewareConfig(config.middleware);
4709
- const hasRouteContextConfig = _chunkPQDFUSXDcjs.hasCustomFarmRouteContext.call(void 0, config);
4771
+ const hasRouteContextConfig = _chunkF7JZENPFcjs.hasCustomFarmRouteContext.call(void 0, config);
4710
4772
  const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
4711
4773
  const hasPluginRoutes = hasFarmPluginRoutes(config);
4712
4774
  const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
@@ -4716,7 +4778,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4716
4778
  const hasConfiguredRuntimePlugins = Boolean(
4717
4779
  hasRuntimeConfigModule && (config.plugins || []).length > 0
4718
4780
  );
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, {
4781
+ const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _58 => _58.docs, 'optionalAccess', _59 => _59.enabled]) && _chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? _optionalChain([config, 'access', _60 => _60.docs, 'access', _61 => _61.adapter, 'optionalAccess', _62 => _62.server]) ? await _chunk3UH7MRCPcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
4720
4782
  root,
4721
4783
  srcDir: config.srcDir,
4722
4784
  clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
@@ -4866,7 +4928,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4866
4928
  __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _68 => _68.env, 'optionalAccess', _69 => _69.public]) || {})
4867
4929
  },
4868
4930
  plugins: [
4869
- _chunkSJVKK4JEcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
4931
+ _chunkICUQICNCcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
4870
4932
  ...tailwindVitePlugin ? [tailwindVitePlugin] : [],
4871
4933
  ...rendererVitePlugins,
4872
4934
  ...config.vite.plugins || [],
@@ -4913,7 +4975,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4913
4975
  resolve: {
4914
4976
  alias: [
4915
4977
  ...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
4916
- ...Object.entries(_chunkSJVKK4JEcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
4978
+ ...Object.entries(_chunkICUQICNCcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
4917
4979
  ([find, replacement]) => ({ find, replacement })
4918
4980
  )
4919
4981
  ],
@@ -4921,7 +4983,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4921
4983
  dedupe: [...config.renderer.dedupe || []]
4922
4984
  }
4923
4985
  };
4924
- await viteBuild(_chunkSJVKK4JEcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
4986
+ await viteBuild(_chunkICUQICNCcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
4925
4987
  } finally {
4926
4988
  if (postcssConfigDir) {
4927
4989
  try {
@@ -5107,8 +5169,8 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, generateConfiguredResponseHeadersRuntimeSo
5107
5169
  function parseRouteRenderingDirectiveFromDisk(modulePath) {
5108
5170
  try {
5109
5171
  const source = _fs.readFileSync.call(void 0, modulePath, "utf8");
5110
- const directive = _chunkQJ3J6MZTcjs.parseRouteRenderingDirective.call(void 0, source);
5111
- if (_chunkQJ3J6MZTcjs.findRequestBoundSourceBlockers.call(void 0, source).length === 0) return directive;
5172
+ const directive = _chunk3BHT4WMPcjs.parseRouteRenderingDirective.call(void 0, source);
5173
+ if (_chunk3BHT4WMPcjs.findRequestBoundSourceBlockers.call(void 0, source).length === 0) return directive;
5112
5174
  return { ..._nullishCoalesce(directive, () => ( { ssg: false, ppr: false, directive: "" })), requestBound: true };
5113
5175
  } catch (e22) {
5114
5176
  return void 0;
@@ -5300,11 +5362,12 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
5300
5362
  const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _76 => _76.agent, 'optionalAccess', _77 => _77.crawlers, 'optionalAccess', _78 => _78.enabled])) && !applicationMetadataRoutes.some(
5301
5363
  (metadata) => metadata.kind === "robots" && metadata.pattern === "/"
5302
5364
  );
5365
+ const servesAiCatalog = _optionalChain([config, 'access', _79 => _79.agent, 'optionalAccess', _80 => _80.aiCatalog]) !== false;
5303
5366
  const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
5304
5367
  const hasInfraAnalyticsRuntime = config.analytics !== false && _chunk2SJ4RQ6Pcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
5305
5368
  const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
5306
5369
  const adapterOwnsDocsRuntime = Boolean(
5307
- _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _79 => _79.docs, 'optionalAccess', _80 => _80.enabled]) && _optionalChain([config, 'access', _81 => _81.docs, 'access', _82 => _82.adapter, 'optionalAccess', _83 => _83.server]) && config.docs.adapter.react
5370
+ _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _81 => _81.docs, 'optionalAccess', _82 => _82.enabled]) && _optionalChain([config, 'access', _83 => _83.docs, 'access', _84 => _84.adapter, 'optionalAccess', _85 => _85.server]) && config.docs.adapter.react
5308
5371
  );
5309
5372
  const docsConfigModulePath = adapterOwnsDocsRuntime && !hasPrecompiledDocs && config.docs.configPath && !config.docs.configPath.endsWith(".json") ? config.docs.configPath : void 0;
5310
5373
  const hasIsolatedClientGraphRuntime = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && isolatedClientBoundaryModules.size > 0;
@@ -5314,7 +5377,7 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
5314
5377
  );
5315
5378
  const hasReactSyncRender = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer);
5316
5379
  const rendererServerImports = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) ? `import * as React from "react";
5317
- import * as ReactDOMServer from "react-dom/server";${hasIsolatedClientGraphRuntime ? '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";' : ""}` : `import React, * as ReactDOMServer from ${JSON.stringify(config.renderer.server)};${generateFarmRendererAppSetupServerCode(config)}`;
5380
+ import * as ReactDOMServer from "react-dom/server";${hasIsolatedClientGraphRuntime ? '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";\nimport { renderFarmServerTreePage } from "@farm.js/core/internal/server-tree";' : ""}` : `import React, * as ReactDOMServer from ${JSON.stringify(config.renderer.server)};${generateFarmRendererAppSetupServerCode(config)}`;
5318
5381
  const routeClientGraphServerRuntime = hasIsolatedClientGraphRuntime ? `function wrapFarmRouteClientGraph(element) {
5319
5382
  return wrapFarmIsolatedClientGraph(React, element);
5320
5383
  }
@@ -5323,15 +5386,23 @@ import * as ReactDOMServer from "react-dom/server";${hasIsolatedClientGraphRunti
5323
5386
  // components render as their own islands instead of joining the layout's React tree.
5324
5387
  function isolateFarmRouteServerPage(element) {
5325
5388
  return isolateFarmServerPageGraph(React, element);
5389
+ }
5390
+
5391
+ // An async page below a hydrating layout renders as a serialized tree the browser rebuilds in
5392
+ // the layout's React root, so its client components read the layout's context.
5393
+ function renderFarmRouteServerTree(element) {
5394
+ return renderFarmServerTreePage(React, element, { isolate: isolateFarmRouteServerPage });
5326
5395
  }` : `function wrapFarmRouteClientGraph(element) { return element; }
5327
5396
 
5328
- function isolateFarmRouteServerPage(element) { return element; }`;
5397
+ function isolateFarmRouteServerPage(element) { return element; }
5398
+
5399
+ function renderFarmRouteServerTree(element) { return element; }`;
5329
5400
  const hasGeneratedMetadataImages = metadataImageRoutes.some(
5330
5401
  (image) => image.sourceType === "module"
5331
5402
  );
5332
5403
  const hasMiddlewareRuntime = middlewareRoutes.length > 0 || hasFarmMiddlewareConfig(config.middleware);
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)) : [];
5334
- const integrationProviders = _chunkTDFPACVXcjs.getIntegrationProviders.call(void 0, config.integrations);
5404
+ const farmDocsFontAssets = _optionalChain([config, 'access', _86 => _86.docs, 'optionalAccess', _87 => _87.enabled]) ? _chunkHREOKQWTcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkHREOKQWTcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
5405
+ const integrationProviders = _chunkFTFYRMQQcjs.getIntegrationProviders.call(void 0, config.integrations);
5335
5406
  const renderedIntegrationProviders = integrationProviders.filter(
5336
5407
  (provider) => provider.component || provider.type === "clerk"
5337
5408
  );
@@ -5340,16 +5411,16 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5340
5411
  `Integration provider components are not supported by the "${config.renderer.name}" renderer.`
5341
5412
  );
5342
5413
  }
5343
- const providerServerModules = _chunkSJVKK4JEcjs.generateFarmIntegrationProviderServerModules.call(void 0,
5414
+ const providerServerModules = _chunkICUQICNCcjs.generateFarmIntegrationProviderServerModules.call(void 0,
5344
5415
  renderedIntegrationProviders,
5345
5416
  config.root,
5346
5417
  _nullishCoalesce(config.renderer.componentExtensions, () => ( []))
5347
5418
  );
5348
5419
  const resolvedIntegrationProviderFallback = Object.fromEntries(
5349
5420
  Object.entries(config.integrations).flatMap(([name, integration]) => {
5350
- const configuredProviders = _optionalChain([integration, 'optionalAccess', _86 => _86.providers]);
5421
+ const configuredProviders = _optionalChain([integration, 'optionalAccess', _88 => _88.providers]);
5351
5422
  const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
5352
- if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _87 => _87.component]) === "function")) {
5423
+ if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _89 => _89.component]) === "function")) {
5353
5424
  throw new Error(
5354
5425
  `Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
5355
5426
  );
@@ -5360,18 +5431,17 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5360
5431
  const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
5361
5432
  (provider) => provider.supportsIsolatedHydration !== true
5362
5433
  );
5363
- const isolatedHydrationMode = _chunkSJVKK4JEcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
5364
- _optionalChain([config, 'access', _88 => _88.experimental, 'optionalAccess', _89 => _89.isolatedClientHydration]),
5434
+ const isolatedHydrationMode = _chunkICUQICNCcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
5435
+ _optionalChain([config, 'access', _90 => _90.experimental, 'optionalAccess', _91 => _91.isolatedClientHydration]),
5365
5436
  {
5366
- serverComponents: _optionalChain([config, 'access', _90 => _90.experimental, 'optionalAccess', _91 => _91.serverComponents]) === true,
5437
+ serverComponents: _optionalChain([config, 'access', _92 => _92.experimental, 'optionalAccess', _93 => _93.serverComponents]) === true,
5367
5438
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
5368
5439
  }
5369
5440
  );
5370
- const hydrationPlanOptions = _chunkSJVKK4JEcjs.getFarmClientHydrationPlanOptions.call(void 0,
5441
+ const hydrationPlanOptions = _chunkICUQICNCcjs.getFarmClientHydrationPlanOptions.call(void 0,
5371
5442
  config.renderer,
5372
5443
  Boolean(unsupportedIntegrationProvider)
5373
5444
  );
5374
- const layoutAppliesToRoute = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (layoutPattern, routePattern) => layoutPattern === "/" || routePattern === layoutPattern || routePattern.startsWith(`${layoutPattern}/`), "layoutAppliesToRoute");
5375
5445
  const layoutHydrationPlans = layoutRoutes.map((layout) => ({
5376
5446
  ...layout,
5377
5447
  hydration: getCachedClientModuleHydrationPlan(
@@ -5382,7 +5452,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5382
5452
  hydrationPlanOptions
5383
5453
  )
5384
5454
  }));
5385
- const markdownPagePlan = _chunkSJVKK4JEcjs.createMarkdownPageHydrationPlanner.call(void 0,
5455
+ const markdownPagePlan = _chunkICUQICNCcjs.createMarkdownPageHydrationPlanner.call(void 0,
5386
5456
  _chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
5387
5457
  config.root,
5388
5458
  isolatedHydrationMode,
@@ -5391,7 +5461,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5391
5461
  const pageHydrationPlans = new Map(
5392
5462
  pageRoutes.map((route) => [
5393
5463
  route.modulePath,
5394
- _chunkUX5S4JEOcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
5464
+ _chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
5395
5465
  route.modulePath,
5396
5466
  config.root,
5397
5467
  isolatedHydrationMode,
@@ -5400,18 +5470,19 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5400
5470
  )
5401
5471
  ])
5402
5472
  );
5403
- _chunkSJVKK4JEcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
5473
+ _chunkICUQICNCcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
5404
5474
  layoutHydrationPlans.map((layout) => ({
5405
5475
  pattern: layout.pattern,
5406
5476
  depth: layout.pattern.split("/").filter(Boolean).length,
5407
5477
  metadata: layout.hydration
5408
5478
  })),
5409
5479
  pageRoutes.map((route) => ({
5410
- pattern: route.pattern,
5411
- depth: route.pattern.split("/").filter(Boolean).length,
5480
+ // Compared by directory so a grouped layout applies only inside its group.
5481
+ pattern: _nullishCoalesce(route.directory, () => ( route.pattern)),
5482
+ depth: _chunkIPXLADVOcjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
5412
5483
  metadata: pageHydrationPlans.get(route.modulePath)
5413
5484
  })),
5414
- layoutAppliesToRoute
5485
+ _chunkIPXLADVOcjs.routeBoundaryCoversDirectory
5415
5486
  );
5416
5487
  const providerServerImports = [
5417
5488
  providerServerModules.hasClerkProvider ? `import { ClerkProvider as FarmClerkProvider } from "@clerk/react";` : "",
@@ -5428,7 +5499,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5428
5499
  apiRegistrations.push(`
5429
5500
  {
5430
5501
  path: ${JSON.stringify(route.path)},
5431
- methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _92 => _92.pluginMethods, 'optionalAccess', _93 => _93.includes, 'call', _94 => _94(method)])))},
5502
+ methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _94 => _94.pluginMethods, 'optionalAccess', _95 => _95.includes, 'call', _96 => _96(method)])))},
5432
5503
  endpoints: ${varName},
5433
5504
  }`);
5434
5505
  });
@@ -5441,10 +5512,11 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5441
5512
  }).map(({ route }) => route);
5442
5513
  orderedPageRoutes.forEach((route, index) => {
5443
5514
  const varName = `pageRoute${index}`;
5444
- if (_chunkUX5S4JEOcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
5515
+ if (_chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
5445
5516
  pageRegistrations.push(`
5446
5517
  {
5447
- pattern: ${JSON.stringify(route.pattern)},
5518
+ pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
5519
+ directory: ${JSON.stringify(route.directory)},` : ""}
5448
5520
  module: createFarmMarkdownRouteModule({
5449
5521
  source: ${JSON.stringify(_nullishCoalesce(route.source, () => ( "")))},
5450
5522
  filePath: ${JSON.stringify(toBakedMarkdownSourcePath(config.root, route.modulePath))},
@@ -5467,10 +5539,11 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5467
5539
  const renderingDirective = parseRouteRenderingDirectiveFromDisk(route.modulePath);
5468
5540
  pageRegistrations.push(`
5469
5541
  {
5470
- pattern: ${JSON.stringify(route.pattern)},
5542
+ pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
5543
+ directory: ${JSON.stringify(route.directory)},` : ""}
5471
5544
  module: ${varName},
5472
5545
  shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},
5473
- islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${renderingDirective ? `
5546
+ islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkICUQICNCcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${renderingDirective ? `
5474
5547
  rendering: ${JSON.stringify(renderingDirective)},` : ""}
5475
5548
  ${route.source !== void 0 ? `markdownSource: {
5476
5549
  source: ${JSON.stringify(route.source)},
@@ -5511,7 +5584,8 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5511
5584
  routeSlotRegistrations.push(`
5512
5585
  {
5513
5586
  name: ${JSON.stringify(slot.name)},
5514
- ownerPattern: ${JSON.stringify(slot.ownerPattern)},
5587
+ ownerPattern: ${JSON.stringify(slot.ownerPattern)},${slot.ownerDirectory ? `
5588
+ ownerDirectory: ${JSON.stringify(slot.ownerDirectory)},` : ""}
5515
5589
  pattern: ${JSON.stringify(slot.pattern)},
5516
5590
  containerId: ${JSON.stringify(slot.containerId)},
5517
5591
  interception: ${JSON.stringify(slot.interception)},
@@ -5526,9 +5600,12 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5526
5600
  errorImports.push(
5527
5601
  `import * as ${varName} from ${toVirtualEntryImportSpecifier(errorRoute.modulePath)};`
5528
5602
  );
5603
+ const groupScope = _chunkIPXLADVOcjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
5529
5604
  errorRegistrations.push(`
5530
5605
  {
5531
- pattern: ${JSON.stringify(errorRoute.pattern)},
5606
+ pattern: ${JSON.stringify(_chunkIPXLADVOcjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
5607
+ groupScope: ${JSON.stringify(groupScope)},
5608
+ directoryDepth: ${_chunkIPXLADVOcjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
5532
5609
  module: ${varName},
5533
5610
  }`);
5534
5611
  });
@@ -5606,14 +5683,18 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5606
5683
  createDefaultErrorMarkup,
5607
5684
  createFarmInstrumentationLifecycle,
5608
5685
  createFarmLayoutSelector,
5686
+ isInFarmRouteGroupScope,
5609
5687
  createFarmCacheKey,
5610
5688
  createFarmMetadataRouteResponse,
5611
5689
  createFarmAgentRobots,
5690
+ createFarmAiCatalogResponse,
5612
5691
  createFarmApiCatalogResponse,
5613
5692
  createFarmAppManifestResponse,
5614
5693
  collectFarmLlmsTxtPages,
5615
5694
  createFarmDefaultLlmsTxt,
5616
5695
  createFarmLlmsMarkdownReader,
5696
+ listFarmMCPLlmsTxtLinks,
5697
+ registerFarmMCPServer,
5617
5698
  renderFarmLlmsFullTxt,
5618
5699
  createFarmLlmsFullRenderer,
5619
5700
  createFarmThemeDocumentParts,
@@ -5634,6 +5715,9 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5634
5715
  mergeRouteRenderingDirectiveConfig,
5635
5716
  manageFarmLinkHeaderPreloads,
5636
5717
  mergeMetadata,
5718
+ mergeModuleViewport,
5719
+ ensureFarmDocumentMeta,
5720
+ renderViewportHead,
5637
5721
  matchesFarmIfNoneMatch,
5638
5722
  normalizeRevalidatePath,
5639
5723
  reportFarmPreloadWarnings,
@@ -5663,25 +5747,25 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5663
5747
  const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
5664
5748
  const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
5665
5749
  const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
5666
- const docsHandlerImport = _optionalChain([config, 'access', _95 => _95.docs, 'optionalAccess', _96 => _96.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
5750
+ const docsHandlerImport = _optionalChain([config, 'access', _97 => _97.docs, 'optionalAccess', _98 => _98.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
5667
5751
  const isFarmDocsAPIRequest = (requestOrPathname) => {
5668
5752
  const pathname = typeof requestOrPathname === "string"
5669
5753
  ? requestOrPathname
5670
5754
  : new URL(requestOrPathname.url).pathname;
5671
- const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _97 => _97.apiPath]) || "/api/docs")};
5755
+ const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _99 => _99.apiPath]) || "/api/docs")};
5672
5756
  return pathname === apiPath || pathname.startsWith(apiPath + "/");
5673
5757
  };` : adapterOwnsDocsRuntime ? `import { isFarmDocsAPIRequest } from "@farm.js/core/docs";
5674
5758
  import { createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler } from ${JSON.stringify(config.docs.adapter.server)};
5675
5759
  import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
5676
5760
  import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
5677
- const docsFontImport = _optionalChain([config, 'access', _98 => _98.docs, 'optionalAccess', _99 => _99.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
5678
- const docsRuntimeImport = _optionalChain([config, 'access', _100 => _100.docs, 'optionalAccess', _101 => _101.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
5761
+ const docsFontImport = _optionalChain([config, 'access', _100 => _100.docs, 'optionalAccess', _101 => _101.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
5762
+ const docsRuntimeImport = _optionalChain([config, 'access', _102 => _102.docs, 'optionalAccess', _103 => _103.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
5679
5763
  import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
5680
5764
  import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
5681
- const markdownHandlerImport = _optionalChain([config, 'access', _102 => _102.md, 'optionalAccess', _103 => _103.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
5765
+ const markdownHandlerImport = _optionalChain([config, 'access', _104 => _104.md, 'optionalAccess', _105 => _105.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
5682
5766
  const appMarkdownImport = hasMarkdownPages ? `import { createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
5683
5767
  const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
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;
5768
+ const mdxComponentsPath = typeof _optionalChain([config, 'access', _106 => _106.mdx, 'optionalAccess', _107 => _107.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
5685
5769
  const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
5686
5770
  const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
5687
5771
  const layerConfigImports = layerConfigPaths.map(
@@ -5886,7 +5970,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
5886
5970
 
5887
5971
  function FarmDefault404Page() {
5888
5972
  return React.createElement(React.Fragment, null,
5889
- React.createElement("style", null, ${JSON.stringify(_chunkSJVKK4JEcjs.DEFAULT_NOT_FOUND_STYLES)}),
5973
+ React.createElement("style", null, ${JSON.stringify(_chunkICUQICNCcjs.DEFAULT_NOT_FOUND_STYLES)}),
5890
5974
  React.createElement("main", {
5891
5975
  className: "farm-default-not-found",
5892
5976
  "aria-labelledby": "farm-default-not-found-title",
@@ -6014,14 +6098,14 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
6014
6098
  onError(error) { console.error("[Farm Image]", error); },
6015
6099
  })`};
6016
6100
  const farmMarkdownConfig = ${JSON.stringify(config.md)};
6017
- const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _106 => _106.agent, 'optionalAccess', _107 => _107.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
6018
- ${_optionalChain([config, 'access', _108 => _108.agent, 'optionalAccess', _109 => _109.llmsTxt, 'optionalAccess', _110 => _110.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
6101
+ const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _108 => _108.agent, 'optionalAccess', _109 => _109.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
6102
+ ${_optionalChain([config, 'access', _110 => _110.agent, 'optionalAccess', _111 => _111.llmsTxt, 'optionalAccess', _112 => _112.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
6019
6103
  const farmMdxConfig = ${JSON.stringify({
6020
6104
  ...config.mdx,
6021
- components: typeof _optionalChain([config, 'access', _111 => _111.mdx, 'optionalAccess', _112 => _112.components]) === "string" ? config.mdx.components : void 0
6105
+ components: typeof _optionalChain([config, 'access', _113 => _113.mdx, 'optionalAccess', _114 => _114.components]) === "string" ? config.mdx.components : void 0
6022
6106
  })};
6023
6107
  const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
6024
- ${_optionalChain([config, 'access', _113 => _113.agent, 'optionalAccess', _114 => _114.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
6108
+ ${_optionalChain([config, 'access', _115 => _115.agent, 'optionalAccess', _116 => _116.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
6025
6109
  // environment this was built in, since Netlify exposes its deploy context only
6026
6110
  // to the build.
6027
6111
  const farmNoindexPreview = resolveFarmPreviewDeployment(
@@ -6069,7 +6153,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
6069
6153
  });
6070
6154
  const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
6071
6155
  ${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
6072
- const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _115 => _115.docs, 'optionalAccess', _116 => _116.enabled]) && !hasPrecompiledDocs ? `(() => {
6156
+ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _117 => _117.docs, 'optionalAccess', _118 => _118.enabled]) && !hasPrecompiledDocs ? `(() => {
6073
6157
  try {
6074
6158
  const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
6075
6159
  const candidates = [
@@ -6090,7 +6174,7 @@ globalThis.__FARM_DOCS_RUNTIME_CONFIG__ = {
6090
6174
  docs: farmDocsResolvedConfig,
6091
6175
  };
6092
6176
  const farmDocsPrecompiledRuntime = ${hasPrecompiledDocs ? `createFarmDocsPrecompiledRuntime(${JSON.stringify(farmDocsPrecompiledManifest)})` : "null"};
6093
- const farmDocsHandler = ${_optionalChain([config, 'access', _117 => _117.docs, 'optionalAccess', _118 => _118.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `createFarmDocsAdapterRuntimeHandler({
6177
+ const farmDocsHandler = ${_optionalChain([config, 'access', _119 => _119.docs, 'optionalAccess', _120 => _120.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `createFarmDocsAdapterRuntimeHandler({
6094
6178
  ${docsConfigModulePath ? "...(farmDocsConfigModule.default || farmDocsConfigModule),\n ...farmDocsResolvedConfig.configOverrides," : "...farmDocsResolvedConfig.config,"}
6095
6179
  entry: farmDocsResolvedConfig.config?.entry || String(farmDocsResolvedConfig.entry || "/docs").replace(/^\\/+|\\/+$/g, "") || "docs",
6096
6180
  docsPath: farmDocsResolvedConfig.entry,
@@ -6109,6 +6193,8 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _117 => _117.docs, '
6109
6193
  getApplicableLayouts(getFarmRoutePathname(pathname)).map((layout) => layout.module),
6110
6194
  ),
6111
6195
  loadReactModule: async () => FarmDocsAdapterReact,
6196
+ // Lists the docs MCP endpoint in /.well-known/ai-catalog.json for the server's lifetime.
6197
+ registerMCPServer: registerFarmMCPServer,
6112
6198
  })` : `createFarmDocsHandler(farmDocsResolvedConfig, {
6113
6199
  root: farmDocsRuntimeRoot,
6114
6200
  srcDir: ${JSON.stringify(config.srcDir)},
@@ -6121,19 +6207,19 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _117 => _117.docs, '
6121
6207
  fontStylesheetHref: "/farm-fonts.css",
6122
6208
  globalStylesheetHref: "/assets/globals.css",
6123
6209
  })` : "null"};
6124
- const farmDocsAPIHandler = ${_optionalChain([config, 'access', _119 => _119.docs, 'optionalAccess', _120 => _120.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig })` : "null"};
6210
+ const farmDocsAPIHandler = ${_optionalChain([config, 'access', _121 => _121.docs, 'optionalAccess', _122 => _122.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig })` : "null"};
6125
6211
 
6126
6212
  // API routes bundled at build time
6127
6213
  const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
6128
6214
  ]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path8, methods }) => ({ path: path8, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)} })` : ""};
6129
6215
  const farmLocalAPIBasePath = ${JSON.stringify(_chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, config.api))};
6130
6216
  const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
6131
- ${_optionalChain([config, 'access', _121 => _121.agent, 'optionalAccess', _122 => _122.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkP64MIF5Bcjs.resolveFarmApiCatalogInput.call(void 0, config))};
6217
+ ${_optionalChain([config, 'access', _123 => _123.agent, 'optionalAccess', _124 => _124.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkIPXLADVOcjs.resolveFarmApiCatalogInput.call(void 0, config))};
6132
6218
  ` : ""}${config.analytics !== false ? `const farmAppManifestInput = ${JSON.stringify(
6133
- _chunkP64MIF5Bcjs.resolveFarmAppManifestInput.call(void 0, config, {
6219
+ _chunkIPXLADVOcjs.resolveFarmAppManifestInput.call(void 0, config, {
6134
6220
  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) : []
6221
+ packages: _chunkICUQICNCcjs.resolveFarmAppPackages.call(void 0, config.root),
6222
+ webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkICUQICNCcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
6137
6223
  })
6138
6224
  )};
6139
6225
  ` : ""}
@@ -6161,7 +6247,7 @@ for (const route of pageRoutes) {
6161
6247
  // Layout routes bundled at build time (sorted by depth, root first)
6162
6248
  const layoutRoutes = [${layoutRegistrations.join(",")}
6163
6249
  ];
6164
- const selectApplicableLayouts = createFarmLayoutSelector(layoutRoutes);
6250
+ const selectApplicableLayouts = createFarmLayoutSelector(layoutRoutes, getMatchedPageDirectory);
6165
6251
 
6166
6252
  const routeSlots = [${routeSlotRegistrations.join(",")}
6167
6253
  ];
@@ -6578,7 +6664,7 @@ function peelFarmDocumentPrefix(markup) {
6578
6664
  let inner = markup.replace(/^\\s+/, "");
6579
6665
  let hoisted = "";
6580
6666
  const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents["'][^>]*>/i;
6581
- const hoistable = /${_chunkSJVKK4JEcjs.HOISTED_HEAD_ELEMENT.source}/i;
6667
+ const hoistable = /${_chunkIPXLADVOcjs.HOISTED_HEAD_ELEMENT.source}/i;
6582
6668
  let match;
6583
6669
  while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
6584
6670
  if (!/^<div/i.test(match[0])) hoisted += match[0];
@@ -6810,6 +6896,7 @@ ${generateRuntimePathMatcherSource()}
6810
6896
  function getMatchingErrorBoundary(pathname) {
6811
6897
  const pathSegments = splitRuntimePath(pathname);
6812
6898
  let bestMatch = null;
6899
+ let directory;
6813
6900
 
6814
6901
  for (const errorRoute of errorRoutes) {
6815
6902
  const patternDepth = splitRuntimePath(errorRoute.pattern).length;
@@ -6819,9 +6906,18 @@ function getMatchingErrorBoundary(pathname) {
6819
6906
  : "/" + pathSegments.slice(0, patternDepth).join("/");
6820
6907
  const params = matchRuntimePathPattern(errorRoute.pattern, candidatePath);
6821
6908
  if (params === null) continue;
6909
+ if (errorRoute.groupScope) {
6910
+ if (directory === undefined) directory = getMatchedPageDirectory(pathname);
6911
+ if (!isInFarmRouteGroupScope(directory, errorRoute.groupScope)) continue;
6912
+ }
6822
6913
 
6823
- if (!bestMatch || patternDepth > bestMatch.depth) {
6824
- bestMatch = { route: errorRoute, params, depth: patternDepth };
6914
+ const directoryDepth = errorRoute.directoryDepth ?? patternDepth;
6915
+ if (
6916
+ !bestMatch ||
6917
+ patternDepth > bestMatch.depth ||
6918
+ (patternDepth === bestMatch.depth && directoryDepth > bestMatch.directoryDepth)
6919
+ ) {
6920
+ bestMatch = { route: errorRoute, params, depth: patternDepth, directoryDepth };
6825
6921
  }
6826
6922
  }
6827
6923
 
@@ -7045,6 +7141,10 @@ function createFarmLlmsTxtContext(request, full) {
7045
7141
  pages,
7046
7142
  config: farmLlmsTxtConfig,
7047
7143
  rootMetadata: rootLayout && rootLayout.module && rootLayout.module.metadata,
7144
+ ${servesAiCatalog ? `mcp: listFarmMCPLlmsTxtLinks(origin, {
7145
+ basePath: ${JSON.stringify(config.basePath)},
7146
+ apiServerBasePath: farmLocalAPIBasePath,
7147
+ }),` : ""}
7048
7148
  }),
7049
7149
  // llms-full.txt reads each page's .md mirror through this same handler,
7050
7150
  // with a fresh request so the caller's cookies never shape its content.
@@ -7288,7 +7388,7 @@ function hasLocalRequestRoute(request, routePathname) {
7288
7388
  if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
7289
7389
  return true;
7290
7390
  }
7291
- ${_optionalChain([config, 'access', _123 => _123.docs, 'optionalAccess', _124 => _124.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
7391
+ ${_optionalChain([config, 'access', _125 => _125.docs, 'optionalAccess', _126 => _126.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
7292
7392
  if (
7293
7393
  isFarmDocsAPIRequest(pathname) ||
7294
7394
  docsPath === "/" ||
@@ -7314,7 +7414,7 @@ function getFarmPluginRequestOptions(request) {
7314
7414
  route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
7315
7415
  };
7316
7416
  }
7317
- const isDocsAPIRequest = ${_optionalChain([config, 'access', _125 => _125.docs, 'optionalAccess', _126 => _126.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
7417
+ const isDocsAPIRequest = ${_optionalChain([config, 'access', _127 => _127.docs, 'optionalAccess', _128 => _128.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
7318
7418
  const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
7319
7419
  pathname,
7320
7420
  method: request.method,
@@ -7394,17 +7494,24 @@ function getFarmPluginRequestOptions(request) {
7394
7494
  return { kind: "request", route };
7395
7495
  }
7396
7496
 
7497
+ /** The directory of the page a pathname selects, or null; route groups confine layouts to it. */
7498
+ function getMatchedPageDirectory(pathname) {
7499
+ const match = matchPageRoute(pathname);
7500
+ return match ? match.route.directory || match.route.pattern : null;
7501
+ }
7502
+
7397
7503
  /**
7398
- * Get applicable layouts for a page path (from root to most specific)
7504
+ * Get applicable layouts for a page path (from root to most specific). Pass the
7505
+ * selected page's directory when it is known, or null when no page applies.
7399
7506
  */
7400
- function getApplicableLayouts(pathname) {
7401
- const applicable = selectApplicableLayouts(pathname);
7507
+ function getApplicableLayouts(pathname, directory) {
7508
+ const applicable = selectApplicableLayouts(pathname, directory);
7402
7509
  // buildSSRInMemory already emits these immutable descriptors in stable depth
7403
7510
  // order. Filtering preserves that order, including equal-depth ties.
7404
7511
  return applicable;
7405
7512
  }
7406
7513
 
7407
- ${_optionalChain([config, 'access', _127 => _127.docs, 'optionalAccess', _128 => _128.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
7514
+ ${_optionalChain([config, 'access', _129 => _129.docs, 'optionalAccess', _130 => _130.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
7408
7515
  if (request.method === "HEAD") return response;
7409
7516
  if (response.headers.get("x-farm-docs-adapter")) return response;
7410
7517
 
@@ -7511,7 +7618,7 @@ ${_optionalChain([config, 'access', _127 => _127.docs, 'optionalAccess', _128 =>
7511
7618
  }` : ""}
7512
7619
 
7513
7620
  const pprShellCache = getFarmDataCache();
7514
- const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _129 => _129.experimental, 'optionalAccess', _130 => _130.ppr]) === true)};
7621
+ const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _131 => _131.experimental, 'optionalAccess', _132 => _132.ppr]) === true)};
7515
7622
 
7516
7623
  function resolveRouteRenderingView(route) {
7517
7624
  // The same merge development uses: baked directive config under the
@@ -7640,7 +7747,7 @@ async function handleFarmRequest(request, adapterContext) {
7640
7747
  },
7641
7748
  { redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
7642
7749
  )` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
7643
- ${_optionalChain([config, 'access', _131 => _131.md, 'optionalAccess', _132 => _132.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
7750
+ ${_optionalChain([config, 'access', _133 => _133.md, 'optionalAccess', _134 => _134.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
7644
7751
  if (matchPageRoute(pathname)) {
7645
7752
  // The Link header advertises the public .md URL, like the head alternate.
7646
7753
  return applyMarkdownNegotiationHeaders(response, {
@@ -7759,7 +7866,21 @@ async function handleFarmRequestInContext(
7759
7866
  const middlewareHeaders = ${hasServerRuntimeIntegrations ? "withFarmIntegrationSetCookies(undefined, farmIntegrationSetCookies)" : "undefined"};
7760
7867
  `}
7761
7868
 
7762
- ${_optionalChain([config, 'access', _133 => _133.docs, 'optionalAccess', _134 => _134.enabled]) ? `
7869
+ ${servesAiCatalog ? `
7870
+ // agent.aiCatalog: the AI catalog of MCP servers and each server's card. Cards
7871
+ // live below the MCP endpoint, so this answers before the docs runtime and the
7872
+ // API routes, as in dev.
7873
+ const farmAiCatalogResponse = createFarmAiCatalogResponse(
7874
+ request,
7875
+ { basePath: ${JSON.stringify(config.basePath)}, apiServerBasePath: farmLocalAPIBasePath },
7876
+ url,
7877
+ );
7878
+ if (farmAiCatalogResponse) {
7879
+ return applyProductionMiddlewareHeaders(farmAiCatalogResponse, middlewareHeaders);
7880
+ }
7881
+ ` : ""}
7882
+
7883
+ ${_optionalChain([config, 'access', _135 => _135.docs, 'optionalAccess', _136 => _136.enabled]) ? `
7763
7884
  // Docs responses are served after app middleware so route guards and
7764
7885
  // middleware headers apply to the docs engine like any other page content.
7765
7886
  // An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
@@ -7808,7 +7929,7 @@ async function handleFarmRequestInContext(
7808
7929
  }
7809
7930
  ` : ""}
7810
7931
 
7811
- ${_optionalChain([config, 'access', _135 => _135.md, 'optionalAccess', _136 => _136.enabled]) ? `
7932
+ ${_optionalChain([config, 'access', _137 => _137.md, 'optionalAccess', _138 => _138.enabled]) ? `
7812
7933
  if (farmMarkdownConfig?.enabled) {
7813
7934
  const markdownResponse = await createMarkdownMirrorResponse({
7814
7935
  // The mirror helper only reads metadata and creates its own GET request.
@@ -7909,7 +8030,7 @@ async function handleFarmRequestInContext(
7909
8030
  ` : ""}
7910
8031
  ${config.analytics !== false ? `
7911
8032
  // /.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)}) {
8033
+ if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkIPXLADVOcjs.FARM_APP_MANIFEST_PATH)}) {
7913
8034
  const farmAppManifest = await createFarmAppManifestResponse(request, farmAppManifestInput, {
7914
8035
  development: false,
7915
8036
  });
@@ -7918,9 +8039,9 @@ async function handleFarmRequestInContext(
7918
8039
  }
7919
8040
  }
7920
8041
  ` : ""}
7921
- ${_optionalChain([config, 'access', _137 => _137.agent, 'optionalAccess', _138 => _138.apiCatalog]) ? `
8042
+ ${_optionalChain([config, 'access', _139 => _139.agent, 'optionalAccess', _140 => _140.apiCatalog]) ? `
7922
8043
  // agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
7923
- if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkP64MIF5Bcjs.FARM_API_CATALOG_PATH)}) {
8044
+ if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkIPXLADVOcjs.FARM_API_CATALOG_PATH)}) {
7924
8045
  return applyProductionMiddlewareHeaders(
7925
8046
  createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
7926
8047
  middlewareHeaders,
@@ -7936,11 +8057,11 @@ async function handleFarmRequestInContext(
7936
8057
  );
7937
8058
  }
7938
8059
  ` : ""}
7939
- ${_optionalChain([config, 'access', _139 => _139.agent, 'optionalAccess', _140 => _140.llmsTxt, 'optionalAccess', _141 => _141.enabled]) ? `
8060
+ ${_optionalChain([config, 'access', _141 => _141.agent, 'optionalAccess', _142 => _142.llmsTxt, 'optionalAccess', _143 => _143.enabled]) ? `
7940
8061
  // agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
7941
8062
  const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
7942
8063
  ? "llms"
7943
- : ${_optionalChain([config, 'access', _142 => _142.agent, 'optionalAccess', _143 => _143.llmsTxt, 'optionalAccess', _144 => _144.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
8064
+ : ${_optionalChain([config, 'access', _144 => _144.agent, 'optionalAccess', _145 => _145.llmsTxt, 'optionalAccess', _146 => _146.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
7944
8065
  if (farmGeneratedLlmsKind) {
7945
8066
  const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
7946
8067
  const llmsOrigin = new URL(request.url).origin;
@@ -7975,7 +8096,7 @@ async function handleFarmRequestInContext(
7975
8096
  }
7976
8097
  ` : ""}
7977
8098
 
7978
- ${_optionalChain([config, 'access', _145 => _145.docs, 'optionalAccess', _146 => _146.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
8099
+ ${_optionalChain([config, 'access', _147 => _147.docs, 'optionalAccess', _148 => _148.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
7979
8100
  const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
7980
8101
  if (docsAPIResponse) {
7981
8102
  return applyProductionMiddlewareHeaders(docsAPIResponse, middlewareHeaders);
@@ -8065,7 +8186,10 @@ async function handleFarmRequestInContext(
8065
8186
  const pageMetadata = route.module.metadata || {};
8066
8187
 
8067
8188
  // Get applicable layouts for this page
8068
- const applicableLayouts = getApplicableLayouts(routePathname);
8189
+ const applicableLayouts = getApplicableLayouts(
8190
+ routePathname,
8191
+ route.directory || route.pattern,
8192
+ );
8069
8193
  const shouldHydrateLayout = applicableLayouts.some(
8070
8194
  (layout) => layout.shouldHydrate === true,
8071
8195
  );
@@ -8298,7 +8422,9 @@ async function handleFarmRequestInContext(
8298
8422
  if (route.shouldHydrate && !shouldHydrateLayout) {
8299
8423
  pageElement = wrapFarmRouteClientGraph(pageElement);
8300
8424
  } else if (shouldHydrateLayout && !route.shouldHydrate) {
8301
- pageElement = isolateFarmRouteServerPage(pageElement);
8425
+ pageElement = route.serverTree
8426
+ ? await renderFarmRouteServerTree(pageElement)
8427
+ : isolateFarmRouteServerPage(pageElement);
8302
8428
  }
8303
8429
 
8304
8430
  pageElement = React.createElement(
@@ -8325,7 +8451,7 @@ async function handleFarmRequestInContext(
8325
8451
  if (LayoutComponent) {
8326
8452
  const slotProps = {};
8327
8453
  for (const slot of renderedRouteSlots) {
8328
- if (slot.ownerPattern !== layout.pattern) continue;
8454
+ if ((slot.ownerDirectory || slot.ownerPattern) !== layout.pattern) continue;
8329
8455
  slotProps[slot.name] = React.createElement(
8330
8456
  "div",
8331
8457
  {
@@ -8392,6 +8518,9 @@ async function handleFarmRequestInContext(
8392
8518
  await layout.module.generateMetadata({ params: pageProps.params }),
8393
8519
  );
8394
8520
  }
8521
+ mergedMetadata = await mergeModuleViewport(mergedMetadata, layout.module, {
8522
+ params: pageProps.params,
8523
+ });
8395
8524
  }
8396
8525
  mergedMetadata = mergeMetadata(mergedMetadata, pageMetadata);
8397
8526
  if (!routeStateRejected && typeof route.module.generateMetadata === "function") {
@@ -8400,6 +8529,11 @@ async function handleFarmRequestInContext(
8400
8529
  await route.module.generateMetadata(pageProps),
8401
8530
  );
8402
8531
  }
8532
+ mergedMetadata = await mergeModuleViewport(
8533
+ mergedMetadata,
8534
+ routeStateRejected ? { viewport: route.module.viewport } : route.module,
8535
+ pageProps,
8536
+ );
8403
8537
 
8404
8538
  if (!mergedMetadata.manifest) {
8405
8539
  const manifestMatch = getMatchingApplicationMetadataRoute(routePathname, "manifest");
@@ -8420,7 +8554,7 @@ async function handleFarmRequestInContext(
8420
8554
  );
8421
8555
  }
8422
8556
  }
8423
- ${_optionalChain([config, 'access', _147 => _147.md, 'optionalAccess', _148 => _148.enabled]) ? `
8557
+ ${_optionalChain([config, 'access', _149 => _149.md, 'optionalAccess', _150 => _150.enabled]) ? `
8424
8558
  // Advertise the Markdown mirror in the head as well as the Link header,
8425
8559
  // using the public path the .md request will be resolved against.
8426
8560
  mergedMetadata = addMetadataMarkdownAlternate(
@@ -8439,10 +8573,11 @@ async function handleFarmRequestInContext(
8439
8573
  emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "request-read" });
8440
8574
  }
8441
8575
 
8442
- const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _149 => _149.agent, 'optionalAccess', _150 => _150.jsonLd]), () => ( false)))} });
8576
+ const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _151 => _151.agent, 'optionalAccess', _152 => _152.jsonLd]), () => ( false)))} });
8443
8577
  const title = renderedMetadata.title;
8444
8578
  const metaTags = renderedMetadata.tags;
8445
8579
  const hasFavicon = renderedMetadata.hasFavicon;
8580
+ const viewportTags = renderedMetadata.viewport;
8446
8581
 
8447
8582
  const hasPrivateRequestHeaders = hasPrivateFarmRequestHeaders(
8448
8583
  request,
@@ -8494,7 +8629,7 @@ async function handleFarmRequestInContext(
8494
8629
  const streamPrefix = '<!DOCTYPE html>\\n<html lang="en">\\n<head>\\n' +
8495
8630
  farmThemeDocument.head + '\\n' +
8496
8631
  ' <meta charset="utf-8">\\n' +
8497
- ' <meta name="viewport" content="width=device-width, initial-scale=1">\\n' +
8632
+ ' ' + viewportTags + '\\n' +
8498
8633
  (hasFavicon ? '' : ' <link rel="icon" href="data:,">\\n') +
8499
8634
  ' <title>' + title + '</title>' + metaTags + '\\n' +
8500
8635
  ' <link rel="stylesheet" href="/__farm_client_css_href__">\\n' +
@@ -8625,6 +8760,9 @@ async function handleFarmRequestInContext(
8625
8760
  ' <script type="module" src="/__farm_client_js_src__"></script>\\n</body>',
8626
8761
  );
8627
8762
 
8763
+ // Last, so the charset (and the viewport, unless the layout wrote one) open the head.
8764
+ fullHtml = ensureFarmDocumentMeta(fullHtml, viewportTags);
8765
+
8628
8766
  // Add DOCTYPE if not present
8629
8767
  if (!fullHtml.trim().startsWith('<!DOCTYPE')) {
8630
8768
  fullHtml = '<!DOCTYPE html>\\n' + fullHtml;
@@ -8635,7 +8773,7 @@ async function handleFarmRequestInContext(
8635
8773
  <html lang="en">
8636
8774
  <head>
8637
8775
  <meta charset="utf-8">
8638
- <meta name="viewport" content="width=device-width, initial-scale=1">
8776
+ \${viewportTags}
8639
8777
  \${hasFavicon ? "" : '<link rel="icon" href="data:,">'}
8640
8778
  \${suppressDefaultTitle ? "" : "<title>" + title + "</title>"}\${metaTags}\${rendererHead ? "\\n " + rendererHead : ""}
8641
8779
  <link rel="stylesheet" href="/__farm_client_css_href__">
@@ -8885,7 +9023,8 @@ async function handleFarmRequestInContext(
8885
9023
  try {
8886
9024
  // Wrap 404 page with root layout if available
8887
9025
  let notFoundElement = createFarmNotFoundElement(pathname);
8888
- const applicableLayouts = getApplicableLayouts("/");
9026
+ // No page matched, so a layout inside a route group cannot apply.
9027
+ const applicableLayouts = getApplicableLayouts("/", null);
8889
9028
 
8890
9029
  // Wrap with layouts (from innermost to outermost)
8891
9030
  for (let i = applicableLayouts.length - 1; i >= 0; i--) {
@@ -8929,6 +9068,7 @@ async function handleFarmRequestInContext(
8929
9068
  () => ' ' + renderFarmClientBootstrapScript() + '\\n' +
8930
9069
  ' <script type="module" src="/__farm_client_js_src__"></script>\\n</body>',
8931
9070
  );
9071
+ fullHtml = ensureFarmDocumentMeta(fullHtml, notFoundMetadata.viewport);
8932
9072
  if (!fullHtml.trim().startsWith('<!DOCTYPE')) {
8933
9073
  fullHtml = '<!DOCTYPE html>\\n' + fullHtml;
8934
9074
  }
@@ -8937,7 +9077,7 @@ async function handleFarmRequestInContext(
8937
9077
  <html lang="en">
8938
9078
  <head>
8939
9079
  <meta charset="UTF-8">
8940
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
9080
+ \${notFoundMetadata.viewport}
8941
9081
  \${notFoundMetadata.hasFavicon ? "" : '<link rel="icon" href="data:,">'}
8942
9082
  <link rel="stylesheet" href="/__farm_client_css_href__">
8943
9083
  <title>\${notFoundMetadata.title}</title>\${notFoundMetadata.tags}
@@ -9055,11 +9195,11 @@ ${generatePreloadResponseRuntimeSource()}
9055
9195
 
9056
9196
  // Export as Web Standard fetch API
9057
9197
  export async function fetch(request, context) {
9058
- ${_optionalChain([config, 'access', _151 => _151.agent, 'optionalAccess', _152 => _152.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
9198
+ ${_optionalChain([config, 'access', _153 => _153.agent, 'optionalAccess', _154 => _154.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
9059
9199
  basePath: farmLocalAPIBasePath,
9060
9200
  dispatch: async (localRequest) =>
9061
9201
  (await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
9062
- }, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _153 => _153.agent, 'optionalAccess', _154 => _154.noindexPreviews]) ? `
9202
+ }, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _155 => _155.agent, 'optionalAccess', _156 => _156.noindexPreviews]) ? `
9063
9203
  // Keep every response of a preview deployment out of search indexes.
9064
9204
  return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
9065
9205
  }
@@ -9255,11 +9395,11 @@ function getPhysicalPrerenderBypassReason(options) {
9255
9395
  }
9256
9396
  if (appMiddlewareMayHandlePath(middlewareRoutes, pathname)) return "app middleware";
9257
9397
  if (configMiddlewareMayHandlePath(config.middleware, pathname)) return "configured middleware";
9258
- if (_chunkPQDFUSXDcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
9398
+ if (_chunkF7JZENPFcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
9259
9399
  if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
9260
9400
  const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
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)) {
9401
+ if (_optionalChain([manifestEntry, 'optionalAccess', _157 => _157.rendering]) === "dynamic") return "dynamic runtime manifest";
9402
+ if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _158 => _158.regions, 'optionalAccess', _159 => _159.length])) || manifestEntry.maxDuration !== void 0)) {
9263
9403
  return "route runtime controls";
9264
9404
  }
9265
9405
  const routeRule = getEffectiveRouteRule(config, pathname);
@@ -9281,7 +9421,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
9281
9421
  const nitroBuilder = nitroBuilderResult.value;
9282
9422
  const isVercel = preset === "vercel" || preset === "vercel-edge";
9283
9423
  const isCloudflareWorker = preset === "cloudflare-module";
9284
- const outputDir = _chunkPQDFUSXDcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
9424
+ const outputDir = _chunkF7JZENPFcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
9285
9425
  const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
9286
9426
  const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
9287
9427
  const imageRuntime = resolveImageRuntime(config, preset);
@@ -9305,7 +9445,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
9305
9445
  const ssgCollectionPromise = routeManager.collectSSGPages();
9306
9446
  const middlewareRoutesPromise = discoverMiddlewareRoutes(_chunkVPTDD5XFcjs.getFarmAppDirectories.call(void 0, config));
9307
9447
  const configuredResponseRoutesPromise = Promise.all([config.redirects(), config.rewrites()]);
9308
- const farmWorkflows = await _chunkMPEYMSCFcjs.prepareFarmWorkflowsForNitro.call(void 0, config);
9448
+ const farmWorkflows = await _chunkVFQT3LAOcjs.prepareFarmWorkflowsForNitro.call(void 0, config);
9309
9449
  const farmCron = await _chunk6EXBPJ24cjs.prepareFarmCronForNitro.call(void 0, config);
9310
9450
  const [{ ssg: ssgPages }, middlewareRoutes, [configuredRedirects, configuredRewrites]] = await Promise.all([
9311
9451
  ssgCollectionPromise,
@@ -9667,20 +9807,20 @@ function toFarmNodeResponse(request, response) {
9667
9807
  snapshotSSRRebundleOptions(nitroConfig)
9668
9808
  );
9669
9809
  const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
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
9810
+ const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _160 => _160.rollupConfig, 'optionalAccess', _161 => _161.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _162 => _162.rollupConfig, 'optionalAccess', _163 => _163.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _164 => _164.output, 'optionalAccess', _165 => _165.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
9811
+ _optionalChain([nitroConfig, 'access', _166 => _166.handlers, 'optionalAccess', _167 => _167.some, 'call', _168 => _168(
9812
+ (handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _169 => _169.handler]) || "") === nitroEntryPath
9673
9813
  )])
9674
9814
  );
9675
9815
  const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
9676
9816
  if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
9677
9817
  const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
9678
9818
  const shouldMinify = nitroConfig.minify !== false;
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]));
9819
+ const keepServerNames = !(_optionalChain([config, 'access', _170 => _170.docs, 'optionalAccess', _171 => _171.enabled]) && _optionalChain([config, 'access', _172 => _172.docs, 'access', _173 => _173.adapter, 'optionalAccess', _174 => _174.server]));
9680
9820
  const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
9681
9821
  const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
9682
9822
  if (canReusePrebuiltSSR) {
9683
- const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _173 => _173.rollupConfig, 'optionalAccess', _174 => _174.plugins]);
9823
+ const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _175 => _175.rollupConfig, 'optionalAccess', _176 => _176.plugins]);
9684
9824
  nitroConfig.rollupConfig = {
9685
9825
  ...nitroConfig.rollupConfig,
9686
9826
  plugins: [
@@ -9691,10 +9831,10 @@ function toFarmNodeResponse(request, response) {
9691
9831
  }
9692
9832
  nitroConfig.minify = useFarmServerMinifier ? false : shouldMinify;
9693
9833
  const nitroInstance = await nitroBuilder.createNitro(nitroConfig);
9694
- if (_optionalChain([config, 'access', _175 => _175.md, 'optionalAccess', _176 => _176.enabled])) {
9834
+ if (_optionalChain([config, 'access', _177 => _177.md, 'optionalAccess', _178 => _178.enabled])) {
9695
9835
  nitroInstance.hooks.hook("prerender:generate", (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);
9836
+ if (!route.contents || !_optionalChain([route, 'access', _179 => _179.contentType, 'optionalAccess', _180 => _180.toLowerCase, 'call', _181 => _181(), 'access', _182 => _182.includes, 'call', _183 => _183("html")])) return;
9837
+ const alternatePath = _chunkEUV4YR3Vcjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route);
9698
9838
  if (!alternatePath) return;
9699
9839
  const routeRule = nitroInstance.options.routeRules[route.route] || {};
9700
9840
  const alternate = `<${alternatePath}>; rel="alternate"; type="text/markdown"`;
@@ -9714,8 +9854,8 @@ function toFarmNodeResponse(request, response) {
9714
9854
  }
9715
9855
  if (config.security.csp && config.security.csp.nonce) {
9716
9856
  nitroInstance.hooks.hook("prerender:generate", async (route) => {
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);
9857
+ if (!route.contents || !_optionalChain([route, 'access', _184 => _184.contentType, 'optionalAccess', _185 => _185.toLowerCase, 'call', _186 => _186(), 'access', _187 => _187.includes, 'call', _188 => _188("html")])) return;
9858
+ const staticCsp = await _chunkRU3M2FIKcjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
9719
9859
  if (!staticCsp) return;
9720
9860
  route.contents = staticCsp.html;
9721
9861
  const routeRule = nitroInstance.options.routeRules[route.route] || {};
@@ -9922,7 +10062,7 @@ async function moveVercelOutputPath(src, dest, fs) {
9922
10062
  await fs.rename(src, dest);
9923
10063
  return;
9924
10064
  } catch (error) {
9925
- const code = _optionalChain([error, 'optionalAccess', _187 => _187.code]);
10065
+ const code = _optionalChain([error, 'optionalAccess', _189 => _189.code]);
9926
10066
  if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
9927
10067
  throw error;
9928
10068
  }
@@ -9949,7 +10089,7 @@ async function postProcessVercelOutput(root, outputDir, fs, config, farmWorkflow
9949
10089
  try {
9950
10090
  await moveVercelOutputPath(publicDir, staticDir, fs);
9951
10091
  } catch (error) {
9952
- if (_optionalChain([error, 'optionalAccess', _188 => _188.code]) !== "ENOENT") throw error;
10092
+ if (_optionalChain([error, 'optionalAccess', _190 => _190.code]) !== "ENOENT") throw error;
9953
10093
  }
9954
10094
  await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs);
9955
10095
  await copyPrismaClientForVercel(root, nitroFuncDir, fs);
@@ -9966,7 +10106,7 @@ async function postProcessVercelOutput(root, outputDir, fs, config, farmWorkflow
9966
10106
  presetRoutes: Array.isArray(vercelConfig.routes) ? vercelConfig.routes : [],
9967
10107
  runtimeRoutes
9968
10108
  });
9969
- const vercelConfigWithWorkflowCrons = _chunkMPEYMSCFcjs.applyFarmWorkflowVercelCrons.call(void 0,
10109
+ const vercelConfigWithWorkflowCrons = _chunkVFQT3LAOcjs.applyFarmWorkflowVercelCrons.call(void 0,
9970
10110
  vercelConfig,
9971
10111
  farmWorkflows.workflows
9972
10112
  );
@@ -9982,7 +10122,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs) {
9982
10122
  const docsContentDir = resolveBuildDocsContentDir(config, root);
9983
10123
  if (!docsContentDir) return;
9984
10124
  const bundledContentDir = _path2.default.join(nitroFuncDir, "farm-docs-content");
9985
- const lastModifiedManifest = _chunkZ2YLTERKcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
10125
+ const lastModifiedManifest = _chunkVZJR7UTGcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
9986
10126
  fallback: "now"
9987
10127
  });
9988
10128
  await fs.rm(bundledContentDir, { recursive: true, force: true });
@@ -9992,7 +10132,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs) {
9992
10132
  force: true
9993
10133
  });
9994
10134
  await fs.writeFile(
9995
- _path2.default.join(bundledContentDir, _chunkZ2YLTERKcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
10135
+ _path2.default.join(bundledContentDir, _chunkVZJR7UTGcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
9996
10136
  `${JSON.stringify(lastModifiedManifest, null, 2)}
9997
10137
  `
9998
10138
  );
@@ -10069,7 +10209,7 @@ async function stageSharpRuntime(config, root, distDir, fs, preset) {
10069
10209
  try {
10070
10210
  await copyPackage("sharp", sharpRequire);
10071
10211
  if (!copiedPackages.has("sharp")) {
10072
- throw new Error(`Farm image optimization requires sharp. ${_chunkSJVKK4JEcjs.SHARP_INSTALL_HINT}`);
10212
+ throw new Error(`Farm image optimization requires sharp. ${_chunkICUQICNCcjs.SHARP_INSTALL_HINT}`);
10073
10213
  }
10074
10214
  } catch (error) {
10075
10215
  await fs.rm(stageDir, { recursive: true, force: true });
@@ -10283,7 +10423,7 @@ function createBuildTargetBaseline(config) {
10283
10423
  preset,
10284
10424
  distDir,
10285
10425
  outputDir,
10286
- outputWasDerived: outputDir === _chunkPQDFUSXDcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
10426
+ outputWasDerived: outputDir === _chunkF7JZENPFcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
10287
10427
  };
10288
10428
  }
10289
10429
  _chunkS3JO3N4Hcjs.__name.call(void 0, createBuildTargetBaseline, "createBuildTargetBaseline");
@@ -10293,8 +10433,8 @@ function resolveBuildTargets(config, options, baseline) {
10293
10433
  const distDir = config.distDir || ".farm";
10294
10434
  const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
10295
10435
  const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
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;
10436
+ const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkF7JZENPFcjs.getDeployTargetForPreset.call(void 0, preset);
10437
+ const outputDir = shouldRefreshDerivedOutput ? _chunkF7JZENPFcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
10298
10438
  return {
10299
10439
  root,
10300
10440
  preset,
@@ -10302,7 +10442,7 @@ function resolveBuildTargets(config, options, baseline) {
10302
10442
  distDir,
10303
10443
  deployTarget,
10304
10444
  outputDir,
10305
- deployOutputDir: _chunkPQDFUSXDcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
10445
+ deployOutputDir: _chunkF7JZENPFcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
10306
10446
  };
10307
10447
  }
10308
10448
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveBuildTargets, "resolveBuildTargets");
@@ -10311,7 +10451,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10311
10451
  const targetBaseline = createBuildTargetBaseline(config);
10312
10452
  let targets;
10313
10453
  const productionViteResultPromise = options.universal === false ? void 0 : Promise.allSettled([Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))]);
10314
- const pluginManager = new (0, _chunkSJVKK4JEcjs.PluginManager)({
10454
+ const pluginManager = new (0, _chunkICUQICNCcjs.PluginManager)({
10315
10455
  config,
10316
10456
  isDev: false,
10317
10457
  isProd: true
@@ -10340,12 +10480,12 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10340
10480
  };
10341
10481
  config = {
10342
10482
  ...config,
10343
- images: _chunkSJVKK4JEcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
10483
+ images: _chunkICUQICNCcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
10344
10484
  root: targets.root,
10345
10485
  preset: targets.preset
10346
10486
  })
10347
10487
  };
10348
- if (_optionalChain([config, 'access', _189 => _189.docs, 'optionalAccess', _190 => _190.enabled])) await _chunkIK6LVLKCcjs.loadFarmDocsEngine.call(void 0, );
10488
+ if (_optionalChain([config, 'access', _191 => _191.docs, 'optionalAccess', _192 => _192.enabled])) await _chunkIK6LVLKCcjs.loadFarmDocsEngine.call(void 0, );
10349
10489
  pluginManager.updateContext({ config });
10350
10490
  const { root, preset, srcDir, distDir, deployOutputDir } = targets;
10351
10491
  _chunk5QIKR7RRcjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
@@ -10359,8 +10499,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10359
10499
  });
10360
10500
  _chunk5QIKR7RRcjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
10361
10501
  const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
10362
- if (_optionalChain([productionViteResult, 'optionalAccess', _191 => _191.status]) === "rejected") throw productionViteResult.reason;
10363
- const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _192 => _192.value]);
10502
+ if (_optionalChain([productionViteResult, 'optionalAccess', _193 => _193.status]) === "rejected") throw productionViteResult.reason;
10503
+ const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _194 => _194.value]);
10364
10504
  const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
10365
10505
  projectModuleServer = await createProjectModuleServer(
10366
10506
  createViteServer,
@@ -10368,18 +10508,18 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10368
10508
  root,
10369
10509
  rendererBuild.signal
10370
10510
  );
10371
- const farmApp = _chunkSJVKK4JEcjs.createFarmApp.call(void 0, config, projectModuleServer);
10511
+ const farmApp = _chunkICUQICNCcjs.createFarmApp.call(void 0, config, projectModuleServer);
10372
10512
  await farmApp.initialize();
10373
10513
  const routeManager = farmApp.getRouteManager();
10374
10514
  const serverRenderer = farmApp.getServerRenderer();
10375
- const typeArtifacts = _chunkQJ3J6MZTcjs.generateFarmTypeArtifacts.call(void 0, {
10515
+ const typeArtifacts = _chunk3BHT4WMPcjs.generateFarmTypeArtifacts.call(void 0, {
10376
10516
  root,
10377
10517
  srcDir,
10378
10518
  layers: config.layers,
10379
10519
  plugins: config.plugins,
10380
10520
  extraRoutes: [
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)
10521
+ ..._optionalChain([config, 'access', _195 => _195.openapi, 'optionalAccess', _196 => _196.enabled]) && config.openapi.route ? [config.openapi.route] : [],
10522
+ ..._chunkVZJR7UTGcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
10383
10523
  ],
10384
10524
  suppressLintOnLink: config.suppressLintOnLink,
10385
10525
  componentExtensions: config.renderer.componentExtensions,
@@ -10388,7 +10528,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10388
10528
  const message = error instanceof Error ? error.message : String(error);
10389
10529
  _chunk5QIKR7RRcjs.logger.warn(`Route type generation failed (farm.d.ts may be stale): ${message}`);
10390
10530
  });
10391
- const apiRouteManager = new (0, _chunkMIDIZJZCcjs.APIRouteManager)(
10531
+ const apiRouteManager = new (0, _chunkXBML5KMGcjs.APIRouteManager)(
10392
10532
  _chunkVPTDD5XFcjs.getFarmAppDirectories.call(void 0, config),
10393
10533
  projectModuleServer,
10394
10534
  {
@@ -10463,7 +10603,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10463
10603
  throw error;
10464
10604
  } finally {
10465
10605
  try {
10466
- await _optionalChain([projectModuleServer, 'optionalAccess', _195 => _195.close, 'call', _196 => _196()]);
10606
+ await _optionalChain([projectModuleServer, 'optionalAccess', _197 => _197.close, 'call', _198 => _198()]);
10467
10607
  } finally {
10468
10608
  rendererBuild.abort();
10469
10609
  }
@@ -10475,7 +10615,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
10475
10615
  ssr: true,
10476
10616
  buildLifetime
10477
10617
  });
10478
- const viteConfig = _chunkSJVKK4JEcjs.mergeFarmViteConfig.call(void 0,
10618
+ const viteConfig = _chunkICUQICNCcjs.mergeFarmViteConfig.call(void 0,
10479
10619
  {
10480
10620
  root,
10481
10621
  appType: "custom",
@@ -10487,7 +10627,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
10487
10627
  },
10488
10628
  plugins: [
10489
10629
  ...rendererVitePlugins,
10490
- _chunkSJVKK4JEcjs.farmFontImportsPlugin.call(void 0, {
10630
+ _chunkICUQICNCcjs.farmFontImportsPlugin.call(void 0, {
10491
10631
  root,
10492
10632
  basePath: config.basePath,
10493
10633
  publicDir: config.publicDir
@@ -10499,7 +10639,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
10499
10639
  hmr: false
10500
10640
  },
10501
10641
  resolve: {
10502
- alias: _chunkSJVKK4JEcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
10642
+ alias: _chunkICUQICNCcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
10503
10643
  dedupe: [...config.renderer.dedupe || []]
10504
10644
  },
10505
10645
  optimizeDeps: {
@@ -10585,7 +10725,7 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
10585
10725
  define: {
10586
10726
  __FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
10587
10727
  __FARM_ENV__: JSON.stringify(_chunkVEKFLAQMcjs.createBundledEnv.call(void 0, config.env)),
10588
- __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _197 => _197.env, 'optionalAccess', _198 => _198.public]) || {})
10728
+ __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _199 => _199.env, 'optionalAccess', _200 => _200.public]) || {})
10589
10729
  },
10590
10730
  plugins: [
10591
10731
  farmI18nClientBridgePlugin(),
@@ -10607,7 +10747,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
10607
10747
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveLegacyPageEntry, "resolveLegacyPageEntry");
10608
10748
  async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
10609
10749
  const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
10610
- import("./nitro-HSAQFXSS.cjs"),
10750
+ import("./nitro-OVPLKPE2.cjs"),
10611
10751
  import("nitro/builder")
10612
10752
  ]);
10613
10753
  let nitroConfig = await createNitroConfig(
@@ -10620,7 +10760,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
10620
10760
  if (pluginManager) {
10621
10761
  nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
10622
10762
  }
10623
- const outputDir = _chunkPQDFUSXDcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
10763
+ const outputDir = _chunkF7JZENPFcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
10624
10764
  const serverOutputDir = _path2.default.join(outputDir, "server");
10625
10765
  const publicOutputDir = _path2.default.join(outputDir, "public");
10626
10766
  const { mkdir, cp } = await import("fs/promises");
@@ -10691,7 +10831,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
10691
10831
  root,
10692
10832
  preset,
10693
10833
  distDir,
10694
- outputDir: _chunkPQDFUSXDcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
10834
+ outputDir: _chunkF7JZENPFcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
10695
10835
  });
10696
10836
  }
10697
10837
  }