@farm.js/core 0.2.0-beta.4 → 0.2.1

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 (235) hide show
  1. package/README.md +1 -3
  2. package/dist/{agent-mcp.d-CAwDC9y4.d.ts → agent-mcp.d--uQgDp_Q.d.ts} +1 -1
  3. package/dist/{agent-mcp.d-BdFnjlAT.d.mts → agent-mcp.d-DpthRhqr.d.mts} +1 -1
  4. package/dist/agent-runtime.d.mts +4 -4
  5. package/dist/agent-runtime.d.ts +4 -4
  6. package/dist/{analyzer-K3S4YRAH.mjs → analyzer-GLFRODYV.mjs} +2 -2
  7. package/dist/analyzer-KBVOHASA.cjs +17 -0
  8. package/dist/api/node.d.mts +6 -6
  9. package/dist/api/node.d.ts +6 -6
  10. package/dist/api/route-manager.cjs +3 -3
  11. package/dist/api/route-manager.d.mts +6 -6
  12. package/dist/api/route-manager.d.ts +6 -6
  13. package/dist/api/route-manager.mjs +2 -2
  14. package/dist/api/runtime.d.mts +5 -5
  15. package/dist/api/runtime.d.ts +5 -5
  16. package/dist/api.cjs +4 -4
  17. package/dist/api.d.mts +7 -7
  18. package/dist/api.d.ts +7 -7
  19. package/dist/api.mjs +3 -3
  20. package/dist/{app-manifest.d-Dczk-fwt.d.ts → app-manifest.d-DMgcFuXQ.d.ts} +1 -1
  21. package/dist/{app-manifest.d-COs1wBGz.d.mts → app-manifest.d-DXAvPjMw.d.mts} +1 -1
  22. package/dist/app-markdown.d.mts +5 -5
  23. package/dist/app-markdown.d.ts +5 -5
  24. package/dist/{app.d-LepnxO-5.d.mts → app.d-DG_-nN5y.d.mts} +4 -4
  25. package/dist/{app.d-DREl_yXh.d.ts → app.d-htfGqq-d.d.ts} +4 -4
  26. package/dist/{chunk-X2SMVPLH.mjs → chunk-2FBFJO2Z.mjs} +8 -5
  27. package/dist/{chunk-Z3RM3VA2.mjs → chunk-5VXVRMXK.mjs} +11 -1
  28. package/dist/{chunk-LWQ6IESX.mjs → chunk-BOHBFBRA.mjs} +1 -1
  29. package/dist/{chunk-V5F6HN7E.mjs → chunk-CPL7WIMP.mjs} +1 -1
  30. package/dist/{chunk-APKULXZV.cjs → chunk-CS6GXE42.cjs} +91 -21
  31. package/dist/chunk-CYUTK4JP.cjs +52 -0
  32. package/dist/{chunk-T4NOMZTS.mjs → chunk-CZMMU3FP.mjs} +4 -4
  33. package/dist/{chunk-PSALMEHJ.cjs → chunk-D2OU4CX2.cjs} +23 -20
  34. package/dist/{chunk-5BZ7PR3T.cjs → chunk-D2VLHRBN.cjs} +3 -3
  35. package/dist/{chunk-D5OY5OKA.mjs → chunk-D5GFVHBV.mjs} +23 -17
  36. package/dist/{chunk-VGX75645.mjs → chunk-E7ISZK3R.mjs} +8 -5
  37. package/dist/{chunk-F5T55PYX.cjs → chunk-EIAA4W3M.cjs} +26 -21
  38. package/dist/{chunk-2PSN2PUJ.cjs → chunk-EWPH5IOC.cjs} +19 -16
  39. package/dist/{chunk-QBCR2EHA.cjs → chunk-GEZ76JXD.cjs} +3 -3
  40. package/dist/{chunk-KM7ZRKCH.cjs → chunk-GL4SPJTE.cjs} +10 -10
  41. package/dist/{chunk-IU4YTFFQ.cjs → chunk-GUYGMTWA.cjs} +12 -9
  42. package/dist/{chunk-MRDI6MTL.mjs → chunk-H6MYRZ2U.mjs} +15 -10
  43. package/dist/{chunk-P67RLOMO.mjs → chunk-HBZQIRRM.mjs} +1 -1
  44. package/dist/{chunk-NNHIV3O2.cjs → chunk-HENYWY5J.cjs} +2 -2
  45. package/dist/{chunk-HV6CYSMF.mjs → chunk-HHZURH4U.mjs} +1 -17
  46. package/dist/{chunk-E5AC7E25.cjs → chunk-JJ22OI7J.cjs} +2 -2
  47. package/dist/{chunk-XPVS4HKU.cjs → chunk-JZAGIXMB.cjs} +1 -1
  48. package/dist/{chunk-TQCDN4DV.mjs → chunk-KQXYBJES.mjs} +14 -11
  49. package/dist/{chunk-5UMPMVNF.mjs → chunk-L2KGQXFU.mjs} +1 -1
  50. package/dist/{chunk-HP7QYVST.cjs → chunk-LEZJZX4C.cjs} +1 -18
  51. package/dist/{chunk-C4DZAEVT.cjs → chunk-MR64FNW6.cjs} +4 -4
  52. package/dist/{chunk-LOQVWATF.mjs → chunk-MYJPW4XN.mjs} +2 -2
  53. package/dist/chunk-O77EKGAS.mjs +36 -0
  54. package/dist/{chunk-VS4ABIJJ.mjs → chunk-OKZHPPBX.mjs} +1 -1
  55. package/dist/{chunk-WLOIUPV2.mjs → chunk-P2THJDLH.mjs} +37 -26
  56. package/dist/{chunk-KBURN62Z.cjs → chunk-PFVNPOKN.cjs} +11 -1
  57. package/dist/{chunk-IASZIYNM.cjs → chunk-PGU4SCIU.cjs} +302 -297
  58. package/dist/chunk-PTG5BEMG.mjs +47 -0
  59. package/dist/{chunk-UBH2OARS.cjs → chunk-PVB5UYJT.cjs} +280 -274
  60. package/dist/{chunk-EBVKVDQA.mjs → chunk-PZ5ZJAAO.mjs} +1 -1
  61. package/dist/{chunk-FYVSAWJP.cjs → chunk-Q4FHYBFT.cjs} +11 -11
  62. package/dist/{chunk-AGT633OM.cjs → chunk-QI3UYN3P.cjs} +11 -11
  63. package/dist/{chunk-HFOME6I2.mjs → chunk-QJKGRUBR.mjs} +5 -5
  64. package/dist/{chunk-DFLCEMQ3.mjs → chunk-RCJAOQWW.mjs} +1 -1
  65. package/dist/{chunk-AGEBFYHF.mjs → chunk-SIJ3DREB.mjs} +1 -1
  66. package/dist/{chunk-II4ENBE4.mjs → chunk-SPVXL37B.mjs} +1 -1
  67. package/dist/{chunk-VVIO7QGN.mjs → chunk-TI4BJFYX.mjs} +32 -27
  68. package/dist/{chunk-MBDDLYT5.cjs → chunk-V6ACETKR.cjs} +4 -4
  69. package/dist/{chunk-VMIR4SUL.cjs → chunk-W34OS5CK.cjs} +383 -372
  70. package/dist/{chunk-ANKMAGFJ.mjs → chunk-WRT775N6.mjs} +92 -22
  71. package/dist/{chunk-DVXT7RLV.cjs → chunk-WXPY5FRF.cjs} +6 -6
  72. package/dist/{chunk-VQYGXWCS.cjs → chunk-XSE4XJKY.cjs} +2 -2
  73. package/dist/{chunk-2ORWY3SE.mjs → chunk-XYCB3CXM.mjs} +2 -2
  74. package/dist/{chunk-XJEOHDPN.cjs → chunk-YCGOQKVC.cjs} +21 -2
  75. package/dist/{chunk-2UV765GT.cjs → chunk-ZQOHL6TX.cjs} +2 -2
  76. package/dist/{client-component.d-BA6kXI5L.d.mts → client-component.d-D5JVDeQf.d.mts} +1 -1
  77. package/dist/{client-component.d-LSEmRhuI.d.ts → client-component.d-DDbDw2yP.d.ts} +1 -1
  78. package/dist/{client-plugins.d-CVUMc2ai.d.mts → client-plugins.d-9jr2yWR3.d.mts} +21 -16
  79. package/dist/{client-plugins.d-CQ6AGHP0.d.ts → client-plugins.d-BHqfH3DQ.d.ts} +21 -16
  80. package/dist/client-plugins.d.mts +4 -4
  81. package/dist/client-plugins.d.ts +4 -4
  82. package/dist/client.d.mts +10 -10
  83. package/dist/client.d.ts +10 -10
  84. package/dist/config.d.mts +4 -4
  85. package/dist/config.d.ts +4 -4
  86. package/dist/desktop.d.mts +5 -5
  87. package/dist/desktop.d.ts +5 -5
  88. package/dist/{devtools-OBQY3XOY.cjs → devtools-F6Z436WU.cjs} +12 -9
  89. package/dist/{devtools-RYTO2V7G.mjs → devtools-ZDBCJI44.mjs} +8 -5
  90. package/dist/docs.cjs +7 -6
  91. package/dist/docs.d.mts +6 -6
  92. package/dist/docs.d.ts +6 -6
  93. package/dist/docs.mjs +6 -5
  94. package/dist/environment/vite.cjs +6 -5
  95. package/dist/environment/vite.d.mts +2 -1
  96. package/dist/environment/vite.d.ts +2 -1
  97. package/dist/environment/vite.mjs +5 -4
  98. package/dist/{generate-route-types.d-BFOMM8Ef.d.mts → generate-route-types.d-CAiRw4N0.d.mts} +1 -1
  99. package/dist/{generate-route-types.d-C2m8myHb.d.ts → generate-route-types.d-Dz8MOQ3u.d.ts} +1 -1
  100. package/dist/{handler.d-nkrNn_0M.d.ts → handler.d-Dq_bSEKC.d.ts} +2 -2
  101. package/dist/{handler.d-DLKZDAYR.d.mts → handler.d-EtTSPkeO.d.mts} +2 -2
  102. package/dist/{headers.d-C3k520Fc.d.mts → headers.d-BKwGD_uC.d.mts} +1 -1
  103. package/dist/{headers.d-DVBrYnqP.d.ts → headers.d-CpIHLCEk.d.ts} +1 -1
  104. package/dist/index.cjs +28 -27
  105. package/dist/{index.d-e5WhoB07.d.ts → index.d-CoRZKiHA.d.ts} +1 -1
  106. package/dist/{index.d-5PDB032w.d.mts → index.d-DXtaU9OU.d.mts} +1 -1
  107. package/dist/index.d.mts +27 -27
  108. package/dist/index.d.ts +27 -27
  109. package/dist/index.mjs +23 -22
  110. package/dist/integrations/orm.d.mts +4 -4
  111. package/dist/integrations/orm.d.ts +4 -4
  112. package/dist/integrations.d.mts +4 -4
  113. package/dist/integrations.d.ts +4 -4
  114. package/dist/internal/app-markdown-runtime.d.mts +5 -5
  115. package/dist/internal/app-markdown-runtime.d.ts +5 -5
  116. package/dist/internal/build-runtime.cjs +23 -22
  117. package/dist/internal/build-runtime.d.mts +8 -8
  118. package/dist/internal/build-runtime.d.ts +8 -8
  119. package/dist/internal/build-runtime.mjs +22 -21
  120. package/dist/internal/cli-runtime.cjs +14 -10
  121. package/dist/internal/cli-runtime.d.mts +20 -12
  122. package/dist/internal/cli-runtime.d.ts +20 -12
  123. package/dist/internal/cli-runtime.mjs +13 -9
  124. package/dist/internal/client-error-overlay.cjs +4 -4
  125. package/dist/internal/client-error-overlay.mjs +1 -1
  126. package/dist/internal/client-runtime.d.mts +8 -8
  127. package/dist/internal/client-runtime.d.ts +8 -8
  128. package/dist/internal/compression-runtime.d.mts +4 -4
  129. package/dist/internal/compression-runtime.d.ts +4 -4
  130. package/dist/internal/config-runtime.cjs +7 -6
  131. package/dist/internal/config-runtime.d.mts +8 -8
  132. package/dist/internal/config-runtime.d.ts +8 -8
  133. package/dist/internal/config-runtime.mjs +6 -5
  134. package/dist/internal/infra-analytics-runtime.cjs +6 -6
  135. package/dist/internal/infra-analytics-runtime.mjs +4 -4
  136. package/dist/internal/native-server-fns.cjs +4 -4
  137. package/dist/internal/native-server-fns.mjs +3 -3
  138. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  139. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  140. package/dist/internal/production-runtime.cjs +4 -4
  141. package/dist/internal/production-runtime.d.mts +13 -13
  142. package/dist/internal/production-runtime.d.ts +13 -13
  143. package/dist/internal/production-runtime.mjs +3 -3
  144. package/dist/internal/spa-router.d.mts +6 -6
  145. package/dist/internal/spa-router.d.ts +6 -6
  146. package/dist/internal/start-manifest.d.mts +4 -4
  147. package/dist/internal/start-manifest.d.ts +4 -4
  148. package/dist/layers-6R55QDT5.cjs +26 -0
  149. package/dist/{layers-IMRXNZRB.mjs → layers-O6GUR6LT.mjs} +6 -1
  150. package/dist/{layers.d-CH0bC4QL.d.ts → layers.d-dNBkiNE9.d.mts} +1 -1
  151. package/dist/{layers.d-CH0bC4QL.d.mts → layers.d-dNBkiNE9.d.ts} +1 -1
  152. package/dist/{manager-3DFQDKJ6.cjs → manager-YRIENS63.cjs} +4 -4
  153. package/dist/{manager-GZUTAN5Q.mjs → manager-YTJOAHII.mjs} +3 -3
  154. package/dist/markdown.d.mts +4 -4
  155. package/dist/markdown.d.ts +4 -4
  156. package/dist/middleware.d.mts +4 -4
  157. package/dist/middleware.d.ts +4 -4
  158. package/dist/mobile.d.mts +4 -4
  159. package/dist/mobile.d.ts +4 -4
  160. package/dist/{mount.d-Cbz8vsSZ.d.ts → mount.d-BzK2Z1pR.d.ts} +1 -1
  161. package/dist/{mount.d-COIrFH0i.d.mts → mount.d-D-ynBlxU.d.mts} +1 -1
  162. package/dist/{navigation-delegate.d-dlnYTX-Y.d.ts → navigation-delegate.d-DtsnFnNF.d.ts} +1 -1
  163. package/dist/{navigation-delegate.d-yulG9Dp5.d.mts → navigation-delegate.d-aJh3ZmTY.d.mts} +1 -1
  164. package/dist/navigation.d.mts +7 -7
  165. package/dist/navigation.d.ts +7 -7
  166. package/dist/plugin.cjs +18 -17
  167. package/dist/plugin.d.mts +8 -8
  168. package/dist/plugin.d.ts +8 -8
  169. package/dist/plugin.mjs +17 -16
  170. package/dist/{render-plan.d-BW56oxMP.d.mts → render-plan.d-C6nUIU2m.d.mts} +1 -1
  171. package/dist/{render-plan.d-Cz7bQmcf.d.ts → render-plan.d-h8bkOQyh.d.ts} +1 -1
  172. package/dist/renderer-client.d.mts +8 -8
  173. package/dist/renderer-client.d.ts +8 -8
  174. package/dist/renderer.cjs +4 -3
  175. package/dist/renderer.d.mts +1 -1
  176. package/dist/renderer.d.ts +1 -1
  177. package/dist/renderer.mjs +3 -2
  178. package/dist/{request.d-BwgX-7Wi.d.mts → request.d-CBEdJD5R.d.mts} +1 -1
  179. package/dist/{request.d-BaFROByP.d.ts → request.d-CrriEvxy.d.ts} +1 -1
  180. package/dist/request.d.mts +5 -5
  181. package/dist/request.d.ts +5 -5
  182. package/dist/{route-rendering.d-D4kUuncg.d.ts → route-rendering.d-C-ivf31T.d.ts} +1 -1
  183. package/dist/{route-rendering.d-BzeFPYGc.d.mts → route-rendering.d-DgXpNk_c.d.mts} +1 -1
  184. package/dist/{router.d-B9qJdgjt.d.ts → router.d-BRRPd5dE.d.ts} +1 -1
  185. package/dist/{router.d-D-p8WElf.d.mts → router.d-O5LrW9mZ.d.mts} +1 -1
  186. package/dist/{routes.d-D7RWvfqL.d.ts → routes.d-CYe98R_8.d.ts} +1 -1
  187. package/dist/{routes.d-BWvpUoYu.d.mts → routes.d-DBGnKaUQ.d.mts} +1 -1
  188. package/dist/routes.d.mts +4 -4
  189. package/dist/routes.d.ts +4 -4
  190. package/dist/{rsc-pipeline-YHVEHWTU.cjs → rsc-pipeline-2DNM7UDA.cjs} +8 -7
  191. package/dist/{rsc-pipeline-Y6D6KBES.mjs → rsc-pipeline-HYINQPMW.mjs} +7 -6
  192. package/dist/{runtime-62ZIEV6U.mjs → runtime-JP7L5KI7.mjs} +11 -8
  193. package/dist/{runtime-LKEMFXHW.cjs → runtime-M6GLD4CR.cjs} +15 -12
  194. package/dist/{runtime.d-BUtDIrRJ.d.mts → runtime.d-DP8Sk9PM.d.mts} +1 -1
  195. package/dist/{runtime.d-Du64AX3R.d.ts → runtime.d-DW_1avVi.d.ts} +1 -1
  196. package/dist/{cli-runtime.d-Bvfxt4uo.d.ts → schema-dependencies.d-C__RyTvW.d.ts} +21 -13
  197. package/dist/{cli-runtime.d-BGaFPum1.d.mts → schema-dependencies.d-Cedd7QUf.d.mts} +21 -13
  198. package/dist/{schema.d-BM-uVGpx.d.mts → schema.d-HlGSe1on.d.mts} +1 -1
  199. package/dist/{schema.d-BM-uVGpx.d.ts → schema.d-HlGSe1on.d.ts} +1 -1
  200. package/dist/schema.d.mts +1 -1
  201. package/dist/schema.d.ts +1 -1
  202. package/dist/{server-components-status.d-CvFhb6-t.d.ts → server-components-status.d-CdsEQbeM.d.ts} +3 -3
  203. package/dist/{server-components-status.d-B0YP-m9A.d.mts → server-components-status.d-DN98yOT4.d.mts} +3 -3
  204. package/dist/server-plugins.d.mts +6 -6
  205. package/dist/server-plugins.d.ts +6 -6
  206. package/dist/server.cjs +56 -53
  207. package/dist/server.d.mts +15 -15
  208. package/dist/server.d.ts +15 -15
  209. package/dist/server.mjs +23 -20
  210. package/dist/{spa-router.d-D4ye2WFk.d.ts → spa-router.d-BJWZAdrV.d.ts} +2 -2
  211. package/dist/{spa-router.d-CkR14oGH.d.mts → spa-router.d-FcDbBCrK.d.mts} +2 -2
  212. package/dist/{ssg.d-DFs97VTY.d.mts → ssg.d--uut8Gya.d.mts} +3 -3
  213. package/dist/{ssg.d-BCJB_f7B.d.ts → ssg.d-Cf9mC1rZ.d.ts} +3 -3
  214. package/dist/storage.d.mts +2 -2
  215. package/dist/storage.d.ts +2 -2
  216. package/dist/{store-core.d-Vk5UDKeC.d.mts → store-core.d-DgYlAo-e.d.mts} +2 -2
  217. package/dist/{store-core.d-0W2YScl8.d.ts → store-core.d-h7o6V2kH.d.ts} +2 -2
  218. package/dist/testing.cjs +2 -2
  219. package/dist/testing.d.mts +4 -4
  220. package/dist/testing.d.ts +4 -4
  221. package/dist/testing.mjs +2 -2
  222. package/dist/{types.d-C5hlNbHa.d.mts → types.d-CRiwa0jj.d.mts} +1 -1
  223. package/dist/{types.d-C5hlNbHa.d.ts → types.d-CRiwa0jj.d.ts} +1 -1
  224. package/dist/{utils.d-Ba3N28fk.d.ts → utils.d-2lGEnyBc.d.ts} +1 -1
  225. package/dist/{utils.d-Cloiko8d.d.mts → utils.d-DjFApBfE.d.mts} +1 -1
  226. package/dist/version.cjs +2 -2
  227. package/dist/version.mjs +1 -1
  228. package/dist/vite.cjs +18 -17
  229. package/dist/vite.d.mts +9 -9
  230. package/dist/vite.d.ts +9 -9
  231. package/dist/vite.mjs +17 -16
  232. package/package.json +1 -1
  233. package/dist/analyzer-3AMJK27J.cjs +0 -17
  234. package/dist/chunk-GTHBWZUK.mjs +0 -17
  235. package/dist/layers-GP57TBE2.cjs +0 -21
