@farm.js/core 0.1.34 → 0.1.36

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 (282) hide show
  1. package/dist/agent-mcp-BVExL8rZ.d.mts +109 -0
  2. package/dist/agent-mcp-handler-LPJ2CADR.mjs +19 -0
  3. package/dist/agent-mcp-handler-SJAHFSPI.cjs +19 -0
  4. package/dist/agent-mcp-luzfXK-P.d.ts +109 -0
  5. package/dist/agent-runtime.cjs +5 -3
  6. package/dist/agent-runtime.d.mts +4 -5
  7. package/dist/agent-runtime.d.ts +4 -5
  8. package/dist/agent-runtime.mjs +4 -2
  9. package/dist/api/route-manager.cjs +7 -7
  10. package/dist/api/route-manager.d.mts +15 -10
  11. package/dist/api/route-manager.d.ts +15 -10
  12. package/dist/api/route-manager.mjs +6 -6
  13. package/dist/api/runtime.cjs +7 -5
  14. package/dist/api/runtime.d.mts +7 -66
  15. package/dist/api/runtime.d.ts +7 -66
  16. package/dist/api/runtime.mjs +7 -5
  17. package/dist/api.cjs +9 -9
  18. package/dist/api.d.mts +8 -9
  19. package/dist/api.d.ts +8 -9
  20. package/dist/api.mjs +8 -8
  21. package/dist/{app-q4rmZlXK.d.mts → app-BukwkFIu.d.mts} +52 -12
  22. package/dist/{app-DgotYGbq.d.ts → app-Yfa2dsFy.d.ts} +52 -12
  23. package/dist/app-markdown.cjs +6 -6
  24. package/dist/app-markdown.d.mts +5 -6
  25. package/dist/app-markdown.d.ts +5 -6
  26. package/dist/app-markdown.mjs +5 -5
  27. package/dist/{chunk-XV5DJTBX.mjs → chunk-276VJSM6.mjs} +627 -260
  28. package/dist/{chunk-36MK5YCW.cjs → chunk-2YTDKNH3.cjs} +547 -240
  29. package/dist/{chunk-VHANUNEG.mjs → chunk-35GKZR22.mjs} +2 -2
  30. package/dist/{chunk-LR5QSC2P.mjs → chunk-35WV46VL.mjs} +399 -92
  31. package/dist/{chunk-UX5S4JEO.cjs → chunk-42NHY7HW.cjs} +57 -7
  32. package/dist/{chunk-U4PTAHW3.mjs → chunk-4E5AEDKY.mjs} +7 -11
  33. package/dist/{chunk-NGVORZVZ.mjs → chunk-4E5WBPEG.mjs} +73 -351
  34. package/dist/{chunk-AQZFOP7S.mjs → chunk-4GLOOWKE.mjs} +5 -5
  35. package/dist/{chunk-7BT4H4P7.cjs → chunk-4NU4GGTC.cjs} +2 -2
  36. package/dist/{chunk-AGC75XAE.mjs → chunk-4WCZJQUO.mjs} +55 -5
  37. package/dist/chunk-4WQ6PGSJ.cjs +367 -0
  38. package/dist/{chunk-QCFFHV5H.mjs → chunk-4WVJLURN.mjs} +1 -1
  39. package/dist/chunk-6SJ2KJTA.mjs +314 -0
  40. package/dist/chunk-75RZHGLS.cjs +135 -0
  41. package/dist/{chunk-P64MIF5B.cjs → chunk-ADEA7PN3.cjs} +483 -60
  42. package/dist/{chunk-YQVSHTMR.mjs → chunk-AJQTP4OO.mjs} +1 -1
  43. package/dist/{chunk-TA5G2HWD.cjs → chunk-AO6RYU5N.cjs} +31 -28
  44. package/dist/{chunk-MOKLYNHV.cjs → chunk-BO36SELV.cjs} +6 -6
  45. package/dist/{chunk-7Y6ZNFPX.mjs → chunk-BPOF5U4N.mjs} +17 -7
  46. package/dist/{chunk-JHWOVJ3M.mjs → chunk-BUGNQIHC.mjs} +5 -0
  47. package/dist/{chunk-TDFPACVX.cjs → chunk-CBJJH36A.cjs} +50 -25
  48. package/dist/{chunk-VKNHTSAP.cjs → chunk-CGBDNNSM.cjs} +2 -2
  49. package/dist/chunk-CI6E3UOH.cjs +314 -0
  50. package/dist/{chunk-QZCT2CQ4.mjs → chunk-CXEN47J3.mjs} +64 -2
  51. package/dist/{chunk-ATK2R4CH.cjs → chunk-D227TIEN.cjs} +14 -4
  52. package/dist/{chunk-QGYRXFU2.cjs → chunk-D2BB47NB.cjs} +8 -8
  53. package/dist/chunk-DTSROJ5J.mjs +367 -0
  54. package/dist/{chunk-ODBZYBAB.cjs → chunk-DZ5ZVB2K.cjs} +1 -1
  55. package/dist/{chunk-ROUTX2E5.cjs → chunk-ECKF2BAM.cjs} +18 -5
  56. package/dist/{chunk-3LUF2PE2.cjs → chunk-EK4QAEFZ.cjs} +67 -5
  57. package/dist/{chunk-VVBO3QH7.mjs → chunk-ENLZ4R3Y.mjs} +10 -1
  58. package/dist/{chunk-XXJU7FCC.cjs → chunk-EUV4YR3V.cjs} +2 -2
  59. package/dist/{chunk-HR5KPHC2.mjs → chunk-EWET4D2Y.mjs} +1 -1
  60. package/dist/{chunk-PXKIEXZD.mjs → chunk-F5QO4FNE.mjs} +1 -1
  61. package/dist/{chunk-MIDIZJZC.cjs → chunk-FO427P6I.cjs} +22 -12
  62. package/dist/{chunk-AWC4VUZL.cjs → chunk-GQ3Z3IZI.cjs} +14 -14
  63. package/dist/{chunk-JDPAKVS4.mjs → chunk-GQRWBCWK.mjs} +8 -5
  64. package/dist/{chunk-75WGQVQA.cjs → chunk-HITLGIAO.cjs} +10 -1
  65. package/dist/{chunk-WNNYOOIB.mjs → chunk-HOXTWRGB.mjs} +1 -1
  66. package/dist/{chunk-KROWKCUH.cjs → chunk-JGLC4TO3.cjs} +8 -1
  67. package/dist/{chunk-QJ3J6MZT.cjs → chunk-JNUWCDTF.cjs} +8 -8
  68. package/dist/{chunk-BTAG7LI7.cjs → chunk-JZVADIOD.cjs} +2 -2
  69. package/dist/{chunk-EM6SBQKM.cjs → chunk-KIIMAWOJ.cjs} +37 -2
  70. package/dist/{chunk-43FMW62B.mjs → chunk-KMTGADN3.mjs} +28 -0
  71. package/dist/{chunk-GOABMOX3.mjs → chunk-LSZAVSGY.mjs} +468 -45
  72. package/dist/{chunk-2NQQ5H5G.cjs → chunk-M7MKQXAF.cjs} +2 -1
  73. package/dist/{chunk-GNSDTTWZ.mjs → chunk-MKYBIIAQ.mjs} +30 -5
  74. package/dist/{chunk-ZHPHJPQP.cjs → chunk-MRMI32SN.cjs} +88 -366
  75. package/dist/{chunk-7M52YUMY.cjs → chunk-N2NAS2AM.cjs} +2 -2
  76. package/dist/{chunk-SJVKK4JE.cjs → chunk-NMHWYWDR.cjs} +1144 -777
  77. package/dist/chunk-NRDBW4MP.mjs +45 -0
  78. package/dist/{chunk-657WJNRY.mjs → chunk-O6I6VWKK.mjs} +20 -5
  79. package/dist/{chunk-O27L4YAA.mjs → chunk-O6WAEAX3.mjs} +2 -2
  80. package/dist/chunk-OFZUJMCU.mjs +601 -0
  81. package/dist/{chunk-ZKP7C2B6.mjs → chunk-OHLSEQ57.mjs} +22 -13
  82. package/dist/{chunk-X242HVD5.mjs → chunk-OO7GXVSR.mjs} +1 -1
  83. package/dist/chunk-PTZ2TVNE.cjs +178 -0
  84. package/dist/{chunk-3ATMYLLJ.mjs → chunk-Q2KB32T4.mjs} +1 -1
  85. package/dist/{chunk-LHODW25H.mjs → chunk-QORUJDIV.mjs} +2 -2
  86. package/dist/{chunk-UBO4SGH4.mjs → chunk-RHAZ22ZN.mjs} +2 -1
  87. package/dist/{chunk-G26MUMKL.cjs → chunk-S6VYG6XU.cjs} +23 -8
  88. package/dist/{chunk-6VVL3MHY.mjs → chunk-SC2WYWPF.mjs} +1 -1
  89. package/dist/{chunk-MPEYMSCF.cjs → chunk-SDOTRX3V.cjs} +5 -5
  90. package/dist/{chunk-BMWDEBXO.cjs → chunk-SHLXACIO.cjs} +31 -3
  91. package/dist/{chunk-LMJ7VRHZ.mjs → chunk-T4OGRVNS.mjs} +13 -3
  92. package/dist/{chunk-T5CERMEH.cjs → chunk-T5OJPTVN.cjs} +2 -2
  93. package/dist/{chunk-Z2YLTERK.cjs → chunk-TE2G5ION.cjs} +6 -6
  94. package/dist/chunk-UH6QN5NL.mjs +178 -0
  95. package/dist/{chunk-PQDFUSXD.cjs → chunk-UVW64BCB.cjs} +44 -35
  96. package/dist/{chunk-VCCUOMQN.mjs → chunk-VILIPRS6.mjs} +1 -1
  97. package/dist/{chunk-A5FGU2WU.cjs → chunk-VQLJWDVW.cjs} +19 -23
  98. package/dist/{chunk-VPTDD5XF.cjs → chunk-WBKEZXWE.cjs} +5 -0
  99. package/dist/{chunk-K3F2E6GS.cjs → chunk-WC5UV2HQ.cjs} +2 -2
  100. package/dist/chunk-WWFTAUFG.cjs +45 -0
  101. package/dist/{chunk-ZUSJDQ2Q.mjs → chunk-WWIKMBRN.mjs} +1 -1
  102. package/dist/{chunk-3VSKDFAT.mjs → chunk-WZ77PUAM.mjs} +1 -1
  103. package/dist/{chunk-CLJYVZAD.mjs → chunk-XCMCS4DA.mjs} +11 -1
  104. package/dist/{chunk-F6OHXPWR.mjs → chunk-YFILVET3.mjs} +8 -1
  105. package/dist/{chunk-DZ4DTRJ5.cjs → chunk-YKX5BK66.cjs} +7 -7
  106. package/dist/chunk-YSLWRWWP.cjs +601 -0
  107. package/dist/{chunk-LI2LMOLR.mjs → chunk-YWMZUGIS.mjs} +18 -5
  108. package/dist/chunk-ZLAT2CWY.mjs +135 -0
  109. package/dist/{chunk-XF7Q24PF.mjs → chunk-ZMMBIVQM.mjs} +35 -0
  110. package/dist/{chunk-U74I55WB.cjs → chunk-ZWM5KGAA.cjs} +19 -9
  111. package/dist/{client-plugins-CLObcuCq.d.mts → client-plugins-C3mK9Pol.d.mts} +300 -7
  112. package/dist/{client-plugins-DZjHC4Mi.d.ts → client-plugins-r1mOtSC1.d.ts} +300 -7
  113. package/dist/client-plugins.d.mts +4 -5
  114. package/dist/client-plugins.d.ts +4 -5
  115. package/dist/client.cjs +5 -5
  116. package/dist/client.d.mts +8 -9
  117. package/dist/client.d.ts +8 -9
  118. package/dist/client.mjs +4 -4
  119. package/dist/config.d.mts +4 -5
  120. package/dist/config.d.ts +4 -5
  121. package/dist/{devtools-RNXCTS4R.mjs → devtools-ERIKFEXX.mjs} +11 -10
  122. package/dist/{devtools-HU6Y2MNV.cjs → devtools-JZJJY5CK.cjs} +12 -11
  123. package/dist/docs.cjs +15 -14
  124. package/dist/docs.d.mts +41 -4
  125. package/dist/docs.d.ts +41 -4
  126. package/dist/docs.mjs +14 -13
  127. package/dist/i18n/client.d.mts +2 -2
  128. package/dist/i18n/client.d.ts +2 -2
  129. package/dist/i18n/index.d.mts +3 -3
  130. package/dist/i18n/index.d.ts +3 -3
  131. package/dist/i18n/server.d.mts +5 -5
  132. package/dist/i18n/server.d.ts +5 -5
  133. package/dist/image/server.cjs +3 -3
  134. package/dist/image/server.mjs +2 -2
  135. package/dist/image/sharp.cjs +10 -10
  136. package/dist/image/sharp.mjs +2 -2
  137. package/dist/{index-a-8Z5kZU.d.mts → index-BJJfLxJo.d.mts} +2 -2
  138. package/dist/{index-BWVfxIsO.d.ts → index-CwoOP-MW.d.ts} +2 -2
  139. package/dist/index.cjs +51 -44
  140. package/dist/index.d.mts +20 -21
  141. package/dist/index.d.ts +20 -21
  142. package/dist/index.mjs +50 -43
  143. package/dist/integrations.cjs +7 -3
  144. package/dist/integrations.d.mts +4 -5
  145. package/dist/integrations.d.ts +4 -5
  146. package/dist/integrations.mjs +6 -2
  147. package/dist/internal/app-markdown-runtime.cjs +5 -5
  148. package/dist/internal/app-markdown-runtime.d.mts +5 -6
  149. package/dist/internal/app-markdown-runtime.d.ts +5 -6
  150. package/dist/internal/app-markdown-runtime.mjs +4 -4
  151. package/dist/internal/build-runtime.cjs +32 -30
  152. package/dist/internal/build-runtime.d.mts +6 -7
  153. package/dist/internal/build-runtime.d.ts +6 -7
  154. package/dist/internal/build-runtime.mjs +31 -29
  155. package/dist/internal/cli-runtime.cjs +17 -16
  156. package/dist/internal/cli-runtime.mjs +16 -15
  157. package/dist/internal/client-error-overlay.cjs +6 -6
  158. package/dist/internal/client-error-overlay.mjs +2 -2
  159. package/dist/internal/client-runtime.cjs +2 -2
  160. package/dist/internal/client-runtime.mjs +1 -1
  161. package/dist/internal/compression-runtime.d.mts +4 -5
  162. package/dist/internal/compression-runtime.d.ts +4 -5
  163. package/dist/internal/config-runtime.cjs +12 -11
  164. package/dist/internal/config-runtime.d.mts +5 -6
  165. package/dist/internal/config-runtime.d.ts +5 -6
  166. package/dist/internal/config-runtime.mjs +11 -10
  167. package/dist/internal/isolated-boundary.cjs +3 -2
  168. package/dist/internal/isolated-boundary.d.mts +1 -1
  169. package/dist/internal/isolated-boundary.d.ts +1 -1
  170. package/dist/internal/isolated-boundary.mjs +2 -1
  171. package/dist/internal/metadata-image-runtime.cjs +3 -3
  172. package/dist/internal/metadata-image-runtime.mjs +2 -2
  173. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  174. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  175. package/dist/internal/production-runtime.cjs +63 -25
  176. package/dist/internal/production-runtime.d.mts +117 -37
  177. package/dist/internal/production-runtime.d.ts +117 -37
  178. package/dist/internal/production-runtime.mjs +65 -27
  179. package/dist/internal/server-tree.cjs +12 -0
  180. package/dist/internal/server-tree.d.mts +27 -0
  181. package/dist/internal/server-tree.d.ts +27 -0
  182. package/dist/internal/server-tree.mjs +12 -0
  183. package/dist/{layers-BRQF5ETU.mjs → layers-UTB43B7A.mjs} +1 -1
  184. package/dist/layers-VUWIOFEO.cjs +18 -0
  185. package/dist/markdown.cjs +4 -4
  186. package/dist/markdown.d.mts +4 -5
  187. package/dist/markdown.d.ts +4 -5
  188. package/dist/markdown.mjs +3 -3
  189. package/dist/middleware.cjs +7 -7
  190. package/dist/middleware.d.mts +6 -7
  191. package/dist/middleware.d.ts +6 -7
  192. package/dist/middleware.mjs +6 -6
  193. package/dist/navigation.cjs +5 -5
  194. package/dist/navigation.d.mts +7 -8
  195. package/dist/navigation.d.ts +7 -8
  196. package/dist/navigation.mjs +4 -4
  197. package/dist/{nitro-HSAQFXSS.cjs → nitro-7F65EZZS.cjs} +3 -3
  198. package/dist/{nitro-4XGPNIK4.mjs → nitro-MPZJGPXK.mjs} +2 -2
  199. package/dist/{observability-BupkiN0m.d.mts → observability-CoXunYhS.d.mts} +4 -3
  200. package/dist/{observability-BupkiN0m.d.ts → observability-CoXunYhS.d.ts} +4 -3
  201. package/dist/observability.d.mts +1 -1
  202. package/dist/observability.d.ts +1 -1
  203. package/dist/plugin.cjs +28 -26
  204. package/dist/plugin.d.mts +4 -5
  205. package/dist/plugin.d.ts +4 -5
  206. package/dist/plugin.mjs +27 -25
  207. package/dist/{production-runtime-CysZl3EV.d.mts → production-runtime-CCeVZXst.d.mts} +4 -4
  208. package/dist/{production-runtime-BU5ETAK9.d.ts → production-runtime-DPnsggY3.d.ts} +4 -4
  209. package/dist/query/client.cjs +6 -6
  210. package/dist/query/client.mjs +2 -2
  211. package/dist/{render-plan-CKr4ltOd.d.mts → render-plan-BuGaPFe6.d.mts} +1 -1
  212. package/dist/{render-plan-D72O1qm4.d.ts → render-plan-Cw4f5E_R.d.ts} +1 -1
  213. package/dist/renderer/react/server.cjs +10 -4
  214. package/dist/renderer/react/server.d.mts +2 -1
  215. package/dist/renderer/react/server.d.ts +2 -1
  216. package/dist/renderer/react/server.mjs +7 -1
  217. package/dist/renderer-client.cjs +5 -5
  218. package/dist/renderer-client.d.mts +6 -7
  219. package/dist/renderer-client.d.ts +6 -7
  220. package/dist/renderer-client.mjs +2 -2
  221. package/dist/renderer.d.mts +2 -0
  222. package/dist/renderer.d.ts +2 -0
  223. package/dist/{request-DbyOYI2j.d.ts → request-Bkg-hERy.d.ts} +1 -1
  224. package/dist/{request-Be83WafN.d.mts → request-CsGARcAw.d.mts} +1 -1
  225. package/dist/request.d.mts +5 -6
  226. package/dist/request.d.ts +5 -6
  227. package/dist/{resolver-PPEeiJ6M.d.ts → resolver-DadfRL6F.d.ts} +1 -1
  228. package/dist/{resolver-DhW0CqZN.d.mts → resolver-khasx3fU.d.mts} +1 -1
  229. package/dist/{route-rendering-CtVMpV-k.d.ts → route-rendering-BUZMH_64.d.ts} +1 -1
  230. package/dist/{route-rendering-BG56SzvJ.d.mts → route-rendering-f11yh5dp.d.mts} +1 -1
  231. package/dist/{router-D94-SDlW.d.ts → router-B8CR9GbD.d.ts} +1 -1
  232. package/dist/{router-ALUvm8gC.d.mts → router-Cp6yRE8A.d.mts} +1 -1
  233. package/dist/routes.d.mts +4 -5
  234. package/dist/routes.d.ts +4 -5
  235. package/dist/{runtime-BirxPwbZ.d.ts → runtime-BgDQzBiu.d.ts} +2 -2
  236. package/dist/runtime-CAEv36S_.d.mts +69 -0
  237. package/dist/runtime-CQVsT330.d.ts +69 -0
  238. package/dist/{runtime-AOJge4vQ.d.mts → runtime-CV2UCV-5.d.mts} +2 -2
  239. package/dist/server-action-security.cjs +3 -3
  240. package/dist/server-action-security.mjs +2 -2
  241. package/dist/server-fn.cjs +4 -4
  242. package/dist/server-fn.mjs +3 -3
  243. package/dist/server-plugins.d.mts +5 -6
  244. package/dist/server-plugins.d.ts +5 -6
  245. package/dist/server-query.cjs +5 -5
  246. package/dist/server-query.mjs +4 -4
  247. package/dist/server.cjs +47 -45
  248. package/dist/server.d.mts +13 -14
  249. package/dist/server.d.ts +13 -14
  250. package/dist/server.mjs +30 -28
  251. package/dist/{spa-router-CxK3USIz.d.ts → spa-router-BuciWGCZ.d.ts} +3 -3
  252. package/dist/{spa-router-DbxNRKOB.d.mts → spa-router-DwbqGkGj.d.mts} +3 -3
  253. package/dist/testing.cjs +9 -9
  254. package/dist/testing.d.mts +4 -5
  255. package/dist/testing.d.ts +4 -5
  256. package/dist/testing.mjs +7 -7
  257. package/dist/{types-Z0aotQ8w.d.mts → types-CnH8DOqo.d.mts} +1 -1
  258. package/dist/{types-Z0aotQ8w.d.ts → types-CnH8DOqo.d.ts} +1 -1
  259. package/dist/{utils-4wVRcpOw.d.mts → utils-B9V0S_yL.d.mts} +1 -1
  260. package/dist/{utils-311Y8eoK.d.ts → utils-CaoWKtYM.d.ts} +1 -1
  261. package/dist/version.cjs +2 -2
  262. package/dist/version.mjs +1 -1
  263. package/dist/vite.cjs +28 -26
  264. package/dist/vite.d.mts +4 -5
  265. package/dist/vite.d.ts +4 -5
  266. package/dist/vite.mjs +27 -25
  267. package/dist/{workflows-CR9ex-gz.d.ts → workflows-jZ4BcdoZ.d.mts} +1 -1
  268. package/dist/{workflows-CR9ex-gz.d.mts → workflows-jZ4BcdoZ.d.ts} +1 -1
  269. package/dist/workflows.cjs +3 -3
  270. package/dist/workflows.d.mts +1 -1
  271. package/dist/workflows.d.ts +1 -1
  272. package/dist/workflows.mjs +2 -2
  273. package/package.json +9 -1
  274. package/dist/chunk-M64YUMA4.cjs +0 -58
  275. package/dist/chunk-QLQ32WC4.mjs +0 -58
  276. package/dist/layers-4PNE2HOY.cjs +0 -18
  277. package/dist/metadata-2HSU2i_w.d.mts +0 -52
  278. package/dist/metadata-Cjs8JMRM.d.ts +0 -52
  279. package/dist/types-DFbjpjXX.d.mts +0 -105
  280. package/dist/types-DFbjpjXX.d.ts +0 -105
  281. package/dist/{chunk-2F2ER724.cjs → chunk-BPMATOP2.cjs} +2 -2
  282. package/dist/{chunk-IHNMMXHV.mjs → chunk-OTC5BDGO.mjs} +3 -3
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-5WI2S4CO.mjs";
9
9
  import {
10
10
  matchesFarmIfNoneMatch
11
- } from "./chunk-XF7Q24PF.mjs";
11
+ } from "./chunk-ZMMBIVQM.mjs";
12
12
  import {
13
13
  __name
14
14
  } from "./chunk-LPEX4YW6.mjs";
