@farm.js/core 0.1.78 → 0.1.81

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 (467) hide show
  1. package/dist/{agent-mcp-handler-EDJNU224.mjs → agent-mcp-handler-GDY5CPPW.mjs} +5 -5
  2. package/dist/{agent-mcp-handler-LNBYLRTZ.cjs → agent-mcp-handler-IUL6OPC3.cjs} +6 -6
  3. package/dist/{agent-mcp.d-BErtnhV2.d.ts → agent-mcp.d-Cxi3214_.d.ts} +1 -1
  4. package/dist/{agent-mcp.d-CYHfcjur.d.mts → agent-mcp.d-DMqOqnOA.d.mts} +1 -1
  5. package/dist/agent-runtime.cjs +2 -2
  6. package/dist/agent-runtime.d.mts +5 -4
  7. package/dist/agent-runtime.d.ts +5 -4
  8. package/dist/agent-runtime.mjs +1 -1
  9. package/dist/analyzer-435DCIQ6.cjs +17 -0
  10. package/dist/{analyzer-M2BG6QYU.mjs → analyzer-IC66UJCU.mjs} +3 -2
  11. package/dist/api/client.cjs +1 -1
  12. package/dist/api/client.mjs +1 -1
  13. package/dist/api/client.native.cjs +1 -1
  14. package/dist/api/client.native.mjs +1 -1
  15. package/dist/api/node.cjs +7 -7
  16. package/dist/api/node.d.mts +7 -6
  17. package/dist/api/node.d.ts +7 -6
  18. package/dist/api/node.mjs +6 -6
  19. package/dist/api/route-manager.cjs +10 -10
  20. package/dist/api/route-manager.d.mts +7 -6
  21. package/dist/api/route-manager.d.ts +7 -6
  22. package/dist/api/route-manager.mjs +9 -9
  23. package/dist/api/runtime.cjs +6 -6
  24. package/dist/api/runtime.d.mts +6 -5
  25. package/dist/api/runtime.d.ts +6 -5
  26. package/dist/api/runtime.mjs +5 -5
  27. package/dist/api.cjs +12 -12
  28. package/dist/api.d.mts +8 -7
  29. package/dist/api.d.ts +8 -7
  30. package/dist/api.mjs +11 -11
  31. package/dist/{app-manifest.d-6NCkLQ1y.d.mts → app-manifest.d-Bbxp5kes.d.mts} +1 -1
  32. package/dist/{app-manifest.d-DuqLBcmi.d.ts → app-manifest.d-C8Cswd31.d.ts} +1 -1
  33. package/dist/app-markdown.cjs +5 -5
  34. package/dist/app-markdown.d.mts +8 -7
  35. package/dist/app-markdown.d.ts +8 -7
  36. package/dist/app-markdown.mjs +4 -4
  37. package/dist/{app.d-Dk2HkvPh.d.mts → app.d-BJuSurgy.d.mts} +13 -4
  38. package/dist/{app.d-Bz6vYBFF.d.ts → app.d-DGIoFt5D.d.ts} +13 -4
  39. package/dist/cache.cjs +3 -3
  40. package/dist/cache.mjs +2 -2
  41. package/dist/{chunk-PG7J7XYT.cjs → chunk-26WP75W5.cjs} +38 -22
  42. package/dist/{chunk-QYOAGT3E.cjs → chunk-2BEGVSDF.cjs} +6 -5
  43. package/dist/{chunk-GCRT6GJG.mjs → chunk-2HMSSPCZ.mjs} +26 -0
  44. package/dist/{chunk-2YJ4DHTD.cjs → chunk-2NOHVIJ3.cjs} +2 -2
  45. package/dist/{chunk-GDM3ZD2O.cjs → chunk-2OFP3IVA.cjs} +5 -1
  46. package/dist/{chunk-7KDCVSTR.mjs → chunk-2PFGA6PB.mjs} +2 -2
  47. package/dist/chunk-2UYYXSUS.mjs +401 -0
  48. package/dist/{chunk-DD2ANOEF.cjs → chunk-2Y2HRZQY.cjs} +843 -627
  49. package/dist/{chunk-PL7MCYYD.mjs → chunk-3AV4DCXY.mjs} +58 -358
  50. package/dist/{chunk-3GNHJ3RN.cjs → chunk-3BTN3NP7.cjs} +2 -2
  51. package/dist/{chunk-XT2CHTDN.mjs → chunk-3RVLJTFZ.mjs} +6 -6
  52. package/dist/{chunk-VJ6L7TII.cjs → chunk-3SPECQXI.cjs} +31 -20
  53. package/dist/{chunk-ODYKCC6W.cjs → chunk-46UV2E7I.cjs} +156 -104
  54. package/dist/{chunk-F4ID7BGO.cjs → chunk-4OFWG4IK.cjs} +7 -7
  55. package/dist/{chunk-VRI43FDN.mjs → chunk-4WXNTAOM.mjs} +1 -1
  56. package/dist/{chunk-QMR2TUVZ.cjs → chunk-52Q4OB4A.cjs} +4 -4
  57. package/dist/chunk-5MMKNW7Q.cjs +54 -0
  58. package/dist/{chunk-RIMEFQYO.mjs → chunk-5N526T7Q.mjs} +116 -86
  59. package/dist/{chunk-CYNQPKA4.cjs → chunk-5ZHC6QGD.cjs} +2 -2
  60. package/dist/{chunk-ALEUMLJN.mjs → chunk-67JTJCAS.mjs} +3 -2
  61. package/dist/{chunk-CBP7AKZH.mjs → chunk-6GJZJAED.mjs} +1 -1
  62. package/dist/{chunk-5REIO5DT.mjs → chunk-6WVRVGKC.mjs} +6 -6
  63. package/dist/{chunk-GC5ROI3A.cjs → chunk-7U4XF76R.cjs} +1 -1
  64. package/dist/{chunk-FOULIN4S.cjs → chunk-ADQ2LATR.cjs} +2 -2
  65. package/dist/{chunk-K3ZELA6U.cjs → chunk-AHVF5GI2.cjs} +10 -10
  66. package/dist/{chunk-CSAIIMY3.mjs → chunk-ATISIC6G.mjs} +1 -1
  67. package/dist/{chunk-MGKWYPE3.mjs → chunk-AYDVUCXD.mjs} +1 -0
  68. package/dist/chunk-B7L24VPX.cjs +401 -0
  69. package/dist/{chunk-DPBQRDWW.cjs → chunk-BBVLOEND.cjs} +4 -4
  70. package/dist/{chunk-DASQJ5UD.mjs → chunk-BCQIXH7L.mjs} +1 -1
  71. package/dist/{chunk-BNCKXPCU.cjs → chunk-BIAGSYIZ.cjs} +30 -30
  72. package/dist/{chunk-R77D7TCZ.mjs → chunk-BJWJP5A4.mjs} +20 -13
  73. package/dist/{chunk-X2SEYK7I.mjs → chunk-BPWTSPK6.mjs} +3 -3
  74. package/dist/{chunk-CKNZJFK5.cjs → chunk-BSX5OGSD.cjs} +4 -4
  75. package/dist/{chunk-ERT6HQAI.mjs → chunk-BVJUFVCU.mjs} +2 -2
  76. package/dist/chunk-C5QHZ626.cjs +85 -0
  77. package/dist/{chunk-HVMQAVZK.cjs → chunk-CL7BUGVB.cjs} +656 -521
  78. package/dist/{chunk-TZ2YPXLB.cjs → chunk-CN2JOTRO.cjs} +7 -7
  79. package/dist/{chunk-ZCYGYIC2.cjs → chunk-CPZZBCPO.cjs} +22 -21
  80. package/dist/{chunk-RK4MGL6Q.mjs → chunk-CYRO3WP4.mjs} +4 -3
  81. package/dist/chunk-D2VAANBS.mjs +48 -0
  82. package/dist/{chunk-VRJAMU34.mjs → chunk-D77OGI6X.mjs} +1 -1
  83. package/dist/{chunk-6XDDE7M6.cjs → chunk-DJ3PVHTW.cjs} +3 -3
  84. package/dist/{chunk-XGS76V7L.cjs → chunk-E3HBD2K3.cjs} +22 -22
  85. package/dist/{chunk-F35C3TJZ.mjs → chunk-E4E4Y5FD.mjs} +1 -1
  86. package/dist/{chunk-KUXEII7V.mjs → chunk-ECVSRE4Y.mjs} +3 -2
  87. package/dist/{chunk-2DA7CLY7.mjs → chunk-EILUVBKS.mjs} +14 -0
  88. package/dist/chunk-EZYKV24V.mjs +385 -0
  89. package/dist/{chunk-TVCFY3KK.cjs → chunk-FB4CWSC2.cjs} +12 -12
  90. package/dist/{chunk-ZO6TOLHL.mjs → chunk-FS55CNTC.mjs} +1 -1
  91. package/dist/{chunk-IYFBLWXU.cjs → chunk-FULX5RYX.cjs} +61 -361
  92. package/dist/{chunk-5KISFWD2.cjs → chunk-FYZD7DUS.cjs} +12 -12
  93. package/dist/{chunk-H5OVJHXY.cjs → chunk-GAWSWJJ2.cjs} +27 -27
  94. package/dist/{chunk-A37D6LOS.mjs → chunk-GY63XD6K.mjs} +1 -1
  95. package/dist/{chunk-OVUU2RCQ.mjs → chunk-HD5FLXP2.mjs} +1 -1
  96. package/dist/{chunk-5QZT2EQN.cjs → chunk-HQEYZSF3.cjs} +4 -3
  97. package/dist/{chunk-JA6RML7C.mjs → chunk-HR4N2K4V.mjs} +2 -2
  98. package/dist/{chunk-6D3CJFNU.cjs → chunk-HR5GU4UU.cjs} +7 -7
  99. package/dist/{chunk-7RQ5KAK6.mjs → chunk-HTNJ7A4D.mjs} +88 -36
  100. package/dist/chunk-I4WZRG73.mjs +54 -0
  101. package/dist/{chunk-BGUTIQII.mjs → chunk-ICOJ2BC6.mjs} +24 -8
  102. package/dist/{chunk-SX535SU5.cjs → chunk-IJPRCQHW.cjs} +10 -10
  103. package/dist/{chunk-E7V2GYBP.mjs → chunk-IM3UINTZ.mjs} +67 -9
  104. package/dist/{chunk-MNIR7I7B.mjs → chunk-INKVDO42.mjs} +1 -1
  105. package/dist/{chunk-AHGOHPRN.mjs → chunk-IPG6B25T.mjs} +235 -100
  106. package/dist/{chunk-PE2LEWXA.mjs → chunk-J2VUPCCR.mjs} +4 -4
  107. package/dist/{chunk-Q2EKSSEG.cjs → chunk-JB4BHRFK.cjs} +17 -17
  108. package/dist/{chunk-YN7G22MP.cjs → chunk-JCYDWJVO.cjs} +3 -3
  109. package/dist/{chunk-LPXJEZJK.mjs → chunk-KCJBIWBM.mjs} +2 -2
  110. package/dist/{chunk-NSNQLBHR.cjs → chunk-KMGHXIDA.cjs} +2 -2
  111. package/dist/{chunk-SVCUSOEF.mjs → chunk-KR5DF7WK.mjs} +1 -1
  112. package/dist/{chunk-5DREJN4G.cjs → chunk-LKIG5SM6.cjs} +17 -17
  113. package/dist/{chunk-OGVOKAQU.mjs → chunk-LTOT5KVJ.mjs} +2 -2
  114. package/dist/{chunk-Z2FFLTF5.mjs → chunk-LTXKRIST.mjs} +2 -2
  115. package/dist/{chunk-67MZTLTF.cjs → chunk-M6DAIE4T.cjs} +27 -1
  116. package/dist/{chunk-IWGGRXD2.cjs → chunk-MHKPXX3J.cjs} +2 -2
  117. package/dist/{chunk-F7PKUP6P.cjs → chunk-MOGRRZMW.cjs} +38 -38
  118. package/dist/{chunk-DZZHTMWM.cjs → chunk-N3H7UPBM.cjs} +3 -2
  119. package/dist/{chunk-WGNGM6MJ.mjs → chunk-N3VMHPIY.mjs} +2 -2
  120. package/dist/{chunk-EBFTAVGD.mjs → chunk-NOYKBGUK.mjs} +672 -456
  121. package/dist/{chunk-LMXGCFAM.cjs → chunk-NSLRK5DK.cjs} +1 -1
  122. package/dist/{chunk-EVVV2XZ2.cjs → chunk-NW3DL2PM.cjs} +53 -7
  123. package/dist/{chunk-6ZFGWB75.cjs → chunk-OFVCWV2D.cjs} +5 -5
  124. package/dist/{chunk-NB2ZEBIS.cjs → chunk-OIWDEDUO.cjs} +540 -510
  125. package/dist/{chunk-WRWJ7IWT.cjs → chunk-OLKYHTLN.cjs} +5 -5
  126. package/dist/{chunk-QES76U42.mjs → chunk-ONSZP5JK.mjs} +4 -4
  127. package/dist/{chunk-H76C5AOU.mjs → chunk-OO4GVGM3.mjs} +4 -4
  128. package/dist/{chunk-BZJYPIFZ.cjs → chunk-OUDNUFVR.cjs} +12 -12
  129. package/dist/{chunk-EVIWKPJV.cjs → chunk-PLJMEUAN.cjs} +15 -1
  130. package/dist/{chunk-GFXKO4UW.mjs → chunk-PO5MZIWK.mjs} +49 -49
  131. package/dist/{chunk-VCW6BR6U.mjs → chunk-POL5RCVU.mjs} +2 -2
  132. package/dist/{chunk-EMTN5ABC.mjs → chunk-POVHO46S.mjs} +1 -1
  133. package/dist/{chunk-ASYOWPSR.cjs → chunk-PWDBWXQI.cjs} +2 -1
  134. package/dist/{chunk-X3Y6JWJG.cjs → chunk-PWMJBCAN.cjs} +3 -3
  135. package/dist/{chunk-IGE5BAWK.mjs → chunk-QBJ6N5MT.mjs} +53 -7
  136. package/dist/{chunk-62DZHPDK.cjs → chunk-QCKSYYXK.cjs} +10 -10
  137. package/dist/{chunk-PKXGFQZS.mjs → chunk-QD34VE4N.mjs} +1 -1
  138. package/dist/{chunk-57QAQU4F.mjs → chunk-QRNYSISP.mjs} +1 -1
  139. package/dist/{chunk-PRL7FXG4.cjs → chunk-RDNKQ5MK.cjs} +12 -13
  140. package/dist/{chunk-VJI2LWTL.cjs → chunk-RFNQTQ44.cjs} +2 -2
  141. package/dist/{chunk-IG2JE6WJ.mjs → chunk-RLEAVG6G.mjs} +1 -1
  142. package/dist/{chunk-VO5XDZHK.mjs → chunk-RPA45OQS.mjs} +2 -2
  143. package/dist/{chunk-PNWRH6TR.mjs → chunk-RZ6XUEQS.mjs} +4 -4
  144. package/dist/{chunk-S6RUJRWI.mjs → chunk-S3IWDDQ3.mjs} +1 -1
  145. package/dist/{chunk-EGHPFXPZ.cjs → chunk-SAPG45RA.cjs} +23 -23
  146. package/dist/{chunk-FE6KYDHC.cjs → chunk-SHDCKRP4.cjs} +3 -3
  147. package/dist/{chunk-DUSTJ6A5.mjs → chunk-SLEHAGGV.mjs} +2 -2
  148. package/dist/{chunk-26CNCIFI.cjs → chunk-T3SMMLSB.cjs} +2 -2
  149. package/dist/{chunk-K6DXKHFE.mjs → chunk-TE7AX6HB.mjs} +1 -1
  150. package/dist/{chunk-A7EJATEW.mjs → chunk-TLSGRK7E.mjs} +4 -4
  151. package/dist/{chunk-KHS3T3E5.mjs → chunk-TYHWZOA2.mjs} +1 -1
  152. package/dist/{chunk-Z3QXQN4U.mjs → chunk-U6GMCDRS.mjs} +1 -1
  153. package/dist/{chunk-URQW27KO.mjs → chunk-UBLKPREL.mjs} +1 -1
  154. package/dist/chunk-UDMBUTJD.mjs +85 -0
  155. package/dist/{chunk-WJ4NUY2H.mjs → chunk-UF4BNKKJ.mjs} +4 -4
  156. package/dist/{chunk-L7Y65BQU.cjs → chunk-UGD53SNO.cjs} +50 -50
  157. package/dist/{chunk-DD22NQFX.cjs → chunk-UGLTOLTJ.cjs} +2 -2
  158. package/dist/{chunk-G7B6NU4X.cjs → chunk-VFMHE5D3.cjs} +3 -3
  159. package/dist/{chunk-4SLHSODZ.cjs → chunk-VGHDPEPQ.cjs} +15 -15
  160. package/dist/{chunk-IXO6O2EL.cjs → chunk-VGVRGGP4.cjs} +2 -2
  161. package/dist/{chunk-47R7CX4A.mjs → chunk-VPGEYX5Y.mjs} +4 -4
  162. package/dist/chunk-VS7HLH4S.cjs +385 -0
  163. package/dist/{chunk-YRXPDKMM.cjs → chunk-W53Z4WDI.cjs} +8 -8
  164. package/dist/{chunk-NNGBTJCX.cjs → chunk-W6C3LEXX.cjs} +83 -25
  165. package/dist/{chunk-4VLXQ55O.cjs → chunk-WIZRYFB2.cjs} +3 -3
  166. package/dist/chunk-WMRGIQTA.cjs +48 -0
  167. package/dist/{chunk-52LTENRE.cjs → chunk-WOAXQ5MZ.cjs} +9 -9
  168. package/dist/{chunk-C6HGUTXB.mjs → chunk-XBSIGZ4J.mjs} +2 -3
  169. package/dist/{chunk-S7QEQCVV.mjs → chunk-XGL42MQ7.mjs} +1 -1
  170. package/dist/{chunk-JHZ6HULQ.cjs → chunk-XOFJUSWC.cjs} +4 -4
  171. package/dist/{chunk-LJKTJNOF.cjs → chunk-XOGCNKB7.cjs} +3 -3
  172. package/dist/{chunk-7JTVN6IJ.mjs → chunk-XOXCQGAF.mjs} +7 -6
  173. package/dist/{chunk-LIC6CMLB.mjs → chunk-YH7ENV3K.mjs} +18 -18
  174. package/dist/{chunk-ZJGFAW5U.mjs → chunk-YHHOTKUT.mjs} +5 -1
  175. package/dist/{chunk-B3IRRANH.mjs → chunk-YHM4PXJY.mjs} +1 -1
  176. package/dist/{chunk-PDACTAVX.mjs → chunk-YOVSWY2E.mjs} +1 -1
  177. package/dist/{chunk-ZEWIWAS2.mjs → chunk-YSU3WCW6.mjs} +2 -2
  178. package/dist/{chunk-R5X7FDOG.mjs → chunk-YU2MNIIY.mjs} +1 -1
  179. package/dist/{chunk-42EUEYW6.cjs → chunk-YUQUGVSV.cjs} +8 -8
  180. package/dist/{chunk-4STJ6LGR.mjs → chunk-Z3RM3VA2.mjs} +1 -1
  181. package/dist/{chunk-MBD34AS5.cjs → chunk-Z5BANEQD.cjs} +6 -6
  182. package/dist/{chunk-4PWGLPL6.mjs → chunk-ZIEO3DQ3.mjs} +26 -15
  183. package/dist/{chunk-2G6JPLSL.cjs → chunk-ZIYJWJV2.cjs} +27 -20
  184. package/dist/{chunk-KZ5BOWJS.cjs → chunk-ZKNXCRUQ.cjs} +28 -28
  185. package/dist/{cli-runtime.d-CGMGs1Zz.d.mts → cli-runtime.d-D8O1v2_X.d.mts} +7 -6
  186. package/dist/{cli-runtime.d-BG9q2_vC.d.ts → cli-runtime.d-hf4L1MNP.d.ts} +7 -6
  187. package/dist/client/lifecycle.d.mts +1 -1
  188. package/dist/client/lifecycle.d.ts +1 -1
  189. package/dist/{client-component.d-B84GPb_u.d.ts → client-component.d-CX8UCQh-.d.ts} +1 -1
  190. package/dist/{client-component.d-CdsG1E7p.d.mts → client-component.d-DFwUHlOz.d.mts} +1 -1
  191. package/dist/{client-plugins.d-DX-iCJWE.d.mts → client-plugins.d-BflSNO-b.d.mts} +5 -16
  192. package/dist/{client-plugins.d-FptsHgls.d.ts → client-plugins.d-qWp8hNwd.d.ts} +5 -16
  193. package/dist/client-plugins.d.mts +5 -4
  194. package/dist/client-plugins.d.ts +5 -4
  195. package/dist/client.cjs +9 -8
  196. package/dist/client.d.mts +23 -154
  197. package/dist/client.d.ts +23 -154
  198. package/dist/client.mjs +8 -7
  199. package/dist/config.d.mts +5 -4
  200. package/dist/config.d.ts +5 -4
  201. package/dist/cron.cjs +3 -3
  202. package/dist/cron.mjs +2 -2
  203. package/dist/desktop.d.mts +6 -5
  204. package/dist/desktop.d.ts +6 -5
  205. package/dist/{devtools-TMATFNUY.cjs → devtools-EI5N366Z.cjs} +17 -17
  206. package/dist/{devtools-7P3OUNLV.mjs → devtools-XJHODO5H.mjs} +14 -14
  207. package/dist/docs.cjs +18 -18
  208. package/dist/docs.d.mts +7 -6
  209. package/dist/docs.d.ts +7 -6
  210. package/dist/docs.mjs +17 -17
  211. package/dist/environment/vite.cjs +8 -7
  212. package/dist/environment/vite.d.mts +9 -0
  213. package/dist/environment/vite.d.ts +9 -0
  214. package/dist/environment/vite.mjs +7 -6
  215. package/dist/{handler.d-Cy3XbY_W.d.ts → handler.d-C2oRihfa.d.ts} +1 -1
  216. package/dist/{handler.d-DSwLTpa5.d.mts → handler.d-DoH5Krkq.d.mts} +1 -1
  217. package/dist/{headers.d-DiL9YTH3.d.mts → headers.d-BrX53wFQ.d.mts} +1 -1
  218. package/dist/{headers.d-Qbjo38a0.d.ts → headers.d-Dj0mfYpb.d.ts} +1 -1
  219. package/dist/index.cjs +90 -82
  220. package/dist/{index.d-OccJoC6I.d.ts → index.d-Dhc2scRl.d.ts} +1 -1
  221. package/dist/{index.d-CqQKX3s6.d.mts → index.d-DzDHOttz.d.mts} +1 -1
  222. package/dist/index.d.mts +29 -27
  223. package/dist/index.d.ts +29 -27
  224. package/dist/index.mjs +92 -84
  225. package/dist/instrumentation.cjs +3 -3
  226. package/dist/instrumentation.mjs +2 -2
  227. package/dist/integrations/orm.cjs +3 -3
  228. package/dist/integrations/orm.d.mts +5 -4
  229. package/dist/integrations/orm.d.ts +5 -4
  230. package/dist/integrations/orm.mjs +2 -2
  231. package/dist/integrations.cjs +2 -2
  232. package/dist/integrations.d.mts +5 -4
  233. package/dist/integrations.d.ts +5 -4
  234. package/dist/integrations.mjs +1 -1
  235. package/dist/internal/app-markdown-runtime.cjs +4 -4
  236. package/dist/internal/app-markdown-runtime.d.mts +15 -8
  237. package/dist/internal/app-markdown-runtime.d.ts +15 -8
  238. package/dist/internal/app-markdown-runtime.mjs +3 -3
  239. package/dist/internal/build-runtime.cjs +63 -62
  240. package/dist/internal/build-runtime.d.mts +8 -7
  241. package/dist/internal/build-runtime.d.ts +8 -7
  242. package/dist/internal/build-runtime.mjs +62 -61
  243. package/dist/internal/cli-runtime.cjs +37 -34
  244. package/dist/internal/cli-runtime.d.mts +12 -11
  245. package/dist/internal/cli-runtime.d.ts +12 -11
  246. package/dist/internal/cli-runtime.mjs +39 -36
  247. package/dist/internal/client-error-overlay.cjs +4 -4
  248. package/dist/internal/client-error-overlay.mjs +1 -1
  249. package/dist/internal/client-runtime.cjs +112 -14
  250. package/dist/internal/client-runtime.d.mts +29 -22
  251. package/dist/internal/client-runtime.d.ts +29 -22
  252. package/dist/internal/client-runtime.mjs +104 -6
  253. package/dist/internal/compression-runtime.d.mts +5 -4
  254. package/dist/internal/compression-runtime.d.ts +5 -4
  255. package/dist/internal/config-runtime.cjs +16 -16
  256. package/dist/internal/config-runtime.d.mts +7 -6
  257. package/dist/internal/config-runtime.d.ts +7 -6
  258. package/dist/internal/config-runtime.mjs +15 -15
  259. package/dist/internal/docs-precompiled-runtime.cjs +1 -1
  260. package/dist/internal/docs-precompiled-runtime.mjs +1 -1
  261. package/dist/internal/form-actions.cjs +3 -3
  262. package/dist/internal/form-actions.mjs +2 -2
  263. package/dist/internal/infra-analytics-runtime.cjs +11 -11
  264. package/dist/internal/infra-analytics-runtime.mjs +9 -9
  265. package/dist/internal/island-codec.cjs +3 -3
  266. package/dist/internal/island-codec.mjs +2 -2
  267. package/dist/internal/island-value-store.d.mts +1 -1
  268. package/dist/internal/island-value-store.d.ts +1 -1
  269. package/dist/internal/islands-boot.cjs +39 -5
  270. package/dist/internal/islands-boot.d.mts +19 -1
  271. package/dist/internal/islands-boot.d.ts +19 -1
  272. package/dist/internal/islands-boot.mjs +38 -4
  273. package/dist/internal/islands-runtime.cjs +10 -56
  274. package/dist/internal/islands-runtime.mjs +6 -52
  275. package/dist/internal/islands-server.cjs +4 -4
  276. package/dist/internal/islands-server.mjs +3 -3
  277. package/dist/internal/islx-actions-client.cjs +36 -0
  278. package/dist/internal/islx-actions-client.d.mts +13 -0
  279. package/dist/internal/islx-actions-client.d.ts +13 -0
  280. package/dist/internal/islx-actions-client.mjs +36 -0
  281. package/dist/internal/islx-actions-server.cjs +8 -0
  282. package/dist/internal/islx-actions-server.d.mts +6 -0
  283. package/dist/internal/islx-actions-server.d.ts +6 -0
  284. package/dist/internal/islx-actions-server.mjs +8 -0
  285. package/dist/internal/islx-client.d.mts +0 -4
  286. package/dist/internal/islx-client.d.ts +0 -4
  287. package/dist/internal/isolated-boundary.cjs +3 -3
  288. package/dist/internal/isolated-boundary.d.mts +1 -1
  289. package/dist/internal/isolated-boundary.d.ts +1 -1
  290. package/dist/internal/isolated-boundary.mjs +2 -2
  291. package/dist/internal/metadata-image-runtime.cjs +4 -2
  292. package/dist/internal/metadata-image-runtime.d.mts +18 -2
  293. package/dist/internal/metadata-image-runtime.d.ts +18 -2
  294. package/dist/internal/metadata-image-runtime.mjs +5 -3
  295. package/dist/internal/native-server-fns.cjs +5 -4
  296. package/dist/internal/native-server-fns.mjs +4 -3
  297. package/dist/internal/navigation-neutral.cjs +36 -0
  298. package/dist/internal/navigation-neutral.d.mts +14 -0
  299. package/dist/internal/navigation-neutral.d.ts +14 -0
  300. package/dist/internal/navigation-neutral.mjs +36 -0
  301. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  302. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  303. package/dist/internal/production-runtime.cjs +36 -36
  304. package/dist/internal/production-runtime.d.mts +15 -13
  305. package/dist/internal/production-runtime.d.ts +15 -13
  306. package/dist/internal/production-runtime.mjs +46 -46
  307. package/dist/internal/server-tree.cjs +5 -4
  308. package/dist/internal/server-tree.d.mts +3 -4
  309. package/dist/internal/server-tree.d.ts +3 -4
  310. package/dist/internal/server-tree.mjs +4 -3
  311. package/dist/internal/spa-router.cjs +44 -0
  312. package/dist/internal/spa-router.d.mts +42 -0
  313. package/dist/internal/spa-router.d.ts +42 -0
  314. package/dist/internal/spa-router.mjs +44 -0
  315. package/dist/internal/start-manifest.d.mts +5 -4
  316. package/dist/internal/start-manifest.d.ts +5 -4
  317. package/dist/internal/vercel-edge-middleware.cjs +4 -4
  318. package/dist/internal/vercel-edge-middleware.mjs +3 -3
  319. package/dist/island-value-protocol.d-fEoc1m8e.d.mts +27 -0
  320. package/dist/island-value-protocol.d-fEoc1m8e.d.ts +27 -0
  321. package/dist/{layers-5ZD4764G.mjs → layers-744BBUY5.mjs} +2 -2
  322. package/dist/layers-XLOMMQP7.cjs +21 -0
  323. package/dist/{lifecycle.d-VzcXyEyn.d.ts → lifecycle.d-OtGWAvJT.d.mts} +1 -1
  324. package/dist/{lifecycle.d-VzcXyEyn.d.mts → lifecycle.d-OtGWAvJT.d.ts} +1 -1
  325. package/dist/markdown.cjs +3 -3
  326. package/dist/markdown.d.mts +5 -4
  327. package/dist/markdown.d.ts +5 -4
  328. package/dist/markdown.mjs +2 -2
  329. package/dist/middleware.cjs +10 -10
  330. package/dist/middleware.d.mts +5 -4
  331. package/dist/middleware.d.ts +5 -4
  332. package/dist/middleware.mjs +9 -9
  333. package/dist/{mount.d-AcJaUtHF.d.mts → mount.d-DOaeUoWq.d.mts} +1 -1
  334. package/dist/{mount.d-CPzqOm-a.d.ts → mount.d-DwXjaOHY.d.ts} +1 -1
  335. package/dist/{native-server-fn-handler-XRTZR7SZ.cjs → native-server-fn-handler-57TCQPSM.cjs} +6 -6
  336. package/dist/{native-server-fn-handler-WYYY4YBN.mjs → native-server-fn-handler-PYK65A46.mjs} +5 -5
  337. package/dist/{native-tree-MNUFN5G6.cjs → native-tree-5TENEQ7Y.cjs} +4 -4
  338. package/dist/{native-tree-JDI3LJSH.mjs → native-tree-LNO7K6JR.mjs} +3 -3
  339. package/dist/{navigation-delegate.d-C4i5Y39E.d.mts → navigation-delegate.d-BElGUMgt.d.mts} +1 -1
  340. package/dist/{navigation-delegate.d-_Df9DnPY.d.ts → navigation-delegate.d-o3pPd9VI.d.ts} +1 -1
  341. package/dist/navigation-errors.d-DwHtoMyR.d.mts +13 -0
  342. package/dist/navigation-errors.d-DwHtoMyR.d.ts +13 -0
  343. package/dist/navigation.cjs +6 -6
  344. package/dist/navigation.d.mts +10 -9
  345. package/dist/navigation.d.ts +10 -9
  346. package/dist/navigation.mjs +5 -5
  347. package/dist/{nitro-NUCTYEKJ.cjs → nitro-XGIO6EQN.cjs} +7 -7
  348. package/dist/{nitro-VCJ6QQSI.mjs → nitro-YLTGVGK4.mjs} +3 -3
  349. package/dist/node-module-bundle-TNSY5PAC.cjs +15 -0
  350. package/dist/{node-module-bundle-XPLBMXRD.mjs → node-module-bundle-ZWCQJCKA.mjs} +3 -1
  351. package/dist/observability.cjs +8 -2
  352. package/dist/{observability.d-DdJRiaIX.d.mts → observability.d-mXSbp4jc.d.mts} +17 -1
  353. package/dist/{observability.d-DdJRiaIX.d.ts → observability.d-mXSbp4jc.d.ts} +17 -1
  354. package/dist/observability.d.mts +1 -1
  355. package/dist/observability.d.ts +1 -1
  356. package/dist/observability.mjs +7 -1
  357. package/dist/{plugin-TV6W7YNK.mjs → plugin-33I3V42N.mjs} +1 -1
  358. package/dist/{plugin-AGEFSU7K.cjs → plugin-LN3JBZRR.cjs} +2 -2
  359. package/dist/plugin.cjs +50 -48
  360. package/dist/plugin.d.mts +9 -8
  361. package/dist/plugin.d.ts +9 -8
  362. package/dist/plugin.mjs +49 -47
  363. package/dist/query/client.cjs +10 -10
  364. package/dist/query/client.mjs +5 -5
  365. package/dist/{render-plan.d-CslZE7o7.d.ts → render-plan.d-BD06tqFA.d.ts} +1 -1
  366. package/dist/{render-plan.d-4V_NmaA6.d.mts → render-plan.d-xWCRAJeR.d.mts} +1 -1
  367. package/dist/renderer/none/server.cjs +5 -1
  368. package/dist/renderer/none/server.d.mts +3 -1
  369. package/dist/renderer/none/server.d.ts +3 -1
  370. package/dist/renderer/none/server.mjs +4 -0
  371. package/dist/renderer/react/server.cjs +6 -6
  372. package/dist/renderer/react/server.mjs +3 -3
  373. package/dist/renderer-client.cjs +34 -15
  374. package/dist/renderer-client.d.mts +16 -100
  375. package/dist/renderer-client.d.ts +16 -100
  376. package/dist/renderer-client.mjs +23 -4
  377. package/dist/renderer.cjs +4 -2
  378. package/dist/renderer.d.mts +49 -6
  379. package/dist/renderer.d.ts +49 -6
  380. package/dist/renderer.mjs +3 -1
  381. package/dist/{request.d-CbV3y7j3.d.ts → request.d-DUMuWxSN.d.ts} +1 -1
  382. package/dist/{request.d-CmLTxEgS.d.mts → request.d-Dx82V8bz.d.mts} +1 -1
  383. package/dist/request.d.mts +6 -5
  384. package/dist/request.d.ts +6 -5
  385. package/dist/{route-rendering.d-CETnXNez.d.ts → route-rendering.d-BwBVpLtD.d.ts} +1 -1
  386. package/dist/{route-rendering.d-CmoqfOmj.d.mts → route-rendering.d-DJh6GauM.d.mts} +1 -1
  387. package/dist/{router.d-ktz7pwYm.d.mts → router.d-BtkKDxUB.d.mts} +1 -1
  388. package/dist/{router.d-Dga3N5YO.d.ts → router.d-CJBSG5jr.d.ts} +1 -1
  389. package/dist/routes.cjs +5 -5
  390. package/dist/routes.d.mts +5 -4
  391. package/dist/routes.d.ts +5 -4
  392. package/dist/routes.mjs +4 -4
  393. package/dist/{rsc-pipeline-N7CWJW7T.mjs → rsc-pipeline-GD6KLOIG.mjs} +20 -20
  394. package/dist/{rsc-pipeline-JLYD26AR.cjs → rsc-pipeline-H5AXQA7A.cjs} +21 -21
  395. package/dist/{runtime-QXX2A4TS.mjs → runtime-OJ7FXFUI.mjs} +22 -22
  396. package/dist/{runtime-F5NSS4DD.cjs → runtime-YWQVBC3V.cjs} +32 -32
  397. package/dist/{runtime.d-BWLZUOfA.d.ts → runtime.d-BQnD0cfC.d.ts} +1 -1
  398. package/dist/{runtime.d-DuaXEM0p.d.mts → runtime.d-C4SuZXf6.d.mts} +1 -1
  399. package/dist/{schema-dev-notice-2GN5V7Y2.mjs → schema-dev-notice-EUPAUJVN.mjs} +2 -2
  400. package/dist/{schema-dev-notice-6VCOZGG2.cjs → schema-dev-notice-ZSCL47CT.cjs} +5 -5
  401. package/dist/search-client-A7YJT7JZ.cjs +15 -0
  402. package/dist/{search-client-W4PEFAQB.mjs → search-client-GIXIEU75.mjs} +1 -1
  403. package/dist/server-action-security.cjs +1 -1
  404. package/dist/server-action-security.mjs +1 -1
  405. package/dist/{server-components-status.d-CqxtJmqP.d.mts → server-components-status.d-9rH7ZoEq.d.mts} +1 -1
  406. package/dist/{server-components-status.d-C5JpC7_Y.d.ts → server-components-status.d-rfKOcE0N.d.ts} +1 -1
  407. package/dist/server-fn.cjs +5 -5
  408. package/dist/server-fn.mjs +4 -4
  409. package/dist/server-plugins.cjs +1 -1
  410. package/dist/server-plugins.d.mts +7 -6
  411. package/dist/server-plugins.d.ts +7 -6
  412. package/dist/server-plugins.mjs +1 -1
  413. package/dist/server-query.cjs +6 -6
  414. package/dist/server-query.mjs +5 -5
  415. package/dist/server.cjs +95 -90
  416. package/dist/server.d.mts +16 -15
  417. package/dist/server.d.ts +16 -15
  418. package/dist/server.mjs +61 -56
  419. package/dist/{session-AK2OA5UZ.mjs → session-4IB34X35.mjs} +2 -2
  420. package/dist/session-MOYQJ7E6.cjs +24 -0
  421. package/dist/{spa-router.d-C3LzwTlY.d.ts → spa-router.d-DMKiBsHH.d.ts} +20 -4
  422. package/dist/{spa-router.d-BLE188EL.d.mts → spa-router.d-V6XLSTCy.d.mts} +20 -4
  423. package/dist/{ssg.d-QrFyU6T4.d.mts → ssg.d-BnCKPQL0.d.mts} +2 -2
  424. package/dist/{ssg.d-DisOfj0I.d.ts → ssg.d-MNedvvMB.d.ts} +2 -2
  425. package/dist/storage.cjs +2 -2
  426. package/dist/storage.d.mts +112 -96
  427. package/dist/storage.d.ts +112 -96
  428. package/dist/storage.mjs +1 -1
  429. package/dist/store-core.d-Ad5biajo.d.ts +301 -0
  430. package/dist/store-core.d-BqJI1-ix.d.mts +301 -0
  431. package/dist/testing.cjs +13 -13
  432. package/dist/testing.d.mts +5 -4
  433. package/dist/testing.d.ts +5 -4
  434. package/dist/testing.mjs +10 -10
  435. package/dist/{types.d-DW2vyaUq.d.mts → types.d-C5hlNbHa.d.mts} +8 -1
  436. package/dist/{types.d-DW2vyaUq.d.ts → types.d-C5hlNbHa.d.ts} +8 -1
  437. package/dist/{utils.d-BlWZFgdL.d.mts → utils.d-BEKLWa0Z.d.mts} +1 -1
  438. package/dist/{utils.d-7YcgfTCK.d.ts → utils.d-BdjHKDuT.d.ts} +1 -1
  439. package/dist/version.cjs +2 -2
  440. package/dist/version.mjs +1 -1
  441. package/dist/vite.cjs +55 -49
  442. package/dist/vite.d.mts +26 -10
  443. package/dist/vite.d.ts +26 -10
  444. package/dist/vite.mjs +54 -48
  445. package/dist/workflows.cjs +3 -3
  446. package/dist/workflows.mjs +2 -2
  447. package/package.json +23 -2
  448. package/types/images.d.ts +9 -0
  449. package/dist/analyzer-KVTUYGTT.cjs +0 -16
  450. package/dist/chunk-CQL5ZGFU.cjs +0 -50
  451. package/dist/chunk-HONTCUK6.mjs +0 -203
  452. package/dist/chunk-K6PGK7DC.cjs +0 -203
  453. package/dist/chunk-NBIVGHAT.mjs +0 -50
  454. package/dist/island-value-protocol.d-BRayRghM.d.mts +0 -12
  455. package/dist/island-value-protocol.d-BRayRghM.d.ts +0 -12
  456. package/dist/layers-HMEGUEXM.cjs +0 -21
  457. package/dist/node-module-bundle-M6BISE2P.cjs +0 -13
  458. package/dist/search-client-6NVC6HM2.cjs +0 -15
  459. package/dist/session-H4TWP73H.cjs +0 -24
  460. package/dist/{chunk-JKFN3YVG.mjs → chunk-6JWXHPVR.mjs} +0 -0
  461. package/dist/{chunk-522K362I.mjs → chunk-C2OLXVUC.mjs} +0 -0
  462. package/dist/{chunk-MALGIHIC.cjs → chunk-HS4JPIGR.cjs} +0 -0
  463. package/dist/{chunk-PBJ7MEOV.cjs → chunk-OZUINP2P.cjs} +2 -2
  464. package/dist/{chunk-CUZT7474.cjs → chunk-TCMRLW3K.cjs} +0 -0
  465. package/dist/{chunk-Q3DO7MVK.mjs → chunk-URBP6DLH.mjs} +0 -0
  466. package/dist/{chunk-7FQFK3OA.mjs → chunk-V7HNYR76.mjs} +3 -3
  467. /package/dist/{chunk-AOTD2N5P.cjs → chunk-WGWWRV2M.cjs} +0 -0