@@ -1,5 +1,5 @@
1
- import { e as RouteModule, d as FarmMdxResolvedConfig, c as FarmMdxComponents } from './client-plugins.d-CQ6AGHP0.js';
2
- export { g as FARM_MARKDOWN_CONTENT_TYPE, j as FarmMdxComponent, k as FarmMdxUserConfig, h as createFarmMarkdownErrorBody, i as farmRequestWantsMarkdown, r as resolveFarmMdxComponentsModulePath, l as resolveMdxConfig } from './client-plugins.d-CQ6AGHP0.js';
1
+ import { p as RouteModule, o as FarmMdxResolvedConfig, k as FarmMdxComponents } from './client-plugins.d-BHqfH3DQ.js';
2
+ export { s as FARM_MARKDOWN_CONTENT_TYPE, v as FarmMdxComponent, w as FarmMdxUserConfig, t as createFarmMarkdownErrorBody, u as farmRequestWantsMarkdown, x as resolveFarmMdxComponentsModulePath, y as resolveMdxConfig } from './client-plugins.d-BHqfH3DQ.js';
3
3
  import { FarmMarkdownPageModuleInput } from './internal/app-markdown-runtime.js';
4
4
  export { FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS, FARM_MARKDOWN_PRECOMPILED_PAGES, FarmMarkdownPageRenderer, FarmMarkdownPageSource, compileFarmMarkdownPage, createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, createMarkdownMetadata, isFarmMarkdownPageFile, isFarmMarkdownPublicSourceResponse, normalizeFarmMarkdownRoutePath, parseMarkdownFrontmatter, readFarmMarkdownRouteConfig, titleFromMarkdown, withoutFarmMarkdownRouteConfig } from './internal/app-markdown-runtime.js';
