@farm.js/core 0.1.50 → 0.1.51-beta.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 (388) hide show
  1. package/README.md +163 -3
  2. package/dist/{agent-mcp-CIMH324y.d.mts → agent-mcp.d-BPzpKBHQ.d.mts} +1 -1
  3. package/dist/{agent-mcp-9BMbRgg_.d.ts → agent-mcp.d-ZuuNgrkQ.d.ts} +1 -1
  4. package/dist/agent-runtime.cjs +3 -3
  5. package/dist/agent-runtime.d.mts +13 -13
  6. package/dist/agent-runtime.d.ts +13 -13
  7. package/dist/agent-runtime.mjs +2 -2
  8. package/dist/{analyzer-CN7C74WX.cjs → analyzer-AZULAOPL.cjs} +2 -2
  9. package/dist/{analyzer-DDW34OMC.mjs → analyzer-V74FTD2F.mjs} +1 -1
  10. package/dist/api/client.d.mts +4 -4
  11. package/dist/api/client.d.ts +4 -4
  12. package/dist/api/route-manager.cjs +5 -5
  13. package/dist/api/route-manager.d.mts +19 -19
  14. package/dist/api/route-manager.d.ts +19 -19
  15. package/dist/api/route-manager.mjs +4 -4
  16. package/dist/api/runtime.d.mts +15 -15
  17. package/dist/api/runtime.d.ts +15 -15
  18. package/dist/{api-client-CvI5oOBE.d.ts → api-client.d-BWcqZciH.d.ts} +3 -3
  19. package/dist/{api-client-CFdv-Xgh.d.mts → api-client.d-CeA6tNA6.d.mts} +3 -3
  20. package/dist/api.cjs +7 -7
  21. package/dist/api.d.mts +21 -21
  22. package/dist/api.d.ts +21 -21
  23. package/dist/api.mjs +6 -6
  24. package/dist/{app-manifest-D0kaXdwu.d.ts → app-manifest.d-BJDcZn3W.d.mts} +1 -1
  25. package/dist/{app-manifest-CQDJOKL2.d.mts → app-manifest.d-HWhqbP2X.d.ts} +1 -1
  26. package/dist/app-markdown.d.mts +14 -14
  27. package/dist/app-markdown.d.ts +14 -14
  28. package/dist/{app-BWibTHVT.d.ts → app.d-B5EWdob-.d.ts} +12 -10
  29. package/dist/{app-DVJ13FPA.d.mts → app.d-DOGW1KI8.d.mts} +12 -10
  30. package/dist/base-path.d-BOUV5ozD.d.mts +10 -0
  31. package/dist/base-path.d-BOUV5ozD.d.ts +10 -0
  32. package/dist/{chunk-B5S2JS6M.cjs → chunk-2756SHCI.cjs} +372 -305
  33. package/dist/{chunk-RWT2BTJT.cjs → chunk-2IAPKPEB.cjs} +6 -6
  34. package/dist/{chunk-2G63BIRL.mjs → chunk-2KVDHNQS.mjs} +8 -11
  35. package/dist/{chunk-NJVFPJ2Y.cjs → chunk-3OWVWZ6R.cjs} +28 -2
  36. package/dist/{chunk-WVBUXNBX.mjs → chunk-5A5GAZ75.mjs} +296 -106
  37. package/dist/{chunk-GERUXONA.cjs → chunk-5A77OEIG.cjs} +4 -1
  38. package/dist/{chunk-4HBKBHVP.mjs → chunk-5ENW27SL.mjs} +1 -1
  39. package/dist/{chunk-FACTMUPI.cjs → chunk-5IONBVJY.cjs} +33 -22
  40. package/dist/{chunk-X2EL3BLH.cjs → chunk-5N7QAGEA.cjs} +36 -9
  41. package/dist/{chunk-DGOLAZLV.cjs → chunk-65Y5SIBH.cjs} +1 -1
  42. package/dist/{chunk-MTB57GOK.mjs → chunk-724WT3NI.mjs} +4 -2
  43. package/dist/{chunk-C73RIAEF.mjs → chunk-72NBDVWQ.mjs} +18 -7
  44. package/dist/{chunk-VCKGOXFI.cjs → chunk-76GHW3WI.cjs} +7 -1
  45. package/dist/{chunk-ZIBIE7AH.mjs → chunk-7UPCJDB5.mjs} +7 -1
  46. package/dist/{chunk-CPXDDWGL.mjs → chunk-AER5I65K.mjs} +1 -1
  47. package/dist/{chunk-RHOR2J6V.cjs → chunk-AGR7VJH2.cjs} +1 -1
  48. package/dist/{chunk-WB6XES4V.mjs → chunk-ALEUMLJN.mjs} +34 -5
  49. package/dist/{chunk-OD6WM3I7.mjs → chunk-AV26KHTG.mjs} +1 -1
  50. package/dist/{chunk-L6QDME5Z.cjs → chunk-B3GZAQSC.cjs} +3 -3
  51. package/dist/{chunk-ZLOQQ2UF.mjs → chunk-BSEKNTMS.mjs} +107 -40
  52. package/dist/{chunk-WAPQWAE6.cjs → chunk-CECUDGXQ.cjs} +9 -8
  53. package/dist/chunk-CKPTIEDX.cjs +12 -0
  54. package/dist/{chunk-IUQLRTTO.mjs → chunk-CO6UYM2D.mjs} +14 -1
  55. package/dist/{chunk-SHJJM6OG.mjs → chunk-CZ35L6PL.mjs} +9 -2
  56. package/dist/{chunk-EQMTJBB7.cjs → chunk-DZZHTMWM.cjs} +35 -6
  57. package/dist/{chunk-3ATXWZPH.cjs → chunk-E36C43IX.cjs} +13 -16
  58. package/dist/{chunk-J2ZEVDEK.cjs → chunk-EHB77D5U.cjs} +3 -3
  59. package/dist/{chunk-KO2NWUKN.mjs → chunk-EIMK7D2D.mjs} +33 -6
  60. package/dist/{chunk-CY7H5KS4.cjs → chunk-EKJYE4Y7.cjs} +2 -2
  61. package/dist/{chunk-2VCC3GVC.mjs → chunk-EOSFVNXZ.mjs} +1 -1
  62. package/dist/{chunk-IWJKJDNW.mjs → chunk-EWC76P5D.mjs} +53 -32
  63. package/dist/{chunk-WQGRD5BJ.cjs → chunk-EX6ZSN5P.cjs} +1 -16
  64. package/dist/{chunk-6QA2SXVH.cjs → chunk-FK25QSVC.cjs} +2 -1
  65. package/dist/{chunk-BW6SCVYX.mjs → chunk-FSQMN2MQ.mjs} +1 -0
  66. package/dist/{chunk-2H3FJYY6.mjs → chunk-FSXSQQTV.mjs} +3 -2
  67. package/dist/chunk-GNZIAJGB.mjs +358 -0
  68. package/dist/{chunk-TXK4D46O.mjs → chunk-H3ASZDT7.mjs} +21 -1
  69. package/dist/{chunk-B6PREBN6.cjs → chunk-HASX6DC7.cjs} +8 -8
  70. package/dist/{chunk-76R5GJER.mjs → chunk-I3EFXUAR.mjs} +60 -13
  71. package/dist/{chunk-HYN3LLG7.cjs → chunk-IFBINMI4.cjs} +3 -3
  72. package/dist/{chunk-CBJKDB6F.mjs → chunk-IRSS4HS4.mjs} +1 -1
  73. package/dist/{chunk-4T25YCZ5.cjs → chunk-JVBNKWLV.cjs} +81 -34
  74. package/dist/{chunk-VOZ5DI7D.mjs → chunk-JWI5PUO2.mjs} +6 -2
  75. package/dist/{chunk-YAXOEAND.cjs → chunk-KHXAJ2KA.cjs} +6 -6
  76. package/dist/{chunk-2DEPNLXK.mjs → chunk-KMB5BMFX.mjs} +122 -12
  77. package/dist/{chunk-M7LKA632.mjs → chunk-KU7MBLDZ.mjs} +1 -1
  78. package/dist/{chunk-WXHDVXJE.mjs → chunk-KY32FWK7.mjs} +2 -2
  79. package/dist/{chunk-EQWWOQTK.cjs → chunk-LEIXUFJN.cjs} +6 -2
  80. package/dist/{chunk-2GLQSIZD.mjs → chunk-LMFJCXDD.mjs} +1 -1
  81. package/dist/{chunk-IXSMFKZ2.cjs → chunk-LNM57D3H.cjs} +4 -4
  82. package/dist/{chunk-5V4KZOZO.mjs → chunk-LZ4SB57H.mjs} +2 -2
  83. package/dist/chunk-N4AQNEXR.cjs +17 -0
  84. package/dist/{chunk-J37KTQIA.cjs → chunk-NK2VWS7P.cjs} +52 -3
  85. package/dist/{chunk-X3HOVNHI.mjs → chunk-NN3MOPSI.mjs} +7 -7
  86. package/dist/{chunk-JZMZKABS.cjs → chunk-NWUHS6GV.cjs} +3 -2
  87. package/dist/{chunk-XLLVWLWO.mjs → chunk-PIHKO25G.mjs} +1 -1
  88. package/dist/chunk-PIUTGRDI.cjs +358 -0
  89. package/dist/{chunk-JJOWY3XD.mjs → chunk-QAIAFCRZ.mjs} +8 -6
  90. package/dist/{chunk-Q3UU2KXC.mjs → chunk-QMDU6QHN.mjs} +4 -1
  91. package/dist/{chunk-75WWOZ5C.mjs → chunk-QOSDWGKT.mjs} +1 -1
  92. package/dist/{chunk-GOOK2J2W.cjs → chunk-RMPNYUGT.cjs} +9 -7
  93. package/dist/{chunk-HWCHIBJZ.mjs → chunk-SCRC5AMM.mjs} +5 -5
  94. package/dist/{chunk-PXEXOQ5R.mjs → chunk-SHS6KXOZ.mjs} +1 -1
  95. package/dist/{chunk-ETF5C6HR.cjs → chunk-SJ23LJ3N.cjs} +3 -3
  96. package/dist/{chunk-JHXJBNLY.cjs → chunk-SUCDVKUB.cjs} +21 -1
  97. package/dist/{chunk-7ONZDKVY.mjs → chunk-T4EW7AAD.mjs} +2 -2
  98. package/dist/{chunk-F5LERVY3.cjs → chunk-TT66CP3P.cjs} +13 -13
  99. package/dist/{chunk-IUBDMDZZ.cjs → chunk-UQHIWZZ6.cjs} +15 -8
  100. package/dist/{chunk-LYWAGXXW.cjs → chunk-VITZRYW3.cjs} +131 -21
  101. package/dist/{chunk-XN2MB4QZ.cjs → chunk-VQJYGZNX.cjs} +4 -4
  102. package/dist/{chunk-KGP76FSV.mjs → chunk-VS7EHLLW.mjs} +1 -1
  103. package/dist/{chunk-5PKDHKQP.cjs → chunk-WFVSAT7Y.cjs} +6 -4
  104. package/dist/{chunk-UY6HS5PF.cjs → chunk-X2AMN2WV.cjs} +10 -10
  105. package/dist/{chunk-474FO3UE.cjs → chunk-X2M4XN4V.cjs} +213 -192
  106. package/dist/chunk-X3EFRVXY.mjs +12 -0
  107. package/dist/{chunk-UCQ52TJY.mjs → chunk-X3JNB2TB.mjs} +1 -1
  108. package/dist/{chunk-IQXGHGZF.cjs → chunk-XB24LZWI.cjs} +5 -5
  109. package/dist/{chunk-BNMHXVLL.mjs → chunk-XMHERKSE.mjs} +0 -15
  110. package/dist/{chunk-CGCJ2TJU.cjs → chunk-XPMC4E2G.cjs} +3 -3
  111. package/dist/{chunk-KZH6YLND.cjs → chunk-XY4DYGSU.cjs} +603 -413
  112. package/dist/{chunk-C7425KDG.cjs → chunk-XYL4HSVC.cjs} +2 -2
  113. package/dist/{chunk-HHFMECFO.mjs → chunk-Y2G5SJFB.mjs} +2 -1
  114. package/dist/{chunk-2SVJGOAX.mjs → chunk-Y3N5BFRJ.mjs} +3 -3
  115. package/dist/{chunk-Z5MZDFX4.cjs → chunk-YIHRZBD7.cjs} +14 -1
  116. package/dist/chunk-Z5A6CNV2.mjs +60 -0
  117. package/dist/chunk-Z64V4WZI.mjs +17 -0
  118. package/dist/{chunk-E2BMCNMJ.cjs → chunk-ZOWNWHK6.cjs} +2 -2
  119. package/dist/{chunk-C5JXCUKR.mjs → chunk-ZQ5BDNKW.mjs} +51 -2
  120. package/dist/client/lifecycle.d.mts +1 -1
  121. package/dist/client/lifecycle.d.ts +1 -1
  122. package/dist/{client-plugins-BPfltM5m.d.ts → client-plugins.d-C0n8Yhh-.d.ts} +60 -14
  123. package/dist/{client-plugins-D4RO59f0.d.mts → client-plugins.d-C_3CdALC.d.mts} +60 -14
  124. package/dist/client-plugins.d.mts +13 -13
  125. package/dist/client-plugins.d.ts +13 -13
  126. package/dist/client.cjs +5 -4
  127. package/dist/client.d.mts +24 -24
  128. package/dist/client.d.ts +24 -24
  129. package/dist/client.mjs +4 -3
  130. package/dist/config.d.mts +13 -13
  131. package/dist/config.d.ts +13 -13
  132. package/dist/cron.cjs +4 -4
  133. package/dist/cron.mjs +3 -3
  134. package/dist/desktop.d.mts +14 -14
  135. package/dist/desktop.d.ts +14 -14
  136. package/dist/{dev-guard-YLO5DE3H.cjs → dev-guard-2UW2KERP.cjs} +2 -2
  137. package/dist/{dev-guard-4PFQNXQX.mjs → dev-guard-ONNMVQUN.mjs} +1 -1
  138. package/dist/{devtools-STG7HPRV.mjs → devtools-BU5IT2PD.mjs} +8 -8
  139. package/dist/{devtools-N5XTOECL.cjs → devtools-KJFUE5FO.cjs} +10 -10
  140. package/dist/docs.cjs +14 -12
  141. package/dist/docs.d.mts +23 -15
  142. package/dist/docs.d.ts +23 -15
  143. package/dist/docs.mjs +13 -11
  144. package/dist/environment/vite.cjs +2 -2
  145. package/dist/environment/vite.d.mts +1 -1
  146. package/dist/environment/vite.d.ts +1 -1
  147. package/dist/environment/vite.mjs +1 -1
  148. package/dist/{generate-route-types-TF5Wwtvz.d.mts → generate-route-types.d-BL2pq6xC.d.ts} +1 -1
  149. package/dist/{generate-route-types-DQP0cUzk.d.ts → generate-route-types.d-BoVDU8qX.d.mts} +1 -1
  150. package/dist/i18n/client.d.mts +2 -2
  151. package/dist/i18n/client.d.ts +2 -2
  152. package/dist/i18n/index.d.mts +3 -3
  153. package/dist/i18n/index.d.ts +3 -3
  154. package/dist/i18n/server.d.mts +5 -5
  155. package/dist/i18n/server.d.ts +5 -5
  156. package/dist/image/server.d.mts +1 -1
  157. package/dist/image/server.d.ts +1 -1
  158. package/dist/image/sharp.d.mts +1 -1
  159. package/dist/image/sharp.d.ts +1 -1
  160. package/dist/image.d.mts +1 -1
  161. package/dist/image.d.ts +1 -1
  162. package/dist/index.cjs +48 -44
  163. package/dist/{index-C-N3Pwg-.d.ts → index.d-B6M_8kmo.d.ts} +2 -2
  164. package/dist/{index-D3l4tREW.d.ts → index.d-BNNDpql4.d.ts} +2 -2
  165. package/dist/{index-DPUAPho_.d.mts → index.d-BqcfqJvt.d.mts} +2 -2
  166. package/dist/{index-k8o8eUOd.d.mts → index.d-CsGxS-hZ.d.mts} +2 -2
  167. package/dist/index.d.mts +42 -42
  168. package/dist/index.d.ts +42 -42
  169. package/dist/index.mjs +47 -43
  170. package/dist/instrumentation.d.mts +2 -2
  171. package/dist/instrumentation.d.ts +2 -2
  172. package/dist/integrations.cjs +3 -3
  173. package/dist/integrations.d.mts +13 -13
  174. package/dist/integrations.d.ts +13 -13
  175. package/dist/integrations.mjs +2 -2
  176. package/dist/internal/app-markdown-runtime.d.mts +14 -14
  177. package/dist/internal/app-markdown-runtime.d.ts +14 -14
  178. package/dist/internal/build-runtime.cjs +36 -35
  179. package/dist/internal/build-runtime.d.mts +16 -16
  180. package/dist/internal/build-runtime.d.ts +16 -16
  181. package/dist/internal/build-runtime.mjs +35 -34
  182. package/dist/internal/cli-runtime.cjs +18 -18
  183. package/dist/internal/cli-runtime.mjs +17 -17
  184. package/dist/internal/client-error-overlay.cjs +4 -4
  185. package/dist/internal/client-error-overlay.mjs +1 -1
  186. package/dist/internal/client-runtime.cjs +4 -2
  187. package/dist/internal/client-runtime.d.mts +21 -21
  188. package/dist/internal/client-runtime.d.ts +21 -21
  189. package/dist/internal/client-runtime.mjs +3 -1
  190. package/dist/internal/compression-runtime.d.mts +13 -13
  191. package/dist/internal/compression-runtime.d.ts +13 -13
  192. package/dist/internal/config-runtime.cjs +10 -10
  193. package/dist/internal/config-runtime.d.mts +18 -18
  194. package/dist/internal/config-runtime.d.ts +18 -18
  195. package/dist/internal/config-runtime.mjs +9 -9
  196. package/dist/internal/form-actions.cjs +4 -3
  197. package/dist/internal/form-actions.d.mts +1 -1
  198. package/dist/internal/form-actions.d.ts +1 -1
  199. package/dist/internal/form-actions.mjs +3 -2
  200. package/dist/internal/infra-analytics-runtime.cjs +5 -5
  201. package/dist/internal/infra-analytics-runtime.mjs +3 -3
  202. package/dist/internal/island-value-store.d.mts +1 -1
  203. package/dist/internal/island-value-store.d.ts +1 -1
  204. package/dist/internal/islands-runtime.cjs +56 -0
  205. package/dist/internal/islands-runtime.d.mts +1 -1
  206. package/dist/internal/islands-runtime.d.ts +1 -1
  207. package/dist/internal/islands-runtime.mjs +57 -1
  208. package/dist/internal/isolated-boundary.d.mts +2 -2
  209. package/dist/internal/isolated-boundary.d.ts +2 -2
  210. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  211. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  212. package/dist/internal/production-runtime.cjs +15 -8
  213. package/dist/internal/production-runtime.d.mts +46 -30
  214. package/dist/internal/production-runtime.d.ts +46 -30
  215. package/dist/internal/production-runtime.mjs +14 -7
  216. package/dist/internal/server-fn-transform.cjs +13 -0
  217. package/dist/internal/server-fn-transform.d.mts +24 -0
  218. package/dist/internal/server-fn-transform.d.ts +24 -0
  219. package/dist/internal/server-fn-transform.mjs +13 -0
  220. package/dist/internal/server-tree.d.mts +1 -1
  221. package/dist/internal/server-tree.d.ts +1 -1
  222. package/dist/markdown.d.mts +13 -13
  223. package/dist/markdown.d.ts +13 -13
  224. package/dist/middleware.cjs +8 -8
  225. package/dist/middleware.d.mts +15 -15
  226. package/dist/middleware.d.ts +15 -15
  227. package/dist/middleware.mjs +7 -7
  228. package/dist/mobile.d.mts +37 -10
  229. package/dist/mobile.d.ts +37 -10
  230. package/dist/{navigation-delegate-8xg3Zvp4.d.ts → navigation-delegate.d-C0BbdUgN.d.mts} +1 -1
  231. package/dist/{navigation-delegate-ji6elCKy.d.mts → navigation-delegate.d-jArRF0ZP.d.ts} +1 -1
  232. package/dist/navigation.d.mts +17 -17
  233. package/dist/navigation.d.ts +17 -17
  234. package/dist/{nitro-YPSZBYDK.cjs → nitro-CK7M4RMY.cjs} +11 -11
  235. package/dist/{nitro-2Q5NVY7L.mjs → nitro-R444AF3O.mjs} +7 -7
  236. package/dist/observability.d.mts +1 -1
  237. package/dist/observability.d.ts +1 -1
  238. package/dist/plugin.cjs +29 -27
  239. package/dist/plugin.d.mts +17 -17
  240. package/dist/plugin.d.ts +17 -17
  241. package/dist/plugin.mjs +28 -26
  242. package/dist/{production-runtime-TdKaYRj0.d.ts → production-runtime.d-DFaQ1qaV.d.mts} +3 -3
  243. package/dist/{production-runtime-DXnQQkQf.d.mts → production-runtime.d-UnXmSS_S.d.ts} +3 -3
  244. package/dist/{programmatic-routes-client-Dh1SDLSM.d.mts → programmatic-routes-client.d-BIowUXQC.d.mts} +10 -2
  245. package/dist/{programmatic-routes-client-BwiTndEC.d.ts → programmatic-routes-client.d-VZ0qcbH4.d.ts} +10 -2
  246. package/dist/query/client.d.mts +1 -1
  247. package/dist/query/client.d.ts +1 -1
  248. package/dist/query/index.d.mts +1 -1
  249. package/dist/query/index.d.ts +1 -1
  250. package/dist/query/server.d.mts +1 -1
  251. package/dist/query/server.d.ts +1 -1
  252. package/dist/{render-plan-BPbwRbuN.d.ts → render-plan.d-BB6KrYjP.d.ts} +2 -2
  253. package/dist/{render-plan-BvCGXF6K.d.mts → render-plan.d-BNeqyPyJ.d.mts} +2 -2
  254. package/dist/renderer-client.cjs +8 -6
  255. package/dist/renderer-client.d.mts +19 -19
  256. package/dist/renderer-client.d.ts +19 -19
  257. package/dist/renderer-client.mjs +4 -2
  258. package/dist/{request-C_xTkJib.d.mts → request.d-BV1munmx.d.mts} +1 -1
  259. package/dist/{request-B8PGTZNR.d.ts → request.d-Bxhghm76.d.ts} +1 -1
  260. package/dist/request.d.mts +14 -14
  261. package/dist/request.d.ts +14 -14
  262. package/dist/{resolver-CJ-D9nP-.d.ts → resolver.d-BHyZgpa7.d.ts} +1 -1
  263. package/dist/{resolver-TDyZKgKI.d.mts → resolver.d-JnZKKsc5.d.mts} +1 -1
  264. package/dist/response.d-BolW0Vx_.d.mts +10 -0
  265. package/dist/response.d-BolW0Vx_.d.ts +10 -0
  266. package/dist/{route-rendering-DlddURL1.d.mts → route-rendering.d-BIf7zE9d.d.ts} +1 -1
  267. package/dist/{route-rendering-RNtcj607.d.ts → route-rendering.d-DShqKlgK.d.mts} +1 -1
  268. package/dist/{route-DFhZj6jN.d.ts → route.d-BaVH3V0w.d.mts} +1 -1
  269. package/dist/{route-2_yXC6gv.d.mts → route.d-DBTEqifW.d.ts} +1 -1
  270. package/dist/{router-B97eB0Mq.d.mts → router.d-BE7i84fb.d.mts} +1 -1
  271. package/dist/{router-qUVaoEN8.d.ts → router.d-Bw3K3b0a.d.ts} +1 -1
  272. package/dist/routes.cjs +3 -2
  273. package/dist/{routes-8PT9cl60.d.ts → routes.d-DVZQL0-H.d.ts} +3 -3
  274. package/dist/{routes-kEUsXHx3.d.mts → routes.d-_5tBQexL.d.mts} +3 -3
  275. package/dist/routes.d.mts +14 -14
  276. package/dist/routes.d.ts +14 -14
  277. package/dist/routes.mjs +2 -1
  278. package/dist/{rsc-pipeline-T3775JUA.mjs → rsc-pipeline-FBM6NFYY.mjs} +13 -13
  279. package/dist/{rsc-pipeline-L4XOZ2TE.cjs → rsc-pipeline-IQI5XQLS.cjs} +14 -14
  280. package/dist/{runtime-HRSFC4ZC.mjs → runtime-2JYIDUON.mjs} +14 -14
  281. package/dist/{runtime-BIBGJO7V.cjs → runtime-DXEVFYLE.cjs} +16 -16
  282. package/dist/{runtime-CihDZ2Rn.d.mts → runtime.d-3iJAKptR.d.mts} +2 -2
  283. package/dist/{runtime-C4CmlOOh.d.ts → runtime.d-BtL3PCL3.d.ts} +2 -2
  284. package/dist/{runtime-C8GUnNeP.d.ts → runtime.d-CQgoYR0Q.d.mts} +4 -4
  285. package/dist/{runtime-CaDswfWi.d.mts → runtime.d-CfhaLPl-.d.ts} +4 -4
  286. package/dist/{schema-dev-notice-LZ5NXGLN.mjs → schema-dev-notice-F6QYSOAI.mjs} +2 -2
  287. package/dist/{schema-dev-notice-XV7GZ3QJ.cjs → schema-dev-notice-UU7DMZEU.cjs} +3 -3
  288. package/dist/{search-client-BTXL5XWD.mjs → search-client-OXH6GBNO.mjs} +5 -3
  289. package/dist/search-client-ZZLKVO5R.cjs +15 -0
  290. package/dist/server-action-security.cjs +2 -2
  291. package/dist/server-action-security.d.mts +1 -1
  292. package/dist/server-action-security.d.ts +1 -1
  293. package/dist/server-action-security.mjs +1 -1
  294. package/dist/server-fn-client.d.mts +5 -5
  295. package/dist/server-fn-client.d.ts +5 -5
  296. package/dist/server-fn.cjs +3 -3
  297. package/dist/server-fn.d.mts +3 -3
  298. package/dist/server-fn.d.ts +3 -3
  299. package/dist/server-fn.mjs +2 -2
  300. package/dist/server-plugins.d.mts +14 -14
  301. package/dist/server-plugins.d.ts +14 -14
  302. package/dist/server-query-client.cjs +4 -3
  303. package/dist/server-query-client.d.mts +5 -5
  304. package/dist/server-query-client.d.ts +5 -5
  305. package/dist/server-query-client.mjs +3 -2
  306. package/dist/server-query.cjs +4 -4
  307. package/dist/server-query.d.mts +2 -2
  308. package/dist/server-query.d.ts +2 -2
  309. package/dist/server-query.mjs +3 -3
  310. package/dist/server.cjs +64 -62
  311. package/dist/server.d.mts +28 -29
  312. package/dist/server.d.ts +28 -29
  313. package/dist/server.mjs +38 -36
  314. package/dist/{spa-router-Dlv5ofg0.d.mts → spa-router.d-C5opIgXg.d.ts} +5 -5
  315. package/dist/{spa-router-qapSboKz.d.ts → spa-router.d-D63jb6nX.d.mts} +5 -5
  316. package/dist/storage.d.mts +2 -2
  317. package/dist/storage.d.ts +2 -2
  318. package/dist/testing.cjs +12 -11
  319. package/dist/testing.d.mts +14 -14
  320. package/dist/testing.d.ts +14 -14
  321. package/dist/testing.mjs +9 -8
  322. package/dist/theme/client.d.mts +1 -1
  323. package/dist/theme/client.d.ts +1 -1
  324. package/dist/theme/index.d.mts +2 -2
  325. package/dist/theme/index.d.ts +2 -2
  326. package/dist/theme/runtime.d.mts +1 -1
  327. package/dist/theme/runtime.d.ts +1 -1
  328. package/dist/theme/server.d.mts +1 -1
  329. package/dist/theme/server.d.ts +1 -1
  330. package/dist/{utils-DyvlSxFk.d.mts → utils.d-CO-U4OVZ.d.mts} +1 -1
  331. package/dist/{utils-A-cYF81u.d.ts → utils.d-CkpTqTsC.d.ts} +1 -1
  332. package/dist/version.cjs +2 -2
  333. package/dist/version.mjs +1 -1
  334. package/dist/vite.cjs +29 -27
  335. package/dist/vite.d.mts +20 -19
  336. package/dist/vite.d.ts +20 -19
  337. package/dist/vite.mjs +28 -26
  338. package/dist/workflows.cjs +4 -4
  339. package/dist/workflows.d.mts +1 -1
  340. package/dist/workflows.d.ts +1 -1
  341. package/dist/workflows.mjs +3 -3
  342. package/package.json +10 -5
  343. package/dist/base-path-leyrqXbX.d.mts +0 -19
  344. package/dist/base-path-leyrqXbX.d.ts +0 -19
  345. package/dist/chunk-OTOOJIUB.mjs +0 -34
  346. package/dist/search-client-QCYAL6AY.cjs +0 -13
  347. /package/dist/{chunk-recovery-lnQFzcQP.d.mts → chunk-recovery.d-lnQFzcQP.d.mts} +0 -0
  348. /package/dist/{chunk-recovery-lnQFzcQP.d.ts → chunk-recovery.d-lnQFzcQP.d.ts} +0 -0
  349. /package/dist/{client-cache-Deoqq-nM.d.ts → client-cache.d-Deoqq-nM.d.ts} +0 -0
  350. /package/dist/{client-cache-di_Nasxa.d.mts → client-cache.d-di_Nasxa.d.mts} +0 -0
  351. /package/dist/{config-CnhyvvmT.d.mts → config.d-CnhyvvmT.d.mts} +0 -0
  352. /package/dist/{config-CnhyvvmT.d.ts → config.d-CnhyvvmT.d.ts} +0 -0
  353. /package/dist/{endpoint-BgHn0lhl.d.ts → endpoint.d-BgHn0lhl.d.ts} +0 -0
  354. /package/dist/{endpoint-BkMSCRf6.d.mts → endpoint.d-BkMSCRf6.d.mts} +0 -0
  355. /package/dist/{image-config-CeDgNyX4.d.mts → image-config.d-CeDgNyX4.d.mts} +0 -0
  356. /package/dist/{image-config-CeDgNyX4.d.ts → image-config.d-CeDgNyX4.d.ts} +0 -0
  357. /package/dist/{instrumentation-runtime-CX9Zh-16.d.mts → instrumentation-runtime.d-CX9Zh-16.d.mts} +0 -0
  358. /package/dist/{instrumentation-runtime-CX9Zh-16.d.ts → instrumentation-runtime.d-CX9Zh-16.d.ts} +0 -0
  359. /package/dist/{island-value-protocol-BRayRghM.d.mts → island-value-protocol.d-BRayRghM.d.mts} +0 -0
  360. /package/dist/{island-value-protocol-BRayRghM.d.ts → island-value-protocol.d-BRayRghM.d.ts} +0 -0
  361. /package/dist/{island-CfGru1MO.d.mts → island.d-CfGru1MO.d.mts} +0 -0
  362. /package/dist/{island-CfGru1MO.d.ts → island.d-CfGru1MO.d.ts} +0 -0
  363. /package/dist/{layers-CcS42OGR.d.mts → layers.d-CcS42OGR.d.mts} +0 -0
  364. /package/dist/{layers-CcS42OGR.d.ts → layers.d-CcS42OGR.d.ts} +0 -0
  365. /package/dist/{lifecycle-C2aLBOwu.d.mts → lifecycle.d-C2aLBOwu.d.mts} +0 -0
  366. /package/dist/{lifecycle-C2aLBOwu.d.ts → lifecycle.d-C2aLBOwu.d.ts} +0 -0
  367. /package/dist/{observability-B2363jB6.d.mts → observability.d-B2363jB6.d.mts} +0 -0
  368. /package/dist/{observability-B2363jB6.d.ts → observability.d-B2363jB6.d.ts} +0 -0
  369. /package/dist/{params-BALtrRim.d.ts → params.d-BALtrRim.d.ts} +0 -0
  370. /package/dist/{params-ry-lxqmy.d.mts → params.d-ry-lxqmy.d.mts} +0 -0
  371. /package/dist/{production-vite-BQFAlG7n.d.mts → production-vite.d-BQFAlG7n.d.mts} +0 -0
  372. /package/dist/{production-vite-BQFAlG7n.d.ts → production-vite.d-BQFAlG7n.d.ts} +0 -0
  373. /package/dist/{route-pattern-CVsVbq5n.d.mts → route-pattern.d-CVsVbq5n.d.mts} +0 -0
  374. /package/dist/{route-pattern-CVsVbq5n.d.ts → route-pattern.d-CVsVbq5n.d.ts} +0 -0
  375. /package/dist/{server-client-bridge-DKWDl5NB.d.mts → server-client-bridge.d-DKWDl5NB.d.mts} +0 -0
  376. /package/dist/{server-client-bridge-DKWDl5NB.d.ts → server-client-bridge.d-DKWDl5NB.d.ts} +0 -0
  377. /package/dist/{server-fn-error-DrcH9cc1.d.mts → server-fn-error.d-DrcH9cc1.d.mts} +0 -0
  378. /package/dist/{server-fn-error-DrcH9cc1.d.ts → server-fn-error.d-DrcH9cc1.d.ts} +0 -0
  379. /package/dist/{server-query-runtime-DXRNhX_3.d.ts → server-query-runtime.d-DXRNhX_3.d.ts} +0 -0
  380. /package/dist/{server-query-runtime-aP52iuL5.d.mts → server-query-runtime.d-aP52iuL5.d.mts} +0 -0
  381. /package/dist/{types-BnIqOn9w.d.mts → types.d-BnIqOn9w.d.mts} +0 -0
  382. /package/dist/{types-BnIqOn9w.d.ts → types.d-BnIqOn9w.d.ts} +0 -0
  383. /package/dist/{types-C41ePjvP.d.mts → types.d-C41ePjvP.d.mts} +0 -0
  384. /package/dist/{types-C41ePjvP.d.ts → types.d-C41ePjvP.d.ts} +0 -0
  385. /package/dist/{types-DQnyD3VD.d.mts → types.d-DQnyD3VD.d.mts} +0 -0
  386. /package/dist/{types-DQnyD3VD.d.ts → types.d-DQnyD3VD.d.ts} +0 -0
  387. /package/dist/{workflows-CRMzQZ3k.d.mts → workflows.d-CRMzQZ3k.d.mts} +0 -0
  388. /package/dist/{workflows-CRMzQZ3k.d.ts → workflows.d-CRMzQZ3k.d.ts} +0 -0
