@farm.js/core 0.1.68 → 0.1.70

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 (318) hide show
  1. package/dist/{agent-mcp-handler-FER4MQDF.cjs → agent-mcp-handler-6T2Z7TB6.cjs} +8 -5
  2. package/dist/{agent-mcp-handler-AZ7QW4UP.mjs → agent-mcp-handler-CPU354QQ.mjs} +7 -4
  3. package/dist/{agent-mcp.d-Uh5xr7aX.d.ts → agent-mcp.d-DulgFLBt.d.ts} +13 -4
  4. package/dist/{agent-mcp.d-wkVPK1GA.d.mts → agent-mcp.d-TAs1ES2F.d.mts} +13 -4
  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-GUIRJWZH.cjs +16 -0
  10. package/dist/{analyzer-CQDU7E3Y.mjs → analyzer-QGRBLETM.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 -24
  21. package/dist/api.d.ts +8 -24
  22. package/dist/api.mjs +5 -5
  23. package/dist/{app-manifest.d-Dd4q5CFx.d.mts → app-manifest.d-6zXb90o6.d.mts} +1 -1
  24. package/dist/{app-manifest.d-BT5i2F-o.d.ts → app-manifest.d-C-nf3Vmm.d.ts} +1 -1
  25. package/dist/app-markdown.cjs +5 -4
  26. package/dist/app-markdown.d.mts +4 -3
  27. package/dist/app-markdown.d.ts +4 -3
  28. package/dist/app-markdown.mjs +4 -3
  29. package/dist/{app.d-BVOpL_f2.d.ts → app.d-C2xeMIYT.d.ts} +18 -8
  30. package/dist/{app.d-BhiDXex_.d.mts → app.d-DF0aundc.d.mts} +18 -8
  31. package/dist/{base-path.d-BOUV5ozD.d.mts → base-path.d-BJ3SYpB8.d.mts} +7 -1
  32. package/dist/{base-path.d-BOUV5ozD.d.ts → base-path.d-BJ3SYpB8.d.ts} +7 -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-UPOYKX4S.cjs → chunk-2MR4MABG.cjs} +4 -4
  36. package/dist/chunk-2RCCFB2Y.cjs +129 -0
  37. package/dist/{chunk-K6VFYFOY.cjs → chunk-2W4GNXGX.cjs} +2 -2
  38. package/dist/{chunk-URN7VFO7.cjs → chunk-32SYRIQ7.cjs} +21 -22
  39. package/dist/{chunk-CV6MFQ4Y.mjs → chunk-3AUINHFG.mjs} +1 -1
  40. package/dist/{chunk-KDO6T6OB.mjs → chunk-3EXCZJEN.mjs} +2 -2
  41. package/dist/{chunk-MMDKYJ5V.cjs → chunk-3GNVIYPO.cjs} +7 -7
  42. package/dist/{chunk-65Y5SIBH.cjs → chunk-3QM74STY.cjs} +1 -1
  43. package/dist/{chunk-NT4W4H52.mjs → chunk-3WS5AZ3R.mjs} +23 -18
  44. package/dist/{chunk-FJMC24KG.cjs → chunk-42KMUIWZ.cjs} +0 -3
  45. package/dist/{chunk-LR4KP3I7.cjs → chunk-4AC4PXZO.cjs} +2 -2
  46. package/dist/{chunk-YVPX5PI5.mjs → chunk-4O26BPUY.mjs} +8 -0
  47. package/dist/{chunk-LENKRGBV.mjs → chunk-5CFHQ7HM.mjs} +1 -1
  48. package/dist/{chunk-G7NBPP7H.mjs → chunk-5IJRJWJS.mjs} +1 -1
  49. package/dist/{chunk-MV7NWU23.mjs → chunk-5R3JQPWD.mjs} +1 -1
  50. package/dist/{chunk-3Y52TWYU.mjs → chunk-62ZRA7XU.mjs} +0 -3
  51. package/dist/{chunk-5JKDFRTK.cjs → chunk-65FPDDT4.cjs} +2 -2
  52. package/dist/{chunk-K6SXMVXO.mjs → chunk-75E5FDX2.mjs} +22 -7
  53. package/dist/{chunk-K76CBYQM.mjs → chunk-7A3URI2F.mjs} +20 -0
  54. package/dist/{chunk-VFNAK6A5.mjs → chunk-A2TH5MKE.mjs} +9 -5
  55. package/dist/{chunk-225APHKC.cjs → chunk-A7HCBHMC.cjs} +3 -3
  56. package/dist/{chunk-VX2HZGC7.cjs → chunk-ACGBXN3U.cjs} +2 -2
  57. package/dist/{chunk-Z3PW3DIR.cjs → chunk-BPUVDCGG.cjs} +5 -5
  58. package/dist/{chunk-FT6KJHS3.cjs → chunk-C2JOS77Z.cjs} +4 -1
  59. package/dist/{chunk-DIXFKAPM.mjs → chunk-CCHJWJGP.mjs} +297 -148
  60. package/dist/{chunk-CRVSYDHV.mjs → chunk-CKQAQFF6.mjs} +2 -2
  61. package/dist/chunk-DC2AXGNZ.mjs +129 -0
  62. package/dist/{chunk-TNK2TVRS.cjs → chunk-DIHBWZDZ.cjs} +449 -352
  63. package/dist/{chunk-JSOCDYER.cjs → chunk-DMXMIE2C.cjs} +15 -1
  64. package/dist/{chunk-23VJEGKC.cjs → chunk-DVJM55D2.cjs} +9 -1
  65. package/dist/{chunk-QSUYB3RH.cjs → chunk-DZHTNSQ5.cjs} +14 -14
  66. package/dist/{chunk-OIOPQ25L.mjs → chunk-E77IA5IF.mjs} +46 -33
  67. package/dist/{chunk-VRGY3X2I.mjs → chunk-EDZU7YRK.mjs} +8 -9
  68. package/dist/{chunk-EZTKXD6P.cjs → chunk-FDGYDQGL.cjs} +8 -1
  69. package/dist/{chunk-PLJKJJ2H.mjs → chunk-FETMUBIA.mjs} +27 -82
  70. package/dist/{chunk-HJZZSBVK.cjs → chunk-FILXOEWD.cjs} +2 -2
  71. package/dist/{chunk-KWCZKJYU.cjs → chunk-FJ5YCERM.cjs} +581 -432
  72. package/dist/{chunk-PDFFYZAT.cjs → chunk-GF22VGMS.cjs} +2 -2
  73. package/dist/{chunk-OOJBBHYW.cjs → chunk-GVYZCJZH.cjs} +30 -1
  74. package/dist/{chunk-MNJDNTGO.mjs → chunk-HAXFV2CD.mjs} +1 -1
  75. package/dist/{chunk-DXZ57EPE.mjs → chunk-I4KPA2C6.mjs} +14 -0
  76. package/dist/{chunk-LDEXTX4I.cjs → chunk-I7NUT24Z.cjs} +29 -22
  77. package/dist/{chunk-MZ4CRSY7.cjs → chunk-IEN2EFE5.cjs} +4 -4
  78. package/dist/{chunk-NVOMQLI2.mjs → chunk-IWJONXPF.mjs} +11 -0
  79. package/dist/{chunk-RLH5AH2M.mjs → chunk-JDO346NV.mjs} +1 -1
  80. package/dist/{chunk-WUTFJOV7.cjs → chunk-JFPKARWM.cjs} +16 -8
  81. package/dist/{chunk-A3T445WK.mjs → chunk-JFVT5ZZV.mjs} +9 -2
  82. package/dist/{chunk-WPB67LE5.mjs → chunk-JRF2SKCD.mjs} +1 -1
  83. package/dist/{chunk-YIHRZBD7.cjs → chunk-JRGR5Z4K.cjs} +1 -1
  84. package/dist/{chunk-UKZ6AWKZ.cjs → chunk-JWY66PID.cjs} +44 -1
  85. package/dist/{chunk-BDYM2TN3.cjs → chunk-JX5VOLAV.cjs} +8 -8
  86. package/dist/{chunk-WMLSZAKN.mjs → chunk-JZQS3ZOI.mjs} +1 -1
  87. package/dist/{chunk-YTNBCXCW.cjs → chunk-K4UGCUXX.cjs} +17 -13
  88. package/dist/{chunk-OFBLGH6V.cjs → chunk-K66JILV3.cjs} +47 -34
  89. package/dist/{chunk-QOGIZKSO.cjs → chunk-K7JMTAFH.cjs} +5 -5
  90. package/dist/{chunk-IFR74W6S.mjs → chunk-KPJYBSHL.mjs} +4 -1
  91. package/dist/{chunk-Z6SOXHAD.mjs → chunk-KPMLDT3B.mjs} +208 -111
  92. package/dist/{chunk-KI3MU7B5.mjs → chunk-LDVJIBGN.mjs} +1 -1
  93. package/dist/{chunk-IGDYL2IA.cjs → chunk-LECZ5DPZ.cjs} +2 -2
  94. package/dist/{chunk-5FBZJJGA.mjs → chunk-LXEJNWF5.mjs} +2 -2
  95. package/dist/{chunk-F36LS2C7.cjs → chunk-M6U6E4F7.cjs} +335 -285
  96. package/dist/{chunk-AKIQ54FK.cjs → chunk-MBCRWU3P.cjs} +26 -81
  97. package/dist/{chunk-P2NBQ5JI.mjs → chunk-MWUDEYBI.mjs} +1 -1
  98. package/dist/{chunk-SQ6IWJ3H.cjs → chunk-MZLJFNMH.cjs} +1 -1
  99. package/dist/{chunk-6OFOIMNS.mjs → chunk-N62IYXYD.mjs} +1 -1
  100. package/dist/{chunk-ZPKJPM7K.mjs → chunk-NA77GEIU.mjs} +2 -2
  101. package/dist/{chunk-FVYBEMOD.cjs → chunk-NAXKOTPP.cjs} +6 -6
  102. package/dist/{chunk-I7J5RLGO.cjs → chunk-NLBHLPEO.cjs} +12 -1
  103. package/dist/{chunk-3EEINK7G.cjs → chunk-NSZY3EWG.cjs} +10 -7
  104. package/dist/{chunk-F6CMGWAL.mjs → chunk-NYF7A4UW.mjs} +1 -1
  105. package/dist/{chunk-QO43L7Z4.cjs → chunk-O32QPFVV.cjs} +25 -7
  106. package/dist/{chunk-5IQ2ERQA.cjs → chunk-O47W53D3.cjs} +1 -1
  107. package/dist/{chunk-CO6UYM2D.mjs → chunk-O5QUJEWT.mjs} +1 -1
  108. package/dist/{chunk-JL2YW5KX.mjs → chunk-OAEDVXVE.mjs} +44 -1
  109. package/dist/{chunk-3TXKFRSO.mjs → chunk-OEL5EPOJ.mjs} +1 -1
  110. package/dist/{chunk-KSZK34HU.mjs → chunk-PJQ5W356.mjs} +16 -8
  111. package/dist/{chunk-BZWTBELF.cjs → chunk-Q5HMVGR5.cjs} +87 -17
  112. package/dist/{chunk-5NFQ6AZI.cjs → chunk-QEWWKYDL.cjs} +25 -10
  113. package/dist/{chunk-QOSDWGKT.mjs → chunk-QVBXTSIZ.mjs} +1 -1
  114. package/dist/{chunk-T5XFZQCL.mjs → chunk-QZHTDVH4.mjs} +1 -1
  115. package/dist/{chunk-HEJM46HQ.mjs → chunk-R7254L3R.mjs} +5 -2
  116. package/dist/{chunk-OGVTUGMU.mjs → chunk-REP6HWJN.mjs} +13 -3
  117. package/dist/{chunk-4UAQB5LB.mjs → chunk-RMOU3PR4.mjs} +112 -62
  118. package/dist/{chunk-WYL4ODZ4.mjs → chunk-SE7HPBYK.mjs} +30 -1
  119. package/dist/{chunk-2ZOYOYEE.mjs → chunk-THG2TVDH.mjs} +73 -3
  120. package/dist/{chunk-TEJ67GD2.mjs → chunk-TLSSIYAL.mjs} +20 -5
  121. package/dist/{chunk-DWLNLU55.cjs → chunk-TPYAYFMF.cjs} +2 -2
  122. package/dist/{chunk-Y6KHPJDB.cjs → chunk-U7VH3Q5E.cjs} +2 -2
  123. package/dist/{chunk-X3MHKLCO.cjs → chunk-VG6HYT5K.cjs} +26 -11
  124. package/dist/{chunk-437QZIC2.cjs → chunk-VNBDN5W2.cjs} +5 -5
  125. package/dist/{chunk-AJNBTOVQ.mjs → chunk-WW3LRNQV.mjs} +1 -1
  126. package/dist/{chunk-GFPS7MNE.mjs → chunk-WX63N6C5.mjs} +4 -4
  127. package/dist/{chunk-7LK5CTUM.cjs → chunk-XYVPTTUT.cjs} +31 -26
  128. package/dist/{chunk-VOQ7XZZT.cjs → chunk-Y2SZVIVH.cjs} +20 -0
  129. package/dist/{chunk-XCAQTCGK.mjs → chunk-YBY34UHB.mjs} +1 -1
  130. package/dist/{chunk-YGJ5P3TJ.mjs → chunk-Z3GPAFIA.mjs} +21 -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-BvQOxSqh.d.mts → client-component.d-Bk5qKJM-.d.mts} +2 -2
  134. package/dist/{client-component.d-DNVSLEPi.d.ts → client-component.d-DNbC4oWI.d.ts} +2 -2
  135. package/dist/{client-plugins.d-CNDqcAuf.d.ts → client-plugins.d-DwUqh4gp.d.ts} +50 -5
  136. package/dist/{client-plugins.d-CE1lVK2R.d.mts → client-plugins.d-Pi9nG0W0.d.mts} +50 -5
  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-2A2GPC7B.mjs → devtools-CB43AHEP.mjs} +8 -7
  154. package/dist/{devtools-R27T3BRY.cjs → devtools-L5DUNDF3.cjs} +9 -8
  155. package/dist/docs.cjs +14 -11
  156. package/dist/docs.d.mts +17 -4
  157. package/dist/docs.d.ts +17 -4
  158. package/dist/docs.mjs +14 -11
  159. package/dist/environment/vite.cjs +3 -3
  160. package/dist/environment/vite.mjs +2 -2
  161. package/dist/headers.d-CE6OWB-n.d.ts +18 -0
  162. package/dist/headers.d-DED1hHh4.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/image/server.cjs +2 -2
  176. package/dist/image/server.mjs +1 -1
  177. package/dist/image/sharp.cjs +9 -9
  178. package/dist/image/sharp.mjs +1 -1
  179. package/dist/index.cjs +49 -45
  180. package/dist/{index.d-Bt3kl19W.d.mts → index.d-CbvOjJcp.d.mts} +1 -1
  181. package/dist/{index.d-Cx_-DaKV.d.ts → index.d-c9UwIqDy.d.ts} +1 -1
  182. package/dist/index.d.mts +26 -24
  183. package/dist/index.d.ts +26 -24
  184. package/dist/index.mjs +63 -59
  185. package/dist/integrations/orm.d.mts +3 -2
  186. package/dist/integrations/orm.d.ts +3 -2
  187. package/dist/integrations.cjs +3 -3
  188. package/dist/integrations.d.mts +3 -2
  189. package/dist/integrations.d.ts +3 -2
  190. package/dist/integrations.mjs +2 -2
  191. package/dist/internal/app-markdown-runtime.cjs +4 -3
  192. package/dist/internal/app-markdown-runtime.d.mts +4 -3
  193. package/dist/internal/app-markdown-runtime.d.ts +4 -3
  194. package/dist/internal/app-markdown-runtime.mjs +3 -2
  195. package/dist/internal/build-runtime.cjs +36 -37
  196. package/dist/internal/build-runtime.d.mts +5 -4
  197. package/dist/internal/build-runtime.d.ts +5 -4
  198. package/dist/internal/build-runtime.mjs +35 -36
  199. package/dist/internal/cli-runtime.cjs +15 -14
  200. package/dist/internal/cli-runtime.mjs +14 -13
  201. package/dist/internal/client-error-overlay.cjs +4 -4
  202. package/dist/internal/client-error-overlay.mjs +1 -1
  203. package/dist/internal/client-runtime.cjs +5 -3
  204. package/dist/internal/client-runtime.d.mts +17 -7
  205. package/dist/internal/client-runtime.d.ts +17 -7
  206. package/dist/internal/client-runtime.mjs +4 -2
  207. package/dist/internal/compression-runtime.d.mts +3 -2
  208. package/dist/internal/compression-runtime.d.ts +3 -2
  209. package/dist/internal/config-runtime.cjs +10 -9
  210. package/dist/internal/config-runtime.d.mts +6 -5
  211. package/dist/internal/config-runtime.d.ts +6 -5
  212. package/dist/internal/config-runtime.mjs +9 -8
  213. package/dist/internal/infra-analytics-runtime.cjs +12 -9
  214. package/dist/internal/infra-analytics-runtime.mjs +10 -7
  215. package/dist/internal/native-server-fns.cjs +4 -4
  216. package/dist/internal/native-server-fns.mjs +3 -3
  217. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  218. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  219. package/dist/internal/production-runtime.cjs +52 -17
  220. package/dist/internal/production-runtime.d.mts +57 -20
  221. package/dist/internal/production-runtime.d.ts +57 -20
  222. package/dist/internal/production-runtime.mjs +55 -20
  223. package/dist/internal/vercel-edge-middleware.cjs +3 -2
  224. package/dist/internal/vercel-edge-middleware.d.mts +2 -2
  225. package/dist/internal/vercel-edge-middleware.d.ts +2 -2
  226. package/dist/internal/vercel-edge-middleware.mjs +2 -1
  227. package/dist/markdown.cjs +3 -2
  228. package/dist/markdown.d.mts +3 -2
  229. package/dist/markdown.d.ts +3 -2
  230. package/dist/markdown.mjs +2 -1
  231. package/dist/middleware.cjs +6 -5
  232. package/dist/middleware.d.mts +4 -3
  233. package/dist/middleware.d.ts +4 -3
  234. package/dist/middleware.mjs +5 -4
  235. package/dist/mobile.d.mts +3 -3
  236. package/dist/mobile.d.ts +3 -3
  237. package/dist/{mount.d-Bki4pOaJ.d.mts → mount.d-BvWxf8ZE.d.mts} +1 -1
  238. package/dist/{mount.d-DjR5aerM.d.ts → mount.d-DngLY7NL.d.ts} +1 -1
  239. package/dist/{native-tree-W2SSJB3Y.cjs → native-tree-GF4BH33L.cjs} +4 -3
  240. package/dist/{native-tree-Y5YQANW7.mjs → native-tree-L2IIEBXH.mjs} +3 -2
  241. package/dist/{navigation-delegate.d-VDkziXTK.d.mts → navigation-delegate.d-CMyl1h2l.d.mts} +1 -1
  242. package/dist/{navigation-delegate.d-CtghaSP3.d.ts → navigation-delegate.d-zZogiDfa.d.ts} +1 -1
  243. package/dist/navigation.cjs +5 -5
  244. package/dist/navigation.d.mts +6 -5
  245. package/dist/navigation.d.ts +6 -5
  246. package/dist/navigation.mjs +4 -4
  247. package/dist/{plugin-WIU4GDD4.cjs → plugin-F2O4BFTK.cjs} +2 -2
  248. package/dist/{plugin-SAS22JL7.mjs → plugin-VEBRN7A3.mjs} +1 -1
  249. package/dist/plugin.cjs +30 -29
  250. package/dist/plugin.d.mts +6 -4
  251. package/dist/plugin.d.ts +6 -4
  252. package/dist/plugin.mjs +29 -28
  253. package/dist/{production-runtime.d-DMZY3OgV.d.mts → production-runtime.d-B0IeWWyO.d.mts} +23 -2
  254. package/dist/{production-runtime.d-BMyyLGBB.d.ts → production-runtime.d-q3aHIv5Y.d.ts} +23 -2
  255. package/dist/query/client.cjs +6 -6
  256. package/dist/query/client.mjs +2 -2
  257. package/dist/{render-plan.d-i9sI4tc9.d.ts → render-plan.d-DQj2bzd2.d.ts} +1 -1
  258. package/dist/{render-plan.d-BSwV8PE4.d.mts → render-plan.d-Di1znBDW.d.mts} +1 -1
  259. package/dist/renderer-client.cjs +7 -7
  260. package/dist/renderer-client.d.mts +6 -5
  261. package/dist/renderer-client.d.ts +6 -5
  262. package/dist/renderer-client.mjs +3 -3
  263. package/dist/{request.d-Dgln8tuI.d.ts → request.d-C5vyoYeL.d.ts} +1 -1
  264. package/dist/{request.d-C24FNQ_7.d.mts → request.d-CJWzfDYJ.d.mts} +1 -1
  265. package/dist/request.d.mts +4 -3
  266. package/dist/request.d.ts +4 -3
  267. package/dist/{resolver.d-JnZKKsc5.d.mts → resolver.d-9iKC79CU.d.mts} +1 -1
  268. package/dist/{resolver.d-BHyZgpa7.d.ts → resolver.d-CY6mEa_F.d.ts} +1 -1
  269. package/dist/response.d-B_MtBCnF.d.mts +12 -0
  270. package/dist/response.d-B_MtBCnF.d.ts +12 -0
  271. package/dist/{route-rendering.d-Ds0BfwQi.d.mts → route-rendering.d-C-et2TZ1.d.mts} +9 -2
  272. package/dist/{route-rendering.d-CUylZKJA.d.ts → route-rendering.d-DhsY5M2I.d.ts} +9 -2
  273. package/dist/{router.d-CFPcbqzc.d.mts → router.d-BMDS5s5X.d.mts} +1 -1
  274. package/dist/{router.d-B56rMOFm.d.ts → router.d-CJB-Ntni.d.ts} +1 -1
  275. package/dist/{routes.d-CrEy0lJS.d.mts → routes.d-D3aJw1H5.d.mts} +1 -1
  276. package/dist/{routes.d-9GFFNioh.d.ts → routes.d-K-Qg79AA.d.ts} +1 -1
  277. package/dist/routes.d.mts +3 -2
  278. package/dist/routes.d.ts +3 -2
  279. package/dist/{index.d-BNNDpql4.d.ts → routing.d-BxOZ2YWc.d.ts} +1 -2
  280. package/dist/{index.d-BqcfqJvt.d.mts → routing.d-DwSUVZbF.d.mts} +1 -2
  281. package/dist/{rsc-pipeline-GA4AQWZI.mjs → rsc-pipeline-AXQJCCHI.mjs} +12 -12
  282. package/dist/{rsc-pipeline-3T7V6OUT.cjs → rsc-pipeline-NJKLZ3YE.cjs} +13 -13
  283. package/dist/{runtime-REUTNTI5.cjs → runtime-DMW6DDOI.cjs} +19 -18
  284. package/dist/{runtime-ZYCKKY7L.mjs → runtime-JXNEKOSE.mjs} +11 -10
  285. package/dist/{runtime.d-BtL3PCL3.d.ts → runtime.d-B_uPfMjA.d.ts} +2 -2
  286. package/dist/{runtime.d-DLRO-ExG.d.mts → runtime.d-BonodRI9.d.mts} +1 -1
  287. package/dist/{runtime.d-3iJAKptR.d.mts → runtime.d-nUz0HAL4.d.mts} +2 -2
  288. package/dist/{runtime.d-H7k9hOQE.d.ts → runtime.d-uw4123iI.d.ts} +1 -1
  289. package/dist/server-plugins.cjs +3 -2
  290. package/dist/server-plugins.d.mts +6 -12
  291. package/dist/server-plugins.d.ts +6 -12
  292. package/dist/server-plugins.mjs +2 -1
  293. package/dist/server.cjs +64 -56
  294. package/dist/server.d.mts +23 -14
  295. package/dist/server.d.ts +23 -14
  296. package/dist/server.mjs +40 -32
  297. package/dist/{spa-router.d-Dr7oanhl.d.ts → spa-router.d-l0d9pPZj.d.ts} +3 -3
  298. package/dist/{spa-router.d-g4CzhEH1.d.mts → spa-router.d-rha3M95y.d.mts} +3 -3
  299. package/dist/testing.cjs +3 -3
  300. package/dist/testing.d.mts +3 -2
  301. package/dist/testing.d.ts +3 -2
  302. package/dist/testing.mjs +3 -3
  303. package/dist/{types.d-C41ePjvP.d.ts → types.d-wVRlLtBf.d.mts} +1 -1
  304. package/dist/{types.d-C41ePjvP.d.mts → types.d-wVRlLtBf.d.ts} +1 -1
  305. package/dist/{utils.d-BxxyDEb8.d.ts → utils.d-BK-PTOF8.d.ts} +1 -1
  306. package/dist/{utils.d-HIla3pD_.d.mts → utils.d-BzuTobEc.d.mts} +1 -1
  307. package/dist/version.cjs +2 -2
  308. package/dist/version.mjs +1 -1
  309. package/dist/vite.cjs +37 -29
  310. package/dist/vite.d.mts +26 -6
  311. package/dist/vite.d.ts +26 -6
  312. package/dist/vite.mjs +36 -28
  313. package/package.json +3 -3
  314. package/dist/analyzer-PPAHM4AW.cjs +0 -16
  315. package/dist/chunk-HHLEYA4B.cjs +0 -17
  316. package/dist/chunk-QYNZ3CTI.mjs +0 -17
  317. package/dist/response.d-BolW0Vx_.d.mts +0 -10
  318. package/dist/response.d-BolW0Vx_.d.ts +0 -10
