@farm.js/core 0.1.69 → 0.1.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/dist/{agent-mcp-handler-FER4MQDF.cjs → agent-mcp-handler-KE4J3W7S.cjs} +8 -5
  2. package/dist/{agent-mcp-handler-AZ7QW4UP.mjs → agent-mcp-handler-VIT4GOSR.mjs} +7 -4
  3. package/dist/{agent-mcp.d-DOfBMEzP.d.mts → agent-mcp.d-BzNw6JI8.d.ts} +24 -5
  4. package/dist/{agent-mcp.d-DnIgriX1.d.ts → agent-mcp.d-CgFen3EH.d.mts} +24 -5
  5. package/dist/agent-runtime.cjs +3 -3
  6. package/dist/agent-runtime.d.mts +3 -2
  7. package/dist/agent-runtime.d.ts +3 -2
  8. package/dist/agent-runtime.mjs +2 -2
  9. package/dist/analyzer-LPIVRSTJ.cjs +16 -0
  10. package/dist/{analyzer-NAL5TJUP.mjs → analyzer-VK3BAOFI.mjs} +2 -2
  11. package/dist/api/node.d.mts +5 -4
  12. package/dist/api/node.d.ts +5 -4
  13. package/dist/api/route-manager.cjs +4 -4
  14. package/dist/api/route-manager.d.mts +16 -7
  15. package/dist/api/route-manager.d.ts +16 -7
  16. package/dist/api/route-manager.mjs +3 -3
  17. package/dist/api/runtime.d.mts +4 -3
  18. package/dist/api/runtime.d.ts +4 -3
  19. package/dist/api.cjs +6 -6
  20. package/dist/api.d.mts +8 -7
  21. package/dist/api.d.ts +8 -7
  22. package/dist/api.mjs +5 -5
  23. package/dist/{app-manifest.d-CaAcaukR.d.ts → app-manifest.d-DY4JfJxi.d.ts} +1 -1
  24. package/dist/{app-manifest.d-_BVbI0xp.d.mts → app-manifest.d-DpDK_B1k.d.mts} +1 -1
  25. package/dist/app-markdown.cjs +7 -4
  26. package/dist/app-markdown.d.mts +5 -4
  27. package/dist/app-markdown.d.ts +5 -4
  28. package/dist/app-markdown.mjs +6 -3
  29. package/dist/{app.d-BWeDqOaF.d.ts → app.d-BeK6bb1c.d.ts} +22 -10
  30. package/dist/{app.d-CaPwtytN.d.mts → app.d-D-5UNrFd.d.mts} +22 -10
  31. package/dist/{base-path.d-CTDVF0Fc.d.mts → base-path.d-BJ3SYpB8.d.mts} +6 -1
  32. package/dist/{base-path.d-CTDVF0Fc.d.ts → base-path.d-BJ3SYpB8.d.ts} +6 -1
  33. package/dist/{chunk-4ZXKYCYK.mjs → chunk-255J7K4X.mjs} +1 -1
  34. package/dist/{chunk-RVGLYMJM.cjs → chunk-2AM26UGI.cjs} +2 -2
  35. package/dist/{chunk-5TOWKGV3.mjs → chunk-2CQC5CMD.mjs} +1 -1
  36. package/dist/{chunk-VO65MYJD.cjs → chunk-2IFT2CSA.cjs} +4 -4
  37. package/dist/{chunk-UPOYKX4S.cjs → chunk-2MR4MABG.cjs} +4 -4
  38. package/dist/chunk-2RCCFB2Y.cjs +129 -0
  39. package/dist/{chunk-K6VFYFOY.cjs → chunk-2W4GNXGX.cjs} +2 -2
  40. package/dist/{chunk-CV6MFQ4Y.mjs → chunk-3AUINHFG.mjs} +1 -1
  41. package/dist/{chunk-TKYOJ5G2.cjs → chunk-3BQ7QHUH.cjs} +5 -5
  42. package/dist/{chunk-MMDKYJ5V.cjs → chunk-3GNVIYPO.cjs} +7 -7
  43. package/dist/{chunk-65Y5SIBH.cjs → chunk-3QM74STY.cjs} +1 -1
  44. package/dist/{chunk-FJMC24KG.cjs → chunk-42KMUIWZ.cjs} +0 -3
  45. package/dist/{chunk-YVPX5PI5.mjs → chunk-4O26BPUY.mjs} +8 -0
  46. package/dist/{chunk-PDQ6EGPK.mjs → chunk-4OD2LXF2.mjs} +2 -2
  47. package/dist/{chunk-LENKRGBV.mjs → chunk-5CFHQ7HM.mjs} +1 -1
  48. package/dist/{chunk-3Y52TWYU.mjs → chunk-62ZRA7XU.mjs} +0 -3
  49. package/dist/{chunk-K76CBYQM.mjs → chunk-7A3URI2F.mjs} +20 -0
  50. package/dist/{chunk-UHU4QALN.mjs → chunk-7BUE2GM6.mjs} +294 -164
  51. package/dist/{chunk-L6NWQ3DR.cjs → chunk-7OHJWFLB.cjs} +600 -469
  52. package/dist/{chunk-VX2HZGC7.cjs → chunk-ACGBXN3U.cjs} +2 -2
  53. package/dist/{chunk-MV7NWU23.mjs → chunk-AYVGD3PK.mjs} +1 -1
  54. package/dist/{chunk-FT6KJHS3.cjs → chunk-C2JOS77Z.cjs} +4 -1
  55. package/dist/{chunk-CRVSYDHV.mjs → chunk-CKQAQFF6.mjs} +2 -2
  56. package/dist/{chunk-QOGIZKSO.cjs → chunk-CSQPMV3Q.cjs} +21 -11
  57. package/dist/chunk-DC2AXGNZ.mjs +129 -0
  58. package/dist/{chunk-Q4HH5Q6A.cjs → chunk-DMXMIE2C.cjs} +2 -2
  59. package/dist/{chunk-MAGFDK4Q.mjs → chunk-DPIGYXSV.mjs} +1 -1
  60. package/dist/{chunk-GUMKIQJL.cjs → chunk-DPYBVVL3.cjs} +2 -2
  61. package/dist/{chunk-23VJEGKC.cjs → chunk-DVJM55D2.cjs} +9 -1
  62. package/dist/{chunk-QSUYB3RH.cjs → chunk-DZHTNSQ5.cjs} +14 -14
  63. package/dist/{chunk-OIOPQ25L.mjs → chunk-E77IA5IF.mjs} +46 -33
  64. package/dist/{chunk-EZTKXD6P.cjs → chunk-FDGYDQGL.cjs} +8 -1
  65. package/dist/{chunk-PLJKJJ2H.mjs → chunk-FETMUBIA.mjs} +27 -82
  66. package/dist/{chunk-HJZZSBVK.cjs → chunk-FILXOEWD.cjs} +2 -2
  67. package/dist/{chunk-PDFFYZAT.cjs → chunk-GF22VGMS.cjs} +2 -2
  68. package/dist/{chunk-IYLZZTP6.mjs → chunk-GUU3IZSM.mjs} +167 -77
  69. package/dist/{chunk-OOJBBHYW.cjs → chunk-GVYZCJZH.cjs} +30 -1
  70. package/dist/{chunk-YOHHL2UE.mjs → chunk-I4KPA2C6.mjs} +1 -1
  71. package/dist/{chunk-PEYDQMSA.mjs → chunk-IGXS54GC.mjs} +6 -6
  72. package/dist/{chunk-NVOMQLI2.mjs → chunk-IWJONXPF.mjs} +11 -0
  73. package/dist/{chunk-SZORL7EW.mjs → chunk-IYDJNCR7.mjs} +6 -6
  74. package/dist/{chunk-HEJM46HQ.mjs → chunk-J5ASGNKF.mjs} +28 -2
  75. package/dist/{chunk-RLH5AH2M.mjs → chunk-JDO346NV.mjs} +1 -1
  76. package/dist/{chunk-K6SXMVXO.mjs → chunk-JMFTKNBA.mjs} +22 -7
  77. package/dist/{chunk-YIHRZBD7.cjs → chunk-JRGR5Z4K.cjs} +1 -1
  78. package/dist/{chunk-4W4ZWSV2.cjs → chunk-JVA4PIYN.cjs} +604 -434
  79. package/dist/{chunk-UKZ6AWKZ.cjs → chunk-JWY66PID.cjs} +44 -1
  80. package/dist/{chunk-BDYM2TN3.cjs → chunk-JX5VOLAV.cjs} +8 -8
  81. package/dist/{chunk-WMLSZAKN.mjs → chunk-JZQS3ZOI.mjs} +1 -1
  82. package/dist/{chunk-OFBLGH6V.cjs → chunk-K66JILV3.cjs} +47 -34
  83. package/dist/{chunk-6GQJVY4E.cjs → chunk-KEB7AGS6.cjs} +17 -17
  84. package/dist/{chunk-IFR74W6S.mjs → chunk-KPJYBSHL.mjs} +4 -1
  85. package/dist/{chunk-TEJ67GD2.mjs → chunk-KQAB5LML.mjs} +28 -6
  86. package/dist/{chunk-DHR2WDSL.cjs → chunk-KWST2O22.cjs} +387 -297
  87. package/dist/{chunk-3EEINK7G.cjs → chunk-L6E4SHUB.cjs} +41 -15
  88. package/dist/{chunk-KI3MU7B5.mjs → chunk-LDVJIBGN.mjs} +1 -1
  89. package/dist/{chunk-5FBZJJGA.mjs → chunk-LXEJNWF5.mjs} +2 -2
  90. package/dist/{chunk-AKIQ54FK.cjs → chunk-MBCRWU3P.cjs} +26 -81
  91. package/dist/{chunk-22LGTSBA.cjs → chunk-MEJCP2LX.cjs} +1 -1
  92. package/dist/{chunk-ZR2QB45W.mjs → chunk-MITIAOUQ.mjs} +4 -4
  93. package/dist/{chunk-OCNV4CI2.cjs → chunk-MQ4DYVFS.cjs} +26 -0
  94. package/dist/{chunk-P2NBQ5JI.mjs → chunk-MWUDEYBI.mjs} +1 -1
  95. package/dist/{chunk-LR4KP3I7.cjs → chunk-N3XO5AL5.cjs} +2 -2
  96. package/dist/{chunk-ZPKJPM7K.mjs → chunk-NA77GEIU.mjs} +2 -2
  97. package/dist/{chunk-FVYBEMOD.cjs → chunk-NAXKOTPP.cjs} +6 -6
  98. package/dist/{chunk-I7J5RLGO.cjs → chunk-NLBHLPEO.cjs} +12 -1
  99. package/dist/{chunk-R2ZHU37O.mjs → chunk-NLRAQXAA.mjs} +26 -0
  100. package/dist/{chunk-QO43L7Z4.cjs → chunk-O32QPFVV.cjs} +25 -7
  101. package/dist/{chunk-CO6UYM2D.mjs → chunk-O5QUJEWT.mjs} +1 -1
  102. package/dist/{chunk-JL2YW5KX.mjs → chunk-OAEDVXVE.mjs} +44 -1
  103. package/dist/{chunk-F6YLXK5L.cjs → chunk-PLXD2MJV.cjs} +19 -19
  104. package/dist/{chunk-JFPKARWM.cjs → chunk-PMU4U2W2.cjs} +1 -0
  105. package/dist/{chunk-GTQOEEE7.cjs → chunk-Q5HMVGR5.cjs} +13 -13
  106. package/dist/{chunk-ZYCEEE3V.mjs → chunk-QUFENL7Q.mjs} +2 -2
  107. package/dist/{chunk-QOSDWGKT.mjs → chunk-QVBXTSIZ.mjs} +1 -1
  108. package/dist/{chunk-OGVTUGMU.mjs → chunk-REP6HWJN.mjs} +13 -3
  109. package/dist/{chunk-ANMIR6US.mjs → chunk-RJUCNO7R.mjs} +1 -1
  110. package/dist/{chunk-WYL4ODZ4.mjs → chunk-SE7HPBYK.mjs} +30 -1
  111. package/dist/{chunk-GQ6QOH7T.cjs → chunk-SXMWVP2L.cjs} +12 -12
  112. package/dist/{chunk-D5F7RPZP.mjs → chunk-THG2TVDH.mjs} +3 -3
  113. package/dist/{chunk-X3MHKLCO.cjs → chunk-TP4RAV7Y.cjs} +25 -10
  114. package/dist/{chunk-DWLNLU55.cjs → chunk-TPYAYFMF.cjs} +2 -2
  115. package/dist/{chunk-Y6KHPJDB.cjs → chunk-U7VH3Q5E.cjs} +2 -2
  116. package/dist/{chunk-4JRAMCUP.cjs → chunk-UISZLYKY.cjs} +22 -22
  117. package/dist/{chunk-CKCKCUYO.mjs → chunk-UQUOSNRN.mjs} +511 -341
  118. package/dist/{chunk-2P7UYHZP.mjs → chunk-V25GSH43.mjs} +1 -1
  119. package/dist/{chunk-437QZIC2.cjs → chunk-VNBDN5W2.cjs} +5 -5
  120. package/dist/{chunk-ABIBASLJ.cjs → chunk-VXB5CMNC.cjs} +2 -2
  121. package/dist/{chunk-G7NBPP7H.mjs → chunk-W2T6NDNP.mjs} +11 -1
  122. package/dist/{chunk-AJNBTOVQ.mjs → chunk-WW3LRNQV.mjs} +1 -1
  123. package/dist/{chunk-GFPS7MNE.mjs → chunk-WX63N6C5.mjs} +4 -4
  124. package/dist/{chunk-ULMXZYOA.mjs → chunk-X7LGLF33.mjs} +1 -1
  125. package/dist/{chunk-VOQ7XZZT.cjs → chunk-Y2SZVIVH.cjs} +20 -0
  126. package/dist/{chunk-XCAQTCGK.mjs → chunk-YBY34UHB.mjs} +1 -1
  127. package/dist/{chunk-5NFQ6AZI.cjs → chunk-YCNHUIPR.cjs} +33 -11
  128. package/dist/{chunk-YGJ5P3TJ.mjs → chunk-Z3GPAFIA.mjs} +21 -3
  129. package/dist/{chunk-PJQ5W356.mjs → chunk-Z5ZZAGIH.mjs} +1 -0
  130. package/dist/{chunk-L5OZN6YW.cjs → chunk-ZPUAOKHV.cjs} +3 -3
  131. package/dist/{chunk-4E57QHPW.cjs → chunk-ZUVAGMQ5.cjs} +17 -7
  132. package/dist/{chunk-23LVFSID.mjs → chunk-ZXDX7VYZ.mjs} +7 -0
  133. package/dist/{client-component.d-CnEeVvGG.d.mts → client-component.d-DwpH251K.d.mts} +2 -2
  134. package/dist/{client-component.d-CfJxuXZl.d.ts → client-component.d-fYupugbZ.d.ts} +2 -2
  135. package/dist/{client-plugins.d-D7dHV1Nf.d.ts → client-plugins.d-BxqFfHpM.d.ts} +39 -3
  136. package/dist/{client-plugins.d-Do5ULA0x.d.mts → client-plugins.d-k3bOT5gz.d.mts} +39 -3
  137. package/dist/client-plugins.d.mts +3 -2
  138. package/dist/client-plugins.d.ts +3 -2
  139. package/dist/client.cjs +6 -6
  140. package/dist/client.d.mts +8 -7
  141. package/dist/client.d.ts +8 -7
  142. package/dist/client.mjs +5 -5
  143. package/dist/config.d.mts +3 -2
  144. package/dist/config.d.ts +3 -2
  145. package/dist/deployment.cjs +4 -2
  146. package/dist/deployment.d.mts +7 -1
  147. package/dist/deployment.d.ts +7 -1
  148. package/dist/deployment.mjs +5 -3
  149. package/dist/desktop.d.mts +4 -3
  150. package/dist/desktop.d.ts +4 -3
  151. package/dist/{dev-guard-ONNMVQUN.mjs → dev-guard-ZDIELV6Q.mjs} +1 -1
  152. package/dist/{dev-guard-2UW2KERP.cjs → dev-guard-ZLLKVO5T.cjs} +2 -2
  153. package/dist/{devtools-BP4EBTKQ.mjs → devtools-6MXPFPNJ.mjs} +9 -8
  154. package/dist/{devtools-7HNDS4SY.cjs → devtools-O5625KCK.cjs} +10 -9
  155. package/dist/docs.cjs +13 -12
  156. package/dist/docs.d.mts +4 -3
  157. package/dist/docs.d.ts +4 -3
  158. package/dist/docs.mjs +12 -11
  159. package/dist/environment/vite.cjs +3 -3
  160. package/dist/environment/vite.mjs +2 -2
  161. package/dist/headers.d-DalIGbVO.d.ts +18 -0
  162. package/dist/headers.d-sNT7ZQiU.d.mts +18 -0
  163. package/dist/i18n/client.cjs +2 -2
  164. package/dist/i18n/client.d.mts +2 -2
  165. package/dist/i18n/client.d.ts +2 -2
  166. package/dist/i18n/client.mjs +1 -1
  167. package/dist/i18n/index.cjs +2 -2
  168. package/dist/i18n/index.d.mts +3 -3
  169. package/dist/i18n/index.d.ts +3 -3
  170. package/dist/i18n/index.mjs +1 -1
  171. package/dist/i18n/server.cjs +3 -3
  172. package/dist/i18n/server.d.mts +5 -5
  173. package/dist/i18n/server.d.ts +5 -5
  174. package/dist/i18n/server.mjs +2 -2
  175. package/dist/index.cjs +50 -45
  176. package/dist/{index.d-CVFk37uX.d.ts → index.d-BcA-secm.d.ts} +1 -1
  177. package/dist/{index.d-B1MpEJAo.d.mts → index.d-DDHHAv7j.d.mts} +1 -1
  178. package/dist/index.d.mts +26 -24
  179. package/dist/index.d.ts +26 -24
  180. package/dist/index.mjs +63 -58
  181. package/dist/integrations/orm.d.mts +3 -2
  182. package/dist/integrations/orm.d.ts +3 -2
  183. package/dist/integrations.cjs +3 -3
  184. package/dist/integrations.d.mts +3 -2
  185. package/dist/integrations.d.ts +3 -2
  186. package/dist/integrations.mjs +2 -2
  187. package/dist/internal/app-markdown-runtime.cjs +6 -3
  188. package/dist/internal/app-markdown-runtime.d.mts +13 -4
  189. package/dist/internal/app-markdown-runtime.d.ts +13 -4
  190. package/dist/internal/app-markdown-runtime.mjs +5 -2
  191. package/dist/internal/build-runtime.cjs +37 -37
  192. package/dist/internal/build-runtime.d.mts +5 -4
  193. package/dist/internal/build-runtime.d.ts +5 -4
  194. package/dist/internal/build-runtime.mjs +36 -36
  195. package/dist/internal/cli-runtime.cjs +18 -15
  196. package/dist/internal/cli-runtime.mjs +17 -14
  197. package/dist/internal/client-error-overlay.cjs +4 -4
  198. package/dist/internal/client-error-overlay.mjs +1 -1
  199. package/dist/internal/client-runtime.cjs +5 -3
  200. package/dist/internal/client-runtime.d.mts +17 -7
  201. package/dist/internal/client-runtime.d.ts +17 -7
  202. package/dist/internal/client-runtime.mjs +4 -2
  203. package/dist/internal/compression-runtime.d.mts +3 -2
  204. package/dist/internal/compression-runtime.d.ts +3 -2
  205. package/dist/internal/config-runtime.cjs +11 -10
  206. package/dist/internal/config-runtime.d.mts +6 -5
  207. package/dist/internal/config-runtime.d.ts +6 -5
  208. package/dist/internal/config-runtime.mjs +10 -9
  209. package/dist/internal/infra-analytics-runtime.cjs +12 -9
  210. package/dist/internal/infra-analytics-runtime.mjs +10 -7
  211. package/dist/internal/native-server-fns.cjs +4 -4
  212. package/dist/internal/native-server-fns.mjs +3 -3
  213. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  214. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  215. package/dist/internal/production-runtime.cjs +48 -17
  216. package/dist/internal/production-runtime.d.mts +53 -18
  217. package/dist/internal/production-runtime.d.ts +53 -18
  218. package/dist/internal/production-runtime.mjs +50 -19
  219. package/dist/internal/vercel-edge-middleware.cjs +3 -2
  220. package/dist/internal/vercel-edge-middleware.d.mts +2 -2
  221. package/dist/internal/vercel-edge-middleware.d.ts +2 -2
  222. package/dist/internal/vercel-edge-middleware.mjs +2 -1
  223. package/dist/markdown.cjs +3 -2
  224. package/dist/markdown.d.mts +3 -2
  225. package/dist/markdown.d.ts +3 -2
  226. package/dist/markdown.mjs +2 -1
  227. package/dist/middleware.cjs +6 -5
  228. package/dist/middleware.d.mts +4 -3
  229. package/dist/middleware.d.ts +4 -3
  230. package/dist/middleware.mjs +5 -4
  231. package/dist/mobile.d.mts +3 -3
  232. package/dist/mobile.d.ts +3 -3
  233. package/dist/{mount.d-CBqr-LfI.d.mts → mount.d-C1PONsEe.d.mts} +1 -1
  234. package/dist/{mount.d-CGzN61Kq.d.ts → mount.d-D3JOux2V.d.ts} +1 -1
  235. package/dist/{native-tree-W2SSJB3Y.cjs → native-tree-GF4BH33L.cjs} +4 -3
  236. package/dist/{native-tree-Y5YQANW7.mjs → native-tree-L2IIEBXH.mjs} +3 -2
  237. package/dist/{navigation-delegate.d-BwCOhpj7.d.mts → navigation-delegate.d-CJQQHboA.d.mts} +1 -1
  238. package/dist/{navigation-delegate.d-CLH2dXjy.d.ts → navigation-delegate.d-CQQPbdkE.d.ts} +1 -1
  239. package/dist/navigation.cjs +5 -5
  240. package/dist/navigation.d.mts +6 -5
  241. package/dist/navigation.d.ts +6 -5
  242. package/dist/navigation.mjs +4 -4
  243. package/dist/{nitro-Y3LGITW3.cjs → nitro-2LMOMIST.cjs} +2 -2
  244. package/dist/{nitro-NSTXT7LB.mjs → nitro-72TFIGGO.mjs} +1 -1
  245. package/dist/{plugin-F2O4BFTK.cjs → plugin-5PIQQVRP.cjs} +2 -2
  246. package/dist/{plugin-VEBRN7A3.mjs → plugin-QZT747YW.mjs} +1 -1
  247. package/dist/plugin.cjs +30 -29
  248. package/dist/plugin.d.mts +6 -4
  249. package/dist/plugin.d.ts +6 -4
  250. package/dist/plugin.mjs +29 -28
  251. package/dist/{production-runtime.d-DMZY3OgV.d.mts → production-runtime.d-B0IeWWyO.d.mts} +23 -2
  252. package/dist/{production-runtime.d-BMyyLGBB.d.ts → production-runtime.d-q3aHIv5Y.d.ts} +23 -2
  253. package/dist/query/client.cjs +6 -6
  254. package/dist/query/client.mjs +2 -2
  255. package/dist/{render-plan.d-CzGDjcT0.d.mts → render-plan.d-CiUj0rq5.d.mts} +1 -1
  256. package/dist/{render-plan.d-W6LmjD6y.d.ts → render-plan.d-DHuJMJRP.d.ts} +1 -1
  257. package/dist/renderer-client.cjs +7 -7
  258. package/dist/renderer-client.d.mts +6 -5
  259. package/dist/renderer-client.d.ts +6 -5
  260. package/dist/renderer-client.mjs +3 -3
  261. package/dist/{request.d-CgNVderU.d.mts → request.d-D-F7o7tb.d.mts} +1 -1
  262. package/dist/{request.d-CTVRZiQv.d.ts → request.d-DRUbOmYD.d.ts} +1 -1
  263. package/dist/request.d.mts +4 -3
  264. package/dist/request.d.ts +4 -3
  265. package/dist/{resolver.d-JnZKKsc5.d.mts → resolver.d-9iKC79CU.d.mts} +1 -1
  266. package/dist/{resolver.d-BHyZgpa7.d.ts → resolver.d-CY6mEa_F.d.ts} +1 -1
  267. package/dist/response.d-B_MtBCnF.d.mts +12 -0
  268. package/dist/response.d-B_MtBCnF.d.ts +12 -0
  269. package/dist/{route-rendering.d-D0bmZVJA.d.mts → route-rendering.d-6smgwT2t.d.mts} +9 -2
  270. package/dist/{route-rendering.d-FDSNtCMg.d.ts → route-rendering.d-KwqM_mlK.d.ts} +9 -2
  271. package/dist/{router.d-DZ3ldniI.d.ts → router.d-B6sesMRD.d.ts} +1 -1
  272. package/dist/{router.d-GRKm_uAV.d.mts → router.d-BYmDeDlp.d.mts} +1 -1
  273. package/dist/{routes.d-CrEy0lJS.d.mts → routes.d-D3aJw1H5.d.mts} +1 -1
  274. package/dist/{routes.d-9GFFNioh.d.ts → routes.d-K-Qg79AA.d.ts} +1 -1
  275. package/dist/routes.d.mts +3 -2
  276. package/dist/routes.d.ts +3 -2
  277. package/dist/{index.d-BNNDpql4.d.ts → routing.d-BxOZ2YWc.d.ts} +1 -2
  278. package/dist/{index.d-BqcfqJvt.d.mts → routing.d-DwSUVZbF.d.mts} +1 -2
  279. package/dist/{rsc-pipeline-J4KKBSCH.cjs → rsc-pipeline-P4PCWDO2.cjs} +14 -13
  280. package/dist/{rsc-pipeline-PJZOVYSY.mjs → rsc-pipeline-R2GOKIMU.mjs} +13 -12
  281. package/dist/{runtime-QDBSE4H6.mjs → runtime-DP5DYGW5.mjs} +12 -11
  282. package/dist/{runtime-OLEO5NXF.cjs → runtime-WA2Q4SLG.cjs} +20 -19
  283. package/dist/{runtime.d-DqXihlxm.d.mts → runtime.d-BFSJf-ww.d.mts} +1 -1
  284. package/dist/{runtime.d-BtL3PCL3.d.ts → runtime.d-B_uPfMjA.d.ts} +2 -2
  285. package/dist/{runtime.d-pqFQBU2N.d.ts → runtime.d-CbdMI0Oy.d.ts} +1 -1
  286. package/dist/{runtime.d-3iJAKptR.d.mts → runtime.d-nUz0HAL4.d.mts} +2 -2
  287. package/dist/server-plugins.cjs +3 -2
  288. package/dist/server-plugins.d.mts +6 -12
  289. package/dist/server-plugins.d.ts +6 -12
  290. package/dist/server-plugins.mjs +2 -1
  291. package/dist/server.cjs +64 -56
  292. package/dist/server.d.mts +23 -14
  293. package/dist/server.d.ts +23 -14
  294. package/dist/server.mjs +40 -32
  295. package/dist/{spa-router.d-Dhvy60p4.d.mts → spa-router.d-D4EDwR20.d.mts} +3 -3
  296. package/dist/{spa-router.d-DhOhaQ-7.d.ts → spa-router.d-mC1D5cTN.d.ts} +3 -3
  297. package/dist/testing.cjs +3 -3
  298. package/dist/testing.d.mts +3 -2
  299. package/dist/testing.d.ts +3 -2
  300. package/dist/testing.mjs +3 -3
  301. package/dist/{types.d-C41ePjvP.d.ts → types.d-wVRlLtBf.d.mts} +1 -1
  302. package/dist/{types.d-C41ePjvP.d.mts → types.d-wVRlLtBf.d.ts} +1 -1
  303. package/dist/{utils.d-BVCMRRau.d.ts → utils.d-A2X3a6z_.d.ts} +1 -1
  304. package/dist/{utils.d-Q8EHCpkF.d.mts → utils.d-DxMzteqE.d.mts} +1 -1
  305. package/dist/version.cjs +2 -2
  306. package/dist/version.mjs +1 -1
  307. package/dist/vite.cjs +37 -29
  308. package/dist/vite.d.mts +28 -6
  309. package/dist/vite.d.ts +28 -6
  310. package/dist/vite.mjs +36 -28
  311. package/package.json +3 -3
  312. package/dist/analyzer-SAJSV6SP.cjs +0 -16
  313. package/dist/response.d-BolW0Vx_.d.mts +0 -10
  314. package/dist/response.d-BolW0Vx_.d.ts +0 -10