@@ -1,3 +1,6 @@
1
+ import {
2
+ loadFarmProductionVite
3
+ } from "./chunk-PSUYE5HR.mjs";
1
4
  import {
2
5
  FARM_DESKTOP_ENV_MODULE_FILE,
3
6
  FARM_DESKTOP_ENV_MODULE_SOURCE,
@@ -7,9 +10,6 @@ import {
7
10
  createFarmNodeServerEntry,
8
11
  withProductionNodeEnv
9
12
  } from "./chunk-VU3MYZPO.mjs";
10
- import {
11
- loadFarmProductionVite
12
- } from "./chunk-PSUYE5HR.mjs";
13
13
  import {
14
14
  generateNativeMCPPluginSource
15
15
  } from "./chunk-KQH2COEJ.mjs";
@@ -17,27 +17,29 @@ import {
17
17
  assertFarmDocsAdapterServesNoGuardedPages,
18
18
  compileFarmDocsAdapterEdgeManifest,
19
19
  createFarmDocsAPIHandler,
20
- hasFarmDocsRuntimeAdapter
21
- } from "./chunk-76R5GJER.mjs";
20
+ hasFarmDocsRuntimeAdapter,
21
+ listFarmDocsAdapterPages
22
+ } from "./chunk-I3EFXUAR.mjs";
22
23
  import {
23
24
  FARM_DOCS_LAST_MODIFIED_MANIFEST,
24
25
  createFarmDocsHandler,
25
26
  createFarmDocsLastModifiedManifest,
26
27
  discoverFarmDocsPages,
27
28
  getFarmDocsMarkdownPath,
29
+ getFarmDocsRoots,
28
30
  getFarmDocsRouteTypeEntries,
29
31
  loadFarmDocsPage,
30
32
  resolveFarmDocsContentDir,
31
33
  toFarmDocsMarkdownPage
32
- } from "./chunk-KO2NWUKN.mjs";
34
+ } from "./chunk-EIMK7D2D.mjs";
33
35
  import {
34
36
  generateFarmDocsSearchClientRuntime,
35
37
  isFarmDocsSearchEnabled,
36
38
  resolveFarmDocsSearchClientModule
37
- } from "./chunk-WB6XES4V.mjs";
39
+ } from "./chunk-ALEUMLJN.mjs";
38
40
  import {
39
41
  FARM_PRERENDER_ENV
40
- } from "./chunk-M7LKA632.mjs";
42
+ } from "./chunk-KU7MBLDZ.mjs";
41
43
  import {
42
44
  resolveFarmInstrumentationFile
43
45
  } from "./chunk-N35YPV4N.mjs";