@@ -1,6 +1,3 @@
1
- import {
2
- hasFarmServerRuntimePlugins
3
- } from "./chunk-QYNZ3CTI.mjs";
4
1
  import {
5
2
  FARM_MOBILE_CLIENT_ENTRY_NAME,
6
3
  FARM_MOBILE_SHELL_CLIENT_PLACEHOLDER,
@@ -29,7 +26,7 @@ import {
29
26
  import {
30
27
  collectFarmNativeServerFns,
31
28
  findFarmNativeScreenFiles
32
- } from "./chunk-MNJDNTGO.mjs";
29
+ } from "./chunk-HAXFV2CD.mjs";
33
30
  import {
34
31
  generateNativeMCPPluginSource
35
32
  } from "./chunk-KQH2COEJ.mjs";
@@ -42,8 +39,9 @@ import {
42
39
  createFarmDocsAPIHandler,
43
40
  farmDocsAdapterServesGuardedPages,
44
41
  hasFarmDocsRuntimeAdapter,
45
- listFarmDocsAdapterPages
46
- } from "./chunk-A3T445WK.mjs";
42
+ listFarmDocsAdapterPages,
43
+ listFarmDocsPagePaths
44
+ } from "./chunk-JFVT5ZZV.mjs";
47
45
  import {
48
46
  FARM_DOCS_LAST_MODIFIED_MANIFEST,
49
47
  createFarmDocsHandler,
@@ -56,7 +54,7 @@ import {
56
54
  loadFarmDocsPage,
57
55
  resolveFarmDocsContentDir,
58
56
  toFarmDocsMarkdownPage
59
- } from "./chunk-5FBZJJGA.mjs";
57
+ } from "./chunk-LXEJNWF5.mjs";
60
58
  import {
61
59
  generateFarmDocsSearchClientRuntime,
62
60
  isFarmDocsSearchEnabled,
@@ -64,10 +62,10 @@ import {
64
62
  } from "./chunk-ALEUMLJN.mjs";
65
63
  import {
66
64
  CDN_CACHE_CONTROL_HEADERS
67
- } from "./chunk-JL2YW5KX.mjs";
65
+ } from "./chunk-OAEDVXVE.mjs";
68
66
  import {
69
67
  FARM_PRERENDER_ENV
70
- } from "./chunk-KDO6T6OB.mjs";
68
+ } from "./chunk-3EXCZJEN.mjs";
71
69
  import {
72
70
  loadFarmDocsEngine
73
71
  } from "./chunk-VE3FWJBO.mjs";
