@farm.js/core 0.1.74 → 0.1.76

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 (476) hide show
  1. package/dist/{agent-mcp-handler-NRIL4JBC.cjs → agent-mcp-handler-73SGWVZT.cjs} +9 -9
  2. package/dist/{agent-mcp-handler-HX4F4VKN.mjs → agent-mcp-handler-PJKZHYSA.mjs} +8 -8
  3. package/dist/{agent-mcp.d-CX8_oOT_.d.ts → agent-mcp.d-Cftp2kFv.d.ts} +24 -2
  4. package/dist/{agent-mcp.d-BEhDfdWc.d.mts → agent-mcp.d-D0FMmqi0.d.mts} +24 -2
  5. package/dist/agent-runtime.cjs +7 -7
  6. package/dist/agent-runtime.d.mts +7 -5
  7. package/dist/agent-runtime.d.ts +7 -5
  8. package/dist/agent-runtime.mjs +6 -6
  9. package/dist/analyzer-KFJGYJS7.cjs +16 -0
  10. package/dist/{analyzer-2K35LIQZ.mjs → analyzer-NLQKPN74.mjs} +2 -2
  11. package/dist/api/client.cjs +4 -4
  12. package/dist/api/client.mjs +3 -3
  13. package/dist/api/client.native.cjs +6 -6
  14. package/dist/api/client.native.mjs +3 -3
  15. package/dist/api/node.cjs +12 -12
  16. package/dist/api/node.d.mts +9 -7
  17. package/dist/api/node.d.ts +9 -7
  18. package/dist/api/node.mjs +11 -11
  19. package/dist/api/route-manager.cjs +20 -20
  20. package/dist/api/route-manager.d.mts +9 -7
  21. package/dist/api/route-manager.d.ts +9 -7
  22. package/dist/api/route-manager.mjs +19 -19
  23. package/dist/api/runtime.cjs +11 -11
  24. package/dist/api/runtime.d.mts +8 -6
  25. package/dist/api/runtime.d.ts +8 -6
  26. package/dist/api/runtime.mjs +10 -10
  27. package/dist/api.cjs +23 -23
  28. package/dist/api.d.mts +10 -8
  29. package/dist/api.d.ts +10 -8
  30. package/dist/api.mjs +22 -22
  31. package/dist/{app-manifest.d-CVEx1CFB.d.ts → app-manifest.d-7PmA_9hm.d.ts} +1 -1
  32. package/dist/{app-manifest.d-BcXt2yCx.d.mts → app-manifest.d-cpOw_sV5.d.mts} +1 -1
  33. package/dist/app-markdown.cjs +7 -7
  34. package/dist/app-markdown.d.mts +8 -6
  35. package/dist/app-markdown.d.ts +8 -6
  36. package/dist/app-markdown.mjs +6 -6
  37. package/dist/{app.d-DowzSmT5.d.mts → app.d-DUZvwnFF.d.mts} +30 -4
  38. package/dist/{app.d-B6i8CSrx.d.ts → app.d-wOkxXre8.d.ts} +30 -4
  39. package/dist/{base-path.d-BJ3SYpB8.d.mts → base-path.d-m7wvRMnG.d.mts} +15 -1
  40. package/dist/{base-path.d-BJ3SYpB8.d.ts → base-path.d-m7wvRMnG.d.ts} +15 -1
  41. package/dist/cache.cjs +2 -2
  42. package/dist/cache.d.mts +14 -1
  43. package/dist/cache.d.ts +14 -1
  44. package/dist/cache.mjs +1 -1
  45. package/dist/{chunk-JYNNIGQO.cjs → chunk-25JGHAGH.cjs} +11 -1
  46. package/dist/{chunk-BFOMCSZ2.mjs → chunk-2GZZVIXY.mjs} +184 -27
  47. package/dist/{chunk-4BS3HSY7.cjs → chunk-2JEXQAIR.cjs} +2 -2
  48. package/dist/{chunk-GWXZS7K5.mjs → chunk-2LKUR5QJ.mjs} +1 -1
  49. package/dist/chunk-2PJVEL56.cjs +90 -0
  50. package/dist/{chunk-4M5ESTJ2.cjs → chunk-2RSVYJT6.cjs} +19 -3
  51. package/dist/{chunk-Q3MVNRAO.cjs → chunk-2WKGQCAV.cjs} +1010 -587
  52. package/dist/{chunk-PG6ZIHKE.cjs → chunk-2YJ4DHTD.cjs} +2 -2
  53. package/dist/{chunk-MGZVDX4R.mjs → chunk-3AJQFVWW.mjs} +3 -3
  54. package/dist/{chunk-DRHHTHA3.mjs → chunk-3GMD2E4Q.mjs} +3 -3
  55. package/dist/{chunk-B4CWYGCG.mjs → chunk-3OYFMOBY.mjs} +1 -1
  56. package/dist/{chunk-S3D6SL2V.cjs → chunk-42EUEYW6.cjs} +17 -12
  57. package/dist/{chunk-D2IAYGYA.mjs → chunk-47R7CX4A.mjs} +6 -6
  58. package/dist/{chunk-YQWRBBAA.mjs → chunk-4PWGLPL6.mjs} +1 -1
  59. package/dist/{chunk-7S7AAK2D.mjs → chunk-4QBFYEDC.mjs} +2 -1
  60. package/dist/{chunk-KMYOKQPP.cjs → chunk-4VLXQ55O.cjs} +27 -22
  61. package/dist/{chunk-XGJVRPYL.cjs → chunk-52LTENRE.cjs} +3 -3
  62. package/dist/{chunk-RQ4UZJPR.cjs → chunk-5AMH6AFA.cjs} +5 -3
  63. package/dist/{chunk-FEQ72ZHD.mjs → chunk-5EEQNZLU.mjs} +6 -6
  64. package/dist/{chunk-AYP2YFVN.mjs → chunk-5KAEGBIL.mjs} +75 -42
  65. package/dist/{chunk-IJFNXP3D.cjs → chunk-5QZT2EQN.cjs} +2 -2
  66. package/dist/{chunk-X2KNHD4B.mjs → chunk-5WFPZG7K.mjs} +8 -8
  67. package/dist/{chunk-TPDKFRQX.cjs → chunk-62DZHPDK.cjs} +16 -11
  68. package/dist/{chunk-DTBRSRTR.cjs → chunk-63EFR2WF.cjs} +6 -5
  69. package/dist/{chunk-2RCCFB2Y.cjs → chunk-6B44ZU5P.cjs} +11 -11
  70. package/dist/{chunk-ZRCGPSUM.cjs → chunk-6D3CJFNU.cjs} +37 -21
  71. package/dist/{chunk-FCBUNILW.mjs → chunk-6MNDFNZW.mjs} +4 -4
  72. package/dist/{chunk-O2A6HE76.cjs → chunk-6ZFGWB75.cjs} +115 -21
  73. package/dist/{chunk-ACAEFEOH.cjs → chunk-7564NP5Z.cjs} +10 -10
  74. package/dist/{chunk-7H45IJWO.mjs → chunk-7DBJ2SWK.mjs} +1 -1
  75. package/dist/chunk-7E4FDO5X.mjs +265 -0
  76. package/dist/{chunk-FPBOAG6N.cjs → chunk-7EOSFIPN.cjs} +3 -3
  77. package/dist/{chunk-DRBXYJZ6.mjs → chunk-7FQFK3OA.mjs} +2 -2
  78. package/dist/{chunk-TUOO6IK3.mjs → chunk-7H2TXT2K.mjs} +11 -1
  79. package/dist/{chunk-A4PWGL46.mjs → chunk-7KDCVSTR.mjs} +4 -4
  80. package/dist/{chunk-GPICBTDV.cjs → chunk-7Q2YWZF7.cjs} +6 -6
  81. package/dist/{chunk-CFG4QERR.cjs → chunk-7Q7UB4TL.cjs} +2 -2
  82. package/dist/{chunk-IP2R2TAE.mjs → chunk-A2VFKOQL.mjs} +1 -1
  83. package/dist/chunk-A3LNXQJJ.cjs +265 -0
  84. package/dist/{chunk-S6O2L47H.mjs → chunk-AG27TI6Q.mjs} +67 -5
  85. package/dist/{chunk-DC2AXGNZ.mjs → chunk-AM2M56SL.mjs} +1 -1
  86. package/dist/{chunk-JRHGJVJH.mjs → chunk-B5QRNCIE.mjs} +1 -1
  87. package/dist/{chunk-FYV6DTAG.cjs → chunk-BBRSPKFI.cjs} +585 -601
  88. package/dist/{chunk-R6Q6VSGU.mjs → chunk-BGUTIQII.mjs} +1 -1
  89. package/dist/{chunk-3OMLZLDE.cjs → chunk-BNCKXPCU.cjs} +44 -0
  90. package/dist/{chunk-BPAXGCKX.mjs → chunk-BRNPLD22.mjs} +30 -17
  91. package/dist/{chunk-35GBGSQZ.cjs → chunk-BYJPBJ4E.cjs} +3 -3
  92. package/dist/{chunk-V6T3UJAH.cjs → chunk-CCQZDOQR.cjs} +17 -17
  93. package/dist/{chunk-JZGL2PIH.mjs → chunk-CDT7CGQT.mjs} +2 -2
  94. package/dist/{chunk-BNXV3PRM.mjs → chunk-CF74ABRI.mjs} +10 -10
  95. package/dist/chunk-CIY74JLV.cjs +134 -0
  96. package/dist/{chunk-JI6N4W2I.mjs → chunk-CKBBKRBO.mjs} +840 -228
  97. package/dist/{chunk-IZ5WOTQP.mjs → chunk-CLM73YYD.mjs} +2 -2
  98. package/dist/{chunk-FGXSWRWA.mjs → chunk-CSAIIMY3.mjs} +1 -1
  99. package/dist/{chunk-EF5AP4CV.cjs → chunk-CYNQPKA4.cjs} +2 -2
  100. package/dist/{chunk-M53MIIXY.mjs → chunk-CZOXZ6WQ.mjs} +1 -1
  101. package/dist/{chunk-ROPMQNCG.mjs → chunk-DASQJ5UD.mjs} +2 -2
  102. package/dist/{chunk-BWFBTTJ5.cjs → chunk-DD22NQFX.cjs} +2 -2
  103. package/dist/{chunk-56HHUSR5.cjs → chunk-DTNWLRRF.cjs} +1308 -696
  104. package/dist/{chunk-AL6E63FZ.mjs → chunk-DUSTJ6A5.mjs} +20 -17
  105. package/dist/{chunk-BUC3FDYC.cjs → chunk-DVW6SKHA.cjs} +2 -2
  106. package/dist/{chunk-EWIEJQP6.cjs → chunk-DZ3AZ7UK.cjs} +52 -52
  107. package/dist/{chunk-6YFC3ZFX.mjs → chunk-DZXD6CYJ.mjs} +1 -1
  108. package/dist/{chunk-BIX46FTI.mjs → chunk-E77ZKNPN.mjs} +10 -2
  109. package/dist/{chunk-Q4G52OSW.mjs → chunk-EMTN5ABC.mjs} +1 -1
  110. package/dist/{chunk-GK2GBIXD.mjs → chunk-ERT6HQAI.mjs} +8 -3
  111. package/dist/{chunk-ZLRWO5GK.mjs → chunk-F35C3TJZ.mjs} +1 -1
  112. package/dist/{chunk-F244KE2D.cjs → chunk-F4ID7BGO.cjs} +33 -30
  113. package/dist/{chunk-C7GJDVN4.mjs → chunk-F7MJWW6A.mjs} +1 -1
  114. package/dist/{chunk-WTTJ2YS2.mjs → chunk-FCAYYLAE.mjs} +18 -2
  115. package/dist/{chunk-PWKAX5MS.cjs → chunk-FDZZ6K3N.cjs} +6 -6
  116. package/dist/{chunk-MHLNWRCJ.cjs → chunk-FE6KYDHC.cjs} +3 -3
  117. package/dist/{chunk-PTLXHRJZ.mjs → chunk-FLMALEY2.mjs} +37 -4
  118. package/dist/{chunk-GRHSQYD4.cjs → chunk-G7B6NU4X.cjs} +11 -11
  119. package/dist/{chunk-E4T7WJJN.mjs → chunk-GAAK3HDZ.mjs} +28 -7
  120. package/dist/{chunk-QMNWKQL4.cjs → chunk-GC5ROI3A.cjs} +4 -4
  121. package/dist/{chunk-JXIYH2NO.cjs → chunk-GCJ4GNMC.cjs} +4 -4
  122. package/dist/{chunk-KNEYWPZV.mjs → chunk-GFXKO4UW.mjs} +42 -10
  123. package/dist/{chunk-GUZC226X.mjs → chunk-GLVDXRG2.mjs} +1 -1
  124. package/dist/{chunk-JZ43UD6S.mjs → chunk-GP5BWTO7.mjs} +13 -13
  125. package/dist/{chunk-OWQV6MLM.cjs → chunk-GYJT2U7J.cjs} +2 -1
  126. package/dist/{chunk-LHFGTR7F.mjs → chunk-H76C5AOU.mjs} +104 -10
  127. package/dist/{chunk-XZPI44Q7.cjs → chunk-H7OFZJCV.cjs} +8 -8
  128. package/dist/{chunk-2TZ3F6TN.cjs → chunk-HFJLMALC.cjs} +25 -25
  129. package/dist/{chunk-NET6PBUH.cjs → chunk-HKGU2X4I.cjs} +2 -2
  130. package/dist/{chunk-CROAFCMW.mjs → chunk-HONTCUK6.mjs} +1 -1
  131. package/dist/{chunk-7PJARAQQ.mjs → chunk-HQ2VAJLW.mjs} +1 -1
  132. package/dist/{chunk-FN5UEC7I.mjs → chunk-IG2JE6WJ.mjs} +1 -1
  133. package/dist/{chunk-MQ4DYVFS.cjs → chunk-IIHZ2BEE.cjs} +3 -3
  134. package/dist/{chunk-FNWL5DMG.cjs → chunk-IXO6O2EL.cjs} +6 -6
  135. package/dist/{chunk-B5WZP3T3.cjs → chunk-IYFBLWXU.cjs} +41 -23
  136. package/dist/{chunk-R4BWNP73.mjs → chunk-JA6RML7C.mjs} +3 -3
  137. package/dist/{chunk-JSUVQ5HG.cjs → chunk-JHZ6HULQ.cjs} +12 -9
  138. package/dist/{chunk-UHAARKF3.mjs → chunk-JL6XHQZF.mjs} +5 -5
  139. package/dist/{chunk-KWUZJZ23.mjs → chunk-JRBWBMP2.mjs} +4 -3
  140. package/dist/{chunk-YH33PZ3K.mjs → chunk-K6DXKHFE.mjs} +1 -1
  141. package/dist/{chunk-AXVRUDMB.cjs → chunk-K6PGK7DC.cjs} +2 -2
  142. package/dist/{chunk-72NTEYCX.mjs → chunk-KHS3T3E5.mjs} +15 -10
  143. package/dist/{chunk-J42QN7OC.cjs → chunk-KQS27YN7.cjs} +6 -6
  144. package/dist/{chunk-KUMKBBYP.mjs → chunk-KUXEII7V.mjs} +1 -1
  145. package/dist/{chunk-CA7DNRHO.cjs → chunk-L6E5BSNU.cjs} +3 -3
  146. package/dist/{chunk-47ZDUDN5.cjs → chunk-L7Y65BQU.cjs} +64 -32
  147. package/dist/{chunk-OSKIG4OP.mjs → chunk-LPXJEZJK.mjs} +30 -14
  148. package/dist/{chunk-CF77L6RL.mjs → chunk-LQBV2Y37.mjs} +4 -4
  149. package/dist/{chunk-HK4VJI27.cjs → chunk-LQWIIBI2.cjs} +11 -1
  150. package/dist/{chunk-YTVSWXEZ.cjs → chunk-ML4TOUZP.cjs} +76 -43
  151. package/dist/{chunk-6JEXH7N6.mjs → chunk-MOS2N377.mjs} +1 -1
  152. package/dist/{chunk-ZD7JUTBY.mjs → chunk-NLATR3T3.mjs} +2 -2
  153. package/dist/{chunk-3BUJIPKE.cjs → chunk-NSNQLBHR.cjs} +2 -2
  154. package/dist/chunk-NUWUEXUD.mjs +55 -0
  155. package/dist/{chunk-WS4SLJW5.mjs → chunk-O225GNEU.mjs} +186 -202
  156. package/dist/{chunk-53EHWHT2.cjs → chunk-O4JYMU5N.cjs} +35 -22
  157. package/dist/{chunk-TNYC3TYP.mjs → chunk-O7JEFGUV.mjs} +2 -2
  158. package/dist/{chunk-62ZRA7XU.mjs → chunk-OCLCA3X3.mjs} +1 -1
  159. package/dist/{chunk-CXQZQK6R.mjs → chunk-OVUU2RCQ.mjs} +2 -2
  160. package/dist/{chunk-65OS2TOT.cjs → chunk-OWO7KDZ3.cjs} +34 -34
  161. package/dist/{chunk-HBLYSWIJ.cjs → chunk-PBJ7MEOV.cjs} +9 -9
  162. package/dist/{chunk-RBRIKT6B.mjs → chunk-PDACTAVX.mjs} +3 -3
  163. package/dist/{chunk-AO5IRA2N.mjs → chunk-PE2LEWXA.mjs} +6 -3
  164. package/dist/{chunk-VZKCGHWC.cjs → chunk-PG7J7XYT.cjs} +6 -6
  165. package/dist/{chunk-MMK4MZUN.mjs → chunk-PKXGFQZS.mjs} +1 -1
  166. package/dist/{chunk-NKETXVKP.mjs → chunk-PL7MCYYD.mjs} +32 -14
  167. package/dist/{chunk-P3EZKU6L.cjs → chunk-PSNYVBWC.cjs} +38 -38
  168. package/dist/chunk-PWHF2C6A.mjs +134 -0
  169. package/dist/{chunk-77SVUQM5.cjs → chunk-PXXG5BID.cjs} +10 -10
  170. package/dist/{chunk-JWHRVBCZ.cjs → chunk-Q2EKSSEG.cjs} +21 -21
  171. package/dist/{chunk-TJVUTGED.mjs → chunk-Q4X3MX4J.mjs} +201 -3
  172. package/dist/{chunk-XXKMAHYE.mjs → chunk-Q7JMHO5U.mjs} +2 -2
  173. package/dist/{chunk-EHJOSIXM.cjs → chunk-QDHR54S6.cjs} +11 -11
  174. package/dist/{chunk-ZOYKJBP5.cjs → chunk-QKW6DLDT.cjs} +2 -2
  175. package/dist/{chunk-NXGQIXR7.cjs → chunk-QP4GYVRR.cjs} +313 -156
  176. package/dist/{chunk-3ODLJRA6.mjs → chunk-QSLGE2ZC.mjs} +1 -1
  177. package/dist/{chunk-ENYBDM4U.cjs → chunk-QTDIOZV6.cjs} +15 -7
  178. package/dist/{chunk-FSODPZRT.cjs → chunk-QUEYL2WM.cjs} +10 -10
  179. package/dist/{chunk-ZDAEHG2O.cjs → chunk-QYOAGT3E.cjs} +3 -3
  180. package/dist/{chunk-VKLV7GF4.mjs → chunk-R5X7FDOG.mjs} +1 -1
  181. package/dist/{chunk-O47W53D3.cjs → chunk-RDADQG5S.cjs} +7 -77
  182. package/dist/chunk-RDSHEHBA.mjs +82 -0
  183. package/dist/{chunk-K3RU5MOR.mjs → chunk-RK4MGL6Q.mjs} +1 -1
  184. package/dist/{chunk-LRB5OVRT.cjs → chunk-RKQOMG2X.cjs} +2 -2
  185. package/dist/chunk-RQRTH57V.cjs +82 -0
  186. package/dist/{chunk-MUITBU5Z.mjs → chunk-S7QEQCVV.mjs} +2 -2
  187. package/dist/{chunk-HKZVC5GP.cjs → chunk-SFSTZ7TB.cjs} +8 -8
  188. package/dist/{chunk-VFPFXMTF.mjs → chunk-SGQXJVFX.mjs} +1 -1
  189. package/dist/{chunk-ZZGANFQH.cjs → chunk-SX535SU5.cjs} +12 -12
  190. package/dist/{chunk-NLBK37HI.cjs → chunk-SXXSQVKK.cjs} +4 -4
  191. package/dist/{chunk-ELJQWUAR.mjs → chunk-SYPEMXW2.mjs} +2 -2
  192. package/dist/{chunk-D4TYE6MY.cjs → chunk-TMVVBK5S.cjs} +2 -2
  193. package/dist/{chunk-BSJMWCWM.cjs → chunk-TZ2YPXLB.cjs} +7 -7
  194. package/dist/{chunk-JMYXO572.cjs → chunk-UBXNTZCY.cjs} +205 -7
  195. package/dist/{chunk-OEL5EPOJ.mjs → chunk-UD6KTSJS.mjs} +6 -76
  196. package/dist/{chunk-2EVESLP3.mjs → chunk-UJIBSFUE.mjs} +4 -4
  197. package/dist/chunk-UNOXV37V.cjs +55 -0
  198. package/dist/{chunk-H2ZJ35NW.mjs → chunk-UOE6ZZZP.mjs} +1 -1
  199. package/dist/{chunk-O6K4G7YA.mjs → chunk-URQW27KO.mjs} +10 -5
  200. package/dist/{chunk-B3XY6FMC.mjs → chunk-VDJ3CLBR.mjs} +3 -3
  201. package/dist/chunk-VDQZV6BX.mjs +17 -0
  202. package/dist/{chunk-2DOI6HLJ.cjs → chunk-VJ6L7TII.cjs} +3 -3
  203. package/dist/{chunk-QL3YZTGZ.cjs → chunk-VJI2LWTL.cjs} +2 -2
  204. package/dist/{chunk-7RKHXF4P.mjs → chunk-WGNGM6MJ.mjs} +2 -2
  205. package/dist/{chunk-DM2YGTRH.cjs → chunk-WILPJVQE.cjs} +23 -23
  206. package/dist/{chunk-4AB62NMW.cjs → chunk-WJDMH3E7.cjs} +4 -4
  207. package/dist/chunk-WKVYF2B5.cjs +17 -0
  208. package/dist/{chunk-737MIVX3.cjs → chunk-WMJQNVKX.cjs} +24 -24
  209. package/dist/{chunk-MKQ27TGW.cjs → chunk-WRWJ7IWT.cjs} +7 -7
  210. package/dist/{chunk-Y4FEQBKY.cjs → chunk-WW62HKA2.cjs} +47 -26
  211. package/dist/{chunk-IG4IQMIW.mjs → chunk-X3HUT4JU.mjs} +1 -1
  212. package/dist/{chunk-XVSBALOY.cjs → chunk-X3Y6JWJG.cjs} +3 -3
  213. package/dist/{chunk-RSL3YFJG.cjs → chunk-XLOORES5.cjs} +1 -1
  214. package/dist/{chunk-LIQJYEQP.cjs → chunk-XRFGOYXG.cjs} +4 -4
  215. package/dist/{chunk-42KMUIWZ.cjs → chunk-XX6ZA2IO.cjs} +3 -3
  216. package/dist/{chunk-6IOZPJ3I.cjs → chunk-Y3DO7BIJ.cjs} +69 -7
  217. package/dist/{chunk-L5JDKFMQ.cjs → chunk-YBXIVQCE.cjs} +4 -4
  218. package/dist/{chunk-YWDRWG4L.mjs → chunk-YHE7HH2I.mjs} +875 -452
  219. package/dist/{chunk-G7S6XG6X.cjs → chunk-YN7G22MP.cjs} +6 -6
  220. package/dist/{chunk-4MU4QCX4.mjs → chunk-YONTMPZ6.mjs} +1 -1
  221. package/dist/{chunk-AU5UPNOD.mjs → chunk-YQXJY7E7.mjs} +3 -3
  222. package/dist/{chunk-VKRMO3EZ.cjs → chunk-YRXPDKMM.cjs} +10 -10
  223. package/dist/{chunk-QDWMCFTH.mjs → chunk-YT2ZMLXK.mjs} +1 -1
  224. package/dist/{chunk-EMRYJG4U.cjs → chunk-YTNE4KGC.cjs} +3 -3
  225. package/dist/{chunk-E7QOEV5Z.cjs → chunk-YUCU6XB4.cjs} +4 -4
  226. package/dist/{chunk-NLRAQXAA.mjs → chunk-YVVY276M.mjs} +1 -1
  227. package/dist/{chunk-MQ5HA7H2.mjs → chunk-Z2FFLTF5.mjs} +3 -3
  228. package/dist/{chunk-JSDV2NUN.mjs → chunk-Z3QXQN4U.mjs} +1 -1
  229. package/dist/{chunk-HRQV5Q3J.mjs → chunk-Z4IRG4RG.mjs} +96 -9
  230. package/dist/{chunk-JOECBGY7.mjs → chunk-ZEWWZJPZ.mjs} +3 -1
  231. package/dist/{chunk-2GQBBOFH.mjs → chunk-ZIAWO6BC.mjs} +11 -1
  232. package/dist/{chunk-WH3PBJS7.cjs → chunk-ZIOFRBIU.cjs} +100 -13
  233. package/dist/{chunk-3OJNNCDL.cjs → chunk-ZNXU4E6A.cjs} +8 -8
  234. package/dist/{chunk-KIRIFO6T.mjs → chunk-ZO6TOLHL.mjs} +44 -0
  235. package/dist/cli-runtime.d-D84CwyPI.d.ts +535 -0
  236. package/dist/cli-runtime.d-OQY2pgwK.d.mts +535 -0
  237. package/dist/client/lifecycle.d.mts +1 -1
  238. package/dist/client/lifecycle.d.ts +1 -1
  239. package/dist/{client-component.d-DYOwmq0c.d.ts → client-component.d-Bf8jZqW7.d.ts} +2 -137
  240. package/dist/{client-component.d-edV76QvU.d.mts → client-component.d-Bh6CfC5z.d.mts} +2 -137
  241. package/dist/{client-plugins.d-BmJYW2FY.d.ts → client-plugins.d-DuujrC8d.d.ts} +27 -6
  242. package/dist/{client-plugins.d-DwvqqGsU.d.mts → client-plugins.d-r3K2oQ6w.d.mts} +27 -6
  243. package/dist/client-plugins.d.mts +7 -5
  244. package/dist/client-plugins.d.ts +7 -5
  245. package/dist/client.cjs +15 -13
  246. package/dist/client.d.mts +12 -10
  247. package/dist/client.d.ts +12 -10
  248. package/dist/client.mjs +14 -12
  249. package/dist/config.d.mts +7 -5
  250. package/dist/config.d.ts +7 -5
  251. package/dist/cron.cjs +4 -4
  252. package/dist/cron.mjs +3 -3
  253. package/dist/desktop.d.mts +8 -6
  254. package/dist/desktop.d.ts +8 -6
  255. package/dist/{devtools-YMDS7PUA.cjs → devtools-3WZIZ7KK.cjs} +20 -20
  256. package/dist/{devtools-WPX62NG2.mjs → devtools-MBZPUH3U.mjs} +18 -18
  257. package/dist/docs.cjs +27 -21
  258. package/dist/docs.d.mts +15 -56
  259. package/dist/docs.d.ts +15 -56
  260. package/dist/docs.mjs +26 -20
  261. package/dist/environment/vite.cjs +6 -6
  262. package/dist/environment/vite.mjs +5 -5
  263. package/dist/handler.d-Bd5lRSvb.d.ts +62 -0
  264. package/dist/handler.d-SRH-AKzf.d.mts +62 -0
  265. package/dist/headers.cjs +3 -3
  266. package/dist/{headers.d-BtNxFc2s.d.mts → headers.d-CHHvyaIG.d.mts} +1 -1
  267. package/dist/{headers.d-BIbQyAxJ.d.ts → headers.d-D-OvGikv.d.ts} +1 -1
  268. package/dist/headers.mjs +2 -2
  269. package/dist/i18n/client.cjs +15 -16
  270. package/dist/i18n/client.mjs +5 -6
  271. package/dist/i18n/index.cjs +4 -4
  272. package/dist/i18n/index.mjs +3 -3
  273. package/dist/i18n/server.cjs +5 -5
  274. package/dist/i18n/server.mjs +4 -4
  275. package/dist/image/server.cjs +5 -4
  276. package/dist/image/server.d.mts +5 -1
  277. package/dist/image/server.d.ts +5 -1
  278. package/dist/image/server.mjs +4 -3
  279. package/dist/image/sharp.cjs +53 -89
  280. package/dist/image/sharp.d.mts +2 -1
  281. package/dist/image/sharp.d.ts +2 -1
  282. package/dist/image/sharp.mjs +50 -86
  283. package/dist/index.cjs +105 -97
  284. package/dist/index.d-BOPsgMlI.d.mts +16 -0
  285. package/dist/index.d-BiUtYJUG.d.ts +16 -0
  286. package/dist/index.d.mts +40 -557
  287. package/dist/index.d.ts +40 -557
  288. package/dist/index.mjs +102 -94
  289. package/dist/integrations/orm.cjs +3 -3
  290. package/dist/integrations/orm.d.mts +6 -4
  291. package/dist/integrations/orm.d.ts +6 -4
  292. package/dist/integrations/orm.mjs +2 -2
  293. package/dist/integrations.cjs +7 -7
  294. package/dist/integrations.d.mts +7 -5
  295. package/dist/integrations.d.ts +7 -5
  296. package/dist/integrations.mjs +6 -6
  297. package/dist/internal/app-markdown-runtime.cjs +6 -6
  298. package/dist/internal/app-markdown-runtime.d.mts +8 -6
  299. package/dist/internal/app-markdown-runtime.d.ts +8 -6
  300. package/dist/internal/app-markdown-runtime.mjs +5 -5
  301. package/dist/internal/build-runtime.cjs +71 -69
  302. package/dist/internal/build-runtime.d.mts +10 -7
  303. package/dist/internal/build-runtime.d.ts +10 -7
  304. package/dist/internal/build-runtime.mjs +70 -68
  305. package/dist/internal/cli-runtime.cjs +40 -35
  306. package/dist/internal/cli-runtime.d.mts +45 -0
  307. package/dist/internal/cli-runtime.d.ts +45 -0
  308. package/dist/internal/cli-runtime.mjs +39 -34
  309. package/dist/internal/client-error-overlay.cjs +4 -4
  310. package/dist/internal/client-error-overlay.mjs +1 -1
  311. package/dist/internal/client-runtime.cjs +23 -2
  312. package/dist/internal/client-runtime.d.mts +36 -13
  313. package/dist/internal/client-runtime.d.ts +36 -13
  314. package/dist/internal/client-runtime.mjs +23 -2
  315. package/dist/internal/compression-runtime.d.mts +7 -5
  316. package/dist/internal/compression-runtime.d.ts +7 -5
  317. package/dist/internal/config-runtime.cjs +20 -20
  318. package/dist/internal/config-runtime.d.mts +9 -7
  319. package/dist/internal/config-runtime.d.ts +9 -7
  320. package/dist/internal/config-runtime.mjs +19 -19
  321. package/dist/internal/form-actions.cjs +6 -6
  322. package/dist/internal/form-actions.mjs +5 -5
  323. package/dist/internal/infra-analytics-runtime.cjs +15 -15
  324. package/dist/internal/infra-analytics-runtime.mjs +13 -13
  325. package/dist/internal/islands-server.cjs +2 -2
  326. package/dist/internal/islands-server.mjs +1 -1
  327. package/dist/internal/metadata-image-runtime.cjs +4 -4
  328. package/dist/internal/metadata-image-runtime.mjs +3 -3
  329. package/dist/internal/native-server-fns.cjs +5 -5
  330. package/dist/internal/native-server-fns.mjs +4 -4
  331. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  332. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  333. package/dist/internal/production-runtime.cjs +65 -42
  334. package/dist/internal/production-runtime.d.mts +86 -17
  335. package/dist/internal/production-runtime.d.ts +86 -17
  336. package/dist/internal/production-runtime.mjs +68 -45
  337. package/dist/internal/react-cache.cjs +3 -3
  338. package/dist/internal/react-cache.mjs +1 -1
  339. package/dist/internal/start-manifest.cjs +54 -0
  340. package/dist/internal/start-manifest.d.mts +45 -0
  341. package/dist/internal/start-manifest.d.ts +45 -0
  342. package/dist/internal/start-manifest.mjs +54 -0
  343. package/dist/internal/vercel-edge-middleware.cjs +8 -8
  344. package/dist/internal/vercel-edge-middleware.mjs +7 -7
  345. package/dist/{lifecycle.d-OtGWAvJT.d.mts → lifecycle.d-VzcXyEyn.d.mts} +1 -1
  346. package/dist/{lifecycle.d-OtGWAvJT.d.ts → lifecycle.d-VzcXyEyn.d.ts} +1 -1
  347. package/dist/manager-R7FV4A56.cjs +18 -0
  348. package/dist/{manager-RHB2P35B.mjs → manager-YO2RHDYU.mjs} +5 -5
  349. package/dist/markdown.cjs +5 -5
  350. package/dist/markdown.d.mts +7 -5
  351. package/dist/markdown.d.ts +7 -5
  352. package/dist/markdown.mjs +4 -4
  353. package/dist/middleware.cjs +14 -14
  354. package/dist/middleware.d.mts +7 -5
  355. package/dist/middleware.d.ts +7 -5
  356. package/dist/middleware.mjs +13 -13
  357. package/dist/{mount.d-C-u7rFkM.d.ts → mount.d-C2yq0Zzz.d.ts} +1 -1
  358. package/dist/{mount.d-6bhpBQQB.d.mts → mount.d-vq1HTq5u.d.mts} +1 -1
  359. package/dist/{native-server-fn-handler-W4FSD76W.cjs → native-server-fn-handler-IWNKQEXK.cjs} +9 -8
  360. package/dist/{native-server-fn-handler-I66X4E5S.mjs → native-server-fn-handler-LII4MDRR.mjs} +8 -7
  361. package/dist/native-tree-D3PW64ZL.cjs +28 -0
  362. package/dist/{native-tree-3X23BT3N.mjs → native-tree-G6ZWS7IR.mjs} +5 -5
  363. package/dist/{navigation-delegate.d-xsG4T1x-.d.ts → navigation-delegate.d-D7xIin3i.d.ts} +1 -1
  364. package/dist/{navigation-delegate.d-nx6gtsY4.d.mts → navigation-delegate.d-DS2Sqm7E.d.mts} +1 -1
  365. package/dist/navigation.cjs +13 -11
  366. package/dist/navigation.d.mts +10 -8
  367. package/dist/navigation.d.ts +10 -8
  368. package/dist/navigation.mjs +12 -10
  369. package/dist/{nitro-SSFTPZMW.cjs → nitro-HKMVYIXY.cjs} +13 -13
  370. package/dist/{nitro-XTQ2HKDL.mjs → nitro-RHLKLYXH.mjs} +8 -8
  371. package/dist/{plugin-QZT747YW.mjs → plugin-6CHZBFJD.mjs} +2 -2
  372. package/dist/{plugin-5PIQQVRP.cjs → plugin-YXPIS3XX.cjs} +3 -3
  373. package/dist/plugin.cjs +64 -62
  374. package/dist/plugin.d.mts +11 -8
  375. package/dist/plugin.d.ts +11 -8
  376. package/dist/plugin.mjs +63 -61
  377. package/dist/query/client.cjs +20 -9
  378. package/dist/query/client.mjs +16 -5
  379. package/dist/{render-plan.d-gW0fwKz2.d.ts → render-plan.d-BCq0nfdw.d.ts} +1 -1
  380. package/dist/{render-plan.d-B5y3h97B.d.mts → render-plan.d-X6KqerAM.d.mts} +1 -1
  381. package/dist/renderer/react/server.cjs +9 -1
  382. package/dist/renderer/react/server.d.mts +9 -1
  383. package/dist/renderer/react/server.d.ts +9 -1
  384. package/dist/renderer/react/server.mjs +8 -0
  385. package/dist/renderer-client.cjs +25 -26
  386. package/dist/renderer-client.d.mts +10 -8
  387. package/dist/renderer-client.d.ts +10 -8
  388. package/dist/renderer-client.mjs +15 -16
  389. package/dist/request.cjs +2 -2
  390. package/dist/{request.d-B0ugAadD.d.ts → request.d-Be9rWboC.d.mts} +7 -2
  391. package/dist/{request.d-DLq33nYo.d.mts → request.d-CPdq2_kC.d.ts} +7 -2
  392. package/dist/request.d.mts +8 -6
  393. package/dist/request.d.ts +8 -6
  394. package/dist/request.mjs +1 -1
  395. package/dist/{route-rendering.d-DSeIV7yV.d.mts → route-rendering.d-CIPli7Ve.d.mts} +1 -1
  396. package/dist/{route-rendering.d-ytaqDQD6.d.ts → route-rendering.d-CKB5GhQr.d.ts} +1 -1
  397. package/dist/router.cjs +4 -4
  398. package/dist/{router.d-BaEAEGPg.d.ts → router.d-CvrbOXzF.d.ts} +1 -1
  399. package/dist/{router.d-Chd5cpe3.d.mts → router.d-VxTgLGxN.d.mts} +1 -1
  400. package/dist/router.mjs +3 -3
  401. package/dist/routes.cjs +6 -6
  402. package/dist/routes.d.mts +7 -5
  403. package/dist/routes.d.ts +7 -5
  404. package/dist/routes.mjs +5 -5
  405. package/dist/{rsc-pipeline-DPMYONEV.mjs → rsc-pipeline-FPE4OL57.mjs} +22 -22
  406. package/dist/{rsc-pipeline-XIUUMMG5.cjs → rsc-pipeline-TPHK74VE.cjs} +23 -23
  407. package/dist/{runtime-XIUJZTZ3.mjs → runtime-45BD33OJ.mjs} +27 -27
  408. package/dist/{runtime-WD77S3C5.cjs → runtime-UBG657UC.cjs} +38 -38
  409. package/dist/{runtime.d-DpCs0eAO.d.mts → runtime.d-Cn1jiDNI.d.mts} +1 -1
  410. package/dist/{runtime.d-h2USyQsz.d.ts → runtime.d-Ps54JWpo.d.ts} +1 -1
  411. package/dist/safe-fetch.cjs +15 -0
  412. package/dist/safe-fetch.d.mts +61 -0
  413. package/dist/safe-fetch.d.ts +61 -0
  414. package/dist/safe-fetch.mjs +15 -0
  415. package/dist/{schema-dev-notice-C2JINRZI.mjs → schema-dev-notice-CA55V57L.mjs} +2 -2
  416. package/dist/{schema-dev-notice-X7GG7QVB.cjs → schema-dev-notice-RWA2UTR6.cjs} +3 -3
  417. package/dist/{schema.d-Dny9pnrm.d.mts → schema.d-BM-uVGpx.d.mts} +1 -1
  418. package/dist/{schema.d-Dny9pnrm.d.ts → schema.d-BM-uVGpx.d.ts} +1 -1
  419. package/dist/schema.d.mts +1 -1
  420. package/dist/schema.d.ts +1 -1
  421. package/dist/server-action-security.cjs +5 -5
  422. package/dist/server-action-security.mjs +4 -4
  423. package/dist/{index.d-CQ_wUzOV.d.ts → server-components-status.d-Dhtbs5lC.d.ts} +2 -15
  424. package/dist/{index.d-CQdDRXd1.d.mts → server-components-status.d-DnmipSb3.d.mts} +2 -15
  425. package/dist/server-fn.cjs +8 -7
  426. package/dist/server-fn.mjs +7 -6
  427. package/dist/server-plugins.cjs +7 -7
  428. package/dist/server-plugins.d.mts +9 -7
  429. package/dist/server-plugins.d.ts +9 -7
  430. package/dist/server-plugins.mjs +6 -6
  431. package/dist/server-query.cjs +9 -8
  432. package/dist/server-query.mjs +8 -7
  433. package/dist/server.cjs +107 -98
  434. package/dist/server.d.mts +20 -17
  435. package/dist/server.d.ts +20 -17
  436. package/dist/server.mjs +78 -69
  437. package/dist/session-ACVUJ5XV.cjs +23 -0
  438. package/dist/{session-QZXZOPR2.mjs → session-ASQTJNBK.mjs} +2 -2
  439. package/dist/{spa-router.d-DCQVtEaE.d.mts → spa-router.d-DXm5J9rM.d.mts} +4 -3
  440. package/dist/{spa-router.d-DpdJHs1q.d.ts → spa-router.d-cppVufl2.d.ts} +4 -3
  441. package/dist/ssg.d-CI5OFl8H.d.ts +138 -0
  442. package/dist/ssg.d-Duzy1wQc.d.mts +138 -0
  443. package/dist/storage.cjs +4 -2
  444. package/dist/storage.d.mts +14 -4
  445. package/dist/storage.d.ts +14 -4
  446. package/dist/storage.mjs +3 -1
  447. package/dist/testing.cjs +31 -31
  448. package/dist/testing.d.mts +7 -5
  449. package/dist/testing.d.ts +7 -5
  450. package/dist/testing.mjs +23 -23
  451. package/dist/theme/server.cjs +3 -3
  452. package/dist/theme/server.mjs +2 -2
  453. package/dist/{types.d-BnIqOn9w.d.ts → types.d-D5cY6XjK.d.mts} +43 -2
  454. package/dist/{types.d-BnIqOn9w.d.mts → types.d-D5cY6XjK.d.ts} +43 -2
  455. package/dist/{utils.d-DKDZtAY5.d.mts → utils.d-CNI-I8ZV.d.mts} +1 -1
  456. package/dist/{utils.d-DmicwMvS.d.ts → utils.d-D3dfy8zh.d.ts} +1 -1
  457. package/dist/version.cjs +2 -2
  458. package/dist/version.mjs +1 -1
  459. package/dist/vite.cjs +64 -62
  460. package/dist/vite.d.mts +17 -9
  461. package/dist/vite.d.ts +17 -9
  462. package/dist/vite.mjs +63 -61
  463. package/dist/workflows.cjs +7 -7
  464. package/dist/workflows.mjs +6 -6
  465. package/package.json +27 -3
  466. package/dist/analyzer-6EOYURMV.cjs +0 -16
  467. package/dist/chunk-D4XGKF67.cjs +0 -127
  468. package/dist/chunk-MFQGU5CC.mjs +0 -127
  469. package/dist/chunk-NCIAP562.mjs +0 -27
  470. package/dist/chunk-QQ44FYRO.cjs +0 -27
  471. package/dist/chunk-RI3EVPKD.cjs +0 -57
  472. package/dist/manager-S77ZARTC.cjs +0 -18
  473. package/dist/native-tree-TAPKR7QJ.cjs +0 -28
  474. package/dist/session-2Q72D4QV.cjs +0 -23
  475. /package/dist/{chunk-PMU4U2W2.cjs → chunk-22T75EML.cjs} +0 -0
  476. /package/dist/{chunk-Z5ZZAGIH.mjs → chunk-LSHUCNIF.mjs} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  resolveFarmAppClientEntry,
