@farm.js/core 0.1.31 → 0.1.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/README.md +1 -1
  2. package/dist/agent-runtime.cjs +69 -14
  3. package/dist/agent-runtime.d.mts +1 -1
  4. package/dist/agent-runtime.d.ts +1 -1
  5. package/dist/agent-runtime.mjs +58 -3
  6. package/dist/api/route-manager.cjs +16 -13
  7. package/dist/api/route-manager.d.mts +1 -1
  8. package/dist/api/route-manager.d.ts +1 -1
  9. package/dist/api/route-manager.mjs +15 -12
  10. package/dist/api/runtime.cjs +9 -7
  11. package/dist/api/runtime.d.mts +1 -1
  12. package/dist/api/runtime.d.ts +1 -1
  13. package/dist/api/runtime.mjs +8 -6
  14. package/dist/api.cjs +19 -16
  15. package/dist/api.d.mts +2 -2
  16. package/dist/api.d.ts +2 -2
  17. package/dist/api.mjs +18 -15
  18. package/dist/{app-sUJ3jnTZ.d.ts → app-DgotYGbq.d.ts} +3 -3
  19. package/dist/app-markdown.cjs +8 -6
  20. package/dist/app-markdown.d.mts +3 -3
  21. package/dist/app-markdown.d.ts +3 -3
  22. package/dist/app-markdown.mjs +7 -5
  23. package/dist/{app-DAuUTIZf.d.mts → app-q4rmZlXK.d.mts} +3 -3
  24. package/dist/cache.cjs +2 -2
  25. package/dist/cache.d.mts +10 -1
  26. package/dist/cache.d.ts +10 -1
  27. package/dist/cache.mjs +1 -1
  28. package/dist/{chunk-YZTASLPQ.cjs → chunk-27ZWSI3W.cjs} +2 -2
  29. package/dist/{chunk-WBIH66JK.mjs → chunk-2ELDTQRN.mjs} +5 -2
  30. package/dist/{chunk-K7CELQLK.cjs → chunk-2F2ER724.cjs} +54 -29
  31. package/dist/{chunk-NRVGEI5I.mjs → chunk-2NNMOPDN.mjs} +4 -210
  32. package/dist/chunk-2NQQ5H5G.cjs +86 -0
  33. package/dist/{chunk-IFI5FXEZ.cjs → chunk-36MK5YCW.cjs} +334 -163
  34. package/dist/chunk-3BU22U3M.cjs +237 -0
  35. package/dist/{chunk-MM5D6VLP.mjs → chunk-3KZS4SUS.mjs} +33 -14
  36. package/dist/chunk-3SDFA7UF.cjs +701 -0
  37. package/dist/{chunk-4IEPYMHF.mjs → chunk-3UEVPCGW.mjs} +1 -1
  38. package/dist/{chunk-5LJCOSKT.mjs → chunk-3VSKDFAT.mjs} +1 -1
  39. package/dist/{chunk-5HGR3W6O.mjs → chunk-5SJWVY6R.mjs} +8 -0
  40. package/dist/{chunk-X7WVQMIB.mjs → chunk-657WJNRY.mjs} +10 -4
  41. package/dist/{chunk-MKMBQSNQ.mjs → chunk-6VVL3MHY.mjs} +3 -3
  42. package/dist/{chunk-QZRVZSPN.cjs → chunk-77GNHH2Z.cjs} +3 -3
  43. package/dist/{chunk-KZLND3D2.cjs → chunk-7BT4H4P7.cjs} +7 -5
  44. package/dist/{chunk-A777V5WU.cjs → chunk-7M52YUMY.cjs} +2 -2
  45. package/dist/{chunk-VUMAE7NC.mjs → chunk-7Y6ZNFPX.mjs} +81 -30
  46. package/dist/{chunk-MXDTKXO6.cjs → chunk-A5FGU2WU.cjs} +74 -23
  47. package/dist/{chunk-7QOCTYBS.mjs → chunk-AGC75XAE.mjs} +37 -1
  48. package/dist/{chunk-4ZQQL4IU.mjs → chunk-AHGECQEW.mjs} +1 -1
  49. package/dist/{chunk-RG3ZOTG5.cjs → chunk-AI7QMY7O.cjs} +10 -3
  50. package/dist/{chunk-O3DTUAX2.mjs → chunk-AQZFOP7S.mjs} +6 -77
  51. package/dist/{chunk-WNLBF77X.cjs → chunk-ATK2R4CH.cjs} +14 -12
  52. package/dist/{chunk-SORB3MAR.cjs → chunk-AWC4VUZL.cjs} +17 -17
  53. package/dist/{chunk-YMCXWPWK.mjs → chunk-BCMSYSN2.mjs} +4 -1
  54. package/dist/{chunk-FYRBX5IY.cjs → chunk-BTAG7LI7.cjs} +2 -2
  55. package/dist/{chunk-I6XDAKWQ.mjs → chunk-BTHHUD7Q.mjs} +14 -0
  56. package/dist/chunk-C4SPBWFM.cjs +26 -0
  57. package/dist/{chunk-JATSG2ZO.mjs → chunk-CLJYVZAD.mjs} +4 -2
  58. package/dist/{chunk-J3LOGE4T.cjs → chunk-DQQOKWYA.cjs} +5 -5
  59. package/dist/{chunk-JLRDISQL.cjs → chunk-DZ4DTRJ5.cjs} +7 -7
  60. package/dist/chunk-E5GNDG5F.mjs +701 -0
  61. package/dist/{chunk-E76XC6ZG.mjs → chunk-EZDQRNQ7.mjs} +2 -2
  62. package/dist/{chunk-TOVMYGYW.mjs → chunk-F2SE2VDO.mjs} +1 -1
  63. package/dist/{chunk-BSPQVJ4A.mjs → chunk-FDR64H6B.mjs} +13 -0
  64. package/dist/{chunk-5OVTOKGH.cjs → chunk-FFFW3OQ7.cjs} +2 -2
  65. package/dist/{chunk-D4JE5NNV.cjs → chunk-FNO7A7CM.cjs} +5 -5
  66. package/dist/chunk-FZ6YYU2W.mjs +65 -0
  67. package/dist/{chunk-PZNCMPJF.cjs → chunk-G26MUMKL.cjs} +14 -8
  68. package/dist/{chunk-IXUY2F5U.mjs → chunk-GCXWJJKH.mjs} +4 -7
  69. package/dist/{chunk-JLCQGPXE.mjs → chunk-GNSDTTWZ.mjs} +50 -61
  70. package/dist/{chunk-TEN4FIZU.mjs → chunk-GOABMOX3.mjs} +151 -3
  71. package/dist/{chunk-HBTUGXHS.cjs → chunk-HLJ6MBUZ.cjs} +7 -4
  72. package/dist/{chunk-GZYH4OER.mjs → chunk-HR5KPHC2.mjs} +1 -1
  73. package/dist/{chunk-ZCU4NZ3M.cjs → chunk-IE7XCHH3.cjs} +4 -4
  74. package/dist/{chunk-I26CZYPV.cjs → chunk-IHNIDL6H.cjs} +50 -7
  75. package/dist/{chunk-2FQHH5SC.mjs → chunk-IHNMMXHV.mjs} +49 -24
  76. package/dist/{chunk-VHJGDMCG.cjs → chunk-IWZKTWHZ.cjs} +2 -2
  77. package/dist/{chunk-DGXN3L4D.mjs → chunk-JDPAKVS4.mjs} +4 -4
  78. package/dist/chunk-JG6DJF5A.mjs +238 -0
  79. package/dist/{chunk-5TISYEQF.mjs → chunk-JM5XPKWH.mjs} +10 -3
  80. package/dist/{chunk-BJJATPEC.mjs → chunk-KN7K4VQN.mjs} +1 -1
  81. package/dist/{chunk-WPYFSQKK.cjs → chunk-KNBBQHO2.cjs} +15 -1
  82. package/dist/{chunk-XWAWFQFS.cjs → chunk-KXWRO25S.cjs} +7 -4
  83. package/dist/{chunk-QG5HNS7P.mjs → chunk-LHODW25H.mjs} +2 -2
  84. package/dist/{chunk-BXFWA23T.mjs → chunk-LMJ7VRHZ.mjs} +3 -3
  85. package/dist/{chunk-WG2KHOMN.mjs → chunk-LR5QSC2P.mjs} +380 -209
  86. package/dist/chunk-LSKZMJMP.cjs +65 -0
  87. package/dist/{chunk-2N5PX3LS.mjs → chunk-LYV44OIR.mjs} +7 -1
  88. package/dist/{chunk-5MKEDGLD.cjs → chunk-M64YUMA4.cjs} +11 -6
  89. package/dist/{chunk-EXLKRR4U.cjs → chunk-MIDIZJZC.cjs} +12 -12
  90. package/dist/{chunk-ES4B2IXW.cjs → chunk-MOKLYNHV.cjs} +2 -2
  91. package/dist/{chunk-IV6CQY7O.mjs → chunk-MSSFIQGM.mjs} +63 -13
  92. package/dist/{chunk-KH7BN726.cjs → chunk-N4UOK6ZI.cjs} +8 -2
  93. package/dist/{chunk-6VYZOPOT.mjs → chunk-NGVORZVZ.mjs} +1 -1
  94. package/dist/{chunk-JNGIWIY6.mjs → chunk-NPC7VWJE.mjs} +2 -2
  95. package/dist/{chunk-ILWLPEVO.mjs → chunk-NRSN7G7E.mjs} +2 -2
  96. package/dist/{chunk-AHAJGAYD.mjs → chunk-O27L4YAA.mjs} +1 -1
  97. package/dist/{chunk-VYZSOYR4.cjs → chunk-ODBZYBAB.cjs} +1 -1
  98. package/dist/{chunk-YVGAEAA5.cjs → chunk-P64MIF5B.cjs} +154 -6
  99. package/dist/{chunk-DFLLARUK.cjs → chunk-PQDFUSXD.cjs} +14 -14
  100. package/dist/{chunk-F6XEGFHO.mjs → chunk-PXKIEXZD.mjs} +10 -0
  101. package/dist/{chunk-S5GDHOE4.mjs → chunk-PZNL3WEG.mjs} +48 -5
  102. package/dist/{chunk-FV45CKBC.mjs → chunk-QCFBDFRS.mjs} +1 -1
  103. package/dist/{chunk-75BRBIFP.cjs → chunk-QCVE2OCI.cjs} +5 -8
  104. package/dist/{chunk-6ZCMSZ5U.mjs → chunk-QE6VAKLT.mjs} +1 -1
  105. package/dist/{chunk-75DYEVXI.cjs → chunk-QGYRXFU2.cjs} +9 -9
  106. package/dist/{chunk-CTV2TTNP.cjs → chunk-QJ3J6MZT.cjs} +16 -87
  107. package/dist/{chunk-O6XNAMBV.mjs → chunk-QLQ32WC4.mjs} +8 -3
  108. package/dist/{chunk-IMB4PIAR.cjs → chunk-SJVKK4JE.cjs} +839 -420
  109. package/dist/{chunk-3FCFQP5V.cjs → chunk-TA5G2HWD.cjs} +21 -21
  110. package/dist/{chunk-Z5HIWVDP.cjs → chunk-TDFPACVX.cjs} +62 -73
  111. package/dist/{chunk-ND224OE2.cjs → chunk-TKSCR644.cjs} +34 -15
  112. package/dist/{chunk-UAFSBWNT.mjs → chunk-U4PTAHW3.mjs} +64 -13
  113. package/dist/{chunk-ZHVYQL3H.cjs → chunk-U74I55WB.cjs} +86 -35
  114. package/dist/chunk-UBO4SGH4.mjs +86 -0
  115. package/dist/{chunk-IQXFRNY2.cjs → chunk-UFDAAQFX.cjs} +2 -2
  116. package/dist/{chunk-X7KZBF63.cjs → chunk-UX5S4JEO.cjs} +40 -4
  117. package/dist/{chunk-5ZSWG4UX.cjs → chunk-UXFQ3UDA.cjs} +14 -1
  118. package/dist/{chunk-L4DVIHOC.mjs → chunk-VCCUOMQN.mjs} +1 -1
  119. package/dist/{chunk-4V7GIE2U.mjs → chunk-VHANUNEG.mjs} +2 -2
  120. package/dist/{chunk-FXUUWYAX.cjs → chunk-VKNHTSAP.cjs} +10 -0
  121. package/dist/{chunk-2AKFKCHA.mjs → chunk-W7LF2J2S.mjs} +1 -1
  122. package/dist/{chunk-MNUGPHLN.mjs → chunk-WNNYOOIB.mjs} +5 -3
  123. package/dist/{chunk-VA62MHFV.mjs → chunk-X242HVD5.mjs} +1 -1
  124. package/dist/{chunk-UJ2C4ICS.cjs → chunk-XJXBIP67.cjs} +4 -4
  125. package/dist/{chunk-6L6DQR5W.mjs → chunk-XV5DJTBX.mjs} +539 -121
  126. package/dist/{chunk-KJ2TIHZZ.cjs → chunk-XXJU7FCC.cjs} +3 -2
  127. package/dist/{chunk-DYEJQTDN.cjs → chunk-YSCV4SJF.cjs} +4 -4
  128. package/dist/{chunk-2SDO73HK.cjs → chunk-YWN746US.cjs} +64 -14
  129. package/dist/chunk-Z2HLU4IX.cjs +238 -0
  130. package/dist/{chunk-2FXWWUE5.cjs → chunk-Z2YLTERK.cjs} +4 -4
  131. package/dist/{chunk-CUMINO7Z.cjs → chunk-ZHPHJPQP.cjs} +4 -4
  132. package/dist/{chunk-FJZ3DQLK.mjs → chunk-ZKP7C2B6.mjs} +4 -4
  133. package/dist/{chunk-JBC2FKRW.mjs → chunk-ZUSJDQ2Q.mjs} +2 -1
  134. package/dist/{client-plugins-BX2ptm4H.d.mts → client-plugins-CLObcuCq.d.mts} +26 -2
  135. package/dist/{client-plugins-BmxM5KW_.d.ts → client-plugins-DZjHC4Mi.d.ts} +26 -2
  136. package/dist/client-plugins.d.mts +1 -1
  137. package/dist/client-plugins.d.ts +1 -1
  138. package/dist/client.cjs +8 -8
  139. package/dist/client.d.mts +5 -5
  140. package/dist/client.d.ts +5 -5
  141. package/dist/client.mjs +7 -7
  142. package/dist/config.d.mts +1 -1
  143. package/dist/config.d.ts +1 -1
  144. package/dist/{devtools-EWRDHCD5.cjs → devtools-HU6Y2MNV.cjs} +11 -9
  145. package/dist/{devtools-BPBCYOU6.mjs → devtools-RNXCTS4R.mjs} +10 -8
  146. package/dist/docs.cjs +13 -11
  147. package/dist/docs.d.mts +5 -0
  148. package/dist/docs.d.ts +5 -0
  149. package/dist/docs.mjs +12 -10
  150. package/dist/environment/vite.cjs +2 -2
  151. package/dist/environment/vite.mjs +1 -1
  152. package/dist/headers.cjs +4 -4
  153. package/dist/headers.mjs +3 -3
  154. package/dist/i18n/client.cjs +14 -13
  155. package/dist/i18n/client.mjs +5 -4
  156. package/dist/i18n/index.cjs +3 -2
  157. package/dist/i18n/index.mjs +2 -1
  158. package/dist/i18n/server.cjs +6 -5
  159. package/dist/i18n/server.mjs +5 -4
  160. package/dist/image/server.cjs +2 -2
  161. package/dist/image/server.mjs +1 -1
  162. package/dist/image/sharp.cjs +9 -9
  163. package/dist/image/sharp.mjs +1 -1
  164. package/dist/index.cjs +67 -55
  165. package/dist/index.d.mts +14 -14
  166. package/dist/index.d.ts +14 -14
  167. package/dist/index.mjs +70 -58
  168. package/dist/integrations.cjs +6 -3
  169. package/dist/integrations.d.mts +1 -1
  170. package/dist/integrations.d.ts +1 -1
  171. package/dist/integrations.mjs +7 -4
  172. package/dist/internal/app-markdown-runtime.cjs +7 -5
  173. package/dist/internal/app-markdown-runtime.d.mts +14 -3
  174. package/dist/internal/app-markdown-runtime.d.ts +14 -3
  175. package/dist/internal/app-markdown-runtime.mjs +6 -4
  176. package/dist/internal/build-runtime.cjs +38 -35
  177. package/dist/internal/build-runtime.d.mts +3 -3
  178. package/dist/internal/build-runtime.d.ts +3 -3
  179. package/dist/internal/build-runtime.mjs +37 -34
  180. package/dist/internal/cli-runtime.cjs +20 -17
  181. package/dist/internal/cli-runtime.mjs +19 -16
  182. package/dist/internal/client-error-overlay.cjs +4 -4
  183. package/dist/internal/client-error-overlay.mjs +1 -1
  184. package/dist/internal/client-runtime.cjs +4 -2
  185. package/dist/internal/client-runtime.d.mts +9 -1
  186. package/dist/internal/client-runtime.d.ts +9 -1
  187. package/dist/internal/client-runtime.mjs +3 -1
  188. package/dist/internal/compression-runtime.d.mts +1 -1
  189. package/dist/internal/compression-runtime.d.ts +1 -1
  190. package/dist/internal/config-runtime.cjs +11 -9
  191. package/dist/internal/config-runtime.d.mts +2 -2
  192. package/dist/internal/config-runtime.d.ts +2 -2
  193. package/dist/internal/config-runtime.mjs +10 -8
  194. package/dist/internal/infra-analytics-runtime.cjs +4 -4
  195. package/dist/internal/infra-analytics-runtime.mjs +2 -2
  196. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  197. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  198. package/dist/internal/production-runtime.cjs +20 -14
  199. package/dist/internal/production-runtime.d.mts +115 -8
  200. package/dist/internal/production-runtime.d.ts +115 -8
  201. package/dist/internal/production-runtime.mjs +19 -13
  202. package/dist/internal/request-cookies.cjs +4 -2
  203. package/dist/internal/request-cookies.d.mts +9 -1
  204. package/dist/internal/request-cookies.d.ts +9 -1
  205. package/dist/internal/request-cookies.mjs +3 -1
  206. package/dist/markdown.cjs +4 -4
  207. package/dist/markdown.d.mts +1 -1
  208. package/dist/markdown.d.ts +1 -1
  209. package/dist/markdown.mjs +3 -3
  210. package/dist/{metadata-DsEaK7mQ.d.mts → metadata-2HSU2i_w.d.mts} +1 -1
  211. package/dist/{metadata-fwZ3gfG6.d.ts → metadata-Cjs8JMRM.d.ts} +1 -1
  212. package/dist/middleware.cjs +18 -8
  213. package/dist/middleware.d.mts +24 -5
  214. package/dist/middleware.d.ts +24 -5
  215. package/dist/middleware.mjs +18 -8
  216. package/dist/navigation.cjs +6 -6
  217. package/dist/navigation.d.mts +4 -4
  218. package/dist/navigation.d.ts +4 -4
  219. package/dist/navigation.mjs +5 -5
  220. package/dist/{nitro-NAKCRVHX.mjs → nitro-4XGPNIK4.mjs} +3 -3
  221. package/dist/{nitro-VYDZGYFY.cjs → nitro-HSAQFXSS.cjs} +4 -4
  222. package/dist/plugin.cjs +33 -30
  223. package/dist/plugin.d.mts +1 -1
  224. package/dist/plugin.d.ts +1 -1
  225. package/dist/plugin.mjs +32 -29
  226. package/dist/{production-runtime-DNkpFnmg.d.ts → production-runtime-BU5ETAK9.d.ts} +8 -1
  227. package/dist/{production-runtime-Baqgwtvc.d.mts → production-runtime-CysZl3EV.d.mts} +8 -1
  228. package/dist/query/client.cjs +7 -7
  229. package/dist/query/client.mjs +3 -3
  230. package/dist/{render-plan-DhwQnmmX.d.mts → render-plan-CKr4ltOd.d.mts} +1 -1
  231. package/dist/{render-plan-rkIK9wd9.d.ts → render-plan-D72O1qm4.d.ts} +1 -1
  232. package/dist/renderer-client.cjs +39 -19
  233. package/dist/renderer-client.d.mts +3 -3
  234. package/dist/renderer-client.d.ts +3 -3
  235. package/dist/renderer-client.mjs +28 -8
  236. package/dist/{request-CFy1BltJ.d.mts → request-Be83WafN.d.mts} +7 -2
  237. package/dist/{request-BcY4RYPC.d.ts → request-DbyOYI2j.d.ts} +7 -2
  238. package/dist/request.cjs +2 -2
  239. package/dist/request.d.mts +2 -2
  240. package/dist/request.d.ts +2 -2
  241. package/dist/request.mjs +1 -1
  242. package/dist/{route-rendering-BkS0TBlB.d.mts → route-rendering-BG56SzvJ.d.mts} +1 -1
  243. package/dist/{route-rendering-D4XpMjam.d.ts → route-rendering-CtVMpV-k.d.ts} +1 -1
  244. package/dist/{router-C4zPlC3V.d.mts → router-ALUvm8gC.d.mts} +1 -1
  245. package/dist/{router-Cq7BcZxg.d.ts → router-D94-SDlW.d.ts} +1 -1
  246. package/dist/routes.cjs +3 -3
  247. package/dist/routes.d.mts +1 -1
  248. package/dist/routes.d.ts +1 -1
  249. package/dist/routes.mjs +2 -2
  250. package/dist/server-fn.cjs +3 -3
  251. package/dist/server-fn.mjs +2 -2
  252. package/dist/server-plugins.cjs +4 -4
  253. package/dist/server-plugins.d.mts +2 -2
  254. package/dist/server-plugins.d.ts +2 -2
  255. package/dist/server-plugins.mjs +3 -3
  256. package/dist/server-query-client.cjs +3 -3
  257. package/dist/server-query-client.mjs +2 -2
  258. package/dist/server-query.cjs +4 -4
  259. package/dist/server-query.mjs +3 -3
  260. package/dist/server.cjs +60 -57
  261. package/dist/server.d.mts +7 -7
  262. package/dist/server.d.ts +7 -7
  263. package/dist/server.mjs +37 -34
  264. package/dist/{spa-router-B1HI3X9k.d.ts → spa-router-CxK3USIz.d.ts} +2 -2
  265. package/dist/{spa-router-DzPZH-AO.d.mts → spa-router-DbxNRKOB.d.mts} +2 -2
  266. package/dist/testing.cjs +19 -17
  267. package/dist/testing.d.mts +1 -1
  268. package/dist/testing.d.ts +1 -1
  269. package/dist/testing.mjs +16 -14
  270. package/dist/theme/server.cjs +4 -3
  271. package/dist/theme/server.mjs +3 -2
  272. package/dist/{utils-DMD1Hzta.d.ts → utils-311Y8eoK.d.ts} +1 -1
  273. package/dist/{utils-CEBktlBG.d.mts → utils-4wVRcpOw.d.mts} +1 -1
  274. package/dist/version.cjs +2 -2
  275. package/dist/version.mjs +1 -1
  276. package/dist/vite.cjs +33 -30
  277. package/dist/vite.d.mts +1 -1
  278. package/dist/vite.d.ts +1 -1
  279. package/dist/vite.mjs +32 -29
  280. package/package.json +2 -2
  281. package/dist/chunk-22GUSVNJ.cjs +0 -351
  282. package/dist/chunk-SWN467MP.cjs +0 -18
  283. package/dist/chunk-XGC343EY.cjs +0 -443
  284. package/dist/chunk-ZSH2Y4LN.mjs +0 -351
  285. /package/dist/{chunk-SUIBNSNO.cjs → chunk-SJNMVDDF.cjs} +0 -0
  286. /package/dist/{chunk-LNZ7JZUS.mjs → chunk-UDNPLXW7.mjs} +0 -0