@@ -76,7 +74,7 @@ import {
76
74
  getDeployTargetForPreset,
77
75
  hasCustomFarmRouteContext,
78
76
  resolveDeployOutputPath
79
- } from "./chunk-NT4W4H52.mjs";
77
+ } from "./chunk-3WS5AZ3R.mjs";
80
78
  import {
81
79
  resolveFarmInstrumentationFile
82
80
  } from "./chunk-57QAQU4F.mjs";
@@ -112,19 +110,20 @@ import {
112
110
  resolveFarmImageServerRuntime,
113
111
  resolveFarmNotFoundComponentPath,
114
112
  resolveFarmRouteRootStrategy
115
- } from "./chunk-4UAQB5LB.mjs";
113
+ } from "./chunk-RMOU3PR4.mjs";
116
114
  import {
117
115
  generateFarmClientPluginEntryCode,
116
+ hasFarmServerRuntimePlugins,
118
117
  loadTailwindVitePlugin
119
- } from "./chunk-DXZ57EPE.mjs";
118
+ } from "./chunk-I4KPA2C6.mjs";
120
119
  import {
121
120
  PluginManager
122
- } from "./chunk-KSZK34HU.mjs";
121
+ } from "./chunk-PJQ5W356.mjs";
123
122
  import {
124
123
  generateFarmTypeArtifacts,
125
124
  readRouteRenderingDirectiveFromFile,
126
125
  resolveRouteRenderingConfigFromFile
127
- } from "./chunk-G7NBPP7H.mjs";
126
+ } from "./chunk-5IJRJWJS.mjs";
128
127
  import {
129
128
  HOISTED_HEAD_ELEMENT,
130
129
  appMiddlewareMayHandlePath,
@@ -137,7 +136,7 @@ import {
137
136
  layoutsCanCoverSamePage,
138
137
  routeBoundaryCoversDirectory,
139
138
  stripRouteGroups
140
- } from "./chunk-ZPKJPM7K.mjs";
139
+ } from "./chunk-NA77GEIU.mjs";
141
140
  import {
142
141
  FARM_NATIVE_TREE_CONTENT_TYPE
143
142
  } from "./chunk-LLZSYFOM.mjs";