@@ -28,11 +28,11 @@ import {
28
28
  } from "./chunk-KQH2COEJ.mjs";
29
29
  import {
30
30
  FARM_MOBILE_SESSION_PLUGIN
31
- } from "./chunk-CBP7AKZH.mjs";
31
+ } from "./chunk-6GJZJAED.mjs";
32
32
  import {
33
33
  collectFarmNativeServerFns,
34
34
  findFarmNativeScreenFiles
35
- } from "./chunk-S6RUJRWI.mjs";
35
+ } from "./chunk-S3IWDDQ3.mjs";
36
36
  import {
37
37
  assertFarmDocsAdapterServesNoGuardedPages,
38
38
  compileFarmDocsAdapterEdgeManifest,
@@ -41,7 +41,7 @@ import {
41
41
  hasFarmDocsRuntimeAdapter,
42
42
  listFarmDocsAdapterPages,
43
43
  listFarmDocsPagePaths
44
- } from "./chunk-VCW6BR6U.mjs";
44
+ } from "./chunk-POL5RCVU.mjs";
45
45
  import {
46
46
  FARM_DOCS_LAST_MODIFIED_MANIFEST,
47
47
  createFarmDocsHandler,
@@ -54,18 +54,18 @@ import {
54
54
  loadFarmDocsPage,
55
55
  resolveFarmDocsContentDir,
56
56
  toFarmDocsMarkdownPage
57
- } from "./chunk-LPXJEZJK.mjs";
57
+ } from "./chunk-KCJBIWBM.mjs";
58
58
  import {
59
59
  generateFarmDocsSearchClientRuntime,
60
60
  isFarmDocsSearchEnabled,
61
61
  resolveFarmDocsSearchClientModule
62
- } from "./chunk-ALEUMLJN.mjs";
62
+ } from "./chunk-67JTJCAS.mjs";
63
63
  import {
64
64
  CDN_CACHE_CONTROL_HEADERS
65
- } from "./chunk-URQW27KO.mjs";
65
+ } from "./chunk-UBLKPREL.mjs";
66
66
  import {
67
67
  FARM_PRERENDER_ENV
68
- } from "./chunk-E7V2GYBP.mjs";
68
+ } from "./chunk-IM3UINTZ.mjs";
69
69
  import {
70
70
  loadFarmDocsEngine
71
71
  } from "./chunk-LRPPXKCX.mjs";
@@ -74,10 +74,10 @@ import {
74
74
  getDeployTargetForPreset,
75
75
  hasCustomFarmRouteContext,
76
76
  resolveDeployOutputPath
77
- } from "./chunk-LIC6CMLB.mjs";
77
+ } from "./chunk-YH7ENV3K.mjs";
78
78
  import {
79
79
  resolveFarmInstrumentationFile
80
- } from "./chunk-57QAQU4F.mjs";
80
+ } from "./chunk-QRNYSISP.mjs";
81
81
  import {
82
82
  resolveFarmInstrumentationRuntime
83
83
  } from "./chunk-WNDAISB7.mjs";
@@ -86,6 +86,7 @@ import {
86
86
  } from "./chunk-BRNPLD22.mjs";
87
87
  import {
88
88
  DEFAULT_NOT_FOUND_STYLES,
89
+ FARM_EARLY_NAVIGATION_SOURCE,
89
90
  FARM_LAYOUT_ELEMENT_CLIENT_SOURCE,
90
91
  FARM_NAVIGATION_SCRIPT_SOURCE,
91
92
  FARM_NAVIGATION_STREAM_READER_SOURCE,
@@ -106,6 +107,7 @@ import {
106
107
  generateClientCachePersistenceCode,
107
108
  generateFarmIntegrationProviderClientCode,
108
109
  generateFarmIntegrationProviderServerModules,
110
+ isRendererCompiledComponent,
109
111
  mergeFarmFontCss,
110
112
  mergeFarmProductionViteConfig,
111
113
  mergeFarmViteConfig,
@@ -113,26 +115,27 @@ import {
113
115
  resolveFarmClientCacheAdapterEntry,
114
116
  resolveFarmImageProviderForRuntime,
115
117
  resolveFarmImageServerRuntime,
118
+ resolveFarmIslxActionsMode,
116
119
  resolveFarmNotFoundComponentPath,
117
120
  resolveFarmRouteRootStrategy,
118
121
  toBakedMarkdownSourcePath
119
- } from "./chunk-AHGOHPRN.mjs";
122
+ } from "./chunk-IPG6B25T.mjs";
120
123
  import {
121
124
  TAILWIND_CSS_BROWSER_TARGET,
122
125
  generateFarmClientPluginEntryCode,
123
126
  hasFarmServerRuntimePlugins,
124
127
  includesTailwindVitePlugin,
125
128
  loadTailwindVitePlugin
126
- } from "./chunk-VO5XDZHK.mjs";
129
+ } from "./chunk-RPA45OQS.mjs";
127
130
  import {
128
131
  PluginManager
129
- } from "./chunk-522K362I.mjs";
132
+ } from "./chunk-C2OLXVUC.mjs";
130
133
  import {
131
134
  generateFarmTypeArtifacts,
132
135
  readRouteRenderingDirectiveFromFile,
133
136
  resolveRouteRenderingConfig,
134
137
  resolveRouteRenderingConfigFromFile
135
- } from "./chunk-A7EJATEW.mjs";
138
+ } from "./chunk-TLSGRK7E.mjs";
136
139
  import {
137
140
  HOISTED_HEAD_ELEMENT,
138
141
  appMiddlewareMayHandlePath,
@@ -145,7 +148,7 @@ import {
145
148
  layoutsCanCoverSamePage,
146
149
  routeBoundaryCoversDirectory,
147
150
  stripRouteGroups
148
- } from "./chunk-H76C5AOU.mjs";
151
+ } from "./chunk-OO4GVGM3.mjs";
149
152
  import {
150
153
  FARM_NATIVE_TREE_CONTENT_TYPE
151
154
  } from "./chunk-LLZSYFOM.mjs";
@@ -159,15 +162,15 @@ import {
159
162
  listFarmBuiltInRoutePaths,
160
163
  resolveFarmApiCatalogInput,
161
164
  resolveFarmAppManifestInput
162
- } from "./chunk-PNWRH6TR.mjs";
165
+ } from "./chunk-RZ6XUEQS.mjs";
163
166
  import {
164
167
  FARM_DEFAULT_MCP_PATH,
165
168
  createFarmDefaultMCPServer,
166
169
  farmConfigMountsMCP
167
- } from "./chunk-JA6RML7C.mjs";
170
+ } from "./chunk-HR4N2K4V.mjs";
168
171
  import {
169
172
  isFarmPreviewDeploymentEnvironment
170
- } from "./chunk-A37D6LOS.mjs";
173
+ } from "./chunk-GY63XD6K.mjs";
171
174
  import {
172
175
  FARM_NATIVE_SERVER_FN_PLUGIN
173
176
  } from "./chunk-L4RTTTVE.mjs";
@@ -188,7 +191,7 @@ import {
188
191
  withFarmSourceSnapshot,
189
192
  withFarmSourceSnapshotOf,
190
193
  withPackageClientBoundaryCache
191
- } from "./chunk-7RQ5KAK6.mjs";
194
+ } from "./chunk-HTNJ7A4D.mjs";
192
195
  import {
193
196
  generateFarmDocsAdapterClientRuntime,
194
197
  getFarmDocsAdapterConfigModule
@@ -210,7 +213,7 @@ import {
210
213
  } from "./chunk-4QENVMG7.mjs";
211
214
  import {
212
215
  getFarmAppDirectories
213
- } from "./chunk-4STJ6LGR.mjs";
216
+ } from "./chunk-Z3RM3VA2.mjs";
214
217
  import {
215
218
  REACT_RENDERER,
216
219
  getFarmRendererCapabilities,
@@ -220,14 +223,14 @@ import {
220
223
  isReactRenderer,
221
224
  loadFarmRendererVitePlugins,
222
225
  resolveFarmRendererAppSetup
223
- } from "./chunk-GCRT6GJG.mjs";
226
+ } from "./chunk-2HMSSPCZ.mjs";
224
227
  import {
225
228
  applyFarmCronVercelCrons,
226
229
  createFarmCronCloudflareConfig,
227
230
  mergeScheduledTasks,
228
231
  prepareFarmCronForNitro,
229
232
  toFarmCronCloudflareScheduledTasks
230
- } from "./chunk-CSAIIMY3.mjs";
233
+ } from "./chunk-ATISIC6G.mjs";
231
234
  import {
232
235
  resolveServerActionsConfig
233
236
  } from "./chunk-NLATR3T3.mjs";
@@ -239,39 +242,39 @@ import {
239
242
  isFarmMarkdownPageFile,
240
243
  parseMarkdownFrontmatter,
241
244
  readFarmMarkdownRouteConfig
242
- } from "./chunk-BGUTIQII.mjs";
245
+ } from "./chunk-ICOJ2BC6.mjs";
243
246
  import {
244
247
  resolveFarmMdxComponentsModulePath,
245
248
  resolveMdxConfig
246
249
  } from "./chunk-UIJOLBUL.mjs";
247
250
  import {
248
251
  getFarmMarkdownAlternatePath
249
- } from "./chunk-R5X7FDOG.mjs";
252
+ } from "./chunk-YU2MNIIY.mjs";
250
253
  import {
251
254
  withPlainDiagnostics
252
- } from "./chunk-MGKWYPE3.mjs";
255
+ } from "./chunk-AYDVUCXD.mjs";
253
256
  import {
254
257
  applyFarmWorkflowVercelCrons,
255
258
  prepareFarmWorkflowsForNitro
256
- } from "./chunk-OGVOKAQU.mjs";
259
+ } from "./chunk-LTOT5KVJ.mjs";
257
260
  import {
258
261
  getFarmIntegrationPluginServerRuntime,
259
262
  getIntegrationProviders
260
- } from "./chunk-JKFN3YVG.mjs";
263
+ } from "./chunk-6JWXHPVR.mjs";
261
264
  import {
262
265
  FARM_INTEGRATION_API_BASE_PATH_KEY
263
266
  } from "./chunk-CZOXZ6WQ.mjs";
