@farm.js/core 0.1.67 → 0.1.69

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 (297) hide show
  1. package/dist/{agent-mcp.d-DWyWkTSy.d.mts → agent-mcp.d-DOfBMEzP.d.mts} +1 -1
  2. package/dist/{agent-mcp.d-BFu9xHAi.d.ts → agent-mcp.d-DnIgriX1.d.ts} +1 -1
  3. package/dist/agent-runtime.d.mts +5 -3
  4. package/dist/agent-runtime.d.ts +5 -3
  5. package/dist/{analyzer-TTIIXXMQ.mjs → analyzer-NAL5TJUP.mjs} +2 -2
  6. package/dist/analyzer-SAJSV6SP.cjs +16 -0
  7. package/dist/api/node.d.mts +7 -5
  8. package/dist/api/node.d.ts +7 -5
  9. package/dist/api/route-manager.d.mts +7 -5
  10. package/dist/api/route-manager.d.ts +7 -5
  11. package/dist/api/runtime.d.mts +6 -4
  12. package/dist/api/runtime.d.ts +6 -4
  13. package/dist/api.cjs +2 -2
  14. package/dist/api.d.mts +8 -23
  15. package/dist/api.d.ts +8 -23
  16. package/dist/api.mjs +1 -1
  17. package/dist/{app-manifest.d-CwfhGrVR.d.ts → app-manifest.d-CaAcaukR.d.ts} +1 -1
  18. package/dist/{app-manifest.d-CRmjN5j9.d.mts → app-manifest.d-_BVbI0xp.d.mts} +1 -1
  19. package/dist/app-markdown.cjs +3 -3
  20. package/dist/app-markdown.d.mts +10 -10
  21. package/dist/app-markdown.d.ts +10 -10
  22. package/dist/app-markdown.mjs +2 -2
  23. package/dist/{app.d-BX9LVTiP.d.ts → app.d-BWeDqOaF.d.ts} +6 -6
  24. package/dist/{app.d-uBBUxwyV.d.mts → app.d-CaPwtytN.d.mts} +6 -6
  25. package/dist/{base-path.d-BOUV5ozD.d.mts → base-path.d-CTDVF0Fc.d.mts} +2 -1
  26. package/dist/{base-path.d-BOUV5ozD.d.ts → base-path.d-CTDVF0Fc.d.ts} +2 -1
  27. package/dist/{chunk-HM7AGSKU.cjs → chunk-22LGTSBA.cjs} +1 -1
  28. package/dist/{chunk-4JX3M4C6.cjs → chunk-23VJEGKC.cjs} +2 -1
  29. package/dist/{chunk-V5MQMQ2P.mjs → chunk-2P7UYHZP.mjs} +1 -1
  30. package/dist/{chunk-Q37INCXG.cjs → chunk-3EEINK7G.cjs} +11 -2
  31. package/dist/{chunk-BRWIVOV4.cjs → chunk-3GNHJ3RN.cjs} +10 -8
  32. package/dist/{chunk-QJVW76JG.mjs → chunk-3Y52TWYU.mjs} +2 -2
  33. package/dist/{chunk-OB3IFUK6.cjs → chunk-437QZIC2.cjs} +4 -4
  34. package/dist/{chunk-DCXSIEFE.cjs → chunk-4JRAMCUP.cjs} +59 -38
  35. package/dist/{chunk-Q5UX55YA.cjs → chunk-4W4ZWSV2.cjs} +887 -485
  36. package/dist/{chunk-JWSI5WO4.mjs → chunk-4ZXKYCYK.mjs} +1 -1
  37. package/dist/{chunk-N35YPV4N.mjs → chunk-57QAQU4F.mjs} +9 -7
  38. package/dist/{chunk-AQDLVHNF.mjs → chunk-5FBZJJGA.mjs} +17 -0
  39. package/dist/{chunk-HP2DQGQH.mjs → chunk-5TOWKGV3.mjs} +1 -1
  40. package/dist/{chunk-556H7JCE.cjs → chunk-6GQJVY4E.cjs} +32 -27
  41. package/dist/{chunk-PL6RTBDE.cjs → chunk-ABIBASLJ.cjs} +2 -2
  42. package/dist/{chunk-H37MDCPR.mjs → chunk-ANMIR6US.mjs} +1 -1
  43. package/dist/{chunk-DQJ2CIH7.cjs → chunk-ASYOWPSR.cjs} +2 -1
  44. package/dist/{chunk-QGJ4FI2G.mjs → chunk-C6HGUTXB.mjs} +113 -29
  45. package/dist/{chunk-UHNSY2PQ.mjs → chunk-CKCKCUYO.mjs} +826 -424
  46. package/dist/{chunk-IRA2CZAY.mjs → chunk-CRVSYDHV.mjs} +2 -2
  47. package/dist/{chunk-2ZOYOYEE.mjs → chunk-D5F7RPZP.mjs} +71 -1
  48. package/dist/{chunk-N5DQMOAG.cjs → chunk-DHR2WDSL.cjs} +275 -92
  49. package/dist/{chunk-QGQP6QKO.cjs → chunk-DWLNLU55.cjs} +2 -2
  50. package/dist/{chunk-52Y3C3HG.mjs → chunk-E7VF3LQ5.mjs} +3 -2
  51. package/dist/{chunk-V5RTHYJB.cjs → chunk-F6YLXK5L.cjs} +93 -25
  52. package/dist/{chunk-HNVAZGQD.cjs → chunk-FJMC24KG.cjs} +2 -2
  53. package/dist/{chunk-KCY52OUQ.cjs → chunk-FSODPZRT.cjs} +1 -1
  54. package/dist/{chunk-PPX7UOFY.cjs → chunk-FVYBEMOD.cjs} +55 -38
  55. package/dist/{chunk-6YBYX4K4.mjs → chunk-G7NBPP7H.mjs} +1 -1
  56. package/dist/{chunk-HFHJJXSV.mjs → chunk-GFPS7MNE.mjs} +1 -1
  57. package/dist/{chunk-LPIZMU7D.cjs → chunk-GQ6QOH7T.cjs} +9 -5
  58. package/dist/{chunk-BZWTBELF.cjs → chunk-GTQOEEE7.cjs} +77 -7
  59. package/dist/{chunk-6V5YWI4W.cjs → chunk-GUMKIQJL.cjs} +2 -2
  60. package/dist/{chunk-3T5TLFCQ.mjs → chunk-HEJM46HQ.mjs} +11 -2
  61. package/dist/{chunk-F43OG25P.cjs → chunk-I7J5RLGO.cjs} +15 -1
  62. package/dist/chunk-ICFPTHXM.mjs +97 -0
  63. package/dist/{chunk-WGHY3OL5.mjs → chunk-IYLZZTP6.mjs} +233 -50
  64. package/dist/{chunk-WUTFJOV7.cjs → chunk-JFPKARWM.cjs} +16 -8
  65. package/dist/{chunk-TEG6HJVF.mjs → chunk-JL2YW5KX.mjs} +1 -0
  66. package/dist/{chunk-23PVOIPT.cjs → chunk-L5OZN6YW.cjs} +3 -3
  67. package/dist/{chunk-QITSS4TD.cjs → chunk-L6NWQ3DR.cjs} +537 -356
  68. package/dist/{chunk-3T7ALZJF.cjs → chunk-LR4KP3I7.cjs} +2 -2
  69. package/dist/{chunk-CO3YMZFD.mjs → chunk-MAGFDK4Q.mjs} +1 -1
  70. package/dist/{chunk-VFXE6NWR.mjs → chunk-MGKWYPE3.mjs} +2 -1
  71. package/dist/{chunk-5TA63JD3.mjs → chunk-MGZVDX4R.mjs} +1 -1
  72. package/dist/{chunk-6SQZXRJ2.cjs → chunk-MMDKYJ5V.cjs} +7 -7
  73. package/dist/{chunk-5Y2P454O.cjs → chunk-MTBDJ326.cjs} +6 -5
  74. package/dist/{chunk-XUES6OET.mjs → chunk-MV7NWU23.mjs} +1 -1
  75. package/dist/{chunk-4IHMHFQB.cjs → chunk-NG2EZ6QS.cjs} +28 -1
  76. package/dist/{chunk-F7JKVHU2.mjs → chunk-NVOMQLI2.mjs} +15 -1
  77. package/dist/{chunk-5IQ2ERQA.cjs → chunk-O47W53D3.cjs} +1 -1
  78. package/dist/{chunk-22IWL4YD.cjs → chunk-OCNV4CI2.cjs} +21 -2
  79. package/dist/{chunk-3TXKFRSO.mjs → chunk-OEL5EPOJ.mjs} +1 -1
  80. package/dist/{chunk-E6CD45JK.mjs → chunk-PDQ6EGPK.mjs} +26 -5
  81. package/dist/{chunk-VK54PDQ6.mjs → chunk-PEYDQMSA.mjs} +86 -18
  82. package/dist/{chunk-KSZK34HU.mjs → chunk-PJQ5W356.mjs} +16 -8
  83. package/dist/{chunk-72KCTHLV.cjs → chunk-PRL7FXG4.cjs} +113 -29
  84. package/dist/{chunk-JSOCDYER.cjs → chunk-Q4HH5Q6A.cjs} +15 -1
  85. package/dist/{chunk-YVTS3S3F.cjs → chunk-QOGIZKSO.cjs} +3 -3
  86. package/dist/{chunk-DB2HSHQA.cjs → chunk-QSUYB3RH.cjs} +14 -14
  87. package/dist/{chunk-724MGMIL.mjs → chunk-R2ZHU37O.mjs} +19 -0
  88. package/dist/{chunk-YQYTQJZN.mjs → chunk-RLH5AH2M.mjs} +1 -1
  89. package/dist/{chunk-WDD5CTZW.mjs → chunk-SZORL7EW.mjs} +24 -19
  90. package/dist/{chunk-6R53ZWX2.cjs → chunk-TKYOJ5G2.cjs} +3 -3
  91. package/dist/{chunk-XNZWMXCF.mjs → chunk-UHU4QALN.mjs} +330 -149
  92. package/dist/{chunk-J7JHVCWA.cjs → chunk-UKZ6AWKZ.cjs} +2 -1
  93. package/dist/{chunk-GTV2ABO7.mjs → chunk-ULMXZYOA.mjs} +162 -33
  94. package/dist/{chunk-4DRINDGN.cjs → chunk-VO65MYJD.cjs} +254 -125
  95. package/dist/chunk-W44X6IC2.cjs +97 -0
  96. package/dist/{chunk-UHE5JUKB.mjs → chunk-XCAQTCGK.mjs} +1 -1
  97. package/dist/{chunk-DGOFR7D5.cjs → chunk-Y6KHPJDB.cjs} +2 -2
  98. package/dist/{chunk-DXZ57EPE.mjs → chunk-YOHHL2UE.mjs} +14 -0
  99. package/dist/{chunk-KWFNUODD.mjs → chunk-YVPX5PI5.mjs} +1 -0
  100. package/dist/{chunk-HRPTMX5C.mjs → chunk-ZR2QB45W.mjs} +7 -3
  101. package/dist/{chunk-JVM3DKZE.mjs → chunk-ZYCEEE3V.mjs} +1 -1
  102. package/dist/{chunk-5FE5YT2N.mjs → chunk-ZZGQD3LL.mjs} +28 -1
  103. package/dist/{client-component.d-DWRKyAp5.d.ts → client-component.d-CfJxuXZl.d.ts} +2 -2
  104. package/dist/{client-component.d-CDRvRmbU.d.mts → client-component.d-CnEeVvGG.d.mts} +2 -2
  105. package/dist/{client-plugins.d-CrKZiNSN.d.ts → client-plugins.d-D7dHV1Nf.d.ts} +37 -236
  106. package/dist/{client-plugins.d-BNILjfX3.d.mts → client-plugins.d-Do5ULA0x.d.mts} +37 -236
  107. package/dist/client-plugins.d.mts +5 -3
  108. package/dist/client-plugins.d.ts +5 -3
  109. package/dist/client.cjs +6 -6
  110. package/dist/client.d.mts +10 -8
  111. package/dist/client.d.ts +10 -8
  112. package/dist/client.mjs +5 -5
  113. package/dist/config.d.mts +5 -3
  114. package/dist/config.d.ts +5 -3
  115. package/dist/deployment.cjs +4 -2
  116. package/dist/deployment.d.mts +15 -1
  117. package/dist/deployment.d.ts +15 -1
  118. package/dist/deployment.mjs +3 -1
  119. package/dist/desktop.d.mts +6 -4
  120. package/dist/desktop.d.ts +6 -4
  121. package/dist/{devtools-RZVT4JVN.cjs → devtools-7HNDS4SY.cjs} +7 -7
  122. package/dist/{devtools-UFQYT3VA.mjs → devtools-BP4EBTKQ.mjs} +6 -6
  123. package/dist/docs.cjs +11 -9
  124. package/dist/docs.d.mts +19 -5
  125. package/dist/docs.d.ts +19 -5
  126. package/dist/docs.mjs +11 -9
  127. package/dist/environment/vite.cjs +5 -5
  128. package/dist/environment/vite.d.mts +1 -1
  129. package/dist/environment/vite.d.ts +1 -1
  130. package/dist/environment/vite.mjs +4 -4
  131. package/dist/{generate-route-types.d-BL2pq6xC.d.ts → generate-route-types.d-B76M5R11.d.ts} +1 -1
  132. package/dist/{generate-route-types.d-BoVDU8qX.d.mts → generate-route-types.d-CaGMIaNI.d.mts} +1 -1
  133. package/dist/image/server.cjs +2 -2
  134. package/dist/image/server.mjs +1 -1
  135. package/dist/image/sharp.cjs +9 -9
  136. package/dist/image/sharp.mjs +1 -1
  137. package/dist/index.cjs +45 -39
  138. package/dist/{index.d-Bdm6866n.d.mts → index.d-B1MpEJAo.d.mts} +1 -1
  139. package/dist/{index.d-Dey5T14f.d.ts → index.d-CVFk37uX.d.ts} +1 -1
  140. package/dist/index.d.mts +26 -23
  141. package/dist/index.d.ts +26 -23
  142. package/dist/index.mjs +48 -42
  143. package/dist/instrumentation.cjs +3 -3
  144. package/dist/instrumentation.mjs +2 -2
  145. package/dist/integrations/orm.d.mts +5 -3
  146. package/dist/integrations/orm.d.ts +5 -3
  147. package/dist/integrations.d.mts +5 -3
  148. package/dist/integrations.d.ts +5 -3
  149. package/dist/internal/app-markdown-runtime.cjs +2 -2
  150. package/dist/internal/app-markdown-runtime.d.mts +12 -5
  151. package/dist/internal/app-markdown-runtime.d.ts +12 -5
  152. package/dist/internal/app-markdown-runtime.mjs +1 -1
  153. package/dist/internal/build-runtime.cjs +34 -32
  154. package/dist/internal/build-runtime.d.mts +7 -5
  155. package/dist/internal/build-runtime.d.ts +7 -5
  156. package/dist/internal/build-runtime.mjs +33 -31
  157. package/dist/internal/cli-runtime.cjs +10 -10
  158. package/dist/internal/cli-runtime.mjs +9 -9
  159. package/dist/internal/client-error-overlay.cjs +4 -4
  160. package/dist/internal/client-error-overlay.mjs +1 -1
  161. package/dist/internal/client-runtime.cjs +31 -36
  162. package/dist/internal/client-runtime.d.mts +9 -7
  163. package/dist/internal/client-runtime.d.ts +9 -7
  164. package/dist/internal/client-runtime.mjs +22 -27
  165. package/dist/internal/compression-runtime.d.mts +5 -3
  166. package/dist/internal/compression-runtime.d.ts +5 -3
  167. package/dist/internal/config-runtime.cjs +8 -8
  168. package/dist/internal/config-runtime.d.mts +9 -7
  169. package/dist/internal/config-runtime.d.ts +9 -7
  170. package/dist/internal/config-runtime.mjs +7 -7
  171. package/dist/internal/form-actions.cjs +7 -2
  172. package/dist/internal/form-actions.d.mts +10 -3
  173. package/dist/internal/form-actions.d.ts +10 -3
  174. package/dist/internal/form-actions.mjs +8 -3
  175. package/dist/internal/infra-analytics-runtime.cjs +6 -6
  176. package/dist/internal/infra-analytics-runtime.mjs +4 -4
  177. package/dist/internal/islands-boot.cjs +6 -1
  178. package/dist/internal/islands-boot.mjs +6 -1
  179. package/dist/internal/native-server-fns.cjs +4 -4
  180. package/dist/internal/native-server-fns.mjs +3 -3
  181. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  182. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  183. package/dist/internal/production-node-env.cjs +4 -2
  184. package/dist/internal/production-node-env.d.mts +22 -1
  185. package/dist/internal/production-node-env.d.ts +22 -1
  186. package/dist/internal/production-node-env.mjs +3 -1
  187. package/dist/internal/production-runtime.cjs +17 -9
  188. package/dist/internal/production-runtime.d.mts +31 -19
  189. package/dist/internal/production-runtime.d.ts +31 -19
  190. package/dist/internal/production-runtime.mjs +18 -10
  191. package/dist/internal/server-tree.cjs +2 -2
  192. package/dist/internal/server-tree.d.mts +0 -5
  193. package/dist/internal/server-tree.d.ts +0 -5
  194. package/dist/internal/server-tree.mjs +1 -1
  195. package/dist/internal/vercel-edge-middleware.cjs +87 -0
  196. package/dist/internal/vercel-edge-middleware.d.mts +39 -0
  197. package/dist/internal/vercel-edge-middleware.d.ts +39 -0
  198. package/dist/internal/vercel-edge-middleware.mjs +87 -0
  199. package/dist/layers-7P4RLKVX.cjs +20 -0
  200. package/dist/{layers-T55SA47E.mjs → layers-XQ7VFMWO.mjs} +4 -2
  201. package/dist/{layers.d-CcS42OGR.d.mts → layers.d-CH0bC4QL.d.mts} +2 -1
  202. package/dist/{layers.d-CcS42OGR.d.ts → layers.d-CH0bC4QL.d.ts} +2 -1
  203. package/dist/markdown.d.mts +5 -3
  204. package/dist/markdown.d.ts +5 -3
  205. package/dist/middleware.cjs +4 -4
  206. package/dist/middleware.d.mts +8 -5
  207. package/dist/middleware.d.ts +8 -5
  208. package/dist/middleware.mjs +6 -6
  209. package/dist/mobile.d.mts +4 -4
  210. package/dist/mobile.d.ts +4 -4
  211. package/dist/{mount.d-BP0nLYQO.d.mts → mount.d-CBqr-LfI.d.mts} +1 -1
  212. package/dist/{mount.d-CkiPky_F.d.ts → mount.d-CGzN61Kq.d.ts} +1 -1
  213. package/dist/{navigation-delegate.d-CdBP-hkZ.d.mts → navigation-delegate.d-BwCOhpj7.d.mts} +1 -1
  214. package/dist/{navigation-delegate.d-DchcGzAQ.d.ts → navigation-delegate.d-CLH2dXjy.d.ts} +1 -1
  215. package/dist/navigation.cjs +5 -5
  216. package/dist/navigation.d.mts +8 -6
  217. package/dist/navigation.d.ts +8 -6
  218. package/dist/navigation.mjs +4 -4
  219. package/dist/{nitro-55YOZWRA.mjs → nitro-NSTXT7LB.mjs} +2 -2
  220. package/dist/{nitro-EEX2J3KB.cjs → nitro-Y3LGITW3.cjs} +4 -4
  221. package/dist/node-module-bundle-LIZ2KMVW.cjs +13 -0
  222. package/dist/node-module-bundle-VR6NV6AI.mjs +13 -0
  223. package/dist/{plugin-WIU4GDD4.cjs → plugin-F2O4BFTK.cjs} +2 -2
  224. package/dist/{plugin-SAS22JL7.mjs → plugin-VEBRN7A3.mjs} +1 -1
  225. package/dist/plugin.cjs +23 -23
  226. package/dist/plugin.d.mts +7 -5
  227. package/dist/plugin.d.ts +7 -5
  228. package/dist/plugin.mjs +22 -22
  229. package/dist/{production-runtime.d-Dou_Htas.d.ts → production-runtime.d-BMyyLGBB.d.ts} +3 -57
  230. package/dist/{production-runtime.d-VwsBzIee.d.mts → production-runtime.d-DMZY3OgV.d.mts} +3 -57
  231. package/dist/query/client.cjs +6 -6
  232. package/dist/query/client.mjs +2 -2
  233. package/dist/{render-plan.d-LKymStDJ.d.mts → render-plan.d-CzGDjcT0.d.mts} +1 -1
  234. package/dist/{render-plan.d-D8UakAIk.d.ts → render-plan.d-W6LmjD6y.d.ts} +1 -1
  235. package/dist/renderer/react/server.cjs +2 -2
  236. package/dist/renderer/react/server.mjs +1 -1
  237. package/dist/renderer-client.cjs +5 -5
  238. package/dist/renderer-client.d.mts +8 -6
  239. package/dist/renderer-client.d.ts +8 -6
  240. package/dist/renderer-client.mjs +2 -2
  241. package/dist/renderer.d.mts +5 -0
  242. package/dist/renderer.d.ts +5 -0
  243. package/dist/{request.d-B928QjWy.d.ts → request.d-CTVRZiQv.d.ts} +1 -1
  244. package/dist/{request.d-KG-4d2eG.d.mts → request.d-CgNVderU.d.mts} +1 -1
  245. package/dist/request.d.mts +6 -4
  246. package/dist/request.d.ts +6 -4
  247. package/dist/{route-rendering.d-NIHQeb4m.d.mts → route-rendering.d-D0bmZVJA.d.mts} +1 -1
  248. package/dist/{route-rendering.d-DoEe_w9t.d.ts → route-rendering.d-FDSNtCMg.d.ts} +1 -1
  249. package/dist/{router.d-DYnRHQwz.d.ts → router.d-DZ3ldniI.d.ts} +1 -1
  250. package/dist/{router.d-B8PkJSGp.d.mts → router.d-GRKm_uAV.d.mts} +1 -1
  251. package/dist/{routes.d-uUBZyWoK.d.ts → routes.d-9GFFNioh.d.ts} +1 -1
  252. package/dist/{routes.d-DgZ_jgGG.d.mts → routes.d-CrEy0lJS.d.mts} +1 -1
  253. package/dist/routes.d.mts +5 -3
  254. package/dist/routes.d.ts +5 -3
  255. package/dist/{rsc-pipeline-7K5H2RPH.cjs → rsc-pipeline-J4KKBSCH.cjs} +10 -10
  256. package/dist/{rsc-pipeline-4OJ5ZQNZ.mjs → rsc-pipeline-PJZOVYSY.mjs} +9 -9
  257. package/dist/{runtime-X52Q7JFR.cjs → runtime-OLEO5NXF.cjs} +20 -20
  258. package/dist/{runtime-U7O3HZOZ.mjs → runtime-QDBSE4H6.mjs} +12 -12
  259. package/dist/{runtime.d-BxQIzwfy.d.mts → runtime.d-DqXihlxm.d.mts} +1 -1
  260. package/dist/{runtime.d-DP7mEkEF.d.ts → runtime.d-pqFQBU2N.d.ts} +1 -1
  261. package/dist/server-http.d-rAe7lAQc.d.mts +70 -0
  262. package/dist/server-http.d-rAe7lAQc.d.ts +70 -0
  263. package/dist/server-plugins.d.mts +6 -4
  264. package/dist/server-plugins.d.ts +6 -4
  265. package/dist/server.cjs +52 -50
  266. package/dist/server.d-C5FFrZAo.d.ts +57 -0
  267. package/dist/server.d-DgC8xew5.d.mts +57 -0
  268. package/dist/server.d.mts +13 -11
  269. package/dist/server.d.ts +13 -11
  270. package/dist/server.mjs +31 -29
  271. package/dist/{spa-router.d-DsFDHTsv.d.ts → spa-router.d-DhOhaQ-7.d.ts} +2 -2
  272. package/dist/{spa-router.d-BgHPVMhz.d.mts → spa-router.d-Dhvy60p4.d.mts} +2 -2
  273. package/dist/testing.d.mts +5 -3
  274. package/dist/testing.d.ts +5 -3
  275. package/dist/types.d-xCIhyjOq.d.mts +233 -0
  276. package/dist/types.d-xCIhyjOq.d.ts +233 -0
  277. package/dist/{utils.d-zxAVcf_V.d.ts → utils.d-BVCMRRau.d.ts} +1 -1
  278. package/dist/{utils.d-BKyKDBR1.d.mts → utils.d-Q8EHCpkF.d.mts} +1 -1
  279. package/dist/version.cjs +2 -2
  280. package/dist/version.mjs +1 -1
  281. package/dist/vite.cjs +23 -23
  282. package/dist/vite.d.mts +10 -8
  283. package/dist/vite.d.ts +10 -8
  284. package/dist/vite.mjs +22 -22
  285. package/dist/workflows.cjs +2 -2
  286. package/dist/workflows.d.mts +121 -1
  287. package/dist/workflows.d.ts +121 -1
  288. package/dist/workflows.mjs +1 -1
  289. package/package.json +7 -2
  290. package/dist/analyzer-KVZGVY5Q.cjs +0 -16
  291. package/dist/chunk-CLFEQGET.cjs +0 -60
  292. package/dist/chunk-MK5E44WP.mjs +0 -60
  293. package/dist/layers-DMRXRL7F.cjs +0 -18
  294. package/dist/node-module-bundle-7JHPPF6B.mjs +0 -11
  295. package/dist/node-module-bundle-YJGYBOGK.cjs +0 -11
  296. package/dist/workflows.d-CRMzQZ3k.d.mts +0 -188
  297. package/dist/workflows.d-CRMzQZ3k.d.ts +0 -188
@@ -9,6 +9,7 @@
9
9
  var _chunkE5UN4OWXcjs = require('./chunk-E5UN4OWX.cjs');
10
10
 
11
11
 
12
+ var _chunkMF3IA2AWcjs = require('./chunk-MF3IA2AW.cjs');
12
13
 
13
14
 
14
15
 
@@ -18,14 +19,14 @@ var _chunkE5UN4OWXcjs = require('./chunk-E5UN4OWX.cjs');
18
19
 
19
20
 
20
21
 
21
- var _chunk4IHMHFQBcjs = require('./chunk-4IHMHFQB.cjs');
22
22
 
23
23
 
24
- var _chunkMF3IA2AWcjs = require('./chunk-MF3IA2AW.cjs');
25
24
 
25
+ var _chunkNG2EZ6QScjs = require('./chunk-NG2EZ6QS.cjs');
26
26
 
27
27
 
28
- var _chunk23PVOIPTcjs = require('./chunk-23PVOIPT.cjs');
28
+
29
+ var _chunkL5OZN6YWcjs = require('./chunk-L5OZN6YW.cjs');
29
30
 
30
31
 
31
32
  var _chunkVM57CK74cjs = require('./chunk-VM57CK74.cjs');
@@ -38,9 +39,10 @@ var _chunk4BS3HSY7cjs = require('./chunk-4BS3HSY7.cjs');
38
39
 
39
40
 
40
41
 
41
- var _chunkDCXSIEFEcjs = require('./chunk-DCXSIEFE.cjs');
42
42
 
43
43
 
44
+ var _chunk4JRAMCUPcjs = require('./chunk-4JRAMCUP.cjs');
45
+
44
46
 
45
47
 
46
48
 
@@ -50,7 +52,9 @@ var _chunkDCXSIEFEcjs = require('./chunk-DCXSIEFE.cjs');
50
52
 
51
53
 
52
54
 
53
- var _chunkPPX7UOFYcjs = require('./chunk-PPX7UOFY.cjs');
55
+
56
+
57
+ var _chunkFVYBEMODcjs = require('./chunk-FVYBEMOD.cjs');
54
58
 
55
59
 
56
60
 
@@ -58,7 +62,10 @@ var _chunkPPX7UOFYcjs = require('./chunk-PPX7UOFY.cjs');
58
62
  var _chunkDZZHTMWMcjs = require('./chunk-DZZHTMWM.cjs');
59
63
 
60
64
 
61
- var _chunk6R53ZWX2cjs = require('./chunk-6R53ZWX2.cjs');
65
+ var _chunkUKZ6AWKZcjs = require('./chunk-UKZ6AWKZ.cjs');
66
+
67
+
68
+ var _chunkTKYOJ5G2cjs = require('./chunk-TKYOJ5G2.cjs');
62
69
 
63
70
 
64
71
  var _chunkV3UOEWCBcjs = require('./chunk-V3UOEWCB.cjs');
@@ -67,10 +74,10 @@ var _chunkV3UOEWCBcjs = require('./chunk-V3UOEWCB.cjs');
67
74
 
68
75
 
69
76
 
70
- var _chunk556H7JCEcjs = require('./chunk-556H7JCE.cjs');
77
+ var _chunk6GQJVY4Ecjs = require('./chunk-6GQJVY4E.cjs');
71
78
 
72
79
 
73
- var _chunkBRWIVOV4cjs = require('./chunk-BRWIVOV4.cjs');
80
+ var _chunk3GNHJ3RNcjs = require('./chunk-3GNHJ3RN.cjs');
74
81
 
75
82
 
76
83
  var _chunkOCS3PSYRcjs = require('./chunk-OCS3PSYR.cjs');
@@ -99,19 +106,24 @@ var _chunkOCS3PSYRcjs = require('./chunk-OCS3PSYR.cjs');
99
106
 
100
107
 
101
108
 
102
- var _chunkN5DQMOAGcjs = require('./chunk-N5DQMOAG.cjs');
103
109
 
104
110
 
105
111
 
106
- var _chunkJSOCDYERcjs = require('./chunk-JSOCDYER.cjs');
107
112
 
113
+ var _chunkDHR2WDSLcjs = require('./chunk-DHR2WDSL.cjs');
108
114
 
109
- var _chunkWUTFJOV7cjs = require('./chunk-WUTFJOV7.cjs');
110
115
 
111
116
 
112
117
 
118
+ var _chunkQ4HH5Q6Acjs = require('./chunk-Q4HH5Q6A.cjs');
113
119
 