@@ -52,7 +54,7 @@ import {
52
54
  getDeployTargetForPreset,
53
55
  hasCustomFarmRouteContext,
54
56
  resolveDeployOutputPath
55
- } from "./chunk-2DEPNLXK.mjs";
57
+ } from "./chunk-KMB5BMFX.mjs";
56
58
  import {
57
59
  DEFAULT_NOT_FOUND_STYLES,
58
60
  FARM_LAYOUT_ELEMENT_CLIENT_SOURCE,
@@ -84,10 +86,10 @@ import {
84
86
  resolveFarmIsolatedClientHydrationMode,
85
87
  resolveFarmNotFoundComponentPath,
86
88
  usesFarmServerTree
87
- } from "./chunk-IWJKJDNW.mjs";
89
+ } from "./chunk-EWC76P5D.mjs";
88
90
  import {
89
91
  loadTailwindVitePlugin
90
- } from "./chunk-XLLVWLWO.mjs";
92
+ } from "./chunk-PIHKO25G.mjs";
91
93
  import {
92
94
  PluginManager
93
95
  } from "./chunk-GHNW564E.mjs";
@@ -95,7 +97,7 @@ import {
95
97
  generateFarmTypeArtifacts,
96
98
  readRouteRenderingDirectiveFromFile,
97
99
  resolveRouteRenderingConfigFromFile
98
- } from "./chunk-SHJJM6OG.mjs";
100
+ } from "./chunk-CZ35L6PL.mjs";
99
101
  import {
100
102
  HOISTED_HEAD_ELEMENT,
101
103
  appMiddlewareMayHandlePath,
@@ -108,7 +110,7 @@ import {
108
110
  layoutsCanCoverSamePage,
109
111
  routeBoundaryCoversDirectory,
110
112
  stripRouteGroups
111
- } from "./chunk-ZIBIE7AH.mjs";
113
+ } from "./chunk-7UPCJDB5.mjs";
112
114
  import {
113
115
  farmPluginMayAffectRuntimePath
114
116
  } from "./chunk-UUMKLGUU.mjs";