@@ -1,12 +1,10 @@
1
1
  import {
2
2
  collectSSGPages,
3
- createRouteSlotContainerId,
4
3
  generateFarmTypeArtifacts,
5
4
  matchSSGPage,
6
- parseRouteSlotFile,
7
5
  resolveRouteRenderingConfig,
8
6
  resolveRouteRenderingConfigFromFile
9
- } from "./chunk-O3DTUAX2.mjs";
7
+ } from "./chunk-AQZFOP7S.mjs";
10
8
  import {
11
9
  collectSchemaExtensions,
12
10
  declareSchemaTables,
@@ -17,8 +15,10 @@ import {
17
15
  } from "./chunk-ZMSZZXOR.mjs";
18
16
  import {
19
17
  FARM_API_CATALOG_PATH,
18
+ FARM_APP_MANIFEST_PATH,
20
19
  createDefaultErrorMarkup,
21
20
  createFarmApiCatalogResponse,
21
+ createFarmAppManifestResponse,
22
22
  createFarmMetadataRouteResponse,
23
23
  createFarmThemeDocumentParts,
24
24
  createLateNotFoundRecovery,
@@ -26,8 +26,9 @@ import {
26
26
  getDefaultErrorStatusText,
27
27
  renderFarmLocaleAlternateLinks,
28
28
  resolveDefaultErrorStatus,
29
- resolveFarmApiCatalogInput
30
- } from "./chunk-TEN4FIZU.mjs";
29
+ resolveFarmApiCatalogInput,
30
+ resolveFarmAppManifestInput
31
+ } from "./chunk-GOABMOX3.mjs";
31
32
  import {
32
33
  isFarmPreviewDeploymentEnvironment
33
34
  } from "./chunk-BOYNDCZL.mjs";
@@ -36,7 +37,7 @@ import {
36
37
  } from "./chunk-YQVSHTMR.mjs";
37
38
  import {
38
39
  createFarmImageHandler
39
- } from "./chunk-F6XEGFHO.mjs";
40
+ } from "./chunk-PXKIEXZD.mjs";
40
41
  import {
41
42
  FARM_ISLAND_REPLAYABLE_SELECTOR,
42
43
  isFarmIslandStrategy
@@ -46,11 +47,11 @@ import {
46
47
  } from "./chunk-PNGWZFUQ.mjs";
47
48
  import {
48
49
  farmEnvironmentFunctionsPlugin
49
- } from "./chunk-ZSH2Y4LN.mjs";
50
+ } from "./chunk-E5GNDG5F.mjs";
50
51
  import {
51
52
  _setDefaultFarmThemeConfig,
52
53
  getTheme
53
- } from "./chunk-WBIH66JK.mjs";
54
+ } from "./chunk-2ELDTQRN.mjs";
54
55
  import {
55
56
  generateFarmDocsAdapterClientRuntime,
56
57
  getFarmDocsAdapterConfigModule
@@ -108,7 +109,7 @@ import {
108
109
  resolveFarmLlmsTxtConfig,
109
110
  resolveFarmPerformanceConfig,
110
111
  resolveFarmSecurityConfig
111
- } from "./chunk-6VYZOPOT.mjs";
112
+ } from "./chunk-NGVORZVZ.mjs";
112
113
  import {
113
114
  getPublicFarmImageConfig,
114
115
  resolveFarmImageConfig
@@ -126,12 +127,12 @@ import {
126
127
  import {
127
128
  createFarmMarkdownRouteModuleFromFile,
128
129
  loadFarmMdxComponents
129
- } from "./chunk-5LJCOSKT.mjs";
130
+ } from "./chunk-3VSKDFAT.mjs";
130
131
  import {
131
132
  createFarmMarkdownSourceResponse,
132
133
  isFarmMarkdownPageFile,
133
134
  normalizeFarmMarkdownRoutePath
134
- } from "./chunk-7QOCTYBS.mjs";
135
+ } from "./chunk-AGC75XAE.mjs";
135
136
  import {
136
137
  resolveFarmMdxComponentsModulePath,
137
138
  resolveMdxConfig
@@ -145,7 +146,7 @@ import {
145
146
  getFarmMarkdownMirrorPath,
146
147
  resolveMarkdownConfig,
147
148
  resolveMarkdownMirrorTarget
148
- } from "./chunk-JBC2FKRW.mjs";
149
+ } from "./chunk-ZUSJDQ2Q.mjs";
149
150
  import {
150
151
  resolveWorkflowsConfig
151
152
  } from "./chunk-3ATMYLLJ.mjs";
