@farm.js/core 0.1.31 → 0.1.35

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 (352) hide show
  1. package/README.md +1 -1
  2. package/dist/agent-runtime.cjs +70 -15
  3. package/dist/agent-runtime.d.mts +4 -5
  4. package/dist/agent-runtime.d.ts +4 -5
  5. package/dist/agent-runtime.mjs +59 -4
  6. package/dist/api/route-manager.cjs +17 -14
  7. package/dist/api/route-manager.d.mts +6 -7
  8. package/dist/api/route-manager.d.ts +6 -7
  9. package/dist/api/route-manager.mjs +16 -13
  10. package/dist/api/runtime.cjs +12 -8
  11. package/dist/api/runtime.d.mts +4 -5
  12. package/dist/api/runtime.d.ts +4 -5
  13. package/dist/api/runtime.mjs +12 -8
  14. package/dist/api.cjs +20 -17
  15. package/dist/api.d.mts +7 -8
  16. package/dist/api.d.ts +7 -8
  17. package/dist/api.mjs +19 -16
  18. package/dist/{app-sUJ3jnTZ.d.ts → app-BXB3JZYc.d.ts} +38 -12
  19. package/dist/{app-DAuUTIZf.d.mts → app-D_j9AAVL.d.mts} +38 -12
  20. package/dist/app-markdown.cjs +8 -6
  21. package/dist/app-markdown.d.mts +6 -7
  22. package/dist/app-markdown.d.ts +6 -7
  23. package/dist/app-markdown.mjs +7 -5
  24. package/dist/cache.cjs +2 -2
  25. package/dist/cache.d.mts +10 -1
  26. package/dist/cache.d.ts +10 -1
  27. package/dist/cache.mjs +1 -1
  28. package/dist/{chunk-BXFWA23T.mjs → chunk-22LTEMGQ.mjs} +3 -3
  29. package/dist/{chunk-YZTASLPQ.cjs → chunk-27ZWSI3W.cjs} +2 -2
  30. package/dist/{chunk-WBIH66JK.mjs → chunk-2ELDTQRN.mjs} +5 -2
  31. package/dist/{chunk-K7CELQLK.cjs → chunk-2F2ER724.cjs} +54 -29
  32. package/dist/{chunk-O3DTUAX2.mjs → chunk-2G2NNLE2.mjs} +6 -77
  33. package/dist/{chunk-NRVGEI5I.mjs → chunk-2NNMOPDN.mjs} +4 -210
  34. package/dist/{chunk-CTV2TTNP.cjs → chunk-3BHT4WMP.cjs} +16 -87
  35. package/dist/chunk-3BU22U3M.cjs +237 -0
  36. package/dist/{chunk-MM5D6VLP.mjs → chunk-3KZS4SUS.mjs} +33 -14
  37. package/dist/{chunk-VA62MHFV.mjs → chunk-3PXS2MHU.mjs} +1 -1
  38. package/dist/chunk-3SDFA7UF.cjs +701 -0
  39. package/dist/{chunk-4IEPYMHF.mjs → chunk-3UEVPCGW.mjs} +1 -1
  40. package/dist/{chunk-MXDTKXO6.cjs → chunk-3UH7MRCP.cjs} +73 -26
  41. package/dist/{chunk-7QOCTYBS.mjs → chunk-4JHOT46A.mjs} +37 -1
  42. package/dist/{chunk-6L6DQR5W.mjs → chunk-4KU5Q7C2.mjs} +917 -305
  43. package/dist/{chunk-3FCFQP5V.cjs → chunk-4MMGO7YW.cjs} +25 -25
  44. package/dist/{chunk-5HGR3W6O.mjs → chunk-5SJWVY6R.mjs} +8 -0
  45. package/dist/{chunk-KZLND3D2.cjs → chunk-62XKI4Z3.cjs} +7 -5
  46. package/dist/{chunk-FJZ3DQLK.mjs → chunk-6DU6UFUE.mjs} +13 -12
  47. package/dist/{chunk-TEN4FIZU.mjs → chunk-6ETPZTJI.mjs} +513 -3
  48. package/dist/{chunk-VUMAE7NC.mjs → chunk-6TJOML4E.mjs} +92 -31
  49. package/dist/{chunk-3ATMYLLJ.mjs → chunk-6WCPV6G2.mjs} +1 -1
  50. package/dist/{chunk-FYRBX5IY.cjs → chunk-73MC7ZL6.cjs} +2 -2
  51. package/dist/chunk-75RZHGLS.cjs +135 -0
  52. package/dist/{chunk-QZRVZSPN.cjs → chunk-77GNHH2Z.cjs} +3 -3
  53. package/dist/{chunk-FXUUWYAX.cjs → chunk-7GLPRTTF.cjs} +12 -2
  54. package/dist/{chunk-A777V5WU.cjs → chunk-7L5V3KQO.cjs} +2 -2
  55. package/dist/{chunk-4ZQQL4IU.mjs → chunk-AHGECQEW.mjs} +1 -1
  56. package/dist/{chunk-RG3ZOTG5.cjs → chunk-AI7QMY7O.cjs} +10 -3
  57. package/dist/{chunk-YMCXWPWK.mjs → chunk-BCMSYSN2.mjs} +4 -1
  58. package/dist/{chunk-I6XDAKWQ.mjs → chunk-BTHHUD7Q.mjs} +14 -0
  59. package/dist/{chunk-LI2LMOLR.mjs → chunk-C35ZBVRD.mjs} +12 -3
  60. package/dist/chunk-C4SPBWFM.cjs +26 -0
  61. package/dist/{chunk-YQVSHTMR.mjs → chunk-CP6X4AEU.mjs} +1 -1
  62. package/dist/{chunk-QZCT2CQ4.mjs → chunk-CXEN47J3.mjs} +64 -2
  63. package/dist/{chunk-WNLBF77X.cjs → chunk-D227TIEN.cjs} +28 -16
  64. package/dist/{chunk-ROUTX2E5.cjs → chunk-DBNKI4NF.cjs} +12 -3
  65. package/dist/{chunk-J3LOGE4T.cjs → chunk-DQQOKWYA.cjs} +5 -5
  66. package/dist/chunk-E5GNDG5F.mjs +701 -0
  67. package/dist/{chunk-X7KZBF63.cjs → chunk-EFCQPQMG.cjs} +40 -4
  68. package/dist/{chunk-K3F2E6GS.cjs → chunk-EJQT6KZN.cjs} +2 -2
  69. package/dist/{chunk-3LUF2PE2.cjs → chunk-EK4QAEFZ.cjs} +67 -5
  70. package/dist/{chunk-VVBO3QH7.mjs → chunk-ENLZ4R3Y.mjs} +10 -1
  71. package/dist/{chunk-KJ2TIHZZ.cjs → chunk-EUV4YR3V.cjs} +3 -2
  72. package/dist/{chunk-E76XC6ZG.mjs → chunk-EZDQRNQ7.mjs} +2 -2
  73. package/dist/{chunk-TOVMYGYW.mjs → chunk-F2SE2VDO.mjs} +1 -1
  74. package/dist/{chunk-MNUGPHLN.mjs → chunk-F6Z3Y5KL.mjs} +5 -3
  75. package/dist/{chunk-DFLLARUK.cjs → chunk-F7JZENPF.cjs} +35 -34
  76. package/dist/{chunk-BSPQVJ4A.mjs → chunk-FDR64H6B.mjs} +13 -0
  77. package/dist/{chunk-5OVTOKGH.cjs → chunk-FFFW3OQ7.cjs} +2 -2
  78. package/dist/{chunk-D4JE5NNV.cjs → chunk-FNO7A7CM.cjs} +5 -5
  79. package/dist/{chunk-Z5HIWVDP.cjs → chunk-FTFYRMQQ.cjs} +80 -91
  80. package/dist/chunk-FZ6YYU2W.mjs +65 -0
  81. package/dist/{chunk-X7WVQMIB.mjs → chunk-G5RT7EXW.mjs} +11 -5
  82. package/dist/{chunk-IXUY2F5U.mjs → chunk-GCXWJJKH.mjs} +4 -7
  83. package/dist/{chunk-ES4B2IXW.cjs → chunk-GFHLGIYC.cjs} +8 -8
  84. package/dist/{chunk-SORB3MAR.cjs → chunk-GQ3Z3IZI.cjs} +17 -17
  85. package/dist/{chunk-75WGQVQA.cjs → chunk-HITLGIAO.cjs} +10 -1
  86. package/dist/{chunk-HBTUGXHS.cjs → chunk-HLJ6MBUZ.cjs} +7 -4
  87. package/dist/{chunk-JLCQGPXE.mjs → chunk-HMIJDL7S.mjs} +51 -62
  88. package/dist/{chunk-F6XEGFHO.mjs → chunk-HUMR6LSU.mjs} +11 -1
  89. package/dist/{chunk-IMB4PIAR.cjs → chunk-ICUQICNC.cjs} +1441 -828
  90. package/dist/{chunk-ZCU4NZ3M.cjs → chunk-IE7XCHH3.cjs} +4 -4
  91. package/dist/{chunk-I26CZYPV.cjs → chunk-IHNIDL6H.cjs} +50 -7
  92. package/dist/{chunk-2FQHH5SC.mjs → chunk-IHNMMXHV.mjs} +49 -24
  93. package/dist/{chunk-YVGAEAA5.cjs → chunk-IPXLADVO.cjs} +522 -12
  94. package/dist/{chunk-VHJGDMCG.cjs → chunk-IWZKTWHZ.cjs} +2 -2
  95. package/dist/chunk-JG6DJF5A.mjs +238 -0
  96. package/dist/{chunk-KROWKCUH.cjs → chunk-JGLC4TO3.cjs} +8 -1
  97. package/dist/{chunk-5TISYEQF.mjs → chunk-JM5XPKWH.mjs} +10 -3
  98. package/dist/{chunk-BJJATPEC.mjs → chunk-KN7K4VQN.mjs} +1 -1
  99. package/dist/{chunk-WPYFSQKK.cjs → chunk-KNBBQHO2.cjs} +15 -1
  100. package/dist/{chunk-XWAWFQFS.cjs → chunk-KXWRO25S.cjs} +7 -4
  101. package/dist/chunk-LSKZMJMP.cjs +65 -0
  102. package/dist/{chunk-2N5PX3LS.mjs → chunk-LYV44OIR.mjs} +7 -1
  103. package/dist/chunk-M7MKQXAF.cjs +87 -0
  104. package/dist/{chunk-IV6CQY7O.mjs → chunk-MSSFIQGM.mjs} +63 -13
  105. package/dist/{chunk-KH7BN726.cjs → chunk-N4UOK6ZI.cjs} +8 -2
  106. package/dist/{chunk-JNGIWIY6.mjs → chunk-NPC7VWJE.mjs} +2 -2
  107. package/dist/chunk-NRDBW4MP.mjs +45 -0
  108. package/dist/{chunk-ILWLPEVO.mjs → chunk-NRSN7G7E.mjs} +2 -2
  109. package/dist/chunk-OFZUJMCU.mjs +601 -0
  110. package/dist/{chunk-L4DVIHOC.mjs → chunk-OKZUAXHF.mjs} +1 -1
  111. package/dist/{chunk-EM6SBQKM.cjs → chunk-OMVAU7NT.cjs} +27 -2
  112. package/dist/{chunk-AHAJGAYD.mjs → chunk-PDOCJ6RY.mjs} +2 -2
  113. package/dist/{chunk-IFI5FXEZ.cjs → chunk-PFQKNERH.cjs} +562 -251
  114. package/dist/{chunk-S5GDHOE4.mjs → chunk-PZNL3WEG.mjs} +48 -5
  115. package/dist/{chunk-GZYH4OER.mjs → chunk-Q3VLETLE.mjs} +2 -2
  116. package/dist/{chunk-WG2KHOMN.mjs → chunk-QAU5JD57.mjs} +571 -260
  117. package/dist/{chunk-FV45CKBC.mjs → chunk-QCFBDFRS.mjs} +1 -1
  118. package/dist/{chunk-75BRBIFP.cjs → chunk-QCVE2OCI.cjs} +5 -8
  119. package/dist/{chunk-6ZCMSZ5U.mjs → chunk-QE6VAKLT.mjs} +1 -1
  120. package/dist/{chunk-QG5HNS7P.mjs → chunk-QORUJDIV.mjs} +2 -2
  121. package/dist/chunk-RHAZ22ZN.mjs +87 -0
  122. package/dist/{chunk-CUMINO7Z.cjs → chunk-RU3M2FIK.cjs} +18 -14
  123. package/dist/{chunk-DGXN3L4D.mjs → chunk-SAZVVAJH.mjs} +5 -5
  124. package/dist/{chunk-MKMBQSNQ.mjs → chunk-SC2WYWPF.mjs} +3 -3
  125. package/dist/{chunk-QCFFHV5H.mjs → chunk-SMHH4VDG.mjs} +1 -1
  126. package/dist/{chunk-UAFSBWNT.mjs → chunk-SOMHP6GF.mjs} +63 -16
  127. package/dist/{chunk-ND224OE2.cjs → chunk-TKSCR644.cjs} +34 -15
  128. package/dist/{chunk-4V7GIE2U.mjs → chunk-UAORZ7QA.mjs} +3 -3
  129. package/dist/{chunk-IQXFRNY2.cjs → chunk-UFDAAQFX.cjs} +2 -2
  130. package/dist/{chunk-6VYZOPOT.mjs → chunk-UJD4PHYB.mjs} +15 -11
  131. package/dist/{chunk-ZHVYQL3H.cjs → chunk-ULAWS2PA.cjs} +97 -36
  132. package/dist/{chunk-5ZSWG4UX.cjs → chunk-UXFQ3UDA.cjs} +14 -1
  133. package/dist/{chunk-MPEYMSCF.cjs → chunk-VFQT3LAO.cjs} +5 -5
  134. package/dist/{chunk-2FXWWUE5.cjs → chunk-VZJR7UTG.cjs} +6 -6
  135. package/dist/{chunk-2AKFKCHA.mjs → chunk-W7LF2J2S.mjs} +1 -1
  136. package/dist/chunk-WWFTAUFG.cjs +45 -0
  137. package/dist/{chunk-JBC2FKRW.mjs → chunk-WWIKMBRN.mjs} +2 -1
  138. package/dist/{chunk-75DYEVXI.cjs → chunk-X6W5FFH6.cjs} +11 -11
  139. package/dist/{chunk-EXLKRR4U.cjs → chunk-XBML5KMG.cjs} +12 -12
  140. package/dist/{chunk-PZNCMPJF.cjs → chunk-XCACDAZZ.cjs} +18 -12
  141. package/dist/{chunk-JATSG2ZO.mjs → chunk-XCMCS4DA.mjs} +15 -3
  142. package/dist/{chunk-UJ2C4ICS.cjs → chunk-XJXBIP67.cjs} +4 -4
  143. package/dist/{chunk-XF7Q24PF.mjs → chunk-Y7RKTKYI.mjs} +25 -0
  144. package/dist/{chunk-VYZSOYR4.cjs → chunk-YC6V7PWE.cjs} +1 -1
  145. package/dist/{chunk-F6OHXPWR.mjs → chunk-YFILVET3.mjs} +8 -1
  146. package/dist/{chunk-JLRDISQL.cjs → chunk-YKX5BK66.cjs} +7 -7
  147. package/dist/{chunk-DYEJQTDN.cjs → chunk-YSCV4SJF.cjs} +4 -4
  148. package/dist/chunk-YSLWRWWP.cjs +601 -0
  149. package/dist/{chunk-5LJCOSKT.mjs → chunk-YULD7ICZ.mjs} +1 -1
  150. package/dist/{chunk-2SDO73HK.cjs → chunk-YWN746US.cjs} +64 -14
  151. package/dist/chunk-Z2HLU4IX.cjs +238 -0
  152. package/dist/chunk-ZLAT2CWY.mjs +135 -0
  153. package/dist/{chunk-T5CERMEH.cjs → chunk-ZXGAFZDO.cjs} +2 -2
  154. package/dist/{client-plugins-BX2ptm4H.d.mts → client-plugins-CvIslxWi.d.mts} +232 -8
  155. package/dist/{client-plugins-BmxM5KW_.d.ts → client-plugins-HIyulDym.d.ts} +232 -8
  156. package/dist/client-plugins.d.mts +4 -5
  157. package/dist/client-plugins.d.ts +4 -5
  158. package/dist/client.cjs +10 -10
  159. package/dist/client.d.mts +8 -9
  160. package/dist/client.d.ts +8 -9
  161. package/dist/client.mjs +9 -9
  162. package/dist/config.d.mts +4 -5
  163. package/dist/config.d.ts +4 -5
  164. package/dist/{devtools-EWRDHCD5.cjs → devtools-EAUY43BS.cjs} +14 -12
  165. package/dist/{devtools-BPBCYOU6.mjs → devtools-EE5RIBTH.mjs} +13 -11
  166. package/dist/docs.cjs +17 -15
  167. package/dist/docs.d.mts +46 -4
  168. package/dist/docs.d.ts +46 -4
  169. package/dist/docs.mjs +16 -14
  170. package/dist/environment/vite.cjs +2 -2
  171. package/dist/environment/vite.mjs +1 -1
  172. package/dist/headers.cjs +4 -4
  173. package/dist/headers.mjs +3 -3
  174. package/dist/i18n/client.cjs +14 -13
  175. package/dist/i18n/client.d.mts +2 -2
  176. package/dist/i18n/client.d.ts +2 -2
  177. package/dist/i18n/client.mjs +5 -4
  178. package/dist/i18n/index.cjs +3 -2
  179. package/dist/i18n/index.d.mts +3 -3
  180. package/dist/i18n/index.d.ts +3 -3
  181. package/dist/i18n/index.mjs +2 -1
  182. package/dist/i18n/server.cjs +6 -5
  183. package/dist/i18n/server.d.mts +5 -5
  184. package/dist/i18n/server.d.ts +5 -5
  185. package/dist/i18n/server.mjs +5 -4
  186. package/dist/image/server.cjs +3 -3
  187. package/dist/image/server.mjs +2 -2
  188. package/dist/image/sharp.cjs +10 -10
  189. package/dist/image/sharp.mjs +2 -2
  190. package/dist/{index-a-8Z5kZU.d.mts → index-BJJfLxJo.d.mts} +2 -2
  191. package/dist/{index-BWVfxIsO.d.ts → index-CwoOP-MW.d.ts} +2 -2
  192. package/dist/index.cjs +75 -60
  193. package/dist/index.d.mts +21 -22
  194. package/dist/index.d.ts +21 -22
  195. package/dist/index.mjs +79 -64
  196. package/dist/integrations.cjs +7 -4
  197. package/dist/integrations.d.mts +4 -5
  198. package/dist/integrations.d.ts +4 -5
  199. package/dist/integrations.mjs +8 -5
  200. package/dist/internal/app-markdown-runtime.cjs +7 -5
  201. package/dist/internal/app-markdown-runtime.d.mts +17 -7
  202. package/dist/internal/app-markdown-runtime.d.ts +17 -7
  203. package/dist/internal/app-markdown-runtime.mjs +6 -4
  204. package/dist/internal/build-runtime.cjs +44 -41
  205. package/dist/internal/build-runtime.d.mts +6 -7
  206. package/dist/internal/build-runtime.d.ts +6 -7
  207. package/dist/internal/build-runtime.mjs +43 -40
  208. package/dist/internal/cli-runtime.cjs +23 -20
  209. package/dist/internal/cli-runtime.mjs +22 -19
  210. package/dist/internal/client-error-overlay.cjs +6 -6
  211. package/dist/internal/client-error-overlay.mjs +2 -2
  212. package/dist/internal/client-runtime.cjs +5 -3
  213. package/dist/internal/client-runtime.d.mts +9 -1
  214. package/dist/internal/client-runtime.d.ts +9 -1
  215. package/dist/internal/client-runtime.mjs +4 -2
  216. package/dist/internal/compression-runtime.d.mts +4 -5
  217. package/dist/internal/compression-runtime.d.ts +4 -5
  218. package/dist/internal/config-runtime.cjs +14 -12
  219. package/dist/internal/config-runtime.d.mts +5 -6
  220. package/dist/internal/config-runtime.d.ts +5 -6
  221. package/dist/internal/config-runtime.mjs +13 -11
  222. package/dist/internal/infra-analytics-runtime.cjs +4 -4
  223. package/dist/internal/infra-analytics-runtime.mjs +2 -2
  224. package/dist/internal/isolated-boundary.cjs +3 -2
  225. package/dist/internal/isolated-boundary.d.mts +1 -0
  226. package/dist/internal/isolated-boundary.d.ts +1 -0
  227. package/dist/internal/isolated-boundary.mjs +2 -1
  228. package/dist/internal/metadata-image-runtime.cjs +3 -3
  229. package/dist/internal/metadata-image-runtime.mjs +2 -2
  230. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  231. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  232. package/dist/internal/production-runtime.cjs +61 -31
  233. package/dist/internal/production-runtime.d.mts +165 -18
  234. package/dist/internal/production-runtime.d.ts +165 -18
  235. package/dist/internal/production-runtime.mjs +57 -27
  236. package/dist/internal/request-cookies.cjs +4 -2
  237. package/dist/internal/request-cookies.d.mts +9 -1
  238. package/dist/internal/request-cookies.d.ts +9 -1
  239. package/dist/internal/request-cookies.mjs +3 -1
  240. package/dist/internal/server-tree.cjs +12 -0
  241. package/dist/internal/server-tree.d.mts +27 -0
  242. package/dist/internal/server-tree.d.ts +27 -0
  243. package/dist/internal/server-tree.mjs +12 -0
  244. package/dist/markdown.cjs +4 -4
  245. package/dist/markdown.d.mts +4 -5
  246. package/dist/markdown.d.ts +4 -5
  247. package/dist/markdown.mjs +3 -3
  248. package/dist/{metadata-DsEaK7mQ.d.mts → metadata-BnLDsUOS.d.ts} +16 -2
  249. package/dist/{metadata-fwZ3gfG6.d.ts → metadata-WGpBYcGn.d.mts} +16 -2
  250. package/dist/middleware.cjs +18 -8
  251. package/dist/middleware.d.mts +27 -9
  252. package/dist/middleware.d.ts +27 -9
  253. package/dist/middleware.mjs +18 -8
  254. package/dist/navigation.cjs +7 -7
  255. package/dist/navigation.d.mts +7 -8
  256. package/dist/navigation.d.ts +7 -8
  257. package/dist/navigation.mjs +6 -6
  258. package/dist/{nitro-NAKCRVHX.mjs → nitro-MXRDCXWZ.mjs} +5 -5
  259. package/dist/{nitro-VYDZGYFY.cjs → nitro-OVPLKPE2.cjs} +7 -7
  260. package/dist/{observability-BupkiN0m.d.mts → observability-CoXunYhS.d.mts} +4 -3
  261. package/dist/{observability-BupkiN0m.d.ts → observability-CoXunYhS.d.ts} +4 -3
  262. package/dist/observability.d.mts +1 -1
  263. package/dist/observability.d.ts +1 -1
  264. package/dist/plugin.cjs +39 -36
  265. package/dist/plugin.d.mts +4 -5
  266. package/dist/plugin.d.ts +4 -5
  267. package/dist/plugin.mjs +38 -35
  268. package/dist/{production-runtime-Baqgwtvc.d.mts → production-runtime-0sRnuYc-.d.mts} +11 -4
  269. package/dist/{production-runtime-DNkpFnmg.d.ts → production-runtime-Crq6CJ-2.d.ts} +11 -4
  270. package/dist/query/client.cjs +8 -8
  271. package/dist/query/client.mjs +4 -4
  272. package/dist/{render-plan-rkIK9wd9.d.ts → render-plan-8ozZh2Qv.d.ts} +1 -1
  273. package/dist/{render-plan-DhwQnmmX.d.mts → render-plan-gs9GGPzw.d.mts} +1 -1
  274. package/dist/renderer/react/server.cjs +10 -4
  275. package/dist/renderer/react/server.d.mts +2 -1
  276. package/dist/renderer/react/server.d.ts +2 -1
  277. package/dist/renderer/react/server.mjs +7 -1
  278. package/dist/renderer-client.cjs +40 -20
  279. package/dist/renderer-client.d.mts +6 -7
  280. package/dist/renderer-client.d.ts +6 -7
  281. package/dist/renderer-client.mjs +29 -9
  282. package/dist/renderer.d.mts +2 -0
  283. package/dist/renderer.d.ts +2 -0
  284. package/dist/{request-BcY4RYPC.d.ts → request-B5G8rLBH.d.ts} +7 -2
  285. package/dist/{request-CFy1BltJ.d.mts → request-fkhiynXe.d.mts} +7 -2
  286. package/dist/request.cjs +2 -2
  287. package/dist/request.d.mts +5 -6
  288. package/dist/request.d.ts +5 -6
  289. package/dist/request.mjs +1 -1
  290. package/dist/{resolver-PPEeiJ6M.d.ts → resolver-DadfRL6F.d.ts} +1 -1
  291. package/dist/{resolver-DhW0CqZN.d.mts → resolver-khasx3fU.d.mts} +1 -1
  292. package/dist/{route-rendering-BkS0TBlB.d.mts → route-rendering-CLnS7AZj.d.mts} +1 -1
  293. package/dist/{route-rendering-D4XpMjam.d.ts → route-rendering-lS5nUMua.d.ts} +1 -1
  294. package/dist/{router-Cq7BcZxg.d.ts → router-4iuiYnOW.d.ts} +1 -1
  295. package/dist/{router-C4zPlC3V.d.mts → router-ifU8Dui1.d.mts} +1 -1
  296. package/dist/routes.cjs +3 -3
  297. package/dist/routes.d.mts +4 -5
  298. package/dist/routes.d.ts +4 -5
  299. package/dist/routes.mjs +2 -2
  300. package/dist/{runtime-BirxPwbZ.d.ts → runtime-BgDQzBiu.d.ts} +2 -2
  301. package/dist/{runtime-AOJge4vQ.d.mts → runtime-CV2UCV-5.d.mts} +2 -2
  302. package/dist/server-action-security.cjs +3 -3
  303. package/dist/server-action-security.mjs +2 -2
  304. package/dist/server-fn.cjs +5 -5
  305. package/dist/server-fn.mjs +4 -4
  306. package/dist/server-plugins.cjs +4 -4
  307. package/dist/server-plugins.d.mts +5 -6
  308. package/dist/server-plugins.d.ts +5 -6
  309. package/dist/server-plugins.mjs +3 -3
  310. package/dist/server-query-client.cjs +3 -3
  311. package/dist/server-query-client.mjs +2 -2
  312. package/dist/server-query.cjs +6 -6
  313. package/dist/server-query.mjs +5 -5
  314. package/dist/server.cjs +66 -63
  315. package/dist/server.d.mts +13 -14
  316. package/dist/server.d.ts +13 -14
  317. package/dist/server.mjs +43 -40
  318. package/dist/{spa-router-DzPZH-AO.d.mts → spa-router-Bq7VCOwx.d.mts} +3 -3
  319. package/dist/{spa-router-B1HI3X9k.d.ts → spa-router-DaJk5Re4.d.ts} +3 -3
  320. package/dist/testing.cjs +22 -20
  321. package/dist/testing.d.mts +4 -5
  322. package/dist/testing.d.ts +4 -5
  323. package/dist/testing.mjs +18 -16
  324. package/dist/theme/server.cjs +4 -3
  325. package/dist/theme/server.mjs +3 -2
  326. package/dist/{types-Z0aotQ8w.d.mts → types-CnH8DOqo.d.mts} +1 -1
  327. package/dist/{types-Z0aotQ8w.d.ts → types-CnH8DOqo.d.ts} +1 -1
  328. package/dist/{utils-DMD1Hzta.d.ts → utils-BXLmFsVR.d.ts} +1 -1
  329. package/dist/{utils-CEBktlBG.d.mts → utils-XJn0c9bj.d.mts} +1 -1
  330. package/dist/version.cjs +2 -2
  331. package/dist/version.mjs +1 -1
  332. package/dist/vite.cjs +39 -36
  333. package/dist/vite.d.mts +4 -5
  334. package/dist/vite.d.ts +4 -5
  335. package/dist/vite.mjs +38 -35
  336. package/dist/{workflows-CR9ex-gz.d.ts → workflows-jZ4BcdoZ.d.mts} +1 -1
  337. package/dist/{workflows-CR9ex-gz.d.mts → workflows-jZ4BcdoZ.d.ts} +1 -1
  338. package/dist/workflows.cjs +3 -3
  339. package/dist/workflows.d.mts +1 -1
  340. package/dist/workflows.d.ts +1 -1
  341. package/dist/workflows.mjs +2 -2
  342. package/package.json +10 -2
  343. package/dist/chunk-22GUSVNJ.cjs +0 -351
  344. package/dist/chunk-5MKEDGLD.cjs +0 -53
  345. package/dist/chunk-O6XNAMBV.mjs +0 -53
  346. package/dist/chunk-SWN467MP.cjs +0 -18
  347. package/dist/chunk-XGC343EY.cjs +0 -443
  348. package/dist/chunk-ZSH2Y4LN.mjs +0 -351
  349. package/dist/types-DFbjpjXX.d.mts +0 -105
  350. package/dist/types-DFbjpjXX.d.ts +0 -105
  351. /package/dist/{chunk-SUIBNSNO.cjs → chunk-SJNMVDDF.cjs} +0 -0
  352. /package/dist/{chunk-LNZ7JZUS.mjs → chunk-UDNPLXW7.mjs} +0 -0
