@farm.js/core 0.1.50 → 0.1.51-beta.0

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 (252) hide show
  1. package/README.md +163 -3
  2. package/dist/{agent-mcp-9BMbRgg_.d.ts → agent-mcp-BBMfNpsC.d.ts} +1 -1
  3. package/dist/{agent-mcp-CIMH324y.d.mts → agent-mcp-D44ip11f.d.mts} +1 -1
  4. package/dist/agent-runtime.d.mts +1 -1
  5. package/dist/agent-runtime.d.ts +1 -1
  6. package/dist/{analyzer-DDW34OMC.mjs → analyzer-HOUCQR3K.mjs} +1 -1
  7. package/dist/{analyzer-CN7C74WX.cjs → analyzer-VKUDHNDF.cjs} +2 -2
  8. package/dist/api/route-manager.cjs +5 -5
  9. package/dist/api/route-manager.d.mts +3 -3
  10. package/dist/api/route-manager.d.ts +3 -3
  11. package/dist/api/route-manager.mjs +4 -4
  12. package/dist/api/runtime.d.mts +2 -2
  13. package/dist/api/runtime.d.ts +2 -2
  14. package/dist/api.cjs +6 -6
  15. package/dist/api.d.mts +3 -3
  16. package/dist/api.d.ts +3 -3
  17. package/dist/api.mjs +5 -5
  18. package/dist/{app-BWibTHVT.d.ts → app-CourU3rQ.d.ts} +4 -4
  19. package/dist/{app-DVJ13FPA.d.mts → app-aeD4s_mg.d.mts} +4 -4
  20. package/dist/{app-manifest-CQDJOKL2.d.mts → app-manifest-BC6mFn5A.d.mts} +1 -1
  21. package/dist/{app-manifest-D0kaXdwu.d.ts → app-manifest-LzjoNPeq.d.ts} +1 -1
  22. package/dist/app-markdown.d.mts +2 -2
  23. package/dist/app-markdown.d.ts +2 -2
  24. package/dist/base-path-BOUV5ozD.d.mts +10 -0
  25. package/dist/base-path-BOUV5ozD.d.ts +10 -0
  26. package/dist/{chunk-RWT2BTJT.cjs → chunk-2IAPKPEB.cjs} +6 -6
  27. package/dist/{chunk-2G63BIRL.mjs → chunk-2KVDHNQS.mjs} +8 -11
  28. package/dist/{chunk-76R5GJER.mjs → chunk-3HA7PP72.mjs} +2 -2
  29. package/dist/{chunk-NJVFPJ2Y.cjs → chunk-3OWVWZ6R.cjs} +28 -2
  30. package/dist/{chunk-KO2NWUKN.mjs → chunk-4GJJ65RB.mjs} +9 -1
  31. package/dist/{chunk-GERUXONA.cjs → chunk-5A77OEIG.cjs} +4 -1
  32. package/dist/{chunk-4HBKBHVP.mjs → chunk-5ENW27SL.mjs} +1 -1
  33. package/dist/{chunk-MTB57GOK.mjs → chunk-724WT3NI.mjs} +4 -2
  34. package/dist/{chunk-VCKGOXFI.cjs → chunk-76GHW3WI.cjs} +7 -1
  35. package/dist/{chunk-ZIBIE7AH.mjs → chunk-7UPCJDB5.mjs} +7 -1
  36. package/dist/{chunk-CPXDDWGL.mjs → chunk-AER5I65K.mjs} +1 -1
  37. package/dist/{chunk-WB6XES4V.mjs → chunk-ALEUMLJN.mjs} +34 -5
  38. package/dist/{chunk-WVBUXNBX.mjs → chunk-AMRK3P6W.mjs} +123 -47
  39. package/dist/{chunk-L6QDME5Z.cjs → chunk-B3GZAQSC.cjs} +3 -3
  40. package/dist/chunk-CKPTIEDX.cjs +12 -0
  41. package/dist/{chunk-B5S2JS6M.cjs → chunk-DWW3AMJX.cjs} +288 -255
  42. package/dist/{chunk-EQMTJBB7.cjs → chunk-DZZHTMWM.cjs} +35 -6
  43. package/dist/{chunk-3ATXWZPH.cjs → chunk-E36C43IX.cjs} +13 -16
  44. package/dist/{chunk-J2ZEVDEK.cjs → chunk-EHB77D5U.cjs} +3 -3
  45. package/dist/{chunk-WQGRD5BJ.cjs → chunk-EX6ZSN5P.cjs} +1 -16
  46. package/dist/{chunk-474FO3UE.cjs → chunk-F42U3R4F.cjs} +170 -163
  47. package/dist/{chunk-6QA2SXVH.cjs → chunk-FK25QSVC.cjs} +2 -1
  48. package/dist/{chunk-BW6SCVYX.mjs → chunk-FSQMN2MQ.mjs} +1 -0
  49. package/dist/{chunk-2H3FJYY6.mjs → chunk-FSXSQQTV.mjs} +3 -2
  50. package/dist/chunk-GNZIAJGB.mjs +358 -0
  51. package/dist/{chunk-TXK4D46O.mjs → chunk-H3ASZDT7.mjs} +21 -1
  52. package/dist/{chunk-B6PREBN6.cjs → chunk-HASX6DC7.cjs} +8 -8
  53. package/dist/{chunk-ZLOQQ2UF.mjs → chunk-I2ZA5SXS.mjs} +60 -27
  54. package/dist/{chunk-X2EL3BLH.cjs → chunk-IOUOGRDX.cjs} +11 -3
  55. package/dist/{chunk-CBJKDB6F.mjs → chunk-IRSS4HS4.mjs} +1 -1
  56. package/dist/{chunk-GOOK2J2W.cjs → chunk-J22JD5YJ.cjs} +2 -2
  57. package/dist/{chunk-2DEPNLXK.mjs → chunk-JF5CNHHF.mjs} +4 -4
  58. package/dist/{chunk-VOZ5DI7D.mjs → chunk-JWI5PUO2.mjs} +6 -2
  59. package/dist/{chunk-YAXOEAND.cjs → chunk-KHXAJ2KA.cjs} +6 -6
  60. package/dist/{chunk-WXHDVXJE.mjs → chunk-KY32FWK7.mjs} +2 -2
  61. package/dist/{chunk-EQWWOQTK.cjs → chunk-LEIXUFJN.cjs} +6 -2
  62. package/dist/{chunk-2GLQSIZD.mjs → chunk-LMFJCXDD.mjs} +1 -1
  63. package/dist/{chunk-IXSMFKZ2.cjs → chunk-LNM57D3H.cjs} +4 -4
  64. package/dist/{chunk-5V4KZOZO.mjs → chunk-LZ4SB57H.mjs} +2 -2
  65. package/dist/{chunk-E2BMCNMJ.cjs → chunk-MMEEXMUQ.cjs} +2 -2
  66. package/dist/chunk-N4AQNEXR.cjs +17 -0
  67. package/dist/{chunk-JZMZKABS.cjs → chunk-NWUHS6GV.cjs} +3 -2
  68. package/dist/{chunk-LYWAGXXW.cjs → chunk-O3MMJPC2.cjs} +12 -12
  69. package/dist/{chunk-FACTMUPI.cjs → chunk-PDJSL7PL.cjs} +30 -19
  70. package/dist/{chunk-XLLVWLWO.mjs → chunk-PIHKO25G.mjs} +1 -1
  71. package/dist/chunk-PIUTGRDI.cjs +358 -0
  72. package/dist/{chunk-KGP76FSV.mjs → chunk-PPDHCRTC.mjs} +1 -1
  73. package/dist/{chunk-C73RIAEF.mjs → chunk-QI5AQMEE.mjs} +17 -6
  74. package/dist/{chunk-F5LERVY3.cjs → chunk-QK3HBOTG.cjs} +10 -10
  75. package/dist/{chunk-Q3UU2KXC.mjs → chunk-QMDU6QHN.mjs} +4 -1
  76. package/dist/{chunk-JJOWY3XD.mjs → chunk-R5P4KFPM.mjs} +1 -1
  77. package/dist/{chunk-IWJKJDNW.mjs → chunk-S5ZA2T2W.mjs} +35 -28
  78. package/dist/{chunk-PXEXOQ5R.mjs → chunk-SHS6KXOZ.mjs} +1 -1
  79. package/dist/{chunk-ETF5C6HR.cjs → chunk-SJ23LJ3N.cjs} +3 -3
  80. package/dist/{chunk-KZH6YLND.cjs → chunk-SO3T6T4I.cjs} +427 -351
  81. package/dist/{chunk-JHXJBNLY.cjs → chunk-SUCDVKUB.cjs} +21 -1
  82. package/dist/{chunk-7ONZDKVY.mjs → chunk-T4EW7AAD.mjs} +2 -2
  83. package/dist/{chunk-UY6HS5PF.cjs → chunk-USL2ANCB.cjs} +8 -8
  84. package/dist/{chunk-4T25YCZ5.cjs → chunk-VIFPE5RG.cjs} +14 -14
  85. package/dist/{chunk-HYN3LLG7.cjs → chunk-VO6NLTV4.cjs} +3 -3
  86. package/dist/{chunk-XN2MB4QZ.cjs → chunk-VQJYGZNX.cjs} +4 -4
  87. package/dist/{chunk-5PKDHKQP.cjs → chunk-WFVSAT7Y.cjs} +6 -4
  88. package/dist/{chunk-X3HOVNHI.mjs → chunk-WSY2JD7O.mjs} +6 -6
  89. package/dist/{chunk-SHJJM6OG.mjs → chunk-WVX3BUNJ.mjs} +1 -1
  90. package/dist/chunk-X3EFRVXY.mjs +12 -0
  91. package/dist/{chunk-UCQ52TJY.mjs → chunk-X3JNB2TB.mjs} +1 -1
  92. package/dist/{chunk-RHOR2J6V.cjs → chunk-X5BCMLGP.cjs} +1 -1
  93. package/dist/{chunk-IQXGHGZF.cjs → chunk-XB24LZWI.cjs} +5 -5
  94. package/dist/{chunk-BNMHXVLL.mjs → chunk-XMHERKSE.mjs} +0 -15
  95. package/dist/{chunk-CGCJ2TJU.cjs → chunk-XPMC4E2G.cjs} +3 -3
  96. package/dist/{chunk-HWCHIBJZ.mjs → chunk-XWC5NAHV.mjs} +4 -4
  97. package/dist/{chunk-C7425KDG.cjs → chunk-XYL4HSVC.cjs} +2 -2
  98. package/dist/{chunk-2SVJGOAX.mjs → chunk-Y3N5BFRJ.mjs} +3 -3
  99. package/dist/{chunk-IUBDMDZZ.cjs → chunk-Y7TLL65B.cjs} +4 -4
  100. package/dist/{chunk-M7LKA632.mjs → chunk-YLNBWUVS.mjs} +1 -1
  101. package/dist/chunk-Z5A6CNV2.mjs +60 -0
  102. package/dist/chunk-Z64V4WZI.mjs +17 -0
  103. package/dist/{chunk-2VCC3GVC.mjs → chunk-ZF3GX4O7.mjs} +1 -1
  104. package/dist/{client-plugins-BPfltM5m.d.ts → client-plugins-CFBEfVPO.d.ts} +20 -3
  105. package/dist/{client-plugins-D4RO59f0.d.mts → client-plugins-cqy_dQd0.d.mts} +20 -3
  106. package/dist/client-plugins.d.mts +1 -1
  107. package/dist/client-plugins.d.ts +1 -1
  108. package/dist/client.cjs +5 -4
  109. package/dist/client.d.mts +6 -6
  110. package/dist/client.d.ts +6 -6
  111. package/dist/client.mjs +4 -3
  112. package/dist/config.d.mts +1 -1
  113. package/dist/config.d.ts +1 -1
  114. package/dist/cron.cjs +4 -4
  115. package/dist/cron.mjs +3 -3
  116. package/dist/desktop.d.mts +2 -2
  117. package/dist/desktop.d.ts +2 -2
  118. package/dist/{devtools-STG7HPRV.mjs → devtools-4MLL3RAL.mjs} +6 -6
  119. package/dist/{devtools-N5XTOECL.cjs → devtools-4ZLMD454.cjs} +8 -8
  120. package/dist/docs.cjs +10 -10
  121. package/dist/docs.d.mts +2 -2
  122. package/dist/docs.d.ts +2 -2
  123. package/dist/docs.mjs +9 -9
  124. package/dist/{index-k8o8eUOd.d.mts → index-BYkNbeQV.d.mts} +1 -1
  125. package/dist/{index-C-N3Pwg-.d.ts → index-BxjN_UDZ.d.ts} +1 -1
  126. package/dist/index.cjs +42 -40
  127. package/dist/index.d.mts +16 -16
  128. package/dist/index.d.ts +16 -16
  129. package/dist/index.mjs +41 -39
  130. package/dist/integrations.d.mts +1 -1
  131. package/dist/integrations.d.ts +1 -1
  132. package/dist/internal/app-markdown-runtime.d.mts +2 -2
  133. package/dist/internal/app-markdown-runtime.d.ts +2 -2
  134. package/dist/internal/build-runtime.cjs +32 -31
  135. package/dist/internal/build-runtime.d.mts +3 -3
  136. package/dist/internal/build-runtime.d.ts +3 -3
  137. package/dist/internal/build-runtime.mjs +31 -30
  138. package/dist/internal/cli-runtime.cjs +15 -15
  139. package/dist/internal/cli-runtime.mjs +14 -14
  140. package/dist/internal/client-error-overlay.cjs +4 -4
  141. package/dist/internal/client-error-overlay.mjs +1 -1
  142. package/dist/internal/client-runtime.cjs +4 -2
  143. package/dist/internal/client-runtime.d.mts +5 -5
  144. package/dist/internal/client-runtime.d.ts +5 -5
  145. package/dist/internal/client-runtime.mjs +3 -1
  146. package/dist/internal/compression-runtime.d.mts +1 -1
  147. package/dist/internal/compression-runtime.d.ts +1 -1
  148. package/dist/internal/config-runtime.cjs +8 -8
  149. package/dist/internal/config-runtime.d.mts +3 -3
  150. package/dist/internal/config-runtime.d.ts +3 -3
  151. package/dist/internal/config-runtime.mjs +7 -7
  152. package/dist/internal/form-actions.cjs +4 -3
  153. package/dist/internal/form-actions.mjs +3 -2
  154. package/dist/internal/infra-analytics-runtime.cjs +5 -5
  155. package/dist/internal/infra-analytics-runtime.mjs +3 -3
  156. package/dist/internal/islands-runtime.cjs +56 -0
  157. package/dist/internal/islands-runtime.mjs +57 -1
  158. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  159. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  160. package/dist/internal/production-runtime.cjs +11 -8
  161. package/dist/internal/production-runtime.d.mts +24 -11
  162. package/dist/internal/production-runtime.d.ts +24 -11
  163. package/dist/internal/production-runtime.mjs +10 -7
  164. package/dist/internal/server-fn-transform.cjs +13 -0
  165. package/dist/internal/server-fn-transform.d.mts +24 -0
  166. package/dist/internal/server-fn-transform.d.ts +24 -0
  167. package/dist/internal/server-fn-transform.mjs +13 -0
  168. package/dist/markdown.d.mts +1 -1
  169. package/dist/markdown.d.ts +1 -1
  170. package/dist/middleware.cjs +7 -7
  171. package/dist/middleware.d.mts +3 -3
  172. package/dist/middleware.d.ts +3 -3
  173. package/dist/middleware.mjs +6 -6
  174. package/dist/mobile.d.mts +30 -3
  175. package/dist/mobile.d.ts +30 -3
  176. package/dist/{navigation-delegate-8xg3Zvp4.d.ts → navigation-delegate-BU4xqdnw.d.ts} +1 -1
  177. package/dist/{navigation-delegate-ji6elCKy.d.mts → navigation-delegate-DLhbfEN4.d.mts} +1 -1
  178. package/dist/navigation.d.mts +4 -4
  179. package/dist/navigation.d.ts +4 -4
  180. package/dist/{nitro-YPSZBYDK.cjs → nitro-CK7M4RMY.cjs} +11 -11
  181. package/dist/{nitro-2Q5NVY7L.mjs → nitro-R444AF3O.mjs} +7 -7
  182. package/dist/plugin.cjs +25 -23
  183. package/dist/plugin.d.mts +3 -3
  184. package/dist/plugin.d.ts +3 -3
  185. package/dist/plugin.mjs +24 -22
  186. package/dist/{production-runtime-TdKaYRj0.d.ts → production-runtime-C78A8YgK.d.ts} +1 -1
  187. package/dist/{production-runtime-DXnQQkQf.d.mts → production-runtime-DLA4J5WG.d.mts} +1 -1
  188. package/dist/{programmatic-routes-client-BwiTndEC.d.ts → programmatic-routes-client-CBqkNhBy.d.ts} +2 -2
  189. package/dist/{programmatic-routes-client-Dh1SDLSM.d.mts → programmatic-routes-client-NpqGBn-i.d.mts} +2 -2
  190. package/dist/{render-plan-BvCGXF6K.d.mts → render-plan-C9sWvDTv.d.mts} +1 -1
  191. package/dist/{render-plan-BPbwRbuN.d.ts → render-plan-CrqcBbnV.d.ts} +1 -1
  192. package/dist/renderer-client.cjs +8 -6
  193. package/dist/renderer-client.d.mts +4 -4
  194. package/dist/renderer-client.d.ts +4 -4
  195. package/dist/renderer-client.mjs +4 -2
  196. package/dist/{request-B8PGTZNR.d.ts → request-BizeuqD7.d.ts} +1 -1
  197. package/dist/{request-C_xTkJib.d.mts → request-WwB1-Uim.d.mts} +1 -1
  198. package/dist/request.d.mts +2 -2
  199. package/dist/request.d.ts +2 -2
  200. package/dist/{route-rendering-RNtcj607.d.ts → route-rendering-BGhJN64l.d.ts} +1 -1
  201. package/dist/{route-rendering-DlddURL1.d.mts → route-rendering-S6NFjnx4.d.mts} +1 -1
  202. package/dist/{router-B97eB0Mq.d.mts → router-BIheIy9G.d.mts} +1 -1
  203. package/dist/{router-qUVaoEN8.d.ts → router-BUD_j2EL.d.ts} +1 -1
  204. package/dist/routes.cjs +3 -2
  205. package/dist/routes.d.mts +2 -2
  206. package/dist/routes.d.ts +2 -2
  207. package/dist/routes.mjs +2 -1
  208. package/dist/{rsc-pipeline-L4XOZ2TE.cjs → rsc-pipeline-JRGUZBYM.cjs} +11 -11
  209. package/dist/{rsc-pipeline-T3775JUA.mjs → rsc-pipeline-OLAVIKI3.mjs} +10 -10
  210. package/dist/{runtime-C8GUnNeP.d.ts → runtime-CWP-21hP.d.ts} +1 -1
  211. package/dist/{runtime-CaDswfWi.d.mts → runtime-CgJwe6H_.d.mts} +1 -1
  212. package/dist/{runtime-BIBGJO7V.cjs → runtime-G23RSLEK.cjs} +14 -14
  213. package/dist/{runtime-HRSFC4ZC.mjs → runtime-OGCHDACZ.mjs} +12 -12
  214. package/dist/{schema-dev-notice-LZ5NXGLN.mjs → schema-dev-notice-F6QYSOAI.mjs} +2 -2
  215. package/dist/{schema-dev-notice-XV7GZ3QJ.cjs → schema-dev-notice-UU7DMZEU.cjs} +3 -3
  216. package/dist/{search-client-BTXL5XWD.mjs → search-client-OXH6GBNO.mjs} +5 -3
  217. package/dist/search-client-ZZLKVO5R.cjs +15 -0
  218. package/dist/server-action-security.cjs +2 -2
  219. package/dist/server-action-security.mjs +1 -1
  220. package/dist/server-fn.cjs +3 -3
  221. package/dist/server-fn.mjs +2 -2
  222. package/dist/server-plugins.d.mts +2 -2
  223. package/dist/server-plugins.d.ts +2 -2
  224. package/dist/server-query-client.cjs +4 -3
  225. package/dist/server-query-client.mjs +3 -2
  226. package/dist/server-query.cjs +4 -4
  227. package/dist/server-query.mjs +3 -3
  228. package/dist/server.cjs +57 -55
  229. package/dist/server.d.mts +9 -9
  230. package/dist/server.d.ts +9 -9
  231. package/dist/server.mjs +34 -32
  232. package/dist/{spa-router-Dlv5ofg0.d.mts → spa-router-CVOL0Vrq.d.mts} +2 -2
  233. package/dist/{spa-router-qapSboKz.d.ts → spa-router-Kytv4jSB.d.ts} +2 -2
  234. package/dist/testing.cjs +12 -11
  235. package/dist/testing.d.mts +1 -1
  236. package/dist/testing.d.ts +1 -1
  237. package/dist/testing.mjs +9 -8
  238. package/dist/{utils-A-cYF81u.d.ts → utils-DbyXlzaj.d.ts} +1 -1
  239. package/dist/{utils-DyvlSxFk.d.mts → utils-Dsa1HZ7X.d.mts} +1 -1
  240. package/dist/version.cjs +2 -2
  241. package/dist/version.mjs +1 -1
  242. package/dist/vite.cjs +25 -23
  243. package/dist/vite.d.mts +4 -4
  244. package/dist/vite.d.ts +4 -4
  245. package/dist/vite.mjs +24 -22
  246. package/dist/workflows.cjs +4 -4
  247. package/dist/workflows.mjs +3 -3
  248. package/package.json +8 -3
  249. package/dist/base-path-leyrqXbX.d.mts +0 -19
  250. package/dist/base-path-leyrqXbX.d.ts +0 -19
  251. package/dist/chunk-OTOOJIUB.mjs +0 -34
  252. package/dist/search-client-QCYAL6AY.cjs +0 -13