264
267
  import {
265
268
  _collectFarmStorageModules
266
- } from "./chunk-IGE5BAWK.mjs";
269
+ } from "./chunk-QBJ6N5MT.mjs";
267
270
  import {
268
271
  appendMiddlewareDirectory,
269
272
  appendMiddlewareRoutePath,
270
273
  compareMiddlewareRouteLocations
271
- } from "./chunk-PKXGFQZS.mjs";
274
+ } from "./chunk-QD34VE4N.mjs";
272
275
  import {
273
276
  APIRouteManager
274
- } from "./chunk-5REIO5DT.mjs";
277
+ } from "./chunk-6WVRVGKC.mjs";
275
278
  import {
276
279
  readFarmI18nCatalogs
277
280
  } from "./chunk-VO55MMBX.mjs";
@@ -292,14 +295,14 @@ import {
292
295
  logger,
293
296
  toPosixPath,
294
297
  toViteModuleId
295
- } from "./chunk-Z3QXQN4U.mjs";
298
+ } from "./chunk-U6GMCDRS.mjs";
296
299
  import {
297
300
  resolveFarmAPIServerBasePath,
298
301
  resolveFarmAPIServerRoutePath
299
302
  } from "./chunk-2I6PUKWJ.mjs";
300
303
  import {
301
304
  FARM_VERSION
302
- } from "./chunk-VRJAMU34.mjs";
305
+ } from "./chunk-D77OGI6X.mjs";
303
306
  import {
304
307
  FARM_VIDEO_PLAYER_PATH
305
308
  } from "./chunk-AG27TI6Q.mjs";
@@ -326,7 +329,7 @@ import {
326
329
  } from "./chunk-5KAEGBIL.mjs";
327
330
 
328
331
  // src/build/index.ts
329
- import path17 from "path";
332
+ import path18 from "path";
330
333
  import { existsSync as existsSync4 } from "fs";
331
334
 
332
335
  // src/nitro/universal-build.ts
@@ -554,7 +557,7 @@ async function resolveHashedClientJsSrc(clientOutputDir) {
554
557
 
555
558
  // src/nitro/universal-build.ts
556
559
  import os from "os";
557
- import path16 from "path";
560
+ import path17 from "path";
558
561
  import { constants as fsConstants, existsSync as existsSync3, readFileSync as readFileSync2, realpathSync as realpathSync3, statSync } from "fs";
559
562
  import { initSync as initModuleLexer, parse as lexModule } from "es-module-lexer";
560
563
  import { fileURLToPath } from "url";
@@ -794,21 +797,26 @@ function collectFarmClientModulePreloads(bundle, options) {
794
797
  ...staticImports(chunk, loaded, [])
795
798
  ].map(index);
796
799
  }
797
- const routerFiles = [];
798
- const routerLoaded = new Set(entryLoaded);
799
- for (const routerModule of options.routerModules ?? []) {
800
- const chunk = chunks.find(
801
- (candidate) => candidate.isDynamicEntry && candidate.facadeModuleId && path4.resolve(candidate.facadeModuleId.split("?")[0]) === path4.resolve(routerModule)
802
- );
803
- if (!chunk || routerLoaded.has(chunk.fileName)) continue;
804
- routerLoaded.add(chunk.fileName);
805
- routerFiles.push(chunk.fileName);
806
- staticImports(chunk, routerLoaded, routerFiles);
807
- }
800
+ const dynamicFiles = (moduleIds) => {
801
+ const into = [];
802
+ const loaded = new Set(entryLoaded);
803
+ for (const moduleId of moduleIds ?? []) {
804
+ const chunk = chunks.find(
805
+ (candidate) => candidate.isDynamicEntry && candidate.facadeModuleId && path4.resolve(candidate.facadeModuleId.split("?")[0]) === path4.resolve(moduleId)
806
+ );
807
+ if (!chunk || loaded.has(chunk.fileName)) continue;
808
+ loaded.add(chunk.fileName);
809
+ into.push(chunk.fileName);
810
+ staticImports(chunk, loaded, into);
811
+ }
812
+ return into;
813
+ };
814
+ const rendererFiles = dynamicFiles(options.rendererModules);
808
815
  return {
809
816
  files,
810
817
  entry: entryFiles.map(index),
811
- router: routerFiles.map(index),
818
+ router: dynamicFiles(options.routerModules).map(index),
819
+ ...rendererFiles.length > 0 ? { renderer: rendererFiles.map(index) } : {},
812
820
  modules
813
821
  };
814
822
  }
@@ -817,10 +825,15 @@ function createFarmClientModulePreloadPlugin(options) {
817
825
  name: "farm-client-module-preloads",
818
826
  enforce: "post",
819
827
  async generateBundle(_output, bundle) {
828
+ const rendererModules = [];
829
+ for (const specifier of options.rendererImports ?? []) {
830
+ const resolved = await this.resolve(specifier, options.rendererImporter);
831
+ if (resolved) rendererModules.push(resolved.id);
832
+ }
820
833
  await fs.mkdir(options.buildDir, { recursive: true });
821
834
  await fs.writeFile(
822
835
  path4.join(options.buildDir, FARM_CLIENT_MODULE_PRELOADS_FILE),
823
- JSON.stringify(collectFarmClientModulePreloads(bundle, options))
836
+ JSON.stringify(collectFarmClientModulePreloads(bundle, { ...options, rendererModules }))
824
837
  );
825
838
  }
826
839
  };