@@ -0,0 +1,601 @@
1
+ import {
2
+ getFarmClientReference,
3
+ subscribeFarmServerTreeUpdates
4
+ } from "./chunk-NRDBW4MP.mjs";
5
+ import {
6
+ __name
7
+ } from "./chunk-LPEX4YW6.mjs";
8
+
9
+ // src/client/server-tree.ts
10
+ var MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo");
11
+ var FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref");
12
+ var SERVER_HTML_TAG = "farm-server-html";
13
+ var FARM_SERVER_TREE_ATTRIBUTE = "data-farm-server-tree";
14
+ var SERVER_TREE_CHUNK_ATTRIBUTE = "data-farm-server-tree-chunk";
15
+ var SERVER_HTML_ATTRIBUTE = "data-farm-server-html";
16
+ var PARSER_SENSITIVE_TAGS = /* @__PURE__ */ new Set([
17
+ "caption",
18
+ "colgroup",
19
+ "datalist",
20
+ "head",
21
+ "html",
22
+ "iframe",
23
+ "math",
24
+ "noscript",
25
+ "optgroup",
26
+ "option",
27
+ "script",
28
+ "select",
29
+ "style",
30
+ "svg",
31
+ "table",
32
+ "tbody",
33
+ "td",
34
+ "template",
35
+ "textarea",
36
+ "tfoot",
37
+ "th",
38
+ "thead",
39
+ "title",
40
+ "tr"
41
+ ]);
42
+ var _UnsupportedNode = class _UnsupportedNode extends Error {
43
+ };
44
+ __name(_UnsupportedNode, "UnsupportedNode");
45
+ var UnsupportedNode = _UnsupportedNode;
46
+ var _UnsupportedInParserSensitiveElement = class _UnsupportedInParserSensitiveElement extends Error {
47
+ };
48
+ __name(_UnsupportedInParserSensitiveElement, "UnsupportedInParserSensitiveElement");
49
+ var UnsupportedInParserSensitiveElement = _UnsupportedInParserSensitiveElement;
50
+ function getHooksDispatcherSlot(ReactRuntime) {
51
+ const runtime = ReactRuntime;
52
+ const react19 = runtime.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
53
+ if (react19 && "H" in react19) {
54
+ return {
55
+ get: /* @__PURE__ */ __name(() => react19.H, "get"),
56
+ set: /* @__PURE__ */ __name((value) => {
57
+ react19.H = value;
58
+ }, "set")
59
+ };
60
+ }
61
+ const react18 = runtime.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentDispatcher;
62
+ if (react18) {
63
+ return {
64
+ get: /* @__PURE__ */ __name(() => react18.current, "get"),
65
+ set: /* @__PURE__ */ __name((value) => {
66
+ react18.current = value;
67
+ }, "set")
68
+ };
69
+ }
70
+ return null;
71
+ }
72
+ __name(getHooksDispatcherSlot, "getHooksDispatcherSlot");
73
+ var unsupportedHooksDispatcher = /* @__PURE__ */ new Proxy(
74
+ {},
75
+ {
76
+ get(_target, name) {
77
+ return () => {
78
+ throw new UnsupportedNode(`calls ${String(name)}()`);
79
+ };
80
+ }
81
+ }
82
+ );
83
+ function callServerComponent(ReactRuntime, render, props, forwardRef) {
84
+ const slot = getHooksDispatcherSlot(ReactRuntime);
85
+ const previous = slot?.get();
86
+ slot?.set(unsupportedHooksDispatcher);
87
+ try {
88
+ return forwardRef ? render(props, null) : render(props);
89
+ } finally {
90
+ slot?.set(previous);
91
+ }
92
+ }
93
+ __name(callServerComponent, "callServerComponent");
94
+ function isThenable(value) {
95
+ return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
96
+ }
97
+ __name(isThenable, "isThenable");
98
+ function serverHtmlNode(state, node, key, context) {
99
+ if (context.parserSensitive) throw new UnsupportedInParserSensitiveElement();
100
+ const id = state.nextId++;
101
+ state.serverHtml.set(id, node);
102
+ return key === null ? { $: "x", i: id } : { $: "x", i: id, k: String(key) };
103
+ }
104
+ __name(serverHtmlNode, "serverHtmlNode");
105
+ async function resolveProps(state, props, context, host) {
106
+ const entries = await Promise.all(
107
+ Object.entries(props).map(async ([name, value]) => {
108
+ if (value === void 0) return null;
109
+ if (name === "ref") {
110
+ if (value === null) return null;
111
+ throw new UnsupportedNode("receives a ref");
112
+ }
113
+ if (host && typeof value === "function") {
114
+ throw new UnsupportedNode(`passes a function to <${String(name)}>`);
115
+ }
116
+ return [name, await resolveValue(state, value, context, /* @__PURE__ */ new Set())];
117
+ })
118
+ );
119
+ return Object.fromEntries(entries.filter((entry) => entry !== null));
120
+ }
121
+ __name(resolveProps, "resolveProps");
122
+ async function resolveValue(state, value, context, seen) {
123
+ if (value === null || value === void 0) return null;
124
+ if (typeof value === "string" || typeof value === "boolean") return value;
125
+ if (typeof value === "number") {
126
+ return Number.isFinite(value) ? value : { $: "n", v: String(value) };
127
+ }
128
+ if (typeof value !== "object") throw new UnsupportedNode(`passes a ${typeof value} value`);
129
+ if (state.ReactRuntime.isValidElement(value)) {
130
+ return resolveElement(state, value, context);
131
+ }
132
+ if (isThenable(value)) {
133
+ try {
134
+ return { $: "P", v: await resolveValue(state, await value, context, seen) };
135
+ } catch (error) {
136
+ if (error instanceof UnsupportedInParserSensitiveElement) throw error;
137
+ throw new UnsupportedNode("passes a promise that does not resolve to a serializable value");
138
+ }
139
+ }
140
+ if (seen.has(value)) throw new UnsupportedNode("passes a circular value");
141
+ seen.add(value);
142
+ try {
143
+ if (Array.isArray(value)) {
144
+ return await Promise.all(value.map((entry) => resolveValue(state, entry, context, seen)));
145
+ }
146
+ const prototype = Object.getPrototypeOf(value);
147
+ if (prototype !== Object.prototype && prototype !== null) {
148
+ throw new UnsupportedNode("passes a class instance");
149
+ }
150
+ const entries = await Promise.all(
151
+ Object.entries(value).filter(([, entry]) => entry !== void 0).map(
152
+ async ([name, entry]) => [
153
+ name,
154
+ await resolveValue(state, entry, context, seen)
155
+ ]
156
+ )
157
+ );
158
+ const object = Object.fromEntries(entries);
159
+ return Object.prototype.hasOwnProperty.call(object, "$") ? { $: "o", v: object } : object;
160
+ } finally {
161
+ seen.delete(value);
162
+ }
163
+ }
164
+ __name(resolveValue, "resolveValue");
165
+ async function resolveElement(state, element, context) {
166
+ const { ReactRuntime } = state;
167
+ const key = element.key === null || element.key === void 0 ? null : String(element.key);
168
+ const withKey = /* @__PURE__ */ __name((node) => key === null ? node : { ...node, k: key }, "withKey");
169
+ let type = element.type;
170
+ const props = element.props ?? {};
171
+ try {
172
+ if (typeof type === "string") {
173
+ const parserSensitive = context.parserSensitive || PARSER_SENSITIVE_TAGS.has(type);
174
+ try {
175
+ const { children, ...rest } = props;
176
+ const resolved2 = await resolveProps(state, rest, context, true);
177
+ if (children !== void 0) {
178
+ resolved2.children = await resolveValue(state, children, { parserSensitive }, /* @__PURE__ */ new Set());
179
+ }
180
+ return withKey({ $: "h", t: type, p: resolved2 });
181
+ } catch (error) {
182
+ if (error instanceof UnsupportedInParserSensitiveElement && !context.parserSensitive) {
183
+ return serverHtmlNode(state, element, key, context);
184
+ }
185
+ throw error;
186
+ }
187
+ }
188
+ if (type === ReactRuntime.Fragment || type === ReactRuntime.StrictMode) {
189
+ return withKey({
190
+ $: "f",
191
+ c: await resolveValue(state, props.children, context, /* @__PURE__ */ new Set())
192
+ });
193
+ }
194
+ if (type === ReactRuntime.Suspense) {
195
+ const id = state.nextId++;
196
+ const fallback = await resolveValue(state, props.fallback, context, /* @__PURE__ */ new Set());
197
+ const encoded = resolveValue(state, props.children, context, /* @__PURE__ */ new Set()).catch((error) => {
198
+ if (error instanceof UnsupportedNode) {
199
+ return serverHtmlNode(
200
+ state,
201
+ ReactRuntime.createElement(
202
+ ReactRuntime.Fragment,
203
+ null,
204
+ props.children
205
+ ),
206
+ null,
207
+ { parserSensitive: false }
208
+ );
209
+ }
210
+ throw error;
211
+ });
212
+ encoded.catch(() => {
213
+ });
214
+ state.chunks.set(id, { encoded });
215
+ return withKey({ $: "s", f: fallback, i: id });
216
+ }
217
+ const clientReference = getFarmClientReference(type);
218
+ if (clientReference) {
219
+ const { children, ...rest } = props;
220
+ const resolved2 = await resolveProps(state, rest, context, false);
221
+ if (children !== void 0) {
222
+ resolved2.children = await resolveValue(state, children, context, /* @__PURE__ */ new Set());
223
+ }
224
+ state.components.set(
225
+ `${clientReference.reference}#${clientReference.exportName}`,
226
+ clientReference.Component
227
+ );
228
+ return withKey({
229
+ $: "c",
230
+ r: clientReference.reference,
231
+ e: clientReference.exportName,
232
+ p: resolved2
233
+ });
234
+ }
235
+ let forwardRef = false;
236
+ while (type && typeof type === "object") {
237
+ const typeOf = type.$$typeof;
238
+ if (typeOf === MEMO_TYPE) {
239
+ type = type.type;
240
+ if (getFarmClientReference(type)) {
241
+ return resolveElement(
242
+ state,
243
+ ReactRuntime.createElement(type, {
244
+ ...props,
245
+ key: element.key
246
+ }),
247
+ context
248
+ );
249
+ }
250
+ continue;
251
+ }
252
+ if (typeOf === FORWARD_REF_TYPE) {
253
+ type = type.render;
254
+ forwardRef = true;
255
+ break;
256
+ }
257
+ throw new UnsupportedNode("is not a function component");
258
+ }
259
+ if (typeof type !== "function") throw new UnsupportedNode("is not a function component");
260
+ if (type.prototype?.isReactComponent) {
261
+ throw new UnsupportedNode("is a class component");
262
+ }
263
+ let rendered = callServerComponent(
264
+ ReactRuntime,
265
+ type,
266
+ props,
267
+ forwardRef
268
+ );
269
+ if (isThenable(rendered)) rendered = await rendered;
270
+ const resolved = await resolveValue(state, rendered, context, /* @__PURE__ */ new Set());
271
+ return key === null ? resolved : { $: "f", k: key, c: resolved };
272
+ } catch (error) {
273
+ if (error instanceof UnsupportedNode) return serverHtmlNode(state, element, key, context);
274
+ throw error;
275
+ }
276
+ }
277
+ __name(resolveElement, "resolveElement");
278
+ function serializeTreePayload(value) {
279
+ return JSON.stringify(value).replace(/&/g, "\\u0026").replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
280
+ }
281
+ __name(serializeTreePayload, "serializeTreePayload");
282
+ var chunkComponents = /* @__PURE__ */ new WeakMap();
283
+ function getChunkComponent(ReactRuntime) {
284
+ const existing = chunkComponents.get(ReactRuntime.createElement);
285
+ if (existing) return existing;
286
+ function FarmServerTreeChunk({ chunk }) {
287
+ if (chunk.status === "fulfilled") return chunk.value;
288
+ if (chunk.status === "rejected") throw chunk.reason;
289
+ const use = ReactRuntime.use;
290
+ if (typeof use === "function") return use(chunk.promise);
291
+ throw chunk.promise;
292
+ }
293
+ __name(FarmServerTreeChunk, "FarmServerTreeChunk");
294
+ chunkComponents.set(ReactRuntime.createElement, FarmServerTreeChunk);
295
+ return FarmServerTreeChunk;
296
+ }
297
+ __name(getChunkComponent, "getChunkComponent");
298
+ function fulfilledThenable(value) {
299
+ const promise = Promise.resolve(value);
300
+ promise.status = "fulfilled";
301
+ promise.value = value;
302
+ return promise;
303
+ }
304
+ __name(fulfilledThenable, "fulfilledThenable");
305
+ function createTreeChildren(ReactRuntime, children, resolver) {
306
+ if (children === void 0) return [];
307
+ const node = createTreeValue(ReactRuntime, children, resolver);
308
+ return Array.isArray(children) ? node : [node];
309
+ }
310
+ __name(createTreeChildren, "createTreeChildren");
311
+ function createTreeProps(ReactRuntime, props, resolver, key) {
312
+ const { children, ...rest } = props;
313
+ const created = {};
314
+ for (const [name, value] of Object.entries(rest)) {
315
+ created[name] = createTreeValue(ReactRuntime, value, resolver);
316
+ }
317
+ if (typeof key === "string") created.key = key;
318
+ return { props: created, children: createTreeChildren(ReactRuntime, children, resolver) };
319
+ }
320
+ __name(createTreeProps, "createTreeProps");
321
+ function createTreeValue(ReactRuntime, value, resolver) {
322
+ if (value === null || typeof value !== "object") return value;
323
+ if (Array.isArray(value))
324
+ return value.map((entry) => createTreeValue(ReactRuntime, entry, resolver));
325
+ switch (value.$) {
326
+ case "h": {
327
+ const { props, children } = createTreeProps(
328
+ ReactRuntime,
329
+ value.p,
330
+ resolver,
331
+ value.k
332
+ );
333
+ return ReactRuntime.createElement(value.t, props, ...children);
334
+ }
335
+ case "c": {
336
+ const { props, children } = createTreeProps(
337
+ ReactRuntime,
338
+ value.p,
339
+ resolver,
340
+ value.k
341
+ );
342
+ return ReactRuntime.createElement(
343
+ resolver.component(value.r, value.e),
344
+ props,
345
+ ...children
346
+ );
347
+ }
348
+ case "f":
349
+ return ReactRuntime.createElement(
350
+ ReactRuntime.Fragment,
351
+ typeof value.k === "string" ? { key: value.k } : null,
352
+ ...createTreeChildren(ReactRuntime, value.c, resolver)
353
+ );
354
+ case "s":
355
+ return ReactRuntime.createElement(
356
+ ReactRuntime.Suspense,
357
+ {
358
+ ...typeof value.k === "string" ? { key: value.k } : {},
359
+ fallback: createTreeValue(
360
+ ReactRuntime,
361
+ value.f,
362
+ resolver
363
+ )
364
+ },
365
+ ReactRuntime.createElement(getChunkComponent(ReactRuntime), {
366
+ chunk: resolver.chunk(value.i)
367
+ })
368
+ );
369
+ case "x":
370
+ return resolver.serverHtml(value.i, typeof value.k === "string" ? value.k : null);
371
+ case "n":
372
+ return Number(value.v);
373
+ case "P":
374
+ return fulfilledThenable(createTreeValue(ReactRuntime, value.v, resolver));
375
+ case "o": {
376
+ const object = value.v;
377
+ return Object.fromEntries(
378
+ Object.entries(object).map(([name, entry]) => [
379
+ name,
380
+ createTreeValue(ReactRuntime, entry, resolver)
381
+ ])
382
+ );
383
+ }
384
+ default:
385
+ return Object.fromEntries(
386
+ Object.entries(value).map(([name, entry]) => [
387
+ name,
388
+ createTreeValue(ReactRuntime, entry, resolver)
389
+ ])
390
+ );
391
+ }
392
+ }
393
+ __name(createTreeValue, "createTreeValue");
394
+ function createTreeScript(ReactRuntime, attribute, value, json) {
395
+ return ReactRuntime.createElement("script", {
396
+ type: "application/json",
397
+ [attribute]: value,
398
+ dangerouslySetInnerHTML: { __html: json }
399
+ });
400
+ }
401
+ __name(createTreeScript, "createTreeScript");
402
+ function createTreePage(ReactRuntime, tree, json, resolver, key) {
403
+ return ReactRuntime.createElement(
404
+ ReactRuntime.Fragment,
405
+ key === void 0 ? null : { key },
406
+ createTreeValue(ReactRuntime, tree, resolver),
407
+ createTreeScript(ReactRuntime, FARM_SERVER_TREE_ATTRIBUTE, "", json)
408
+ );
409
+ }
410
+ __name(createTreePage, "createTreePage");
411
+ async function renderFarmServerTreePage(ReactRuntime, element, options) {
412
+ const state = {
413
+ ReactRuntime,
414
+ nextId: 0,
415
+ components: /* @__PURE__ */ new Map(),
416
+ serverHtml: /* @__PURE__ */ new Map(),
417
+ chunks: /* @__PURE__ */ new Map()
418
+ };
419
+ const tree = await resolveValue(state, element, { parserSensitive: false }, /* @__PURE__ */ new Set());
420
+ const resolver = {
421
+ component(reference, exportName) {
422
+ const Component = state.components.get(`${reference}#${exportName}`);
423
+ if (!Component)
424
+ throw new Error(`client reference ${reference}#${exportName} was not resolved`);
425
+ return Component;
426
+ },
427
+ chunk(id) {
428
+ const entry = state.chunks.get(id);
429
+ if (entry.chunk) return entry.chunk;
430
+ const chunk = {
431
+ status: "pending",
432
+ promise: entry.encoded.then(
433
+ (encoded) => {
434
+ chunk.value = ReactRuntime.createElement(
435
+ ReactRuntime.Fragment,
436
+ null,
437
+ createTreeValue(ReactRuntime, encoded, resolver),
438
+ createTreeScript(
439
+ ReactRuntime,
440
+ SERVER_TREE_CHUNK_ATTRIBUTE,
441
+ String(id),
442
+ serializeTreePayload({ t: encoded })
443
+ )
444
+ );
445
+ chunk.status = "fulfilled";
446
+ return chunk.value;
447
+ },
448
+ (error) => {
449
+ chunk.status = "rejected";
450
+ chunk.reason = error;
451
+ throw error;
452
+ }
453
+ )
454
+ };
455
+ chunk.promise.catch(() => {
456
+ });
457
+ entry.chunk = chunk;
458
+ return chunk;
459
+ },
460
+ serverHtml(id, key) {
461
+ return ReactRuntime.createElement(
462
+ SERVER_HTML_TAG,
463
+ {
464
+ ...key === null ? {} : { key },
465
+ [SERVER_HTML_ATTRIBUTE]: String(id),
466
+ style: { display: "contents" }
467
+ },
468
+ options.isolate(state.serverHtml.get(id))
469
+ );
470
+ }
471
+ };
472
+ const page = createTreePage(
473
+ ReactRuntime,
474
+ tree,
475
+ serializeTreePayload({ v: 1, t: tree }),
476
+ resolver
477
+ );
478
+ return ReactRuntime.createElement(/* @__PURE__ */ __name(function FarmServerTreePage() {
479
+ return page;
480
+ }, "FarmServerTreePage"));
481
+ }
482
+ __name(renderFarmServerTreePage, "renderFarmServerTreePage");
483
+ function collectReferences(value, references) {
484
+ if (value === null || typeof value !== "object") return;
485
+ if (Array.isArray(value)) {
486
+ for (const entry of value) collectReferences(entry, references);
487
+ return;
488
+ }
489
+ if (value.$ === "c") references.add(`${value.r}#${value.e}`);
490
+ for (const entry of Object.values(value)) collectReferences(entry, references);
491
+ }
492
+ __name(collectReferences, "collectReferences");
493
+ function parseHtml(html) {
494
+ const template = document.createElement("template");
495
+ template.innerHTML = html;
496
+ return template.content;
497
+ }
498
+ __name(parseHtml, "parseHtml");
499
+ function originalExport(module, exportName) {
500
+ const Component = module.__farm_client_boundary_originals__?.[exportName];
501
+ if (typeof Component !== "function" && typeof Component !== "object") {
502
+ throw new Error(`compiled original export ${exportName} was not found`);
503
+ }
504
+ return Component;
505
+ }
506
+ __name(originalExport, "originalExport");
507
+ async function createFarmServerTreeElement(ReactRuntime, source, options) {
508
+ const root = typeof source === "string" ? parseHtml(source) : source;
509
+ const script = root.querySelector(`script[${FARM_SERVER_TREE_ATTRIBUTE}]`);
510
+ if (!script) return null;
511
+ const json = script.textContent ?? "";
512
+ const payload = JSON.parse(json);
513
+ if (payload.v !== 1) throw new Error("unsupported server tree payload version");
514
+ const chunks = /* @__PURE__ */ new Map();
515
+ for (const chunkScript of root.querySelectorAll(
516
+ `script[${SERVER_TREE_CHUNK_ATTRIBUTE}]`
517
+ )) {
518
+ const chunkJson = chunkScript.textContent ?? "";
519
+ chunks.set(Number(chunkScript.getAttribute(SERVER_TREE_CHUNK_ATTRIBUTE)), {
520
+ tree: JSON.parse(chunkJson).t,
521
+ json: chunkJson
522
+ });
523
+ }
524
+ const references = /* @__PURE__ */ new Set();
525
+ collectReferences(payload.t, references);
526
+ for (const chunk of chunks.values()) collectReferences(chunk.tree, references);
527
+ const components = /* @__PURE__ */ new Map();
528
+ await Promise.all(
529
+ Array.from(references, async (key) => {
530
+ const separator = key.lastIndexOf("#");
531
+ const reference = key.slice(0, separator);
532
+ components.set(key, originalExport(await options.load(reference), key.slice(separator + 1)));
533
+ })
534
+ );
535
+ const serverHtml = /* @__PURE__ */ new Map();
536
+ for (const container of root.querySelectorAll(`${SERVER_HTML_TAG}[${SERVER_HTML_ATTRIBUTE}]`)) {
537
+ serverHtml.set(Number(container.getAttribute(SERVER_HTML_ATTRIBUTE)), container.innerHTML);
538
+ }
539
+ const resolver = {
540
+ component(reference, exportName) {
541
+ const Component = components.get(`${reference}#${exportName}`);
542
+ if (!Component) throw new Error(`client reference ${reference}#${exportName} was not loaded`);
543
+ return Component;
544
+ },
545
+ chunk(id) {
546
+ const chunk = chunks.get(id);
547
+ if (!chunk) throw new Error(`server tree chunk ${id} was not found`);
548
+ const value = ReactRuntime.createElement(
549
+ ReactRuntime.Fragment,
550
+ null,
551
+ createTreeValue(ReactRuntime, chunk.tree, resolver),
552
+ createTreeScript(ReactRuntime, SERVER_TREE_CHUNK_ATTRIBUTE, String(id), chunk.json)
553
+ );
554
+ return { status: "fulfilled", value, promise: Promise.resolve(value) };
555
+ },
556
+ serverHtml(id, key) {
557
+ const html = serverHtml.get(id);
558
+ if (html === void 0) throw new Error(`server HTML ${id} was not found`);
559
+ return ReactRuntime.createElement(options.ServerHtml, {
560
+ ...key === null ? {} : { key },
561
+ as: SERVER_HTML_TAG,
562
+ [SERVER_HTML_ATTRIBUTE]: String(id),
563
+ style: { display: "contents" },
564
+ suppressHydrationWarning: true,
565
+ dangerouslySetInnerHTML: { __html: html }
566
+ });
567
+ }
568
+ };
569
+ const build = /* @__PURE__ */ __name(() => createTreePage(ReactRuntime, payload.t, json, resolver), "build");
570
+ build();
571
+ function FarmServerTreePage() {
572
+ const [, setVersion] = ReactRuntime.useState(0);
573
+ ReactRuntime.useEffect(() => {
574
+ const listener = /* @__PURE__ */ __name((reference, module) => {
575
+ let changed = false;
576
+ for (const key of components.keys()) {
577
+ const separator = key.lastIndexOf("#");
578
+ if (key.slice(0, separator) !== reference) continue;
579
+ components.set(key, originalExport(module, key.slice(separator + 1)));
580
+ changed = true;
581
+ }
582
+ if (changed) setVersion((version) => version + 1);
583
+ return changed;
584
+ }, "listener");
585
+ return subscribeFarmServerTreeUpdates(listener);
586
+ }, []);
587
+ return build();
588
+ }
589
+ __name(FarmServerTreePage, "FarmServerTreePage");
590
+ return ReactRuntime.createElement(
591
+ FarmServerTreePage,
592
+ options.key === void 0 ? null : { key: options.key }
593
+ );
594
+ }
595
+ __name(createFarmServerTreeElement, "createFarmServerTreeElement");
596
+
597
+ export {
598
+ FARM_SERVER_TREE_ATTRIBUTE,
599
+ renderFarmServerTreePage,
600
+ createFarmServerTreeElement
601
+ };
@@ -27,7 +27,7 @@ import {
27
27
  } from "./chunk-ZMSZZXOR.mjs";
