@farm.js/core 0.1.74 → 0.1.75

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 (439) 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-Djvao5eV.d.ts} +24 -2
  4. package/dist/{agent-mcp.d-BEhDfdWc.d.mts → agent-mcp.d-wA13pwmS.d.mts} +24 -2
  5. package/dist/agent-runtime.cjs +7 -7
  6. package/dist/agent-runtime.d.mts +1 -1
  7. package/dist/agent-runtime.d.ts +1 -1
  8. package/dist/agent-runtime.mjs +6 -6
  9. package/dist/analyzer-23GCBYFI.cjs +16 -0
  10. package/dist/{analyzer-2K35LIQZ.mjs → analyzer-LJHMFCDW.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 +3 -3
  17. package/dist/api/node.d.ts +3 -3
  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 +3 -3
  21. package/dist/api/route-manager.d.ts +3 -3
  22. package/dist/api/route-manager.mjs +19 -19
  23. package/dist/api/runtime.cjs +11 -11
  24. package/dist/api/runtime.d.mts +2 -2
  25. package/dist/api/runtime.d.ts +2 -2
  26. package/dist/api/runtime.mjs +10 -10
  27. package/dist/api.cjs +23 -23
  28. package/dist/api.d.mts +4 -4
  29. package/dist/api.d.ts +4 -4
  30. package/dist/api.mjs +22 -22
  31. package/dist/{app-manifest.d-CVEx1CFB.d.ts → app-manifest.d-BukcP_EV.d.ts} +1 -1
  32. package/dist/{app-manifest.d-BcXt2yCx.d.mts → app-manifest.d-DIuqSi9k.d.mts} +1 -1
  33. package/dist/app-markdown.cjs +7 -7
  34. package/dist/app-markdown.d.mts +2 -2
  35. package/dist/app-markdown.d.ts +2 -2
  36. package/dist/app-markdown.mjs +6 -6
  37. package/dist/{app.d-B6i8CSrx.d.ts → app.d-BQqmM6Gy.d.ts} +29 -4
  38. package/dist/{app.d-DowzSmT5.d.mts → app.d-YVuFb10p.d.mts} +29 -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-GWXZS7K5.mjs → chunk-2LKUR5QJ.mjs} +1 -1
  47. package/dist/{chunk-B3XY6FMC.mjs → chunk-2NQ3S2SJ.mjs} +3 -3
  48. package/dist/chunk-2PJVEL56.cjs +90 -0
  49. package/dist/{chunk-4M5ESTJ2.cjs → chunk-2RSVYJT6.cjs} +19 -3
  50. package/dist/{chunk-PG6ZIHKE.cjs → chunk-2YJ4DHTD.cjs} +2 -2
  51. package/dist/{chunk-MGZVDX4R.mjs → chunk-3AJQFVWW.mjs} +3 -3
  52. package/dist/{chunk-DRHHTHA3.mjs → chunk-3GMD2E4Q.mjs} +3 -3
  53. package/dist/{chunk-S3D6SL2V.cjs → chunk-42EUEYW6.cjs} +17 -12
  54. package/dist/{chunk-D2IAYGYA.mjs → chunk-47R7CX4A.mjs} +6 -6
  55. package/dist/{chunk-YQWRBBAA.mjs → chunk-4PWGLPL6.mjs} +1 -1
  56. package/dist/{chunk-7S7AAK2D.mjs → chunk-4QBFYEDC.mjs} +2 -1
  57. package/dist/{chunk-UHAARKF3.mjs → chunk-4T2RB4JA.mjs} +5 -5
  58. package/dist/{chunk-KMYOKQPP.cjs → chunk-4VLXQ55O.cjs} +27 -22
  59. package/dist/{chunk-V6T3UJAH.cjs → chunk-4ZSZI6XL.cjs} +17 -17
  60. package/dist/{chunk-XGJVRPYL.cjs → chunk-52LTENRE.cjs} +3 -3
  61. package/dist/{chunk-RQ4UZJPR.cjs → chunk-5AMH6AFA.cjs} +5 -3
  62. package/dist/{chunk-AYP2YFVN.mjs → chunk-5KAEGBIL.mjs} +75 -42
  63. package/dist/{chunk-FCBUNILW.mjs → chunk-5O3SK3ZC.mjs} +4 -4
  64. package/dist/{chunk-IJFNXP3D.cjs → chunk-5QZT2EQN.cjs} +2 -2
  65. package/dist/{chunk-X2KNHD4B.mjs → chunk-5WFPZG7K.mjs} +8 -8
  66. package/dist/{chunk-TPDKFRQX.cjs → chunk-62DZHPDK.cjs} +16 -11
  67. package/dist/{chunk-DTBRSRTR.cjs → chunk-63EFR2WF.cjs} +6 -5
  68. package/dist/{chunk-2RCCFB2Y.cjs → chunk-6B44ZU5P.cjs} +11 -11
  69. package/dist/{chunk-ZRCGPSUM.cjs → chunk-6D3CJFNU.cjs} +37 -21
  70. package/dist/{chunk-65OS2TOT.cjs → chunk-6DBBMQWT.cjs} +34 -34
  71. package/dist/{chunk-IP2R2TAE.mjs → chunk-6MATGOEF.mjs} +1 -1
  72. package/dist/{chunk-ACAEFEOH.cjs → chunk-7564NP5Z.cjs} +10 -10
  73. package/dist/{chunk-7H45IJWO.mjs → chunk-7DBJ2SWK.mjs} +1 -1
  74. package/dist/chunk-7E4FDO5X.mjs +265 -0
  75. package/dist/{chunk-FPBOAG6N.cjs → chunk-7EOSFIPN.cjs} +3 -3
  76. package/dist/{chunk-DRBXYJZ6.mjs → chunk-7FQFK3OA.mjs} +2 -2
  77. package/dist/{chunk-TUOO6IK3.mjs → chunk-7H2TXT2K.mjs} +11 -1
  78. package/dist/{chunk-A4PWGL46.mjs → chunk-7KDCVSTR.mjs} +4 -4
  79. package/dist/{chunk-GPICBTDV.cjs → chunk-7Q2YWZF7.cjs} +6 -6
  80. package/dist/{chunk-CFG4QERR.cjs → chunk-7Q7UB4TL.cjs} +2 -2
  81. package/dist/chunk-A3LNXQJJ.cjs +265 -0
  82. package/dist/{chunk-BFOMCSZ2.mjs → chunk-A5F55ZFA.mjs} +184 -27
  83. package/dist/{chunk-S6O2L47H.mjs → chunk-AG27TI6Q.mjs} +67 -5
  84. package/dist/{chunk-DC2AXGNZ.mjs → chunk-AM2M56SL.mjs} +1 -1
  85. package/dist/{chunk-JRHGJVJH.mjs → chunk-B5QRNCIE.mjs} +1 -1
  86. package/dist/{chunk-R6Q6VSGU.mjs → chunk-BGUTIQII.mjs} +1 -1
  87. package/dist/{chunk-3OMLZLDE.cjs → chunk-BNCKXPCU.cjs} +44 -0
  88. package/dist/{chunk-35GBGSQZ.cjs → chunk-BNTRXJL4.cjs} +3 -3
  89. package/dist/{chunk-BPAXGCKX.mjs → chunk-BRNPLD22.mjs} +30 -17
  90. package/dist/{chunk-JZGL2PIH.mjs → chunk-CDT7CGQT.mjs} +2 -2
  91. package/dist/{chunk-BNXV3PRM.mjs → chunk-CF74ABRI.mjs} +10 -10
  92. package/dist/chunk-CIY74JLV.cjs +134 -0
  93. package/dist/{chunk-IZ5WOTQP.mjs → chunk-CLM73YYD.mjs} +2 -2
  94. package/dist/{chunk-FGXSWRWA.mjs → chunk-CSAIIMY3.mjs} +1 -1
  95. package/dist/{chunk-EF5AP4CV.cjs → chunk-CYNQPKA4.cjs} +2 -2
  96. package/dist/{chunk-M53MIIXY.mjs → chunk-CZOXZ6WQ.mjs} +1 -1
  97. package/dist/{chunk-ROPMQNCG.mjs → chunk-DASQJ5UD.mjs} +2 -2
  98. package/dist/{chunk-BWFBTTJ5.cjs → chunk-DD22NQFX.cjs} +2 -2
  99. package/dist/{chunk-AL6E63FZ.mjs → chunk-DUSTJ6A5.mjs} +20 -17
  100. package/dist/{chunk-EWIEJQP6.cjs → chunk-DZ3AZ7UK.cjs} +52 -52
  101. package/dist/{chunk-6YFC3ZFX.mjs → chunk-DZXD6CYJ.mjs} +1 -1
  102. package/dist/{chunk-Q4G52OSW.mjs → chunk-EMTN5ABC.mjs} +1 -1
  103. package/dist/{chunk-GK2GBIXD.mjs → chunk-ERT6HQAI.mjs} +8 -3
  104. package/dist/{chunk-ZLRWO5GK.mjs → chunk-F35C3TJZ.mjs} +1 -1
  105. package/dist/{chunk-F244KE2D.cjs → chunk-F4ID7BGO.cjs} +33 -30
  106. package/dist/{chunk-C7GJDVN4.mjs → chunk-F7MJWW6A.mjs} +1 -1
  107. package/dist/{chunk-WTTJ2YS2.mjs → chunk-FCAYYLAE.mjs} +18 -2
  108. package/dist/{chunk-PWKAX5MS.cjs → chunk-FDZZ6K3N.cjs} +6 -6
  109. package/dist/{chunk-MHLNWRCJ.cjs → chunk-FE6KYDHC.cjs} +3 -3
  110. package/dist/{chunk-PTLXHRJZ.mjs → chunk-FLMALEY2.mjs} +37 -4
  111. package/dist/{chunk-GRHSQYD4.cjs → chunk-G7B6NU4X.cjs} +11 -11
  112. package/dist/{chunk-E4T7WJJN.mjs → chunk-GAAK3HDZ.mjs} +28 -7
  113. package/dist/{chunk-QMNWKQL4.cjs → chunk-GC5ROI3A.cjs} +4 -4
  114. package/dist/{chunk-JXIYH2NO.cjs → chunk-GCJ4GNMC.cjs} +4 -4
  115. package/dist/{chunk-KNEYWPZV.mjs → chunk-GFXKO4UW.mjs} +42 -10
  116. package/dist/{chunk-AU5UPNOD.mjs → chunk-GLF44JKY.mjs} +3 -3
  117. package/dist/{chunk-GUZC226X.mjs → chunk-GLVDXRG2.mjs} +1 -1
  118. package/dist/{chunk-FEQ72ZHD.mjs → chunk-GNY7BO7R.mjs} +6 -6
  119. package/dist/{chunk-OWQV6MLM.cjs → chunk-GYJT2U7J.cjs} +2 -1
  120. package/dist/{chunk-XZPI44Q7.cjs → chunk-H7OFZJCV.cjs} +8 -8
  121. package/dist/{chunk-IG4IQMIW.mjs → chunk-H7QY7ZE4.mjs} +1 -1
  122. package/dist/{chunk-2TZ3F6TN.cjs → chunk-HFJLMALC.cjs} +25 -25
  123. package/dist/{chunk-CROAFCMW.mjs → chunk-HONTCUK6.mjs} +1 -1
  124. package/dist/{chunk-7PJARAQQ.mjs → chunk-HQ2VAJLW.mjs} +1 -1
  125. package/dist/{chunk-LHFGTR7F.mjs → chunk-HT2SZKXG.mjs} +92 -10
  126. package/dist/{chunk-6JEXH7N6.mjs → chunk-HV2WZFUW.mjs} +1 -1
  127. package/dist/{chunk-ENYBDM4U.cjs → chunk-HVJ7IACB.cjs} +15 -7
  128. package/dist/{chunk-WS4SLJW5.mjs → chunk-IDOUCM2X.mjs} +142 -170
  129. package/dist/{chunk-FN5UEC7I.mjs → chunk-IG2JE6WJ.mjs} +1 -1
  130. package/dist/{chunk-MQ4DYVFS.cjs → chunk-IIHZ2BEE.cjs} +3 -3
  131. package/dist/{chunk-56HHUSR5.cjs → chunk-IK33N2AN.cjs} +1281 -685
  132. package/dist/{chunk-RSL3YFJG.cjs → chunk-IVBDRAOR.cjs} +1 -1
  133. package/dist/{chunk-FNWL5DMG.cjs → chunk-IXO6O2EL.cjs} +6 -6
  134. package/dist/{chunk-B5WZP3T3.cjs → chunk-IYFBLWXU.cjs} +41 -23
  135. package/dist/{chunk-R4BWNP73.mjs → chunk-JA6RML7C.mjs} +3 -3
  136. package/dist/{chunk-JSUVQ5HG.cjs → chunk-JHZ6HULQ.cjs} +12 -9
  137. package/dist/{chunk-NXGQIXR7.cjs → chunk-JNZDTE75.cjs} +313 -156
  138. package/dist/{chunk-KWUZJZ23.mjs → chunk-JRBWBMP2.mjs} +4 -3
  139. package/dist/{chunk-YH33PZ3K.mjs → chunk-K6DXKHFE.mjs} +1 -1
  140. package/dist/{chunk-AXVRUDMB.cjs → chunk-K6PGK7DC.cjs} +2 -2
  141. package/dist/{chunk-72NTEYCX.mjs → chunk-KHS3T3E5.mjs} +15 -10
  142. package/dist/{chunk-D4TYE6MY.cjs → chunk-KPYQ32BA.cjs} +2 -2
  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-BIX46FTI.mjs → chunk-MFU7SXAB.mjs} +10 -2
  151. package/dist/{chunk-YTVSWXEZ.cjs → chunk-ML4TOUZP.cjs} +76 -43
  152. package/dist/{chunk-ZD7JUTBY.mjs → chunk-NLATR3T3.mjs} +2 -2
  153. package/dist/{chunk-P3EZKU6L.cjs → chunk-NPGXX7HN.cjs} +37 -37
  154. package/dist/{chunk-3BUJIPKE.cjs → chunk-NSNQLBHR.cjs} +2 -2
  155. package/dist/chunk-NUWUEXUD.mjs +55 -0
  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-JI6N4W2I.mjs → chunk-OFIFRB62.mjs} +813 -217
  160. package/dist/{chunk-CXQZQK6R.mjs → chunk-OVUU2RCQ.mjs} +2 -2
  161. package/dist/{chunk-Q3MVNRAO.cjs → chunk-OZARLCYQ.cjs} +1005 -582
  162. package/dist/{chunk-HBLYSWIJ.cjs → chunk-PBJ7MEOV.cjs} +9 -9
  163. package/dist/{chunk-4AB62NMW.cjs → chunk-PBQGIA27.cjs} +2 -2
  164. package/dist/{chunk-RBRIKT6B.mjs → chunk-PDACTAVX.mjs} +3 -3
  165. package/dist/{chunk-AO5IRA2N.mjs → chunk-PE2LEWXA.mjs} +6 -3
  166. package/dist/{chunk-VZKCGHWC.cjs → chunk-PG7J7XYT.cjs} +6 -6
  167. package/dist/{chunk-MMK4MZUN.mjs → chunk-PKXGFQZS.mjs} +1 -1
  168. package/dist/{chunk-NKETXVKP.mjs → chunk-PL7MCYYD.mjs} +32 -14
  169. package/dist/chunk-PWHF2C6A.mjs +134 -0
  170. package/dist/{chunk-JWHRVBCZ.cjs → chunk-Q2EKSSEG.cjs} +21 -21
  171. package/dist/{chunk-EHJOSIXM.cjs → chunk-QDHR54S6.cjs} +11 -11
  172. package/dist/{chunk-YWDRWG4L.mjs → chunk-QGYHE6VJ.mjs} +872 -449
  173. package/dist/{chunk-ZOYKJBP5.cjs → chunk-QKW6DLDT.cjs} +2 -2
  174. package/dist/{chunk-3ODLJRA6.mjs → chunk-QSLGE2ZC.mjs} +1 -1
  175. package/dist/{chunk-FSODPZRT.cjs → chunk-QUEYL2WM.cjs} +10 -10
  176. package/dist/{chunk-ZDAEHG2O.cjs → chunk-QYOAGT3E.cjs} +3 -3
  177. package/dist/{chunk-VKLV7GF4.mjs → chunk-R5X7FDOG.mjs} +1 -1
  178. package/dist/{chunk-O47W53D3.cjs → chunk-RDADQG5S.cjs} +7 -77
  179. package/dist/chunk-RDSHEHBA.mjs +82 -0
  180. package/dist/{chunk-K3RU5MOR.mjs → chunk-RK4MGL6Q.mjs} +1 -1
  181. package/dist/{chunk-LRB5OVRT.cjs → chunk-RKQOMG2X.cjs} +2 -2
  182. package/dist/chunk-RQRTH57V.cjs +82 -0
  183. package/dist/{chunk-MUITBU5Z.mjs → chunk-S7QEQCVV.mjs} +2 -2
  184. package/dist/{chunk-HKZVC5GP.cjs → chunk-SFSTZ7TB.cjs} +8 -8
  185. package/dist/{chunk-ZZGANFQH.cjs → chunk-SX535SU5.cjs} +12 -12
  186. package/dist/{chunk-NLBK37HI.cjs → chunk-SXXSQVKK.cjs} +4 -4
  187. package/dist/{chunk-ELJQWUAR.mjs → chunk-SYPEMXW2.mjs} +2 -2
  188. package/dist/{chunk-XXKMAHYE.mjs → chunk-TFEODQLG.mjs} +1 -1
  189. package/dist/{chunk-BSJMWCWM.cjs → chunk-TZ2YPXLB.cjs} +7 -7
  190. package/dist/{chunk-OEL5EPOJ.mjs → chunk-UD6KTSJS.mjs} +6 -76
  191. package/dist/{chunk-2EVESLP3.mjs → chunk-UJIBSFUE.mjs} +4 -4
  192. package/dist/chunk-UNOXV37V.cjs +55 -0
  193. package/dist/{chunk-H2ZJ35NW.mjs → chunk-UOE6ZZZP.mjs} +1 -1
  194. package/dist/{chunk-O6K4G7YA.mjs → chunk-URQW27KO.mjs} +10 -5
  195. package/dist/chunk-VDQZV6BX.mjs +17 -0
  196. package/dist/{chunk-2DOI6HLJ.cjs → chunk-VJ6L7TII.cjs} +3 -3
  197. package/dist/{chunk-QL3YZTGZ.cjs → chunk-VJI2LWTL.cjs} +2 -2
  198. package/dist/{chunk-7RKHXF4P.mjs → chunk-WGNGM6MJ.mjs} +2 -2
  199. package/dist/{chunk-77SVUQM5.cjs → chunk-WHCNJVYU.cjs} +10 -10
  200. package/dist/{chunk-DM2YGTRH.cjs → chunk-WJ5CCQBM.cjs} +23 -23
  201. package/dist/chunk-WKVYF2B5.cjs +17 -0
  202. package/dist/{chunk-MKQ27TGW.cjs → chunk-WRWJ7IWT.cjs} +7 -7
  203. package/dist/{chunk-Y4FEQBKY.cjs → chunk-WW62HKA2.cjs} +47 -26
  204. package/dist/{chunk-XVSBALOY.cjs → chunk-X3Y6JWJG.cjs} +3 -3
  205. package/dist/{chunk-O2A6HE76.cjs → chunk-XGDI4OUB.cjs} +103 -21
  206. package/dist/{chunk-LIQJYEQP.cjs → chunk-XRFGOYXG.cjs} +4 -4
  207. package/dist/{chunk-42KMUIWZ.cjs → chunk-XX6ZA2IO.cjs} +3 -3
  208. package/dist/{chunk-6IOZPJ3I.cjs → chunk-Y3DO7BIJ.cjs} +69 -7
  209. package/dist/{chunk-L5JDKFMQ.cjs → chunk-YBXIVQCE.cjs} +4 -4
  210. package/dist/{chunk-JZ43UD6S.mjs → chunk-YCNKS6SD.mjs} +12 -12
  211. package/dist/{chunk-FYV6DTAG.cjs → chunk-YL7BKHYE.cjs} +538 -566
  212. package/dist/{chunk-G7S6XG6X.cjs → chunk-YN7G22MP.cjs} +6 -6
  213. package/dist/{chunk-VKRMO3EZ.cjs → chunk-YRXPDKMM.cjs} +10 -10
  214. package/dist/{chunk-VFPFXMTF.mjs → chunk-YSTKSZD2.mjs} +1 -1
  215. package/dist/{chunk-QDWMCFTH.mjs → chunk-YT2ZMLXK.mjs} +1 -1
  216. package/dist/{chunk-EMRYJG4U.cjs → chunk-YTNE4KGC.cjs} +3 -3
  217. package/dist/{chunk-E7QOEV5Z.cjs → chunk-YUCU6XB4.cjs} +4 -4
  218. package/dist/{chunk-NLRAQXAA.mjs → chunk-YVVY276M.mjs} +1 -1
  219. package/dist/{chunk-MQ5HA7H2.mjs → chunk-Z2FFLTF5.mjs} +3 -3
  220. package/dist/{chunk-JSDV2NUN.mjs → chunk-Z3QXQN4U.mjs} +1 -1
  221. package/dist/{chunk-HRQV5Q3J.mjs → chunk-Z4IRG4RG.mjs} +96 -9
  222. package/dist/{chunk-JOECBGY7.mjs → chunk-ZEWWZJPZ.mjs} +3 -1
  223. package/dist/{chunk-2GQBBOFH.mjs → chunk-ZIAWO6BC.mjs} +11 -1
  224. package/dist/{chunk-WH3PBJS7.cjs → chunk-ZIOFRBIU.cjs} +100 -13
  225. package/dist/{chunk-3OJNNCDL.cjs → chunk-ZNXU4E6A.cjs} +8 -8
  226. package/dist/{chunk-KIRIFO6T.mjs → chunk-ZO6TOLHL.mjs} +44 -0
  227. package/dist/{chunk-737MIVX3.cjs → chunk-ZPCZWEU3.cjs} +24 -24
  228. package/dist/{chunk-NET6PBUH.cjs → chunk-ZV76IQG7.cjs} +2 -2
  229. package/dist/{client-component.d-edV76QvU.d.mts → client-component.d-BeqVuqy2.d.mts} +2 -2
  230. package/dist/{client-component.d-DYOwmq0c.d.ts → client-component.d-CZ1NpHAY.d.ts} +2 -2
  231. package/dist/{client-plugins.d-DwvqqGsU.d.mts → client-plugins.d-ChceYO9t.d.mts} +24 -3
  232. package/dist/{client-plugins.d-BmJYW2FY.d.ts → client-plugins.d-D9kWC0QB.d.ts} +24 -3
  233. package/dist/client-plugins.d.mts +1 -1
  234. package/dist/client-plugins.d.ts +1 -1
  235. package/dist/client.cjs +15 -13
  236. package/dist/client.d.mts +6 -6
  237. package/dist/client.d.ts +6 -6
  238. package/dist/client.mjs +14 -12
  239. package/dist/config.d.mts +1 -1
  240. package/dist/config.d.ts +1 -1
  241. package/dist/cron.cjs +4 -4
  242. package/dist/cron.mjs +3 -3
  243. package/dist/desktop.d.mts +2 -2
  244. package/dist/desktop.d.ts +2 -2
  245. package/dist/{devtools-WPX62NG2.mjs → devtools-B3W3DLPG.mjs} +18 -18
  246. package/dist/{devtools-YMDS7PUA.cjs → devtools-T5I2WHRX.cjs} +20 -20
  247. package/dist/docs.cjs +27 -21
  248. package/dist/docs.d.mts +17 -3
  249. package/dist/docs.d.ts +17 -3
  250. package/dist/docs.mjs +26 -20
  251. package/dist/environment/vite.cjs +6 -6
  252. package/dist/environment/vite.mjs +5 -5
  253. package/dist/headers.cjs +3 -3
  254. package/dist/{headers.d-BIbQyAxJ.d.ts → headers.d-Aux4JVnm.d.ts} +1 -1
  255. package/dist/{headers.d-BtNxFc2s.d.mts → headers.d-BawakaPv.d.mts} +1 -1
  256. package/dist/headers.mjs +2 -2
  257. package/dist/i18n/client.cjs +15 -16
  258. package/dist/i18n/client.mjs +5 -6
  259. package/dist/i18n/index.cjs +4 -4
  260. package/dist/i18n/index.mjs +3 -3
  261. package/dist/i18n/server.cjs +5 -5
  262. package/dist/i18n/server.mjs +4 -4
  263. package/dist/image/server.cjs +5 -4
  264. package/dist/image/server.d.mts +5 -1
  265. package/dist/image/server.d.ts +5 -1
  266. package/dist/image/server.mjs +4 -3
  267. package/dist/image/sharp.cjs +53 -89
  268. package/dist/image/sharp.d.mts +2 -1
  269. package/dist/image/sharp.d.ts +2 -1
  270. package/dist/image/sharp.mjs +50 -86
  271. package/dist/index.cjs +99 -93
  272. package/dist/{index.d-CQdDRXd1.d.mts → index.d-Ccq42CPU.d.mts} +1 -1
  273. package/dist/{index.d-CQ_wUzOV.d.ts → index.d-r1MLpgeE.d.ts} +1 -1
  274. package/dist/index.d.mts +19 -19
  275. package/dist/index.d.ts +19 -19
  276. package/dist/index.mjs +96 -90
  277. package/dist/integrations/orm.d.mts +1 -1
  278. package/dist/integrations/orm.d.ts +1 -1
  279. package/dist/integrations.cjs +7 -7
  280. package/dist/integrations.d.mts +1 -1
  281. package/dist/integrations.d.ts +1 -1
  282. package/dist/integrations.mjs +6 -6
  283. package/dist/internal/app-markdown-runtime.cjs +6 -6
  284. package/dist/internal/app-markdown-runtime.d.mts +2 -2
  285. package/dist/internal/app-markdown-runtime.d.ts +2 -2
  286. package/dist/internal/app-markdown-runtime.mjs +5 -5
  287. package/dist/internal/build-runtime.cjs +68 -66
  288. package/dist/internal/build-runtime.d.mts +3 -3
  289. package/dist/internal/build-runtime.d.ts +3 -3
  290. package/dist/internal/build-runtime.mjs +67 -65
  291. package/dist/internal/cli-runtime.cjs +33 -33
  292. package/dist/internal/cli-runtime.mjs +32 -32
  293. package/dist/internal/client-error-overlay.cjs +4 -4
  294. package/dist/internal/client-error-overlay.mjs +1 -1
  295. package/dist/internal/client-runtime.cjs +23 -2
  296. package/dist/internal/client-runtime.d.mts +29 -8
  297. package/dist/internal/client-runtime.d.ts +29 -8
  298. package/dist/internal/client-runtime.mjs +23 -2
  299. package/dist/internal/compression-runtime.d.mts +1 -1
  300. package/dist/internal/compression-runtime.d.ts +1 -1
  301. package/dist/internal/config-runtime.cjs +20 -20
  302. package/dist/internal/config-runtime.d.mts +3 -3
  303. package/dist/internal/config-runtime.d.ts +3 -3
  304. package/dist/internal/config-runtime.mjs +19 -19
  305. package/dist/internal/form-actions.cjs +6 -6
  306. package/dist/internal/form-actions.mjs +5 -5
  307. package/dist/internal/infra-analytics-runtime.cjs +15 -15
  308. package/dist/internal/infra-analytics-runtime.mjs +13 -13
  309. package/dist/internal/islands-server.cjs +2 -2
  310. package/dist/internal/islands-server.mjs +1 -1
  311. package/dist/internal/metadata-image-runtime.cjs +4 -4
  312. package/dist/internal/metadata-image-runtime.mjs +3 -3
  313. package/dist/internal/native-server-fns.cjs +5 -5
  314. package/dist/internal/native-server-fns.mjs +4 -4
  315. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  316. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  317. package/dist/internal/production-runtime.cjs +63 -40
  318. package/dist/internal/production-runtime.d.mts +80 -13
  319. package/dist/internal/production-runtime.d.ts +80 -13
  320. package/dist/internal/production-runtime.mjs +66 -43
  321. package/dist/internal/react-cache.cjs +3 -3
  322. package/dist/internal/react-cache.mjs +1 -1
  323. package/dist/internal/start-manifest.cjs +54 -0
  324. package/dist/internal/start-manifest.d.mts +43 -0
  325. package/dist/internal/start-manifest.d.ts +43 -0
  326. package/dist/internal/start-manifest.mjs +54 -0
  327. package/dist/internal/vercel-edge-middleware.cjs +8 -8
  328. package/dist/internal/vercel-edge-middleware.mjs +7 -7
  329. package/dist/manager-R7FV4A56.cjs +18 -0
  330. package/dist/{manager-RHB2P35B.mjs → manager-YO2RHDYU.mjs} +5 -5
  331. package/dist/markdown.cjs +5 -5
  332. package/dist/markdown.d.mts +1 -1
  333. package/dist/markdown.d.ts +1 -1
  334. package/dist/markdown.mjs +4 -4
  335. package/dist/middleware.cjs +14 -14
  336. package/dist/middleware.d.mts +1 -1
  337. package/dist/middleware.d.ts +1 -1
  338. package/dist/middleware.mjs +13 -13
  339. package/dist/{mount.d-6bhpBQQB.d.mts → mount.d-BomEt2kV.d.mts} +1 -1
  340. package/dist/{mount.d-C-u7rFkM.d.ts → mount.d-Ca8eb9GB.d.ts} +1 -1
  341. package/dist/{native-server-fn-handler-W4FSD76W.cjs → native-server-fn-handler-IWNKQEXK.cjs} +9 -8
  342. package/dist/{native-server-fn-handler-I66X4E5S.mjs → native-server-fn-handler-LII4MDRR.mjs} +8 -7
  343. package/dist/native-tree-D3PW64ZL.cjs +28 -0
  344. package/dist/{native-tree-3X23BT3N.mjs → native-tree-G6ZWS7IR.mjs} +5 -5
  345. package/dist/{navigation-delegate.d-nx6gtsY4.d.mts → navigation-delegate.d-B1ujRkYo.d.mts} +1 -1
  346. package/dist/{navigation-delegate.d-xsG4T1x-.d.ts → navigation-delegate.d-DJCC2jXF.d.ts} +1 -1
  347. package/dist/navigation.cjs +13 -11
  348. package/dist/navigation.d.mts +4 -4
  349. package/dist/navigation.d.ts +4 -4
  350. package/dist/navigation.mjs +12 -10
  351. package/dist/{nitro-SSFTPZMW.cjs → nitro-HKMVYIXY.cjs} +13 -13
  352. package/dist/{nitro-XTQ2HKDL.mjs → nitro-RHLKLYXH.mjs} +8 -8
  353. package/dist/{plugin-5PIQQVRP.cjs → plugin-5BNPYCER.cjs} +2 -2
  354. package/dist/{plugin-QZT747YW.mjs → plugin-FD4S2QEJ.mjs} +1 -1
  355. package/dist/plugin.cjs +62 -60
  356. package/dist/plugin.d.mts +4 -4
  357. package/dist/plugin.d.ts +4 -4
  358. package/dist/plugin.mjs +61 -59
  359. package/dist/query/client.cjs +20 -9
  360. package/dist/query/client.mjs +16 -5
  361. package/dist/{render-plan.d-gW0fwKz2.d.ts → render-plan.d-BxRbaxYA.d.ts} +1 -1
  362. package/dist/{render-plan.d-B5y3h97B.d.mts → render-plan.d-CFod_Zf-.d.mts} +1 -1
  363. package/dist/renderer/react/server.cjs +9 -1
  364. package/dist/renderer/react/server.d.mts +9 -1
  365. package/dist/renderer/react/server.d.ts +9 -1
  366. package/dist/renderer/react/server.mjs +8 -0
  367. package/dist/renderer-client.cjs +25 -26
  368. package/dist/renderer-client.d.mts +4 -4
  369. package/dist/renderer-client.d.ts +4 -4
  370. package/dist/renderer-client.mjs +15 -16
  371. package/dist/request.cjs +2 -2
  372. package/dist/{request.d-B0ugAadD.d.ts → request.d-DG4TeXMM.d.mts} +7 -2
  373. package/dist/{request.d-DLq33nYo.d.mts → request.d-DRQgaXGG.d.ts} +7 -2
  374. package/dist/request.d.mts +2 -2
  375. package/dist/request.d.ts +2 -2
  376. package/dist/request.mjs +1 -1
  377. package/dist/{route-rendering.d-DSeIV7yV.d.mts → route-rendering.d-BXtZKgqu.d.mts} +1 -1
  378. package/dist/{route-rendering.d-ytaqDQD6.d.ts → route-rendering.d-Db07UNVG.d.ts} +1 -1
  379. package/dist/router.cjs +4 -4
  380. package/dist/{router.d-Chd5cpe3.d.mts → router.d-B61kXqxJ.d.mts} +1 -1
  381. package/dist/{router.d-BaEAEGPg.d.ts → router.d-BC3hyjf0.d.ts} +1 -1
  382. package/dist/router.mjs +3 -3
  383. package/dist/routes.cjs +6 -6
  384. package/dist/routes.d.mts +1 -1
  385. package/dist/routes.d.ts +1 -1
  386. package/dist/routes.mjs +5 -5
  387. package/dist/{rsc-pipeline-DPMYONEV.mjs → rsc-pipeline-LJ7YCGY6.mjs} +22 -22
  388. package/dist/{rsc-pipeline-XIUUMMG5.cjs → rsc-pipeline-VENBFYXW.cjs} +23 -23
  389. package/dist/{runtime-XIUJZTZ3.mjs → runtime-4DWUXZHS.mjs} +27 -27
  390. package/dist/{runtime-WD77S3C5.cjs → runtime-UNDTYGQS.cjs} +38 -38
  391. package/dist/{runtime.d-DpCs0eAO.d.mts → runtime.d-Cl6EBGmC.d.mts} +1 -1
  392. package/dist/{runtime.d-h2USyQsz.d.ts → runtime.d-SC95yDzr.d.ts} +1 -1
  393. package/dist/safe-fetch.cjs +15 -0
  394. package/dist/safe-fetch.d.mts +61 -0
  395. package/dist/safe-fetch.d.ts +61 -0
  396. package/dist/safe-fetch.mjs +15 -0
  397. package/dist/{schema-dev-notice-C2JINRZI.mjs → schema-dev-notice-CA55V57L.mjs} +2 -2
  398. package/dist/{schema-dev-notice-X7GG7QVB.cjs → schema-dev-notice-RWA2UTR6.cjs} +3 -3
  399. package/dist/server-action-security.cjs +5 -5
  400. package/dist/server-action-security.mjs +4 -4
  401. package/dist/server-fn.cjs +8 -7
  402. package/dist/server-fn.mjs +7 -6
  403. package/dist/server-plugins.cjs +7 -7
  404. package/dist/server-plugins.d.mts +3 -3
  405. package/dist/server-plugins.d.ts +3 -3
  406. package/dist/server-plugins.mjs +6 -6
  407. package/dist/server-query.cjs +9 -8
  408. package/dist/server-query.mjs +8 -7
  409. package/dist/server.cjs +101 -94
  410. package/dist/server.d.mts +13 -13
  411. package/dist/server.d.ts +13 -13
  412. package/dist/server.mjs +74 -67
  413. package/dist/{spa-router.d-DCQVtEaE.d.mts → spa-router.d-DrlXgDqY.d.mts} +4 -3
  414. package/dist/{spa-router.d-DpdJHs1q.d.ts → spa-router.d-DwM02Mwd.d.ts} +4 -3
  415. package/dist/testing.cjs +31 -31
  416. package/dist/testing.d.mts +1 -1
  417. package/dist/testing.d.ts +1 -1
  418. package/dist/testing.mjs +23 -23
  419. package/dist/theme/server.cjs +3 -3
  420. package/dist/theme/server.mjs +2 -2
  421. package/dist/{utils.d-DmicwMvS.d.ts → utils.d-C6KXz3uB.d.ts} +1 -1
  422. package/dist/{utils.d-DKDZtAY5.d.mts → utils.d-CHzxAshz.d.mts} +1 -1
  423. package/dist/version.cjs +2 -2
  424. package/dist/version.mjs +1 -1
  425. package/dist/vite.cjs +62 -60
  426. package/dist/vite.d.mts +10 -5
  427. package/dist/vite.d.ts +10 -5
  428. package/dist/vite.mjs +61 -59
  429. package/dist/workflows.cjs +7 -7
  430. package/dist/workflows.mjs +6 -6
  431. package/package.json +18 -1
  432. package/dist/analyzer-6EOYURMV.cjs +0 -16
  433. package/dist/chunk-D4XGKF67.cjs +0 -127
  434. package/dist/chunk-MFQGU5CC.mjs +0 -127
  435. package/dist/chunk-NCIAP562.mjs +0 -27
  436. package/dist/chunk-QQ44FYRO.cjs +0 -27
  437. package/dist/chunk-RI3EVPKD.cjs +0 -57
  438. package/dist/manager-S77ZARTC.cjs +0 -18
  439. package/dist/native-tree-TAPKR7QJ.cjs +0 -28
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  resolveFarmAppClientEntry,
3
3
  resolveFarmClientPlugins