@@ -122,7 +124,7 @@ import {
122
124
  listFarmBuiltInRoutePaths,
123
125
  resolveFarmApiCatalogInput,
124
126
  resolveFarmAppManifestInput
125
- } from "./chunk-JJOWY3XD.mjs";
127
+ } from "./chunk-QAIAFCRZ.mjs";
126
128
  import {
127
129
  FARM_DEFAULT_MCP_PATH,
128
130
  createFarmDefaultMCPServer,
@@ -130,7 +132,7 @@ import {
130
132
  } from "./chunk-KRRZJ77U.mjs";
131
133
  import {
132
134
  farmEnvironmentFunctionsPlugin
133
- } from "./chunk-C5JXCUKR.mjs";
135
+ } from "./chunk-ZQ5BDNKW.mjs";
134
136
  import {
135
137
  isFarmMarkdownPageFile
136
138
  } from "./chunk-GW4YUIHW.mjs";
@@ -174,16 +176,16 @@ import {
174
176
  import {
175
177
  applyFarmWorkflowVercelCrons,
176
178
  prepareFarmWorkflowsForNitro
177
- } from "./chunk-5V4KZOZO.mjs";
179
+ } from "./chunk-LZ4SB57H.mjs";
178
180
  import {
179
181
  applyFarmCronVercelCrons,
180
182
  createFarmCronCloudflareConfig,
181
183
  mergeScheduledTasks,
182
184
  prepareFarmCronForNitro
183
- } from "./chunk-UCQ52TJY.mjs";
185
+ } from "./chunk-X3JNB2TB.mjs";
184
186
  import {
185
187
  resolveServerActionsConfig
186
- } from "./chunk-BW6SCVYX.mjs";
188
+ } from "./chunk-FSQMN2MQ.mjs";
187
189
  import {
188
190
  getFarmMarkdownAlternatePath
189
191
  } from "./chunk-N77JBPLC.mjs";
