@farm.js/core 0.1.73 → 0.1.74

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 (362) hide show
  1. package/dist/{agent-mcp-handler-RK7LDYEL.mjs → agent-mcp-handler-HX4F4VKN.mjs} +4 -4
  2. package/dist/{agent-mcp-handler-VBCA3WZ6.cjs → agent-mcp-handler-NRIL4JBC.cjs} +5 -5
  3. package/dist/{agent-mcp.d-PvEf-1mi.d.mts → agent-mcp.d-BEhDfdWc.d.mts} +1 -1
  4. package/dist/{agent-mcp.d-D_gHjCAE.d.ts → agent-mcp.d-CX8_oOT_.d.ts} +1 -1
  5. package/dist/agent-runtime.cjs +4 -4
  6. package/dist/agent-runtime.d.mts +4 -4
  7. package/dist/agent-runtime.d.ts +4 -4
  8. package/dist/agent-runtime.mjs +3 -3
  9. package/dist/{analyzer-MFYCJT75.mjs → analyzer-2K35LIQZ.mjs} +2 -2
  10. package/dist/analyzer-6EOYURMV.cjs +16 -0
  11. package/dist/api/client.d.mts +3 -3
  12. package/dist/api/client.d.ts +3 -3
  13. package/dist/api/client.native.d.mts +4 -4
  14. package/dist/api/client.native.d.ts +4 -4
  15. package/dist/api/node.cjs +9 -8
  16. package/dist/api/node.d.mts +6 -6
  17. package/dist/api/node.d.ts +6 -6
  18. package/dist/api/node.mjs +8 -7
  19. package/dist/api/route-manager.cjs +11 -9
  20. package/dist/api/route-manager.d.mts +9 -7
  21. package/dist/api/route-manager.d.ts +9 -7
  22. package/dist/api/route-manager.mjs +10 -8
  23. package/dist/api/runtime.cjs +8 -7
  24. package/dist/api/runtime.d.mts +5 -5
  25. package/dist/api/runtime.d.ts +5 -5
  26. package/dist/api/runtime.mjs +7 -6
  27. package/dist/{api-client.d-Bp35zMqR.d.mts → api-client.d-CyVmI4Di.d.mts} +2 -2
  28. package/dist/{api-client.d-CFI_xL0V.d.ts → api-client.d-DrTM7BdH.d.ts} +2 -2
  29. package/dist/api.cjs +13 -11
  30. package/dist/api.d.mts +9 -9
  31. package/dist/api.d.ts +9 -9
  32. package/dist/api.mjs +12 -10
  33. package/dist/{app-manifest.d-CN7cEWHX.d.mts → app-manifest.d-BcXt2yCx.d.mts} +10 -1
  34. package/dist/{app-manifest.d-BpVTg43i.d.ts → app-manifest.d-CVEx1CFB.d.ts} +10 -1
  35. package/dist/app-markdown.cjs +8 -4
  36. package/dist/app-markdown.d.mts +6 -6
  37. package/dist/app-markdown.d.ts +6 -6
  38. package/dist/app-markdown.mjs +7 -3
  39. package/dist/{app.d-DO4PTCWm.d.ts → app.d-B6i8CSrx.d.ts} +30 -4
  40. package/dist/{app.d-BFWzAdTe.d.mts → app.d-DowzSmT5.d.mts} +30 -4
  41. package/dist/cache.cjs +2 -2
  42. package/dist/cache.d.mts +8 -0
  43. package/dist/cache.d.ts +8 -0
  44. package/dist/cache.mjs +1 -1
  45. package/dist/chunk-2DOI6HLJ.cjs +284 -0
  46. package/dist/chunk-2GQBBOFH.mjs +76 -0
  47. package/dist/{chunk-5LOARKDP.cjs → chunk-2TZ3F6TN.cjs} +29 -17
  48. package/dist/{chunk-TDCP3Z4T.cjs → chunk-35GBGSQZ.cjs} +3 -3
  49. package/dist/{chunk-VPETSSWN.cjs → chunk-3BUJIPKE.cjs} +2 -2
  50. package/dist/{chunk-Y5LEPEVH.mjs → chunk-3ODLJRA6.mjs} +1 -1
  51. package/dist/{chunk-DMAP4RND.cjs → chunk-3OMLZLDE.cjs} +54 -16
  52. package/dist/{chunk-VNBDN5W2.cjs → chunk-47ZDUDN5.cjs} +64 -27
  53. package/dist/{chunk-2W4GNXGX.cjs → chunk-4AB62NMW.cjs} +2 -2
  54. package/dist/{chunk-HDPT6OYE.cjs → chunk-4M5ESTJ2.cjs} +10 -2
  55. package/dist/{chunk-TAU3OF5B.cjs → chunk-56HHUSR5.cjs} +420 -337
  56. package/dist/chunk-5XD2ULJG.mjs +114 -0
  57. package/dist/{chunk-JX5VOLAV.cjs → chunk-65OS2TOT.cjs} +4 -4
  58. package/dist/{chunk-7GMBETHM.mjs → chunk-6JEXH7N6.mjs} +1 -1
  59. package/dist/{chunk-TY5KCYDE.mjs → chunk-72NTEYCX.mjs} +10 -3
  60. package/dist/{chunk-KDOZORJD.cjs → chunk-737MIVX3.cjs} +22 -22
  61. package/dist/{chunk-ROCF6UQD.cjs → chunk-77SVUQM5.cjs} +74 -17
  62. package/dist/{chunk-CKQAQFF6.mjs → chunk-7RKHXF4P.mjs} +2 -2
  63. package/dist/{chunk-GJEC5S4V.mjs → chunk-7VCLTNED.mjs} +1 -1
  64. package/dist/{chunk-CLEWORVY.cjs → chunk-ACAEFEOH.cjs} +38 -41
  65. package/dist/{chunk-OBYM5S5G.mjs → chunk-AL6E63FZ.mjs} +2 -2
  66. package/dist/{chunk-DQ2DI3Y7.mjs → chunk-AO5IRA2N.mjs} +2 -2
  67. package/dist/{chunk-CYRIIVD4.mjs → chunk-AU5UPNOD.mjs} +2 -2
  68. package/dist/{chunk-Z3IN6GEX.mjs → chunk-B3XY6FMC.mjs} +69 -12
  69. package/dist/{chunk-U7VH3Q5E.cjs → chunk-B5WZP3T3.cjs} +15 -2
  70. package/dist/{chunk-IBVN7SW5.mjs → chunk-BFOMCSZ2.mjs} +292 -120
  71. package/dist/{chunk-I4KPA2C6.mjs → chunk-BIX46FTI.mjs} +1 -1
  72. package/dist/{chunk-YZLEOMMA.mjs → chunk-BNXV3PRM.mjs} +4 -4
  73. package/dist/{chunk-3GNVIYPO.cjs → chunk-BSJMWCWM.cjs} +7 -7
  74. package/dist/{chunk-WVQNXXNE.cjs → chunk-BWFBTTJ5.cjs} +2 -2
  75. package/dist/{chunk-FEFCISOX.cjs → chunk-CEVXKJKF.cjs} +2 -2
  76. package/dist/{chunk-B67CW2LM.mjs → chunk-CF77L6RL.mjs} +33 -36
  77. package/dist/{chunk-OB45EAQL.mjs → chunk-CXQZQK6R.mjs} +3 -2
  78. package/dist/{chunk-255J7K4X.mjs → chunk-D2IAYGYA.mjs} +1 -1
  79. package/dist/{chunk-ILQ5DKYF.cjs → chunk-D4TYE6MY.cjs} +2 -2
  80. package/dist/{chunk-4YHGQDTT.cjs → chunk-DM2YGTRH.cjs} +24 -17
  81. package/dist/{chunk-ICFPTHXM.mjs → chunk-DRBXYJZ6.mjs} +7 -3
  82. package/dist/{chunk-E3HDJCWF.mjs → chunk-DRHHTHA3.mjs} +1 -1
  83. package/dist/{chunk-YXIQYWOK.cjs → chunk-DTBRSRTR.cjs} +23 -5
  84. package/dist/{chunk-JZQS3ZOI.mjs → chunk-E4T7WJJN.mjs} +10 -2
  85. package/dist/{chunk-YAEN3L2F.cjs → chunk-EF5AP4CV.cjs} +21 -2
  86. package/dist/{chunk-SPP3EZTJ.cjs → chunk-EHJOSIXM.cjs} +137 -67
  87. package/dist/{chunk-JZBU7V4D.mjs → chunk-ELJQWUAR.mjs} +125 -55
  88. package/dist/{chunk-DMXMIE2C.cjs → chunk-ENYBDM4U.cjs} +2 -2
  89. package/dist/{chunk-ZFEJ2SF2.cjs → chunk-EWIEJQP6.cjs} +28 -28
  90. package/dist/{chunk-ODBM54RT.cjs → chunk-F244KE2D.cjs} +7 -7
  91. package/dist/{chunk-WW3LRNQV.mjs → chunk-FCBUNILW.mjs} +1 -1
  92. package/dist/{chunk-GZOKWJIW.mjs → chunk-FEQ72ZHD.mjs} +16 -9
  93. package/dist/{chunk-ME7RVELR.mjs → chunk-FGXSWRWA.mjs} +20 -1
  94. package/dist/{chunk-2AFW7673.cjs → chunk-FNWL5DMG.cjs} +4 -3
  95. package/dist/{chunk-XUSJVHHD.cjs → chunk-FYV6DTAG.cjs} +738 -485
  96. package/dist/{chunk-7PPLTD3P.cjs → chunk-G7S6XG6X.cjs} +6 -6
  97. package/dist/{chunk-AQIO3RNL.mjs → chunk-GK2GBIXD.mjs} +3 -3
  98. package/dist/{chunk-IHTDLCDJ.cjs → chunk-GRHSQYD4.cjs} +17 -4
  99. package/dist/{chunk-W44X6IC2.cjs → chunk-HBLYSWIJ.cjs} +13 -9
  100. package/dist/chunk-HK4VJI27.cjs +76 -0
  101. package/dist/{chunk-EGIY4A7V.cjs → chunk-HKZVC5GP.cjs} +2 -2
  102. package/dist/{chunk-EYPSKXO4.mjs → chunk-HRQV5Q3J.mjs} +1 -1
  103. package/dist/{chunk-S7MWSFFP.cjs → chunk-IBEHVSU4.cjs} +2 -2
  104. package/dist/{chunk-JMOCMXTQ.mjs → chunk-IG4IQMIW.mjs} +1 -1
  105. package/dist/{chunk-GPO3LJDJ.cjs → chunk-IJFNXP3D.cjs} +2 -2
  106. package/dist/{chunk-FRO4BB2T.mjs → chunk-IP2R2TAE.mjs} +1 -1
  107. package/dist/{chunk-FETMUBIA.mjs → chunk-IZ5WOTQP.mjs} +1 -1
  108. package/dist/{chunk-CSLHNBPS.cjs → chunk-J42QN7OC.cjs} +6 -6
  109. package/dist/{chunk-NDDRTFN4.mjs → chunk-J7EUGGTY.mjs} +2 -2
  110. package/dist/{chunk-MJEKMT6B.mjs → chunk-JI6N4W2I.mjs} +125 -42
  111. package/dist/{chunk-GJ7QVFAG.mjs → chunk-JOECBGY7.mjs} +1 -1
  112. package/dist/{chunk-CL52PD6D.cjs → chunk-JSUVQ5HG.cjs} +8 -8
  113. package/dist/{chunk-DZHTNSQ5.cjs → chunk-JWHRVBCZ.cjs} +14 -14
  114. package/dist/{chunk-462MUII7.mjs → chunk-JZ43UD6S.mjs} +7 -7
  115. package/dist/{chunk-RLEALQEN.mjs → chunk-KIRIFO6T.mjs} +43 -5
  116. package/dist/{chunk-XGTFLG73.cjs → chunk-KMYOKQPP.cjs} +18 -11
  117. package/dist/{chunk-WX63N6C5.mjs → chunk-KNEYWPZV.mjs} +64 -27
  118. package/dist/{chunk-XI3OXOMK.mjs → chunk-KUMKBBYP.mjs} +1 -1
  119. package/dist/{chunk-VT25ERQK.mjs → chunk-KWUZJZ23.mjs} +21 -3
  120. package/dist/{chunk-SVQX5HYW.mjs → chunk-LHFGTR7F.mjs} +2 -2
  121. package/dist/{chunk-4P5634G6.cjs → chunk-LIQJYEQP.cjs} +14 -9
  122. package/dist/chunk-LXTYJ2HW.mjs +139 -0
  123. package/dist/{chunk-5PDMBWAF.cjs → chunk-MKQ27TGW.cjs} +5 -5
  124. package/dist/{chunk-SUQACHER.mjs → chunk-MQ5HA7H2.mjs} +2 -2
  125. package/dist/{chunk-HY6IVQ54.mjs → chunk-MUITBU5Z.mjs} +1 -1
  126. package/dist/{chunk-QKEZLYON.cjs → chunk-NET6PBUH.cjs} +2 -2
  127. package/dist/{chunk-YBY34UHB.mjs → chunk-NKETXVKP.mjs} +15 -2
  128. package/dist/chunk-NRWEY2CM.mjs +25 -0
  129. package/dist/chunk-NU5XLYRN.cjs +139 -0
  130. package/dist/{chunk-HTXKSREF.cjs → chunk-NXGQIXR7.cjs} +345 -173
  131. package/dist/{chunk-PXAHSCR6.cjs → chunk-O2A6HE76.cjs} +4 -4
  132. package/dist/{chunk-OAEDVXVE.mjs → chunk-O6K4G7YA.mjs} +5 -2
  133. package/dist/{chunk-73K53YPP.mjs → chunk-OSKIG4OP.mjs} +1 -1
  134. package/dist/{chunk-OXNZUCHN.cjs → chunk-P3EZKU6L.cjs} +18 -18
  135. package/dist/{chunk-HGB4PM2C.cjs → chunk-PG6ZIHKE.cjs} +102 -30
  136. package/dist/{chunk-YZK64PZT.cjs → chunk-Q3MVNRAO.cjs} +1071 -650
  137. package/dist/{chunk-AZ6IW6SF.mjs → chunk-Q4G52OSW.mjs} +1 -1
  138. package/dist/{chunk-TPYAYFMF.cjs → chunk-QL3YZTGZ.cjs} +2 -2
  139. package/dist/{chunk-UVZMSRHF.mjs → chunk-R4BWNP73.mjs} +2 -2
  140. package/dist/{chunk-OIP62QEL.mjs → chunk-R6Q6VSGU.mjs} +24 -9
  141. package/dist/{chunk-B6RBJJ5G.mjs → chunk-RBRIKT6B.mjs} +15 -2
  142. package/dist/{chunk-C6CUUBY5.cjs → chunk-RHI67C2V.cjs} +5 -5
  143. package/dist/chunk-RK3YYUX6.cjs +114 -0
  144. package/dist/{chunk-Y2LU4LE5.mjs → chunk-ROPMQNCG.mjs} +2 -2
  145. package/dist/{chunk-QIXEU2WV.cjs → chunk-RQ4UZJPR.cjs} +3 -3
  146. package/dist/{chunk-UVQRMUAR.cjs → chunk-RSL3YFJG.cjs} +1 -1
  147. package/dist/{chunk-JWY66PID.cjs → chunk-S3D6SL2V.cjs} +9 -6
  148. package/dist/{chunk-4HGLJOXZ.cjs → chunk-TPDKFRQX.cjs} +11 -11
  149. package/dist/{chunk-6O6PAZZR.mjs → chunk-UHAARKF3.mjs} +2 -2
  150. package/dist/{chunk-QSTRBKHZ.mjs → chunk-UJWRXBVP.mjs} +2 -2
  151. package/dist/{chunk-KTDG4THT.cjs → chunk-V6T3UJAH.cjs} +7 -7
  152. package/dist/{chunk-IXZSBO76.mjs → chunk-VFPFXMTF.mjs} +1 -1
  153. package/dist/{chunk-CPMME66W.mjs → chunk-VKLV7GF4.mjs} +72 -0
  154. package/dist/{chunk-TU6VAH4V.cjs → chunk-VKRMO3EZ.cjs} +8 -8
  155. package/dist/chunk-VWIW47FW.cjs +25 -0
  156. package/dist/{chunk-LGR7565L.cjs → chunk-VZKCGHWC.cjs} +39 -24
  157. package/dist/{chunk-JWLRBDDC.cjs → chunk-WH3PBJS7.cjs} +2 -2
  158. package/dist/{chunk-QGCSUC5O.mjs → chunk-WS4SLJW5.mjs} +403 -150
  159. package/dist/{chunk-5OFNUETM.mjs → chunk-WTTJ2YS2.mjs} +9 -1
  160. package/dist/{chunk-RLFGKJQ6.mjs → chunk-X2KNHD4B.mjs} +14 -2
  161. package/dist/{chunk-5CFHQ7HM.mjs → chunk-XXKMAHYE.mjs} +1 -1
  162. package/dist/{chunk-MBCRWU3P.cjs → chunk-XZPI44Q7.cjs} +4 -4
  163. package/dist/{chunk-ACGBXN3U.cjs → chunk-Y4FEQBKY.cjs} +17 -9
  164. package/dist/{chunk-4CTCSKAF.mjs → chunk-YH33PZ3K.mjs} +1 -1
  165. package/dist/chunk-YQWRBBAA.mjs +284 -0
  166. package/dist/{chunk-REK6HZSU.mjs → chunk-YWDRWG4L.mjs} +962 -541
  167. package/dist/{chunk-E46NXBNJ.mjs → chunk-ZD7JUTBY.mjs} +11 -6
  168. package/dist/{chunk-JDO346NV.mjs → chunk-ZLRWO5GK.mjs} +1 -1
  169. package/dist/{chunk-HFUOLILA.cjs → chunk-ZRCGPSUM.cjs} +4 -4
  170. package/dist/{chunk-4Z3YLMSW.cjs → chunk-ZZGANFQH.cjs} +10 -10
  171. package/dist/client/lifecycle.d.mts +1 -1
  172. package/dist/client/lifecycle.d.ts +1 -1
  173. package/dist/{client-component.d-sF-Znk0j.d.ts → client-component.d-DYOwmq0c.d.ts} +80 -3
  174. package/dist/{client-component.d-C71rMuHF.d.mts → client-component.d-edV76QvU.d.mts} +80 -3
  175. package/dist/{client-plugins.d-MFibjgBg.d.ts → client-plugins.d-BmJYW2FY.d.ts} +19 -6
  176. package/dist/{client-plugins.d-B-Gd9mWR.d.mts → client-plugins.d-DwvqqGsU.d.mts} +19 -6
  177. package/dist/client-plugins.d.mts +4 -4
  178. package/dist/client-plugins.d.ts +4 -4
  179. package/dist/client.cjs +6 -5
  180. package/dist/client.d.mts +11 -11
  181. package/dist/client.d.ts +11 -11
  182. package/dist/client.mjs +5 -4
  183. package/dist/config.d.mts +4 -4
  184. package/dist/config.d.ts +4 -4
  185. package/dist/cron.cjs +6 -2
  186. package/dist/cron.d.mts +11 -2
  187. package/dist/cron.d.ts +11 -2
  188. package/dist/cron.mjs +7 -3
  189. package/dist/desktop.d.mts +5 -5
  190. package/dist/desktop.d.ts +5 -5
  191. package/dist/{devtools-TDIJ6HVC.mjs → devtools-WPX62NG2.mjs} +10 -9
  192. package/dist/{devtools-6K4QXFRL.cjs → devtools-YMDS7PUA.cjs} +12 -11
  193. package/dist/docs.cjs +13 -12
  194. package/dist/docs.d.mts +5 -5
  195. package/dist/docs.d.ts +5 -5
  196. package/dist/docs.mjs +12 -11
  197. package/dist/{endpoint.d-BkMSCRf6.d.mts → endpoint.d-BXbBpKoh.d.mts} +42 -1
  198. package/dist/{endpoint.d-BgHn0lhl.d.ts → endpoint.d-Dx_1k6Du.d.ts} +42 -1
  199. package/dist/environment/vite.cjs +3 -3
  200. package/dist/environment/vite.mjs +2 -2
  201. package/dist/headers.cjs +3 -3
  202. package/dist/{headers.d-uQ6BR59u.d.ts → headers.d-BIbQyAxJ.d.ts} +1 -1
  203. package/dist/{headers.d-BUxGJTsj.d.mts → headers.d-BtNxFc2s.d.mts} +1 -1
  204. package/dist/headers.mjs +2 -2
  205. package/dist/index.cjs +70 -59
  206. package/dist/{index.d-BCGfxCXY.d.ts → index.d-CQ_wUzOV.d.ts} +1 -1
  207. package/dist/{index.d-CuWOJ-un.d.mts → index.d-CQdDRXd1.d.mts} +1 -1
  208. package/dist/index.d.mts +62 -28
  209. package/dist/index.d.ts +62 -28
  210. package/dist/index.mjs +66 -55
  211. package/dist/integrations/orm.d.mts +4 -4
  212. package/dist/integrations/orm.d.ts +4 -4
  213. package/dist/integrations.cjs +4 -4
  214. package/dist/integrations.d.mts +4 -4
  215. package/dist/integrations.d.ts +4 -4
  216. package/dist/integrations.mjs +3 -3
  217. package/dist/internal/app-markdown-runtime.cjs +7 -3
  218. package/dist/internal/app-markdown-runtime.d.mts +17 -6
  219. package/dist/internal/app-markdown-runtime.d.ts +17 -6
  220. package/dist/internal/app-markdown-runtime.mjs +6 -2
  221. package/dist/internal/build-runtime.cjs +41 -39
  222. package/dist/internal/build-runtime.d.mts +6 -6
  223. package/dist/internal/build-runtime.d.ts +6 -6
  224. package/dist/internal/build-runtime.mjs +40 -38
  225. package/dist/internal/cli-runtime.cjs +20 -19
  226. package/dist/internal/cli-runtime.mjs +19 -18
  227. package/dist/internal/client-error-overlay.cjs +6 -6
  228. package/dist/internal/client-error-overlay.mjs +2 -2
  229. package/dist/internal/client-runtime.cjs +6 -2
  230. package/dist/internal/client-runtime.d.mts +21 -9
  231. package/dist/internal/client-runtime.d.ts +21 -9
  232. package/dist/internal/client-runtime.mjs +5 -1
  233. package/dist/internal/compression-runtime.d.mts +4 -4
  234. package/dist/internal/compression-runtime.d.ts +4 -4
  235. package/dist/internal/config-runtime.cjs +12 -11
  236. package/dist/internal/config-runtime.d.mts +6 -6
  237. package/dist/internal/config-runtime.d.ts +6 -6
  238. package/dist/internal/config-runtime.mjs +11 -10
  239. package/dist/internal/form-actions.cjs +5 -4
  240. package/dist/internal/form-actions.d.mts +2 -2
  241. package/dist/internal/form-actions.d.ts +2 -2
  242. package/dist/internal/form-actions.mjs +4 -3
  243. package/dist/internal/infra-analytics-runtime.cjs +10 -10
  244. package/dist/internal/infra-analytics-runtime.mjs +8 -8
  245. package/dist/internal/native-server-fns.cjs +4 -4
  246. package/dist/internal/native-server-fns.mjs +3 -3
  247. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  248. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  249. package/dist/internal/production-runtime.cjs +32 -22
  250. package/dist/internal/production-runtime.d.mts +64 -13
  251. package/dist/internal/production-runtime.d.ts +64 -13
  252. package/dist/internal/production-runtime.mjs +31 -21
  253. package/dist/internal/react-cache.cjs +3 -3
  254. package/dist/internal/react-cache.mjs +1 -1
  255. package/dist/internal/vercel-edge-middleware.cjs +4 -4
  256. package/dist/internal/vercel-edge-middleware.mjs +3 -3
  257. package/dist/{lifecycle.d-keQs5Swc.d.mts → lifecycle.d-OtGWAvJT.d.mts} +4 -0
  258. package/dist/{lifecycle.d-keQs5Swc.d.ts → lifecycle.d-OtGWAvJT.d.ts} +4 -0
  259. package/dist/{manager-JIA66YJ2.mjs → manager-RHB2P35B.mjs} +4 -1
  260. package/dist/{manager-JOHU6BQI.cjs → manager-S77ZARTC.cjs} +5 -2
  261. package/dist/markdown.cjs +2 -2
  262. package/dist/markdown.d.mts +4 -4
  263. package/dist/markdown.d.ts +4 -4
  264. package/dist/markdown.mjs +1 -1
  265. package/dist/middleware.cjs +6 -6
  266. package/dist/middleware.d.mts +4 -4
  267. package/dist/middleware.d.ts +4 -4
  268. package/dist/middleware.mjs +5 -5
  269. package/dist/{mount.d-BIYmcGGg.d.mts → mount.d-6bhpBQQB.d.mts} +1 -1
  270. package/dist/{mount.d-q8k0cJV0.d.ts → mount.d-C-u7rFkM.d.ts} +1 -1
  271. package/dist/{native-server-fn-handler-EP5AFJYE.mjs → native-server-fn-handler-I66X4E5S.mjs} +6 -5
  272. package/dist/{native-server-fn-handler-QRTXGZA4.cjs → native-server-fn-handler-W4FSD76W.cjs} +7 -6
  273. package/dist/{native-tree-OYGKP2NZ.mjs → native-tree-3X23BT3N.mjs} +2 -2
  274. package/dist/{native-tree-R6CQMDTI.cjs → native-tree-TAPKR7QJ.cjs} +3 -3
  275. package/dist/{navigation-delegate.d-CYBUupsv.d.mts → navigation-delegate.d-nx6gtsY4.d.mts} +1 -1
  276. package/dist/{navigation-delegate.d-Btfs6Uoa.d.ts → navigation-delegate.d-xsG4T1x-.d.ts} +1 -1
  277. package/dist/navigation.cjs +4 -4
  278. package/dist/navigation.d.mts +7 -7
  279. package/dist/navigation.d.ts +7 -7
  280. package/dist/navigation.mjs +3 -3
  281. package/dist/{nitro-2LMOMIST.cjs → nitro-SSFTPZMW.cjs} +4 -4
  282. package/dist/{nitro-72TFIGGO.mjs → nitro-XTQ2HKDL.mjs} +1 -1
  283. package/dist/plugin.cjs +36 -33
  284. package/dist/plugin.d.mts +7 -7
  285. package/dist/plugin.d.ts +7 -7
  286. package/dist/plugin.mjs +35 -32
  287. package/dist/query/client.cjs +5 -5
  288. package/dist/query/client.mjs +1 -1
  289. package/dist/{render-plan.d-BlyxqKMu.d.mts → render-plan.d-B5y3h97B.d.mts} +1 -1
  290. package/dist/{render-plan.d-0FHusf1D.d.ts → render-plan.d-gW0fwKz2.d.ts} +1 -1
  291. package/dist/renderer-client.cjs +4 -4
  292. package/dist/renderer-client.d.mts +7 -7
  293. package/dist/renderer-client.d.ts +7 -7
  294. package/dist/renderer-client.mjs +1 -1
  295. package/dist/request.cjs +2 -2
  296. package/dist/{request.d-CX-gks1l.d.mts → request.d-B0ugAadD.d.ts} +9 -2
  297. package/dist/{request.d-CPdVjssg.d.ts → request.d-DLq33nYo.d.mts} +9 -2
  298. package/dist/request.d.mts +5 -5
  299. package/dist/request.d.ts +5 -5
  300. package/dist/request.mjs +1 -1
  301. package/dist/{route-rendering.d-CcvZ_4N2.d.mts → route-rendering.d-DSeIV7yV.d.mts} +1 -1
  302. package/dist/{route-rendering.d-DcOoSNoG.d.ts → route-rendering.d-ytaqDQD6.d.ts} +1 -1
  303. package/dist/{route.d-DrXkpvcg.d.mts → route.d-Cd4Fi6BA.d.ts} +3 -1
  304. package/dist/{route.d-hs-_cyHn.d.ts → route.d-ShmtqqVQ.d.mts} +3 -1
  305. package/dist/{router.d-D2QnK8cM.d.ts → router.d-BaEAEGPg.d.ts} +1 -1
  306. package/dist/{router.d-C8RHma4A.d.mts → router.d-Chd5cpe3.d.mts} +1 -1
  307. package/dist/routes.cjs +5 -3
  308. package/dist/routes.d.mts +4 -4
  309. package/dist/routes.d.ts +4 -4
  310. package/dist/routes.mjs +4 -2
  311. package/dist/{rsc-pipeline-LC2FBZAR.mjs → rsc-pipeline-DPMYONEV.mjs} +12 -11
  312. package/dist/{rsc-pipeline-NTAM65NT.cjs → rsc-pipeline-XIUUMMG5.cjs} +13 -12
  313. package/dist/{runtime-U4PAMTVH.cjs → runtime-WD77S3C5.cjs} +25 -25
  314. package/dist/{runtime-MWAC7NWR.mjs → runtime-XIUJZTZ3.mjs} +16 -16
  315. package/dist/{runtime.d-BQUHHq8M.d.mts → runtime.d-DpCs0eAO.d.mts} +3 -3
  316. package/dist/{runtime.d-1l_1bLrL.d.ts → runtime.d-h2USyQsz.d.ts} +3 -3
  317. package/dist/server-action-security.cjs +5 -3
  318. package/dist/server-action-security.d.mts +11 -3
  319. package/dist/server-action-security.d.ts +11 -3
  320. package/dist/server-action-security.mjs +4 -2
  321. package/dist/server-fn-client.d.mts +3 -3
  322. package/dist/server-fn-client.d.ts +3 -3
  323. package/dist/server-fn.cjs +6 -5
  324. package/dist/server-fn.d.mts +1 -1
  325. package/dist/server-fn.d.ts +1 -1
  326. package/dist/server-fn.mjs +5 -4
  327. package/dist/server-plugins.cjs +4 -4
  328. package/dist/server-plugins.d.mts +53 -9
  329. package/dist/server-plugins.d.ts +53 -9
  330. package/dist/server-plugins.mjs +3 -3
  331. package/dist/server-query-client.d.mts +1 -1
  332. package/dist/server-query-client.d.ts +1 -1
  333. package/dist/server-query.cjs +7 -6
  334. package/dist/server-query.d.mts +1 -1
  335. package/dist/server-query.d.ts +1 -1
  336. package/dist/server-query.mjs +6 -5
  337. package/dist/server.cjs +62 -67
  338. package/dist/server.d.mts +14 -14
  339. package/dist/server.d.ts +14 -14
  340. package/dist/server.mjs +41 -46
  341. package/dist/{spa-router.d-BzPdi48R.d.mts → spa-router.d-DCQVtEaE.d.mts} +11 -5
  342. package/dist/{spa-router.d-BJtXNeqo.d.ts → spa-router.d-DpdJHs1q.d.ts} +11 -5
  343. package/dist/testing.cjs +16 -14
  344. package/dist/testing.d.mts +4 -4
  345. package/dist/testing.d.ts +4 -4
  346. package/dist/testing.mjs +12 -10
  347. package/dist/theme/server.cjs +3 -3
  348. package/dist/theme/server.mjs +2 -2
  349. package/dist/{utils.d-B4ZW-6z6.d.mts → utils.d-DKDZtAY5.d.mts} +1 -1
  350. package/dist/{utils.d-DquC6qxy.d.ts → utils.d-DmicwMvS.d.ts} +1 -1
  351. package/dist/version.cjs +2 -2
  352. package/dist/version.mjs +1 -1
  353. package/dist/vite.cjs +36 -33
  354. package/dist/vite.d.mts +13 -8
  355. package/dist/vite.d.ts +13 -8
  356. package/dist/vite.mjs +35 -32
  357. package/package.json +1 -1
  358. package/dist/analyzer-V5ZMRIIY.cjs +0 -16
  359. package/dist/chunk-6I4BFRE7.cjs +0 -51
  360. package/dist/chunk-EIVGPQN5.mjs +0 -51
  361. /package/dist/{chunk-QEJWNXRI.cjs → chunk-EMRYJG4U.cjs} +0 -0
  362. /package/dist/{chunk-TXE4SAMV.mjs → chunk-H2ZJ35NW.mjs} +0 -0