114
- var _chunkYVTS3S3Fcjs = require('./chunk-YVTS3S3F.cjs');
120
+
121
+ var _chunkJFPKARWMcjs = require('./chunk-JFPKARWM.cjs');
122
+
123
+
124
+
125
+
126
+ var _chunkQOGIZKSOcjs = require('./chunk-QOGIZKSO.cjs');
115
127
 
116
128
 
117
129
 
@@ -138,7 +150,7 @@ var _chunk47JV57DAcjs = require('./chunk-47JV57DA.cjs');
138
150
 
139
151
 
140
152
 
141
- var _chunkLPIZMU7Dcjs = require('./chunk-LPIZMU7D.cjs');
153
+ var _chunkGQ6QOH7Tcjs = require('./chunk-GQ6QOH7T.cjs');
142
154
 
143
155
 
144
156
 
@@ -146,7 +158,7 @@ var _chunkLPIZMU7Dcjs = require('./chunk-LPIZMU7D.cjs');
146
158
  var _chunkX3MHKLCOcjs = require('./chunk-X3MHKLCO.cjs');
147
159
 
148
160
 
149
- var _chunk6V5YWI4Wcjs = require('./chunk-6V5YWI4W.cjs');
161
+ var _chunkGUMKIQJLcjs = require('./chunk-GUMKIQJL.cjs');
150
162
 
151
163
 
152
164
  var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
@@ -164,7 +176,7 @@ var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
164
176
 
165
177
 
166
178
 
167
- var _chunk4DRINDGNcjs = require('./chunk-4DRINDGN.cjs');
179
+ var _chunkVO65MYJDcjs = require('./chunk-VO65MYJD.cjs');
168
180
 
169
181
 
170
182
 
@@ -175,7 +187,8 @@ var _chunkSM2SYWARcjs = require('./chunk-SM2SYWAR.cjs');
175
187
  var _chunkERMUL73Lcjs = require('./chunk-ERMUL73L.cjs');
176
188
 
177
189
 
178
- var _chunk22IWL4YDcjs = require('./chunk-22IWL4YD.cjs');
190
+
191
+ var _chunkOCNV4CI2cjs = require('./chunk-OCNV4CI2.cjs');
179
192
 
180
193
 
181
194
 
@@ -185,7 +198,7 @@ var _chunk6JHZPB52cjs = require('./chunk-6JHZPB52.cjs');
185
198
  var _chunkRE5E2G5Scjs = require('./chunk-RE5E2G5S.cjs');
186
199
 
187
200
 
188
- var _chunk5Y2P454Ocjs = require('./chunk-5Y2P454O.cjs');
201
+ var _chunkMTBDJ326cjs = require('./chunk-MTBDJ326.cjs');
189
202
 
190
203
 
191
204
 
@@ -210,7 +223,7 @@ var _chunk4P5634G6cjs = require('./chunk-4P5634G6.cjs');
210
223
  var _chunk3EIPOTZVcjs = require('./chunk-3EIPOTZV.cjs');
211
224
 
212
225
 
213
- var _chunkQ37INCXGcjs = require('./chunk-Q37INCXG.cjs');
226
+ var _chunk3EEINK7Gcjs = require('./chunk-3EEINK7G.cjs');
214
227
 
215
228
 
216
229
 
@@ -220,8 +233,11 @@ var _chunk2HW5LWAHcjs = require('./chunk-2HW5LWAH.cjs');
220
233
  var _chunkFT6KJHS3cjs = require('./chunk-FT6KJHS3.cjs');
221
234
 
222
235
 
236
+ var _chunkASYOWPSRcjs = require('./chunk-ASYOWPSR.cjs');
237
+
223
238
 
224
- var _chunkKCY52OUQcjs = require('./chunk-KCY52OUQ.cjs');
239
+
240
+ var _chunkFSODPZRTcjs = require('./chunk-FSODPZRT.cjs');
225
241
 
226
242
 
227
243
 
@@ -266,16 +282,21 @@ var _chunkQMNWKQL4cjs = require('./chunk-QMNWKQL4.cjs');
266
282
  var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
267
283
 
268
284
 
269
- var _chunkHM7AGSKUcjs = require('./chunk-HM7AGSKU.cjs');
285
+ var _chunk22LGTSBAcjs = require('./chunk-22LGTSBA.cjs');
286
+
287
+
288
+ var _chunk23VJEGKCcjs = require('./chunk-23VJEGKC.cjs');
289
+
270
290
 
271
291
 
272
- var _chunkF43OG25Pcjs = require('./chunk-F43OG25P.cjs');
292
+ var _chunkI7J5RLGOcjs = require('./chunk-I7J5RLGO.cjs');
273
293
 
274
294
 
275
295
  var _chunkHDPT6OYEcjs = require('./chunk-HDPT6OYE.cjs');
276
296
 
277
297
 
278
298
 
299
+
279
300
  var _chunkD22BUQKWcjs = require('./chunk-D22BUQKW.cjs');
280
301
 
281
302
 
@@ -398,7 +419,7 @@ function getDocsTitle(docs) {
398
419
  return typeof docs.config.nav === "object" && docs.config.nav && "title" in docs.config.nav ? String(docs.config.nav.title || "Documentation") : "Documentation";
399
420
  }
400
421
  function loadPages(contentDir, docs) {
401
- return _chunkPPX7UOFYcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunkPPX7UOFYcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
422
+ return _chunkFVYBEMODcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunkFVYBEMODcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
402
423
  }