4
- } from "./chunk-BIX46FTI.mjs";
4
+ } from "./chunk-MFU7SXAB.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,21 @@ 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
46
  takeFarmHoistedHead
45
- } from "./chunk-LHFGTR7F.mjs";
47
+ } from "./chunk-HT2SZKXG.mjs";
46
48
  import {
47
49
  listFarmMCPLlmsTxtLinks
48
- } from "./chunk-FEQ72ZHD.mjs";
50
+ } from "./chunk-GNY7BO7R.mjs";
49
51
  import {
50
52
  FARM_DEFAULT_MCP_PATH,
51
53
  collectFarmDefaultMCPPages,
@@ -53,16 +55,19 @@ import {
53
55
  farmConfigMountsMCP,
54
56
  isFarmDefaultMCPPathname,
55
57
  resolveFarmDefaultMCPServer
56
- } from "./chunk-R4BWNP73.mjs";
58
+ } from "./chunk-JA6RML7C.mjs";
59
+ import {
60
+ createFarmMetadataImageResponse
61
+ } from "./chunk-HONTCUK6.mjs";
57
62
  import {
58
63
  getFarmFormState,
59
64
  handleFarmFormActionRequest,
60
65
  renderFarmFormStateScript
61
- } from "./chunk-DRBXYJZ6.mjs";
66
+ } from "./chunk-7FQFK3OA.mjs";
62
67
  import {
63
68
  installFarmIslandValues,
64
69
  uninstallFarmIslandValues
65
- } from "./chunk-A4PWGL46.mjs";
70
+ } from "./chunk-7KDCVSTR.mjs";
66
71
  import {
67
72
  FarmSourceSnapshotStore,
68
73
  collectFarmRenderedClientModules,
@@ -77,23 +82,26 @@ import {
77
82
  getFarmSourceStamp,
78
83
  getIslandStrategyExport,
79
84
  isFarmClientModulePlanUnchanged,
85
+ memoizeInFarmSourceSnapshot,
80
86
  mergeProgrammaticClientRoutes,
87
+ noteFarmSourceRead,
81
88
  resolveFarmIsolatedClientHydrationMode,
82
89
  resolveImportedModule,
90
+ resolveModuleSourcePath,
83
91
  resolveProgrammaticClientRoutes,
84
92
  runWithLatestPackageClientBoundaryCache,
85
93
  runWithPackageClientBoundaryCacheFile,
86
94
  traceFarmSourceReads,
87
95
  usesFarmServerTree,
88
96
  withFarmSourceSnapshot
89
- } from "./chunk-BFOMCSZ2.mjs";
97
+ } from "./chunk-A5F55ZFA.mjs";
90
98
  import {
91
99
  FARM_ISLAND_REPLAYABLE_SELECTOR
92
100
  } from "./chunk-S32PDOLO.mjs";