@@ -193,7 +195,7 @@ import {
193
195
  import {
194
196
  getFarmIntegrationPluginServerRuntime,
195
197
  getIntegrationProviders
196
- } from "./chunk-HHFMECFO.mjs";
198
+ } from "./chunk-Y2G5SJFB.mjs";
197
199
  import {
198
200
  FARM_INTEGRATION_API_BASE_PATH_KEY
199
201
  } from "./chunk-F6TLUMH7.mjs";
@@ -201,10 +203,10 @@ import {
201
203
  appendMiddlewareDirectory,
202
204
  appendMiddlewareRoutePath,
203
205
  compareMiddlewareRouteLocations
204
- } from "./chunk-4HBKBHVP.mjs";
206
+ } from "./chunk-5ENW27SL.mjs";
205
207
  import {
206
208
  APIRouteManager
207
- } from "./chunk-WXHDVXJE.mjs";
209
+ } from "./chunk-KY32FWK7.mjs";
208
210
  import {
209
211
  readFarmI18nCatalogs
210
212
  } from "./chunk-DU4VHHPJ.mjs";
@@ -224,14 +226,14 @@ import {
224
226
  logger,
225
227
  toPosixPath,
226
228
  toViteModuleId
227
- } from "./chunk-2SVJGOAX.mjs";
229
+ } from "./chunk-Y3N5BFRJ.mjs";
228
230
  import {
229
231
  resolveFarmAPIServerBasePath,
230
232
  resolveFarmAPIServerRoutePath
231
233
  } from "./chunk-LM2YOGDK.mjs";
232
234
  import {
233
235
  FARM_VERSION
234
- } from "./chunk-2VCC3GVC.mjs";
236
+ } from "./chunk-EOSFVNXZ.mjs";
235
237
  import {
236
238
  getFarmPresetRuntime
237
239
  } from "./chunk-UAQD67HM.mjs";
@@ -1080,6 +1082,75 @@ function createFarmPrivateClientSourcemapsPlugin(options) {
1080
1082
  };
1081
1083
  }
1082
1084
 
1085
+ // src/middleware/static-config.ts
1086
+ function literalMatcher(node) {
1087
+ if (!node) return void 0;
1088
+ if (node.type === "Literal" && typeof node.value === "string") return node.value;
1089
+ if (node.type === "Literal" && node.regex)
1090
+ return new RegExp(node.regex.pattern, node.regex.flags);
1091
+ if (node.type === "TemplateLiteral" && node.expressions.length === 0) {
1092
+ return node.quasis[0]?.value?.cooked ?? void 0;
1093
+ }
1094
+ return void 0;
1095
+ }
1096
+ function literalMatchers(node) {
1097
+ const values = node.type === "ArrayExpression" ? node.elements : [node];
1098
+ const matchers = [];
1099
+ for (const value of values) {
1100
+ const matcher = literalMatcher(value);
1101
+ if (matcher === void 0) return void 0;
1102
+ matchers.push(matcher);
1103
+ }
1104
+ return matchers;
1105
+ }
1106
+ function unwrap(node) {
1107
+ while (node.type === "TSAsExpression" || node.type === "TSSatisfiesExpression" || node.type === "ParenthesizedExpression") {
1108
+ node = node.expression;
1109
+ }
1110
+ return node;
1111
+ }
1112
+ function readStaticMiddlewareConfig(program) {
1113
+ let found = null;
1114
+ for (const statement of program.body) {
1115
+ if (statement.type === "ExportNamedDeclaration" && !statement.declaration) {
1116
+ if (statement.specifiers.some((specifier) => specifier.exported?.name === "config")) {
1117
+ return "unknown";
1118
+ }
1119
+ continue;
1120
+ }
1121
+ const declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : null;
1122
+ if (!declaration || declaration.type !== "VariableDeclaration") continue;
1123
+ for (const declarator of declaration.declarations) {
1124
+ if (declarator.id?.type !== "Identifier" || declarator.id.name !== "config") continue;
1125
+ if (declaration.kind !== "const" || !declarator.init) return "unknown";
1126
+ const init = unwrap(declarator.init);
1127
+ if (init.type !== "ObjectExpression") return "unknown";
1128
+ const config = {};
1129
+ for (const property of init.properties) {
1130
+ if (property.type !== "Property" || property.computed) return "unknown";
1131
+ const key = property.key?.name ?? property.key?.value;
1132
+ if (key !== "matcher" && key !== "exclude") continue;
1133
+ const matchers = literalMatchers(unwrap(property.value));
1134
+ if (!matchers) return "unknown";
1135
+ if (key === "matcher") config.matcher = matchers;
1136
+ else config.exclude = matchers;
1137
+ }
1138
+ found = config;
1139
+ }
1140
+ }
1141
+ return found;
1142
+ }
1143
+ async function readMiddlewareFileConfig(filePath) {
1144
+ try {
1145
+ const [{ readFile }, vite] = await Promise.all([import("fs/promises"), import("vite")]);
1146
+ const parsed = vite.parseSync(filePath, await readFile(filePath, "utf8"));
1147
+ if (parsed.errors?.length) return "unknown";
1148
+ return readStaticMiddlewareConfig(parsed.program);
1149
+ } catch {
1150
+ return "unknown";
1151
+ }
1152
+ }
1153
+
1083
1154
  // src/nitro/universal-build.ts