@@ -168,16 +169,20 @@ import {
168
169
  getRegisteredIntegrationAPIManifest,
169
170
  isFarmIntegrationProviderComponentReference,
170
171
  matchIntegrationRoute
171
- } from "./chunk-JLCQGPXE.mjs";
172
+ } from "./chunk-GNSDTTWZ.mjs";
172
173
  import {
173
174
  MiddlewareManager
174
- } from "./chunk-VUMAE7NC.mjs";
175
+ } from "./chunk-7Y6ZNFPX.mjs";
176
+ import {
177
+ createRouteSlotContainerId,
178
+ parseRouteSlotFile
179
+ } from "./chunk-UBO4SGH4.mjs";
175
180
  import {
176
181
  _clearCurrentMiddlewareContext,
177
182
  _clearCurrentMiddlewareData,
178
183
  _runWithMiddlewareContext,
179
184
  _runWithMiddlewareData
180
- } from "./chunk-NRVGEI5I.mjs";
185
+ } from "./chunk-2NNMOPDN.mjs";
181
186
  import {
182
187
  _runWithAPIRequestRuntime
183
188
  } from "./chunk-R3DS7A2T.mjs";
@@ -186,17 +191,17 @@ import {
186
191
  } from "./chunk-IOEH4VWN.mjs";