@@ -21,23 +21,139 @@ import {
21
21
  } from "./chunk-JSDV2NUN.mjs";
22
22
  import {
23
23
  FARM_VERSION
24
- } from "./chunk-JMOCMXTQ.mjs";
24
+ } from "./chunk-IG4IQMIW.mjs";
25
25
 
26
26
  // src/environment-vite.ts
27
27
  import { existsSync, readFileSync, realpathSync } from "fs";
28
- import path6 from "path";
28
+ import path8 from "path";
29
+
30
+ // src/diagnostics.ts
31
+ import { TraceMap, originalPositionFor } from "@jridgewell/trace-mapping";
32
+ import path from "path";
33
+ var BOUNDARY_DOCS = "/docs/environment-functions#boundary-diagnostics";
34
+ var FARM_DIAGNOSTIC_RULES = {
35
+ CLIENT_SERVER_ENV: {
36
+ severity: "warning",
37
+ fix: "Read it on the server (a server function, API route, or server component), or declare it in env.public in farm.config.ts and read it through publicEnv.",
38
+ docs: BOUNDARY_DOCS
39
+ },
40
+ CLIENT_PROCESS_ENV_PUBLIC: {
41
+ severity: "warning",
42
+ fix: 'Read it through publicEnv from "@farm.js/core/env".',
43
+ docs: BOUNDARY_DOCS
44
+ },
45
+ CLIENT_NODE_BUILTIN: {
46
+ severity: "warning",
47
+ fix: "Move the import into server-only code, or import it lazily inside a function that runs only on the server.",
48
+ docs: BOUNDARY_DOCS
49
+ },
50
+ CLIENT_SERVER_FUNCTION: {
51
+ severity: "error",
52
+ fix: "Add @farm.js/plugin/rsc and set experimental.serverActions: true so client imports become server references, or call it from server code, or expose an API route and call it with createAPIClient.",
53
+ docs: BOUNDARY_DOCS
54
+ },
55
+ CLIENT_SERVER_ONLY_IMPORT: {
56
+ severity: "error",
57
+ fix: "Move what the client needs out of that module, or call it from a server component, server function, or API route.",
58
+ docs: BOUNDARY_DOCS
59
+ },
60
+ CLIENT_SERVER_ONLY_ENTRY: {
61
+ severity: "error",
62
+ fix: "Use it from an API route or another server module.",
63
+ docs: BOUNDARY_DOCS
64
+ },
65
+ CLIENT_ROUTES_FILE: {
66
+ severity: "error",
67
+ fix: "Import the component, server function, or helper from its own module instead of from the module that defines routes.",
68
+ docs: BOUNDARY_DOCS
69
+ },
70
+ CLIENT_ROUTE_SERVER_IMPORT: {
71
+ severity: "error",
72
+ fix: "Keep server-only imports in the routes file, or in modules only its guard, data, and API handlers use.",
73
+ docs: BOUNDARY_DOCS
74
+ },
75
+ SERVER_CLIENT_ONLY_IMPORT: {
76
+ severity: "error",
77
+ fix: 'Add "use client" to this module, or import the package from a "use client" module.',
78
+ docs: BOUNDARY_DOCS
79
+ }
80
+ };
81
+ var FARM_DOCS_ORIGIN = "https://farmjs.dev";
82
+ function createFarmDiagnostic(code, file, message, location) {
83
+ const rule = FARM_DIAGNOSTIC_RULES[code];
84
+ return {
85
+ code,
86
+ severity: rule.severity,
87
+ file: file.split("?", 1)[0].replace(/\\/g, "/"),
88
+ ...location,
89
+ message,
90
+ fix: rule.fix,
91
+ docs: FARM_DOCS_ORIGIN + rule.docs
92
+ };
93
+ }
94
+ function formatFarmDiagnostic(diagnostic, root) {
95
+ let file = diagnostic.file;
96
+ if (root) {
97
+ const relative = path.relative(root, file).replace(/\\/g, "/");
98
+ if (relative && !relative.startsWith("../") && !path.isAbsolute(relative)) file = relative;
99
+ }
100
+ const position = diagnostic.line === void 0 ? "" : `:${diagnostic.line}:${diagnostic.column ?? 1}`;
101
+ return [
102
+ `${file}${position} - ${diagnostic.severity} ${diagnostic.code}: ${diagnostic.message}`,
103
+ ` fix: ${diagnostic.fix}`,
104
+ ` docs: ${diagnostic.docs}`
105
+ ].join("\n");
106
+ }
107
+ function createFarmSourceLocator(code, getCombinedSourcemap) {
108
+ let trace2;
109
+ let lineStarts;
110
+ return (offset) => {
111
+ if (trace2 === void 0) {
112
+ try {
113
+ const map = getCombinedSourcemap();
114
+ trace2 = map ? new TraceMap(map) : null;
115
+ } catch {
116
+ trace2 = null;
117
+ }
118
+ }
119
+ if (!trace2) return void 0;
120
+ if (!lineStarts) {
121
+ lineStarts = [0];
122
+ for (let index = code.indexOf("\n"); index !== -1; index = code.indexOf("\n", index + 1)) {
123
+ lineStarts.push(index + 1);
124
+ }
125
+ }
126
+ let low = 0;
127
+ let high = lineStarts.length - 1;
128
+ while (low < high) {
129
+ const middle = low + high + 1 >> 1;
130
+ if (lineStarts[middle] <= offset) low = middle;
131
+ else high = middle - 1;
132
+ }
133
+ const original = originalPositionFor(trace2, {
134
+ line: low + 1,
135
+ column: offset - lineStarts[low]
136
+ });
137
+ return original.line === null ? void 0 : { line: original.line, column: (original.column ?? 0) + 1 };
138
+ };
139
+ }
29
140
 