5
5
  import './lifecycle.d-OtGWAvJT.js';
@@ -15,13 +15,13 @@ import './types.d-euATAbE4.js';
15
15
  import './server-fn.js';
16
16
  import './server-fn-error.d-DrcH9cc1.js';
17
17
  import './server-query.js';
18
- import './types.d-C5hlNbHa.js';
18
+ import './types.d-CRiwa0jj.js';
19
19
  import '@farming-labs/orm';
20
20
  import '@libsql/core/api';
21
21
  import '@farming-labs/orm-sql';
22
22
  import 'db0';
23
23
  import 'unstorage';
24
- import './schema.d-BM-uVGpx.js';
24
+ import './schema.d-HlGSe1on.js';
25
25
  import 'react';
26
26
  import '@farming-labs/docs';
27
27
  import './observability.d-mXSbp4jc.js';
@@ -34,7 +34,7 @@ import './cron.js';
34
34
  import './env.js';
35
35
  import './navigation-errors.d-DwHtoMyR.js';
36
36
  import './server-action-security.js';
37
- import './layers.d-CH0bC4QL.js';
37
+ import './layers.d-dNBkiNE9.js';
38
38
  import 'rolldown/utils';
39
39
  import 'rolldown';
40
40
  import './image-config.d-ByhQ0TT7.js';