187
192
  import {
188
193
  APIRouteManager
189
- } from "./chunk-BXFWA23T.mjs";
194
+ } from "./chunk-LMJ7VRHZ.mjs";
190
195
  import {
191
196
  findProgrammaticRouteFiles,
192
197
  loadProgrammaticRouteManifests
193
- } from "./chunk-LNZ7JZUS.mjs";
198
+ } from "./chunk-UDNPLXW7.mjs";
194
199
  import {
195
200
  _runWithFarmI18nRequest,
196
201
  _setDefaultFarmI18nRuntime,
197
202
  createFarmI18nRuntime,
198
203
  getFarmI18nClientSnapshot
199
- } from "./chunk-JNGIWIY6.mjs";
204
+ } from "./chunk-NPC7VWJE.mjs";
200
205
  import {
201
206
  VERCEL_OG_INSTALL_HINT,
202
207
  formatOptionalPeerInstallHint,
@@ -205,10 +210,7 @@ import {
205
210
  } from "./chunk-YOZYCI6Z.mjs";
206
211
  import {
207
212
  isFarmAPIPathname
208
- } from "./chunk-X7WVQMIB.mjs";
209
- import {
210
- resolveFarmAPIServerBasePath
211
- } from "./chunk-I6XDAKWQ.mjs";
213
+ } from "./chunk-657WJNRY.mjs";
212
214
  import {
213
215
  createProgrammaticRouteModuleId,
214
216
  getProgrammaticRouteSearchClientOptions,
@@ -228,7 +230,7 @@ import {
228
230
  configureFarmCache,
229
231
  getFarmDataCache,
230
232
  normalizeRevalidatePath
231
- } from "./chunk-IV6CQY7O.mjs";
233
+ } from "./chunk-MSSFIQGM.mjs";
232
234
  import {
233
235
  clearRequestContext,
234
236
  copyRequestContext,
@@ -255,7 +257,7 @@ import {
255
257
  isFarmI18nCatalogFile,
256
258
  resolveFarmI18nConfig,
257
259
  resolveFarmI18nMessagePath
258
- } from "./chunk-YMCXWPWK.mjs";
260
+ } from "./chunk-BCMSYSN2.mjs";
259
261
  import {
260
262
  fileExists,
261
263
  globFiles,
@@ -274,6 +276,9 @@ import {
274
276
  import {
275
277
  searchParamsToObject
276
278
  } from "./chunk-QVKYGNVM.mjs";
279
+ import {
280
+ resolveFarmAPIServerBasePath
281
+ } from "./chunk-BTHHUD7Q.mjs";
277
282
  import {
278
283
  configureFarmObservability,
279
284
  emitFarmEvent,
@@ -285,7 +290,7 @@ import {
285
290
  } from "./chunk-Z2RZJZIZ.mjs";
286
291
  import {
287
292
  FARM_VERSION
288
- } from "./chunk-VA62MHFV.mjs";
293
+ } from "./chunk-X242HVD5.mjs";
289
294
  import {
290
295
  resolveFarmTrailingSlashRedirect,
291
296
  setFarmTrailingSlashPreference
@@ -297,7 +302,7 @@ import {
297
302
  import {
298
303
  createFarmLocaleCookie,
299
304
  getFarmLocaleVaryHeaders
300
- } from "./chunk-IXUY2F5U.mjs";
305
+ } from "./chunk-GCXWJJKH.mjs";
301
306
  import {
302
307
  addMetadataImageReference,
303
308
  addMetadataMarkdownAlternate,
@@ -321,7 +326,7 @@ import {
321
326
  } from "./chunk-CNOQY6Z7.mjs";
322
327
  import {
323
328
  FARM_CONFIG_REWRITES_PLUGIN_NAME
324
- } from "./chunk-2AKFKCHA.mjs";
329
+ } from "./chunk-W7LF2J2S.mjs";
325
330
  import {
326
331
  appendFarmRedirectQuery
327
332
  } from "./chunk-BRYHOB4X.mjs";
@@ -331,10 +336,14 @@ import {
331
336
  isFarmRedirectError
332
337
  } from "./chunk-CBBLJMR5.mjs";
333
338
  import {
339
+ _getRequestReadCount,
334
340
  _runWithCurrentRequest,
335
341
  createWebRequestFromFarmRequest,
336
342
  resolveFarmRequestURL
337
- } from "./chunk-BSPQVJ4A.mjs";
343
+ } from "./chunk-FDR64H6B.mjs";
344
+ import {
345
+ _resolveCurrentRequest
346
+ } from "./chunk-IZY3V5XW.mjs";
338
347
  import {
339
348
  localizeFarmHref,
340
349
  localizeFarmPathname,
@@ -1771,14 +1780,14 @@ function createFarmRouteRenderPlan(input = {}) {
1771
1780
  const layoutShouldHydrate = input.layoutShouldHydrate === true;
1772
1781
  const hydration = pageShouldHydrate ? layoutShouldHydrate ? "route-and-layout-islands" : "route-island" : layoutShouldHydrate ? "layout-island" : "none";
1773
1782
  const rendering = input.rendering;
1774
- const cache = rendering?.ssg ? typeof rendering.revalidate === "number" && rendering.revalidate > 0 ? { mode: "revalidate", revalidate: rendering.revalidate } : { mode: "static" } : { mode: "dynamic" };
1783
+ const cache2 = rendering?.ssg ? typeof rendering.revalidate === "number" && rendering.revalidate > 0 ? { mode: "revalidate", revalidate: rendering.revalidate } : { mode: "static" } : { mode: "dynamic" };
1775
1784
  return {
1776
1785
  version: 1,
1777
1786
  output: "html",
1778
1787
  navigation: "html-fragment",
1779
1788
  hydration,
1780
1789
  islandStrategy: hydration === "none" ? null : input.islandStrategy ?? "load",
1781
- cache
1790
+ cache: cache2
1782
1791
  };
1783
1792
  }
1784
1793
  __name(createFarmRouteRenderPlan, "createFarmRouteRenderPlan");
@@ -3784,15 +3793,15 @@ __name(readFontOptions, "readFontOptions");
3784
3793
  function evaluateStaticObject(code, id, node) {
3785
3794
  const result = {};
3786
3795
  const properties = Array.isArray(node.properties) ? node.properties : [];
3787
- for (const property of properties) {
3788
- if (!isAstNode(property) || property.type !== "Property" || property.computed === true) {
3796
+ for (const property2 of properties) {
3797
+ if (!isAstNode(property2) || property2.type !== "Property" || property2.computed === true) {
3789
3798
  throw fontError(id, "font options do not support spreads or computed properties");
3790
3799
  }
3791
- const key = readPropertyName(property.key);
3792
- if (!key || !isAstNode(property.value)) {
3800
+ const key = readPropertyName(property2.key);
3801
+ if (!key || !isAstNode(property2.value)) {
3793
3802
  throw fontError(id, "font options must use static property names and values");
3794
3803
  }
3795
- result[key] = evaluateStaticValue(code, id, property.value);
3804
+ result[key] = evaluateStaticValue(code, id, property2.value);
3796
3805
  }
3797
3806
  return result;
3798
3807
  }
@@ -4058,8 +4067,8 @@ function normalizePublicFontPath(source, moduleId) {
4058
4067
  }
4059
4068
  __name(normalizePublicFontPath, "normalizePublicFontPath");
4060
4069
  function isPathInside(parent, child) {
4061
- const relative3 = path6.relative(parent, child);
4062
- return relative3 === "" || !relative3.startsWith("..") && !path6.isAbsolute(relative3);
4070
+ const relative4 = path6.relative(parent, child);
4071
+ return relative4 === "" || !relative4.startsWith("..") && !path6.isAbsolute(relative4);
4063
4072
  }
4064
4073
  __name(isPathInside, "isPathInside");
4065
4074
  function normalizeBasePath(value) {
@@ -4513,8 +4522,8 @@ function redactErrorText(value) {
4513
4522
  }
4514
4523
  __name(redactErrorText, "redactErrorText");
4515
4524
  function isPathInsideRoot(root, filePath) {
4516
- const relative3 = path8.relative(root, filePath);
4517
- return relative3 === "" || !relative3.startsWith("..") && !path8.isAbsolute(relative3);
4525
+ const relative4 = path8.relative(root, filePath);
4526
+ return relative4 === "" || !relative4.startsWith("..") && !path8.isAbsolute(relative4);
4518
4527
  }
4519
4528
  __name(isPathInsideRoot, "isPathInsideRoot");
4520
4529
  function normalizeStackPath(value) {
@@ -4733,7 +4742,7 @@ __name(toMiddlewareMap, "toMiddlewareMap");
4733
4742
  function requestOwnHttpsServer(request2, address) {
4734
4743
  const url = new URL(request2.url);
4735
4744
  const hostname = url.hostname.replace(/^\[|\]$/g, "");
4736
- return new Promise((resolve5, reject) => {
4745
+ return new Promise((resolve6, reject) => {
4737
4746
  const outgoing = https.request(
4738
4747
  {
4739
4748
  host: address.host,
@@ -4755,7 +4764,7 @@ function requestOwnHttpsServer(request2, address) {
4755
4764
  const status = incoming.statusCode ?? 502;
4756
4765
  const hasBody = ![204, 205, 304].includes(status);
4757
4766
  if (!hasBody) incoming.resume();
4758
- resolve5(
4767
+ resolve6(
4759
4768
  new Response(hasBody ? Readable.toWeb(incoming) : null, {
4760
4769
  status,
4761
4770
  headers
@@ -4951,7 +4960,7 @@ var _ServerRenderer = class _ServerRenderer {
4951
4960
  const streaming = getFarmRendererStreamingCapabilitiesForRuntime(this.config.renderer, "node");
4952
4961
  const renderToPipeableStream = streaming.node ? this.rendererRuntime.renderToPipeableStream : void 0;
4953
4962
  if (renderToPipeableStream) {
4954
- return await new Promise((resolve5, reject) => {
4963
+ return await new Promise((resolve6, reject) => {
4955
4964
  const chunks = [];
4956
4965
  let started = false;
4957
4966
  const writable = new Writable({
@@ -4960,7 +4969,7 @@ var _ServerRenderer = class _ServerRenderer {
4960
4969
  callback();
4961
4970
  }
4962
4971
  });
4963
- writable.once("finish", () => resolve5(Buffer.concat(chunks).toString("utf8")));
4972
+ writable.once("finish", () => resolve6(Buffer.concat(chunks).toString("utf8")));
4964
4973
  writable.once("error", reject);
4965
4974
  const stream = renderToPipeableStream(element, {
4966
4975
  onShellReady() {
@@ -5485,6 +5494,7 @@ var _ServerRenderer = class _ServerRenderer {
5485
5494
  const programmaticRouteComponents = routeModule.__farmRouteComponents;
5486
5495
  let PageComponent = routeModule.default;
5487
5496
  let pageProps;
5497
+ let routeStateRejected = false;
5488
5498
  try {
5489
5499
  pageProps = await parseRouteModuleProps(routeModule, {
5490
5500
  props: rawPageProps,
@@ -5493,6 +5503,7 @@ var _ServerRenderer = class _ServerRenderer {
5493
5503
  });
5494
5504
  } catch (error) {
5495
5505
  if (isFarmRedirectError(error)) throw error;
5506
+ routeStateRejected = true;
5496
5507
  const routeStateProps = {
5497
5508
  ...rawPageProps,
5498
5509
  search: searchParamsObject,
@@ -5571,6 +5582,9 @@ var _ServerRenderer = class _ServerRenderer {
5571
5582
  key: pprCacheKey
5572
5583
  });
5573
5584
  }
5585
+ const outerRequest = _resolveCurrentRequest();
5586
+ const countRequestReads = /* @__PURE__ */ __name(() => (outerRequest ? _getRequestReadCount(outerRequest) : 0) + _getRequestReadCount(currentRequest), "countRequestReads");
5587
+ const requestReadsBeforeRender = countRequestReads();
5574
5588
  let LoadingFallbackComponent = null;
5575
5589
  if (loadingBoundaryEntry) {
5576
5590
  const loadingModule = await this.routeManager.loadRouteModule(
@@ -5746,7 +5760,8 @@ var _ServerRenderer = class _ServerRenderer {
5746
5760
  layoutModules,
5747
5761
  routeModule,
5748
5762
  pageProps,
5749
- pathname
5763
+ pathname,
5764
+ skipGeneratedRouteMetadata: routeStateRejected
5750
5765
  });
5751
5766
  req.__FARM_METADATA__ = mergedMetadata;
5752
5767
  const middlewareDataForContext = middlewareMap;
@@ -5851,7 +5866,22 @@ var _ServerRenderer = class _ServerRenderer {
5851
5866
  type: "ppr.suspense.holeDetected",
5852
5867
  route: pathname
5853
5868
  }) : void 0,
5854
- onComplete: pprShellOptions && req.method !== "HEAD" ? (html) => this.cachePPRShell(pprShellOptions, html) : void 0
5869
+ onComplete: pprShellOptions && req.method !== "HEAD" ? (html) => {
5870
+ if (countRequestReads() !== requestReadsBeforeRender) {
5871
+ emitFarmEvent({
5872
+ type: "ppr.shell.bypass",
5873
+ route: pathname,
5874
+ reason: "request-read"
5875
+ });
5876
+ emitFarmEvent({
5877
+ type: "cache.bypass",
5878
+ route: pathname,
5879
+ reason: "request-read"
5880
+ });
5881
+ return;
5882
+ }
5883
+ return this.cachePPRShell(pprShellOptions, html);
5884
+ } : void 0
5855
5885
  }
5856
5886
  );
5857
5887
  if (pprRefreshRoute) {
@@ -6025,7 +6055,7 @@ var _ServerRenderer = class _ServerRenderer {
6025
6055
  }
6026
6056
  }
6027
6057
  metadata = mergeMetadata(metadata, options.routeModule.metadata);
6028
- if (typeof options.routeModule.generateMetadata === "function") {
6058
+ if (!options.skipGeneratedRouteMetadata && typeof options.routeModule.generateMetadata === "function") {
6029
6059
  metadata = mergeMetadata(
6030
6060
  metadata,
6031
6061
  await options.routeModule.generateMetadata(options.pageProps)
@@ -6642,7 +6672,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6642
6672
  if (!renderToPipeableStream || fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument()) {
6643
6673
  return this.renderBufferedSSR(element, req, res, clearMiddlewareData, options);
6644
6674
  }
6645
- return new Promise((resolve5, reject) => {
6675
+ return new Promise((resolve6, reject) => {
6646
6676
  const streamStartTime = Date.now();
6647
6677
  const observabilityRoute = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
6648
6678
  const deploymentId = this.getDeploymentId();
@@ -6922,7 +6952,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6922
6952
  route: observabilityRoute,
6923
6953
  durationMs: Date.now() - streamStartTime
6924
6954
  });
6925
- resolve5();
6955
+ resolve6();
6926
6956
  }, "finishStream");
6927
6957
  res.write(securedShell);
6928
6958
  if (typeof res.flush === "function") {
@@ -7470,9 +7500,9 @@ __name(isVitePluginHook, "isVitePluginHook");
7470
7500
  function withVite5TransformContext(handler) {
7471
7501
  return function(...args) {
7472
7502
  const context = new Proxy(this, {
7473
- get(target, property, receiver) {
7474
- if (property === "environment") return void 0;
7475
- return Reflect.get(target, property, receiver);
7503
+ get(target, property2, receiver) {
7504
+ if (property2 === "environment") return void 0;
7505
+ return Reflect.get(target, property2, receiver);
7476
7506
  }
7477
7507
  });
7478
7508
  return handler.apply(context, args);
@@ -7632,8 +7662,8 @@ __name(validateSchemaSteps, "validateSchemaSteps");
7632
7662
  var _FarmPluginOptionsError = class _FarmPluginOptionsError extends TypeError {
7633
7663
  constructor(issues) {
7634
7664
  const lines = issues.map((issue) => {
7635
- const path18 = formatIssuePath(issue.path);
7636
- return ` - ${path18 ? `${path18}: ` : ""}${issue.message}`;
7665
+ const path21 = formatIssuePath(issue.path);
7666
+ return ` - ${path21 ? `${path21}: ` : ""}${issue.message}`;
7637
7667
  });
7638
7668
  super(`Invalid plugin options:
7639
7669
  ${lines.join("\n")}`);
@@ -7643,9 +7673,9 @@ ${lines.join("\n")}`);
7643
7673
  };
7644
7674
  __name(_FarmPluginOptionsError, "FarmPluginOptionsError");
7645
7675
  var FarmPluginOptionsError = _FarmPluginOptionsError;
7646
- function formatIssuePath(path18) {
7647
- if (!path18?.length) return "";
7648
- return path18.map((segment) => {
7676
+ function formatIssuePath(path21) {
7677
+ if (!path21?.length) return "";
7678
+ return path21.map((segment) => {
7649
7679
  const key = typeof segment === "object" && segment !== null ? segment.key : segment;
7650
7680
  return typeof key === "symbol" ? key.toString() : String(key);
7651
7681
  }).join(".");
@@ -7881,23 +7911,23 @@ var _PluginManager = class _PluginManager {
7881
7911
  `Farm plugin "${plugin.name}" runtime.endpoints must contain endpoint objects`
7882
7912
  );
7883
7913
  }
7884
- const path18 = normalizeFarmPluginRuntimeEndpointPath(
7914
+ const path21 = normalizeFarmPluginRuntimeEndpointPath(
7885
7915
  endpoint.path,
7886
7916
  `Farm plugin "${plugin.name}" runtime endpoint`
7887
7917
  );
7888
7918
  if (typeof endpoint.handler !== "function") {
7889
7919
  throw new TypeError(
7890
- `Farm plugin "${plugin.name}" runtime endpoint ${path18} requires a handler`
7920
+ `Farm plugin "${plugin.name}" runtime endpoint ${path21} requires a handler`
7891
7921
  );
7892
7922
  }
7893
- const owner = owners.get(path18);
7923
+ const owner = owners.get(path21);
7894
7924
  if (owner) {
7895
7925
  throw new Error(
7896
- `Farm plugin runtime endpoint ${path18} from "${plugin.name}" conflicts with "${owner}"`
7926
+ `Farm plugin runtime endpoint ${path21} from "${plugin.name}" conflicts with "${owner}"`
7897
7927
  );
7898
7928
  }
7899
- owners.set(path18, plugin.name);
7900
- endpoints.push({ plugin, endpoint, path: path18 });
7929
+ owners.set(path21, plugin.name);
7930
+ endpoints.push({ plugin, endpoint, path: path21 });
7901
7931
  }
7902
7932
  }
7903
7933
  this.runtimeEndpoints = endpoints;
@@ -8870,8 +8900,8 @@ __name(isArrayIndex, "isArrayIndex");
8870
8900
  import fs7 from "fs";
8871
8901
  import path13 from "path";
8872
8902
  var ADAPTER_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
8873
- function resolveFarmClientCacheAdapterEntry(root, cache) {
8874
- const client = cache?.client;
8903
+ function resolveFarmClientCacheAdapterEntry(root, cache2) {
8904
+ const client = cache2?.client;
8875
8905
  const adapter = client?.adapter;
8876
8906
  if (adapter === void 0) return void 0;
8877
8907
  if (typeof adapter !== "string" || adapter.trim().length === 0) {
@@ -8913,6 +8943,233 @@ function generateClientCachePersistenceCode(entry) {
8913
8943
  }
8914
8944
  __name(generateClientCachePersistenceCode, "generateClientCachePersistenceCode");
8915
8945
 
8946
+ // src/app-manifest-packages.ts
8947
+ import fs8 from "fs";
8948
+ import path14 from "path";
8949
+ var FARM_PACKAGE = /^@(?:farm\.js|farming-labs)\/[a-z0-9._-]+$/;
8950
+ function resolveFarmAppPackages(root) {
8951
+ let manifest;
8952
+ try {
8953
+ manifest = JSON.parse(fs8.readFileSync(path14.join(root, "package.json"), "utf8"));
8954
+ } catch {
8955
+ return {};
8956
+ }
8957
+ const names = new Set(
8958
+ [
8959
+ ...Object.keys(manifest.dependencies ?? {}),
8960
+ ...Object.keys(manifest.devDependencies ?? {})
8961
+ ].filter((name) => FARM_PACKAGE.test(name))
8962
+ );
8963
+ const versions = {};
8964
+ for (const name of [...names].sort()) {
8965
+ for (let dir = root; ; ) {
8966
+ try {
8967
+ const { version } = JSON.parse(
8968
+ fs8.readFileSync(path14.join(dir, "node_modules", name, "package.json"), "utf8")
8969
+ );
8970
+ if (typeof version === "string" && /^[0-9A-Za-z.+-]{1,64}$/.test(version))
8971
+ versions[name] = version;
8972
+ break;
8973
+ } catch {
8974
+ const parent = path14.dirname(dir);
8975
+ if (parent === dir) break;
8976
+ dir = parent;
8977
+ }
8978
+ }
8979
+ }
8980
+ return versions;
8981
+ }
8982
+ __name(resolveFarmAppPackages, "resolveFarmAppPackages");
8983
+
8984
+ // src/app-manifest-webmcp.ts
8985
+ import fs9 from "fs";
8986
+ import { createRequire as createRequire2 } from "module";
8987
+ import path15 from "path";
8988
+ import fg from "fast-glob";
8989
+ var WEBMCP_CLIENT = "@farm.js/webmcp/client";
8990
+ var DEFINERS = /* @__PURE__ */ new Set(["defineWebMCPTool", "registerWebMCPTool", "registerWebMCPTools"]);
8991
+ var HINTS = ["readOnlyHint", "destructiveHint", "idempotentHint", "openWorldHint"];
8992
+ var MAX_TOOLS = 500;
8993
+ var MAX_SCHEMA_BYTES = 64 * 1024;
8994
+ var NOT_STATIC = /* @__PURE__ */ Symbol("not static");
8995
+ var LANGS = {
8996
+ ts: "ts",
8997
+ mts: "ts",
8998
+ cts: "ts",
8999
+ tsx: "tsx",
9000
+ js: "jsx",
9001
+ mjs: "jsx",
9002
+ cjs: "jsx",
9003
+ jsx: "jsx"
9004
+ };
9005
+ var parseAst;
9006
+ function staticValue(node) {
9007
+ if (!node) return NOT_STATIC;
9008
+ switch (node.type) {
9009
+ case "Literal":
9010
+ return node.regex || typeof node.value === "bigint" ? NOT_STATIC : node.value;
9011
+ case "TemplateLiteral":
9012
+ return node.expressions.length ? NOT_STATIC : node.quasis[0].value.cooked;
9013
+ case "UnaryExpression":
9014
+ if (node.operator === "-" && node.argument.type === "Literal" && typeof node.argument.value === "number")
9015
+ return -node.argument.value;
9016
+ return NOT_STATIC;
9017
+ case "ArrayExpression": {
9018
+ const items = [];
9019
+ for (const element of node.elements) {
9020
+ const value = staticValue(element);
9021
+ if (value === NOT_STATIC) return NOT_STATIC;
9022
+ items.push(value);
9023
+ }
9024
+ return items;
9025
+ }
9026
+ case "ObjectExpression": {
9027
+ const object = {};
9028
+ for (const property2 of node.properties) {
9029
+ if (property2.type !== "Property" || property2.computed || property2.kind !== "init")
9030
+ return NOT_STATIC;
9031
+ const key = property2.key.type === "Identifier" ? property2.key.name : staticValue(property2.key);
9032
+ if (typeof key !== "string" || key === "__proto__") return NOT_STATIC;
9033
+ const value = staticValue(property2.value);
9034
+ if (value === NOT_STATIC) return NOT_STATIC;
9035
+ object[key] = value;
9036
+ }
9037
+ return object;
9038
+ }
9039
+ case "TSAsExpression":
9040
+ case "TSSatisfiesExpression":
9041
+ case "TSNonNullExpression":
9042
+ case "ParenthesizedExpression":
9043
+ return staticValue(node.expression);
9044
+ default:
9045
+ return NOT_STATIC;
9046
+ }
9047
+ }
9048
+ __name(staticValue, "staticValue");
9049
+ function property(object, name) {
9050
+ return object.properties.find(
9051
+ (entry) => entry.type === "Property" && !entry.computed && (entry.key.name === name || entry.key.value === name)
9052
+ )?.value;
9053
+ }
9054
+ __name(property, "property");
9055
+ function toolFromObject(object) {
9056
+ const name = staticValue(property(object, "name"));
9057
+ if (typeof name !== "string" || !/^[A-Za-z0-9_.-]{1,128}$/.test(name)) return null;
9058
+ const text = /* @__PURE__ */ __name((key) => {
9059
+ const value = staticValue(property(object, key));
9060
+ return typeof value === "string" && value.length <= 2e3 ? value : void 0;
9061
+ }, "text");
9062
+ const annotations = staticValue(property(object, "annotations"));
9063
+ const hints = annotations && typeof annotations === "object" && !Array.isArray(annotations) ? Object.fromEntries(
9064
+ HINTS.filter(
9065
+ (hint) => typeof annotations[hint] === "boolean"
9066
+ ).map((hint) => [hint, annotations[hint]])
9067
+ ) : {};
9068
+ const schemaNode = property(object, "inputSchema");
9069
+ const schema = staticValue(schemaNode);
9070
+ const literal = schema !== NOT_STATIC && schema !== null && typeof schema === "object" && !Array.isArray(schema) && Buffer.byteLength(JSON.stringify(schema)) <= MAX_SCHEMA_BYTES;
9071
+ const title = text("title");
9072
+ const description = text("description");
9073
+ return {
9074
+ name,
9075
+ ...title ? { title } : {},
9076
+ ...description ? { description } : {},
9077
+ ...hints,
9078
+ ...literal ? { inputSchema: schema } : {},
9079
+ inputSchemaSource: literal ? "literal" : schemaNode ? "computed" : "none"
9080
+ };
9081
+ }
9082
+ __name(toolFromObject, "toolFromObject");
9083
+ function findFarmWebMCPTools(code, filename = "module.tsx") {
9084
+ if (!code.includes(WEBMCP_CLIENT)) return [];
9085
+ const lang = LANGS[path15.extname(filename).slice(1)] ?? "tsx";
9086
+ parseAst ?? (parseAst = createRequire2(typeof __filename === "string" ? __filename : import.meta.url)(
9087
+ "rolldown/parseAst"
9088
+ ).parseAst);
9089
+ let program;
9090
+ try {
9091
+ program = parseAst(code, { lang });
9092
+ } catch {
9093
+ return [];
9094
+ }
9095
+ const locals = /* @__PURE__ */ new Map();
9096
+ for (const statement of program.body) {
9097
+ if (statement.type !== "ImportDeclaration" || statement.source.value !== WEBMCP_CLIENT)
9098
+ continue;
9099
+ for (const specifier of statement.specifiers) {
9100
+ const imported = specifier.imported?.name ?? specifier.imported?.value;
9101
+ if (specifier.type === "ImportSpecifier" && DEFINERS.has(imported))
9102
+ locals.set(specifier.local.name, imported);
9103
+ }
9104
+ }
9105
+ if (!locals.size) return [];
9106
+ const found = [];
9107
+ const visit = /* @__PURE__ */ __name((node) => {
9108
+ if (!node || typeof node !== "object") return;
9109
+ if (Array.isArray(node)) return node.forEach(visit);
9110
+ const current = node;
9111
+ if (current.type === "CallExpression" && current.callee.type === "Identifier") {
9112
+ const definer = locals.get(current.callee.name);
9113
+ const [argument] = current.arguments;
9114
+ if (definer && argument) {
9115
+ const objects = definer === "registerWebMCPTools" ? argument.type === "ArrayExpression" ? argument.elements.filter(
9116
+ (element) => element?.type === "ObjectExpression"
9117
+ ) : [] : argument.type === "ObjectExpression" ? [argument] : [];
9118
+ for (const object of objects) {
9119
+ const tool = toolFromObject(object);
9120
+ if (tool) found.push({ start: object.start, tool });
9121
+ }
9122
+ }
9123
+ }
9124
+ for (const [key, value] of Object.entries(current))
9125
+ if (key !== "type" && value && typeof value === "object") visit(value);
9126
+ }, "visit");
9127
+ visit(program.body);
9128
+ return found.sort((a, b) => a.start - b.start).map(({ tool }) => tool);
9129
+ }
9130
+ __name(findFarmWebMCPTools, "findFarmWebMCPTools");
9131
+ var cache = /* @__PURE__ */ new Map();
9132
+ function collectFarmWebMCPTools(root, srcDir = "src") {
9133
+ const base = path15.resolve(root, srcDir);
9134
+ let files;
9135
+ try {
9136
+ files = fg.sync("**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}", {
9137
+ cwd: base,
9138
+ absolute: true,
9139
+ ignore: ["**/node_modules/**", "**/*.d.ts", "**/*.{test,spec}.*", "**/__tests__/**"]
9140
+ });
9141
+ } catch {
9142
+ return [];
9143
+ }
9144
+ const seen = /* @__PURE__ */ new Set();
9145
+ const tools = [];
9146
+ for (const file of files.sort()) {
9147
+ let mtimeMs;
9148
+ try {
9149
+ mtimeMs = fs9.statSync(file).mtimeMs;
9150
+ } catch {
9151
+ continue;
9152
+ }
9153
+ let entry = cache.get(file);
9154
+ if (!entry || entry.mtimeMs !== mtimeMs) {
9155
+ let code = "";
9156
+ try {
9157
+ code = fs9.readFileSync(file, "utf8");
9158
+ } catch {
9159
+ }
9160
+ entry = { mtimeMs, tools: findFarmWebMCPTools(code, file) };
9161
+ cache.set(file, entry);
9162
+ }
9163
+ for (const tool of entry.tools) {
9164
+ if (seen.has(tool.name) || tools.length >= MAX_TOOLS) continue;
9165
+ seen.add(tool.name);
9166
+ tools.push(tool);
9167
+ }
9168
+ }
9169
+ return tools;
9170
+ }
9171
+ __name(collectFarmWebMCPTools, "collectFarmWebMCPTools");
9172
+
8916
9173
  // src/document-layout-client.ts
8917
9174
  var FARM_LAYOUT_ELEMENT_CLIENT_SOURCE = String.raw`
8918
9175
  const farmLayoutComponentKeys = new WeakMap();
@@ -8979,14 +9236,136 @@ function createFarmLayoutElement(Component, pattern, children, params) {
8979
9236
  }
8980
9237
  `;
8981
9238
 
9239
+ // src/dev-preview-guard.ts
9240
+ import { promises as fsp } from "fs";
9241
+ import * as path16 from "path";
9242
+ var FARM_PREVIEW_REQUEST_HEADER = "x-farm-preview";
9243
+ function isFarmPreviewTunnelRequest(headers) {
9244
+ return headers[FARM_PREVIEW_REQUEST_HEADER] !== void 0;
9245
+ }
9246
+ __name(isFarmPreviewTunnelRequest, "isFarmPreviewTunnelRequest");
9247
+ var VITE_DEFAULT_FS_DENY = [
9248
+ ".env",
9249
+ ".env.*",
9250
+ "*.{crt,pem,key,p12,pfx,cer,der}",
9251
+ ".npmrc",
9252
+ ".yarnrc.yml",
9253
+ "**/.git/**"
9254
+ ];
9255
+ function getFarmDevFsDeny(userDeny, options) {
9256
+ const deny = ["**/.farm/**"];
9257
+ const root = path16.resolve(options.root || process.cwd());
9258
+ const distDir = options.distDir ? path16.resolve(root, options.distDir) : void 0;
9259
+ const relativeDistDir = distDir ? path16.relative(root, distDir) : "";
9260
+ if (distDir && relativeDistDir && relativeDistDir !== ".farm" && relativeDistDir !== ".." && !relativeDistDir.startsWith(`..${path16.sep}`) && !/[*?[\]{}()!+@]/.test(distDir)) {
9261
+ deny.push(`${distDir.replace(/\\/g, "/")}/**`);
9262
+ }
9263
+ return userDeny ? deny : [...VITE_DEFAULT_FS_DENY, ...deny];
9264
+ }
9265
+ __name(getFarmDevFsDeny, "getFarmDevFsDeny");
9266
+ var SOURCE_QUERY_FLAGS = ["raw", "inline", "url"];
9267
+ var MODULE_EXTENSION = /\.(?:[cm]?[jt]sx?|vue|svelte|astro|mdx?|css|scss|sass|less|styl|stylus|pcss|postcss|sss)$/i;
9268
+ var ASSET_EXTENSION = /\.(?:apng|bmp|png|jpe?g|jfif|pjpeg|pjp|gif|svg|ico|webp|avif|cur|jxl|mp4|webm|ogg|mp3|wav|flac|aac|opus|mov|m4a|vtt|woff2?|eot|ttf|otf|webmanifest|pdf|txt|wasm)$/i;
9269
+ var INTERNAL_PREFIXES = ["/@vite/", "/@farm/", "/@react-refresh", "/__vite_ping"];
9270
+ var DEVELOPER_ONLY_PREFIXES = ["/__farm/devtools", "/__open-in-editor"];
9271
+ function createFarmDevPreviewGuard(server, options) {
9272
+ return /* @__PURE__ */ __name(async function farmDevPreviewGuard(req, res, next) {
9273
+ if (!isFarmPreviewTunnelRequest(req.headers)) return next();
9274
+ try {
9275
+ if (await isAllowedPreviewRequest(server, options, req)) return next();
9276
+ } catch {
9277
+ }
9278
+ res.statusCode = 403;
9279
+ res.setHeader("Content-Type", "text/plain; charset=utf-8");
9280
+ res.setHeader("Cache-Control", "no-store");
9281
+ res.end("This development file is not available through farm preview.");
9282
+ }, "farmDevPreviewGuard");
9283
+ }
9284
+ __name(createFarmDevPreviewGuard, "createFarmDevPreviewGuard");
9285
+ async function isAllowedPreviewRequest(server, options, req) {
9286
+ const rawUrl = req.url || "/";
9287
+ const queryIndex = rawUrl.indexOf("?");
9288
+ const rawPath = queryIndex === -1 ? rawUrl : rawUrl.slice(0, queryIndex);
9289
+ const query = new URLSearchParams(queryIndex === -1 ? "" : rawUrl.slice(queryIndex + 1));
9290
+ let pathname = decodeURI(rawPath);
9291
+ const base = (server.config.base || "/").replace(/\/$/, "");
9292
+ if (base.startsWith("/") && (pathname === base || pathname.startsWith(`${base}/`))) {
9293
+ pathname = pathname.slice(base.length) || "/";
9294
+ }
9295
+ const url = `${pathname}${queryIndex === -1 ? "" : rawUrl.slice(queryIndex)}`;
9296
+ if (DEVELOPER_ONLY_PREFIXES.some((prefix) => pathname.startsWith(prefix))) return false;
9297
+ if (INTERNAL_PREFIXES.some((prefix) => pathname.startsWith(prefix))) return true;
9298
+ const method = (req.method || "GET").toUpperCase();
9299
+ if (method !== "GET" && method !== "HEAD") return true;
9300
+ const file = await resolveRequestedFile(server, pathname);
9301
+ if (!file) return true;
9302
+ const client = server.environments?.client;
9303
+ const inClientGraph = /* @__PURE__ */ __name(async () => Boolean(await client?.moduleGraph.getModuleByUrl(url)), "inClientGraph");
9304
+ if (SOURCE_QUERY_FLAGS.some((flag) => query.has(flag))) return inClientGraph();
9305
+ if (await inClientGraph()) return true;
9306
+ if (file.split(path16.sep).includes("node_modules")) return true;
9307
+ if (server.config.publicDir && isInside(await realpathOr(server.config.publicDir), file)) {
9308
+ return true;
9309
+ }
9310
+ const isModuleOrAsset = MODULE_EXTENSION.test(file) || ASSET_EXTENSION.test(file) || query.has("import");
9311
+ if (!isModuleOrAsset) return false;
9312
+ for (const source of options.getSourceRoots()) {
9313
+ const sourceRoot = await realpathOr(source.root);
9314
+ const sourceDir = await realpathOr(path16.resolve(source.root, source.srcDir));
9315
+ if (sourceRoot === sourceDir && path16.dirname(file) === sourceDir) continue;
9316
+ if (isInside(sourceDir, file)) return true;
9317
+ }
9318
+ return false;
9319
+ }
9320
+ __name(isAllowedPreviewRequest, "isAllowedPreviewRequest");
9321
+ async function resolveRequestedFile(server, pathname) {
9322
+ let candidate;
9323
+ if (pathname.startsWith("/@fs/")) {
9324
+ candidate = pathname.slice("/@fs".length);
9325
+ if (/^\/[A-Za-z]:/.test(candidate)) candidate = candidate.slice(1);
9326
+ } else {
9327
+ let id = pathname;
9328
+ if (id.startsWith("/@id/")) {
9329
+ id = id.slice("/@id/".length).replace(/^__x00__/, "\0");
9330
+ if (id.startsWith("\0")) return void 0;
9331
+ }
9332
+ const resolved = await server.environments?.client?.pluginContainer.resolveId(id, void 0);
9333
+ const resolvedId = resolved?.id.replace(/[?#].*$/, "");
9334
+ if (resolvedId && path16.isAbsolute(resolvedId)) candidate = resolvedId;
9335
+ else if (resolvedId?.startsWith("\0")) return void 0;
9336
+ else if (id.startsWith("/")) candidate = path16.join(server.config.root, id);
9337
+ }
9338
+ if (!candidate) return void 0;
9339
+ try {
9340
+ const real = await fsp.realpath(candidate);
9341
+ return (await fsp.stat(real)).isFile() ? real : void 0;
9342
+ } catch {
9343
+ return void 0;
9344
+ }
9345
+ }
9346
+ __name(resolveRequestedFile, "resolveRequestedFile");
9347
+ async function realpathOr(directory) {
9348
+ try {
9349
+ return await fsp.realpath(directory);
9350
+ } catch {
9351
+ return path16.resolve(directory);
9352
+ }
9353
+ }
9354
+ __name(realpathOr, "realpathOr");
9355
+ function isInside(directory, file) {
9356
+ const relative4 = path16.relative(directory, file);
9357
+ return relative4 !== "" && relative4 !== ".." && !relative4.startsWith(`..${path16.sep}`) && !path16.isAbsolute(relative4);
9358
+ }
9359
+ __name(isInside, "isInside");
9360
+
8982
9361
  // src/vite.ts
8983
- import * as fs9 from "fs";
8984
- import * as path17 from "path";
9362
+ import * as fs11 from "fs";
9363
+ import * as path20 from "path";
8985
9364
  import { pathToFileURL as pathToFileURL3 } from "url";
8986
9365
 
8987
9366
  // src/dev-static.ts
8988
- import * as fs8 from "fs";
8989
- import * as path14 from "path";
9367
+ import * as fs10 from "fs";
9368
+ import * as path17 from "path";
8990
9369
  function shouldBypassFarmRouterForDottedPath(pathname, routeManager, baseDirs, generatedPaths = []) {
8991
9370
  if (!pathname.includes(".") || pathname.endsWith(".html")) return false;
8992
9371
  const matchesAppRoute = Boolean(
@@ -9033,11 +9412,11 @@ function devServableFileExists(pathname, baseDirs) {
9033
9412
  if (!relativePathname) return false;
9034
9413
  for (const baseDir of baseDirs) {
9035
9414
  if (typeof baseDir !== "string" || baseDir.length === 0) continue;
9036
- const resolvedBase = path14.resolve(baseDir);
9037
- const candidate = path14.resolve(resolvedBase, relativePathname);
9038
- if (!candidate.startsWith(resolvedBase + path14.sep)) continue;
9415
+ const resolvedBase = path17.resolve(baseDir);
9416
+ const candidate = path17.resolve(resolvedBase, relativePathname);
9417
+ if (!candidate.startsWith(resolvedBase + path17.sep)) continue;
9039
9418
  try {
9040
- if (fs8.existsSync(candidate) && fs8.statSync(candidate).isFile()) {
9419
+ if (fs10.existsSync(candidate) && fs10.statSync(candidate).isFile()) {
9041
9420
  return true;
9042
9421
  }
9043
9422
  } catch {
@@ -9146,13 +9525,13 @@ function readProcessEnvKey(node) {
9146
9525
  if (!object || object.type !== "MemberExpression" || object.object?.type !== "Identifier" || object.object.name !== "process" || object.property?.name !== "env") {
9147
9526
  return void 0;
9148
9527
  }
9149
- const property = node.property;
9150
- if (!property) return void 0;
9151
- if (!node.computed && property.type === "Identifier") {
9152
- return property.name;
9528
+ const property2 = node.property;
9529
+ if (!property2) return void 0;
9530
+ if (!node.computed && property2.type === "Identifier") {
9531
+ return property2.name;
9153
9532
  }
9154
- if (node.computed && property.type === "Literal") {
9155
- const value = property.value;
9533
+ if (node.computed && property2.type === "Literal") {
9534
+ const value = property2.value;
9156
9535
  return typeof value === "string" ? value : void 0;
9157
9536
  }
9158
9537
  return void 0;
@@ -9182,7 +9561,7 @@ __name(formatClientBoundaryWarning, "formatClientBoundaryWarning");
9182
9561
 
9183
9562
  // src/image-vite.ts
9184
9563
  import { readFile as readFile3 } from "fs/promises";
9185
- import path15 from "path";
9564
+ import path18 from "path";
9186
9565
  import { imageSize as imageSize2 } from "image-size";
9187
9566
  var FARM_IMAGE_ID_PREFIX = "\0farm:image:";
9188
9567
  var STATIC_IMAGE_RE = /\.(?:avif|gif|jpe?g|png|webp)$/i;
@@ -9250,7 +9629,7 @@ async function createBlurDataURL(bytes) {
9250
9629
  __name(createBlurDataURL, "createBlurDataURL");
9251
9630
 
9252
9631
  // src/server/vite-config.ts
9253
- import path16 from "path";
9632
+ import path19 from "path";
9254
9633
  var FARM_CLIENT_ENTRY_PATTERN = "**/{page,layout,loading,error,not-found,default}.{js,jsx,ts,tsx}";
9255
9634
  var FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE = [
9256
9635
  "react",
@@ -9274,9 +9653,9 @@ function getFarmClientOptimizeDepsInclude(renderer) {
9274
9653
  }
9275
9654
  __name(getFarmClientOptimizeDepsInclude, "getFarmClientOptimizeDepsInclude");
9276
9655
  function createFarmClientOptimizeDepsEntries(projectRoot, appDirectories) {
9277
- const resolvedProjectRoot = path16.resolve(projectRoot);
9656
+ const resolvedProjectRoot = path19.resolve(projectRoot);
9278
9657
  return appDirectories.map((appDirectory) => {
9279
- const relativeAppDirectory = path16.relative(resolvedProjectRoot, path16.resolve(appDirectory)).replace(/\\/g, "/");
9658
+ const relativeAppDirectory = path19.relative(resolvedProjectRoot, path19.resolve(appDirectory)).replace(/\\/g, "/");
9280
9659
  const prefix = relativeAppDirectory || ".";
9281
9660
  return `${prefix}/${FARM_CLIENT_ENTRY_PATTERN}`;
9282
9661
  });
@@ -9300,7 +9679,7 @@ function createFarmClientOptimizeDepsConfig(entries, renderer) {
9300
9679
  __name(createFarmClientOptimizeDepsConfig, "createFarmClientOptimizeDepsConfig");
9301
9680
  function createFarmSourceAlias(projectRoot, srcDir = "src") {
9302
9681
  return {
9303
- "@": path16.resolve(projectRoot, srcDir)
9682
+ "@": path19.resolve(projectRoot, srcDir)
9304
9683
  };
9305
9684
  }
9306
9685
  __name(createFarmSourceAlias, "createFarmSourceAlias");
@@ -9550,7 +9929,7 @@ function loadFarmWorkflowsDevRuntime() {
9550
9929
  }
9551
9930
  __name(loadFarmWorkflowsDevRuntime, "loadFarmWorkflowsDevRuntime");
9552
9931
  function loadFarmDevtoolsSnapshotRuntime() {
9553
- return import("./devtools-BPBCYOU6.mjs");
9932
+ return import("./devtools-RNXCTS4R.mjs");
9554
9933
  }
9555
9934
  __name(loadFarmDevtoolsSnapshotRuntime, "loadFarmDevtoolsSnapshotRuntime");
9556
9935
  function loadFarmDevtoolsUIRuntime() {
@@ -9961,11 +10340,11 @@ function isPotentialProgrammaticRouteSourceFile(normalizedFile, srcDirSlug) {
9961
10340
  }
9962
10341
  __name(isPotentialProgrammaticRouteSourceFile, "isPotentialProgrammaticRouteSourceFile");
9963
10342
  function fileContainsProgrammaticPageRoute(file) {
9964
- if (!fs9.existsSync(file)) {
10343
+ if (!fs11.existsSync(file)) {
9965
10344
  return false;
9966
10345
  }
9967
10346
  try {
9968
- return scanProgrammaticPagePaths(fs9.readFileSync(file, "utf8")).length > 0;
10347
+ return scanProgrammaticPagePaths(fs11.readFileSync(file, "utf8")).length > 0;
9969
10348
  } catch {
9970
10349
  return false;
9971
10350
  }
@@ -9973,7 +10352,7 @@ function fileContainsProgrammaticPageRoute(file) {
9973
10352
  __name(fileContainsProgrammaticPageRoute, "fileContainsProgrammaticPageRoute");
9974
10353
  function rewriteEarlySsrRelativeImports(options) {
9975
10354
  const cleanId = options.id.split("?", 1)[0];
9976
- if (!path17.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
10355
+ if (!path20.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
9977
10356
  return null;
9978
10357
  }
9979
10358
  const replacements = [];
@@ -9993,7 +10372,7 @@ function rewriteEarlySsrRelativeImports(options) {
9993
10372
  const suffixIndex = source.value.search(/[?#]/);
9994
10373
  const sourcePath = suffixIndex === -1 ? source.value : source.value.slice(0, suffixIndex);
9995
10374
  const suffix = suffixIndex === -1 ? "" : source.value.slice(suffixIndex);
9996
- const resolvedPath = path17.resolve(path17.dirname(cleanId), sourcePath);
10375
+ const resolvedPath = path20.resolve(path20.dirname(cleanId), sourcePath);
9997
10376
  replacements.push({
9998
10377
  start: source.start,
9999
10378
  end: source.end,
@@ -10111,8 +10490,8 @@ __name(isFarmModuleAstNode, "isFarmModuleAstNode");
10111
10490
  function isFarmConfigFile(file, root) {
10112
10491
  const normalized = file.replace(/\\/g, "/");
10113
10492
  const rootSlug = root.replace(/\\/g, "/").replace(/\/+$/, "");
10114
- const relative3 = normalized.startsWith(`${rootSlug}/`) ? normalized.slice(rootSlug.length + 1) : normalized;
10115
- return FARM_CONFIG_FILENAMES.has(relative3);
10493
+ const relative4 = normalized.startsWith(`${rootSlug}/`) ? normalized.slice(rootSlug.length + 1) : normalized;
10494
+ return FARM_CONFIG_FILENAMES.has(relative4);
10116
10495
  }
10117
10496
  __name(isFarmConfigFile, "isFarmConfigFile");
10118
10497
  var warnedClientBoundaryIds = /* @__PURE__ */ new Set();
@@ -10189,13 +10568,12 @@ function farmPlugin(options = {}, initialPluginManager) {
10189
10568
  resolve: {
10190
10569
  alias: { ...layerAliases, ...sourceAlias }
10191
10570
  },
10192
- ...layerRoots.length ? {
10193
- server: {
10194
- fs: {
10195
- allow: [path17.resolve(options.root || process.cwd()), ...layerRoots]
10196
- }
10571
+ server: {
10572
+ fs: {
10573
+ ...layerRoots.length ? { allow: [path20.resolve(options.root || process.cwd()), ...layerRoots] } : {},
10574
+ deny: getFarmDevFsDeny(userConfig.server?.fs?.deny, options)
10197
10575
  }
10198
- } : {}
10576
+ }
10199
10577
  };
10200
10578
  },
10201
10579
  async configResolved(config) {
@@ -10212,6 +10590,11 @@ function farmPlugin(options = {}, initialPluginManager) {
10212
10590
  }
10213
10591
  },
10214
10592
  async configureServer(viteServer) {
10593
+ viteServer.middlewares.use(
10594
+ createFarmDevPreviewGuard(viteServer, {
10595
+ getSourceRoots: /* @__PURE__ */ __name(() => getFarmSourceRoots(farmApp?.getConfig() ?? options), "getSourceRoots")
10596
+ })
10597
+ );
10215
10598
  if (typeof fontImports.configureServer === "function") {
10216
10599
  await fontImports.configureServer.call(this, viteServer);
10217
10600
  }
@@ -10233,6 +10616,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10233
10616
  );
10234
10617
  await farmApp.initialize();
10235
10618
  const farmConfig = farmApp.getConfig();
10619
+ let farmAppPackages;
10236
10620
  if (farmConfig.agent?.noindexPreviews) {
10237
10621
  server.middlewares.use((_req, res, next) => {
10238
10622
  if (isFarmPreviewDeploymentEnvironment(process.env)) {
@@ -10262,7 +10646,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10262
10646
  });
10263
10647
  }
10264
10648
  const sourceRoots = getFarmSourceRoots(farmConfig);
10265
- server.watcher.add(sourceRoots.map((source) => path17.join(source.root, source.srcDir)));
10649
+ server.watcher.add(sourceRoots.map((source) => path20.join(source.root, source.srcDir)));
10266
10650
  if (farmConfig.i18n.enabled) {
10267
10651
  server.watcher.add(
10268
10652
  farmConfig.i18n.locales.map(
@@ -10277,7 +10661,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10277
10661
  ...farmDocsDevRuntime?.getFarmDocsRouteTypeEntries(farmConfig.docs) ?? []
10278
10662
  ], "getExtraRouteTypes");
10279
10663
  const appDirSlugs = sourceRoots.map(
10280
- (source) => path17.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
10664
+ (source) => path20.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
10281
10665
  );
10282
10666
  const generateTypeArtifacts = /* @__PURE__ */ __name(async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
10283
10667
  try {
@@ -10318,7 +10702,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10318
10702
  }, "generateTypeArtifacts");
10319
10703
  await generateTypeArtifacts("startup");
10320
10704
  const srcDirSlugs = sourceRoots.map(
10321
- (source) => path17.join(source.root, source.srcDir).replace(/\\/g, "/")
10705
+ (source) => path20.join(source.root, source.srcDir).replace(/\\/g, "/")
10322
10706
  );
10323
10707
  const layerConfigFiles = new Set(
10324
10708
  farmConfig.layers.map((layer) => layer.configFile?.replace(/\\/g, "/")).filter((file) => Boolean(file))
@@ -10457,7 +10841,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10457
10841
  await apiRouteManager.discoverRoutes();
10458
10842
  let discoveredWorkflows = [];
10459
10843
  const hasWorkflowDirectory = workflowConfig.enabled && workflowConfig.dirs.some(
10460
- (dir) => fs9.existsSync(path17.isAbsolute(dir) ? dir : path17.join(farmConfig.root, dir))
10844
+ (dir) => fs11.existsSync(path20.isAbsolute(dir) ? dir : path20.join(farmConfig.root, dir))
10461
10845
  );
10462
10846
  if (hasWorkflowDirectory) {
10463
10847
  const { createFarmWorkflowRequestHandler, discoverFarmWorkflows } = await loadFarmWorkflowsDevRuntime();
@@ -10491,7 +10875,8 @@ function farmPlugin(options = {}, initialPluginManager) {
10491
10875
  server,
10492
10876
  farmConfig.middleware,
10493
10877
  farmConfig.i18n,
10494
- farmConfig.server
10878
+ farmConfig.server,
10879
+ apiServerBasePath
10495
10880
  );
10496
10881
  await middlewareManager.discover();
10497
10882
  if (pm) {
@@ -10671,7 +11056,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
10671
11056
  const farmDocsAPIHandler = farmDocsDevRuntime && !farmDocsDevRuntime.hasFarmDocsRuntimeAdapter(farmConfig.docs) ? farmDocsDevRuntime.createFarmDocsAPIHandler({
10672
11057
  rootDir: farmConfig.root,
10673
11058
  srcDir: farmConfig.srcDir,
10674
- docs: farmConfig.docs
11059
+ docs: farmConfig.docs,
11060
+ diagnostics: true
10675
11061
  }) : null;
10676
11062
  const farmDocsFontAssets = new Map(
10677
11063
  farmDocsFontAssetList.map(({ url, sourcePath }) => [url, sourcePath])
@@ -10739,12 +11125,12 @@ window.__FARM_MANIFEST__ = ${inlineValue({
10739
11125
  }
10740
11126
  }
10741
11127
  const farmDocsFontPath = farmDocsFontAssets.get(requestPathname);
10742
- if ((requestMethod === "GET" || requestMethod === "HEAD") && farmDocsFontPath && fs9.existsSync(farmDocsFontPath)) {
11128
+ if ((requestMethod === "GET" || requestMethod === "HEAD") && farmDocsFontPath && fs11.existsSync(farmDocsFontPath)) {
10743
11129
  res.statusCode = 200;
10744
11130
  res.setHeader("Content-Type", "font/woff2");
10745
11131
  res.setHeader("Cache-Control", "public, max-age=31536000, immutable");
10746
11132
  if (requestMethod === "HEAD") res.end();
10747
- else fs9.createReadStream(farmDocsFontPath).pipe(res);
11133
+ else fs11.createReadStream(farmDocsFontPath).pipe(res);
10748
11134
  return;
10749
11135
  }
10750
11136
  if (requestMethod === "GET" && (requestPathname === FARM_DEVTOOLS_PATH || requestPathname === `${FARM_DEVTOOLS_PATH}.json`)) {
@@ -10846,6 +11232,23 @@ window.__FARM_MANIFEST__ = ${inlineValue({
10846
11232
  const docsHandler = openAPIManager.getDocsRouteHandler(parsedRequestUrl.origin);
10847
11233
  return docsHandler(req, res);
10848
11234
  }
11235
+ if (stripFarmBasePath(requestPathname, farmConfig.basePath) === FARM_APP_MANIFEST_PATH) {
11236
+ farmAppPackages ?? (farmAppPackages = resolveFarmAppPackages(farmConfig.root ?? process.cwd()));
11237
+ const manifest = await createFarmAppManifestResponse(
11238
+ new Request(parsedRequestUrl, { method: requestMethod }),
11239
+ resolveFarmAppManifestInput(farmConfig, {
11240
+ build: "development",
11241
+ packages: farmAppPackages,
11242
+ // Read again on each request; unchanged files come from a cache.
11243
+ webmcpTools: farmConfig.plugins?.some(({ name }) => name === "farm:webmcp") ? collectFarmWebMCPTools(farmConfig.root ?? process.cwd(), farmConfig.srcDir) : []
11244
+ }),
11245
+ { development: true }
11246
+ );
11247
+ if (manifest) {
11248
+ await sendWebResponse(res, manifest);
11249
+ return;
11250
+ }
11251
+ }
10849
11252
  if (options.agent?.apiCatalog && stripFarmBasePath(requestPathname, farmConfig.basePath) === FARM_API_CATALOG_PATH) {
10850
11253
  if (await runAppMiddlewareForContentRoute()) return;
10851
11254
  await sendWebResponse(
@@ -10900,10 +11303,16 @@ window.__FARM_MANIFEST__ = ${inlineValue({
10900
11303
  return null;
10901
11304
  }
10902
11305
  return {
10903
- source: await fs9.promises.readFile(sourcePath, "utf8"),
11306
+ source: await fs11.promises.readFile(sourcePath, "utf8"),
10904
11307
  filePath: sourcePath
10905
11308
  };
10906
- }, "resolveSource")
11309
+ }, "resolveSource"),
11310
+ // The anonymous check goes through this server, so its guards and
11311
+ // middleware see the page's own path, as in production.
11312
+ renderPage: /* @__PURE__ */ __name(async (request2) => fetch(request2, {
11313
+ redirect: "manual",
11314
+ signal: res.destroyed ? AbortSignal.abort() : createFarmNodeRequestAbortSignal(req, res)
11315
+ }), "renderPage")
10907
11316
  });
10908
11317
  if (markdownSourceResponse) {
10909
11318
  if (await runAppMiddlewareForContentRoute()) return;
@@ -11987,7 +12396,7 @@ export const manifest = getManifest();
11987
12396
  const root = currentConfig.root || server?.config.root || process.cwd();
11988
12397
  const cleanId = id.split("?", 1)[0];
11989
12398
  const selectedIsolatedModules = options.isolatedClientBoundaryModules ?? farmApp?.getRouteManager().getIsolatedClientBoundaryModules(root);
11990
- const selectedForIsolatedHydration = selectedIsolatedModules?.has(path17.resolve(cleanId)) === true;
12399
+ const selectedForIsolatedHydration = selectedIsolatedModules?.has(path20.resolve(cleanId)) === true;
11991
12400
  if (isReactRenderer(resolveFarmRenderer(currentConfig.renderer)) && selectedForIsolatedHydration && isIsolatableClientBoundarySource(clientBoundarySource)) {
11992
12401
  isolatedModuleReference = toViteModuleId(cleanId, root);
11993
12402
  const transformedBoundary = transformIsolatedClientBoundaryModule({
@@ -12078,8 +12487,8 @@ if (import.meta.hot) {
12078
12487
  }
12079
12488
  logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
12080
12489
  logger.info("Pre-rendering SSG pages...");
12081
- const outDir = path17.join(server?.config.root || process.cwd(), options.outDir || "dist");
12082
- const clientDir = path17.join(outDir, "client");
12490
+ const outDir = path20.join(server?.config.root || process.cwd(), options.outDir || "dist");
12491
+ const clientDir = path20.join(outDir, "client");
12083
12492
  for (const page of ssgPages) {
12084
12493
  try {
12085
12494
  const staticRequest = new Request(new URL(page.urlPath, "http://farm.static"));
@@ -12131,9 +12540,9 @@ if (import.meta.hot) {
12131
12540
  <script type="module" src="/assets/client.js"></script>
12132
12541
  </body>
12133
12542
  </html>`;
12134
- const outputPath = page.urlPath === "/" ? path17.join(clientDir, "index.html") : path17.join(clientDir, page.urlPath + ".html");
12135
- fs9.mkdirSync(path17.dirname(outputPath), { recursive: true });
12136
- fs9.writeFileSync(outputPath, fullHtml);
12543
+ const outputPath = page.urlPath === "/" ? path20.join(clientDir, "index.html") : path20.join(clientDir, page.urlPath + ".html");
12544
+ fs11.mkdirSync(path20.dirname(outputPath), { recursive: true });
12545
+ fs11.writeFileSync(outputPath, fullHtml);
12137
12546
  const revalidateInfo = page.revalidate ? ` (revalidate: ${page.revalidate}s)` : "";
12138
12547
  logger.success(` \u2713 ${page.urlPath}${revalidateInfo}`);
12139
12548
  });
@@ -12141,8 +12550,8 @@ if (import.meta.hot) {
12141
12550
  logger.error(` \u2717 ${page.urlPath}: ${error}`);
12142
12551
  }
12143
12552
  }
12144
- const manifestPath = path17.join(outDir, "__ssg_manifest.json");
12145
- fs9.writeFileSync(
12553
+ const manifestPath = path20.join(outDir, "__ssg_manifest.json");
12554
+ fs11.writeFileSync(
12146
12555
  manifestPath,
12147
12556
  JSON.stringify(
12148
12557
  ssgPages.map((p) => ({
@@ -12185,9 +12594,9 @@ if (import.meta.hot) {
12185
12594
  server2.ws.send({ type: "full-reload", path: "*" });
12186
12595
  return [];
12187
12596
  }
12188
- const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) => path17.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
12597
+ const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) => path20.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
12189
12598
  if (currentSrcRoot && normalizedFile.startsWith(`${currentSrcRoot}/`) && isProgrammaticRoutesFileName(normalizedFile)) {
12190
- logUpdate("PAGE", `updated ${path17.basename(file)}`);
12599
+ logUpdate("PAGE", `updated ${path20.basename(file)}`);
12191
12600
  for (const mod of modules) {
12192
12601
  server2.moduleGraph.invalidateModule(mod);
12193
12602
  }
@@ -12318,10 +12727,10 @@ function createPageDataMiddlewareRequest(req, target) {
12318
12727
  __name(createPageDataMiddlewareRequest, "createPageDataMiddlewareRequest");
12319
12728
  function resolveDevelopmentRoot(farmRoot, viteRoot) {
12320
12729
  if (!farmRoot) return viteRoot;
12321
- if (path17.resolve(farmRoot) === path17.resolve(viteRoot)) return farmRoot;
12730
+ if (path20.resolve(farmRoot) === path20.resolve(viteRoot)) return farmRoot;
12322
12731
  try {
12323
- if (fs9.realpathSync(farmRoot) === fs9.realpathSync(viteRoot)) {
12324
- return path17.resolve(viteRoot);
12732
+ if (fs11.realpathSync(farmRoot) === fs11.realpathSync(viteRoot)) {
12733
+ return path20.resolve(viteRoot);
12325
12734
  }
12326
12735
  } catch {
12327
12736
  }
@@ -12715,7 +13124,7 @@ ${isolatedHydrationImport}
12715
13124
  import { installChunkErrorRecovery, SPARouter } from '@farm.js/core/client'
12716
13125
  import { createClientPluginManager } from '@farm.js/core/plugin/client'
12717
13126
  import { isFarmRouteActive } from '@farm.js/core/router'
12718
- import { replayFarmQueuedInteraction, scheduleFarmIslandHydration, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from '@farm.js/core/internal/client-runtime'
13127
+ import { isFarmBlockedNavigationURL, replayFarmQueuedInteraction, scheduleFarmIslandHydration, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from '@farm.js/core/internal/client-runtime'
12719
13128
  import { reviveDeferredData } from '@farm.js/core/deferred'
12720
13129
  import {
12721
13130
  createFarmDeploymentMismatchError,
@@ -12886,6 +13295,7 @@ class LegacyManifestSPARouter {
12886
13295
  async navigate(href, options = {}) {
12887
13296
  const { replace = false, scroll = true } = options;
12888
13297
  const url = new URL(href, window.location.origin);
13298
+ if (isFarmBlockedNavigationURL(url)) return;
12889
13299
  const pathname = url.pathname;
12890
13300
  const search = url.search;
12891
13301
  const fullPath = pathname + search;
@@ -13615,6 +14025,12 @@ async function tryHydrateImportedPage(
13615
14025
  return false;
13616
14026
  }
13617
14027
 
14028
+ if (PageComponent.__farmServerProps === true && existingProps?.__farmRoutePropsResolved !== true) {
14029
+ // This route's guard and data run only on the server, and it did not
14030
+ // resolve them (it rendered error or notFound UI): keep its HTML.
14031
+ return false;
14032
+ }
14033
+
13618
14034
  currentPageComponent = PageComponent;
13619
14035
  currentPageProps = await buildRouteComponentProps(
13620
14036
  pageModule,
@@ -14243,7 +14659,7 @@ function generateClientManifest(bundle) {
14243
14659
  __name(generateClientManifest, "generateClientManifest");
14244
14660
  async function defineConfig(config = {}) {
14245
14661
  const tailwindVitePlugin = await loadTailwindVitePlugin();
14246
- const appRoot = path17.resolve(config.root || process.cwd());
14662
+ const appRoot = path20.resolve(config.root || process.cwd());
14247
14663
  if (config.extends?.length) {
14248
14664
  const { config: layeredConfig } = await import("./layers-BRQF5ETU.mjs").then(
14249
14665
  ({ resolveFarmLayers }) => resolveFarmLayers(config, {
@@ -14487,6 +14903,8 @@ export {
14487
14903
  generateFarmClientPluginEntryCode,
14488
14904
  resolveFarmClientCacheAdapterEntry,
14489
14905
  generateClientCachePersistenceCode,
14906
+ resolveFarmAppPackages,
14907
+ collectFarmWebMCPTools,
14490
14908
  FARM_LAYOUT_ELEMENT_CLIENT_SOURCE,
14491
14909
  createFarmClientOptimizeDepsEntries,
14492
14910
  createFarmClientOptimizeDepsConfig,