30
141
  // src/islands-react-server-exports.ts
31
142
  import fs2 from "fs";
32
- import path from "path";
143
+ import path3 from "path";
33
144
  import { parseAst } from "rolldown/parseAst";
34
145
 
35
146
  // src/utils/source-snapshot.ts
36
147
  import fs from "fs";
148
+ import path2 from "path";
37
149
  var snapshot;
150
+ var base;
38
151
  var volatile;
39
152
  var trace;
40
- function stampOf(file) {
153
+ function farmSourceSnapshotPathKey(file, paths = path2) {
154
+ return paths.resolve(file);
155
+ }
156
+ function getFarmSourceStamp(file) {
41
157
  try {
42
158
  const stat = fs.statSync(file);
43
159
  return `${stat.mtimeMs}:${stat.size}`;
@@ -46,7 +162,12 @@ function stampOf(file) {
46
162
  }
47
163
  }
48
164
  var FarmSourceSnapshotStore = class {
49
- constructor() {
165
+ /**
166
+ * `tracked: false` keeps entries for a process that edits no sources while it runs, a production
167
+ * build: nothing is stamped, so each plan does not stat every file the snapshot holds.
168
+ */
169
+ constructor(tracked = true) {
170
+ this.tracked = tracked;
50
171
  this.entries = /* @__PURE__ */ new Map();
51
172
  this.stamps = /* @__PURE__ */ new Map();
52
173
  }
@@ -59,7 +180,7 @@ var FarmSourceSnapshotStore = class {
59
180
  const changed = /* @__PURE__ */ new Map();
60
181
  for (const file of edited) changed.set(file, void 0);
61
182
  for (const [file, stamp] of this.stamps) {
62
- if (stampOf(file) !== stamp) changed.set(file, void 0);
183
+ if (getFarmSourceStamp(file) !== stamp) changed.set(file, void 0);
63
184
  }
64
185
  if (changed.size === 0) return changed;
65
186
  const replaced = /* @__PURE__ */ new Set();
@@ -85,10 +206,11 @@ var FarmSourceSnapshotStore = class {
85
206
  }
86
207
  /** Records the stamp of every file an entry read that has none yet. */
87
208
  stamp() {
209
+ if (!this.tracked) return;
88
210
  for (const entries of this.entries.values()) {
89
211
  for (const entry of entries.values()) {
90
212
  for (const file of entry.files) {
91
- if (!this.stamps.has(file)) this.stamps.set(file, stampOf(file));
213
+ if (!this.stamps.has(file)) this.stamps.set(file, getFarmSourceStamp(file));
92
214
  }
93
215
  }
94
216
  }
@@ -112,11 +234,20 @@ function withFarmSourceSnapshot(operation, store) {
112
234
  store?.stamp();
113
235
  }
114
236
  }
237
+ function withFarmSourceSnapshotOf(store, operation) {
238
+ if (snapshot) return operation();
239
+ base = store.entries;
240
+ try {
241
+ return withFarmSourceSnapshot(operation);
242
+ } finally {
243
+ base = void 0;
244
+ }
245
+ }
115
246
  function memoizeInFarmSourceSnapshot(scope, key, compute, lasting) {
116
247
  if (!snapshot) return compute();
117
248
  let entries = snapshot.get(scope);
118
249
  if (!entries) snapshot.set(scope, entries = /* @__PURE__ */ new Map());
119
- const memoized = entries.get(key);
250
+ const memoized = entries.get(key) ?? base?.get(scope)?.get(key);
120
251
  if (memoized) {
121
252
  if (trace) for (const file of memoized.files) trace.add(file);
122
253
  return memoized.value;
@@ -165,10 +296,10 @@ function packageNameOf(specifier) {
165
296
  return { name, subpath: parts.slice(name.startsWith("@") ? 2 : 1).join("/") };
166
297
  }
167
298
  function findPackageDirectory(importer, name) {
168
- for (let current = path.dirname(importer); ; current = path.dirname(current)) {
169
- const directory = path.join(current, "node_modules", name);
170
- if (fs2.existsSync(path.join(directory, "package.json"))) return fs2.realpathSync(directory);
171
- if (path.dirname(current) === current) return null;
299
+ for (let current = path3.dirname(importer); ; current = path3.dirname(current)) {
300
+ const directory = path3.join(current, "node_modules", name);
301
+ if (fs2.existsSync(path3.join(directory, "package.json"))) return fs2.realpathSync(directory);
302
+ if (path3.dirname(current) === current) return null;
172
303
  }
173
304
  }
174
305
  function pickTarget(value, conditions) {
@@ -225,12 +356,12 @@ function resolveFarmReactServerExport(importer, specifier) {
225
356
  if (cache.has(key)) return cache.get(key);
226
357
  let resolved = null;
227
358
  try {
228
- const manifest = JSON.parse(fs2.readFileSync(path.join(directory, "package.json"), "utf8"));
359
+ const manifest = JSON.parse(fs2.readFileSync(path3.join(directory, "package.json"), "utf8"));
229
360
  const entry = exportEntry(manifest.exports, parsed.subpath);
230
361
  const server = pickTarget(entry, SERVER_CONDITIONS);
231
362
  const fallback = pickTarget(entry, DEFAULT_CONDITIONS);
232
363
  if (server && server !== fallback && server.startsWith("./")) {
233
- const file = path.resolve(directory, server);
364
+ const file = path3.resolve(directory, server);
234
365
  if (fs2.existsSync(file)) resolved = file;
235
366
  }
236
367
  } catch {
@@ -253,7 +384,7 @@ function readModule(file) {
253
384
  let program = null;
254
385
  try {
255
386
  const code = fs2.readFileSync(file, "utf8");
256
- const extension = path.extname(file).slice(1);
387
+ const extension = path3.extname(file).slice(1);
257
388
  const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : "tsx";
258
389
  program = parseAst(code, { lang });
259
390
  } catch {
@@ -270,13 +401,13 @@ function isClientModule(program) {
270
401
  return false;
271
402
  }
272
403
  function resolveRelative(from, specifier) {
273
- const base = path.resolve(path.dirname(from), specifier);
404
+ const base2 = path3.resolve(path3.dirname(from), specifier);
274
405
  for (const extension of SCRIPT_EXTENSIONS) {
275
- const file = `${base}${extension}`;
406
+ const file = `${base2}${extension}`;
276
407
  if (fs2.existsSync(file) && fs2.statSync(file).isFile()) return file;
277
408
  }
278
409
  for (const index of INDEX_FILES) {
279
- const file = path.join(base, index);
410
+ const file = path3.join(base2, index);
280
411
  if (fs2.existsSync(file)) return file;
281
412
  }
282
413
  return null;
@@ -290,10 +421,10 @@ function resolveFarmPackageDefaultEntry(importer, specifier, conditions = ["brow
290
421
  const directory = findPackageDirectory(importer, parsed.name);
291
422
  if (!directory) return null;
292
423
  try {
293
- const manifest = JSON.parse(fs2.readFileSync(path.join(directory, "package.json"), "utf8"));
424
+ const manifest = JSON.parse(fs2.readFileSync(path3.join(directory, "package.json"), "utf8"));
294
425
  const target = pickTarget(exportEntry(manifest.exports, parsed.subpath), conditions) ?? (!parsed.subpath ? manifest.module ?? manifest.main ?? "index.js" : parsed.subpath);
295
426
  return resolveRelative(
296
- path.join(directory, "package.json"),
427
+ path3.join(directory, "package.json"),
297
428
  `./${String(target).replace(/^\.\//, "")}`
298
429
  );
299
430
  } catch {
@@ -372,7 +503,7 @@ function isFarmClientExport(file, name) {
372
503
  function isFarmPackageClientExport(importer, specifier, name) {
373
504
  return memoizeInFarmSourceSnapshot(
374
505
  "package-client-export",
375
- `${path.dirname(importer)}\0${specifier}\0${name}`,
506
+ `${farmSourceSnapshotPathKey(path3.dirname(importer))}\0${specifier}\0${name}`,
376
507
  () => {
377
508
  const entry = resolveFarmPackageDefaultEntry(importer, specifier);
378
509
  return !entry || traceFarmExport(entry, name) !== "server";
@@ -380,13 +511,15 @@ function isFarmPackageClientExport(importer, specifier, name) {
380
511
  );
381
512
  }
382
513
  function parseCode(code, file) {
383
- const extension = path.extname(file).slice(1);
514
+ const extension = path3.extname(file).slice(1);
384
515
  const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : "tsx";
385
- try {
386
- return parseAst(code, { lang });
387
- } catch {
388
- return null;
389
- }
516
+ return memoizeInFarmSourceSnapshot(`ast:${lang}`, code, () => {
517
+ try {
518
+ return parseAst(code, { lang });
519
+ } catch {
520
+ return null;
521
+ }
522
+ });
390
523
  }
391
524
  function namespaceMembers(program, local) {
392
525
  const members = /* @__PURE__ */ new Set();
@@ -672,7 +805,7 @@ function scanPackage(directory) {
672
805
  }
673
806
  for (const entry of entries) {
674
807
  if (entry.name === "node_modules" || entry.name.startsWith(".")) continue;
675
- const file = path.join(current, entry.name);
808
+ const file = path3.join(current, entry.name);
676
809
  if (entry.isDirectory()) pending.push(file);
677
810
  else if (/\.(?:[cm]?js|jsx)$/.test(entry.name) && scanned++ < MAX_SCANNED_FILES) {
678
811
  let code;
@@ -697,8 +830,8 @@ function findFarmServerBundledPackage(importer, specifier) {
697
830
  const directory = findPackageDirectory(importer, parsed.name);
698
831
  if (!directory) return null;
699
832
  try {
700
- const manifest = JSON.parse(fs2.readFileSync(path.join(directory, "package.json"), "utf8"));
701
- if (manifest.exports === void 0 && manifest.type !== "module" && typeof manifest.module === "string" && typeof manifest.main === "string" && path.resolve(directory, manifest.main) !== path.resolve(directory, manifest.module)) {
833
+ const manifest = JSON.parse(fs2.readFileSync(path3.join(directory, "package.json"), "utf8"));
834
+ if (manifest.exports === void 0 && manifest.type !== "module" && typeof manifest.module === "string" && typeof manifest.main === "string" && path3.resolve(directory, manifest.main) !== path3.resolve(directory, manifest.module)) {
702
835
  return { name: parsed.name, prebundle: isSelfContainedPackage(manifest, importer) };
703
836
  }
704
837
  } catch {
@@ -719,7 +852,7 @@ function findFarmPackageManifest(importer, specifier) {
719
852
  if (!directory) return null;
720
853
  let names;
721
854
  try {
722
- const manifest = JSON.parse(fs2.readFileSync(path.join(directory, "package.json"), "utf8"));
855
+ const manifest = JSON.parse(fs2.readFileSync(path3.join(directory, "package.json"), "utf8"));
723
856
  names = new Set(Object.keys(manifest.dependencies ?? {}));
724
857
  } catch {
725
858
  return null;
@@ -1326,13 +1459,13 @@ function toModuleFile(file) {
1326
1459
 
1327
1460
  // src/utils/client-component.ts
1328
1461
  import fs6 from "fs";
1329
- import path5 from "path";
1462
+ import path7 from "path";
1330
1463
  import { fileURLToPath as fileURLToPath2 } from "url";
1331
1464
 
1332
1465
  // src/islands-package-references.ts
1333
1466
  import { createHash } from "crypto";
1334
1467
  import fs3 from "fs";
1335
- import path2 from "path";
1468
+ import path4 from "path";
1336
1469
  import { parseAst as parseAst2 } from "rolldown/parseAst";
1337
1470
  var IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
1338
1471
  var moduleName = (node) => {
@@ -1340,7 +1473,7 @@ var moduleName = (node) => {
1340
1473
  return typeof name === "string" ? name : null;
1341
1474
  };
1342
1475
  function parse(code, file) {
1343
- const extension = path2.extname(file).slice(1);
1476
+ const extension = path4.extname(file).slice(1);
1344
1477
  const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : "tsx";
1345
1478
  return memoizeInFarmSourceSnapshot(`ast:${lang}`, code, () => parseAs(code, lang));
1346
1479
  }
@@ -1457,18 +1590,18 @@ function parseFarmResolveFrom(id, importer) {
1457
1590
  const rest = id.slice(FARM_RESOLVE_FROM_PREFIX.length);
1458
1591
  const separator = rest.indexOf(":");
1459
1592
  if (separator <= 0) return null;
1460
- const directory = path2.resolve(
1461
- path2.dirname(importer),
1593
+ const directory = path4.resolve(
1594
+ path4.dirname(importer),
1462
1595
  decodeURIComponent(rest.slice(0, separator))
1463
1596
  );
1464
1597
  return {
1465
1598
  specifier: rest.slice(separator + 1),
1466
- importer: path2.join(directory, "__farm_client_reference__.js")
1599
+ importer: path4.join(directory, "__farm_client_reference__.js")
1467
1600
  };
1468
1601
  }
1469
1602
  function farmPackageClientReferencePath(root, specifier, exportName, scope) {
1470
1603
  const directory = specifier.replace(/^@/, "").replace(/[^A-Za-z0-9._-]/g, "+");
1471
- return path2.join(
1604
+ return path4.join(
1472
1605
  root,
1473
1606
  ".farm",
1474
1607
  "client-references",
@@ -1482,22 +1615,22 @@ function specifierPackage(specifier) {
1482
1615
  return specifier.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
1483
1616
  }
1484
1617
  function packageLookup(directory, packageName) {
1485
- for (let current = directory; ; current = path2.dirname(current)) {
1486
- if (path2.basename(current) !== "node_modules") {
1487
- const candidate = path2.join(current, "node_modules", packageName);
1618
+ for (let current = directory; ; current = path4.dirname(current)) {
1619
+ if (path4.basename(current) !== "node_modules") {
1620
+ const candidate = path4.join(current, "node_modules", packageName);
1488
1621
  try {
1489
1622
  return { from: current, real: fs3.realpathSync(candidate) };
1490
1623
  } catch {
1491
1624
  }
1492
1625
  }
1493
- if (path2.dirname(current) === current) return null;
1626
+ if (path4.dirname(current) === current) return null;
1494
1627
  }
1495
1628
  }
1496
1629
  function referenceResolveFrom(root, specifier, importer) {
1497
1630
  const packageName = specifierPackage(specifier);
1498
- const own = packageLookup(path2.dirname(importer), packageName);
1631
+ const own = packageLookup(path4.dirname(importer), packageName);
1499
1632
  if (!own) return null;
1500
- const app = packageLookup(path2.join(root, ".farm", "client-references"), packageName);
1633
+ const app = packageLookup(path4.join(root, ".farm", "client-references"), packageName);
1501
1634
  if (app?.real === own.real) return null;
1502
1635
  try {
1503
1636
  return fs3.realpathSync(own.from);
@@ -1507,11 +1640,11 @@ function referenceResolveFrom(root, specifier, importer) {
1507
1640
  }
1508
1641
  function ensureFarmPackageClientReference(root, specifier, exportName, importer) {
1509
1642
  const resolveFrom = importer ? referenceResolveFrom(root, specifier, importer) : null;
1510
- const scope = resolveFrom ? `__from__${createHash("sha256").update(path2.relative(root, resolveFrom).split(path2.sep).join("/")).digest("hex").slice(0, 8)}` : void 0;
1643
+ const scope = resolveFrom ? `__from__${createHash("sha256").update(path4.relative(root, resolveFrom).split(path4.sep).join("/")).digest("hex").slice(0, 8)}` : void 0;
1511
1644
  const file = farmPackageClientReferencePath(root, specifier, exportName, scope);
1512
1645
  const target = JSON.stringify(
1513
1646
  resolveFrom ? `${FARM_RESOLVE_FROM_PREFIX}${encodeURIComponent(
1514
- path2.relative(path2.dirname(file), resolveFrom).split(path2.sep).join("/")
1647
+ path4.relative(path4.dirname(file), resolveFrom).split(path4.sep).join("/")
1515
1648
  )}:${specifier}` : specifier
1516
1649
  );
1517
1650
  const source = [
@@ -1530,7 +1663,7 @@ function ensureFarmPackageClientReference(root, specifier, exportName, importer)
1530
1663
  } catch {
1531
1664
  }
1532
1665
  if (current !== source) {
1533
- fs3.mkdirSync(path2.dirname(file), { recursive: true });
1666
+ fs3.mkdirSync(path4.dirname(file), { recursive: true });
1534
1667
  fs3.writeFileSync(file, source);
1535
1668
  }
1536
1669
  return file;
@@ -1542,18 +1675,18 @@ function writeIfChanged(file, source) {
1542
1675
  } catch {
1543
1676
  }
1544
1677
  if (current !== source) {
1545
- fs3.mkdirSync(path2.dirname(file), { recursive: true });
1678
+ fs3.mkdirSync(path4.dirname(file), { recursive: true });
1546
1679
  fs3.writeFileSync(file, source);
1547
1680
  }
1548
1681
  }
1549
1682
  function owningPackage(file) {
1550
- for (let current = path2.dirname(file); ; current = path2.dirname(current)) {
1683
+ for (let current = path4.dirname(file); ; current = path4.dirname(current)) {
1551
1684
  try {
1552
- const manifest = JSON.parse(fs3.readFileSync(path2.join(current, "package.json"), "utf8"));
1685
+ const manifest = JSON.parse(fs3.readFileSync(path4.join(current, "package.json"), "utf8"));
1553
1686
  if (typeof manifest.name === "string") return { directory: current, name: manifest.name };
1554
1687
  } catch {
1555
1688
  }
1556
- if (path2.dirname(current) === current) return null;
1689
+ if (path4.dirname(current) === current) return null;
1557
1690
  }
1558
1691
  }
1559
1692
  function ensureFarmInternalClientReference(root, clientFile) {
@@ -1562,8 +1695,8 @@ function ensureFarmInternalClientReference(root, clientFile) {
1562
1695
  if (!owner || !names || names.length === 0) return null;
1563
1696
  const directory = owner.name.replace(/^@/, "").replace(/[^A-Za-z0-9._-]/g, "+");
1564
1697
  const hash = createHash("sha256").update(owner.directory).digest("hex").slice(0, 8);
1565
- const relative = path2.relative(owner.directory, clientFile).split(path2.sep).join("+").replace(/[^A-Za-z0-9._+-]/g, "_");
1566
- const file = path2.join(
1698
+ const relative = path4.relative(owner.directory, clientFile).split(path4.sep).join("+").replace(/[^A-Za-z0-9._+-]/g, "_");
1699
+ const file = path4.join(
1567
1700
  root,
1568
1701
  ".farm",
1569
1702
  "client-references",
@@ -1573,7 +1706,7 @@ function ensureFarmInternalClientReference(root, clientFile) {
1573
1706
  );
1574
1707
  const target = JSON.stringify(clientFile);
1575
1708
  const lines = [
1576
- `// Generated by Farm: ${owner.name}'s ${path2.relative(owner.directory, clientFile).split(path2.sep).join("/")}, as a client reference for server components.`,
1709
+ `// Generated by Farm: ${owner.name}'s ${path4.relative(owner.directory, clientFile).split(path4.sep).join("/")}, as a client reference for server components.`,
1577
1710
  FARM_CLIENT_REFERENCE_PRAGMA,
1578
1711
  '"use client";'
1579
1712
  ];
@@ -1636,7 +1769,7 @@ function rewriteFarmPackageClientImports(options) {
1636
1769
 
1637
1770
  // src/islands-containers.ts
1638
1771
  import fs4 from "fs";
1639
- import path3 from "path";
1772
+ import path5 from "path";
1640
1773
  import { parseAst as parseAst3 } from "rolldown/parseAst";
1641
1774
  var FARM_ISLAND_CONTAINER_EXPORT = "FarmIslandContainer";
1642
1775
  var CONTAINER_LOCAL = "__FarmIslandContainer__";
@@ -1655,7 +1788,7 @@ var ISLAND_CONTAINER_TAGS = /* @__PURE__ */ new Set([
1655
1788
  ]);
1656
1789
  var FLOW_CONTENT_TAGS = /* @__PURE__ */ new Set(["td", "th", "caption", "foreignObject", "li"]);
1657
1790
  function farmIslandContainerReferencePath(root) {
1658
- return path3.join(root, ".farm", "client-references", "farm.js+core", "__island-container.tsx");
1791
+ return path5.join(root, ".farm", "client-references", "farm.js+core", "__island-container.tsx");
1659
1792
  }
1660
1793
  function ensureFarmIslandContainerReference(root) {
1661
1794
  const file = farmIslandContainerReferencePath(root);
@@ -1674,13 +1807,13 @@ function ensureFarmIslandContainerReference(root) {
1674
1807
  } catch {
1675
1808
  }
1676
1809
  if (current !== source) {
1677
- fs4.mkdirSync(path3.dirname(file), { recursive: true });
1810
+ fs4.mkdirSync(path5.dirname(file), { recursive: true });
1678
1811
  fs4.writeFileSync(file, source);
1679
1812
  }
1680
1813
  return file;
1681
1814
  }
1682
1815
  function parse2(code, file) {
1683
- const extension = path3.extname(file).slice(1);
1816
+ const extension = path5.extname(file).slice(1);
1684
1817
  const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : extension === "js" || extension === "mjs" || extension === "cjs" || extension === "jsx" ? "jsx" : "tsx";
1685
1818
  return memoizeInFarmSourceSnapshot(`ast:${lang}`, code, () => {
1686
1819
  try {
@@ -1764,7 +1897,7 @@ function wrapFarmIslandContainers(options) {
1764
1897
  for (const container of [...containers].reverse()) {
1765
1898
  code = code.slice(0, container.start) + `<${CONTAINER_LOCAL}>` + code.slice(container.start, container.end) + `</${CONTAINER_LOCAL}>` + code.slice(container.end);
1766
1899
  }
1767
- const specifier = JSON.stringify(options.reference.split(path3.sep).join("/"));
1900
+ const specifier = JSON.stringify(options.reference.split(path5.sep).join("/"));
1768
1901
  const declaration = `import { ${FARM_ISLAND_CONTAINER_EXPORT} as ${CONTAINER_LOCAL} } from ${specifier};
1769
1902
  `;
1770
1903
  let prologueEnd = 0;
@@ -1780,9 +1913,9 @@ ${declaration}${code.slice(prologueEnd)}`;
1780
1913
  // src/utils/package-client-boundary-cache.ts
1781
1914
  import { AsyncLocalStorage } from "async_hooks";
1782
1915
  import fs5 from "fs";
1783
- import path4 from "path";
1916
+ import path6 from "path";
1784
1917
  var SCHEMA_VERSION = 2;
1785
- var NODE_MODULES_SEGMENT = `${path4.sep}node_modules${path4.sep}`;
1918
+ var NODE_MODULES_SEGMENT = `${path6.sep}node_modules${path6.sep}`;
1786
1919
  var PackageInspectionTrace = class {
1787
1920
  constructor() {
1788
1921
  this.files = /* @__PURE__ */ new Set();
@@ -1792,7 +1925,7 @@ var PackageInspectionTrace = class {
1792
1925
  }
1793
1926
  visit(file) {
1794
1927
  this.files.add(file);
1795
- const directory = path4.dirname(file);
1928
+ const directory = path6.dirname(file);
1796
1929
  if (!this.directoryStamps.has(directory)) {
1797
1930
  this.directoryStamps.set(directory, stampPackagePath(directory, "directory"));
1798
1931
  }
@@ -1819,7 +1952,7 @@ var PackageInspectionTrace = class {
1819
1952
  }
1820
1953
  };
1821
1954
  function stampPackagePath(target, kind) {
1822
- if (!`${target}${path4.sep}`.includes(NODE_MODULES_SEGMENT)) return void 0;
1955
+ if (!`${target}${path6.sep}`.includes(NODE_MODULES_SEGMENT)) return void 0;
1823
1956
  try {
1824
1957
  const stat = fs5.statSync(target, { throwIfNoEntry: false });
1825
1958
  if (!stat || (kind === "file" ? !stat.isFile() : !stat.isDirectory())) return void 0;
@@ -1876,7 +2009,7 @@ var PackageClientBoundaryCache = class {
1876
2009
  const { file, contents } = pending;
1877
2010
  const temporary = `${file}.${process.pid}.${Date.now()}.tmp`;
1878
2011
  try {
1879
- await fs5.promises.mkdir(path4.dirname(file), { recursive: true });
2012
+ await fs5.promises.mkdir(path6.dirname(file), { recursive: true });
1880
2013
  await fs5.promises.writeFile(temporary, contents);
1881
2014
  await fs5.promises.rename(temporary, file);
1882
2015
  } catch {
@@ -1891,7 +2024,7 @@ var PackageClientBoundaryCache = class {
1891
2024
  const { file, contents } = pending;
1892
2025
  const temporary = `${file}.${process.pid}.${Date.now()}.tmp`;
1893
2026
  try {
1894
- fs5.mkdirSync(path4.dirname(file), { recursive: true });
2027
+ fs5.mkdirSync(path6.dirname(file), { recursive: true });
1895
2028
  fs5.writeFileSync(temporary, contents);
1896
2029
  fs5.renameSync(temporary, file);
1897
2030
  } catch {
@@ -1988,7 +2121,7 @@ function isRecord(value) {
1988
2121
  return typeof value === "object" && value !== null && !Array.isArray(value);
1989
2122
  }
1990
2123
  function isPathStamp(value) {
1991
- return Array.isArray(value) && value.length === 4 && typeof value[0] === "string" && path4.isAbsolute(value[0]) && value.slice(1).every((part) => typeof part === "number" && Number.isFinite(part));
2124
+ return Array.isArray(value) && value.length === 4 && typeof value[0] === "string" && path6.isAbsolute(value[0]) && value.slice(1).every((part) => typeof part === "number" && Number.isFinite(part));
1992
2125
  }
1993
2126
  function isPathIndexList(value, pathCount) {
1994
2127
  return Array.isArray(value) && value.length > 0 && value.every((index) => Number.isSafeInteger(index) && index >= 0 && index < pathCount);
@@ -1996,7 +2129,7 @@ function isPathIndexList(value, pathCount) {
1996
2129
  function isStoredEntry(value, pathCount) {
1997
2130
  if (!isRecord(value) || !isRecord(value.result)) return false;
1998
2131
  const { isClientComponent, shouldHydrate, islandStrategy } = value.result;
1999
- return isPathIndexList(value.files, pathCount) && isPathIndexList(value.directories, pathCount) && Array.isArray(value.stops) && value.stops.every((file) => typeof file === "string" && path4.isAbsolute(file)) && typeof isClientComponent === "boolean" && typeof shouldHydrate === "boolean" && (islandStrategy === null || isFarmIslandStrategy(islandStrategy)) && Object.keys(value.result).length === 3;
2132
+ return isPathIndexList(value.files, pathCount) && isPathIndexList(value.directories, pathCount) && Array.isArray(value.stops) && value.stops.every((file) => typeof file === "string" && path6.isAbsolute(file)) && typeof isClientComponent === "boolean" && typeof shouldHydrate === "boolean" && (islandStrategy === null || isFarmIslandStrategy(islandStrategy)) && Object.keys(value.result).length === 3;
2000
2133
  }
2001
2134
  var STORAGE_KEY = /* @__PURE__ */ Symbol.for("@farm.js/core/package-client-boundary-cache");
2002
2135
  function getStorage() {
@@ -2024,7 +2157,7 @@ function usePackageClientBoundaryCacheFile(file) {
2024
2157
  getPackageClientBoundaryCache()?.load(file);
2025
2158
  }
2026
2159
  function resolvePackageClientBoundaryCacheFile(root, distDir) {
2027
- return path4.resolve(root, distDir, "cache", "client-boundaries.json");
2160
+ return path6.resolve(root, distDir, "cache", "client-boundaries.json");
2028
2161
  }
2029
2162
  function runWithPackageClientBoundaryCacheFile(file, operation) {
2030
2163
  if (getPackageClientBoundaryCache()) return operation();
@@ -2090,18 +2223,18 @@ function resolveModuleSourcePath(modulePath, root) {
2090
2223
  }
2091
2224
  if (modulePath.startsWith("/@fs/")) {
2092
2225
  const fsPath = withoutQuery.slice("/@fs/".length);
2093
- candidates.add(path5.normalize(/^[A-Za-z]:/.test(fsPath) ? fsPath : `/${fsPath}`));
2226
+ candidates.add(path7.normalize(/^[A-Za-z]:/.test(fsPath) ? fsPath : `/${fsPath}`));
2094
2227
  }
2095
2228
  }
2096
2229
  if (root && modulePath) {
2097
2230
  const normalized = withoutQuery.replace(/^\/+/, "");
2098
- candidates.add(path5.join(root, normalized));
2099
- candidates.add(path5.resolve(root, normalized));
2231
+ candidates.add(path7.join(root, normalized));
2232
+ candidates.add(path7.resolve(root, normalized));
2100
2233
  }
2101
2234
  if (withoutQuery?.startsWith("/src/")) {
2102
2235
  const normalized = withoutQuery.replace(/^\/+/, "");
2103
- candidates.add(path5.join(process.cwd(), normalized));
2104
- candidates.add(path5.resolve(process.cwd(), normalized));
2236
+ candidates.add(path7.join(process.cwd(), normalized));
2237
+ candidates.add(path7.resolve(process.cwd(), normalized));
2105
2238
  }
2106
2239
  for (const candidate of candidates) {
2107
2240
  if (fs6.existsSync(candidate)) {
@@ -2121,8 +2254,8 @@ var FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES = 4;
2121
2254
  function isolatedHydrationBoundaryLimit() {
2122
2255
  const benchmarkRoot = process.env.FARM_INTERNAL_ISOLATED_HYDRATION_BENCHMARK_ROOT;
2123
2256
  const benchmarkLimit = Number(process.env.FARM_INTERNAL_ISOLATED_HYDRATION_BENCHMARK_LIMIT);
2124
- const resolvedBenchmarkRoot = benchmarkRoot ? path5.resolve(benchmarkRoot) : null;
2125
- const isBenchmarkFixture = process.env.FARM_INTERNAL_BENCHMARK === "isolated-hydration" && resolvedBenchmarkRoot !== null && (process.cwd() === resolvedBenchmarkRoot || process.cwd().startsWith(`${resolvedBenchmarkRoot}${path5.sep}`));
2257
+ const resolvedBenchmarkRoot = benchmarkRoot ? path7.resolve(benchmarkRoot) : null;
2258
+ const isBenchmarkFixture = process.env.FARM_INTERNAL_BENCHMARK === "isolated-hydration" && resolvedBenchmarkRoot !== null && (process.cwd() === resolvedBenchmarkRoot || process.cwd().startsWith(`${resolvedBenchmarkRoot}${path7.sep}`));
2126
2259
  return isBenchmarkFixture && Number.isSafeInteger(benchmarkLimit) && benchmarkLimit > FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES ? benchmarkLimit : FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES;
2127
2260
  }
2128
2261
  var RESOLVABLE_SOURCE_EXTENSIONS = [
@@ -2153,7 +2286,7 @@ function hasUseClientDirective(content) {
2153
2286
  if (!normalized.includes("use client")) {
2154
2287
  return false;
2155
2288
  }
2156
- for (const token of tokenizeModuleSource(content)) {
2289
+ for (const token of scanModuleSourceTokens(content, true)) {
2157
2290
  if (token.kind === "string") {
2158
2291
  if (token.value === "use client") {
2159
2292
  return true;
@@ -2279,7 +2412,7 @@ function isIdentifierStartCode(code) {
2279
2412
  function isIdentifierPartCode(code) {
2280
2413
  return isIdentifierStartCode(code) || code >= 48 && code <= 57;
2281
2414
  }
2282
- function scanModuleSourceTokens(content) {
2415
+ function scanModuleSourceTokens(content, prologueOnly = false) {
2283
2416
  const tokens = [];
2284
2417
  let index = 0;
2285
2418
  let line = 1;
@@ -2359,9 +2492,11 @@ function scanModuleSourceTokens(content) {
2359
2492
  const start = index++;
2360
2493
  while (index < content.length && isIdentifierPartCode(content.charCodeAt(index))) index++;
2361
2494
  tokens.push({ kind: "identifier", value: content.slice(start, index), line });
2495
+ if (prologueOnly) return tokens;
2362
2496
  continue;
2363
2497
  }
2364
2498
  tokens.push({ kind: "punctuation", value: character, line });
2499
+ if (prologueOnly && character !== ";") return tokens;
2365
2500
  index++;
2366
2501
  }
2367
2502
  return tokens;
@@ -2474,7 +2609,7 @@ function getFarmClientRenderingBindings(code, file, root) {
2474
2609
  for (const [specifier, locals] of getStaticImportBindings(code)) {
2475
2610
  const imported = resolveImportedModule(file, specifier, root);
2476
2611
  if (!imported.path) continue;
2477
- const metadata = imported.local ? inspectClientModuleMetadata(imported.path, root, /* @__PURE__ */ new Set([path5.resolve(file)]), false) : inspectPackageClientBoundary(imported.path, root, /* @__PURE__ */ new Set());
2612
+ const metadata = imported.local ? inspectClientModuleMetadata(imported.path, root, /* @__PURE__ */ new Set([path7.resolve(file)]), false) : inspectPackageClientBoundary(imported.path, root, /* @__PURE__ */ new Set());
2478
2613
  if (metadata.isClientComponent || metadata.shouldHydrate) bindings.push(...locals);
2479
2614
  }
2480
2615
  return bindings;
@@ -2518,6 +2653,9 @@ function getClientModuleMetadata(modulePath, root) {
2518
2653
  const resolvedPath = resolveModuleSourcePath(modulePath, root);
2519
2654
  return inspectClientModuleMetadata(resolvedPath, root, /* @__PURE__ */ new Set(), true);
2520
2655
  }
2656
+ function getClientModuleHydrationPlanKey(modulePath, root, mode, options = {}) {
2657
+ return `${path7.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${options.serverOwners === true}\0${options.serverTreeLayouts === true}\0${options.packageReferences === true}\0${path7.resolve(modulePath)}`;
2658
+ }
2521
2659
  function getClientModuleHydrationPlan(modulePath, root, mode = "off", options = {}) {
2522
2660
  const plan = planClientModuleHydration(modulePath, root, mode, options);
2523
2661
  if (options.serverTreeLayouts !== true || options.asyncOwnerIslands !== true || !plan.shouldHydrate || plan.isClientComponent || plan.asyncOwnerIslands) {
@@ -3090,7 +3228,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
3090
3228
  let fallbackReason;
3091
3229
  let fallbackHint;
3092
3230
  let costGuardExceeded = false;
3093
- const projectRoot = root ? path5.resolve(root) : void 0;
3231
+ const projectRoot = root ? path7.resolve(root) : void 0;
3094
3232
  const visit = (moduleSourcePath) => {
3095
3233
  if (fallbackReason) return 0;
3096
3234
  const cached = estimates.get(moduleSourcePath);
@@ -3277,7 +3415,7 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
3277
3415
  }
3278
3416
  function farmWorkspaceServerEntry(entry) {
3279
3417
  const real = realpathOrSelf(entry);
3280
- if (real.split(path5.sep).includes("node_modules")) return null;
3418
+ if (real.split(path7.sep).includes("node_modules")) return null;
3281
3419
  if (parseClientModuleMetadata(readIfExists(real), false).isClientComponent) return null;
3282
3420
  return real;
3283
3421
  }
@@ -3441,7 +3579,7 @@ function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
3441
3579
  function resolveImportedModule(importerPath, specifier, root) {
3442
3580
  const resolved = memoizeInFarmSourceSnapshot(
3443
3581
  "resolution",
3444
- `${root ?? ""}\0${importerPath}\0${specifier}`,
3582
+ `${root ? farmSourceSnapshotPathKey(root) : ""}\0${farmSourceSnapshotPathKey(importerPath)}\0${specifier}`,
3445
3583
  () => resolveImportedModuleUncached(importerPath, specifier, root),
3446
3584
  // A file added later may resolve an import that does not resolve now.
3447
3585
  (result) => result.path !== null
@@ -3470,7 +3608,7 @@ var ALIAS_IMPORT = /^(?:@\/|~\/|#)/;
3470
3608
  function warnUnresolvedAliasImport(importerPath, specifier, root) {
3471
3609
  if (!ALIAS_IMPORT.test(specifier) || warnedUnresolvedAliasImports.has(specifier)) return;
3472
3610
  warnedUnresolvedAliasImports.add(specifier);
3473
- const importer = root ? path5.relative(root, importerPath) : importerPath;
3611
+ const importer = root ? path7.relative(root, importerPath) : importerPath;
3474
3612
  logger.warn(
3475
3613
  `Could not resolve "${specifier}" (imported by ${importer}) while checking which pages need client JavaScript. If it holds client components, they will not hydrate. Map the alias in tsconfig.json "paths" or package.json "imports".`
3476
3614
  );
@@ -3479,7 +3617,7 @@ var projectImportAliasCache = /* @__PURE__ */ new Map();
3479
3617
  var PROJECT_ALIAS_FILES = ["tsconfig.json", "jsconfig.json", "package.json"];
3480
3618
  function resolveProjectAliasSourcePath(specifier, root) {
3481
3619
  if (!root) return void 0;
3482
- const projectRoot = path5.resolve(root);
3620
+ const projectRoot = path7.resolve(root);
3483
3621
  let match;
3484
3622
  for (const alias of getProjectImportAliases(projectRoot)) {
3485
3623
  const captured = matchProjectImportAlias(alias, specifier);
@@ -3489,7 +3627,7 @@ function resolveProjectAliasSourcePath(specifier, root) {
3489
3627
  if (!match) return void 0;
3490
3628
  const resolved = resolveSourceCandidate(
3491
3629
  match.alias.targets.map(
3492
- (target) => path5.normalize(match.alias.wildcard ? target.replace("*", match.captured) : target)
3630
+ (target) => path7.normalize(match.alias.wildcard ? target.replace("*", match.captured) : target)
3493
3631
  )
3494
3632
  );
3495
3633
  return resolved && /\.d\.[cm]?ts$/.test(resolved) ? null : resolved;
@@ -3504,7 +3642,7 @@ function matchProjectImportAlias(alias, specifier) {
3504
3642
  function getProjectImportAliases(projectRoot) {
3505
3643
  const stamp = PROJECT_ALIAS_FILES.map((file) => {
3506
3644
  try {
3507
- return String(fs6.statSync(path5.join(projectRoot, file)).mtimeMs);
3645
+ return String(fs6.statSync(path7.join(projectRoot, file)).mtimeMs);
3508
3646
  } catch {
3509
3647
  return "-";
3510
3648
  }
@@ -3522,7 +3660,7 @@ function getProjectImportAliases(projectRoot) {
3522
3660
  prefix: "@/",
3523
3661
  suffix: "",
3524
3662
  wildcard: true,
3525
- targets: [path5.join(projectRoot, sourceDir, "*")]
3663
+ targets: [path7.join(projectRoot, sourceDir, "*")]
3526
3664
  });
3527
3665
  }
3528
3666
  projectImportAliasCache.set(projectRoot, { stamp: cacheStamp, aliases });
@@ -3530,11 +3668,11 @@ function getProjectImportAliases(projectRoot) {
3530
3668
  }
3531
3669
  function readTsconfigPathAliases(projectRoot) {
3532
3670
  for (const name of ["tsconfig.json", "jsconfig.json"]) {
3533
- const configPath = path5.join(projectRoot, name);
3671
+ const configPath = path7.join(projectRoot, name);
3534
3672
  if (!fs6.existsSync(configPath)) continue;
3535
3673
  const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
3536
3674
  if (!resolved?.paths) return [];
3537
- const base = resolved.baseUrl ?? resolved.pathsDirectory;
3675
+ const base2 = resolved.baseUrl ?? resolved.pathsDirectory;
3538
3676
  return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
3539
3677
  if (!Array.isArray(targets)) return [];
3540
3678
  const wildcardIndex = pattern.indexOf("*");
@@ -3543,7 +3681,7 @@ function readTsconfigPathAliases(projectRoot) {
3543
3681
  prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
3544
3682
  suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
3545
3683
  wildcard: wildcardIndex !== -1,
3546
- targets: targets.filter((target) => typeof target === "string").map((target) => path5.resolve(base, target))
3684
+ targets: targets.filter((target) => typeof target === "string").map((target) => path7.resolve(base2, target))
3547
3685
  }
3548
3686
  ];
3549
3687
  });
@@ -3555,27 +3693,27 @@ function readTsconfigPaths(configPath, visited) {
3555
3693
  visited.add(configPath);
3556
3694
  const config = readJsonWithComments(configPath);
3557
3695
  if (!config) return null;
3558
- const directory = path5.dirname(configPath);
3696
+ const directory = path7.dirname(configPath);
3559
3697
  const parents = (Array.isArray(config.extends) ? config.extends : [config.extends]).filter(
3560
3698
  (parent) => typeof parent === "string" && parent.startsWith(".")
3561
3699
  );
3562
3700
  let inherited = null;
3563
3701
  for (const parent of parents) {
3564
- const parentPath = path5.resolve(
3702
+ const parentPath = path7.resolve(
3565
3703
  directory,
3566
3704
  parent.endsWith(".json") ? parent : `${parent}.json`
3567
3705
  );
3568
3706
  inherited = readTsconfigPaths(parentPath, visited) ?? inherited;
3569
3707
  }
3570
3708
  const options = config.compilerOptions ?? {};
3571
- const baseUrl = typeof options.baseUrl === "string" ? path5.resolve(directory, options.baseUrl) : inherited?.baseUrl;
3709
+ const baseUrl = typeof options.baseUrl === "string" ? path7.resolve(directory, options.baseUrl) : inherited?.baseUrl;
3572
3710
  if (options.paths && typeof options.paths === "object") {
3573
3711
  return { paths: options.paths, pathsDirectory: directory, baseUrl };
3574
3712
  }
3575
3713
  return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
3576
3714
  }
3577
3715
  function readPackageImportAliases(projectRoot) {
3578
- const imports = readPackageJson(path5.join(projectRoot, "package.json"))?.imports;
3716
+ const imports = readPackageJson(path7.join(projectRoot, "package.json"))?.imports;
3579
3717
  if (!imports || typeof imports !== "object") return [];
3580
3718
  return Object.entries(imports).flatMap(([pattern, value]) => {
3581
3719
  const target = resolveConditionalExportTarget(value);
@@ -3586,7 +3724,7 @@ function readPackageImportAliases(projectRoot) {
3586
3724
  prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
3587
3725
  suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
3588
3726
  wildcard: wildcardIndex !== -1,
3589
- targets: [path5.resolve(projectRoot, target)]
3727
+ targets: [path7.resolve(projectRoot, target)]
3590
3728
  }
3591
3729
  ];
3592
3730
  });
@@ -3632,7 +3770,7 @@ function resolveImportedModuleSourcePath(importerPath, specifier, root) {
3632
3770
  return resolvePackageModuleSourcePath(importerPath, specifier, root);
3633
3771
  }
3634
3772
  const candidates = /* @__PURE__ */ new Set();
3635
- const basePath = specifier.startsWith(".") ? path5.resolve(path5.dirname(importerPath), specifier) : root ? path5.resolve(root, specifier.replace(/^\/+/, "")) : path5.resolve(specifier);
3773
+ const basePath = specifier.startsWith(".") ? path7.resolve(path7.dirname(importerPath), specifier) : root ? path7.resolve(root, specifier.replace(/^\/+/, "")) : path7.resolve(specifier);
3636
3774
  candidates.add(basePath);
3637
3775
  return resolveSourceCandidate(candidates);
3638
3776
  }
@@ -3642,45 +3780,45 @@ function resolvePackageModuleSourcePath(importerPath, specifier, root) {
3642
3780
  const packageSubpath = packageParts.slice(packageName.startsWith("@") ? 2 : 1).join("/");
3643
3781
  const packageDirectory = findPackageDirectory2(importerPath, packageName, root);
3644
3782
  if (!packageDirectory) return null;
3645
- const packageJsonPath = path5.join(packageDirectory, "package.json");
3783
+ const packageJsonPath = path7.join(packageDirectory, "package.json");
3646
3784
  const packageJson = readPackageJson(packageJsonPath);
3647
3785
  const exportKey = packageSubpath ? `./${packageSubpath}` : ".";
3648
3786
  const exportTarget = resolvePackageExport(packageJson?.exports, exportKey);
3649
3787
  const candidates = /* @__PURE__ */ new Set();
3650
3788
  if (exportTarget?.startsWith("./")) {
3651
- candidates.add(path5.resolve(packageDirectory, exportTarget));
3789
+ candidates.add(path7.resolve(packageDirectory, exportTarget));
3652
3790
  }
3653
3791
  if (packageSubpath) {
3654
- candidates.add(path5.join(packageDirectory, packageSubpath));
3792
+ candidates.add(path7.join(packageDirectory, packageSubpath));
3655
3793
  } else {
3656
3794
  for (const entry of [packageJson?.browser, packageJson?.module, packageJson?.main]) {
3657
- if (typeof entry === "string") candidates.add(path5.resolve(packageDirectory, entry));
3795
+ if (typeof entry === "string") candidates.add(path7.resolve(packageDirectory, entry));
3658
3796
  }
3659
- candidates.add(path5.join(packageDirectory, "index"));
3797
+ candidates.add(path7.join(packageDirectory, "index"));
3660
3798
  }
3661
3799
  return resolveSourceCandidate(candidates);
3662
3800
  }
3663
3801
  function findPackageDirectory2(importerPath, packageName, root) {
3664
3802
  const searchRoots = /* @__PURE__ */ new Set();
3665
- let current = path5.dirname(importerPath);
3803
+ let current = path7.dirname(importerPath);
3666
3804
  while (true) {
3667
3805
  searchRoots.add(current);
3668
- const parent = path5.dirname(current);
3806
+ const parent = path7.dirname(current);
3669
3807
  if (parent === current) break;
3670
3808
  current = parent;
3671
3809
  }
3672
3810
  if (root) {
3673
- current = path5.resolve(root);
3811
+ current = path7.resolve(root);
3674
3812
  while (true) {
3675
3813
  searchRoots.add(current);
3676
- const parent = path5.dirname(current);
3814
+ const parent = path7.dirname(current);
3677
3815
  if (parent === current) break;
3678
3816
  current = parent;
3679
3817
  }
3680
3818
  }
3681
3819
  for (const searchRoot of searchRoots) {
3682
- const packageDirectory = path5.join(searchRoot, "node_modules", packageName);
3683
- if (fs6.existsSync(path5.join(packageDirectory, "package.json"))) {
3820
+ const packageDirectory = path7.join(searchRoot, "node_modules", packageName);
3821
+ if (fs6.existsSync(path7.join(packageDirectory, "package.json"))) {
3684
3822
  return packageDirectory;
3685
3823
  }
3686
3824
  }
@@ -3746,7 +3884,7 @@ function resolveSourceCandidate(candidates) {
3746
3884
  for (const candidate of candidates) {
3747
3885
  const paths = [candidate];
3748
3886
  for (const extension of RESOLVABLE_SOURCE_EXTENSIONS) {
3749
- paths.push(`${candidate}${extension}`, path5.join(candidate, `index${extension}`));
3887
+ paths.push(`${candidate}${extension}`, path7.join(candidate, `index${extension}`));
3750
3888
  }
3751
3889
  for (const sourcePath of paths) {
3752
3890
  try {
@@ -3799,7 +3937,7 @@ function scanFarmPackageImports(directory, root) {
3799
3937
  }
3800
3938
  for (const entry of entries) {
3801
3939
  if (entry.name.startsWith(".") && entry.isDirectory()) continue;
3802
- const file = path5.join(current, entry.name);
3940
+ const file = path7.join(current, entry.name);
3803
3941
  if (entry.isDirectory()) {
3804
3942
  if (!CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
3805
3943
  continue;
@@ -3832,7 +3970,7 @@ function collectFarmServerBundledPackageInfo(directory) {
3832
3970
  }
3833
3971
  for (const entry of entries) {
3834
3972
  if (entry.name.startsWith(".") && entry.isDirectory()) continue;
3835
- const file = path5.join(current, entry.name);
3973
+ const file = path7.join(current, entry.name);
3836
3974
  if (entry.isDirectory()) {
3837
3975
  if (!CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
3838
3976
  continue;
@@ -3857,7 +3995,7 @@ function invalidateFarmClientReachableModules() {
3857
3995
  clientReachableModules.clear();
3858
3996
  }
3859
3997
  function getFarmClientReachableModules(directory, root) {
3860
- const key = `${path5.resolve(root)}\0${path5.resolve(directory)}`;
3998
+ const key = `${path7.resolve(root)}\0${path7.resolve(directory)}`;
3861
3999
  const cached = clientReachableModules.get(key);
3862
4000
  if (cached) return cached;
3863
4001
  const reachable = /* @__PURE__ */ new Set();
@@ -3870,7 +4008,7 @@ function getFarmClientReachableModules(directory, root) {
3870
4008
  return;
3871
4009
  }
3872
4010
  for (const entry of entries) {
3873
- const file = path5.join(current, entry.name);
4011
+ const file = path7.join(current, entry.name);
3874
4012
  if (entry.isDirectory()) {
3875
4013
  if (!entry.name.startsWith(".") && !CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
3876
4014
  } else if (isScannedSourceFile(entry.name)) {
@@ -3881,12 +4019,12 @@ function getFarmClientReachableModules(directory, root) {
3881
4019
  };
3882
4020
  walk2(directory);
3883
4021
  while (queue.length > 0) {
3884
- const file = path5.resolve(queue.pop());
4022
+ const file = path7.resolve(queue.pop());
3885
4023
  if (reachable.has(file)) continue;
3886
4024
  reachable.add(file);
3887
4025
  for (const specifier of getImportSpecifiers(readIfExists(file), { dynamic: true })) {
3888
4026
  const imported = resolveImportedModule(file, specifier, root);
3889
- if (imported.local && imported.path && !reachable.has(path5.resolve(imported.path))) {
4027
+ if (imported.local && imported.path && !reachable.has(path7.resolve(imported.path))) {
3890
4028
  queue.push(imported.path);
3891
4029
  }
3892
4030
  }
@@ -3895,7 +4033,7 @@ function getFarmClientReachableModules(directory, root) {
3895
4033
  return reachable;
3896
4034
  }
3897
4035
  function resolveFarmClientOptimizeDeps(directory, root) {
3898
- const importer = path5.join(path5.resolve(root), "package.json");
4036
+ const importer = path7.join(path7.resolve(root), "package.json");
3899
4037
  const include = /* @__PURE__ */ new Set();
3900
4038
  const exclude = /* @__PURE__ */ new Set();
3901
4039
  const imports = scanFarmPackageImports(directory, root);
@@ -3981,7 +4119,15 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
3981
4119
  }
3982
4120
  return sources.files;
3983
4121
  };
3984
- const routeSourceError = (file, importers = []) => `[Farm.js] ${file} defines programmatic routes, but the browser bundle imports it` + (importers.length > 0 ? ` (from ${importers.join(", ")})` : "") + ". Routes files and the modules that define routes carry server-only guards, data hooks, and API handlers, so they never reach the browser. Import the component, server function, or helper from its own module instead.";
4122
+ const relativeFile = (file) => path8.isAbsolute(file) ? path8.relative(projectRoot, file).replace(/\\/g, "/") || file : file;
4123
+ const routeSourceError = (file, importers = []) => formatFarmDiagnostic(
4124
+ createFarmDiagnostic(
4125
+ "CLIENT_ROUTES_FILE",
4126
+ file,
4127
+ "This module defines programmatic routes, but the browser bundle imports it" + (importers.length > 0 ? ` (from ${importers.map(relativeFile).join(", ")})` : "") + ". Routes files and the modules that define routes carry server-only guards, data hooks, and API handlers, so they never reach the browser."
4128
+ ),
4129
+ projectRoot
4130
+ );
3985
4131
  return {
3986
4132
  name: "farm:environment-functions",
3987
4133
  enforce: "post",
@@ -3993,7 +4139,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
3993
4139
  routesFiles = new Set(
3994
4140
  getFarmSourceRoots({ ...options, root: options.root ?? config.root }).flatMap(
3995
4141
  (source) => PROGRAMMATIC_ROUTE_FILE_NAMES.map(
3996
- (name) => resolvedFile(path6.resolve(source.root, source.srcDir, name))
4142
+ (name) => resolvedFile(path8.resolve(source.root, source.srcDir, name))
3997
4143
  )
3998
4144
  )
3999
4145
  );
@@ -4011,12 +4157,25 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
4011
4157
  if (environment === "server" && resolveFarmServerComponentsMode(options.experimental?.serverComponents) === "islands" && isApplicationScript(id)) {
4012
4158
  const file = id.split("?", 1)[0];
4013
4159
  const root = realpathSync(options.root ?? projectRoot);
4014
- const clientCode = getFarmClientReachableModules(root, root).has(path6.resolve(file)) || existsSync(file) && hasUseClientDirective(readFileSync(file, "utf8"));
4160
+ const clientCode = getFarmClientReachableModules(root, root).has(path8.resolve(file)) || existsSync(file) && hasUseClientDirective(readFileSync(file, "utf8"));
4015
4161
  const reached = clientCode ? null : findFarmClientOnlyImport(code, file);
4016
4162
  if (reached) {
4017
- const chain = reached.chain.map((step) => path6.relative(root, step)).join(" -> ");
4163
+ const chain = reached.chain.map((step) => path8.relative(root, step).replace(/\\/g, "/")).join(" -> ");
4164
+ const importMatch = new RegExp(
4165
+ String.raw`\b(?:from|import)\s*["']` + reached.specifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + `["']`
4166
+ ).exec(code);
4167
+ const importAt = importMatch ? importMatch.index + importMatch[0].search(/["']/) : void 0;
4168
+ const locate = createFarmSourceLocator(code, () => this.getCombinedSourcemap());
4018
4169
  this.error(
4019
- `[Farm.js] ${path6.relative(root, file)} is server code, but its import of "${reached.specifier}" reaches "client-only" (${chain}), so that package can only run in the browser. Add "use client" to this module, or import the package from a "use client" module.`
4170
+ formatFarmDiagnostic(
4171
+ createFarmDiagnostic(
4172
+ "SERVER_CLIENT_ONLY_IMPORT",
4173
+ file,
4174
+ `This module is server code, but its import of "${reached.specifier}" reaches "client-only" (${chain}), so that package can only run in the browser.`,
4175
+ importAt === void 0 ? void 0 : locate(importAt)
4176
+ ),
4177
+ root
4178
+ )
4020
4179
  );
4021
4180
  }
4022
4181
  }
@@ -4033,7 +4192,14 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
4033
4192
  });
4034
4193
  if (chain) {
4035
4194
  this.error(
4036
- `[Farm.js] The browser bundle reaches the server-only module "${chain.at(-1)}" through the programmatic route module ${moduleFile(id)}: ${chain.map(moduleFile).join(" -> ")}. Keep server-only imports in the routes file or in modules only its guard, data, and API handlers use.`
4195
+ formatFarmDiagnostic(
4196
+ createFarmDiagnostic(
4197
+ "CLIENT_ROUTE_SERVER_IMPORT",
4198
+ moduleFile(id),
4199
+ `The browser bundle reaches the server-only module "${chain.at(-1)}" through this programmatic route module: ${chain.map((step) => relativeFile(moduleFile(step))).join(" -> ")}.`
4200
+ ),
4201
+ projectRoot
4202
+ )
4037
4203
  );
4038
4204
  }
4039
4205
  continue;
@@ -4326,8 +4492,10 @@ export {
4326
4492
  createEvaluatedRouteGraph,
4327
4493
  mergeProgrammaticClientRoutes,
4328
4494
  generateProgrammaticClientRouteModule,
4495
+ getFarmSourceStamp,
4329
4496
  FarmSourceSnapshotStore,
4330
4497
  withFarmSourceSnapshot,
4498
+ withFarmSourceSnapshotOf,
4331
4499
  traceFarmSourceReads,
4332
4500
  rewriteFarmReactServerClientModuleImports,
4333
4501
  rewriteFarmReactServerImports,
@@ -4360,6 +4528,7 @@ export {
4360
4528
  collectFarmRenderedClientModules,
4361
4529
  collectFarmServerStylesheets,
4362
4530
  getClientModuleMetadata,
4531
+ getClientModuleHydrationPlanKey,
4363
4532
  getClientModuleHydrationPlan,
4364
4533
  usesFarmServerTree,
4365
4534
  createMarkdownPageHydrationPlanner,
@@ -4373,6 +4542,9 @@ export {
4373
4542
  invalidateFarmClientReachableModules,
4374
4543
  getFarmClientReachableModules,
4375
4544
  resolveFarmClientOptimizeDeps,
4545
+ createFarmDiagnostic,
4546
+ formatFarmDiagnostic,
4547
+ createFarmSourceLocator,
4376
4548
  transformEnvironmentFunctions,
4377
4549
  farmEnvironmentFunctionsPlugin
4378
4550
  };