93
101
  import {
94
102
  _setDefaultFarmThemeConfig,
95
103
  getTheme
96
- } from "./chunk-JOECBGY7.mjs";
104
+ } from "./chunk-ZEWWZJPZ.mjs";
97
105
  import {
98
106
  isSecretDocsConfigKey
99
107
  } from "./chunk-EJCVG25Z.mjs";
@@ -103,7 +111,7 @@ import {
103
111
  } from "./chunk-TPA2PV5J.mjs";
104
112
  import {
105
113
  normalizeRouteRules
106
- } from "./chunk-NLRAQXAA.mjs";
114
+ } from "./chunk-YVVY276M.mjs";
107
115
  import {
108
116
  resolveFarmDevtoolsConfig
109
117
  } from "./chunk-CU5SYTJG.mjs";
@@ -113,7 +121,7 @@ import {
113
121
  resolveFarmAgentCrawlers,
114
122
  resolveFarmAgentSitemap,
115
123
  resolveFarmPerformanceConfig
116
- } from "./chunk-AL6E63FZ.mjs";
124
+ } from "./chunk-DUSTJ6A5.mjs";
117
125
  import {
118
126
  collectFarmLlmsTxtPages,
119
127
  createFarmDefaultLlmsTxt,
@@ -123,7 +131,7 @@ import {
123
131
  renderFarmLlmsFullTxt,
124
132
  resolveFarmAgentOrigin,
125
133
  resolveFarmLlmsTxtConfig
126
- } from "./chunk-MUITBU5Z.mjs";
134
+ } from "./chunk-S7QEQCVV.mjs";
127
135
  import {
128
136
  createFarmCspNonce,
129
137
  createFarmCspNonceRewriter,
@@ -157,17 +165,17 @@ import {
157
165
  } from "./chunk-AOIUYHPH.mjs";
158
166
  import {
159
167
  resolveCronConfig
160
- } from "./chunk-FGXSWRWA.mjs";
168
+ } from "./chunk-CSAIIMY3.mjs";
161
169
  import {
162
170
  resolveServerActionsConfig
163
- } from "./chunk-ZD7JUTBY.mjs";
171
+ } from "./chunk-NLATR3T3.mjs";
164
172
  import {
165
173
  createFarmMarkdownRouteModuleFromFile,
166
174
  loadFarmMdxComponents
167
- } from "./chunk-KUMKBBYP.mjs";
175
+ } from "./chunk-KUXEII7V.mjs";
168
176
  import {
169
177
  isFarmMarkdownPageFile
170
- } from "./chunk-R6Q6VSGU.mjs";
178
+ } from "./chunk-BGUTIQII.mjs";
171
179
  import {
172
180
  resolveFarmMdxComponentsModulePath,
173
181
  resolveMdxConfig
@@ -180,10 +188,10 @@ import {
180
188
  farmRequestWantsMarkdown,
181
189
  getFarmMarkdownAlternatePath,
182
190
  resolveMarkdownConfig
183
- } from "./chunk-VKLV7GF4.mjs";
191
+ } from "./chunk-R5X7FDOG.mjs";
184
192
  import {
185
193
  resolveWorkflowsConfig
186
- } from "./chunk-MGZVDX4R.mjs";
194
+ } from "./chunk-3AJQFVWW.mjs";
187
195
  import {
188
196
  resolveFarmThemeConfig
189
197
  } from "./chunk-YWPNIYUP.mjs";
@@ -191,7 +199,7 @@ import {
191
199
  getIntegrationProviders,
192
200
  getRegisteredIntegrationAPIManifest,
193
201
  isFarmIntegrationProviderComponentReference
194
- } from "./chunk-FCBUNILW.mjs";
202
+ } from "./chunk-5O3SK3ZC.mjs";
195
203
  import {
196
204
  initStorage
197
205
  } from "./chunk-TJVUTGED.mjs";
@@ -202,7 +210,7 @@ import {
202
210
  import {
203
211
  createRouteSlotContainerId,
204
212
  parseRouteSlotFile
205
- } from "./chunk-K3RU5MOR.mjs";
213
+ } from "./chunk-RK4MGL6Q.mjs";
206
214
  import {
207
215
  _clearCurrentMiddlewareContext,
208
216
  _clearCurrentMiddlewareData,
@@ -212,13 +220,13 @@ import {
212
220
  import {
213
221
  findProgrammaticRouteFiles,
214
222
  loadProgrammaticRouteManifests
215
- } from "./chunk-H2ZJ35NW.mjs";
223
+ } from "./chunk-UOE6ZZZP.mjs";
216
224
  import {
217
225
  _runWithFarmI18nRequest,
218
226
  _setDefaultFarmI18nRuntime,
219
227
  createFarmI18nRuntime,
220
228
  getFarmI18nClientSnapshot
221
- } from "./chunk-TNYC3TYP.mjs";
229
+ } from "./chunk-O7JEFGUV.mjs";
222
230
  import {
223
231
  formatOptionalPeerInstallHint,
224
232
  isOptionalPeerInstalled
@@ -229,7 +237,7 @@ import {
229
237
  normalizeProgrammaticRoutePath,
230
238
  parseProgrammaticRoutePath,
231
239
  trackProgrammaticRouteSources
232
- } from "./chunk-6YFC3ZFX.mjs";
240
+ } from "./chunk-DZXD6CYJ.mjs";
233
241
  import {
234
242
  getFarmRouteRuntimeConfig,
235
243
  mergeFarmRouteRuntimeConfigs,
@@ -241,7 +249,7 @@ import {
241
249
  configureFarmCache,
242
250
  getFarmDataCache,
243
251
  normalizeRevalidatePath
244
- } from "./chunk-KIRIFO6T.mjs";
252
+ } from "./chunk-ZO6TOLHL.mjs";
245
253
  import {
246
254
  sendWebResponse
247
255
  } from "./chunk-O5QUJEWT.mjs";
@@ -250,7 +258,7 @@ import {
250
258
  } from "./chunk-VHIXGZYH.mjs";
251
259
  import {
252
260
  loadFarmDevModule
253
- } from "./chunk-TUOO6IK3.mjs";
261
+ } from "./chunk-7H2TXT2K.mjs";
254
262
  import {
255
263
  resolveFarmI18nConfig
256
264
  } from "./chunk-VJSXPN3W.mjs";
@@ -267,7 +275,7 @@ import {
267
275
  splitRoutePath,
268
276
  toRootRelativeUrlPath,
269
277
  toViteModuleId
270
- } from "./chunk-JSDV2NUN.mjs";
278
+ } from "./chunk-Z3QXQN4U.mjs";
271
279
  import {
272
280
  resolveFarmAPIServerBasePath
273
281
  } from "./chunk-2I6PUKWJ.mjs";
@@ -275,7 +283,7 @@ import {
275
283
  createFarmNodeRequestAbortSignal,
276
284
  matchesFarmIfNoneMatch,
277
285
  resolveFarmServerConfig
278
- } from "./chunk-QDWMCFTH.mjs";
286
+ } from "./chunk-YT2ZMLXK.mjs";
279
287
  import {
280
288
  getRequestContextSnapshot
281
289
  } from "./chunk-D2LCAV6L.mjs";
@@ -289,14 +297,13 @@ import {
289
297
  } from "./chunk-2DA7CLY7.mjs";
290
298
  import {
291
299
  FARM_VERSION
292
- } from "./chunk-IG4IQMIW.mjs";
300
+ } from "./chunk-H7QY7ZE4.mjs";
301
+ import {
302
+ _setFarmSearchPreserveRoutes
303
+ } from "./chunk-VDQZV6BX.mjs";
293
304
  import {
294
305
  normalizeFarmAPIConfig
295
306
  } from "./chunk-W6QLRQ3V.mjs";
296
- import {
297
- createFarmLocaleCookie,
298
- getFarmLocaleVaryHeaders
299
- } from "./chunk-2EVESLP3.mjs";
300
307
  import {
301
308
  getFarmPageDataRedirect
302
309
  } from "./chunk-SD6JGJOM.mjs";
@@ -308,7 +315,7 @@ import {
308
315
  renderMetadataHead,
309
316
  renderViewportHead,
310
317
  resolveFarmNotFoundMetadata
311
- } from "./chunk-S6O2L47H.mjs";
318
+ } from "./chunk-AG27TI6Q.mjs";
312
319
  import {
313
320
  prepareDeferredData,
314
321
  snapshotDeferredData
@@ -320,6 +327,10 @@ import {
320
327
  getFarmDeploymentMismatch,
321
328
  withoutFarmDeploymentCookie
322
329
  } from "./chunk-IWJONXPF.mjs";
330
+ import {
331
+ createFarmLocaleCookie,
332
+ getFarmLocaleVaryHeaders
333
+ } from "./chunk-UJIBSFUE.mjs";
323
334
  import {
324
335
  resolveFarmTrailingSlashRedirect,
325
336
  setFarmTrailingSlashPreference
@@ -332,15 +343,16 @@ import {
332
343
  } from "./chunk-XQ4DPO4G.mjs";
333
344
  import {
334
345
  encodeConfigRouteSegment
335
- } from "./chunk-JZGL2PIH.mjs";
346
+ } from "./chunk-CDT7CGQT.mjs";
336
347
  import {
348
+ _getRequestCookieReadCount,
337
349
  _getRequestReadCount,
338
350
  _runWithCurrentRequest,
339
351
  _runWithFarmCspNonce,
340
352
  createWebRequestFromFarmRequest,
341
353
  getCurrentRequestOrNull,
342
354
  resolveFarmRequestURL
343
- } from "./chunk-WTTJ2YS2.mjs";
355
+ } from "./chunk-FCAYYLAE.mjs";
344
356
  import {
345
357
  _peekCurrentRequest,
346
358
  _resolveCurrentCspNonce
@@ -355,7 +367,7 @@ import {
355
367
  localizeFarmPathname,
356
368
  resolveFarmLocalePath,
357
369
  stripFarmLocaleFromPathname
358
- } from "./chunk-7S7AAK2D.mjs";
370
+ } from "./chunk-4QBFYEDC.mjs";
359
371
  import {
360
372
  applyFarmBasePath,
361
373
  normalizeFarmConfigBasePath,
@@ -367,7 +379,7 @@ import {
367
379
  assertUniqueRouteParameters,
368
380
  compareRouteSpecificity,
369
381
  getRoutePatternShape
370
- } from "./chunk-AYP2YFVN.mjs";
382
+ } from "./chunk-5KAEGBIL.mjs";
371
383
 
372
384
  // src/static-metadata-image.ts
373
385
  import { createHash } from "crypto";
@@ -435,7 +447,7 @@ async function readAltText(filePath) {
435
447
  }
436
448
 
437
449
  // src/routing/route-manager.ts
438
- import { realpathSync } from "fs";
450
+ import fs from "fs";
439
451
  import path2 from "path";