3
3
  resolveFarmClientPlugins
4
- } from "./chunk-BIX46FTI.mjs";
4
+ } from "./chunk-E77ZKNPN.mjs";
5
5
  import {
6
6
  resolveFarmPlatform
7
7
  } from "./chunk-SMUW7UST.mjs";
@@ -9,15 +9,13 @@ import {
9
9
  collectSSGPages,
10
10
  matchSSGPage,
11
11
  resolveRouteRenderingConfigFromFile
12
- } from "./chunk-CF77L6RL.mjs";
13
- import {
14
- createFarmMetadataImageResponse
15
- } from "./chunk-CROAFCMW.mjs";
12
+ } from "./chunk-LQBV2Y37.mjs";
16
13
  import {
17
14
  appendFarmHead,
18
15
  classifyFarmDocumentPrefix,
19
16
  composeFarmFullDocument,
20
17
  createDefaultErrorMarkup,
18
+ createFarmDocsLayoutTree,
21
19
  createFarmMetadataRouteResponse,
22
20
  createFarmRouteRenderPlan,
23
21
  createFarmStreamedDocumentTransform,
@@ -26,6 +24,7 @@ import {
26
24
  createLateRedirectRecovery,
27
25
  createRouteDirectoryPattern,
28
26
  extractFarmFullDocument,
27
+ farmDocsLayoutsWrapPage,
29
28
  farmPathGuardCoversPage,
30
29
  formatRouteSegment,
31
30
  getDefaultErrorStatusText,
@@ -34,18 +33,22 @@ import {
34
33
  getRouteGroupScope,
35
34
  getSharedLayoutPrefixLength,
36
35
  isInRouteGroupScope,
36
+ markFarmDocumentLayouts,
37
37
  openFarmStreamedDocument,
38
38
  parseFarmLayoutChainHeader,
39
+ placeFarmDocsLayoutRoot,
39
40
  removeFarmDocumentTitles,
40
41
  renderFarmLocaleAlternateLinks,
41
42
  resolveDefaultErrorStatus,
43
+ resolveFarmDocsLayoutIslandStrategy,
42
44
  routeBoundaryCoversDirectory,
43
45
  stripRouteGroups,
44
- takeFarmHoistedHead
45
- } from "./chunk-LHFGTR7F.mjs";
46
+ takeFarmHoistedHead,
47
+ takeFarmNavigationOutlet
48
+ } from "./chunk-H76C5AOU.mjs";
46
49
  import {
47
50
  listFarmMCPLlmsTxtLinks
48
- } from "./chunk-FEQ72ZHD.mjs";
51
+ } from "./chunk-5EEQNZLU.mjs";
49
52
  import {
50
53
  FARM_DEFAULT_MCP_PATH,
51
54
  collectFarmDefaultMCPPages,
@@ -53,16 +56,19 @@ import {
53
56
  farmConfigMountsMCP,
54
57
  isFarmDefaultMCPPathname,
55
58
  resolveFarmDefaultMCPServer
56
- } from "./chunk-R4BWNP73.mjs";
59
+ } from "./chunk-JA6RML7C.mjs";
60
+ import {
61
+ createFarmMetadataImageResponse
62
+ } from "./chunk-HONTCUK6.mjs";
57
63
  import {
58
64
  getFarmFormState,
59
65
  handleFarmFormActionRequest,
60
66
  renderFarmFormStateScript
61
- } from "./chunk-DRBXYJZ6.mjs";
67
+ } from "./chunk-7FQFK3OA.mjs";
62
68
  import {
63
69
  installFarmIslandValues,
64
70
  uninstallFarmIslandValues
65
- } from "./chunk-A4PWGL46.mjs";
71
+ } from "./chunk-7KDCVSTR.mjs";
66
72
  import {
67
73
  FarmSourceSnapshotStore,
68
74
  collectFarmRenderedClientModules,
@@ -77,23 +83,26 @@ import {
77
83
  getFarmSourceStamp,
78
84
  getIslandStrategyExport,
79
85
  isFarmClientModulePlanUnchanged,
86
+ memoizeInFarmSourceSnapshot,
80
87
  mergeProgrammaticClientRoutes,
88
+ noteFarmSourceRead,
81
89
  resolveFarmIsolatedClientHydrationMode,
82
90
  resolveImportedModule,
91
+ resolveModuleSourcePath,
83
92
  resolveProgrammaticClientRoutes,
84
93
  runWithLatestPackageClientBoundaryCache,
85
94
  runWithPackageClientBoundaryCacheFile,
86
95
  traceFarmSourceReads,
87
96
  usesFarmServerTree,
88
97
  withFarmSourceSnapshot
89
- } from "./chunk-BFOMCSZ2.mjs";
98
+ } from "./chunk-2GZZVIXY.mjs";
90
99
  import {
91
100
  FARM_ISLAND_REPLAYABLE_SELECTOR
92
101
  } from "./chunk-S32PDOLO.mjs";