@@ -6,7 +6,7 @@ var _chunk4PPEPOZZcjs = require('./chunk-4PPEPOZZ.cjs');
6
6
  var _chunkMQ3H6LT5cjs = require('./chunk-MQ3H6LT5.cjs');
7
7
 
8
8
 
9
- var _chunkMIDIZJZCcjs = require('./chunk-MIDIZJZC.cjs');
9
+ var _chunkFO427P6Icjs = require('./chunk-FO427P6I.cjs');
10
10
 
11
11
 
12
12
  var _chunkSJNMVDDFcjs = require('./chunk-SJNMVDDF.cjs');
@@ -20,7 +20,7 @@ var _chunk2CQ74SP6cjs = require('./chunk-2CQ74SP6.cjs');
20
20
 
21
21
 
22
22
 
23
- var _chunkG26MUMKLcjs = require('./chunk-G26MUMKL.cjs');
23
+ var _chunkS6VYG6XUcjs = require('./chunk-S6VYG6XU.cjs');
24
24
 
25
25
 
26
26
  var _chunk6V4TDWECcjs = require('./chunk-6V4TDWEC.cjs');
@@ -28,13 +28,13 @@ var _chunk6V4TDWECcjs = require('./chunk-6V4TDWEC.cjs');
28
28
 