@@ -26,7 +26,7 @@ import {
26
26
  import {
27
27
  collectFarmNativeServerFns,
28
28
  findFarmNativeScreenFiles
29
- } from "./chunk-5TOWKGV3.mjs";
29
+ } from "./chunk-2CQC5CMD.mjs";
30
30
  import {
31
31
  generateNativeMCPPluginSource
32
32
  } from "./chunk-KQH2COEJ.mjs";
@@ -41,7 +41,7 @@ import {
41
41
  hasFarmDocsRuntimeAdapter,
42
42
  listFarmDocsAdapterPages,
43
43
  listFarmDocsPagePaths
44
- } from "./chunk-PDQ6EGPK.mjs";
44
+ } from "./chunk-4OD2LXF2.mjs";
45
45
  import {
46
46
  FARM_DOCS_LAST_MODIFIED_MANIFEST,
47
47
  createFarmDocsHandler,
@@ -54,7 +54,7 @@ import {
54
54
  loadFarmDocsPage,
55
55
  resolveFarmDocsContentDir,
56
56
  toFarmDocsMarkdownPage
57
- } from "./chunk-5FBZJJGA.mjs";
57
+ } from "./chunk-LXEJNWF5.mjs";
58
58
  import {
59
59
  generateFarmDocsSearchClientRuntime,
60
60
  isFarmDocsSearchEnabled,
@@ -62,10 +62,10 @@ import {
62
62
  } from "./chunk-ALEUMLJN.mjs";
63
63
  import {
64
64
  CDN_CACHE_CONTROL_HEADERS
65
- } from "./chunk-JL2YW5KX.mjs";
65
+ } from "./chunk-OAEDVXVE.mjs";
66
66
  import {
67
67
  FARM_PRERENDER_ENV
68
- } from "./chunk-ZYCEEE3V.mjs";
68
+ } from "./chunk-QUFENL7Q.mjs";
69
69
  import {
70
70
  loadFarmDocsEngine
71
71
  } from "./chunk-VE3FWJBO.mjs";
@@ -74,7 +74,7 @@ import {
74
74
  getDeployTargetForPreset,
75
75
  hasCustomFarmRouteContext,
76
76
  resolveDeployOutputPath
77
- } from "./chunk-SZORL7EW.mjs";
77
+ } from "./chunk-IYDJNCR7.mjs";
78
78
  import {
79
79
  resolveFarmInstrumentationFile
80
80
  } from "./chunk-57QAQU4F.mjs";
@@ -110,20 +110,20 @@ import {
110
110
  resolveFarmImageServerRuntime,
111
111
  resolveFarmNotFoundComponentPath,
112
112
  resolveFarmRouteRootStrategy
113
- } from "./chunk-IYLZZTP6.mjs";
113
+ } from "./chunk-GUU3IZSM.mjs";
114
114
  import {
115
115
  generateFarmClientPluginEntryCode,
116
116
  hasFarmServerRuntimePlugins,
117
117
  loadTailwindVitePlugin
118
- } from "./chunk-YOHHL2UE.mjs";
118
+ } from "./chunk-I4KPA2C6.mjs";
119
119
  import {
120
120
  PluginManager
121
- } from "./chunk-PJQ5W356.mjs";
121
+ } from "./chunk-Z5ZZAGIH.mjs";
122
122
  import {
123
123
  generateFarmTypeArtifacts,
124
124
  readRouteRenderingDirectiveFromFile,
125
125
  resolveRouteRenderingConfigFromFile
126
- } from "./chunk-G7NBPP7H.mjs";
126
+ } from "./chunk-W2T6NDNP.mjs";
127
127
  import {
128
128
  HOISTED_HEAD_ELEMENT,
129
129
  appMiddlewareMayHandlePath,
@@ -136,7 +136,7 @@ import {
136
136
  layoutsCanCoverSamePage,
137
137
  routeBoundaryCoversDirectory,
138
138
  stripRouteGroups
139
- } from "./chunk-ZPKJPM7K.mjs";
139
+ } from "./chunk-NA77GEIU.mjs";
140
140
  import {
141
141
  FARM_NATIVE_TREE_CONTENT_TYPE
142
142
  } from "./chunk-LLZSYFOM.mjs";
@@ -150,15 +150,15 @@ import {
150
150
  listFarmBuiltInRoutePaths,
151
151
  resolveFarmApiCatalogInput,
152
152
  resolveFarmAppManifestInput
153
- } from "./chunk-ZR2QB45W.mjs";
153
+ } from "./chunk-MITIAOUQ.mjs";
154
154
  import {
155
155
  FARM_DEFAULT_MCP_PATH,
156
156
  createFarmDefaultMCPServer,
157
157
  farmConfigMountsMCP
158
- } from "./chunk-K6SXMVXO.mjs";
158
+ } from "./chunk-JMFTKNBA.mjs";
159
159
  import {
160
160
  isFarmPreviewDeploymentEnvironment
161
- } from "./chunk-2P7UYHZP.mjs";
161
+ } from "./chunk-V25GSH43.mjs";
162
162
  import {
163
163
  FARM_NATIVE_SERVER_FN_PLUGIN
164
164
  } from "./chunk-L4RTTTVE.mjs";
@@ -176,7 +176,7 @@ import {
176
176
  usePackageClientBoundaryCacheFile,
177
177
  usesFarmServerTree,
178
178
  withPackageClientBoundaryCache
179
- } from "./chunk-ULMXZYOA.mjs";
179
+ } from "./chunk-X7LGLF33.mjs";
180
180
  import {
181
181
  generateFarmDocsAdapterClientRuntime,
182
182
  getFarmDocsAdapterConfigModule
@@ -188,7 +188,7 @@ import {
188
188
  import {
189
189
  nitroRouteRulesBelowBasePath,
190
190
  routeRulesToNitroRouteRules
191
- } from "./chunk-R2ZHU37O.mjs";
191
+ } from "./chunk-NLRAQXAA.mjs";
192
192
  import {
193
193
  applyFarmCspHashesToHtml,
194
194
  createFarmCspNonce
@@ -223,14 +223,14 @@ import {
223
223
  } from "./chunk-N33DLJBC.mjs";
224
224
  import {
225
225
  isFarmMarkdownPageFile
226
- } from "./chunk-HEJM46HQ.mjs";
226
+ } from "./chunk-J5ASGNKF.mjs";
227
227
  import {
228
228
  resolveFarmMdxComponentsModulePath,
229
229
  resolveMdxConfig
230
230
  } from "./chunk-UIJOLBUL.mjs";
231
231
  import {
232
232
  getFarmMarkdownAlternatePath
233
- } from "./chunk-IFR74W6S.mjs";
233
+ } from "./chunk-KPJYBSHL.mjs";
234
234
  import {
235
235
  withPlainDiagnostics
236
236
  } from "./chunk-MGKWYPE3.mjs";
@@ -241,7 +241,7 @@ import {
241
241
  import {
242
242
  getFarmIntegrationPluginServerRuntime,
243
243
  getIntegrationProviders
244
- } from "./chunk-AJNBTOVQ.mjs";
244
+ } from "./chunk-WW3LRNQV.mjs";
245
245
  import {
246
246
  FARM_INTEGRATION_API_BASE_PATH_KEY
247
247
  } from "./chunk-M53MIIXY.mjs";
@@ -255,7 +255,7 @@ import {
255
255
  } from "./chunk-MMK4MZUN.mjs";
256
256
  import {
257
257
  APIRouteManager
258
- } from "./chunk-OIOPQ25L.mjs";
258
+ } from "./chunk-E77IA5IF.mjs";
259
259
  import {
260
260
  readFarmI18nCatalogs
261
261
  } from "./chunk-DU4VHHPJ.mjs";
@@ -264,6 +264,7 @@ import {
264
264
  } from "./chunk-NR63PD3P.mjs";
265
265
  import {
266
266
  createFarmRouteRuntimeKey,
267
+ farmRouteRuleMatches,
267
268
  getFarmRouteRuntimeConfig,
268
269
  hasFarmRouteRuntimeControls,
269
270
  mergeFarmRouteRuntimeConfigs,
@@ -282,14 +283,14 @@ import {
282
283
  } from "./chunk-2I6PUKWJ.mjs";
283
284
  import {
284
285
  FARM_VERSION
285
- } from "./chunk-ANMIR6US.mjs";
286
+ } from "./chunk-RJUCNO7R.mjs";
286
287
  import {
287
288
  normalizeFarmTrailingSlashPathname
288
- } from "./chunk-YVPX5PI5.mjs";
289
+ } from "./chunk-4O26BPUY.mjs";
289
290
  import {
290
291
  getFarmPresetRuntime,
291
292
  resolveCloudflareProcessEnvFlags
292
- } from "./chunk-NVOMQLI2.mjs";
293
+ } from "./chunk-IWJONXPF.mjs";
293
294
  import {
294
295
  _runWithFarmCspNonce
295
296
  } from "./chunk-5OFNUETM.mjs";
@@ -303,7 +304,7 @@ import {
303
304
  } from "./chunk-AYP2YFVN.mjs";
304
305
 
305
306
  // src/build/index.ts
306
- import path13 from "path";
307
+ import path14 from "path";
307
308
  import { existsSync as existsSync3 } from "fs";
308
309
 
309
310
  // src/nitro/universal-build.ts