93
102
  import {
94
103
  _setDefaultFarmThemeConfig,
95
104
  getTheme
96
- } from "./chunk-JOECBGY7.mjs";
105
+ } from "./chunk-ZEWWZJPZ.mjs";
97
106
  import {
98
107
  isSecretDocsConfigKey
99
108
  } from "./chunk-EJCVG25Z.mjs";
@@ -103,7 +112,7 @@ import {
103
112
  } from "./chunk-TPA2PV5J.mjs";
104
113
  import {
105
114
  normalizeRouteRules
106
- } from "./chunk-NLRAQXAA.mjs";
115
+ } from "./chunk-YVVY276M.mjs";
107
116
  import {
108
117
  resolveFarmDevtoolsConfig
109
118
  } from "./chunk-CU5SYTJG.mjs";
@@ -113,7 +122,7 @@ import {
113
122
  resolveFarmAgentCrawlers,
114
123
  resolveFarmAgentSitemap,
115
124
  resolveFarmPerformanceConfig
116
- } from "./chunk-AL6E63FZ.mjs";
125
+ } from "./chunk-DUSTJ6A5.mjs";
117
126
  import {
118
127
  collectFarmLlmsTxtPages,
119
128
  createFarmDefaultLlmsTxt,
@@ -123,7 +132,7 @@ import {
123
132
  renderFarmLlmsFullTxt,
124
133
  resolveFarmAgentOrigin,
125
134
  resolveFarmLlmsTxtConfig
126
- } from "./chunk-MUITBU5Z.mjs";
135
+ } from "./chunk-S7QEQCVV.mjs";
127
136
  import {
128
137
  createFarmCspNonce,
129
138
  createFarmCspNonceRewriter,
@@ -157,17 +166,17 @@ import {
157
166
  } from "./chunk-AOIUYHPH.mjs";
158
167
  import {
159
168
  resolveCronConfig
160
- } from "./chunk-FGXSWRWA.mjs";
169
+ } from "./chunk-CSAIIMY3.mjs";
161
170
  import {
162
171
  resolveServerActionsConfig
163
- } from "./chunk-ZD7JUTBY.mjs";
172
+ } from "./chunk-NLATR3T3.mjs";
164
173
  import {
165
174
  createFarmMarkdownRouteModuleFromFile,
166
175
  loadFarmMdxComponents
167
- } from "./chunk-KUMKBBYP.mjs";
176
+ } from "./chunk-KUXEII7V.mjs";
168
177
  import {
169
178
  isFarmMarkdownPageFile
170
- } from "./chunk-R6Q6VSGU.mjs";
179
+ } from "./chunk-BGUTIQII.mjs";
171
180
  import {
172
181
  resolveFarmMdxComponentsModulePath,
173
182
  resolveMdxConfig
@@ -180,10 +189,10 @@ import {
180
189
  farmRequestWantsMarkdown,
181
190
  getFarmMarkdownAlternatePath,
182
191
  resolveMarkdownConfig
183
- } from "./chunk-VKLV7GF4.mjs";
192
+ } from "./chunk-R5X7FDOG.mjs";
184
193
  import {
185
194
  resolveWorkflowsConfig
186
- } from "./chunk-MGZVDX4R.mjs";
195
+ } from "./chunk-3AJQFVWW.mjs";
187
196
  import {
188
197
  resolveFarmThemeConfig
189
198
  } from "./chunk-YWPNIYUP.mjs";
@@ -191,10 +200,10 @@ import {
191
200
  getIntegrationProviders,
192
201
  getRegisteredIntegrationAPIManifest,
193
202
  isFarmIntegrationProviderComponentReference
194
- } from "./chunk-FCBUNILW.mjs";
203
+ } from "./chunk-6MNDFNZW.mjs";
195
204
  import {
196
205
  initStorage
197
- } from "./chunk-TJVUTGED.mjs";
206
+ } from "./chunk-Q4X3MX4J.mjs";
198
207
  import {
199
208
  resolveFarmRouteContext,
200
209
  withFarmRouteContext
@@ -202,7 +211,7 @@ import {
202
211
  import {
203
212
  createRouteSlotContainerId,
204
213
  parseRouteSlotFile
205
- } from "./chunk-K3RU5MOR.mjs";
214
+ } from "./chunk-RK4MGL6Q.mjs";
206
215
  import {
207
216
  _clearCurrentMiddlewareContext,
208
217
  _clearCurrentMiddlewareData,
@@ -212,13 +221,13 @@ import {
212
221
  import {
213
222
  findProgrammaticRouteFiles,
214
223
  loadProgrammaticRouteManifests
215
- } from "./chunk-H2ZJ35NW.mjs";
224
+ } from "./chunk-UOE6ZZZP.mjs";
216
225
  import {
217
226
  _runWithFarmI18nRequest,
218
227
  _setDefaultFarmI18nRuntime,
219
228
  createFarmI18nRuntime,
220
229
  getFarmI18nClientSnapshot
221
- } from "./chunk-TNYC3TYP.mjs";
230
+ } from "./chunk-O7JEFGUV.mjs";
222
231
  import {
223
232
  formatOptionalPeerInstallHint,
224
233
  isOptionalPeerInstalled
@@ -229,7 +238,7 @@ import {
229
238
  normalizeProgrammaticRoutePath,
230
239
  parseProgrammaticRoutePath,
231
240
  trackProgrammaticRouteSources
232
- } from "./chunk-6YFC3ZFX.mjs";
241
+ } from "./chunk-DZXD6CYJ.mjs";
233
242
  import {
234
243
  getFarmRouteRuntimeConfig,
235
244
  mergeFarmRouteRuntimeConfigs,
@@ -241,7 +250,7 @@ import {
241
250
  configureFarmCache,
242
251
  getFarmDataCache,
243
252
  normalizeRevalidatePath
244
- } from "./chunk-KIRIFO6T.mjs";
253
+ } from "./chunk-ZO6TOLHL.mjs";
245
254
  import {
246
255
  sendWebResponse
247
256
  } from "./chunk-O5QUJEWT.mjs";
@@ -250,7 +259,7 @@ import {
250
259
  } from "./chunk-VHIXGZYH.mjs";
251
260
  import {
252
261
  loadFarmDevModule
253
- } from "./chunk-TUOO6IK3.mjs";
262
+ } from "./chunk-7H2TXT2K.mjs";
254
263
  import {
255
264
  resolveFarmI18nConfig
256
265
  } from "./chunk-VJSXPN3W.mjs";
@@ -267,7 +276,7 @@ import {
267
276
  splitRoutePath,
268
277
  toRootRelativeUrlPath,
269
278
  toViteModuleId
270
- } from "./chunk-JSDV2NUN.mjs";
279
+ } from "./chunk-Z3QXQN4U.mjs";
271
280
  import {
272
281
  resolveFarmAPIServerBasePath
273
282
  } from "./chunk-2I6PUKWJ.mjs";
@@ -275,7 +284,7 @@ import {
275
284
  createFarmNodeRequestAbortSignal,
276
285
  matchesFarmIfNoneMatch,
277
286
  resolveFarmServerConfig
278
- } from "./chunk-QDWMCFTH.mjs";
287
+ } from "./chunk-YT2ZMLXK.mjs";
279
288
  import {
280
289
  getRequestContextSnapshot
281
290
  } from "./chunk-D2LCAV6L.mjs";
@@ -289,14 +298,13 @@ import {
289
298
  } from "./chunk-2DA7CLY7.mjs";
290
299
  import {
291
300
  FARM_VERSION
292
- } from "./chunk-IG4IQMIW.mjs";
301
+ } from "./chunk-X3HUT4JU.mjs";
302
+ import {
303
+ _setFarmSearchPreserveRoutes
304
+ } from "./chunk-VDQZV6BX.mjs";
293
305
  import {
294
306
  normalizeFarmAPIConfig
295
307
  } from "./chunk-W6QLRQ3V.mjs";
296
- import {
297
- createFarmLocaleCookie,
298
- getFarmLocaleVaryHeaders
299
- } from "./chunk-2EVESLP3.mjs";
300
308
  import {
301
309
  getFarmPageDataRedirect
302
310
  } from "./chunk-SD6JGJOM.mjs";