@@ -9,10 +9,10 @@ import {
9
9
  } from "./chunk-IYEY3JWJ.mjs";
10
10
  import {
11
11
  APIRouteConflictError
12
- } from "./chunk-WXHDVXJE.mjs";
12
+ } from "./chunk-KY32FWK7.mjs";
13
13
  import {
14
14
  findProgrammaticRouteFilesInDir
15
- } from "./chunk-2H3FJYY6.mjs";
15
+ } from "./chunk-FSXSQQTV.mjs";
16
16
  import {
17
17
  isFarmAPIRouteFileName
18
18
  } from "./chunk-YX6AFPXC.mjs";
@@ -20,6 +20,7 @@ import {
20
20
  API_ROUTE_METHODS,
21
21
  getAllowedAPIRouteMethods,
22
22
  invokeAPIRouteEndpoint,
23
+ isFarmAPIPathname,
23
24
  matchAPIRouteAtBasePath,
24
25
  mergePluginAPIRoutes,
25
26
  resolveAPIRouteEndpoint
@@ -36,7 +37,7 @@ import {
36
37
  import {
37
38
  toPosixPath,
38
39
  toViteModuleId
39
- } from "./chunk-2SVJGOAX.mjs";
40
+ } from "./chunk-Y3N5BFRJ.mjs";
40
41
  import {
41
42
  sendWebResponse
42
43
  } from "./chunk-IUQLRTTO.mjs";
@@ -400,16 +401,26 @@ function farmApiPlugin(options = {}) {
400
401
  const pathname = url.split("?")[0];
401
402
  const method = req.method || "GET";
402
403
  if (discoveryPromise) await waitForDiscovery();
404
+ const farmMiddleware = server.__farmMiddleware__;
405
+ let middlewareRan = false;
403
406
  if (!matchAPIRouteAtBasePath(servedRoutes(), pathname, basePath)) {
404
- return next();
407
+ if (!farmMiddleware || !apiRouterHandler || !isFarmAPIPathname(pathname, basePath)) {
408
+ return next();
409
+ }
410
+ await farmMiddleware.waitForDiscovery?.();
411
+ if (await farmMiddleware.execute(req, res, pathname, /* @__PURE__ */ new Map())) return;
412
+ middlewareRan = true;
413
+ const rewrittenPathname = (req.url || url).split("?")[0];
414
+ if (rewrittenPathname === pathname || !matchAPIRouteAtBasePath(servedRoutes(), rewrittenPathname, basePath)) {
415
+ return next();
416
+ }
405
417
  }
406
418
  if (!apiRouterHandler) {
407
419
  return next();
408
420
  }
409
421
  const startTime = Date.now();
410
422
  try {
411
- const farmMiddleware = server.__farmMiddleware__;
412
- if (farmMiddleware) {
423
+ if (farmMiddleware && !middlewareRan) {
413
424
  await farmMiddleware.waitForDiscovery?.();
414
425
  const middlewareData = /* @__PURE__ */ new Map();
415
426
  const handled = await farmMiddleware.execute(req, res, pathname, middlewareData);
@@ -1,20 +1,20 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await 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; } async function _asyncOptionalChain(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 = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkETF5C6HRcjs = require('./chunk-ETF5C6HR.cjs');
4
+ var _chunkSJ23LJ3Ncjs = require('./chunk-SJ23LJ3N.cjs');
5
5
 
6
6
 
7
- var _chunkCGCJ2TJUcjs = require('./chunk-CGCJ2TJU.cjs');
7
+ var _chunkXPMC4E2Gcjs = require('./chunk-XPMC4E2G.cjs');
8
8
 
9
9
 
10
- var _chunkLYWAGXXWcjs = require('./chunk-LYWAGXXW.cjs');
10
+ var _chunkO3MMJPC2cjs = require('./chunk-O3MMJPC2.cjs');
11
11
 
12
12
 
13
13
 
14
14
  var _chunkDGOLAZLVcjs = require('./chunk-DGOLAZLV.cjs');
15
15
 
16
16
 
17
- var _chunkIXSMFKZ2cjs = require('./chunk-IXSMFKZ2.cjs');
17
+ var _chunkLNM57D3Hcjs = require('./chunk-LNM57D3H.cjs');
18
18
 
19
19
 
20
20
  var _chunkAQLHD6HZcjs = require('./chunk-AQLHD6HZ.cjs');
@@ -54,7 +54,7 @@ function pickImportTarget(entry) {
54
54
  return void 0;
55
55
  }
56
56
  async function importFromApp(root, packageName, subpath = ".") {
57
- const packageDir = _chunkETF5C6HRcjs.findFarmAppPackageDir.call(void 0, root, packageName);
57
+ const packageDir = _chunkSJ23LJ3Ncjs.findFarmAppPackageDir.call(void 0, root, packageName);
58
58
  if (!packageDir) return void 0;
59
59
  const manifest = JSON.parse(_fs.readFileSync.call(void 0, _path2.default.join(packageDir, "package.json"), "utf8"));
60
60
  const exportsMap = manifest.exports;
@@ -81,9 +81,9 @@ async function createFarmRscViteConfig(userConfig, options) {
81
81
  importFromApp(root, "@vitejs/plugin-rsc"),
82
82
  importFromApp(root, "@vitejs/plugin-react")
83
83
  ]);
84
- if (!pluginRsc || !viteRsc || !_chunkETF5C6HRcjs.findFarmAppPackageDir.call(void 0, root, "react-server-dom-webpack")) {
84
+ if (!pluginRsc || !viteRsc || !_chunkSJ23LJ3Ncjs.findFarmAppPackageDir.call(void 0, root, "react-server-dom-webpack")) {
85
85
  throw new Error(
86
- `[Farm.js] experimental.serverComponents runs on @farm.js/plugin and the official @vitejs/plugin-rsc. Install them: ${_chunkETF5C6HRcjs.FARM_RSC_INSTALL_HINT}`
86
+ `[Farm.js] experimental.serverComponents runs on @farm.js/plugin and the official @vitejs/plugin-rsc. Install them: ${_chunkSJ23LJ3Ncjs.FARM_RSC_INSTALL_HINT}`
87
87
  );
88
88
  }
89
89
  const { plugins: vitePlugins = [], ...viteOptions } = _nullishCoalesce(userConfig.vite, () => ( {}));
@@ -92,7 +92,7 @@ async function createFarmRscViteConfig(userConfig, options) {
92
92
  if (userConfig[key] !== void 0) rscConfig[key] = userConfig[key];
93
93
  }
94
94
  const createReactPlugin = hasPluginNamed(vitePlugins, "vite:react") ? void 0 : await _asyncNullishCoalesce(await _asyncOptionalChain([viteReact, 'optionalAccess', async _2 => _2.default]), async () => ( (options.command === "serve" ? (await _chunkDGOLAZLVcjs.loadFarmReactPlugin.call(void 0, )).default : void 0)));
95
- const tailwind = hasPluginNamed(vitePlugins, "@tailwindcss/vite") ? void 0 : await _chunkIXSMFKZ2cjs.loadTailwindVitePlugin.call(void 0, );
95
+ const tailwind = hasPluginNamed(vitePlugins, "@tailwindcss/vite") ? void 0 : await _chunkLNM57D3Hcjs.loadTailwindVitePlugin.call(void 0, );
96
96
  const farmConfig = pluginRsc.defineConfig({
97
97
  ...rscConfig,
98
98
  experimental: { ...userConfig.experimental, serverComponents: true },
@@ -111,7 +111,7 @@ async function createFarmRscViteConfig(userConfig, options) {
111
111
  server: { environmentName: "rsc" },
112
112
  config: {
113
113
  preset: options.preset,
114
- outputDir: options.outputDir && _chunkLYWAGXXWcjs.resolveDeployOutputPath.call(void 0, root, options.outputDir)
114
+ outputDir: options.outputDir && _chunkO3MMJPC2cjs.resolveDeployOutputPath.call(void 0, root, options.outputDir)
115
115
  }
116
116
  })
117
117
  ]
@@ -134,7 +134,7 @@ async function createFarmRscDevServer(userConfig, options) {
134
134
  const config = await createFarmRscViteConfig(userConfig, { ...configOptions, command: "serve" });
135
135
  return createServer({
136
136
  ...config,
137
- plugins: [..._nullishCoalesce(config.plugins, () => ( [])), _chunkCGCJ2TJUcjs.createFarmDevLoopbackPlugin.call(void 0, )],
137
+ plugins: [..._nullishCoalesce(config.plugins, () => ( [])), _chunkXPMC4E2Gcjs.createFarmDevLoopbackPlugin.call(void 0, )],
138
138
  ...host === void 0 ? {} : { server: { ...config.server, host } }
139
139
  });
140
140
  }
@@ -15,6 +15,9 @@ import {
15
15
  createRouteDataCacheTag,
16
16
  getFarmDataCache
17
17
  } from "./chunk-RLEALQEN.mjs";
18
+ import {
19
+ createFarmSearchParams
20
+ } from "./chunk-H3ASZDT7.mjs";
18
21
  import {
19
22
  createFarmCacheKey
20
23
  } from "./chunk-GLOICKDO.mjs";
@@ -535,7 +538,7 @@ async function resolveProgrammaticRouteProps(route, props) {
535
538
  ...props,
536
539
  params,
537
540
  search,
538
- searchParams: Promise.resolve(search)
541
+ searchParams: createFarmSearchParams(search)
539
542
  };
540
543
  const routeContextProps = {
541
544
  ...baseProps,
@@ -23,7 +23,7 @@ import {
23
23
  } from "./chunk-LM2YOGDK.mjs";
24
24
  import {
25
25
  FARM_VERSION
26
- } from "./chunk-2VCC3GVC.mjs";
26
+ } from "./chunk-ZF3GX4O7.mjs";
27
27
  import {
28
28
  applyFarmBasePath
29
29
  } from "./chunk-SF3JB56B.mjs";
@@ -1,14 +1,11 @@
1
+ import {
2
+ resolveFarmPlatform
3
+ } from "./chunk-SMUW7UST.mjs";
1
4
  import {
2
5
  collectSSGPages,
3
6
  matchSSGPage,
4
7
  resolveRouteRenderingConfigFromFile
5
- } from "./chunk-SHJJM6OG.mjs";
6
- import {
7
- createFarmMetadataImageResponse
8
- } from "./chunk-OZK2DS44.mjs";
9
- import {
10
- resolveFarmPlatform
11
- } from "./chunk-SMUW7UST.mjs";
8
+ } from "./chunk-WVX3BUNJ.mjs";
12
9
  import {
13
10
  classifyFarmDocumentPrefix,
14
11
  composeFarmFullDocument,
@@ -33,10 +30,10 @@ import {
33
30
  renderFarmLocaleAlternateLinks,
34
31
  resolveDefaultErrorStatus,
35
32
  routeBoundaryCoversDirectory
36
- } from "./chunk-ZIBIE7AH.mjs";
33
+ } from "./chunk-7UPCJDB5.mjs";
37
34
  import {
38
35
  listFarmMCPLlmsTxtLinks
39
- } from "./chunk-JJOWY3XD.mjs";
36
+ } from "./chunk-R5P4KFPM.mjs";
40
37
  import {
41
38
  FARM_DEFAULT_MCP_PATH,
42
39
  collectFarmDefaultMCPPages,
@@ -45,13 +42,16 @@ import {
45
42
  isFarmDefaultMCPPathname,
46
43
  resolveFarmDefaultMCPServer
47
44
  } from "./chunk-KRRZJ77U.mjs";
45
+ import {
46
+ createFarmMetadataImageResponse
47
+ } from "./chunk-OZK2DS44.mjs";
48
48
  import {
49
49
  installFarmIslandValues,
50
50
  uninstallFarmIslandValues
51
51
  } from "./chunk-A4PWGL46.mjs";
52
52
  import {
53
53
  handleFarmFormActionRequest
54
- } from "./chunk-OTOOJIUB.mjs";
54
+ } from "./chunk-Z5A6CNV2.mjs";
55
55
  import {
56
56
  FARM_ISLAND_REPLAYABLE_SELECTOR,
57
57
  isFarmIslandStrategy
@@ -134,13 +134,13 @@ import {
134
134
  } from "./chunk-UIJOLBUL.mjs";
135
135
  import {
136
136
  resolveWorkflowsConfig
137
- } from "./chunk-5V4KZOZO.mjs";
137
+ } from "./chunk-LZ4SB57H.mjs";
138
138
  import {
139
139
  resolveCronConfig
140
- } from "./chunk-UCQ52TJY.mjs";
140
+ } from "./chunk-X3JNB2TB.mjs";
141
141
  import {
142
142
  resolveServerActionsConfig
143
- } from "./chunk-BW6SCVYX.mjs";
143
+ } from "./chunk-FSQMN2MQ.mjs";
144
144
  import {
145
145
  resolveFarmThemeConfig
146
146
  } from "./chunk-YWPNIYUP.mjs";
@@ -168,7 +168,7 @@ import {
168
168
  import {
169
169
  createRouteSlotContainerId,
170
170
  parseRouteSlotFile
171
- } from "./chunk-CBJKDB6F.mjs";
171
+ } from "./chunk-IRSS4HS4.mjs";
172
172
  import {
173
173
  _clearCurrentMiddlewareContext,
174
174
  _clearCurrentMiddlewareData,
@@ -178,7 +178,7 @@ import {
178
178
  import {
179
179
  findProgrammaticRouteFiles,
180
180
  loadProgrammaticRouteManifests
181
- } from "./chunk-2H3FJYY6.mjs";
181
+ } from "./chunk-FSXSQQTV.mjs";
182
182
  import {
183
183
  _runWithFarmI18nRequest,
184
184
  _setDefaultFarmI18nRuntime,
@@ -230,10 +230,11 @@ import {
230
230
  splitRoutePath,
231
231
  toRootRelativeUrlPath,
232
232
  toViteModuleId
233
- } from "./chunk-2SVJGOAX.mjs";
233
+ } from "./chunk-Y3N5BFRJ.mjs";
234
234
  import {
235
+ createFarmSearchParams,
235
236
  searchParamsToObject
236
- } from "./chunk-TXK4D46O.mjs";
237
+ } from "./chunk-H3ASZDT7.mjs";
237
238
  import {
238
239
  configureFarmObservability,
239
240
  emitFarmEvent
@@ -253,7 +254,7 @@ import {
253
254
  } from "./chunk-LM2YOGDK.mjs";
254
255
  import {
255
256
  FARM_VERSION
256
- } from "./chunk-2VCC3GVC.mjs";
257
+ } from "./chunk-ZF3GX4O7.mjs";
257
258
  import {
258
259
  resolveFarmTrailingSlashRedirect,
259
260
  setFarmTrailingSlashPreference
@@ -4465,7 +4466,12 @@ function withFarmIslandsRenders(runtime, islandsRuntime) {
4465
4466
  return wrapped;
4466
4467
  }
4467
4468
  var cachedClerkProvider = null;
4468
- var importRuntimeModule = new Function("specifier", "return import(specifier);");
4469
+ function importRuntimeModule(specifier) {
4470
+ return import(
4471
+ /* @vite-ignore */
4472
+ specifier
4473
+ );
4474
+ }
4469
4475
  function shouldServePrerenderedPage(nodeEnv, method) {
4470
4476
  if (nodeEnv !== "production") return false;
4471
4477
  const normalizedMethod = (method || "GET").toUpperCase();
@@ -4655,7 +4661,7 @@ async function parseRouteModuleProps(routeModule, input) {
4655
4661
  ...input.props,
4656
4662
  params,
4657
4663
  search,
4658
- searchParams: Promise.resolve(search)
4664
+ searchParams: createFarmSearchParams(search)
4659
4665
  };
4660
4666
  }
4661
4667
  function parseRouteModuleSchema(schema, value, label, routePath) {
@@ -4673,7 +4679,7 @@ function createRouteStateProps(input) {
4673
4679
  return {
4674
4680
  params: input.params,
4675
4681
  search: input.searchParamsObject,
4676
- searchParams: Promise.resolve(input.searchParamsObject),
4682
+ searchParams: createFarmSearchParams(input.searchParamsObject),
4677
4683
  path: input.path,
4678
4684
  middleware: input.middlewareMap.size > 0 ? { data: input.middlewareMap } : void 0,
4679
4685
  context: input.pluginExposedContext.size > 0 ? { data: input.pluginExposedContext } : void 0
@@ -5126,7 +5132,7 @@ var ServerRenderer = class {
5126
5132
  const PageComponent = mod.default;
5127
5133
  const pageProps = {
5128
5134
  params: page.params,
5129
- searchParams: Promise.resolve({}),
5135
+ searchParams: createFarmSearchParams({}),
5130
5136
  path: page.urlPath
5131
5137
  };
5132
5138
  let pageElement = this.rendererRuntime.createElement(PageComponent, pageProps);
@@ -5412,7 +5418,7 @@ var ServerRenderer = class {
5412
5418
  const rawPageProps = withFarmRouteContext(
5413
5419
  {
5414
5420
  params,
5415
- searchParams: Promise.resolve(searchParamsObject),
5421
+ searchParams: createFarmSearchParams(searchParamsObject),
5416
5422
  path: pathname,
5417
5423
  middleware: middlewareMap.size > 0 ? { data: middlewareMap } : void 0,
5418
5424
  context: pluginExposedContext.size > 0 ? { data: pluginExposedContext } : void 0
@@ -5435,7 +5441,7 @@ var ServerRenderer = class {
5435
5441
  const routeStateProps = {
5436
5442
  ...rawPageProps,
5437
5443
  search: searchParamsObject,
5438
- searchParams: Promise.resolve(searchParamsObject),
5444
+ searchParams: createFarmSearchParams(searchParamsObject),
5439
5445
  error
5440
5446
  };
5441
5447
  if (isFarmNotFoundError(error) && programmaticRouteComponents?.notFound) {
@@ -5553,7 +5559,7 @@ var ServerRenderer = class {
5553
5559
  const rawSlotProps = withFarmRouteContext(
5554
5560
  {
5555
5561
  params: slot.params,
5556
- searchParams: Promise.resolve(searchParamsObject),
5562
+ searchParams: createFarmSearchParams(searchParamsObject),
5557
5563
  path: pathname,
5558
5564
  middleware: middlewareMap.size > 0 ? { data: middlewareMap } : void 0,
5559
5565
  context: pluginExposedContext.size > 0 ? { data: pluginExposedContext } : void 0
@@ -6417,7 +6423,7 @@ var ServerRenderer = class {
6417
6423
  }
6418
6424
  const imageProps = {
6419
6425
  params: options.params,
6420
- searchParams: Promise.resolve(options.searchParamsObject),
6426
+ searchParams: createFarmSearchParams(options.searchParamsObject),
6421
6427
  path: options.pagePath
6422
6428
  };
6423
6429
  const handlerResult = typeof imageModule.default === "function" ? await imageModule.default(imageProps) : imageModule.default;
@@ -7721,7 +7727,7 @@ function resolveFarmAppPackages(root) {
7721
7727
  import fs7 from "fs";
7722
7728
  import { createRequire as createRequire2 } from "module";
7723
7729
  import path12 from "path";
7724
- import fg from "fast-glob";
7730
+ import { globSync } from "tinyglobby";
7725
7731
  var WEBMCP_CLIENT = "@farm.js/webmcp/client";
7726
7732
  var DEFINERS = /* @__PURE__ */ new Set(["defineWebMCPTool", "registerWebMCPTool", "registerWebMCPTools"]);
7727
7733
  var HINTS = ["readOnlyHint", "destructiveHint", "idempotentHint", "openWorldHint"];
@@ -7865,9 +7871,10 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
7865
7871
  const base = path12.resolve(root, srcDir);
7866
7872
  let files;
7867
7873
  try {
7868
- files = fg.sync("**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}", {
7874
+ files = globSync("**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}", {
7869
7875
  cwd: base,
7870
7876
  absolute: true,
7877
+ expandDirectories: false,
7871
7878
  ignore: ["**/node_modules/**", "**/*.d.ts", "**/*.{test,spec}.*", "**/__tests__/**"]
7872
7879
  });
7873
7880
  } catch {
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-PAKCHVUS.mjs";
5
5
  import {
6
6
  logger
7
- } from "./chunk-2SVJGOAX.mjs";
7
+ } from "./chunk-Y3N5BFRJ.mjs";
8
8
 
9
9
  // src/server-components-status.ts
10
10
  import { existsSync, realpathSync } from "fs";
@@ -4,7 +4,7 @@
4
4
  var _chunkBPNOYILCcjs = require('./chunk-BPNOYILC.cjs');
5
5
 
6
6
 
7
- var _chunkXN2MB4QZcjs = require('./chunk-XN2MB4QZ.cjs');
7
+ var _chunkVQJYGZNXcjs = require('./chunk-VQJYGZNX.cjs');
8
8
 
9
9
  // src/server-components-status.ts
10
10
  var _fs = require('fs');
@@ -103,7 +103,7 @@ function farmAppUsesRscPipeline(config, root) {
103
103
  if (status.fallback) {
104
104
  if (!warnedFallback) {
105
105
  warnedFallback = true;
106
- _chunkXN2MB4QZcjs.logger.warn(
106
+ _chunkVQJYGZNXcjs.logger.warn(
107
107
  `[Farm.js] ${formatFarmRscFallbackMessage(status.missingPackages, status.blockingKeys)}`
108
108
  );
109
109
  }
@@ -113,7 +113,7 @@ function farmAppUsesRscPipeline(config, root) {
113
113
  throw new Error(`[Farm.js] ${formatFarmRscBlockingMessage(status.blockingKeys)}`);
114
114
  }
115
115
  if (status.ignoredKeys.length > 0) {
116
- _chunkXN2MB4QZcjs.logger.warn(
116
+ _chunkVQJYGZNXcjs.logger.warn(
117
117
  `[Farm.js] experimental.serverComponents runs on the RSC pipeline, which does not run ${formatKeys(
118
118
  status.ignoredKeys
119
119
  )} yet. ${status.ignoredKeys.length === 1 ? "It is" : "They are"} ignored.`