@@ -151,15 +150,15 @@ import {
151
150
  listFarmBuiltInRoutePaths,
152
151
  resolveFarmApiCatalogInput,
153
152
  resolveFarmAppManifestInput
154
- } from "./chunk-VFNAK6A5.mjs";
153
+ } from "./chunk-A2TH5MKE.mjs";
155
154
  import {
156
155
  FARM_DEFAULT_MCP_PATH,
157
156
  createFarmDefaultMCPServer,
158
157
  farmConfigMountsMCP
159
- } from "./chunk-K6SXMVXO.mjs";
158
+ } from "./chunk-75E5FDX2.mjs";
160
159
  import {
161
160
  isFarmPreviewDeploymentEnvironment
162
- } from "./chunk-T5XFZQCL.mjs";
161
+ } from "./chunk-QZHTDVH4.mjs";
163
162
  import {
164
163
  FARM_NATIVE_SERVER_FN_PLUGIN
165
164
  } from "./chunk-L4RTTTVE.mjs";
@@ -177,7 +176,7 @@ import {
177
176
  usePackageClientBoundaryCacheFile,
178
177
  usesFarmServerTree,
179
178
  withPackageClientBoundaryCache
180
- } from "./chunk-WPB67LE5.mjs";
179
+ } from "./chunk-JRF2SKCD.mjs";
181
180
  import {
182
181
  generateFarmDocsAdapterClientRuntime,
183
182
  getFarmDocsAdapterConfigModule
@@ -224,14 +223,14 @@ import {
224
223
  } from "./chunk-N33DLJBC.mjs";
225
224
  import {
226
225
  isFarmMarkdownPageFile
227
- } from "./chunk-HEJM46HQ.mjs";
226
+ } from "./chunk-R7254L3R.mjs";
228
227
  import {
229
228
  resolveFarmMdxComponentsModulePath,
230
229
  resolveMdxConfig
231
230
  } from "./chunk-UIJOLBUL.mjs";
232
231
  import {
233
232
  getFarmMarkdownAlternatePath
234
- } from "./chunk-IFR74W6S.mjs";
233
+ } from "./chunk-KPJYBSHL.mjs";
235
234
  import {
236
235
  withPlainDiagnostics
237
236
  } from "./chunk-MGKWYPE3.mjs";
@@ -242,7 +241,7 @@ import {
242
241
  import {
243
242
  getFarmIntegrationPluginServerRuntime,
244
243
  getIntegrationProviders
245
- } from "./chunk-AJNBTOVQ.mjs";
244
+ } from "./chunk-WW3LRNQV.mjs";
246
245
  import {
247
246
  FARM_INTEGRATION_API_BASE_PATH_KEY
248
247
  } from "./chunk-M53MIIXY.mjs";
@@ -256,7 +255,7 @@ import {
256
255
  } from "./chunk-MMK4MZUN.mjs";
257
256
  import {
258
257
  APIRouteManager
259
- } from "./chunk-OIOPQ25L.mjs";
258
+ } from "./chunk-E77IA5IF.mjs";
260
259
  import {
261
260
  readFarmI18nCatalogs
262
261
  } from "./chunk-DU4VHHPJ.mjs";
@@ -283,14 +282,14 @@ import {
283
282
  } from "./chunk-2I6PUKWJ.mjs";
284
283
  import {
285
284
  FARM_VERSION
286
- } from "./chunk-F6CMGWAL.mjs";
285
+ } from "./chunk-NYF7A4UW.mjs";
287
286
  import {
288
287
  normalizeFarmTrailingSlashPathname
289
- } from "./chunk-YVPX5PI5.mjs";
288
+ } from "./chunk-4O26BPUY.mjs";
290
289
  import {
291
290
  getFarmPresetRuntime,
292
291
  resolveCloudflareProcessEnvFlags
293
- } from "./chunk-NVOMQLI2.mjs";
292
+ } from "./chunk-IWJONXPF.mjs";
294
293
  import {
295
294
  _runWithFarmCspNonce
296
295
  } from "./chunk-5OFNUETM.mjs";
@@ -965,13 +964,14 @@ function createFarmVercelImmutableAssetRoute() {
965
964
  };
966
965
  }
967
966
  function buildFarmVercelRoutes(options) {
968
- const { presetRoutes, runtimeRoutes, middlewareRoutes = [] } = options;
967
+ const { presetRoutes, runtimeRoutes, middlewareRoutes = [], canonicalSlashRoutes = [] } = options;
969
968
  const filesystemIndex = presetRoutes.findIndex((route) => route.handle === "filesystem");
970
969
  const sourceRoutes = filesystemIndex >= 0 ? presetRoutes.slice(0, filesystemIndex) : [];
971
970
  const preservedSourceRoutes = sourceRoutes.filter((route) => route.continue !== true);
972
971
  return [
973
972
  ...preservedSourceRoutes,
974
973
  ...middlewareRoutes,
974
+ ...canonicalSlashRoutes,
975
975
  createFarmVercelImmutableAssetRoute(),
976
976
  { handle: "filesystem" },
977
977
  ...runtimeRoutes,
@@ -981,6 +981,18 @@ function buildFarmVercelRoutes(options) {
981
981
  }
982
982
  ];
983
983
  }
984
+ function escapeRegExp2(value) {
985
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
986
+ }
987
+ function createFarmVercelCanonicalSlashRoutes(publicPaths) {
988
+ const otherSpellings = [
989
+ ...new Set(
990
+ publicPaths.filter((pathname) => pathname !== "/").map((pathname) => pathname.endsWith("/") ? pathname.replace(/\/+$/, "") : `${pathname}/`).filter((pathname) => pathname !== "")
991
+ )
992
+ ];
993
+ if (otherSpellings.length === 0) return [];
994
+ return [{ src: `^(?:${otherSpellings.map(escapeRegExp2).join("|")})$`, dest: "/__nitro" }];
995
+ }
984
996
 
985
997
  // src/nitro/ssr-public-assets.ts
986
998
  import path7 from "path";
@@ -1125,10 +1137,19 @@ const CREDENTIAL_VARY = /(?:^|,)\\s*(?:\\*|cookie|authorization)\\s*(?:,|$)/i;
1125
1137
  // What Nitro's entry sets when the response has no Cache-Control of its own.
1126
1138
  const NITRO_DEFAULT_CACHE_CONTROL = "public, max-age=0, must-revalidate";
1127
1139
 