403
424
  function findSocialImagePath(html, basePath) {
404
425
  const match = /<meta\s+property=["']og:image["']\s+content=["']([^"']+)["']/i.exec(html) || /<meta\s+content=["']([^"']+)["']\s+property=["']og:image["']/i.exec(html);
@@ -416,7 +437,7 @@ async function addHandlerRoute(routes, pathname, handler, absolutePaths) {
416
437
  return response;
417
438
  }
418
439
  async function compileFarmDocsManifest(docs, options) {
419
- const contentDir = _chunkPPX7UOFYcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
440
+ const contentDir = _chunkFVYBEMODcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
420
441
  const pages = loadPages(contentDir, docs);
421
442
  const basePath = _chunkD22BUQKWcjs.normalizeFarmBasePath.call(void 0, options.basePath);
422
443
  const absolutePaths = [
@@ -424,7 +445,7 @@ async function compileFarmDocsManifest(docs, options) {
424
445
  _path2.default.resolve(contentDir),
425
446
  docs.configPath || ""
426
447
  ];
427
- const handler = _chunkPPX7UOFYcjs.createFarmDocsHandler.call(void 0, docs, {
448
+ const handler = _chunkFVYBEMODcjs.createFarmDocsHandler.call(void 0, docs, {
428
449
  root: options.root,
429
450
  srcDir: options.srcDir,
430
451
  clientEntry: options.clientEntry,
@@ -434,7 +455,7 @@ async function compileFarmDocsManifest(docs, options) {
434
455
  isPathGuarded: options.isPathGuarded,
435
456
  basePath
436
457
  });
437
- const apiHandler = _chunkDCXSIEFEcjs.createFarmDocsAPIHandler.call(void 0, {
458
+ const apiHandler = _chunk4JRAMCUPcjs.createFarmDocsAPIHandler.call(void 0, {
438
459
  rootDir: options.root,
439
460
  srcDir: options.srcDir,
440
461
  docs,
@@ -446,7 +467,7 @@ async function compileFarmDocsManifest(docs, options) {
446
467
  const apiMarkdown = {};
447
468
  for (const page of pages) {
448
469
  const htmlResponse = await addHandlerRoute(routes, page.href, handler, absolutePaths);
449
- const markdownPath = _chunkPPX7UOFYcjs.getFarmDocsMarkdownPath.call(void 0, page.href);
470
+ const markdownPath = _chunkFVYBEMODcjs.getFarmDocsMarkdownPath.call(void 0, page.href);
450
471
  await addHandlerRoute(routes, markdownPath, handler, absolutePaths);
451
472
  if (htmlResponse) {
452
473
  const socialImagePath = findSocialImagePath(await htmlResponse.text(), basePath);
@@ -531,7 +552,7 @@ async function compileFarmDocsManifest(docs, options) {
531
552
  post: await compileResponse(postResponse, absolutePaths),
532
553
  search: {
533
554
  pages: publicPages.map((page) => ({
534
- ..._chunkPPX7UOFYcjs.toFarmDocsMarkdownPage.call(void 0, page, basePath),
555
+ ..._chunkFVYBEMODcjs.toFarmDocsMarkdownPage.call(void 0, page, basePath),
535
556
  sourcePath: `farm-docs:${page.slug || "index"}`
536
557
  })),
537
558
  search: _nullishCoalesce(searchConfig, () => ( true)),
@@ -709,7 +730,7 @@ async function createFarmRouteRuntimeManifest(options) {
709
730
  const routes = [];
710
731
  for (const [pattern, entry] of options.routeManager.getRoutes()) {
711
732
  const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
712
- const rendering = await _chunkYVTS3S3Fcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
733
+ const rendering = await _chunkQOGIZKSOcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
713
734
  const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
714
735
  routes.push({
715
736
  kind: "page",
@@ -782,7 +803,7 @@ async function writeFarmRouteRuntimeManifest(directory, manifest) {
782
803
  return manifestPath;
783
804
  }
784
805
  function validateFarmRouteRuntimeDeployment(manifest, preset) {
785
- const runtime = _chunkF43OG25Pcjs.getFarmPresetRuntime.call(void 0, preset);
806
+ const runtime = _chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset);
786
807
  const warnings = /* @__PURE__ */ new Set();
787
808
  for (const route of manifest.routes) {
788
809
  if (route.rendering === "static") continue;
@@ -946,12 +967,14 @@ function createFarmVercelImmutableAssetRoute() {
946
967
  };
947
968
  }
948
969
  function buildFarmVercelRoutes(options) {
949
- const { presetRoutes, runtimeRoutes } = options;
970
+ const { presetRoutes, runtimeRoutes, middlewareRoutes = [], canonicalSlashRoutes = [] } = options;
950
971
  const filesystemIndex = presetRoutes.findIndex((route) => route.handle === "filesystem");
951
972
  const sourceRoutes = filesystemIndex >= 0 ? presetRoutes.slice(0, filesystemIndex) : [];
952
973
  const preservedSourceRoutes = sourceRoutes.filter((route) => route.continue !== true);
953
974
  return [
954
975
  ...preservedSourceRoutes,
976
+ ...middlewareRoutes,
977
+ ...canonicalSlashRoutes,
955
978
  createFarmVercelImmutableAssetRoute(),
956
979
  { handle: "filesystem" },
957
980
  ...runtimeRoutes,
@@ -961,6 +984,18 @@ function buildFarmVercelRoutes(options) {
961
984
  }
962
985
  ];
963
986
  }
987
+ function escapeRegExp2(value) {
988
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
989
+ }
990
+ function createFarmVercelCanonicalSlashRoutes(publicPaths) {
991
+ const otherSpellings = [
992
+ ...new Set(
993
+ publicPaths.filter((pathname) => pathname !== "/").map((pathname) => pathname.endsWith("/") ? pathname.replace(/\/+$/, "") : `${pathname}/`).filter((pathname) => pathname !== "")
994
+ )
995
+ ];
996
+ if (otherSpellings.length === 0) return [];
997
+ return [{ src: `^(?:${otherSpellings.map(escapeRegExp2).join("|")})$`, dest: "/__nitro" }];
998
+ }
964
999
 
965
1000
  // src/nitro/ssr-public-assets.ts
966
1001
 
@@ -1025,7 +1060,7 @@ function collectServerOnlySSRAssets(bundle) {
1025
1060
  return serverOnly;
1026
1061
  }
1027
1062
  function canReadServerFiles(preset) {
1028
- return _chunkF43OG25Pcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" && !preset.startsWith("cloudflare");
1063
+ return _chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" && !preset.startsWith("cloudflare");
1029
1064
  }
1030
1065
  function assertServerReadSSRAssetsSupported(bundle, preset, root) {
1031
1066
  if (canReadServerFiles(preset)) return;
@@ -1219,14 +1254,17 @@ function farmStripPlatformConfigPlugin(configFiles) {
1219
1254
  // Before the TypeScript transform, so its import elision also drops imports only the
1220
1255
  // removed block used (`readFileSync` for a version, say).
1221
1256
  enforce: "pre",
1222
- async transform(code, id) {
1223
- const file = id.split("?", 1)[0];
1224
- if (!files.has(_path2.default.resolve(file)) && !files.has(realPath(file))) return null;
1225
- const { parseAst } = await import("rolldown/parseAst");
1226
- const extension = _path2.default.extname(file).slice(1);
1227
- const lang = /^[cm]?tsx?$/.test(extension) ? extension.endsWith("x") ? "tsx" : "ts" : extension.endsWith("x") ? "jsx" : "js";
1228
- const stripped = stripPlatformConfigSource(code, (source) => parseAst(source, { lang }));
1229
- return stripped === null ? null : { code: stripped, map: null };
1257
+ transform: {
1258
+ filter: { id: _chunkDHR2WDSLcjs.fileNamePattern.call(void 0, configFiles) },
1259
+ async handler(code, id) {
1260
+ const file = id.split("?", 1)[0];
1261
+ if (!files.has(_path2.default.resolve(file)) && !files.has(realPath(file))) return null;
1262
+ const { parseAst } = await import("rolldown/parseAst");
1263
+ const extension = _path2.default.extname(file).slice(1);
1264
+ const lang = /^[cm]?tsx?$/.test(extension) ? extension.endsWith("x") ? "tsx" : "ts" : extension.endsWith("x") ? "jsx" : "js";
1265
+ const stripped = stripPlatformConfigSource(code, (source) => parseAst(source, { lang }));
1266
+ return stripped === null ? null : { code: stripped, map: null };
1267
+ }
1230
1268
  }
1231
1269
  };
1232
1270
  }
@@ -1309,6 +1347,11 @@ function readStaticMiddlewareConfig(program) {
1309
1347
  for (const property of init.properties) {
1310
1348
  if (property.type !== "Property" || property.computed) return "unknown";
1311
1349
  const key = _nullishCoalesce(_optionalChain([property, 'access', _36 => _36.key, 'optionalAccess', _37 => _37.name]), () => ( _optionalChain([property, 'access', _38 => _38.key, 'optionalAccess', _39 => _39.value])));
1350
+ if (key === "runtime") {
1351
+ const runtime = literalMatcher(unwrap(property.value));
1352
+ if (runtime === "edge" || runtime === "nodejs") config.runtime = runtime;
1353
+ continue;
1354
+ }
1312
1355
  if (key !== "matcher" && key !== "exclude") continue;
1313
1356
  const matchers = literalMatchers(unwrap(property.value));
1314
1357
  if (!matchers) return "unknown";
@@ -1331,6 +1374,164 @@ async function readMiddlewareFileConfig(filePath) {
1331
1374
  }
1332
1375
  }
1333
1376
 
1377
+ // src/nitro/vercel-edge-middleware.ts
1378
+
1379
+
1380
+ var _zlib = require('zlib');
1381
+ var FARM_VERCEL_EDGE_MIDDLEWARE_FUNCTION = "_farm_middleware";
1382
+ var FARM_VERCEL_EDGE_NOT_FOUND_PATH = "/__farm/not-found";
1383
+ var EDGE_NODE_MODULES = /* @__PURE__ */ new Set(["async_hooks", "events", "buffer", "assert", "util"]);
1384
+ var EDGE_FUNCTION_SIZE_WARNING_BYTES = 1024 * 1024;
1385
+ function farmTargetRunsEdgeMiddleware(preset) {
1386
+ return preset === "vercel";
1387
+ }
1388
+ function isFarmEdgeMiddlewareRoute(route) {
1389
+ return typeof route.config === "object" && _optionalChain([route, 'access', _42 => _42.config, 'optionalAccess', _43 => _43.runtime]) === "edge";
1390
+ }
1391
+ function escapeRegExp3(value) {
1392
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1393
+ }
1394
+ function toFarmVercelEdgeGuardedUrls(pathnames, basePath) {
1395
+ return [
1396
+ ...new Set(pathnames.flatMap((pathname) => [pathname, _chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, pathname, basePath)]))
1397
+ ];
1398
+ }
1399
+ function createFarmVercelEdgeMiddlewareRoute(pathnames, basePath = "/") {
1400
+ const publicPaths = toFarmVercelEdgeGuardedUrls(pathnames, basePath);
1401
+ const alternatives = publicPaths.map((pathname) => {
1402
+ const trimmed = pathname.replace(/\/+$/, "");
1403
+ return trimmed ? `${escapeRegExp3(trimmed)}(?:/|/index\\.html|\\.html)?` : "/(?:index\\.html)?";
1404
+ });
1405
+ return {
1406
+ src: `^(?:${alternatives.join("|")})$`,
1407
+ middlewarePath: FARM_VERCEL_EDGE_MIDDLEWARE_FUNCTION,
1408
+ middlewareRawSrc: publicPaths,
1409
+ continue: true
1410
+ };
1411
+ }
1412
+ function generateFarmVercelEdgeMiddlewareEntry(routes, config, guardedPages) {
1413
+ const imports = routes.map(
1414
+ (route, index) => `import * as farmEdgeMiddleware${index} from ${JSON.stringify(route.filePath.replace(/\\/g, "/"))};`
1415
+ );
1416
+ const modules = routes.map(
1417
+ (route, index) => ` { path: ${JSON.stringify(route.path)}, filePath: ${JSON.stringify(route.filePath)}, module: farmEdgeMiddleware${index} },`
1418
+ );
1419
+ return `import { createFarmVercelEdgeMiddleware } from "@farm.js/core/internal/vercel-edge-middleware";
1420
+ ${imports.join("\n")}
1421
+
1422
+ export default createFarmVercelEdgeMiddleware({
1423
+ modules: [
1424
+ ${modules.join("\n")}
1425
+ ],
1426
+ i18n: ${JSON.stringify(config.i18n)},
1427
+ server: ${JSON.stringify({ trustProxy: _optionalChain([config, 'access', _44 => _44.server, 'optionalAccess', _45 => _45.trustProxy]) === true })},
1428
+ apiBasePath: ${JSON.stringify(_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))},
1429
+ notFoundPath: ${JSON.stringify(_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, FARM_VERCEL_EDGE_NOT_FOUND_PATH, config.basePath))},
1430
+ pages: ${JSON.stringify(toFarmVercelEdgeGuardedUrls(guardedPages, config.basePath))},
1431
+ });
1432
+ `;
1433
+ }
1434
+ async function resolveFarmCoreDir(root, fs4) {
1435
+ const runtimeEntry = _module.createRequire.call(void 0, _path2.default.join(root, "package.json")).resolve(
1436
+ "@farm.js/core/internal/vercel-edge-middleware"
1437
+ );
1438
+ return fs4.realpath(_path2.default.resolve(_path2.default.dirname(runtimeEntry), "..", ".."));
1439
+ }
1440
+ function edgeNodeModulesPlugin(coreDir, unsupported) {
1441
+ const streamStub = "\0farm-edge-node-stream";
1442
+ const corePrefix = coreDir + _path2.default.sep;
1443
+ return {
1444
+ name: "farm-vercel-edge-node-modules",
1445
+ resolveId(source, importer) {
1446
+ if (!_module.isBuiltin.call(void 0, source)) return null;
1447
+ const name = source.replace(/^node:/, "").split("/")[0];
1448
+ if (EDGE_NODE_MODULES.has(name)) return { id: `node:${name}`, external: true };
1449
+ if (name === "stream" && importer && _path2.default.resolve(importer).startsWith(corePrefix)) {
1450
+ return streamStub;
1451
+ }
1452
+ unsupported.add(`${source} (imported by ${_nullishCoalesce(importer, () => ( "the entry"))})`);
1453
+ return { id: source, external: true };
1454
+ },
1455
+ load(id) {
1456
+ if (id !== streamStub) return null;
1457
+ return `export const Readable = { toWeb() { throw new Error("[Farm.js] Node streams are not available in Vercel edge middleware."); } };`;
1458
+ }
1459
+ };
1460
+ }
1461
+ async function writeFarmVercelEdgeMiddlewareFunction(options) {
1462
+ const { root, outputDir, buildDir, config, routes, guardedPages, fs: fs4 } = options;
1463
+ const functionDir = _path2.default.join(
1464
+ outputDir,
1465
+ "functions",
1466
+ `${FARM_VERCEL_EDGE_MIDDLEWARE_FUNCTION}.func`
1467
+ );
1468
+ const entryPath = _path2.default.join(buildDir, "vercel-edge-middleware-entry.mjs");
1469
+ await fs4.mkdir(_path2.default.dirname(entryPath), { recursive: true });
1470
+ await fs4.writeFile(
1471
+ entryPath,
1472
+ generateFarmVercelEdgeMiddlewareEntry(routes, config, guardedPages)
1473
+ );
1474
+ const unsupported = /* @__PURE__ */ new Set();
1475
+ const coreDir = await resolveFarmCoreDir(root, fs4);
1476
+ const { rolldown } = await import("rolldown");
1477
+ let code;
1478
+ try {
1479
+ const bundle = await rolldown({
1480
+ cwd: root,
1481
+ input: entryPath,
1482
+ platform: "browser",
1483
+ logLevel: "silent",
1484
+ plugins: [edgeNodeModulesPlugin(coreDir, unsupported)],
1485
+ resolve: {
1486
+ alias: _chunkDHR2WDSLcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
1487
+ conditionNames: ["edge-light", "worker", "browser", "import", "module", "default"]
1488
+ },
1489
+ transform: {
1490
+ target: "es2022",
1491
+ define: { "process.env.NODE_ENV": JSON.stringify("production") }
1492
+ }
1493
+ });
1494
+ try {
1495
+ const { output } = await bundle.generate({
1496
+ format: "esm",
1497
+ codeSplitting: false,
1498
+ minify: true
1499
+ });
1500
+ code = output[0].code;
1501
+ } finally {
1502
+ await bundle.close();
1503
+ }
1504
+ } catch (error) {
1505
+ throw _chunkASYOWPSRcjs.withPlainDiagnostics.call(void 0, error);
1506
+ } finally {
1507
+ await fs4.rm(entryPath, { force: true });
1508
+ }
1509
+ if (unsupported.size > 0) {
1510
+ throw new Error(
1511
+ `[Farm.js] runtime: "edge" middleware runs in Vercel's Edge runtime, which does not provide these Node modules:
1512
+ ` + [...unsupported].map((entry) => ` - ${entry}`).join("\n") + `
1513
+ Remove them from the middleware (Edge provides ${[...EDGE_NODE_MODULES].join(", ")}), or remove runtime: "edge" so the middleware runs in the server and its pages render on request.`
1514
+ );
1515
+ }
1516
+ await fs4.rm(functionDir, { recursive: true, force: true });
1517
+ await fs4.mkdir(functionDir, { recursive: true });
1518
+ await fs4.writeFile(_path2.default.join(functionDir, "index.js"), code);
1519
+ await fs4.writeFile(
1520
+ _path2.default.join(functionDir, ".vc-config.json"),
1521
+ `${JSON.stringify({ runtime: "edge", entrypoint: "index.js" }, null, 2)}
1522
+ `
1523
+ );
1524
+ const gzippedBytes = _zlib.gzipSync.call(void 0, code).length;
1525
+ if (gzippedBytes > EDGE_FUNCTION_SIZE_WARNING_BYTES) {
1526
+ _chunkQMNWKQL4cjs.logger.warn(
1527
+ `Vercel edge middleware is ${(gzippedBytes / 1024 / 1024).toFixed(2)} MB gzipped, over the Hobby plan's 1 MB Edge function limit (Pro allows 2 MB, Enterprise 4 MB).`
1528
+ );
1529
+ }
1530
+ _chunkQMNWKQL4cjs.logger.info(
1531
+ `\u{1F6E1}\uFE0F Vercel edge middleware: ${routes.length} middleware file(s) guard their prerendered pages before the CDN serves them`
1532
+ );
1533
+ }
1534
+
1334
1535
  // src/nitro/universal-build.ts
1335
1536
  var FARM_NATIVE_STYLESHEETS_PLACEHOLDER = "__FARM_NATIVE_STYLESHEETS__";
1336
1537
  async function readFarmNativeStylesheets(clientOutputDir, clientCssHref) {
@@ -1501,7 +1702,7 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
1501
1702
  return {
1502
1703
  name: "farm-prerender-runtime-resolver",
1503
1704
  async resolveId(id, _importer, options) {
1504
- if (_optionalChain([options, 'access', _42 => _42.custom, 'optionalAccess', _43 => _43.farmPrerenderRuntimeResolve])) return null;
1705
+ if (_optionalChain([options, 'access', _46 => _46.custom, 'optionalAccess', _47 => _47.farmPrerenderRuntimeResolve])) return null;
1505
1706
  if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || _path2.default.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
1506
1707
  return null;
1507
1708
  }
@@ -1629,7 +1830,7 @@ function hasReactDomEdgeServerBuild(root) {
1629
1830
  }
1630
1831
  }
1631
1832
  function shouldAliasReactServerToWebBuild(renderer, preset) {
1632
- return _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _chunkF43OG25Pcjs.getFarmPresetRuntime.call(void 0, preset) === "edge";
1833
+ return _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge";
1633
1834
  }
1634
1835
  function isCloudflareImagePreset(preset) {
1635
1836
  return preset === "cloudflare" || preset === "cloudflare-pages" || preset === "cloudflare-module";
@@ -1651,18 +1852,6 @@ function isNitroRollupExternal(id) {
1651
1852
  return NODE_BUILTIN_MODULES.has(id) || NITRO_EXTERNAL_MODULES.has(id) || normalizedId.startsWith(".prisma/") || normalizedId.includes("/node_modules/@prisma/client/") || normalizedId.includes("/node_modules/.prisma/client/");
1652
1853
  }
1653
1854
  var FARM_METADATA_IMAGE_WASM_PREFIX = "\0farm-metadata-image-wasm:";
1654
- function createReactProductionModePlugin() {
1655
- const nodeEnvExpression = ["process", "env", "NODE_ENV"].join(".");
1656
- return {
1657
- name: "farm-react-production-mode",
1658
- transform(code, id) {
1659
- const normalizedId = id.replace(/\\/g, "/");
1660
- const isReactRuntime = normalizedId.includes("/node_modules/react/") || normalizedId.includes("/node_modules/react-dom/");
1661
- if (!isReactRuntime || !code.includes(nodeEnvExpression)) return null;
1662
- return { code: code.split(nodeEnvExpression).join('"production"'), map: null };
1663
- }
1664
- };
1665
- }
1666
1855
  var FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID = "\0farm-omitted-metadata-image-runtime";
1667
1856
  function isFarmCoreModule(file) {
1668
1857
  let dir = _path2.default.dirname(file.split("?", 1)[0]);
@@ -1682,21 +1871,27 @@ function isFarmCoreModule(file) {
1682
1871
  function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
1683
1872
  return {
1684
1873
  name: "farm-omitted-metadata-image-runtime",
1685
- resolveId(source, importer) {
1686
- if (source !== "@vercel/og") return null;
1687
- const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(_path2.default.basename(importer.split("?", 1)[0]));
1688
- if (fromCoreRuntime) return FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID;
1689
- return externalizeOtherImports ? { id: source, external: true } : null;
1874
+ resolveId: {
1875
+ filter: { id: _chunkDHR2WDSLcjs.exactIdPattern.call(void 0, ["@vercel/og"]) },
1876
+ handler(source, importer) {
1877
+ if (source !== "@vercel/og") return null;
1878
+ const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(_path2.default.basename(importer.split("?", 1)[0]));
1879
+ if (fromCoreRuntime) return FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID;
1880
+ return externalizeOtherImports ? { id: source, external: true } : null;
1881
+ }
1690
1882
  },
1691
- load(id) {
1692
- if (id !== FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID) return null;
1693
- return `
1883
+ load: {
1884
+ filter: { id: _chunkDHR2WDSLcjs.exactIdPattern.call(void 0, [FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID]) },
1885
+ handler(id) {
1886
+ if (id !== FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID) return null;
1887
+ return `
1694
1888
  export class ImageResponse {
1695
1889
  constructor() {
1696
1890
  throw new Error("@vercel/og is not in this server build because the app has no generated metadata image route.");
1697
1891
  }
1698
1892
  }
1699
1893
  `;
1894
+ }
1700
1895
  }
1701
1896
  };
1702
1897
  }
@@ -1714,8 +1909,8 @@ function readVercelOgManifest(file) {
1714
1909
  }
1715
1910
  function resolveVercelOgConditionEntry(resolvedId, condition) {
1716
1911
  const vercelOg = readVercelOgManifest(resolvedId);
1717
- const entry = _optionalChain([vercelOg, 'optionalAccess', _44 => _44.manifest, 'access', _45 => _45.exports, 'optionalAccess', _46 => _46["."], 'optionalAccess', _47 => _47[condition]]);
1718
- const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess', _48 => _48.default]);
1912
+ const entry = _optionalChain([vercelOg, 'optionalAccess', _48 => _48.manifest, 'access', _49 => _49.exports, 'optionalAccess', _50 => _50["."], 'optionalAccess', _51 => _51[condition]]);
1913
+ const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess', _52 => _52.default]);
1719
1914
  return vercelOg && typeof file === "string" ? _path2.default.join(vercelOg.dir, file) : null;
1720
1915
  }
1721
1916
  function createEdgeMetadataImageRuntimePlugin({
@@ -1731,7 +1926,7 @@ function createEdgeMetadataImageRuntimePlugin({
1731
1926
  const edgeEntry = resolveVercelOgConditionEntry(resolved.id, condition);
1732
1927
  return edgeEntry ? { ...resolved, id: edgeEntry } : resolved;
1733
1928
  }
1734
- if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _49 => _49.replace, 'call', _50 => _50(/\\/g, "/"), 'access', _51 => _51.includes, 'call', _52 => _52("/@vercel/og/")])) {
1929
+ if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _53 => _53.replace, 'call', _54 => _54(/\\/g, "/"), 'access', _55 => _55.includes, 'call', _56 => _56("/@vercel/og/")])) {
1735
1930
  return null;
1736
1931
  }
1737
1932
  const resolvedPath = _path2.default.resolve(_path2.default.dirname(importer.split("?", 1)[0]), source);
@@ -1753,7 +1948,7 @@ function createVercelOgFontInlinePlugin(runtime = "Cloudflare Workers") {
1753
1948
  return `Promise.resolve({ arrayBuffer: () => Uint8Array.from(atob(${JSON.stringify(encoded)}), (character) => character.charCodeAt(0)).buffer })`;
1754
1949
  });
1755
1950
  if (inlined !== code) return { code: inlined, map: null };
1756
- const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call', _53 => _53(file), 'optionalAccess', _54 => _54.manifest, 'access', _55 => _55.version]), () => ( "(unknown version)"));
1951
+ const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call', _57 => _57(file), 'optionalAccess', _58 => _58.manifest, 'access', _59 => _59.version]), () => ( "(unknown version)"));
1757
1952
  this.error(
1758
1953
  `@vercel/og ${version} cannot be bundled for ${runtime}: ${file} does not load its default font with fetch(new URL("./<font>.ttf", import.meta.url)), the pattern Farm inlines because an edge function cannot fetch it. Install a @vercel/og version whose edge build does, such as 1.0.1.`
1759
1954
  );
@@ -1764,7 +1959,7 @@ function createMetadataImageWasmPlugin() {
1764
1959
  return {
1765
1960
  name: "farm-metadata-image-wasm",
1766
1961
  resolveId(source, importer) {
1767
- if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _56 => _56.replace, 'call', _57 => _57(/\\/g, "/"), 'access', _58 => _58.includes, 'call', _59 => _59("/@vercel/og/")])) {
1962
+ if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _60 => _60.replace, 'call', _61 => _61(/\\/g, "/"), 'access', _62 => _62.includes, 'call', _63 => _63("/@vercel/og/")])) {
1768
1963
  return null;
1769
1964
  }
1770
1965
  const requestPath = source.slice(0, -"?module".length);
@@ -1840,9 +2035,9 @@ function hasFarmRuntimeConfigModule(config, configModulePath) {
1840
2035
  return Boolean(configModulePath || (config.layers || []).some((layer) => layer.configFile));
1841
2036
  }
1842
2037
  function nameCodeSplittingGroups(bundlerConfig) {
1843
- const outputs = _optionalChain([bundlerConfig, 'optionalAccess', _60 => _60.output]);
2038
+ const outputs = _optionalChain([bundlerConfig, 'optionalAccess', _64 => _64.output]);
1844
2039
  for (const output of Array.isArray(outputs) ? outputs : [outputs]) {
1845
- const groups = _optionalChain([output, 'optionalAccess', _61 => _61.codeSplitting, 'optionalAccess', _62 => _62.groups]);
2040
+ const groups = _optionalChain([output, 'optionalAccess', _65 => _65.codeSplitting, 'optionalAccess', _66 => _66.groups]);
1846
2041
  if (!Array.isArray(groups)) continue;
1847
2042
  groups.forEach((group, index) => {
1848
2043
  if (group && typeof group.name === "function" && !group.debugName) {
@@ -1898,9 +2093,9 @@ function restoreLiteralModuleSpecifiers(code, fileName, { parseSync, Visitor })
1898
2093
  if (needsAst) {
1899
2094
  replacements.length = 0;
1900
2095
  const restore = (node) => {
1901
- if (_optionalChain([node, 'optionalAccess', _63 => _63.type]) !== "TemplateLiteral") return;
2096
+ if (_optionalChain([node, 'optionalAccess', _67 => _67.type]) !== "TemplateLiteral") return;
1902
2097
  const template = node;
1903
- const value = _optionalChain([template, 'access', _64 => _64.quasis, 'access', _65 => _65[0], 'optionalAccess', _66 => _66.value, 'access', _67 => _67.cooked]);
2098
+ const value = _optionalChain([template, 'access', _68 => _68.quasis, 'access', _69 => _69[0], 'optionalAccess', _70 => _70.value, 'access', _71 => _71.cooked]);
1904
2099
  if (template.expressions.length > 0 || typeof value !== "string") return;
1905
2100
  replacements.push({
1906
2101
  start: template.start,
@@ -2005,14 +2200,6 @@ async function findFarmConfigPath(root) {
2005
2200
  }
2006
2201
  return null;
2007
2202
  }
2008
- function hasFarmServerRuntimePlugins(config) {
2009
- return (config.plugins || []).some((plugin) => {
2010
- if (_chunkBDYM2TN3cjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) === false) return false;
2011
- return Boolean(
2012
- 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
2013
- );
2014
- });
2015
- }
2016
2203
  function hasFarmPluginRoutes(config) {
2017
2204
  return (config.plugins || []).some((plugin) => Boolean(plugin.routes));
2018
2205
  }
@@ -2066,7 +2253,7 @@ async function discoverMiddlewareRoutes(appDir) {
2066
2253
  return Array.from(routes.values()).sort(_chunkMHLNWRCJcjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
2067
2254
  }
2068
2255
  function assertFarmDocsRuntimeSupported(config, preset) {
2069
- if (!_optionalChain([config, 'access', _68 => _68.docs, 'optionalAccess', _69 => _69.enabled]) || !_optionalChain([config, 'access', _70 => _70.docs, 'access', _71 => _71.adapter, 'optionalAccess', _72 => _72.server]) || _chunkF43OG25Pcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" || Boolean(config.docs.adapter.edgeCompiler)) {
2256
+ if (!_optionalChain([config, 'access', _72 => _72.docs, 'optionalAccess', _73 => _73.enabled]) || !_optionalChain([config, 'access', _74 => _74.docs, 'access', _75 => _75.adapter, 'optionalAccess', _76 => _76.server]) || _chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" || Boolean(config.docs.adapter.edgeCompiler)) {
2070
2257
  return;
2071
2258
  }
2072
2259
  throw new Error(
@@ -2079,7 +2266,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
2079
2266
  assertFarmDocsRuntimeSupported(config, preset);
2080
2267
  const srcDir = config.srcDir || "src";
2081
2268
  const distDir = config.distDir || ".farm";
2082
- const deployOutputDir = _chunk556H7JCEcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
2269
+ const deployOutputDir = _chunk6GQJVY4Ecjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
2083
2270
  const lifecyclePluginManager = options.pluginManager;
2084
2271
  const productionViteResultPromise = Promise.allSettled([
2085
2272
  Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkMF3IA2AWcjs.loadFarmProductionVite.call(void 0, ))))
@@ -2098,7 +2285,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
2098
2285
  const routeRuntimeManifestResultPromise = Promise.allSettled([routeRuntimeManifestPromise]);
2099
2286
  const pageRoutes = [];
2100
2287
  for (const [pattern, entry] of routeManager.getRoutes()) {
2101
- const markdownSourcePath = entry.markdownSourcePath || (_chunkQ37INCXGcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
2288
+ const markdownSourcePath = entry.markdownSourcePath || (_chunk3EEINK7Gcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
2102
2289
  pageRoutes.push({
2103
2290
  pattern,
2104
2291
  ...entry.directory ? { directory: entry.directory } : {},
@@ -2304,7 +2491,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
2304
2491
  _chunkQMNWKQL4cjs.logger.error(`\u274C Build failed: ${error}`);
2305
2492
  throw error;
2306
2493
  } finally {
2307
- _optionalChain([rendererBuild, 'optionalAccess', _73 => _73.abort, 'call', _74 => _74()]);
2494
+ _optionalChain([rendererBuild, 'optionalAccess', _77 => _77.abort, 'call', _78 => _78()]);
2308
2495
  }
2309
2496
  }
2310
2497
  function shouldBuildFarmMobileClient(config) {
@@ -2313,7 +2500,7 @@ function shouldBuildFarmMobileClient(config) {
2313
2500
  function varyFarmNitroCacheRulesByShell(rules) {
2314
2501
  return Object.fromEntries(
2315
2502
  Object.entries(rules).map(([source, rule]) => {
2316
- const cached = _optionalChain([rule, 'optionalAccess', _75 => _75.swr]) !== void 0 && rule.swr !== false || _optionalChain([rule, 'optionalAccess', _76 => _76.cache]) !== void 0 && rule.cache !== false;
2503
+ const cached = _optionalChain([rule, 'optionalAccess', _79 => _79.swr]) !== void 0 && rule.swr !== false || _optionalChain([rule, 'optionalAccess', _80 => _80.cache]) !== void 0 && rule.cache !== false;
2317
2504
  if (!cached || rule.cache === false) return [source, rule];
2318
2505
  const cache = rule.cache && typeof rule.cache === "object" ? rule.cache : {};
2319
2506
  const varies = [...Array.isArray(cache.varies) ? cache.varies : [], "x-farm-shell"];
@@ -2364,7 +2551,14 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
2364
2551
  }
2365
2552
  const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
2366
2553
  await fs4.writeFile(fontCssPath, normalizedFontCss);
2367
- await fs4.writeFile(clientCssPath, _chunkN5DQMOAGcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
2554
+ await fs4.writeFile(clientCssPath, _chunkDHR2WDSLcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
2555
+ }
2556
+ function importsFarmClientBlockedPackage(id, packageName) {
2557
+ return id === packageName || id.startsWith(`${packageName}/`);
2558
+ }
2559
+ function importsFarmApiRouteModule(id) {
2560
+ const specifier = id.replace(/\\/g, "/").split("?", 1)[0];
2561
+ return /(?:^|\/)api\/(?:.*\/)?route(?:\.[cm]?[jt]sx?)?$/.test(specifier);
2368
2562
  }
2369
2563
  var IncompleteClientBuildOutputError = class extends Error {
2370
2564
  constructor(detail) {
@@ -2410,7 +2604,7 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
2410
2604
  const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${options.serverOwners === true}\0${options.serverTreeLayouts === true}\0${_path2.default.resolve(modulePath)}`;
2411
2605
  let plan = cache.get(key);
2412
2606
  if (!plan) {
2413
- plan = _chunk4DRINDGNcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
2607
+ plan = _chunkVO65MYJDcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
2414
2608
  cache.set(key, plan);
2415
2609
  }
2416
2610
  return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
@@ -2419,7 +2613,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2419
2613
  if (!mobile) await _chunkE5UN4OWXcjs.removeFarmMobileClientManifest.call(void 0, _path2.default.dirname(outputDir));
2420
2614
  const viteBuild = productionVite.build;
2421
2615
  const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
2422
- const { PluginManager: PluginManager2 } = await import("./plugin-WIU4GDD4.cjs");
2616
+ const { PluginManager: PluginManager2 } = await import("./plugin-F2O4BFTK.cjs");
2423
2617
  const fs4 = await import("fs/promises");
2424
2618
  const pluginManager = new PluginManager2({
2425
2619
  config,
@@ -2434,25 +2628,25 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2434
2628
  const unsupportedIntegrationProvider = integrationProviders.find(
2435
2629
  (provider) => provider.supportsIsolatedHydration !== true
2436
2630
  );
2437
- if (_optionalChain([config, 'access', _77 => _77.experimental, 'optionalAccess', _78 => _78.isolatedClientHydration]) === "enabled" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _79 => _79.experimental, 'optionalAccess', _80 => _80.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
2631
+ if (_optionalChain([config, 'access', _81 => _81.experimental, 'optionalAccess', _82 => _82.isolatedClientHydration]) === "enabled" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _83 => _83.experimental, 'optionalAccess', _84 => _84.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
2438
2632
  _chunkQMNWKQL4cjs.logger.warn(
2439
2633
  `[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
2440
2634
  );
2441
2635
  }
2442
- const isolatedMode = _chunk4DRINDGNcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
2443
- _optionalChain([config, 'access', _81 => _81.experimental, 'optionalAccess', _82 => _82.isolatedClientHydration]),
2636
+ const isolatedMode = _chunkVO65MYJDcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
2637
+ _optionalChain([config, 'access', _85 => _85.experimental, 'optionalAccess', _86 => _86.isolatedClientHydration]),
2444
2638
  {
2445
- serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _83 => _83.experimental, 'optionalAccess', _84 => _84.serverComponents])) === "rsc",
2639
+ serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _87 => _87.experimental, 'optionalAccess', _88 => _88.serverComponents])) === "rsc",
2446
2640
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
2447
2641
  }
2448
2642
  );
2449
- const planOptions = _chunk4DRINDGNcjs.getFarmClientHydrationPlanOptions.call(void 0,
2643
+ const planOptions = _chunkVO65MYJDcjs.getFarmClientHydrationPlanOptions.call(void 0,
2450
2644
  config.renderer,
2451
2645
  Boolean(unsupportedIntegrationProvider)
2452
2646
  );
2453
2647
  const pagePlanOptions = {
2454
2648
  ...planOptions,
2455
- serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _85 => _85.experimental, 'optionalAccess', _86 => _86.serverComponents])) === "islands"
2649
+ serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _89 => _89.experimental, 'optionalAccess', _90 => _90.serverComponents])) === "islands"
2456
2650
  };
2457
2651
  const layoutPlanOptions = {
2458
2652
  ...planOptions,
@@ -2505,20 +2699,20 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2505
2699
  });
2506
2700
  const layoutAppliesToRoute = _chunkUPOYKX4Scjs.routeBoundaryCoversDirectory;
2507
2701
  const routeDirectory = (route) => _nullishCoalesce(route.directory, () => ( route.pattern));
2508
- const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _87 => _87.experimental, 'optionalAccess', _88 => _88.serverComponents])) === "islands";
2702
+ const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _91 => _91.experimental, 'optionalAccess', _92 => _92.serverComponents])) === "islands";
2509
2703
  const adapterOwnsDocsRuntime = Boolean(
2510
- _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _89 => _89.docs, 'optionalAccess', _90 => _90.enabled]) && _optionalChain([config, 'access', _91 => _91.docs, 'access', _92 => _92.adapter, 'optionalAccess', _93 => _93.server]) && config.docs.adapter.react
2704
+ _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _93 => _93.docs, 'optionalAccess', _94 => _94.enabled]) && _optionalChain([config, 'access', _95 => _95.docs, 'access', _96 => _96.adapter, 'optionalAccess', _97 => _97.server]) && config.docs.adapter.react
2511
2705
  );
2512
- const docsEntries = _optionalChain([config, 'access', _94 => _94.docs, 'optionalAccess', _95 => _95.enabled]) ? _chunkPPX7UOFYcjs.getFarmDocsRoots.call(void 0, config.docs).map(
2706
+ const docsEntries = _optionalChain([config, 'access', _98 => _98.docs, 'optionalAccess', _99 => _99.enabled]) ? _chunkFVYBEMODcjs.getFarmDocsRoots.call(void 0, config.docs).map(
2513
2707
  (docsRoot) => `/${docsRoot.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/"
2514
2708
  ) : [];
2515
2709
  const adapterDocsEntry = _nullishCoalesce(docsEntries[0], () => ( null));
2516
2710
  const isAdapterDocsRoute = (routePattern) => adapterOwnsDocsRuntime && docsEntries.some(
2517
2711
  (docsEntry) => docsEntry === "/" || routePattern === docsEntry || routePattern.startsWith(`${docsEntry}/`)
2518
2712
  );
2519
- const syntheticDocsEntry = _optionalChain([config, 'access', _96 => _96.docs, 'optionalAccess', _97 => _97.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
2713
+ const syntheticDocsEntry = _optionalChain([config, 'access', _100 => _100.docs, 'optionalAccess', _101 => _101.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
2520
2714
  const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
2521
- const markdownPagePlan = _chunk4DRINDGNcjs.createMarkdownPageHydrationPlanner.call(void 0,
2715
+ const markdownPagePlan = _chunkVO65MYJDcjs.createMarkdownPageHydrationPlanner.call(void 0,
2522
2716
  _chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), root),
2523
2717
  root,
2524
2718
  isolatedMode,
@@ -2526,7 +2720,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2526
2720
  );
2527
2721
  const routePlans = pageRoutes.map((route) => ({
2528
2722
  route,
2529
- metadata: _chunkQ37INCXGcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
2723
+ metadata: _chunk3EEINK7Gcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
2530
2724
  route.modulePath,
2531
2725
  root,
2532
2726
  isolatedMode,
@@ -2534,7 +2728,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2534
2728
  pagePlanOptions
2535
2729
  )
2536
2730
  }));
2537
- _chunk4DRINDGNcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
2731
+ _chunkVO65MYJDcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
2538
2732
  clientLayouts.map((layout) => ({
2539
2733
  pattern: layout.pattern,
2540
2734
  depth: layout.pattern.split("/").filter(Boolean).length,
@@ -2567,7 +2761,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2567
2761
  for (const layout of clientLayouts) {
2568
2762
  const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || docsEntries.some((docsEntry) => layoutAppliesToRoute(layout.pattern, docsEntry));
2569
2763
  if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
2570
- _chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F ${_chunk4DRINDGNcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
2764
+ _chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F ${_chunkVO65MYJDcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
2571
2765
  }
2572
2766
  }
2573
2767
  if (isolatedMode === "analyze") {
@@ -2601,7 +2795,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2601
2795
  );
2602
2796
  if (metadata.suppressedAsyncHydration) {
2603
2797
  _chunkQMNWKQL4cjs.logger.warn(
2604
- `\u26A0\uFE0F ${_chunk4DRINDGNcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
2798
+ `\u26A0\uFE0F ${_chunkVO65MYJDcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
2605
2799
  );
2606
2800
  }
2607
2801
  const slotBoundaries = serverSlotPlans.filter(
@@ -2609,7 +2803,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2609
2803
  ).flatMap(({ plan }) => plan.isolatedBoundaries);
2610
2804
  if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0 || slotBoundaries.length > 0) {
2611
2805
  const relativePath = route.modulePath.replace(root, "").replace(/^\//, "");
2612
- const islandStrategy = _chunkN5DQMOAGcjs.resolveFarmRouteRootStrategy.call(void 0,
2806
+ const islandStrategy = _chunkDHR2WDSLcjs.resolveFarmRouteRootStrategy.call(void 0,
2613
2807
  route,
2614
2808
  metadata,
2615
2809
  clientLayouts,
@@ -2628,7 +2822,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2628
2822
  ...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
2629
2823
  ],
2630
2824
  // The server renders a server tree only below a hydrating layout.
2631
- ..._chunk4DRINDGNcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
2825
+ ..._chunkVO65MYJDcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
2632
2826
  });
2633
2827
  _chunkQMNWKQL4cjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
2634
2828
  }
@@ -2650,6 +2844,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2650
2844
  ) ? _nullishCoalesce(hydrationStrategies[0], () => ( "load")) : "load";
2651
2845
  const docsClientRoutes = syntheticDocsPatterns.map((pattern) => ({
2652
2846
  pattern,
2847
+ docs: true,
2653
2848
  modulePath: "",
2654
2849
  relativePath: "",
2655
2850
  pageShouldHydrate: false,
@@ -2664,7 +2859,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2664
2859
  }
2665
2860
  const clientRouteSlots = routeSlots.filter((slot) => {
2666
2861
  try {
2667
- const metadata = _chunk4DRINDGNcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root);
2862
+ const metadata = _chunkVO65MYJDcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root);
2668
2863
  return metadata.shouldHydrate && (!islandsMode || metadata.isClientComponent);
2669
2864
  } catch (error) {
2670
2865
  _chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
@@ -2687,8 +2882,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2687
2882
  srcDir,
2688
2883
  adapterOwnsDocsRuntime ? false : _chunkDZZHTMWMcjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
2689
2884
  adapterOwnsDocsRuntime ? void 0 : _chunkDZZHTMWMcjs.resolveFarmDocsSearchClientModule.call(void 0, root),
2690
- _optionalChain([config, 'access', _98 => _98.docs, 'optionalAccess', _99 => _99.enabled]) ? _chunkPPX7UOFYcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
2691
- adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _100 => _100.docs, 'access', _101 => _101.adapter, 'optionalAccess', _102 => _102.react]) : void 0,
2885
+ _optionalChain([config, 'access', _102 => _102.docs, 'optionalAccess', _103 => _103.enabled]) ? _chunkFVYBEMODcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
2886
+ adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _104 => _104.docs, 'access', _105 => _105.adapter, 'optionalAccess', _106 => _106.react]) : void 0,
2692
2887
  config.i18n,
2693
2888
  config.plugins,
2694
2889
  config.renderer,
@@ -2696,11 +2891,11 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2696
2891
  config.trailingSlash,
2697
2892
  _chunkBDYM2TN3cjs.getIntegrationProviders.call(void 0, config.integrations),
2698
2893
  config.basePath,
2699
- _chunkN5DQMOAGcjs.generateClientCachePersistenceCode.call(void 0, _chunkN5DQMOAGcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
2894
+ _chunkDHR2WDSLcjs.generateClientCachePersistenceCode.call(void 0, _chunkDHR2WDSLcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
2700
2895
  adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
2701
- _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _103 => _103.experimental, 'optionalAccess', _104 => _104.serverComponents])) === "islands",
2896
+ _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _107 => _107.experimental, 'optionalAccess', _108 => _108.serverComponents])) === "islands",
2702
2897
  platform,
2703
- islandsMode ? _chunk4DRINDGNcjs.collectFarmServerStylesheets.call(void 0,
2898
+ islandsMode ? _chunkVO65MYJDcjs.collectFarmServerStylesheets.call(void 0,
2704
2899
  [
2705
2900
  ...layoutRoutes.map((layout) => layout.modulePath),
2706
2901
  ...pageRoutes.filter((route) => !isAdapterDocsRoute(route.pattern)).map((route) => route.modulePath)
@@ -2715,7 +2910,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2715
2910
  await fs4.writeFile(_path2.default.join(clientEntryDir, "farm-client-router.tsx"), clientEntry.router);
2716
2911
  }
2717
2912
  const clientInput = { [entryName]: clientEntryPath };
2718
- if (platform === "web" && _chunkN5DQMOAGcjs.canBootFarmIslandsClient.call(void 0, config)) {
2913
+ if (platform === "web" && _chunkDHR2WDSLcjs.canBootFarmIslandsClient.call(void 0, config)) {
2719
2914
  const clientBootPath = _path2.default.join(clientEntryDir, "farm-client-boot.tsx");
2720
2915
  await fs4.writeFile(
2721
2916
  clientBootPath,
@@ -2736,7 +2931,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2736
2931
  const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
2737
2932
  await fs4.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
2738
2933
  postcssSearchPath = clientEntryDir;
2739
- tailwindVitePlugin = await _chunkJSOCDYERcjs.loadTailwindVitePlugin.call(void 0, {
2934
+ tailwindVitePlugin = await _chunkQ4HH5Q6Acjs.loadTailwindVitePlugin.call(void 0, {
2740
2935
  builder: productionVite.builder,
2741
2936
  announce: true
2742
2937
  });
@@ -2758,7 +2953,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2758
2953
  outDir: outputDir,
2759
2954
  emptyOutDir: platform === "web",
2760
2955
  // Never public: see resolveFarmClientSourcemap.
2761
- sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access', _105 => _105.vite, 'optionalAccess', _106 => _106.build, 'optionalAccess', _107 => _107.sourcemap])),
2956
+ sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access', _109 => _109.vite, 'optionalAccess', _110 => _110.build, 'optionalAccess', _111 => _111.sourcemap])),
2762
2957
  assetsInlineLimit: 0,
2763
2958
  cssCodeSplit: false,
2764
2959
  // Bundle all CSS into one file
@@ -2770,7 +2965,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2770
2965
  hashCharacters: "hex",
2771
2966
  // Use predictable name for CSS so we can reference it in SSR HTML
2772
2967
  assetFileNames: (assetInfo) => {
2773
- if (_optionalChain([assetInfo, 'access', _108 => _108.name, 'optionalAccess', _109 => _109.endsWith, 'call', _110 => _110(".css")])) {
2968
+ if (_optionalChain([assetInfo, 'access', _112 => _112.name, 'optionalAccess', _113 => _113.endsWith, 'call', _114 => _114(".css")])) {
2774
2969
  return `${entryName}.css`;
2775
2970
  }
2776
2971
  return "assets/[name]-h[hash][extname]";
@@ -2779,7 +2974,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2779
2974
  // A browser cannot load a Node builtin: farmServerOnlyEntriesPlugin
2780
2975
  // resolves one to Farm's browser module for it instead.
2781
2976
  external: (id) => {
2782
- if (id === "fsevents" || id.includes("fsevents") || id.endsWith(".node")) {
2977
+ if (importsFarmClientBlockedPackage(id, "fsevents") || id.endsWith(".node")) {
2783
2978
  return true;
2784
2979
  }
2785
2980
  return false;
@@ -2787,7 +2982,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2787
2982
  }
2788
2983
  },
2789
2984
  plugins: [
2790
- _chunkN5DQMOAGcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
2985
+ _chunkDHR2WDSLcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
2791
2986
  createFarmPrivateClientSourcemapsPlugin({
2792
2987
  outDir: _path2.default.join(
2793
2988
  _path2.default.dirname(outputDir),
@@ -2819,61 +3014,77 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2819
3014
  ...rendererVitePlugins,
2820
3015
  ...config.vite.plugins || [],
2821
3016
  farmServerOnlyEntriesPlugin({ platform }),
2822
- _chunkN5DQMOAGcjs.farmDocsClientConfigPlugin.call(void 0,
3017
+ _chunkDHR2WDSLcjs.farmDocsClientConfigPlugin.call(void 0,
2823
3018
  adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
2824
3019
  ),
2825
3020
  // Plugin to redirect @farm.js/core imports to client-only exports
2826
3021
  {
2827
3022
  name: "farm-client-only-imports",
2828
3023
  enforce: "pre",
2829
- resolveId(id) {
2830
- if (id === "@farm.js/core") {
2831
- return { id: "\0farm-client-exports", external: false };
2832
- }
2833
- if (id === "@farm.js/core/i18n/server") {
2834
- return { id: "\0farm-i18n-client-bridge", external: false };
2835
- }
2836
- if (id === "@farm.js/core/server" || id === "@farm.js/core/api" || id === "@farm.js/core/middleware" || id === "@farm.js/core/headers" || id === "@farm.js/core/config" || id.includes("@farm.js/core/middleware") || id.includes("@farm.js/core/query/server")) {
2837
- return { id: "\0empty-module", external: false };
2838
- }
2839
- if (id.includes("/api/") && id.includes("/route")) {
2840
- return { id: "\0empty-api-route", external: false };
2841
- }
2842
- if (id === "fsevents" || id.includes("fsevents") || id.endsWith(".node") || id === "nitro" || id === "vite" || id === "esbuild" || id === "rolldown" || id.startsWith("rolldown/") || id === "rollup" || id.startsWith("nitro/") || id.includes("node-pre-gyp") || id.includes("nf3")) {
2843
- return { id: "\0empty-module", external: false };
3024
+ resolveId: {
3025
+ // Every specifier the handler redirects, as a superset of its checks.
3026
+ filter: {
3027
+ id: /@farm\.js\/core|\/api\/|fsevents|\.node$|node-pre-gyp|nf3|^(?:nitro|vite|esbuild|rolldown|rollup)(?:\/|$)/
3028
+ },
3029
+ handler(id) {
3030
+ if (id === "@farm.js/core") {
3031
+ return { id: "\0farm-client-exports", external: false };
3032
+ }
3033
+ if (id === "@farm.js/core/i18n/server") {
3034
+ return { id: "\0farm-i18n-client-bridge", external: false };
3035
+ }
3036
+ if (id === "@farm.js/core/server" || id === "@farm.js/core/api" || id === "@farm.js/core/middleware" || id === "@farm.js/core/headers" || id === "@farm.js/core/config" || id.includes("@farm.js/core/middleware") || id.includes("@farm.js/core/query/server")) {
3037
+ return { id: "\0empty-module", external: false };
3038
+ }
3039
+ if (importsFarmApiRouteModule(id)) {
3040
+ return { id: "\0empty-api-route", external: false };
3041
+ }
3042
+ if (importsFarmClientBlockedPackage(id, "fsevents") || id.endsWith(".node") || id === "nitro" || id === "vite" || id === "esbuild" || id === "rolldown" || id.startsWith("rolldown/") || id === "rollup" || id.startsWith("nitro/") || importsFarmClientBlockedPackage(id, "node-pre-gyp") || importsFarmClientBlockedPackage(id, "@mapbox/node-pre-gyp") || importsFarmClientBlockedPackage(id, "nf3")) {
3043
+ return { id: "\0empty-module", external: false };
3044
+ }
3045
+ return null;
2844
3046
  }
2845
- return null;
2846
3047
  },
2847
- load(id) {
2848
- if (id === "\0empty-module") {
2849
- return "const emptyMiddlewareStore = new Map(); export default {}; export const getMiddlewareContext = () => emptyMiddlewareStore; export const getMiddlewareData = () => emptyMiddlewareStore; export const getMiddlewareValue = () => undefined; export const middleware = () => ({});";
2850
- }
2851
- if (id === "\0empty-api-route") {
2852
- return "export const GET = () => {}; export const HEAD = () => {}; export const QUERY = () => {}; export const POST = () => {}; export const PUT = () => {}; export const DELETE = () => {}; export const PATCH = () => {}; export const OPTIONS = () => {}; export default {};";
2853
- }
2854
- if (id === "\0farm-i18n-client-bridge") {
2855
- return 'export { createTranslator, format, getLocale, getLocaleSource, t } from "@farm.js/core/i18n/client";';
2856
- }
2857
- if (id === "\0farm-client-exports") {
2858
- return [
2859
- "// Farm.js Client Exports - Safe for browser bundling",
2860
- 'export { Link } from "@farm.js/core/client";',
2861
- 'export { useRouter } from "@farm.js/core/client";',
2862
- 'export { usePathname, useSearchParams } from "@farm.js/core/navigation";',
2863
- // A page that hydrates ships to the browser with its notFound()/redirect() calls.
2864
- 'export { getFarmRedirectError, isFarmNotFoundError, isFarmRedirectError, notFound, permanentRedirect, redirect } from "@farm.js/core/navigation";',
2865
- 'export { createAPIClient } from "@farm.js/core/client";',
2866
- 'export { localFont, remoteFont } from "@farm.js/core/font";'
2867
- ].join("\n");
3048
+ load: {
3049
+ filter: {
3050
+ id: _chunkDHR2WDSLcjs.exactIdPattern.call(void 0, [
3051
+ "\0empty-module",
3052
+ "\0empty-api-route",
3053
+ "\0farm-i18n-client-bridge",
3054
+ "\0farm-client-exports"
3055
+ ])
3056
+ },
3057
+ handler(id) {
3058
+ if (id === "\0empty-module") {
3059
+ return "const emptyMiddlewareStore = new Map(); export default {}; export const getMiddlewareContext = () => emptyMiddlewareStore; export const getMiddlewareData = () => emptyMiddlewareStore; export const getMiddlewareValue = () => undefined; export const middleware = () => ({});";
3060
+ }
3061
+ if (id === "\0empty-api-route") {
3062
+ return "export const GET = () => {}; export const HEAD = () => {}; export const QUERY = () => {}; export const POST = () => {}; export const PUT = () => {}; export const DELETE = () => {}; export const PATCH = () => {}; export const OPTIONS = () => {}; export default {};";
3063
+ }
3064
+ if (id === "\0farm-i18n-client-bridge") {
3065
+ return 'export { createTranslator, format, getLocale, getLocaleSource, t } from "@farm.js/core/i18n/client";';
3066
+ }
3067
+ if (id === "\0farm-client-exports") {
3068
+ return [
3069
+ "// Farm.js Client Exports - Safe for browser bundling",
3070
+ 'export { Link } from "@farm.js/core/client";',
3071
+ 'export { useRouter } from "@farm.js/core/client";',
3072
+ 'export { usePathname, useSearchParams } from "@farm.js/core/navigation";',
3073
+ // A page that hydrates ships to the browser with its notFound()/redirect() calls.
3074
+ 'export { getFarmRedirectError, isFarmNotFoundError, isFarmRedirectError, notFound, permanentRedirect, redirect } from "@farm.js/core/navigation";',
3075
+ 'export { createAPIClient } from "@farm.js/core/client";',
3076
+ 'export { localFont, remoteFont } from "@farm.js/core/font";'
3077
+ ].join("\n");
3078
+ }
3079
+ return null;
2868
3080
  }
2869
- return null;
2870
3081
  }
2871
3082
  },
2872
3083
  farmPlugin(
2873
3084
  { ...config, isolatedClientBoundaryModules, programmaticClientRoutes },
2874
3085
  pluginManager
2875
3086
  ),
2876
- _chunk4DRINDGNcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
3087
+ _chunkVO65MYJDcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
2877
3088
  ],
2878
3089
  mode: "production",
2879
3090
  css: postcssSearchPath ? {
@@ -2881,7 +3092,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2881
3092
  } : void 0,
2882
3093
  // Ensure React is bundled for client
2883
3094
  resolve: {
2884
- alias: _chunkN5DQMOAGcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
3095
+ alias: _chunkDHR2WDSLcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
2885
3096
  dedupe: [...config.renderer.dedupe || []]
2886
3097
  },
2887
3098
  // Optimize dependencies - exclude server-side code from client bundle
@@ -2894,7 +3105,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2894
3105
  ]
2895
3106
  }
2896
3107
  };
2897
- await viteBuild(_chunkN5DQMOAGcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
3108
+ await viteBuild(_chunkDHR2WDSLcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
2898
3109
  if (platform === "mobile") {
2899
3110
  await fs4.rm(_path2.default.join(outputDir, `${entryName}.css`), { force: true });
2900
3111
  if (!await _chunkE5UN4OWXcjs.hasFarmMobileClientEntry.call(void 0, _path2.default.dirname(outputDir), outputDir)) {
@@ -2994,7 +3205,7 @@ async function fetchFarmNavigationDocument(url, headers, recover = true, signal)
2994
3205
  return response;
2995
3206
  }
2996
3207
 
2997
- ${streamNavigations ? _chunkN5DQMOAGcjs.FARM_NAVIGATION_STREAM_READER_SOURCE : ""}
3208
+ ${streamNavigations ? _chunkDHR2WDSLcjs.FARM_NAVIGATION_STREAM_READER_SOURCE : ""}
2998
3209
 
2999
3210
  function clearFarmPrefetchCacheOnDeploymentMismatch(router, error) {
3000
3211
  if (error?.name === "FarmDeploymentMismatchError") {
@@ -3014,6 +3225,14 @@ function hasAbsoluteNavigationHref(href) {
3014
3225
  }
3015
3226
  `.trim();
3016
3227
  }
3228
+ function generateClientPageDirectorySource() {
3229
+ return `function getFarmPageDirectory(pathname) {
3230
+ const path = getFarmRoutePathname(pathname);
3231
+ let matched = clientRouteMatcher.match(path);
3232
+ if (matched && matched.route.meta.docs) matched = clientPageRouteMatcher.match(path);
3233
+ return matched ? matched.route.meta.directory || matched.route.meta.pattern : null;
3234
+ }`;
3235
+ }
3017
3236
  function generateRuntimePathMatcherSource() {
3018
3237
  return `
3019
3238
  function normalizeRuntimePath(pathname) {
@@ -3173,30 +3392,35 @@ function encodeRuntimePathSegment(value) {
3173
3392
  }
3174
3393
 
3175
3394
  function interpolateRedirectDestination(destination, params) {
3176
- let result = destination;
3177
3395
  const catchAllParamSegments = params[farmCatchAllParamSegments] || {};
3396
+ const encodedParams = new Map();
3178
3397
  const orderedCaptures = [];
3179
3398
  for (const [key, value] of Object.entries(params)) {
3180
3399
  const segments = catchAllParamSegments[key];
3181
3400
  const encodedValue = Array.isArray(segments)
3182
3401
  ? segments.map(encodeRuntimePathSegment).join("/")
3183
3402
  : encodeRuntimePathSegment(value);
3403
+ encodedParams.set(key, encodedValue);
3184
3404
  orderedCaptures.push(encodedValue);
3185
- result = result.split("[[..." + key + "]]").join(encodedValue);
3186
- result = result.split("[..." + key + "]").join(encodedValue);
3187
- result = result.split("[" + key + "]").join(encodedValue);
3188
- result = result.split(":" + key + "*").join(encodedValue);
3189
- result = result.split(":" + key).join(encodedValue);
3190
- if (key === "wildcard") result = result.split("*").join(encodedValue);
3191
- }
3192
- // Numbered captures resolve after the named substitutions. Encoded values
3193
- // never contain "$", so this cannot rewrite an already-injected value. An
3194
- // out-of-range index resolves to "", matching the development path.
3195
- result = result.replace(/\\$(\\d+)/g, function(_whole, group) {
3196
- const captured = orderedCaptures[Number(group) - 1];
3197
- return captured === undefined ? "" : captured;
3198
- });
3199
- return result;
3405
+ }
3406
+ // One pass that reads each reference whole, as the development path does: ":id" never
3407
+ // consumes the start of ":idx", an unknown ":name" stays as written, and an injected value is
3408
+ // never read again. An out-of-range "$n" resolves to "", matching the development path.
3409
+ return destination.replace(
3410
+ /\\[\\[\\.\\.\\.(\\w+)\\]\\]|\\[\\.\\.\\.(\\w+)\\]|\\[(\\w+)\\]|:([A-Za-z0-9_]+)(\\*?)|\\$(\\d+)|\\*/g,
3411
+ function(whole, optionalCatchAll, catchAll, bracket, name, star, group) {
3412
+ if (group !== undefined) {
3413
+ const captured = orderedCaptures[Number(group) - 1];
3414
+ return captured === undefined ? "" : captured;
3415
+ }
3416
+ const wildcard = encodedParams.has("wildcard") ? encodedParams.get("wildcard") : "*";
3417
+ const key = optionalCatchAll || catchAll || bracket || name;
3418
+ if (key === undefined) return wildcard;
3419
+ if (encodedParams.has(key)) return encodedParams.get(key);
3420
+ if (name === undefined) return whole;
3421
+ return ":" + name + (star ? wildcard : "");
3422
+ },
3423
+ );
3200
3424
  }
3201
3425
  `.trim();
3202
3426
  }
@@ -3525,8 +3749,10 @@ ${streamNavigations ? ` // A streamed navigation swaps in the page's shell; its
3525
3749
  const record = recover ? null : { valid: true, deploymentId, promise: null };
3526
3750
  // A navigation (not a prefetch) streams when the router supports it: the page goes in as
3527
3751
  // soon as its shell arrives, and its Suspense content follows (takeNavigationStream). A page
3528
- // whose layouts hydrate, or one rendered in this page's React root, arrives whole.
3529
- const streamShell = ${streamNavigations ? `recover && !interceptFrom && !partialHeaders["F-Render"] &&
3752
+ // whose layouts hydrate, or one rendered in this page's React root, arrives whole. So does a
3753
+ // refresh, which renders every layout again (no layout chain): like a transition, it keeps
3754
+ // the page on screen until the new one is ready, so the islands it keeps are all in it.
3755
+ const streamShell = ${streamNavigations ? `recover && layoutChain && !interceptFrom && !partialHeaders["F-Render"] &&
3530
3756
  !hasHydratableLayout(new URL(url, window.location.href).pathname)` : "false"};
3531
3757
  const request = async () => {
3532
3758
  const response = await fetchFarmNavigationDocument(url, {
@@ -3538,7 +3764,7 @@ ${streamNavigations ? ` // A streamed navigation swaps in the page's shell; its
3538
3764
  ...partialHeaders,
3539
3765
  ...(streamShell ? { "F-Stream": "flush" } : {}),
3540
3766
  }, recover, signal);
3541
- if (!response.ok) throw new Error("Failed to fetch page");
3767
+ if (!response.ok) throw new Error("Failed to fetch page: " + response.status);
3542
3768
  const store = (html) => {
3543
3769
  if (cacheResult && !signal?.aborted && generation === this.prefetchGeneration &&
3544
3770
  deploymentId === window.__FARM_DEPLOYMENT_ID__ && (!record || record.valid)) {
@@ -3841,7 +4067,7 @@ function readFarmEntryImports(source) {
3841
4067
  for (const match of source.matchAll(/^import\s+([^"';]+?)\s+from\s+(["'][^"']+["'])/gm)) {
3842
4068
  const from = match[2];
3843
4069
  const named = /\{([^}]*)\}/.exec(match[1]);
3844
- for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess', _111 => _111[1], 'optionalAccess', _112 => _112.split, 'call', _113 => _113(",")]), () => ( []))) {
4070
+ for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess', _115 => _115[1], 'optionalAccess', _116 => _116.split, 'call', _117 => _117(",")]), () => ( []))) {
3845
4071
  const [imported, local] = specifier.trim().split(/\s+as\s+/);
3846
4072
  if (imported)
3847
4073
  bindings.push({ local: _nullishCoalesce(local, () => ( imported)), clause: `{ ${specifier.trim()} }`, from });
@@ -3936,7 +4162,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
3936
4162
  direction: {}
3937
4163
  }, plugins = [], renderer = _chunk67MZTLTFcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false, platform, serverStylesheets = []) {
3938
4164
  const toImportPath = (targetPath) => targetPath.replace(/\\/g, "/");
3939
- const clientPluginEntry = _chunkJSOCDYERcjs.generateFarmClientPluginEntryCode.call(void 0,
4165
+ const clientPluginEntry = _chunkQ4HH5Q6Acjs.generateFarmClientPluginEntryCode.call(void 0,
3940
4166
  plugins,
3941
4167
  root,
3942
4168
  srcDir,
@@ -3948,7 +4174,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
3948
4174
  import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
3949
4175
  import __farmAppSetup from ${JSON.stringify(_chunkQMNWKQL4cjs.toPosixPath.call(void 0, appSetupPath))};
3950
4176
  __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
3951
- const providerClientCode = _chunkN5DQMOAGcjs.generateFarmIntegrationProviderClientCode.call(void 0,
4177
+ const providerClientCode = _chunkDHR2WDSLcjs.generateFarmIntegrationProviderClientCode.call(void 0,
3952
4178
  integrationProviders,
3953
4179
  root,
3954
4180
  _nullishCoalesce(renderer.componentExtensions, () => ( []))
@@ -4069,6 +4295,8 @@ mountFarmDocsSearch();
4069
4295
 
4070
4296
  ${generateUniversalRouterStateRuntime()}
4071
4297
 
4298
+ ${_chunkDHR2WDSLcjs.FARM_NAVIGATION_SCRIPT_SOURCE}
4299
+
4072
4300
  // SPA Router for server-rendered pages (HTML swap)
4073
4301
  const spaRouter = {
4074
4302
  ${generateUniversalRouterStateProperties()}
@@ -4239,12 +4467,7 @@ ${generateUniversalRouterStateProperties()}
4239
4467
 
4240
4468
  setTimeout(function() {
4241
4469
  Array.from(document.querySelectorAll("script")).forEach(function(script) {
4242
- const freshScript = document.createElement("script");
4243
- Array.from(script.attributes).forEach(function(attr) {
4244
- freshScript.setAttribute(attr.name, attr.value);
4245
- });
4246
- freshScript.textContent = script.textContent || "";
4247
- script.replaceWith(freshScript);
4470
+ script.replaceWith(createFarmNavigationScript(script));
4248
4471
  });
4249
4472
  }, 0);
4250
4473
 
@@ -4351,7 +4574,7 @@ document.addEventListener("click", function(e) {
4351
4574
  routeEntries.push(` {
4352
4575
  pattern: ${JSON.stringify(page.pattern)},${page.directory ? `
4353
4576
  directory: ${JSON.stringify(page.directory)},` : ""}
4354
- pageShouldHydrate: ${JSON.stringify(page.pageShouldHydrate)},
4577
+ pageShouldHydrate: ${JSON.stringify(page.pageShouldHydrate)},${page.docs ? "\n docs: true," : ""}
4355
4578
  ${page.hasIsolatedClientBoundaries ? "hasIsolatedClientBoundaries: true," : ""}
4356
4579
  islandStrategy: ${JSON.stringify(page.islandStrategy)},
4357
4580
  navigation: "html-fragment",
@@ -4452,6 +4675,12 @@ ${routeEntries.join(",\n")}
4452
4675
  const clientRouteMatcher = createFarmRouter(clientRoutes.map(function(route) {
4453
4676
  return { path: route.pattern, meta: route };
4454
4677
  }));
4678
+ ${clientPages.some((page) => page.docs) ? `const clientPageRouteMatcher = createFarmRouter(clientRoutes.filter(function(route) {
4679
+ return !route.docs;
4680
+ }).map(function(route) {
4681
+ return { path: route.pattern, meta: route };
4682
+ }));` : "const clientPageRouteMatcher = clientRouteMatcher;"}
4683
+ ${generateClientPageDirectorySource()}
4455
4684
 
4456
4685
  ${isolatedHydrationRuntime}
4457
4686
  ${routeClientGraphRuntime}
@@ -4477,10 +4706,7 @@ function getApplicableLayouts(pathname) {
4477
4706
  const urlPattern = layout.urlPattern || layout.pattern;
4478
4707
  if (urlPattern !== '/' && !isFarmRouteActive(urlPattern, normalizedPath, { exact: false })) continue;
4479
4708
  if (layout.groupScope) {
4480
- if (directory === undefined) {
4481
- const matched = matchRoute(pathname);
4482
- directory = matched ? matched.route.directory || matched.route.pattern : null;
4483
- }
4709
+ if (directory === undefined) directory = getFarmPageDirectory(pathname);
4484
4710
  if (
4485
4711
  typeof directory !== 'string' ||
4486
4712
  (directory !== layout.groupScope && !directory.startsWith(layout.groupScope + '/'))
@@ -4505,7 +4731,7 @@ function hasHydratableLayout(pathname) {
4505
4731
  });
4506
4732
  }
4507
4733
 
4508
- ${_chunkN5DQMOAGcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
4734
+ ${_chunkDHR2WDSLcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
4509
4735
  // Wrap a page element with applicable layouts
4510
4736
  function wrapWithLayouts(pageElement, pathname, params) {
4511
4737
  const layouts = getApplicableLayouts(pathname);
@@ -4540,7 +4766,7 @@ function createLayoutPageBoundary(route, pageElement, serverHtml) {
4540
4766
  return React.createElement("div", props, pageElement);
4541
4767
  }
4542
4768
  let farmLastRouteState = null;
4543
- ${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkN5DQMOAGcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
4769
+ ${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkDHR2WDSLcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
4544
4770
  function farmTreeLayoutsOf(pathname) {
4545
4771
  return getApplicableLayouts(pathname).filter(function(layout) {
4546
4772
  return layout.serverTree === true;
@@ -5053,10 +5279,12 @@ async function hydrate() {
5053
5279
  }
5054
5280
  },
5055
5281
  });
5056
- ${isolatedHydrationEnabled ? `const isolatedHydration =
5282
+ ${isolatedHydrationEnabled ? `// Not cancelled with the page: a navigation disposes the islands it removes, and one in a
5283
+ // layout it keeps still waits for its trigger, as on a page of islands only.
5284
+ const isolatedHydration =
5057
5285
  !hasHydratableLayout(pathname) &&
5058
5286
  document.querySelector('f-island[src]')
5059
- ? hydrateFarmIsolatedClientBoundaries(document, hydrationController.signal)
5287
+ ? hydrateFarmIsolatedClientBoundaries(document)
5060
5288
  : Promise.resolve();
5061
5289
  await Promise.all([pageHydration, isolatedHydration]);` : "await pageHydration;"}
5062
5290
  } finally {
@@ -5102,14 +5330,11 @@ function fitsSegmentResponse(currentRoot, nextRoot) {
5102
5330
  return true;
5103
5331
  }` : ""}
5104
5332
 
5333
+ ${_chunkDHR2WDSLcjs.FARM_NAVIGATION_SCRIPT_SOURCE}
5334
+
5105
5335
  function activateNavigationScripts(root) {
5106
5336
  for (const script of Array.from(root?.querySelectorAll?.("script") || [])) {
5107
- const freshScript = document.createElement("script");
5108
- for (const attribute of Array.from(script.attributes)) {
5109
- freshScript.setAttribute(attribute.name, attribute.value);
5110
- }
5111
- freshScript.textContent = script.textContent || "";
5112
- script.replaceWith(freshScript);
5337
+ script.replaceWith(createFarmNavigationScript(script));
5113
5338
  }
5114
5339
  }
5115
5340
 
@@ -5183,8 +5408,8 @@ function removeSuspenseContent(root) {
5183
5408
  }
5184
5409
  }
5185
5410
 
5186
- // A layout's own server output, without what it wraps and without its islands, whose live DOM
5187
- // always differs from fresh HTML.
5411
+ // A layout's own server output, without what it wraps and without its islands' DOM, which live
5412
+ // always differs from fresh HTML. It keeps each island's props, so new props count as a change.
5188
5413
  function getLayoutShell(root, patterns, index) {
5189
5414
  const shell = findLayoutBoundary(root, patterns[index])?.cloneNode(true);
5190
5415
  if (!shell) return null;
@@ -5193,7 +5418,12 @@ function getLayoutShell(root, patterns, index) {
5193
5418
  : shell.querySelector("#__farm_page__");
5194
5419
  inner?.replaceChildren();
5195
5420
  removeSuspenseContent(shell);
5196
- shell.querySelectorAll("script").forEach(function(script) { script.remove(); });
5421
+ shell.querySelectorAll("script").forEach(function(script) {
5422
+ if (script.type !== "f/props") return script.remove();
5423
+ Array.from(script.attributes).forEach(function(attribute) {
5424
+ if (attribute.name !== "type") script.removeAttribute(attribute.name);
5425
+ });
5426
+ });
5197
5427
  shell.querySelectorAll("f-island").forEach(function(island) {
5198
5428
  island.replaceChildren();
5199
5429
  Array.from(island.attributes).forEach(function(attribute) {
@@ -5203,7 +5433,9 @@ function getLayoutShell(root, patterns, index) {
5203
5433
  return shell.innerHTML;
5204
5434
  }
5205
5435
 
5206
- function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
5436
+ ${islandValues ? _chunkDHR2WDSLcjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
5437
+ // A refresh keeps the islands still on the page: the ones in streamed Suspense content too.
5438
+ if (refresh) revealFarmStreamedContent(nextRoot);
5207
5439
  const currentPatterns = getLayoutPatterns(currentRoot);
5208
5440
  const nextPatterns = getLayoutPatterns(nextRoot);
5209
5441
  let sharedCount = 0;
@@ -5227,11 +5459,13 @@ function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
5227
5459
  ? findLayoutBoundary(nextRoot, nextPatterns[sharedCount])
5228
5460
  : nextRoot.querySelector("#__farm_page__");
5229
5461
 
5230
- if (!currentTarget || !nextTarget) return false;
5462
+ if (!currentTarget || !nextTarget) return false;${islandValues ? `
5463
+ // A refresh renders the same layouts again: their fields keep what was typed, and the focus.
5464
+ const fields = refresh ? captureFarmServerFields(currentTarget) : null;` : ""}
5231
5465
  ${isolatedHydrationEnabled ? `${islandValues ? `// A refresh keeps the islands still on the page, with their state and new props.
5232
5466
  if (refresh) farmIsolatedHydrationRuntime.carryOver(currentTarget, nextTarget);
5233
5467
  ` : ""}disposeFarmIsolatedClientBoundaries(currentTarget);` : ""}
5234
- currentTarget.replaceWith(nextTarget);
5468
+ currentTarget.replaceWith(nextTarget);${islandValues ? "\n if (fields) restoreFarmServerFields(fields, nextTarget);" : ""}
5235
5469
  activateNavigationScripts(nextTarget);
5236
5470
  if (nextTreeRoot && nextTreeRoot !== nextTarget) nextTreeRoot.remove();
5237
5471
 
@@ -5239,7 +5473,17 @@ function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
5239
5473
  const support = document.createElement("div");
5240
5474
  support.hidden = true;
5241
5475
  support.dataset.farmFragmentSupport = "true";
5242
- while (nextRoot.firstChild) support.appendChild(nextRoot.firstChild);
5476
+ while (nextRoot.firstChild) {
5477
+ const node = nextRoot.firstChild;
5478
+ // React's staged Suspense content stays in the root, where a later flush of a streamed
5479
+ // navigation reveals it; React removes it then.
5480
+ if (node.nodeType === 1 && node.matches('div[hidden][id^="S:"]')) {
5481
+ currentRoot.appendChild(node);
5482
+ activateNavigationScripts(node);
5483
+ } else {
5484
+ support.appendChild(node);
5485
+ }
5486
+ }
5243
5487
  document.body.appendChild(support);
5244
5488
  activateNavigationScripts(support);
5245
5489
  setTimeout(function() { support.remove(); }, 0);
@@ -5664,12 +5908,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
5664
5908
 
5665
5909
  setTimeout(function() {
5666
5910
  Array.from(document.querySelectorAll("script")).forEach(function(script) {
5667
- const freshScript = document.createElement("script");
5668
- Array.from(script.attributes).forEach(function(attr) {
5669
- freshScript.setAttribute(attr.name, attr.value);
5670
- });
5671
- freshScript.textContent = script.textContent || "";
5672
- script.replaceWith(freshScript);
5911
+ script.replaceWith(createFarmNavigationScript(script));
5673
5912
  });
5674
5913
  }, 0);
5675
5914
 
@@ -5776,7 +6015,7 @@ void hydrate();
5776
6015
  async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache, rendererBuildLifetime) {
5777
6016
  const viteBuild = productionVite.build;
5778
6017
  const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
5779
- const { PluginManager: PluginManager2 } = await import("./plugin-WIU4GDD4.cjs");
6018
+ const { PluginManager: PluginManager2 } = await import("./plugin-F2O4BFTK.cjs");
5780
6019
  const fs4 = await import("fs/promises");
5781
6020
  const pluginManager = new PluginManager2({
5782
6021
  config,
@@ -5797,7 +6036,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5797
6036
  _path2.default.join(postcssConfigDir, "postcss.config.cjs"),
5798
6037
  "module.exports = { plugins: [] };\n"
5799
6038
  );
5800
- tailwindVitePlugin = await _chunkJSOCDYERcjs.loadTailwindVitePlugin.call(void 0, {
6039
+ tailwindVitePlugin = await _chunkQ4HH5Q6Acjs.loadTailwindVitePlugin.call(void 0, {
5801
6040
  builder: productionVite.builder,
5802
6041
  label: "for SSR"
5803
6042
  });
@@ -5876,7 +6115,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5876
6115
  modulePath: entry.modulePath
5877
6116
  })) : [];
5878
6117
  const i18nCatalogs = config.i18n.enabled ? (await _chunkBBPDJGCUcjs.readFarmI18nCatalogs.call(void 0, config.i18n)).catalogs : {};
5879
- const appDirs = _chunk5Y2P454Ocjs.getFarmAppDirectories.call(void 0, config);
6118
+ const appDirs = _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, config);
5880
6119
  let openAPIReference = null;
5881
6120
  if (config.openapi.enabled && config.openapi.route) {
5882
6121
  const { OpenAPIManager, renderOpenAPIReferenceHTML } = await import("./manager-JOHU6BQI.cjs");
@@ -5896,9 +6135,15 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5896
6135
  specRoute: config.openapi.specRoute || null
5897
6136
  };
5898
6137
  }
5899
- const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
5900
- const instrumentationPath = _chunkBRWIVOV4cjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
5901
- const notFoundPath = _chunkN5DQMOAGcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
6138
+ const discoveredMiddlewareRoutes = await discoverMiddlewareRoutes(appDirs);
6139
+ const middlewareRoutes = farmTargetRunsEdgeMiddleware(preset) ? await Promise.all(
6140
+ discoveredMiddlewareRoutes.map(async (route) => ({
6141
+ ...route,
6142
+ config: await readMiddlewareFileConfig(route.filePath)
6143
+ }))
6144
+ ) : discoveredMiddlewareRoutes;
6145
+ const instrumentationPath = _chunk3GNHJ3RNcjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
6146
+ const notFoundPath = _chunkDHR2WDSLcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
5902
6147
  if (notFoundPath) _chunkQMNWKQL4cjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
5903
6148
  layoutRoutes.sort((a, b) => {
5904
6149
  const depthA = a.pattern.split("/").filter(Boolean).length;
@@ -5919,10 +6164,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5919
6164
  (provider) => provider.component || provider.type === "clerk"
5920
6165
  );
5921
6166
  const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
5922
- const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _114 => _114.mdx, 'optionalAccess', _115 => _115.components]));
6167
+ const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _118 => _118.mdx, 'optionalAccess', _119 => _119.components]));
5923
6168
  const hasMiddlewareConfig = _chunkUPOYKX4Scjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
5924
- const hasRouteContextConfig = _chunk556H7JCEcjs.hasCustomFarmRouteContext.call(void 0, config);
5925
- const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
6169
+ const hasRouteContextConfig = _chunk6GQJVY4Ecjs.hasCustomFarmRouteContext.call(void 0, config);
6170
+ const hasServerRuntimePlugins = _chunkQ4HH5Q6Acjs.hasFarmServerRuntimePlugins.call(void 0, config.plugins);
5926
6171
  const hasPluginRoutes = hasFarmPluginRoutes(config);
5927
6172
  const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
5928
6173
  const configModulePath = hasServerRuntimeIntegrations || hasObservabilityHandler || hasMdxComponentConfig || hasMiddlewareConfig || hasRouteContextConfig || hasServerRuntimePlugins || hasPluginRoutes || hasServerCacheConfig || hasFarmServerStorageConfig(config.storage) || hasIntegrationProviders ? await findFarmConfigPath(root) : null;
@@ -5931,18 +6176,19 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5931
6176
  const hasConfiguredRuntimePlugins = Boolean(
5932
6177
  hasRuntimeConfigModule && (config.plugins || []).length > 0
5933
6178
  );
5934
- if (_chunkDCXSIEFEcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
6179
+ if (_chunk4JRAMCUPcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
5935
6180
  const adapterGuardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
5936
- _chunkDCXSIEFEcjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
6181
+ _chunk4JRAMCUPcjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
5937
6182
  config.docs,
5938
6183
  { root, srcDir: config.srcDir },
5939
- (pathname) => adapterGuardedPaths.has(pathname)
6184
+ (pathname) => adapterGuardedPaths.has(pathname),
6185
+ _chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? "edge" : "node"
5940
6186
  );
5941
6187
  }
5942
6188
  const farmDocsCspNonceMarker = _chunk6JHZPB52cjs.createFarmCspNonce.call(void 0, config.security);
5943
- const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _116 => _116.docs, 'optionalAccess', _117 => _117.enabled]) && _chunkF43OG25Pcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunkHDPT6OYEcjs._runWithFarmCspNonce.call(void 0,
6189
+ const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _120 => _120.docs, 'optionalAccess', _121 => _121.enabled]) && _chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunkHDPT6OYEcjs._runWithFarmCspNonce.call(void 0,
5944
6190
  farmDocsCspNonceMarker,
5945
- async () => _optionalChain([config, 'access', _118 => _118.docs, 'access', _119 => _119.adapter, 'optionalAccess', _120 => _120.server]) ? await _chunkDCXSIEFEcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
6191
+ async () => _optionalChain([config, 'access', _122 => _122.docs, 'access', _123 => _123.adapter, 'optionalAccess', _124 => _124.server]) ? await _chunk4JRAMCUPcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
5946
6192
  root,
5947
6193
  srcDir: config.srcDir,
5948
6194
  clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
@@ -5965,6 +6211,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5965
6211
  if (farmDocsPrecompiledManifest && farmDocsCspNonceMarker) {
5966
6212
  farmDocsPrecompiledManifest.cspNonceMarker = farmDocsCspNonceMarker;
5967
6213
  }
6214
+ const farmDocsAnalyticsPages = await listFarmDocsAnalyticsPages(config, root, preset);
5968
6215
  const virtualEntryCode = generateVirtualEntryCode(
5969
6216
  apiRoutes,
5970
6217
  pageRoutes,
@@ -5991,7 +6238,8 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5991
6238
  i18nCatalogs,
5992
6239
  isolatedClientBoundaryModules,
5993
6240
  hydrationPlanCache,
5994
- mobileShellLoadingRoutes
6241
+ mobileShellLoadingRoutes,
6242
+ farmDocsAnalyticsPages
5995
6243
  );
5996
6244
  const virtualEntryId = "\0virtual:farm-ssr-entry";
5997
6245
  const useExternalMetadataImageRuntime = shouldUseExternalMetadataImageRuntime(preset, true);
@@ -6054,7 +6302,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
6054
6302
  // Adapters can render provider scripts by serializing function source.
6055
6303
  // keepNames injects helper calls into those functions; after Nitro
6056
6304
  // minifies the server chunk the helper is no longer in script scope.
6057
- keepNames: !(_optionalChain([config, 'access', _121 => _121.docs, 'optionalAccess', _122 => _122.enabled]) && _optionalChain([config, 'access', _123 => _123.docs, 'access', _124 => _124.adapter, 'optionalAccess', _125 => _125.server])),
6305
+ keepNames: !(_optionalChain([config, 'access', _125 => _125.docs, 'optionalAccess', _126 => _126.enabled]) && _optionalChain([config, 'access', _127 => _127.docs, 'access', _128 => _128.adapter, 'optionalAccess', _129 => _129.server])),
6058
6306
  jsxDev: false
6059
6307
  },
6060
6308
  // SSR configuration to externalize problematic modules
@@ -6104,10 +6352,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
6104
6352
  define: {
6105
6353
  __FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
6106
6354
  __FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
6107
- __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _126 => _126.env, 'optionalAccess', _127 => _127.public]) || {})
6355
+ __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _130 => _130.env, 'optionalAccess', _131 => _131.public]) || {})
6108
6356
  },
6109
6357
  plugins: [
6110
- _chunkN5DQMOAGcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
6358
+ _chunkDHR2WDSLcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
6111
6359
  ...tailwindVitePlugin ? [tailwindVitePlugin] : [],
6112
6360
  ...rendererVitePlugins,
6113
6361
  ...config.vite.plugins || [],
@@ -6127,10 +6375,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
6127
6375
  },
6128
6376
  createVercelOgFontInlinePlugin(edgeMetadataImageRuntime.runtime)
6129
6377
  ] : [],
6130
- { ...createReactProductionModePlugin(), enforce: "pre" },
6378
+ { ..._chunkNG2EZ6QScjs.createReactProductionModePlugin.call(void 0, ), enforce: "pre" },
6131
6379
  farmServerOnlyEntriesPlugin(),
6132
6380
  farmPlugin({ ...config, isolatedClientBoundaryModules }, pluginManager),
6133
- _chunk4DRINDGNcjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
6381
+ _chunkVO65MYJDcjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
6134
6382
  ...hasRuntimeConfigModule ? [
6135
6383
  farmStripPlatformConfigPlugin(
6136
6384
  [
@@ -6141,17 +6389,23 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
6141
6389
  ] : [],
6142
6390
  {
6143
6391
  name: "farm-virtual-ssr-entry",
6144
- resolveId(id) {
6145
- if (id === virtualEntryId || id === "\0virtual:farm-ssr-entry") {
6146
- return virtualEntryId;
6392
+ resolveId: {
6393
+ filter: { id: _chunkDHR2WDSLcjs.exactIdPattern.call(void 0, [virtualEntryId, "\0virtual:farm-ssr-entry"]) },
6394
+ handler(id) {
6395
+ if (id === virtualEntryId || id === "\0virtual:farm-ssr-entry") {
6396
+ return virtualEntryId;
6397
+ }
6398
+ return null;
6147
6399
  }
6148
- return null;
6149
6400
  },
6150
- load(id) {
6151
- if (id === virtualEntryId) {
6152
- return virtualEntryCode;
6401
+ load: {
6402
+ filter: { id: _chunkDHR2WDSLcjs.exactIdPattern.call(void 0, [virtualEntryId]) },
6403
+ handler(id) {
6404
+ if (id === virtualEntryId) {
6405
+ return virtualEntryCode;
6406
+ }
6407
+ return null;
6153
6408
  }
6154
- return null;
6155
6409
  }
6156
6410
  },
6157
6411
  {
@@ -6177,7 +6431,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
6177
6431
  resolve: {
6178
6432
  alias: [
6179
6433
  ...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
6180
- ...Object.entries(_chunkN5DQMOAGcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
6434
+ ...Object.entries(_chunkDHR2WDSLcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
6181
6435
  ([find, replacement]) => ({ find, replacement })
6182
6436
  )
6183
6437
  ],
@@ -6185,7 +6439,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
6185
6439
  dedupe: [...config.renderer.dedupe || []]
6186
6440
  }
6187
6441
  };
6188
- await viteBuild(_chunkN5DQMOAGcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
6442
+ await viteBuild(_chunkDHR2WDSLcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
6189
6443
  } finally {
6190
6444
  if (postcssConfigDir) {
6191
6445
  try {
@@ -6221,26 +6475,26 @@ function readFarmPageLastModified(pageRoutes) {
6221
6475
  return lastModified;
6222
6476
  }
6223
6477
  function getFarmDocsGuardedPaths(config, middlewareRoutes) {
6224
- if (!_optionalChain([config, 'access', _128 => _128.docs, 'optionalAccess', _129 => _129.enabled])) return [];
6478
+ if (!_optionalChain([config, 'access', _132 => _132.docs, 'optionalAccess', _133 => _133.enabled])) return [];
6225
6479
  const options = { root: config.root, srcDir: config.srcDir };
6226
6480
  const guards = {
6227
6481
  config: { middleware: config.middleware, integrations: config.integrations },
6228
6482
  middlewareRoutes
6229
6483
  };
6230
- return _chunkPPX7UOFYcjs.getFarmDocsRoots.call(void 0, config.docs).flatMap(
6231
- (docsRoot) => _chunkPPX7UOFYcjs.discoverFarmDocsPages.call(void 0, _chunkPPX7UOFYcjs.resolveFarmDocsContentDir.call(void 0, docsRoot, options), docsRoot)
6232
- ).flatMap((page) => [page.href, _chunkPPX7UOFYcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunkUPOYKX4Scjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
6484
+ return _chunkFVYBEMODcjs.getFarmDocsRoots.call(void 0, config.docs).flatMap(
6485
+ (docsRoot) => _chunkFVYBEMODcjs.discoverFarmDocsPages.call(void 0, _chunkFVYBEMODcjs.resolveFarmDocsContentDir.call(void 0, docsRoot, options), docsRoot)
6486
+ ).flatMap((page) => [page.href, _chunkFVYBEMODcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunkUPOYKX4Scjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
6233
6487
  }
6234
6488
  function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
6235
- const llmsTxt = _optionalChain([agent, 'optionalAccess', _130 => _130.llmsTxt]);
6489
+ const llmsTxt = _optionalChain([agent, 'optionalAccess', _134 => _134.llmsTxt]);
6236
6490
  const ownedByFile = (kind) => applicationMetadataRoutes.some(
6237
6491
  (metadata) => metadata.kind === kind && metadata.pattern === "/"
6238
6492
  );
6239
6493
  return [
6240
- ..._optionalChain([llmsTxt, 'optionalAccess', _131 => _131.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
6241
- ..._optionalChain([llmsTxt, 'optionalAccess', _132 => _132.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
6242
- ..._optionalChain([agent, 'optionalAccess', _133 => _133.sitemap, 'optionalAccess', _134 => _134.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
6243
- ..._optionalChain([agent, 'optionalAccess', _135 => _135.crawlers, 'optionalAccess', _136 => _136.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
6494
+ ..._optionalChain([llmsTxt, 'optionalAccess', _135 => _135.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
6495
+ ..._optionalChain([llmsTxt, 'optionalAccess', _136 => _136.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
6496
+ ..._optionalChain([agent, 'optionalAccess', _137 => _137.sitemap, 'optionalAccess', _138 => _138.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
6497
+ ..._optionalChain([agent, 'optionalAccess', _139 => _139.crawlers, 'optionalAccess', _140 => _140.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
6244
6498
  ];
6245
6499
  }
6246
6500
  function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
@@ -6251,7 +6505,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
6251
6505
  docsPath: ${root}.entry,
6252
6506
  contentDir: ${root}.contentDir || ${root}.config?.contentDir,
6253
6507
  }`;
6254
- if (_optionalChain([docs, 'optionalAccess', _137 => _137.roots, 'optionalAccess', _138 => _138.length])) {
6508
+ if (_optionalChain([docs, 'optionalAccess', _141 => _141.roots, 'optionalAccess', _142 => _142.length])) {
6255
6509
  return {
6256
6510
  factory: "createFarmDocsAdapterMultiRuntimeHandler",
6257
6511
  config: `[farmDocsResolvedConfig, ...farmDocsResolvedConfig.roots].map((farmDocsRoot) => (${runtimeConfig("farmDocsRoot")}))`
@@ -6264,7 +6518,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
6264
6518
  }
6265
6519
  function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
6266
6520
  if (!docs.enabled) return "null";
6267
- const serializableDocs = _optionalChain([docs, 'access', _139 => _139.roots, 'optionalAccess', _140 => _140.length]) ? {
6521
+ const serializableDocs = _optionalChain([docs, 'access', _143 => _143.roots, 'optionalAccess', _144 => _144.length]) ? {
6268
6522
  ...docs,
6269
6523
  // React elements and functions do not survive JSON; see runtimeConfig below.
6270
6524
  roots: docs.roots.map((docsRoot) => ({ ...docsRoot, runtimeConfig: void 0 }))
@@ -6298,7 +6552,7 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
6298
6552
  },
6299
6553
  }
6300
6554
  : ${JSON.stringify({ ...serializableDocs, runtimeConfig: void 0 })}`;
6301
- if (!_optionalChain([docs, 'access', _141 => _141.roots, 'optionalAccess', _142 => _142.length])) return expression;
6555
+ if (!_optionalChain([docs, 'access', _145 => _145.roots, 'optionalAccess', _146 => _146.length])) return expression;
6302
6556
  return `((farmDocs) => ({
6303
6557
  ...farmDocs,
6304
6558
  roots: farmDocs.roots.map((farmDocsRoot, index) => {
@@ -6315,7 +6569,7 @@ function toVirtualEntryImportSpecifier(modulePath) {
6315
6569
  return JSON.stringify(modulePath.replace(/\\/g, "/"));
6316
6570
  }
6317
6571
  function generateNativeAuthIntegrationSource(auth) {
6318
- if (_optionalChain([auth, 'optionalAccess', _143 => _143.enabled]) !== true) {
6572
+ if (_optionalChain([auth, 'optionalAccess', _147 => _147.enabled]) !== true) {
6319
6573
  return { importSource: "", registerSource: "" };
6320
6574
  }
6321
6575
  return {
@@ -6623,28 +6877,28 @@ if (typeof ReactDOMServer.configureApp !== "function") {
6623
6877
  }
6624
6878
  ReactDOMServer.configureApp(__farmAppSetup);`;
6625
6879
  }
6626
- function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache, mobileShellLoadingRoutes = []) {
6880
+ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache, mobileShellLoadingRoutes = [], farmDocsAnalyticsPages = []) {
6627
6881
  const farmRendererDisabled = _chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, config.renderer);
6628
- const farmIslandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _144 => _144.experimental, 'optionalAccess', _145 => _145.serverComponents])) === "islands";
6629
- const farmClientBoot = _chunkN5DQMOAGcjs.canBootFarmIslandsClient.call(void 0, config);
6882
+ const farmIslandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _148 => _148.experimental, 'optionalAccess', _149 => _149.serverComponents])) === "islands";
6883
+ const farmClientBoot = _chunkDHR2WDSLcjs.canBootFarmIslandsClient.call(void 0, config);
6630
6884
  const farmMobileClient = shouldBuildFarmMobileClient(config);
6631
6885
  const farmMobileShells = farmMobileClient && config.mobileShells ? config.mobileShells : null;
6632
6886
  const hasCompressionRuntime = config.compress && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
6633
- const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _146 => _146.agent, 'optionalAccess', _147 => _147.crawlers, 'optionalAccess', _148 => _148.enabled])) && !applicationMetadataRoutes.some(
6887
+ const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _150 => _150.agent, 'optionalAccess', _151 => _151.crawlers, 'optionalAccess', _152 => _152.enabled])) && !applicationMetadataRoutes.some(
6634
6888
  (metadata) => metadata.kind === "robots" && metadata.pattern === "/"
6635
6889
  );
6636
- const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _149 => _149.agent, 'optionalAccess', _150 => _150.sitemap, 'optionalAccess', _151 => _151.enabled])) && !applicationMetadataRoutes.some(
6890
+ const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _153 => _153.agent, 'optionalAccess', _154 => _154.sitemap, 'optionalAccess', _155 => _155.enabled])) && !applicationMetadataRoutes.some(
6637
6891
  (metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
6638
6892
  );
6639
- const servesDefaultMCP = _optionalChain([config, 'access', _152 => _152.agent, 'optionalAccess', _153 => _153.mcp]) === true && !_chunkX3MHKLCOcjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
6640
- const servesAiCatalog = _optionalChain([config, 'access', _154 => _154.agent, 'optionalAccess', _155 => _155.aiCatalog]) !== false;
6893
+ const servesDefaultMCP = _optionalChain([config, 'access', _156 => _156.agent, 'optionalAccess', _157 => _157.mcp]) === true && !_chunkX3MHKLCOcjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
6894
+ const servesAiCatalog = _optionalChain([config, 'access', _158 => _158.agent, 'optionalAccess', _159 => _159.aiCatalog]) !== false;
6641
6895
  const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
6642
6896
  const hasInfraAnalyticsRuntime = config.analytics !== false && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
6643
6897
  const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
6644
6898
  const adapterOwnsDocsRuntime = Boolean(
6645
- _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _156 => _156.docs, 'optionalAccess', _157 => _157.enabled]) && _optionalChain([config, 'access', _158 => _158.docs, 'access', _159 => _159.adapter, 'optionalAccess', _160 => _160.server]) && config.docs.adapter.react
6899
+ _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _160 => _160.docs, 'optionalAccess', _161 => _161.enabled]) && _optionalChain([config, 'access', _162 => _162.docs, 'access', _163 => _163.adapter, 'optionalAccess', _164 => _164.server]) && config.docs.adapter.react
6646
6900
  );
6647
- if (_optionalChain([config, 'access', _161 => _161.docs, 'optionalAccess', _162 => _162.enabled]) && _optionalChain([config, 'access', _163 => _163.docs, 'access', _164 => _164.roots, 'optionalAccess', _165 => _165.length]) && !adapterOwnsDocsRuntime) {
6901
+ if (_optionalChain([config, 'access', _165 => _165.docs, 'optionalAccess', _166 => _166.enabled]) && _optionalChain([config, 'access', _167 => _167.docs, 'access', _168 => _168.roots, 'optionalAccess', _169 => _169.length]) && !adapterOwnsDocsRuntime) {
6648
6902
  throw new Error(
6649
6903
  "Several docs roots need the docs adapter, which serves the React renderer only; Farm's built-in docs renderer serves a single docs root."
6650
6904
  );
@@ -6654,7 +6908,7 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
6654
6908
  const hasIsolatedClientGraphRuntime = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && isolatedClientBoundaryModules.size > 0;
6655
6909
  const rendererStreamingCapabilities = _chunk67MZTLTFcjs.getFarmRendererStreamingCapabilitiesForRuntime.call(void 0,
6656
6910
  config.renderer,
6657
- _chunkF43OG25Pcjs.getFarmPresetRuntime.call(void 0, preset)
6911
+ _chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset)
6658
6912
  );
6659
6913
  const hasReactSyncRender = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer);
6660
6914
  const rendererServerImports = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) ? `import * as React from "react";
@@ -6693,8 +6947,9 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6693
6947
  const hasGeneratedMetadataImages = metadataImageRoutes.some(
6694
6948
  (image) => image.sourceType === "module"
6695
6949
  );
6950
+ const edgeMiddlewareFilePaths = farmTargetRunsEdgeMiddleware(preset) ? middlewareRoutes.filter(isFarmEdgeMiddlewareRoute).map((route) => route.filePath) : [];
6696
6951
  const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunkUPOYKX4Scjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
6697
- const farmDocsFontAssets = _optionalChain([config, 'access', _166 => _166.docs, 'optionalAccess', _167 => _167.enabled]) ? _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
6952
+ const farmDocsFontAssets = _optionalChain([config, 'access', _170 => _170.docs, 'optionalAccess', _171 => _171.enabled]) ? _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
6698
6953
  const integrationProviders = _chunkBDYM2TN3cjs.getIntegrationProviders.call(void 0, config.integrations);
6699
6954
  const renderedIntegrationProviders = integrationProviders.filter(
6700
6955
  (provider) => provider.component || provider.type === "clerk"
@@ -6704,16 +6959,16 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6704
6959
  `Integration provider components are not supported by the "${config.renderer.name}" renderer.`
6705
6960
  );
6706
6961
  }
6707
- const providerServerModules = _chunkN5DQMOAGcjs.generateFarmIntegrationProviderServerModules.call(void 0,
6962
+ const providerServerModules = _chunkDHR2WDSLcjs.generateFarmIntegrationProviderServerModules.call(void 0,
6708
6963
  renderedIntegrationProviders,
6709
6964
  config.root,
6710
6965
  _nullishCoalesce(config.renderer.componentExtensions, () => ( []))
6711
6966
  );
6712
6967
  const resolvedIntegrationProviderFallback = Object.fromEntries(
6713
6968
  Object.entries(config.integrations).flatMap(([name, integration]) => {
6714
- const configuredProviders = _optionalChain([integration, 'optionalAccess', _168 => _168.providers]);
6969
+ const configuredProviders = _optionalChain([integration, 'optionalAccess', _172 => _172.providers]);
6715
6970
  const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
6716
- if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _169 => _169.component]) === "function")) {
6971
+ if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _173 => _173.component]) === "function")) {
6717
6972
  throw new Error(
6718
6973
  `Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
6719
6974
  );
@@ -6724,20 +6979,20 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6724
6979
  const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
6725
6980
  (provider) => provider.supportsIsolatedHydration !== true
6726
6981
  );
6727
- const isolatedHydrationMode = _chunk4DRINDGNcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
6728
- _optionalChain([config, 'access', _170 => _170.experimental, 'optionalAccess', _171 => _171.isolatedClientHydration]),
6982
+ const isolatedHydrationMode = _chunkVO65MYJDcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
6983
+ _optionalChain([config, 'access', _174 => _174.experimental, 'optionalAccess', _175 => _175.isolatedClientHydration]),
6729
6984
  {
6730
- serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _172 => _172.experimental, 'optionalAccess', _173 => _173.serverComponents])) === "rsc",
6985
+ serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _176 => _176.experimental, 'optionalAccess', _177 => _177.serverComponents])) === "rsc",
6731
6986
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
6732
6987
  }
6733
6988
  );
6734
- const hydrationPlanOptions = _chunk4DRINDGNcjs.getFarmClientHydrationPlanOptions.call(void 0,
6989
+ const hydrationPlanOptions = _chunkVO65MYJDcjs.getFarmClientHydrationPlanOptions.call(void 0,
6735
6990
  config.renderer,
6736
6991
  Boolean(unsupportedIntegrationProvider)
6737
6992
  );
6738
6993
  const pageHydrationPlanOptions = {
6739
6994
  ...hydrationPlanOptions,
6740
- serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _174 => _174.experimental, 'optionalAccess', _175 => _175.serverComponents])) === "islands"
6995
+ serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _178 => _178.experimental, 'optionalAccess', _179 => _179.serverComponents])) === "islands"
6741
6996
  };
6742
6997
  const layoutHydrationPlans = layoutRoutes.map((layout) => ({
6743
6998
  ...layout,
@@ -6749,7 +7004,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6749
7004
  { ...hydrationPlanOptions, serverTreeLayouts: pageHydrationPlanOptions.serverOwners }
6750
7005
  )
6751
7006
  }));
6752
- const markdownPagePlan = _chunk4DRINDGNcjs.createMarkdownPageHydrationPlanner.call(void 0,
7007
+ const markdownPagePlan = _chunkVO65MYJDcjs.createMarkdownPageHydrationPlanner.call(void 0,
6753
7008
  _chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
6754
7009
  config.root,
6755
7010
  isolatedHydrationMode,
@@ -6758,7 +7013,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6758
7013
  const pageHydrationPlans = new Map(
6759
7014
  pageRoutes.map((route) => [
6760
7015
  route.modulePath,
6761
- _chunkQ37INCXGcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
7016
+ _chunk3EEINK7Gcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
6762
7017
  route.modulePath,
6763
7018
  config.root,
6764
7019
  isolatedHydrationMode,
@@ -6767,7 +7022,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6767
7022
  )
6768
7023
  ])
6769
7024
  );
6770
- _chunk4DRINDGNcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
7025
+ _chunkVO65MYJDcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
6771
7026
  layoutHydrationPlans.map((layout) => ({
6772
7027
  pattern: layout.pattern,
6773
7028
  depth: layout.pattern.split("/").filter(Boolean).length,
@@ -6797,7 +7052,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6797
7052
  apiRegistrations.push(`
6798
7053
  {
6799
7054
  path: ${JSON.stringify(route.path)},
6800
- methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _176 => _176.pluginMethods, 'optionalAccess', _177 => _177.includes, 'call', _178 => _178(method)])))},
7055
+ methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _180 => _180.pluginMethods, 'optionalAccess', _181 => _181.includes, 'call', _182 => _182(method)])))},
6801
7056
  endpoints: ${varName},
6802
7057
  }`);
6803
7058
  });
@@ -6810,7 +7065,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6810
7065
  }).map(({ route }) => route);
6811
7066
  orderedPageRoutes.forEach((route, index) => {
6812
7067
  const varName = `pageRoute${index}`;
6813
- if (_chunkQ37INCXGcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
7068
+ if (_chunk3EEINK7Gcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
6814
7069
  pageRegistrations.push(`
6815
7070
  {
6816
7071
  pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
@@ -6834,7 +7089,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6834
7089
  `import * as ${varName} from ${toVirtualEntryImportSpecifier(route.modulePath)};`
6835
7090
  );
6836
7091
  const clientMetadata = pageHydrationPlans.get(route.modulePath);
6837
- const renderingDirective = _chunkYVTS3S3Fcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
7092
+ const renderingDirective = _chunkQOGIZKSOcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
6838
7093
  pageRegistrations.push(`
6839
7094
  {
6840
7095
  pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
@@ -6842,8 +7097,8 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6842
7097
  module: ${varName},
6843
7098
  shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
6844
7099
  clientModule: ${JSON.stringify(_chunkQMNWKQL4cjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
6845
- islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunk4DRINDGNcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${(() => {
6846
- const rootStrategy = _chunkN5DQMOAGcjs.resolveFarmRouteRootStrategy.call(void 0,
7100
+ islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkVO65MYJDcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${(() => {
7101
+ const rootStrategy = _chunkDHR2WDSLcjs.resolveFarmRouteRootStrategy.call(void 0,
6847
7102
  route,
6848
7103
  clientMetadata,
6849
7104
  layoutHydrationPlans.map((layout) => ({ ...layout, ...layout.hydration })),
@@ -6906,7 +7161,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6906
7161
  containerId: ${JSON.stringify(slot.containerId)},
6907
7162
  interception: ${JSON.stringify(slot.interception)},
6908
7163
  fallback: ${JSON.stringify(slot.fallback)},
6909
- hydrates: ${!farmIslandsMode || _chunk4DRINDGNcjs.getClientModuleMetadata.call(void 0, slot.modulePath, config.root).isClientComponent},
7164
+ hydrates: ${!farmIslandsMode || _chunkVO65MYJDcjs.getClientModuleMetadata.call(void 0, slot.modulePath, config.root).isClientComponent},
6910
7165
  module: ${varName},
6911
7166
  }`);
6912
7167
  });
@@ -7037,6 +7292,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
7037
7292
  createFarmApiCatalogResponse,
7038
7293
  createFarmAppManifestResponse,
7039
7294
  farmPathGuardCoversEndpoint,
7295
+ farmPathGuardCoversPage,
7040
7296
  collectFarmLlmsTxtPages,
7041
7297
  createFarmDefaultLlmsTxt,
7042
7298
  createFarmLlmsMarkdownReader,
@@ -7147,38 +7403,40 @@ function resolveFarmMobileShellRender(request, route, routePathname) {
7147
7403
  }
7148
7404
  return loading.route.module.default;
7149
7405
  }` : ""}${farmIslandsMode ? `
7150
- import { getSharedLayoutPrefixLength, handleFarmFormActionRequest, ignoreFarmHeldValues, installFarmIslandValues, parseFarmLayoutChainHeader } from "@farm.js/core/internal/production-runtime";
7406
+ import { getFarmFormState as farmFormState, getSharedLayoutPrefixLength, handleFarmFormActionRequest, ignoreFarmHeldValues, installFarmIslandValues, parseFarmLayoutChainHeader, renderFarmFormStateScript as farmFormStateScript } from "@farm.js/core/internal/production-runtime";
7151
7407
  import { installFarmIslandsServer } from "@farm.js/core/internal/islands-server";
7152
7408
  installFarmIslandsServer();
7153
7409
  const farmFormActionsConfig = ${JSON.stringify(_chunk4P5634G6cjs.resolveServerActionsConfig.call(void 0, config.serverActions))};
7154
7410
  installFarmIslandValues();
7155
7411
  ${islandsActionKeyCode()}
7156
- ${FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME}` : ""}`;
7412
+ ${FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME}` : `
7413
+ function farmFormState() { return undefined; }
7414
+ function farmFormStateScript() { return ""; }`}`;
7157
7415
  const productionSiteTelemetryImport = config.telemetry ? `import { createFarmProductionSiteReporter } from "@farm.js/core/internal/product-telemetry-runtime";` : "";
7158
7416
  const metadataImageRuntimeImport = hasGeneratedMetadataImages ? `import { createFarmMetadataImageResponse } from "@farm.js/core/internal/metadata-image-runtime";` : "";
7159
7417
  const pluginRuntimeImport = hasPluginRuntime ? `import { PluginManager } from "@farm.js/core/plugin";` : "";
7160
7418
  const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
7161
7419
  const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
7162
7420
  const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
7163
- const docsHandlerImport = _optionalChain([config, 'access', _179 => _179.docs, 'optionalAccess', _180 => _180.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
7421
+ const docsHandlerImport = _optionalChain([config, 'access', _183 => _183.docs, 'optionalAccess', _184 => _184.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
7164
7422
  const isFarmDocsAPIRequest = (requestOrPathname) => {
7165
7423
  const pathname = typeof requestOrPathname === "string"
7166
7424
  ? requestOrPathname
7167
7425
  : new URL(requestOrPathname.url).pathname;
7168
- const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _181 => _181.apiPath]) || "/api/docs")};
7426
+ const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _185 => _185.apiPath]) || "/api/docs")};
7169
7427
  return pathname === apiPath || pathname.startsWith(apiPath + "/");
7170
7428
  };` : adapterOwnsDocsRuntime ? `import { ${docsConfigModulePath ? "getFarmDocsConfigModuleRoot, " : ""}isFarmDocsAPIRequest } from "@farm.js/core/docs";
7171
- import { ${_optionalChain([config, 'access', _182 => _182.docs, 'access', _183 => _183.roots, 'optionalAccess', _184 => _184.length]) ? "createFarmDocsMultiRuntimeHandler as createFarmDocsAdapterMultiRuntimeHandler" : "createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler"} } from ${JSON.stringify(config.docs.adapter.server)};
7429
+ import { ${_optionalChain([config, 'access', _186 => _186.docs, 'access', _187 => _187.roots, 'optionalAccess', _188 => _188.length]) ? "createFarmDocsMultiRuntimeHandler as createFarmDocsAdapterMultiRuntimeHandler" : "createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler"} } from ${JSON.stringify(config.docs.adapter.server)};
7172
7430
  import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
7173
7431
  import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
7174
- const docsFontImport = _optionalChain([config, 'access', _185 => _185.docs, 'optionalAccess', _186 => _186.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
7175
- const docsRuntimeImport = _optionalChain([config, 'access', _187 => _187.docs, 'optionalAccess', _188 => _188.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
7432
+ const docsFontImport = _optionalChain([config, 'access', _189 => _189.docs, 'optionalAccess', _190 => _190.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
7433
+ const docsRuntimeImport = _optionalChain([config, 'access', _191 => _191.docs, 'optionalAccess', _192 => _192.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
7176
7434
  import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
7177
7435
  import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
7178
- const markdownHandlerImport = _optionalChain([config, 'access', _189 => _189.md, 'optionalAccess', _190 => _190.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
7436
+ const markdownHandlerImport = _optionalChain([config, 'access', _193 => _193.md, 'optionalAccess', _194 => _194.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
7179
7437
  const appMarkdownImport = hasMarkdownPages ? `import { FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS, createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
7180
7438
  const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
7181
- const mdxComponentsPath = typeof _optionalChain([config, 'access', _191 => _191.mdx, 'optionalAccess', _192 => _192.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
7439
+ const mdxComponentsPath = typeof _optionalChain([config, 'access', _195 => _195.mdx, 'optionalAccess', _196 => _196.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
7182
7440
  const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
7183
7441
  const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
7184
7442
  const layerConfigImports = layerConfigPaths.map(
@@ -7198,14 +7456,14 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
7198
7456
  const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
7199
7457
  const nativeMCP = _chunkVM57CK74cjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
7200
7458
  const mobileSession = (config.plugins || []).some(
7201
- (plugin) => _optionalChain([plugin, 'optionalAccess', _193 => _193.name]) === _chunk4BS3HSY7cjs.FARM_MOBILE_SESSION_PLUGIN
7459
+ (plugin) => _optionalChain([plugin, 'optionalAccess', _197 => _197.name]) === _chunk4BS3HSY7cjs.FARM_MOBILE_SESSION_PLUGIN
7202
7460
  );
7203
7461
  const nativeServerFns = (config.plugins || []).some(
7204
- (plugin) => _optionalChain([plugin, 'optionalAccess', _194 => _194.name]) === _chunk4EBC7EMWcjs.FARM_NATIVE_SERVER_FN_PLUGIN
7205
- ) ? _chunk23PVOIPTcjs.collectFarmNativeServerFns.call(void 0, {
7462
+ (plugin) => _optionalChain([plugin, 'optionalAccess', _198 => _198.name]) === _chunk4EBC7EMWcjs.FARM_NATIVE_SERVER_FN_PLUGIN
7463
+ ) ? _chunkL5OZN6YWcjs.collectFarmNativeServerFns.call(void 0, {
7206
7464
  root: config.root,
7207
7465
  srcDir: config.srcDir,
7208
- entries: _chunk23PVOIPTcjs.findFarmNativeScreenFiles.call(void 0, _chunk5Y2P454Ocjs.getFarmAppDirectories.call(void 0, config))
7466
+ entries: _chunkL5OZN6YWcjs.findFarmNativeScreenFiles.call(void 0, _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, config))
7209
7467
  }) : void 0;
7210
7468
  const integrationImports = `
7211
7469
  ${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
@@ -7220,7 +7478,7 @@ ${nativeServerFns ? `const __farmNativeServerFnRegistry = Object.assign(Object.c
7220
7478
  ${nativeServerFns.flatMap((module, index) => module.exports.map((entry) => ` ${JSON.stringify(entry.id)}: __farmNativeServerFns${index}[${JSON.stringify(entry.name)}],`)).join("\n")}
7221
7479
  });` : ""}
7222
7480
  `;
7223
- const imageRuntime = _chunkN5DQMOAGcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
7481
+ const imageRuntime = _chunkDHR2WDSLcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
7224
7482
  const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
7225
7483
  const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
7226
7484
  const apiHandlerCode = apiRoutes.length > 0 ? `
@@ -7357,7 +7615,7 @@ ${routeClientGraphServerRuntime}
7357
7615
  const farmRendererStreamingCapabilities = ${JSON.stringify(rendererStreamingCapabilities)};
7358
7616
  const farmRendererName = ${JSON.stringify(config.renderer.name)};
7359
7617
  const farmReactSyncRender = ${JSON.stringify(hasReactSyncRender)};
7360
- const farmRendererRuntime = ${JSON.stringify(_chunkF43OG25Pcjs.getFarmPresetRuntime.call(void 0, preset))};
7618
+ const farmRendererRuntime = ${JSON.stringify(_chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset))};
7361
7619
  const farmRendererRuntimeStreamingCapabilities = ReactDOMServer.capabilities &&
7362
7620
  ReactDOMServer.capabilities.streaming;
7363
7621
  if (farmRendererRuntimeStreamingCapabilities &&
@@ -7402,7 +7660,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
7402
7660
 
7403
7661
  function FarmDefault404Page() {
7404
7662
  return React.createElement(React.Fragment, null,
7405
- React.createElement("style", null, ${JSON.stringify(_chunkN5DQMOAGcjs.DEFAULT_NOT_FOUND_STYLES)}),
7663
+ React.createElement("style", null, ${JSON.stringify(_chunkDHR2WDSLcjs.DEFAULT_NOT_FOUND_STYLES)}),
7406
7664
  React.createElement("main", {
7407
7665
  className: "farm-default-not-found",
7408
7666
  "aria-labelledby": "farm-default-not-found-title",
@@ -7540,19 +7798,19 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
7540
7798
  onError(error) { console.error("[Farm Image]", error); },
7541
7799
  })`};
7542
7800
  const farmMarkdownConfig = ${JSON.stringify(config.md)};
7543
- const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _195 => _195.agent, 'optionalAccess', _196 => _196.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
7544
- ${_optionalChain([config, 'access', _197 => _197.agent, 'optionalAccess', _198 => _198.llmsTxt, 'optionalAccess', _199 => _199.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
7801
+ const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _199 => _199.agent, 'optionalAccess', _200 => _200.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
7802
+ ${_optionalChain([config, 'access', _201 => _201.agent, 'optionalAccess', _202 => _202.llmsTxt, 'optionalAccess', _203 => _203.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
7545
7803
  const farmMdxConfig = ${JSON.stringify({
7546
7804
  ...config.mdx,
7547
- components: typeof _optionalChain([config, 'access', _200 => _200.mdx, 'optionalAccess', _201 => _201.components]) === "string" ? config.mdx.components : void 0
7805
+ components: typeof _optionalChain([config, 'access', _204 => _204.mdx, 'optionalAccess', _205 => _205.components]) === "string" ? config.mdx.components : void 0
7548
7806
  })};
7549
7807
  const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
7550
- ${_optionalChain([config, 'access', _202 => _202.agent, 'optionalAccess', _203 => _203.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
7808
+ ${_optionalChain([config, 'access', _206 => _206.agent, 'optionalAccess', _207 => _207.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
7551
7809
  // environment this was built in, since Netlify exposes its deploy context only
7552
7810
  // to the build.
7553
7811
  const farmNoindexPreview = resolveFarmPreviewDeployment(
7554
7812
  globalThis.process?.env,
7555
- ${JSON.stringify(_chunk6V5YWI4Wcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env))},
7813
+ ${JSON.stringify(_chunkGUMKIQJLcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env))},
7556
7814
  );` : ""}
7557
7815
  const farmMdxComponents = ${mdxComponentsPath ? `(FarmMdxComponentsModule.components || Reflect.get(FarmMdxComponentsModule, "default") || {})` : `(configuredFarmMdxComponents && typeof configuredFarmMdxComponents === "object" ? configuredFarmMdxComponents : {})`};
7558
7816
  const farmObservabilityConfig = farmUserConfig?.observability ?? ${JSON.stringify(
@@ -7598,7 +7856,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
7598
7856
  });
7599
7857
  const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
7600
7858
  ${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
7601
- const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _204 => _204.docs, 'optionalAccess', _205 => _205.enabled]) && !hasPrecompiledDocs ? `(() => {
7859
+ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _208 => _208.docs, 'optionalAccess', _209 => _209.enabled]) && !hasPrecompiledDocs ? `(() => {
7602
7860
  try {
7603
7861
  const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
7604
7862
  const candidates = [
@@ -7610,7 +7868,7 @@ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _204 => _2
7610
7868
  } catch {
7611
7869
  return null;
7612
7870
  }
7613
- })()` : "null"};${_optionalChain([config, 'access', _206 => _206.docs, 'optionalAccess', _207 => _207.enabled]) && !hasPrecompiledDocs && _optionalChain([config, 'access', _208 => _208.docs, 'access', _209 => _209.roots, 'optionalAccess', _210 => _210.length]) ? `
7871
+ })()` : "null"};${_optionalChain([config, 'access', _210 => _210.docs, 'optionalAccess', _211 => _211.enabled]) && !hasPrecompiledDocs && _optionalChain([config, 'access', _212 => _212.docs, 'access', _213 => _213.roots, 'optionalAccess', _214 => _214.length]) ? `
7614
7872
  const farmDocsBundledRootsDir = (() => {
7615
7873
  try {
7616
7874
  const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
@@ -7662,7 +7920,7 @@ const farmDocsModulePreloadPaths = farmDocsModulePreloads
7662
7920
  ),
7663
7921
  }
7664
7922
  : undefined;
7665
- const farmDocsHandler = ${_optionalChain([config, 'access', _211 => _211.docs, 'optionalAccess', _212 => _212.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {
7923
+ const farmDocsHandler = ${_optionalChain([config, 'access', _215 => _215.docs, 'optionalAccess', _216 => _216.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {
7666
7924
  rootDir: farmDocsRuntimeRoot,
7667
7925
  // A production build's content cannot change, so the adapter reads its
7668
7926
  // navigation once instead of scanning the content directory per request.
@@ -7681,6 +7939,19 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _211 => _211.docs, '
7681
7939
  loadReactModule: async () => FarmDocsAdapterReact,
7682
7940
  // Lists the docs MCP endpoint in /.well-known/ai-catalog.json for the server's lifetime.
7683
7941
  registerMCPServer: registerFarmMCPServer,
7942
+ // A page built with this keeps its HTML string, so the preload budget and the response
7943
+ // writer use it instead of reading and re-encoding the body. Older adapters ignore it.
7944
+ createHtmlResponse: farmOwnedHtmlResponse,${_chunk4JRAMCUPcjs.farmDocsAdapterServesGuardedPages.call(void 0, config.docs) ? `
7945
+ // The adapter keeps pages a path guard covers off search, llms.txt, the sitemap and MCP. It
7946
+ // asks about any path its own content lists, so the guards decide here, not a page list.
7947
+ isPathGuarded: (pathname) =>
7948
+ farmPathGuardCoversPage(
7949
+ {
7950
+ config: { middleware: farmMiddlewareConfig, integrations: serverRuntimeIntegrations },
7951
+ middlewareRoutes: fileMiddlewareModules,
7952
+ },
7953
+ pathname,
7954
+ ),` : ""}
7684
7955
  })` : `createFarmDocsHandler(farmDocsResolvedConfig, {
7685
7956
  root: farmDocsRuntimeRoot,
7686
7957
  srcDir: ${JSON.stringify(config.srcDir)},
@@ -7696,11 +7967,11 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _211 => _211.docs, '
7696
7967
  isPathGuarded: isFarmDocsPathGuarded,
7697
7968
  basePath: ${JSON.stringify(config.basePath)},
7698
7969
  })` : "null"};
7699
- const farmDocsAPIHandler = ${_optionalChain([config, 'access', _213 => _213.docs, 'optionalAccess', _214 => _214.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded, basePath: ${JSON.stringify(config.basePath)} })` : "null"};
7970
+ const farmDocsAPIHandler = ${_optionalChain([config, 'access', _217 => _217.docs, 'optionalAccess', _218 => _218.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded, basePath: ${JSON.stringify(config.basePath)} })` : "null"};
7700
7971
 
7701
7972
  // API routes bundled at build time
7702
7973
  const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
7703
- ]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path13, methods }) => ({ path: path13, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)}, dispatch: dispatchFarmPluginAPIRequest })` : ""};
7974
+ ]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path14, methods }) => ({ path: path14, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)}, dispatch: dispatchFarmPluginAPIRequest })` : ""};
7704
7975
  // A plugin calling an app endpoint (an MCP tool, say) goes through the whole
7705
7976
  // pipeline, so the endpoint's middleware and integration guards run for it.
7706
7977
  function dispatchFarmPluginAPIRequest(request) {
@@ -7724,12 +7995,12 @@ const farmLocalAPIBasePath = ${JSON.stringify(_chunk2OF5RPVUcjs.resolveFarmAPISe
7724
7995
  // runtime request.
7725
7996
  const farmRuntimeErrorSlot = Symbol("farm.runtime.error.slot");
7726
7997
  const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
7727
- ${_optionalChain([config, 'access', _215 => _215.agent, 'optionalAccess', _216 => _216.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkLPIZMU7Dcjs.resolveFarmApiCatalogInput.call(void 0, config))};
7728
- ` : ""}${_optionalChain([config, 'access', _217 => _217.agent, 'optionalAccess', _218 => _218.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
7729
- _chunkLPIZMU7Dcjs.resolveFarmAppManifestInput.call(void 0, config, {
7998
+ ${_optionalChain([config, 'access', _219 => _219.agent, 'optionalAccess', _220 => _220.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkGQ6QOH7Tcjs.resolveFarmApiCatalogInput.call(void 0, config))};
7999
+ ` : ""}${_optionalChain([config, 'access', _221 => _221.agent, 'optionalAccess', _222 => _222.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
8000
+ _chunkGQ6QOH7Tcjs.resolveFarmAppManifestInput.call(void 0, config, {
7730
8001
  build: config.deploymentId,
7731
- packages: _chunkN5DQMOAGcjs.resolveFarmAppPackages.call(void 0, config.root),
7732
- webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkN5DQMOAGcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
8002
+ packages: _chunkDHR2WDSLcjs.resolveFarmAppPackages.call(void 0, config.root),
8003
+ webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkDHR2WDSLcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
7733
8004
  })
7734
8005
  )};
7735
8006
  ${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
@@ -7842,7 +8113,7 @@ function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, page
7842
8113
  }
7843
8114
  return '<script id="__farm_route_slots_data__" type="application/json">' +
7844
8115
  serializedRouteSlots +
7845
- '</script>' + stampFarmCspNonce('<script>' + source + '</script>');
8116
+ '</script>' + stampFarmCspNonce('<script>' + source + '</script>') + farmFormStateScript();
7846
8117
  }
7847
8118
 
7848
8119
  // The settled defer() values the bootstrap script's props refer to, as development writes them.
@@ -7983,6 +8254,7 @@ async function renderFarmElement(ReactDOMServer, element, routeKey, flushToken =
7983
8254
  typeof ReactDOMServer.renderToReadableStream === "function") {
7984
8255
  const stream = await ReactDOMServer.renderToReadableStream(element, {
7985
8256
  nonce: _resolveCurrentCspNonce(),
8257
+ formState: farmFormState(),
7986
8258
  onError(error) {
7987
8259
  // redirect()/notFound() are control flow, not render failures: the
7988
8260
  // request handler must still receive them to map the response status,
@@ -8145,6 +8417,7 @@ async function renderFarmElement(ReactDOMServer, element, routeKey, flushToken =
8145
8417
  };
8146
8418
  pipeableStream = ReactDOMServer.renderToPipeableStream(element, {
8147
8419
  nonce: _resolveCurrentCspNonce(),
8420
+ formState: farmFormState(),
8148
8421
  onShellReady() {
8149
8422
  try {
8150
8423
  pipeableStream.pipe(destination);
@@ -8260,6 +8533,12 @@ function rememberFarmSyncRender(routeKey, streamedHtml) {
8260
8533
 
8261
8534
  function renderFarmElementSync(ReactDOMServer, element, routeKey) {
8262
8535
  if (!farmReactSyncRender) return undefined;
8536
+ // renderToString takes no form state: the page a useActionState form posted to streams.
8537
+ if (farmFormState() !== undefined) return undefined;
8538
+ // renderToString takes no nonce, so the scripts React adds itself (the form replay script of a
8539
+ // form with a function action) would go out without one, and a nonce policy blocks them. A
8540
+ // response with a nonce renders with the stream, which gives them the nonce.
8541
+ if (_resolveCurrentCspNonce()) return undefined;
8263
8542
  const addsDoctype = routeKey === undefined ? undefined : farmSyncRenderRoutes.get(routeKey);
8264
8543
  if (addsDoctype === undefined) return undefined;
8265
8544
  if (typeof ReactDOMServer.renderToString !== "function") return undefined;
@@ -8673,12 +8952,8 @@ function withFarmDocsRequestCache(response, request, farmLocaleResolution, middl
8673
8952
  ) {
8674
8953
  return response;
8675
8954
  }
8676
- const headers = new Headers(response.headers);
8677
- headers.set("Cache-Control", "private, no-store");
8678
- return farmOwnedResponse(response.body, {
8679
- status: response.status,
8680
- statusText: response.statusText,
8681
- headers,
8955
+ return farmPreloadHeadersResponse(response, (headers) => {
8956
+ headers.set("Cache-Control", "private, no-store");
8682
8957
  });
8683
8958
  }
8684
8959
 
@@ -8975,7 +9250,7 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
8975
9250
  // aside for a page route that answers /mcp and for any MCP server published or
8976
9251
  // registered at runtime, such as the docs engine's.
8977
9252
  const farmDefaultMCPServer = ${JSON.stringify(
8978
- _chunkX3MHKLCOcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunkHM7AGSKUcjs.FARM_VERSION)
9253
+ _chunkX3MHKLCOcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunk22LGTSBAcjs.FARM_VERSION)
8979
9254
  )};
8980
9255
  let farmDefaultMCPRouteFree;
8981
9256
  function getFarmDefaultMCPServer() {
@@ -9136,13 +9411,18 @@ function matchRewriteRoute(pathname, locale) {
9136
9411
  return null;
9137
9412
  }
9138
9413
 
9414
+ // The URL the browser asked for, for a request a configured rewrite replaced.
9415
+ const farmRequestedUrls = new WeakMap();
9416
+
9139
9417
  function createRewrittenRequest(request, destination) {
9140
9418
  const sourceUrl = new URL(request.url);
9141
9419
  const destinationUrl = new URL(destination, sourceUrl);
9142
9420
  if (!destinationUrl.search && sourceUrl.search) {
9143
9421
  destinationUrl.search = sourceUrl.search;
9144
9422
  }
9145
- return new Request(destinationUrl, request);
9423
+ const rewritten = new Request(destinationUrl, request);
9424
+ farmRequestedUrls.set(rewritten, farmRequestedUrls.get(request) || request.url);
9425
+ return rewritten;
9146
9426
  }
9147
9427
 
9148
9428
  ${generateConfiguredResponseHeadersRuntimeSource()}
@@ -9150,10 +9430,17 @@ ${generateConfiguredResponseHeadersRuntimeSource()}
9150
9430
  // App middleware files bundled at build time (sorted by depth, root first)
9151
9431
  const fileMiddlewareModules = [${middlewareRegistrations.join(",")}
9152
9432
  ];
9153
-
9433
+ ${edgeMiddlewareFilePaths.length > 0 ? `
9434
+ // \`runtime: "edge"\` middleware runs as Vercel routing middleware in front of the pages the build
9435
+ // prerendered for it, so the build's own requests for those pages skip it. A page any other
9436
+ // middleware guards is never prerendered. Read once: Nitro's prerender worker sets the variable.
9437
+ const farmEdgeMiddlewareFiles = new Set(${JSON.stringify(edgeMiddlewareFilePaths)});
9438
+ const farmPrerendering =
9439
+ typeof process !== "undefined" && process.env?.${_chunkTKYOJ5G2cjs.FARM_PRERENDER_ENV} === "1";
9440
+ ` : ""}
9154
9441
  const farmMiddlewareRunner = ${hasMiddlewareRuntime ? `createProductionMiddlewareRunner({
9155
9442
  config: farmMiddlewareConfig,
9156
- modules: fileMiddlewareModules,
9443
+ modules: ${edgeMiddlewareFilePaths.length > 0 ? "farmPrerendering ? fileMiddlewareModules.filter((entry) => !farmEdgeMiddlewareFiles.has(entry.filePath)) : fileMiddlewareModules" : "fileMiddlewareModules"},
9157
9444
  i18n: farmI18nConfig,
9158
9445
  server: farmServerConfig,
9159
9446
  apiBasePath: farmLocalAPIBasePath,
@@ -9293,7 +9580,7 @@ function hasLocalRequestRoute(request, routePathname) {
9293
9580
  if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
9294
9581
  return true;
9295
9582
  }
9296
- ${_optionalChain([config, 'access', _219 => _219.docs, 'optionalAccess', _220 => _220.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
9583
+ ${_optionalChain([config, 'access', _223 => _223.docs, 'optionalAccess', _224 => _224.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
9297
9584
  // The docs answer below the basePath; their API stays at /api/docs, as API routes do.
9298
9585
  const docsRoutePathname = stripFarmBasePath(pathname);
9299
9586
  if (
@@ -9321,7 +9608,7 @@ function getFarmPluginRequestOptions(request) {
9321
9608
  route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
9322
9609
  };
9323
9610
  }
9324
- const isDocsAPIRequest = ${_optionalChain([config, 'access', _221 => _221.docs, 'optionalAccess', _222 => _222.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
9611
+ const isDocsAPIRequest = ${_optionalChain([config, 'access', _225 => _225.docs, 'optionalAccess', _226 => _226.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
9325
9612
  const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
9326
9613
  pathname,
9327
9614
  method: request.method,
@@ -9405,7 +9692,7 @@ ${hasInfraAnalyticsRuntime ? `
9405
9692
  // endpoints, Markdown mirrors, and docs pages have no app route pattern, so they are
9406
9693
  // labeled here; route.pattern keeps meaning the matched app route for plugins.
9407
9694
  const farmBuiltInRoutePaths = new Set(${JSON.stringify(
9408
- _chunkLPIZMU7Dcjs.listFarmBuiltInRoutePaths.call(void 0, {
9695
+ _chunkGQ6QOH7Tcjs.listFarmBuiltInRoutePaths.call(void 0, {
9409
9696
  agent: {
9410
9697
  ...config.agent,
9411
9698
  aiCatalog: servesAiCatalog,
@@ -9416,9 +9703,10 @@ const farmBuiltInRoutePaths = new Set(${JSON.stringify(
9416
9703
  openapi: openAPIReference
9417
9704
  })
9418
9705
  )});
9419
- ${_optionalChain([config, 'access', _223 => _223.docs, 'optionalAccess', _224 => _224.enabled]) ? `const farmDocsRouteLabelInput = {
9706
+ ${_optionalChain([config, 'access', _227 => _227.docs, 'optionalAccess', _228 => _228.enabled]) ? `const farmDocsRouteLabelInput = {
9420
9707
  path: normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs"),
9421
- apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _225 => _225.apiPath]) || "/api/docs")},${_optionalChain([config, 'access', _226 => _226.docs, 'access', _227 => _227.roots, 'optionalAccess', _228 => _228.length]) ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}
9708
+ apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _229 => _229.apiPath]) || "/api/docs")},${_optionalChain([config, 'access', _230 => _230.docs, 'access', _231 => _231.roots, 'optionalAccess', _232 => _232.length]) ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}${farmDocsAnalyticsPages.length ? `
9709
+ pages: new Set(${JSON.stringify(farmDocsAnalyticsPages)}),` : ""}
9422
9710
  };
9423
9711
  ` : ""}// The request's route payload, for a handler that learns what answered while it handles.
9424
9712
  const farmRouteLabelSlot = Symbol("farm.route.label.slot");
@@ -9433,11 +9721,11 @@ function labelFarmRequestOptions(options) {
9433
9721
  setFarmRouteLabel(options.route, mcpLabel);
9434
9722
  return options;
9435
9723
  }
9436
- ${_optionalChain([config, 'access', _229 => _229.docs, 'optionalAccess', _230 => _230.enabled]) ? `if (options.kind === "docs") {
9724
+ ${_optionalChain([config, 'access', _233 => _233.docs, 'optionalAccess', _234 => _234.enabled]) ? `if (options.kind === "docs") {
9437
9725
  setFarmRouteLabel(options.route, resolveFarmDocsRouteLabel(routePathname, farmDocsRouteLabelInput));
9438
9726
  return options;
9439
9727
  }` : ""}
9440
- ${_optionalChain([config, 'access', _231 => _231.md, 'optionalAccess', _232 => _232.enabled]) || hasMarkdownPages ? `const markdownLabel = resolveFarmMarkdownRouteLabel(
9728
+ ${_optionalChain([config, 'access', _235 => _235.md, 'optionalAccess', _236 => _236.enabled]) || hasMarkdownPages ? `const markdownLabel = resolveFarmMarkdownRouteLabel(
9441
9729
  routePathname,
9442
9730
  (page) => matchPageRoute(page)?.route.pattern,
9443
9731
  );
@@ -9472,7 +9760,7 @@ function getApplicableLayouts(pathname, directory) {
9472
9760
  return applicable;
9473
9761
  }
9474
9762
 
9475
- ${_optionalChain([config, 'access', _233 => _233.docs, 'optionalAccess', _234 => _234.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
9763
+ ${_optionalChain([config, 'access', _237 => _237.docs, 'optionalAccess', _238 => _238.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
9476
9764
  if (request.method === "HEAD") return response;
9477
9765
  if (response.headers.get("x-farm-docs-adapter")) return response;
9478
9766
 
@@ -9580,7 +9868,7 @@ ${_optionalChain([config, 'access', _233 => _233.docs, 'optionalAccess', _234 =>
9580
9868
 
9581
9869
  // Shells keep their own LRU so query-string variants never evict app cache entries.
9582
9870
  const pprShellCache = getFarmDataCache().pprShellCache;
9583
- const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _235 => _235.experimental, 'optionalAccess', _236 => _236.ppr]) === true)};
9871
+ const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _239 => _239.experimental, 'optionalAccess', _240 => _240.ppr]) === true)};
9584
9872
 
9585
9873
  function resolveRouteRenderingView(route) {
9586
9874
  // The same merge development uses: baked directive config under the
@@ -9714,7 +10002,7 @@ async function handleFarmRequest(request, adapterContext) {
9714
10002
  },
9715
10003
  { redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
9716
10004
  )` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
9717
- ${_optionalChain([config, 'access', _237 => _237.md, 'optionalAccess', _238 => _238.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
10005
+ ${_optionalChain([config, 'access', _241 => _241.md, 'optionalAccess', _242 => _242.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
9718
10006
  if (matchPageRoute(pathname)) {
9719
10007
  // The Link header advertises the public .md URL, like the head alternate.
9720
10008
  return applyMarkdownNegotiationHeaders(response, {
@@ -9766,6 +10054,8 @@ async function resolveFarmRequestInContext(
9766
10054
  let url = requestUrl;
9767
10055
  let pathname = url.pathname;
9768
10056
  let routePathname = getFarmRoutePathname(pathname);
10057
+ // Before middleware: a ctx.rewrite() replaces the request below.
10058
+ const farmRequestedUrl = farmRequestedUrls.get(request) || request.url;
9769
10059
 
9770
10060
  // Redirects have precedence over local routes. Configured rewrites use
9771
10061
  // after-files semantics so emitted page, API, integration, docs, image, and
@@ -9923,7 +10213,7 @@ ${hasServerRuntimeIntegrations ? `
9923
10213
  return renderFarmErrorJSONResponse();` : `
9924
10214
  if (isFarmLocalAPIPathname(pathname)) return renderFarmErrorJSONResponse();
9925
10215
  // No page was selected, so only the root error boundary and layouts apply.
9926
- const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access', _239 => _239.md, 'optionalAccess', _240 => _240.enabled]) ? `
10216
+ const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access', _243 => _243.md, 'optionalAccess', _244 => _244.enabled]) ? `
9927
10217
  // An agent asking for Markdown reads the error document as Markdown, as it
9928
10218
  // does when a page throws. The helper answers null when Markdown is off.
9929
10219
  const markdownErrorResponse = await createMarkdownMirrorResponse({
@@ -9965,7 +10255,7 @@ ${hasServerRuntimeIntegrations ? `
9965
10255
  }
9966
10256
  ` : ""}
9967
10257
 
9968
- ${_optionalChain([config, 'access', _241 => _241.docs, 'optionalAccess', _242 => _242.enabled]) ? `
10258
+ ${_optionalChain([config, 'access', _245 => _245.docs, 'optionalAccess', _246 => _246.enabled]) ? `
9969
10259
  // Docs responses are served after app middleware so route guards and
9970
10260
  // middleware headers apply to the docs engine like any other page content.
9971
10261
  // An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
@@ -9996,13 +10286,11 @@ ${hasServerRuntimeIntegrations ? `
9996
10286
  middlewareData,
9997
10287
  middlewareContext,
9998
10288
  );
9999
- const docsHeaders = new Headers(wrappedDocsResponse.headers);
10000
- docsHeaders.set("x-farm-preload-buffered", "1");
10001
- return applyProductionMiddlewareHeaders(farmOwnedResponse(wrappedDocsResponse.body, {
10002
- status: wrappedDocsResponse.status,
10003
- statusText: wrappedDocsResponse.statusText,
10004
- headers: docsHeaders,
10005
- }), middlewareHeaders);
10289
+ // In place for a page the adapter built with createHtmlResponse, so its HTML string stays.
10290
+ const bufferedDocsResponse = farmPreloadHeadersResponse(wrappedDocsResponse, (headers) => {
10291
+ headers.set("x-farm-preload-buffered", "1");
10292
+ });
10293
+ return applyProductionMiddlewareHeaders(bufferedDocsResponse, middlewareHeaders);
10006
10294
  }
10007
10295
  }
10008
10296
  ` : ""}
@@ -10057,7 +10345,7 @@ ${hasServerRuntimeIntegrations ? `
10057
10345
  }
10058
10346
  ` : ""}
10059
10347
 
10060
- ${_optionalChain([config, 'access', _243 => _243.md, 'optionalAccess', _244 => _244.enabled]) ? `
10348
+ ${_optionalChain([config, 'access', _247 => _247.md, 'optionalAccess', _248 => _248.enabled]) ? `
10061
10349
  if (farmMarkdownConfig?.enabled) {
10062
10350
  const markdownResponse = await createMarkdownMirrorResponse({
10063
10351
  // The mirror helper only reads metadata and creates its own GET request.
@@ -10160,11 +10448,11 @@ ${hasServerRuntimeIntegrations ? `
10160
10448
  return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
10161
10449
  }
10162
10450
  ` : ""}
10163
- ${_optionalChain([config, 'access', _245 => _245.agent, 'optionalAccess', _246 => _246.manifest]) !== false ? `
10451
+ ${_optionalChain([config, 'access', _249 => _249.agent, 'optionalAccess', _250 => _250.manifest]) !== false ? `
10164
10452
  // agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
10165
10453
  // public manifest, the same document for every request.
10166
10454
  if (
10167
- [${JSON.stringify(_chunkLPIZMU7Dcjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkLPIZMU7Dcjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
10455
+ [${JSON.stringify(_chunkGQ6QOH7Tcjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkGQ6QOH7Tcjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
10168
10456
  normalizeRuntimePath(routePathname),
10169
10457
  )
10170
10458
  ) {
@@ -10174,9 +10462,9 @@ ${hasServerRuntimeIntegrations ? `
10174
10462
  );
10175
10463
  }
10176
10464
  ` : ""}
10177
- ${_optionalChain([config, 'access', _247 => _247.agent, 'optionalAccess', _248 => _248.apiCatalog]) ? `
10465
+ ${_optionalChain([config, 'access', _251 => _251.agent, 'optionalAccess', _252 => _252.apiCatalog]) ? `
10178
10466
  // agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
10179
- if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkLPIZMU7Dcjs.FARM_API_CATALOG_PATH)}) {
10467
+ if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkGQ6QOH7Tcjs.FARM_API_CATALOG_PATH)}) {
10180
10468
  return applyProductionMiddlewareHeaders(
10181
10469
  createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
10182
10470
  middlewareHeaders,
@@ -10201,11 +10489,11 @@ ${hasServerRuntimeIntegrations ? `
10201
10489
  );
10202
10490
  }
10203
10491
  ` : ""}
10204
- ${_optionalChain([config, 'access', _249 => _249.agent, 'optionalAccess', _250 => _250.llmsTxt, 'optionalAccess', _251 => _251.enabled]) ? `
10492
+ ${_optionalChain([config, 'access', _253 => _253.agent, 'optionalAccess', _254 => _254.llmsTxt, 'optionalAccess', _255 => _255.enabled]) ? `
10205
10493
  // agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
10206
10494
  const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
10207
10495
  ? "llms"
10208
- : ${_optionalChain([config, 'access', _252 => _252.agent, 'optionalAccess', _253 => _253.llmsTxt, 'optionalAccess', _254 => _254.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
10496
+ : ${_optionalChain([config, 'access', _256 => _256.agent, 'optionalAccess', _257 => _257.llmsTxt, 'optionalAccess', _258 => _258.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
10209
10497
  if (farmGeneratedLlmsKind) {
10210
10498
  const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
10211
10499
  // Renders are shared per origin the request reached, which is where pages are read.
@@ -10241,7 +10529,7 @@ ${hasServerRuntimeIntegrations ? `
10241
10529
  }
10242
10530
  ` : ""}
10243
10531
 
10244
- ${_optionalChain([config, 'access', _255 => _255.docs, 'optionalAccess', _256 => _256.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
10532
+ ${_optionalChain([config, 'access', _259 => _259.docs, 'optionalAccess', _260 => _260.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
10245
10533
  const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
10246
10534
  if (docsAPIResponse) {
10247
10535
  return applyProductionMiddlewareHeaders(
@@ -10266,7 +10554,7 @@ ${hasServerRuntimeIntegrations ? `
10266
10554
  if (matchedRoute && request.method === "POST") {
10267
10555
  const actionResponse = await _runWithMiddlewareData(middlewareData || {}, () =>
10268
10556
  _runWithMiddlewareContext(middlewareContext || {}, () =>
10269
- handleFarmFormActionRequest(request, farmFormActionsConfig)
10557
+ handleFarmFormActionRequest(request, farmFormActionsConfig, farmRequestedUrl)
10270
10558
  )
10271
10559
  );
10272
10560
  if (actionResponse) return applyProductionMiddlewareHeaders(actionResponse, middlewareHeaders);
@@ -10831,7 +11119,7 @@ ${hasServerRuntimeIntegrations ? `
10831
11119
  );
10832
11120
  }
10833
11121
  }
10834
- ${_optionalChain([config, 'access', _257 => _257.md, 'optionalAccess', _258 => _258.enabled]) ? `
11122
+ ${_optionalChain([config, 'access', _261 => _261.md, 'optionalAccess', _262 => _262.enabled]) ? `
10835
11123
  // Advertise the Markdown mirror in the head as well as the Link header,
10836
11124
  // using the public path the .md request will be resolved against.
10837
11125
  mergedMetadata = addMetadataMarkdownAlternate(
@@ -10850,7 +11138,7 @@ ${hasServerRuntimeIntegrations ? `
10850
11138
  emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "request-read" });
10851
11139
  }
10852
11140
 
10853
- const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _259 => _259.agent, 'optionalAccess', _260 => _260.jsonLd]), () => ( false)))} });
11141
+ const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _263 => _263.agent, 'optionalAccess', _264 => _264.jsonLd]), () => ( false)))} });
10854
11142
  const title = renderedMetadata.title;
10855
11143
  const metaTags = renderedMetadata.tags;
10856
11144
  const hasFavicon = renderedMetadata.hasFavicon;
@@ -11610,11 +11898,11 @@ function createFarmRuntimeHookErrorResponse(request, error) {
11610
11898
  export async function fetch(request, context) {${imageRuntime === "none" ? "" : `
11611
11899
  // The image optimizer's fetch of a local source is not a loopback visitor.
11612
11900
  context = _withFarmImageSourceClientAddress(request, context);`}
11613
- ${_optionalChain([config, 'access', _261 => _261.agent, 'optionalAccess', _262 => _262.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
11901
+ ${_optionalChain([config, 'access', _265 => _265.agent, 'optionalAccess', _266 => _266.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
11614
11902
  basePath: farmLocalAPIBasePath,
11615
11903
  dispatch: async (localRequest) =>
11616
11904
  (await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
11617
- }, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _263 => _263.agent, 'optionalAccess', _264 => _264.noindexPreviews]) ? `
11905
+ }, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _267 => _267.agent, 'optionalAccess', _268 => _268.noindexPreviews]) ? `
11618
11906
  // Keep every response of a preview deployment out of search indexes.
11619
11907
  return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
11620
11908
  }
@@ -11798,6 +12086,16 @@ function getEffectiveRouteRule(config, pathname) {
11798
12086
  function getManifestPageEntry(manifest, pathname) {
11799
12087
  return manifest.routes.filter((entry) => entry.kind === "page" && middlewarePatternMatches(entry.pattern, pathname)).sort((left, right) => _chunkYTVSWXEZcjs.compareRoutePatternSpecificity.call(void 0, left.pattern, right.pattern))[0];
11800
12088
  }
12089
+ function withFarmEdgeGuardedPrerenderHeaders(headers, edgeGuarded) {
12090
+ if (!edgeGuarded) return headers;
12091
+ const cacheHeaders = /* @__PURE__ */ new Set(["cache-control", ..._chunkUKZ6AWKZcjs.CDN_CACHE_CONTROL_HEADERS]);
12092
+ return {
12093
+ ...Object.fromEntries(
12094
+ Object.entries(headers).filter(([name]) => !cacheHeaders.has(name.toLowerCase()))
12095
+ ),
12096
+ "cache-control": "private, no-store"
12097
+ };
12098
+ }
11801
12099
  function getPhysicalPrerenderBypassReason(options) {
11802
12100
  const {
11803
12101
  config,
@@ -11816,11 +12114,11 @@ function getPhysicalPrerenderBypassReason(options) {
11816
12114
  }
11817
12115
  if (_chunkUPOYKX4Scjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
11818
12116
  if (_chunkUPOYKX4Scjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
11819
- if (_chunk556H7JCEcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
12117
+ if (_chunk6GQJVY4Ecjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
11820
12118
  if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
11821
12119
  const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
11822
- if (_optionalChain([manifestEntry, 'optionalAccess', _265 => _265.rendering]) === "dynamic") return "dynamic runtime manifest";
11823
- if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _266 => _266.regions, 'optionalAccess', _267 => _267.length])) || manifestEntry.maxDuration !== void 0)) {
12120
+ if (_optionalChain([manifestEntry, 'optionalAccess', _269 => _269.rendering]) === "dynamic") return "dynamic runtime manifest";
12121
+ if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _270 => _270.regions, 'optionalAccess', _271 => _271.length])) || manifestEntry.maxDuration !== void 0)) {
11824
12122
  return "route runtime controls";
11825
12123
  }
11826
12124
  const routeRule = getEffectiveRouteRule(config, pathname);
@@ -11833,20 +12131,32 @@ function getPhysicalPrerenderBypassReason(options) {
11833
12131
  return void 0;
11834
12132
  }
11835
12133
  async function getFarmDocsPrerenderPages(config, root, preset) {
11836
- if (!_optionalChain([config, 'access', _268 => _268.docs, 'optionalAccess', _269 => _269.enabled]) || !config.docs.prerender) return [];
11837
- if (!_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) || !_chunkDCXSIEFEcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
11838
- _chunkQMNWKQL4cjs.logger.warn(
11839
- "docs.prerender needs a docs adapter such as @farming-labs/farmjs; Farm's built-in docs renderer keeps rendering docs pages on request."
12134
+ if (!_optionalChain([config, 'access', _272 => _272.docs, 'optionalAccess', _273 => _273.enabled]) || !config.docs.prerender) return [];
12135
+ if (_chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge") {
12136
+ _chunkQMNWKQL4cjs.logger.info(
12137
+ `\u21AA Keeping docs pages in the edge docs snapshot: docs.prerender writes static files on Node and serverless targets, not "${preset}".`
11840
12138
  );
11841
12139
  return [];
11842
12140
  }
11843
- if (_chunkF43OG25Pcjs.getFarmPresetRuntime.call(void 0, preset) === "edge") {
11844
- _chunkQMNWKQL4cjs.logger.info(
11845
- `\u21AA Keeping docs pages in the edge docs snapshot: docs.prerender writes static files on Node and serverless targets, not "${preset}".`
12141
+ if (!_chunk4JRAMCUPcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
12142
+ const { pages: pages2, originDependent } = _chunkFVYBEMODcjs.listFarmDocsBuiltInPrerenderPages.call(void 0, config.docs, {
12143
+ root,
12144
+ srcDir: config.srcDir
12145
+ });
12146
+ if (originDependent.length > 0) {
12147
+ _chunkQMNWKQL4cjs.logger.info(
12148
+ `\u21AA Keeping ${originDependent.length} docs page(s) rendering on request: their social image metadata is an absolute URL built from the request's origin. Set docs.socialImage.baseUrl to prerender them.`
12149
+ );
12150
+ }
12151
+ return pages2;
12152
+ }
12153
+ if (!_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer)) {
12154
+ _chunkQMNWKQL4cjs.logger.warn(
12155
+ `The docs adapter ${JSON.stringify(config.docs.adapter.id)} renders with React; docs.prerender keeps its pages rendering on request with the "${config.renderer.name}" renderer.`
11846
12156
  );
11847
12157
  return [];
11848
12158
  }
11849
- const pages = await _chunkDCXSIEFEcjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
12159
+ const pages = await _chunk4JRAMCUPcjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
11850
12160
  if (!pages) {
11851
12161
  _chunkQMNWKQL4cjs.logger.warn(
11852
12162
  `The docs adapter ${JSON.stringify(config.docs.adapter.id)} does not list its pages for prerendering; upgrade it to prerender docs pages. They render on request until then.`
@@ -11855,11 +12165,28 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
11855
12165
  }
11856
12166
  return pages;
11857
12167
  }
12168
+ async function listFarmDocsAnalyticsPages(config, root, preset) {
12169
+ if (!_optionalChain([config, 'access', _274 => _274.docs, 'optionalAccess', _275 => _275.enabled]) || config.analytics === false || _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) !== "nodejs") {
12170
+ return [];
12171
+ }
12172
+ try {
12173
+ return await _chunk4JRAMCUPcjs.listFarmDocsPagePaths.call(void 0, config.docs, {
12174
+ root,
12175
+ srcDir: config.srcDir,
12176
+ adapter: _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _chunk4JRAMCUPcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)
12177
+ });
12178
+ } catch (error) {
12179
+ _chunkQMNWKQL4cjs.logger.warn(
12180
+ `Farm Infra analytics reports docs pages by the docs route, not each page's path: listing them failed (${error instanceof Error ? error.message : String(error)}).`
12181
+ );
12182
+ return [];
12183
+ }
12184
+ }
11858
12185
  function hasFarmNitroCacheRouteRule(routeRules) {
11859
12186
  return Object.values(routeRules || {}).some((rule) => {
11860
- const swr = _optionalChain([rule, 'optionalAccess', _270 => _270.swr]);
11861
- const cache = _optionalChain([rule, 'optionalAccess', _271 => _271.cache]);
11862
- const headers = _optionalChain([rule, 'optionalAccess', _272 => _272.headers]);
12187
+ const swr = _optionalChain([rule, 'optionalAccess', _276 => _276.swr]);
12188
+ const cache = _optionalChain([rule, 'optionalAccess', _277 => _277.cache]);
12189
+ const headers = _optionalChain([rule, 'optionalAccess', _278 => _278.headers]);
11863
12190
  return swr !== void 0 && swr !== false || cache !== void 0 && cache !== false || !!headers && typeof headers === "object" && Object.keys(headers).length > 0;
11864
12191
  });
11865
12192
  }
@@ -11872,10 +12199,10 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
11872
12199
  const nitroBuilder = nitroBuilderResult.value;
11873
12200
  const isVercel = preset === "vercel";
11874
12201
  const isCloudflareWorker = preset === "cloudflare-module";
11875
- const outputDir = _chunk556H7JCEcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
12202
+ const outputDir = _chunk6GQJVY4Ecjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
11876
12203
  const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
11877
12204
  const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
11878
- const imageRuntime = _chunkN5DQMOAGcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
12205
+ const imageRuntime = _chunkDHR2WDSLcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
11879
12206
  const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
11880
12207
  (image) => image.sourceType === "module"
11881
12208
  );
@@ -11889,15 +12216,18 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
11889
12216
  ...imageRuntime === "node" ? ["sharp"] : [],
11890
12217
  ...useExternalMetadataImageRuntime ? ["@vercel/og"] : []
11891
12218
  ]);
11892
- const isPrebuiltSSRCandidate = preset === "node-server" && [...ssrExternalPackages].every((packageName) => copiedRuntimePackages.has(packageName));
12219
+ const ssrExternalsArePackaged = [...ssrExternalPackages].every(
12220
+ (packageName) => copiedRuntimePackages.has(packageName)
12221
+ );
12222
+ const isPrebuiltSSRCandidate = preset === "node-server" && ssrExternalsArePackaged;
11893
12223
  _chunkQMNWKQL4cjs.logger.info(`\u{1F4E6} Nitro output directory: ${outputDir}`);
11894
12224
  _chunkQMNWKQL4cjs.logger.info(`\u{1F4E6} SSR entry file: ${ssrEntryFile}`);
11895
12225
  _chunkQMNWKQL4cjs.logger.info(`\u{1F4E6} Preset: ${preset}`);
11896
12226
  const ssgCollectionPromise = routeManager.collectSSGPages();
11897
- const middlewareRoutesPromise = discoverMiddlewareRoutes(_chunk5Y2P454Ocjs.getFarmAppDirectories.call(void 0, config));
12227
+ const middlewareRoutesPromise = discoverMiddlewareRoutes(_chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, config));
11898
12228
  const configuredResponseRoutesPromise = Promise.all([config.redirects(), config.rewrites()]);
11899
12229
  const docsPrerenderPagesPromise = getFarmDocsPrerenderPages(config, root, preset);
11900
- const farmWorkflows = await _chunkKCY52OUQcjs.prepareFarmWorkflowsForNitro.call(void 0, config);
12230
+ const farmWorkflows = await _chunkFSODPZRTcjs.prepareFarmWorkflowsForNitro.call(void 0, config);
11901
12231
  const farmCron = await _chunkYAEN3L2Fcjs.prepareFarmCronForNitro.call(void 0, config);
11902
12232
  const [
11903
12233
  { ssg: ssgPages },
@@ -11923,12 +12253,21 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
11923
12253
  config: await readMiddlewareFileConfig(route.filePath)
11924
12254
  }))
11925
12255
  ) : middlewareRoutes;
12256
+ const edgeMiddlewareRoutes = farmTargetRunsEdgeMiddleware(preset) ? middlewareRoutesWithConfig.filter(isFarmEdgeMiddlewareRoute) : [];
12257
+ const serverMiddlewareRoutes = edgeMiddlewareRoutes.length > 0 ? middlewareRoutesWithConfig.filter((route) => !isFarmEdgeMiddlewareRoute(route)) : middlewareRoutesWithConfig;
12258
+ const edgeGuardedPrerenderRoutes = [];
12259
+ const addPrerenderRoute = (pathname) => {
12260
+ prerenderRoutes.push(pathname);
12261
+ if (_chunkUPOYKX4Scjs.appMiddlewareMayHandlePath.call(void 0, edgeMiddlewareRoutes, pathname)) {
12262
+ edgeGuardedPrerenderRoutes.push(pathname);
12263
+ }
12264
+ };
11926
12265
  for (const page of ssgPages) {
11927
12266
  if (page.revalidate !== void 0) continue;
11928
12267
  if (prerenderRoutes.includes(page.urlPath)) continue;
11929
12268
  const reason = getPhysicalPrerenderBypassReason({
11930
12269
  config,
11931
- middlewareRoutes: middlewareRoutesWithConfig,
12270
+ middlewareRoutes: serverMiddlewareRoutes,
11932
12271
  routeRuntimeManifest,
11933
12272
  redirectSources,
11934
12273
  rewriteSources,
@@ -11938,7 +12277,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
11938
12277
  skippedPrerenderRoutes.push({ pathname: page.urlPath, reason });
11939
12278
  continue;
11940
12279
  }
11941
- prerenderRoutes.push(page.urlPath);
12280
+ addPrerenderRoute(page.urlPath);
11942
12281
  }
11943
12282
  const docsRouteRuntimeManifest = {
11944
12283
  ...routeRuntimeManifest,
@@ -11948,7 +12287,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
11948
12287
  if (prerenderRoutes.includes(pathname)) continue;
11949
12288
  const reason = getPhysicalPrerenderBypassReason({
11950
12289
  config,
11951
- middlewareRoutes: middlewareRoutesWithConfig,
12290
+ middlewareRoutes: serverMiddlewareRoutes,
11952
12291
  routeRuntimeManifest: docsRouteRuntimeManifest,
11953
12292
  redirectSources,
11954
12293
  rewriteSources,
@@ -11958,7 +12297,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
11958
12297
  skippedPrerenderRoutes.push({ pathname, reason });
11959
12298
  continue;
11960
12299
  }
11961
- prerenderRoutes.push(pathname);
12300
+ addPrerenderRoute(pathname);
11962
12301
  }
11963
12302
  for (const skipped of skippedPrerenderRoutes) {
11964
12303
  _chunkQMNWKQL4cjs.logger.info(`\u21AA Keeping SSG route ${skipped.pathname} server-handled (${skipped.reason})`);
@@ -11997,7 +12336,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
11997
12336
  webEntry: clientJsSrc,
11998
12337
  webBoot: clientBootSrc,
11999
12338
  stylesheet: clientCssHref,
12000
- webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess', _273 => _273.files]), () => ( []))
12339
+ webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess', _279 => _279.files]), () => ( []))
12001
12340
  })
12002
12341
  ) : null;
12003
12342
  for (const output of Object.values(ssrBundle)) {
@@ -12164,12 +12503,19 @@ function resolveTrustedLocalOrigin(event, request) {
12164
12503
  : requestURL.hostname
12165
12504
  const isLoopback = (value) =>
12166
12505
  value === 'localhost' || value === '::1' || /^127(?:[.][0-9]{1,3}){3}$/.test(value)
12167
- return requestURL.protocol === protocol &&
12506
+ if (
12507
+ requestURL.protocol === protocol &&
12168
12508
  requestPort === port &&
12169
12509
  isLoopback(address) &&
12170
12510
  isLoopback(normalizedRequestHostname)
12171
- ? requestURL.origin
12172
- : undefined
12511
+ ) {
12512
+ return requestURL.origin
12513
+ }
12514
+ // Any other Host is the client's to choose, so it must not decide where a local image is
12515
+ // fetched from: the optimizer reads local sources from this server's own socket address, as the
12516
+ // development server does. A TLS socket's certificate names the public host, not this address,
12517
+ // so there the request origin still stands in.
12518
+ return socket.encrypted ? undefined : origin
12173
12519
  }
12174
12520
 
12175
12521
  // Export the event handler for Nitro
@@ -12244,19 +12590,19 @@ function toFarmNodeResponse(request, response) {
12244
12590
  );
12245
12591
  }
12246
12592
  await fs4.writeFile(
12247
- _path2.default.join(ssrOutputDir, _chunk4IHMHFQBcjs.FARM_DESKTOP_ENV_MODULE_FILE),
12248
- _chunk4IHMHFQBcjs.FARM_DESKTOP_ENV_MODULE_SOURCE
12593
+ _path2.default.join(ssrOutputDir, _chunkNG2EZ6QScjs.FARM_DESKTOP_ENV_MODULE_FILE),
12594
+ _chunkNG2EZ6QScjs.FARM_DESKTOP_ENV_MODULE_SOURCE
12249
12595
  );
12250
12596
  }
12251
12597
  const farmNodeServerEntryPath = preset === "node-server" ? _path2.default.join(ssrOutputDir, "farm-node-server-entry.mjs") : null;
12252
12598
  if (farmNodeServerEntryPath && nodeAdapterModule) {
12253
12599
  await fs4.writeFile(
12254
- _path2.default.join(ssrOutputDir, _chunk4IHMHFQBcjs.FARM_NODE_ENV_MODULE_FILE),
12255
- _chunk4IHMHFQBcjs.FARM_NODE_ENV_MODULE_SOURCE
12600
+ _path2.default.join(ssrOutputDir, _chunkNG2EZ6QScjs.FARM_NODE_ENV_MODULE_FILE),
12601
+ _chunkNG2EZ6QScjs.FARM_NODE_ENV_MODULE_SOURCE
12256
12602
  );
12257
12603
  await fs4.writeFile(
12258
12604
  farmNodeServerEntryPath,
12259
- _chunk4IHMHFQBcjs.createFarmNodeServerEntry.call(void 0, {
12605
+ _chunkNG2EZ6QScjs.createFarmNodeServerEntry.call(void 0, {
12260
12606
  nitroEntryFile: _path2.default.basename(nitroEntryPath),
12261
12607
  nodeAdapterModule,
12262
12608
  server: config.server,
@@ -12269,7 +12615,7 @@ function toFarmNodeResponse(request, response) {
12269
12615
  if (farmBunServerEntryPath) {
12270
12616
  await fs4.writeFile(
12271
12617
  farmBunServerEntryPath,
12272
- _chunk4IHMHFQBcjs.createFarmBunServerEntry.call(void 0, {
12618
+ _chunkNG2EZ6QScjs.createFarmBunServerEntry.call(void 0, {
12273
12619
  nitroEntryFile: _path2.default.basename(nitroEntryPath),
12274
12620
  bunAdapterModule: resolveNitroRuntimeDependency(root, "srvx/bun"),
12275
12621
  server: config.server,
@@ -12303,19 +12649,30 @@ function toFarmNodeResponse(request, response) {
12303
12649
  ssrOutputDir,
12304
12650
  ssrEntryFile
12305
12651
  );
12306
- const configuredNitroRouteRules = shouldBuildFarmMobileClient(config) ? varyFarmNitroCacheRulesByShell(_chunk22IWL4YDcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules)) : _chunk22IWL4YDcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules);
12652
+ const configuredNitroRouteRules = _chunkOCNV4CI2cjs.nitroRouteRulesBelowBasePath.call(void 0,
12653
+ shouldBuildFarmMobileClient(config) ? varyFarmNitroCacheRulesByShell(_chunkOCNV4CI2cjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules)) : _chunkOCNV4CI2cjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules),
12654
+ config.basePath,
12655
+ _chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api)
12656
+ );
12657
+ const toPrerenderPublicPath = (route) => _chunk23VJEGKCcjs.normalizeFarmTrailingSlashPathname.call(void 0,
12658
+ _chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, route, config.basePath),
12659
+ config.trailingSlash === true
12660
+ );
12307
12661
  const prerenderNitroRouteRules = Object.fromEntries(
12308
12662
  prerenderRoutes.map((route) => {
12309
12663
  const configuredRule = configuredNitroRouteRules[route] || {};
12310
12664
  return [
12311
- route,
12665
+ toPrerenderPublicPath(route),
12312
12666
  {
12313
12667
  ...configuredRule,
12314
12668
  prerender: true,
12315
- headers: {
12316
- ...getPrerenderRouteHeaders(route, configuredHeaderRoutes),
12317
- ...configuredRule.headers
12318
- }
12669
+ headers: withFarmEdgeGuardedPrerenderHeaders(
12670
+ {
12671
+ ...getPrerenderRouteHeaders(route, configuredHeaderRoutes),
12672
+ ...configuredRule.headers
12673
+ },
12674
+ edgeGuardedPrerenderRoutes.includes(route)
12675
+ )
12319
12676
  }
12320
12677
  ];
12321
12678
  })
@@ -12362,7 +12719,7 @@ function toFarmNodeResponse(request, response) {
12362
12719
  // answered independently, as by the production server, so keeping several
12363
12720
  // in flight overlaps the worker's rendering with this thread's per-route work.
12364
12721
  concurrency: Math.min(_os2.default.availableParallelism(), 8),
12365
- routes: prerenderRoutes
12722
+ routes: prerenderRoutes.map(toPrerenderPublicPath)
12366
12723
  }
12367
12724
  } : {},
12368
12725
  experimental: {
@@ -12413,7 +12770,7 @@ function toFarmNodeResponse(request, response) {
12413
12770
  // Workers bundle React here rather than loading it from node_modules.
12414
12771
  // Unenv rewrites `process` before Nitro's own replacements run, so
12415
12772
  // React's development builds would otherwise ship next to production.
12416
- ...isCloudflareWorker ? [createReactProductionModePlugin()] : []
12773
+ ...isCloudflareWorker ? [_chunkNG2EZ6QScjs.createReactProductionModePlugin.call(void 0, )] : []
12417
12774
  ]
12418
12775
  },
12419
12776
  // Keep the public Nitro boolean intact for build hooks. Farm replaces
@@ -12439,21 +12796,23 @@ function toFarmNodeResponse(request, response) {
12439
12796
  snapshotSSRRebundleOptions(nitroConfig)
12440
12797
  );
12441
12798
  const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
12442
- const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _274 => _274.rollupConfig, 'optionalAccess', _275 => _275.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _276 => _276.rollupConfig, 'optionalAccess', _277 => _277.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _278 => _278.output, 'optionalAccess', _279 => _279.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
12443
- _optionalChain([nitroConfig, 'access', _280 => _280.handlers, 'optionalAccess', _281 => _281.some, 'call', _282 => _282(
12444
- (handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _283 => _283.handler]) || "") === nitroEntryPath
12799
+ const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _280 => _280.rollupConfig, 'optionalAccess', _281 => _281.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _282 => _282.rollupConfig, 'optionalAccess', _283 => _283.plugins])) && customRollupKeys.length === 0 && Boolean(
12800
+ _optionalChain([nitroConfig, 'access', _284 => _284.handlers, 'optionalAccess', _285 => _285.some, 'call', _286 => _286(
12801
+ (handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _287 => _287.handler]) || "") === nitroEntryPath
12445
12802
  )])
12446
12803
  );
12804
+ const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _288 => _288.output, 'optionalAccess', _289 => _289.serverDir]) || "") === _path2.default.resolve(expectedServerDir);
12805
+ const prerenderReusesPrebuiltSSR = prerenderRoutes.length > 0 && ssrExternalsArePackaged && nitroBuildIsFarms;
12447
12806
  const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
12448
12807
  if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
12449
12808
  const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
12450
12809
  const shouldMinify = nitroConfig.minify !== false;
12451
- const keepServerNames = !(_optionalChain([config, 'access', _284 => _284.docs, 'optionalAccess', _285 => _285.enabled]) && _optionalChain([config, 'access', _286 => _286.docs, 'access', _287 => _287.adapter, 'optionalAccess', _288 => _288.server]));
12810
+ const keepServerNames = !(_optionalChain([config, 'access', _290 => _290.docs, 'optionalAccess', _291 => _291.enabled]) && _optionalChain([config, 'access', _292 => _292.docs, 'access', _293 => _293.adapter, 'optionalAccess', _294 => _294.server]));
12452
12811
  const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
12453
12812
  const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
12454
12813
  const ssrRollupPlugin = canReusePrebuiltSSR ? prebuiltSSRPlugin : createServerReadSSRAssetsPlugin(ssrBundle, ssrOutputDir);
12455
12814
  if (ssrRollupPlugin) {
12456
- const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _289 => _289.rollupConfig, 'optionalAccess', _290 => _290.plugins]);
12815
+ const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _295 => _295.rollupConfig, 'optionalAccess', _296 => _296.plugins]);
12457
12816
  nitroConfig.rollupConfig = {
12458
12817
  ...nitroConfig.rollupConfig,
12459
12818
  plugins: [
@@ -12480,9 +12839,9 @@ function toFarmNodeResponse(request, response) {
12480
12839
  const orderOf = (route) => _nullishCoalesce(prerenderOrder.get(route), () => ( Number.MAX_SAFE_INTEGER));
12481
12840
  prerenderedRoutes.sort((a, b) => orderOf(a.route) - orderOf(b.route));
12482
12841
  });
12483
- if (_optionalChain([config, 'access', _291 => _291.md, 'optionalAccess', _292 => _292.enabled])) {
12842
+ if (_optionalChain([config, 'access', _297 => _297.md, 'optionalAccess', _298 => _298.enabled])) {
12484
12843
  nitroInstance.hooks.hook("prerender:generate", (route) => {
12485
- if (!route.contents || !_optionalChain([route, 'access', _293 => _293.contentType, 'optionalAccess', _294 => _294.toLowerCase, 'call', _295 => _295(), 'access', _296 => _296.includes, 'call', _297 => _297("html")])) return;
12844
+ if (!route.contents || !_optionalChain([route, 'access', _299 => _299.contentType, 'optionalAccess', _300 => _300.toLowerCase, 'call', _301 => _301(), 'access', _302 => _302.includes, 'call', _303 => _303("html")])) return;
12486
12845
  const alternatePath = _chunkFT6KJHS3cjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route, {
12487
12846
  routePathname: (pathname) => routeManager.toRoutePathname(pathname)
12488
12847
  });
@@ -12505,7 +12864,7 @@ function toFarmNodeResponse(request, response) {
12505
12864
  }
12506
12865
  if (config.security.csp && config.security.csp.nonce) {
12507
12866
  nitroInstance.hooks.hook("prerender:generate", async (route) => {
12508
- if (!route.contents || !_optionalChain([route, 'access', _298 => _298.contentType, 'optionalAccess', _299 => _299.toLowerCase, 'call', _300 => _300(), 'access', _301 => _301.includes, 'call', _302 => _302("html")])) return;
12867
+ if (!route.contents || !_optionalChain([route, 'access', _304 => _304.contentType, 'optionalAccess', _305 => _305.toLowerCase, 'call', _306 => _306(), 'access', _307 => _307.includes, 'call', _308 => _308("html")])) return;
12509
12868
  const staticCsp = await _chunk6JHZPB52cjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
12510
12869
  if (!staticCsp) return;
12511
12870
  route.contents = staticCsp.html;
@@ -12538,7 +12897,24 @@ function toFarmNodeResponse(request, response) {
12538
12897
  });
12539
12898
  await nitroBuilder.prepare(nitroInstance);
12540
12899
  await nitroBuilder.copyPublicAssets(nitroInstance);
12541
- if (prerenderRoutes.length > 0 && canReusePrebuiltSSR) {
12900
+ if (prerenderReusesPrebuiltSSR && !canReusePrebuiltSSR) {
12901
+ nitroInstance.hooks.hook("prerender:config", (prerendererConfig) => {
12902
+ const configuredPlugins = _optionalChain([prerendererConfig, 'access', _309 => _309.rollupConfig, 'optionalAccess', _310 => _310.plugins]);
12903
+ const plugins = Array.isArray(configuredPlugins) ? configuredPlugins : configuredPlugins ? [configuredPlugins] : [];
12904
+ prerendererConfig.rollupConfig = {
12905
+ ...prerendererConfig.rollupConfig,
12906
+ plugins: [...plugins.filter((plugin) => plugin !== ssrRollupPlugin), prebuiltSSRPlugin]
12907
+ };
12908
+ prerendererConfig.output = {
12909
+ ...prerendererConfig.output,
12910
+ serverDir: _path2.default.join(
12911
+ _nullishCoalesce(prerendererConfig.buildDir, () => ( _path2.default.join(root, distDir, ".nitro"))),
12912
+ "prerender"
12913
+ )
12914
+ };
12915
+ });
12916
+ }
12917
+ if (prerenderReusesPrebuiltSSR) {
12542
12918
  nitroInstance.hooks.hook("prerender:init", (prerenderer) => {
12543
12919
  if (useRolldownBuilder) {
12544
12920
  prerenderer.hooks.hook("rollup:before", (_nitro, rollupConfig) => {
@@ -12548,7 +12924,7 @@ function toFarmNodeResponse(request, response) {
12548
12924
  });
12549
12925
  }
12550
12926
  prerenderer.hooks.hook("compiled", async () => {
12551
- const prerenderServerDir = _path2.default.join(outputDir, "server");
12927
+ const prerenderServerDir = prerenderer.options.output.serverDir;
12552
12928
  await copyPrebuiltSSRBundle(
12553
12929
  ssrBundle,
12554
12930
  _path2.default.join(prerenderServerDir, FARM_SSR_OUTPUT_DIR),
@@ -12580,13 +12956,13 @@ function toFarmNodeResponse(request, response) {
12580
12956
  }
12581
12957
  if (prerenderRoutes.length > 0) {
12582
12958
  _chunkQMNWKQL4cjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
12583
- const previousPrerender = process.env[_chunk6R53ZWX2cjs.FARM_PRERENDER_ENV];
12584
- process.env[_chunk6R53ZWX2cjs.FARM_PRERENDER_ENV] = "1";
12959
+ const previousPrerender = process.env[_chunkTKYOJ5G2cjs.FARM_PRERENDER_ENV];
12960
+ process.env[_chunkTKYOJ5G2cjs.FARM_PRERENDER_ENV] = "1";
12585
12961
  try {
12586
12962
  await nitroBuilder.prerender(nitroInstance);
12587
12963
  } finally {
12588
- if (previousPrerender === void 0) delete process.env[_chunk6R53ZWX2cjs.FARM_PRERENDER_ENV];
12589
- else process.env[_chunk6R53ZWX2cjs.FARM_PRERENDER_ENV] = previousPrerender;
12964
+ if (previousPrerender === void 0) delete process.env[_chunkTKYOJ5G2cjs.FARM_PRERENDER_ENV];
12965
+ else process.env[_chunkTKYOJ5G2cjs.FARM_PRERENDER_ENV] = previousPrerender;
12590
12966
  }
12591
12967
  }
12592
12968
  const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs4, preset) : Promise.resolve(null);
@@ -12665,7 +13041,13 @@ function toFarmNodeResponse(request, response) {
12665
13041
  config,
12666
13042
  farmWorkflows,
12667
13043
  routeRuntimeManifest,
12668
- farmCron.provider === "host" ? farmCron.jobs : []
13044
+ farmCron.provider === "host" ? farmCron.jobs : [],
13045
+ {
13046
+ buildDir: _path2.default.join(root, distDir),
13047
+ middlewareRoutes: edgeMiddlewareRoutes,
13048
+ guardedPages: edgeGuardedPrerenderRoutes
13049
+ },
13050
+ prerenderRoutes.map(toPrerenderPublicPath)
12669
13051
  );
12670
13052
  }
12671
13053
  _chunkQMNWKQL4cjs.logger.success(`\u2705 Nitro build completed with preset: ${preset}`);
@@ -12683,19 +13065,6 @@ function resolveFarmNitroOutputConfig(preset, outputDir) {
12683
13065
  } : {}
12684
13066
  };
12685
13067
  }
12686
- var CLOUDFLARE_POPULATE_PROCESS_ENV_FLAG = "nodejs_compat_populate_process_env";
12687
- var CLOUDFLARE_DO_NOT_POPULATE_PROCESS_ENV_FLAG = "nodejs_compat_do_not_populate_process_env";
12688
- var CLOUDFLARE_POPULATE_PROCESS_ENV_DATE = "2025-04-01";
12689
- function resolveCloudflareProcessEnvFlags(wrangler) {
12690
- const date = wrangler.compatibility_date;
12691
- const flags = wrangler.compatibility_flags;
12692
- if (typeof date !== "string" || date >= CLOUDFLARE_POPULATE_PROCESS_ENV_DATE) return void 0;
12693
- if (!Array.isArray(flags) || !flags.includes("nodejs_compat")) return void 0;
12694
- if (flags.includes(CLOUDFLARE_POPULATE_PROCESS_ENV_FLAG) || flags.includes(CLOUDFLARE_DO_NOT_POPULATE_PROCESS_ENV_FLAG)) {
12695
- return void 0;
12696
- }
12697
- return [...flags, CLOUDFLARE_POPULATE_PROCESS_ENV_FLAG];
12698
- }
12699
13068
  async function populateCloudflareProcessEnv(serverDir, fs4) {
12700
13069
  const wranglerPath = _path2.default.join(serverDir, "wrangler.json");
12701
13070
  let source;
@@ -12706,7 +13075,7 @@ async function populateCloudflareProcessEnv(serverDir, fs4) {
12706
13075
  throw error;
12707
13076
  }
12708
13077
  const wrangler = JSON.parse(source);
12709
- const flags = resolveCloudflareProcessEnvFlags(wrangler);
13078
+ const flags = _chunkI7J5RLGOcjs.resolveCloudflareProcessEnvFlags.call(void 0, wrangler);
12710
13079
  if (!flags) return;
12711
13080
  await fs4.writeFile(
12712
13081
  wranglerPath,
@@ -12736,16 +13105,16 @@ async function copyPrebuiltSSRBundle(ssrBundle, targetDir, minifyOptions, fs4) {
12736
13105
  }
12737
13106
  async function installFarmCompileCacheLauncher(serverDir, fs4) {
12738
13107
  const entryPath = _path2.default.join(serverDir, "index.mjs");
12739
- const serverPath = _path2.default.join(serverDir, _chunk4IHMHFQBcjs.FARM_SERVER_MODULE_FILE);
13108
+ const serverPath = _path2.default.join(serverDir, _chunkNG2EZ6QScjs.FARM_SERVER_MODULE_FILE);
12740
13109
  const entry = await fs4.readFile(entryPath, "utf8").catch((error) => {
12741
13110
  if (error.code === "ENOENT") return null;
12742
13111
  throw error;
12743
13112
  });
12744
13113
  if (entry === null) return false;
12745
- if (entry.includes(`./${_chunk4IHMHFQBcjs.FARM_SERVER_MODULE_FILE}`)) return false;
13114
+ if (entry.includes(`./${_chunkNG2EZ6QScjs.FARM_SERVER_MODULE_FILE}`)) return false;
12746
13115
  await fs4.rename(entryPath, serverPath);
12747
- await fs4.writeFile(entryPath, _chunk4IHMHFQBcjs.createFarmCompileCacheLauncher.call(void 0, _chunk4IHMHFQBcjs.FARM_SERVER_MODULE_FILE));
12748
- await fs4.rm(_path2.default.join(serverDir, _chunk4IHMHFQBcjs.FARM_COMPILE_CACHE_DIR), { recursive: true, force: true });
13116
+ await fs4.writeFile(entryPath, _chunkNG2EZ6QScjs.createFarmCompileCacheLauncher.call(void 0, _chunkNG2EZ6QScjs.FARM_SERVER_MODULE_FILE));
13117
+ await fs4.rm(_path2.default.join(serverDir, _chunkNG2EZ6QScjs.FARM_COMPILE_CACHE_DIR), { recursive: true, force: true });
12749
13118
  return true;
12750
13119
  }
12751
13120
  async function registerPrebuiltSSRPackageImport(serverDir, ssrEntryFile, fs4) {
@@ -12769,7 +13138,7 @@ async function moveVercelOutputPath(src, dest, fs4) {
12769
13138
  await fs4.rename(src, dest);
12770
13139
  return;
12771
13140
  } catch (error) {
12772
- const code = _optionalChain([error, 'optionalAccess', _303 => _303.code]);
13141
+ const code = _optionalChain([error, 'optionalAccess', _311 => _311.code]);
12773
13142
  if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
12774
13143
  throw error;
12775
13144
  }
@@ -12777,7 +13146,7 @@ async function moveVercelOutputPath(src, dest, fs4) {
12777
13146
  await fs4.cp(src, dest, { recursive: true, force: true });
12778
13147
  await fs4.rm(src, { recursive: true, force: true });
12779
13148
  }
12780
- async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflows, routeRuntimeManifest, cronJobs) {
13149
+ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflows, routeRuntimeManifest, cronJobs, edgeMiddleware, prerenderedPages) {
12781
13150
  const serverDir = _path2.default.join(outputDir, "server");
12782
13151
  const functionsDir = _path2.default.join(outputDir, "functions");
12783
13152
  const nitroFuncDir = _path2.default.join(functionsDir, "__nitro.func");
@@ -12795,7 +13164,7 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
12795
13164
  try {
12796
13165
  await moveVercelOutputPath(publicDir, staticDir, fs4);
12797
13166
  } catch (error) {
12798
- if (_optionalChain([error, 'optionalAccess', _304 => _304.code]) !== "ENOENT") throw error;
13167
+ if (_optionalChain([error, 'optionalAccess', _312 => _312.code]) !== "ENOENT") throw error;
12799
13168
  }
12800
13169
  await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4);
12801
13170
  await copyPrismaClientForVercel(root, nitroFuncDir, fs4);
@@ -12808,11 +13177,27 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
12808
13177
  fs4,
12809
13178
  config.basePath
12810
13179
  );
13180
+ const edgeMiddlewareRoutes = edgeMiddleware.middlewareRoutes.filter(
13181
+ (route) => edgeMiddleware.guardedPages.some((pathname) => _chunkUPOYKX4Scjs.appMiddlewareMayHandlePath.call(void 0, [route], pathname))
13182
+ );
13183
+ if (edgeMiddlewareRoutes.length > 0) {
13184
+ await writeFarmVercelEdgeMiddlewareFunction({
13185
+ root,
13186
+ outputDir,
13187
+ buildDir: edgeMiddleware.buildDir,
13188
+ config,
13189
+ routes: edgeMiddlewareRoutes,
13190
+ guardedPages: edgeMiddleware.guardedPages,
13191
+ fs: fs4
13192
+ });
13193
+ }
12811
13194
  vercelConfig.routes = buildFarmVercelRoutes({
12812
13195
  presetRoutes: Array.isArray(vercelConfig.routes) ? vercelConfig.routes : [],
12813
- runtimeRoutes
13196
+ runtimeRoutes,
13197
+ middlewareRoutes: edgeMiddlewareRoutes.length > 0 ? [createFarmVercelEdgeMiddlewareRoute(edgeMiddleware.guardedPages, config.basePath)] : [],
13198
+ canonicalSlashRoutes: createFarmVercelCanonicalSlashRoutes(prerenderedPages)
12814
13199
  });
12815
- const vercelConfigWithWorkflowCrons = _chunkKCY52OUQcjs.applyFarmWorkflowVercelCrons.call(void 0,
13200
+ const vercelConfigWithWorkflowCrons = _chunkFSODPZRTcjs.applyFarmWorkflowVercelCrons.call(void 0,
12816
13201
  vercelConfig,
12817
13202
  farmWorkflows.workflows
12818
13203
  );
@@ -12821,8 +13206,8 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
12821
13206
  _chunkQMNWKQL4cjs.logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
12822
13207
  }
12823
13208
  async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
12824
- if (!_optionalChain([config, 'access', _305 => _305.docs, 'optionalAccess', _306 => _306.enabled])) return;
12825
- const [mainRoot, ...extraRoots] = _chunkPPX7UOFYcjs.getFarmDocsRoots.call(void 0, config.docs);
13209
+ if (!_optionalChain([config, 'access', _313 => _313.docs, 'optionalAccess', _314 => _314.enabled])) return;
13210
+ const [mainRoot, ...extraRoots] = _chunkFVYBEMODcjs.getFarmDocsRoots.call(void 0, config.docs);
12826
13211
  await copyFarmDocsRootContent(
12827
13212
  mainRoot,
12828
13213
  root,
@@ -12843,10 +13228,10 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
12843
13228
  async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs4) {
12844
13229
  const docsContentDir = resolveBuildDocsContentDir(docs, root, srcDir);
12845
13230
  if (!docsContentDir) return;
12846
- const lastModifiedManifest = _chunkPPX7UOFYcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
13231
+ const lastModifiedManifest = _chunkFVYBEMODcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
12847
13232
  fallback: "now"
12848
13233
  });
12849
- const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access', _307 => _307.unknown, 'optionalAccess', _308 => _308.length]), () => ( 0));
13234
+ const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access', _315 => _315.unknown, 'optionalAccess', _316 => _316.length]), () => ( 0));
12850
13235
  if (undatedPages > 0) {
12851
13236
  _chunkQMNWKQL4cjs.logger.warn(
12852
13237
  `${undatedPages} docs page(s) were last changed before this shallow clone's Git history, so they show no "Last updated" date. Build from a full clone (git fetch --unshallow) or set lastModified in the page's frontmatter.`
@@ -12859,7 +13244,7 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
12859
13244
  force: true
12860
13245
  });
12861
13246
  await fs4.writeFile(
12862
- _path2.default.join(bundledContentDir, _chunkPPX7UOFYcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
13247
+ _path2.default.join(bundledContentDir, _chunkFVYBEMODcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
12863
13248
  `${JSON.stringify(lastModifiedManifest, null, 2)}
12864
13249
  `
12865
13250
  );
@@ -12930,7 +13315,7 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
12930
13315
  try {
12931
13316
  await copyPackage("sharp", sharpRequire);
12932
13317
  if (!copiedPackages.has("sharp")) {
12933
- throw new Error(`Farm image optimization requires sharp. ${_chunkN5DQMOAGcjs.SHARP_INSTALL_HINT}`);
13318
+ throw new Error(`Farm image optimization requires sharp. ${_chunkDHR2WDSLcjs.SHARP_INSTALL_HINT}`);
12934
13319
  }
12935
13320
  } catch (error) {
12936
13321
  await fs4.rm(stageDir, { recursive: true, force: true });
@@ -13080,14 +13465,23 @@ function resolvePackageJson(parentRequire, packageName) {
13080
13465
  }
13081
13466
  return null;
13082
13467
  }
13083
- async function copyPrismaClientForVercel(root, nitroFuncDir, fs4) {
13084
- const projectRequire = _module.createRequire.call(void 0, _path2.default.join(root, "package.json"));
13085
- let prismaClientDir;
13086
- try {
13087
- prismaClientDir = _path2.default.dirname(projectRequire.resolve("@prisma/client/default.js"));
13088
- } catch (e40) {
13089
- return;
13468
+ async function resolveProjectInstalledPackageDir(root, packageName, fs4) {
13469
+ let directory = _path2.default.resolve(root);
13470
+ while (true) {
13471
+ const candidate = _path2.default.join(directory, "node_modules", ...packageName.split("/"));
13472
+ try {
13473
+ const packageDir = await fs4.realpath(candidate);
13474
+ if ((await fs4.stat(_path2.default.join(packageDir, "package.json"))).isFile()) return packageDir;
13475
+ } catch (e40) {
13476
+ }
13477
+ const parent = _path2.default.dirname(directory);
13478
+ if (parent === directory) return null;
13479
+ directory = parent;
13090
13480
  }
13481
+ }
13482
+ async function copyPrismaClientForVercel(root, nitroFuncDir, fs4) {
13483
+ const prismaClientDir = await resolveProjectInstalledPackageDir(root, "@prisma/client", fs4);
13484
+ if (!prismaClientDir) return;
13091
13485
  const generatedClientDir = _path2.default.join(prismaClientDir, "..", "..", ".prisma", "client");
13092
13486
  try {
13093
13487
  await fs4.access(generatedClientDir);
@@ -13150,8 +13544,8 @@ async function createFarmProjectModuleSsrEnvironment() {
13150
13544
 
13151
13545
  // src/build/index.ts
13152
13546
  async function build(config, options = {}) {
13153
- return _chunk4IHMHFQBcjs.withProductionNodeEnv.call(void 0,
13154
- () => _chunk4DRINDGNcjs.withPackageClientBoundaryCache.call(void 0, () => buildWithProductionNodeEnv(config, options))
13547
+ return _chunkNG2EZ6QScjs.withProductionNodeEnv.call(void 0,
13548
+ () => _chunkVO65MYJDcjs.withPackageClientBoundaryCache.call(void 0, () => buildWithProductionNodeEnv(config, options))
13155
13549
  );
13156
13550
  }
13157
13551
  function createBuildTargetBaseline(config) {
@@ -13162,7 +13556,7 @@ function createBuildTargetBaseline(config) {
13162
13556
  preset,
13163
13557
  distDir,
13164
13558
  outputDir,
13165
- outputWasDerived: outputDir === _chunk556H7JCEcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
13559
+ outputWasDerived: outputDir === _chunk6GQJVY4Ecjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
13166
13560
  };
13167
13561
  }
13168
13562
  function resolveBuildTargets(config, options, baseline) {
@@ -13171,8 +13565,8 @@ function resolveBuildTargets(config, options, baseline) {
13171
13565
  const distDir = config.distDir || ".farm";
13172
13566
  const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
13173
13567
  const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
13174
- const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunk556H7JCEcjs.getDeployTargetForPreset.call(void 0, preset);
13175
- const outputDir = shouldRefreshDerivedOutput ? _chunk556H7JCEcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
13568
+ const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunk6GQJVY4Ecjs.getDeployTargetForPreset.call(void 0, preset);
13569
+ const outputDir = shouldRefreshDerivedOutput ? _chunk6GQJVY4Ecjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
13176
13570
  return {
13177
13571
  root,
13178
13572
  preset,
@@ -13180,7 +13574,7 @@ function resolveBuildTargets(config, options, baseline) {
13180
13574
  distDir,
13181
13575
  deployTarget,
13182
13576
  outputDir,
13183
- deployOutputDir: _chunk556H7JCEcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
13577
+ deployOutputDir: _chunk6GQJVY4Ecjs.resolveDeployOutputPath.call(void 0, root, outputDir)
13184
13578
  };
13185
13579
  }
13186
13580
  async function buildWithProductionNodeEnv(inputConfig, options) {
@@ -13188,7 +13582,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
13188
13582
  const targetBaseline = createBuildTargetBaseline(config);
13189
13583
  let targets;
13190
13584
  const productionViteResultPromise = options.universal === false ? void 0 : Promise.allSettled([Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkMF3IA2AWcjs.loadFarmProductionVite.call(void 0, ))))]);
13191
- const pluginManager = new (0, _chunkWUTFJOV7cjs.PluginManager)({
13585
+ const pluginManager = new (0, _chunkJFPKARWMcjs.PluginManager)({
13192
13586
  config,
13193
13587
  isDev: false,
13194
13588
  isProd: true
@@ -13217,15 +13611,15 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
13217
13611
  };
13218
13612
  config = {
13219
13613
  ...config,
13220
- images: _chunkN5DQMOAGcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
13614
+ images: _chunkDHR2WDSLcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
13221
13615
  root: targets.root,
13222
13616
  preset: targets.preset
13223
13617
  })
13224
13618
  };
13225
- if (_optionalChain([config, 'access', _309 => _309.docs, 'optionalAccess', _310 => _310.enabled])) await _chunkV3UOEWCBcjs.loadFarmDocsEngine.call(void 0, );
13619
+ if (_optionalChain([config, 'access', _317 => _317.docs, 'optionalAccess', _318 => _318.enabled])) await _chunkV3UOEWCBcjs.loadFarmDocsEngine.call(void 0, );
13226
13620
  pluginManager.updateContext({ config });
13227
13621
  const { root, preset, srcDir, distDir, deployOutputDir } = targets;
13228
- _chunk4DRINDGNcjs.usePackageClientBoundaryCacheFile.call(void 0, _chunk4DRINDGNcjs.resolvePackageClientBoundaryCacheFile.call(void 0, root, distDir));
13622
+ _chunkVO65MYJDcjs.usePackageClientBoundaryCacheFile.call(void 0, _chunkVO65MYJDcjs.resolvePackageClientBoundaryCacheFile.call(void 0, root, distDir));
13229
13623
  _chunkQMNWKQL4cjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
13230
13624
  await pluginManager.setupPlugins();
13231
13625
  await pluginManager.runHookParallel("beforeBundle", {
@@ -13237,8 +13631,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
13237
13631
  });
13238
13632
  _chunkQMNWKQL4cjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
13239
13633
  const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
13240
- if (_optionalChain([productionViteResult, 'optionalAccess', _311 => _311.status]) === "rejected") throw productionViteResult.reason;
13241
- const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _312 => _312.value]);
13634
+ if (_optionalChain([productionViteResult, 'optionalAccess', _319 => _319.status]) === "rejected") throw productionViteResult.reason;
13635
+ const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _320 => _320.value]);
13242
13636
  const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
13243
13637
  projectModuleServer = await createProjectModuleServer(
13244
13638
  createViteServer,
@@ -13246,18 +13640,18 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
13246
13640
  root,
13247
13641
  rendererBuild.signal
13248
13642
  );
13249
- const farmApp = _chunkN5DQMOAGcjs.createFarmApp.call(void 0, config, projectModuleServer);
13643
+ const farmApp = _chunkDHR2WDSLcjs.createFarmApp.call(void 0, config, projectModuleServer);
13250
13644
  await farmApp.initialize();
13251
13645
  const routeManager = farmApp.getRouteManager();
13252
13646
  const serverRenderer = farmApp.getServerRenderer();
13253
- const typeArtifacts = _chunkYVTS3S3Fcjs.generateFarmTypeArtifacts.call(void 0, {
13647
+ const typeArtifacts = _chunkQOGIZKSOcjs.generateFarmTypeArtifacts.call(void 0, {
13254
13648
  root,
13255
13649
  srcDir,
13256
13650
  layers: config.layers,
13257
13651
  plugins: config.plugins,
13258
13652
  extraRoutes: [
13259
- ..._optionalChain([config, 'access', _313 => _313.openapi, 'optionalAccess', _314 => _314.enabled]) && config.openapi.route ? [config.openapi.route] : [],
13260
- ..._chunkPPX7UOFYcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
13653
+ ..._optionalChain([config, 'access', _321 => _321.openapi, 'optionalAccess', _322 => _322.enabled]) && config.openapi.route ? [config.openapi.route] : [],
13654
+ ..._chunkFVYBEMODcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
13261
13655
  ],
13262
13656
  suppressLintOnLink: config.suppressLintOnLink,
13263
13657
  componentExtensions: config.renderer.componentExtensions,
@@ -13267,7 +13661,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
13267
13661
  _chunkQMNWKQL4cjs.logger.warn(`Route type generation failed (farm.d.ts may be stale): ${message}`);
13268
13662
  });
13269
13663
  const apiRouteManager = new (0, _chunkOFBLGH6Vcjs.APIRouteManager)(
13270
- _chunk5Y2P454Ocjs.getFarmAppDirectories.call(void 0, config),
13664
+ _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, config),
13271
13665
  projectModuleServer,
13272
13666
  {
13273
13667
  throwOnLoadError: true,
@@ -13341,7 +13735,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
13341
13735
  throw error;
13342
13736
  } finally {
13343
13737
  try {
13344
- await _optionalChain([projectModuleServer, 'optionalAccess', _315 => _315.close, 'call', _316 => _316()]);
13738
+ await _optionalChain([projectModuleServer, 'optionalAccess', _323 => _323.close, 'call', _324 => _324()]);
13345
13739
  } finally {
13346
13740
  rendererBuild.abort();
13347
13741
  }
@@ -13353,7 +13747,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
13353
13747
  ssr: true,
13354
13748
  buildLifetime
13355
13749
  });
13356
- const viteConfig = _chunkN5DQMOAGcjs.mergeFarmViteConfig.call(void 0,
13750
+ const viteConfig = _chunkDHR2WDSLcjs.mergeFarmViteConfig.call(void 0,
13357
13751
  {
13358
13752
  root,
13359
13753
  appType: "custom",
@@ -13365,22 +13759,24 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
13365
13759
  },
13366
13760
  plugins: [
13367
13761
  ...rendererVitePlugins,
13368
- _chunkN5DQMOAGcjs.farmFontImportsPlugin.call(void 0, {
13762
+ _chunkDHR2WDSLcjs.farmFontImportsPlugin.call(void 0, {
13369
13763
  root,
13370
13764
  basePath: config.basePath,
13371
13765
  publicDir: config.publicDir
13372
13766
  }),
13373
- _chunk4DRINDGNcjs.farmEnvironmentFunctionsPlugin.call(void 0, ),
13767
+ _chunkVO65MYJDcjs.farmEnvironmentFunctionsPlugin.call(void 0, ),
13374
13768
  // Route modules load here at build time (rendering config, prerendering): `server-only`
13375
- // resolves as it does in the server build.
13376
- farmServerOnlyEntriesPlugin()
13769
+ // resolves as it does in the server build. Module-entry packages load pre-bundled, as in
13770
+ // `farm dev`: unbundled, lucide-react alone is ~1,750 modules through the module runner,
13771
+ // which a docs build waited on after its bundles.
13772
+ farmServerOnlyEntriesPlugin({ prebundleServerPackages: true })
13377
13773
  ],
13378
13774
  server: {
13379
13775
  middlewareMode: true,
13380
13776
  hmr: false
13381
13777
  },
13382
13778
  resolve: {
13383
- alias: _chunkN5DQMOAGcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
13779
+ alias: _chunkDHR2WDSLcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
13384
13780
  dedupe: [...config.renderer.dedupe || []]
13385
13781
  },
13386
13782
  optimizeDeps: {
@@ -13393,6 +13789,12 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
13393
13789
  return createViteServer({
13394
13790
  ...viteConfig,
13395
13791
  root,
13792
+ // Vite keys its pre-bundled dependencies on the config, mode included, so this server and
13793
+ // `farm dev` sharing one cache would each rebuild it after the other ran.
13794
+ cacheDir: _path2.default.join(
13795
+ _path2.default.resolve(root, _nullishCoalesce(viteConfig.cacheDir, () => ( _path2.default.join("node_modules", ".vite")))),
13796
+ "farm-build"
13797
+ ),
13396
13798
  configFile: false,
13397
13799
  appType: "custom",
13398
13800
  mode: "production",
@@ -13413,10 +13815,10 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
13413
13815
  noDiscovery: true
13414
13816
  },
13415
13817
  // An app or plugin that brings its own SSR environment keeps it.
13416
- environments: _optionalChain([viteConfig, 'access', _317 => _317.environments, 'optionalAccess', _318 => _318.ssr, 'optionalAccess', _319 => _319.dev, 'optionalAccess', _320 => _320.createEnvironment]) ? viteConfig.environments : {
13818
+ environments: _optionalChain([viteConfig, 'access', _325 => _325.environments, 'optionalAccess', _326 => _326.ssr, 'optionalAccess', _327 => _327.dev, 'optionalAccess', _328 => _328.createEnvironment]) ? viteConfig.environments : {
13417
13819
  ...viteConfig.environments,
13418
13820
  ssr: {
13419
- ..._optionalChain([viteConfig, 'access', _321 => _321.environments, 'optionalAccess', _322 => _322.ssr]),
13821
+ ..._optionalChain([viteConfig, 'access', _329 => _329.environments, 'optionalAccess', _330 => _330.ssr]),
13420
13822
  ...await createFarmProjectModuleSsrEnvironment()
13421
13823
  }
13422
13824
  }
@@ -13424,7 +13826,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
13424
13826
  }
13425
13827
  async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
13426
13828
  const { farmI18nClientBridgePlugin, farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
13427
- const { PluginManager: PluginManager2 } = await import("./plugin-WIU4GDD4.cjs");
13829
+ const { PluginManager: PluginManager2 } = await import("./plugin-F2O4BFTK.cjs");
13428
13830
  const pluginManager = new PluginManager2({
13429
13831
  config,
13430
13832
  isDev: false,
@@ -13444,14 +13846,14 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
13444
13846
  farmI18nClientBridgePlugin(),
13445
13847
  farmServerOnlyEntriesPlugin(),
13446
13848
  farmPlugin(config, pluginManager),
13447
- _chunk4DRINDGNcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
13849
+ _chunkVO65MYJDcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
13448
13850
  ],
13449
13851
  mode: "production"
13450
13852
  });
13451
13853
  }
13452
13854
  async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
13453
13855
  const { farmI18nClientBridgePlugin, farmPlugin } = await import("./vite.cjs");
13454
- const { PluginManager: PluginManager2 } = await import("./plugin-WIU4GDD4.cjs");
13856
+ const { PluginManager: PluginManager2 } = await import("./plugin-F2O4BFTK.cjs");
13455
13857
  const pluginManager = new PluginManager2({
13456
13858
  config,
13457
13859
  isDev: false,
@@ -13472,12 +13874,12 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
13472
13874
  define: {
13473
13875
  __FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
13474
13876
  __FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
13475
- __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _323 => _323.env, 'optionalAccess', _324 => _324.public]) || {})
13877
+ __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _331 => _331.env, 'optionalAccess', _332 => _332.public]) || {})
13476
13878
  },
13477
13879
  plugins: [
13478
13880
  farmI18nClientBridgePlugin(),
13479
13881
  farmPlugin(config, pluginManager),
13480
- _chunk4DRINDGNcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
13882
+ _chunkVO65MYJDcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
13481
13883
  ],
13482
13884
  mode: "production"
13483
13885
  });
@@ -13492,7 +13894,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
13492
13894
  }
13493
13895
  async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
13494
13896
  const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
13495
- import("./nitro-EEX2J3KB.cjs"),
13897
+ import("./nitro-Y3LGITW3.cjs"),
13496
13898
  import("nitro/builder")
13497
13899
  ]);
13498
13900
  let nitroConfig = await createNitroConfig(
@@ -13505,7 +13907,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
13505
13907
  if (pluginManager) {
13506
13908
  nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
13507
13909
  }
13508
- const outputDir = _chunk556H7JCEcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
13910
+ const outputDir = _chunk6GQJVY4Ecjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
13509
13911
  const serverOutputDir = _path2.default.join(outputDir, "server");
13510
13912
  const publicOutputDir = _path2.default.join(outputDir, "public");
13511
13913
  const { mkdir, cp } = await import("fs/promises");
@@ -13576,7 +13978,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
13576
13978
  root,
13577
13979
  preset,
13578
13980
  distDir,
13579
- outputDir: _chunk556H7JCEcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
13981
+ outputDir: _chunk6GQJVY4Ecjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
13580
13982
  });
13581
13983
  }
13582
13984
  }