@@ -1,14 +1,14 @@
1
- import { aK as FarmConfig, P as ParsedRoute, bn as ResolvedFarmRouteRuntimeConfig, bo as ApplicationMetadataRouteKind, e as RouteModule, aZ as LayoutModule, S as SSGCollectionResult, E as FarmRequest, G as FarmResponse, bp as ResolvedFarmAPIConfig, aH as FarmDocsResolvedConfig, bm as FarmMarkdownResolvedConfig, d as FarmMdxResolvedConfig, ax as ResolvedFarmDevtoolsConfig, bq as ResolvedFarmDevIndicatorsConfig, br as ResolvedFarmAuthConfig, bs as ResolvedFarmPerformanceConfig, bt as ResolvedFarmSecurityConfig } from './client-plugins.d-CVUMc2ai.mjs';
1
+ import { aT as FarmConfig, P as ParsedRoute, bw as ResolvedFarmRouteRuntimeConfig, bx as ApplicationMetadataRouteKind, p as RouteModule, b6 as LayoutModule, S as SSGCollectionResult, X as FarmRequest, Y as FarmResponse, by as ResolvedFarmAPIConfig, aQ as FarmDocsResolvedConfig, bv as FarmMarkdownResolvedConfig, o as FarmMdxResolvedConfig, aG as ResolvedFarmDevtoolsConfig, bz as ResolvedFarmDevIndicatorsConfig, bA as ResolvedFarmAuthConfig, bB as ResolvedFarmPerformanceConfig, bC as ResolvedFarmSecurityConfig } from './client-plugins.d-9jr2yWR3.mjs';
2
2
  import { FarmWorkflowsResolvedConfig } from './workflows.mjs';
3
3
  import { FarmCronResolvedConfig } from './cron.mjs';
4
4
  import { R as ResolvedFarmImageConfig } from './image-config.d-ByhQ0TT7.mjs';
5
- import { F as FarmSearchPreserveRoute, M as MetadataImageKind, c as createFarmDefaultMCPServer } from './agent-mcp.d-BdFnjlAT.mjs';
5
+ import { F as FarmSearchPreserveRoute, M as MetadataImageKind, c as createFarmDefaultMCPServer } from './agent-mcp.d-DpthRhqr.mjs';
6
6
  import { ProgrammaticRedirectRoute, ProgrammaticRouteSearchClientOptions } from './routes.mjs';
7
- import { I as IsolatedClientBoundaryReference, F as FarmSourceSnapshotStore, C as ClientModuleHydrationPlan, P as ProgrammaticClientRoutes } from './client-component.d-BA6kXI5L.mjs';
7
+ import { I as IsolatedClientBoundaryReference, F as FarmSourceSnapshotStore, C as ClientModuleHydrationPlan, P as ProgrammaticClientRoutes } from './client-component.d-D5JVDeQf.mjs';
8
8
  import { ViteDevServer } from 'vite';
9
9
  import { F as FarmIslandStrategy } from './island.d-CfGru1MO.mjs';
10
10
  import { FarmRenderer, FarmRendererServerModule } from './renderer.mjs';
11
- import { F as FarmRouteRenderPlan } from './render-plan.d-BW56oxMP.mjs';
11
+ import { F as FarmRouteRenderPlan } from './render-plan.d-C6nUIU2m.mjs';
12
12
  import { R as ResolvedFarmI18nConfig } from './types.d-euATAbE4.mjs';
13
13
  import { a as FarmRedirectStatus } from './navigation-errors.d-DwHtoMyR.mjs';
14
14
  import { F as FarmI18nRuntime } from './runtime.d-CTAXWZby.mjs';
@@ -1,14 +1,14 @@
1
- import { aK as FarmConfig, P as ParsedRoute, bn as ResolvedFarmRouteRuntimeConfig, bo as ApplicationMetadataRouteKind, e as RouteModule, aZ as LayoutModule, S as SSGCollectionResult, E as FarmRequest, G as FarmResponse, bp as ResolvedFarmAPIConfig, aH as FarmDocsResolvedConfig, bm as FarmMarkdownResolvedConfig, d as FarmMdxResolvedConfig, ax as ResolvedFarmDevtoolsConfig, bq as ResolvedFarmDevIndicatorsConfig, br as ResolvedFarmAuthConfig, bs as ResolvedFarmPerformanceConfig, bt as ResolvedFarmSecurityConfig } from './client-plugins.d-CQ6AGHP0.js';
1
+ import { aT as FarmConfig, P as ParsedRoute, bw as ResolvedFarmRouteRuntimeConfig, bx as ApplicationMetadataRouteKind, p as RouteModule, b6 as LayoutModule, S as SSGCollectionResult, X as FarmRequest, Y as FarmResponse, by as ResolvedFarmAPIConfig, aQ as FarmDocsResolvedConfig, bv as FarmMarkdownResolvedConfig, o as FarmMdxResolvedConfig, aG as ResolvedFarmDevtoolsConfig, bz as ResolvedFarmDevIndicatorsConfig, bA as ResolvedFarmAuthConfig, bB as ResolvedFarmPerformanceConfig, bC as ResolvedFarmSecurityConfig } from './client-plugins.d-BHqfH3DQ.js';
2
2
  import { FarmWorkflowsResolvedConfig } from './workflows.js';
3
3
  import { FarmCronResolvedConfig } from './cron.js';
4
4
  import { R as ResolvedFarmImageConfig } from './image-config.d-ByhQ0TT7.js';
5
- import { F as FarmSearchPreserveRoute, M as MetadataImageKind, c as createFarmDefaultMCPServer } from './agent-mcp.d-CAwDC9y4.js';
5
+ import { F as FarmSearchPreserveRoute, M as MetadataImageKind, c as createFarmDefaultMCPServer } from './agent-mcp.d--uQgDp_Q.js';
6
6
  import { ProgrammaticRedirectRoute, ProgrammaticRouteSearchClientOptions } from './routes.js';
7
- import { I as IsolatedClientBoundaryReference, F as FarmSourceSnapshotStore, C as ClientModuleHydrationPlan, P as ProgrammaticClientRoutes } from './client-component.d-LSEmRhuI.js';
7
+ import { I as IsolatedClientBoundaryReference, F as FarmSourceSnapshotStore, C as ClientModuleHydrationPlan, P as ProgrammaticClientRoutes } from './client-component.d-DDbDw2yP.js';
8
8
  import { ViteDevServer } from 'vite';
9
9
  import { F as FarmIslandStrategy } from './island.d-CfGru1MO.js';
10
10
  import { FarmRenderer, FarmRendererServerModule } from './renderer.js';
11
- import { F as FarmRouteRenderPlan } from './render-plan.d-Cz7bQmcf.js';
11
+ import { F as FarmRouteRenderPlan } from './render-plan.d-h8bkOQyh.js';
12
12
  import { R as ResolvedFarmI18nConfig } from './types.d-euATAbE4.js';
13
13
  import { a as FarmRedirectStatus } from './navigation-errors.d-DwHtoMyR.js';
14
14
  import { F as FarmI18nRuntime } from './runtime.d-PUA5qBnd.js';
@@ -2,9 +2,12 @@ import {
2
2
  getFarmRendererCapabilities,
3
3
  isFarmRendererDisabled,
4
4
  isReactRenderer,
5
- resolveFarmRenderer,
5
+ resolveFarmRenderer
6
+ } from "./chunk-HHZURH4U.mjs";
7
+ import {
8
+ readFarmServerComponentsConfig,
6
9
  resolveFarmServerComponentsMode
7
- } from "./chunk-HV6CYSMF.mjs";
10
+ } from "./chunk-PTG5BEMG.mjs";
8
11
  import {
9
12
  isFarmIslandStrategy
10
13
  } from "./chunk-S32PDOLO.mjs";
@@ -89,7 +92,7 @@ function resolveFarmIsland(props, reference) {
89
92
  }
90
93
  }