@@ -1698,12 +1711,15 @@ function createFarmPrivateClientSourcemapsPlugin(options) {
1698
1711
  return {
1699
1712
  name: "farm-private-client-sourcemaps",
1700
1713
  enforce: "post",
1701
- generateBundle(_output, bundle) {
1702
- maps = [];
1703
- for (const [fileName, output] of Object.entries(bundle)) {
1704
- if (output.type !== "asset" || !fileName.endsWith(".map")) continue;
1705
- maps.push([fileName, output.source ?? ""]);
1706
- delete bundle[fileName];
1714
+ generateBundle: {
1715
+ order: "post",
1716
+ handler(_output, bundle) {
1717
+ maps = [];
1718
+ for (const [fileName, output] of Object.entries(bundle)) {
1719
+ if (output.type !== "asset" || !fileName.endsWith(".map")) continue;
1720
+ maps.push([fileName, output.source ?? ""]);
1721
+ delete bundle[fileName];
1722
+ }
1707
1723
  }
1708
1724
  },
1709
1725
  async writeBundle() {
@@ -1717,6 +1733,42 @@ function createFarmPrivateClientSourcemapsPlugin(options) {
1717
1733
  };
1718
1734
  }
1719
1735
 
1736
+ // src/nitro/client-brotli-assets.ts
1737
+ import { readdir, readFile, writeFile } from "fs/promises";
1738
+ import { availableParallelism } from "os";
1739
+ import path15 from "path";
1740
+ import { promisify } from "util";
1741
+ import { brotliCompress, constants } from "zlib";
1742
+ var compress = promisify(brotliCompress);
1743
+ var SCRIPT_OR_STYLESHEET = /\.(?:m?js|css)$/;
1744
+ var MIN_COMPRESSED_BYTES = 1024;
1745
+ async function writeFarmClientBrotliAssets(clientOutputDir) {
1746
+ const entries = await readdir(clientOutputDir, { recursive: true, withFileTypes: true });
1747
+ const files = new Set(
1748
+ entries.filter((entry) => entry.isFile()).map((entry) => path15.join(entry.parentPath, entry.name))
1749
+ );
1750
+ const pending = [...files].filter(
1751
+ (file) => SCRIPT_OR_STYLESHEET.test(file) && !files.has(`${file}.br`)
1752
+ );
1753
+ const next = async () => {
1754
+ const file = pending.pop();
1755
+ if (file === void 0) return;
1756
+ const source = await readFile(file);
1757
+ if (source.length >= MIN_COMPRESSED_BYTES) {
1758
+ const compressed = await compress(source, {
1759
+ params: {
1760
+ [constants.BROTLI_PARAM_MODE]: constants.BROTLI_MODE_TEXT,
1761
+ [constants.BROTLI_PARAM_QUALITY]: constants.BROTLI_MAX_QUALITY,
1762
+ [constants.BROTLI_PARAM_SIZE_HINT]: source.length
1763
+ }
1764
+ });
1765
+ await writeFile(`${file}.br`, compressed);
1766
+ }
1767
+ return next();
1768
+ };
1769
+ await Promise.all(Array.from({ length: availableParallelism() }, next));
1770
+ }
1771
+
1720
1772
  // src/middleware/static-config.ts
1721
1773
  function literalMatcher(node) {
1722
1774
  if (!node) return void 0;
@@ -1782,8 +1834,8 @@ function readStaticMiddlewareConfig(program) {
1782
1834
  }
1783
1835
  async function readMiddlewareFileConfig(filePath) {
1784
1836
  try {
1785
- const [{ readFile }, vite] = await Promise.all([import("fs/promises"), import("vite")]);
1786
- const parsed = vite.parseSync(filePath, await readFile(filePath, "utf8"));
1837
+ const [{ readFile: readFile2 }, vite] = await Promise.all([import("fs/promises"), import("vite")]);
1838
+ const parsed = vite.parseSync(filePath, await readFile2(filePath, "utf8"));
1787
1839
  if (parsed.errors?.length) return "unknown";
1788
1840
  return readStaticMiddlewareConfig(parsed.program);
1789
1841
  } catch {
@@ -1793,7 +1845,7 @@ async function readMiddlewareFileConfig(filePath) {
1793
1845
 
1794
1846
  // src/nitro/vercel-edge-middleware.ts
1795
1847
  import { createRequire, isBuiltin } from "module";
1796
- import path15 from "path";
1848
+ import path16 from "path";
1797
1849
  import { gzipSync } from "zlib";
1798
1850
  var FARM_VERCEL_EDGE_MIDDLEWARE_FUNCTION = "_farm_middleware";
1799
1851
  var FARM_VERCEL_EDGE_NOT_FOUND_PATH = "/__farm/not-found";
@@ -1848,21 +1900,21 @@ ${modules.join("\n")}
1848
1900
  `;
1849
1901
  }
1850
1902
  async function resolveFarmCoreDir(root, fs5) {
1851
- const runtimeEntry = createRequire(path15.join(root, "package.json")).resolve(
1903
+ const runtimeEntry = createRequire(path16.join(root, "package.json")).resolve(
1852
1904
  "@farm.js/core/internal/vercel-edge-middleware"
1853
1905
  );
1854
- return fs5.realpath(path15.resolve(path15.dirname(runtimeEntry), "..", ".."));
1906
+ return fs5.realpath(path16.resolve(path16.dirname(runtimeEntry), "..", ".."));
1855
1907
  }
1856
1908
  function edgeNodeModulesPlugin(coreDir, unsupported) {
1857
1909
  const streamStub = "\0farm-edge-node-stream";
1858
- const corePrefix = coreDir + path15.sep;
1910
+ const corePrefix = coreDir + path16.sep;
1859
1911
  return {
1860
1912
  name: "farm-vercel-edge-node-modules",
1861
1913
  resolveId(source, importer) {
1862
1914
  if (!isBuiltin(source)) return null;
1863
1915
  const name = source.replace(/^node:/, "").split("/")[0];
1864
1916
  if (EDGE_NODE_MODULES.has(name)) return { id: `node:${name}`, external: true };
1865
- if (name === "stream" && importer && path15.resolve(importer).startsWith(corePrefix)) {
1917
+ if (name === "stream" && importer && path16.resolve(importer).startsWith(corePrefix)) {
1866
1918
  return streamStub;
1867
1919
  }
1868
1920
  unsupported.add(`${source} (imported by ${importer ?? "the entry"})`);
@@ -1876,13 +1928,13 @@ function edgeNodeModulesPlugin(coreDir, unsupported) {
1876
1928
  }
1877
1929
  async function writeFarmVercelEdgeMiddlewareFunction(options) {
1878
1930
  const { root, outputDir, buildDir, config, routes, guardedPages, fs: fs5 } = options;
1879
- const functionDir = path15.join(
1931
+ const functionDir = path16.join(
1880
1932
  outputDir,
1881
1933
  "functions",
1882
1934
  `${FARM_VERCEL_EDGE_MIDDLEWARE_FUNCTION}.func`
1883
1935
  );
1884
- const entryPath = path15.join(buildDir, "vercel-edge-middleware-entry.mjs");
1885
- await fs5.mkdir(path15.dirname(entryPath), { recursive: true });
1936
+ const entryPath = path16.join(buildDir, "vercel-edge-middleware-entry.mjs");
1937
+ await fs5.mkdir(path16.dirname(entryPath), { recursive: true });
1886
1938
  await fs5.writeFile(
1887
1939
  entryPath,
1888
1940
  generateFarmVercelEdgeMiddlewareEntry(routes, config, guardedPages)
@@ -1931,9 +1983,9 @@ Remove them from the middleware (Edge provides ${[...EDGE_NODE_MODULES].join(",
1931
1983
  }
1932
1984
  await fs5.rm(functionDir, { recursive: true, force: true });
1933
1985
  await fs5.mkdir(functionDir, { recursive: true });
1934
- await fs5.writeFile(path15.join(functionDir, "index.js"), code);
1986
+ await fs5.writeFile(path16.join(functionDir, "index.js"), code);
1935
1987
  await fs5.writeFile(
1936
- path15.join(functionDir, ".vc-config.json"),
1988
+ path16.join(functionDir, ".vc-config.json"),
1937
1989
  `${JSON.stringify({ runtime: "edge", entrypoint: "index.js" }, null, 2)}
1938
1990
  `
1939
1991
  );
@@ -1955,7 +2007,7 @@ async function readFarmNativeStylesheets(clientOutputDir, clientCssHref) {
1955
2007
  try {
1956
2008
  return {
1957
2009
  [clientCssHref]: await fs5.readFile(
1958
- path16.join(clientOutputDir, clientCssHref.slice(1)),
2010
+ path17.join(clientOutputDir, clientCssHref.slice(1)),
1959
2011
  "utf8"
1960
2012
  )
1961
2013
  };
@@ -1970,18 +2022,18 @@ function preloadFarmNitroBuilder() {
1970
2022
  );
1971
2023
  }
1972
2024
  var _filename = typeof import.meta.url !== "undefined" ? fileURLToPath(import.meta.url) : "";
1973
- var _dirname = path16.dirname(_filename);
2025
+ var _dirname = path17.dirname(_filename);
1974
2026
  function findFarmCoreRoot(from) {
1975
- let dir = path16.dirname(from);
1976
- while (dir !== path16.dirname(dir)) {
1977
- const manifest = path16.join(dir, "package.json");
2027
+ let dir = path17.dirname(from);
2028
+ while (dir !== path17.dirname(dir)) {
2029
+ const manifest = path17.join(dir, "package.json");
1978
2030
  if (existsSync3(manifest)) {
1979
2031
  try {
1980
2032
  if (JSON.parse(readFileSync2(manifest, "utf8")).name === "@farm.js/core") return dir;
1981
2033
  } catch {
1982
2034
  }
1983
2035
  }
1984
- dir = path16.dirname(dir);
2036
+ dir = path17.dirname(dir);
1985
2037
  }
1986
2038
  return null;
1987
2039
  }
@@ -1991,16 +2043,16 @@ function toModulePath(file) {
1991
2043
  return process.platform === "win32" ? normalized.toLowerCase() : normalized;
1992
2044
  }
1993
2045
  function findInstalledPackageDir(name, from) {
1994
- for (let dir = from; ; dir = path16.dirname(dir)) {
1995
- const candidate = path16.join(dir, "node_modules", name);
1996
- if (existsSync3(path16.join(candidate, "package.json"))) {
2046
+ for (let dir = from; ; dir = path17.dirname(dir)) {
2047
+ const candidate = path17.join(dir, "node_modules", name);
2048
+ if (existsSync3(path17.join(candidate, "package.json"))) {
1997
2049
  try {
1998
2050
  return realpathSync3(candidate);
1999
2051
  } catch {
2000
2052
  return null;
2001
2053
  }
2002
2054
  }
2003
- if (dir === path16.dirname(dir)) return null;
2055
+ if (dir === path17.dirname(dir)) return null;
2004
2056
  }
2005
2057
  }
2006
2058
  function collectFarmDependencyDirs(root) {
@@ -2011,7 +2063,7 @@ function collectFarmDependencyDirs(root) {
2011
2063
  seen.add(dir);
2012
2064
  let manifest;
2013
2065
  try {
2014
- manifest = JSON.parse(readFileSync2(path16.join(dir, "package.json"), "utf8"));
2066
+ manifest = JSON.parse(readFileSync2(path17.join(dir, "package.json"), "utf8"));
2015
2067
  } catch {
2016
2068
  return;
2017
2069
  }
@@ -2022,7 +2074,7 @@ function collectFarmDependencyDirs(root) {
2022
2074
  if (farmCoreRoot) visit(realpathSync3(farmCoreRoot));
2023
2075
  queue.push({ name: "@farm.js/core", from: root });
2024
2076
  try {
2025
- const manifest = JSON.parse(readFileSync2(path16.join(root, "package.json"), "utf8"));
2077
+ const manifest = JSON.parse(readFileSync2(path17.join(root, "package.json"), "utf8"));
2026
2078
  for (const field of ["dependencies", "devDependencies"]) {
2027
2079
  for (const name of Object.keys(manifest[field] ?? {})) {
2028
2080
  if (name.startsWith("@farm.js/")) queue.push({ name, from: root });
@@ -2089,17 +2141,17 @@ var FARM_SSR_PACKAGE_IMPORT = "#farm-ssr-entry";
2089
2141
  var FARM_SSR_OUTPUT_DIR = "farm-ssr";
2090
2142
  var FARM_CLIENT_BUILD_TARGET = ["es2020", "edge88", "firefox78", "chrome87", "safari14"];
2091
2143
  function resolveNitroRuntimeDependency(root, specifier) {
2092
- return createRequire2(resolveNitroPackageEntry(root)).resolve(specifier).split(path16.sep).join("/");
2144
+ return createRequire2(resolveNitroPackageEntry(root)).resolve(specifier).split(path17.sep).join("/");
2093
2145
  }
2094
2146
  function resolveNitroInternalRuntimeAliases(root) {
2095
2147
  const nitroEntry = resolveNitroPackageEntry(root);
2096
- const runtimeDir = path16.dirname(nitroEntry);
2148
+ const runtimeDir = path17.dirname(nitroEntry);
2097
2149
  const nitroRequire = createRequire2(nitroEntry);
2098
2150
  return {
2099
2151
  ...Object.fromEntries(
2100
2152
  ["app", "error/hooks", "runtime-config", "shutdown", "task"].map((moduleName) => [
2101
2153
  `#nitro/runtime/${moduleName}`,
2102
- path16.join(runtimeDir, "internal", `${moduleName}.mjs`).split(path16.sep).join("/")
2154
+ path17.join(runtimeDir, "internal", `${moduleName}.mjs`).split(path17.sep).join("/")
2103
2155
  ])
2104
2156
  ),
2105
2157
  // Farm's generated workflow and cron wrappers live under `.farm/` and
@@ -2108,7 +2160,7 @@ function resolveNitroInternalRuntimeAliases(root) {
2108
2160
  ...Object.fromEntries(
2109
2161
  ["nitro/app", "nitro/h3", "nitro/task"].map((specifier) => [
2110
2162
  specifier,
2111
- nitroRequire.resolve(specifier).split(path16.sep).join("/")
2163
+ nitroRequire.resolve(specifier).split(path17.sep).join("/")
2112
2164
  ])
2113
2165
  )
2114
2166
  };
@@ -2132,7 +2184,7 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
2132
2184
  name: "farm-prerender-runtime-resolver",
2133
2185
  async resolveId(id, _importer, options) {
2134
2186
  if (options.custom?.farmPrerenderRuntimeResolve) return null;
2135
- if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || path16.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
2187
+ if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || path17.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
2136
2188
  return null;
2137
2189
  }
2138
2190
  if (nitroEntry === void 0) {
@@ -2155,7 +2207,7 @@ function createFarmStorageModuleRegistration(config) {
2155
2207
  const modules = _collectFarmStorageModules(config.storage);
2156
2208
  if (modules.length === 0) return "";
2157
2209
  const root = config.root || process.cwd();
2158
- const projectRequire = createRequire2(path16.join(root, "package.json"));
2210
+ const projectRequire = createRequire2(path17.join(root, "package.json"));
2159
2211
  let runtimeRequire = projectRequire;
2160
2212
  try {
2161
2213
  runtimeRequire = createRequire2(projectRequire.resolve("@farm.js/core"));
@@ -2182,7 +2234,7 @@ ${loaders.join("\n")}
2182
2234
  });` : "";
2183
2235
  }
2184
2236
  function resolveNitroPackageEntry(root) {
2185
- const projectRequire = createRequire2(path16.join(root, "package.json"));
2237
+ const projectRequire = createRequire2(path17.join(root, "package.json"));
2186
2238
  let runtimeRequire = projectRequire;
2187
2239
  try {
2188
2240
  runtimeRequire = createRequire2(projectRequire.resolve("@farm.js/core"));
@@ -2252,7 +2304,7 @@ function createFarmReactWebServerAlias(hasEdgeBuild) {
2252
2304
  }
2253
2305
  function hasReactDomEdgeServerBuild(root) {
2254
2306
  try {
2255
- createRequire2(path16.join(root, "package.json")).resolve("react-dom/server.edge");
2307
+ createRequire2(path17.join(root, "package.json")).resolve("react-dom/server.edge");
2256
2308
  return true;
2257
2309
  } catch {
2258
2310
  return false;
@@ -2283,9 +2335,9 @@ function isNitroRollupExternal(id) {
2283
2335
  var FARM_METADATA_IMAGE_WASM_PREFIX = "\0farm-metadata-image-wasm:";
2284
2336
  var FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID = "\0farm-omitted-metadata-image-runtime";
2285
2337
  function isFarmCoreModule(file) {
2286
- let dir = path16.dirname(file.split("?", 1)[0]);
2287
- while (dir !== path16.dirname(dir)) {
2288
- const manifest = path16.join(dir, "package.json");
2338
+ let dir = path17.dirname(file.split("?", 1)[0]);
2339
+ while (dir !== path17.dirname(dir)) {
2340
+ const manifest = path17.join(dir, "package.json");
2289
2341
  if (existsSync3(manifest)) {
2290
2342
  try {
2291
2343
  return JSON.parse(readFileSync2(manifest, "utf8")).name === "@farm.js/core";
@@ -2293,7 +2345,7 @@ function isFarmCoreModule(file) {
2293
2345
  return false;
2294
2346
  }
2295
2347
  }
2296
- dir = path16.dirname(dir);
2348
+ dir = path17.dirname(dir);
2297
2349
  }
2298
2350
  return false;
2299
2351
  }
@@ -2304,7 +2356,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
2304
2356
  filter: { id: exactIdPattern(["@vercel/og"]) },
2305
2357
  handler(source, importer) {
2306
2358
  if (source !== "@vercel/og") return null;
2307
- const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(path16.basename(importer.split("?", 1)[0]));
2359
+ const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(path17.basename(importer.split("?", 1)[0]));
2308
2360
  if (fromCoreRuntime) return FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID;
2309
2361
  return externalizeOtherImports ? { id: source, external: true } : null;
2310
2362
  }
@@ -2325,14 +2377,14 @@ export class ImageResponse {
2325
2377
  };
2326
2378
  }
2327
2379
  function readVercelOgManifest(file) {
2328
- let dir = path16.dirname(file.split("?", 1)[0]);
2329
- while (dir !== path16.dirname(dir)) {
2330
- const manifestPath = path16.join(dir, "package.json");
2380
+ let dir = path17.dirname(file.split("?", 1)[0]);
2381
+ while (dir !== path17.dirname(dir)) {
2382
+ const manifestPath = path17.join(dir, "package.json");
2331
2383
  if (existsSync3(manifestPath)) {
2332
2384
  const manifest = JSON.parse(readFileSync2(manifestPath, "utf8"));
2333
2385
  return manifest.name === "@vercel/og" ? { dir, manifest } : null;
2334
2386
  }
2335
- dir = path16.dirname(dir);
2387
+ dir = path17.dirname(dir);
2336
2388
  }
2337
2389
  return null;
2338
2390
  }
@@ -2340,7 +2392,7 @@ function resolveVercelOgConditionEntry(resolvedId, condition) {
2340
2392
  const vercelOg = readVercelOgManifest(resolvedId);
2341
2393
  const entry = vercelOg?.manifest.exports?.["."]?.[condition];
2342
2394
  const file = typeof entry === "string" ? entry : entry?.default;
2343
- return vercelOg && typeof file === "string" ? path16.join(vercelOg.dir, file) : null;
2395
+ return vercelOg && typeof file === "string" ? path17.join(vercelOg.dir, file) : null;
2344
2396
  }
2345
2397
  function createEdgeMetadataImageRuntimePlugin({
2346
2398
  condition,
@@ -2358,7 +2410,7 @@ function createEdgeMetadataImageRuntimePlugin({
2358
2410
  if (wasm !== "module" || !source.endsWith(".wasm?module") || !importer?.replace(/\\/g, "/").includes("/@vercel/og/")) {
2359
2411
  return null;
2360
2412
  }
2361
- const resolvedPath = path16.resolve(path16.dirname(importer.split("?", 1)[0]), source);
2413
+ const resolvedPath = path17.resolve(path17.dirname(importer.split("?", 1)[0]), source);
2362
2414
  return { id: toPosixPath(resolvedPath), external: "absolute" };
2363
2415
  }
2364
2416
  };
@@ -2373,7 +2425,7 @@ function createVercelOgFontInlinePlugin(runtime = "Cloudflare Workers") {
2373
2425
  return null;
2374
2426
  }
2375
2427
  const inlined = code.replace(VERCEL_OG_FONT_FETCH, (_match, _quote, request) => {
2376
- const encoded = readFileSync2(path16.resolve(path16.dirname(file), request)).toString("base64");
2428
+ const encoded = readFileSync2(path17.resolve(path17.dirname(file), request)).toString("base64");
2377
2429
  return `Promise.resolve({ arrayBuffer: () => Uint8Array.from(atob(${JSON.stringify(encoded)}), (character) => character.charCodeAt(0)).buffer })`;
2378
2430
  });
2379
2431
  if (inlined !== code) return { code: inlined, map: null };
@@ -2392,7 +2444,7 @@ function createMetadataImageWasmPlugin() {
2392
2444
  return null;
2393
2445
  }
2394
2446
  const requestPath = source.slice(0, -"?module".length);
2395
- const resolvedPath = path16.isAbsolute(requestPath) ? requestPath : path16.resolve(path16.dirname(importer.split("?", 1)[0]), requestPath);
2447
+ const resolvedPath = path17.isAbsolute(requestPath) ? requestPath : path17.resolve(path17.dirname(importer.split("?", 1)[0]), requestPath);
2396
2448
  return `${FARM_METADATA_IMAGE_WASM_PREFIX}${resolvedPath}`;
2397
2449
  },
2398
2450
  load(id) {
@@ -2417,11 +2469,11 @@ function collectSSRExternalPackages(ssrBundle) {
2417
2469
  for (const importId of [...output.imports, ...output.dynamicImports]) {
2418
2470
  const normalizedImportId = importId.replace(/\\/g, "/");
2419
2471
  const normalizedId = normalizedImportId.replace(/^\.\//, "");
2420
- const resolvedRelativeId = normalizedImportId.startsWith("./") || normalizedImportId.startsWith("../") ? path16.posix.normalize(path16.posix.join(path16.posix.dirname(fileName), normalizedImportId)) : null;
2472
+ const resolvedRelativeId = normalizedImportId.startsWith("./") || normalizedImportId.startsWith("../") ? path17.posix.normalize(path17.posix.join(path17.posix.dirname(fileName), normalizedImportId)) : null;
2421
2473
  if (emittedFiles.has(normalizedId) || resolvedRelativeId !== null && emittedFiles.has(resolvedRelativeId) || NODE_BUILTIN_MODULES.has(importId) || importId.startsWith("node:")) {
2422
2474
  continue;
2423
2475
  }
2424
- if (path16.isAbsolute(importId) || /^[A-Za-z]:[\\/]/.test(importId) || importId.startsWith("#") || importId.startsWith("\0")) {
2476
+ if (path17.isAbsolute(importId) || /^[A-Za-z]:[\\/]/.test(importId) || importId.startsWith("#") || importId.startsWith("\0")) {
2425
2477
  externalPackages.add(importId);
2426
2478
  continue;
2427
2479
  }
@@ -2433,15 +2485,15 @@ function collectSSRExternalPackages(ssrBundle) {
2433
2485
  return externalPackages;
2434
2486
  }
2435
2487
  function createExternalSSRBundlePlugin(nitroEntryPath, ssrOutputDir, ssrEntryFile) {
2436
- const resolvedNitroEntry = path16.resolve(nitroEntryPath);
2437
- const resolvedSSREntry = path16.resolve(ssrOutputDir, ssrEntryFile);
2488
+ const resolvedNitroEntry = path17.resolve(nitroEntryPath);
2489
+ const resolvedSSREntry = path17.resolve(ssrOutputDir, ssrEntryFile);
2438
2490
  return {
2439
2491
  name: "farm-externalize-prebuilt-ssr",
2440
2492
  resolveId(source, importer) {
2441
- if (!importer || path16.resolve(importer) !== resolvedNitroEntry) {
2493
+ if (!importer || path17.resolve(importer) !== resolvedNitroEntry) {
2442
2494
  return null;
2443
2495
  }
2444
- const resolvedImport = path16.resolve(path16.dirname(importer), source);
2496
+ const resolvedImport = path17.resolve(path17.dirname(importer), source);
2445
2497
  if (resolvedImport !== resolvedSSREntry) return null;
2446
2498
  return { id: FARM_SSR_PACKAGE_IMPORT, external: true };
2447
2499
  }
@@ -2579,13 +2631,13 @@ function trimSlashes(value) {
2579
2631
  function resolveBuildDocsContentDir(docs, root, srcDir) {
2580
2632
  const configuredContentDir = docs.contentDir || docs.config.contentDir;
2581
2633
  if (typeof configuredContentDir === "string" && configuredContentDir.trim()) {
2582
- const contentDir = path16.isAbsolute(configuredContentDir) ? configuredContentDir : path16.join(root, configuredContentDir);
2634
+ const contentDir = path17.isAbsolute(configuredContentDir) ? configuredContentDir : path17.join(root, configuredContentDir);
2583
2635
  return existsSync3(contentDir) ? contentDir : null;
2584
2636
  }
2585
2637
  const entryDir = docs.config.entry || trimSlashes(docs.entry) || "docs";
2586
- const appDocsDir = path16.join(root, srcDir || "src", "app", entryDir);
2638
+ const appDocsDir = path17.join(root, srcDir || "src", "app", entryDir);
2587
2639
  if (existsSync3(appDocsDir)) return appDocsDir;
2588
- const rootDocsDir = path16.join(root, entryDir);
2640
+ const rootDocsDir = path17.join(root, entryDir);
2589
2641
  return existsSync3(rootDocsDir) ? rootDocsDir : null;
2590
2642
  }
2591
2643
  function hasProjectPostcssConfig(root) {
@@ -2602,7 +2654,7 @@ function hasProjectPostcssConfig(root) {
2602
2654
  ".postcssrc.mjs",
2603
2655
  ".postcssrc.ts"
2604
2656
  ];
2605
- const projectRequire = createRequire2(path16.join(root, "package.json"));
2657
+ const projectRequire = createRequire2(path17.join(root, "package.json"));
2606
2658
  return candidates.some((file) => {
2607
2659
  try {
2608
2660
  projectRequire.resolve(`./${file}`);
@@ -2625,7 +2677,7 @@ async function findFarmConfigPath(root) {
2625
2677
  "config.mjs"
2626
2678
  ];
2627
2679
  for (const candidate of candidates) {
2628
- const resolvedPath = path16.join(root, candidate);
2680
+ const resolvedPath = path17.join(root, candidate);
2629
2681
  try {
2630
2682
  await fs5.access(resolvedPath);
2631
2683
  return resolvedPath;
@@ -2662,7 +2714,7 @@ async function discoverMiddlewareRoutes(appDir) {
2662
2714
  discovered.push({
2663
2715
  path: routePath,
2664
2716
  directory,
2665
- filePath: path16.join(dir, middlewareFile.name)
2717
+ filePath: path17.join(dir, middlewareFile.name)
2666
2718
  });
2667
2719
  }
2668
2720
  for (const entry of entries) {
@@ -2670,7 +2722,7 @@ async function discoverMiddlewareRoutes(appDir) {
2670
2722
  continue;
2671
2723
  }
2672
2724
  await walk(
2673
- path16.join(dir, entry.name),
2725
+ path17.join(dir, entry.name),
2674
2726
  appendMiddlewareRoutePath(routePath, entry.name),
2675
2727
  appendMiddlewareDirectory(directory, entry.name),
2676
2728
  discovered
@@ -2770,7 +2822,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
2770
2822
  }
2771
2823
  const hydrationPlanCache = routeManager.getRouteModuleHydrationPlans();
2772
2824
  const sourceSnapshot = routeManager.takeBuildSourceSnapshot();
2773
- const clientOutputDir = path16.join(root, distDir, "client");
2825
+ const clientOutputDir = path17.join(root, distDir, "client");
2774
2826
  const [productionViteResult] = await productionViteResultPromise;
2775
2827
  if (productionViteResult.status === "rejected") {
2776
2828
  await routeRuntimeManifestResultPromise;
@@ -2903,10 +2955,10 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
2903
2955
  markdownPrecompile?.pages
2904
2956
  );
2905
2957
  const runtimeManifestPath = await writeFarmRouteRuntimeManifest(
2906
- path16.join(root, distDir),
2958
+ path17.join(root, distDir),
2907
2959
  routeRuntimeManifest
2908
2960
  );
2909
- logger.info(`\u{1F4CB} Route runtime manifest: ${path16.relative(root, runtimeManifestPath)}`);
2961
+ logger.info(`\u{1F4CB} Route runtime manifest: ${path17.relative(root, runtimeManifestPath)}`);
2910
2962
  } catch (error) {
2911
2963
  if (lifecyclePluginManager) {
2912
2964
  await lifecyclePluginManager.runHookParallel("onError", {
@@ -2964,15 +3016,15 @@ async function writeSSRAssetsToClient(bundle, outputDir) {
2964
3016
  await mergeBuiltFontCss(outputDir, output.source);
2965
3017
  continue;
2966
3018
  }
2967
- const filePath = path16.join(outputDir, fileName);
2968
- await fs5.mkdir(path16.dirname(filePath), { recursive: true });
3019
+ const filePath = path17.join(outputDir, fileName);
3020
+ await fs5.mkdir(path17.dirname(filePath), { recursive: true });
2969
3021
  await fs5.writeFile(filePath, output.source);
2970
3022
  }
2971
3023
  }
2972
3024
  async function writeFarmVideoPlayerToClient(outputDir) {
2973
3025
  const fs5 = await import("fs/promises");
2974
- const filePath = path16.join(outputDir, FARM_VIDEO_PLAYER_PATH.slice(1));
2975
- await fs5.mkdir(path16.dirname(filePath), { recursive: true });
3026
+ const filePath = path17.join(outputDir, FARM_VIDEO_PLAYER_PATH.slice(1));
3027
+ await fs5.mkdir(path17.dirname(filePath), { recursive: true });
2976
3028
  try {
2977
3029
  await fs5.writeFile(filePath, FARM_VIDEO_PLAYER_HTML, { flag: "wx" });
2978
3030
  } catch (error) {
@@ -2983,15 +3035,15 @@ async function copyFarmDocsFontAssetsToClient(root, outputDir) {
2983
3035
  const fs5 = await import("fs/promises");
2984
3036
  await Promise.all(
2985
3037
  resolveFarmDocsFontAssets(root).map(async ({ sourcePath, url }) => {
2986
- const targetPath = path16.join(outputDir, url.replace(/^\/+/, ""));
2987
- await fs5.mkdir(path16.dirname(targetPath), { recursive: true });
3038
+ const targetPath = path17.join(outputDir, url.replace(/^\/+/, ""));
3039
+ await fs5.mkdir(path17.dirname(targetPath), { recursive: true });
2988
3040
  await fs5.copyFile(sourcePath, targetPath);
2989
3041
  })
2990
3042
  );
2991
3043
  }
2992
3044
  async function mergeBuiltFontCss(outputDir, fontCssSource) {
2993
3045
  const fs5 = await import("fs/promises");
2994
- const fontCssPath = path16.join(outputDir, "farm-fonts.css");
3046
+ const fontCssPath = path17.join(outputDir, "farm-fonts.css");
2995
3047
  let fontCss = fontCssSource;
2996
3048
  if (fontCss === void 0) {
2997
3049
  try {
@@ -3000,7 +3052,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
3000
3052
  return;
3001
3053
  }
3002
3054
  }
3003
- const clientCssPath = path16.join(outputDir, "farm-client.css");
3055
+ const clientCssPath = path17.join(outputDir, "farm-client.css");
3004
3056
  let clientCss = "";
3005
3057
  try {
3006
3058
  clientCss = await fs5.readFile(clientCssPath, "utf8");
@@ -3026,7 +3078,7 @@ var IncompleteClientBuildOutputError = class extends Error {
3026
3078
  async function validateClientBuildOutput(root, srcDir, outputDir) {
3027
3079
  const fs5 = await import("fs/promises");
3028
3080
  const fingerprinted = await findFingerprintedClientEntry(outputDir);
3029
- const clientEntryPath = path16.join(outputDir, fingerprinted ?? "farm-client.js");
3081
+ const clientEntryPath = path17.join(outputDir, fingerprinted ?? "farm-client.js");
3030
3082
  let clientEntrySize = 0;
3031
3083
  try {
3032
3084
  const clientEntry = await fs5.stat(clientEntryPath);
@@ -3036,8 +3088,8 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
3036
3088
  if (clientEntrySize === 0) {
3037
3089
  throw new IncompleteClientBuildOutputError("farm-client.js is missing or empty");
3038
3090
  }
3039
- const clientCssPath = path16.join(outputDir, "farm-client.css");
3040
- const globalsCssPath = path16.join(root, srcDir, "app", "globals.css");
3091
+ const clientCssPath = path17.join(outputDir, "farm-client.css");
3092
+ const globalsCssPath = path17.join(root, srcDir, "app", "globals.css");
3041
3093
  let expectsCss = false;
3042
3094
  try {
3043
3095
  const globalsCss = await fs5.readFile(globalsCssPath, "utf8");
@@ -3067,10 +3119,15 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
3067
3119
  return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
3068
3120
  }
3069
3121
  async function buildClient(productionVite, config, root, srcDir, outputDir, pageRoutes, layoutRoutes = [], routeSlots = [], isolatedClientBoundaryModules = /* @__PURE__ */ new Set(), hydrationPlanCache = /* @__PURE__ */ new Map(), rendererBuildLifetime, programmaticClientRoutes, mobile = false, sourceSnapshot) {
3070
- if (!mobile) await removeFarmMobileClientManifest(path16.dirname(outputDir));
3122
+ if (!mobile) await removeFarmMobileClientManifest(path17.dirname(outputDir));
3071
3123
  const viteBuild = productionVite.build;
3072
- const { farmIslandContainersPlugin, farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
3073
- const { PluginManager: PluginManager2 } = await import("./plugin-TV6W7YNK.mjs");
3124
+ const {
3125
+ farmIslandContainersPlugin,
3126
+ farmNavigationPlugin,
3127
+ farmPlugin,
3128
+ farmServerOnlyEntriesPlugin
3129
+ } = await import("./vite.mjs");
3130
+ const { PluginManager: PluginManager2 } = await import("./plugin-33I3V42N.mjs");
3074
3131
  const fs5 = await import("fs/promises");
3075
3132
  const pluginManager = new PluginManager2({
3076
3133
  config,
@@ -3350,12 +3407,12 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3350
3407
  );
3351
3408
  const clientRouteTable = createFarmClientRouteTable(clientPages);
3352
3409
  createFarmRouter(clientRouteTable.map((route) => ({ path: route.pattern, meta: route })));
3353
- await writeFarmClientRouteTable(path16.dirname(outputDir), clientRouteTable);
3410
+ await writeFarmClientRouteTable(path17.dirname(outputDir), clientRouteTable);
3354
3411
  const buildTarget = async (platform) => {
3355
- const clientEntryRoot = path16.join(root, ".farm", "tmp");
3412
+ const clientEntryRoot = path17.join(root, ".farm", "tmp");
3356
3413
  await fs5.mkdir(clientEntryRoot, { recursive: true });
3357
- const clientEntryDir = await fs5.mkdtemp(path16.join(clientEntryRoot, "client-entry-"));
3358
- const clientEntryPath = path16.join(clientEntryDir, "farm-client-entry.tsx");
3414
+ const clientEntryDir = await fs5.mkdtemp(path17.join(clientEntryRoot, "client-entry-"));
3415
+ const clientEntryPath = path17.join(clientEntryDir, "farm-client-entry.tsx");
3359
3416
  const clientHydrationCode = generateClientHydrationEntry(
3360
3417
  clientPages,
3361
3418
  clientLayouts,
@@ -3389,15 +3446,15 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3389
3446
  const clientEntry = islandsMode && platform === "web" && clientHydrationCode.includes("/*farm-router-stub*/") ? splitFarmClientRouter(clientHydrationCode) : { entry: clientHydrationCode, router: void 0 };
3390
3447
  await fs5.writeFile(clientEntryPath, clientEntry.entry);
3391
3448
  await fs5.writeFile(
3392
- path16.join(clientEntryDir, `${FARM_CLIENT_ROUTE_TABLE_MODULE}.tsx`),
3449
+ path17.join(clientEntryDir, `${FARM_CLIENT_ROUTE_TABLE_MODULE}.tsx`),
3393
3450
  generateFarmClientRouteTableModule(clientRouteTable)
3394
3451
  );
3395
3452
  if (clientEntry.router !== void 0) {
3396
- await fs5.writeFile(path16.join(clientEntryDir, "farm-client-router.tsx"), clientEntry.router);
3453
+ await fs5.writeFile(path17.join(clientEntryDir, "farm-client-router.tsx"), clientEntry.router);
3397
3454
  }
3398
3455
  const clientInput = { [entryName]: clientEntryPath };
3399
3456
  if (platform === "web" && canBootFarmIslandsClient(config)) {
3400
- const clientBootPath = path16.join(clientEntryDir, "farm-client-boot.tsx");
3457
+ const clientBootPath = path17.join(clientEntryDir, "farm-client-boot.tsx");
3401
3458
  await fs5.writeFile(
3402
3459
  clientBootPath,
3403
3460
  'import { startFarmIslandsBoot } from "@farm.js/core/internal/islands-boot";\nstartFarmIslandsBoot();\n'
@@ -3414,7 +3471,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3414
3471
  if (hasScopedPostcssConfig) {
3415
3472
  logger.info("\u{1F4E6} Using project PostCSS/Tailwind configuration");
3416
3473
  } else {
3417
- const postcssConfigPath = path16.join(clientEntryDir, "postcss.config.cjs");
3474
+ const postcssConfigPath = path17.join(clientEntryDir, "postcss.config.cjs");
3418
3475
  await fs5.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
3419
3476
  postcssSearchPath = clientEntryDir;
3420
3477
  tailwindVitePlugin = await loadTailwindVitePlugin({
@@ -3473,28 +3530,37 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3473
3530
  plugins: [
3474
3531
  createFarmThemeCssPlugin(config.theme, config.basePath),
3475
3532
  createFarmPrivateClientSourcemapsPlugin({
3476
- outDir: path16.join(
3477
- path16.dirname(outputDir),
3533
+ outDir: path17.join(
3534
+ path17.dirname(outputDir),
3478
3535
  platform === "mobile" ? `${FARM_CLIENT_SOURCEMAPS_DIR}-mobile` : FARM_CLIENT_SOURCEMAPS_DIR
3479
3536
  )
3480
3537
  }),
3481
3538
  // The web client's preload manifests; the mobile client records its files instead.
3482
3539
  platform === "mobile" ? createFarmMobileClientManifestPlugin({
3483
- buildDir: path16.dirname(outputDir),
3540
+ buildDir: path17.dirname(outputDir),
3484
3541
  entryName
3485
3542
  }) : createFarmClientModulePreloadPlugin({
3486
3543
  root,
3487
- buildDir: path16.dirname(outputDir),
3544
+ buildDir: path17.dirname(outputDir),
3488
3545
  entryName: "farm-client",
3489
3546
  routerModules: [
3490
- path16.join(clientEntryDir, "farm-client-router.tsx"),
3491
- path16.join(clientEntryDir, `${FARM_CLIENT_ROUTE_TABLE_MODULE}.tsx`)
3492
- ]
3547
+ path17.join(clientEntryDir, "farm-client-router.tsx"),
3548
+ path17.join(clientEntryDir, `${FARM_CLIENT_ROUTE_TABLE_MODULE}.tsx`)
3549
+ ],
3550
+ // What the islands entry loads with its first render or hydration (RFC 0010).
3551
+ ...islandsMode && isReactRenderer(config.renderer) ? {
3552
+ rendererImports: [
3553
+ "react",
3554
+ "react-dom/client",
3555
+ "@farm.js/core/internal/islands-runtime"
3556
+ ],
3557
+ rendererImporter: clientEntryPath
3558
+ } : {}
3493
3559
  }),
3494
3560
  ...adapterOwnsDocsRuntime && platform === "web" ? [
3495
3561
  createFarmDocsModulePreloadPlugin({
3496
3562
  root,
3497
- buildDir: path16.dirname(outputDir),
3563
+ buildDir: path17.dirname(outputDir),
3498
3564
  importer: clientEntryPath,
3499
3565
  entryName: "farm-client",
3500
3566
  modules: [
@@ -3507,6 +3573,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3507
3573
  ...rendererVitePlugins,
3508
3574
  ...config.vite.plugins || [],
3509
3575
  farmServerOnlyEntriesPlugin({ platform, distDir: config.distDir || ".farm" }),
3576
+ farmNavigationPlugin(config.renderer),
3510
3577
  farmDocsClientConfigPlugin(
3511
3578
  adapterOwnsDocsRuntime ? getFarmDocsAdapterConfigModule(config.docs) : void 0
3512
3579
  ),
@@ -3603,8 +3670,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3603
3670
  mergeFarmProductionViteConfig(clientViteConfig, config.vite, { clientOutput: true })
3604
3671
  );
3605
3672
  if (platform === "mobile") {
3606
- await fs5.rm(path16.join(outputDir, `${entryName}.css`), { force: true });
3607
- if (!await hasFarmMobileClientEntry(path16.dirname(outputDir), outputDir)) {
3673
+ await fs5.rm(path17.join(outputDir, `${entryName}.css`), { force: true });
3674
+ if (!await hasFarmMobileClientEntry(path17.dirname(outputDir), outputDir)) {
3608
3675
  throw new IncompleteClientBuildOutputError(
3609
3676
  `${FARM_MOBILE_CLIENT_ENTRY_NAME}.js is missing or empty`
3610
3677
  );
@@ -3662,11 +3729,12 @@ function createHistoryState(path, pageState, currentState) {
3662
3729
 
3663
3730
  async function fetchFarmNavigationDocument(url, headers, recover = true, signal) {
3664
3731
  const deploymentId = window.__FARM_DEPLOYMENT_ID__;
3665
- const response = await fetch(url, {
3666
- headers: createFarmDeploymentRequestHeaders(deploymentId, headers),
3732
+ const requestHeaders = createFarmDeploymentRequestHeaders(deploymentId, headers);
3733
+ const response = await (${streamNavigations ? "(recover && takeFarmEarlyNavigation(url, requestHeaders, signal)) || " : ""}fetch(url, {
3734
+ headers: requestHeaders,
3667
3735
  signal,
3668
3736
  redirect: "manual",
3669
- });
3737
+ }));
3670
3738
  // Let a document navigation follow redirects, including cross-origin chains
3671
3739
  // and fragment inheritance. Never cache/swap their HTML under the source URL.
3672
3740
  if (response.type === "opaqueredirect" || response.redirected) {
@@ -3693,7 +3761,9 @@ async function fetchFarmNavigationDocument(url, headers, recover = true, signal)
3693
3761
  return response;
3694
3762
  }
3695
3763
 
3696
- ${streamNavigations ? FARM_NAVIGATION_STREAM_READER_SOURCE : ""}
3764
+ ${streamNavigations ? `${FARM_NAVIGATION_STREAM_READER_SOURCE}
3765
+
3766
+ ${FARM_EARLY_NAVIGATION_SOURCE}` : ""}
3697
3767
 
3698
3768
  function clearFarmPrefetchCacheOnDeploymentMismatch(router, error) {
3699
3769
  if (error?.name === "FarmDeploymentMismatchError") {
@@ -4422,9 +4492,9 @@ ${streamNavigations ? ` // A streamed navigation swaps in the page's shell; its
4422
4492
  const response = await fetchFarmNavigationDocument(url, {
4423
4493
  "Accept": "text/html",
4424
4494
  ...(interceptFrom ? { "X-Farm-Intercept-From": interceptFrom } : {}),
4425
- // Islands mode: the server leaves out island values this browser holds, and the
4426
- // layouts it shows.
4427
- ...getFarmIslandValueHeaders(),
4495
+ // Islands mode: the server leaves out island values this browser holds (the swap keeps
4496
+ // the ones only the page holds, keepFarmIslandValues), and the layouts it shows.
4497
+ ...getFarmIslandValueHeaders(${streamNavigations ? 'document.getElementById("root") || document.body' : ""}),
4428
4498
  ...partialHeaders,
4429
4499
  ...(streamShell ? { "F-Stream": "flush" } : {}),
4430
4500
  }, recover, signal);
@@ -4854,17 +4924,26 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
4854
4924
  platform
4855
4925
  );
4856
4926
  const appSetupPath = resolveFarmRendererAppSetup(root, renderer);
4857
- const rendererClientImports = isReactRenderer(renderer) ? `import React from "react";
4927
+ const lazyRenderer = islandValues && platform !== "mobile" && isReactRenderer(renderer) && clientRouteSlots.length === 0;
4928
+ const rendererClientImports = lazyRenderer ? `import { holdFarmIslandInteractions, restorePagePosition, watchFarmIslandTriggers } from "@farm.js/core/internal/client-runtime";` : isReactRenderer(renderer) ? `import React from "react";
4858
4929
  import { createRoot, hydrateRoot } from "react-dom/client";
4859
- import { restorePagePosition } from "@farm.js/core/internal/client-runtime";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
4930
+ import { restorePagePosition } from "@farm.js/core/internal/client-runtime";` : (
4931
+ // Named exports only, as the server entry and the development client read them. A copy
4932
+ // of the namespace, so feature checks of optional exports don't make Rolldown warn.
4933
+ appSetupPath ? `import * as __farmRendererClient from ${JSON.stringify(renderer.client)};
4934
+ import { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
4860
4935
  import __farmAppSetup from ${JSON.stringify(toPosixPath(appSetupPath))};
4861
- __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
4936
+ const React = { ...__farmRendererClient };
4937
+ __farmConfigureApp(__farmAppSetup);` : `import * as __farmRendererClient from ${JSON.stringify(renderer.client)};
4938
+ import { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};
4939
+ const React = { ...__farmRendererClient };`
4940
+ );
4862
4941
  const providerClientCode = generateFarmIntegrationProviderClientCode(
4863
4942
  integrationProviders,
4864
4943
  root,
4865
4944
  renderer.componentExtensions ?? []
4866
4945
  );
4867
- const globalsCssPath = path16.join(root, srcDir, "app", "globals.css");
4946
+ const globalsCssPath = path17.join(root, srcDir, "app", "globals.css");
4868
4947
  const serverStyleModules = [];
4869
4948
  const cssImport = [
4870
4949
  ...existsSync3(globalsCssPath) ? [globalsCssPath] : [],
@@ -5282,7 +5361,45 @@ installFarmLinkPrefetch();
5282
5361
  });
5283
5362
  const isolatedHydrationEnabled = isolatedBoundaryModules.size > 0;
5284
5363
  const serverTreeEnabled = isolatedHydrationEnabled && clientPages.some((page) => page.serverTree);
5285
- const isolatedHydrationImport = isolatedHydrationEnabled ? `${islandValues ? `import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph, createFarmServerTreeElement${hasServerTreeLayouts ? ", createFarmServerTreeLayout" : ""} } from "@farm.js/core/internal/islands-runtime";` : 'import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";'}${serverTreeEnabled && !islandValues ? '\nimport { createFarmServerTreeElement } from "@farm.js/core/internal/server-tree";' : ""}` : "";
5364
+ const islandsRuntimeExports = [
5365
+ "createFarmIsolatedHydrationRuntime",
5366
+ "createFarmServerPageBoundary",
5367
+ "wrapFarmIsolatedClientGraph",
5368
+ ...serverTreeEnabled ? ["createFarmServerTreeElement"] : [],
5369
+ ...hasServerTreeLayouts ? ["createFarmServerTreeLayout"] : []
5370
+ ].join(", ");
5371
+ const lazyRendererRuntime = lazyRenderer ? `// React, React DOM${isolatedHydrationEnabled ? " and islx" : ""} load with the first render or hydration (RFC 0010).
5372
+ let React;
5373
+ let createRoot;
5374
+ let hydrateRoot;
5375
+ let farmRendererLoading = null;
5376
+ let farmRendererLoaded = false;${isolatedHydrationEnabled ? `
5377
+ // The boot stops holding interactions once this entry runs. Until islx loads, islands that have not
5378
+ // hydrated hold them here, for their schedulers to replay.
5379
+ const releaseFarmIslandInteractions = holdFarmIslandInteractions("f-island");` : ""}
5380
+ function loadFarmRenderer() {
5381
+ return farmRendererLoading || (farmRendererLoading = Promise.all([
5382
+ import("react"),
5383
+ import("react-dom/client"),${isolatedHydrationEnabled ? `
5384
+ // Named here, so the build keeps only these of islx's exports.
5385
+ import("@farm.js/core/internal/islands-runtime").then(function({ ${islandsRuntimeExports} }) {
5386
+ return { ${islandsRuntimeExports} };
5387
+ }),` : ""}
5388
+ ]).then(function(modules) {
5389
+ React = modules[0].default;
5390
+ createRoot = modules[1].createRoot;
5391
+ hydrateRoot = modules[1].hydrateRoot;${isolatedHydrationEnabled ? "\n startFarmIslandsRuntime(modules[2]);\n releaseFarmIslandInteractions();\n runFarmIslandsWaiting();" : ""}
5392
+ farmRendererLoaded = true;
5393
+ }, function(error) {${isolatedHydrationEnabled ? `
5394
+ // Without islx a held click would never replay: the page acts natively again.
5395
+ releaseFarmIslandInteractions();` : ""}
5396
+ // A chunk that failed to load can load on a later call.
5397
+ farmRendererLoading = null;
5398
+ throw error;
5399
+ }));
5400
+ }
5401
+ ` : "";
5402
+ const isolatedHydrationImport = lazyRenderer ? "" : isolatedHydrationEnabled ? `${islandValues ? `import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph, createFarmServerTreeElement${hasServerTreeLayouts ? ", createFarmServerTreeLayout" : ""} } from "@farm.js/core/internal/islands-runtime";` : 'import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";'}${serverTreeEnabled && !islandValues ? '\nimport { createFarmServerTreeElement } from "@farm.js/core/internal/server-tree";' : ""}` : "";
5286
5403
  const isolatedHydrationRuntime = isolatedHydrationEnabled ? `const farmIsolatedBoundaryLoaders = {
5287
5404
  ${Array.from(isolatedBoundaryModules.entries()).map(
5288
5405
  ([reference, modulePath]) => ` ${JSON.stringify(reference)}: () => import(${JSON.stringify(modulePath)}),`
@@ -5293,7 +5410,72 @@ async function loadFarmIsolatedBoundary(reference) {
5293
5410
  if (!loader) throw new Error("isolated client boundary loader was not found: " + reference);
5294
5411
  return loader();
5295
5412
  }
5296
- const farmIsolatedHydrationRuntime = createFarmIsolatedHydrationRuntime({
5413
+ ${lazyRenderer ? `let farmIslandsRuntime = null;
5414
+ let FarmServerPage;
5415
+ let wrapFarmIsolatedClientGraph;${serverTreeEnabled ? "\nlet createFarmServerTreeElement;" : ""}${hasServerTreeLayouts ? "\nlet createFarmServerTreeLayout;" : ""}
5416
+ function startFarmIslandsRuntime(islands) {
5417
+ wrapFarmIsolatedClientGraph = islands.wrapFarmIsolatedClientGraph;${serverTreeEnabled ? "\n createFarmServerTreeElement = islands.createFarmServerTreeElement;" : ""}${hasServerTreeLayouts ? "\n createFarmServerTreeLayout = islands.createFarmServerTreeLayout;" : ""}
5418
+ farmIslandsRuntime = islands.createFarmIsolatedHydrationRuntime({
5419
+ ReactRuntime: React,
5420
+ hydrateRoot,
5421
+ load: loadFarmIsolatedBoundary,
5422
+ schedule: scheduleFarmIslandHydration,
5423
+ wrap: wrapWithIntegrationProviders,
5424
+ });
5425
+ // A hydrating layout keeps a non-hydrating page as server HTML; this wrapper runs its islands.
5426
+ FarmServerPage = islands.createFarmServerPageBoundary(React, farmIslandsRuntime);
5427
+ }
5428
+ // islx loads with the first island that is due, as the boot decides on a first load: at once for
5429
+ // one that hydrates at load, else on its trigger. A page or navigation of islands that wait loads
5430
+ // none of it. Until it loads, calls wait here in the order they were made and run with it.
5431
+ const farmIslandsWaiting = [];
5432
+ function runFarmIslandsWaiting() {
5433
+ for (const entry of farmIslandsWaiting.splice(0)) {
5434
+ if (entry.stop) entry.stop();
5435
+ entry.run(farmIslandsRuntime);
5436
+ }
5437
+ }
5438
+ // Behind a load under way, calls wait for it; one that fails reports itself to whoever awaited it.
5439
+ function whenFarmIslandsRuntime(scope, call) {
5440
+ if (farmIslandsRuntime) call(farmIslandsRuntime);
5441
+ else if (farmRendererLoading) farmRendererLoading.then(function() { call(farmIslandsRuntime); }, function() {});
5442
+ else farmIslandsWaiting.push({ scope: scope, run: call });
5443
+ }
5444
+ const farmIsolatedHydrationRuntime = {
5445
+ hydrate: function(scope, signal) {
5446
+ if (farmIslandsRuntime) return farmIslandsRuntime.hydrate(scope, signal);
5447
+ const stop = farmRendererLoading
5448
+ ? null
5449
+ : watchFarmIslandTriggers(scope, "f-island", function() { void loadFarmRenderer(); });
5450
+ if (!stop) return loadFarmRenderer().then(function() { return farmIslandsRuntime.hydrate(scope, signal); });
5451
+ farmIslandsWaiting.push({
5452
+ scope: scope,
5453
+ stop: stop,
5454
+ run: function(runtime) {
5455
+ if (!signal || !signal.aborted) void runtime.hydrate(scope, signal);
5456
+ },
5457
+ });
5458
+ return Promise.resolve();
5459
+ },
5460
+ dispose: function(scope) {
5461
+ if (farmIslandsRuntime) return farmIslandsRuntime.dispose(scope);
5462
+ // Nothing has hydrated yet: what removed DOM waits for goes with it.
5463
+ for (let index = farmIslandsWaiting.length - 1; index >= 0; index--) {
5464
+ const entry = farmIslandsWaiting[index];
5465
+ if (!scope.contains(entry.scope)) continue;
5466
+ farmIslandsWaiting.splice(index, 1);
5467
+ if (entry.stop) entry.stop();
5468
+ }
5469
+ if (farmRendererLoading) farmRendererLoading.then(function() { farmIslandsRuntime.dispose(scope); }, function() {});
5470
+ },
5471
+ // Only a hydrated island has state to carry over.
5472
+ carryOver: function(from, to) {
5473
+ if (farmIslandsRuntime) farmIslandsRuntime.carryOver(from, to);
5474
+ },
5475
+ endStream: function(root) {
5476
+ whenFarmIslandsRuntime(root, function(runtime) { runtime.endStream(root); });
5477
+ },
5478
+ };` : `const farmIsolatedHydrationRuntime = createFarmIsolatedHydrationRuntime({
5297
5479
  ReactRuntime: React,
5298
5480
  hydrateRoot,
5299
5481
  load: loadFarmIsolatedBoundary,
@@ -5302,7 +5484,7 @@ const farmIsolatedHydrationRuntime = createFarmIsolatedHydrationRuntime({
5302
5484
  });
5303
5485
 
5304
5486
  // A hydrating layout keeps a non-hydrating page as server HTML; this wrapper runs its islands.
5305
- const FarmServerPage = createFarmServerPageBoundary(React, farmIsolatedHydrationRuntime);
5487
+ const FarmServerPage = createFarmServerPageBoundary(React, farmIsolatedHydrationRuntime);`}
5306
5488
 
5307
5489
  function disposeFarmIsolatedClientBoundaries(scope) {
5308
5490
  farmIsolatedHydrationRuntime.dispose(scope);
@@ -5349,7 +5531,7 @@ ${layoutImports}
5349
5531
  ${rendererClientImports}
5350
5532
  ${isolatedHydrationImport}
5351
5533
  ${providerClientCode.imports}
5352
- import { createClientCancellation, createClientPluginManager, createPluginlessClientRuntime, getFarmIslandValueHeaders, getHashTargetElement, installChunkErrorRecovery, installFarmLinkPrefetch, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, readFarmLinkNavigateOptions, rememberFarmLinkLocale, reconcileFarmDocumentHead, runFarmNavigationDelegates, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
5534
+ import { createClientCancellation, createClientPluginManager, createPluginlessClientRuntime, getFarmIslandValueHeaders, getHashTargetElement, keepFarmIslandValues, installChunkErrorRecovery, installFarmLinkPrefetch, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, readFarmLinkNavigateOptions, rememberFarmLinkLocale, reconcileFarmDocumentHead, runFarmNavigationDelegates, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
5353
5535
  import { createFarmDeploymentMismatchError, createFarmDeploymentRequestHeaders, isFarmDeploymentMismatchResponse } from "@farm.js/core/deployment";
5354
5536
  import { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";
5355
5537
  ${clientPluginEntry.imports}
@@ -5359,7 +5541,7 @@ ${docsNavigationRuntime}
5359
5541
  ${docsAdapterRuntime}
5360
5542
 
5361
5543
  ${imports.join("\n")}
5362
- ${generateFarmDocsSearchClientRuntime(docsSearchEnabled, docsSearchModuleId)}
5544
+ ${generateFarmDocsSearchClientRuntime(docsSearchEnabled, docsSearchModuleId, void 0, lazyRenderer ? "loadFarmRenderer" : void 0)}
5363
5545
 
5364
5546
  ${providerClientCode.runtime}
5365
5547
 
@@ -5379,7 +5561,7 @@ ${generateFarmClientRouteTableRuntime({
5379
5561
  })}
5380
5562
  ${generateClientPageDirectorySource()}
5381
5563
 
5382
- ${isolatedHydrationRuntime}
5564
+ ${lazyRendererRuntime}${isolatedHydrationRuntime}
5383
5565
  ${routeClientGraphRuntime}
5384
5566
 
5385
5567
  const clientRouteSlots = [
@@ -5503,10 +5685,15 @@ function matchRoute(pathname) {
5503
5685
  }
5504
5686
 
5505
5687
  async function loadRouteComponent(route) {
5506
- if (!route.load) return null;
5688
+ if (!route.load) return null;${lazyRenderer ? `
5689
+ // A page component renders with React DOM, which loads beside it (RFC 0010).
5690
+ const renderer = loadFarmRenderer();
5691
+ if (!route.Component) route.Component = await route.load();
5692
+ await renderer;
5693
+ return route.Component;` : `
5507
5694
  if (route.Component) return route.Component;
5508
5695
  route.Component = await route.load();
5509
- return route.Component;
5696
+ return route.Component;`}
5510
5697
  }
5511
5698
 
5512
5699
  // The props the server rendered this document with, as the page receives them:
@@ -5522,7 +5709,9 @@ function reviveServerPageProps(serverProps) {
5522
5709
  async function createMatchedHydrationRoute(matched, pathname, searchParams, navigationPage, serverProps, layoutSource, hydrationContainer) {
5523
5710
  const hydrateLayouts = hasHydratableLayout(pathname);
5524
5711
  const params = matched.params;
5525
- let pageElement = null;
5712
+ let pageElement = null;${lazyRenderer ? `
5713
+ // Only a route that renders a page or its layouts needs React DOM; one of islands hydrates them.
5714
+ if (hydrateLayouts || matched.route.pageShouldHydrate) await loadFarmRenderer();` : ""}
5526
5715
  // Layouts rendered as server trees rebuild from the HTML that carries them.
5527
5716
  if (hydrateLayouts && !(await prepareFarmTreeLayouts(pathname, params, layoutSource))) return null;
5528
5717
 
@@ -5892,7 +6081,9 @@ async function hydrate() {
5892
6081
  );
5893
6082
  window.__FARM_PROPS__ = initialPayload.page;
5894
6083
  window.__FARM_ROUTE_SLOTS__ = initialPayload.slots;
5895
-
6084
+ ${lazyRenderer ? ` // React DOM and islx load with what first renders or hydrates, not here (RFC 0010): a root
6085
+ // that waits for its trigger, or a navigation that swaps its page in, does not wait for them.
6086
+ ` : ""}
5896
6087
  if (await hydrateFarmDocsAdapterRuntime()) {
5897
6088
  return;
5898
6089
  }
@@ -5929,101 +6120,82 @@ async function hydrate() {
5929
6120
  return;
5930
6121
  }
5931
6122
 
6123
+ const pageHydration = scheduleFarmRouteHydration(matched, pathname, container, window.__FARM_PROPS__);
6124
+ ${isolatedHydrationEnabled ? `// Not cancelled with the page: a navigation disposes the islands it removes, and one in a
6125
+ // layout it keeps still waits for its trigger, as on a page of islands only.
6126
+ const isolatedHydration =
6127
+ !hasHydratableLayout(pathname) &&
6128
+ document.querySelector('f-island[src]')
6129
+ ? hydrateFarmIsolatedClientBoundaries(document)
6130
+ : Promise.resolve();
6131
+ await Promise.all([pageHydration, isolatedHydration]);` : "await pageHydration;"}
6132
+ }
6133
+
6134
+ // Hydrates the route's page or layout root in \`container\` when its strategy is due: at once, or
6135
+ // on its idle, visible or interaction trigger (RFC 0003, section 11). The first load schedules it,
6136
+ // and so does a navigation that swaps a page into a root that never hydrated (RFC 0011): nothing
6137
+ // in that root ran, so it waits for the next page's trigger as a first load of that page would.
6138
+ function scheduleFarmRouteHydration(matched, pathname, container, serverProps) {
5932
6139
  container.dataset.farmIsland = "page";
5933
6140
  container.dataset.farmIslandStrategy = matched.route.islandStrategy || "load";
5934
6141
 
5935
6142
  const hydrationController = new AbortController();
5936
6143
  pendingPageHydrationController = hydrationController;
5937
- try {
5938
- const pageHydration = scheduleFarmIslandHydration({
5939
- container,
5940
- strategy: matched.route.islandStrategy,
5941
- signal: hydrationController.signal,
5942
- hydrate: async function() {
5943
- if (
5944
- hydrationController.signal.aborted ||
5945
- !container.isConnected ||
5946
- window.location.pathname !== pathname
5947
- ) {
5948
- return;
5949
- }
5950
- const searchParams = searchParamsToObject(new URLSearchParams(window.location.search));
5951
- const shouldHydrate = !isHydrated && Boolean(container.innerHTML.trim());
5952
- const routeState = await createMatchedHydrationRoute(
5953
- matched,
5954
- pathname,
5955
- searchParams,
5956
- undefined,
5957
- window.__FARM_PROPS__,
5958
- undefined,
5959
- shouldHydrate ? container : undefined,
5960
- );
5961
- if (!routeState) return;
5962
- const hydrationSession = await farmClientRuntime.beginHydration({
5963
- container,
5964
- mode: shouldHydrate ? "hydrate" : "render",
5965
- });
6144
+ return scheduleFarmIslandHydration({
6145
+ container,
6146
+ strategy: matched.route.islandStrategy,
6147
+ signal: hydrationController.signal,
6148
+ hydrate: async function() {
6149
+ if (
6150
+ hydrationController.signal.aborted ||
6151
+ !container.isConnected ||
6152
+ window.location.pathname !== pathname
6153
+ ) {
6154
+ return;
6155
+ }
6156
+ const searchParams = searchParamsToObject(new URLSearchParams(window.location.search));
6157
+ const shouldHydrate = !isHydrated && Boolean(container.innerHTML.trim());
6158
+ const routeState = await createMatchedHydrationRoute(
6159
+ matched,
6160
+ pathname,
6161
+ searchParams,
6162
+ undefined,
6163
+ serverProps,
6164
+ undefined,
6165
+ shouldHydrate ? container : undefined,
6166
+ );
6167
+ if (!routeState) return;
6168
+ const hydrationSession = await farmClientRuntime.beginHydration({
6169
+ container,
6170
+ mode: shouldHydrate ? "hydrate" : "render",
6171
+ });
5966
6172
 
5967
- try {
5968
- // A navigation replaced this route before it hydrated. Like a superseded
5969
- // navigation, that is not a failure, so error hooks never see it.
5970
- if (hydrationController.signal.aborted || !container.isConnected) return;
5971
- if (shouldHydrate) {
5972
- reactRoot = hydrateFarmRoute(container, routeState);
6173
+ try {
6174
+ // A navigation replaced this route before it hydrated. Like a superseded
6175
+ // navigation, that is not a failure, so error hooks never see it.
6176
+ if (hydrationController.signal.aborted || !container.isConnected) return;
6177
+ if (shouldHydrate) {
6178
+ reactRoot = hydrateFarmRoute(container, routeState);
6179
+ reactRootContainer = container;
6180
+ isHydrated = true;
6181
+ } else {
6182
+ if (!reactRoot) {
6183
+ reactRoot = createRoot(container);
5973
6184
  reactRootContainer = container;
5974
- isHydrated = true;
5975
- } else {
5976
- if (!reactRoot) {
5977
- reactRoot = createRoot(container);
5978
- reactRootContainer = container;
5979
- }
5980
- renderFarmRoute(reactRoot, routeState);
5981
6185
  }
5982
- await farmClientRuntime.completeHydration(hydrationSession);
5983
- } catch (error) {
5984
- await farmClientRuntime.failHydration(hydrationSession, error);
5985
- console.error("[Farm.js] Hydration error:", error);
6186
+ renderFarmRoute(reactRoot, routeState);
5986
6187
  }
5987
- },
5988
- });
5989
- ${islandValues ? `// A layout root that waits for a click renders again on a navigation, and a link under the
5990
- // pointer is a navigation on its way: hydrate the root now, as a focus would, so the click
5991
- // updates it instead of rendering it from the start.
5992
- if (hasHydratableLayout(pathname) && (matched.route.islandStrategy || "load") !== "load") {
5993
- const hydrateForLink = function(target) {
5994
- const anchor = target instanceof Element ? target.closest("a[href]") : null;
5995
- const href = anchor && anchor.getAttribute("href");
5996
- if (!href || href.startsWith("#") || hasAbsoluteNavigationHref(href)) return false;
5997
- if (!container.contains(anchor)) return false;
5998
- document.dispatchEvent(
5999
- new CustomEvent("farm:island-interaction", { detail: { target: anchor, kind: null } }),
6000
- );
6001
- return true;
6002
- };
6003
- const onLinkIntent = function(event) {
6004
- if (hydrateForLink(event.target)) document.removeEventListener("mouseover", onLinkIntent, true);
6005
- };
6006
- // The hover that loaded this entry fired before it ran.
6007
- if (!hydrateForLink(container.querySelector("a[href]:hover"))) {
6008
- document.addEventListener("mouseover", onLinkIntent, true);
6009
- void pageHydration.finally(function() {
6010
- document.removeEventListener("mouseover", onLinkIntent, true);
6011
- });
6188
+ await farmClientRuntime.completeHydration(hydrationSession);
6189
+ } catch (error) {
6190
+ await farmClientRuntime.failHydration(hydrationSession, error);
6191
+ console.error("[Farm.js] Hydration error:", error);
6012
6192
  }
6013
- }` : ""}
6014
- ${isolatedHydrationEnabled ? `// Not cancelled with the page: a navigation disposes the islands it removes, and one in a
6015
- // layout it keeps still waits for its trigger, as on a page of islands only.
6016
- const isolatedHydration =
6017
- !hasHydratableLayout(pathname) &&
6018
- document.querySelector('f-island[src]')
6019
- ? hydrateFarmIsolatedClientBoundaries(document)
6020
- : Promise.resolve();
6021
- await Promise.all([pageHydration, isolatedHydration]);` : "await pageHydration;"}
6022
- } finally {
6193
+ },
6194
+ }).finally(function() {
6023
6195
  if (pendingPageHydrationController === hydrationController) {
6024
6196
  pendingPageHydrationController = null;
6025
6197
  }
6026
- }
6198
+ });
6027
6199
  }
6028
6200
 
6029
6201
  /*farm-router-start*/
@@ -6232,11 +6404,9 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
6232
6404
  partialNavigationHeaders: function() {
6233
6405
  const root = document.getElementById("root") || document.body;
6234
6406
  const layouts = getLayoutPatterns(root);
6235
- // The root React owns, or one whose layouts hydrate together but have not yet: the
6236
- // navigation creates it (swapContent).
6237
- const rendersTree = reactRoot
6238
- ? reactRootContainer === root
6239
- : root.id === "root" && hasHydratableLayout(window.location.pathname);
6407
+ // Only a root React owns rebuilds the next page from its tree. One that has not hydrated
6408
+ // swaps the next page's HTML in and keeps waiting (swapContent), without React DOM.
6409
+ const rendersTree = Boolean(reactRoot) && reactRootContainer === root;
6240
6410
  return {
6241
6411
  ...(layouts.length ? { "F-Layouts": JSON.stringify(layouts) } : {}),
6242
6412
  ...(rendersTree ? { "F-Render": "tree" } : {}),
@@ -6575,30 +6745,6 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
6575
6745
  const hydrateLayouts = hasHydratableLayout(newPathname);
6576
6746
  const nextPage = newRoot.querySelector("#__farm_page__");
6577
6747
 
6578
- ${islandValues ? `// A layout that hydrates as one root but has not yet (its client components wait for a
6579
- // click): its first navigation renders the page's payload in a new root, as later ones do.
6580
- if (
6581
- matched && hydrateLayouts && !reactRoot && currentRoot.id === "root" &&
6582
- nextPage?.querySelector('script[type="f/tree"][partial]')
6583
- ) {
6584
- const routeState = await createMatchedHydrationRoute(
6585
- matched,
6586
- newPathname,
6587
- searchParamsToObject(targetUrl.searchParams),
6588
- nextPage,
6589
- nextPageProps,
6590
- newRoot,
6591
- );
6592
- if (!isNavigationCurrent()) return false;
6593
- if (!routeState) return "segment-mismatch";
6594
- cancelPendingPageHydration();
6595
- resetRouteSlotRoots();
6596
- setFarmReactRoot(createRoot(currentRoot), currentRoot);
6597
- renderFarmRoute(reactRoot, routeState);
6598
- window.__FARM_ROUTE_SLOTS__ = nextRouteSlots;
6599
- setFarmHydrated();
6600
- return true;
6601
- }` : ""}
6602
6748
  // If React already owns the shared layout, update that root. React keeps
6603
6749
  // matching layout component instances and their state mounted.
6604
6750
  if (matched && hydrateLayouts && reactRoot && reactRootContainer === currentRoot) {
@@ -6622,6 +6768,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
6622
6768
 
6623
6769
  ${islandValues ? `// A payload-only page renders only in a React root that rebuilds it.
6624
6770
  if (nextPage?.querySelector('script[type="f/tree"][partial]')) return "segment-mismatch";` : ""}
6771
+ ${islandValues ? "const keepValues = keepFarmIslandValues(currentRoot);" : ""}
6625
6772
  const rootWasReactOwned = reactRootContainer === currentRoot;
6626
6773
  resetReactRoot();
6627
6774
  resetRouteSlotRoots();
@@ -6638,29 +6785,57 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
6638
6785
  activateNavigationScripts(currentRoot);
6639
6786
  isolatedHydrationScope = currentRoot;
6640
6787
  }
6788
+ ${islandValues ? "keepValues();" : ""}
6641
6789
  window.__FARM_ROUTE_SLOTS__ = nextRouteSlots;
6642
6790
  hydrateInitialRouteSlots();
6643
6791
 
6644
6792
  // Check if the new HTML contains an interactive route boundary.
6645
6793
  if (matched) {
6646
- const searchParams = searchParamsToObject(targetUrl.searchParams);
6647
6794
  const pageContainer =
6648
6795
  hydrateLayouts ? currentRoot : document.getElementById("__farm_page__") || currentRoot;
6649
- const routeState = await createMatchedHydrationRoute(
6650
- matched,
6651
- newPathname,
6652
- searchParams,
6653
- undefined,
6654
- nextPageProps,
6655
- undefined,
6656
- pageContainer,
6657
- );
6658
- if (!isNavigationCurrent()) return false;
6659
- if (routeState) {
6660
- setFarmReactRoot(hydrateFarmRoute(pageContainer, routeState), pageContainer);
6661
- setFarmHydrated();
6796
+ if (
6797
+ (hydrateLayouts || matched.route.pageShouldHydrate) &&
6798
+ (matched.route.islandStrategy || "load") !== "load"
6799
+ ) {
6800
+ // A root that waits for its trigger waits after a navigation too, as on a first load:
6801
+ // the page is server HTML and its tree until then, and React DOM loads when it hydrates.
6802
+ scheduleFarmRouteHydration(matched, newPathname, pageContainer, nextPageProps).catch(
6803
+ function(error) {
6804
+ console.error("[Farm.js] Hydration error:", error);
6805
+ },
6806
+ );
6807
+ } else {
6808
+ const searchParams = searchParamsToObject(targetUrl.searchParams);
6809
+ const routeState = await createMatchedHydrationRoute(
6810
+ matched,
6811
+ newPathname,
6812
+ searchParams,
6813
+ undefined,
6814
+ nextPageProps,
6815
+ undefined,
6816
+ pageContainer,
6817
+ );
6818
+ if (!isNavigationCurrent()) return false;
6819
+ if (routeState) {
6820
+ setFarmReactRoot(hydrateFarmRoute(pageContainer, routeState), pageContainer);
6821
+ setFarmHydrated();
6822
+ }
6662
6823
  }
6663
- ${isolatedHydrationEnabled ? `if (matched.route.hasIsolatedClientBoundaries && !hydrateLayouts) {
6824
+ ${isolatedHydrationEnabled ? lazyRenderer ? `if (matched.route.hasIsolatedClientBoundaries && !hydrateLayouts) {
6825
+ if (farmRendererLoaded) {
6826
+ await hydrateFarmIsolatedClientBoundaries(
6827
+ isolatedHydrationScope,
6828
+ navigation.controller.signal,
6829
+ );
6830
+ if (!isNavigationCurrent()) return false;
6831
+ } else {
6832
+ // React DOM and islx are still on their way (RFC 0010): the page shows now, and its
6833
+ // islands hydrate once they arrive. A navigation that removes them first disposes them.
6834
+ hydrateFarmIsolatedClientBoundaries(isolatedHydrationScope).catch(function(error) {
6835
+ console.error("[Farm.js] Hydrating the page's islands failed:", error);
6836
+ });
6837
+ }
6838
+ }` : `if (matched.route.hasIsolatedClientBoundaries && !hydrateLayouts) {
6664
6839
  await hydrateFarmIsolatedClientBoundaries(
6665
6840
  isolatedHydrationScope,
6666
6841
  navigation.controller.signal,
@@ -6812,8 +6987,13 @@ void hydrate();
6812
6987
  }
6813
6988
  async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache, rendererBuildLifetime, sourceSnapshot) {
6814
6989
  const viteBuild = productionVite.build;
6815
- const { farmIslandContainersPlugin, farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
6816
- const { PluginManager: PluginManager2 } = await import("./plugin-TV6W7YNK.mjs");
6990
+ const {
6991
+ farmIslandContainersPlugin,
6992
+ farmNavigationPlugin,
6993
+ farmPlugin,
6994
+ farmServerOnlyEntriesPlugin
6995
+ } = await import("./vite.mjs");
6996
+ const { PluginManager: PluginManager2 } = await import("./plugin-33I3V42N.mjs");
6817
6997
  const fs5 = await import("fs/promises");
6818
6998
  const pluginManager = new PluginManager2({
6819
6999
  config,
@@ -6829,9 +7009,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
6829
7009
  buildLifetime: rendererBuildLifetime
6830
7010
  });
6831
7011
  if (!hasScopedPostcssConfig) {
6832
- postcssConfigDir = await fs5.mkdtemp(path16.join(os.tmpdir(), "farm-postcss-"));
7012
+ postcssConfigDir = await fs5.mkdtemp(path17.join(os.tmpdir(), "farm-postcss-"));
6833
7013
  await fs5.writeFile(
6834
- path16.join(postcssConfigDir, "postcss.config.cjs"),
7014
+ path17.join(postcssConfigDir, "postcss.config.cjs"),
6835
7015
  "module.exports = { plugins: [] };\n"
6836
7016
  );
6837
7017
  tailwindVitePlugin = await loadTailwindVitePlugin({
@@ -7175,6 +7355,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7175
7355
  ] : [],
7176
7356
  { ...createReactProductionModePlugin(), enforce: "pre" },
7177
7357
  farmServerOnlyEntriesPlugin({ distDir: config.distDir || ".farm" }),
7358
+ farmNavigationPlugin(config.renderer),
7178
7359
  farmIslandContainersPlugin(config),
7179
7360
  farmPlugin(
7180
7361
  {
@@ -7262,7 +7443,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7262
7443
  }
7263
7444
  function readFarmAppPackageIdentity(root) {
7264
7445
  try {
7265
- return JSON.parse(readFileSync2(path16.join(root, "package.json"), "utf8"));
7446
+ return JSON.parse(readFileSync2(path17.join(root, "package.json"), "utf8"));
7266
7447
  } catch {
7267
7448
  return {};
7268
7449
  }
@@ -7695,6 +7876,7 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
7695
7876
  );
7696
7877
  const searchPreserveRoutesSource = searchPreserveRoutes.length > 0 ? JSON.stringify(searchPreserveRoutes) : "";
7697
7878
  const farmIslandsMode = resolveFarmServerComponentsMode(config.experimental?.serverComponents) === "islands";
7879
+ const farmRendererActions = resolveFarmIslxActionsMode(config) === "renderer";
7698
7880
  const farmClientBoot = canBootFarmIslandsClient(config);
7699
7881
  const farmMobileClient = shouldBuildFarmMobileClient(config);
7700
7882
  const farmMobileShells = farmMobileClient && config.mobileShells ? config.mobileShells : null;
@@ -7728,7 +7910,15 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
7728
7910
  const hasReactSyncRender = isReactRenderer(config.renderer);
7729
7911
  const rendererServerImports = isReactRenderer(config.renderer) ? `import * as React from "react";
7730
7912
  import * as ReactDOMServer from "react-dom/server";
7731
- import { markPagePosition, markLayoutPosition } from "@farm.js/core/internal/production-runtime";${hasIsolatedClientGraphRuntime ? farmIslandsMode ? '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph, renderFarmServerTreePage, renderFarmServerTreeLayout, withFarmIslandsRender } from "@farm.js/core/internal/islands-runtime";' : '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";\nimport { renderFarmServerTreePage } from "@farm.js/core/internal/server-tree";' : ""}` : `import React, * as ReactDOMServer from ${JSON.stringify(config.renderer.server)};${generateFarmRendererAppSetupServerCode(config)}`;
7913
+ import { markPagePosition, markLayoutPosition } from "@farm.js/core/internal/production-runtime";${hasIsolatedClientGraphRuntime ? farmIslandsMode ? '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph, renderFarmServerTreePage, renderFarmServerTreeLayout, withFarmIslandsRender } from "@farm.js/core/internal/islands-runtime";' : '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";\nimport { renderFarmServerTreePage } from "@farm.js/core/internal/server-tree";' : ""}` : (
7914
+ // The renderer contract is the server module's named exports, which the development
7915
+ // server reads too; a renderer needs no default export. The entry feature-checks optional
7916
+ // exports (streaming, `capabilities`, `generateHydrationScript`) on a copy of the
7917
+ // namespace, because Rolldown warns about each such read off the namespace itself.
7918
+ `import * as __farmRendererServer from ${JSON.stringify(config.renderer.server)};
7919
+ const ReactDOMServer = { ...__farmRendererServer };
7920
+ const React = ReactDOMServer;${generateFarmRendererAppSetupServerCode(config)}`
7921
+ );
7732
7922
  const routeClientGraphServerRuntime = hasIsolatedClientGraphRuntime ? `function wrapFarmRouteClientGraph(element) {
7733
7923
  return wrapFarmIsolatedClientGraph(React, element);
7734
7924
  }
@@ -7896,7 +8086,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
7896
8086
  source: ${JSON.stringify(route.source ?? "")},
7897
8087
  filePath: ${JSON.stringify(toBakedMarkdownSourcePath(config.root, route.modulePath))},
7898
8088
  components: farmMdxComponents,
7899
- config: farmMdxConfig,
8089
+ config: farmMdxConfig,${isReactRenderer(config.renderer) ? "" : "\n renderer: React,"}
7900
8090
  }),
7901
8091
  markdownSource: {
7902
8092
  source: ${JSON.stringify(route.source ?? "")},
@@ -8031,12 +8221,13 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
8031
8221
  metadataImageImports.push(
8032
8222
  `import * as ${varName} from ${toVirtualEntryImportSpecifier(image.modulePath)};`
8033
8223
  );
8224
+ const component = !isReactRenderer(config.renderer) && isRendererCompiledComponent(image.modulePath, config.renderer?.componentExtensions ?? []);
8034
8225
  metadataImageRegistrations.push(`
8035
8226
  {
8036
8227
  pattern: ${JSON.stringify(image.pattern)},
8037
8228
  kind: ${JSON.stringify(image.kind)},
8038
8229
  fileName: ${JSON.stringify(image.fileName)},
8039
- sourceType: "module",
8230
+ sourceType: "module",${component ? "\n component: true," : ""}
8040
8231
  module: ${varName},
8041
8232
  }`);
8042
8233
  return;
@@ -8247,12 +8438,15 @@ import { installFarmIslandsServer } from "@farm.js/core/internal/islands-server"
8247
8438
  installFarmIslandsServer();
8248
8439
  const farmFormActionsConfig = ${JSON.stringify(resolveServerActionsConfig(config.serverActions))};
8249
8440
  installFarmIslandValues();
8250
- ${islandsActionKeyCode()}
8251
- ${FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME}` : `
8441
+ ${islandsActionKeyCode("@farm.js/core/internal/islx-server")}
8442
+ ${FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME}` : `${farmRendererActions ? `
8443
+ import { handleFarmFormActionRequest } from "@farm.js/core/internal/production-runtime";
8444
+ const farmFormActionsConfig = ${JSON.stringify(resolveServerActionsConfig(config.serverActions))};
8445
+ ${islandsActionKeyCode("@farm.js/core/internal/islx-actions-server")}` : ""}
8252
8446
  function farmFormState() { return undefined; }
8253
8447
  function farmFormStateScript() { return ""; }`}`;
8254
8448
  const productionSiteTelemetryImport = config.telemetry ? `import { createFarmProductionSiteReporter } from "@farm.js/core/internal/product-telemetry-runtime";` : "";
8255
- const metadataImageRuntimeImport = hasGeneratedMetadataImages ? `import { createFarmMetadataImageResponse } from "@farm.js/core/internal/metadata-image-runtime";` : "";
8449
+ const metadataImageRuntimeImport = hasGeneratedMetadataImages ? `import { createFarmMetadataImageResponse, resolveFarmMetadataImageValue } from "@farm.js/core/internal/metadata-image-runtime";` : "";
8256
8450
  const pluginRuntimeImport = hasPluginRuntime ? `import { PluginManager } from "@farm.js/core/plugin";` : "";
8257
8451
  const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
8258
8452
  const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
@@ -8275,7 +8469,7 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
8275
8469
  const markdownHandlerImport = config.md?.enabled ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
8276
8470
  const appMarkdownImport = hasMarkdownPages ? `import { FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS, createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
8277
8471
  const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
8278
- const mdxComponentsPath = typeof config.mdx?.components === "string" ? path16.isAbsolute(config.mdx.components) ? config.mdx.components : path16.join(config.root, config.mdx.components) : null;
8472
+ const mdxComponentsPath = typeof config.mdx?.components === "string" ? path17.isAbsolute(config.mdx.components) ? config.mdx.components : path17.join(config.root, config.mdx.components) : null;
8279
8473
  const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
8280
8474
  const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
8281
8475
  const layerConfigImports = layerConfigPaths.map(
@@ -8820,7 +9014,7 @@ const farmDocsAPIHandler = ${config.docs?.enabled ? hasPrecompiledDocs ? "farmDo
8820
9014
 
8821
9015
  // API routes bundled at build time
8822
9016
  const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
8823
- ]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path18, methods }) => ({ path: path18, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)}, dispatch: dispatchFarmPluginAPIRequest })` : ""};
9017
+ ]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path19, methods }) => ({ path: path19, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)}, dispatch: dispatchFarmPluginAPIRequest })` : ""};
8824
9018
  // A plugin calling an app endpoint (an MCP tool, say) goes through the whole
8825
9019
  // pipeline, so the endpoint's middleware and integration guards run for it.
8826
9020
  function dispatchFarmPluginAPIRequest(request) {
@@ -8963,7 +9157,10 @@ function serializeFarmInlineValue(value) {
8963
9157
  .replace(/\\u2029/g, "\\\\u2029");
8964
9158
  }
8965
9159
 
8966
- function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, pageProps, routePathname) {
9160
+ // \`statusDocument\`: the not-found or error page, which renders without the route's layout
9161
+ // boundaries and page segment. It names no route for its URL, so the client hydrates none over it
9162
+ // (development writes no hydration flags for it either); its links still navigate.
9163
+ function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, pageProps, routePathname, statusDocument) {
8967
9164
  const integrationManifest = ${hasRuntimeIntegrationConfig ? "getRegisteredIntegrationAPIManifest()" : "{}"};
8968
9165
  const serializedRouteSlots = serializeFarmInlineValue(selectedRouteSlots || []);
8969
9166
  const serializedPageProps = serializeFarmInlineValue(pageProps || {});
@@ -8974,11 +9171,13 @@ function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, page
8974
9171
  ';window.__FARM_DEPLOYMENT_ID__=' + serializeFarmInlineValue(farmDeploymentId) + ';'${searchPreserveRoutesSource ? ` +
8975
9172
  'window[Symbol.for("farm.searchPreserveRoutes")]=' + serializeFarmInlineValue(farmSearchPreserveRoutes) + ';'` : ""};
8976
9173
  // The client boots at the canonical path when the script below moves it there.
8977
- const bootRoutes = getFarmClientBootRoutes(
8978
- typeof canonicalPath === "string" && canonicalPath.startsWith("/")
8979
- ? getFarmRoutePathname(canonicalPath.split(/[?#]/)[0])
8980
- : routePathname
8981
- );
9174
+ const bootRoutes = statusDocument
9175
+ ? typeof routePathname === "string" ? { path: routePathname, routes: [] } : undefined
9176
+ : getFarmClientBootRoutes(
9177
+ typeof canonicalPath === "string" && canonicalPath.startsWith("/")
9178
+ ? getFarmRoutePathname(canonicalPath.split(/[?#]/)[0])
9179
+ : routePathname
9180
+ );
8982
9181
  if (bootRoutes) source += 'window.__FARM_CLIENT_ROUTES__=' + serializeFarmInlineValue(bootRoutes) + ';';
8983
9182
  if (typeof canonicalPath === "string" && canonicalPath.startsWith("/")) {
8984
9183
  const serializedPath = serializeFarmInlineValue(canonicalPath);
@@ -9034,9 +9233,9 @@ function farmDocumentBootsClient(markup, hydratesAtLoad, routeSlots) {
9034
9233
  // The boot entry runs the client entry from the URL on its script, with the files listed for what
9035
9234
  // started it. A root that waits (the element a hydrating layout or client page hydrates) is named
9036
9235
  // with its strategy, for the boot to watch.
9037
- function renderFarmClientBootScript(root, rootStrategy, markup, pageModule) {
9236
+ function renderFarmClientBootScript(root, rootStrategy, markup, pageModule, navigation) {
9038
9237
  return stampFarmCspNonce('<script type="module" src="${farmClientBoot ? FARM_CLIENT_BOOT_SRC_PLACEHOLDER : ""}" data-farm-runtime="/__farm_client_js_src__"' +
9039
- renderFarmClientBootPreloads(markup, pageModule, root, rootStrategy) +
9238
+ renderFarmClientBootPreloads(markup, pageModule, root, rootStrategy, navigation) +
9040
9239
  (root ? ' data-farm-root="' + root + '" data-farm-root-strategy="' + rootStrategy + '"' : '') +
9041
9240
  '></script>');
9042
9241
  }
@@ -9766,7 +9965,7 @@ function addFarmFallbackIcon(markup, hasFavicon) {
9766
9965
  return markup.replace(/<\\/head>/i, function() { return ' <link rel="icon" href="data:,">\\n</head>'; });
9767
9966
  }
9768
9967
 
9769
- function createFarmErrorDocument(html, title) {
9968
+ function createFarmErrorDocument(html, title, routePathname) {
9770
9969
  const escapedTitle = escapeFarmHtmlAttribute(title || "Application Error");
9771
9970
  const fullDocument = extractFarmFullDocument(html);
9772
9971
  const hasFullDocument = fullDocument !== null;
@@ -9781,7 +9980,7 @@ function createFarmErrorDocument(html, title) {
9781
9980
  renderFarmRendererHydrationScript() + '\\n' +
9782
9981
  '</head>\\n<body>\\n' +
9783
9982
  ' <div id="root">' + html + '</div>\\n' +
9784
- ' ' + renderFarmClientBootstrapScript() + '\\n' +
9983
+ ' ' + renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname, true) + '\\n' +
9785
9984
  ' ' + renderFarmClientEntryScript() + '\\n' +
9786
9985
  '</body>\\n</html>';
9787
9986
  }
@@ -9800,7 +9999,7 @@ function createFarmErrorDocument(html, title) {
9800
9999
  .replace(
9801
10000
  /<\\/body>/i,
9802
10001
  function() {
9803
- return ' ' + renderFarmClientBootstrapScript() + '\\n' +
10002
+ return ' ' + renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname, true) + '\\n' +
9804
10003
  ' ' + renderFarmClientEntryScript() + '\\n</body>';
9805
10004
  },
9806
10005
  );
@@ -9826,6 +10025,11 @@ ${generateFarmClientBootRoutesServerSource(`"${FARM_CLIENT_ROUTE_TABLE_PLACEHOLD
9826
10025
  const farmClientEntryPreloadTags = farmClientModulePreloads
9827
10026
  ? farmClientModulePreloads.entry.map(renderFarmClientModulePreload).join("")
9828
10027
  : "";
10028
+ // A document that runs the entry at once (no boot) hydrates with the renderer it imports lazily
10029
+ // (RFC 0010). A client navigation's response runs neither, so it leaves them out.
10030
+ const farmClientRendererPreloadTags = farmClientModulePreloads
10031
+ ? (farmClientModulePreloads.renderer || []).map(renderFarmClientModulePreload).join("")
10032
+ : "";
9829
10033
  // The client modules a document's markup loads: its islands' boundaries and the
9830
10034
  // client references of its server tree. An island with a deferred strategy loads its
9831
10035
  // module on its own trigger, so it is not preloaded.
@@ -9860,14 +10064,14 @@ function collectFarmClientDocumentModules(markup, pageModule, listed) {
9860
10064
  return indexes;
9861
10065
  }
9862
10066
 
9863
- // The modulepreload links for a document: the entry's static imports, then the
9864
- // modules its hydrating page and its markup load.
9865
- function renderFarmClientModulePreloads(markup, pageModule) {
10067
+ // The modulepreload links for a document: the entry's static imports and, unless it answers a
10068
+ // client navigation, the renderer, then the modules its hydrating page and its markup load.
10069
+ function renderFarmClientModulePreloads(markup, pageModule, navigation) {
9866
10070
  // A nonce policy blocks parser-inserted links without the nonce, and the
9867
10071
  // response filter manages nonces on script elements only, so CSP nonce mode
9868
10072
  // keeps the documents it had.
9869
10073
  if (!farmClientModulePreloads || (farmSecurityConfig.csp && farmSecurityConfig.csp.nonce)) return "";
9870
- return farmClientEntryPreloadTags +
10074
+ return farmClientEntryPreloadTags + (navigation ? "" : farmClientRendererPreloadTags) +
9871
10075
  collectFarmClientDocumentModules(markup, pageModule, new Set())
9872
10076
  .map(renderFarmClientModulePreload)
9873
10077
  .join("");
@@ -9875,11 +10079,12 @@ function renderFarmClientModulePreloads(markup, pageModule) {
9875
10079
 
9876
10080
  // What a boot document's runtime fetches as it starts, for the boot to request with it rather
9877
10081
  // than each a round trip after the file that imports it: the entry's static imports, the router
9878
- // and route table a link's intent loads, and the modules the root hydrates with. A root that
10082
+ // and route table a link's intent loads, the renderer the entry renders and hydrates with (RFC
10083
+ // 0010), and the modules the root hydrates with. A root that
9879
10084
  // waits for its time hydrates once the runtime runs, so its modules come with the entry's; one
9880
10085
  // that waits for a click hydrates on an interaction in it, and the boot fetches them then. The
9881
10086
  // boot adds the links itself with the script's nonce, so CSP nonce mode keeps them.
9882
- function renderFarmClientBootPreloads(markup, pageModule, root, rootStrategy) {
10087
+ function renderFarmClientBootPreloads(markup, pageModule, root, rootStrategy, navigation) {
9883
10088
  if (!farmClientModulePreloads) return "";
9884
10089
  const files = farmClientModulePreloads.files;
9885
10090
  const attribute = function(name, indexes) {
@@ -9895,6 +10100,7 @@ function renderFarmClientBootPreloads(markup, pageModule, root, rootStrategy) {
9895
10100
  const waitsForClick = rootStrategy === "interaction";
9896
10101
  return attribute("data-farm-preload", waitsForClick ? entry : entry.concat(rootModules)) +
9897
10102
  attribute("data-farm-preload-router", farmClientModulePreloads.router || []) +
10103
+ attribute("data-farm-preload-renderer", navigation ? [] : farmClientModulePreloads.renderer || []) +
9898
10104
  (waitsForClick ? attribute("data-farm-preload-root", rootModules) : "");
9899
10105
  }
9900
10106
 
@@ -10146,11 +10352,9 @@ async function handleMetadataImageRequest(request, routePathname) {
10146
10352
  searchParams: createFarmSearchParams(searchParams),
10147
10353
  path: match.pagePath,
10148
10354
  };
10149
- const value = typeof imageModule.default === "function"
10150
- ? await imageModule.default(props)
10151
- : imageModule.default;
10152
10355
 
10153
- ${hasGeneratedMetadataImages ? `return createFarmMetadataImageResponse(value, imageModule, {
10356
+ ${hasGeneratedMetadataImages ? `const value = await resolveFarmMetadataImageValue(imageModule, props${isReactRenderer(config.renderer) ? "" : ", {\n renderer: ReactDOMServer,\n component: image.component === true,\n }"});
10357
+ return createFarmMetadataImageResponse(value, imageModule, {
10154
10358
  method,
10155
10359
  ifNoneMatch: request.headers.get("if-none-match"),${isReactRenderer(config.renderer) ? "" : "\n renderer: ReactDOMServer,"}
10156
10360
  });` : 'throw new Error("Generated metadata image runtime is unavailable");'}
@@ -11619,7 +11823,7 @@ ${hasServerRuntimeIntegrations ? `
11619
11823
  if (farmDeploymentMismatch) return createFarmDeploymentMismatchResponse(farmDeploymentMismatch);
11620
11824
  farmCacheGuard.deploymentPage = true;
11621
11825
  }
11622
- ${farmIslandsMode ? `// Islands mode: a form or client component posting a server action to this page.
11826
+ ${farmIslandsMode || farmRendererActions ? `// A form or client component posting a server action to this page.
11623
11827
  if (matchedRoute && request.method === "POST") {
11624
11828
  const actionResponse = await _runWithMiddlewareData(middlewareData || {}, () =>
11625
11829
  _runWithMiddlewareContext(middlewareContext || {}, () =>
@@ -12049,11 +12253,11 @@ ${hasServerRuntimeIntegrations ? `
12049
12253
  // outer request handler exactly like sync render errors.
12050
12254
  if (typeof PageComponent === "function" && PageComponent.constructor.name === "AsyncFunction") {
12051
12255
  const result = await PageComponent(pageProps);
12052
- if (React.isValidElement(result)) {
12053
- pageElement = result;
12054
- } else {
12055
- pageElement = React.createElement("div", null, String(result));
12056
- }
12256
+ // Anything else (text, a number, null) renders as the renderer renders a child,
12257
+ // as in development.
12258
+ pageElement = React.isValidElement(result)
12259
+ ? result
12260
+ : React.createElement(React.Fragment, null, result);
12057
12261
  } else {
12058
12262
  // Sync component - create element directly
12059
12263
  pageElement = React.createElement(PageComponent, pageProps);
@@ -12335,6 +12539,10 @@ ${hasServerRuntimeIntegrations ? `
12335
12539
  // Set once the whole document is rendered: whether it starts with the boot entry, which
12336
12540
  // preloads nothing.
12337
12541
  let farmBootsClient = false;
12542
+ // A client navigation swaps this document in without running its scripts. A route a
12543
+ // shared cache stores renders the same for every request.
12544
+ const farmNavigationRequest = ${farmIslandsMode ? `!farmSharedCacheableRoute &&
12545
+ (request.headers.has("f-stream") || request.headers.has("f-render"))` : "false"};
12338
12546
  // A layout's own <html> document with Farm's head assets merged in and the #root the client
12339
12547
  // hydrates opening its body: the whole document, or a streamed one's opening.
12340
12548
  const composeFarmFullDocument = function(markup) {
@@ -12344,7 +12552,7 @@ ${hasServerRuntimeIntegrations ? `
12344
12552
  );
12345
12553
  composed = composed
12346
12554
  // Inject CSS link after opening head tag or first meta tag
12347
- .replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n <link rel="stylesheet" href="/__farm_client_css_href__">' + (farmBootsClient ? "" : renderFarmClientModulePreloads(composed, route.clientModule)); })
12555
+ .replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n <link rel="stylesheet" href="/__farm_client_css_href__">' + (farmBootsClient ? "" : renderFarmClientModulePreloads(composed, route.clientModule, farmNavigationRequest)); })
12348
12556
  .replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n</head>')
12349
12557
  // Explicit metadata wins over renderer and layout titles. Without
12350
12558
  // explicit metadata, a renderer title wins over the layout title.
@@ -12542,7 +12750,8 @@ ${hasServerRuntimeIntegrations ? `
12542
12750
  farmHydratesRoot ? (shouldHydrateLayout ? "root" : "__farm_page__") : "",
12543
12751
  route.rootStrategy,
12544
12752
  html,
12545
- route.clientModule
12753
+ route.clientModule,
12754
+ farmNavigationRequest
12546
12755
  )
12547
12756
  : renderFarmClientEntryScript();
12548
12757
 
@@ -12573,7 +12782,7 @@ ${hasServerRuntimeIntegrations ? `
12573
12782
  \${viewportTags}
12574
12783
  \${hasFavicon ? "" : '<link rel="icon" href="data:,">'}
12575
12784
  \${suppressDefaultTitle ? "" : "<title>" + title + "</title>"}\${metaTags}\${rendererHead ? "\\n " + rendererHead : ""}
12576
- <link rel="stylesheet" href="/__farm_client_css_href__">\${farmBootsClient ? "" : renderFarmClientModulePreloads(html, route.clientModule)}
12785
+ <link rel="stylesheet" href="/__farm_client_css_href__">\${farmBootsClient ? "" : renderFarmClientModulePreloads(html, route.clientModule, farmNavigationRequest)}
12577
12786
  \${renderFarmRendererHydrationScript()}
12578
12787
  </head>
12579
12788
  <body>
@@ -12773,7 +12982,7 @@ ${servesDefaultMCP ? `
12773
12982
  )` : "await renderErrorElement()"};
12774
12983
  const errorDocument = applyFarmThemeDocument(
12775
12984
  applyFarmI18nDocument(
12776
- createFarmErrorDocument(errorHtml, "Application Error"),
12985
+ createFarmErrorDocument(errorHtml, "Application Error", routePathname),
12777
12986
  pathname,
12778
12987
  getFarmI18nSnapshot(),
12779
12988
  request
@@ -12814,7 +13023,8 @@ ${servesDefaultMCP ? `
12814
13023
  applyFarmI18nDocument(
12815
13024
  createFarmErrorDocument(
12816
13025
  fallbackHtml,
12817
- errorStatus + " - " + errorStatusText
13026
+ errorStatus + " - " + errorStatusText,
13027
+ routePathname
12818
13028
  ),
12819
13029
  pathname,
12820
13030
  getFarmI18nSnapshot(),
@@ -12937,7 +13147,7 @@ ${farmRendererDisabled ? `
12937
13147
  .replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n</head>')
12938
13148
  .replace(
12939
13149
  /<\\/body>/i,
12940
- () => ' ' + renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname) + '\\n' +
13150
+ () => ' ' + renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname, true) + '\\n' +
12941
13151
  ' ' + renderFarmClientEntryScript() + '\\n</body>',
12942
13152
  );
12943
13153
  fullHtml = ensureFarmDocumentMeta(fullHtml, notFoundMetadata.viewport);
@@ -12957,7 +13167,7 @@ ${farmRendererDisabled ? `
12957
13167
  </head>
12958
13168
  <body>
12959
13169
  <div id="root">\${html}</div>
12960
- \${renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname)}
13170
+ \${renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname, true)}
12961
13171
  \${renderFarmClientEntryScript()}
12962
13172
  </body>
12963
13173
  </html>\`;
@@ -13424,8 +13634,8 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
13424
13634
  const isVercel = preset === "vercel";
13425
13635
  const isCloudflareWorker = preset === "cloudflare-module";
13426
13636
  const outputDir = resolveDeployOutputPath(root, config.deploy.outputDir);
13427
- const runtimeServerOutputDir = isVercel ? path16.join(outputDir, "functions", "__nitro.func") : path16.join(outputDir, "server");
13428
- const ssrOutputDir = path16.join(root, distDir, "ssr");
13637
+ const runtimeServerOutputDir = isVercel ? path17.join(outputDir, "functions", "__nitro.func") : path17.join(outputDir, "server");
13638
+ const ssrOutputDir = path17.join(root, distDir, "ssr");
13429
13639
  const imageRuntime = resolveFarmImageServerRuntime(config.images, preset);
13430
13640
  const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
13431
13641
  (image) => image.sourceType === "module"
@@ -13558,9 +13768,9 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
13558
13768
  resolveHashedClientCssHref(clientOutputDir),
13559
13769
  resolveHashedClientJsSrc(clientOutputDir),
13560
13770
  resolveClientBootSrc(clientOutputDir),
13561
- readFarmDocsModulePreloads(path16.join(root, distDir)),
13562
- readFarmClientModulePreloads(path16.join(root, distDir)),
13563
- readFarmClientRouteTable(path16.join(root, distDir))
13771
+ readFarmDocsModulePreloads(path17.join(root, distDir)),
13772
+ readFarmClientModulePreloads(path17.join(root, distDir)),
13773
+ readFarmClientRouteTable(path17.join(root, distDir))
13564
13774
  ]);
13565
13775
  let nativeStylesheets;
13566
13776
  const encodedDocsModulePreloads = encodeFarmDocsModulePreloads(docsModulePreloads);
@@ -13568,7 +13778,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
13568
13778
  const encodedClientRouteTable = encodeFarmBuildJSONPlaceholder(clientRouteTable);
13569
13779
  const encodedMobileShellClient = shouldBuildFarmMobileClient(config) ? encodeFarmMobileShellClient(
13570
13780
  await finalizeFarmMobileClient({
13571
- buildDir: path16.join(root, distDir),
13781
+ buildDir: path17.join(root, distDir),
13572
13782
  clientOutputDir,
13573
13783
  webEntry: clientJsSrc,
13574
13784
  webBoot: clientBootSrc,
@@ -13610,12 +13820,12 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
13610
13820
  await fs5.mkdir(ssrOutputDir, { recursive: true });
13611
13821
  await Promise.all(
13612
13822
  Object.entries(ssrBundle).map(async ([fileName, output]) => {
13613
- const filePath = path16.join(ssrOutputDir, fileName);
13614
- await fs5.mkdir(path16.dirname(filePath), { recursive: true });
13823
+ const filePath = path17.join(ssrOutputDir, fileName);
13824
+ await fs5.mkdir(path17.dirname(filePath), { recursive: true });
13615
13825
  await fs5.writeFile(filePath, output.type === "chunk" ? output.code : output.source);
13616
13826
  })
13617
13827
  );
13618
- const nitroEntryPath = path16.join(ssrOutputDir, "nitro-entry.mjs");
13828
+ const nitroEntryPath = path17.join(ssrOutputDir, "nitro-entry.mjs");
13619
13829
  const nodeAdapterModule = preset === "node-server" ? resolveNitroRuntimeDependency(root, "srvx/node") : null;
13620
13830
  const hasNitroCacheRouteRules = hasFarmNitroCacheRouteRule(config.routeRules);
13621
13831
  const nitroEntryCode = `
@@ -13833,20 +14043,20 @@ function toFarmNodeResponse(request, response) {
13833
14043
  );
13834
14044
  }
13835
14045
  await fs5.writeFile(
13836
- path16.join(ssrOutputDir, FARM_DESKTOP_ENV_MODULE_FILE),
14046
+ path17.join(ssrOutputDir, FARM_DESKTOP_ENV_MODULE_FILE),
13837
14047
  FARM_DESKTOP_ENV_MODULE_SOURCE
13838
14048
  );
13839
14049
  }
13840
- const farmNodeServerEntryPath = preset === "node-server" ? path16.join(ssrOutputDir, "farm-node-server-entry.mjs") : null;
14050
+ const farmNodeServerEntryPath = preset === "node-server" ? path17.join(ssrOutputDir, "farm-node-server-entry.mjs") : null;
13841
14051
  if (farmNodeServerEntryPath && nodeAdapterModule) {
13842
14052
  await fs5.writeFile(
13843
- path16.join(ssrOutputDir, FARM_NODE_ENV_MODULE_FILE),
14053
+ path17.join(ssrOutputDir, FARM_NODE_ENV_MODULE_FILE),
13844
14054
  FARM_NODE_ENV_MODULE_SOURCE
13845
14055
  );
13846
14056
  await fs5.writeFile(
13847
14057
  farmNodeServerEntryPath,
13848
14058
  createFarmNodeServerEntry({
13849
- nitroEntryFile: path16.basename(nitroEntryPath),
14059
+ nitroEntryFile: path17.basename(nitroEntryPath),
13850
14060
  nodeAdapterModule,
13851
14061
  server: config.server,
13852
14062
  websocketAdapterModule: resolveNitroRuntimeDependency(root, "crossws/adapters/node"),
@@ -13854,12 +14064,12 @@ function toFarmNodeResponse(request, response) {
13854
14064
  })
13855
14065
  );
13856
14066
  }
13857
- const farmBunServerEntryPath = preset === "bun" ? path16.join(ssrOutputDir, "farm-bun-server-entry.mjs") : null;
14067
+ const farmBunServerEntryPath = preset === "bun" ? path17.join(ssrOutputDir, "farm-bun-server-entry.mjs") : null;
13858
14068
  if (farmBunServerEntryPath) {
13859
14069
  await fs5.writeFile(
13860
14070
  farmBunServerEntryPath,
13861
14071
  createFarmBunServerEntry({
13862
- nitroEntryFile: path16.basename(nitroEntryPath),
14072
+ nitroEntryFile: path17.basename(nitroEntryPath),
13863
14073
  bunAdapterModule: resolveNitroRuntimeDependency(root, "srvx/bun"),
13864
14074
  server: config.server,
13865
14075
  websocketAdapterModule: resolveNitroRuntimeDependency(root, "crossws/adapters/bun"),
@@ -13867,7 +14077,7 @@ function toFarmNodeResponse(request, response) {
13867
14077
  })
13868
14078
  );
13869
14079
  }
13870
- const farmNetlifyEntryPath = preset === "netlify" ? path16.join(ssrOutputDir, "farm-netlify-entry.mjs") : null;
14080
+ const farmNetlifyEntryPath = preset === "netlify" ? path17.join(ssrOutputDir, "farm-netlify-entry.mjs") : null;
13871
14081
  if (farmNetlifyEntryPath) {
13872
14082
  await fs5.writeFile(
13873
14083
  farmNetlifyEntryPath,
@@ -13876,7 +14086,7 @@ function toFarmNodeResponse(request, response) {
13876
14086
  })
13877
14087
  );
13878
14088
  }
13879
- const farmCloudflareEnvPath = preset === "cloudflare-pages" ? path16.join(ssrOutputDir, "farm-cloudflare-env.mjs") : null;
14089
+ const farmCloudflareEnvPath = preset === "cloudflare-pages" ? path17.join(ssrOutputDir, "farm-cloudflare-env.mjs") : null;
13880
14090
  if (farmCloudflareEnvPath) {
13881
14091
  await fs5.writeFile(
13882
14092
  farmCloudflareEnvPath,
@@ -13924,6 +14134,7 @@ function toFarmNodeResponse(request, response) {
13924
14134
  ];
13925
14135
  })
13926
14136
  );
14137
+ if (preset === "node-server") await writeFarmClientBrotliAssets(clientOutputDir);
13927
14138
  const immutableAssets = isVercel ? { publicAssets: [], routeRules: {} } : planFarmImmutableAssets({
13928
14139
  clientOutputDir,
13929
14140
  files: await listFarmClientOutputFiles(clientOutputDir),
@@ -13950,18 +14161,20 @@ function toFarmNodeResponse(request, response) {
13950
14161
  // `src` directory), as Nitro handlers outside Farm's aliases.
13951
14162
  serverDir: false,
13952
14163
  serverEntry: false,
13953
- buildDir: path16.join(root, distDir, ".nitro"),
14164
+ buildDir: path17.join(root, distDir, ".nitro"),
13954
14165
  alias: resolveNitroInternalRuntimeAliases(root),
13955
14166
  compatibilityDate: "2024-12-01",
13956
14167
  output: resolveFarmNitroOutputConfig(preset, outputDir),
13957
14168
  // Nitro gives the root directory no Cache-Control on any preset (it falls through to the
13958
14169
  // app), so public files keep revalidating; the hashed directories carry their own maxAge.
13959
14170
  publicAssets: [{ dir: clientOutputDir, baseURL: "/" }, ...immutableAssets.publicAssets],
13960
- // A self-hosted Node server sends static files itself, so precompress them
13961
- // with gzip and let Nitro serve that by Accept-Encoding. Brotli at Nitro's
13962
- // fixed top quality cost a docs app ~20 s of build CPU for a small further
13963
- // saving. Serverless and edge targets sit behind a CDN that compresses.
13964
- ...preset === "node-server" ? { compressPublicAssets: { gzip: true } } : {},
14171
+ // A self-hosted Node or Bun server sends static files itself, so precompress
14172
+ // them with gzip and let Nitro serve that by Accept-Encoding. Brotli at Nitro's
14173
+ // fixed top quality on every file cost a docs app ~20 s of build CPU, so only
14174
+ // client scripts and stylesheets get a brotli copy, on node-server
14175
+ // (writeFarmClientBrotliAssets). Serverless and edge targets sit behind a CDN
14176
+ // that compresses.
14177
+ ...preset === "node-server" || preset === "bun" ? { compressPublicAssets: { gzip: true } } : {},
13965
14178
  // Nitro gzips every server output file at level 9, node_modules included, to
13966
14179
  // print sizes after the build. A self-hosted server is never shipped compressed,
13967
14180
  // so list plain sizes; zipped serverless and edge bundles keep the gzip column.
@@ -14044,7 +14257,7 @@ function toFarmNodeResponse(request, response) {
14044
14257
  if (pluginManager) {
14045
14258
  nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
14046
14259
  }
14047
- const expectedServerDir = path16.join(outputDir, "server");
14260
+ const expectedServerDir = path17.join(outputDir, "server");
14048
14261
  const customRollupKeys = Object.keys(nitroConfig.rollupConfig || {}).filter(
14049
14262
  (key) => key !== "external" && key !== "plugins"
14050
14263
  );
@@ -14059,10 +14272,10 @@ function toFarmNodeResponse(request, response) {
14059
14272
  const requestedBuilder = nitroConfig.builder ?? process.env.NITRO_BUILDER;
14060
14273
  const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && nitroConfig.rollupConfig?.external === nitroRollupExternal && !hasRollupPlugins(nitroConfig.rollupConfig?.plugins) && customRollupKeys.length === 0 && Boolean(
14061
14274
  nitroConfig.handlers?.some(
14062
- (handler) => path16.resolve(handler?.handler || "") === nitroEntryPath
14275
+ (handler) => path17.resolve(handler?.handler || "") === nitroEntryPath
14063
14276
  )
14064
14277
  );
14065
- const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && path16.resolve(nitroConfig.output?.serverDir || "") === path16.resolve(expectedServerDir);
14278
+ const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && path17.resolve(nitroConfig.output?.serverDir || "") === path17.resolve(expectedServerDir);
14066
14279
  const prerenderReusesPrebuiltSSR = prerenderRoutes.length > 0 && ssrExternalsArePackaged && nitroBuildIsFarms;
14067
14280
  const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
14068
14281
  if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
@@ -14191,8 +14404,8 @@ function toFarmNodeResponse(request, response) {
14191
14404
  };
14192
14405
  prerendererConfig.output = {
14193
14406
  ...prerendererConfig.output,
14194
- serverDir: path16.join(
14195
- prerendererConfig.buildDir ?? path16.join(root, distDir, ".nitro"),
14407
+ serverDir: path17.join(
14408
+ prerendererConfig.buildDir ?? path17.join(root, distDir, ".nitro"),
14196
14409
  "prerender"
14197
14410
  )
14198
14411
  };
@@ -14211,7 +14424,7 @@ function toFarmNodeResponse(request, response) {
14211
14424
  const prerenderServerDir = prerenderer.options.output.serverDir;
14212
14425
  await copyPrebuiltSSRBundle(
14213
14426
  ssrBundle,
14214
- path16.join(prerenderServerDir, FARM_SSR_OUTPUT_DIR),
14427
+ path17.join(prerenderServerDir, FARM_SSR_OUTPUT_DIR),
14215
14428
  null,
14216
14429
  fs5
14217
14430
  );
@@ -14287,7 +14500,7 @@ function toFarmNodeResponse(request, response) {
14287
14500
  const copyResults = await Promise.allSettled([
14288
14501
  prebuiltSSRFilesResult.value ? writeSSRBundleFiles(
14289
14502
  prebuiltSSRFilesResult.value,
14290
- path16.join(outputDir, "server", FARM_SSR_OUTPUT_DIR),
14503
+ path17.join(outputDir, "server", FARM_SSR_OUTPUT_DIR),
14291
14504
  fs5
14292
14505
  ) : Promise.resolve(),
14293
14506
  runtimeCopyPromise
@@ -14297,14 +14510,14 @@ function toFarmNodeResponse(request, response) {
14297
14510
  );
14298
14511
  if (failedCopy) throw failedCopy.reason;
14299
14512
  if (canReusePrebuiltSSR) {
14300
- await registerPrebuiltSSRPackageImport(path16.join(outputDir, "server"), ssrEntryFile, fs5);
14513
+ await registerPrebuiltSSRPackageImport(path17.join(outputDir, "server"), ssrEntryFile, fs5);
14301
14514
  logger.info("\u26A1 Reused Farm's prebuilt SSR bundle for the Node output");
14302
14515
  }
14303
14516
  if (useRolldownBuilder) {
14304
14517
  logger.info("\u26A1 Built the Node adapter with Rolldown");
14305
14518
  }
14306
14519
  if (preset === "node-server" && !desktopServerEntry) {
14307
- await installFarmCompileCacheLauncher(path16.join(outputDir, "server"), fs5);
14520
+ await installFarmCompileCacheLauncher(path17.join(outputDir, "server"), fs5);
14308
14521
  }
14309
14522
  if (preset.startsWith("cloudflare")) {
14310
14523
  await populateCloudflareProcessEnv(nitroInstance.options.output.serverDir, fs5);
@@ -14327,7 +14540,7 @@ function toFarmNodeResponse(request, response) {
14327
14540
  routeRuntimeManifest,
14328
14541
  farmCron.provider === "host" ? farmCron.jobs : [],
14329
14542
  {
14330
- buildDir: path16.join(root, distDir),
14543
+ buildDir: path17.join(root, distDir),
14331
14544
  middlewareRoutes: edgeMiddlewareRoutes,
14332
14545
  guardedPages: edgeGuardedPrerenderRoutes
14333
14546
  },
@@ -14341,16 +14554,16 @@ function resolveFarmNitroOutputConfig(preset, outputDir) {
14341
14554
  return {
14342
14555
  dir: outputDir,
14343
14556
  ...preset === "node-server" ? {
14344
- serverDir: path16.join(outputDir, "server"),
14345
- publicDir: path16.join(outputDir, "public")
14557
+ serverDir: path17.join(outputDir, "server"),
14558
+ publicDir: path17.join(outputDir, "public")
14346
14559
  } : isVercel ? {
14347
- serverDir: path16.join(outputDir, "functions", "__nitro.func"),
14348
- publicDir: path16.join(outputDir, "static")
14560
+ serverDir: path17.join(outputDir, "functions", "__nitro.func"),
14561
+ publicDir: path17.join(outputDir, "static")
14349
14562
  } : {}
14350
14563
  };
14351
14564
  }
14352
14565
  async function populateCloudflareProcessEnv(serverDir, fs5) {
14353
- const wranglerPath = path16.join(serverDir, "wrangler.json");
14566
+ const wranglerPath = path17.join(serverDir, "wrangler.json");
14354
14567
  let source;
14355
14568
  try {
14356
14569
  source = await fs5.readFile(wranglerPath, "utf8");
@@ -14378,8 +14591,8 @@ async function writeSSRBundleFiles(files, targetDir, fs5) {
14378
14591
  await fs5.rm(targetDir, { recursive: true, force: true });
14379
14592
  await Promise.all(
14380
14593
  files.map(async ({ fileName, contents }) => {
14381
- const targetPath = path16.join(targetDir, fileName);
14382
- await fs5.mkdir(path16.dirname(targetPath), { recursive: true });
14594
+ const targetPath = path17.join(targetDir, fileName);
14595
+ await fs5.mkdir(path17.dirname(targetPath), { recursive: true });
14383
14596
  await fs5.writeFile(targetPath, contents);
14384
14597
  })
14385
14598
  );
@@ -14388,8 +14601,8 @@ async function copyPrebuiltSSRBundle(ssrBundle, targetDir, minifyOptions, fs5) {
14388
14601
  await writeSSRBundleFiles(await prepareSSRBundleFiles(ssrBundle, minifyOptions), targetDir, fs5);
14389
14602
  }
14390
14603
  async function installFarmCompileCacheLauncher(serverDir, fs5) {
14391
- const entryPath = path16.join(serverDir, "index.mjs");
14392
- const serverPath = path16.join(serverDir, FARM_SERVER_MODULE_FILE);
14604
+ const entryPath = path17.join(serverDir, "index.mjs");
14605
+ const serverPath = path17.join(serverDir, FARM_SERVER_MODULE_FILE);
14393
14606
  const entry = await fs5.readFile(entryPath, "utf8").catch((error) => {
14394
14607
  if (error.code === "ENOENT") return null;
14395
14608
  throw error;
@@ -14398,11 +14611,11 @@ async function installFarmCompileCacheLauncher(serverDir, fs5) {
14398
14611
  if (entry.includes(`./${FARM_SERVER_MODULE_FILE}`)) return false;
14399
14612
  await fs5.rename(entryPath, serverPath);
14400
14613
  await fs5.writeFile(entryPath, createFarmCompileCacheLauncher(FARM_SERVER_MODULE_FILE));
14401
- await fs5.rm(path16.join(serverDir, FARM_COMPILE_CACHE_DIR), { recursive: true, force: true });
14614
+ await fs5.rm(path17.join(serverDir, FARM_COMPILE_CACHE_DIR), { recursive: true, force: true });
14402
14615
  return true;
14403
14616
  }
14404
14617
  async function registerPrebuiltSSRPackageImport(serverDir, ssrEntryFile, fs5) {
14405
- const packagePath = path16.join(serverDir, "package.json");
14618
+ const packagePath = path17.join(serverDir, "package.json");
14406
14619
  const packageJSON = await fs5.readFile(packagePath, "utf8").then((contents) => JSON.parse(contents)).catch((error) => {
14407
14620
  if (error.code === "ENOENT") return { type: "module" };
14408
14621
  throw error;
@@ -14432,18 +14645,18 @@ async function moveVercelOutputPath(src, dest, fs5) {
14432
14645
  await fs5.rm(src, { recursive: true, force: true });
14433
14646
  }
14434
14647
  async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflows, routeRuntimeManifest, cronJobs, edgeMiddleware, prerenderedPages) {
14435
- const serverDir = path16.join(outputDir, "server");
14436
- const functionsDir = path16.join(outputDir, "functions");
14437
- const nitroFuncDir = path16.join(functionsDir, "__nitro.func");
14438
- const staticDir = path16.join(outputDir, "static");
14439
- const publicDir = path16.join(outputDir, "public");
14648
+ const serverDir = path17.join(outputDir, "server");
14649
+ const functionsDir = path17.join(outputDir, "functions");
14650
+ const nitroFuncDir = path17.join(functionsDir, "__nitro.func");
14651
+ const staticDir = path17.join(outputDir, "static");
14652
+ const publicDir = path17.join(outputDir, "public");
14440
14653
  await fs5.mkdir(nitroFuncDir, { recursive: true });
14441
14654
  const serverContents = await fs5.readdir(serverDir).catch((error) => {
14442
14655
  if (error.code === "ENOENT") return [];
14443
14656
  throw error;
14444
14657
  });
14445
14658
  for (const file of serverContents) {
14446
- await moveVercelOutputPath(path16.join(serverDir, file), path16.join(nitroFuncDir, file), fs5);
14659
+ await moveVercelOutputPath(path17.join(serverDir, file), path17.join(nitroFuncDir, file), fs5);
14447
14660
  }
14448
14661
  if (serverContents.length > 0) await fs5.rm(serverDir, { recursive: true, force: true });
14449
14662
  try {
@@ -14453,7 +14666,7 @@ async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflo
14453
14666
  }
14454
14667
  await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5);
14455
14668
  await copyPrismaClientForVercel(root, nitroFuncDir, fs5);
14456
- const configPath = path16.join(outputDir, "config.json");
14669
+ const configPath = path17.join(outputDir, "config.json");
14457
14670
  const configContent = await fs5.readFile(configPath, "utf-8");
14458
14671
  const vercelConfig = JSON.parse(configContent);
14459
14672
  const runtimeRoutes = await createFarmVercelRouteRuntimeFunctions(
@@ -14497,7 +14710,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5) {
14497
14710
  mainRoot,
14498
14711
  root,
14499
14712
  config.srcDir,
14500
- path16.join(nitroFuncDir, "farm-docs-content"),
14713
+ path17.join(nitroFuncDir, "farm-docs-content"),
14501
14714
  fs5
14502
14715
  );
14503
14716
  for (const [index, docsRoot] of extraRoots.entries()) {
@@ -14505,7 +14718,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5) {
14505
14718
  docsRoot,
14506
14719
  root,
14507
14720
  config.srcDir,
14508
- path16.join(nitroFuncDir, "farm-docs-roots", String(index)),
14721
+ path17.join(nitroFuncDir, "farm-docs-roots", String(index)),
14509
14722
  fs5
14510
14723
  );
14511
14724
  }
@@ -14523,18 +14736,18 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
14523
14736
  );
14524
14737
  }
14525
14738
  await fs5.rm(bundledContentDir, { recursive: true, force: true });
14526
- await fs5.mkdir(path16.dirname(bundledContentDir), { recursive: true });
14739
+ await fs5.mkdir(path17.dirname(bundledContentDir), { recursive: true });
14527
14740
  await fs5.cp(docsContentDir, bundledContentDir, {
14528
14741
  recursive: true,
14529
14742
  force: true,
14530
14743
  dereference: true
14531
14744
  });
14532
14745
  await fs5.writeFile(
14533
- path16.join(bundledContentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST),
14746
+ path17.join(bundledContentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST),
14534
14747
  `${JSON.stringify(lastModifiedManifest, null, 2)}
14535
14748
  `
14536
14749
  );
14537
- logger.info(`\u{1F4DA} Bundled docs content for Vercel: ${path16.relative(root, docsContentDir)}`);
14750
+ logger.info(`\u{1F4DA} Bundled docs content for Vercel: ${path17.relative(root, docsContentDir)}`);
14538
14751
  }
14539
14752
  function resolveServerFunctionPlatform(preset) {
14540
14753
  return preset === "vercel" || preset === "netlify" ? { os: "linux", cpu: "x64", libc: "glibc" } : null;
@@ -14551,7 +14764,7 @@ function platformFieldAllows(field, value) {
14551
14764
  }
14552
14765
  async function stageSharpRuntime(config, root, distDir, fs5, preset) {
14553
14766
  const functionPlatform = resolveServerFunctionPlatform(preset);
14554
- const projectRequire = createRequire2(path16.join(root, "package.json"));
14767
+ const projectRequire = createRequire2(path17.join(root, "package.json"));
14555
14768
  let sharpRequire = projectRequire;
14556
14769
  if (!resolvePackageJson(projectRequire, "sharp")) {
14557
14770
  try {
@@ -14561,10 +14774,10 @@ async function stageSharpRuntime(config, root, distDir, fs5, preset) {
14561
14774
  }
14562
14775
  const copiedPackages = /* @__PURE__ */ new Map();
14563
14776
  const packageCopies = /* @__PURE__ */ new Map();
14564
- const stageRoot = path16.join(root, distDir, "tmp");
14777
+ const stageRoot = path17.join(root, distDir, "tmp");
14565
14778
  await fs5.mkdir(stageRoot, { recursive: true });
14566
- const stageDir = await fs5.mkdtemp(path16.join(stageRoot, "sharp-runtime-"));
14567
- const targetNodeModules = path16.join(stageDir, "node_modules");
14779
+ const stageDir = await fs5.mkdtemp(path17.join(stageRoot, "sharp-runtime-"));
14780
+ const targetNodeModules = path17.join(stageDir, "node_modules");
14568
14781
  function copyPackage(packageName, parentRequire) {
14569
14782
  const activeCopy = packageCopies.get(packageName);
14570
14783
  if (activeCopy) return activeCopy;
@@ -14577,10 +14790,10 @@ async function stageSharpRuntime(config, root, distDir, fs5, preset) {
14577
14790
  if (!packageJsonPath) return;
14578
14791
  const packageJson = JSON.parse(await fs5.readFile(packageJsonPath, "utf8"));
14579
14792
  if (functionPlatform && !packageSupportsPlatform(packageJson, functionPlatform)) return;
14580
- const packageDir = path16.dirname(packageJsonPath);
14581
- const targetDir = path16.join(targetNodeModules, ...packageName.split("/"));
14793
+ const packageDir = path17.dirname(packageJsonPath);
14794
+ const targetDir = path17.join(targetNodeModules, ...packageName.split("/"));
14582
14795
  copiedPackages.set(packageName, String(packageJson.version || "*"));
14583
- await fs5.mkdir(path16.dirname(targetDir), { recursive: true });
14796
+ await fs5.mkdir(path17.dirname(targetDir), { recursive: true });
14584
14797
  const packageRequire = createRequire2(packageJsonPath);
14585
14798
  const dependencies = {
14586
14799
  ...packageJson.dependencies,
@@ -14615,8 +14828,8 @@ async function stageSharpRuntime(config, root, distDir, fs5, preset) {
14615
14828
  };
14616
14829
  }
14617
14830
  async function installStagedSharpRuntime(staged, nitroFuncDir, fs5) {
14618
- const stagedNodeModules = path16.join(staged.stageDir, "node_modules");
14619
- const targetNodeModules = path16.join(nitroFuncDir, "node_modules");
14831
+ const stagedNodeModules = path17.join(staged.stageDir, "node_modules");
14832
+ const targetNodeModules = path17.join(nitroFuncDir, "node_modules");
14620
14833
  try {
14621
14834
  await mergeStagedDirectory(stagedNodeModules, targetNodeModules, fs5);
14622
14835
  const functionPackage = await readNitroOutputPackage(nitroFuncDir, fs5);
@@ -14644,8 +14857,8 @@ async function mergeStagedDirectory(sourceDir, targetDir, fs5) {
14644
14857
  const entries = await fs5.readdir(sourceDir, { withFileTypes: true });
14645
14858
  await settleAllOrThrow(
14646
14859
  entries.map(async (entry) => {
14647
- const sourcePath = path16.join(sourceDir, entry.name);
14648
- const targetPath = path16.join(targetDir, entry.name);
14860
+ const sourcePath = path17.join(sourceDir, entry.name);
14861
+ const targetPath = path17.join(targetDir, entry.name);
14649
14862
  try {
14650
14863
  await fs5.rename(sourcePath, targetPath);
14651
14864
  return;
@@ -14672,13 +14885,13 @@ async function mergeStagedDirectory(sourceDir, targetDir, fs5) {
14672
14885
  function assertMetadataImageRuntimeInstalled(root, metadataImageRoutes) {
14673
14886
  const generated = metadataImageRoutes.find((image) => image.sourceType === "module");
14674
14887
  if (!generated || resolveMetadataImageRuntimePackageJson(root)) return;
14675
- const file = generated.modulePath ? toPosixPath(path16.relative(root, generated.modulePath)) : "";
14888
+ const file = generated.modulePath ? toPosixPath(path17.relative(root, generated.modulePath)) : "";
14676
14889
  throw new Error(
14677
14890
  `${file || "A generated metadata image"} renders with @vercel/og, which is not installed. ${VERCEL_OG_INSTALL_HINT}`
14678
14891
  );
14679
14892
  }
14680
14893
  function resolveMetadataImageRuntimePackageJson(root) {
14681
- const projectRequire = createRequire2(path16.join(root, "package.json"));
14894
+ const projectRequire = createRequire2(path17.join(root, "package.json"));
14682
14895
  const packageJsonPath = resolvePackageJson(projectRequire, "@vercel/og");
14683
14896
  if (packageJsonPath) return packageJsonPath;
14684
14897
  try {
@@ -14691,9 +14904,9 @@ async function copyMetadataImageRuntime(root, nitroFuncDir, fs5) {
14691
14904
  const packageJsonPath = resolveMetadataImageRuntimePackageJson(root);
14692
14905
  if (!packageJsonPath) return;
14693
14906
  const packageJson = JSON.parse(await fs5.readFile(packageJsonPath, "utf8"));
14694
- const packageDir = path16.dirname(packageJsonPath);
14695
- const targetDir = path16.join(nitroFuncDir, "node_modules", "@vercel", "og");
14696
- await fs5.mkdir(path16.dirname(targetDir), { recursive: true });
14907
+ const packageDir = path17.dirname(packageJsonPath);
14908
+ const targetDir = path17.join(nitroFuncDir, "node_modules", "@vercel", "og");
14909
+ await fs5.mkdir(path17.dirname(targetDir), { recursive: true });
14697
14910
  await fs5.cp(packageDir, targetDir, {
14698
14911
  recursive: true,
14699
14912
  force: true,
@@ -14709,7 +14922,7 @@ async function copyMetadataImageRuntime(root, nitroFuncDir, fs5) {
14709
14922
  logger.info("\u{1F5BC}\uFE0F Bundled generated metadata image runtime");
14710
14923
  }
14711
14924
  async function readNitroOutputPackage(outputDir, fs5) {
14712
- const packagePath = path16.join(outputDir, "package.json");
14925
+ const packagePath = path17.join(outputDir, "package.json");
14713
14926
  return fs5.readFile(packagePath, "utf8").then((contents) => JSON.parse(contents)).catch((error) => {
14714
14927
  if (error.code === "ENOENT") return {};
14715
14928
  throw error;
@@ -14718,7 +14931,7 @@ async function readNitroOutputPackage(outputDir, fs5) {
14718
14931
  async function writeNitroOutputPackage(outputDir, packageJson, fs5) {
14719
14932
  await fs5.mkdir(outputDir, { recursive: true });
14720
14933
  await fs5.writeFile(
14721
- path16.join(outputDir, "package.json"),
14934
+ path17.join(outputDir, "package.json"),
14722
14935
  `${JSON.stringify(packageJson, null, 2)}
14723
14936
  `
14724
14937
  );
@@ -14734,9 +14947,9 @@ function resolvePackageJson(parentRequire, packageName) {
14734
14947
  }
14735
14948
  }
14736
14949
  try {
14737
- let directory = path16.dirname(metadataModule ?? parentRequire.resolve(packageName));
14738
- while (directory !== path16.dirname(directory)) {
14739
- const candidate = path16.join(directory, "package.json");
14950
+ let directory = path17.dirname(metadataModule ?? parentRequire.resolve(packageName));
14951
+ while (directory !== path17.dirname(directory)) {
14952
+ const candidate = path17.join(directory, "package.json");
14740
14953
  if (existsSync3(candidate)) {
14741
14954
  try {
14742
14955
  const manifest = JSON.parse(readFileSync2(candidate, "utf8"));
@@ -14744,23 +14957,23 @@ function resolvePackageJson(parentRequire, packageName) {
14744
14957
  } catch {
14745
14958
  }
14746
14959
  }
14747
- if (path16.basename(directory) === "node_modules") break;
14748
- directory = path16.dirname(directory);
14960
+ if (path17.basename(directory) === "node_modules") break;
14961
+ directory = path17.dirname(directory);
14749
14962
  }
14750
14963
  } catch {
14751
14964
  }
14752
14965
  return null;
14753
14966
  }
14754
14967
  async function resolveProjectInstalledPackageDir(root, packageName, fs5) {
14755
- let directory = path16.resolve(root);
14968
+ let directory = path17.resolve(root);
14756
14969
  while (true) {
14757
- const candidate = path16.join(directory, "node_modules", ...packageName.split("/"));
14970
+ const candidate = path17.join(directory, "node_modules", ...packageName.split("/"));
14758
14971
  try {
14759
14972
  const packageDir = await fs5.realpath(candidate);
14760
- if ((await fs5.stat(path16.join(packageDir, "package.json"))).isFile()) return packageDir;
14973
+ if ((await fs5.stat(path17.join(packageDir, "package.json"))).isFile()) return packageDir;
14761
14974
  } catch {
14762
14975
  }
14763
- const parent = path16.dirname(directory);
14976
+ const parent = path17.dirname(directory);
14764
14977
  if (parent === directory) return null;
14765
14978
  directory = parent;
14766
14979
  }
@@ -14769,28 +14982,28 @@ var PRISMA_RUNTIME_GENERATE_ONLY_FILE = /^query_(?:engine|compiler)_bg\.|\.map$|
14769
14982
  async function copyPrismaClientForVercel(root, nitroFuncDir, fs5) {
14770
14983
  const prismaClientDir = await resolveProjectInstalledPackageDir(root, "@prisma/client", fs5);
14771
14984
  if (!prismaClientDir) return;
14772
- const generatedClientDir = path16.join(prismaClientDir, "..", "..", ".prisma", "client");
14985
+ const generatedClientDir = path17.join(prismaClientDir, "..", "..", ".prisma", "client");
14773
14986
  try {
14774
14987
  await fs5.access(generatedClientDir);
14775
14988
  } catch {
14776
14989
  return;
14777
14990
  }
14778
- const targetNodeModules = path16.join(nitroFuncDir, "node_modules");
14779
- const targetPrismaScopeDir = path16.join(targetNodeModules, "@prisma");
14780
- const targetGeneratedDir = path16.join(targetNodeModules, ".prisma", "client");
14781
- const targetClientDir = path16.join(targetPrismaScopeDir, "client");
14782
- const runtimeDir = path16.join(prismaClientDir, "runtime");
14991
+ const targetNodeModules = path17.join(nitroFuncDir, "node_modules");
14992
+ const targetPrismaScopeDir = path17.join(targetNodeModules, "@prisma");
14993
+ const targetGeneratedDir = path17.join(targetNodeModules, ".prisma", "client");
14994
+ const targetClientDir = path17.join(targetPrismaScopeDir, "client");
14995
+ const runtimeDir = path17.join(prismaClientDir, "runtime");
14783
14996
  await fs5.mkdir(targetPrismaScopeDir, { recursive: true });
14784
14997
  await fs5.cp(prismaClientDir, targetClientDir, {
14785
14998
  recursive: true,
14786
14999
  force: true,
14787
- filter: (source) => path16.dirname(source) !== runtimeDir || !PRISMA_RUNTIME_GENERATE_ONLY_FILE.test(path16.basename(source))
15000
+ filter: (source) => path17.dirname(source) !== runtimeDir || !PRISMA_RUNTIME_GENERATE_ONLY_FILE.test(path17.basename(source))
14788
15001
  });
14789
15002
  await fs5.cp(generatedClientDir, targetGeneratedDir, {
14790
15003
  recursive: true,
14791
15004
  force: true
14792
15005
  });
14793
- const clientPackagePath = path16.join(prismaClientDir, "package.json");
15006
+ const clientPackagePath = path17.join(prismaClientDir, "package.json");
14794
15007
  const [functionPackage, clientPackageContent] = await Promise.all([
14795
15008
  readNitroOutputPackage(nitroFuncDir, fs5),
14796
15009
  fs5.readFile(clientPackagePath, "utf-8")
@@ -14802,9 +15015,9 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs5) {
14802
15015
  };
14803
15016
  await writeNitroOutputPackage(nitroFuncDir, functionPackage, fs5);
14804
15017
  }
14805
- function islandsActionKeyCode() {
15018
+ function islandsActionKeyCode(runtimeModule) {
14806
15019
  const key = randomBytes(32).toString("base64url");
14807
- return `import { setBuildDefaults as __farmIslxBuildDefaults } from "@farm.js/core/internal/islx-server";
15020
+ return `import { setBuildDefaults as __farmIslxBuildDefaults } from ${JSON.stringify(runtimeModule)};
14808
15021
  __farmIslxBuildDefaults({ key: ${JSON.stringify(key)} });`;
14809
15022
  }
14810
15023
 
@@ -14978,9 +15191,9 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
14978
15191
  } else {
14979
15192
  const { build: legacyViteBuild } = await import("vite");
14980
15193
  logger.info("\u{1F4E6} Building client bundle...");
14981
- await buildClient2(legacyViteBuild, config, root, srcDir, path17.join(root, distDir, "client"));
15194
+ await buildClient2(legacyViteBuild, config, root, srcDir, path18.join(root, distDir, "client"));
14982
15195
  logger.info("\u{1F4E6} Building SSR bundle...");
14983
- await buildSSR(legacyViteBuild, config, root, srcDir, path17.join(root, distDir, "server"));
15196
+ await buildSSR(legacyViteBuild, config, root, srcDir, path18.join(root, distDir, "server"));
14984
15197
  logger.info(`\u{1F680} Building server with Nitro (preset: ${preset})...`);
14985
15198
  await buildNitro(
14986
15199
  config,
@@ -15033,7 +15246,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
15033
15246
  }
15034
15247
  }
15035
15248
  async function createProjectModuleServer(createViteServer, config, root, buildLifetime) {
15036
- const { farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
15249
+ const { farmNavigationPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
15037
15250
  const rendererVitePlugins = await loadFarmRendererVitePlugins(config.renderer, root, {
15038
15251
  ssr: true,
15039
15252
  buildLifetime
@@ -15055,7 +15268,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
15055
15268
  basePath: config.basePath,
15056
15269
  publicDir: config.publicDir
15057
15270
  }),
15058
- farmEnvironmentFunctionsPlugin(),
15271
+ farmEnvironmentFunctionsPlugin({ renderer: config.renderer }),
15059
15272
  // Route modules load here at build time (rendering config, prerendering): `server-only`
15060
15273
  // resolves as it does in the server build. Module-entry packages load pre-bundled, as in
15061
15274
  // `farm dev`: unbundled, lucide-react alone is ~1,750 modules through the module runner,
@@ -15063,7 +15276,8 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
15063
15276
  farmServerOnlyEntriesPlugin({
15064
15277
  prebundleServerPackages: true,
15065
15278
  distDir: config.distDir || ".farm"
15066
- })
15279
+ }),
15280
+ farmNavigationPlugin(config.renderer)
15067
15281
  ],
15068
15282
  server: {
15069
15283
  middlewareMode: true,
@@ -15085,8 +15299,8 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
15085
15299
  root,
15086
15300
  // Vite keys its pre-bundled dependencies on the config, mode included, so this server and
15087
15301
  // `farm dev` sharing one cache would each rebuild it after the other ran.
15088
- cacheDir: path17.join(
15089
- path17.resolve(root, viteConfig.cacheDir ?? path17.join("node_modules", ".vite")),
15302
+ cacheDir: path18.join(
15303
+ path18.resolve(root, viteConfig.cacheDir ?? path18.join("node_modules", ".vite")),
15090
15304
  "farm-build"
15091
15305
  ),
15092
15306
  configFile: false,
@@ -15122,10 +15336,11 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
15122
15336
  const {
15123
15337
  farmI18nClientBridgePlugin,
15124
15338
  farmIslandContainersPlugin,
15339
+ farmNavigationPlugin,
15125
15340
  farmPlugin,
15126
15341
  farmServerOnlyEntriesPlugin
15127
15342
  } = await import("./vite.mjs");
15128
- const { PluginManager: PluginManager2 } = await import("./plugin-TV6W7YNK.mjs");
15343
+ const { PluginManager: PluginManager2 } = await import("./plugin-33I3V42N.mjs");
15129
15344
  const pluginManager = new PluginManager2({
15130
15345
  config,
15131
15346
  isDev: false,
@@ -15144,6 +15359,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
15144
15359
  plugins: [
15145
15360
  farmI18nClientBridgePlugin(),
15146
15361
  farmServerOnlyEntriesPlugin({ distDir: config.distDir || ".farm" }),
15362
+ farmNavigationPlugin(config.renderer),
15147
15363
  farmIslandContainersPlugin(config),
15148
15364
  farmPlugin(config, pluginManager),
15149
15365
  farmEnvironmentFunctionsPlugin(config)
@@ -15153,7 +15369,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
15153
15369
  }
15154
15370
  async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
15155
15371
  const { farmI18nClientBridgePlugin, farmIslandContainersPlugin, farmPlugin } = await import("./vite.mjs");
15156
- const { PluginManager: PluginManager2 } = await import("./plugin-TV6W7YNK.mjs");
15372
+ const { PluginManager: PluginManager2 } = await import("./plugin-33I3V42N.mjs");
15157
15373
  const pluginManager = new PluginManager2({
15158
15374
  config,
15159
15375
  isDev: false,
@@ -15186,16 +15402,16 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
15186
15402
  });
15187
15403
  }
15188
15404
  function resolveLegacyPageEntry(config, root, srcDir) {
15189
- const appDir = path17.join(root, srcDir, "app");
15405
+ const appDir = path18.join(root, srcDir, "app");
15190
15406
  for (const extension of getFarmRendererComponentExtensions(config.renderer)) {
15191
- const candidate = path17.join(appDir, `page${extension}`);
15407
+ const candidate = path18.join(appDir, `page${extension}`);
15192
15408
  if (existsSync4(candidate)) return candidate;
15193
15409
  }
15194
- return path17.join(appDir, "page.tsx");
15410
+ return path18.join(appDir, "page.tsx");
15195
15411
  }
15196
15412
  async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
15197
15413
  const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
15198
- import("./nitro-VCJ6QQSI.mjs"),
15414
+ import("./nitro-YLTGVGK4.mjs"),
15199
15415
  import("nitro/builder")
15200
15416
  ]);
15201
15417
  let nitroConfig = await createNitroConfig(
@@ -15209,18 +15425,18 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
15209
15425
  nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
15210
15426
  }
15211
15427
  const outputDir = resolveDeployOutputPath(root, config.deploy.outputDir);
15212
- const serverOutputDir = path17.join(outputDir, "server");
15213
- const publicOutputDir = path17.join(outputDir, "public");
15428
+ const serverOutputDir = path18.join(outputDir, "server");
15429
+ const publicOutputDir = path18.join(outputDir, "public");
15214
15430
  const { mkdir, cp } = await import("fs/promises");
15215
15431
  await mkdir(serverOutputDir, { recursive: true });
15216
15432
  await mkdir(publicOutputDir, { recursive: true });
15217
- const clientDir = path17.join(root, distDir, "client");
15433
+ const clientDir = path18.join(root, distDir, "client");
15218
15434
  try {
15219
15435
  await mkdir(publicOutputDir, { recursive: true });
15220
15436
  await cp(clientDir, publicOutputDir, { recursive: true });
15221
15437
  logger.info("\u{1F4E6} Copied client assets to public directory");
15222
- const manifestPath = path17.join(publicOutputDir, "farm-client-manifest.json");
15223
- const assetsDir = path17.join(publicOutputDir, "assets");
15438
+ const manifestPath = path18.join(publicOutputDir, "farm-client-manifest.json");
15439
+ const assetsDir = path18.join(publicOutputDir, "assets");
15224
15440
  const manifestExists = await import("fs/promises").then(
15225
15441
  (fs5) => fs5.access(manifestPath).then(() => true).catch(() => false)
15226
15442
  );
@@ -15236,8 +15452,8 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
15236
15452
  logger.error(`\u274C Failed to copy client assets: ${error}`);
15237
15453
  throw error;
15238
15454
  }
15239
- const serverDir = path17.join(root, distDir, "server");
15240
- const nitroServerDir = path17.join(root, distDir, ".nitro", "server", "farm");
15455
+ const serverDir = path18.join(root, distDir, "server");
15456
+ const nitroServerDir = path18.join(root, distDir, ".nitro", "server", "farm");
15241
15457
  try {
15242
15458
  await mkdir(nitroServerDir, { recursive: true });
15243
15459
  await cp(serverDir, nitroServerDir, { recursive: true });
@@ -15246,7 +15462,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
15246
15462
  logger.warn(`Could not copy SSR bundles: ${error}`);
15247
15463
  }
15248
15464
  const nitro = await createNitro(nitroConfig);
15249
- const registryPath = path17.join(root, distDir, ".nitro", "server", "farm-registry.ts");
15465
+ const registryPath = path18.join(root, distDir, ".nitro", "server", "farm-registry.ts");
15250
15466
  try {
15251
15467
  const { farmRegistry } = await import(
15252
15468
  /* @vite-ignore */
@@ -15263,9 +15479,9 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
15263
15479
  }
15264
15480
  farmRegistry.routePaths = routePaths;
15265
15481
  try {
15266
- const clientManifestPath = path17.join(root, distDir, "client", "farm-client-manifest.json");
15267
- const { readFile } = await import("fs/promises");
15268
- const manifestContent = await readFile(clientManifestPath, "utf-8");
15482
+ const clientManifestPath = path18.join(root, distDir, "client", "farm-client-manifest.json");
15483
+ const { readFile: readFile2 } = await import("fs/promises");
15484
+ const manifestContent = await readFile2(clientManifestPath, "utf-8");
15269
15485
  farmRegistry.clientManifest = JSON.parse(manifestContent);
15270
15486
  } catch {
15271
15487
  farmRegistry.clientManifest = {};