1140
+ // The deployment cookie names a release, not a visitor (see @farm.js/core/deployment).
1141
+ function hasVisitorCookies(cookieHeader) {
1142
+ if (!cookieHeader) return false;
1143
+ return cookieHeader.split(";").some((part) => {
1144
+ const name = part.split("=")[0].trim();
1145
+ return name !== "" && name !== "__farm_deployment";
1146
+ });
1147
+ }
1148
+
1128
1149
  function isSharedCacheable(request, response) {
1129
1150
  return (
1130
1151
  response.status === 200 &&
1131
- !request.headers.has("cookie") &&
1152
+ !hasVisitorCookies(request.headers.get("cookie")) &&
1132
1153
  !request.headers.has("authorization") &&
1133
1154
  !response.headers.has("set-cookie") &&
1134
1155
  !PRIVATE_CACHE_DIRECTIVE.test(response.headers.get("cache-control") || "") &&
@@ -1373,7 +1394,7 @@ function farmTargetRunsEdgeMiddleware(preset) {
1373
1394
  function isFarmEdgeMiddlewareRoute(route) {
1374
1395
  return typeof route.config === "object" && route.config?.runtime === "edge";
1375
1396
  }
1376
- function escapeRegExp2(value) {
1397
+ function escapeRegExp3(value) {
1377
1398
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1378
1399
  }
1379
1400
  function toFarmVercelEdgeGuardedUrls(pathnames, basePath) {
@@ -1385,7 +1406,7 @@ function createFarmVercelEdgeMiddlewareRoute(pathnames, basePath = "/") {
1385
1406
  const publicPaths = toFarmVercelEdgeGuardedUrls(pathnames, basePath);
1386
1407
  const alternatives = publicPaths.map((pathname) => {
1387
1408
  const trimmed = pathname.replace(/\/+$/, "");
1388
- return trimmed ? `${escapeRegExp2(trimmed)}(?:/|/index\\.html|\\.html)?` : "/(?:index\\.html)?";
1409
+ return trimmed ? `${escapeRegExp3(trimmed)}(?:/|/index\\.html|\\.html)?` : "/(?:index\\.html)?";
1389
1410
  });
1390
1411
  return {
1391
1412
  src: `^(?:${alternatives.join("|")})$`,
@@ -2482,13 +2503,16 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
2482
2503
  function shouldBuildFarmMobileClient(config) {
2483
2504
  return Boolean(config.mobileClient) && !config.desktop;
2484
2505
  }
2485
- function varyFarmNitroCacheRulesByShell(rules) {
2506
+ function varyFarmNitroCacheRules(rules, headerNames) {
2507
+ if (headerNames.length === 0) return rules;
2486
2508
  return Object.fromEntries(
2487
2509
  Object.entries(rules).map(([source, rule]) => {
2488
2510
  const cached = rule?.swr !== void 0 && rule.swr !== false || rule?.cache !== void 0 && rule.cache !== false;
2489
2511
  if (!cached || rule.cache === false) return [source, rule];
2490
2512
  const cache = rule.cache && typeof rule.cache === "object" ? rule.cache : {};
2491
- const varies = [...Array.isArray(cache.varies) ? cache.varies : [], "x-farm-shell"];
2513
+ const varies = [
2514
+ .../* @__PURE__ */ new Set([...Array.isArray(cache.varies) ? cache.varies : [], ...headerNames])
2515
+ ];
2492
2516
  return [source, { ...rule, cache: { ...cache, varies } }];
2493
2517
  })
2494
2518
  );
@@ -2598,7 +2622,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2598
2622
  if (!mobile) await removeFarmMobileClientManifest(path12.dirname(outputDir));
2599
2623
  const viteBuild = productionVite.build;
2600
2624
  const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
2601
- const { PluginManager: PluginManager2 } = await import("./plugin-SAS22JL7.mjs");
2625
+ const { PluginManager: PluginManager2 } = await import("./plugin-VEBRN7A3.mjs");
2602
2626
  const fs4 = await import("fs/promises");
2603
2627
  const pluginManager = new PluginManager2({
2604
2628
  config,
@@ -6000,7 +6024,7 @@ void hydrate();
6000
6024
  async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache, rendererBuildLifetime) {
6001
6025
  const viteBuild = productionVite.build;
6002
6026
  const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
6003
- const { PluginManager: PluginManager2 } = await import("./plugin-SAS22JL7.mjs");
6027
+ const { PluginManager: PluginManager2 } = await import("./plugin-VEBRN7A3.mjs");
6004
6028
  const fs4 = await import("fs/promises");
6005
6029
  const pluginManager = new PluginManager2({
6006
6030
  config,
@@ -6196,6 +6220,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
6196
6220
  if (farmDocsPrecompiledManifest && farmDocsCspNonceMarker) {
6197
6221
  farmDocsPrecompiledManifest.cspNonceMarker = farmDocsCspNonceMarker;
6198
6222
  }
6223
+ const farmDocsAnalyticsPages = await listFarmDocsAnalyticsPages(config, root, preset);
6199
6224
  const virtualEntryCode = generateVirtualEntryCode(
6200
6225
  apiRoutes,
6201
6226
  pageRoutes,
@@ -6222,7 +6247,8 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
6222
6247
  i18nCatalogs,
6223
6248
  isolatedClientBoundaryModules,
6224
6249
  hydrationPlanCache,
6225
- mobileShellLoadingRoutes
6250
+ mobileShellLoadingRoutes,
6251
+ farmDocsAnalyticsPages
6226
6252
  );
6227
6253
  const virtualEntryId = "\0virtual:farm-ssr-entry";
6228
6254
  const useExternalMetadataImageRuntime = shouldUseExternalMetadataImageRuntime(preset, true);
@@ -6860,7 +6886,7 @@ if (typeof ReactDOMServer.configureApp !== "function") {
6860
6886
  }
6861
6887
  ReactDOMServer.configureApp(__farmAppSetup);`;
6862
6888
  }
6863
- function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache, mobileShellLoadingRoutes = []) {
6889
+ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache, mobileShellLoadingRoutes = [], farmDocsAnalyticsPages = []) {
6864
6890
  const farmRendererDisabled = isFarmRendererDisabled(config.renderer);
6865
6891
  const farmIslandsMode = resolveFarmServerComponentsMode(config.experimental?.serverComponents) === "islands";
6866
6892
  const farmClientBoot = canBootFarmIslandsClient(config);
@@ -7291,6 +7317,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
7291
7317
  createFarmProductionLifecycle,
7292
7318
  createFarmNodeRequestAbortSignal,
7293
7319
  createProductionMiddlewareRunner,
7320
+ _hasPrivateFarmRequestHeaders,
7294
7321
  _withFarmGuardedResponseCache,
7295
7322
  _farmPluginsKeepResponsesPrivate,
7296
7323
  getTheme as getFarmTheme,
@@ -7304,6 +7331,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
7304
7331
  localizeFarmHref,
7305
7332
  manageFarmDocumentPreloads,
7306
7333
  mergeRouteRenderingDirectiveConfig,
7334
+ resolveRouteSharedCacheControl,
7307
7335
  manageFarmLinkHeaderPreloads,
7308
7336
  mergeMetadata,
7309
7337
  mergeModuleViewport,
@@ -7332,7 +7360,13 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
7332
7360
  stripFarmLocaleFromPathname,
7333
7361
  withFarmRouteContext,
7334
7362
  createLateNotFoundRecovery,
7335
- 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," : ""}
7363
+ createLateRedirectRecovery,
7364
+ _withFarmDeploymentCookie,
7365
+ _withFarmResponseHeaders,
7366
+ createFarmDeploymentMismatchResponse,
7367
+ FARM_DEPLOYMENT_ID_HEADER,
7368
+ getFarmDeploymentMismatch,
7369
+ 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," : ""}
7336
7370
  } from "@farm.js/core/internal/production-runtime";${farmMobileClient ? `
7337
7371
  import { _applyFarmMobileShellClient } from "@farm.js/core/internal/production-runtime";
7338
7372
  // The mobile client documents load when a mobile shell asks for them (RFC 0004, 7.2), filled in
@@ -7780,7 +7814,11 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
7780
7814
  validateRemoteUrl: createNodeImageUrlValidator(${JSON.stringify(config.images)}),
7781
7815
  onError(error) { console.error("[Farm Image]", error); },
7782
7816
  })`};
7783
- const farmMarkdownConfig = ${JSON.stringify(config.md)};
7817
+ const farmMarkdownConfig = ${JSON.stringify(config.md)};${config.md?.enabled || hasMarkdownPages ? config.trailingSlash ? `
7818
+ // A Markdown mirror, and a page.md source's page check, read the page at the URL it answers at
7819
+ // ('/about/'), so the trailing-slash 308 never answers in its place.
7820
+ const toFarmMarkdownPageRequest = (request) => toFarmTrailingSlashPageRequest(request, true);` : `
7821
+ const toFarmMarkdownPageRequest = (request) => request;` : ""}
7784
7822
  const farmLlmsTxtConfig = ${JSON.stringify(config.agent?.llmsTxt ?? { enabled: false, include: [], exclude: [] })};
7785
7823
  ${config.agent?.llmsTxt?.enabled ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
7786
7824
  const farmMdxConfig = ${JSON.stringify({
@@ -7974,6 +8012,10 @@ function fetchFarmInnerRequest(request, context) {
7974
8012
  return fetch(new Request(request, { headers }), context);
7975
8013
  }
7976
8014
  const farmLocalAPIBasePath = ${JSON.stringify(resolveFarmAPIServerBasePath(config.api))};
8015
+ // Deployment skew protection (see the deployment docs): documents embed this ID, page responses
8016
+ // name it, and a page request from a browser holding another deployment's page is refused.
8017
+ const farmDeploymentId = ${JSON.stringify(config.deploymentId)};
8018
+ const farmDeploymentCookiePath = ${JSON.stringify(config.basePath || "/")};
7977
8019
  // Reports a failure Farm answers itself (an API or integration route's 500) to the plugin
7978
8020
  // runtime request.
7979
8021
  const farmRuntimeErrorSlot = Symbol("farm.runtime.error.slot");
@@ -8087,7 +8129,8 @@ function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, page
8087
8129
  let source = 'window.__FARM_PROPS__=' + serializedPageProps +
8088
8130
  ';window.__FARM_INTEGRATION_API_MANIFEST__=' +
8089
8131
  serializeFarmInlineValue(integrationManifest) +
8090
- ';window.__FARM_ROUTE_SLOTS__=' + serializedRouteSlots + ';';
8132
+ ';window.__FARM_ROUTE_SLOTS__=' + serializedRouteSlots +
8133
+ ';window.__FARM_DEPLOYMENT_ID__=' + serializeFarmInlineValue(farmDeploymentId) + ';';
8091
8134
  if (typeof canonicalPath === "string" && canonicalPath.startsWith("/")) {
8092
8135
  const serializedPath = serializeFarmInlineValue(canonicalPath);
8093
8136
  source += 'if(location.pathname+location.search!==' + serializedPath + '){' +
@@ -8889,38 +8932,14 @@ function applyFarmI18nResponse(response, resolution) {
8889
8932
  });
8890
8933
  }
8891
8934
 
8892
- function hasOnlyValidFarmLocaleCookie(cookieHeader) {
8893
- if (!farmI18nRuntime || !cookieHeader) return false;
8894
- const parts = cookieHeader.split(";");
8895
- if (parts.length !== 1) return false;
8896
-
8897
- const cookie = parts[0].trim();
8898
- const separator = cookie.indexOf("=");
8899
- if (separator <= 0) return false;
8900
-
8901
- let name;
8902
- let value;
8903
- try {
8904
- name = decodeURIComponent(cookie.slice(0, separator).trim());
8905
- value = decodeURIComponent(cookie.slice(separator + 1).trim());
8906
- } catch {
8907
- return false;
8908
- }
8909
-
8910
- return (
8911
- name === farmI18nConfig.cookie.name &&
8912
- farmI18nConfig.locales.includes(value)
8913
- );
8914
- }
8915
-
8935
+ // Credentials or a visitor's cookie; the deployment cookie, and a lone valid locale cookie when
8936
+ // the URL names the locale, keep shared caching. The RSC server decides with the same helper.
8916
8937
  function hasPrivateFarmRequestHeaders(request, farmLocaleResolution) {
8917
- if (request.headers.get("authorization")) return true;
8918
- const cookieHeader = request.headers.get("cookie");
8919
- if (!cookieHeader) return false;
8920
-
8921
- return !(
8922
- farmLocaleResolution?.source === "url" &&
8923
- hasOnlyValidFarmLocaleCookie(cookieHeader)
8938
+ return _hasPrivateFarmRequestHeaders(
8939
+ request,
8940
+ farmI18nRuntime && farmLocaleResolution?.source === "url"
8941
+ ? { name: farmI18nConfig.cookie.name, locales: farmI18nConfig.locales }
8942
+ : undefined,
8924
8943
  );
8925
8944
  }
8926
8945
 
@@ -9221,7 +9240,7 @@ function createFarmAgentSitemapResponse(request) {
9221
9240
  metadataBase: rootLayout && rootLayout.module && rootLayout.module.metadata
9222
9241
  ? rootLayout.module.metadata.metadataBase
9223
9242
  : undefined,
9224
- basePath: ${JSON.stringify(config.basePath)},
9243
+ basePath: ${JSON.stringify(config.basePath)},${config.trailingSlash ? "\n trailingSlash: true," : ""}${config.i18n.enabled ? "\n i18n: farmI18nConfig," : ""}
9225
9244
  },
9226
9245
  ),
9227
9246
  {},
@@ -9247,18 +9266,22 @@ async function handleFarmDefaultMCP(request) {
9247
9266
  return handleFarmDefaultMCPRequest(request, {
9248
9267
  server: getFarmDefaultMCPServer(),
9249
9268
  basePath: ${JSON.stringify(config.basePath)},
9269
+ i18n: farmI18nConfig,
9270
+ // Each page at the URL it answers at, as in development and as the sitemap lists it.
9250
9271
  listPages: () =>
9251
9272
  collectFarmDefaultMCPPages(
9252
9273
  getFarmAgentListedPageRoutes().map((route) => ({ pattern: route.pattern, module: route.module })),
9253
- { origin, basePath: ${JSON.stringify(config.basePath)}, markdown: farmMarkdownConfig },
9274
+ {
9275
+ origin,
9276
+ basePath: ${JSON.stringify(config.basePath)},
9277
+ markdown: farmMarkdownConfig,${config.trailingSlash ? "\n trailingSlash: true," : ""}
9278
+ i18n: farmI18nConfig,
9279
+ },
9254
9280
  ),
9255
- // A fresh request through this handler, so the caller's cookies never shape a page.
9256
- // The handler sees paths below the base path, as the server passes them in.
9257
- readMarkdown: (url) => {
9258
- const page = new URL(url);
9259
- page.pathname = stripFarmBasePath(page.pathname);
9260
- return farmDefaultMCPReadMarkdown(page.href);
9261
- },
9281
+ // A fresh request through this handler, so the caller's cookies never shape a page. It
9282
+ // reads the public URL, base path included, as llms-full.txt does: this handler sees
9283
+ // public paths, and with i18n a mirror path without the base path answers with a redirect.
9284
+ readMarkdown: farmDefaultMCPReadMarkdown,
9262
9285
  });
9263
9286
  }
9264
9287
  // \`fetch\` is this module's outer request entry: plugin runtime hooks run and the page
@@ -9286,7 +9309,7 @@ function createFarmLlmsTxtContext(request, full) {
9286
9309
  origin,
9287
9310
  markdown: farmMarkdownConfig,
9288
9311
  include: farmLlmsTxtConfig.include,
9289
- exclude: farmLlmsTxtConfig.exclude,
9312
+ exclude: farmLlmsTxtConfig.exclude,${config.trailingSlash ? "\n trailingSlash: true," : ""}${config.i18n.enabled ? "\n i18n: farmI18nConfig," : ""}
9290
9313
  },
9291
9314
  );
9292
9315
  const rootLayout = layoutRoutes.find((layout) => layout.pattern === "/");
@@ -9688,7 +9711,8 @@ const farmBuiltInRoutePaths = new Set(${JSON.stringify(
9688
9711
  )});
9689
9712
  ${config.docs?.enabled ? `const farmDocsRouteLabelInput = {
9690
9713
  path: normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs"),
9691
- apiPath: ${JSON.stringify(farmDocsPrecompiledManifest?.apiPath || "/api/docs")},${config.docs.roots?.length ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}
9714
+ apiPath: ${JSON.stringify(farmDocsPrecompiledManifest?.apiPath || "/api/docs")},${config.docs.roots?.length ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}${farmDocsAnalyticsPages.length ? `
9715
+ pages: new Set(${JSON.stringify(farmDocsAnalyticsPages)}),` : ""}
9692
9716
  };
9693
9717
  ` : ""}// The request's route payload, for a handler that learns what answered while it handles.
9694
9718
  const farmRouteLabelSlot = Symbol("farm.route.label.slot");
@@ -9875,7 +9899,7 @@ function getPPRShellBypassReason(request, middlewareData, middlewareContext) {
9875
9899
  if (farmSecurityConfig.csp && farmSecurityConfig.csp.nonce) return "csp-nonce";
9876
9900
  const method = request.method.toUpperCase();
9877
9901
  if (method !== "GET" && method !== "HEAD") return "method";
9878
- if (request.headers.get("cookie")) return "cookie";
9902
+ if (withoutFarmDeploymentCookie(request.headers.get("cookie"))) return "cookie";
9879
9903
  if (request.headers.get("authorization")) return "authorization";
9880
9904
  if (request.headers.get("x-farm-intercept-from")) return "route-interception";
9881
9905
  if (request.headers.get("x-farm-ppr-refresh")) return "refresh";
@@ -9887,12 +9911,15 @@ function getPPRShellBypassReason(request, middlewareData, middlewareContext) {
9887
9911
 
9888
9912
  // origin is set when the shell carries hreflang alternates (i18n prefix
9889
9913
  // routing), so one host never serves a shell holding another host's URLs.
9914
+ // A shell embeds its deployment's ID and client assets, and a shared cache
9915
+ // adapter outlives a deployment, so each deployment keys its own shells.
9890
9916
  function getPPRShellCacheKey(url, locale, origin) {
9891
9917
  const key = [
9892
9918
  "ppr",
9893
9919
  locale || "",
9894
9920
  normalizeRevalidatePath(url.pathname),
9895
9921
  url.search,
9922
+ farmDeploymentId,
9896
9923
  ];
9897
9924
  return createFarmCacheKey(origin ? key.concat(origin) : key);
9898
9925
  }
@@ -9922,22 +9949,13 @@ function hasFarmUnserializableRouteData(data) {
9922
9949
  return Boolean(data) && typeof data === "object" && Object.values(data).some(isPromise);
9923
9950
  }
9924
9951
 
9952
+ // Core's policy for the route, shared with the RSC server so both send the same Cache-Control.
9925
9953
  function getRouteSharedCacheControl(route, pprCanCache) {
9926
9954
  if (!route || !route.module) {
9927
9955
  return null;
9928
9956
  }
9929
9957
 
9930
- const view = resolveRouteRenderingView(route);
9931
- if (view.dynamic === "force-dynamic") {
9932
- return null;
9933
- }
9934
- if (!view.ssg && !pprCanCache) {
9935
- return null;
9936
- }
9937
-
9938
- const revalidate =
9939
- typeof view.revalidate === "number" && view.revalidate > 0 ? view.revalidate : 60;
9940
- return "public, s-maxage=" + revalidate + ", stale-while-revalidate=300";
9958
+ return resolveRouteSharedCacheControl(resolveRouteRenderingView(route), pprCanCache);
9941
9959
  }
9942
9960
 
9943
9961
  async function getCachedPPRShell(cacheKey) {
@@ -10008,8 +10026,9 @@ async function handleFarmRequestInContext(
10008
10026
  adapterContext,
10009
10027
  requestUrl = new URL(request.url),
10010
10028
  ) {
10011
- const farmCacheGuard = { guarded: farmPluginRuntimeKeepsResponsesPrivate };
10012
- const response = await resolveFarmRequestInContext(
10029
+ // deploymentPage: a page route answered, so the response names this deployment.
10030
+ const farmCacheGuard = { guarded: farmPluginRuntimeKeepsResponsesPrivate, deploymentPage: false };
10031
+ let response = await resolveFarmRequestInContext(
10013
10032
  farmCacheGuard,
10014
10033
  request,
10015
10034
  farmLocaleResolution,
@@ -10018,6 +10037,11 @@ async function handleFarmRequestInContext(
10018
10037
  adapterContext,
10019
10038
  requestUrl,
10020
10039
  );
10040
+ if (farmCacheGuard.deploymentPage) {
10041
+ response = _withFarmResponseHeaders(response, (headers) =>
10042
+ headers.set(FARM_DEPLOYMENT_ID_HEADER, farmDeploymentId)
10043
+ );
10044
+ }
10021
10045
  if (!farmCacheGuard.guarded) return response;
10022
10046
  // Tells the Nitro entry, which keeps this policy over a swr rule's public one.
10023
10047
  adapterContext?.onGuardedResponse?.();
@@ -10261,6 +10285,14 @@ ${hasServerRuntimeIntegrations ? `
10261
10285
  middlewareHeaders,
10262
10286
  );
10263
10287
  }
10288
+ // A docs page is a page document: it names this deployment, and a navigation from
10289
+ // another deployment's page is refused, as for an app page.
10290
+ const farmDocsDeploymentMismatch = getFarmDeploymentMismatch(request, farmDeploymentId);
10291
+ if (farmDocsDeploymentMismatch) {
10292
+ await docsResponse.body?.cancel();
10293
+ return createFarmDeploymentMismatchResponse(farmDocsDeploymentMismatch);
10294
+ }
10295
+ farmCacheGuard.deploymentPage = true;
10264
10296
  const wrappedDocsResponse = withFarmDocsRequestCache(
10265
10297
  await wrapFarmDocsResponseWithLayouts(request, docsResponse),
10266
10298
  request,
@@ -10292,7 +10324,7 @@ ${hasServerRuntimeIntegrations ? `
10292
10324
  clientAddress: adapterContext?.clientAddress,
10293
10325
  // An anonymous visitor's request: guards never see the caller's address.
10294
10326
  renderPage: (targetRequest) =>
10295
- fetchFarmInnerRequest(targetRequest, {
10327
+ fetchFarmInnerRequest(toFarmMarkdownPageRequest(targetRequest), {
10296
10328
  ...adapterContext,
10297
10329
  clientAddress: FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS,
10298
10330
  }),
@@ -10339,7 +10371,8 @@ ${hasServerRuntimeIntegrations ? `
10339
10371
  routePathname: getFarmRoutePathname,
10340
10372
  routeExists: (targetPathname) =>
10341
10373
  Boolean(matchPageRoute(getFarmRoutePathname(targetPathname))),
10342
- renderPage: (targetRequest) => fetchFarmInnerRequest(targetRequest, adapterContext),
10374
+ renderPage: (targetRequest) =>
10375
+ fetchFarmInnerRequest(toFarmMarkdownPageRequest(targetRequest), adapterContext),
10343
10376
  apiServerBasePath: farmLocalAPIBasePath,
10344
10377
  });
10345
10378
  if (markdownResponse) {
@@ -10532,6 +10565,14 @@ ${hasServerRuntimeIntegrations ? `
10532
10565
  // Handle page routes (SSR)
10533
10566
  emitFarmEvent({ type: "render.start", route: pathname, pathname });
10534
10567
  const matchedRoute = matchPageRoute(routePathname);
10568
+ if (matchedRoute) {
10569
+ // A browser holding another deployment's page names it: a navigation fetch in its header, a
10570
+ // form or server action post in the deployment cookie. Refuse it before an action runs, and
10571
+ // before a document would refresh that cookie to this deployment.
10572
+ const farmDeploymentMismatch = getFarmDeploymentMismatch(request, farmDeploymentId);
10573
+ if (farmDeploymentMismatch) return createFarmDeploymentMismatchResponse(farmDeploymentMismatch);
10574
+ farmCacheGuard.deploymentPage = true;
10575
+ }
10535
10576
  ${farmIslandsMode ? `// Islands mode: a form or client component posting a server action to this page.
10536
10577
  if (matchedRoute && request.method === "POST") {
10537
10578
  const actionResponse = await _runWithMiddlewareData(middlewareData || {}, () =>
@@ -11664,6 +11705,13 @@ ${farmRendererDisabled ? `
11664
11705
  { status: 404, headers: { "Content-Type": "application/json" } }
11665
11706
  ), middlewareHeaders);
11666
11707
  ` : ""}
11708
+ // The not-found page is a page document: it names this deployment, and a navigation from
11709
+ // another deployment's page is refused, as for an app page.
11710
+ const farmNotFoundDeploymentMismatch = getFarmDeploymentMismatch(request, farmDeploymentId);
11711
+ if (farmNotFoundDeploymentMismatch) {
11712
+ return createFarmDeploymentMismatchResponse(farmNotFoundDeploymentMismatch);
11713
+ }
11714
+ farmCacheGuard.deploymentPage = true;
11667
11715
  // Agents that navigate in Markdown (a \`.md\` URL or \`Accept: text/markdown\`)
11668
11716
  // get a Markdown error body instead of the HTML not-found shell.
11669
11717
  if (farmRequestWantsMarkdown(pathname, request.headers.get("accept"))) {
@@ -11902,9 +11950,10 @@ async function handleFarmFetch(request, context) {
11902
11950
  );
11903
11951
 
11904
11952
  // headers() config applies after middleware let the request through, so it learns
11905
- // whether the response was guarded and can't make that response shareable again.
11953
+ // whether the response was guarded and can't make that response shareable again. A plugin
11954
+ // runtime hook that throws answers a new 500 out here, which learns it the same way.
11906
11955
  let farmGuardedResponse = false;
11907
- if (configuredHeaderRoutes.length > 0) {
11956
+ if (configuredHeaderRoutes.length > 0 || farmPluginRuntime) {
11908
11957
  const adapterContext = context;
11909
11958
  context = {
11910
11959
  ...adapterContext,
@@ -11937,9 +11986,15 @@ async function handleFarmFetch(request, context) {
11937
11986
  const configured = applyConfiguredResponseHeaders(response, routePathname);
11938
11987
  // Configured headers may edit the response in place, so check it either way.
11939
11988
  const guarded = farmGuardedResponse ? _withFarmGuardedResponseCache(configured) : configured;
11989
+ // The deployment cookie goes on once the response's cache policy is final.
11940
11990
  return applyFarmPreloadBudget(
11941
11991
  applyFarmCspNonceToResponse(
11942
- applyFarmMobileShellResponse(runtimeRequest, guarded, context),
11992
+ _withFarmDeploymentCookie(
11993
+ runtimeRequest,
11994
+ applyFarmMobileShellResponse(runtimeRequest, guarded, context),
11995
+ farmDeploymentId,
11996
+ farmDeploymentCookiePath,
11997
+ ),
11943
11998
  farmSecurityConfig,
11944
11999
  cspNonce,
11945
12000
  ),
@@ -11984,7 +12039,9 @@ async function handleFarmFetch(request, context) {
11984
12039
  const response = await _runWithCurrentRequest(request, () =>
11985
12040
  _runWithFarmCspNonce(cspNonce, () => _runWithAfterRequest(request, runRequest, context)),
11986
12041
  );
11987
- return ${hasCompressionRuntime && !hasPluginRuntime ? "compressFarmResponse(request, response, getFarmOwnedBufferedHtml(response), farmLazyBufferedHtml.has(response))" : "response"};
12042
+ // A Nitro cache rule stores the response and strips its Content-Encoding, so a
12043
+ // response it caches is sent as it is, with no Vary on an encoding it never saw.
12044
+ return ${hasCompressionRuntime && !hasPluginRuntime ? "context?.routeRuleCache ? response : compressFarmResponse(request, response, getFarmOwnedBufferedHtml(response), farmLazyBufferedHtml.has(response))" : "response"};
11988
12045
  }),
11989
12046
  {
11990
12047
  onResponseFinished: typeof context?.onResponseFinished === "function"
@@ -12078,6 +12135,14 @@ function withFarmEdgeGuardedPrerenderHeaders(headers, edgeGuarded) {
12078
12135
  "cache-control": "private, no-store"
12079
12136
  };
12080
12137
  }
12138
+ function prerenderWouldChangePageUrl(pathname) {
12139
+ if (/%(?:23|25|2F|3F)/i.test(pathname)) return true;
12140
+ try {
12141
+ return decodeURI(pathname) !== pathname;
12142
+ } catch {
12143
+ return true;
12144
+ }
12145
+ }
12081
12146
  function getPhysicalPrerenderBypassReason(options) {
12082
12147
  const {
12083
12148
  config,
@@ -12087,6 +12152,7 @@ function getPhysicalPrerenderBypassReason(options) {
12087
12152
  rewriteSources,
12088
12153
  pathname
12089
12154
  } = options;
12155
+ if (prerenderWouldChangePageUrl(pathname)) return "an escaped character in its URL";
12090
12156
  if (config.i18n.enabled) return "request-sensitive i18n";
12091
12157
  if (redirectSources.some((source) => middlewarePatternMatches(source, pathname))) {
12092
12158
  return "redirect";
@@ -12147,6 +12213,23 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
12147
12213
  }
12148
12214
  return pages;
12149
12215
  }
12216
+ async function listFarmDocsAnalyticsPages(config, root, preset) {
12217
+ if (!config.docs?.enabled || config.analytics === false || resolveFarmInstrumentationRuntime(preset) !== "nodejs") {
12218
+ return [];
12219
+ }
12220
+ try {
12221
+ return await listFarmDocsPagePaths(config.docs, {
12222
+ root,
12223
+ srcDir: config.srcDir,
12224
+ adapter: isReactRenderer(config.renderer) && hasFarmDocsRuntimeAdapter(config.docs)
12225
+ });
12226
+ } catch (error) {
12227
+ logger.warn(
12228
+ `Farm Infra analytics reports docs pages by the docs route, not each page's path: listing them failed (${error instanceof Error ? error.message : String(error)}).`
12229
+ );
12230
+ return [];
12231
+ }
12232
+ }
12150
12233
  function hasFarmNitroCacheRouteRule(routeRules) {
12151
12234
  return Object.values(routeRules || {}).some((rule) => {
12152
12235
  const swr = rule?.swr;
@@ -12468,12 +12551,19 @@ function resolveTrustedLocalOrigin(event, request) {
12468
12551
  : requestURL.hostname
12469
12552
  const isLoopback = (value) =>
12470
12553
  value === 'localhost' || value === '::1' || /^127(?:[.][0-9]{1,3}){3}$/.test(value)
12471
- return requestURL.protocol === protocol &&
12554
+ if (
12555
+ requestURL.protocol === protocol &&
12472
12556
  requestPort === port &&
12473
12557
  isLoopback(address) &&
12474
12558
  isLoopback(normalizedRequestHostname)
12475
- ? requestURL.origin
12476
- : undefined
12559
+ ) {
12560
+ return requestURL.origin
12561
+ }
12562
+ // Any other Host is the client's to choose, so it must not decide where a local image is
12563
+ // fetched from: the optimizer reads local sources from this server's own socket address, as the
12564
+ // development server does. A TLS socket's certificate names the public host, not this address,
12565
+ // so there the request origin still stands in.
12566
+ return socket.encrypted ? undefined : origin
12477
12567
  }
12478
12568
 
12479
12569
  // Export the event handler for Nitro
@@ -12494,6 +12584,7 @@ ${hasNitroCacheRouteRules ? " let farmGuardedResponse = false\n" : ""} const r
12494
12584
  onResponseFinished: createResponseFinishedHook(event),
12495
12585
  trustedLocalOrigin: resolveTrustedLocalOrigin(event, request),
12496
12586
  clientAddress: resolveFarmClientAddress(event),${hasNitroCacheRouteRules ? `
12587
+ routeRuleCache: Boolean(event.context?.routeRules?.cache),
12497
12588
  onGuardedResponse: () => {
12498
12589
  farmGuardedResponse = true
12499
12590
  },` : ""}
@@ -12608,7 +12699,10 @@ function toFarmNodeResponse(request, response) {
12608
12699
  ssrEntryFile
12609
12700
  );
12610
12701
  const configuredNitroRouteRules = nitroRouteRulesBelowBasePath(
12611
- shouldBuildFarmMobileClient(config) ? varyFarmNitroCacheRulesByShell(routeRulesToNitroRouteRules(config.routeRules)) : routeRulesToNitroRouteRules(config.routeRules),
12702
+ varyFarmNitroCacheRules(routeRulesToNitroRouteRules(config.routeRules), [
12703
+ ...config.md.enabled ? ["accept"] : [],
12704
+ ...shouldBuildFarmMobileClient(config) ? ["x-farm-shell"] : []
12705
+ ]),
12612
12706
  config.basePath,
12613
12707
  resolveFarmAPIServerBasePath(config.api)
12614
12708
  );
@@ -13004,7 +13098,8 @@ function toFarmNodeResponse(request, response) {
13004
13098
  buildDir: path12.join(root, distDir),
13005
13099
  middlewareRoutes: edgeMiddlewareRoutes,
13006
13100
  guardedPages: edgeGuardedPrerenderRoutes
13007
- }
13101
+ },
13102
+ prerenderRoutes.map(toPrerenderPublicPath)
13008
13103
  );
13009
13104
  }
13010
13105
  logger.success(`\u2705 Nitro build completed with preset: ${preset}`);
@@ -13103,7 +13198,7 @@ async function moveVercelOutputPath(src, dest, fs4) {
13103
13198
  await fs4.cp(src, dest, { recursive: true, force: true });
13104
13199
  await fs4.rm(src, { recursive: true, force: true });
13105
13200
  }
13106
- async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflows, routeRuntimeManifest, cronJobs, edgeMiddleware) {
13201
+ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflows, routeRuntimeManifest, cronJobs, edgeMiddleware, prerenderedPages) {
13107
13202
  const serverDir = path12.join(outputDir, "server");
13108
13203
  const functionsDir = path12.join(outputDir, "functions");
13109
13204
  const nitroFuncDir = path12.join(functionsDir, "__nitro.func");
@@ -13151,7 +13246,8 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
13151
13246
  vercelConfig.routes = buildFarmVercelRoutes({
13152
13247
  presetRoutes: Array.isArray(vercelConfig.routes) ? vercelConfig.routes : [],
13153
13248
  runtimeRoutes,
13154
- middlewareRoutes: edgeMiddlewareRoutes.length > 0 ? [createFarmVercelEdgeMiddlewareRoute(edgeMiddleware.guardedPages, config.basePath)] : []
13249
+ middlewareRoutes: edgeMiddlewareRoutes.length > 0 ? [createFarmVercelEdgeMiddlewareRoute(edgeMiddleware.guardedPages, config.basePath)] : [],
13250
+ canonicalSlashRoutes: createFarmVercelCanonicalSlashRoutes(prerenderedPages)
13155
13251
  });
13156
13252
  const vercelConfigWithWorkflowCrons = applyFarmWorkflowVercelCrons(
13157
13253
  vercelConfig,
@@ -13197,7 +13293,8 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
13197
13293
  await fs4.mkdir(path12.dirname(bundledContentDir), { recursive: true });
13198
13294
  await fs4.cp(docsContentDir, bundledContentDir, {
13199
13295
  recursive: true,
13200
- force: true
13296
+ force: true,
13297
+ dereference: true
13201
13298
  });
13202
13299
  await fs4.writeFile(
13203
13300
  path12.join(bundledContentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST),
@@ -13782,7 +13879,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
13782
13879
  }
13783
13880
  async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
13784
13881
  const { farmI18nClientBridgePlugin, farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
13785
- const { PluginManager: PluginManager2 } = await import("./plugin-SAS22JL7.mjs");
13882
+ const { PluginManager: PluginManager2 } = await import("./plugin-VEBRN7A3.mjs");
13786
13883
  const pluginManager = new PluginManager2({
13787
13884
  config,
13788
13885
  isDev: false,
@@ -13809,7 +13906,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
13809
13906
  }
13810
13907
  async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
13811
13908
  const { farmI18nClientBridgePlugin, farmPlugin } = await import("./vite.mjs");
13812
- const { PluginManager: PluginManager2 } = await import("./plugin-SAS22JL7.mjs");
13909
+ const { PluginManager: PluginManager2 } = await import("./plugin-VEBRN7A3.mjs");
13813
13910
  const pluginManager = new PluginManager2({
13814
13911
  config,
13815
13912
  isDev: false,