91
94
  function resolveFarmRendererServerComponentsIslands(config) {
92
- if (resolveFarmServerComponentsMode(config.experimental?.serverComponents) !== "islands") {
95
+ if (resolveFarmServerComponentsMode(readFarmServerComponentsConfig(config)) !== "islands") {
93
96
  return false;
94
97
  }
95
98
  if (config.renderer === void 0 || isFarmRendererDisabled(config.renderer)) return false;
@@ -97,14 +100,14 @@ function resolveFarmRendererServerComponentsIslands(config) {
97
100
  if (isReactRenderer(renderer)) return false;
98
101
  if (!getFarmRendererCapabilities(renderer).islands) {
99
102
  throw new Error(
100
- `[Farm.js] \`experimental.serverComponents: { mode: "islands" }\` needs a renderer that supports islands, and \`${renderer.name}\` doesn't declare \`capabilities.islands\`. Remove \`experimental.serverComponents\` to hydrate each route whole, or add islands to the renderer: https://farmjs.dev/docs/renderers/custom#islands`
103
+ `[Farm.js] \`serverComponents: { mode: "islands" }\` needs a renderer that supports islands, and \`${renderer.name}\` doesn't declare \`capabilities.islands\`. Remove \`serverComponents\` to hydrate each route whole, or add islands to the renderer: https://farmjs.dev/docs/renderers/custom#islands`
101
104
  );
102
105
  }
103
106
  return true;
104
107
  }
105
108
  function usesFarmRendererIslands(config) {
106
109
  const renderer = resolveFarmRenderer(config.renderer);
107
- return !isReactRenderer(renderer) && getFarmRendererCapabilities(renderer).islands && config.experimental?.isolatedClientHydration === "enabled" && resolveFarmServerComponentsMode(config.experimental?.serverComponents) === void 0;
110
+ return !isReactRenderer(renderer) && getFarmRendererCapabilities(renderer).islands && config.experimental?.isolatedClientHydration === "enabled" && resolveFarmServerComponentsMode(readFarmServerComponentsConfig(config)) === void 0;
108
111
  }
109
112
 
110
113
  export {
@@ -1,3 +1,6 @@
1
+ import {
2
+ normalizeFarmServerComponentsConfig
3
+ } from "./chunk-PTG5BEMG.mjs";
1
4
  import {
2
5
  bundleNodeModule,
3
6
  isDeclarationFile,
@@ -6,6 +9,9 @@ import {
6
9
  import {
7
10
  hasManagedMountSchema
8
11
  } from "./chunk-DS2KZ5BT.mjs";
12
+ import {
13
+ logger
14
+ } from "./chunk-U6GMCDRS.mjs";
9
15
 
10
16
  // src/layers.ts
11
17
  import { existsSync, readFileSync, realpathSync, statSync } from "fs";
@@ -104,7 +110,11 @@ async function resolveFarmLayers(projectConfig, options) {
104
110
  }
105
111
  let mergedConfig = {};
106
112
  for (const layer of loadedLayers) {
107
- mergedConfig = mergeFarmLayerConfig(mergedConfig, getLayerDefaults(layer.config));
113
+ const config = normalizeFarmServerComponentsConfig(
114
+ layer.config,
115
+ (message) => logger.warn(message)
116
+ );
117
+ mergedConfig = mergeFarmLayerConfig(mergedConfig, getLayerDefaults(config));
108
118
  }
109
119
  mergedConfig = mergeFarmLayerConfig(mergedConfig, projectConfig);
110
120
  const layers = loadedLayers.map(({ config: _config, ...layer }) => layer);
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.2.0-beta.4";
2
+ var version = "0.2.1";
3
3
 
4
4
  // src/version.ts
5
5
  var FARM_VERSION = version;
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  hasPolyroutePlugin,
9
9
  isFarmAPIRouteFileName
10
- } from "./chunk-GTHBWZUK.mjs";
10
+ } from "./chunk-O77EKGAS.mjs";
11
11
  import {
12
12
  _runWithFarmI18nRequest
13
13
  } from "./chunk-O7JEFGUV.mjs";
@@ -3,7 +3,9 @@
3
3
  var _chunkB6JPBPBQcjs = require('./chunk-B6JPBPBQ.cjs');
4
4
 
5
5
 
6
- var _chunkXJEOHDPNcjs = require('./chunk-XJEOHDPN.cjs');
6
+
7
+
8
+ var _chunkYCGOQKVCcjs = require('./chunk-YCGOQKVC.cjs');
7
9
 
8
10
 
9
11
  var _chunkSGBEJBBBcjs = require('./chunk-SGBEJBBB.cjs');
@@ -19,16 +21,45 @@ var _module = require('module');
19
21
  var _path = require('path');
20
22
  var _esmodulelexer = require('es-module-lexer');
21
23
  var moduleLexerInitialized = false;
24
+ var HTTP_METHODS = ["GET", "HEAD", "QUERY", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"];
22
25
  var JSX_ROUTE_LANGS = { ".jsx": "jsx", ".tsx": "tsx" };
23
- var oxcTransformSync;
24
- function transformJSXRoute(content, lang, filePath) {
25
- _nullishCoalesce(oxcTransformSync, () => ( (oxcTransformSync = _module.createRequire.call(void 0, typeof __filename === "string" ? __filename : _chunkUGL4BDNBcjs.define_import_meta_default.url)(
26
+ var oxcUtils;
27
+ function loadOxcUtils() {
28
+ return _nullishCoalesce(oxcUtils, () => ( (oxcUtils = _module.createRequire.call(void 0, typeof __filename === "string" ? __filename : _chunkUGL4BDNBcjs.define_import_meta_default.url)(
26
29
  "rolldown/utils"
27
- ).transformSync)));
28
- const result = oxcTransformSync(filePath, content, { lang, sourceType: "module" });
30
+ ))));
31
+ }
32
+ function transformJSXRoute(content, lang, filePath) {
33
+ const result = loadOxcUtils().transformSync(filePath, content, { lang, sourceType: "module" });
29
34
  if (result.errors.length > 0) throw result.errors[0];
30
35
  return result.code;
31
36
  }
37
+ function extractDeclaredMethods(content, filePath) {
38
+ const { program, errors } = loadOxcUtils().parseSync(filePath, content, { lang: "dts" });
39
+ if (errors.length > 0) throw new Error(`${filePath}: ${errors[0].message}`);
40
+ const names = /* @__PURE__ */ new Set();
41
+ for (const statement of program.body) {
42
+ if (statement.type !== "ExportNamedDeclaration") continue;
43
+ const declaration = statement.declaration;
44
+ if (_optionalChain([declaration, 'optionalAccess', _ => _.type]) === "VariableDeclaration") {
45
+ for (const declarator of declaration.declarations) {
46
+ if (declarator.id.type === "Identifier") names.add(declarator.id.name);
47
+ }
48
+ } else if ((_optionalChain([declaration, 'optionalAccess', _2 => _2.type]) === "FunctionDeclaration" || _optionalChain([declaration, 'optionalAccess', _3 => _3.type]) === "TSDeclareFunction") && declaration.id) {
49
+ names.add(declaration.id.name);
50
+ } else if (!declaration && statement.exportKind !== "type") {
51
+ for (const specifier of statement.specifiers) {
52
+ if (specifier.exportKind === "type") continue;
53
+ const exported = specifier.exported;
54
+ names.add(exported.type === "Literal" ? String(exported.value) : exported.name);
55
+ }
56
+ }
57
+ }
58
+ return HTTP_METHODS.filter((method) => names.has(method));
59
+ }
60
+ function isFile(filePath) {
61
+ return _optionalChain([_fs.statSync.call(void 0, filePath, { throwIfNoEntry: false }), 'optionalAccess', _4 => _4.isFile, 'call', _5 => _5()]) === true;
62
+ }
32
63
  var API_CLIENT_METHOD_SEGMENTS = /* @__PURE__ */ new Set([
33
64
  "get",
34
65
  "head",
@@ -40,8 +71,9 @@ var API_CLIENT_METHOD_SEGMENTS = /* @__PURE__ */ new Set([
40
71
  "options"
41
72
  ]);
42
73
  var APITypeGenerator = class {
43
- constructor(appDir) {
74
+ constructor(appDir, options = {}) {
44
75
  this.appDirs = Array.isArray(appDir) ? [...appDir] : [appDir];
76
+ this.polyroute = options.polyroute === true;
45
77
  }
46
78
  /**
47
79
  * Scan all API route files and extract route information
@@ -89,7 +121,7 @@ var APITypeGenerator = class {
89
121
  if (item.isDirectory()) {
90
122
  const newBasePath = basePath ? `${basePath}/${item.name}` : item.name;
91
123
  this.scanDirectory(fullPath, appDir, routes, newBasePath);
92
- } else if (_chunkXJEOHDPNcjs.isFarmAPIRouteFileName.call(void 0, item.name)) {
124
+ } else if (_chunkYCGOQKVCcjs.isFarmAPIRouteFileName.call(void 0, item.name, this.polyroute)) {
93
125
  const routeInfo = this.extractRouteInfo(fullPath, appDir, basePath);
94
126
  if (routeInfo) {
95
127
  routes.push(routeInfo);
@@ -98,14 +130,44 @@ var APITypeGenerator = class {
98
130
  }
99
131
  }
100
132
  extractRouteInfo(filePath, appDir, basePath) {
133
+ const relativePath = _path.relative.call(void 0, appDir, filePath);
134
+ const apiPath = basePath ? `/api/${basePath}` : "/api";
135
+ const fileName = _path.basename.call(void 0, filePath);
136
+ if (_chunkYCGOQKVCcjs.isPolyrouteRouteFileName.call(void 0, fileName)) {
137
+ const declarationPath = _path.join.call(void 0,
138
+ _path.dirname.call(void 0, filePath),
139
+ _chunkYCGOQKVCcjs.getPolyrouteRouteDeclarationFileName.call(void 0, fileName)
140
+ );
141
+ if (!isFile(declarationPath)) {
142
+ return { path: apiPath, methods: [...HTTP_METHODS], filePath, relativePath };
143
+ }
144
+ try {
145
+ const methods = extractDeclaredMethods(
146
+ _fs.readFileSync.call(void 0, declarationPath, "utf-8"),
147
+ declarationPath
148
+ );
149
+ if (methods.length === 0) return null;
150
+ return {
151
+ path: apiPath,
152
+ methods,
153
+ filePath,
154
+ relativePath,
155
+ declaration: {
156
+ filePath: declarationPath,
157
+ relativePath: _path.relative.call(void 0, appDir, declarationPath)
158
+ }
159
+ };
160
+ } catch (error) {
161
+ console.warn(`Failed to read route declaration ${declarationPath}:`, error);
162
+ return null;
163
+ }
164
+ }
101
165
  try {
102
166
  const content = _fs.readFileSync.call(void 0, filePath, "utf-8");
103
167
  const methods = this.extractExportedMethods(content, filePath);
104
168
  if (methods.length === 0) {
105
169
  return null;
106
170
  }
107
- const relativePath = _path.relative.call(void 0, appDir, filePath);
108
- const apiPath = basePath ? `/api/${basePath}` : "/api";
109
171
  return {
110
172
  path: apiPath,
111
173
  methods,
@@ -122,7 +184,7 @@ var APITypeGenerator = class {
122
184
  _esmodulelexer.initSync.call(void 0, );
123
185
  moduleLexerInitialized = true;
124
186
  }
125
- const httpMethods = ["GET", "HEAD", "QUERY", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"];
187
+ const httpMethods = HTTP_METHODS;
126
188
  const lang = JSX_ROUTE_LANGS[_path.extname.call(void 0, filePath)];
127
189
  const source = lang ? transformJSXRoute(content, lang, filePath) : content;
128
190
  const [, exports] = _esmodulelexer.parse.call(void 0, source);
@@ -159,9 +221,10 @@ var APITypeGenerator = class {
159
221
  */
160
222
  generateAPIRouter(routes, options = {}) {
161
223
  const imports = [];
224
+ const coreAPITypes = [];
162
225
  const pluginTypes = [];
163
- if (_optionalChain([options, 'access', _ => _.pluginConfigs, 'optionalAccess', _2 => _2.length])) {
164
- imports.push('import type { PluginAPIRouter } from "@farm.js/core/api";');
226
+ if (_optionalChain([options, 'access', _6 => _6.pluginConfigs, 'optionalAccess', _7 => _7.length])) {
227
+ coreAPITypes.push("PluginAPIRouter");
165
228
  options.pluginConfigs.forEach((filePath, index) => {
166
229
  const importPath = this.getRouteImportPath({ filePath }, options.outFile);
167
230
  imports.push(`import type FarmPluginConfig${index} from ${JSON.stringify(importPath)};`);
@@ -202,25 +265,31 @@ var APITypeGenerator = class {
202
265
  for (const method of route.methods) methodSources.set(method, route);
203
266
  }
204
267
  const allMethods = [...methodSources.keys()];
268
+ const methodTypes = /* @__PURE__ */ new Map();
205
269
  for (const method of allMethods) {
206
- const importPath = this.getRouteImportPath(methodSources.get(method), options.outFile);
270
+ const source = methodSources.get(method);
271
+ if (!source.declaration && _chunkYCGOQKVCcjs.isPolyrouteRouteFileName.call(void 0, _path.basename.call(void 0, source.filePath))) {
272
+ if (!coreAPITypes.includes("TypedEndpoint")) coreAPITypes.push("TypedEndpoint");
273
+ methodTypes.set(method, "TypedEndpoint<any, any>");
274
+ continue;
275
+ }
276
+ const importPath = this.getRouteImportPath(_nullishCoalesce(source.declaration, () => ( source)), options.outFile);
207
277
  const importName = `${method}_${routeName}`;
208
278
  imports.push(
209
279
  `import type { ${method} as ${importName} } from ${JSON.stringify(importPath)};`
210
280
  );
281
+ methodTypes.set(method, `typeof ${importName}`);
211
282
  }
212
283
  if (parts.length === 0) {
213
284
  for (const method of allMethods) {
214
- const importName = `${method}_${routeName}`;
215
- const methodName = method.toLowerCase();
216
- nestedStructure[methodName] = `typeof ${importName}`;
285
+ nestedStructure[method.toLowerCase()] = methodTypes.get(method);
217
286
  }
218
287
  } else {
219
288
  const hasMethodCollision = parts.some((part, index) => {
220
289
  if (part === "$params" || index === 0 && part === "integrations") return true;
221
290
  if (!API_CLIENT_METHOD_SEGMENTS.has(part)) return false;
222
291
  const parentPath = parts.slice(0, index).join("/");
223
- return _optionalChain([routeMethodsByPath, 'access', _3 => _3.get, 'call', _4 => _4(parentPath), 'optionalAccess', _5 => _5.has, 'call', _6 => _6(part)]) === true;
292
+ return _optionalChain([routeMethodsByPath, 'access', _8 => _8.get, 'call', _9 => _9(parentPath), 'optionalAccess', _10 => _10.has, 'call', _11 => _11(part)]) === true;
224
293
  });
225
294
  const typePath = hasMethodCollision ? [`/${cleanPath}`] : parts;
226
295
  let current = nestedStructure;
@@ -229,9 +298,7 @@ var APITypeGenerator = class {
229
298
  if (i === typePath.length - 1) {
230
299
  current[part] = createRouteTreeNode();
231
300
  for (const method of allMethods) {
232
- const importName = `${method}_${routeName}`;
233
- const methodName = method.toLowerCase();
234
- current[part][methodName] = `typeof ${importName}`;
301
+ current[part][method.toLowerCase()] = methodTypes.get(method);
235
302
  }
236
303
  } else {
237
304
  if (!Object.prototype.hasOwnProperty.call(current, part)) {
@@ -268,6 +335,9 @@ ${routeManifest.map(
268
335
  },`
269
336
  ).join("\n")}
270
337
  ]` : "[]";
338
+ if (coreAPITypes.length) {
339
+ imports.unshift(`import type { ${coreAPITypes.join(", ")} } from "@farm.js/core/api";`);
340
+ }
271
341
  return `/**
272
342
  * Auto-generated API router types
273
343
  * This file is automatically generated - do not edit manually
@@ -0,0 +1,52 @@
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
+
3
+ var _chunkUGL4BDNBcjs = require('./chunk-UGL4BDNB.cjs');
4
+
5
+ // src/server-components-mode.ts
6
+ _chunkUGL4BDNBcjs.init_define_import_meta.call(void 0, );
7
+ var CONFLICTING_SPELLINGS = "`serverComponents` and the deprecated `experimental.serverComponents` ask for different engines. Remove `experimental.serverComponents` and keep `serverComponents`.";
8
+ function readFarmServerComponentsConfig(config) {
9
+ const source = config;
10
+ const value = _optionalChain([source, 'optionalAccess', _ => _.serverComponents]);
11
+ const legacy = _optionalChain([source, 'optionalAccess', _2 => _2.experimental, 'optionalAccess', _3 => _3.serverComponents]);
12
+ if (value === void 0) return legacy;
13
+ if (legacy !== void 0 && resolveFarmServerComponentsMode(value) !== resolveFarmServerComponentsMode(legacy)) {
14
+ throw new TypeError(CONFLICTING_SPELLINGS);
15
+ }
16
+ return value;
17
+ }
18
+ var warnedDeprecatedSpelling = false;
19
+ function normalizeFarmServerComponentsConfig(config, warn) {
20
+ const source = config;
21
+ const legacy = _optionalChain([source, 'access', _4 => _4.experimental, 'optionalAccess', _5 => _5.serverComponents]);
22
+ if (legacy === void 0) return config;
23
+ resolveFarmServerComponentsMode(legacy);
24
+ const value = readFarmServerComponentsConfig(config);
25
+ if (source.serverComponents === void 0 && warn && !warnedDeprecatedSpelling) {
26
+ warnedDeprecatedSpelling = true;
27
+ warn(
28
+ "`experimental.serverComponents` is deprecated. Move the same value to the top-level `serverComponents` in farm.config."
29
+ );
30
+ }
31
+ const { serverComponents: _moved, ...experimental } = _nullishCoalesce(source.experimental, () => ( {}));
32
+ return { ...config, serverComponents: value, experimental };
33
+ }
34
+ function resolveFarmServerComponentsMode(value) {
35
+ if (value === void 0 || value === null || value === false) return void 0;
36
+ if (value === true) return "islands";
37
+ const mode = typeof value === "object" ? value.mode : void 0;
38
+ if (mode === "rsc" || mode === "islands") return mode;
39
+ throw new TypeError(
40
+ '`serverComponents` must be true, false, { mode: "rsc" } or { mode: "islands" }.'
41
+ );
42
+ }
43
+ function isExplicitFarmServerComponentsMode(value) {
44
+ return typeof value === "object" && value !== null;
45
+ }
46
+
47
+
48
+
49
+
50
+
51
+
52
+ exports.readFarmServerComponentsConfig = readFarmServerComponentsConfig; exports.normalizeFarmServerComponentsConfig = normalizeFarmServerComponentsConfig; exports.resolveFarmServerComponentsMode = resolveFarmServerComponentsMode; exports.isExplicitFarmServerComponentsMode = isExplicitFarmServerComponentsMode;
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createRouteTypeDeclarations,
3
3
  generateRouteTypes
4
- } from "./chunk-EBVKVDQA.mjs";
4
+ } from "./chunk-PZ5ZJAAO.mjs";
5
5
  import {
6
6
  APITypeGenerator
7
- } from "./chunk-ANKMAGFJ.mjs";
7
+ } from "./chunk-WRT775N6.mjs";
8
8
  import {
9
9
  getOptionalCatchAllParameterNames,
10
10
  materializeSSGRoutePath,
@@ -26,7 +26,7 @@ import {
26
26
  findFarmConfigFile,
27
27
  getFarmAppDirectories,
28
28
  getFarmSourceRoots
29
- } from "./chunk-Z3RM3VA2.mjs";
29
+ } from "./chunk-5VXVRMXK.mjs";
30
30
  import {
31
31
  isFarmMarkdownPageFile
32
32
  } from "./chunk-TP3ISVRU.mjs";
@@ -841,7 +841,7 @@ async function generateFarmTypeArtifacts(options) {
841
841
  }
842
842
  }
843
843
  if (shouldGenerateApi) {
844
- const generator = new APITypeGenerator(appDirs);
844
+ const generator = new APITypeGenerator(appDirs, { polyroute: options.polyroute });
845
845
  const apiRoutes = generator.scanAPIRoutes();
846
846
  const apiTypesPath = options.apiTypesOutFile ? resolve3(root, options.apiTypesOutFile) : join3(root, srcDir, "lib", "api.generated.ts");
847
847
  const pluginRoutes = resolvePluginRoutes(
@@ -7,14 +7,17 @@ var _chunkJ3RIMCBDcjs = require('./chunk-J3RIMCBD.cjs');
7
7
  var _chunkBNWADCG2cjs = require('./chunk-BNWADCG2.cjs');
8
8
 
9
9
 
10
- var _chunkKBURN62Zcjs = require('./chunk-KBURN62Z.cjs');
10
+ var _chunkPFVNPOKNcjs = require('./chunk-PFVNPOKN.cjs');
11
11
 
12
12
 
13
13
 
14
14
 
15
15
 
16
+ var _chunkLEZJZX4Ccjs = require('./chunk-LEZJZX4C.cjs');
16
17
 
17
- var _chunkHP7QYVSTcjs = require('./chunk-HP7QYVST.cjs');
18
+
19
+
20
+ var _chunkCYUTK4JPcjs = require('./chunk-CYUTK4JP.cjs');
18
21
 
19
22
 
20
23
  var _chunk32HGOX3Mcjs = require('./chunk-32HGOX3M.cjs');
@@ -28,7 +31,7 @@ var _chunkPYPHM7AScjs = require('./chunk-PYPHM7AS.cjs');
28
31
  var _chunk7ZDLE77Pcjs = require('./chunk-7ZDLE77P.cjs');
29
32
 
30
33
 
31
- var _chunkXPVS4HKUcjs = require('./chunk-XPVS4HKU.cjs');
34
+ var _chunkJZAGIXMBcjs = require('./chunk-JZAGIXMB.cjs');
32
35
 
33
36
 
34
37
  var _chunkUGL4BDNBcjs = require('./chunk-UGL4BDNB.cjs');
@@ -977,7 +980,7 @@ function usePackageScanCacheFile(file) {
977
980
  const stored = /* @__PURE__ */ new Map();
978
981
  try {
979
982
  const value = JSON.parse(_fs2.default.readFileSync(file, "utf8"));
980
- if (_optionalChain([value, 'optionalAccess', _68 => _68.schema]) === PACKAGE_SCAN_CACHE_SCHEMA && value.farm === _chunkXPVS4HKUcjs.FARM_VERSION && value.scans && typeof value.scans === "object") {
983
+ if (_optionalChain([value, 'optionalAccess', _68 => _68.schema]) === PACKAGE_SCAN_CACHE_SCHEMA && value.farm === _chunkJZAGIXMBcjs.FARM_VERSION && value.scans && typeof value.scans === "object") {
981
984
  for (const [directory, scan] of Object.entries(value.scans)) {
982
985
  if (isStoredPackageScan(scan)) stored.set(directory, scan);
983
986
  }
@@ -1006,7 +1009,7 @@ function persistPackageScanCache() {
1006
1009
  _fs2.default.mkdirSync(_path2.default.dirname(cache2.file), { recursive: true });
1007
1010
  _fs2.default.writeFileSync(
1008
1011
  temporary,
1009
- JSON.stringify({ schema: PACKAGE_SCAN_CACHE_SCHEMA, farm: _chunkXPVS4HKUcjs.FARM_VERSION, scans })
1012
+ JSON.stringify({ schema: PACKAGE_SCAN_CACHE_SCHEMA, farm: _chunkJZAGIXMBcjs.FARM_VERSION, scans })
1010
1013
  );
1011
1014
  _fs2.default.renameSync(temporary, cache2.file);
1012
1015
  cache2.dirty = false;
@@ -2319,7 +2322,7 @@ var PackageClientBoundaryCache = class {
2319
2322
  }
2320
2323
  const contents = JSON.stringify({
2321
2324
  schema: SCHEMA_VERSION,
2322
- farm: _chunkXPVS4HKUcjs.FARM_VERSION,
2325
+ farm: _chunkJZAGIXMBcjs.FARM_VERSION,
2323
2326
  paths,
2324
2327
  entries
2325
2328
  });
@@ -2359,7 +2362,7 @@ function readStoredCache(file) {
2359
2362
  } catch (e38) {
2360
2363
  return null;
2361
2364
  }
2362
- if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !== _chunkXPVS4HKUcjs.FARM_VERSION) {
2365
+ if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !== _chunkJZAGIXMBcjs.FARM_VERSION) {
2363
2366
  return null;
2364
2367
  }
2365
2368
  const { paths, entries } = value;
@@ -2370,7 +2373,7 @@ function readStoredCache(file) {
2370
2373
  const usable = variants.filter((entry) => isStoredEntry(entry, paths.length));
2371
2374
  if (usable.length > 0) valid[key] = usable;
2372
2375
  }
2373
- return { schema: SCHEMA_VERSION, farm: _chunkXPVS4HKUcjs.FARM_VERSION, paths, entries: valid };
2376
+ return { schema: SCHEMA_VERSION, farm: _chunkJZAGIXMBcjs.FARM_VERSION, paths, entries: valid };
2374
2377
  }
2375
2378
  function isRecord(value) {
2376
2379
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -2524,7 +2527,7 @@ function readOwnHydration(scope, content, file) {
2524
2527
  try {
2525
2528
  value = scope.renderer.hydration.resolve(content, file);
2526
2529
  } catch (error) {
2527
- throw _chunkHP7QYVSTcjs.createFarmRendererHookError.call(void 0,
2530
+ throw _chunkLEZJZX4Ccjs.createFarmRendererHookError.call(void 0,
2528
2531
  `${where} threw: ${error instanceof Error ? error.message : String(error)}`,
2529
2532
  error
2530
2533
  );
@@ -2535,7 +2538,7 @@ function readOwnHydration(scope, content, file) {
2535
2538
  `${where} returned ${JSON.stringify(value)}. Return \`{ hydrate?, strategy? }\`, or nothing to leave the file to Farm.`
2536
2539
  );
2537
2540
  }
2538
- return _chunkHP7QYVSTcjs.readFarmRendererHydration.call(void 0, value, where);
2541
+ return _chunkLEZJZX4Ccjs.readFarmRendererHydration.call(void 0, value, where);
2539
2542
  }
2540
2543
  function mayCompileFarmRendererSource(file) {
2541
2544
  if (scopes.size === 0) return false;
@@ -2558,7 +2561,7 @@ function compileFarmRendererSource(content, sourcePath) {
2558
2561
  try {
2559
2562
  value = compile.call(scope.renderer, content, file);
2560
2563
  } catch (error) {
2561
- throw _chunkHP7QYVSTcjs.createFarmRendererHookError.call(void 0,
2564
+ throw _chunkLEZJZX4Ccjs.createFarmRendererHookError.call(void 0,
2562
2565
  `${where} threw: ${error instanceof Error ? error.message : String(error)}`,
2563
2566
  error
2564
2567
  );
@@ -2677,7 +2680,7 @@ function resolveModuleSourcePath(modulePath, root) {
2677
2680
  return null;
2678
2681
  }
2679
2682
  function getFarmClientHydrationPlanOptions(renderer, hasUnsupportedIntegrationProvider) {
2680
- return { asyncOwnerIslands: _chunkHP7QYVSTcjs.isReactRenderer.call(void 0, renderer) && !hasUnsupportedIntegrationProvider };
2683
+ return { asyncOwnerIslands: _chunkLEZJZX4Ccjs.isReactRenderer.call(void 0, renderer) && !hasUnsupportedIntegrationProvider };
2681
2684
  }
2682
2685
  function describeSuppressedAsyncHydration(subject, reason) {
2683
2686
  const remediation = reason ? "Fix the reason above, or render the interactive UI from a synchronous owner." : 'Move the interactive UI into an eligible "use client" boundary, or render it from a synchronous owner.';
@@ -4696,7 +4699,7 @@ function transformEnvironmentFunctions(options) {
4696
4699
  function farmEnvironmentFunctionsPlugin(options = {}) {
4697
4700
  let routesFiles = /* @__PURE__ */ new Set();
4698
4701
  const componentExtensions = new Set(
4699
- _chunkHP7QYVSTcjs.getFarmRendererComponentExtensions.call(void 0, options.renderer || void 0)
4702
+ _chunkLEZJZX4Ccjs.getFarmRendererComponentExtensions.call(void 0, options.renderer || void 0)
4700
4703
  );
4701
4704
  let farmApi;
4702
4705
  let isBuild = false;
@@ -4733,7 +4736,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
4733
4736
  farmApi = _optionalChain([config, 'access', _280 => _280.plugins, 'access', _281 => _281.find, 'call', _282 => _282((plugin) => plugin.name === "farm"), 'optionalAccess', _283 => _283.api]);
4734
4737
  sources = void 0;
4735
4738
  routesFiles = new Set(
4736
- _chunkKBURN62Zcjs.getFarmSourceRoots.call(void 0, { ...options, root: _nullishCoalesce(options.root, () => ( config.root)) }).flatMap(
4739
+ _chunkPFVNPOKNcjs.getFarmSourceRoots.call(void 0, { ...options, root: _nullishCoalesce(options.root, () => ( config.root)) }).flatMap(
4737
4740
  (source) => _chunkPYPHM7AScjs.PROGRAMMATIC_ROUTE_FILE_NAMES.map(
4738
4741
  (name) => resolvedFile(_path2.default.resolve(source.root, source.srcDir, name))
4739
4742
  )
@@ -4756,7 +4759,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
4756
4759
  if (environment === "client" && !isBuild && !_chunkPYPHM7AScjs.parseProgrammaticRouteModuleId.call(void 0, id) && routeSourceFiles().has(moduleFile(id)) && !isProgrammaticRouteActionProxy(code)) {
4757
4760
  this.error(routeSourceError(moduleFile(id)));
4758
4761
  }
4759
- if (environment === "server" && _chunkHP7QYVSTcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([options, 'access', _285 => _285.experimental, 'optionalAccess', _286 => _286.serverComponents])) === "islands" && isApplicationScript(id)) {
4762
+ if (environment === "server" && _chunkCYUTK4JPcjs.resolveFarmServerComponentsMode.call(void 0, _chunkCYUTK4JPcjs.readFarmServerComponentsConfig.call(void 0, options)) === "islands" && isApplicationScript(id)) {
4760
4763
  const file = id.split("?", 1)[0];
4761
4764
  const root = _fs.realpathSync.call(void 0, _nullishCoalesce(options.root, () => ( projectRoot)));
4762
4765
  const clientCode = getFarmClientReachableModules(root, root).has(_path2.default.resolve(file)) || _fs.existsSync.call(void 0, file) && hasUseClientDirective(_fs.readFileSync.call(void 0, file, "utf8"));
@@ -4790,7 +4793,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
4790
4793
  for (const id of this.getModuleIds()) {
4791
4794
  if (_chunkPYPHM7AScjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
4792
4795
  const chain = findClientNodeBuiltinChain(id, (moduleId) => {
4793
- return _optionalChain([this, 'access', _287 => _287.getModuleInfo, 'call', _288 => _288(moduleId), 'optionalAccess', _289 => _289.importedIds]);
4796
+ return _optionalChain([this, 'access', _285 => _285.getModuleInfo, 'call', _286 => _286(moduleId), 'optionalAccess', _287 => _287.importedIds]);
4794
4797
  });
4795
4798
  if (chain) {
4796
4799
  this.error(
@@ -4808,8 +4811,8 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
4808
4811
  }
4809
4812
  if (!forbidden.has(moduleFile(id))) continue;
4810
4813
  const info = this.getModuleInfo(id);
4811
- if (isProgrammaticRouteActionProxy(_optionalChain([info, 'optionalAccess', _290 => _290.code]))) continue;
4812
- this.error(routeSourceError(moduleFile(id), _optionalChain([info, 'optionalAccess', _291 => _291.importers, 'access', _292 => _292.map, 'call', _293 => _293(moduleFile)])));
4814
+ if (isProgrammaticRouteActionProxy(_optionalChain([info, 'optionalAccess', _288 => _288.code]))) continue;
4815
+ this.error(routeSourceError(moduleFile(id), _optionalChain([info, 'optionalAccess', _289 => _289.importers, 'access', _290 => _290.map, 'call', _291 => _291(moduleFile)])));
4813
4816
  }
4814
4817
  }
4815
4818
  };
@@ -4828,8 +4831,8 @@ function resolvedFile(filePath) {
4828
4831
  }
4829
4832
  }
4830
4833
  function resolveBuildEnvironment(context, ssr) {
4831
- if (_optionalChain([context, 'access', _294 => _294.environment, 'optionalAccess', _295 => _295.name]) === "client") return "client";
4832
- if (_optionalChain([context, 'access', _296 => _296.environment, 'optionalAccess', _297 => _297.name]) === "rsc" || _optionalChain([context, 'access', _298 => _298.environment, 'optionalAccess', _299 => _299.name]) === "ssr") {
4834
+ if (_optionalChain([context, 'access', _292 => _292.environment, 'optionalAccess', _293 => _293.name]) === "client") return "client";
4835
+ if (_optionalChain([context, 'access', _294 => _294.environment, 'optionalAccess', _295 => _295.name]) === "rsc" || _optionalChain([context, 'access', _296 => _296.environment, 'optionalAccess', _297 => _297.name]) === "ssr") {
4833
4836
  return "server";
4834
4837
  }
4835
4838
  return ssr ? "server" : "client";