29
29
 
30
30
 
31
- var _chunkEM6SBQKMcjs = require('./chunk-EM6SBQKM.cjs');
31
+ var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
32
32
 
33
33
 
34
34
  var _chunkM2L4MYDQcjs = require('./chunk-M2L4MYDQ.cjs');
35
35
 
36
36
 
37
- var _chunkBMWDEBXOcjs = require('./chunk-BMWDEBXO.cjs');
37
+ var _chunkSHLXACIOcjs = require('./chunk-SHLXACIO.cjs');
38
38
 
39
39
 
40
40
 
@@ -58,7 +58,7 @@ var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
58
58
  function farmApiPlugin(options = {}) {
59
59
  const srcDir = _nullishCoalesce(options.srcDir, () => ( "src"));
60
60
  const debug = _nullishCoalesce(options.debug, () => ( false));
61
- const bodySizeLimit = _chunkEM6SBQKMcjs.resolveFarmServerConfig.call(void 0, {
61
+ const bodySizeLimit = _chunkKIIMAWOJcjs.resolveFarmServerConfig.call(void 0, {
62
62
  bodySizeLimit: options.bodySizeLimit
63
63
  }).bodySizeLimit;
64
64
  const basePath = options.basePath;
@@ -110,7 +110,7 @@ function farmApiPlugin(options = {}) {
110
110
  const existing = apiRoutesCache.get(routePath);
111
111
  const existingFile = _optionalChain([endpointSources, 'access', _ => _.get, 'call', _2 => _2(routePath), 'optionalAccess', _3 => _3.get, 'call', _4 => _4(normalizedMethod)]);
112
112
  if (existingFile) {
113
- throw new (0, _chunkMIDIZJZCcjs.APIRouteConflictError)(routePath, normalizedMethod, existingFile, filePath);
113
+ throw new (0, _chunkFO427P6Icjs.APIRouteConflictError)(routePath, normalizedMethod, existingFile, filePath);
114
114
  }
115
115
  if (existing) {
116
116
  if (!existing.methods.includes(normalizedMethod)) {
@@ -186,8 +186,11 @@ function farmApiPlugin(options = {}) {
186
186
  const createRouter = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
187
187
  const plugins = options.plugins ? await (_nullishCoalesce(routePlugins, () => ( (routePlugins = Promise.resolve(options.plugins({ root: projectRoot })))))) : [];
188
188
  pluginMergedRoutes = plugins.length ? new Map(
189
- _chunkG26MUMKLcjs.mergePluginAPIRoutes.call(void 0, [...apiRoutesCache.values()], plugins, void 0, {
190
- bodySizeLimit
189
+ _chunkS6VYG6XUcjs.mergePluginAPIRoutes.call(void 0, [...apiRoutesCache.values()], plugins, void 0, {
190
+ bodySizeLimit,
191
+ // A plugin calling an app endpoint (an MCP tool, say) goes back through this server,
192
+ // so the middleware that guards the endpoint's path runs for it.
193
+ dispatch: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (request) => fetch(request, { redirect: "manual" }), "dispatch")
191
194
  }).map((route) => [route.path, route])
192
195
  ) : null;
193
196
  const totalEndpoints = Array.from(servedRoutes().values()).reduce(
@@ -200,7 +203,7 @@ function farmApiPlugin(options = {}) {
200
203
  const url = new URL(request.url);
201
204
  const method = request.method.toUpperCase();
202
205
  const pathname = url.pathname;
203
- const match = _chunkG26MUMKLcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), pathname, basePath);
206
+ const match = _chunkS6VYG6XUcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), pathname, basePath);
204
207
  if (!match) {
205
208
  return new Response(JSON.stringify({ error: "Not Found" }), {
206
209
  status: 404,
@@ -208,18 +211,18 @@ function farmApiPlugin(options = {}) {
208
211
  });
209
212
  }
210
213
  const { route, params } = match;
211
- const endpoint = _chunkG26MUMKLcjs.resolveAPIRouteEndpoint.call(void 0, route, method);
214
+ const endpoint = _chunkS6VYG6XUcjs.resolveAPIRouteEndpoint.call(void 0, route, method);
212
215
  if (!endpoint) {
213
216
  return new Response(JSON.stringify({ error: "Method Not Allowed" }), {
214
217
  status: 405,
215
218
  headers: {
216
- Allow: _chunkG26MUMKLcjs.getAllowedAPIRouteMethods.call(void 0, route).join(", "),
219
+ Allow: _chunkS6VYG6XUcjs.getAllowedAPIRouteMethods.call(void 0, route).join(", "),
217
220
  "Content-Type": "application/json"
218
221
  }
219
222
  });
220
223
  }
221
224
  try {
222
- return await _chunkG26MUMKLcjs.invokeAPIRouteEndpoint.call(void 0, endpoint, request, params, bodySizeLimit);
225
+ return await _chunkS6VYG6XUcjs.invokeAPIRouteEndpoint.call(void 0, endpoint, request, params, bodySizeLimit);
223
226
  } catch (error) {
224
227
  return new Response(JSON.stringify({ error: error.message || "Internal Server Error" }), {
225
228
  status: 500,
@@ -264,10 +267,10 @@ function farmApiPlugin(options = {}) {
264
267
  try {
265
268
  const relativePath = path.relative(apiDir, path.dirname(filePath));
266
269
  const routePath = "/api/" + (relativePath === "." ? "" : relativePath.replace(/\\/g, "/"));
267
- const routeModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, filePath);
270
+ const routeModule = await _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, server, filePath);
268
271
  const endpoints = {};
269
272
  const availableMethods = [];
270
- for (const method of _chunkG26MUMKLcjs.API_ROUTE_METHODS) {
273
+ for (const method of _chunkS6VYG6XUcjs.API_ROUTE_METHODS) {
271
274
  if (routeModule[method]) {
272
275
  availableMethods.push(method);
273
276
  endpoints[method] = routeModule[method];
@@ -280,7 +283,7 @@ function farmApiPlugin(options = {}) {
280
283
  log(`API route discovered: ${availableMethods.join(", ")} ${routePath}`);
281
284
  }
282
285
  } catch (e) {
283
- if (e instanceof _chunkMIDIZJZCcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
286
+ if (e instanceof _chunkFO427P6Icjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
284
287
  log(`API route load failed at ${filePath}: ${e.message}`);
285
288
  }
286
289
  }
@@ -296,7 +299,7 @@ function farmApiPlugin(options = {}) {
296
299
  for (const routesFile of routesFiles) {
297
300
  if (fs.existsSync(routesFile)) {
298
301
  try {
299
- const routesModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, routesFile);
302
+ const routesModule = await _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, server, routesFile);
300
303
  for (const [exportName, exportValue] of Object.entries(routesModule)) {
301
304
  const endpoint = exportValue;
302
305
  if (endpoint && endpoint.__path) {
@@ -307,7 +310,7 @@ function farmApiPlugin(options = {}) {
307
310
  }
308
311
  }
309
312
  } catch (e) {
310
- if (e instanceof _chunkMIDIZJZCcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
313
+ if (e instanceof _chunkFO427P6Icjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
311
314
  log(`Root routes.ts load failed: ${e.message}`);
312
315
  }
313
316
  break;
@@ -322,7 +325,7 @@ function farmApiPlugin(options = {}) {
322
325
  const { getProgrammaticRouteManifest } = await import("./routes.cjs");
323
326
  for (const routeFile of routeFiles) {
324
327
  try {
325
- const routesModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0,
328
+ const routesModule = await _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0,
326
329
  server,
327
330
  _chunk5QIKR7RRcjs.toViteModuleId.call(void 0, routeFile, server.config.root)
328
331
  );
@@ -338,7 +341,7 @@ function farmApiPlugin(options = {}) {
338
341
  }
339
342
  }
340
343
  } catch (e) {
341
- if (e instanceof _chunkMIDIZJZCcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
344
+ if (e instanceof _chunkFO427P6Icjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
342
345
  log(`Programmatic routes file load failed at ${routeFile}: ${e.message}`);
343
346
  }
344
347
  }
@@ -390,7 +393,7 @@ function farmApiPlugin(options = {}) {
390
393
  const pathname = url.split("?")[0];
391
394
  const method = req.method || "GET";
392
395
  if (discoveryPromise) await waitForDiscovery();
393
- if (!_chunkG26MUMKLcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), pathname, basePath)) {
396
+ if (!_chunkS6VYG6XUcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), pathname, basePath)) {
394
397
  return next();
395
398
  }
396
399
  if (!apiRouterHandler) {
@@ -411,7 +414,7 @@ function farmApiPlugin(options = {}) {
411
414
  }
412
415
  const currentUrl = req.url || url;
413
416
  const currentPathname = currentUrl.split("?")[0];
414
- if (currentPathname !== pathname && !_chunkG26MUMKLcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), currentPathname, basePath)) {
417
+ if (currentPathname !== pathname && !_chunkS6VYG6XUcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), currentPathname, basePath)) {
415
418
  return next();
416
419
  }
417
420
  const fullUrl = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req);
@@ -423,7 +426,7 @@ function farmApiPlugin(options = {}) {
423
426
  }
424
427
  let body;
425
428
  if (method !== "GET" && method !== "HEAD") {
426
- body = await _chunkEM6SBQKMcjs.readNodeRequestBody.call(void 0, req, bodySizeLimit);
429
+ body = await _chunkKIIMAWOJcjs.readNodeRequestBody.call(void 0, req, bodySizeLimit);
427
430
  }
428
431
  const request = new Request(fullUrl, {
429
432
  method,
@@ -438,7 +441,7 @@ function farmApiPlugin(options = {}) {
438
441
  logResponse(method, currentPathname, response.status, duration);
439
442
  await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, response);
440
443
  } catch (error) {
441
- const bodyErrorResponse = _chunkEM6SBQKMcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
444
+ const bodyErrorResponse = _chunkKIIMAWOJcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
442
445
  if (bodyErrorResponse) {
443
446
  await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
444
447
  return;
@@ -487,7 +490,7 @@ function farmApiPlugin(options = {}) {
487
490
  if (await _optionalChain([recoverFailedDiscovery, 'optionalCall', _9 => _9()])) return [];
488
491
  const previousState = snapshotRouteState();
489
492
  try {
490
- const routesModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, file);
493
+ const routesModule = await _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, server, file);
491
494
  removeEndpointsFromFile(file);
492
495
  for (const [exportName, exportValue] of Object.entries(routesModule)) {
493
496
  const endpoint = exportValue;
@@ -515,7 +518,7 @@ function farmApiPlugin(options = {}) {
515
518
  log(`API router recreated`);
516
519
  } catch (e) {
517
520
  restoreRouteState(previousState);
518
- if (e instanceof _chunkMIDIZJZCcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
521
+ if (e instanceof _chunkFO427P6Icjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
519
522
  log(`Root routes.ts HMR failed: ${e.message}`);
520
523
  }
521
524
  return [];
@@ -540,10 +543,10 @@ function farmApiPlugin(options = {}) {
540
543
  log(`API route file removed: ${routePath}`);
541
544
  return [];
542
545
  }
543
- const routeModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, file);
546
+ const routeModule = await _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, server, file);
544
547
  removeEndpointsFromFile(file);
545
548
  const availableMethods = [];
546
- for (const method of _chunkG26MUMKLcjs.API_ROUTE_METHODS) {
549
+ for (const method of _chunkS6VYG6XUcjs.API_ROUTE_METHODS) {
547
550
  if (!routeModule[method]) continue;
548
551
  availableMethods.push(method);
549
552
  addEndpoint(routePath, file, method, routeModule[method]);
@@ -553,7 +556,7 @@ function farmApiPlugin(options = {}) {
553
556
  log(`API router recreated`);
554
557
  } catch (e) {
555
558
  restoreRouteState(previousState);
556
- if (e instanceof _chunkMIDIZJZCcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
559
+ if (e instanceof _chunkFO427P6Icjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
557
560
  log(`API route HMR failed: ${e.message}`);
558
561
  }
559
562
  return [];
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkT5CERMEHcjs = require('./chunk-T5CERMEH.cjs');
7
+ var _chunkT5OJPTVNcjs = require('./chunk-T5OJPTVN.cjs');
8
8
 
9
9
 
10
10
  var _chunkYWN746UScjs = require('./chunk-YWN746US.cjs');
@@ -70,13 +70,13 @@ async function _invokeServerFunction(value, input, request) {
70
70
  throw new TypeError("Expected a function created with createServerFn or createServerQuery");
71
71
  }
72
72
  try {
73
- const data = await _chunkT5CERMEHcjs.runWithServerActionRequest.call(void 0, request, () => runner.run(input));
73
+ const data = await _chunkT5OJPTVNcjs.runWithServerActionRequest.call(void 0, request, () => runner.run(input));
74
74
  return { ok: true, data };
75
75
  } catch (error) {
76
76
  if (error instanceof ServerFnInputError) {
77
77
  return { ok: false, reason: "input", error: error.cause };
78
78
  }
79
- if (_chunkT5CERMEHcjs.isServerFnFailure.call(void 0, error)) return { ok: false, reason: "failure", failure: error };
79
+ if (_chunkT5OJPTVNcjs.isServerFnFailure.call(void 0, error)) return { ok: false, reason: "failure", failure: error };
80
80
  const redirect = _chunkOX6O6WVAcjs.getFarmRedirectError.call(void 0, error);
81
81
  if (redirect) {
82
82
  return { ok: false, reason: "redirect", url: redirect.url, status: redirect.status };
@@ -117,9 +117,9 @@ function createServerFn(options) {
117
117
  } catch (cause) {
118
118
  throw labelInputErrors && isSchemaValidationFailure(cause) ? new ServerFnInputError(cause) : cause;
119
119
  }
120
- const executionContext = _chunkT5CERMEHcjs.getServerActionExecutionContext.call(void 0, );
120
+ const executionContext = _chunkT5OJPTVNcjs.getServerActionExecutionContext.call(void 0, );
121
121
  const request = _nullishCoalesce(_optionalChain([executionContext, 'optionalAccess', _ => _.request]), () => ( _chunkU4KT7QP3cjs._resolveCurrentRequest.call(void 0, )));
122
- const signal = _nullishCoalesce(_nullishCoalesce(_optionalChain([executionContext, 'optionalAccess', _2 => _2.signal]), () => ( _optionalChain([request, 'optionalAccess', _3 => _3.signal]))), () => ( _chunkT5CERMEHcjs.getServerActionSignal.call(void 0, )));
122
+ const signal = _nullishCoalesce(_nullishCoalesce(_optionalChain([executionContext, 'optionalAccess', _2 => _2.signal]), () => ( _optionalChain([request, 'optionalAccess', _3 => _3.signal]))), () => ( _chunkT5OJPTVNcjs.getServerActionSignal.call(void 0, )));
123
123
  const handlerContext = {
124
124
  input,
125
125
  rawInput,
@@ -245,7 +245,7 @@ function createServerFnErrorHandler(definitions) {
245
245
  throw new TypeError(`Server function error "${code}" is not declared`);
246
246
  }
247
247
  const parsed = parseServerFnFailureData(code, definition.data, data);
248
- throw new (0, _chunkT5CERMEHcjs.ServerFnFailure)(code, parsed, {
248
+ throw new (0, _chunkT5OJPTVNcjs.ServerFnFailure)(code, parsed, {
249
249
  status: definition.status,
250
250
  message: _nullishCoalesce(definition.message, () => ( "Server function failed"))
251
251
  });
@@ -1,6 +1,7 @@
1
1
  import {
2
- isRouteSlotSegment
3
- } from "./chunk-UBO4SGH4.mjs";
2
+ isRouteSlotSegment,
3
+ parseInterceptionMarker
4
+ } from "./chunk-RHAZ22ZN.mjs";
4
5
  import {
5
6
  normalizeMiddlewareModule,
6
7
  parseMiddlewareCookieHeader,
@@ -19,19 +20,19 @@ import {
19
20
  import {
20
21
  loadFarmDevModule,
21
22
  toFileModuleUrl
22
- } from "./chunk-43FMW62B.mjs";
23
+ } from "./chunk-KMTGADN3.mjs";
23
24
  import {
24
25
  logger
25
26
  } from "./chunk-KI3MESHB.mjs";
26
- import {
27
- createFarmAPIMiddlewarePathnames
28
- } from "./chunk-BTHHUD7Q.mjs";
29
27
  import {
30
28
  emitFarmEvent
31
29
  } from "./chunk-FUZEBRP3.mjs";
32
30
  import {
33
31
  sendWebResponse
34
32
  } from "./chunk-Z2RZJZIZ.mjs";
33
+ import {
34
+ createFarmAPIMiddlewarePathnames
35
+ } from "./chunk-BTHHUD7Q.mjs";
35
36
  import {
36
37
  getFarmRedirectError,
37
38
  isFarmNotFoundError,
@@ -193,6 +194,15 @@ import * as path from "path";
193
194
 
194
195
  // src/middleware/path.ts
195
196
  function appendMiddlewareRoutePath(routePath, directoryName) {
197
+ const marker = parseInterceptionMarker(directoryName);
198
+ if (marker) {
199
+ const owner = routePath.split("/").filter(Boolean);
200
+ const parts = [
201
+ ...marker.root ? [] : owner.slice(0, Math.max(0, owner.length - marker.up)),
202
+ ...marker.remainder ? [marker.remainder] : []
203
+ ];
204
+ return `/${parts.join("/")}`;
205
+ }
196
206
  if (directoryName.startsWith("(") && directoryName.endsWith(")") || isRouteSlotSegment(directoryName)) {
197
207
  return routePath;
198
208
  }
@@ -287,7 +297,7 @@ var _MiddlewareManager = class _MiddlewareManager {
287
297
  }
288
298
  const entries = fs.readdirSync(dir, { withFileTypes: true });
289
299
  for (const entry of entries) {
290
- if (entry.isDirectory() && !entry.name.startsWith(".") && !entry.name.startsWith("_")) {
300
+ if (entry.isDirectory() && !entry.name.startsWith(".")) {
291
301
  await this.discoverInDirectory(
292
302
  path.join(dir, entry.name),
293
303
  appendMiddlewareRoutePath(routePath, entry.name),
@@ -190,6 +190,7 @@ function createFarmConfigResolutionPlugin(options) {
190
190
  };
191
191
  }
192
192
  __name(createFarmConfigResolutionPlugin, "createFarmConfigResolutionPlugin");
193
+ var FARM_CONFIG_ROOT = /* @__PURE__ */ Symbol.for("farm.configRoot");
193
194
  async function loadFarmConfigFile(configPath, options) {
194
195
  const { transform } = await import("rolldown/utils");
195
196
  const cacheRoot = path.resolve(options.cacheRoot || options.root);
@@ -207,6 +208,9 @@ async function loadFarmConfigFile(configPath, options) {
207
208
  plugins: [createFarmConfigResolutionPlugin({ transform })]
208
209
  });
209
210
  const moduleUrl = `${pathToFileURL(modulePath).href}?t=${Date.now()}`;
211
+ const configRootState = globalThis;
212
+ const previousConfigRoot = configRootState[FARM_CONFIG_ROOT];
213
+ configRootState[FARM_CONFIG_ROOT] = cacheRoot;
210
214
  try {
211
215
  const loaded = await import(
212
216
  /* @vite-ignore */
@@ -218,6 +222,7 @@ async function loadFarmConfigFile(configPath, options) {
218
222
  }
219
223
  return config;
220
224
  } finally {
225
+ configRootState[FARM_CONFIG_ROOT] = previousConfigRoot;
221
226
  await unlink(modulePath).catch(() => void 0);
222
227
  }
223
228
  }
@@ -16,7 +16,7 @@ var _chunkZ2HLU4IXcjs = require('./chunk-Z2HLU4IX.cjs');
16
16
 
17
17
 
18
18
 
19
- var _chunkEM6SBQKMcjs = require('./chunk-EM6SBQKM.cjs');
19
+ var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
20
20
 
21
21
 
22
22
 
@@ -24,6 +24,10 @@ var _chunkUQZ4AYTHcjs = require('./chunk-UQZ4AYTH.cjs');
24
24
 
25
25
 
26
26
 
27
+ var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
28
+
29
+
30
+
27
31
  var _chunkNZKJGRB3cjs = require('./chunk-NZKJGRB3.cjs');
28
32
 
29
33
 
@@ -839,9 +843,9 @@ function createIntegrationPlugin(integrationKey, integration) {
839
843
  if (!bodyLoaded) {
840
844
  bodyLoaded = true;
841
845
  if (req.method && req.method !== "GET" && req.method !== "HEAD") {
842
- requestBody = await _chunkEM6SBQKMcjs.readNodeRequestBody.call(void 0,
846
+ requestBody = await _chunkKIIMAWOJcjs.readNodeRequestBody.call(void 0,
843
847
  req,
844
- _chunkEM6SBQKMcjs.resolveFarmServerConfig.call(void 0, context.config.server).bodySizeLimit
848
+ _chunkKIIMAWOJcjs.resolveFarmServerConfig.call(void 0, context.config.server).bodySizeLimit
845
849
  );
846
850
  }
847
851
  }
@@ -851,7 +855,7 @@ function createIntegrationPlugin(integrationKey, integration) {
851
855
  try {
852
856
  return createWebRequest(req, fullUrl, await getRequestBody());
853
857
  } catch (error) {
854
- const response = _chunkEM6SBQKMcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
858
+ const response = _chunkKIIMAWOJcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
855
859
  if (!response) throw error;
856
860
  await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, response);
857
861
  return null;
@@ -1558,12 +1562,12 @@ function createFormInput(formData) {
1558
1562
  _chunkS3JO3N4Hcjs.__name.call(void 0, createFormInput, "createFormInput");
1559
1563
  async function dispatchIntegrationRequest(runtime, request, options = {}) {
1560
1564
  try {
1561
- request = await _chunkEM6SBQKMcjs.bufferFarmRequestBody.call(void 0,
1565
+ request = await _chunkKIIMAWOJcjs.bufferFarmRequestBody.call(void 0,
1562
1566
  request,
1563
- _chunkEM6SBQKMcjs.resolveFarmServerConfig.call(void 0, runtime.config.server).bodySizeLimit
1567
+ _chunkKIIMAWOJcjs.resolveFarmServerConfig.call(void 0, runtime.config.server).bodySizeLimit
1564
1568
  );
1565
1569
  } catch (error) {
1566
- const response = _chunkEM6SBQKMcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
1570
+ const response = _chunkKIIMAWOJcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
1567
1571
  if (response) return response;
1568
1572
  throw error;
1569
1573
  }
@@ -1577,10 +1581,12 @@ async function dispatchIntegrationRequest(runtime, request, options = {}) {
1577
1581
  const middleware = [...integration.middleware || []];
1578
1582
  const forwardedSetCookies = [];
1579
1583
  for (const entry of middleware) {
1584
+ if (_optionalChain([options, 'access', _24 => _24.ranMiddleware, 'optionalAccess', _25 => _25.has, 'call', _26 => _26(entry)])) continue;
1580
1585
  const params = resolveIntegrationMiddlewareParams(entry, pathname, runtime.config);
1581
1586
  if (!params) {
1582
1587
  continue;
1583
1588
  }
1589
+ _optionalChain([options, 'access', _27 => _27.ranMiddleware, 'optionalAccess', _28 => _28.add, 'call', _29 => _29(entry)]);
1584
1590
  const handlerContext = createServerIntegrationHandlerContext({
1585
1591
  runtime,
1586
1592
  route: {
@@ -1819,7 +1825,7 @@ async function dispatchIntegrationRequest(runtime, request, options = {}) {
1819
1825
  }
1820
1826
  }
1821
1827
  if (forwardedSetCookies.length > 0) {
1822
- _optionalChain([options, 'access', _24 => _24.onForwardedCookies, 'optionalCall', _25 => _25(forwardedSetCookies)]);
1828
+ _optionalChain([options, 'access', _30 => _30.onForwardedCookies, 'optionalCall', _31 => _31(forwardedSetCookies)]);
1823
1829
  }
1824
1830
  return null;
1825
1831
  }
@@ -1845,6 +1851,7 @@ async function dispatchIntegrationRequests(integrations, runtime, request, optio
1845
1851
  request.clone(),
1846
1852
  {
1847
1853
  currentRequest: options.currentRequest,
1854
+ ranMiddleware: options.ranMiddleware,
1848
1855
  onForwardedCookies: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (cookies) => setCookies.push(...cookies), "onForwardedCookies")
1849
1856
  }
1850
1857
  );
@@ -1931,38 +1938,38 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, createServerIntegrationHandlerContext, "cr
1931
1938
  function createServerIntegrationRequestContextStore(request, currentRequest) {
1932
1939
  return {
1933
1940
  get(key) {
1934
- const requestValue = _chunkEM6SBQKMcjs.getRequestContext.call(void 0, request, key);
1941
+ const requestValue = _chunkKIIMAWOJcjs.getRequestContext.call(void 0, request, key);
1935
1942
  if (requestValue !== void 0) {
1936
1943
  return requestValue;
1937
1944
  }
1938
1945
  if (currentRequest) {
1939
- return _chunkEM6SBQKMcjs.getRequestContext.call(void 0, currentRequest, key);
1946
+ return _chunkKIIMAWOJcjs.getRequestContext.call(void 0, currentRequest, key);
1940
1947
  }
1941
1948
  return void 0;
1942
1949
  },
1943
1950
  set(key, value, options) {
1944
- _chunkEM6SBQKMcjs.setRequestContext.call(void 0, request, key, value, options);
1951
+ _chunkKIIMAWOJcjs.setRequestContext.call(void 0, request, key, value, options);
1945
1952
  if (currentRequest) {
1946
- _chunkEM6SBQKMcjs.setRequestContext.call(void 0, currentRequest, key, value, options);
1953
+ _chunkKIIMAWOJcjs.setRequestContext.call(void 0, currentRequest, key, value, options);
1947
1954
  }
1948
1955
  },
1949
1956
  has(key) {
1950
- return _chunkEM6SBQKMcjs.hasRequestContext.call(void 0, request, key) || !!currentRequest && _chunkEM6SBQKMcjs.hasRequestContext.call(void 0, currentRequest, key);
1957
+ return _chunkKIIMAWOJcjs.hasRequestContext.call(void 0, request, key) || !!currentRequest && _chunkKIIMAWOJcjs.hasRequestContext.call(void 0, currentRequest, key);
1951
1958
  },
1952
1959
  delete(key) {
1953
- const deletedRequest = _chunkEM6SBQKMcjs.deleteRequestContext.call(void 0, request, key);
1954
- const deletedCurrent = currentRequest ? _chunkEM6SBQKMcjs.deleteRequestContext.call(void 0, currentRequest, key) : false;
1960
+ const deletedRequest = _chunkKIIMAWOJcjs.deleteRequestContext.call(void 0, request, key);
1961
+ const deletedCurrent = currentRequest ? _chunkKIIMAWOJcjs.deleteRequestContext.call(void 0, currentRequest, key) : false;
1955
1962
  return deletedRequest || deletedCurrent;
1956
1963
  },
1957
1964
  clear() {
1958
- _chunkEM6SBQKMcjs.clearRequestContext.call(void 0, request);
1965
+ _chunkKIIMAWOJcjs.clearRequestContext.call(void 0, request);
1959
1966
  if (currentRequest) {
1960
- _chunkEM6SBQKMcjs.clearRequestContext.call(void 0, currentRequest);
1967
+ _chunkKIIMAWOJcjs.clearRequestContext.call(void 0, currentRequest);
1961
1968
  }
1962
1969
  },
1963
1970
  snapshot(options) {
1964
- const merged = currentRequest ? _chunkEM6SBQKMcjs.getRequestContextSnapshot.call(void 0, currentRequest, options) : /* @__PURE__ */ new Map();
1965
- const requestSnapshot = _chunkEM6SBQKMcjs.getRequestContextSnapshot.call(void 0, request, options);
1971
+ const merged = currentRequest ? _chunkKIIMAWOJcjs.getRequestContextSnapshot.call(void 0, currentRequest, options) : /* @__PURE__ */ new Map();
1972
+ const requestSnapshot = _chunkKIIMAWOJcjs.getRequestContextSnapshot.call(void 0, request, options);
1966
1973
  for (const [key, value] of requestSnapshot) {
1967
1974
  merged.set(key, value);
1968
1975
  }
@@ -2006,8 +2013,10 @@ function resolveIntegrationMiddlewareParams(entry, pathname, config) {
2006
2013
  const params = resolveMatcherParams(entry.matcher, pathname);
2007
2014
  if (params || !entry.matcher) return params;
2008
2015
  const routePathname = resolveIntegrationRoutePathname(pathname, config);
2009
- if (routePathname !== pathname) {
2010
- const routeParams = resolveMatcherParams(entry.matcher, routePathname);
2016
+ const candidates = [.../* @__PURE__ */ new Set([pathname, ...getIntegrationAPIPathnames(config)(routePathname)])];
2017
+ for (const candidate of candidates) {
2018
+ if (candidate === pathname) continue;
2019
+ const routeParams = resolveMatcherParams(entry.matcher, candidate);
2011
2020
  if (routeParams) return routeParams;
2012
2021
  }
2013
2022
  let compiled = compiledIntegrationGuards.get(entry);
@@ -2017,17 +2026,32 @@ function resolveIntegrationMiddlewareParams(entry, pathname, config) {
2017
2026
  });
2018
2027
  compiledIntegrationGuards.set(entry, compiled);
2019
2028
  }
2020
- for (const candidate of routePathname === pathname ? [pathname] : [pathname, routePathname]) {
2029
+ for (const candidate of candidates) {
2021
2030
  const result = _chunkZ2HLU4IXcjs.matchesCompiledMiddlewareConfig.call(void 0, candidate, compiled, noMiddlewareContext);
2022
2031
  if (result.matched) return _nullishCoalesce(result.params, () => ( {}));
2023
2032
  }
2024
2033
  return null;
2025
2034
  }
2026
2035
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveIntegrationMiddlewareParams, "resolveIntegrationMiddlewareParams");
2036
+ var FARM_INTEGRATION_API_BASE_PATH_KEY = "__farmAPIServerBasePath";
2037
+ var integrationAPIPathnames = /* @__PURE__ */ new WeakMap();
2038
+ function getIntegrationAPIPathnames(config) {
2039
+ if (!config) return (pathname) => [pathname];
2040
+ let toPathnames = integrationAPIPathnames.get(config);
2041
+ if (!toPathnames) {
2042
+ const recorded = config[FARM_INTEGRATION_API_BASE_PATH_KEY];
2043
+ const api2 = config.api;
2044
+ const serverBasePath = typeof recorded === "string" ? recorded : typeof _optionalChain([api2, 'optionalAccess', _32 => _32.baseURL]) === "string" && typeof api2.basePath === "string" ? _chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, api2) : void 0;
2045
+ toPathnames = _chunkKNBBQHO2cjs.createFarmAPIMiddlewarePathnames.call(void 0, serverBasePath);
2046
+ integrationAPIPathnames.set(config, toPathnames);
2047
+ }
2048
+ return toPathnames;
2049
+ }
2050
+ _chunkS3JO3N4Hcjs.__name.call(void 0, getIntegrationAPIPathnames, "getIntegrationAPIPathnames");
2027
2051
  function resolveIntegrationRoutePathname(pathname, config) {
2028
- const basePath = typeof _optionalChain([config, 'optionalAccess', _26 => _26.basePath]) === "string" ? config.basePath : void 0;
2052
+ const basePath = typeof _optionalChain([config, 'optionalAccess', _33 => _33.basePath]) === "string" ? config.basePath : void 0;
2029
2053
  let routePathname = basePath ? _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, pathname, basePath) : pathname;
2030
- const i18n = _optionalChain([config, 'optionalAccess', _27 => _27.i18n]);
2054
+ const i18n = _optionalChain([config, 'optionalAccess', _34 => _34.i18n]);
2031
2055
  if (i18n && Array.isArray(i18n.locales) && i18n.locales.length > 0) {
2032
2056
  routePathname = _chunkBIDYX3SLcjs.resolveFarmLocalePath.call(void 0, routePathname, {
2033
2057
  locales: i18n.locales,
@@ -2159,4 +2183,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, normalizeMatcher, "normalizeMatcher");
2159
2183
 
2160
2184
 
2161
2185
 
2162
- exports.getFarmPluginIntegrationContext = getFarmPluginIntegrationContext; exports.FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY = FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY; exports.FARM_INTEGRATION_SET_COOKIES_KEY = FARM_INTEGRATION_SET_COOKIES_KEY; exports.forwardIntegrationSetCookies = forwardIntegrationSetCookies; exports.defineIntegrationSchema = defineIntegrationSchema; exports.getFarmIntegrationPluginServerRuntime = getFarmIntegrationPluginServerRuntime; exports.getFarmIntegrationPluginOwner = getFarmIntegrationPluginOwner; exports.createIntegrationRoute = createIntegrationRoute; exports.integrationRoute = integrationRoute; exports.defineIntegration = defineIntegration; exports.isFarmIntegration = isFarmIntegration; exports.resolveIntegrationPlugins = resolveIntegrationPlugins; exports.getIntegrationProviders = getIntegrationProviders; exports.isFarmIntegrationProviderComponentReference = isFarmIntegrationProviderComponentReference; exports.getIntegrationDocumentNavigationMatchers = getIntegrationDocumentNavigationMatchers; exports.getIntegrationSchemas = getIntegrationSchemas; exports.getRegisteredIntegrationRuntime = getRegisteredIntegrationRuntime; exports.getRegisteredIntegrations = getRegisteredIntegrations; exports.getRegisteredIntegrationSchemas = getRegisteredIntegrationSchemas; exports.matchIntegrationRoute = matchIntegrationRoute; exports.matchRegisteredIntegrationRoute = matchRegisteredIntegrationRoute; exports.getRegisteredIntegrationAPIManifest = getRegisteredIntegrationAPIManifest; exports.dispatchIntegrationRequest = dispatchIntegrationRequest; exports.dispatchIntegrationRequests = dispatchIntegrationRequests;
2186
+
2187
+ exports.getFarmPluginIntegrationContext = getFarmPluginIntegrationContext; exports.FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY = FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY; exports.FARM_INTEGRATION_SET_COOKIES_KEY = FARM_INTEGRATION_SET_COOKIES_KEY; exports.forwardIntegrationSetCookies = forwardIntegrationSetCookies; exports.defineIntegrationSchema = defineIntegrationSchema; exports.getFarmIntegrationPluginServerRuntime = getFarmIntegrationPluginServerRuntime; exports.getFarmIntegrationPluginOwner = getFarmIntegrationPluginOwner; exports.createIntegrationRoute = createIntegrationRoute; exports.integrationRoute = integrationRoute; exports.defineIntegration = defineIntegration; exports.isFarmIntegration = isFarmIntegration; exports.resolveIntegrationPlugins = resolveIntegrationPlugins; exports.getIntegrationProviders = getIntegrationProviders; exports.isFarmIntegrationProviderComponentReference = isFarmIntegrationProviderComponentReference; exports.getIntegrationDocumentNavigationMatchers = getIntegrationDocumentNavigationMatchers; exports.getIntegrationSchemas = getIntegrationSchemas; exports.getRegisteredIntegrationRuntime = getRegisteredIntegrationRuntime; exports.getRegisteredIntegrations = getRegisteredIntegrations; exports.getRegisteredIntegrationSchemas = getRegisteredIntegrationSchemas; exports.matchIntegrationRoute = matchIntegrationRoute; exports.matchRegisteredIntegrationRoute = matchRegisteredIntegrationRoute; exports.getRegisteredIntegrationAPIManifest = getRegisteredIntegrationAPIManifest; exports.dispatchIntegrationRequest = dispatchIntegrationRequest; exports.dispatchIntegrationRequests = dispatchIntegrationRequests; exports.FARM_INTEGRATION_API_BASE_PATH_KEY = FARM_INTEGRATION_API_BASE_PATH_KEY;
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkEM6SBQKMcjs = require('./chunk-EM6SBQKM.cjs');
3
+ var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
4
4
 
5
5
 
6
6
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
@@ -583,7 +583,7 @@ function createOptimizedImageResponse(request, image, config) {
583
583
  if (image.contentType === "image/svg+xml" && config.dangerouslyAllowSVG) {
584
584
  headers.set("content-security-policy", "default-src 'none'; sandbox");
585
585
  }
586
- if (_chunkEM6SBQKMcjs.matchesFarmIfNoneMatch.call(void 0, request.headers.get("if-none-match"), image.etag)) {
586
+ if (_chunkKIIMAWOJcjs.matchesFarmIfNoneMatch.call(void 0, request.headers.get("if-none-match"), image.etag)) {
587
587
  headers.delete("content-length");
588
588
  return new Response(null, { status: 304, headers });
589
589
  }