1084
1155
  function preloadFarmNitroBuilder() {
1085
1156
  return import("nitro/builder").then(
@@ -1613,15 +1684,14 @@ function createServerChunkMinifyPlugin(options) {
1613
1684
  function trimSlashes(value) {
1614
1685
  return value.replace(/^\/+|\/+$/g, "");
1615
1686
  }
1616
- function resolveBuildDocsContentDir(config, root) {
1617
- if (!config.docs?.enabled) return null;
1618
- const configuredContentDir = config.docs.contentDir || config.docs.config.contentDir;
1687
+ function resolveBuildDocsContentDir(docs, root, srcDir) {
1688
+ const configuredContentDir = docs.contentDir || docs.config.contentDir;
1619
1689
  if (typeof configuredContentDir === "string" && configuredContentDir.trim()) {
1620
1690
  const contentDir = path10.isAbsolute(configuredContentDir) ? configuredContentDir : path10.join(root, configuredContentDir);
1621
1691
  return existsSync2(contentDir) ? contentDir : null;
1622
1692
  }
1623
- const entryDir = config.docs.config.entry || trimSlashes(config.docs.entry) || "docs";
1624
- const appDocsDir = path10.join(root, config.srcDir || "src", "app", entryDir);
1693
+ const entryDir = docs.config.entry || trimSlashes(docs.entry) || "docs";
1694
+ const appDocsDir = path10.join(root, srcDir || "src", "app", entryDir);
1625
1695
  if (existsSync2(appDocsDir)) return appDocsDir;
1626
1696
  const rootDocsDir = path10.join(root, entryDir);
1627
1697
  return existsSync2(rootDocsDir) ? rootDocsDir : null;
@@ -2143,9 +2213,12 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2143
2213
  const adapterOwnsDocsRuntime = Boolean(
2144
2214
  isReactRenderer(config.renderer) && config.docs?.enabled && config.docs.adapter?.server && config.docs.adapter.react
2145
2215
  );
2146
- const adapterDocsEntry = config.docs?.enabled ? `/${config.docs.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/" : null;
2147
- const isAdapterDocsRoute = (routePattern) => Boolean(
2148
- adapterOwnsDocsRuntime && adapterDocsEntry && (adapterDocsEntry === "/" || routePattern === adapterDocsEntry || routePattern.startsWith(`${adapterDocsEntry}/`))
2216
+ const docsEntries = config.docs?.enabled ? getFarmDocsRoots(config.docs).map(
2217
+ (docsRoot) => `/${docsRoot.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/"
2218
+ ) : [];
2219
+ const adapterDocsEntry = docsEntries[0] ?? null;
2220
+ const isAdapterDocsRoute = (routePattern) => adapterOwnsDocsRuntime && docsEntries.some(
2221
+ (docsEntry) => docsEntry === "/" || routePattern === docsEntry || routePattern.startsWith(`${docsEntry}/`)
2149
2222
  );
2150
2223
  const syntheticDocsEntry = config.docs?.enabled && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
2151
2224
  const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
@@ -2195,7 +2268,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2195
2268
  layoutAppliesToRoute
2196
2269
  );
2197
2270
  for (const layout of clientLayouts) {
2198
- const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || Boolean(adapterDocsEntry && layoutAppliesToRoute(layout.pattern, adapterDocsEntry));
2271
+ const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || docsEntries.some((docsEntry) => layoutAppliesToRoute(layout.pattern, docsEntry));
2199
2272
  if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
2200
2273
  logger.warn(`\u26A0\uFE0F ${describeSuppressedAsyncHydration(layout.pattern, layout.fallbackReason)}`);
2201
2274
  }
@@ -2303,7 +2376,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2303
2376
  srcDir,
2304
2377
  adapterOwnsDocsRuntime ? false : isFarmDocsSearchEnabled(config.docs),
2305
2378
  adapterOwnsDocsRuntime ? void 0 : resolveFarmDocsSearchClientModule(root),
2306
- config.docs?.enabled ? config.docs.entry : void 0,
2379
+ config.docs?.enabled ? getFarmDocsRoots(config.docs).map((docsRoot) => docsRoot.entry) : void 0,
2307
2380
  adapterOwnsDocsRuntime ? config.docs.adapter?.react : void 0,
2308
2381
  config.i18n,
2309
2382
  config.plugins,
@@ -2371,28 +2444,9 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2371
2444
  return "assets/[name]-h[hash][extname]";
2372
2445
  }
2373
2446
  },
2374
- // Externalize Node.js built-ins and server-side modules for client build
2447
+ // A browser cannot load a Node builtin: farmServerOnlyEntriesPlugin
2448
+ // resolves one to Farm's browser module for it instead.
2375
2449
  external: (id) => {
2376
- if (id.startsWith("node:") || [
2377
- "path",
2378
- "url",
2379
- "fs",
2380
- "fs/promises",
2381
- "os",
2382
- "crypto",
2383
- "http",
2384
- "https",
2385
- "net",
2386
- "stream",
2387
- "util",
2388
- "events",
2389
- "child_process",
2390
- "module",
2391
- "tty",
2392
- "dns"
2393
- ].includes(id)) {
2394
- return true;
2395
- }
2396
2450
  if (id === "fsevents" || id.includes("fsevents") || id.endsWith(".node")) {
2397
2451
  return true;
2398
2452
  }
@@ -3355,6 +3409,14 @@ function countFarmKeptLayouts(request, layouts, params) {
3355
3409
  // browser's chain starts at the next layout.
3356
3410
  return keys.length > 1 ? 1 + getSharedLayoutPrefixLength(chain, keys.slice(1)) : 0;
3357
3411
  }
3412
+ `;
3413
+ var FARM_DOCUMENT_PARSED_RUNTIME = `function farmDocumentParsed() {
3414
+ if (document.readyState !== "loading") return Promise.resolve();
3415
+ return new Promise(function(resolve) {
3416
+ document.addEventListener("DOMContentLoaded", function() { resolve(); }, { once: true });
3417
+ });
3418
+ }
3419
+
3358
3420
  `;
3359
3421
  function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlots, root, srcDir, docsSearchEnabled, docsSearchModuleId, docsEntryPath, docsAdapterReact, i18nConfig = {
3360
3422
  enabled: false,
@@ -3447,8 +3509,18 @@ function isFarmLocaleDocumentChange() {
3447
3509
  return false;
3448
3510
  }
3449
3511
  `;
3450
- const docsNavigationRuntime = docsEntryPath ? `
3451
- const farmDocsEntryPath = ${JSON.stringify(docsEntryPath)};
3512
+ const docsEntryPaths = typeof docsEntryPath === "string" ? [docsEntryPath] : docsEntryPath ?? [];
3513
+ const docsNavigationRuntime = docsEntryPaths.length > 1 ? `
3514
+ const farmDocsEntryPaths = ${JSON.stringify(docsEntryPaths)};
3515
+ function isFarmDocsPath(pathname) {
3516
+ const routePathname = getFarmRoutePathname(pathname);
3517
+ const normalizedPath = routePathname.length > 1 ? routePathname.replace(/\\/+$/, "") : routePathname;
3518
+ return farmDocsEntryPaths.some(
3519
+ (entryPath) => normalizedPath === entryPath || normalizedPath.startsWith(entryPath + "/"),
3520
+ );
3521
+ }
3522
+ ` : docsEntryPaths[0] ? `
3523
+ const farmDocsEntryPath = ${JSON.stringify(docsEntryPaths[0])};
3452
3524
  function isFarmDocsPath(pathname) {
3453
3525
  const routePathname = getFarmRoutePathname(pathname);
3454
3526
  const normalizedPath = routePathname.length > 1 ? routePathname.replace(/\\/+$/, "") : routePathname;
@@ -3715,7 +3787,7 @@ void farmClientRuntime.start();
3715
3787
  spaRouter.initializeHistory();
3716
3788
  window.__FARM_SPA_ROUTER__ = spaRouter;
3717
3789
 
3718
- ${islandValues ? "void farmDocumentParsed().then(hydrateFarmDocsAdapterRuntime);" : "void hydrateFarmDocsAdapterRuntime();"}
3790
+ ${islandValues ? `${FARM_DOCUMENT_PARSED_RUNTIME}void farmDocumentParsed().then(hydrateFarmDocsAdapterRuntime);` : "void hydrateFarmDocsAdapterRuntime();"}
3719
3791
 
3720
3792
  window.addEventListener("beforeunload", function(event) {
3721
3793
  if (spaRouter.shouldBlockUnload()) {
@@ -3842,7 +3914,7 @@ ${layoutImports}
3842
3914
  ${rendererClientImports}
3843
3915
  ${isolatedHydrationImport}
3844
3916
  ${providerClientCode.imports}
3845
- import { createClientCancellation, createClientPluginManager, getFarmIslandValueHeaders, getHashTargetElement, installChunkErrorRecovery, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, reconcileFarmDocumentHead, runFarmNavigationDelegates, scheduleFarmIslandHydration, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
3917
+ import { createClientCancellation, createClientPluginManager, getFarmIslandValueHeaders, getHashTargetElement, installChunkErrorRecovery, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, reconcileFarmDocumentHead, runFarmNavigationDelegates, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
3846
3918
  import { createFarmDeploymentMismatchError, createFarmDeploymentRequestHeaders, isFarmDeploymentMismatchResponse } from "@farm.js/core/deployment";
3847
3919
  import { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";
3848
3920
  ${clientPluginEntry.imports}
@@ -4029,7 +4101,7 @@ async function createMatchedHydrationRoute(matched, pathname, searchParams, serv
4029
4101
  if (!serverProps || serverProps.__farmRoutePropsResolved !== true) return null;
4030
4102
  const props = {
4031
4103
  ...reviveServerPageProps(serverProps),
4032
- searchParams: Promise.resolve(serverProps.search ?? searchParams),
4104
+ searchParams: createFarmSearchParams(serverProps.search ?? searchParams),
4033
4105
  };
4034
4106
  pageElement = React.createElement(Component, props);
4035
4107
  } else if (typeof Component === "function" && Component.constructor && Component.constructor.name === "AsyncFunction") {
@@ -4044,7 +4116,7 @@ async function createMatchedHydrationRoute(matched, pathname, searchParams, serv
4044
4116
  const props = {
4045
4117
  ...reviveServerPageProps(serverProps),
4046
4118
  params: params,
4047
- searchParams: Promise.resolve(searchParams),
4119
+ searchParams: createFarmSearchParams(searchParams),
4048
4120
  };
4049
4121
  pageElement = React.createElement(Component, props);
4050
4122
  }
@@ -4290,16 +4362,7 @@ function resetReactRoot() {
4290
4362
  isHydrated = false;
4291
4363
  }
4292
4364
 
4293
- ${islandValues ? `// Islands mode starts the client while the body streams (an async entry): a page of islands
4294
- // hydrates them as they arrive; anything else waits for the whole document.
4295
- function farmDocumentParsed() {
4296
- if (document.readyState !== "loading") return Promise.resolve();
4297
- return new Promise(function(resolve) {
4298
- document.addEventListener("DOMContentLoaded", function() { resolve(); }, { once: true });
4299
- });
4300
- }
4301
-
4302
- ` : ""}// Hydrate client components
4365
+ ${islandValues ? FARM_DOCUMENT_PARSED_RUNTIME : ""}// Hydrate client components
4303
4366
  async function hydrate() {
4304
4367
  await window.__FARM_PPR_REFRESH_PROMISE__;
4305
4368
  // A PPR refresh that is still retrying must not replace DOM once hydration starts.
@@ -4703,7 +4766,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
4703
4766
  if (!this.isCurrentNavigation(navigation, clientNavigation)) return;
4704
4767
  const params = matched.params;
4705
4768
  const searchParams = searchParamsToObject(url.searchParams);
4706
- const props = { params: params, searchParams: Promise.resolve(searchParams) };
4769
+ const props = { params: params, searchParams: createFarmSearchParams(searchParams) };
4707
4770
  let pageElement = React.createElement(Component, props);
4708
4771
  if (hasHydratableLayout(pathname)) {
4709
4772
  pageElement = createLayoutPageBoundary(matched.route, pageElement);
@@ -5240,7 +5303,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5240
5303
  srcDir: config.srcDir,
5241
5304
  clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
5242
5305
  fontStylesheetHref: "/farm-fonts.css",
5243
- globalStylesheetHref: "/assets/globals.css"
5306
+ globalStylesheetHref: FARM_CLIENT_CSS_HREF_PLACEHOLDER
5244
5307
  }) : await (async () => {
5245
5308
  const guardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
5246
5309
  return compileFarmDocsManifest(config.docs, {
@@ -5249,7 +5312,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5249
5312
  clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
5250
5313
  fontAssets: toFarmDocsPublicFontAssets(resolveFarmDocsFontAssets(root)),
5251
5314
  fontStylesheetHref: "/farm-fonts.css",
5252
- globalStylesheetHref: "/assets/globals.css",
5315
+ globalStylesheetHref: FARM_CLIENT_CSS_HREF_PLACEHOLDER,
5253
5316
  isPathGuarded: (pathname) => guardedPaths.has(pathname)
5254
5317
  });
5255
5318
  })()
@@ -5503,15 +5566,14 @@ function readFarmPageLastModified(pageRoutes) {
5503
5566
  }
5504
5567
  function getFarmDocsGuardedPaths(config, middlewareRoutes) {
5505
5568
  if (!config.docs?.enabled) return [];
5506
- const contentDir = resolveFarmDocsContentDir(config.docs, {
5507
- root: config.root,
5508
- srcDir: config.srcDir
5509
- });
5569
+ const options = { root: config.root, srcDir: config.srcDir };
5510
5570
  const guards = {
5511
5571
  config: { middleware: config.middleware, integrations: config.integrations },
5512
5572
  middlewareRoutes
5513
5573
  };
5514
- return discoverFarmDocsPages(contentDir, config.docs).flatMap((page) => [page.href, getFarmDocsMarkdownPath(page.href)]).filter((pathname) => farmPathGuardCoversPage(guards, pathname));
5574
+ return getFarmDocsRoots(config.docs).flatMap(
5575
+ (docsRoot) => discoverFarmDocsPages(resolveFarmDocsContentDir(docsRoot, options), docsRoot)
5576
+ ).flatMap((page) => [page.href, getFarmDocsMarkdownPath(page.href)]).filter((pathname) => farmPathGuardCoversPage(guards, pathname));
5515
5577
  }
5516
5578
  function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
5517
5579
  const llmsTxt = agent?.llmsTxt;
@@ -5525,10 +5587,34 @@ function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
5525
5587
  ...agent?.crawlers?.enabled || ownedByFile("robots") ? ["/robots.txt"] : []
5526
5588
  ];
5527
5589
  }
5590
+ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
5591
+ const runtimeConfig = (root) => `{
5592
+ ${docsConfigModulePath ? `...getFarmDocsConfigModuleRoot(farmDocsConfigModule.default || farmDocsConfigModule, ${root}.entry),
5593
+ ...${root}.configOverrides,` : `...${root}.config,`}
5594
+ entry: ${root}.config?.entry || String(${root}.entry || "/docs").replace(/^\\/+|\\/+$/g, "") || "docs",
5595
+ docsPath: ${root}.entry,
5596
+ contentDir: ${root}.contentDir || ${root}.config?.contentDir,
5597
+ }`;
5598
+ if (docs?.roots?.length) {
5599
+ return {
5600
+ factory: "createFarmDocsAdapterMultiRuntimeHandler",
5601
+ config: `[farmDocsResolvedConfig, ...farmDocsResolvedConfig.roots].map((farmDocsRoot) => (${runtimeConfig("farmDocsRoot")}))`
5602
+ };
5603
+ }
5604
+ return {
5605
+ factory: "createFarmDocsAdapterRuntimeHandler",
5606
+ config: runtimeConfig("farmDocsResolvedConfig")
5607
+ };
5608
+ }
5528
5609
  function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
5529
5610
  if (!docs.enabled) return "null";
5530
- const baseConfig = {
5611
+ const serializableDocs = docs.roots?.length ? {
5531
5612
  ...docs,
5613
+ // React elements and functions do not survive JSON; see runtimeConfig below.
5614
+ roots: docs.roots.map((docsRoot) => ({ ...docsRoot, runtimeConfig: void 0 }))
5615
+ } : docs;
5616
+ const baseConfig = {
5617
+ ...serializableDocs,
5532
5618
  contentDir: void 0,
5533
5619
  ...precompiled ? { configPath: void 0 } : {},
5534
5620
  config: void 0,
@@ -5546,7 +5632,7 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
5546
5632
  config: nestedConfig
5547
5633
  });
5548
5634
  }
5549
- return `farmDocsBundledContentDir
5635
+ const expression = `farmDocsBundledContentDir
5550
5636
  ? {
5551
5637
  ...${JSON.stringify(baseConfig)},
5552
5638
  contentDir: farmDocsBundledContentDir,
@@ -5555,7 +5641,19 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
5555
5641
  contentDir: farmDocsBundledContentDir,
5556
5642
  },
5557
5643
  }
5558
- : ${JSON.stringify({ ...docs, runtimeConfig: void 0 })}`;
5644
+ : ${JSON.stringify({ ...serializableDocs, runtimeConfig: void 0 })}`;
5645
+ if (!docs.roots?.length) return expression;
5646
+ return `((farmDocs) => ({
5647
+ ...farmDocs,
5648
+ roots: farmDocs.roots.map((farmDocsRoot, index) => {
5649
+ const contentDir = farmDocsBundledRootsDir
5650
+ ? farmDocsJoin(farmDocsBundledRootsDir, String(index))
5651
+ : null;
5652
+ return contentDir && farmDocsExistsSync(contentDir)
5653
+ ? { ...farmDocsRoot, contentDir, config: { ...farmDocsRoot.config, contentDir } }
5654
+ : farmDocsRoot;
5655
+ }),
5656
+ }))(${expression})`;
5559
5657
  }
5560
5658
  function toVirtualEntryImportSpecifier(modulePath) {
5561
5659
  return JSON.stringify(modulePath.replace(/\\/g, "/"));
@@ -5870,7 +5968,13 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
5870
5968
  const adapterOwnsDocsRuntime = Boolean(
5871
5969
  isReactRenderer(config.renderer) && config.docs?.enabled && config.docs.adapter?.server && config.docs.adapter.react
5872
5970
  );
5971
+ if (config.docs?.enabled && config.docs.roots?.length && !adapterOwnsDocsRuntime) {
5972
+ throw new Error(
5973
+ "Several docs roots need the docs adapter, which serves the React renderer only; Farm's built-in docs renderer serves a single docs root."
5974
+ );
5975
+ }
5873
5976
  const docsConfigModulePath = adapterOwnsDocsRuntime && !hasPrecompiledDocs && config.docs.configPath && !config.docs.configPath.endsWith(".json") ? config.docs.configPath : void 0;
5977
+ const adapterHandler = generateFarmDocsAdapterHandlerArguments(config.docs, docsConfigModulePath);
5874
5978
  const hasIsolatedClientGraphRuntime = isReactRenderer(config.renderer) && isolatedClientBoundaryModules.size > 0;
5875
5979
  const rendererStreamingCapabilities = getFarmRendererStreamingCapabilitiesForRuntime(
5876
5980
  config.renderer,
@@ -6267,7 +6371,9 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6267
6371
  resolveFarmInstrumentationRuntime,
6268
6372
  resolveFarmPreviewDeployment,
6269
6373
  resolveFarmWebRequestOrigin,
6374
+ fetchFarmExternalRewrite,
6270
6375
  runWithFarmRequestSpan,
6376
+ createFarmSearchParams,
6271
6377
  searchParamsToObject,
6272
6378
  setFarmBasePath,
6273
6379
  setFarmTrailingSlashPreference,
@@ -6297,8 +6403,8 @@ const isFarmDocsAPIRequest = (requestOrPathname) => {
6297
6403
  : new URL(requestOrPathname.url).pathname;
6298
6404
  const apiPath = ${JSON.stringify(farmDocsPrecompiledManifest?.apiPath || "/api/docs")};
6299
6405
  return pathname === apiPath || pathname.startsWith(apiPath + "/");
6300
- };` : adapterOwnsDocsRuntime ? `import { isFarmDocsAPIRequest } from "@farm.js/core/docs";
6301
- import { createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler } from ${JSON.stringify(config.docs.adapter.server)};
6406
+ };` : adapterOwnsDocsRuntime ? `import { ${docsConfigModulePath ? "getFarmDocsConfigModuleRoot, " : ""}isFarmDocsAPIRequest } from "@farm.js/core/docs";
6407
+ import { ${config.docs.roots?.length ? "createFarmDocsMultiRuntimeHandler as createFarmDocsAdapterMultiRuntimeHandler" : "createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler"} } from ${JSON.stringify(config.docs.adapter.server)};
6302
6408
  import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
6303
6409
  import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
6304
6410
  const docsFontImport = config.docs?.enabled && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
@@ -6716,7 +6822,20 @@ const farmDocsBundledContentDir = ${config.docs?.enabled && !hasPrecompiledDocs
6716
6822
  } catch {
6717
6823
  return null;
6718
6824
  }
6719
- })()` : "null"};
6825
+ })()` : "null"};${config.docs?.enabled && !hasPrecompiledDocs && config.docs.roots?.length ? `
6826
+ const farmDocsBundledRootsDir = (() => {
6827
+ try {
6828
+ const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
6829
+ const candidates = [
6830
+ farmDocsJoin(currentDir, "farm-docs-roots"),
6831
+ farmDocsJoin(currentDir, "..", "farm-docs-roots"),
6832
+ farmDocsJoin(currentDir, "..", "..", "farm-docs-roots"),
6833
+ ];
6834
+ return candidates.find((candidate) => farmDocsExistsSync(candidate)) || null;
6835
+ } catch {
6836
+ return null;
6837
+ }
6838
+ })();` : ""}
6720
6839
  const farmDocsResolvedConfig = ${generateFarmDocsRuntimeConfigExpression(config.docs, hasPrecompiledDocs)};
6721
6840
  const farmDocsRuntimeRoot = ${hasPrecompiledDocs ? '"."' : `farmDocsBundledContentDir || ${JSON.stringify(config.root)}`};
6722
6841
  // Docs pages a path-specific guard covers, decided at build time. The docs API and the
@@ -6754,12 +6873,7 @@ const farmDocsModulePreloadPaths = farmDocsModulePreloads
6754
6873
  ),
6755
6874
  }
6756
6875
  : undefined;
6757
- const farmDocsHandler = ${config.docs?.enabled ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `createFarmDocsAdapterRuntimeHandler({
6758
- ${docsConfigModulePath ? "...(farmDocsConfigModule.default || farmDocsConfigModule),\n ...farmDocsResolvedConfig.configOverrides," : "...farmDocsResolvedConfig.config,"}
6759
- entry: farmDocsResolvedConfig.config?.entry || String(farmDocsResolvedConfig.entry || "/docs").replace(/^\\/+|\\/+$/g, "") || "docs",
6760
- docsPath: farmDocsResolvedConfig.entry,
6761
- contentDir: farmDocsResolvedConfig.contentDir || farmDocsResolvedConfig.config?.contentDir,
6762
- }, {
6876
+ const farmDocsHandler = ${config.docs?.enabled ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {
6763
6877
  rootDir: farmDocsRuntimeRoot,
6764
6878
  // A production build's content cannot change, so the adapter reads its
6765
6879
  // navigation once instead of scanning the content directory per request.
@@ -6788,7 +6902,8 @@ const farmDocsHandler = ${config.docs?.enabled ? hasPrecompiledDocs ? "farmDocsP
6788
6902
  getApplicableLayouts(getFarmRoutePathname(pathname)).map((layout) => layout.module),
6789
6903
  ),
6790
6904
  fontStylesheetHref: "/farm-fonts.css",
6791
- globalStylesheetHref: "/assets/globals.css",
6905
+ // The client stylesheet carries globals.css under a content-hashed name.
6906
+ globalStylesheetHref: ${JSON.stringify(FARM_CLIENT_CSS_HREF_PLACEHOLDER)},
6792
6907
  isPathGuarded: isFarmDocsPathGuarded,
6793
6908
  })` : "null"};
6794
6909
  const farmDocsAPIHandler = ${config.docs?.enabled ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded })` : "null"};
@@ -7853,7 +7968,7 @@ async function handleMetadataImageRequest(request, routePathname) {
7853
7968
  const searchParams = searchParamsToObject(url.searchParams);
7854
7969
  const props = {
7855
7970
  params: match.params,
7856
- searchParams: Promise.resolve(searchParams),
7971
+ searchParams: createFarmSearchParams(searchParams),
7857
7972
  path: match.pagePath,
7858
7973
  };
7859
7974
  const value = typeof imageModule.default === "function"
@@ -8410,7 +8525,7 @@ const farmBuiltInRoutePaths = new Set(${JSON.stringify(
8410
8525
  )});
8411
8526
  ${config.docs?.enabled ? `const farmDocsRouteLabelInput = {
8412
8527
  path: normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs"),
8413
- apiPath: ${JSON.stringify(farmDocsPrecompiledManifest?.apiPath || "/api/docs")},
8528
+ apiPath: ${JSON.stringify(farmDocsPrecompiledManifest?.apiPath || "/api/docs")},${config.docs.roots?.length ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}
8414
8529
  };