28
28
  import {
29
29
  getIntegrationSchemas
30
- } from "./chunk-JLCQGPXE.mjs";
30
+ } from "./chunk-HMIJDL7S.mjs";
31
31
  import {
32
32
  __name
33
33
  } from "./chunk-LPEX4YW6.mjs";
@@ -419,6 +419,30 @@ async function readNodeRequestBody(request, limit) {
419
419
  });
420
420
  }
421
421
  _chunkS3JO3N4Hcjs.__name.call(void 0, readNodeRequestBody, "readNodeRequestBody");
422
+ function createFarmNodeRequestBodyStream(request) {
423
+ let iterator;
424
+ return new ReadableStream(
425
+ {
426
+ async pull(controller) {
427
+ _nullishCoalesce(iterator, () => ( (iterator = request[Symbol.asyncIterator]())));
428
+ const { value, done } = await iterator.next();
429
+ if (done) {
430
+ controller.close();
431
+ return;
432
+ }
433
+ controller.enqueue(
434
+ value instanceof Uint8Array ? value : new TextEncoder().encode(String(value))
435
+ );
436
+ },
437
+ async cancel(reason) {
438
+ await _optionalChain([iterator, 'optionalAccess', _31 => _31.return, 'optionalCall', _32 => _32(reason)]);
439
+ }
440
+ },
441
+ // No eager pull: the request stays untouched until the handler reads it.
442
+ { highWaterMark: 0 }
443
+ );
444
+ }
445
+ _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmNodeRequestBodyStream, "createFarmNodeRequestBodyStream");
422
446
  function createFarmRequestBodyErrorResponse(error) {
423
447
  if (!(error instanceof FarmRequestBodyError)) return null;
424
448
  return new Response(error.status === 413 ? "Payload Too Large" : "Bad Request", {
@@ -432,7 +456,7 @@ function createFarmRequestBodyErrorResponse(error) {
432
456
  }
433
457
  _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmRequestBodyErrorResponse, "createFarmRequestBodyErrorResponse");
434
458
  function validateContentLength(value, limit) {
435
- const contentLength = _optionalChain([value, 'optionalAccess', _31 => _31.trim, 'call', _32 => _32()]);
459
+ const contentLength = _optionalChain([value, 'optionalAccess', _33 => _33.trim, 'call', _34 => _34()]);
436
460
  if (!contentLength) return;
437
461
  if (!/^\d+$/.test(contentLength)) {
438
462
  throw new FarmRequestBodyError("INVALID_CONTENT_LENGTH", 400, "Invalid content-length header");
@@ -467,4 +491,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, throwIfAborted, "throwIfAborted");
467
491
 
468
492
 
469
493
 
470
- exports.setRequestContext = setRequestContext; exports.getRequestContext = getRequestContext; exports.hasRequestContext = hasRequestContext; exports.deleteRequestContext = deleteRequestContext; exports.clearRequestContext = clearRequestContext; exports.getRequestContextSnapshot = getRequestContextSnapshot; exports.copyRequestContext = copyRequestContext; exports.createFarmNodeRequestAbortSignal = createFarmNodeRequestAbortSignal; exports.DEFAULT_FARM_SERVER_BODY_SIZE_LIMIT = DEFAULT_FARM_SERVER_BODY_SIZE_LIMIT; exports.matchesFarmIfNoneMatch = matchesFarmIfNoneMatch; exports.resolveFarmServerConfig = resolveFarmServerConfig; exports.parseBodySizeLimit = parseBodySizeLimit; exports.cloneFarmRequestWithContext = cloneFarmRequestWithContext; exports.bufferFarmRequestBody = bufferFarmRequestBody; exports.readFarmRequestBody = readFarmRequestBody; exports.readNodeRequestBody = readNodeRequestBody; exports.createFarmRequestBodyErrorResponse = createFarmRequestBodyErrorResponse;
494
+
495
+ exports.setRequestContext = setRequestContext; exports.getRequestContext = getRequestContext; exports.hasRequestContext = hasRequestContext; exports.deleteRequestContext = deleteRequestContext; exports.clearRequestContext = clearRequestContext; exports.getRequestContextSnapshot = getRequestContextSnapshot; exports.copyRequestContext = copyRequestContext; exports.createFarmNodeRequestAbortSignal = createFarmNodeRequestAbortSignal; exports.DEFAULT_FARM_SERVER_BODY_SIZE_LIMIT = DEFAULT_FARM_SERVER_BODY_SIZE_LIMIT; exports.matchesFarmIfNoneMatch = matchesFarmIfNoneMatch; exports.resolveFarmServerConfig = resolveFarmServerConfig; exports.parseBodySizeLimit = parseBodySizeLimit; exports.cloneFarmRequestWithContext = cloneFarmRequestWithContext; exports.bufferFarmRequestBody = bufferFarmRequestBody; exports.readFarmRequestBody = readFarmRequestBody; exports.readNodeRequestBody = readNodeRequestBody; exports.createFarmNodeRequestBodyStream = createFarmNodeRequestBodyStream; exports.createFarmRequestBodyErrorResponse = createFarmRequestBodyErrorResponse;
@@ -15,10 +15,10 @@ import {
15
15
  } from "./chunk-TVGP4BBZ.mjs";
16
16
  import {
17
17
  farmAcceptQuality
18
- } from "./chunk-JBC2FKRW.mjs";
18
+ } from "./chunk-WWIKMBRN.mjs";
19
19
  import {
20
20
  matchesFarmIfNoneMatch
21
- } from "./chunk-XF7Q24PF.mjs";
21
+ } from "./chunk-Y7RKTKYI.mjs";
22
22
  import {
23
23
  __name
24
24
  } from "./chunk-LPEX4YW6.mjs";