440
452
  function getRouteEntryDirectory(entry) {
441
453
  return entry.directory ?? entry.pattern;
@@ -455,6 +467,19 @@ function compareRouteEntries(left, right) {
455
467
  }
456
468
  var PLAN_SOURCE = /\.(?:[cm]?[jt]sx?|vue|svelte)$/;
457
469
  var NODE_MODULES_SEGMENT = `${path2.sep}node_modules${path2.sep}`;
470
+ function getInstalledPackageDirectory(file, start) {
471
+ let end = file.indexOf(path2.sep, start);
472
+ if (end !== -1 && file[start] === "@") end = file.indexOf(path2.sep, end + 1);
473
+ return end === -1 ? file : file.slice(0, end);
474
+ }
475
+ function realPathOutsideNodeModules(target) {
476
+ try {
477
+ const real = fs.realpathSync(target);
478
+ return real.includes(NODE_MODULES_SEGMENT) ? null : real;
479
+ } catch {
480
+ return null;
481
+ }
482
+ }
458
483
  var RouteManager = class _RouteManager {
459
484
  constructor(config, viteServer) {
460
485
  this.routes = /* @__PURE__ */ new Map();
@@ -482,6 +507,8 @@ var RouteManager = class _RouteManager {
482
507
  this.planStamps = /* @__PURE__ */ new Map();
483
508
  this.sourceChangeTracking = false;
484
509
  this.linkedSources = /* @__PURE__ */ new Map();
510
+ // Whether each package directory under `node_modules` a plan read from links to a workspace.
511
+ this.linkedPackages = /* @__PURE__ */ new Map();
485
512
  // Source files edited since the last plan; null when the next plan must recompute every module.
486
513
  this.editedSources = null;
487
514
  this.config = config;
@@ -605,6 +632,30 @@ var RouteManager = class _RouteManager {
605
632
  getRoutes() {
606
633
  return new Map(this.routes);
607
634
  }
635
+ /**
636
+ * The pages whose programmatic definition declares `search.preserve`, for Farm links to carry
637
+ * those params from the current URL. Read from the evaluated routes files, without planning.
638
+ */
639
+ getSearchPreserveRoutes() {
640
+ const routes = [];
641
+ for (const entry of this.routes.values()) {
642
+ const preserve = getProgrammaticRouteSearchClientOptions(
643
+ this.programmaticPages.get(entry.modulePath)?.search
644
+ )?.preserve;
645
+ if (!preserve?.length) continue;
646
+ routes.push({
647
+ pattern: entry.pattern,
648
+ segments: entry.route.segments.map((seg) => ({
649
+ segment: seg.segment,
650
+ isDynamic: seg.isDynamic,
651
+ isCatchAll: seg.isCatchAll,
652
+ isOptional: seg.isOptional
653
+ })),
654
+ search: { preserve: [...preserve] }
655
+ });
656
+ }
657
+ return routes;
658
+ }
608
659
  /**
609
660
  * Get all registered layouts
610
661
  */
@@ -852,6 +903,7 @@ var RouteManager = class _RouteManager {
852
903
  this.editedSources = null;
853
904
  this.sourceSnapshot?.clear();
854
905
  this.linkedSources.clear();
906
+ this.linkedPackages.clear();
855
907
  }
856
908
  /**
857
909
  * @internal Whether an edit to `file` leaves the current plan as it is: a client module the
@@ -915,17 +967,22 @@ var RouteManager = class _RouteManager {
915
967
  /**
916
968
  * The path the watcher reports for a file a plan read: itself, or the real path of a workspace
917
969
  * package's source read through its `node_modules` link. Null for an installed package's file.
970
+ * Package managers link whole package directories, so one realpath of the directory rules out an
971
+ * installed package; a plan reads thousands of files of an icon package.
918
972
  */
919
973
  planSourcePath(file) {
920
- if (!file.includes(NODE_MODULES_SEGMENT)) return file;
974
+ const index = file.lastIndexOf(NODE_MODULES_SEGMENT);
975
+ if (index === -1) return file;
976
+ const directory = getInstalledPackageDirectory(file, index + NODE_MODULES_SEGMENT.length);
977
+ let linked = this.linkedPackages.get(directory);
978
+ if (linked === void 0) {
979
+ linked = realPathOutsideNodeModules(directory) !== null;
980
+ this.linkedPackages.set(directory, linked);
981
+ }
982
+ if (!linked) return null;
921
983
  let source = this.linkedSources.get(file);
922
984
  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
- }
985
+ source = realPathOutsideNodeModules(file);
929
986
  this.linkedSources.set(file, source);
930
987
  }
931
988
  return source;
@@ -1902,7 +1959,7 @@ async function safeGlobFiles(pattern, cwd) {
1902
1959
  }
1903
1960
  function toRealPath(filePath) {
1904
1961
  try {
1905
- return realpathSync(filePath);
1962
+ return fs.realpathSync(filePath);
1906
1963
  } catch {
1907
1964
  return filePath;
1908
1965
  }
@@ -1960,40 +2017,15 @@ function createFarmDevClientManifest(manifest, options) {
1960
2017
  return clientManifest;
1961
2018
  }
1962
2019
 
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
2020
  // src/font-vite.ts
1990
2021
  import { createHash as createHash2, timingSafeEqual } from "crypto";
1991
- import { existsSync as existsSync2 } from "fs";
2022
+ import { existsSync } from "fs";
1992
2023
  import { readFile as readFile2 } from "fs/promises";
1993
- import path4 from "path";
2024
+ import path3 from "path";
1994
2025
  import { createRequire } from "module";
1995
- import { pathToFileURL } from "url";
2026
+ import { fileURLToPath, pathToFileURL } from "url";
1996
2027
  var FONT_IMPORTS = /* @__PURE__ */ new Set(["@farm.js/core", "@farm.js/core/font"]);
2028
+ var FARM_CORE_DIRECTORY = `${path3.dirname(typeof __filename === "string" ? __filename : fileURLToPath(import.meta.url)).replace(/\\/g, "/")}/`;
1997
2029
  var FONT_FUNCTIONS = /* @__PURE__ */ new Set(["localFont", "remoteFont"]);
1998
2030
  var FONT_CSS_PREFIX = "\0farm:font-css:";
1999
2031
  var FONT_RUNTIME_ID = "\0farm:font-runtime";
@@ -2096,7 +2128,7 @@ function farmFontImportsPlugin(options = {}) {
2096
2128
  }
2097
2129
  async function transformFarmFontCalls(options) {
2098
2130
  const cleanId = options.id.split("?", 1)[0];
2099
- if (!MODULE_EXTENSION_RE.test(cleanId) || /\.d\.[cm]?ts$/.test(cleanId) || !containsFontFunction(options.code)) {
2131
+ if (!MODULE_EXTENSION_RE.test(cleanId) || /\.d\.[cm]?ts$/.test(cleanId) || !containsFontFunction(options.code) || cleanId.replace(/\\/g, "/").startsWith(FARM_CORE_DIRECTORY)) {
2100
2132
  return null;
2101
2133
  }
2102
2134
  const ast = options.parse(options.code);
@@ -2348,7 +2380,7 @@ ${FONT_SECTION_END}
2348
2380
  return resource;
2349
2381
  }
2350
2382
  const bytes2 = await fetchRemoteFont(url, input.integrity);
2351
- return this.createSelfHostedResource(bytes2, extension, path4.basename(url.pathname));
2383
+ return this.createSelfHostedResource(bytes2, extension, path3.basename(url.pathname));
2352
2384
  }
2353
2385
  if (input.source.startsWith("/")) {
2354
2386
  return this.createPublicResource(input.moduleId, input.source);
@@ -2371,8 +2403,8 @@ ${FONT_SECTION_END}
2371
2403
  }
2372
2404
  return this.createSelfHostedResource(
2373
2405
  bytes,
2374
- path4.extname(resolvedPath),
2375
- path4.basename(resolvedPath)
2406
+ path3.extname(resolvedPath),
2407
+ path3.basename(resolvedPath)
2376
2408
  );
2377
2409
  }
2378
2410
  async createPublicResource(moduleId, source) {
@@ -2383,7 +2415,7 @@ ${FONT_SECTION_END}
2383
2415
  );
2384
2416
  }
2385
2417
  const publicPath = normalizePublicFontPath(source, moduleId);
2386
- const resolvedPath = path4.resolve(this.publicDir, `.${publicPath}`);
2418
+ const resolvedPath = path3.resolve(this.publicDir, `.${publicPath}`);
2387
2419
  if (!isPathInside(this.publicDir, resolvedPath)) {
2388
2420
  throw fontError(moduleId, `public font path must stay inside publicDir`);
2389
2421
  }
@@ -2399,7 +2431,7 @@ ${FONT_SECTION_END}
2399
2431
  `could not read ${JSON.stringify(source)} from publicDir: ${error.message}`
2400
2432
  );
2401
2433
  }
2402
- const extension = path4.extname(resolvedPath).toLowerCase();
2434
+ const extension = path3.extname(resolvedPath).toLowerCase();
2403
2435
  const hash = createHash2("sha256").update(bytes).digest("hex").slice(0, 12);
2404
2436
  const resource = {
2405
2437
  extension,
@@ -2414,7 +2446,7 @@ ${FONT_SECTION_END}
2414
2446
  createSelfHostedResource(bytes, extension, fileName) {
2415
2447
  const normalizedExtension = extension.toLowerCase();
2416
2448
  const hash = createHash2("sha256").update(bytes).digest("hex").slice(0, 12);
2417
- const baseName = sanitizeFileName(path4.basename(fileName, extension)) || "font";
2449
+ const baseName = sanitizeFileName(path3.basename(fileName, extension)) || "font";
2418
2450
  const outputFileName = `assets/fonts/${baseName}-h${hash}${normalizedExtension}`;
2419
2451
  const key = `${hash}${normalizedExtension}`;
2420
2452
  const existing = this.resources.get(key);
@@ -2767,24 +2799,24 @@ function verifyIntegrity(bytes, integrity) {
2767
2799
  if (!matches) throw new Error("downloaded font did not match its integrity value");
2768
2800
  }
2769
2801
  function resolveLocalFontPath(source, importer, root) {
2770
- if (source.startsWith(".")) return path4.resolve(path4.dirname(importer), source);
2771
- if (path4.isAbsolute(source)) {
2802
+ if (source.startsWith(".")) return path3.resolve(path3.dirname(importer), source);
2803
+ if (path3.isAbsolute(source)) {
2772
2804
  return source;
2773
2805
  }
2774
2806
  try {
2775
2807
  return createRequire(pathToFileURL(importer)).resolve(source);
2776
2808
  } catch {
2777
2809
  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;
2810
+ if (segments.includes("..")) return path3.resolve(root, source);
2811
+ let current = path3.dirname(importer);
2812
+ const filesystemRoot = path3.parse(current).root;
2781
2813
  while (true) {
2782
- const candidate = path4.join(current, "node_modules", ...segments);
2783
- if (existsSync2(candidate)) return candidate;
2814
+ const candidate = path3.join(current, "node_modules", ...segments);
2815
+ if (existsSync(candidate)) return candidate;
2784
2816
  if (current === filesystemRoot) break;
2785
- current = path4.dirname(current);
2817
+ current = path3.dirname(current);
2786
2818
  }
2787
- return path4.resolve(root, "node_modules", ...segments);
2819
+ return path3.resolve(root, "node_modules", ...segments);
2788
2820
  }
2789
2821
  }
2790
2822
  function replaceFontSection(css, section) {
@@ -2817,11 +2849,11 @@ function getGlobalMap(key) {
2817
2849
  return created;
2818
2850
  }
2819
2851
  function normalizeRoot(root) {
2820
- return path4.resolve(root).replace(/\\/g, "/");
2852
+ return path3.resolve(root).replace(/\\/g, "/");
2821
2853
  }
2822
2854
  function normalizePublicDir(root, publicDir) {
2823
2855
  if (publicDir === false || publicDir === "") return false;
2824
- return path4.resolve(root, publicDir || "public");
2856
+ return path3.resolve(root, publicDir || "public");
2825
2857
  }
2826
2858
  function normalizePublicFontPath(source, moduleId) {
2827
2859
  if (source.includes("?") || source.includes("#")) {
@@ -2830,8 +2862,8 @@ function normalizePublicFontPath(source, moduleId) {
2830
2862
  return `/${source.replace(/\\/g, "/").replace(/^\/+/, "")}`;
2831
2863
  }
2832
2864
  function isPathInside(parent, child) {
2833
- const relative3 = path4.relative(parent, child);
2834
- return relative3 === "" || !relative3.startsWith("..") && !path4.isAbsolute(relative3);
2865
+ const relative3 = path3.relative(parent, child);
2866
+ return relative3 === "" || !relative3.startsWith("..") && !path3.isAbsolute(relative3);
2835
2867
  }
2836
2868
  function normalizeBasePath(value) {
2837
2869
  if (!value || value === "/") return "/";
@@ -2841,7 +2873,7 @@ function joinBasePath(basePath, value) {
2841
2873
  return basePath === "/" ? value : `${basePath.replace(/\/$/, "")}${value}`;
2842
2874
  }
2843
2875
  function extensionFromPath(pathname) {
2844
- const extension = path4.extname(pathname).toLowerCase();
2876
+ const extension = path3.extname(pathname).toLowerCase();
2845
2877
  if (!FONT_EXTENSION_RE.test(extension)) {
2846
2878
  throw new Error(`[Farm fonts] Remote font URL must end in .woff2, .woff, .ttf, or .otf`);
2847
2879
  }
@@ -2980,6 +3012,49 @@ function fontError(id, message) {
2980
3012
  return new Error(`[Farm fonts] ${message} in ${id.split("?", 1)[0]}`);
2981
3013
  }
2982
3014
 
3015
+ // src/server/dev-styles.ts
3016
+ import * as fs2 from "fs";
3017
+ import * as path4 from "path";
3018
+ function resolveDevGlobalStylesheetHref(root, srcDir = "src") {
3019
+ const file = path4.join(root, srcDir, "app", "globals.css");
3020
+ if (!fs2.existsSync(file)) return void 0;
3021
+ return `/${path4.relative(root, file).split(path4.sep).join("/")}`;
3022
+ }
3023
+ var STYLE_EXTENSIONS = /\.(css|scss|sass|less|styl|stylus)(?:$|\?)/;
3024
+ var ALREADY_LINKED = "/src/app/globals.css";
3025
+ function collectDevStylesheetUrls(modules, alreadyLinked = ALREADY_LINKED, options = {}) {
3026
+ const seen = /* @__PURE__ */ new Set();
3027
+ for (const mod of modules) {
3028
+ const id = mod.id ?? mod.file ?? "";
3029
+ if (!STYLE_EXTENSIONS.test(id)) continue;
3030
+ const cssModule = id.includes(".module.");
3031
+ if (cssModule && !options.cssModules) continue;
3032
+ const url = mod.url;
3033
+ if (!url || !url.startsWith("/")) continue;
3034
+ const bare = url.split("?")[0];
3035
+ if (bare === alreadyLinked) continue;
3036
+ seen.add(cssModule ? `${bare}?direct` : bare);
3037
+ }
3038
+ return [...seen].sort();
3039
+ }
3040
+ var SERVER_STYLESHEET_FILE = /\.(?:css|less|sass|scss|styl|stylus|pcss|postcss|sss)$/;
3041
+ function farmDevServerStylesheetsPlugin() {
3042
+ return {
3043
+ name: "farm:dev-server-stylesheets",
3044
+ apply: "serve",
3045
+ enforce: "pre",
3046
+ applyToEnvironment: (environment) => environment.config.consumer === "server",
3047
+ load: {
3048
+ filter: { id: SERVER_STYLESHEET_FILE },
3049
+ handler(id) {
3050
+ if (id.startsWith("\0") && !id.startsWith(FONT_CSS_PREFIX)) return null;
3051
+ if (/\.module\.[^./]+$/.test(id)) return null;
3052
+ return "";
3053
+ }
3054
+ }
3055
+ };
3056
+ }
3057
+
2983
3058
  // src/integration-provider-build.ts
2984
3059
  import path5 from "path";
2985
3060
  function isRendererCompiledComponent(moduleId, rendererComponentExtensions) {
@@ -3087,7 +3162,7 @@ function resolveProviderModule(moduleId, root) {
3087
3162
  }
3088
3163
 
3089
3164
  // src/island-inference.ts
3090
- import fs2 from "fs";
3165
+ import fs3 from "fs";
3091
3166
  import path6 from "path";
3092
3167
  import { inferStrategy } from "@farm.js/islx/compiler";
3093
3168
  import { parseAst } from "rolldown/parseAst";
@@ -3105,7 +3180,7 @@ function parseFarmIslandSource(file, code) {
3105
3180
  }
3106
3181
  function modifiedAt(file) {
3107
3182
  try {
3108
- return fs2.statSync(file).mtimeMs;
3183
+ return fs3.statSync(file).mtimeMs;
3109
3184
  } catch {
3110
3185
  return -1;
3111
3186
  }
@@ -3119,7 +3194,7 @@ function inferFarmIslandStrategy(filePath, root) {
3119
3194
  }
3120
3195
  let code;
3121
3196
  try {
3122
- code = fs2.readFileSync(file, "utf8");
3197
+ code = fs3.readFileSync(file, "utf8");
3123
3198
  } catch {
3124
3199
  return { strategy: null, files: [file], reason: `${path6.basename(file)} could not be read` };
3125
3200
  }
@@ -3176,7 +3251,7 @@ function inferRouteRoot(owners, root) {
3176
3251
  for (const module of modules) {
3177
3252
  let source = null;
3178
3253
  try {
3179
- source = fs2.readFileSync(module, "utf8");
3254
+ source = fs3.readFileSync(module, "utf8");
3180
3255
  } catch {
3181
3256
  }
3182
3257
  if (getIslandStrategyExport(source) !== null) return { strategy: null, files, declared: true };
@@ -3212,15 +3287,15 @@ function resolveFarmRouteRootStrategy(route, page, layouts, root, islandsMode) {
3212
3287
  }
3213
3288
 
3214
3289
  // src/server/renderer.ts
3215
- import * as fs5 from "fs";
3290
+ import * as fs7 from "fs";
3216
3291
  import * as https from "https";
3217
3292
  import { isIP } from "net";
3218
- import * as path9 from "path";
3293
+ import * as path10 from "path";
3219
3294
  import * as tls from "tls";
3220
3295
  import { Readable, Writable } from "stream";
3221
3296
 
3222
3297
  // src/not-found.ts
3223
- import fs3 from "fs";
3298
+ import fs4 from "fs";
3224
3299
  import path7 from "path";
3225
3300
  function resolveFarmNotFoundComponentPath(config, appDirs) {
3226
3301
  const extensions = getFarmRendererComponentExtensions(config.renderer);
@@ -3232,7 +3307,7 @@ function resolveFarmNotFoundComponentPath(config, appDirs) {
3232
3307
  `notFound.component must use one of the configured renderer extensions: ${extensions.join(", ")}`
3233
3308
  );
3234
3309
  }
3235
- if (!fs3.existsSync(componentPath) || !fs3.statSync(componentPath).isFile()) {
3310
+ if (!fs4.existsSync(componentPath) || !fs4.statSync(componentPath).isFile()) {
3236
3311
  throw new Error(`notFound.component was not found: ${componentPath}`);
3237
3312
  }
3238
3313
  return componentPath;
@@ -3241,7 +3316,7 @@ function resolveFarmNotFoundComponentPath(config, appDirs) {
3241
3316
  for (const appDir of appDirs) {
3242
3317
  for (const extension of extensions) {
3243
3318
  const candidate = path7.join(appDir, `not-found${extension}`);
3244
- if (fs3.existsSync(candidate) && fs3.statSync(candidate).isFile()) {
3319
+ if (fs4.existsSync(candidate) && fs4.statSync(candidate).isFile()) {
3245
3320
  discoveredPath = candidate;
3246
3321
  break;
3247
3322
  }
@@ -3437,9 +3512,9 @@ body {
3437
3512
  import { pathToFileURL as pathToFileURL2 } from "url";
3438
3513
 
3439
3514
  // src/server/error-diagnostics.ts
3440
- import * as fs4 from "fs";
3515
+ import * as fs5 from "fs";
3441
3516
  import * as path8 from "path";
3442
- import { fileURLToPath } from "url";
3517
+ import { fileURLToPath as fileURLToPath2 } from "url";
3443
3518
  var SECRET_VALUE_PATTERN = /\b(api[_-]?key|access[_-]?token|auth[_-]?token|client[_-]?secret|secret[_-]?key|token|password|secret)\s*[:=]\s*([^\s,;]+)/gi;
3444
3519
  var BEARER_PATTERN = /\b(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi;
3445
3520
  function redactErrorText(value) {
@@ -3452,7 +3527,7 @@ function isPathInsideRoot(root, filePath) {
3452
3527
  function normalizeStackPath(value) {
3453
3528
  const withoutQuery = value.replace(/[?#].*$/, "");
3454
3529
  try {
3455
- return withoutQuery.startsWith("file://") ? fileURLToPath(withoutQuery) : withoutQuery;
3530
+ return withoutQuery.startsWith("file://") ? fileURLToPath2(withoutQuery) : withoutQuery;
3456
3531
  } catch {
3457
3532
  return void 0;
3458
3533
  }
@@ -3466,7 +3541,7 @@ function findStackLocation(stack, root) {
3466
3541
  const candidate = normalizeStackPath(match[1]);
3467
3542
  if (!candidate || candidate.includes(`${path8.sep}node_modules${path8.sep}`)) continue;
3468
3543
  const absolutePath = path8.resolve(candidate);
3469
- if (!isPathInsideRoot(root, absolutePath) || !fs4.existsSync(absolutePath)) continue;
3544
+ if (!isPathInsideRoot(root, absolutePath) || !fs5.existsSync(absolutePath)) continue;
3470
3545
  const relativePath = path8.relative(root, absolutePath).split(path8.sep).join("/");
3471
3546
  return {
3472
3547
  absolutePath,
@@ -3479,7 +3554,7 @@ function findStackLocation(stack, root) {
3479
3554
  }
3480
3555
  function createSourceFrame(location) {
3481
3556
  try {
3482
- const sourceLines = fs4.readFileSync(location.absolutePath, "utf8").split(/\r?\n/);
3557
+ const sourceLines = fs5.readFileSync(location.absolutePath, "utf8").split(/\r?\n/);
3483
3558
  if (location.line < 1 || location.line > sourceLines.length) return void 0;
3484
3559
  const start = Math.max(1, location.line - 2);
3485
3560
  const end = Math.min(sourceLines.length, location.line + 2);
@@ -3524,6 +3599,244 @@ function canBootFarmIslandsClient(config) {
3524
3599
  return resolveFarmServerComponentsMode(config.experimental?.serverComponents) === "islands" && !docsEnabled && resolveFarmClientPlugins(config.plugins, config.root).length === 0 && !resolveFarmAppClientEntry(config.root, config.srcDir || "src");
3525
3600
  }
3526
3601
 
3602
+ // src/islands-kept-layouts.ts
3603
+ import fs6 from "fs";
3604
+ import path9 from "path";
3605
+ import { parseAst as parseAst2 } from "rolldown/parseAst";
3606
+ var SCRIPT_SOURCE = /\.[cm]?[jt]sx?$/;
3607
+ var ASSET_SOURCE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss|svg|png|jpe?g|gif|webp|avif|ico|woff2?|ttf|otf)$/;
3608
+ var PURE_PACKAGE_IMPORTS = /* @__PURE__ */ new Map([
3609
+ ["react", "*"],
3610
+ ["react/jsx-runtime", "*"],
3611
+ ["react/jsx-dev-runtime", "*"],
3612
+ ["@farm.js/core/client", /* @__PURE__ */ new Set(["Link"])]
3613
+ ]);
3614
+ var IMPURE_GLOBALS = /* @__PURE__ */ new Set([
3615
+ "process",
3616
+ "globalThis",
3617
+ "global",
3618
+ "window",
3619
+ "self",
3620
+ "Date",
3621
+ "crypto",
3622
+ "fetch",
3623
+ "require",
3624
+ "eval",
3625
+ "Function",
3626
+ "performance",
3627
+ "setTimeout",
3628
+ "setInterval",
3629
+ "queueMicrotask",
3630
+ "AsyncLocalStorage"
3631
+ ]);
3632
+ var DECLARATION_STATEMENTS = /* @__PURE__ */ new Set([
3633
+ "ImportDeclaration",
3634
+ "FunctionDeclaration",
3635
+ "VariableDeclaration",
3636
+ "ClassDeclaration",
3637
+ "TSTypeAliasDeclaration",
3638
+ "TSInterfaceDeclaration",
3639
+ "TSEnumDeclaration",
3640
+ "TSModuleDeclaration",
3641
+ "TSDeclareFunction",
3642
+ "EmptyStatement"
3643
+ ]);
3644
+ function parse(code, file) {
3645
+ const extension = path9.extname(file).slice(1);
3646
+ const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : extension === "js" || extension === "mjs" || extension === "cjs" || extension === "jsx" ? "jsx" : "tsx";
3647
+ return memoizeInFarmSourceSnapshot(`ast:${lang}`, code, () => {
3648
+ try {
3649
+ return parseAst2(code, { lang });
3650
+ } catch {
3651
+ return null;
3652
+ }
3653
+ });
3654
+ }
3655
+ function findFarmRequestDecidingConstruct(code, file) {
3656
+ const program = parse(code, file);
3657
+ if (!program) return { reason: "the module does not parse", imports: [] };
3658
+ const imports = [];
3659
+ let reason = null;
3660
+ for (const statement of program.body) {
3661
+ if (statement.type === "ImportDeclaration") {
3662
+ if (statement.importKind === "type") continue;
3663
+ const names = [];
3664
+ for (const specifier of statement.specifiers ?? []) {
3665
+ if (specifier.importKind === "type") continue;
3666
+ if (specifier.type === "ImportSpecifier") {
3667
+ names.push(specifier.imported.name ?? specifier.imported.value);
3668
+ } else if (specifier.type === "ImportDefaultSpecifier") names.push("default");
3669
+ else names.push("*");
3670
+ }
3671
+ if ((statement.specifiers ?? []).length === 0 || names.length > 0) {
3672
+ imports.push({ source: statement.source.value, names });
3673
+ }
3674
+ continue;
3675
+ }
3676
+ if (statement.type === "ExportAllDeclaration") {
3677
+ if (statement.exportKind !== "type")
3678
+ imports.push({ source: statement.source.value, names: ["*"] });
3679
+ continue;
3680
+ }
3681
+ if (statement.type === "ExportNamedDeclaration") {
3682
+ if (statement.source && statement.exportKind !== "type") {
3683
+ imports.push({
3684
+ source: statement.source.value,
3685
+ names: (statement.specifiers ?? []).filter((specifier) => specifier.exportKind !== "type").map((specifier) => specifier.local.name ?? specifier.local.value)
3686
+ });
3687
+ }
3688
+ continue;
3689
+ }
3690
+ if (statement.type === "ExportDefaultDeclaration") continue;
3691
+ if (statement.type === "ExpressionStatement" && typeof statement.directive === "string") {
3692
+ continue;
3693
+ }
3694
+ if (!DECLARATION_STATEMENTS.has(statement.type)) {
3695
+ reason ?? (reason = `a top-level ${statement.type}`);
3696
+ }
3697
+ }
3698
+ const visit = (node, parent, key) => {
3699
+ if (reason || !node || typeof node !== "object") return;
3700
+ if (Array.isArray(node)) {
3701
+ for (const child of node) visit(child, parent, key);
3702
+ return;
3703
+ }
3704
+ const current = node;
3705
+ if (typeof current.type !== "string") return;
3706
+ switch (current.type) {
3707
+ case "ThrowStatement":
3708
+ reason = "a throw statement";
3709
+ return;
3710
+ case "AwaitExpression":
3711
+ reason = "an await expression";
3712
+ return;
3713
+ case "YieldExpression":
3714
+ reason = "a generator";
3715
+ return;
3716
+ case "ImportExpression":
3717
+ reason = "a dynamic import()";
3718
+ return;
3719
+ case "ForOfStatement":
3720
+ if (current.await) {
3721
+ reason = "a for await loop";
3722
+ return;
3723
+ }
3724
+ break;
3725
+ case "FunctionDeclaration":
3726
+ case "FunctionExpression":
3727
+ case "ArrowFunctionExpression":
3728
+ if (current.async || current.generator) {
3729
+ reason = current.async ? "an async function" : "a generator";
3730
+ return;
3731
+ }
3732
+ break;
3733
+ case "MetaProperty":
3734
+ reason = "import.meta";
3735
+ return;
3736
+ case "CallExpression":
3737
+ if (current.callee?.type === "Identifier" && current.callee.name === "use") {
3738
+ reason = "a use() call";
3739
+ return;
3740
+ }
3741
+ if (current.callee?.type === "MemberExpression" && !current.callee.computed && current.callee.object?.type === "Identifier" && current.callee.object.name === "Math" && current.callee.property?.name === "random") {
3742
+ reason = "Math.random()";
3743
+ return;
3744
+ }
3745
+ break;
3746
+ case "Identifier":
3747
+ if (IMPURE_GLOBALS.has(current.name) && isReference(current, parent, key)) {
3748
+ reason = `the global ${current.name}`;
3749
+ return;
3750
+ }
3751
+ break;
3752
+ }
3753
+ for (const [childKey, value] of Object.entries(current)) {
3754
+ if (childKey === "start" || childKey === "end" || childKey === "loc" || childKey === "range") {
3755
+ continue;
3756
+ }
3757
+ if (value && typeof value === "object") visit(value, current, childKey);
3758
+ }
3759
+ };
3760
+ for (const statement of program.body) {
3761
+ if (statement.type === "ImportDeclaration") continue;
3762
+ visit(statement, program, "body");
3763
+ if (reason) break;
3764
+ }
3765
+ return { reason, imports };
3766
+ }
3767
+ function isReference(node, parent, key) {
3768
+ if (!parent) return true;
3769
+ if (parent.type === "MemberExpression" && key === "property" && !parent.computed) return false;
3770
+ if ((parent.type === "Property" || parent.type === "MethodDefinition") && key === "key") {
3771
+ return Boolean(parent.computed);
3772
+ }
3773
+ if (parent.type === "PropertyDefinition" && key === "key") return Boolean(parent.computed);
3774
+ if (parent.type.startsWith("TS")) return false;
3775
+ if (parent.type === "JSXAttribute" || parent.type.startsWith("JSX")) return false;
3776
+ if (parent.type === "LabeledStatement" || parent.type === "BreakStatement") return false;
3777
+ if (parent.type === "ContinueStatement") return false;
3778
+ return true;
3779
+ }
3780
+ function readSource(file) {
3781
+ try {
3782
+ noteFarmSourceRead(file);
3783
+ return fs6.readFileSync(file, "utf8");
3784
+ } catch {
3785
+ return null;
3786
+ }
3787
+ }
3788
+ function explainFarmKeptLayoutRender(modulePath, root) {
3789
+ const entry = resolveModuleSourcePath(modulePath, root);
3790
+ if (!entry) return `${modulePath} does not resolve`;
3791
+ const visited = /* @__PURE__ */ new Set();
3792
+ const check = (file) => {
3793
+ if (visited.has(file)) return null;
3794
+ visited.add(file);
3795
+ if (ASSET_SOURCE.test(file)) return null;
3796
+ if (!SCRIPT_SOURCE.test(file)) return `${path9.relative(root, file)} is not a script`;
3797
+ const code = readSource(file);
3798
+ if (code === null) return `${path9.relative(root, file)} cannot be read`;
3799
+ const { reason, imports } = memoizeInFarmSourceSnapshot(
3800
+ "kept-layout-module",
3801
+ code,
3802
+ () => findFarmRequestDecidingConstruct(code, file)
3803
+ );
3804
+ if (reason) return `${path9.relative(root, file)} has ${reason}`;
3805
+ for (const imported of imports) {
3806
+ const allowed = PURE_PACKAGE_IMPORTS.get(imported.source);
3807
+ if (allowed) {
3808
+ if (allowed === "*" || imported.names.every((name) => allowed.has(name))) continue;
3809
+ return `${path9.relative(root, file)} imports ${imported.names.join(", ")} from ${imported.source}`;
3810
+ }
3811
+ if (ASSET_SOURCE.test(imported.source.split("?")[0])) continue;
3812
+ const resolved = resolveImportedModule(file, imported.source, root);
3813
+ if (!resolved.path || !resolved.local) {
3814
+ return `${path9.relative(root, file)} imports ${imported.source}`;
3815
+ }
3816
+ const nested = check(resolved.path);
3817
+ if (nested) return nested;
3818
+ }
3819
+ return null;
3820
+ };
3821
+ return check(entry);
3822
+ }
3823
+ var answers = /* @__PURE__ */ new Map();
3824
+ function canFarmSkipKeptLayoutRender(modulePath, root) {
3825
+ const key = `${root}\0${modulePath}`;
3826
+ const known = answers.get(key);
3827
+ if (known && known.stamps.every(([file, stamp]) => getFarmSourceStamp(file) === stamp)) {
3828
+ return known.skip;
3829
+ }
3830
+ const { result, files } = traceFarmSourceReads(
3831
+ () => explainFarmKeptLayoutRender(modulePath, root) === null
3832
+ );
3833
+ answers.set(key, {
3834
+ skip: result,
3835
+ stamps: files.map((file) => [file, getFarmSourceStamp(file)])
3836
+ });
3837
+ return result;
3838
+ }
3839
+
3527
3840
  // src/server/renderer.ts
3528
3841
  var islands;
3529
3842
  function withFarmIslandsRenders(runtime, islandsRuntime) {
@@ -3783,12 +4096,13 @@ function createRouteStateProps(input) {
3783
4096
  function readAppPackageIdentity(root) {
3784
4097
  try {
3785
4098
  return JSON.parse(
3786
- fs5.readFileSync(path9.join(root || process.cwd(), "package.json"), "utf8")
4099
+ fs7.readFileSync(path10.join(root || process.cwd(), "package.json"), "utf8")
3787
4100
  );
3788
4101
  } catch {
3789
4102
  return {};
3790
4103
  }
3791
4104
  }
4105
+ var pageRequests = /* @__PURE__ */ new WeakMap();
3792
4106
  var ServerRenderer = class {
3793
4107
  constructor(config, routeManager, i18nRuntime, viteServer) {
3794
4108
  this.ssgManifest = [];
@@ -3812,7 +4126,7 @@ var ServerRenderer = class {
3812
4126
  if (this.config.notFound?.component?.trim()) {
3813
4127
  resolveFarmNotFoundComponentPath(this.config, getFarmAppDirectories(this.config));
3814
4128
  }
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(
4129
+ 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
4130
  resolveFarmRendererModule(
3817
4131
  this.config.root || process.cwd(),
3818
4132
  this.config.renderer.server
@@ -3860,7 +4174,7 @@ var ServerRenderer = class {
3860
4174
  configureApp(setupModule.default);
3861
4175
  }
3862
4176
  createPageBoundary(pageElement, options) {
3863
- return this.rendererRuntime.createElement(
4177
+ const boundary = this.rendererRuntime.createElement(
3864
4178
  "div",
3865
4179
  {
3866
4180
  id: "__farm_page__",
@@ -3872,6 +4186,7 @@ var ServerRenderer = class {
3872
4186
  },
3873
4187
  pageElement
3874
4188
  );
4189
+ return options.pageShouldHydrate && !options.layoutShouldHydrate && this.reactRenderer ? this.reactRenderer.markPagePosition(boundary) : boundary;
3875
4190
  }
3876
4191
  /// The app's `<srcDir>/app/globals.css`, linked only when it exists, as the
3877
4192
  /// production build imports it only when it exists. An app without one gets
@@ -4057,6 +4372,7 @@ var ServerRenderer = class {
4057
4372
  await this.initialize();
4058
4373
  if (this.viteServer) await this.applyRendererAppSetup();
4059
4374
  setFarmBasePath(this.config.basePath);
4375
+ this.publishSearchPreserveRoutes();
4060
4376
  setFarmTrailingSlashPreference(this.config.trailingSlash);
4061
4377
  let element = this.rendererRuntime.createElement(input.PageComponent, input.pageProps);
4062
4378
  if (input.LoadingComponent) {
@@ -4113,6 +4429,9 @@ var ServerRenderer = class {
4113
4429
  });
4114
4430
  element = this.createLayoutBoundary(layout.pattern, element);
4115
4431
  }
4432
+ if (input.pageShouldHydrate && !input.layoutShouldHydrate && this.reactRenderer) {
4433
+ element = this.reactRenderer.markLayoutPosition(element);
4434
+ }
4116
4435
  if (input.layoutShouldHydrate) {
4117
4436
  element = this.wrapClientGraph(element);
4118
4437
  }
@@ -4120,6 +4439,137 @@ var ServerRenderer = class {
4120
4439
  rejectLateRedirects: true
4121
4440
  });
4122
4441
  }
4442
+ /**
4443
+ * A built-in docs runtime page (`docs.entry`, no adapter) under layouts that hydrate, or whose
4444
+ * client components are islands: the docs runtime's document with the layout chain
4445
+ * rendered around its body, and the client that hydrates it with the boot data an app page has. Production renders the same tree
4446
+ * (wrapFarmDocsResponseWithLayouts in nitro/universal-build.ts, with docs-layout-tree.ts).
4447
+ * Any other docs response is sent as it is.
4448
+ */
4449
+ async wrapDocsResponseWithLayouts(request2, response) {
4450
+ if (request2.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !response.headers.get("content-type")?.toLowerCase().includes("text/html")) {
4451
+ return response;
4452
+ }
4453
+ await this.initialize();
4454
+ if (this.viteServer) await this.applyRendererAppSetup();
4455
+ const pathname = new URL(request2.url).pathname;
4456
+ const root = this.config.root || process.cwd();
4457
+ const matched = this.routeManager.matchRoute(pathname);
4458
+ const routeManifest = this.routeManager.generateClientManifest(this.config.root);
4459
+ const islandsMode = Boolean(islands && this.islandValues());
4460
+ const layouts = matched.layouts.map((layout) => {
4461
+ const entry = routeManifest.layouts.find((candidate) => candidate.pattern === layout.pattern);
4462
+ return {
4463
+ pattern: layout.pattern,
4464
+ modulePath: layout.modulePath,
4465
+ shouldHydrate: entry?.shouldHydrate === true,
4466
+ islandStrategy: entry?.islandStrategy ?? null,
4467
+ hasIsolatedClientBoundaries: entry?.hasIsolatedClientBoundaries === true,
4468
+ serverTree: entry?.serverTree === true,
4469
+ islands: entry?.hasIsolatedClientBoundaries === true
4470
+ };
4471
+ });
4472
+ if (!farmDocsLayoutsWrapPage(layouts)) return response;
4473
+ const shouldHydrateLayout = layouts.some((layout) => layout.shouldHydrate);
4474
+ const hasIsolatedClientBoundaries = layouts.some(
4475
+ (layout) => layout.hasIsolatedClientBoundaries
4476
+ );
4477
+ const source = await response.text();
4478
+ const bodyMatch = /<body([^>]*)>([\s\S]*?)<\/body>/i.exec(source);
4479
+ if (!bodyMatch) {
4480
+ return new Response(source, {
4481
+ status: response.status,
4482
+ statusText: response.statusText,
4483
+ headers: response.headers
4484
+ });
4485
+ }
4486
+ const modules = await Promise.all(
4487
+ layouts.map((layout) => this.routeManager.loadLayoutModule(layout.modulePath))
4488
+ );
4489
+ const treeLayouts = layouts.map((layout, index) => ({
4490
+ ...layout,
4491
+ Component: modules[index]?.default
4492
+ }));
4493
+ const islandStrategy = resolveFarmDocsLayoutIslandStrategy(treeLayouts);
4494
+ const tree = await createFarmDocsLayoutTree(this.rendererRuntime, {
4495
+ pageHtml: bodyMatch[2],
4496
+ layouts: treeLayouts,
4497
+ params: matched.params,
4498
+ renderServerTreeLayout: islandsMode ? (Layout, props, outlets, pattern) => islands.renderFarmServerTreeLayout(
4499
+ Layout,
4500
+ props,
4501
+ outlets,
4502
+ pattern
4503
+ ) : void 0,
4504
+ layoutKey: islandsMode ? (pattern) => getFarmLayoutKey(pattern, matched.params) : void 0
4505
+ });
4506
+ const rendered = await this.renderElementToDocumentParts(
4507
+ this.rendererRuntime.createElement(
4508
+ "div",
4509
+ { id: "root" },
4510
+ await this.wrapWithIntegrationProviders(
4511
+ shouldHydrateLayout ? this.wrapClientGraph(tree) : tree
4512
+ )
4513
+ )
4514
+ );
4515
+ const rootMarkup = placeFarmDocsLayoutRoot(rendered.html);
4516
+ const clientLayouts = layouts.map((layout) => ({
4517
+ pattern: layout.pattern,
4518
+ modulePath: toViteModuleId(layout.modulePath, root),
4519
+ shouldHydrate: layout.shouldHydrate,
4520
+ islandStrategy: layout.islandStrategy,
4521
+ ...layout.hasIsolatedClientBoundaries ? { hasIsolatedClientBoundaries: true } : {},
4522
+ // Islands mode: the browser rebuilds this layout from its tree, not its module.
4523
+ ...shouldHydrateLayout && layout.serverTree ? { serverTree: true } : {}
4524
+ }));
4525
+ const clientManifest = createFarmDevClientManifest(routeManifest, {
4526
+ sharedAssets: [
4527
+ ...this.devGlobalStylesheetAssets(),
4528
+ ...this.collectDevStyleHrefs().map((href) => ({
4529
+ tag: "link",
4530
+ attrs: { rel: "stylesheet", href }
4531
+ }))
4532
+ ],
4533
+ boot: { layoutPatterns: layouts.map((layout) => layout.pattern) }
4534
+ });
4535
+ const i18nSnapshot = getFarmI18nClientSnapshot();
4536
+ const bootstrapScript = `<script>
4537
+ window.__FARM_PROPS__ = ${serializeInlineValue({ params: matched.params })};
4538
+ window.__FARM_ROUTE_SLOTS__ = [];
4539
+ window.__FARM_DEPLOYMENT_ID__ = ${serializeInlineValue(this.getDeploymentId())};
4540
+ window.__FARM_PATH__ = ${serializeInlineValue(pathname)};
4541
+ window.__FARM_IS_CLIENT__ = false;
4542
+ window.__FARM_PAGE_SHOULD_HYDRATE__ = false;
4543
+ window.__FARM_LAYOUT_SHOULD_HYDRATE__ = ${JSON.stringify(shouldHydrateLayout)};
4544
+ window.__FARM_LAYOUTS__ = ${serializeInlineValue(clientLayouts)};
4545
+ window.__FARM_SHOULD_HYDRATE__ = ${JSON.stringify(shouldHydrateLayout || hasIsolatedClientBoundaries)};
4546
+ window.__FARM_HAS_ISOLATED_CLIENT_BOUNDARIES__ = ${JSON.stringify(hasIsolatedClientBoundaries)};
4547
+ window.__FARM_ISLAND_STRATEGY__ = ${serializeInlineValue(islandStrategy)};
4548
+ window.__FARM_PAGE_MODULE__ = "";
4549
+ window.__FARM_LOADING_MODULE__ = null;
4550
+ window.__FARM_MANIFEST__ = ${serializeInlineValue(clientManifest)};
4551
+ window.__FARM_INTEGRATION_API_MANIFEST__ = ${serializeInlineValue(getRegisteredIntegrationAPIManifest())};
4552
+ window.__FARM_I18N__ = ${i18nSnapshot ? serializeInlineValue(i18nSnapshot) : "null"};
4553
+ </script>`;
4554
+ const head = [
4555
+ ...this.collectDevStyleLinks(),
4556
+ `<script type="module" src="/@vite/client"></script>`,
4557
+ source.includes("window._$HY") ? "" : this.rendererRuntime.generateHydrationScript?.(),
4558
+ bootstrapScript
4559
+ ].filter(Boolean).map((markup) => stampFarmCspNonce(markup)).concat(rendered.head || []).join("\n ");
4560
+ const clientScript = source.includes('src="/@farm/client.js"') ? "" : `
4561
+ ${stampFarmCspNonce(`<script type="module" src="/@farm/client.js"></script>`)}`;
4562
+ const html = source.replace(bodyMatch[0], () => `<body${bodyMatch[1]}>${rootMarkup}${clientScript}</body>`).replace(/<\/head>/i, () => ` ${head}
4563
+ </head>`);
4564
+ const headers = new Headers(response.headers);
4565
+ headers.delete("content-length");
4566
+ headers.delete("etag");
4567
+ return new Response(html, {
4568
+ status: response.status,
4569
+ statusText: response.statusText,
4570
+ headers
4571
+ });
4572
+ }
4123
4573
  async runWithRequestContext(request2, fn) {
4124
4574
  return _runWithCurrentRequest(
4125
4575
  request2,
@@ -4135,10 +4585,10 @@ var ServerRenderer = class {
4135
4585
  * Load SSG manifest from build output
4136
4586
  */
4137
4587
  loadSSGManifest() {
4138
- const manifestPath = path9.join(this.config.root, this.config.outDir, "__ssg_manifest.json");
4588
+ const manifestPath = path10.join(this.config.root, this.config.outDir, "__ssg_manifest.json");
4139
4589
  let content;
4140
4590
  try {
4141
- content = fs5.readFileSync(manifestPath, "utf-8");
4591
+ content = fs7.readFileSync(manifestPath, "utf-8");
4142
4592
  } catch (error) {
4143
4593
  if (error.code === "ENOENT") {
4144
4594
  return;
@@ -4191,26 +4641,23 @@ var ServerRenderer = class {
4191
4641
  this.getPPRCacheKey(pathname, search, locale, origin)
4192
4642
  );
4193
4643
  }
4194
- async cachePPRShell(options, html) {
4644
+ getPPRShellWriteOptions(options) {
4645
+ return {
4646
+ // revalidatePath() takes the route path (`/pricing`), as the docs show, while the shell
4647
+ // answers the public one (`/console/fr/pricing`): either clears it, as in production.
4648
+ paths: [.../* @__PURE__ */ new Set([options.pathname, this.routeManager.toRoutePathname(options.pathname)])],
4649
+ tags: ["ppr"],
4650
+ revalidate: options.revalidate ?? false
4651
+ };
4652
+ }
4653
+ async cachePPRShell(options, html, write, cookieIndependent = false) {
4195
4654
  const key = this.getPPRCacheKey(
4196
4655
  options.pathname,
4197
4656
  options.search,
4198
4657
  options.locale,
4199
4658
  options.origin
4200
4659
  );
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
- );
4660
+ await (write ?? await this.dataCache.pprShellCache.startWriteAsync(this.getPPRShellWriteOptions(options))).commit(key, { html, ...cookieIndependent ? { cookieIndependent: true } : {} });
4214
4661
  emitFarmEvent({
4215
4662
  type: "ppr.shell.cached",
4216
4663
  route: options.pathname,
@@ -4226,9 +4673,6 @@ var ServerRenderer = class {
4226
4673
  if (method !== "GET" && method !== "HEAD") {
4227
4674
  return "method";
4228
4675
  }
4229
- if (withoutFarmDeploymentCookie(req.headers.cookie)) {
4230
- return "cookie";
4231
- }
4232
4676
  if (req.headers.authorization) {
4233
4677
  return "authorization";
4234
4678
  }
@@ -4259,11 +4703,14 @@ var ServerRenderer = class {
4259
4703
  }
4260
4704
  return headers;
4261
4705
  }
4262
- serveCachedPPRShell(res, shell, revalidate) {
4706
+ serveCachedPPRShell(req, res, shell, revalidate) {
4263
4707
  res.setHeader("Content-Type", "text/html; charset=utf-8");
4264
4708
  for (const [key, value] of Object.entries(this.getPPRHeaders("hit", revalidate))) {
4265
4709
  res.setHeader(key, value);
4266
4710
  }
4711
+ if (withoutFarmDeploymentCookie(req.headers.cookie)) {
4712
+ res.setHeader("Cache-Control", "private, no-store");
4713
+ }
4267
4714
  res.write(shell.html);
4268
4715
  res.end();
4269
4716
  }
@@ -4315,6 +4762,9 @@ var ServerRenderer = class {
4315
4762
  });
4316
4763
  pageElement = this.createLayoutBoundary(layouts[i].pattern, pageElement);
4317
4764
  }
4765
+ if (pageMetadata.shouldHydrate && !layoutShouldHydrate && this.reactRenderer) {
4766
+ pageElement = this.reactRenderer.markLayoutPosition(pageElement);
4767
+ }
4318
4768
  const html = await this.rendererRuntime.renderToString(
4319
4769
  await this.wrapWithIntegrationProviders(pageElement)
4320
4770
  );
@@ -4361,10 +4811,10 @@ var ServerRenderer = class {
4361
4811
  return true;
4362
4812
  }
4363
4813
  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");
4814
+ 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");
4815
+ if (fs7.existsSync(htmlPath)) {
4816
+ const stat = fs7.statSync(htmlPath);
4817
+ const html = fs7.readFileSync(htmlPath, "utf-8");
4368
4818
  await this.cacheSSGPage(page, html, {
4369
4819
  document: true,
4370
4820
  createdAt: stat.mtimeMs
@@ -4387,10 +4837,19 @@ var ServerRenderer = class {
4387
4837
  }
4388
4838
  return false;
4389
4839
  }
4840
+ /**
4841
+ * The pages with `search.preserve`, for the links this render draws (set per render, like the
4842
+ * base path, so a routes-file edit applies to the next one). A route manager without the list,
4843
+ * such as a partial test double, has none.
4844
+ */
4845
+ publishSearchPreserveRoutes() {
4846
+ _setFarmSearchPreserveRoutes(this.routeManager.getSearchPreserveRoutes?.() ?? []);
4847
+ }
4390
4848
  async renderPage(req, res) {
4391
4849
  await this.initialize();
4392
4850
  if (this.viteServer) await this.applyRendererAppSetup();
4393
4851
  setFarmBasePath(this.config.basePath);
4852
+ this.publishSearchPreserveRoutes();
4394
4853
  setFarmTrailingSlashPreference(this.config.trailingSlash);
4395
4854
  const cspNonce = createFarmCspNonce(this.security);
4396
4855
  if (cspNonce) {
@@ -4430,6 +4889,13 @@ var ServerRenderer = class {
4430
4889
  * it can stop.
4431
4890
  */
4432
4891
  createPageRequest(req, res) {
4892
+ const existing = pageRequests.get(req);
4893
+ if (existing) return existing;
4894
+ const request2 = this.createPageRequestOnce(req, res);
4895
+ pageRequests.set(req, request2);
4896
+ return request2;
4897
+ }
4898
+ createPageRequestOnce(req, res) {
4433
4899
  const observable = typeof req.once === "function" && typeof res.once === "function";
4434
4900
  return createWebRequestFromFarmRequest(req, {
4435
4901
  trustProxy: this.config.server?.trustProxy,
@@ -4460,6 +4926,7 @@ var ServerRenderer = class {
4460
4926
  durationMs: Date.now() - renderStartTime
4461
4927
  });
4462
4928
  };
4929
+ let pprShellWrite;
4463
4930
  try {
4464
4931
  const url = resolveFarmRequestURL(req, { trustProxy: this.config.server?.trustProxy });
4465
4932
  pathname = url.pathname;
@@ -4647,7 +5114,7 @@ var ServerRenderer = class {
4647
5114
  );
4648
5115
  const canCachePPRShell = renderingConfig.ppr && !pprBypassReason && !islandsNavigationRequest;
4649
5116
  const pprI18nSnapshot = canCachePPRShell ? getFarmI18nClientSnapshot() : void 0;
4650
- const pprShellOptions = canCachePPRShell ? {
5117
+ let pprShellOptions = canCachePPRShell ? {
4651
5118
  pathname,
4652
5119
  search: url.search,
4653
5120
  locale: pprI18nSnapshot?.locale ?? "",
@@ -4670,6 +5137,7 @@ var ServerRenderer = class {
4670
5137
  emitFarmEvent({ type: "ppr.refresh.start", route: pathname });
4671
5138
  }
4672
5139
  }
5140
+ const pprVisitorCookies = Boolean(withoutFarmDeploymentCookie(req.headers.cookie));
4673
5141
  if (pprShellOptions) {
4674
5142
  const pprCacheKey = this.getPPRCacheKey(
4675
5143
  pathname,
@@ -4683,25 +5151,37 @@ var ServerRenderer = class {
4683
5151
  pprShellOptions.locale,
4684
5152
  pprShellOptions.origin
4685
5153
  );
4686
- if (cachedPPRShell) {
5154
+ if (cachedPPRShell && pprVisitorCookies && !cachedPPRShell.value.cookieIndependent) {
5155
+ pprShellOptions = void 0;
5156
+ emitFarmEvent({ type: "ppr.shell.bypass", route: pathname, reason: "cookie" });
5157
+ emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "cookie" });
5158
+ } else if (cachedPPRShell) {
4687
5159
  emitFarmEvent({
4688
5160
  type: "ppr.shell.hit",
4689
5161
  route: pathname,
4690
5162
  key: pprCacheKey
4691
5163
  });
4692
- this.serveCachedPPRShell(res, cachedPPRShell.value, renderingConfig.revalidate);
5164
+ this.serveCachedPPRShell(req, res, cachedPPRShell.value, renderingConfig.revalidate);
4693
5165
  completeRender(res.statusCode || 200, pathname);
4694
5166
  return;
5167
+ } else {
5168
+ emitFarmEvent({
5169
+ type: "ppr.shell.miss",
5170
+ route: pathname,
5171
+ key: pprCacheKey
5172
+ });
5173
+ if (req.method !== "HEAD") {
5174
+ pprShellWrite = await this.dataCache.pprShellCache.startWriteAsync(
5175
+ this.getPPRShellWriteOptions(pprShellOptions)
5176
+ );
5177
+ }
4695
5178
  }
4696
- emitFarmEvent({
4697
- type: "ppr.shell.miss",
4698
- route: pathname,
4699
- key: pprCacheKey
4700
- });
4701
5179
  }
4702
5180
  const outerRequest = _peekCurrentRequest();
4703
5181
  const countRequestReads = () => (outerRequest ? _getRequestReadCount(outerRequest) : 0) + _getRequestReadCount(currentRequest);
4704
5182
  const requestReadsBeforeRender = countRequestReads();
5183
+ const countRequestCookieReads = () => (outerRequest ? _getRequestCookieReadCount(outerRequest) : 0) + _getRequestCookieReadCount(currentRequest);
5184
+ const requestCookieReadsBeforeRender = countRequestCookieReads();
4705
5185
  let LoadingFallbackComponent = null;
4706
5186
  if (loadingBoundaryEntry) {
4707
5187
  const loadingModule = await this.routeManager.loadRouteModule(
@@ -4838,6 +5318,7 @@ var ServerRenderer = class {
4838
5318
  const hasIsolatedClientBoundaries = routeManifestEntry?.hasIsolatedClientBoundaries === true || layoutHydrationMetadata.some((metadata) => metadata.hasIsolatedClientBoundaries === true);
4839
5319
  req.__FARM_PAGE_PATH__ = route.modulePath;
4840
5320
  req.__FARM_ROUTE__ = pathname;
5321
+ req.__FARM_ROOT_LAYOUT_PATH__ = layouts[0]?.modulePath;
4841
5322
  req.__FARM_IS_CLIENT_COMPONENT__ = isClientComponent;
4842
5323
  req.__FARM_PAGE_SHOULD_HYDRATE__ = shouldHydrate;
4843
5324
  req.__FARM_LAYOUT_SHOULD_HYDRATE__ = shouldHydrateLayout;
@@ -4931,7 +5412,8 @@ var ServerRenderer = class {
4931
5412
  const islandsSegments = Boolean(islands && this.islandValues());
4932
5413
  const keptLayoutCount = islandsSegments && !renderingConfig.ssg && !shouldHydrateLayout && renderedRouteSlots.length === 0 ? countFarmKeptLayouts(requestHeader(req, "f-layouts"), layouts, params) : 0;
4933
5414
  let keptLayouts = keptLayoutCount > 1 ? keptLayoutCount : 0;
4934
- if (keptLayouts > 0) {
5415
+ const keptRoot = this.config.root || process.cwd();
5416
+ if (keptLayouts > 0 && !layouts.slice(0, keptLayouts).every((layout) => canFarmSkipKeptLayoutRender(layout.modulePath, keptRoot))) {
4935
5417
  let keptElement = null;
4936
5418
  for (let i = keptLayouts - 1; i >= 0; i--) {
4937
5419
  const KeptLayout = layoutModules[i]?.default;
@@ -5020,8 +5502,14 @@ var ServerRenderer = class {
5020
5502
  wrappedElement
5021
5503
  );
5022
5504
  }
5505
+ if ((isClientComponent || shouldHydrate) && !shouldHydrateLayout && this.reactRenderer) {
5506
+ wrappedElement = this.reactRenderer.markLayoutPosition(wrappedElement);
5507
+ }
5023
5508
  const integratedElement = await this.wrapWithIntegrationProviders(wrappedElement);
5024
5509
  const pprHeaders = renderingConfig.ppr ? this.getPPRHeaders(pprShellOptions ? "miss" : "bypass", renderingConfig.revalidate) : void 0;
5510
+ if (pprHeaders && pprShellOptions && pprVisitorCookies) {
5511
+ pprHeaders["Cache-Control"] = "private, no-store";
5512
+ }
5025
5513
  await this.renderWithSSR(
5026
5514
  integratedElement,
5027
5515
  req,
@@ -5054,7 +5542,26 @@ var ServerRenderer = class {
5054
5542
  });
5055
5543
  return;
5056
5544
  }
5057
- return this.cachePPRShell(pprShellOptions, html);
5545
+ const renderReadCookies = countRequestCookieReads() !== requestCookieReadsBeforeRender;
5546
+ if (renderReadCookies && pprVisitorCookies) {
5547
+ emitFarmEvent({
5548
+ type: "ppr.shell.bypass",
5549
+ route: pathname,
5550
+ reason: "cookie"
5551
+ });
5552
+ emitFarmEvent({
5553
+ type: "cache.bypass",
5554
+ route: pathname,
5555
+ reason: "cookie"
5556
+ });
5557
+ return;
5558
+ }
5559
+ return this.cachePPRShell(
5560
+ pprShellOptions,
5561
+ html,
5562
+ pprShellWrite,
5563
+ !renderReadCookies
5564
+ );
5058
5565
  } : void 0
5059
5566
  }
5060
5567
  );
@@ -5145,13 +5652,16 @@ var ServerRenderer = class {
5145
5652
  pluginExposedContext,
5146
5653
  error,
5147
5654
  statusCode: errorStatus,
5148
- errorModulePath: errorBoundaryEntry.modulePath
5655
+ errorModulePath: errorBoundaryEntry.modulePath,
5656
+ errorPattern: errorBoundaryEntry.pattern
5149
5657
  });
5150
5658
  if (rendered) {
5151
5659
  return;
5152
5660
  }
5153
5661
  }
5154
5662
  await this.renderError(req, res, error, errorStatus);
5663
+ } finally {
5664
+ pprShellWrite?.release();
5155
5665
  }
5156
5666
  }
5157
5667
  async wrapWithIntegrationProviders(element) {
@@ -5176,11 +5686,11 @@ var ServerRenderer = class {
5176
5686
  if (isFarmIntegrationProviderComponentReference(provider.component)) {
5177
5687
  providerSourceModule = provider.component.module;
5178
5688
  const providerModuleId = provider.component.module.startsWith(".") ? toViteModuleId(
5179
- path9.resolve(this.config.root, provider.component.module),
5689
+ path10.resolve(this.config.root, provider.component.module),
5180
5690
  this.config.root
5181
5691
  ) : provider.component.module;
5182
5692
  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
5693
+ provider.component.module.startsWith(".") ? pathToFileURL2(path10.resolve(this.config.root, provider.component.module)).href : provider.component.module
5184
5694
  );
5185
5695
  ProviderComponent = providerModule[provider.component.export || "default"];
5186
5696
  } else if (typeof provider.component === "function") {
@@ -5449,7 +5959,7 @@ var ServerRenderer = class {
5449
5959
  logger.warn(`Could not read metadata for ${pattern} in sitemap.xml: ${error}`);
5450
5960
  return void 0;
5451
5961
  }),
5452
- fs5.promises.stat(route.modulePath).catch(() => void 0)
5962
+ fs7.promises.stat(route.modulePath).catch(() => void 0)
5453
5963
  ]);
5454
5964
  if (await this.isAgentPageNoIndex(pattern, module?.metadata)) return null;
5455
5965
  return { pattern, module, lastModified: stat?.mtime.toISOString() };
@@ -5536,7 +6046,7 @@ var ServerRenderer = class {
5536
6046
  const server = this.getDefaultMCPServer();
5537
6047
  const request2 = getCurrentRequestOrNull() ?? createWebRequestFromFarmRequest(req, { trustProxy: this.config.server?.trustProxy });
5538
6048
  try {
5539
- const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-HX4F4VKN.mjs");
6049
+ const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-PJKZHYSA.mjs");
5540
6050
  const origin = new URL(request2.url).origin;
5541
6051
  const i18n = this.i18nRuntime?.config;
5542
6052
  const metadataBase = await this.getRootMetadataBase();
@@ -5752,7 +6262,7 @@ var ServerRenderer = class {
5752
6262
  res.end();
5753
6263
  return;
5754
6264
  }
5755
- res.write(await fs5.promises.readFile(image.modulePath));
6265
+ res.write(await fs7.promises.readFile(image.modulePath));
5756
6266
  res.end();
5757
6267
  }
5758
6268
  async renderRouteErrorBoundary(req, res, options) {
@@ -5781,8 +6291,14 @@ var ServerRenderer = class {
5781
6291
  }
5782
6292
  });
5783
6293
  let wrapped = errorElement;
6294
+ const boundaryLayouts = options.errorPattern === void 0 ? options.layouts : options.layouts.filter(
6295
+ (layout) => !("pattern" in layout) || routeBoundaryCoversDirectory(
6296
+ layout.pattern,
6297
+ options.errorPattern
6298
+ )
6299
+ );
5784
6300
  const layoutModules = await Promise.all(
5785
- options.layouts.map((layout) => this.routeManager.loadLayoutModule(layout.modulePath))
6301
+ boundaryLayouts.map((layout) => this.routeManager.loadLayoutModule(layout.modulePath))
5786
6302
  );
5787
6303
  for (let i = layoutModules.length - 1; i >= 0; i--) {
5788
6304
  const LayoutComponent = layoutModules[i].default;
@@ -5903,7 +6419,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
5903
6419
  getTheme()
5904
6420
  );
5905
6421
  themeDocument.head = farmScripts(themeDocument.head);
5906
- const fullDocument = extractFarmFullDocument(content);
6422
+ const fullDocument = extractFarmFullDocument(markFarmDocumentLayouts(content));
5907
6423
  let html;
5908
6424
  if (fullDocument) {
5909
6425
  const shouldReplaceLayoutTitle = hasExplicitTitle || rendererHasTitle;
@@ -5985,12 +6501,11 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
5985
6501
  * this up front keeps a route's first request on the buffered path too; a layout this cannot
5986
6502
  * call (async, a class, or one using hooks) falls back to detection from the stream.
5987
6503
  */
5988
- async rootLayoutRendersDocument() {
5989
- if (typeof this.routeManager.getLayouts !== "function") return false;
5990
- const rootLayout = this.routeManager.getLayouts().get("/");
5991
- if (!rootLayout) return false;
6504
+ async rootLayoutRendersDocument(req) {
6505
+ const modulePath = req.__FARM_ROOT_LAYOUT_PATH__ ?? (typeof this.routeManager.getLayouts === "function" ? this.routeManager.getLayouts().get("/")?.modulePath : void 0);
6506
+ if (!modulePath) return false;
5992
6507
  try {
5993
- const Layout = (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).default;
6508
+ const Layout = (await this.routeManager.loadLayoutModule(modulePath)).default;
5994
6509
  if (typeof Layout !== "function" || Layout.prototype?.isReactComponent || Layout.constructor?.name === "AsyncFunction") {
5995
6510
  return false;
5996
6511
  }
@@ -6015,7 +6530,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6015
6530
  async renderWithSSR(element, req, res, clearMiddlewareData, options = {}) {
6016
6531
  const renderToPipeableStream = this.rendererRuntime.renderToPipeableStream;
6017
6532
  const fullDocumentRouteKey = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
6018
- const streamDocument = fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument();
6533
+ const streamDocument = fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument(req);
6019
6534
  if (!renderToPipeableStream || _isFarmMarkdownPageCheck(req.headers?.[FARM_MARKDOWN_PAGE_CHECK_HEADER]) || streamDocument && (options.captureStaticShell || !isReactRenderer(this.config.renderer))) {
6020
6535
  return this.renderBufferedSSR(element, req, res, clearMiddlewareData, options);
6021
6536
  }
@@ -6191,7 +6706,9 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6191
6706
  const documentTransform = streamDocument ? createFarmStreamedDocumentTransform(
6192
6707
  (opening) => withEarlyClient(
6193
6708
  openFarmStreamedDocument(
6194
- hasExplicitTitle ? removeFarmDocumentTitles(opening) : opening,
6709
+ markFarmDocumentLayouts(
6710
+ hasExplicitTitle ? removeFarmDocumentTitles(opening) : opening
6711
+ ),
6195
6712
  {
6196
6713
  fallbackIcon: !hasFavicon,
6197
6714
  viewport: viewportTags,
@@ -6530,13 +7047,13 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6530
7047
  res.end(createFarmMarkdownErrorBody(404, pathname, this.config.basePath || "/"));
6531
7048
  return;
6532
7049
  }
6533
- const appDir = path9.join(this.config.root, this.config.srcDir, "app");
7050
+ const appDir = path10.join(this.config.root, this.config.srcDir, "app");
6534
7051
  const notFoundExtensions = getFarmRendererComponentExtensions(this.config.renderer);
6535
7052
  let layoutModule = null;
6536
7053
  try {
6537
7054
  for (const ext of notFoundExtensions) {
6538
- const layoutPath = path9.join(appDir, `layout${ext}`);
6539
- if (fs5.existsSync(layoutPath)) {
7055
+ const layoutPath = path10.join(appDir, `layout${ext}`);
7056
+ if (fs7.existsSync(layoutPath)) {
6540
7057
  layoutModule = await this.routeManager.loadLayoutModule(layoutPath);
6541
7058
  break;
6542
7059
  }
@@ -6629,7 +7146,8 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6629
7146
  getI18nAlternateOptions(req, metadata) {
6630
7147
  return {
6631
7148
  metadataBase: metadata?.metadataBase,
6632
- origin: req ? resolveFarmRequestURL(req, { trustProxy: this.config.server?.trustProxy }).origin : void 0
7149
+ origin: req ? resolveFarmRequestURL(req, { trustProxy: this.config.server?.trustProxy }).origin : void 0,
7150
+ languages: metadata?.alternates?.languages
6633
7151
  };
6634
7152
  }
6635
7153
  createFullHTML(content, isClientComponent = false, requestPath = "/", metadataHead, alternates = {}) {
@@ -6658,7 +7176,7 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
6658
7176
  this.rendererRuntime.generateHydrationScript?.() || ""
6659
7177
  );
6660
7178
  const viewportTags = renderViewportHead(alternates.metadata?.viewport);
6661
- const fullDocument = extractFarmFullDocument(content);
7179
+ const fullDocument = extractFarmFullDocument(markFarmDocumentLayouts(content));
6662
7180
  if (fullDocument) {
6663
7181
  return composeFarmFullDocument(
6664
7182
  metadataHead ? removeFarmDocumentTitles(fullDocument) : fullDocument,
@@ -6756,7 +7274,7 @@ ${clientScript}
6756
7274
  };
6757
7275
 
6758
7276
  // src/app.ts
6759
- import path10 from "path";
7277
+ import path11 from "path";
6760
7278
  var defaultDocsConfig = {
6761
7279
  enabled: false,
6762
7280
  entry: "/docs",
@@ -6886,7 +7404,7 @@ var FarmApp = class {
6886
7404
  const files = [
6887
7405
  ...this.routeManager.getRoutes().values(),
6888
7406
  ...this.routeManager.getLayouts().values()
6889
- ].map((entry) => path10.relative(this.config.root, entry.modulePath).split(path10.sep).join("/"));
7407
+ ].map((entry) => path11.relative(this.config.root, entry.modulePath).split(path11.sep).join("/"));
6890
7408
  if (files.length === 0) return;
6891
7409
  throw new Error(
6892
7410
  `This app sets \`renderer: false\`, which serves API routes only, but it has pages or layouts:
@@ -6912,7 +7430,7 @@ var FarmApp = class {
6912
7430
  }
6913
7431
  const componentExtensions = getFarmRendererComponentExtensions(this.config.renderer);
6914
7432
  const rootLayoutPaths = appDirs.flatMap(
6915
- (appDir) => componentExtensions.map((extension) => path10.join(appDir, `layout${extension}`))
7433
+ (appDir) => componentExtensions.map((extension) => path11.join(appDir, `layout${extension}`))
6916
7434
  );
6917
7435
  const hasRootLayout = await Promise.all(rootLayoutPaths.map((p) => fileExists(p))).then(
6918
7436
  (results) => results.some(Boolean)
@@ -6975,14 +7493,26 @@ function resolveFarmImageServerRuntime(images, preset) {
6975
7493
  return provider === "cloudflare" || provider === "auto" && cloudflarePreset ? "cloudflare" : "node";
6976
7494
  }
6977
7495
 
7496
+ // src/markdown-source-path.ts
7497
+ import path12 from "path";
7498
+ function toBakedMarkdownSourcePath(root, filePath) {
7499
+ if (!filePath) return "";
7500
+ if (!path12.isAbsolute(filePath)) return filePath.split(path12.sep).join("/");
7501
+ const relative3 = path12.relative(root, filePath);
7502
+ if (!relative3 || relative3.startsWith("..") || path12.isAbsolute(relative3)) {
7503
+ return path12.basename(filePath);
7504
+ }
7505
+ return relative3.split(path12.sep).join("/");
7506
+ }
7507
+
6978
7508
  // src/app-manifest-packages.ts
6979
- import fs6 from "fs";
6980
- import path11 from "path";
7509
+ import fs8 from "fs";
7510
+ import path13 from "path";
6981
7511
  var FARM_PACKAGE = /^@(?:farm\.js|farming-labs)\/[a-z0-9._-]+$/;
6982
7512
  function resolveFarmAppPackages(root) {
6983
7513
  let manifest;
6984
7514
  try {
6985
- manifest = JSON.parse(fs6.readFileSync(path11.join(root, "package.json"), "utf8"));
7515
+ manifest = JSON.parse(fs8.readFileSync(path13.join(root, "package.json"), "utf8"));
6986
7516
  } catch {
6987
7517
  return {};
6988
7518
  }
@@ -6997,13 +7527,13 @@ function resolveFarmAppPackages(root) {
6997
7527
  for (let dir = root; ; ) {
6998
7528
  try {
6999
7529
  const { version } = JSON.parse(
7000
- fs6.readFileSync(path11.join(dir, "node_modules", name, "package.json"), "utf8")
7530
+ fs8.readFileSync(path13.join(dir, "node_modules", name, "package.json"), "utf8")
7001
7531
  );
7002
7532
  if (typeof version === "string" && /^[0-9A-Za-z.+-]{1,64}$/.test(version))
7003
7533
  versions[name] = version;
7004
7534
  break;
7005
7535
  } catch {
7006
- const parent = path11.dirname(dir);
7536
+ const parent = path13.dirname(dir);
7007
7537
  if (parent === dir) break;
7008
7538
  dir = parent;
7009
7539
  }
@@ -7013,9 +7543,9 @@ function resolveFarmAppPackages(root) {
7013
7543
  }
7014
7544
 
7015
7545
  // src/app-manifest-webmcp.ts
7016
- import fs7 from "fs";
7546
+ import fs9 from "fs";
7017
7547
  import { createRequire as createRequire2 } from "module";
7018
- import path12 from "path";
7548
+ import path14 from "path";
7019
7549
  import { globSync } from "tinyglobby";
7020
7550
  var WEBMCP_CLIENT = "@farm.js/webmcp/client";
7021
7551
  var DEFINERS = /* @__PURE__ */ new Set(["defineWebMCPTool", "registerWebMCPTool", "registerWebMCPTools"]);
@@ -7033,7 +7563,7 @@ var LANGS = {
7033
7563
  cjs: "jsx",
7034
7564
  jsx: "jsx"
7035
7565
  };
7036
- var parseAst2;
7566
+ var parseAst3;
7037
7567
  function staticValue(node) {
7038
7568
  if (!node) return NOT_STATIC;
7039
7569
  switch (node.type) {
@@ -7110,13 +7640,13 @@ function toolFromObject(object) {
7110
7640
  }
7111
7641
  function findFarmWebMCPTools(code, filename = "module.tsx") {
7112
7642
  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)(
7643
+ const lang = LANGS[path14.extname(filename).slice(1)] ?? "tsx";
7644
+ parseAst3 ?? (parseAst3 = createRequire2(typeof __filename === "string" ? __filename : import.meta.url)(
7115
7645
  "rolldown/parseAst"
7116
7646
  ).parseAst);
7117
7647
  let program;
7118
7648
  try {
7119
- program = parseAst2(code, { lang });
7649
+ program = parseAst3(code, { lang });
7120
7650
  } catch {
7121
7651
  return [];
7122
7652
  }
@@ -7157,7 +7687,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
7157
7687
  }
7158
7688
  var cache = /* @__PURE__ */ new Map();
7159
7689
  function collectFarmWebMCPTools(root, srcDir = "src") {
7160
- const base = path12.resolve(root, srcDir);
7690
+ const base = path14.resolve(root, srcDir);
7161
7691
  let files;
7162
7692
  try {
7163
7693
  files = globSync("**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}", {
@@ -7174,7 +7704,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
7174
7704
  for (const file of files.sort()) {
7175
7705
  let mtimeMs;
7176
7706
  try {
7177
- mtimeMs = fs7.statSync(file).mtimeMs;
7707
+ mtimeMs = fs9.statSync(file).mtimeMs;
7178
7708
  } catch {
7179
7709
  continue;
7180
7710
  }
@@ -7182,7 +7712,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
7182
7712
  if (!entry || entry.mtimeMs !== mtimeMs) {
7183
7713
  let code = "";
7184
7714
  try {
7185
- code = fs7.readFileSync(file, "utf8");
7715
+ code = fs9.readFileSync(file, "utf8");
7186
7716
  } catch {
7187
7717
  }
7188
7718
  entry = { mtimeMs, tools: findFarmWebMCPTools(code, file) };
@@ -7198,8 +7728,8 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
7198
7728
  }
7199
7729
 
7200
7730
  // src/client-cache-persistence-build.ts
7201
- import fs8 from "fs";
7202
- import path13 from "path";
7731
+ import fs10 from "fs";
7732
+ import path15 from "path";
7203
7733
  var ADAPTER_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
7204
7734
  function resolveFarmClientCacheAdapterEntry(root, cache2) {
7205
7735
  const client = cache2?.client;
@@ -7210,7 +7740,7 @@ function resolveFarmClientCacheAdapterEntry(root, cache2) {
7210
7740
  'cache.client.adapter must be a module path string, for example "./src/cache-adapter".'
7211
7741
  );
7212
7742
  }
7213
- const resolved = path13.resolve(root, adapter);
7743
+ const resolved = path15.resolve(root, adapter);
7214
7744
  const found = resolveAdapterFile(resolved);
7215
7745
  if (!found) {
7216
7746
  throw new Error(
@@ -7223,10 +7753,10 @@ function resolveFarmClientCacheAdapterEntry(root, cache2) {
7223
7753
  return { importPath: found.replace(/\\/g, "/"), options };
7224
7754
  }
7225
7755
  function resolveAdapterFile(resolved) {
7226
- if (fs8.existsSync(resolved) && fs8.statSync(resolved).isFile()) return resolved;
7756
+ if (fs10.existsSync(resolved) && fs10.statSync(resolved).isFile()) return resolved;
7227
7757
  for (const extension of ADAPTER_EXTENSIONS) {
7228
7758
  const candidate = `${resolved}.${extension}`;
7229
- if (fs8.existsSync(candidate) && fs8.statSync(candidate).isFile()) return candidate;
7759
+ if (fs10.existsSync(candidate) && fs10.statSync(candidate).isFile()) return candidate;
7230
7760
  }
7231
7761
  return void 0;
7232
7762
  }
@@ -7269,14 +7799,27 @@ function farmChildrenToArray(children) {
7269
7799
 
7270
7800
  function unwrapFarmDocumentElement(node) {
7271
7801
  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
- });
7802
+ let body;
7803
+ function documentChild(child) {
7804
+ if (React.isValidElement(child)) {
7805
+ if (child.type === "body" && !body) body = child;
7806
+ return child.type === "head" ? null : child;
7807
+ }
7808
+ if (child && typeof child === "object" && typeof child[Symbol.iterator] === "function") {
7809
+ return Array.from(child, documentChild);
7810
+ }
7811
+ return child;
7812
+ }
7813
+ const children = documentChild(node.props.children);
7814
+ if (!body) return farmChildrenToArray(children);
7815
+
7816
+ // React derives useId from the size and index of each sibling array. Keep
7817
+ // the body's original slot, including empty siblings and nested arrays.
7818
+ function bodySlot(child) {
7819
+ if (Array.isArray(child)) return child.map(bodySlot);
7820
+ return child === body ? (body.props.children ?? null) : null;
7821
+ }
7822
+ return bodySlot(children);
7280
7823
  }
7281
7824
 
7282
7825
  function farmLayoutBoundaryElement(pattern, content) {
@@ -7575,8 +8118,8 @@ function restoreFarmServerFields(captured, root) {
7575
8118
  `;
7576
8119
 
7577
8120
  // src/utils/hook-filters.ts
7578
- import { realpathSync as realpathSync2 } from "fs";
7579
- import path14 from "path";
8121
+ import { realpathSync } from "fs";
8122
+ import path16 from "path";
7580
8123
  function escapeRegExp(value) {
7581
8124
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
7582
8125
  }
@@ -7586,9 +8129,9 @@ function exactIdPattern(ids) {
7586
8129
  function fileNamePattern(files) {
7587
8130
  const names = /* @__PURE__ */ new Set();
7588
8131
  for (const file of files) {
7589
- names.add(path14.basename(file));
8132
+ names.add(path16.basename(file));
7590
8133
  try {
7591
- names.add(path14.basename(realpathSync2(file)));
8134
+ names.add(path16.basename(realpathSync(file)));
7592
8135
  } catch {
7593
8136
  }
7594
8137
  }
@@ -7596,10 +8139,10 @@ function fileNamePattern(files) {
7596
8139
  }
7597
8140
 
7598
8141
  // src/docs/client-config.ts
7599
- import { realpathSync as realpathSync3 } from "fs";
8142
+ import { realpathSync as realpathSync2 } from "fs";
7600
8143
  import { createRequire as createRequire3 } from "module";
7601
- import path15 from "path";
7602
- var parseAst3;
8144
+ import path17 from "path";
8145
+ var parseAst4;
7603
8146
  function propertyKeyName(property2) {
7604
8147
  if (property2.computed) return void 0;
7605
8148
  const key = property2.key;
@@ -7608,11 +8151,11 @@ function propertyKeyName(property2) {
7608
8151
  return void 0;
7609
8152
  }
7610
8153
  function redactFarmDocsClientConfig(code, filename) {
7611
- parseAst3 ?? (parseAst3 = createRequire3(typeof __filename === "string" ? __filename : import.meta.url)(
8154
+ parseAst4 ?? (parseAst4 = createRequire3(typeof __filename === "string" ? __filename : import.meta.url)(
7612
8155
  "rolldown/parseAst"
7613
8156
  ).parseAst);
7614
- const extension = path15.extname(filename);
7615
- const program = parseAst3(code, {
8157
+ const extension = path17.extname(filename);
8158
+ const program = parseAst4(code, {
7616
8159
  lang: extension === ".tsx" || extension === ".jsx" ? "tsx" : "ts"
7617
8160
  });
7618
8161
  const edits = [];
@@ -7655,7 +8198,7 @@ function isFarmDocsClientConfigModule(id, configModule) {
7655
8198
  const file = id.split("?")[0].replace(/\\/g, "/");
7656
8199
  if (file === configModule) return true;
7657
8200
  try {
7658
- return file === realpathSync3(configModule).replace(/\\/g, "/");
8201
+ return file === realpathSync2(configModule).replace(/\\/g, "/");
7659
8202
  } catch {
7660
8203
  return false;
7661
8204
  }
@@ -7676,8 +8219,57 @@ function farmDocsClientConfigPlugin(configModule) {
7676
8219
  };
7677
8220
  }
7678
8221
 
8222
+ // src/video-player.ts
8223
+ var FARM_VIDEO_PLAYER_HTML = `<!doctype html>
8224
+ <html lang="en">
8225
+ <head>
8226
+ <meta charset="utf-8">
8227
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8228
+ <meta name="robots" content="noindex">
8229
+ <title>Video</title>
8230
+ <style>
8231
+ html, body { height: 100%; margin: 0; background: #000; }
8232
+ video { display: block; width: 100%; height: 100%; object-fit: contain; }
8233
+ </style>
8234
+ </head>
8235
+ <body>
8236
+ <video controls muted playsinline preload="metadata"></video>
8237
+ <script>
8238
+ (() => {
8239
+ const params = new URLSearchParams(location.search);
8240
+ const sameOrigin = (value) => {
8241
+ if (!value) return null;
8242
+ try {
8243
+ const url = new URL(value, location.href);
8244
+ return url.origin === location.origin ? url.href : null;
8245
+ } catch {
8246
+ return null;
8247
+ }
8248
+ };
8249
+ const src = sameOrigin(params.get("src"));
8250
+ if (!src) return;
8251
+ const video = document.querySelector("video");
8252
+ const poster = sameOrigin(params.get("poster"));
8253
+ if (poster) video.poster = poster;
8254
+ video.addEventListener(
8255
+ "loadedmetadata",
8256
+ () => {
8257
+ if (video.duration > 10) return;
8258
+ video.loop = true;
8259
+ // A browser may refuse autoplay; the controls still play it.
8260
+ video.play().catch(() => {});
8261
+ },
8262
+ { once: true },
8263
+ );
8264
+ video.src = src;
8265
+ })();
8266
+ </script>
8267
+ </body>
8268
+ </html>
8269
+ `;
8270
+
7679
8271
  // src/server/vite-config.ts
7680
- import path16 from "path";
8272
+ import path18 from "path";
7681
8273
  var FARM_CLIENT_ENTRY_PATTERN = "**/{page,layout,loading,error,not-found,default}.{js,jsx,ts,tsx}";
7682
8274
  var FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE = [
7683
8275
  "react",
@@ -7704,9 +8296,9 @@ function getFarmClientOptimizeDepsInclude(renderer) {
7704
8296
  );
7705
8297
  }
7706
8298
  function createFarmClientOptimizeDepsEntries(projectRoot, appDirectories) {
7707
- const resolvedProjectRoot = path16.resolve(projectRoot);
8299
+ const resolvedProjectRoot = path18.resolve(projectRoot);
7708
8300
  return appDirectories.map((appDirectory) => {
7709
- const relativeAppDirectory = path16.relative(resolvedProjectRoot, path16.resolve(appDirectory)).replace(/\\/g, "/");
8301
+ const relativeAppDirectory = path18.relative(resolvedProjectRoot, path18.resolve(appDirectory)).replace(/\\/g, "/");
7710
8302
  const prefix = relativeAppDirectory || ".";
7711
8303
  return `${prefix}/${FARM_CLIENT_ENTRY_PATTERN}`;
7712
8304
  });
@@ -7729,7 +8321,7 @@ function createFarmClientOptimizeDepsConfig(entries, renderer) {
7729
8321
  }
7730
8322
  function createFarmSourceAlias(projectRoot, srcDir = "src") {
7731
8323
  return {
7732
- "@": path16.resolve(projectRoot, srcDir)
8324
+ "@": path18.resolve(projectRoot, srcDir)
7733
8325
  };
7734
8326
  }
7735
8327
  function mergeNoExternal(farmValue, userValue) {
@@ -7918,11 +8510,12 @@ export {
7918
8510
  inspectStaticMetadataImage,
7919
8511
  RouteManager,
7920
8512
  createFarmDevClientManifest,
8513
+ farmFontImportsPlugin,
8514
+ mergeFarmFontCss,
7921
8515
  resolveDevGlobalStylesheetHref,
7922
8516
  collectDevStylesheetUrls,
8517
+ farmDevServerStylesheetsPlugin,
7923
8518
  resolveFarmNotFoundComponentPath,
7924
- farmFontImportsPlugin,
7925
- mergeFarmFontCss,
7926
8519
  DEFAULT_NOT_FOUND_STYLES,
7927
8520
  generateFarmIntegrationProviderClientCode,
7928
8521
  generateFarmIntegrationProviderServerModules,
@@ -7930,12 +8523,14 @@ export {
7930
8523
  invalidateFarmRouteRootInferences,
7931
8524
  resolveFarmRouteRootStrategy,
7932
8525
  canBootFarmIslandsClient,
8526
+ canFarmSkipKeptLayoutRender,
7933
8527
  ServerRenderer,
7934
8528
  FarmApp,
7935
8529
  createFarmApp,
7936
8530
  SHARP_INSTALL_HINT,
7937
8531
  resolveFarmImageProviderForRuntime,
7938
8532
  resolveFarmImageServerRuntime,
8533
+ toBakedMarkdownSourcePath,
7939
8534
  resolveFarmAppPackages,
7940
8535
  collectFarmWebMCPTools,
7941
8536
  resolveFarmClientCacheAdapterEntry,
@@ -7950,6 +8545,7 @@ export {
7950
8545
  redactFarmDocsClientConfig,
7951
8546
  isFarmDocsClientConfigModule,
7952
8547
  farmDocsClientConfigPlugin,
8548
+ FARM_VIDEO_PLAYER_HTML,
7953
8549
  createFarmClientOptimizeDepsEntries,
7954
8550
  createFarmClientOptimizeDepsConfig,
7955
8551
  createFarmSourceAlias,