@@ -368,7 +369,7 @@ async function resolveHashedClientJsSrc(clientOutputDir) {
368
369
 
369
370
  // src/nitro/universal-build.ts
370
371
  import os from "os";
371
- import path12 from "path";
372
+ import path13 from "path";
372
373
  import { constants as fsConstants, existsSync as existsSync2, readFileSync, realpathSync as realpathSync2, statSync } from "fs";
373
374
  import { fileURLToPath } from "url";
374
375
  import { builtinModules, createRequire as createRequire2 } from "module";
@@ -612,6 +613,7 @@ function collectFarmClientModulePreloads(bundle, options) {
612
613
  function createFarmClientModulePreloadPlugin(options) {
613
614
  return {
614
615
  name: "farm-client-module-preloads",
616
+ enforce: "post",
615
617
  async generateBundle(_output, bundle) {
616
618
  await fs.mkdir(options.buildDir, { recursive: true });
617
619
  await fs.writeFile(
@@ -686,6 +688,8 @@ function createFarmDocsModulePreloadPlugin(options) {
686
688
  let runtimeModuleIds = [];
687
689
  return {
688
690
  name: "farm-docs-module-preloads",
691
+ // After Vite's CSS plugin deletes stylesheet-only chunks (see client-module-preloads.ts).
692
+ enforce: "post",
689
693
  async buildStart() {
690
694
  const resolved = await Promise.all(
691
695
  options.modules.map((specifier) => this.resolve(specifier, options.importer))
@@ -950,12 +954,65 @@ function escapeRegExp(value) {
950
954
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
951
955
  }
952
956
 
953
- // src/nitro/vercel-assets.ts
957
+ // src/nitro/immutable-assets.ts
958
+ import path7 from "path";
954
959
  var FARM_IMMUTABLE_ASSET_CACHE_CONTROL = "public, max-age=31536000, immutable";
960
+ var FARM_IMMUTABLE_ASSET_MAX_AGE = 31536e3;
961
+ var FARM_IMMUTABLE_ASSET_PATH_SOURCE = "^/(?:(?:assets|chunks)/(?:.+/)*[^/]+|farm-(?:mobile-)?client(?:-boot)?)-h(?:[a-fA-F0-9]{8}|[a-fA-F0-9]{12}|[a-fA-F0-9]{16})\\.(?!(?:[hH][tT][mM][lL]?)$)[^/]+$";
962
+ var FARM_IMMUTABLE_ASSET_PATH = new RegExp(FARM_IMMUTABLE_ASSET_PATH_SOURCE);
963
+ function isFarmImmutableAssetPath(pathname) {
964
+ return FARM_IMMUTABLE_ASSET_PATH.test(pathname);
965
+ }
966
+ var FARM_HASHED_ASSET_DIRS = ["assets", "chunks"];
967
+ var LITERAL_ROUTE_PATH = /^\/[\w.~@/-]+$/;
968
+ function planFarmImmutableAssets(options) {
969
+ const cacheRulePatterns = Object.entries(options.routeRules ?? {}).filter(
970
+ ([, rule]) => Object.keys(rule?.headers ?? {}).some((name) => name.toLowerCase() === "cache-control")
971
+ ).map(([pattern]) => pattern);
972
+ const isImmutable = (file) => isFarmImmutableAssetPath(file) && !cacheRulePatterns.some((pattern) => farmRouteRuleMatches(pattern, file));
973
+ const routeDirs = new Set(
974
+ (options.routePaths ?? []).map((routePath) => routePath.split("/").filter(Boolean)[0])
975
+ );
976
+ const plan = { publicAssets: [], routeRules: {} };
977
+ const addRule = (file) => {
978
+ if (!LITERAL_ROUTE_PATH.test(file)) return;
979
+ plan.routeRules[file] = { headers: { "cache-control": FARM_IMMUTABLE_ASSET_CACHE_CONTROL } };
980
+ };
981
+ const dirFiles = /* @__PURE__ */ new Map();
982
+ for (const file of options.files) {
983
+ const dir = file.split("/")[1];
984
+ if (file.split("/").length > 2 && FARM_HASHED_ASSET_DIRS.includes(dir)) {
985
+ dirFiles.set(dir, [...dirFiles.get(dir) ?? [], file]);
986
+ } else if (isImmutable(file)) {
987
+ addRule(file);
988
+ }
989
+ }
990
+ for (const [dir, files] of dirFiles) {
991
+ if (!routeDirs.has(dir) && files.every(isImmutable)) {
992
+ plan.publicAssets.push({
993
+ dir: path7.join(options.clientOutputDir, dir),
994
+ baseURL: `/${dir}`,
995
+ maxAge: FARM_IMMUTABLE_ASSET_MAX_AGE
996
+ });
997
+ } else {
998
+ for (const file of files) if (isImmutable(file)) addRule(file);
999
+ }
1000
+ }
1001
+ return plan;
1002
+ }
1003
+ async function listFarmClientOutputFiles(dir) {
1004
+ const fs4 = await import("fs/promises");
1005
+ const entries = await fs4.readdir(dir, { recursive: true, withFileTypes: true }).catch(() => []);
1006
+ return entries.filter((entry) => entry.isFile()).map((entry) => {
1007
+ const relative = path7.relative(dir, path7.join(entry.parentPath, entry.name));
1008
+ return `/${relative.split(path7.sep).join("/")}`;
1009
+ });
1010
+ }
1011
+
1012
+ // src/nitro/vercel-assets.ts
955
1013
  function createFarmVercelImmutableAssetRoute() {
956
- const fingerprint = "-h(?:[a-fA-F0-9]{8}|[a-fA-F0-9]{12}|[a-fA-F0-9]{16})";
957
1014
  return {
958
- src: `^/(?:(?:assets|chunks)/(?:.+/)*[^/]+|farm-client)${fingerprint}\\.(?!(?:[hH][tT][mM][lL]?)$)[^/]+$`,
1015
+ src: FARM_IMMUTABLE_ASSET_PATH_SOURCE,
959
1016
  headers: {
960
1017
  "Cache-Control": FARM_IMMUTABLE_ASSET_CACHE_CONTROL
961
1018
  },
@@ -995,7 +1052,7 @@ function createFarmVercelCanonicalSlashRoutes(publicPaths) {
995
1052
  }
996
1053
 
997
1054
  // src/nitro/ssr-public-assets.ts
998
- import path7 from "path";
1055
+ import path8 from "path";
999
1056
  var SERVER_FILE_URL_RE = /new\s+URL\(\s*(["'`])([^"'`\\]+)\1\s*,\s*import\.meta\.url\s*\)/g;
1000
1057
  function resolveBundleFileName(chunkFileName, relativeUrl) {
1001
1058
  if (relativeUrl.startsWith("/") || /^[a-z][a-z\d+.-]*:/i.test(relativeUrl)) return null;
@@ -1004,8 +1061,8 @@ function resolveBundleFileName(chunkFileName, relativeUrl) {
1004
1061
  relativePath = decodeURI(relativePath);
1005
1062
  } catch {
1006
1063
  }
1007
- const fileName = path7.posix.normalize(
1008
- path7.posix.join(path7.posix.dirname(chunkFileName), relativePath)
1064
+ const fileName = path8.posix.normalize(
1065
+ path8.posix.join(path8.posix.dirname(chunkFileName), relativePath)
1009
1066
  );
1010
1067
  return fileName.startsWith("../") ? null : fileName;
1011
1068
  }
@@ -1049,7 +1106,7 @@ function collectServerOnlySSRAssets(bundle) {
1049
1106
  }
1050
1107
  }
1051
1108
  for (const fileName of serverOnly) {
1052
- const name = path7.posix.basename(fileName);
1109
+ const name = path8.posix.basename(fileName);
1053
1110
  if (publicReferenceSources.some((source) => source.includes(name))) {
1054
1111
  serverOnly.delete(fileName);
1055
1112
  }
@@ -1067,7 +1124,7 @@ function assertServerReadSSRAssetsSupported(bundle, preset, root) {
1067
1124
  const output = bundle[fileName];
1068
1125
  const original = output?.type === "asset" ? output.originalFileNames?.[0] : void 0;
1069
1126
  if (!original) return fileName;
1070
- return path7.relative(root, path7.resolve(root, original)).split(path7.sep).join("/");
1127
+ return path8.relative(root, path8.resolve(root, original)).split(path8.sep).join("/");
1071
1128
  });
1072
1129
  throw new Error(
1073
1130
  `The "${preset}" preset cannot run server code that imports ${sources.join(", ")}. Server code reads such a file from beside the server bundle, and this edge runtime deploys no such file (Cloudflare Workers and Vercel Edge also refuse to compile WebAssembly from bytes). Load it in the browser instead, from client code with the @farm.js/wasm plugin or a "?url" import, or deploy to a Node target such as node-server, bun, vercel or netlify.`
@@ -1083,7 +1140,7 @@ function createServerReadSSRAssetsPlugin(bundle, ssrOutputDir) {
1083
1140
  },
1084
1141
  transform(code, id) {
1085
1142
  if (!code.includes("import.meta.url")) return null;
1086
- const chunkFileName = path7.relative(ssrOutputDir, id.split("?", 1)[0]).split(path7.sep).join("/");
1143
+ const chunkFileName = path8.relative(ssrOutputDir, id.split("?", 1)[0]).split(path8.sep).join("/");
1087
1144
  if (bundle[chunkFileName]?.type !== "chunk") return null;
1088
1145
  let changed = false;
1089
1146
  const transformed = replaceServerFileReferences(
@@ -1111,10 +1168,10 @@ function createServerReadSSRAssetsPlugin(bundle, ssrOutputDir) {
1111
1168
 
1112
1169
  // src/nitro/netlify-entry.ts
1113
1170
  import { existsSync } from "fs";
1114
- import path8 from "path";
1171
+ import path9 from "path";
1115
1172
  function resolveNitroNetlifyEntry(nitroRuntimeEntry) {
1116
- const entry = path8.join(
1117
- path8.dirname(nitroRuntimeEntry),
1173
+ const entry = path9.join(
1174
+ path9.dirname(nitroRuntimeEntry),
1118
1175
  "..",
1119
1176
  "presets",
1120
1177
  "netlify",
@@ -1126,7 +1183,7 @@ function resolveNitroNetlifyEntry(nitroRuntimeEntry) {
1126
1183
  `[Farm.js] Could not find Nitro's Netlify function entry at ${entry}. Farm wraps it so private responses are never cached by Netlify's CDN; reinstall dependencies or report the installed Nitro version.`
1127
1184
  );
1128
1185
  }
1129
- return entry.split(path8.sep).join("/");
1186
+ return entry.split(path9.sep).join("/");
1130
1187
  }
1131
1188
  function createFarmNetlifyEntry(options) {
1132
1189
  return `
@@ -1137,10 +1194,19 @@ const CREDENTIAL_VARY = /(?:^|,)\\s*(?:\\*|cookie|authorization)\\s*(?:,|$)/i;
1137
1194
  // What Nitro's entry sets when the response has no Cache-Control of its own.
1138
1195
  const NITRO_DEFAULT_CACHE_CONTROL = "public, max-age=0, must-revalidate";
1139
1196
 
1197
+ // The deployment cookie names a release, not a visitor (see @farm.js/core/deployment).
1198
+ function hasVisitorCookies(cookieHeader) {
1199
+ if (!cookieHeader) return false;
1200
+ return cookieHeader.split(";").some((part) => {
1201
+ const name = part.split("=")[0].trim();
1202
+ return name !== "" && name !== "__farm_deployment";
1203
+ });
1204
+ }
1205
+
1140
1206
  function isSharedCacheable(request, response) {
1141
1207
  return (
1142
1208
  response.status === 200 &&
1143
- !request.headers.has("cookie") &&
1209
+ !hasVisitorCookies(request.headers.get("cookie")) &&
1144
1210
  !request.headers.has("authorization") &&
1145
1211
  !response.headers.has("set-cookie") &&
1146
1212
  !PRIVATE_CACHE_DIRECTIVE.test(response.headers.get("cache-control") || "") &&
@@ -1167,7 +1233,7 @@ export default async function farmNetlifyHandler(request, context) {
1167
1233
 
1168
1234
  // src/build/strip-platform-config.ts
1169
1235
  import { realpathSync } from "fs";
1170
- import path9 from "path";
1236
+ import path10 from "path";
1171
1237
  var PLATFORM_CONFIG_KEYS = /* @__PURE__ */ new Set(["desktop", "mobile"]);
1172
1238
  var CONFIG_FACTORIES = /* @__PURE__ */ new Set(["defineConfig", "defineFarmConfig"]);
1173
1239
  function isConfigObject(node) {
@@ -1241,11 +1307,11 @@ function realPath(file) {
1241
1307
  try {
1242
1308
  return realpathSync(file);
1243
1309
  } catch {
1244
- return path9.resolve(file);
1310
+ return path10.resolve(file);
1245
1311
  }
1246
1312
  }
1247
1313
  function farmStripPlatformConfigPlugin(configFiles) {
1248
- const files = new Set(configFiles.flatMap((file) => [path9.resolve(file), realPath(file)]));
1314
+ const files = new Set(configFiles.flatMap((file) => [path10.resolve(file), realPath(file)]));
1249
1315
  return {
1250
1316
  name: "farm:strip-platform-config",
1251
1317
  // Before the TypeScript transform, so its import elision also drops imports only the
@@ -1255,9 +1321,9 @@ function farmStripPlatformConfigPlugin(configFiles) {
1255
1321
  filter: { id: fileNamePattern(configFiles) },
1256
1322
  async handler(code, id) {
1257
1323
  const file = id.split("?", 1)[0];
1258
- if (!files.has(path9.resolve(file)) && !files.has(realPath(file))) return null;
1324
+ if (!files.has(path10.resolve(file)) && !files.has(realPath(file))) return null;
1259
1325
  const { parseAst } = await import("rolldown/parseAst");
1260
- const extension = path9.extname(file).slice(1);
1326
+ const extension = path10.extname(file).slice(1);
1261
1327
  const lang = /^[cm]?tsx?$/.test(extension) ? extension.endsWith("x") ? "tsx" : "ts" : extension.endsWith("x") ? "jsx" : "js";
1262
1328
  const stripped = stripPlatformConfigSource(code, (source) => parseAst(source, { lang }));
1263
1329
  return stripped === null ? null : { code: stripped, map: null };
@@ -1268,7 +1334,7 @@ function farmStripPlatformConfigPlugin(configFiles) {
1268
1334
 
1269
1335
  // src/nitro/client-sourcemaps.ts
1270
1336
  import fs3 from "fs/promises";
1271
- import path10 from "path";
1337
+ import path11 from "path";
1272
1338
  var FARM_CLIENT_SOURCEMAPS_DIR = "client-sourcemaps";
1273
1339
  function resolveFarmClientSourcemap(sourcemap) {
1274
1340
  return sourcemap ? "hidden" : false;
@@ -1289,8 +1355,8 @@ function createFarmPrivateClientSourcemapsPlugin(options) {
1289
1355
  async writeBundle() {
1290
1356
  await fs3.rm(options.outDir, { recursive: true, force: true });
1291
1357
  for (const [fileName, source] of maps) {
1292
- const target = path10.join(options.outDir, fileName);
1293
- await fs3.mkdir(path10.dirname(target), { recursive: true });
1358
+ const target = path11.join(options.outDir, fileName);
1359
+ await fs3.mkdir(path11.dirname(target), { recursive: true });
1294
1360
  await fs3.writeFile(target, source);
1295
1361
  }
1296
1362
  }
@@ -1373,7 +1439,7 @@ async function readMiddlewareFileConfig(filePath) {
1373
1439
 
1374
1440
  // src/nitro/vercel-edge-middleware.ts
1375
1441
  import { createRequire, isBuiltin } from "module";
1376
- import path11 from "path";
1442
+ import path12 from "path";
1377
1443
  import { gzipSync } from "zlib";
1378
1444
  var FARM_VERCEL_EDGE_MIDDLEWARE_FUNCTION = "_farm_middleware";
1379
1445
  var FARM_VERCEL_EDGE_NOT_FOUND_PATH = "/__farm/not-found";
@@ -1429,21 +1495,21 @@ ${modules.join("\n")}
1429
1495
  `;
1430
1496
  }
1431
1497
  async function resolveFarmCoreDir(root, fs4) {
1432
- const runtimeEntry = createRequire(path11.join(root, "package.json")).resolve(
1498
+ const runtimeEntry = createRequire(path12.join(root, "package.json")).resolve(
1433
1499
  "@farm.js/core/internal/vercel-edge-middleware"
1434
1500
  );
1435
- return fs4.realpath(path11.resolve(path11.dirname(runtimeEntry), "..", ".."));
1501
+ return fs4.realpath(path12.resolve(path12.dirname(runtimeEntry), "..", ".."));
1436
1502
  }
1437
1503
  function edgeNodeModulesPlugin(coreDir, unsupported) {
1438
1504
  const streamStub = "\0farm-edge-node-stream";
1439
- const corePrefix = coreDir + path11.sep;
1505
+ const corePrefix = coreDir + path12.sep;
1440
1506
  return {
1441
1507
  name: "farm-vercel-edge-node-modules",
1442
1508
  resolveId(source, importer) {
1443
1509
  if (!isBuiltin(source)) return null;
1444
1510
  const name = source.replace(/^node:/, "").split("/")[0];
1445
1511
  if (EDGE_NODE_MODULES.has(name)) return { id: `node:${name}`, external: true };
1446
- if (name === "stream" && importer && path11.resolve(importer).startsWith(corePrefix)) {
1512
+ if (name === "stream" && importer && path12.resolve(importer).startsWith(corePrefix)) {
1447
1513
  return streamStub;
1448
1514
  }
1449
1515
  unsupported.add(`${source} (imported by ${importer ?? "the entry"})`);
@@ -1457,13 +1523,13 @@ function edgeNodeModulesPlugin(coreDir, unsupported) {
1457
1523
  }
1458
1524
  async function writeFarmVercelEdgeMiddlewareFunction(options) {
1459
1525
  const { root, outputDir, buildDir, config, routes, guardedPages, fs: fs4 } = options;
1460
- const functionDir = path11.join(
1526
+ const functionDir = path12.join(
1461
1527
  outputDir,
1462
1528
  "functions",
1463
1529
  `${FARM_VERCEL_EDGE_MIDDLEWARE_FUNCTION}.func`
1464
1530
  );
1465
- const entryPath = path11.join(buildDir, "vercel-edge-middleware-entry.mjs");
1466
- await fs4.mkdir(path11.dirname(entryPath), { recursive: true });
1531
+ const entryPath = path12.join(buildDir, "vercel-edge-middleware-entry.mjs");
1532
+ await fs4.mkdir(path12.dirname(entryPath), { recursive: true });
1467
1533
  await fs4.writeFile(
1468
1534
  entryPath,
1469
1535
  generateFarmVercelEdgeMiddlewareEntry(routes, config, guardedPages)
@@ -1512,9 +1578,9 @@ Remove them from the middleware (Edge provides ${[...EDGE_NODE_MODULES].join(",
1512
1578
  }
1513
1579
  await fs4.rm(functionDir, { recursive: true, force: true });
1514
1580
  await fs4.mkdir(functionDir, { recursive: true });
1515
- await fs4.writeFile(path11.join(functionDir, "index.js"), code);
1581
+ await fs4.writeFile(path12.join(functionDir, "index.js"), code);
1516
1582
  await fs4.writeFile(
1517
- path11.join(functionDir, ".vc-config.json"),
1583
+ path12.join(functionDir, ".vc-config.json"),
1518
1584
  `${JSON.stringify({ runtime: "edge", entrypoint: "index.js" }, null, 2)}
1519
1585
  `
1520
1586
  );
@@ -1536,7 +1602,7 @@ async function readFarmNativeStylesheets(clientOutputDir, clientCssHref) {
1536
1602
  try {
1537
1603
  return {
1538
1604
  [clientCssHref]: await fs4.readFile(
1539
- path12.join(clientOutputDir, clientCssHref.slice(1)),
1605
+ path13.join(clientOutputDir, clientCssHref.slice(1)),
1540
1606
  "utf8"
1541
1607
  )
1542
1608
  };
@@ -1551,18 +1617,18 @@ function preloadFarmNitroBuilder() {
1551
1617
  );
1552
1618
  }
1553
1619
  var _filename = typeof import.meta.url !== "undefined" ? fileURLToPath(import.meta.url) : "";
1554
- var _dirname = path12.dirname(_filename);
1620
+ var _dirname = path13.dirname(_filename);
1555
1621
  function findFarmCoreRoot(from) {
1556
- let dir = path12.dirname(from);
1557
- while (dir !== path12.dirname(dir)) {
1558
- const manifest = path12.join(dir, "package.json");
1622
+ let dir = path13.dirname(from);
1623
+ while (dir !== path13.dirname(dir)) {
1624
+ const manifest = path13.join(dir, "package.json");
1559
1625
  if (existsSync2(manifest)) {
1560
1626
  try {
1561
1627
  if (JSON.parse(readFileSync(manifest, "utf8")).name === "@farm.js/core") return dir;
1562
1628
  } catch {
1563
1629
  }
1564
1630
  }
1565
- dir = path12.dirname(dir);
1631
+ dir = path13.dirname(dir);
1566
1632
  }
1567
1633
  return null;
1568
1634
  }
@@ -1572,16 +1638,16 @@ function toModulePath(file) {
1572
1638
  return process.platform === "win32" ? normalized.toLowerCase() : normalized;
1573
1639
  }
1574
1640
  function findInstalledPackageDir(name, from) {
1575
- for (let dir = from; ; dir = path12.dirname(dir)) {
1576
- const candidate = path12.join(dir, "node_modules", name);
1577
- if (existsSync2(path12.join(candidate, "package.json"))) {
1641
+ for (let dir = from; ; dir = path13.dirname(dir)) {
1642
+ const candidate = path13.join(dir, "node_modules", name);
1643
+ if (existsSync2(path13.join(candidate, "package.json"))) {
1578
1644
  try {
1579
1645
  return realpathSync2(candidate);
1580
1646
  } catch {
1581
1647
  return null;
1582
1648
  }
1583
1649
  }
1584
- if (dir === path12.dirname(dir)) return null;
1650
+ if (dir === path13.dirname(dir)) return null;
1585
1651
  }
1586
1652
  }
1587
1653
  function collectFarmDependencyDirs(root) {
@@ -1592,7 +1658,7 @@ function collectFarmDependencyDirs(root) {
1592
1658
  seen.add(dir);
1593
1659
  let manifest;
1594
1660
  try {
1595
- manifest = JSON.parse(readFileSync(path12.join(dir, "package.json"), "utf8"));
1661
+ manifest = JSON.parse(readFileSync(path13.join(dir, "package.json"), "utf8"));
1596
1662
  } catch {
1597
1663
  return;
1598
1664
  }
@@ -1603,7 +1669,7 @@ function collectFarmDependencyDirs(root) {
1603
1669
  if (farmCoreRoot) visit(realpathSync2(farmCoreRoot));
1604
1670
  queue.push({ name: "@farm.js/core", from: root });
1605
1671
  try {
1606
- const manifest = JSON.parse(readFileSync(path12.join(root, "package.json"), "utf8"));
1672
+ const manifest = JSON.parse(readFileSync(path13.join(root, "package.json"), "utf8"));
1607
1673
  for (const field of ["dependencies", "devDependencies"]) {
1608
1674
  for (const name of Object.keys(manifest[field] ?? {})) {
1609
1675
  if (name.startsWith("@farm.js/")) queue.push({ name, from: root });
@@ -1670,17 +1736,17 @@ var FARM_SSR_PACKAGE_IMPORT = "#farm-ssr-entry";
1670
1736
  var FARM_SSR_OUTPUT_DIR = "farm-ssr";
1671
1737
  var FARM_CLIENT_BUILD_TARGET = ["es2020", "edge88", "firefox78", "chrome87", "safari14"];
1672
1738
  function resolveNitroRuntimeDependency(root, specifier) {
1673
- return createRequire2(resolveNitroPackageEntry(root)).resolve(specifier).split(path12.sep).join("/");
1739
+ return createRequire2(resolveNitroPackageEntry(root)).resolve(specifier).split(path13.sep).join("/");
1674
1740
  }
1675
1741
  function resolveNitroInternalRuntimeAliases(root) {
1676
1742
  const nitroEntry = resolveNitroPackageEntry(root);
1677
- const runtimeDir = path12.dirname(nitroEntry);
1743
+ const runtimeDir = path13.dirname(nitroEntry);
1678
1744
  const nitroRequire = createRequire2(nitroEntry);
1679
1745
  return {
1680
1746
  ...Object.fromEntries(
1681
1747
  ["app", "error/hooks", "runtime-config", "shutdown", "task"].map((moduleName) => [
1682
1748
  `#nitro/runtime/${moduleName}`,
1683
- path12.join(runtimeDir, "internal", `${moduleName}.mjs`).split(path12.sep).join("/")
1749
+ path13.join(runtimeDir, "internal", `${moduleName}.mjs`).split(path13.sep).join("/")
1684
1750
  ])
1685
1751
  ),
1686
1752
  // Farm's generated workflow and cron wrappers live under `.farm/` and
@@ -1689,7 +1755,7 @@ function resolveNitroInternalRuntimeAliases(root) {
1689
1755
  ...Object.fromEntries(
1690
1756
  ["nitro/app", "nitro/h3", "nitro/task"].map((specifier) => [
1691
1757
  specifier,
1692
- nitroRequire.resolve(specifier).split(path12.sep).join("/")
1758
+ nitroRequire.resolve(specifier).split(path13.sep).join("/")
1693
1759
  ])
1694
1760
  )
1695
1761
  };
@@ -1700,7 +1766,7 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
1700
1766
  name: "farm-prerender-runtime-resolver",
1701
1767
  async resolveId(id, _importer, options) {
1702
1768
  if (options.custom?.farmPrerenderRuntimeResolve) return null;
1703
- if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || path12.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
1769
+ if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || path13.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
1704
1770
  return null;
1705
1771
  }
1706
1772
  if (nitroEntry === void 0) {
@@ -1723,7 +1789,7 @@ function createFarmStorageModuleRegistration(config) {
1723
1789
  const modules = _collectFarmStorageModules(config.storage);
1724
1790
  if (modules.length === 0) return "";
1725
1791
  const root = config.root || process.cwd();
1726
- const projectRequire = createRequire2(path12.join(root, "package.json"));
1792
+ const projectRequire = createRequire2(path13.join(root, "package.json"));
1727
1793
  let runtimeRequire = projectRequire;
1728
1794
  try {
1729
1795
  runtimeRequire = createRequire2(projectRequire.resolve("@farm.js/core"));
@@ -1750,7 +1816,7 @@ ${loaders.join("\n")}
1750
1816
  });` : "";
1751
1817
  }
1752
1818
  function resolveNitroPackageEntry(root) {
1753
- const projectRequire = createRequire2(path12.join(root, "package.json"));
1819
+ const projectRequire = createRequire2(path13.join(root, "package.json"));
1754
1820
  let runtimeRequire = projectRequire;
1755
1821
  try {
1756
1822
  runtimeRequire = createRequire2(projectRequire.resolve("@farm.js/core"));
@@ -1820,7 +1886,7 @@ function createFarmReactWebServerAlias(hasEdgeBuild) {
1820
1886
  }
1821
1887
  function hasReactDomEdgeServerBuild(root) {
1822
1888
  try {
1823
- createRequire2(path12.join(root, "package.json")).resolve("react-dom/server.edge");
1889
+ createRequire2(path13.join(root, "package.json")).resolve("react-dom/server.edge");
1824
1890
  return true;
1825
1891
  } catch {
1826
1892
  return false;
@@ -1851,9 +1917,9 @@ function isNitroRollupExternal(id) {
1851
1917
  var FARM_METADATA_IMAGE_WASM_PREFIX = "\0farm-metadata-image-wasm:";
1852
1918
  var FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID = "\0farm-omitted-metadata-image-runtime";
1853
1919
  function isFarmCoreModule(file) {
1854
- let dir = path12.dirname(file.split("?", 1)[0]);
1855
- while (dir !== path12.dirname(dir)) {
1856
- const manifest = path12.join(dir, "package.json");
1920
+ let dir = path13.dirname(file.split("?", 1)[0]);
1921
+ while (dir !== path13.dirname(dir)) {
1922
+ const manifest = path13.join(dir, "package.json");
1857
1923
  if (existsSync2(manifest)) {
1858
1924
  try {
1859
1925
  return JSON.parse(readFileSync(manifest, "utf8")).name === "@farm.js/core";
@@ -1861,7 +1927,7 @@ function isFarmCoreModule(file) {
1861
1927
  return false;
1862
1928
  }
1863
1929
  }
1864
- dir = path12.dirname(dir);
1930
+ dir = path13.dirname(dir);
1865
1931
  }
1866
1932
  return false;
1867
1933
  }
@@ -1872,7 +1938,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
1872
1938
  filter: { id: exactIdPattern(["@vercel/og"]) },
1873
1939
  handler(source, importer) {
1874
1940
  if (source !== "@vercel/og") return null;
1875
- const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(path12.basename(importer.split("?", 1)[0]));
1941
+ const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(path13.basename(importer.split("?", 1)[0]));
1876
1942
  if (fromCoreRuntime) return FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID;
1877
1943
  return externalizeOtherImports ? { id: source, external: true } : null;
1878
1944
  }
@@ -1893,14 +1959,14 @@ export class ImageResponse {
1893
1959
  };
1894
1960
  }
1895
1961
  function readVercelOgManifest(file) {
1896
- let dir = path12.dirname(file.split("?", 1)[0]);
1897
- while (dir !== path12.dirname(dir)) {
1898
- const manifestPath = path12.join(dir, "package.json");
1962
+ let dir = path13.dirname(file.split("?", 1)[0]);
1963
+ while (dir !== path13.dirname(dir)) {
1964
+ const manifestPath = path13.join(dir, "package.json");
1899
1965
  if (existsSync2(manifestPath)) {
1900
1966
  const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
1901
1967
  return manifest.name === "@vercel/og" ? { dir, manifest } : null;
1902
1968
  }
1903
- dir = path12.dirname(dir);
1969
+ dir = path13.dirname(dir);
1904
1970
  }
1905
1971
  return null;
1906
1972
  }
@@ -1908,7 +1974,7 @@ function resolveVercelOgConditionEntry(resolvedId, condition) {
1908
1974
  const vercelOg = readVercelOgManifest(resolvedId);
1909
1975
  const entry = vercelOg?.manifest.exports?.["."]?.[condition];
1910
1976
  const file = typeof entry === "string" ? entry : entry?.default;
1911
- return vercelOg && typeof file === "string" ? path12.join(vercelOg.dir, file) : null;
1977
+ return vercelOg && typeof file === "string" ? path13.join(vercelOg.dir, file) : null;
1912
1978
  }
1913
1979
  function createEdgeMetadataImageRuntimePlugin({
1914
1980
  condition,
@@ -1926,7 +1992,7 @@ function createEdgeMetadataImageRuntimePlugin({
1926
1992
  if (wasm !== "module" || !source.endsWith(".wasm?module") || !importer?.replace(/\\/g, "/").includes("/@vercel/og/")) {
1927
1993
  return null;
1928
1994
  }
1929
- const resolvedPath = path12.resolve(path12.dirname(importer.split("?", 1)[0]), source);
1995
+ const resolvedPath = path13.resolve(path13.dirname(importer.split("?", 1)[0]), source);
1930
1996
  return { id: toPosixPath(resolvedPath), external: "absolute" };
1931
1997
  }
1932
1998
  };
@@ -1941,7 +2007,7 @@ function createVercelOgFontInlinePlugin(runtime = "Cloudflare Workers") {
1941
2007
  return null;
1942
2008
  }
1943
2009
  const inlined = code.replace(VERCEL_OG_FONT_FETCH, (_match, _quote, request) => {
1944
- const encoded = readFileSync(path12.resolve(path12.dirname(file), request)).toString("base64");
2010
+ const encoded = readFileSync(path13.resolve(path13.dirname(file), request)).toString("base64");
1945
2011
  return `Promise.resolve({ arrayBuffer: () => Uint8Array.from(atob(${JSON.stringify(encoded)}), (character) => character.charCodeAt(0)).buffer })`;
1946
2012
  });
1947
2013
  if (inlined !== code) return { code: inlined, map: null };
@@ -1960,7 +2026,7 @@ function createMetadataImageWasmPlugin() {
1960
2026
  return null;
1961
2027
  }
1962
2028
  const requestPath = source.slice(0, -"?module".length);
1963
- const resolvedPath = path12.isAbsolute(requestPath) ? requestPath : path12.resolve(path12.dirname(importer.split("?", 1)[0]), requestPath);
2029
+ const resolvedPath = path13.isAbsolute(requestPath) ? requestPath : path13.resolve(path13.dirname(importer.split("?", 1)[0]), requestPath);
1964
2030
  return `${FARM_METADATA_IMAGE_WASM_PREFIX}${resolvedPath}`;
1965
2031
  },
1966
2032
  load(id) {
@@ -1985,11 +2051,11 @@ function collectSSRExternalPackages(ssrBundle) {
1985
2051
  for (const importId of [...output.imports, ...output.dynamicImports]) {
1986
2052
  const normalizedImportId = importId.replace(/\\/g, "/");
1987
2053
  const normalizedId = normalizedImportId.replace(/^\.\//, "");
1988
- const resolvedRelativeId = normalizedImportId.startsWith("./") || normalizedImportId.startsWith("../") ? path12.posix.normalize(path12.posix.join(path12.posix.dirname(fileName), normalizedImportId)) : null;
2054
+ const resolvedRelativeId = normalizedImportId.startsWith("./") || normalizedImportId.startsWith("../") ? path13.posix.normalize(path13.posix.join(path13.posix.dirname(fileName), normalizedImportId)) : null;
1989
2055
  if (emittedFiles.has(normalizedId) || resolvedRelativeId !== null && emittedFiles.has(resolvedRelativeId) || NODE_BUILTIN_MODULES.has(importId) || importId.startsWith("node:")) {
1990
2056
  continue;
1991
2057
  }
1992
- if (path12.isAbsolute(importId) || /^[A-Za-z]:[\\/]/.test(importId) || importId.startsWith("#") || importId.startsWith("\0")) {
2058
+ if (path13.isAbsolute(importId) || /^[A-Za-z]:[\\/]/.test(importId) || importId.startsWith("#") || importId.startsWith("\0")) {
1993
2059
  externalPackages.add(importId);
1994
2060
  continue;
1995
2061
  }
@@ -2001,15 +2067,15 @@ function collectSSRExternalPackages(ssrBundle) {
2001
2067
  return externalPackages;
2002
2068
  }
2003
2069
  function createExternalSSRBundlePlugin(nitroEntryPath, ssrOutputDir, ssrEntryFile) {
2004
- const resolvedNitroEntry = path12.resolve(nitroEntryPath);
2005
- const resolvedSSREntry = path12.resolve(ssrOutputDir, ssrEntryFile);
2070
+ const resolvedNitroEntry = path13.resolve(nitroEntryPath);
2071
+ const resolvedSSREntry = path13.resolve(ssrOutputDir, ssrEntryFile);
2006
2072
  return {
2007
2073
  name: "farm-externalize-prebuilt-ssr",
2008
2074
  resolveId(source, importer) {
2009
- if (!importer || path12.resolve(importer) !== resolvedNitroEntry) {
2075
+ if (!importer || path13.resolve(importer) !== resolvedNitroEntry) {
2010
2076
  return null;
2011
2077
  }
2012
- const resolvedImport = path12.resolve(path12.dirname(importer), source);
2078
+ const resolvedImport = path13.resolve(path13.dirname(importer), source);
2013
2079
  if (resolvedImport !== resolvedSSREntry) return null;
2014
2080
  return { id: FARM_SSR_PACKAGE_IMPORT, external: true };
2015
2081
  }
@@ -2142,13 +2208,13 @@ function trimSlashes(value) {
2142
2208
  function resolveBuildDocsContentDir(docs, root, srcDir) {
2143
2209
  const configuredContentDir = docs.contentDir || docs.config.contentDir;
2144
2210
  if (typeof configuredContentDir === "string" && configuredContentDir.trim()) {
2145
- const contentDir = path12.isAbsolute(configuredContentDir) ? configuredContentDir : path12.join(root, configuredContentDir);
2211
+ const contentDir = path13.isAbsolute(configuredContentDir) ? configuredContentDir : path13.join(root, configuredContentDir);
2146
2212
  return existsSync2(contentDir) ? contentDir : null;
2147
2213
  }
2148
2214
  const entryDir = docs.config.entry || trimSlashes(docs.entry) || "docs";
2149
- const appDocsDir = path12.join(root, srcDir || "src", "app", entryDir);
2215
+ const appDocsDir = path13.join(root, srcDir || "src", "app", entryDir);
2150
2216
  if (existsSync2(appDocsDir)) return appDocsDir;
2151
- const rootDocsDir = path12.join(root, entryDir);
2217
+ const rootDocsDir = path13.join(root, entryDir);
2152
2218
  return existsSync2(rootDocsDir) ? rootDocsDir : null;
2153
2219
  }
2154
2220
  function hasProjectPostcssConfig(root) {
@@ -2165,7 +2231,7 @@ function hasProjectPostcssConfig(root) {
2165
2231
  ".postcssrc.mjs",
2166
2232
  ".postcssrc.ts"
2167
2233
  ];
2168
- const projectRequire = createRequire2(path12.join(root, "package.json"));
2234
+ const projectRequire = createRequire2(path13.join(root, "package.json"));
2169
2235
  return candidates.some((file) => {
2170
2236
  try {
2171
2237
  projectRequire.resolve(`./${file}`);
@@ -2188,7 +2254,7 @@ async function findFarmConfigPath(root) {
2188
2254
  "config.mjs"
2189
2255
  ];
2190
2256
  for (const candidate of candidates) {
2191
- const resolvedPath = path12.join(root, candidate);
2257
+ const resolvedPath = path13.join(root, candidate);
2192
2258
  try {
2193
2259
  await fs4.access(resolvedPath);
2194
2260
  return resolvedPath;
@@ -2225,7 +2291,7 @@ async function discoverMiddlewareRoutes(appDir) {
2225
2291
  discovered.push({
2226
2292
  path: routePath,
2227
2293
  directory,
2228
- filePath: path12.join(dir, middlewareFile.name)
2294
+ filePath: path13.join(dir, middlewareFile.name)
2229
2295
  });
2230
2296
  }
2231
2297
  for (const entry of entries) {
@@ -2233,7 +2299,7 @@ async function discoverMiddlewareRoutes(appDir) {
2233
2299
  continue;
2234
2300
  }
2235
2301
  await walk(
2236
- path12.join(dir, entry.name),
2302
+ path13.join(dir, entry.name),
2237
2303
  appendMiddlewareRoutePath(routePath, entry.name),
2238
2304
  appendMiddlewareDirectory(directory, entry.name),
2239
2305
  discovered
@@ -2263,7 +2329,6 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
2263
2329
  assertFarmDocsRuntimeSupported(config, preset);
2264
2330
  const srcDir = config.srcDir || "src";
2265
2331
  const distDir = config.distDir || ".farm";
2266
- const deployOutputDir = resolveDeployOutputPath(root, config.deploy.outputDir);
2267
2332
  const lifecyclePluginManager = options.pluginManager;
2268
2333
  const productionViteResultPromise = Promise.allSettled([
2269
2334
  Promise.resolve(options.productionVite ?? loadFarmProductionVite())
@@ -2309,7 +2374,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
2309
2374
  logger.info(`\u{1F4CB} Found ${pageRoutes.length} page routes`);
2310
2375
  const fs4 = await import("fs/promises");
2311
2376
  const layoutRoutes = [];
2312
- const appDir = path12.join(root, srcDir, "app");
2377
+ const appDir = path13.join(root, srcDir, "app");
2313
2378
  async function findLayoutsForClient(dir, routePrefix = "/") {
2314
2379
  try {
2315
2380
  const entries = await fs4.readdir(dir, { withFileTypes: true });
@@ -2317,11 +2382,11 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
2317
2382
  if (entry.isFile() && entry.name.match(/^layout\.(tsx?|jsx?|vue|svelte)$/)) {
2318
2383
  layoutRoutes.push({
2319
2384
  pattern: routePrefix,
2320
- modulePath: path12.join(dir, entry.name)
2385
+ modulePath: path13.join(dir, entry.name)
2321
2386
  });
2322
2387
  } else if (entry.isDirectory() && !entry.name.startsWith(".") && !entry.name.startsWith("_")) {
2323
2388
  const childPrefix = routePrefix === "/" ? `/${entry.name}` : `${routePrefix}/${entry.name}`;
2324
- await findLayoutsForClient(path12.join(dir, entry.name), childPrefix);
2389
+ await findLayoutsForClient(path13.join(dir, entry.name), childPrefix);
2325
2390
  }
2326
2391
  }
2327
2392
  } catch {
@@ -2345,7 +2410,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
2345
2410
  );
2346
2411
  }
2347
2412
  const hydrationPlanCache = /* @__PURE__ */ new Map();
2348
- const clientOutputDir = path12.join(root, distDir, "client");
2413
+ const clientOutputDir = path13.join(root, distDir, "client");
2349
2414
  const [productionViteResult] = await productionViteResultPromise;
2350
2415
  if (productionViteResult.status === "rejected") {
2351
2416
  await routeRuntimeManifestResultPromise;
@@ -2470,10 +2535,10 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
2470
2535
  lifecyclePluginManager
2471
2536
  );
2472
2537
  const runtimeManifestPath = await writeFarmRouteRuntimeManifest(
2473
- path12.join(root, distDir),
2538
+ path13.join(root, distDir),
2474
2539
  routeRuntimeManifest
2475
2540
  );
2476
- logger.info(`\u{1F4CB} Route runtime manifest: ${path12.relative(root, runtimeManifestPath)}`);
2541
+ logger.info(`\u{1F4CB} Route runtime manifest: ${path13.relative(root, runtimeManifestPath)}`);
2477
2542
  } catch (error) {
2478
2543
  if (lifecyclePluginManager) {
2479
2544
  await lifecyclePluginManager.runHookParallel("onError", {
@@ -2494,13 +2559,16 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
2494
2559
  function shouldBuildFarmMobileClient(config) {
2495
2560
  return Boolean(config.mobileClient) && !config.desktop;
2496
2561
  }
2497
- function varyFarmNitroCacheRulesByShell(rules) {
2562
+ function varyFarmNitroCacheRules(rules, headerNames) {
2563
+ if (headerNames.length === 0) return rules;
2498
2564
  return Object.fromEntries(
2499
2565
  Object.entries(rules).map(([source, rule]) => {
2500
2566
  const cached = rule?.swr !== void 0 && rule.swr !== false || rule?.cache !== void 0 && rule.cache !== false;
2501
2567
  if (!cached || rule.cache === false) return [source, rule];
2502
2568
  const cache = rule.cache && typeof rule.cache === "object" ? rule.cache : {};
2503
- const varies = [...Array.isArray(cache.varies) ? cache.varies : [], "x-farm-shell"];
2569
+ const varies = [
2570
+ .../* @__PURE__ */ new Set([...Array.isArray(cache.varies) ? cache.varies : [], ...headerNames])
2571
+ ];
2504
2572
  return [source, { ...rule, cache: { ...cache, varies } }];
2505
2573
  })
2506
2574
  );
@@ -2514,8 +2582,8 @@ async function writeSSRAssetsToClient(bundle, outputDir) {
2514
2582
  await mergeBuiltFontCss(outputDir, output.source);
2515
2583
  continue;
2516
2584
  }
2517
- const filePath = path12.join(outputDir, fileName);
2518
- await fs4.mkdir(path12.dirname(filePath), { recursive: true });
2585
+ const filePath = path13.join(outputDir, fileName);
2586
+ await fs4.mkdir(path13.dirname(filePath), { recursive: true });
2519
2587
  await fs4.writeFile(filePath, output.source);
2520
2588
  }
2521
2589
  }
@@ -2523,15 +2591,15 @@ async function copyFarmDocsFontAssetsToClient(root, outputDir) {
2523
2591
  const fs4 = await import("fs/promises");
2524
2592
  await Promise.all(
2525
2593
  resolveFarmDocsFontAssets(root).map(async ({ sourcePath, url }) => {
2526
- const targetPath = path12.join(outputDir, url.replace(/^\/+/, ""));
2527
- await fs4.mkdir(path12.dirname(targetPath), { recursive: true });
2594
+ const targetPath = path13.join(outputDir, url.replace(/^\/+/, ""));
2595
+ await fs4.mkdir(path13.dirname(targetPath), { recursive: true });
2528
2596
  await fs4.copyFile(sourcePath, targetPath);
2529
2597
  })
2530
2598
  );
2531
2599
  }
2532
2600
  async function mergeBuiltFontCss(outputDir, fontCssSource) {
2533
2601
  const fs4 = await import("fs/promises");
2534
- const fontCssPath = path12.join(outputDir, "farm-fonts.css");
2602
+ const fontCssPath = path13.join(outputDir, "farm-fonts.css");
2535
2603
  let fontCss = fontCssSource;
2536
2604
  if (fontCss === void 0) {
2537
2605
  try {
@@ -2540,7 +2608,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
2540
2608
  return;
2541
2609
  }
2542
2610
  }
2543
- const clientCssPath = path12.join(outputDir, "farm-client.css");
2611
+ const clientCssPath = path13.join(outputDir, "farm-client.css");
2544
2612
  let clientCss = "";
2545
2613
  try {
2546
2614
  clientCss = await fs4.readFile(clientCssPath, "utf8");
@@ -2566,7 +2634,7 @@ var IncompleteClientBuildOutputError = class extends Error {
2566
2634
  async function validateClientBuildOutput(root, srcDir, outputDir) {
2567
2635
  const fs4 = await import("fs/promises");
2568
2636
  const fingerprinted = await findFingerprintedClientEntry(outputDir);
2569
- const clientEntryPath = path12.join(outputDir, fingerprinted ?? "farm-client.js");
2637
+ const clientEntryPath = path13.join(outputDir, fingerprinted ?? "farm-client.js");
2570
2638
  let clientEntrySize = 0;
2571
2639
  try {
2572
2640
  const clientEntry = await fs4.stat(clientEntryPath);
@@ -2576,8 +2644,8 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
2576
2644
  if (clientEntrySize === 0) {
2577
2645
  throw new IncompleteClientBuildOutputError("farm-client.js is missing or empty");
2578
2646
  }
2579
- const clientCssPath = path12.join(outputDir, "farm-client.css");
2580
- const globalsCssPath = path12.join(root, srcDir, "app", "globals.css");
2647
+ const clientCssPath = path13.join(outputDir, "farm-client.css");
2648
+ const globalsCssPath = path13.join(root, srcDir, "app", "globals.css");
2581
2649
  let expectsCss = false;
2582
2650
  try {
2583
2651
  const globalsCss = await fs4.readFile(globalsCssPath, "utf8");
@@ -2598,7 +2666,7 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
2598
2666
  }
2599
2667
  }
2600
2668
  function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, options = {}) {
2601
- const key = `${path12.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${options.serverOwners === true}\0${options.serverTreeLayouts === true}\0${path12.resolve(modulePath)}`;
2669
+ const key = `${path13.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${options.serverOwners === true}\0${options.serverTreeLayouts === true}\0${path13.resolve(modulePath)}`;
2602
2670
  let plan = cache.get(key);
2603
2671
  if (!plan) {
2604
2672
  plan = getClientModuleHydrationPlan(modulePath, root, mode, options);
@@ -2607,10 +2675,10 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
2607
2675
  return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
2608
2676
  }
2609
2677
  async function buildClient(productionVite, config, root, srcDir, outputDir, pageRoutes, layoutRoutes = [], routeSlots = [], isolatedClientBoundaryModules = /* @__PURE__ */ new Set(), hydrationPlanCache = /* @__PURE__ */ new Map(), rendererBuildLifetime, programmaticClientRoutes, mobile = false) {
2610
- if (!mobile) await removeFarmMobileClientManifest(path12.dirname(outputDir));
2678
+ if (!mobile) await removeFarmMobileClientManifest(path13.dirname(outputDir));
2611
2679
  const viteBuild = productionVite.build;
2612
2680
  const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
2613
- const { PluginManager: PluginManager2 } = await import("./plugin-VEBRN7A3.mjs");
2681
+ const { PluginManager: PluginManager2 } = await import("./plugin-QZT747YW.mjs");
2614
2682
  const fs4 = await import("fs/promises");
2615
2683
  const pluginManager = new PluginManager2({
2616
2684
  config,
@@ -2867,10 +2935,10 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2867
2935
  `\u{1F4F1} Total hydratable routes detected: ${clientPages.length} pages, ${clientLayouts.filter((layout) => layout.shouldHydrate || layout.hasIsolatedClientBoundaries).length} layouts, and ${clientRouteSlots.length} slots`
2868
2936
  );
2869
2937
  const buildTarget = async (platform) => {
2870
- const clientEntryRoot = path12.join(root, ".farm", "tmp");
2938
+ const clientEntryRoot = path13.join(root, ".farm", "tmp");
2871
2939
  await fs4.mkdir(clientEntryRoot, { recursive: true });
2872
- const clientEntryDir = await fs4.mkdtemp(path12.join(clientEntryRoot, "client-entry-"));
2873
- const clientEntryPath = path12.join(clientEntryDir, "farm-client-entry.tsx");
2940
+ const clientEntryDir = await fs4.mkdtemp(path13.join(clientEntryRoot, "client-entry-"));
2941
+ const clientEntryPath = path13.join(clientEntryDir, "farm-client-entry.tsx");
2874
2942
  const clientHydrationCode = generateClientHydrationEntry(
2875
2943
  clientPages,
2876
2944
  clientLayouts,
@@ -2904,11 +2972,11 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2904
2972
  const clientEntry = islandsMode && platform === "web" && clientHydrationCode.includes("/*farm-router-stub*/") ? splitFarmClientRouter(clientHydrationCode) : { entry: clientHydrationCode, router: void 0 };
2905
2973
  await fs4.writeFile(clientEntryPath, clientEntry.entry);
2906
2974
  if (clientEntry.router !== void 0) {
2907
- await fs4.writeFile(path12.join(clientEntryDir, "farm-client-router.tsx"), clientEntry.router);
2975
+ await fs4.writeFile(path13.join(clientEntryDir, "farm-client-router.tsx"), clientEntry.router);
2908
2976
  }
2909
2977
  const clientInput = { [entryName]: clientEntryPath };
2910
2978
  if (platform === "web" && canBootFarmIslandsClient(config)) {
2911
- const clientBootPath = path12.join(clientEntryDir, "farm-client-boot.tsx");
2979
+ const clientBootPath = path13.join(clientEntryDir, "farm-client-boot.tsx");
2912
2980
  await fs4.writeFile(
2913
2981
  clientBootPath,
2914
2982
  'import { startFarmIslandsBoot } from "@farm.js/core/internal/islands-boot";\nstartFarmIslandsBoot();\n'
@@ -2925,7 +2993,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2925
2993
  if (hasScopedPostcssConfig) {
2926
2994
  logger.info("\u{1F4E6} Using project PostCSS/Tailwind configuration");
2927
2995
  } else {
2928
- const postcssConfigPath = path12.join(clientEntryDir, "postcss.config.cjs");
2996
+ const postcssConfigPath = path13.join(clientEntryDir, "postcss.config.cjs");
2929
2997
  await fs4.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
2930
2998
  postcssSearchPath = clientEntryDir;
2931
2999
  tailwindVitePlugin = await loadTailwindVitePlugin({
@@ -2981,24 +3049,24 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2981
3049
  plugins: [
2982
3050
  createFarmThemeCssPlugin(config.theme, config.basePath),
2983
3051
  createFarmPrivateClientSourcemapsPlugin({
2984
- outDir: path12.join(
2985
- path12.dirname(outputDir),
3052
+ outDir: path13.join(
3053
+ path13.dirname(outputDir),
2986
3054
  platform === "mobile" ? `${FARM_CLIENT_SOURCEMAPS_DIR}-mobile` : FARM_CLIENT_SOURCEMAPS_DIR
2987
3055
  )
2988
3056
  }),
2989
3057
  // The web client's preload manifests; the mobile client records its files instead.
2990
3058
  platform === "mobile" ? createFarmMobileClientManifestPlugin({
2991
- buildDir: path12.dirname(outputDir),
3059
+ buildDir: path13.dirname(outputDir),
2992
3060
  entryName
2993
3061
  }) : createFarmClientModulePreloadPlugin({
2994
3062
  root,
2995
- buildDir: path12.dirname(outputDir),
3063
+ buildDir: path13.dirname(outputDir),
2996
3064
  entryName: "farm-client"
2997
3065
  }),
2998
3066
  ...adapterOwnsDocsRuntime && platform === "web" ? [
2999
3067
  createFarmDocsModulePreloadPlugin({
3000
3068
  root,
3001
- buildDir: path12.dirname(outputDir),
3069
+ buildDir: path13.dirname(outputDir),
3002
3070
  importer: clientEntryPath,
3003
3071
  entryName: "farm-client",
3004
3072
  modules: [
@@ -3102,10 +3170,12 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3102
3170
  ]
3103
3171
  }
3104
3172
  };
3105
- await viteBuild(mergeFarmProductionViteConfig(clientViteConfig, config.vite));
3173
+ await viteBuild(
3174
+ mergeFarmProductionViteConfig(clientViteConfig, config.vite, { clientOutput: true })
3175
+ );
3106
3176
  if (platform === "mobile") {
3107
- await fs4.rm(path12.join(outputDir, `${entryName}.css`), { force: true });
3108
- if (!await hasFarmMobileClientEntry(path12.dirname(outputDir), outputDir)) {
3177
+ await fs4.rm(path13.join(outputDir, `${entryName}.css`), { force: true });
3178
+ if (!await hasFarmMobileClientEntry(path13.dirname(outputDir), outputDir)) {
3109
3179
  throw new IncompleteClientBuildOutputError(
3110
3180
  `${FARM_MOBILE_CLIENT_ENTRY_NAME}.js is missing or empty`
3111
3181
  );
@@ -3126,12 +3196,12 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3126
3196
  }
3127
3197
  function toBakedMarkdownSourcePath(root, filePath) {
3128
3198
  if (!filePath) return "";
3129
- if (!path12.isAbsolute(filePath)) return filePath.split(path12.sep).join("/");
3130
- const relative = path12.relative(root, filePath);
3131
- if (!relative || relative.startsWith("..") || path12.isAbsolute(relative)) {
3132
- return path12.basename(filePath);
3199
+ if (!path13.isAbsolute(filePath)) return filePath.split(path13.sep).join("/");
3200
+ const relative = path13.relative(root, filePath);
3201
+ if (!relative || relative.startsWith("..") || path13.isAbsolute(relative)) {
3202
+ return path13.basename(filePath);
3133
3203
  }
3134
- return relative.split(path12.sep).join("/");
3204
+ return relative.split(path13.sep).join("/");
3135
3205
  }
3136
3206
  function generateUniversalRouterStateRuntime(streamNavigations = false) {
3137
3207
  return `
@@ -4176,7 +4246,7 @@ __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot
4176
4246
  root,
4177
4247
  renderer.componentExtensions ?? []
4178
4248
  );
4179
- const globalsCssPath = path12.join(root, srcDir, "app", "globals.css");
4249
+ const globalsCssPath = path13.join(root, srcDir, "app", "globals.css");
4180
4250
  const serverStyleModules = [];
4181
4251
  const cssImport = [
4182
4252
  ...existsSync2(globalsCssPath) ? [globalsCssPath] : [],
@@ -4616,7 +4686,8 @@ async function createFarmServerTreePageElement(source, pathname) {
4616
4686
  return await createFarmServerTreeElement(React, source, {
4617
4687
  load: loadFarmIsolatedBoundary,
4618
4688
  ServerHtml: FarmServerPage,
4619
- key: pathname,
4689
+ // No key: the next page of the same layout updates this one in place, as React Server
4690
+ // Components do, instead of unmounting it and building every node again.
4620
4691
  });
4621
4692
  } catch (error) {
4622
4693
  console.warn("[Farm.js] Could not rebuild the server tree of " + pathname + "; its server HTML was kept.", error);
@@ -6012,7 +6083,7 @@ void hydrate();
6012
6083
  async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache, rendererBuildLifetime) {
6013
6084
  const viteBuild = productionVite.build;
6014
6085
  const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
6015
- const { PluginManager: PluginManager2 } = await import("./plugin-VEBRN7A3.mjs");
6086
+ const { PluginManager: PluginManager2 } = await import("./plugin-QZT747YW.mjs");
6016
6087
  const fs4 = await import("fs/promises");
6017
6088
  const pluginManager = new PluginManager2({
6018
6089
  config,
@@ -6028,9 +6099,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
6028
6099
  buildLifetime: rendererBuildLifetime
6029
6100
  });
6030
6101
  if (!hasScopedPostcssConfig) {
6031
- postcssConfigDir = await fs4.mkdtemp(path12.join(os.tmpdir(), "farm-postcss-"));
6102
+ postcssConfigDir = await fs4.mkdtemp(path13.join(os.tmpdir(), "farm-postcss-"));
6032
6103
  await fs4.writeFile(
6033
- path12.join(postcssConfigDir, "postcss.config.cjs"),
6104
+ path13.join(postcssConfigDir, "postcss.config.cjs"),
6034
6105
  "module.exports = { plugins: [] };\n"
6035
6106
  );
6036
6107
  tailwindVitePlugin = await loadTailwindVitePlugin({
@@ -6453,7 +6524,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
6453
6524
  }
6454
6525
  function readFarmAppPackageIdentity(root) {
6455
6526
  try {
6456
- return JSON.parse(readFileSync(path12.join(root, "package.json"), "utf8"));
6527
+ return JSON.parse(readFileSync(path13.join(root, "package.json"), "utf8"));
6457
6528
  } catch {
6458
6529
  return {};
6459
6530
  }
@@ -7063,10 +7134,12 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
7063
7134
  orderedPageRoutes.forEach((route, index) => {
7064
7135
  const varName = `pageRoute${index}`;
7065
7136
  if (isFarmMarkdownPageFile(route.modulePath)) {
7137
+ const renderingDirective2 = readRouteRenderingDirectiveFromFile(route.modulePath);
7066
7138
  pageRegistrations.push(`
7067
7139
  {
7068
7140
  pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
7069
- directory: ${JSON.stringify(route.directory)},` : ""}
7141
+ directory: ${JSON.stringify(route.directory)},` : ""}${renderingDirective2 ? `
7142
+ rendering: ${JSON.stringify(renderingDirective2)},` : ""}
7070
7143
  module: createFarmMarkdownRouteModule({
7071
7144
  source: ${JSON.stringify(route.source ?? "")},
7072
7145
  filePath: ${JSON.stringify(toBakedMarkdownSourcePath(config.root, route.modulePath))},
@@ -7305,6 +7378,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
7305
7378
  createFarmProductionLifecycle,
7306
7379
  createFarmNodeRequestAbortSignal,
7307
7380
  createProductionMiddlewareRunner,
7381
+ _hasPrivateFarmRequestHeaders,
7308
7382
  _withFarmGuardedResponseCache,
7309
7383
  _farmPluginsKeepResponsesPrivate,
7310
7384
  getTheme as getFarmTheme,
@@ -7318,6 +7392,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
7318
7392
  localizeFarmHref,
7319
7393
  manageFarmDocumentPreloads,
7320
7394
  mergeRouteRenderingDirectiveConfig,
7395
+ resolveRouteSharedCacheControl,
7321
7396
  manageFarmLinkHeaderPreloads,
7322
7397
  mergeMetadata,
7323
7398
  mergeModuleViewport,
@@ -7346,7 +7421,13 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
7346
7421
  stripFarmLocaleFromPathname,
7347
7422
  withFarmRouteContext,
7348
7423
  createLateNotFoundRecovery,
7349
- createLateRedirectRecovery,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${hasInfraAnalyticsRuntime ? "\n resolveFarmDocsEngineRouteLabel,\n resolveFarmDocsRouteLabel,\n resolveFarmMarkdownRouteLabel,\n resolveFarmMCPRouteLabel,\n setFarmRouteLabel," : ""}${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}
7424
+ createLateRedirectRecovery,
7425
+ _withFarmDeploymentCookie,
7426
+ _withFarmResponseHeaders,
7427
+ createFarmDeploymentMismatchResponse,
7428
+ FARM_DEPLOYMENT_ID_HEADER,
7429
+ getFarmDeploymentMismatch,
7430
+ withoutFarmDeploymentCookie,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${config.trailingSlash && (config.md?.enabled || hasMarkdownPages) ? "\n toFarmTrailingSlashPageRequest," : ""}${hasInfraAnalyticsRuntime ? "\n resolveFarmDocsEngineRouteLabel,\n resolveFarmDocsRouteLabel,\n resolveFarmMarkdownRouteLabel,\n resolveFarmMCPRouteLabel,\n setFarmRouteLabel," : ""}${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}
7350
7431
  } from "@farm.js/core/internal/production-runtime";${farmMobileClient ? `
7351
7432
  import { _applyFarmMobileShellClient } from "@farm.js/core/internal/production-runtime";
7352
7433
  // The mobile client documents load when a mobile shell asks for them (RFC 0004, 7.2), filled in
@@ -7433,7 +7514,7 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
7433
7514
  const markdownHandlerImport = config.md?.enabled ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
7434
7515
  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;";
7435
7516
  const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
7436
- const mdxComponentsPath = typeof config.mdx?.components === "string" ? path12.isAbsolute(config.mdx.components) ? config.mdx.components : path12.join(config.root, config.mdx.components) : null;
7517
+ const mdxComponentsPath = typeof config.mdx?.components === "string" ? path13.isAbsolute(config.mdx.components) ? config.mdx.components : path13.join(config.root, config.mdx.components) : null;
7437
7518
  const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
7438
7519
  const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
7439
7520
  const layerConfigImports = layerConfigPaths.map(
@@ -7794,7 +7875,11 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
7794
7875
  validateRemoteUrl: createNodeImageUrlValidator(${JSON.stringify(config.images)}),
7795
7876
  onError(error) { console.error("[Farm Image]", error); },
7796
7877
  })`};
7797
- const farmMarkdownConfig = ${JSON.stringify(config.md)};
7878
+ const farmMarkdownConfig = ${JSON.stringify(config.md)};${config.md?.enabled || hasMarkdownPages ? config.trailingSlash ? `
7879
+ // A Markdown mirror, and a page.md source's page check, read the page at the URL it answers at
7880
+ // ('/about/'), so the trailing-slash 308 never answers in its place.
7881
+ const toFarmMarkdownPageRequest = (request) => toFarmTrailingSlashPageRequest(request, true);` : `
7882
+ const toFarmMarkdownPageRequest = (request) => request;` : ""}
7798
7883
  const farmLlmsTxtConfig = ${JSON.stringify(config.agent?.llmsTxt ?? { enabled: false, include: [], exclude: [] })};
7799
7884
  ${config.agent?.llmsTxt?.enabled ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
7800
7885
  const farmMdxConfig = ${JSON.stringify({
@@ -7968,7 +8053,7 @@ const farmDocsAPIHandler = ${config.docs?.enabled ? hasPrecompiledDocs ? "farmDo
7968
8053
 
7969
8054
  // API routes bundled at build time
7970
8055
  const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
7971
- ]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path14, methods }) => ({ path: path14, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)}, dispatch: dispatchFarmPluginAPIRequest })` : ""};
8056
+ ]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path15, methods }) => ({ path: path15, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)}, dispatch: dispatchFarmPluginAPIRequest })` : ""};
7972
8057
  // A plugin calling an app endpoint (an MCP tool, say) goes through the whole
7973
8058
  // pipeline, so the endpoint's middleware and integration guards run for it.
7974
8059
  function dispatchFarmPluginAPIRequest(request) {
@@ -7988,6 +8073,10 @@ function fetchFarmInnerRequest(request, context) {
7988
8073
  return fetch(new Request(request, { headers }), context);
7989
8074
  }
7990
8075
  const farmLocalAPIBasePath = ${JSON.stringify(resolveFarmAPIServerBasePath(config.api))};
8076
+ // Deployment skew protection (see the deployment docs): documents embed this ID, page responses
8077
+ // name it, and a page request from a browser holding another deployment's page is refused.
8078
+ const farmDeploymentId = ${JSON.stringify(config.deploymentId)};
8079
+ const farmDeploymentCookiePath = ${JSON.stringify(config.basePath || "/")};
7991
8080
  // Reports a failure Farm answers itself (an API or integration route's 500) to the plugin
7992
8081
  // runtime request.
7993
8082
  const farmRuntimeErrorSlot = Symbol("farm.runtime.error.slot");
@@ -8101,7 +8190,8 @@ function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, page
8101
8190
  let source = 'window.__FARM_PROPS__=' + serializedPageProps +
8102
8191
  ';window.__FARM_INTEGRATION_API_MANIFEST__=' +
8103
8192
  serializeFarmInlineValue(integrationManifest) +
8104
- ';window.__FARM_ROUTE_SLOTS__=' + serializedRouteSlots + ';';
8193
+ ';window.__FARM_ROUTE_SLOTS__=' + serializedRouteSlots +
8194
+ ';window.__FARM_DEPLOYMENT_ID__=' + serializeFarmInlineValue(farmDeploymentId) + ';';
8105
8195
  if (typeof canonicalPath === "string" && canonicalPath.startsWith("/")) {
8106
8196
  const serializedPath = serializeFarmInlineValue(canonicalPath);
8107
8197
  source += 'if(location.pathname+location.search!==' + serializedPath + '){' +
@@ -8802,8 +8892,9 @@ const farmClientEntryPreloadTags = farmClientModulePreloads
8802
8892
  ? farmClientModulePreloads.entry.map(renderFarmClientModulePreload).join("")
8803
8893
  : "";
8804
8894
  // The client modules a document's markup loads: its islands' boundaries and the
8805
- // client references of its server tree.
8806
- const FARM_CLIENT_MODULE_REFERENCE_PATTERN = /<f-island src="([^"]+)"|"r":"(\\/[^"]+)"/g;
8895
+ // client references of its server tree. An island with a deferred strategy loads its
8896
+ // module on its own trigger, so it is not preloaded.
8897
+ const FARM_CLIENT_MODULE_REFERENCE_PATTERN = /<f-island src="([^"]+)"([^>]*)>|"r":"(\\/[^"]+)"/g;
8807
8898
 
8808
8899
  function renderFarmClientModulePreload(index) {
8809
8900
  return '\\n <link rel="modulepreload" href="/' +
@@ -8831,7 +8922,10 @@ function renderFarmClientModulePreloads(markup, pageModule) {
8831
8922
  };
8832
8923
  add(pageModule);
8833
8924
  if (typeof markup === "string") {
8834
- for (const match of markup.matchAll(FARM_CLIENT_MODULE_REFERENCE_PATTERN)) add(match[1] || match[2]);
8925
+ for (const match of markup.matchAll(FARM_CLIENT_MODULE_REFERENCE_PATTERN)) {
8926
+ if (match[1] && FARM_DEFERRED_ISLAND_STRATEGY.test(match[2])) continue;
8927
+ add(match[1] || match[3]);
8928
+ }
8835
8929
  }
8836
8930
  return tags;
8837
8931
  }
@@ -8903,38 +8997,14 @@ function applyFarmI18nResponse(response, resolution) {
8903
8997
  });
8904
8998
  }
8905
8999
 
8906
- function hasOnlyValidFarmLocaleCookie(cookieHeader) {
8907
- if (!farmI18nRuntime || !cookieHeader) return false;
8908
- const parts = cookieHeader.split(";");
8909
- if (parts.length !== 1) return false;
8910
-
8911
- const cookie = parts[0].trim();
8912
- const separator = cookie.indexOf("=");
8913
- if (separator <= 0) return false;
8914
-
8915
- let name;
8916
- let value;
8917
- try {
8918
- name = decodeURIComponent(cookie.slice(0, separator).trim());
8919
- value = decodeURIComponent(cookie.slice(separator + 1).trim());
8920
- } catch {
8921
- return false;
8922
- }
8923
-
8924
- return (
8925
- name === farmI18nConfig.cookie.name &&
8926
- farmI18nConfig.locales.includes(value)
8927
- );
8928
- }
8929
-
9000
+ // Credentials or a visitor's cookie; the deployment cookie, and a lone valid locale cookie when
9001
+ // the URL names the locale, keep shared caching. The RSC server decides with the same helper.
8930
9002
  function hasPrivateFarmRequestHeaders(request, farmLocaleResolution) {
8931
- if (request.headers.get("authorization")) return true;
8932
- const cookieHeader = request.headers.get("cookie");
8933
- if (!cookieHeader) return false;
8934
-
8935
- return !(
8936
- farmLocaleResolution?.source === "url" &&
8937
- hasOnlyValidFarmLocaleCookie(cookieHeader)
9003
+ return _hasPrivateFarmRequestHeaders(
9004
+ request,
9005
+ farmI18nRuntime && farmLocaleResolution?.source === "url"
9006
+ ? { name: farmI18nConfig.cookie.name, locales: farmI18nConfig.locales }
9007
+ : undefined,
8938
9008
  );
8939
9009
  }
8940
9010
 
@@ -9235,7 +9305,7 @@ function createFarmAgentSitemapResponse(request) {
9235
9305
  metadataBase: rootLayout && rootLayout.module && rootLayout.module.metadata
9236
9306
  ? rootLayout.module.metadata.metadataBase
9237
9307
  : undefined,
9238
- basePath: ${JSON.stringify(config.basePath)},
9308
+ basePath: ${JSON.stringify(config.basePath)},${config.trailingSlash ? "\n trailingSlash: true," : ""}${config.i18n.enabled ? "\n i18n: farmI18nConfig," : ""}
9239
9309
  },
9240
9310
  ),
9241
9311
  {},
@@ -9258,37 +9328,45 @@ function getFarmDefaultMCPServer() {
9258
9328
  }
9259
9329
  async function handleFarmDefaultMCP(request) {
9260
9330
  const origin = new URL(request.url).origin;
9331
+ // Pages are linked on metadataBase, as sitemap.xml and llms.txt link them.
9332
+ const metadataBase = getFarmRootMetadataBase();
9261
9333
  return handleFarmDefaultMCPRequest(request, {
9262
9334
  server: getFarmDefaultMCPServer(),
9263
9335
  basePath: ${JSON.stringify(config.basePath)},
9336
+ i18n: farmI18nConfig,
9337
+ metadataBase,
9338
+ // Each page at the URL it answers at, as in development and as the sitemap lists it.
9264
9339
  listPages: () =>
9265
9340
  collectFarmDefaultMCPPages(
9266
9341
  getFarmAgentListedPageRoutes().map((route) => ({ pattern: route.pattern, module: route.module })),
9267
- { origin, basePath: ${JSON.stringify(config.basePath)}, markdown: farmMarkdownConfig },
9342
+ {
9343
+ origin,
9344
+ metadataBase,
9345
+ basePath: ${JSON.stringify(config.basePath)},
9346
+ markdown: farmMarkdownConfig,${config.trailingSlash ? "\n trailingSlash: true," : ""}
9347
+ i18n: farmI18nConfig,
9348
+ },
9268
9349
  ),
9269
- // A fresh request through this handler, so the caller's cookies never shape a page.
9270
- // The handler sees paths below the base path, as the server passes them in.
9271
- readMarkdown: (url) => {
9272
- const page = new URL(url);
9273
- page.pathname = stripFarmBasePath(page.pathname);
9274
- return farmDefaultMCPReadMarkdown(page.href);
9275
- },
9350
+ // A fresh request through this handler, so the caller's cookies never shape a page. It
9351
+ // reads the public URL, base path included, as llms-full.txt does: this handler sees
9352
+ // public paths, and with i18n a mirror path without the base path answers with a redirect.
9353
+ readMarkdown: farmDefaultMCPReadMarkdown,
9276
9354
  });
9277
9355
  }
9278
9356
  // \`fetch\` is this module's outer request entry: plugin runtime hooks run and the page
9279
9357
  // gets its own request context, as for a direct request.
9280
9358
  const farmDefaultMCPReadMarkdown = createFarmLlmsMarkdownReader((page) => fetch(page));
9281
9359
  ` : ""}
9282
- // The origin llms.txt and llms-full.txt link to: the root layout's metadataBase, else the
9283
- // request's origin, as for the sitemap and in development.
9360
+ // The origin llms.txt, llms-full.txt and list_pages link to: the root layout's metadataBase,
9361
+ // else the request's origin, as for the sitemap and in development.
9284
9362
  function getFarmAgentOrigin(request) {
9363
+ return resolveFarmAgentOrigin(getFarmRootMetadataBase(), new URL(request.url).origin);
9364
+ }
9365
+ function getFarmRootMetadataBase() {
9285
9366
  const rootLayout = layoutRoutes.find((layout) => layout.pattern === "/");
9286
- return resolveFarmAgentOrigin(
9287
- rootLayout && rootLayout.module && rootLayout.module.metadata
9288
- ? rootLayout.module.metadata.metadataBase
9289
- : undefined,
9290
- new URL(request.url).origin,
9291
- );
9367
+ return rootLayout && rootLayout.module && rootLayout.module.metadata
9368
+ ? rootLayout.module.metadata.metadataBase
9369
+ : undefined;
9292
9370
  }
9293
9371
 
9294
9372
  // Static pages and root metadata for llms.txt, built the same way as in development.
@@ -9300,7 +9378,7 @@ function createFarmLlmsTxtContext(request, full) {
9300
9378
  origin,
9301
9379
  markdown: farmMarkdownConfig,
9302
9380
  include: farmLlmsTxtConfig.include,
9303
- exclude: farmLlmsTxtConfig.exclude,
9381
+ exclude: farmLlmsTxtConfig.exclude,${config.trailingSlash ? "\n trailingSlash: true," : ""}${config.i18n.enabled ? "\n i18n: farmI18nConfig," : ""}
9304
9382
  },
9305
9383
  );
9306
9384
  const rootLayout = layoutRoutes.find((layout) => layout.pattern === "/");
@@ -9890,7 +9968,7 @@ function getPPRShellBypassReason(request, middlewareData, middlewareContext) {
9890
9968
  if (farmSecurityConfig.csp && farmSecurityConfig.csp.nonce) return "csp-nonce";
9891
9969
  const method = request.method.toUpperCase();
9892
9970
  if (method !== "GET" && method !== "HEAD") return "method";
9893
- if (request.headers.get("cookie")) return "cookie";
9971
+ if (withoutFarmDeploymentCookie(request.headers.get("cookie"))) return "cookie";
9894
9972
  if (request.headers.get("authorization")) return "authorization";
9895
9973
  if (request.headers.get("x-farm-intercept-from")) return "route-interception";
9896
9974
  if (request.headers.get("x-farm-ppr-refresh")) return "refresh";
@@ -9902,12 +9980,15 @@ function getPPRShellBypassReason(request, middlewareData, middlewareContext) {
9902
9980
 
9903
9981
  // origin is set when the shell carries hreflang alternates (i18n prefix
9904
9982
  // routing), so one host never serves a shell holding another host's URLs.
9983
+ // A shell embeds its deployment's ID and client assets, and a shared cache
9984
+ // adapter outlives a deployment, so each deployment keys its own shells.
9905
9985
  function getPPRShellCacheKey(url, locale, origin) {
9906
9986
  const key = [
9907
9987
  "ppr",
9908
9988
  locale || "",
9909
9989
  normalizeRevalidatePath(url.pathname),
9910
9990
  url.search,
9991
+ farmDeploymentId,
9911
9992
  ];
9912
9993
  return createFarmCacheKey(origin ? key.concat(origin) : key);
9913
9994
  }
@@ -9937,22 +10018,13 @@ function hasFarmUnserializableRouteData(data) {
9937
10018
  return Boolean(data) && typeof data === "object" && Object.values(data).some(isPromise);
9938
10019
  }
9939
10020
 
10021
+ // Core's policy for the route, shared with the RSC server so both send the same Cache-Control.
9940
10022
  function getRouteSharedCacheControl(route, pprCanCache) {
9941
10023
  if (!route || !route.module) {
9942
10024
  return null;
9943
10025
  }
9944
10026
 
9945
- const view = resolveRouteRenderingView(route);
9946
- if (view.dynamic === "force-dynamic") {
9947
- return null;
9948
- }
9949
- if (!view.ssg && !pprCanCache) {
9950
- return null;
9951
- }
9952
-
9953
- const revalidate =
9954
- typeof view.revalidate === "number" && view.revalidate > 0 ? view.revalidate : 60;
9955
- return "public, s-maxage=" + revalidate + ", stale-while-revalidate=300";
10027
+ return resolveRouteSharedCacheControl(resolveRouteRenderingView(route), pprCanCache);
9956
10028
  }
9957
10029
 
9958
10030
  async function getCachedPPRShell(cacheKey) {
@@ -10023,8 +10095,9 @@ async function handleFarmRequestInContext(
10023
10095
  adapterContext,
10024
10096
  requestUrl = new URL(request.url),
10025
10097
  ) {
10026
- const farmCacheGuard = { guarded: farmPluginRuntimeKeepsResponsesPrivate };
10027
- const response = await resolveFarmRequestInContext(
10098
+ // deploymentPage: a page route answered, so the response names this deployment.
10099
+ const farmCacheGuard = { guarded: farmPluginRuntimeKeepsResponsesPrivate, deploymentPage: false };
10100
+ let response = await resolveFarmRequestInContext(
10028
10101
  farmCacheGuard,
10029
10102
  request,
10030
10103
  farmLocaleResolution,
@@ -10033,6 +10106,11 @@ async function handleFarmRequestInContext(
10033
10106
  adapterContext,
10034
10107
  requestUrl,
10035
10108
  );
10109
+ if (farmCacheGuard.deploymentPage) {
10110
+ response = _withFarmResponseHeaders(response, (headers) =>
10111
+ headers.set(FARM_DEPLOYMENT_ID_HEADER, farmDeploymentId)
10112
+ );
10113
+ }
10036
10114
  if (!farmCacheGuard.guarded) return response;
10037
10115
  // Tells the Nitro entry, which keeps this policy over a swr rule's public one.
10038
10116
  adapterContext?.onGuardedResponse?.();
@@ -10276,6 +10354,14 @@ ${hasServerRuntimeIntegrations ? `
10276
10354
  middlewareHeaders,
10277
10355
  );
10278
10356
  }
10357
+ // A docs page is a page document: it names this deployment, and a navigation from
10358
+ // another deployment's page is refused, as for an app page.
10359
+ const farmDocsDeploymentMismatch = getFarmDeploymentMismatch(request, farmDeploymentId);
10360
+ if (farmDocsDeploymentMismatch) {
10361
+ await docsResponse.body?.cancel();
10362
+ return createFarmDeploymentMismatchResponse(farmDocsDeploymentMismatch);
10363
+ }
10364
+ farmCacheGuard.deploymentPage = true;
10279
10365
  const wrappedDocsResponse = withFarmDocsRequestCache(
10280
10366
  await wrapFarmDocsResponseWithLayouts(request, docsResponse),
10281
10367
  request,
@@ -10307,7 +10393,7 @@ ${hasServerRuntimeIntegrations ? `
10307
10393
  clientAddress: adapterContext?.clientAddress,
10308
10394
  // An anonymous visitor's request: guards never see the caller's address.
10309
10395
  renderPage: (targetRequest) =>
10310
- fetchFarmInnerRequest(targetRequest, {
10396
+ fetchFarmInnerRequest(toFarmMarkdownPageRequest(targetRequest), {
10311
10397
  ...adapterContext,
10312
10398
  clientAddress: FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS,
10313
10399
  }),
@@ -10354,7 +10440,8 @@ ${hasServerRuntimeIntegrations ? `
10354
10440
  routePathname: getFarmRoutePathname,
10355
10441
  routeExists: (targetPathname) =>
10356
10442
  Boolean(matchPageRoute(getFarmRoutePathname(targetPathname))),
10357
- renderPage: (targetRequest) => fetchFarmInnerRequest(targetRequest, adapterContext),
10443
+ renderPage: (targetRequest) =>
10444
+ fetchFarmInnerRequest(toFarmMarkdownPageRequest(targetRequest), adapterContext),
10358
10445
  apiServerBasePath: farmLocalAPIBasePath,
10359
10446
  });
10360
10447
  if (markdownResponse) {
@@ -10547,6 +10634,14 @@ ${hasServerRuntimeIntegrations ? `
10547
10634
  // Handle page routes (SSR)
10548
10635
  emitFarmEvent({ type: "render.start", route: pathname, pathname });
10549
10636
  const matchedRoute = matchPageRoute(routePathname);
10637
+ if (matchedRoute) {
10638
+ // A browser holding another deployment's page names it: a navigation fetch in its header, a
10639
+ // form or server action post in the deployment cookie. Refuse it before an action runs, and
10640
+ // before a document would refresh that cookie to this deployment.
10641
+ const farmDeploymentMismatch = getFarmDeploymentMismatch(request, farmDeploymentId);
10642
+ if (farmDeploymentMismatch) return createFarmDeploymentMismatchResponse(farmDeploymentMismatch);
10643
+ farmCacheGuard.deploymentPage = true;
10644
+ }
10550
10645
  ${farmIslandsMode ? `// Islands mode: a form or client component posting a server action to this page.
10551
10646
  if (matchedRoute && request.method === "POST") {
10552
10647
  const actionResponse = await _runWithMiddlewareData(middlewareData || {}, () =>
@@ -10656,6 +10751,12 @@ ${hasServerRuntimeIntegrations ? `
10656
10751
 
10657
10752
  // Reads from here on belong to the page render, not to middleware.
10658
10753
  const requestReadsBeforeRender = _getRequestReadCount();
10754
+ // A swr or cache route rule stores this page by URL for every visitor. Nitro hands Farm the
10755
+ // request without its cookies, Authorization, or any header the rule does not key on, so a
10756
+ // render that reads nothing of the request is that shared page, whatever its route config.
10757
+ const farmRouteRuleCached =
10758
+ Boolean(adapterContext?.routeRuleCache) &&
10759
+ (request.method === "GET" || request.method === "HEAD");
10659
10760
 
10660
10761
  // Get the page component and metadata
10661
10762
  let PageComponent = route.module.default;
@@ -10889,7 +10990,8 @@ ${hasServerRuntimeIntegrations ? `
10889
10990
  ${farmIslandsMode ? `// Islands mode: a route a shared cache may store (a PPR shell, a static page) renders
10890
10991
  // whole for every request, so a cache hit stays a hit. Other routes leave out what the
10891
10992
  // navigating browser keeps: the layouts it shows and the values it holds.
10892
- const farmSharedCacheableRoute = Boolean(getRouteSharedCacheControl(route, pprCanCache));
10993
+ const farmSharedCacheableRoute =
10994
+ farmRouteRuleCached || Boolean(getRouteSharedCacheControl(route, pprCanCache));
10893
10995
  if (farmSharedCacheableRoute) ignoreFarmHeldValues();
10894
10996
  const farmLayoutKeyOf = getFarmLayoutKey;
10895
10997
  // A navigation the browser renders in its layout's React root rebuilds a server-tree page
@@ -11154,6 +11256,24 @@ ${hasServerRuntimeIntegrations ? `
11154
11256
  middlewareData?.size ||
11155
11257
  middlewareContext?.size
11156
11258
  );
11259
+ if (farmRouteRuleCached && (renderedPage.stream || hasRequestScopedRender)) {
11260
+ // The route rule's cache refuses a private page: say why it renders on every request.
11261
+ emitFarmEvent({
11262
+ type: "cache.bypass",
11263
+ route: pathname,
11264
+ reason: pageStatus >= 400
11265
+ ? "error-status"
11266
+ : renderReadRequest
11267
+ ? "request-read"
11268
+ : middlewareData?.size || middlewareContext?.size
11269
+ ? "middleware-data"
11270
+ : hasConfiguredRouteContext
11271
+ ? "route-context"
11272
+ : renderedPage.stream
11273
+ ? "suspense-stream"
11274
+ : "request-scoped",
11275
+ });
11276
+ }
11157
11277
  const sharedCacheControl = getRouteSharedCacheControl(route, pprCanCache);
11158
11278
  const responseHeaders = {
11159
11279
  "Content-Type": "text/html; charset=utf-8",
@@ -11163,8 +11283,16 @@ ${hasServerRuntimeIntegrations ? `
11163
11283
  };
11164
11284
  // An error status or a request-scoped render is never shareable, even when
11165
11285
  // the PPR shell headers would otherwise grant a shared max-age.
11166
- if (renderedPage.stream || hasRequestScopedRender || !sharedCacheControl) {
11286
+ if (
11287
+ renderedPage.stream ||
11288
+ hasRequestScopedRender ||
11289
+ (!sharedCacheControl && !farmRouteRuleCached)
11290
+ ) {
11167
11291
  responseHeaders["Cache-Control"] = "private, no-store";
11292
+ } else if (responseHeaders["Cache-Control"] == null) {
11293
+ // A page with no policy of its own under a swr or cache route rule: the rule's cache
11294
+ // stores it and sends the rule's Cache-Control.
11295
+ delete responseHeaders["Cache-Control"];
11168
11296
  }
11169
11297
  const farmI18nSnapshot = getFarmI18nSnapshot();${farmIslandsMode ? `
11170
11298
  // Islands mode: a navigation that names the values it holds, or the layouts it shows,
@@ -11679,6 +11807,13 @@ ${farmRendererDisabled ? `
11679
11807
  { status: 404, headers: { "Content-Type": "application/json" } }
11680
11808
  ), middlewareHeaders);
11681
11809
  ` : ""}
11810
+ // The not-found page is a page document: it names this deployment, and a navigation from
11811
+ // another deployment's page is refused, as for an app page.
11812
+ const farmNotFoundDeploymentMismatch = getFarmDeploymentMismatch(request, farmDeploymentId);
11813
+ if (farmNotFoundDeploymentMismatch) {
11814
+ return createFarmDeploymentMismatchResponse(farmNotFoundDeploymentMismatch);
11815
+ }
11816
+ farmCacheGuard.deploymentPage = true;
11682
11817
  // Agents that navigate in Markdown (a \`.md\` URL or \`Accept: text/markdown\`)
11683
11818
  // get a Markdown error body instead of the HTML not-found shell.
11684
11819
  if (farmRequestWantsMarkdown(pathname, request.headers.get("accept"))) {
@@ -11917,9 +12052,10 @@ async function handleFarmFetch(request, context) {
11917
12052
  );
11918
12053
 
11919
12054
  // headers() config applies after middleware let the request through, so it learns
11920
- // whether the response was guarded and can't make that response shareable again.
12055
+ // whether the response was guarded and can't make that response shareable again. A plugin
12056
+ // runtime hook that throws answers a new 500 out here, which learns it the same way.
11921
12057
  let farmGuardedResponse = false;
11922
- if (configuredHeaderRoutes.length > 0) {
12058
+ if (configuredHeaderRoutes.length > 0 || farmPluginRuntime) {
11923
12059
  const adapterContext = context;
11924
12060
  context = {
11925
12061
  ...adapterContext,
@@ -11952,9 +12088,15 @@ async function handleFarmFetch(request, context) {
11952
12088
  const configured = applyConfiguredResponseHeaders(response, routePathname);
11953
12089
  // Configured headers may edit the response in place, so check it either way.
11954
12090
  const guarded = farmGuardedResponse ? _withFarmGuardedResponseCache(configured) : configured;
12091
+ // The deployment cookie goes on once the response's cache policy is final.
11955
12092
  return applyFarmPreloadBudget(
11956
12093
  applyFarmCspNonceToResponse(
11957
- applyFarmMobileShellResponse(runtimeRequest, guarded, context),
12094
+ _withFarmDeploymentCookie(
12095
+ runtimeRequest,
12096
+ applyFarmMobileShellResponse(runtimeRequest, guarded, context),
12097
+ farmDeploymentId,
12098
+ farmDeploymentCookiePath,
12099
+ ),
11958
12100
  farmSecurityConfig,
11959
12101
  cspNonce,
11960
12102
  ),
@@ -11999,7 +12141,9 @@ async function handleFarmFetch(request, context) {
11999
12141
  const response = await _runWithCurrentRequest(request, () =>
12000
12142
  _runWithFarmCspNonce(cspNonce, () => _runWithAfterRequest(request, runRequest, context)),
12001
12143
  );
12002
- return ${hasCompressionRuntime && !hasPluginRuntime ? "compressFarmResponse(request, response, getFarmOwnedBufferedHtml(response), farmLazyBufferedHtml.has(response))" : "response"};
12144
+ // A Nitro cache rule stores the response and strips its Content-Encoding, so a
12145
+ // response it caches is sent as it is, with no Vary on an encoding it never saw.
12146
+ return ${hasCompressionRuntime && !hasPluginRuntime ? "context?.routeRuleCache ? response : compressFarmResponse(request, response, getFarmOwnedBufferedHtml(response), farmLazyBufferedHtml.has(response))" : "response"};
12003
12147
  }),
12004
12148
  {
12005
12149
  onResponseFinished: typeof context?.onResponseFinished === "function"
@@ -12093,6 +12237,14 @@ function withFarmEdgeGuardedPrerenderHeaders(headers, edgeGuarded) {
12093
12237
  "cache-control": "private, no-store"
12094
12238
  };
12095
12239
  }
12240
+ function prerenderWouldChangePageUrl(pathname) {
12241
+ if (/%(?:23|25|2F|3F)/i.test(pathname)) return true;
12242
+ try {
12243
+ return decodeURI(pathname) !== pathname;
12244
+ } catch {
12245
+ return true;
12246
+ }
12247
+ }
12096
12248
  function getPhysicalPrerenderBypassReason(options) {
12097
12249
  const {
12098
12250
  config,
@@ -12102,6 +12254,7 @@ function getPhysicalPrerenderBypassReason(options) {
12102
12254
  rewriteSources,
12103
12255
  pathname
12104
12256
  } = options;
12257
+ if (prerenderWouldChangePageUrl(pathname)) return "an escaped character in its URL";
12105
12258
  if (config.i18n.enabled) return "request-sensitive i18n";
12106
12259
  if (redirectSources.some((source) => middlewarePatternMatches(source, pathname))) {
12107
12260
  return "redirect";
@@ -12197,8 +12350,8 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
12197
12350
  const isVercel = preset === "vercel";
12198
12351
  const isCloudflareWorker = preset === "cloudflare-module";
12199
12352
  const outputDir = resolveDeployOutputPath(root, config.deploy.outputDir);
12200
- const runtimeServerOutputDir = isVercel ? path12.join(outputDir, "functions", "__nitro.func") : path12.join(outputDir, "server");
12201
- const ssrOutputDir = path12.join(root, distDir, "ssr");
12353
+ const runtimeServerOutputDir = isVercel ? path13.join(outputDir, "functions", "__nitro.func") : path13.join(outputDir, "server");
12354
+ const ssrOutputDir = path13.join(root, distDir, "ssr");
12202
12355
  const imageRuntime = resolveFarmImageServerRuntime(config.images, preset);
12203
12356
  const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
12204
12357
  (image) => image.sourceType === "module"
@@ -12320,15 +12473,15 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
12320
12473
  resolveHashedClientCssHref(clientOutputDir),
12321
12474
  resolveHashedClientJsSrc(clientOutputDir),
12322
12475
  resolveClientBootSrc(clientOutputDir),
12323
- readFarmDocsModulePreloads(path12.join(root, distDir)),
12324
- readFarmClientModulePreloads(path12.join(root, distDir))
12476
+ readFarmDocsModulePreloads(path13.join(root, distDir)),
12477
+ readFarmClientModulePreloads(path13.join(root, distDir))
12325
12478
  ]);
12326
12479
  let nativeStylesheets;
12327
12480
  const encodedDocsModulePreloads = encodeFarmDocsModulePreloads(docsModulePreloads);
12328
12481
  const encodedClientModulePreloads = encodeFarmClientModulePreloads(clientModulePreloads);
12329
12482
  const encodedMobileShellClient = shouldBuildFarmMobileClient(config) ? encodeFarmMobileShellClient(
12330
12483
  await finalizeFarmMobileClient({
12331
- buildDir: path12.join(root, distDir),
12484
+ buildDir: path13.join(root, distDir),
12332
12485
  clientOutputDir,
12333
12486
  webEntry: clientJsSrc,
12334
12487
  webBoot: clientBootSrc,
@@ -12367,12 +12520,12 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
12367
12520
  await fs4.mkdir(ssrOutputDir, { recursive: true });
12368
12521
  await Promise.all(
12369
12522
  Object.entries(ssrBundle).map(async ([fileName, output]) => {
12370
- const filePath = path12.join(ssrOutputDir, fileName);
12371
- await fs4.mkdir(path12.dirname(filePath), { recursive: true });
12523
+ const filePath = path13.join(ssrOutputDir, fileName);
12524
+ await fs4.mkdir(path13.dirname(filePath), { recursive: true });
12372
12525
  await fs4.writeFile(filePath, output.type === "chunk" ? output.code : output.source);
12373
12526
  })
12374
12527
  );
12375
- const nitroEntryPath = path12.join(ssrOutputDir, "nitro-entry.mjs");
12528
+ const nitroEntryPath = path13.join(ssrOutputDir, "nitro-entry.mjs");
12376
12529
  const nodeAdapterModule = preset === "node-server" ? resolveNitroRuntimeDependency(root, "srvx/node") : null;
12377
12530
  const hasNitroCacheRouteRules = hasFarmNitroCacheRouteRule(config.routeRules);
12378
12531
  const nitroEntryCode = `
@@ -12533,6 +12686,7 @@ ${hasNitroCacheRouteRules ? " let farmGuardedResponse = false\n" : ""} const r
12533
12686
  onResponseFinished: createResponseFinishedHook(event),
12534
12687
  trustedLocalOrigin: resolveTrustedLocalOrigin(event, request),
12535
12688
  clientAddress: resolveFarmClientAddress(event),${hasNitroCacheRouteRules ? `
12689
+ routeRuleCache: Boolean(event.context?.routeRules?.cache),
12536
12690
  onGuardedResponse: () => {
12537
12691
  farmGuardedResponse = true
12538
12692
  },` : ""}
@@ -12549,7 +12703,9 @@ ${hasNitroCacheRouteRules ? " let farmGuardedResponse = false\n" : ""} const r
12549
12703
  }${hasNitroCacheRouteRules ? `
12550
12704
  const farmCacheControl = response.headers.get('cache-control')
12551
12705
  if (
12552
- farmGuardedResponse &&
12706
+ // A guarded response, or any response Farm kept private under a swr or cache rule: the
12707
+ // rule's cache does not store it, and the rule's public Cache-Control must not reach a CDN.
12708
+ (farmGuardedResponse || event.context?.routeRules?.cache) &&
12553
12709
  farmCacheControl &&
12554
12710
  FARM_PRIVATE_CACHE_DIRECTIVE.test(farmCacheControl)
12555
12711
  ) {
@@ -12587,20 +12743,20 @@ function toFarmNodeResponse(request, response) {
12587
12743
  );
12588
12744
  }
12589
12745
  await fs4.writeFile(
12590
- path12.join(ssrOutputDir, FARM_DESKTOP_ENV_MODULE_FILE),
12746
+ path13.join(ssrOutputDir, FARM_DESKTOP_ENV_MODULE_FILE),
12591
12747
  FARM_DESKTOP_ENV_MODULE_SOURCE
12592
12748
  );
12593
12749
  }
12594
- const farmNodeServerEntryPath = preset === "node-server" ? path12.join(ssrOutputDir, "farm-node-server-entry.mjs") : null;
12750
+ const farmNodeServerEntryPath = preset === "node-server" ? path13.join(ssrOutputDir, "farm-node-server-entry.mjs") : null;
12595
12751
  if (farmNodeServerEntryPath && nodeAdapterModule) {
12596
12752
  await fs4.writeFile(
12597
- path12.join(ssrOutputDir, FARM_NODE_ENV_MODULE_FILE),
12753
+ path13.join(ssrOutputDir, FARM_NODE_ENV_MODULE_FILE),
12598
12754
  FARM_NODE_ENV_MODULE_SOURCE
12599
12755
  );
12600
12756
  await fs4.writeFile(
12601
12757
  farmNodeServerEntryPath,
12602
12758
  createFarmNodeServerEntry({
12603
- nitroEntryFile: path12.basename(nitroEntryPath),
12759
+ nitroEntryFile: path13.basename(nitroEntryPath),
12604
12760
  nodeAdapterModule,
12605
12761
  server: config.server,
12606
12762
  websocketAdapterModule: resolveNitroRuntimeDependency(root, "crossws/adapters/node"),
@@ -12608,12 +12764,12 @@ function toFarmNodeResponse(request, response) {
12608
12764
  })
12609
12765
  );
12610
12766
  }
12611
- const farmBunServerEntryPath = preset === "bun" ? path12.join(ssrOutputDir, "farm-bun-server-entry.mjs") : null;
12767
+ const farmBunServerEntryPath = preset === "bun" ? path13.join(ssrOutputDir, "farm-bun-server-entry.mjs") : null;
12612
12768
  if (farmBunServerEntryPath) {
12613
12769
  await fs4.writeFile(
12614
12770
  farmBunServerEntryPath,
12615
12771
  createFarmBunServerEntry({
12616
- nitroEntryFile: path12.basename(nitroEntryPath),
12772
+ nitroEntryFile: path13.basename(nitroEntryPath),
12617
12773
  bunAdapterModule: resolveNitroRuntimeDependency(root, "srvx/bun"),
12618
12774
  server: config.server,
12619
12775
  websocketAdapterModule: resolveNitroRuntimeDependency(root, "crossws/adapters/bun"),
@@ -12621,7 +12777,7 @@ function toFarmNodeResponse(request, response) {
12621
12777
  })
12622
12778
  );
12623
12779
  }
12624
- const farmNetlifyEntryPath = preset === "netlify" ? path12.join(ssrOutputDir, "farm-netlify-entry.mjs") : null;
12780
+ const farmNetlifyEntryPath = preset === "netlify" ? path13.join(ssrOutputDir, "farm-netlify-entry.mjs") : null;
12625
12781
  if (farmNetlifyEntryPath) {
12626
12782
  await fs4.writeFile(
12627
12783
  farmNetlifyEntryPath,
@@ -12630,7 +12786,7 @@ function toFarmNodeResponse(request, response) {
12630
12786
  })
12631
12787
  );
12632
12788
  }
12633
- const farmCloudflareEnvPath = preset === "cloudflare-pages" ? path12.join(ssrOutputDir, "farm-cloudflare-env.mjs") : null;
12789
+ const farmCloudflareEnvPath = preset === "cloudflare-pages" ? path13.join(ssrOutputDir, "farm-cloudflare-env.mjs") : null;
12634
12790
  if (farmCloudflareEnvPath) {
12635
12791
  await fs4.writeFile(
12636
12792
  farmCloudflareEnvPath,
@@ -12647,7 +12803,11 @@ function toFarmNodeResponse(request, response) {
12647
12803
  ssrEntryFile
12648
12804
  );
12649
12805
  const configuredNitroRouteRules = nitroRouteRulesBelowBasePath(
12650
- shouldBuildFarmMobileClient(config) ? varyFarmNitroCacheRulesByShell(routeRulesToNitroRouteRules(config.routeRules)) : routeRulesToNitroRouteRules(config.routeRules),
12806
+ varyFarmNitroCacheRules(routeRulesToNitroRouteRules(config.routeRules), [
12807
+ ...config.md.enabled ? ["accept"] : [],
12808
+ ...shouldBuildFarmMobileClient(config) ? ["x-farm-shell"] : [],
12809
+ ...resolveFarmServerComponentsMode(config.experimental?.serverComponents) === "islands" ? ["f-layouts"] : []
12810
+ ]),
12651
12811
  config.basePath,
12652
12812
  resolveFarmAPIServerBasePath(config.api)
12653
12813
  );
@@ -12674,6 +12834,18 @@ function toFarmNodeResponse(request, response) {
12674
12834
  ];
12675
12835
  })
12676
12836
  );
12837
+ const immutableAssets = isVercel ? { publicAssets: [], routeRules: {} } : planFarmImmutableAssets({
12838
+ clientOutputDir,
12839
+ files: await listFarmClientOutputFiles(clientOutputDir),
12840
+ routeRules: configuredNitroRouteRules,
12841
+ routePaths: [
12842
+ ...[...routeManager.getRoutes().keys()].map(
12843
+ (pattern) => applyFarmBasePath(pattern, config.basePath)
12844
+ ),
12845
+ ...apiRouteManager.getRoutes().keys(),
12846
+ resolveFarmAPIServerBasePath(config.api)
12847
+ ]
12848
+ });
12677
12849
  let nitroConfig = {
12678
12850
  preset,
12679
12851
  ...farmNodeServerEntryPath ? { entry: farmNodeServerEntryPath } : {},
@@ -12688,17 +12860,13 @@ function toFarmNodeResponse(request, response) {
12688
12860
  // `src` directory), as Nitro handlers outside Farm's aliases.
12689
12861
  serverDir: false,
12690
12862
  serverEntry: false,
12691
- buildDir: path12.join(root, distDir, ".nitro"),
12863
+ buildDir: path13.join(root, distDir, ".nitro"),
12692
12864
  alias: resolveNitroInternalRuntimeAliases(root),
12693
12865
  compatibilityDate: "2024-12-01",
12694
12866
  output: resolveFarmNitroOutputConfig(preset, outputDir),
12695
- publicAssets: [
12696
- {
12697
- dir: clientOutputDir,
12698
- maxAge: 31536e3,
12699
- baseURL: "/"
12700
- }
12701
- ],
12867
+ // Nitro gives the root directory no Cache-Control on any preset (it falls through to the
12868
+ // app), so public files keep revalidating; the hashed directories carry their own maxAge.
12869
+ publicAssets: [{ dir: clientOutputDir, baseURL: "/" }, ...immutableAssets.publicAssets],
12702
12870
  // A self-hosted Node server sends static files itself, so precompress them
12703
12871
  // with gzip and let Nitro serve that by Accept-Encoding. Brotli at Nitro's
12704
12872
  // fixed top quality cost a docs app ~20 s of build CPU for a small further
@@ -12752,6 +12920,7 @@ function toFarmNodeResponse(request, response) {
12752
12920
  "/**": {
12753
12921
  prerender: false
12754
12922
  },
12923
+ ...immutableAssets.routeRules,
12755
12924
  ...configuredNitroRouteRules,
12756
12925
  // Exact user rules must retain their runtime settings without replacing
12757
12926
  // the headers and prerender marker generated for a safe physical page.
@@ -12780,7 +12949,7 @@ function toFarmNodeResponse(request, response) {
12780
12949
  if (pluginManager) {
12781
12950
  nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
12782
12951
  }
12783
- const expectedServerDir = path12.join(outputDir, "server");
12952
+ const expectedServerDir = path13.join(outputDir, "server");
12784
12953
  const customRollupKeys = Object.keys(nitroConfig.rollupConfig || {}).filter(
12785
12954
  (key) => key !== "external" && key !== "plugins"
12786
12955
  );
@@ -12795,10 +12964,10 @@ function toFarmNodeResponse(request, response) {
12795
12964
  const requestedBuilder = nitroConfig.builder ?? process.env.NITRO_BUILDER;
12796
12965
  const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && nitroConfig.rollupConfig?.external === nitroRollupExternal && !hasRollupPlugins(nitroConfig.rollupConfig?.plugins) && customRollupKeys.length === 0 && Boolean(
12797
12966
  nitroConfig.handlers?.some(
12798
- (handler) => path12.resolve(handler?.handler || "") === nitroEntryPath
12967
+ (handler) => path13.resolve(handler?.handler || "") === nitroEntryPath
12799
12968
  )
12800
12969
  );
12801
- const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && path12.resolve(nitroConfig.output?.serverDir || "") === path12.resolve(expectedServerDir);
12970
+ const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && path13.resolve(nitroConfig.output?.serverDir || "") === path13.resolve(expectedServerDir);
12802
12971
  const prerenderReusesPrebuiltSSR = prerenderRoutes.length > 0 && ssrExternalsArePackaged && nitroBuildIsFarms;
12803
12972
  const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
12804
12973
  if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
@@ -12904,8 +13073,8 @@ function toFarmNodeResponse(request, response) {
12904
13073
  };
12905
13074
  prerendererConfig.output = {
12906
13075
  ...prerendererConfig.output,
12907
- serverDir: path12.join(
12908
- prerendererConfig.buildDir ?? path12.join(root, distDir, ".nitro"),
13076
+ serverDir: path13.join(
13077
+ prerendererConfig.buildDir ?? path13.join(root, distDir, ".nitro"),
12909
13078
  "prerender"
12910
13079
  )
12911
13080
  };
@@ -12924,7 +13093,7 @@ function toFarmNodeResponse(request, response) {
12924
13093
  const prerenderServerDir = prerenderer.options.output.serverDir;
12925
13094
  await copyPrebuiltSSRBundle(
12926
13095
  ssrBundle,
12927
- path12.join(prerenderServerDir, FARM_SSR_OUTPUT_DIR),
13096
+ path13.join(prerenderServerDir, FARM_SSR_OUTPUT_DIR),
12928
13097
  null,
12929
13098
  fs4
12930
13099
  );
@@ -13000,7 +13169,7 @@ function toFarmNodeResponse(request, response) {
13000
13169
  const copyResults = await Promise.allSettled([
13001
13170
  prebuiltSSRFilesResult.value ? writeSSRBundleFiles(
13002
13171
  prebuiltSSRFilesResult.value,
13003
- path12.join(outputDir, "server", FARM_SSR_OUTPUT_DIR),
13172
+ path13.join(outputDir, "server", FARM_SSR_OUTPUT_DIR),
13004
13173
  fs4
13005
13174
  ) : Promise.resolve(),
13006
13175
  runtimeCopyPromise
@@ -13010,14 +13179,14 @@ function toFarmNodeResponse(request, response) {
13010
13179
  );
13011
13180
  if (failedCopy) throw failedCopy.reason;
13012
13181
  if (canReusePrebuiltSSR) {
13013
- await registerPrebuiltSSRPackageImport(path12.join(outputDir, "server"), ssrEntryFile, fs4);
13182
+ await registerPrebuiltSSRPackageImport(path13.join(outputDir, "server"), ssrEntryFile, fs4);
13014
13183
  logger.info("\u26A1 Reused Farm's prebuilt SSR bundle for the Node output");
13015
13184
  }
13016
13185
  if (useRolldownBuilder) {
13017
13186
  logger.info("\u26A1 Built the Node adapter with Rolldown");
13018
13187
  }
13019
13188
  if (preset === "node-server" && !desktopServerEntry) {
13020
- await installFarmCompileCacheLauncher(path12.join(outputDir, "server"), fs4);
13189
+ await installFarmCompileCacheLauncher(path13.join(outputDir, "server"), fs4);
13021
13190
  }
13022
13191
  if (preset.startsWith("cloudflare")) {
13023
13192
  await populateCloudflareProcessEnv(nitroInstance.options.output.serverDir, fs4);
@@ -13040,7 +13209,7 @@ function toFarmNodeResponse(request, response) {
13040
13209
  routeRuntimeManifest,
13041
13210
  farmCron.provider === "host" ? farmCron.jobs : [],
13042
13211
  {
13043
- buildDir: path12.join(root, distDir),
13212
+ buildDir: path13.join(root, distDir),
13044
13213
  middlewareRoutes: edgeMiddlewareRoutes,
13045
13214
  guardedPages: edgeGuardedPrerenderRoutes
13046
13215
  },
@@ -13054,16 +13223,16 @@ function resolveFarmNitroOutputConfig(preset, outputDir) {
13054
13223
  return {
13055
13224
  dir: outputDir,
13056
13225
  ...preset === "node-server" ? {
13057
- serverDir: path12.join(outputDir, "server"),
13058
- publicDir: path12.join(outputDir, "public")
13226
+ serverDir: path13.join(outputDir, "server"),
13227
+ publicDir: path13.join(outputDir, "public")
13059
13228
  } : isVercel ? {
13060
- serverDir: path12.join(outputDir, "functions", "__nitro.func"),
13061
- publicDir: path12.join(outputDir, "static")
13229
+ serverDir: path13.join(outputDir, "functions", "__nitro.func"),
13230
+ publicDir: path13.join(outputDir, "static")
13062
13231
  } : {}
13063
13232
  };
13064
13233
  }
13065
13234
  async function populateCloudflareProcessEnv(serverDir, fs4) {
13066
- const wranglerPath = path12.join(serverDir, "wrangler.json");
13235
+ const wranglerPath = path13.join(serverDir, "wrangler.json");
13067
13236
  let source;
13068
13237
  try {
13069
13238
  source = await fs4.readFile(wranglerPath, "utf8");
@@ -13091,8 +13260,8 @@ async function writeSSRBundleFiles(files, targetDir, fs4) {
13091
13260
  await fs4.rm(targetDir, { recursive: true, force: true });
13092
13261
  await Promise.all(
13093
13262
  files.map(async ({ fileName, contents }) => {
13094
- const targetPath = path12.join(targetDir, fileName);
13095
- await fs4.mkdir(path12.dirname(targetPath), { recursive: true });
13263
+ const targetPath = path13.join(targetDir, fileName);
13264
+ await fs4.mkdir(path13.dirname(targetPath), { recursive: true });
13096
13265
  await fs4.writeFile(targetPath, contents);
13097
13266
  })
13098
13267
  );
@@ -13101,8 +13270,8 @@ async function copyPrebuiltSSRBundle(ssrBundle, targetDir, minifyOptions, fs4) {
13101
13270
  await writeSSRBundleFiles(await prepareSSRBundleFiles(ssrBundle, minifyOptions), targetDir, fs4);
13102
13271
  }
13103
13272
  async function installFarmCompileCacheLauncher(serverDir, fs4) {
13104
- const entryPath = path12.join(serverDir, "index.mjs");
13105
- const serverPath = path12.join(serverDir, FARM_SERVER_MODULE_FILE);
13273
+ const entryPath = path13.join(serverDir, "index.mjs");
13274
+ const serverPath = path13.join(serverDir, FARM_SERVER_MODULE_FILE);
13106
13275
  const entry = await fs4.readFile(entryPath, "utf8").catch((error) => {
13107
13276
  if (error.code === "ENOENT") return null;
13108
13277
  throw error;
@@ -13111,11 +13280,11 @@ async function installFarmCompileCacheLauncher(serverDir, fs4) {
13111
13280
  if (entry.includes(`./${FARM_SERVER_MODULE_FILE}`)) return false;
13112
13281
  await fs4.rename(entryPath, serverPath);
13113
13282
  await fs4.writeFile(entryPath, createFarmCompileCacheLauncher(FARM_SERVER_MODULE_FILE));
13114
- await fs4.rm(path12.join(serverDir, FARM_COMPILE_CACHE_DIR), { recursive: true, force: true });
13283
+ await fs4.rm(path13.join(serverDir, FARM_COMPILE_CACHE_DIR), { recursive: true, force: true });
13115
13284
  return true;
13116
13285
  }
13117
13286
  async function registerPrebuiltSSRPackageImport(serverDir, ssrEntryFile, fs4) {
13118
- const packagePath = path12.join(serverDir, "package.json");
13287
+ const packagePath = path13.join(serverDir, "package.json");
13119
13288
  const packageJSON = await fs4.readFile(packagePath, "utf8").then((contents) => JSON.parse(contents)).catch((error) => {
13120
13289
  if (error.code === "ENOENT") return { type: "module" };
13121
13290
  throw error;
@@ -13144,18 +13313,18 @@ async function moveVercelOutputPath(src, dest, fs4) {
13144
13313
  await fs4.rm(src, { recursive: true, force: true });
13145
13314
  }
13146
13315
  async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflows, routeRuntimeManifest, cronJobs, edgeMiddleware, prerenderedPages) {
13147
- const serverDir = path12.join(outputDir, "server");
13148
- const functionsDir = path12.join(outputDir, "functions");
13149
- const nitroFuncDir = path12.join(functionsDir, "__nitro.func");
13150
- const staticDir = path12.join(outputDir, "static");
13151
- const publicDir = path12.join(outputDir, "public");
13316
+ const serverDir = path13.join(outputDir, "server");
13317
+ const functionsDir = path13.join(outputDir, "functions");
13318
+ const nitroFuncDir = path13.join(functionsDir, "__nitro.func");
13319
+ const staticDir = path13.join(outputDir, "static");
13320
+ const publicDir = path13.join(outputDir, "public");
13152
13321
  await fs4.mkdir(nitroFuncDir, { recursive: true });
13153
13322
  const serverContents = await fs4.readdir(serverDir).catch((error) => {
13154
13323
  if (error.code === "ENOENT") return [];
13155
13324
  throw error;
13156
13325
  });
13157
13326
  for (const file of serverContents) {
13158
- await moveVercelOutputPath(path12.join(serverDir, file), path12.join(nitroFuncDir, file), fs4);
13327
+ await moveVercelOutputPath(path13.join(serverDir, file), path13.join(nitroFuncDir, file), fs4);
13159
13328
  }
13160
13329
  if (serverContents.length > 0) await fs4.rm(serverDir, { recursive: true, force: true });
13161
13330
  try {
@@ -13165,7 +13334,7 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
13165
13334
  }
13166
13335
  await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4);
13167
13336
  await copyPrismaClientForVercel(root, nitroFuncDir, fs4);
13168
- const configPath = path12.join(outputDir, "config.json");
13337
+ const configPath = path13.join(outputDir, "config.json");
13169
13338
  const configContent = await fs4.readFile(configPath, "utf-8");
13170
13339
  const vercelConfig = JSON.parse(configContent);
13171
13340
  const runtimeRoutes = await createFarmVercelRouteRuntimeFunctions(
@@ -13209,7 +13378,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
13209
13378
  mainRoot,
13210
13379
  root,
13211
13380
  config.srcDir,
13212
- path12.join(nitroFuncDir, "farm-docs-content"),
13381
+ path13.join(nitroFuncDir, "farm-docs-content"),
13213
13382
  fs4
13214
13383
  );
13215
13384
  for (const [index, docsRoot] of extraRoots.entries()) {
@@ -13217,7 +13386,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
13217
13386
  docsRoot,
13218
13387
  root,
13219
13388
  config.srcDir,
13220
- path12.join(nitroFuncDir, "farm-docs-roots", String(index)),
13389
+ path13.join(nitroFuncDir, "farm-docs-roots", String(index)),
13221
13390
  fs4
13222
13391
  );
13223
13392
  }
@@ -13235,17 +13404,18 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
13235
13404
  );
13236
13405
  }
13237
13406
  await fs4.rm(bundledContentDir, { recursive: true, force: true });
13238
- await fs4.mkdir(path12.dirname(bundledContentDir), { recursive: true });
13407
+ await fs4.mkdir(path13.dirname(bundledContentDir), { recursive: true });
13239
13408
  await fs4.cp(docsContentDir, bundledContentDir, {
13240
13409
  recursive: true,
13241
- force: true
13410
+ force: true,
13411
+ dereference: true
13242
13412
  });
13243
13413
  await fs4.writeFile(
13244
- path12.join(bundledContentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST),
13414
+ path13.join(bundledContentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST),
13245
13415
  `${JSON.stringify(lastModifiedManifest, null, 2)}
13246
13416
  `
13247
13417
  );
13248
- logger.info(`\u{1F4DA} Bundled docs content for Vercel: ${path12.relative(root, docsContentDir)}`);
13418
+ logger.info(`\u{1F4DA} Bundled docs content for Vercel: ${path13.relative(root, docsContentDir)}`);
13249
13419
  }
13250
13420
  function resolveServerFunctionPlatform(preset) {
13251
13421
  return preset === "vercel" || preset === "netlify" ? { os: "linux", cpu: "x64", libc: "glibc" } : null;
@@ -13262,7 +13432,7 @@ function platformFieldAllows(field, value) {
13262
13432
  }
13263
13433
  async function stageSharpRuntime(config, root, distDir, fs4, preset) {
13264
13434
  const functionPlatform = resolveServerFunctionPlatform(preset);
13265
- const projectRequire = createRequire2(path12.join(root, "package.json"));
13435
+ const projectRequire = createRequire2(path13.join(root, "package.json"));
13266
13436
  let sharpRequire = projectRequire;
13267
13437
  if (!resolvePackageJson(projectRequire, "sharp")) {
13268
13438
  try {
@@ -13272,10 +13442,10 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
13272
13442
  }
13273
13443
  const copiedPackages = /* @__PURE__ */ new Map();
13274
13444
  const packageCopies = /* @__PURE__ */ new Map();
13275
- const stageRoot = path12.join(root, distDir, "tmp");
13445
+ const stageRoot = path13.join(root, distDir, "tmp");
13276
13446
  await fs4.mkdir(stageRoot, { recursive: true });
13277
- const stageDir = await fs4.mkdtemp(path12.join(stageRoot, "sharp-runtime-"));
13278
- const targetNodeModules = path12.join(stageDir, "node_modules");
13447
+ const stageDir = await fs4.mkdtemp(path13.join(stageRoot, "sharp-runtime-"));
13448
+ const targetNodeModules = path13.join(stageDir, "node_modules");
13279
13449
  function copyPackage(packageName, parentRequire) {
13280
13450
  const activeCopy = packageCopies.get(packageName);
13281
13451
  if (activeCopy) return activeCopy;
@@ -13288,10 +13458,10 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
13288
13458
  if (!packageJsonPath) return;
13289
13459
  const packageJson = JSON.parse(await fs4.readFile(packageJsonPath, "utf8"));
13290
13460
  if (functionPlatform && !packageSupportsPlatform(packageJson, functionPlatform)) return;
13291
- const packageDir = path12.dirname(packageJsonPath);
13292
- const targetDir = path12.join(targetNodeModules, ...packageName.split("/"));
13461
+ const packageDir = path13.dirname(packageJsonPath);
13462
+ const targetDir = path13.join(targetNodeModules, ...packageName.split("/"));
13293
13463
  copiedPackages.set(packageName, String(packageJson.version || "*"));
13294
- await fs4.mkdir(path12.dirname(targetDir), { recursive: true });
13464
+ await fs4.mkdir(path13.dirname(targetDir), { recursive: true });
13295
13465
  const packageRequire = createRequire2(packageJsonPath);
13296
13466
  const dependencies = {
13297
13467
  ...packageJson.dependencies,
@@ -13326,8 +13496,8 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
13326
13496
  };
13327
13497
  }
13328
13498
  async function installStagedSharpRuntime(staged, nitroFuncDir, fs4) {
13329
- const stagedNodeModules = path12.join(staged.stageDir, "node_modules");
13330
- const targetNodeModules = path12.join(nitroFuncDir, "node_modules");
13499
+ const stagedNodeModules = path13.join(staged.stageDir, "node_modules");
13500
+ const targetNodeModules = path13.join(nitroFuncDir, "node_modules");
13331
13501
  try {
13332
13502
  await mergeStagedDirectory(stagedNodeModules, targetNodeModules, fs4);
13333
13503
  const functionPackage = await readNitroOutputPackage(nitroFuncDir, fs4);
@@ -13355,8 +13525,8 @@ async function mergeStagedDirectory(sourceDir, targetDir, fs4) {
13355
13525
  const entries = await fs4.readdir(sourceDir, { withFileTypes: true });
13356
13526
  await settleAllOrThrow(
13357
13527
  entries.map(async (entry) => {
13358
- const sourcePath = path12.join(sourceDir, entry.name);
13359
- const targetPath = path12.join(targetDir, entry.name);
13528
+ const sourcePath = path13.join(sourceDir, entry.name);
13529
+ const targetPath = path13.join(targetDir, entry.name);
13360
13530
  try {
13361
13531
  await fs4.rename(sourcePath, targetPath);
13362
13532
  return;
@@ -13383,13 +13553,13 @@ async function mergeStagedDirectory(sourceDir, targetDir, fs4) {
13383
13553
  function assertMetadataImageRuntimeInstalled(root, metadataImageRoutes) {
13384
13554
  const generated = metadataImageRoutes.find((image) => image.sourceType === "module");
13385
13555
  if (!generated || resolveMetadataImageRuntimePackageJson(root)) return;
13386
- const file = generated.modulePath ? toPosixPath(path12.relative(root, generated.modulePath)) : "";
13556
+ const file = generated.modulePath ? toPosixPath(path13.relative(root, generated.modulePath)) : "";
13387
13557
  throw new Error(
13388
13558
  `${file || "A generated metadata image"} renders with @vercel/og, which is not installed. ${VERCEL_OG_INSTALL_HINT}`
13389
13559
  );
13390
13560
  }
13391
13561
  function resolveMetadataImageRuntimePackageJson(root) {
13392
- const projectRequire = createRequire2(path12.join(root, "package.json"));
13562
+ const projectRequire = createRequire2(path13.join(root, "package.json"));
13393
13563
  const packageJsonPath = resolvePackageJson(projectRequire, "@vercel/og");
13394
13564
  if (packageJsonPath) return packageJsonPath;
13395
13565
  try {
@@ -13402,9 +13572,9 @@ async function copyMetadataImageRuntime(root, nitroFuncDir, fs4) {
13402
13572
  const packageJsonPath = resolveMetadataImageRuntimePackageJson(root);
13403
13573
  if (!packageJsonPath) return;
13404
13574
  const packageJson = JSON.parse(await fs4.readFile(packageJsonPath, "utf8"));
13405
- const packageDir = path12.dirname(packageJsonPath);
13406
- const targetDir = path12.join(nitroFuncDir, "node_modules", "@vercel", "og");
13407
- await fs4.mkdir(path12.dirname(targetDir), { recursive: true });
13575
+ const packageDir = path13.dirname(packageJsonPath);
13576
+ const targetDir = path13.join(nitroFuncDir, "node_modules", "@vercel", "og");
13577
+ await fs4.mkdir(path13.dirname(targetDir), { recursive: true });
13408
13578
  await fs4.cp(packageDir, targetDir, {
13409
13579
  recursive: true,
13410
13580
  force: true,
@@ -13420,7 +13590,7 @@ async function copyMetadataImageRuntime(root, nitroFuncDir, fs4) {
13420
13590
  logger.info("\u{1F5BC}\uFE0F Bundled generated metadata image runtime");
13421
13591
  }
13422
13592
  async function readNitroOutputPackage(outputDir, fs4) {
13423
- const packagePath = path12.join(outputDir, "package.json");
13593
+ const packagePath = path13.join(outputDir, "package.json");
13424
13594
  return fs4.readFile(packagePath, "utf8").then((contents) => JSON.parse(contents)).catch((error) => {
13425
13595
  if (error.code === "ENOENT") return {};
13426
13596
  throw error;
@@ -13429,7 +13599,7 @@ async function readNitroOutputPackage(outputDir, fs4) {
13429
13599
  async function writeNitroOutputPackage(outputDir, packageJson, fs4) {
13430
13600
  await fs4.mkdir(outputDir, { recursive: true });
13431
13601
  await fs4.writeFile(
13432
- path12.join(outputDir, "package.json"),
13602
+ path13.join(outputDir, "package.json"),
13433
13603
  `${JSON.stringify(packageJson, null, 2)}
13434
13604
  `
13435
13605
  );
@@ -13445,9 +13615,9 @@ function resolvePackageJson(parentRequire, packageName) {
13445
13615
  }
13446
13616
  }
13447
13617
  try {
13448
- let directory = path12.dirname(metadataModule ?? parentRequire.resolve(packageName));
13449
- while (directory !== path12.dirname(directory)) {
13450
- const candidate = path12.join(directory, "package.json");
13618
+ let directory = path13.dirname(metadataModule ?? parentRequire.resolve(packageName));
13619
+ while (directory !== path13.dirname(directory)) {
13620
+ const candidate = path13.join(directory, "package.json");
13451
13621
  if (existsSync2(candidate)) {
13452
13622
  try {
13453
13623
  const manifest = JSON.parse(readFileSync(candidate, "utf8"));
@@ -13455,23 +13625,23 @@ function resolvePackageJson(parentRequire, packageName) {
13455
13625
  } catch {
13456
13626
  }
13457
13627
  }
13458
- if (path12.basename(directory) === "node_modules") break;
13459
- directory = path12.dirname(directory);
13628
+ if (path13.basename(directory) === "node_modules") break;
13629
+ directory = path13.dirname(directory);
13460
13630
  }
13461
13631
  } catch {
13462
13632
  }
13463
13633
  return null;
13464
13634
  }
13465
13635
  async function resolveProjectInstalledPackageDir(root, packageName, fs4) {
13466
- let directory = path12.resolve(root);
13636
+ let directory = path13.resolve(root);
13467
13637
  while (true) {
13468
- const candidate = path12.join(directory, "node_modules", ...packageName.split("/"));
13638
+ const candidate = path13.join(directory, "node_modules", ...packageName.split("/"));
13469
13639
  try {
13470
13640
  const packageDir = await fs4.realpath(candidate);
13471
- if ((await fs4.stat(path12.join(packageDir, "package.json"))).isFile()) return packageDir;
13641
+ if ((await fs4.stat(path13.join(packageDir, "package.json"))).isFile()) return packageDir;
13472
13642
  } catch {
13473
13643
  }
13474
- const parent = path12.dirname(directory);
13644
+ const parent = path13.dirname(directory);
13475
13645
  if (parent === directory) return null;
13476
13646
  directory = parent;
13477
13647
  }
@@ -13479,16 +13649,16 @@ async function resolveProjectInstalledPackageDir(root, packageName, fs4) {
13479
13649
  async function copyPrismaClientForVercel(root, nitroFuncDir, fs4) {
13480
13650
  const prismaClientDir = await resolveProjectInstalledPackageDir(root, "@prisma/client", fs4);
13481
13651
  if (!prismaClientDir) return;
13482
- const generatedClientDir = path12.join(prismaClientDir, "..", "..", ".prisma", "client");
13652
+ const generatedClientDir = path13.join(prismaClientDir, "..", "..", ".prisma", "client");
13483
13653
  try {
13484
13654
  await fs4.access(generatedClientDir);
13485
13655
  } catch {
13486
13656
  return;
13487
13657
  }
13488
- const targetNodeModules = path12.join(nitroFuncDir, "node_modules");
13489
- const targetPrismaScopeDir = path12.join(targetNodeModules, "@prisma");
13490
- const targetGeneratedDir = path12.join(targetNodeModules, ".prisma", "client");
13491
- const targetClientDir = path12.join(targetPrismaScopeDir, "client");
13658
+ const targetNodeModules = path13.join(nitroFuncDir, "node_modules");
13659
+ const targetPrismaScopeDir = path13.join(targetNodeModules, "@prisma");
13660
+ const targetGeneratedDir = path13.join(targetNodeModules, ".prisma", "client");
13661
+ const targetClientDir = path13.join(targetPrismaScopeDir, "client");
13492
13662
  await fs4.mkdir(targetPrismaScopeDir, { recursive: true });
13493
13663
  await fs4.cp(prismaClientDir, targetClientDir, {
13494
13664
  recursive: true,
@@ -13498,7 +13668,7 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs4) {
13498
13668
  recursive: true,
13499
13669
  force: true
13500
13670
  });
13501
- const clientPackagePath = path12.join(prismaClientDir, "package.json");
13671
+ const clientPackagePath = path13.join(prismaClientDir, "package.json");
13502
13672
  const [functionPackage, clientPackageContent] = await Promise.all([
13503
13673
  readNitroOutputPackage(nitroFuncDir, fs4),
13504
13674
  fs4.readFile(clientPackagePath, "utf-8")
@@ -13684,9 +13854,9 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
13684
13854
  } else {
13685
13855
  const { build: legacyViteBuild } = await import("vite");
13686
13856
  logger.info("\u{1F4E6} Building client bundle...");
13687
- await buildClient2(legacyViteBuild, config, root, srcDir, path13.join(root, distDir, "client"));
13857
+ await buildClient2(legacyViteBuild, config, root, srcDir, path14.join(root, distDir, "client"));
13688
13858
  logger.info("\u{1F4E6} Building SSR bundle...");
13689
- await buildSSR(legacyViteBuild, config, root, srcDir, path13.join(root, distDir, "server"));
13859
+ await buildSSR(legacyViteBuild, config, root, srcDir, path14.join(root, distDir, "server"));
13690
13860
  logger.info(`\u{1F680} Building server with Nitro (preset: ${preset})...`);
13691
13861
  await buildNitro(
13692
13862
  config,
@@ -13788,8 +13958,8 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
13788
13958
  root,
13789
13959
  // Vite keys its pre-bundled dependencies on the config, mode included, so this server and
13790
13960
  // `farm dev` sharing one cache would each rebuild it after the other ran.
13791
- cacheDir: path13.join(
13792
- path13.resolve(root, viteConfig.cacheDir ?? path13.join("node_modules", ".vite")),
13961
+ cacheDir: path14.join(
13962
+ path14.resolve(root, viteConfig.cacheDir ?? path14.join("node_modules", ".vite")),
13793
13963
  "farm-build"
13794
13964
  ),
13795
13965
  configFile: false,
@@ -13823,7 +13993,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
13823
13993
  }
13824
13994
  async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
13825
13995
  const { farmI18nClientBridgePlugin, farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
13826
- const { PluginManager: PluginManager2 } = await import("./plugin-VEBRN7A3.mjs");
13996
+ const { PluginManager: PluginManager2 } = await import("./plugin-QZT747YW.mjs");
13827
13997
  const pluginManager = new PluginManager2({
13828
13998
  config,
13829
13999
  isDev: false,
@@ -13850,7 +14020,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
13850
14020
  }
13851
14021
  async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
13852
14022
  const { farmI18nClientBridgePlugin, farmPlugin } = await import("./vite.mjs");
13853
- const { PluginManager: PluginManager2 } = await import("./plugin-VEBRN7A3.mjs");
14023
+ const { PluginManager: PluginManager2 } = await import("./plugin-QZT747YW.mjs");
13854
14024
  const pluginManager = new PluginManager2({
13855
14025
  config,
13856
14026
  isDev: false,
@@ -13882,16 +14052,16 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
13882
14052
  });
13883
14053
  }
13884
14054
  function resolveLegacyPageEntry(config, root, srcDir) {
13885
- const appDir = path13.join(root, srcDir, "app");
14055
+ const appDir = path14.join(root, srcDir, "app");
13886
14056
  for (const extension of getFarmRendererComponentExtensions(config.renderer)) {
13887
- const candidate = path13.join(appDir, `page${extension}`);
14057
+ const candidate = path14.join(appDir, `page${extension}`);
13888
14058
  if (existsSync3(candidate)) return candidate;
13889
14059
  }
13890
- return path13.join(appDir, "page.tsx");
14060
+ return path14.join(appDir, "page.tsx");
13891
14061
  }
13892
14062
  async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
13893
14063
  const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
13894
- import("./nitro-NSTXT7LB.mjs"),
14064
+ import("./nitro-72TFIGGO.mjs"),
13895
14065
  import("nitro/builder")
13896
14066
  ]);
13897
14067
  let nitroConfig = await createNitroConfig(
@@ -13905,18 +14075,18 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
13905
14075
  nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
13906
14076
  }
13907
14077
  const outputDir = resolveDeployOutputPath(root, config.deploy.outputDir);
13908
- const serverOutputDir = path13.join(outputDir, "server");
13909
- const publicOutputDir = path13.join(outputDir, "public");
14078
+ const serverOutputDir = path14.join(outputDir, "server");
14079
+ const publicOutputDir = path14.join(outputDir, "public");
13910
14080
  const { mkdir, cp } = await import("fs/promises");
13911
14081
  await mkdir(serverOutputDir, { recursive: true });
13912
14082
  await mkdir(publicOutputDir, { recursive: true });
13913
- const clientDir = path13.join(root, distDir, "client");
14083
+ const clientDir = path14.join(root, distDir, "client");
13914
14084
  try {
13915
14085
  await mkdir(publicOutputDir, { recursive: true });
13916
14086
  await cp(clientDir, publicOutputDir, { recursive: true });
13917
14087
  logger.info("\u{1F4E6} Copied client assets to public directory");
13918
- const manifestPath = path13.join(publicOutputDir, "farm-client-manifest.json");
13919
- const assetsDir = path13.join(publicOutputDir, "assets");
14088
+ const manifestPath = path14.join(publicOutputDir, "farm-client-manifest.json");
14089
+ const assetsDir = path14.join(publicOutputDir, "assets");
13920
14090
  const manifestExists = await import("fs/promises").then(
13921
14091
  (fs4) => fs4.access(manifestPath).then(() => true).catch(() => false)
13922
14092
  );
@@ -13932,8 +14102,8 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
13932
14102
  logger.error(`\u274C Failed to copy client assets: ${error}`);
13933
14103
  throw error;
13934
14104
  }
13935
- const serverDir = path13.join(root, distDir, "server");
13936
- const nitroServerDir = path13.join(root, distDir, ".nitro", "server", "farm");
14105
+ const serverDir = path14.join(root, distDir, "server");
14106
+ const nitroServerDir = path14.join(root, distDir, ".nitro", "server", "farm");
13937
14107
  try {
13938
14108
  await mkdir(nitroServerDir, { recursive: true });
13939
14109
  await cp(serverDir, nitroServerDir, { recursive: true });
@@ -13942,7 +14112,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
13942
14112
  logger.warn(`Could not copy SSR bundles: ${error}`);
13943
14113
  }
13944
14114
  const nitro = await createNitro(nitroConfig);
13945
- const registryPath = path13.join(root, distDir, ".nitro", "server", "farm-registry.ts");
14115
+ const registryPath = path14.join(root, distDir, ".nitro", "server", "farm-registry.ts");
13946
14116
  try {
13947
14117
  const { farmRegistry } = await import(
13948
14118
  /* @vite-ignore */
@@ -13959,7 +14129,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
13959
14129
  }
13960
14130
  farmRegistry.routePaths = routePaths;
13961
14131
  try {
13962
- const clientManifestPath = path13.join(root, distDir, "client", "farm-client-manifest.json");
14132
+ const clientManifestPath = path14.join(root, distDir, "client", "farm-client-manifest.json");
13963
14133
  const { readFile } = await import("fs/promises");
13964
14134
  const manifestContent = await readFile(clientManifestPath, "utf-8");
13965
14135
  farmRegistry.clientManifest = JSON.parse(manifestContent);