@@ -308,7 +316,7 @@ import {
308
316
  renderMetadataHead,
309
317
  renderViewportHead,
310
318
  resolveFarmNotFoundMetadata
311
- } from "./chunk-S6O2L47H.mjs";
319
+ } from "./chunk-AG27TI6Q.mjs";
312
320
  import {
313
321
  prepareDeferredData,
314
322
  snapshotDeferredData
@@ -320,6 +328,10 @@ import {
320
328
  getFarmDeploymentMismatch,
321
329
  withoutFarmDeploymentCookie
322
330
  } from "./chunk-IWJONXPF.mjs";
331
+ import {
332
+ createFarmLocaleCookie,
333
+ getFarmLocaleVaryHeaders
334
+ } from "./chunk-UJIBSFUE.mjs";
323
335
  import {
324
336
  resolveFarmTrailingSlashRedirect,
325
337
  setFarmTrailingSlashPreference
@@ -332,15 +344,16 @@ import {
332
344
  } from "./chunk-XQ4DPO4G.mjs";
333
345
  import {
334
346
  encodeConfigRouteSegment
335
- } from "./chunk-JZGL2PIH.mjs";
347
+ } from "./chunk-CDT7CGQT.mjs";
336
348
  import {
349
+ _getRequestCookieReadCount,
337
350
  _getRequestReadCount,
338
351
  _runWithCurrentRequest,
339
352
  _runWithFarmCspNonce,
340
353
  createWebRequestFromFarmRequest,
341
354
  getCurrentRequestOrNull,
342
355
  resolveFarmRequestURL
343
- } from "./chunk-WTTJ2YS2.mjs";
356
+ } from "./chunk-FCAYYLAE.mjs";
344
357
  import {
345
358
  _peekCurrentRequest,
346
359
  _resolveCurrentCspNonce
@@ -355,7 +368,7 @@ import {
355
368
  localizeFarmPathname,
356
369
  resolveFarmLocalePath,
357
370
  stripFarmLocaleFromPathname
358
- } from "./chunk-7S7AAK2D.mjs";
371
+ } from "./chunk-4QBFYEDC.mjs";
359
372
  import {
360
373
  applyFarmBasePath,
361
374
  normalizeFarmConfigBasePath,
@@ -367,7 +380,7 @@ import {
367
380
  assertUniqueRouteParameters,
368
381
  compareRouteSpecificity,
369
382
  getRoutePatternShape
370
- } from "./chunk-AYP2YFVN.mjs";
383
+ } from "./chunk-5KAEGBIL.mjs";
371
384
 
372
385
  // src/static-metadata-image.ts
373
386
  import { createHash } from "crypto";
@@ -435,7 +448,7 @@ async function readAltText(filePath) {
435
448
  }
436
449
 
437
450
  // src/routing/route-manager.ts
438
- import { realpathSync } from "fs";
451
+ import fs from "fs";
439
452
  import path2 from "path";