8415
8530
  ` : ""}// The request's route payload, for a handler that learns what answered while it handles.
8416
8531
  const farmRouteLabelSlot = Symbol("farm.route.label.slot");
@@ -8785,7 +8900,7 @@ async function resolveFarmRequestInContext(
8785
8900
  if (rewriteDestination) {
8786
8901
  let rewrittenRequest = createRewrittenRequest(request, rewriteDestination);
8787
8902
  if (new URL(rewrittenRequest.url).origin !== url.origin) {
8788
- return globalThis.fetch(rewrittenRequest);
8903
+ return fetchFarmExternalRewrite(rewrittenRequest);
8789
8904
  }
8790
8905
  if (farmPluginRuntime) {
8791
8906
  // Plugin guards ran on the requested URL. Re-run only runtime.before
@@ -9317,7 +9432,7 @@ ${hasServerRuntimeIntegrations ? `
9317
9432
  const rawPageProps = withFarmRouteContext(
9318
9433
  {
9319
9434
  params,
9320
- searchParams: Promise.resolve(searchParamsObj),
9435
+ searchParams: createFarmSearchParams(searchParamsObj),
9321
9436
  path: pathname,
9322
9437
  ...(middlewareData?.size ? { middleware: { data: middlewareData } } : {}),
9323
9438
  },
@@ -9358,7 +9473,7 @@ ${hasServerRuntimeIntegrations ? `
9358
9473
  ...rawPageProps,
9359
9474
  params: parsedParams,
9360
9475
  search: parsedSearch,
9361
- searchParams: Promise.resolve(parsedSearch),
9476
+ searchParams: createFarmSearchParams(parsedSearch),
9362
9477
  };
9363
9478
  })();
9364
9479
  if (
@@ -9377,7 +9492,7 @@ ${hasServerRuntimeIntegrations ? `
9377
9492
  const routeStateProps = {
9378
9493
  ...rawPageProps,
9379
9494
  search: searchParamsObj,
9380
- searchParams: Promise.resolve(searchParamsObj),
9495
+ searchParams: createFarmSearchParams(searchParamsObj),
9381
9496
  error: routeStateError,
9382
9497
  };
9383
9498
  if (isFarmNotFoundError(routeStateError) && routeComponents?.notFound) {
@@ -9406,7 +9521,7 @@ ${hasServerRuntimeIntegrations ? `
9406
9521
  const rawSlotProps = withFarmRouteContext(
9407
9522
  {
9408
9523
  params: slot.params,
9409
- searchParams: Promise.resolve(searchParamsObj),
9524
+ searchParams: createFarmSearchParams(searchParamsObj),
9410
9525
  path: pathname,
9411
9526
  ...(middlewareData?.size ? { middleware: { data: middlewareData } } : {}),
9412
9527
  },
@@ -9433,7 +9548,7 @@ ${hasServerRuntimeIntegrations ? `
9433
9548
  search: slotSchemas.search?.parse
9434
9549
  ? slotSchemas.search.parse(searchParamsObj)
9435
9550
  : searchParamsObj,
9436
- searchParams: Promise.resolve(
9551
+ searchParams: createFarmSearchParams(
9437
9552
  slotSchemas.search?.parse
9438
9553
  ? slotSchemas.search.parse(searchParamsObj)
9439
9554
  : searchParamsObj,
@@ -10097,7 +10212,7 @@ ${hasServerRuntimeIntegrations ? `
10097
10212
  reset: function() {},
10098
10213
  params,
10099
10214
  search: searchParamsObj,
10100
- searchParams: Promise.resolve(searchParamsObj),
10215
+ searchParams: createFarmSearchParams(searchParamsObj),
10101
10216
  path: pathname,
10102
10217
  ...(middlewareData?.size ? { middleware: { data: middlewareData } } : {}),
10103
10218
  });
@@ -10619,6 +10734,29 @@ function getPhysicalPrerenderBypassReason(options) {
10619
10734
  }
10620
10735
  return void 0;
10621
10736
  }
10737
+ async function getFarmDocsPrerenderPages(config, root, preset) {
10738
+ if (!config.docs?.enabled || !config.docs.prerender) return [];
10739
+ if (!isReactRenderer(config.renderer) || !hasFarmDocsRuntimeAdapter(config.docs)) {
10740
+ logger.warn(
10741
+ "docs.prerender needs a docs adapter such as @farming-labs/farmjs; Farm's built-in docs renderer keeps rendering docs pages on request."
10742
+ );
10743
+ return [];
10744
+ }
10745
+ if (getFarmPresetRuntime(preset) === "edge") {
10746
+ logger.info(
10747
+ `\u21AA Keeping docs pages in the edge docs snapshot: docs.prerender writes static files on Node and serverless targets, not "${preset}".`
10748
+ );
10749
+ return [];
10750
+ }
10751
+ const pages = await listFarmDocsAdapterPages(config.docs, { root, srcDir: config.srcDir });
10752
+ if (!pages) {
10753
+ logger.warn(
10754
+ `The docs adapter ${JSON.stringify(config.docs.adapter.id)} does not list its pages for prerendering; upgrade it to prerender docs pages. They render on request until then.`
10755
+ );
10756
+ return [];
10757
+ }
10758
+ return pages;
10759
+ }
10622
10760
  function hasFarmNitroCacheRouteRule(routeRules) {
10623
10761
  return Object.values(routeRules || {}).some((rule) => {
10624
10762
  const swr = rule?.swr;
@@ -10660,12 +10798,19 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
10660
10798
  const ssgCollectionPromise = routeManager.collectSSGPages();
10661
10799
  const middlewareRoutesPromise = discoverMiddlewareRoutes(getFarmAppDirectories(config));
10662
10800
  const configuredResponseRoutesPromise = Promise.all([config.redirects(), config.rewrites()]);
10801
+ const docsPrerenderPagesPromise = getFarmDocsPrerenderPages(config, root, preset);
10663
10802
  const farmWorkflows = await prepareFarmWorkflowsForNitro(config);
10664
10803
  const farmCron = await prepareFarmCronForNitro(config);
10665
- const [{ ssg: ssgPages }, middlewareRoutes, [configuredRedirects, configuredRewrites]] = await Promise.all([
10804
+ const [
10805
+ { ssg: ssgPages },
10806
+ middlewareRoutes,
10807
+ [configuredRedirects, configuredRewrites],
10808
+ docsPrerenderPages
10809
+ ] = await Promise.all([
10666
10810
  ssgCollectionPromise,
10667
10811
  middlewareRoutesPromise,
10668
- configuredResponseRoutesPromise
10812
+ configuredResponseRoutesPromise,
10813
+ docsPrerenderPagesPromise
10669
10814
  ]);
10670
10815
  const redirectSources = [
10671
10816
  ...routeManager.getRedirects().map((route) => route.source),
@@ -10674,12 +10819,18 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
10674
10819
  const rewriteSources = configuredRewrites.map((route) => route.source);
10675
10820
  const prerenderRoutes = [];
10676
10821
  const skippedPrerenderRoutes = [];
10822
+ const middlewareRoutesWithConfig = ssgPages.length > 0 || docsPrerenderPages.length > 0 ? await Promise.all(
10823
+ middlewareRoutes.map(async (route) => ({
10824
+ ...route,
10825
+ config: await readMiddlewareFileConfig(route.filePath)
10826
+ }))
10827
+ ) : middlewareRoutes;
10677
10828
  for (const page of ssgPages) {
10678
10829
  if (page.revalidate !== void 0) continue;
10679
10830
  if (prerenderRoutes.includes(page.urlPath)) continue;
10680
10831
  const reason = getPhysicalPrerenderBypassReason({
10681
10832
  config,
10682
- middlewareRoutes,
10833
+ middlewareRoutes: middlewareRoutesWithConfig,
10683
10834
  routeRuntimeManifest,
10684
10835
  redirectSources,
10685
10836
  rewriteSources,
@@ -10691,6 +10842,26 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
10691
10842
  }
10692
10843
  prerenderRoutes.push(page.urlPath);
10693
10844
  }
10845
+ const docsRouteRuntimeManifest = {
10846
+ ...routeRuntimeManifest,
10847
+ routes: routeRuntimeManifest.routes.filter((entry) => entry.kind !== "page")
10848
+ };
10849
+ for (const pathname of docsPrerenderPages) {
10850
+ if (prerenderRoutes.includes(pathname)) continue;
10851
+ const reason = getPhysicalPrerenderBypassReason({
10852
+ config,
10853
+ middlewareRoutes: middlewareRoutesWithConfig,
10854
+ routeRuntimeManifest: docsRouteRuntimeManifest,
10855
+ redirectSources,
10856
+ rewriteSources,
10857
+ pathname
10858
+ });
10859
+ if (reason) {
10860
+ skippedPrerenderRoutes.push({ pathname, reason });
10861
+ continue;
10862
+ }
10863
+ prerenderRoutes.push(pathname);
10864
+ }
10694
10865
  for (const skipped of skippedPrerenderRoutes) {
10695
10866
  logger.info(`\u21AA Keeping SSG route ${skipped.pathname} server-handled (${skipped.reason})`);
10696
10867
  }
@@ -11424,9 +11595,28 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
11424
11595
  logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
11425
11596
  }
11426
11597
  async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
11427
- const docsContentDir = resolveBuildDocsContentDir(config, root);
11598
+ if (!config.docs?.enabled) return;
11599
+ const [mainRoot, ...extraRoots] = getFarmDocsRoots(config.docs);
11600
+ await copyFarmDocsRootContent(
11601
+ mainRoot,
11602
+ root,
11603
+ config.srcDir,
11604
+ path10.join(nitroFuncDir, "farm-docs-content"),
11605
+ fs4
11606
+ );
11607
+ for (const [index, docsRoot] of extraRoots.entries()) {
11608
+ await copyFarmDocsRootContent(
11609
+ docsRoot,
11610
+ root,
11611
+ config.srcDir,
11612
+ path10.join(nitroFuncDir, "farm-docs-roots", String(index)),
11613
+ fs4
11614
+ );
11615
+ }
11616
+ }
11617
+ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs4) {
11618
+ const docsContentDir = resolveBuildDocsContentDir(docs, root, srcDir);
11428
11619
  if (!docsContentDir) return;
11429
- const bundledContentDir = path10.join(nitroFuncDir, "farm-docs-content");
11430
11620
  const lastModifiedManifest = createFarmDocsLastModifiedManifest(docsContentDir, {
11431
11621
  fallback: "now"
11432
11622
  });
@@ -12063,7 +12253,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
12063
12253
  }
12064
12254
  async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
12065
12255
  const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
12066
- import("./nitro-2Q5NVY7L.mjs"),
12256
+ import("./nitro-R444AF3O.mjs"),
12067
12257
  import("nitro/builder")
12068
12258
  ]);
12069
12259
  let nitroConfig = await createNitroConfig(