440
453
  function getRouteEntryDirectory(entry) {
441
454
  return entry.directory ?? entry.pattern;
@@ -455,6 +468,19 @@ function compareRouteEntries(left, right) {
455
468
  }
456
469
  var PLAN_SOURCE = /\.(?:[cm]?[jt]sx?|vue|svelte)$/;
457
470
  var NODE_MODULES_SEGMENT = `${path2.sep}node_modules${path2.sep}`;
471
+ function getInstalledPackageDirectory(file, start) {
472
+ let end = file.indexOf(path2.sep, start);
473
+ if (end !== -1 && file[start] === "@") end = file.indexOf(path2.sep, end + 1);
474
+ return end === -1 ? file : file.slice(0, end);
475
+ }
476
+ function realPathOutsideNodeModules(target) {
477
+ try {
478
+ const real = fs.realpathSync(target);
479
+ return real.includes(NODE_MODULES_SEGMENT) ? null : real;
480
+ } catch {
481
+ return null;
482
+ }
483
+ }
458
484
  var RouteManager = class _RouteManager {
459
485
  constructor(config, viteServer) {
460
486
  this.routes = /* @__PURE__ */ new Map();
@@ -482,6 +508,8 @@ var RouteManager = class _RouteManager {
482
508
  this.planStamps = /* @__PURE__ */ new Map();
483
509
  this.sourceChangeTracking = false;
484
510
  this.linkedSources = /* @__PURE__ */ new Map();
511
+ // Whether each package directory under `node_modules` a plan read from links to a workspace.
512
+ this.linkedPackages = /* @__PURE__ */ new Map();
485
513
  // Source files edited since the last plan; null when the next plan must recompute every module.
486
514
  this.editedSources = null;
487
515
  this.config = config;
@@ -605,6 +633,30 @@ var RouteManager = class _RouteManager {
605
633
  getRoutes() {
606
634
  return new Map(this.routes);
607
635
  }
636
+ /**
637
+ * The pages whose programmatic definition declares `search.preserve`, for Farm links to carry
638
+ * those params from the current URL. Read from the evaluated routes files, without planning.
639
+ */
640
+ getSearchPreserveRoutes() {
641
+ const routes = [];
642
+ for (const entry of this.routes.values()) {
643
+ const preserve = getProgrammaticRouteSearchClientOptions(
644
+ this.programmaticPages.get(entry.modulePath)?.search
645
+ )?.preserve;
646
+ if (!preserve?.length) continue;
647
+ routes.push({
648
+ pattern: entry.pattern,
649
+ segments: entry.route.segments.map((seg) => ({
650
+ segment: seg.segment,
651
+ isDynamic: seg.isDynamic,
652
+ isCatchAll: seg.isCatchAll,
653
+ isOptional: seg.isOptional
654
+ })),
655
+ search: { preserve: [...preserve] }
656
+ });
657
+ }
658
+ return routes;
659
+ }
608
660
  /**
609
661
  * Get all registered layouts
610
662
  */
@@ -852,6 +904,7 @@ var RouteManager = class _RouteManager {
852
904
  this.editedSources = null;
853
905
  this.sourceSnapshot?.clear();
854
906
  this.linkedSources.clear();
907
+ this.linkedPackages.clear();
855
908
  }
856
909
  /**
857
910
  * @internal Whether an edit to `file` leaves the current plan as it is: a client module the
@@ -915,17 +968,22 @@ var RouteManager = class _RouteManager {
915
968
  /**
916
969
  * The path the watcher reports for a file a plan read: itself, or the real path of a workspace
917
970
  * package's source read through its `node_modules` link. Null for an installed package's file.
971
+ * Package managers link whole package directories, so one realpath of the directory rules out an
972
+ * installed package; a plan reads thousands of files of an icon package.
918
973
  */
919
974
  planSourcePath(file) {
920
- if (!file.includes(NODE_MODULES_SEGMENT)) return file;
975
+ const index = file.lastIndexOf(NODE_MODULES_SEGMENT);
976
+ if (index === -1) return file;
977
+ const directory = getInstalledPackageDirectory(file, index + NODE_MODULES_SEGMENT.length);
978
+ let linked = this.linkedPackages.get(directory);
979
+ if (linked === void 0) {
980
+ linked = realPathOutsideNodeModules(directory) !== null;
981
+ this.linkedPackages.set(directory, linked);
982
+ }
983
+ if (!linked) return null;
921
984
  let source = this.linkedSources.get(file);
922
985
  if (source === void 0) {
923
- try {
924
- const real = realpathSync(file);
925
- source = real.includes(NODE_MODULES_SEGMENT) ? null : real;
926
- } catch {
927
- source = null;
928
- }
986
+ source = realPathOutsideNodeModules(file);
929
987
  this.linkedSources.set(file, source);
930
988
  }
931
989
  return source;
@@ -1902,7 +1960,7 @@ async function safeGlobFiles(pattern, cwd) {
1902
1960
  }
1903
1961
  function toRealPath(filePath) {
1904
1962
  try {
1905
- return realpathSync(filePath);
1963
+ return fs.realpathSync(filePath);
1906
1964
  } catch {
1907
1965
  return filePath;
1908
1966
  }
@@ -1960,40 +2018,15 @@ function createFarmDevClientManifest(manifest, options) {
1960
2018
  return clientManifest;
1961
2019
  }
1962
2020
 
1963
- // src/server/dev-styles.ts
1964
- import * as fs from "fs";
1965
- import * as path3 from "path";
1966
- function resolveDevGlobalStylesheetHref(root, srcDir = "src") {
1967
- const file = path3.join(root, srcDir, "app", "globals.css");
1968
- if (!fs.existsSync(file)) return void 0;
1969
- return `/${path3.relative(root, file).split(path3.sep).join("/")}`;
1970
- }
1971
- var STYLE_EXTENSIONS = /\.(css|scss|sass|less|styl|stylus)(?:$|\?)/;
1972
- var ALREADY_LINKED = "/src/app/globals.css";
1973
- function collectDevStylesheetUrls(modules, alreadyLinked = ALREADY_LINKED, options = {}) {
1974
- const seen = /* @__PURE__ */ new Set();
1975
- for (const mod of modules) {
1976
- const id = mod.id ?? mod.file ?? "";
1977
- if (!STYLE_EXTENSIONS.test(id)) continue;
1978
- const cssModule = id.includes(".module.");
1979
- if (cssModule && !options.cssModules) continue;
1980
- const url = mod.url;
1981
- if (!url || !url.startsWith("/")) continue;
1982
- const bare = url.split("?")[0];
1983
- if (bare === alreadyLinked) continue;
1984
- seen.add(cssModule ? `${bare}?direct` : bare);
1985
- }
1986
- return [...seen].sort();
1987
- }
1988
-
1989
2021
  // src/font-vite.ts
1990
2022
  import { createHash as createHash2, timingSafeEqual } from "crypto";
1991
- import { existsSync as existsSync2 } from "fs";
2023
+ import { existsSync } from "fs";
1992
2024
  import { readFile as readFile2 } from "fs/promises";
1993
- import path4 from "path";
2025
+ import path3 from "path";
1994
2026
  import { createRequire } from "module";
1995
- import { pathToFileURL } from "url";
2027
+ import { fileURLToPath, pathToFileURL } from "url";
1996
2028
  var FONT_IMPORTS = /* @__PURE__ */ new Set(["@farm.js/core", "@farm.js/core/font"]);
2029
+ var FARM_CORE_DIRECTORY = `${path3.dirname(typeof __filename === "string" ? __filename : fileURLToPath(import.meta.url)).replace(/\\/g, "/")}/`;
1997
2030
  var FONT_FUNCTIONS = /* @__PURE__ */ new Set(["localFont", "remoteFont"]);
1998
2031
  var FONT_CSS_PREFIX = "\0farm:font-css:";
1999
2032
  var FONT_RUNTIME_ID = "\0farm:font-runtime";
@@ -2096,7 +2129,7 @@ function farmFontImportsPlugin(options = {}) {
2096
2129
  }
2097
2130
  async function transformFarmFontCalls(options) {
2098
2131
  const cleanId = options.id.split("?", 1)[0];
2099
- if (!MODULE_EXTENSION_RE.test(cleanId) || /\.d\.[cm]?ts$/.test(cleanId) || !containsFontFunction(options.code)) {
2132
+ if (!MODULE_EXTENSION_RE.test(cleanId) || /\.d\.[cm]?ts$/.test(cleanId) || !containsFontFunction(options.code) || cleanId.replace(/\\/g, "/").startsWith(FARM_CORE_DIRECTORY)) {
2100
2133
  return null;
2101
2134
  }
2102
2135
  const ast = options.parse(options.code);
@@ -2348,7 +2381,7 @@ ${FONT_SECTION_END}
2348
2381
  return resource;
2349
2382
  }
2350
2383
  const bytes2 = await fetchRemoteFont(url, input.integrity);
2351
- return this.createSelfHostedResource(bytes2, extension, path4.basename(url.pathname));
2384
+ return this.createSelfHostedResource(bytes2, extension, path3.basename(url.pathname));
2352
2385
  }
2353
2386
  if (input.source.startsWith("/")) {
2354
2387
  return this.createPublicResource(input.moduleId, input.source);
@@ -2371,8 +2404,8 @@ ${FONT_SECTION_END}
2371
2404
  }
2372
2405
  return this.createSelfHostedResource(
2373
2406
  bytes,
2374
- path4.extname(resolvedPath),
2375
- path4.basename(resolvedPath)
2407
+ path3.extname(resolvedPath),
2408
+ path3.basename(resolvedPath)
2376
2409
  );
2377
2410
  }
2378
2411
  async createPublicResource(moduleId, source) {
@@ -2383,7 +2416,7 @@ ${FONT_SECTION_END}
2383
2416
  );
2384
2417
  }
2385
2418
  const publicPath = normalizePublicFontPath(source, moduleId);
2386
- const resolvedPath = path4.resolve(this.publicDir, `.${publicPath}`);
2419
+ const resolvedPath = path3.resolve(this.publicDir, `.${publicPath}`);
2387
2420
  if (!isPathInside(this.publicDir, resolvedPath)) {
2388
2421
  throw fontError(moduleId, `public font path must stay inside publicDir`);
2389
2422
  }
@@ -2399,7 +2432,7 @@ ${FONT_SECTION_END}
2399
2432
  `could not read ${JSON.stringify(source)} from publicDir: ${error.message}`
2400
2433
  );
2401
2434
  }
2402
- const extension = path4.extname(resolvedPath).toLowerCase();
2435
+ const extension = path3.extname(resolvedPath).toLowerCase();
2403
2436
  const hash = createHash2("sha256").update(bytes).digest("hex").slice(0, 12);
2404
2437
  const resource = {
2405
2438
  extension,
@@ -2414,7 +2447,7 @@ ${FONT_SECTION_END}
2414
2447
  createSelfHostedResource(bytes, extension, fileName) {
2415
2448
  const normalizedExtension = extension.toLowerCase();
2416
2449
  const hash = createHash2("sha256").update(bytes).digest("hex").slice(0, 12);
2417
- const baseName = sanitizeFileName(path4.basename(fileName, extension)) || "font";
2450
+ const baseName = sanitizeFileName(path3.basename(fileName, extension)) || "font";
2418
2451
  const outputFileName = `assets/fonts/${baseName}-h${hash}${normalizedExtension}`;
2419
2452
  const key = `${hash}${normalizedExtension}`;
2420
2453
  const existing = this.resources.get(key);
@@ -2767,24 +2800,24 @@ function verifyIntegrity(bytes, integrity) {
2767
2800
  if (!matches) throw new Error("downloaded font did not match its integrity value");
2768
2801
  }
2769
2802
  function resolveLocalFontPath(source, importer, root) {
2770
- if (source.startsWith(".")) return path4.resolve(path4.dirname(importer), source);
2771
- if (path4.isAbsolute(source)) {
2803
+ if (source.startsWith(".")) return path3.resolve(path3.dirname(importer), source);
2804
+ if (path3.isAbsolute(source)) {
2772
2805
  return source;
2773
2806
  }
2774
2807
  try {
2775
2808
  return createRequire(pathToFileURL(importer)).resolve(source);
2776
2809
  } catch {
2777
2810
  const segments = source.replace(/\\/g, "/").split("/");
2778
- if (segments.includes("..")) return path4.resolve(root, source);
2779
- let current = path4.dirname(importer);
2780
- const filesystemRoot = path4.parse(current).root;
2811
+ if (segments.includes("..")) return path3.resolve(root, source);
2812
+ let current = path3.dirname(importer);
2813
+ const filesystemRoot = path3.parse(current).root;
2781
2814
  while (true) {
2782
- const candidate = path4.join(current, "node_modules", ...segments);
2783
- if (existsSync2(candidate)) return candidate;
2815
+ const candidate = path3.join(current, "node_modules", ...segments);
2816
+ if (existsSync(candidate)) return candidate;
2784
2817
  if (current === filesystemRoot) break;
2785
- current = path4.dirname(current);
2818
+ current = path3.dirname(current);
2786
2819
  }
2787
- return path4.resolve(root, "node_modules", ...segments);
2820
+ return path3.resolve(root, "node_modules", ...segments);
2788
2821
  }
2789
2822
  }
2790
2823
  function replaceFontSection(css, section) {
@@ -2817,11 +2850,11 @@ function getGlobalMap(key) {
2817
2850
  return created;
2818
2851
  }
2819
2852
  function normalizeRoot(root) {
2820
- return path4.resolve(root).replace(/\\/g, "/");
2853
+ return path3.resolve(root).replace(/\\/g, "/");
2821
2854
  }
2822
2855
  function normalizePublicDir(root, publicDir) {
2823
2856
  if (publicDir === false || publicDir === "") return false;
2824
- return path4.resolve(root, publicDir || "public");
2857
+ return path3.resolve(root, publicDir || "public");
2825
2858
  }
2826
2859
  function normalizePublicFontPath(source, moduleId) {
2827
2860
  if (source.includes("?") || source.includes("#")) {
@@ -2830,8 +2863,8 @@ function normalizePublicFontPath(source, moduleId) {
2830
2863
  return `/${source.replace(/\\/g, "/").replace(/^\/+/, "")}`;
2831
2864
  }
2832
2865
  function isPathInside(parent, child) {
2833
- const relative3 = path4.relative(parent, child);
2834
- return relative3 === "" || !relative3.startsWith("..") && !path4.isAbsolute(relative3);
2866
+ const relative3 = path3.relative(parent, child);
2867
+ return relative3 === "" || !relative3.startsWith("..") && !path3.isAbsolute(relative3);
2835
2868
  }
2836
2869
  function normalizeBasePath(value) {
2837
2870
  if (!value || value === "/") return "/";
@@ -2841,7 +2874,7 @@ function joinBasePath(basePath, value) {
2841
2874
  return basePath === "/" ? value : `${basePath.replace(/\/$/, "")}${value}`;
2842
2875
  }
2843
2876
  function extensionFromPath(pathname) {
2844
- const extension = path4.extname(pathname).toLowerCase();
2877
+ const extension = path3.extname(pathname).toLowerCase();
2845
2878
  if (!FONT_EXTENSION_RE.test(extension)) {
2846
2879
  throw new Error(`[Farm fonts] Remote font URL must end in .woff2, .woff, .ttf, or .otf`);
2847
2880
  }
@@ -2980,6 +3013,49 @@ function fontError(id, message) {
2980
3013
  return new Error(`[Farm fonts] ${message} in ${id.split("?", 1)[0]}`);
2981
3014
  }
2982
3015
 
3016
+ // src/server/dev-styles.ts
3017
+ import * as fs2 from "fs";
3018
+ import * as path4 from "path";
3019
+ function resolveDevGlobalStylesheetHref(root, srcDir = "src") {
3020
+ const file = path4.join(root, srcDir, "app", "globals.css");
3021
+ if (!fs2.existsSync(file)) return void 0;
3022
+ return `/${path4.relative(root, file).split(path4.sep).join("/")}`;
3023
+ }
3024
+ var STYLE_EXTENSIONS = /\.(css|scss|sass|less|styl|stylus)(?:$|\?)/;
3025
+ var ALREADY_LINKED = "/src/app/globals.css";
3026
+ function collectDevStylesheetUrls(modules, alreadyLinked = ALREADY_LINKED, options = {}) {
3027
+ const seen = /* @__PURE__ */ new Set();
3028
+ for (const mod of modules) {
3029
+ const id = mod.id ?? mod.file ?? "";
3030
+ if (!STYLE_EXTENSIONS.test(id)) continue;
3031
+ const cssModule = id.includes(".module.");
3032
+ if (cssModule && !options.cssModules) continue;
3033
+ const url = mod.url;
3034
+ if (!url || !url.startsWith("/")) continue;
3035
+ const bare = url.split("?")[0];
3036
+ if (bare === alreadyLinked) continue;
3037
+ seen.add(cssModule ? `${bare}?direct` : bare);
3038
+ }
3039
+ return [...seen].sort();
3040
+ }
3041
+ var SERVER_STYLESHEET_FILE = /\.(?:css|less|sass|scss|styl|stylus|pcss|postcss|sss)$/;
3042
+ function farmDevServerStylesheetsPlugin() {
3043
+ return {
3044
+ name: "farm:dev-server-stylesheets",
3045
+ apply: "serve",
3046
+ enforce: "pre",
3047
+ applyToEnvironment: (environment) => environment.config.consumer === "server",
3048
+ load: {
3049
+ filter: { id: SERVER_STYLESHEET_FILE },
3050
+ handler(id) {
3051
+ if (id.startsWith("\0") && !id.startsWith(FONT_CSS_PREFIX)) return null;
3052
+ if (/\.module\.[^./]+$/.test(id)) return null;
3053
+ return "";
3054
+ }
3055
+ }
3056
+ };
3057
+ }
3058
+
2983
3059
  // src/integration-provider-build.ts
2984
3060
  import path5 from "path";
2985
3061
  function isRendererCompiledComponent(moduleId, rendererComponentExtensions) {
@@ -3087,7 +3163,7 @@ function resolveProviderModule(moduleId, root) {
3087
3163
  }
3088
3164
 
3089
3165
  // src/island-inference.ts
3090
- import fs2 from "fs";
3166
+ import fs3 from "fs";
3091
3167
  import path6 from "path";
3092
3168
  import { inferStrategy } from "@farm.js/islx/compiler";
3093
3169
  import { parseAst } from "rolldown/parseAst";
@@ -3105,7 +3181,7 @@ function parseFarmIslandSource(file, code) {
3105
3181
  }
3106
3182
  function modifiedAt(file) {
3107
3183
  try {
3108
- return fs2.statSync(file).mtimeMs;
3184
+ return fs3.statSync(file).mtimeMs;
3109
3185
  } catch {
3110
3186
  return -1;
3111
3187
  }
@@ -3119,7 +3195,7 @@ function inferFarmIslandStrategy(filePath, root) {
3119
3195
  }
3120
3196
  let code;
3121
3197
  try {
3122
- code = fs2.readFileSync(file, "utf8");
3198
+ code = fs3.readFileSync(file, "utf8");
3123
3199
  } catch {
3124
3200
  return { strategy: null, files: [file], reason: `${path6.basename(file)} could not be read` };
3125
3201
  }
@@ -3176,7 +3252,7 @@ function inferRouteRoot(owners, root) {
3176
3252
  for (const module of modules) {
3177
3253
  let source = null;
3178
3254
  try {
3179
- source = fs2.readFileSync(module, "utf8");
3255
+ source = fs3.readFileSync(module, "utf8");
3180
3256
  } catch {
3181
3257
  }
3182
3258
  if (getIslandStrategyExport(source) !== null) return { strategy: null, files, declared: true };
@@ -3212,15 +3288,15 @@ function resolveFarmRouteRootStrategy(route, page, layouts, root, islandsMode) {
3212
3288
  }
3213
3289
 
3214
3290
  // src/server/renderer.ts
3215
- import * as fs5 from "fs";
3291
+ import * as fs7 from "fs";
3216
3292
  import * as https from "https";
3217
3293
  import { isIP } from "net";
3218
- import * as path9 from "path";
3294
+ import * as path10 from "path";
3219
3295
  import * as tls from "tls";
3220
3296
  import { Readable, Writable } from "stream";
3221
3297
 
3222
3298
  // src/not-found.ts
3223
- import fs3 from "fs";
3299
+ import fs4 from "fs";
3224
3300
  import path7 from "path";
3225
3301
  function resolveFarmNotFoundComponentPath(config, appDirs) {
3226
3302
  const extensions = getFarmRendererComponentExtensions(config.renderer);
@@ -3232,7 +3308,7 @@ function resolveFarmNotFoundComponentPath(config, appDirs) {
3232
3308
  `notFound.component must use one of the configured renderer extensions: ${extensions.join(", ")}`
3233
3309
  );
3234
3310
  }
3235
- if (!fs3.existsSync(componentPath) || !fs3.statSync(componentPath).isFile()) {
3311
+ if (!fs4.existsSync(componentPath) || !fs4.statSync(componentPath).isFile()) {
3236
3312
  throw new Error(`notFound.component was not found: ${componentPath}`);
3237
3313
  }
3238
3314
  return componentPath;
@@ -3241,7 +3317,7 @@ function resolveFarmNotFoundComponentPath(config, appDirs) {
3241
3317
  for (const appDir of appDirs) {
3242
3318
  for (const extension of extensions) {
3243
3319
  const candidate = path7.join(appDir, `not-found${extension}`);
3244
- if (fs3.existsSync(candidate) && fs3.statSync(candidate).isFile()) {
3320
+ if (fs4.existsSync(candidate) && fs4.statSync(candidate).isFile()) {
3245
3321
  discoveredPath = candidate;
3246
3322
  break;
3247
3323
  }
@@ -3437,9 +3513,9 @@ body {
3437
3513
  import { pathToFileURL as pathToFileURL2 } from "url";
3438
3514
 
3439
3515
  // src/server/error-diagnostics.ts
3440
- import * as fs4 from "fs";
3516
+ import * as fs5 from "fs";
3441
3517
  import * as path8 from "path";
3442
- import { fileURLToPath } from "url";
3518
+ import { fileURLToPath as fileURLToPath2 } from "url";
3443
3519
  var SECRET_VALUE_PATTERN = /\b(api[_-]?key|access[_-]?token|auth[_-]?token|client[_-]?secret|secret[_-]?key|token|password|secret)\s*[:=]\s*([^\s,;]+)/gi;
3444
3520
  var BEARER_PATTERN = /\b(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi;
3445
3521
  function redactErrorText(value) {
@@ -3452,7 +3528,7 @@ function isPathInsideRoot(root, filePath) {
3452
3528
  function normalizeStackPath(value) {
3453
3529
  const withoutQuery = value.replace(/[?#].*$/, "");
3454
3530
  try {
3455
- return withoutQuery.startsWith("file://") ? fileURLToPath(withoutQuery) : withoutQuery;
3531
+ return withoutQuery.startsWith("file://") ? fileURLToPath2(withoutQuery) : withoutQuery;
3456
3532
  } catch {
3457
3533
  return void 0;
3458
3534
  }
@@ -3466,7 +3542,7 @@ function findStackLocation(stack, root) {
3466
3542
  const candidate = normalizeStackPath(match[1]);
3467
3543
  if (!candidate || candidate.includes(`${path8.sep}node_modules${path8.sep}`)) continue;
3468
3544
  const absolutePath = path8.resolve(candidate);
3469
- if (!isPathInsideRoot(root, absolutePath) || !fs4.existsSync(absolutePath)) continue;
3545
+ if (!isPathInsideRoot(root, absolutePath) || !fs5.existsSync(absolutePath)) continue;
3470
3546
  const relativePath = path8.relative(root, absolutePath).split(path8.sep).join("/");
3471
3547
  return {
3472
3548
  absolutePath,
@@ -3479,7 +3555,7 @@ function findStackLocation(stack, root) {
3479
3555
  }
3480
3556
  function createSourceFrame(location) {
3481
3557
  try {
3482
- const sourceLines = fs4.readFileSync(location.absolutePath, "utf8").split(/\r?\n/);
3558
+ const sourceLines = fs5.readFileSync(location.absolutePath, "utf8").split(/\r?\n/);
3483
3559
  if (location.line < 1 || location.line > sourceLines.length) return void 0;
3484
3560
  const start = Math.max(1, location.line - 2);
3485
3561
  const end = Math.min(sourceLines.length, location.line + 2);
@@ -3524,6 +3600,244 @@ function canBootFarmIslandsClient(config) {
3524
3600
  return resolveFarmServerComponentsMode(config.experimental?.serverComponents) === "islands" && !docsEnabled && resolveFarmClientPlugins(config.plugins, config.root).length === 0 && !resolveFarmAppClientEntry(config.root, config.srcDir || "src");
3525
3601
  }
3526
3602
 
3603
+ // src/islands-kept-layouts.ts
3604
+ import fs6 from "fs";
3605
+ import path9 from "path";
3606
+ import { parseAst as parseAst2 } from "rolldown/parseAst";
3607
+ var SCRIPT_SOURCE = /\.[cm]?[jt]sx?$/;
3608
+ var ASSET_SOURCE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss|svg|png|jpe?g|gif|webp|avif|ico|woff2?|ttf|otf)$/;
3609
+ var PURE_PACKAGE_IMPORTS = /* @__PURE__ */ new Map([
3610
+ ["react", "*"],
3611
+ ["react/jsx-runtime", "*"],
3612
+ ["react/jsx-dev-runtime", "*"],
3613
+ ["@farm.js/core/client", /* @__PURE__ */ new Set(["Link"])]
3614
+ ]);
3615
+ var IMPURE_GLOBALS = /* @__PURE__ */ new Set([
3616
+ "process",
3617
+ "globalThis",
3618
+ "global",
3619
+ "window",
3620
+ "self",
3621
+ "Date",
3622
+ "crypto",
3623
+ "fetch",
3624
+ "require",
3625
+ "eval",
3626
+ "Function",
3627
+ "performance",
3628
+ "setTimeout",
3629
+ "setInterval",
3630
+ "queueMicrotask",
3631
+ "AsyncLocalStorage"
3632
+ ]);
3633
+ var DECLARATION_STATEMENTS = /* @__PURE__ */ new Set([
3634
+ "ImportDeclaration",
3635
+ "FunctionDeclaration",
3636
+ "VariableDeclaration",
3637
+ "ClassDeclaration",
3638
+ "TSTypeAliasDeclaration",
3639
+ "TSInterfaceDeclaration",
3640
+ "TSEnumDeclaration",
3641
+ "TSModuleDeclaration",
3642
+ "TSDeclareFunction",
3643
+ "EmptyStatement"
3644
+ ]);
3645
+ function parse(code, file) {
3646
+ const extension = path9.extname(file).slice(1);
3647
+ const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : extension === "js" || extension === "mjs" || extension === "cjs" || extension === "jsx" ? "jsx" : "tsx";
3648
+ return memoizeInFarmSourceSnapshot(`ast:${lang}`, code, () => {
3649
+ try {
3650
+ return parseAst2(code, { lang });
3651
+ } catch {
3652
+ return null;
3653
+ }
3654
+ });
3655
+ }
3656
+ function findFarmRequestDecidingConstruct(code, file) {
3657
+ const program = parse(code, file);
3658
+ if (!program) return { reason: "the module does not parse", imports: [] };
3659
+ const imports = [];
3660
+ let reason = null;
3661
+ for (const statement of program.body) {
3662
+ if (statement.type === "ImportDeclaration") {
3663
+ if (statement.importKind === "type") continue;
3664
+ const names = [];
3665
+ for (const specifier of statement.specifiers ?? []) {
3666
+ if (specifier.importKind === "type") continue;
3667
+ if (specifier.type === "ImportSpecifier") {
3668
+ names.push(specifier.imported.name ?? specifier.imported.value);
3669
+ } else if (specifier.type === "ImportDefaultSpecifier") names.push("default");
3670
+ else names.push("*");
3671
+ }
3672
+ if ((statement.specifiers ?? []).length === 0 || names.length > 0) {
3673
+ imports.push({ source: statement.source.value, names });
3674
+ }
3675
+ continue;
3676
+ }
3677
+ if (statement.type === "ExportAllDeclaration") {
3678
+ if (statement.exportKind !== "type")
3679
+ imports.push({ source: statement.source.value, names: ["*"] });
3680
+ continue;
3681
+ }
3682
+ if (statement.type === "ExportNamedDeclaration") {
3683
+ if (statement.source && statement.exportKind !== "type") {
3684
+ imports.push({
3685
+ source: statement.source.value,
3686
+ names: (statement.specifiers ?? []).filter((specifier) => specifier.exportKind !== "type").map((specifier) => specifier.local.name ?? specifier.local.value)
3687
+ });
3688
+ }
3689
+ continue;
3690
+ }
3691
+ if (statement.type === "ExportDefaultDeclaration") continue;
3692
+ if (statement.type === "ExpressionStatement" && typeof statement.directive === "string") {
3693
+ continue;
3694
+ }
3695
+ if (!DECLARATION_STATEMENTS.has(statement.type)) {
3696
+ reason ?? (reason = `a top-level ${statement.type}`);
3697
+ }
3698
+ }
3699
+ const visit = (node, parent, key) => {
3700
+ if (reason || !node || typeof node !== "object") return;
3701
+ if (Array.isArray(node)) {
3702
+ for (const child of node) visit(child, parent, key);
3703
+ return;
3704
+ }
3705
+ const current = node;
3706
+ if (typeof current.type !== "string") return;
3707
+ switch (current.type) {
3708
+ case "ThrowStatement":
3709
+ reason = "a throw statement";
3710
+ return;
3711
+ case "AwaitExpression":
3712
+ reason = "an await expression";
3713
+ return;
3714
+ case "YieldExpression":
3715
+ reason = "a generator";
3716
+ return;
3717
+ case "ImportExpression":
3718
+ reason = "a dynamic import()";
3719
+ return;
3720
+ case "ForOfStatement":
3721
+ if (current.await) {
3722
+ reason = "a for await loop";
3723
+ return;
3724
+ }
3725
+ break;
3726
+ case "FunctionDeclaration":
3727
+ case "FunctionExpression":
3728
+ case "ArrowFunctionExpression":
3729
+ if (current.async || current.generator) {
3730
+ reason = current.async ? "an async function" : "a generator";
3731
+ return;
3732
+ }
3733
+ break;
3734
+ case "MetaProperty":
3735
+ reason = "import.meta";
3736
+ return;
3737
+ case "CallExpression":
3738
+ if (current.callee?.type === "Identifier" && current.callee.name === "use") {
3739
+ reason = "a use() call";
3740
+ return;
3741
+ }
3742
+ if (current.callee?.type === "MemberExpression" && !current.callee.computed && current.callee.object?.type === "Identifier" && current.callee.object.name === "Math" && current.callee.property?.name === "random") {
3743
+ reason = "Math.random()";
3744
+ return;
3745
+ }
3746
+ break;
3747
+ case "Identifier":
3748
+ if (IMPURE_GLOBALS.has(current.name) && isReference(current, parent, key)) {
3749
+ reason = `the global ${current.name}`;
3750
+ return;
3751
+ }
3752
+ break;
3753
+ }
3754
+ for (const [childKey, value] of Object.entries(current)) {
3755
+ if (childKey === "start" || childKey === "end" || childKey === "loc" || childKey === "range") {
3756
+ continue;
3757
+ }
3758
+ if (value && typeof value === "object") visit(value, current, childKey);
3759
+ }
3760
+ };
3761
+ for (const statement of program.body) {
3762
+ if (statement.type === "ImportDeclaration") continue;
3763
+ visit(statement, program, "body");
3764
+ if (reason) break;
3765
+ }
3766
+ return { reason, imports };
3767
+ }
3768
+ function isReference(node, parent, key) {
3769
+ if (!parent) return true;
3770
+ if (parent.type === "MemberExpression" && key === "property" && !parent.computed) return false;
3771
+ if ((parent.type === "Property" || parent.type === "MethodDefinition") && key === "key") {
3772
+ return Boolean(parent.computed);
3773
+ }
3774
+ if (parent.type === "PropertyDefinition" && key === "key") return Boolean(parent.computed);
3775
+ if (parent.type.startsWith("TS")) return false;
3776
+ if (parent.type === "JSXAttribute" || parent.type.startsWith("JSX")) return false;
3777
+ if (parent.type === "LabeledStatement" || parent.type === "BreakStatement") return false;
3778
+ if (parent.type === "ContinueStatement") return false;
3779
+ return true;
3780
+ }
3781
+ function readSource(file) {
3782
+ try {
3783
+ noteFarmSourceRead(file);
3784
+ return fs6.readFileSync(file, "utf8");
3785
+ } catch {
3786
+ return null;
3787
+ }
3788
+ }
3789
+ function explainFarmKeptLayoutRender(modulePath, root) {
3790
+ const entry = resolveModuleSourcePath(modulePath, root);
3791
+ if (!entry) return `${modulePath} does not resolve`;
3792
+ const visited = /* @__PURE__ */ new Set();
3793
+ const check = (file) => {
3794
+ if (visited.has(file)) return null;
3795
+ visited.add(file);
3796
+ if (ASSET_SOURCE.test(file)) return null;
3797
+ if (!SCRIPT_SOURCE.test(file)) return `${path9.relative(root, file)} is not a script`;
3798
+ const code = readSource(file);
3799
+ if (code === null) return `${path9.relative(root, file)} cannot be read`;
3800
+ const { reason, imports } = memoizeInFarmSourceSnapshot(
3801
+ "kept-layout-module",
3802
+ code,
3803
+ () => findFarmRequestDecidingConstruct(code, file)
3804
+ );
3805
+ if (reason) return `${path9.relative(root, file)} has ${reason}`;
3806
+ for (const imported of imports) {
3807
+ const allowed = PURE_PACKAGE_IMPORTS.get(imported.source);
3808
+ if (allowed) {
3809
+ if (allowed === "*" || imported.names.every((name) => allowed.has(name))) continue;
3810
+ return `${path9.relative(root, file)} imports ${imported.names.join(", ")} from ${imported.source}`;
3811
+ }
3812
+ if (ASSET_SOURCE.test(imported.source.split("?")[0])) continue;
3813
+ const resolved = resolveImportedModule(file, imported.source, root);
3814
+ if (!resolved.path || !resolved.local) {
3815
+ return `${path9.relative(root, file)} imports ${imported.source}`;
3816
+ }
3817
+ const nested = check(resolved.path);
3818
+ if (nested) return nested;
3819
+ }
3820
+ return null;
3821
+ };
3822
+ return check(entry);
3823
+ }
3824
+ var answers = /* @__PURE__ */ new Map();
3825
+ function canFarmSkipKeptLayoutRender(modulePath, root) {
3826
+ const key = `${root}\0${modulePath}`;
3827
+ const known = answers.get(key);
3828
+ if (known && known.stamps.every(([file, stamp]) => getFarmSourceStamp(file) === stamp)) {
3829
+ return known.skip;
3830
+ }
3831
+ const { result, files } = traceFarmSourceReads(
3832
+ () => explainFarmKeptLayoutRender(modulePath, root) === null
3833
+ );
3834
+ answers.set(key, {
3835
+ skip: result,
3836
+ stamps: files.map((file) => [file, getFarmSourceStamp(file)])
3837
+ });
3838
+ return result;
3839
+ }
3840
+
3527
3841
  // src/server/renderer.ts
3528
3842
  var islands;
3529
3843
  function withFarmIslandsRenders(runtime, islandsRuntime) {
@@ -3783,12 +4097,13 @@ function createRouteStateProps(input) {
3783
4097
  function readAppPackageIdentity(root) {
3784
4098
  try {
3785
4099
  return JSON.parse(
3786
- fs5.readFileSync(path9.join(root || process.cwd(), "package.json"), "utf8")
4100
+ fs7.readFileSync(path10.join(root || process.cwd(), "package.json"), "utf8")
3787
4101
  );
3788
4102
  } catch {
3789
4103
  return {};
3790
4104
  }
3791
4105
  }
4106
+ var pageRequests = /* @__PURE__ */ new WeakMap();
3792
4107
  var ServerRenderer = class {
3793
4108
  constructor(config, routeManager, i18nRuntime, viteServer) {
3794
4109
  this.ssgManifest = [];
@@ -3812,7 +4127,7 @@ var ServerRenderer = class {
3812
4127
  if (this.config.notFound?.component?.trim()) {
3813
4128
  resolveFarmNotFoundComponentPath(this.config, getFarmAppDirectories(this.config));
3814
4129
  }
3815
- const loaded = isReactRenderer(this.config.renderer) ? await import("./renderer/react/server.mjs") : isFarmRendererDisabled(this.config.renderer) ? await import("./renderer/none/server.mjs") : this.viteServer ? await loadFarmDevModule(this.viteServer, this.config.renderer.server) : await import(pathToFileURL2(
4130
+ const loaded = isReactRenderer(this.config.renderer) ? this.reactRenderer = await import("./renderer/react/server.mjs") : isFarmRendererDisabled(this.config.renderer) ? await import("./renderer/none/server.mjs") : this.viteServer ? await loadFarmDevModule(this.viteServer, this.config.renderer.server) : await import(pathToFileURL2(
3816
4131
  resolveFarmRendererModule(
3817
4132
  this.config.root || process.cwd(),
3818
4133
  this.config.renderer.server
@@ -3860,7 +4175,7 @@ var ServerRenderer = class {
3860
4175
  configureApp(setupModule.default);
3861
4176
  }
3862
4177
  createPageBoundary(pageElement, options) {
3863
- return this.rendererRuntime.createElement(
4178
+ const boundary = this.rendererRuntime.createElement(
3864
4179
  "div",
3865
4180
  {
3866
4181
  id: "__farm_page__",
@@ -3872,6 +4187,7 @@ var ServerRenderer = class {
3872
4187
  },
3873
4188
  pageElement
3874
4189
  );
4190
+ return options.pageShouldHydrate && !options.layoutShouldHydrate && this.reactRenderer ? this.reactRenderer.markPagePosition(boundary) : boundary;
3875
4191
  }
3876
4192
  /// The app's `<srcDir>/app/globals.css`, linked only when it exists, as the
3877
4193
  /// production build imports it only when it exists. An app without one gets
@@ -4057,6 +4373,7 @@ var ServerRenderer = class {
4057
4373
  await this.initialize();
4058
4374
  if (this.viteServer) await this.applyRendererAppSetup();
4059
4375
  setFarmBasePath(this.config.basePath);
4376
+ this.publishSearchPreserveRoutes();
4060
4377
  setFarmTrailingSlashPreference(this.config.trailingSlash);
4061
4378
  let element = this.rendererRuntime.createElement(input.PageComponent, input.pageProps);
4062
4379
  if (input.LoadingComponent) {
@@ -4081,11 +4398,17 @@ var ServerRenderer = class {
4081
4398
  layoutShouldHydrate: input.layoutShouldHydrate,
4082
4399
  islandStrategy: input.islandStrategy
4083
4400
  });
4084
- const layoutStartIndex = Math.max(
4085
- 0,
4086
- Math.min(input.layoutStartIndex ?? 0, input.layouts.length)
4401
+ const sharedCount = Math.max(0, Math.min(input.layoutStartIndex ?? 0, input.layouts.length));
4402
+ const dynamicTreeIndex = input.layouts.findIndex(
4403
+ (layout, index) => index < sharedCount && layout.serverTree && layout.pattern.includes("[")
4087
4404
  );
4088
- for (let index = input.layouts.length - 1; index >= layoutStartIndex; index--) {
4405
+ const layoutStartIndex = dynamicTreeIndex === -1 ? sharedCount : dynamicTreeIndex;
4406
+ const fragmentTag = this.reactRenderer && layoutStartIndex > 0 ? "farm-fragment-" + createFarmFlushToken() : null;
4407
+ const renderFrom = this.reactRenderer ? 0 : sharedCount;
4408
+ for (let index = input.layouts.length - 1; index >= renderFrom; index--) {
4409
+ if (fragmentTag && index === layoutStartIndex - 1) {
4410
+ element = this.rendererRuntime.createElement(fragmentTag, null, element);
4411
+ }
4089
4412
  const layout = input.layouts[index];
4090
4413
  const LayoutComponent = layout.module.default;
4091
4414
  if (!LayoutComponent) continue;
@@ -4106,18 +4429,161 @@ var ServerRenderer = class {
4106
4429
  slotElement
4107
4430
  );
4108
4431
  }
4109
- element = this.rendererRuntime.createElement(LayoutComponent, {
4110
- children: element,
4432
+ const outlets = { children: element, ...slotProps };
4433
+ element = index >= layoutStartIndex && input.layoutShouldHydrate && layout.serverTree && islands && this.islandValues() ? await islands.renderFarmServerTreeLayout(
4434
+ LayoutComponent,
4435
+ { params: input.params },
4436
+ outlets,
4437
+ layout.pattern
4438
+ ) : this.rendererRuntime.createElement(LayoutComponent, {
4111
4439
  params: input.params,
4112
- ...slotProps
4440
+ ...outlets
4113
4441
  });
4114
4442
  element = this.createLayoutBoundary(layout.pattern, element);
4115
4443
  }
4444
+ if (input.pageShouldHydrate && !input.layoutShouldHydrate && this.reactRenderer) {
4445
+ element = this.reactRenderer.markLayoutPosition(element);
4446
+ }
4116
4447
  if (input.layoutShouldHydrate) {
4117
4448
  element = this.wrapClientGraph(element);
4118
4449
  }
4119
- return this.renderElementToCompleteHTML(await this.wrapWithIntegrationProviders(element), {
4120
- rejectLateRedirects: true
4450
+ const html = await this.renderElementToCompleteHTML(
4451
+ await this.wrapWithIntegrationProviders(element),
4452
+ {
4453
+ rejectLateRedirects: true
4454
+ }
4455
+ );
4456
+ return fragmentTag ? takeFarmNavigationOutlet(html, fragmentTag) : html;
4457
+ }
4458
+ /**
4459
+ * A built-in docs runtime page (`docs.entry`, no adapter) under layouts that hydrate, or whose
4460
+ * client components are islands: the docs runtime's document with the layout chain
4461
+ * rendered around its body, and the client that hydrates it with the boot data an app page has. Production renders the same tree
4462
+ * (wrapFarmDocsResponseWithLayouts in nitro/universal-build.ts, with docs-layout-tree.ts).
4463
+ * Any other docs response is sent as it is.
4464
+ */
4465
+ async wrapDocsResponseWithLayouts(request2, response) {
4466
+ if (request2.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !response.headers.get("content-type")?.toLowerCase().includes("text/html")) {
4467
+ return response;
4468
+ }
4469
+ await this.initialize();
4470
+ if (this.viteServer) await this.applyRendererAppSetup();
4471
+ const pathname = new URL(request2.url).pathname;
4472
+ const root = this.config.root || process.cwd();
4473
+ const matched = this.routeManager.matchRoute(pathname);
4474
+ const routeManifest = this.routeManager.generateClientManifest(this.config.root);
4475
+ const islandsMode = Boolean(islands && this.islandValues());
4476
+ const layouts = matched.layouts.map((layout) => {
4477
+ const entry = routeManifest.layouts.find((candidate) => candidate.pattern === layout.pattern);
4478
+ return {
4479
+ pattern: layout.pattern,
4480
+ modulePath: layout.modulePath,
4481
+ shouldHydrate: entry?.shouldHydrate === true,
4482
+ islandStrategy: entry?.islandStrategy ?? null,
4483
+ hasIsolatedClientBoundaries: entry?.hasIsolatedClientBoundaries === true,
4484
+ serverTree: entry?.serverTree === true,
4485
+ islands: entry?.hasIsolatedClientBoundaries === true
4486
+ };
4487
+ });
4488
+ if (!farmDocsLayoutsWrapPage(layouts)) return response;
4489
+ const shouldHydrateLayout = layouts.some((layout) => layout.shouldHydrate);
4490
+ const hasIsolatedClientBoundaries = layouts.some(
4491
+ (layout) => layout.hasIsolatedClientBoundaries
4492
+ );
4493
+ const source = await response.text();
4494
+ const bodyMatch = /<body([^>]*)>([\s\S]*?)<\/body>/i.exec(source);
4495
+ if (!bodyMatch) {
4496
+ return new Response(source, {
4497
+ status: response.status,
4498
+ statusText: response.statusText,
4499
+ headers: response.headers
4500
+ });
4501
+ }
4502
+ const modules = await Promise.all(
4503
+ layouts.map((layout) => this.routeManager.loadLayoutModule(layout.modulePath))
4504
+ );
4505
+ const treeLayouts = layouts.map((layout, index) => ({
4506
+ ...layout,
4507
+ Component: modules[index]?.default
4508
+ }));
4509
+ const islandStrategy = resolveFarmDocsLayoutIslandStrategy(treeLayouts);
4510
+ const tree = await createFarmDocsLayoutTree(this.rendererRuntime, {
4511
+ pageHtml: bodyMatch[2],
4512
+ layouts: treeLayouts,
4513
+ params: matched.params,
4514
+ renderServerTreeLayout: islandsMode ? (Layout, props, outlets, pattern) => islands.renderFarmServerTreeLayout(
4515
+ Layout,
4516
+ props,
4517
+ outlets,
4518
+ pattern
4519
+ ) : void 0,
4520
+ layoutKey: islandsMode ? (pattern) => getFarmLayoutKey(pattern, matched.params) : void 0
4521
+ });
4522
+ const rendered = await this.renderElementToDocumentParts(
4523
+ this.rendererRuntime.createElement(
4524
+ "div",
4525
+ { id: "root" },
4526
+ await this.wrapWithIntegrationProviders(
4527
+ shouldHydrateLayout ? this.wrapClientGraph(tree) : tree
4528
+ )
4529
+ )
4530
+ );
4531
+ const rootMarkup = placeFarmDocsLayoutRoot(rendered.html);
4532
+ const clientLayouts = layouts.map((layout) => ({
4533
+ pattern: layout.pattern,
4534
+ modulePath: toViteModuleId(layout.modulePath, root),
4535
+ shouldHydrate: layout.shouldHydrate,
4536
+ islandStrategy: layout.islandStrategy,
4537
+ ...layout.hasIsolatedClientBoundaries ? { hasIsolatedClientBoundaries: true } : {},
4538
+ // Islands mode: the browser rebuilds this layout from its tree, not its module.
4539
+ ...shouldHydrateLayout && layout.serverTree ? { serverTree: true } : {}
4540
+ }));
4541
+ const clientManifest = createFarmDevClientManifest(routeManifest, {
4542
+ sharedAssets: [
4543
+ ...this.devGlobalStylesheetAssets(),
4544
+ ...this.collectDevStyleHrefs().map((href) => ({
4545
+ tag: "link",
4546
+ attrs: { rel: "stylesheet", href }
4547
+ }))
4548
+ ],
4549
+ boot: { layoutPatterns: layouts.map((layout) => layout.pattern) }
4550
+ });
4551
+ const i18nSnapshot = getFarmI18nClientSnapshot();
4552
+ const bootstrapScript = `<script>
4553
+ window.__FARM_PROPS__ = ${serializeInlineValue({ params: matched.params })};
4554
+ window.__FARM_ROUTE_SLOTS__ = [];
4555
+ window.__FARM_DEPLOYMENT_ID__ = ${serializeInlineValue(this.getDeploymentId())};
4556
+ window.__FARM_PATH__ = ${serializeInlineValue(pathname)};
4557
+ window.__FARM_IS_CLIENT__ = false;
4558
+ window.__FARM_PAGE_SHOULD_HYDRATE__ = false;
4559
+ window.__FARM_LAYOUT_SHOULD_HYDRATE__ = ${JSON.stringify(shouldHydrateLayout)};
4560
+ window.__FARM_LAYOUTS__ = ${serializeInlineValue(clientLayouts)};
4561
+ window.__FARM_SHOULD_HYDRATE__ = ${JSON.stringify(shouldHydrateLayout || hasIsolatedClientBoundaries)};
4562
+ window.__FARM_HAS_ISOLATED_CLIENT_BOUNDARIES__ = ${JSON.stringify(hasIsolatedClientBoundaries)};
4563
+ window.__FARM_ISLAND_STRATEGY__ = ${serializeInlineValue(islandStrategy)};
4564
+ window.__FARM_PAGE_MODULE__ = "";
4565
+ window.__FARM_LOADING_MODULE__ = null;
4566
+ window.__FARM_MANIFEST__ = ${serializeInlineValue(clientManifest)};
4567
+ window.__FARM_INTEGRATION_API_MANIFEST__ = ${serializeInlineValue(getRegisteredIntegrationAPIManifest())};
4568
+ window.__FARM_I18N__ = ${i18nSnapshot ? serializeInlineValue(i18nSnapshot) : "null"};
4569
+ </script>`;
4570
+ const head = [
4571
+ ...this.collectDevStyleLinks(),
4572
+ `<script type="module" src="/@vite/client"></script>`,
4573
+ source.includes("window._$HY") ? "" : this.rendererRuntime.generateHydrationScript?.(),
4574
+ bootstrapScript
4575
+ ].filter(Boolean).map((markup) => stampFarmCspNonce(markup)).concat(rendered.head || []).join("\n ");
4576
+ const clientScript = source.includes('src="/@farm/client.js"') ? "" : `
4577
+ ${stampFarmCspNonce(`<script type="module" src="/@farm/client.js"></script>`)}`;
4578
+ const html = source.replace(bodyMatch[0], () => `<body${bodyMatch[1]}>${rootMarkup}${clientScript}</body>`).replace(/<\/head>/i, () => ` ${head}
4579
+ </head>`);
4580
+ const headers = new Headers(response.headers);
4581
+ headers.delete("content-length");
4582
+ headers.delete("etag");
4583
+ return new Response(html, {
4584
+ status: response.status,
4585
+ statusText: response.statusText,
4586
+ headers
4121
4587
  });
4122
4588
  }
4123
4589
  async runWithRequestContext(request2, fn) {
@@ -4135,10 +4601,10 @@ var ServerRenderer = class {
4135
4601
  * Load SSG manifest from build output
4136
4602
  */
4137
4603
  loadSSGManifest() {
4138
- const manifestPath = path9.join(this.config.root, this.config.outDir, "__ssg_manifest.json");
4604
+ const manifestPath = path10.join(this.config.root, this.config.outDir, "__ssg_manifest.json");
4139
4605
  let content;
4140
4606
  try {
4141
- content = fs5.readFileSync(manifestPath, "utf-8");
4607
+ content = fs7.readFileSync(manifestPath, "utf-8");
4142
4608
  } catch (error) {
4143
4609
  if (error.code === "ENOENT") {
4144
4610
  return;
@@ -4191,26 +4657,23 @@ var ServerRenderer = class {
4191
4657
  this.getPPRCacheKey(pathname, search, locale, origin)
4192
4658
  );
4193
4659
  }
4194
- async cachePPRShell(options, html) {
4660
+ getPPRShellWriteOptions(options) {
4661
+ return {
4662
+ // revalidatePath() takes the route path (`/pricing`), as the docs show, while the shell
4663
+ // answers the public one (`/console/fr/pricing`): either clears it, as in production.
4664
+ paths: [.../* @__PURE__ */ new Set([options.pathname, this.routeManager.toRoutePathname(options.pathname)])],
4665
+ tags: ["ppr"],
4666
+ revalidate: options.revalidate ?? false
4667
+ };
4668
+ }
4669
+ async cachePPRShell(options, html, write, cookieIndependent = false) {
4195
4670
  const key = this.getPPRCacheKey(
4196
4671
  options.pathname,
4197
4672
  options.search,
4198
4673
  options.locale,
4199
4674
  options.origin
4200
4675
  );
4201
- await this.dataCache.pprShellCache.setAsync(
4202
- key,
4203
- { html },
4204
- {
4205
- // revalidatePath() takes the route path (`/pricing`), as the docs show, while the shell
4206
- // answers the public one (`/console/fr/pricing`): either clears it, as in production.
4207
- paths: [
4208
- .../* @__PURE__ */ new Set([options.pathname, this.routeManager.toRoutePathname(options.pathname)])
4209
- ],
4210
- tags: ["ppr"],
4211
- revalidate: options.revalidate ?? false
4212
- }
4213
- );
4676
+ await (write ?? await this.dataCache.pprShellCache.startWriteAsync(this.getPPRShellWriteOptions(options))).commit(key, { html, ...cookieIndependent ? { cookieIndependent: true } : {} });
4214
4677
  emitFarmEvent({
4215
4678
  type: "ppr.shell.cached",
4216
4679
  route: options.pathname,
@@ -4226,9 +4689,6 @@ var ServerRenderer = class {
4226
4689
  if (method !== "GET" && method !== "HEAD") {
4227
4690
  return "method";
4228
4691
  }
4229
- if (withoutFarmDeploymentCookie(req.headers.cookie)) {
4230
- return "cookie";
4231
- }
4232
4692
  if (req.headers.authorization) {
4233
4693
  return "authorization";
4234
4694
  }
@@ -4259,11 +4719,14 @@ var ServerRenderer = class {
4259
4719
  }
4260
4720
  return headers;
4261
4721
  }
4262
- serveCachedPPRShell(res, shell, revalidate) {
4722
+ serveCachedPPRShell(req, res, shell, revalidate) {
4263
4723
  res.setHeader("Content-Type", "text/html; charset=utf-8");
4264
4724
  for (const [key, value] of Object.entries(this.getPPRHeaders("hit", revalidate))) {
4265
4725
  res.setHeader(key, value);
4266
4726
  }
4727
+ if (withoutFarmDeploymentCookie(req.headers.cookie)) {
4728
+ res.setHeader("Cache-Control", "private, no-store");
4729
+ }
4267
4730
  res.write(shell.html);
4268
4731
  res.end();
4269
4732
  }
@@ -4315,6 +4778,9 @@ var ServerRenderer = class {
4315
4778
  });
4316
4779
  pageElement = this.createLayoutBoundary(layouts[i].pattern, pageElement);
4317
4780
  }
4781
+ if (pageMetadata.shouldHydrate && !layoutShouldHydrate && this.reactRenderer) {
4782
+ pageElement = this.reactRenderer.markLayoutPosition(pageElement);
4783
+ }
4318
4784
  const html = await this.rendererRuntime.renderToString(
4319
4785
  await this.wrapWithIntegrationProviders(pageElement)
4320
4786
  );
@@ -4361,10 +4827,10 @@ var ServerRenderer = class {
4361
4827
  return true;
4362
4828
  }
4363
4829
  try {
4364
- const htmlPath = page.urlPath === "/" ? path9.join(this.config.root, this.config.outDir, "client", "index.html") : path9.join(this.config.root, this.config.outDir, "client", page.urlPath + ".html");
4365
- if (fs5.existsSync(htmlPath)) {
4366
- const stat = fs5.statSync(htmlPath);
4367
- const html = fs5.readFileSync(htmlPath, "utf-8");
4830
+ const htmlPath = page.urlPath === "/" ? path10.join(this.config.root, this.config.outDir, "client", "index.html") : path10.join(this.config.root, this.config.outDir, "client", page.urlPath + ".html");
4831
+ if (fs7.existsSync(htmlPath)) {
4832
+ const stat = fs7.statSync(htmlPath);
4833
+ const html = fs7.readFileSync(htmlPath, "utf-8");
4368
4834
  await this.cacheSSGPage(page, html, {
4369
4835
  document: true,
4370
4836
  createdAt: stat.mtimeMs
@@ -4387,10 +4853,19 @@ var ServerRenderer = class {
4387
4853
  }
4388
4854
  return false;
4389
4855
  }
4856
+ /**
4857
+ * The pages with `search.preserve`, for the links this render draws (set per render, like the
4858
+ * base path, so a routes-file edit applies to the next one). A route manager without the list,
4859
+ * such as a partial test double, has none.
4860
+ */
4861
+ publishSearchPreserveRoutes() {
4862
+ _setFarmSearchPreserveRoutes(this.routeManager.getSearchPreserveRoutes?.() ?? []);
4863
+ }
4390
4864
  async renderPage(req, res) {
4391
4865
  await this.initialize();
4392
4866
  if (this.viteServer) await this.applyRendererAppSetup();
4393
4867
  setFarmBasePath(this.config.basePath);
4868
+ this.publishSearchPreserveRoutes();
4394
4869
  setFarmTrailingSlashPreference(this.config.trailingSlash);
4395
4870
  const cspNonce = createFarmCspNonce(this.security);
4396
4871
  if (cspNonce) {
@@ -4430,6 +4905,13 @@ var ServerRenderer = class {
4430
4905
  * it can stop.
4431
4906
  */
4432
4907
  createPageRequest(req, res) {
4908
+ const existing = pageRequests.get(req);
4909
+ if (existing) return existing;
4910
+ const request2 = this.createPageRequestOnce(req, res);
4911
+ pageRequests.set(req, request2);
4912
+ return request2;
4913
+ }
4914
+ createPageRequestOnce(req, res) {
4433
4915
  const observable = typeof req.once === "function" && typeof res.once === "function";
4434
4916
  return createWebRequestFromFarmRequest(req, {
4435
4917
  trustProxy: this.config.server?.trustProxy,
@@ -4460,6 +4942,7 @@ var ServerRenderer = class {
4460
4942
  durationMs: Date.now() - renderStartTime
4461
4943
  });
4462
4944
  };
4945
+ let pprShellWrite;
4463
4946
  try {
4464
4947
  const url = resolveFarmRequestURL(req, { trustProxy: this.config.server?.trustProxy });
4465
4948
  pathname = url.pathname;
@@ -4647,7 +5130,7 @@ var ServerRenderer = class {
4647
5130
  );
4648
5131
  const canCachePPRShell = renderingConfig.ppr && !pprBypassReason && !islandsNavigationRequest;
4649
5132
  const pprI18nSnapshot = canCachePPRShell ? getFarmI18nClientSnapshot() : void 0;
4650
- const pprShellOptions = canCachePPRShell ? {
5133
+ let pprShellOptions = canCachePPRShell ? {
4651
5134
  pathname,
4652
5135
  search: url.search,
4653
5136
  locale: pprI18nSnapshot?.locale ?? "",
@@ -4670,6 +5153,7 @@ var ServerRenderer = class {
4670
5153
  emitFarmEvent({ type: "ppr.refresh.start", route: pathname });
4671
5154
  }
4672
5155
  }
5156
+ const pprVisitorCookies = Boolean(withoutFarmDeploymentCookie(req.headers.cookie));
4673
5157
  if (pprShellOptions) {
4674
5158
  const pprCacheKey = this.getPPRCacheKey(
4675
5159
  pathname,
@@ -4683,25 +5167,37 @@ var ServerRenderer = class {
4683
5167
  pprShellOptions.locale,
4684
5168
  pprShellOptions.origin
4685
5169
  );
4686
- if (cachedPPRShell) {
5170
+ if (cachedPPRShell && pprVisitorCookies && !cachedPPRShell.value.cookieIndependent) {
5171
+ pprShellOptions = void 0;
5172
+ emitFarmEvent({ type: "ppr.shell.bypass", route: pathname, reason: "cookie" });
5173
+ emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "cookie" });
5174
+ } else if (cachedPPRShell) {
4687
5175
  emitFarmEvent({
4688
5176
  type: "ppr.shell.hit",
4689
5177
  route: pathname,
4690
5178
  key: pprCacheKey
4691
5179
  });
4692
- this.serveCachedPPRShell(res, cachedPPRShell.value, renderingConfig.revalidate);
5180
+ this.serveCachedPPRShell(req, res, cachedPPRShell.value, renderingConfig.revalidate);
4693
5181
  completeRender(res.statusCode || 200, pathname);
4694
5182
  return;
5183
+ } else {
5184
+ emitFarmEvent({
5185
+ type: "ppr.shell.miss",
5186
+ route: pathname,
5187
+ key: pprCacheKey
5188
+ });
5189
+ if (req.method !== "HEAD") {
5190
+ pprShellWrite = await this.dataCache.pprShellCache.startWriteAsync(
5191
+ this.getPPRShellWriteOptions(pprShellOptions)
5192
+ );
5193
+ }
4695
5194
  }
4696
- emitFarmEvent({
4697
- type: "ppr.shell.miss",
4698
- route: pathname,
4699
- key: pprCacheKey
4700
- });
4701
5195
  }
4702
5196
  const outerRequest = _peekCurrentRequest();
4703
5197
  const countRequestReads = () => (outerRequest ? _getRequestReadCount(outerRequest) : 0) + _getRequestReadCount(currentRequest);
4704
5198
  const requestReadsBeforeRender = countRequestReads();
5199
+ const countRequestCookieReads = () => (outerRequest ? _getRequestCookieReadCount(outerRequest) : 0) + _getRequestCookieReadCount(currentRequest);
5200
+ const requestCookieReadsBeforeRender = countRequestCookieReads();
4705
5201
  let LoadingFallbackComponent = null;
4706
5202
  if (loadingBoundaryEntry) {
4707
5203
  const loadingModule = await this.routeManager.loadRouteModule(
@@ -4838,6 +5334,7 @@ var ServerRenderer = class {
4838
5334
  const hasIsolatedClientBoundaries = routeManifestEntry?.hasIsolatedClientBoundaries === true || layoutHydrationMetadata.some((metadata) => metadata.hasIsolatedClientBoundaries === true);
4839
5335
  req.__FARM_PAGE_PATH__ = route.modulePath;
4840
5336
  req.__FARM_ROUTE__ = pathname;
5337
+ req.__FARM_ROOT_LAYOUT_PATH__ = layouts[0]?.modulePath;
4841
5338
  req.__FARM_IS_CLIENT_COMPONENT__ = isClientComponent;
4842
5339
  req.__FARM_PAGE_SHOULD_HYDRATE__ = shouldHydrate;
4843
5340
  req.__FARM_LAYOUT_SHOULD_HYDRATE__ = shouldHydrateLayout;
@@ -4931,7 +5428,8 @@ var ServerRenderer = class {
4931
5428
  const islandsSegments = Boolean(islands && this.islandValues());
4932
5429
  const keptLayoutCount = islandsSegments && !renderingConfig.ssg && !shouldHydrateLayout && renderedRouteSlots.length === 0 ? countFarmKeptLayouts(requestHeader(req, "f-layouts"), layouts, params) : 0;
4933
5430
  let keptLayouts = keptLayoutCount > 1 ? keptLayoutCount : 0;
4934
- if (keptLayouts > 0) {
5431
+ const keptRoot = this.config.root || process.cwd();
5432
+ if (keptLayouts > 0 && !layouts.slice(0, keptLayouts).every((layout) => canFarmSkipKeptLayoutRender(layout.modulePath, keptRoot))) {
4935
5433
  let keptElement = null;
4936
5434
  for (let i = keptLayouts - 1; i >= 0; i--) {
4937
5435
  const KeptLayout = layoutModules[i]?.default;
@@ -5020,8 +5518,14 @@ var ServerRenderer = class {
5020
5518
  wrappedElement
5021
5519
  );
5022
5520
  }
5521
+ if ((isClientComponent || shouldHydrate) && !shouldHydrateLayout && this.reactRenderer) {
5522
+ wrappedElement = this.reactRenderer.markLayoutPosition(wrappedElement);
5523
+ }
5023
5524
  const integratedElement = await this.wrapWithIntegrationProviders(wrappedElement);
5024
5525
  const pprHeaders = renderingConfig.ppr ? this.getPPRHeaders(pprShellOptions ? "miss" : "bypass", renderingConfig.revalidate) : void 0;
5526
+ if (pprHeaders && pprShellOptions && pprVisitorCookies) {
5527
+ pprHeaders["Cache-Control"] = "private, no-store";
5528
+ }
5025
5529
  await this.renderWithSSR(
5026
5530
  integratedElement,
5027
5531
  req,
@@ -5054,7 +5558,26 @@ var ServerRenderer = class {
5054
5558
  });
5055
5559
  return;
5056
5560
  }
5057
- return this.cachePPRShell(pprShellOptions, html);
5561
+ const renderReadCookies = countRequestCookieReads() !== requestCookieReadsBeforeRender;
5562
+ if (renderReadCookies && pprVisitorCookies) {
5563
+ emitFarmEvent({
5564
+ type: "ppr.shell.bypass",
5565
+ route: pathname,
5566
+ reason: "cookie"
5567
+ });
5568
+ emitFarmEvent({
5569
+ type: "cache.bypass",
5570
+ route: pathname,
5571
+ reason: "cookie"
5572
+ });
5573
+ return;
5574
+ }
5575
+ return this.cachePPRShell(
5576
+ pprShellOptions,
5577
+ html,
5578
+ pprShellWrite,
5579
+ !renderReadCookies
5580
+ );
5058
5581
  } : void 0
5059
5582
  }
5060
5583
  );
@@ -5145,13 +5668,16 @@ var ServerRenderer = class {
5145
5668
  pluginExposedContext,
5146
5669
  error,
5147
5670
  statusCode: errorStatus,
5148
- errorModulePath: errorBoundaryEntry.modulePath
5671
+ errorModulePath: errorBoundaryEntry.modulePath,
5672
+ errorPattern: errorBoundaryEntry.pattern
5149
5673
  });
5150
5674
  if (rendered) {
5151
5675
  return;
5152
5676
  }
5153
5677
  }
5154
5678
  await this.renderError(req, res, error, errorStatus);
5679
+ } finally {
5680
+ pprShellWrite?.release();
5155
5681
  }
5156
5682
  }
5157
5683
  async wrapWithIntegrationProviders(element) {
@@ -5176,11 +5702,11 @@ var ServerRenderer = class {
5176
5702
  if (isFarmIntegrationProviderComponentReference(provider.component)) {
5177
5703
  providerSourceModule = provider.component.module;
5178
5704
  const providerModuleId = provider.component.module.startsWith(".") ? toViteModuleId(
5179
- path9.resolve(this.config.root, provider.component.module),
5705
+ path10.resolve(this.config.root, provider.component.module),
5180
5706
  this.config.root
5181
5707
  ) : provider.component.module;
5182
5708
  const providerModule = this.viteServer ? await loadFarmDevModule(this.viteServer, providerModuleId) : await importRuntimeModule(
5183
- provider.component.module.startsWith(".") ? pathToFileURL2(path9.resolve(this.config.root, provider.component.module)).href : provider.component.module
5709
+ provider.component.module.startsWith(".") ? pathToFileURL2(path10.resolve(this.config.root, provider.component.module)).href : provider.component.module
5184
5710
  );
5185
5711
  ProviderComponent = providerModule[provider.component.export || "default"];
5186
5712
  } else if (typeof provider.component === "function") {
@@ -5449,7 +5975,7 @@ var ServerRenderer = class {
5449
5975
  logger.warn(`Could not read metadata for ${pattern} in sitemap.xml: ${error}`);
5450
5976
  return void 0;
5451
5977
  }),
5452
- fs5.promises.stat(route.modulePath).catch(() => void 0)
5978
+ fs7.promises.stat(route.modulePath).catch(() => void 0)
5453
5979
  ]);
5454
5980
  if (await this.isAgentPageNoIndex(pattern, module?.metadata)) return null;
5455
5981
  return { pattern, module, lastModified: stat?.mtime.toISOString() };
@@ -5536,7 +6062,7 @@ var ServerRenderer = class {
5536
6062
  const server = this.getDefaultMCPServer();
5537
6063
  const request2 = getCurrentRequestOrNull() ?? createWebRequestFromFarmRequest(req, { trustProxy: this.config.server?.trustProxy });
5538
6064
  try {
5539
- const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-HX4F4VKN.mjs");
6065
+ const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-PJKZHYSA.mjs");
5540
6066
  const origin = new URL(request2.url).origin;
5541
6067
  const i18n = this.i18nRuntime?.config;
5542
6068
  const metadataBase = await this.getRootMetadataBase();
@@ -5752,7 +6278,7 @@ var ServerRenderer = class {
5752
6278
  res.end();
5753
6279
  return;
5754
6280
  }
5755
- res.write(await fs5.promises.readFile(image.modulePath));
6281
+ res.write(await fs7.promises.readFile(image.modulePath));
5756
6282
  res.end();
5757
6283
  }
5758
6284
  async renderRouteErrorBoundary(req, res, options) {
@@ -5781,8 +6307,14 @@ var ServerRenderer = class {
5781
6307
  }
5782
6308
  });
5783
6309
  let wrapped = errorElement;
6310
+ const boundaryLayouts = options.errorPattern === void 0 ? options.layouts : options.layouts.filter(
6311
+ (layout) => !("pattern" in layout) || routeBoundaryCoversDirectory(
6312
+ layout.pattern,
6313
+ options.errorPattern
6314
+ )
6315
+ );
5784
6316
  const layoutModules = await Promise.all(
5785
- options.layouts.map((layout) => this.routeManager.loadLayoutModule(layout.modulePath))
6317
+ boundaryLayouts.map((layout) => this.routeManager.loadLayoutModule(layout.modulePath))
5786
6318
  );
5787
6319
  for (let i = layoutModules.length - 1; i >= 0; i--) {
5788
6320
  const LayoutComponent = layoutModules[i].default;
@@ -5903,7 +6435,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
5903
6435
  getTheme()
5904
6436
  );
5905
6437
  themeDocument.head = farmScripts(themeDocument.head);
5906
- const fullDocument = extractFarmFullDocument(content);
6438
+ const fullDocument = extractFarmFullDocument(markFarmDocumentLayouts(content));
5907
6439
  let html;
5908
6440
  if (fullDocument) {
5909
6441
  const shouldReplaceLayoutTitle = hasExplicitTitle || rendererHasTitle;
@@ -5985,12 +6517,11 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
5985
6517
  * this up front keeps a route's first request on the buffered path too; a layout this cannot
5986
6518
  * call (async, a class, or one using hooks) falls back to detection from the stream.
5987
6519
  */
5988
- async rootLayoutRendersDocument() {
5989
- if (typeof this.routeManager.getLayouts !== "function") return false;
5990
- const rootLayout = this.routeManager.getLayouts().get("/");
5991
- if (!rootLayout) return false;
6520
+ async rootLayoutRendersDocument(req) {
6521
+ const modulePath = req.__FARM_ROOT_LAYOUT_PATH__ ?? (typeof this.routeManager.getLayouts === "function" ? this.routeManager.getLayouts().get("/")?.modulePath : void 0);
6522
+ if (!modulePath) return false;
5992
6523
  try {
5993
- const Layout = (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).default;
6524
+ const Layout = (await this.routeManager.loadLayoutModule(modulePath)).default;
5994
6525
  if (typeof Layout !== "function" || Layout.prototype?.isReactComponent || Layout.constructor?.name === "AsyncFunction") {
5995
6526
  return false;
5996
6527
  }
@@ -6015,7 +6546,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6015
6546
  async renderWithSSR(element, req, res, clearMiddlewareData, options = {}) {
6016
6547
  const renderToPipeableStream = this.rendererRuntime.renderToPipeableStream;
6017
6548
  const fullDocumentRouteKey = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
6018
- const streamDocument = fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument();
6549
+ const streamDocument = fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument(req);
6019
6550
  if (!renderToPipeableStream || _isFarmMarkdownPageCheck(req.headers?.[FARM_MARKDOWN_PAGE_CHECK_HEADER]) || streamDocument && (options.captureStaticShell || !isReactRenderer(this.config.renderer))) {
6020
6551
  return this.renderBufferedSSR(element, req, res, clearMiddlewareData, options);
6021
6552
  }
@@ -6191,7 +6722,9 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6191
6722
  const documentTransform = streamDocument ? createFarmStreamedDocumentTransform(
6192
6723
  (opening) => withEarlyClient(
6193
6724
  openFarmStreamedDocument(
6194
- hasExplicitTitle ? removeFarmDocumentTitles(opening) : opening,
6725
+ markFarmDocumentLayouts(
6726
+ hasExplicitTitle ? removeFarmDocumentTitles(opening) : opening
6727
+ ),
6195
6728
  {
6196
6729
  fallbackIcon: !hasFavicon,
6197
6730
  viewport: viewportTags,
@@ -6530,13 +7063,13 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6530
7063
  res.end(createFarmMarkdownErrorBody(404, pathname, this.config.basePath || "/"));
6531
7064
  return;
6532
7065
  }
6533
- const appDir = path9.join(this.config.root, this.config.srcDir, "app");
7066
+ const appDir = path10.join(this.config.root, this.config.srcDir, "app");
6534
7067
  const notFoundExtensions = getFarmRendererComponentExtensions(this.config.renderer);
6535
7068
  let layoutModule = null;
6536
7069
  try {
6537
7070
  for (const ext of notFoundExtensions) {
6538
- const layoutPath = path9.join(appDir, `layout${ext}`);
6539
- if (fs5.existsSync(layoutPath)) {
7071
+ const layoutPath = path10.join(appDir, `layout${ext}`);
7072
+ if (fs7.existsSync(layoutPath)) {
6540
7073
  layoutModule = await this.routeManager.loadLayoutModule(layoutPath);
6541
7074
  break;
6542
7075
  }
@@ -6629,7 +7162,8 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6629
7162
  getI18nAlternateOptions(req, metadata) {
6630
7163
  return {
6631
7164
  metadataBase: metadata?.metadataBase,
6632
- origin: req ? resolveFarmRequestURL(req, { trustProxy: this.config.server?.trustProxy }).origin : void 0
7165
+ origin: req ? resolveFarmRequestURL(req, { trustProxy: this.config.server?.trustProxy }).origin : void 0,
7166
+ languages: metadata?.alternates?.languages
6633
7167
  };
6634
7168
  }
6635
7169
  createFullHTML(content, isClientComponent = false, requestPath = "/", metadataHead, alternates = {}) {
@@ -6658,7 +7192,7 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
6658
7192
  this.rendererRuntime.generateHydrationScript?.() || ""
6659
7193
  );
6660
7194
  const viewportTags = renderViewportHead(alternates.metadata?.viewport);
6661
- const fullDocument = extractFarmFullDocument(content);
7195
+ const fullDocument = extractFarmFullDocument(markFarmDocumentLayouts(content));
6662
7196
  if (fullDocument) {
6663
7197
  return composeFarmFullDocument(
6664
7198
  metadataHead ? removeFarmDocumentTitles(fullDocument) : fullDocument,
@@ -6756,7 +7290,7 @@ ${clientScript}
6756
7290
  };
6757
7291
 
6758
7292
  // src/app.ts
6759
- import path10 from "path";
7293
+ import path11 from "path";
6760
7294
  var defaultDocsConfig = {
6761
7295
  enabled: false,
6762
7296
  entry: "/docs",
@@ -6886,7 +7420,7 @@ var FarmApp = class {
6886
7420
  const files = [
6887
7421
  ...this.routeManager.getRoutes().values(),
6888
7422
  ...this.routeManager.getLayouts().values()
6889
- ].map((entry) => path10.relative(this.config.root, entry.modulePath).split(path10.sep).join("/"));
7423
+ ].map((entry) => path11.relative(this.config.root, entry.modulePath).split(path11.sep).join("/"));
6890
7424
  if (files.length === 0) return;
6891
7425
  throw new Error(
6892
7426
  `This app sets \`renderer: false\`, which serves API routes only, but it has pages or layouts:
@@ -6912,7 +7446,7 @@ var FarmApp = class {
6912
7446
  }
6913
7447
  const componentExtensions = getFarmRendererComponentExtensions(this.config.renderer);
6914
7448
  const rootLayoutPaths = appDirs.flatMap(
6915
- (appDir) => componentExtensions.map((extension) => path10.join(appDir, `layout${extension}`))
7449
+ (appDir) => componentExtensions.map((extension) => path11.join(appDir, `layout${extension}`))
6916
7450
  );
6917
7451
  const hasRootLayout = await Promise.all(rootLayoutPaths.map((p) => fileExists(p))).then(
6918
7452
  (results) => results.some(Boolean)
@@ -6975,14 +7509,26 @@ function resolveFarmImageServerRuntime(images, preset) {
6975
7509
  return provider === "cloudflare" || provider === "auto" && cloudflarePreset ? "cloudflare" : "node";
6976
7510
  }
6977
7511
 
7512
+ // src/markdown-source-path.ts
7513
+ import path12 from "path";
7514
+ function toBakedMarkdownSourcePath(root, filePath) {
7515
+ if (!filePath) return "";
7516
+ if (!path12.isAbsolute(filePath)) return filePath.split(path12.sep).join("/");
7517
+ const relative3 = path12.relative(root, filePath);
7518
+ if (!relative3 || relative3.startsWith("..") || path12.isAbsolute(relative3)) {
7519
+ return path12.basename(filePath);
7520
+ }
7521
+ return relative3.split(path12.sep).join("/");
7522
+ }
7523
+
6978
7524
  // src/app-manifest-packages.ts
6979
- import fs6 from "fs";
6980
- import path11 from "path";
7525
+ import fs8 from "fs";
7526
+ import path13 from "path";
6981
7527
  var FARM_PACKAGE = /^@(?:farm\.js|farming-labs)\/[a-z0-9._-]+$/;
6982
7528
  function resolveFarmAppPackages(root) {
6983
7529
  let manifest;
6984
7530
  try {
6985
- manifest = JSON.parse(fs6.readFileSync(path11.join(root, "package.json"), "utf8"));
7531
+ manifest = JSON.parse(fs8.readFileSync(path13.join(root, "package.json"), "utf8"));
6986
7532
  } catch {
6987
7533
  return {};
6988
7534
  }
@@ -6997,13 +7543,13 @@ function resolveFarmAppPackages(root) {
6997
7543
  for (let dir = root; ; ) {
6998
7544
  try {
6999
7545
  const { version } = JSON.parse(
7000
- fs6.readFileSync(path11.join(dir, "node_modules", name, "package.json"), "utf8")
7546
+ fs8.readFileSync(path13.join(dir, "node_modules", name, "package.json"), "utf8")
7001
7547
  );
7002
7548
  if (typeof version === "string" && /^[0-9A-Za-z.+-]{1,64}$/.test(version))
7003
7549
  versions[name] = version;
7004
7550
  break;
7005
7551
  } catch {
7006
- const parent = path11.dirname(dir);
7552
+ const parent = path13.dirname(dir);
7007
7553
  if (parent === dir) break;
7008
7554
  dir = parent;
7009
7555
  }
@@ -7013,9 +7559,9 @@ function resolveFarmAppPackages(root) {
7013
7559
  }
7014
7560
 
7015
7561
  // src/app-manifest-webmcp.ts
7016
- import fs7 from "fs";
7562
+ import fs9 from "fs";
7017
7563
  import { createRequire as createRequire2 } from "module";
7018
- import path12 from "path";
7564
+ import path14 from "path";
7019
7565
  import { globSync } from "tinyglobby";
7020
7566
  var WEBMCP_CLIENT = "@farm.js/webmcp/client";
7021
7567
  var DEFINERS = /* @__PURE__ */ new Set(["defineWebMCPTool", "registerWebMCPTool", "registerWebMCPTools"]);
@@ -7033,7 +7579,7 @@ var LANGS = {
7033
7579
  cjs: "jsx",
7034
7580
  jsx: "jsx"
7035
7581
  };
7036
- var parseAst2;
7582
+ var parseAst3;
7037
7583
  function staticValue(node) {
7038
7584
  if (!node) return NOT_STATIC;
7039
7585
  switch (node.type) {
@@ -7110,13 +7656,13 @@ function toolFromObject(object) {
7110
7656
  }
7111
7657
  function findFarmWebMCPTools(code, filename = "module.tsx") {
7112
7658
  if (!code.includes(WEBMCP_CLIENT)) return [];
7113
- const lang = LANGS[path12.extname(filename).slice(1)] ?? "tsx";
7114
- parseAst2 ?? (parseAst2 = createRequire2(typeof __filename === "string" ? __filename : import.meta.url)(
7659
+ const lang = LANGS[path14.extname(filename).slice(1)] ?? "tsx";
7660
+ parseAst3 ?? (parseAst3 = createRequire2(typeof __filename === "string" ? __filename : import.meta.url)(
7115
7661
  "rolldown/parseAst"
7116
7662
  ).parseAst);
7117
7663
  let program;
7118
7664
  try {
7119
- program = parseAst2(code, { lang });
7665
+ program = parseAst3(code, { lang });
7120
7666
  } catch {
7121
7667
  return [];
7122
7668
  }
@@ -7157,7 +7703,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
7157
7703
  }
7158
7704
  var cache = /* @__PURE__ */ new Map();
7159
7705
  function collectFarmWebMCPTools(root, srcDir = "src") {
7160
- const base = path12.resolve(root, srcDir);
7706
+ const base = path14.resolve(root, srcDir);
7161
7707
  let files;
7162
7708
  try {
7163
7709
  files = globSync("**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}", {
@@ -7174,7 +7720,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
7174
7720
  for (const file of files.sort()) {
7175
7721
  let mtimeMs;
7176
7722
  try {
7177
- mtimeMs = fs7.statSync(file).mtimeMs;
7723
+ mtimeMs = fs9.statSync(file).mtimeMs;
7178
7724
  } catch {
7179
7725
  continue;
7180
7726
  }
@@ -7182,7 +7728,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
7182
7728
  if (!entry || entry.mtimeMs !== mtimeMs) {
7183
7729
  let code = "";
7184
7730
  try {
7185
- code = fs7.readFileSync(file, "utf8");
7731
+ code = fs9.readFileSync(file, "utf8");
7186
7732
  } catch {
7187
7733
  }
7188
7734
  entry = { mtimeMs, tools: findFarmWebMCPTools(code, file) };
@@ -7198,8 +7744,8 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
7198
7744
  }
7199
7745
 
7200
7746
  // src/client-cache-persistence-build.ts
7201
- import fs8 from "fs";
7202
- import path13 from "path";
7747
+ import fs10 from "fs";
7748
+ import path15 from "path";
7203
7749
  var ADAPTER_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
7204
7750
  function resolveFarmClientCacheAdapterEntry(root, cache2) {
7205
7751
  const client = cache2?.client;
@@ -7210,7 +7756,7 @@ function resolveFarmClientCacheAdapterEntry(root, cache2) {
7210
7756
  'cache.client.adapter must be a module path string, for example "./src/cache-adapter".'
7211
7757
  );
7212
7758
  }
7213
- const resolved = path13.resolve(root, adapter);
7759
+ const resolved = path15.resolve(root, adapter);
7214
7760
  const found = resolveAdapterFile(resolved);
7215
7761
  if (!found) {
7216
7762
  throw new Error(
@@ -7223,10 +7769,10 @@ function resolveFarmClientCacheAdapterEntry(root, cache2) {
7223
7769
  return { importPath: found.replace(/\\/g, "/"), options };
7224
7770
  }
7225
7771
  function resolveAdapterFile(resolved) {
7226
- if (fs8.existsSync(resolved) && fs8.statSync(resolved).isFile()) return resolved;
7772
+ if (fs10.existsSync(resolved) && fs10.statSync(resolved).isFile()) return resolved;
7227
7773
  for (const extension of ADAPTER_EXTENSIONS) {
7228
7774
  const candidate = `${resolved}.${extension}`;
7229
- if (fs8.existsSync(candidate) && fs8.statSync(candidate).isFile()) return candidate;
7775
+ if (fs10.existsSync(candidate) && fs10.statSync(candidate).isFile()) return candidate;
7230
7776
  }
7231
7777
  return void 0;
7232
7778
  }
@@ -7269,14 +7815,27 @@ function farmChildrenToArray(children) {
7269
7815
 
7270
7816
  function unwrapFarmDocumentElement(node) {
7271
7817
  if (!React.isValidElement(node) || node.type !== "html") return undefined;
7272
- const children = farmChildrenToArray(node.props.children);
7273
- const body = children.find(function (child) {
7274
- return React.isValidElement(child) && child.type === "body";
7275
- });
7276
- if (body) return body.props.children === undefined ? null : body.props.children;
7277
- return children.filter(function (child) {
7278
- return !(React.isValidElement(child) && child.type === "head");
7279
- });
7818
+ let body;
7819
+ function documentChild(child) {
7820
+ if (React.isValidElement(child)) {
7821
+ if (child.type === "body" && !body) body = child;
7822
+ return child.type === "head" ? null : child;
7823
+ }
7824
+ if (child && typeof child === "object" && typeof child[Symbol.iterator] === "function") {
7825
+ return Array.from(child, documentChild);
7826
+ }
7827
+ return child;
7828
+ }
7829
+ const children = documentChild(node.props.children);
7830
+ if (!body) return farmChildrenToArray(children);
7831
+
7832
+ // React derives useId from the size and index of each sibling array. Keep
7833
+ // the body's original slot, including empty siblings and nested arrays.
7834
+ function bodySlot(child) {
7835
+ if (Array.isArray(child)) return child.map(bodySlot);
7836
+ return child === body ? (body.props.children ?? null) : null;
7837
+ }
7838
+ return bodySlot(children);
7280
7839
  }
7281
7840
 
7282
7841
  function farmLayoutBoundaryElement(pattern, content) {
@@ -7575,8 +8134,8 @@ function restoreFarmServerFields(captured, root) {
7575
8134
  `;
7576
8135
 
7577
8136
  // src/utils/hook-filters.ts
7578
- import { realpathSync as realpathSync2 } from "fs";
7579
- import path14 from "path";
8137
+ import { realpathSync } from "fs";
8138
+ import path16 from "path";
7580
8139
  function escapeRegExp(value) {
7581
8140
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
7582
8141
  }
@@ -7586,9 +8145,9 @@ function exactIdPattern(ids) {
7586
8145
  function fileNamePattern(files) {
7587
8146
  const names = /* @__PURE__ */ new Set();
7588
8147
  for (const file of files) {
7589
- names.add(path14.basename(file));
8148
+ names.add(path16.basename(file));
7590
8149
  try {
7591
- names.add(path14.basename(realpathSync2(file)));
8150
+ names.add(path16.basename(realpathSync(file)));
7592
8151
  } catch {
7593
8152
  }
7594
8153
  }
@@ -7596,10 +8155,10 @@ function fileNamePattern(files) {
7596
8155
  }
7597
8156
 
7598
8157
  // src/docs/client-config.ts
7599
- import { realpathSync as realpathSync3 } from "fs";
8158
+ import { realpathSync as realpathSync2 } from "fs";
7600
8159
  import { createRequire as createRequire3 } from "module";
7601
- import path15 from "path";
7602
- var parseAst3;
8160
+ import path17 from "path";
8161
+ var parseAst4;
7603
8162
  function propertyKeyName(property2) {
7604
8163
  if (property2.computed) return void 0;
7605
8164
  const key = property2.key;
@@ -7608,11 +8167,11 @@ function propertyKeyName(property2) {
7608
8167
  return void 0;
7609
8168
  }
7610
8169
  function redactFarmDocsClientConfig(code, filename) {
7611
- parseAst3 ?? (parseAst3 = createRequire3(typeof __filename === "string" ? __filename : import.meta.url)(
8170
+ parseAst4 ?? (parseAst4 = createRequire3(typeof __filename === "string" ? __filename : import.meta.url)(
7612
8171
  "rolldown/parseAst"
7613
8172
  ).parseAst);
7614
- const extension = path15.extname(filename);
7615
- const program = parseAst3(code, {
8173
+ const extension = path17.extname(filename);
8174
+ const program = parseAst4(code, {
7616
8175
  lang: extension === ".tsx" || extension === ".jsx" ? "tsx" : "ts"
7617
8176
  });
7618
8177
  const edits = [];
@@ -7655,7 +8214,7 @@ function isFarmDocsClientConfigModule(id, configModule) {
7655
8214
  const file = id.split("?")[0].replace(/\\/g, "/");
7656
8215
  if (file === configModule) return true;
7657
8216
  try {
7658
- return file === realpathSync3(configModule).replace(/\\/g, "/");
8217
+ return file === realpathSync2(configModule).replace(/\\/g, "/");
7659
8218
  } catch {
7660
8219
  return false;
7661
8220
  }
@@ -7676,8 +8235,57 @@ function farmDocsClientConfigPlugin(configModule) {
7676
8235
  };
7677
8236
  }
7678
8237
 
8238
+ // src/video-player.ts
8239
+ var FARM_VIDEO_PLAYER_HTML = `<!doctype html>
8240
+ <html lang="en">
8241
+ <head>
8242
+ <meta charset="utf-8">
8243
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8244
+ <meta name="robots" content="noindex">
8245
+ <title>Video</title>
8246
+ <style>
8247
+ html, body { height: 100%; margin: 0; background: #000; }
8248
+ video { display: block; width: 100%; height: 100%; object-fit: contain; }
8249
+ </style>
8250
+ </head>
8251
+ <body>
8252
+ <video controls muted playsinline preload="metadata"></video>
8253
+ <script>
8254
+ (() => {
8255
+ const params = new URLSearchParams(location.search);
8256
+ const sameOrigin = (value) => {
8257
+ if (!value) return null;
8258
+ try {
8259
+ const url = new URL(value, location.href);
8260
+ return url.origin === location.origin ? url.href : null;
8261
+ } catch {
8262
+ return null;
8263
+ }
8264
+ };
8265
+ const src = sameOrigin(params.get("src"));
8266
+ if (!src) return;
8267
+ const video = document.querySelector("video");
8268
+ const poster = sameOrigin(params.get("poster"));
8269
+ if (poster) video.poster = poster;
8270
+ video.addEventListener(
8271
+ "loadedmetadata",
8272
+ () => {
8273
+ if (video.duration > 10) return;
8274
+ video.loop = true;
8275
+ // A browser may refuse autoplay; the controls still play it.
8276
+ video.play().catch(() => {});
8277
+ },
8278
+ { once: true },
8279
+ );
8280
+ video.src = src;
8281
+ })();
8282
+ </script>
8283
+ </body>
8284
+ </html>
8285
+ `;
8286
+
7679
8287
  // src/server/vite-config.ts
7680
- import path16 from "path";
8288
+ import path18 from "path";
7681
8289
  var FARM_CLIENT_ENTRY_PATTERN = "**/{page,layout,loading,error,not-found,default}.{js,jsx,ts,tsx}";
7682
8290
  var FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE = [
7683
8291
  "react",
@@ -7704,9 +8312,9 @@ function getFarmClientOptimizeDepsInclude(renderer) {
7704
8312
  );
7705
8313
  }
7706
8314
  function createFarmClientOptimizeDepsEntries(projectRoot, appDirectories) {
7707
- const resolvedProjectRoot = path16.resolve(projectRoot);
8315
+ const resolvedProjectRoot = path18.resolve(projectRoot);
7708
8316
  return appDirectories.map((appDirectory) => {
7709
- const relativeAppDirectory = path16.relative(resolvedProjectRoot, path16.resolve(appDirectory)).replace(/\\/g, "/");
8317
+ const relativeAppDirectory = path18.relative(resolvedProjectRoot, path18.resolve(appDirectory)).replace(/\\/g, "/");
7710
8318
  const prefix = relativeAppDirectory || ".";
7711
8319
  return `${prefix}/${FARM_CLIENT_ENTRY_PATTERN}`;
7712
8320
  });
@@ -7729,7 +8337,7 @@ function createFarmClientOptimizeDepsConfig(entries, renderer) {
7729
8337
  }
7730
8338
  function createFarmSourceAlias(projectRoot, srcDir = "src") {
7731
8339
  return {
7732
- "@": path16.resolve(projectRoot, srcDir)
8340
+ "@": path18.resolve(projectRoot, srcDir)
7733
8341
  };
7734
8342
  }
7735
8343
  function mergeNoExternal(farmValue, userValue) {
@@ -7918,11 +8526,12 @@ export {
7918
8526
  inspectStaticMetadataImage,
7919
8527
  RouteManager,
7920
8528
  createFarmDevClientManifest,
8529
+ farmFontImportsPlugin,
8530
+ mergeFarmFontCss,
7921
8531
  resolveDevGlobalStylesheetHref,
7922
8532
  collectDevStylesheetUrls,
8533
+ farmDevServerStylesheetsPlugin,
7923
8534
  resolveFarmNotFoundComponentPath,
7924
- farmFontImportsPlugin,
7925
- mergeFarmFontCss,
7926
8535
  DEFAULT_NOT_FOUND_STYLES,
7927
8536
  generateFarmIntegrationProviderClientCode,
7928
8537
  generateFarmIntegrationProviderServerModules,
@@ -7930,12 +8539,14 @@ export {
7930
8539
  invalidateFarmRouteRootInferences,
7931
8540
  resolveFarmRouteRootStrategy,
7932
8541
  canBootFarmIslandsClient,
8542
+ canFarmSkipKeptLayoutRender,
7933
8543
  ServerRenderer,
7934
8544
  FarmApp,
7935
8545
  createFarmApp,
7936
8546
  SHARP_INSTALL_HINT,
7937
8547
  resolveFarmImageProviderForRuntime,
7938
8548
  resolveFarmImageServerRuntime,
8549
+ toBakedMarkdownSourcePath,
7939
8550
  resolveFarmAppPackages,
7940
8551
  collectFarmWebMCPTools,
7941
8552
  resolveFarmClientCacheAdapterEntry,
@@ -7950,6 +8561,7 @@ export {
7950
8561
  redactFarmDocsClientConfig,
7951
8562
  isFarmDocsClientConfigModule,
7952
8563
  farmDocsClientConfigPlugin,
8564
+ FARM_VIDEO_PLAYER_HTML,
7953
8565
  createFarmClientOptimizeDepsEntries,
7954
8566
  createFarmClientOptimizeDepsConfig,
7955
8567
  createFarmSourceAlias,