@farm.js/core 0.1.0-beta.6 → 0.1.0-beta.8

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 (447) hide show
  1. package/dist/after.cjs +227 -0
  2. package/dist/after.cjs.map +1 -0
  3. package/dist/after.d.mts +25 -0
  4. package/dist/after.d.ts +25 -0
  5. package/dist/after.mjs +14 -0
  6. package/dist/after.mjs.map +1 -0
  7. package/dist/agent-runtime.cjs +2379 -0
  8. package/dist/agent-runtime.cjs.map +1 -0
  9. package/dist/agent-runtime.d.mts +94 -0
  10. package/dist/agent-runtime.d.ts +94 -0
  11. package/dist/agent-runtime.mjs +479 -0
  12. package/dist/agent-runtime.mjs.map +1 -0
  13. package/dist/api/route-manager.d.mts +66 -0
  14. package/dist/api/route-manager.d.ts +66 -0
  15. package/dist/api/runtime.d.mts +3 -0
  16. package/dist/api/runtime.d.ts +3 -0
  17. package/dist/api.cjs +4100 -0
  18. package/dist/api.cjs.map +1 -0
  19. package/dist/api.d.mts +48 -0
  20. package/dist/api.d.ts +48 -0
  21. package/dist/api.mjs +93 -0
  22. package/dist/api.mjs.map +1 -0
  23. package/dist/app-BWtqQu3R.d.mts +302 -0
  24. package/dist/app-markdown.cjs +244 -0
  25. package/dist/app-markdown.cjs.map +1 -0
  26. package/dist/app-markdown.d.mts +22 -0
  27. package/dist/app-markdown.d.ts +22 -0
  28. package/dist/app-markdown.mjs +27 -0
  29. package/dist/app-markdown.mjs.map +1 -0
  30. package/dist/app-xltejvLY.d.ts +302 -0
  31. package/dist/cache.cjs +945 -0
  32. package/dist/cache.cjs.map +1 -0
  33. package/dist/cache.d.mts +192 -0
  34. package/dist/cache.d.ts +192 -0
  35. package/dist/cache.mjs +46 -0
  36. package/dist/cache.mjs.map +1 -0
  37. package/dist/chunk-2ED5Q2GH.mjs +422 -0
  38. package/dist/chunk-2ED5Q2GH.mjs.map +1 -0
  39. package/dist/chunk-32W4QEJP.mjs +158 -0
  40. package/dist/chunk-32W4QEJP.mjs.map +1 -0
  41. package/dist/chunk-3XNTL3FQ.mjs +452 -0
  42. package/dist/chunk-3XNTL3FQ.mjs.map +1 -0
  43. package/dist/chunk-44ZCFSKE.mjs +84 -0
  44. package/dist/chunk-44ZCFSKE.mjs.map +1 -0
  45. package/dist/chunk-4MGVSBRP.mjs +7787 -0
  46. package/dist/chunk-4MGVSBRP.mjs.map +1 -0
  47. package/dist/chunk-4S3ORGFA.mjs +44 -0
  48. package/dist/chunk-4S3ORGFA.mjs.map +1 -0
  49. package/dist/chunk-5BY76U2M.mjs +1 -0
  50. package/dist/chunk-5BY76U2M.mjs.map +1 -0
  51. package/dist/chunk-5ZGPRGWV.mjs +136 -0
  52. package/dist/chunk-5ZGPRGWV.mjs.map +1 -0
  53. package/dist/chunk-65A7QIKI.mjs +142 -0
  54. package/dist/chunk-65A7QIKI.mjs.map +1 -0
  55. package/dist/chunk-74YTBPTY.mjs +450 -0
  56. package/dist/chunk-74YTBPTY.mjs.map +1 -0
  57. package/dist/chunk-7FBJLMQH.mjs +338 -0
  58. package/dist/chunk-7FBJLMQH.mjs.map +1 -0
  59. package/dist/chunk-7HO6AEOP.mjs +74 -0
  60. package/dist/chunk-7HO6AEOP.mjs.map +1 -0
  61. package/dist/chunk-7MABZJIM.mjs +29 -0
  62. package/dist/chunk-7MABZJIM.mjs.map +1 -0
  63. package/dist/chunk-7N62DNSO.mjs +41 -0
  64. package/dist/chunk-7N62DNSO.mjs.map +1 -0
  65. package/dist/chunk-7ZY5AIJO.mjs +161 -0
  66. package/dist/chunk-7ZY5AIJO.mjs.map +1 -0
  67. package/dist/chunk-ALCLXXTY.mjs +187 -0
  68. package/dist/chunk-ALCLXXTY.mjs.map +1 -0
  69. package/dist/chunk-AZ7YUVNR.mjs +65 -0
  70. package/dist/chunk-AZ7YUVNR.mjs.map +1 -0
  71. package/dist/chunk-B232I2GP.mjs +163 -0
  72. package/dist/chunk-B232I2GP.mjs.map +1 -0
  73. package/dist/chunk-B4W3BNTL.mjs +483 -0
  74. package/dist/chunk-B4W3BNTL.mjs.map +1 -0
  75. package/dist/chunk-C2ROET2V.mjs +718 -0
  76. package/dist/chunk-C2ROET2V.mjs.map +1 -0
  77. package/dist/chunk-CGILA3WO.mjs +14 -0
  78. package/dist/chunk-CGILA3WO.mjs.map +1 -0
  79. package/dist/chunk-CGIXMLSY.mjs +184 -0
  80. package/dist/chunk-CGIXMLSY.mjs.map +1 -0
  81. package/dist/chunk-DJSGLHCN.mjs +597 -0
  82. package/dist/chunk-DJSGLHCN.mjs.map +1 -0
  83. package/dist/chunk-E2MPIBRE.mjs +149 -0
  84. package/dist/chunk-E2MPIBRE.mjs.map +1 -0
  85. package/dist/chunk-E6EPN5BT.mjs +203 -0
  86. package/dist/chunk-E6EPN5BT.mjs.map +1 -0
  87. package/dist/chunk-EI43C4RA.mjs +6277 -0
  88. package/dist/chunk-EI43C4RA.mjs.map +1 -0
  89. package/dist/chunk-EJ7T4TPB.mjs +622 -0
  90. package/dist/chunk-EJ7T4TPB.mjs.map +1 -0
  91. package/dist/chunk-FQYDHKKU.mjs +128 -0
  92. package/dist/chunk-FQYDHKKU.mjs.map +1 -0
  93. package/dist/chunk-FRPWCMMG.mjs +299 -0
  94. package/dist/chunk-FRPWCMMG.mjs.map +1 -0
  95. package/dist/chunk-GN72QAIH.mjs +146 -0
  96. package/dist/chunk-GN72QAIH.mjs.map +1 -0
  97. package/dist/chunk-GQVGIUSN.mjs +149 -0
  98. package/dist/chunk-GQVGIUSN.mjs.map +1 -0
  99. package/dist/chunk-GS6K5OCM.mjs +407 -0
  100. package/dist/chunk-GS6K5OCM.mjs.map +1 -0
  101. package/dist/chunk-GXASWWJU.mjs +364 -0
  102. package/dist/chunk-GXASWWJU.mjs.map +1 -0
  103. package/dist/chunk-GY2STC2S.mjs +180 -0
  104. package/dist/chunk-GY2STC2S.mjs.map +1 -0
  105. package/dist/chunk-H2FA2SBS.mjs +51 -0
  106. package/dist/chunk-H2FA2SBS.mjs.map +1 -0
  107. package/dist/chunk-I4CUBGVF.mjs +93 -0
  108. package/dist/chunk-I4CUBGVF.mjs.map +1 -0
  109. package/dist/chunk-ITN462YM.mjs +98 -0
  110. package/dist/chunk-ITN462YM.mjs.map +1 -0
  111. package/dist/chunk-J23HNLFY.mjs +72 -0
  112. package/dist/chunk-J23HNLFY.mjs.map +1 -0
  113. package/dist/chunk-J4FNJ5IU.mjs +179 -0
  114. package/dist/chunk-J4FNJ5IU.mjs.map +1 -0
  115. package/dist/chunk-J5YWQVI5.mjs +211 -0
  116. package/dist/chunk-J5YWQVI5.mjs.map +1 -0
  117. package/dist/chunk-JDEOUK5V.mjs +427 -0
  118. package/dist/chunk-JDEOUK5V.mjs.map +1 -0
  119. package/dist/chunk-JK25YEN6.mjs +219 -0
  120. package/dist/chunk-JK25YEN6.mjs.map +1 -0
  121. package/dist/chunk-K4667E2Q.mjs +1916 -0
  122. package/dist/chunk-K4667E2Q.mjs.map +1 -0
  123. package/dist/chunk-LGHEOHBU.mjs +218 -0
  124. package/dist/chunk-LGHEOHBU.mjs.map +1 -0
  125. package/dist/chunk-LM2YNO4U.mjs +24 -0
  126. package/dist/chunk-LM2YNO4U.mjs.map +1 -0
  127. package/dist/chunk-ME4MO2RJ.mjs +3540 -0
  128. package/dist/chunk-ME4MO2RJ.mjs.map +1 -0
  129. package/dist/chunk-MIUW47JX.mjs +639 -0
  130. package/dist/chunk-MIUW47JX.mjs.map +1 -0
  131. package/dist/chunk-NNLCAVB6.mjs +391 -0
  132. package/dist/chunk-NNLCAVB6.mjs.map +1 -0
  133. package/dist/chunk-P7QDS5AT.mjs +191 -0
  134. package/dist/chunk-P7QDS5AT.mjs.map +1 -0
  135. package/dist/chunk-PFE6GMNE.mjs +603 -0
  136. package/dist/chunk-PFE6GMNE.mjs.map +1 -0
  137. package/dist/chunk-QGOHVJ6J.mjs +63 -0
  138. package/dist/chunk-QGOHVJ6J.mjs.map +1 -0
  139. package/dist/chunk-QKVUNGAH.mjs +39 -0
  140. package/dist/chunk-QKVUNGAH.mjs.map +1 -0
  141. package/dist/chunk-QM746KUO.mjs +56 -0
  142. package/dist/chunk-QM746KUO.mjs.map +1 -0
  143. package/dist/chunk-QTZZ2ISQ.mjs +753 -0
  144. package/dist/chunk-QTZZ2ISQ.mjs.map +1 -0
  145. package/dist/chunk-RBRLLZL5.mjs +81 -0
  146. package/dist/chunk-RBRLLZL5.mjs.map +1 -0
  147. package/dist/chunk-RHIFZZUI.mjs +69 -0
  148. package/dist/chunk-RHIFZZUI.mjs.map +1 -0
  149. package/dist/chunk-RQ633A5I.mjs +187 -0
  150. package/dist/chunk-RQ633A5I.mjs.map +1 -0
  151. package/dist/chunk-SCFX4UTD.mjs +28 -0
  152. package/dist/chunk-SCFX4UTD.mjs.map +1 -0
  153. package/dist/chunk-SL6HTIOK.mjs +66 -0
  154. package/dist/chunk-SL6HTIOK.mjs.map +1 -0
  155. package/dist/chunk-SPBBQLXI.mjs +207 -0
  156. package/dist/chunk-SPBBQLXI.mjs.map +1 -0
  157. package/dist/chunk-SSA7THPX.mjs +10 -0
  158. package/dist/chunk-SSA7THPX.mjs.map +1 -0
  159. package/dist/chunk-T4QJQK76.mjs +459 -0
  160. package/dist/chunk-T4QJQK76.mjs.map +1 -0
  161. package/dist/chunk-TQAEEJB4.mjs +157 -0
  162. package/dist/chunk-TQAEEJB4.mjs.map +1 -0
  163. package/dist/chunk-UB5UOSHB.mjs +458 -0
  164. package/dist/chunk-UB5UOSHB.mjs.map +1 -0
  165. package/dist/chunk-USWZZUEH.mjs +25 -0
  166. package/dist/chunk-USWZZUEH.mjs.map +1 -0
  167. package/dist/chunk-UVCIEUJC.mjs +16 -0
  168. package/dist/chunk-UVCIEUJC.mjs.map +1 -0
  169. package/dist/chunk-UXUAWNO5.mjs +396 -0
  170. package/dist/chunk-UXUAWNO5.mjs.map +1 -0
  171. package/dist/chunk-V3XURYJO.mjs +756 -0
  172. package/dist/chunk-V3XURYJO.mjs.map +1 -0
  173. package/dist/chunk-V6WE6JSZ.mjs +352 -0
  174. package/dist/chunk-V6WE6JSZ.mjs.map +1 -0
  175. package/dist/chunk-V7RBCSDJ.mjs +170 -0
  176. package/dist/chunk-V7RBCSDJ.mjs.map +1 -0
  177. package/dist/chunk-VCANOYFI.mjs +588 -0
  178. package/dist/chunk-VCANOYFI.mjs.map +1 -0
  179. package/dist/chunk-VY2UYN5R.mjs +224 -0
  180. package/dist/chunk-VY2UYN5R.mjs.map +1 -0
  181. package/dist/chunk-W2CRQFF6.mjs +1352 -0
  182. package/dist/chunk-W2CRQFF6.mjs.map +1 -0
  183. package/dist/chunk-WDU6QXNK.mjs +872 -0
  184. package/dist/chunk-WDU6QXNK.mjs.map +1 -0
  185. package/dist/chunk-WZ5QFROO.mjs +23 -0
  186. package/dist/chunk-WZ5QFROO.mjs.map +1 -0
  187. package/dist/chunk-XIVV5IWN.mjs +541 -0
  188. package/dist/chunk-XIVV5IWN.mjs.map +1 -0
  189. package/dist/chunk-YW7OBE6Q.mjs +119 -0
  190. package/dist/chunk-YW7OBE6Q.mjs.map +1 -0
  191. package/dist/chunk-Z5CQMP54.mjs +365 -0
  192. package/dist/chunk-Z5CQMP54.mjs.map +1 -0
  193. package/dist/chunk-ZBE6MLHL.mjs +230 -0
  194. package/dist/chunk-ZBE6MLHL.mjs.map +1 -0
  195. package/dist/chunk-ZVWA4ZQ3.mjs +189 -0
  196. package/dist/chunk-ZVWA4ZQ3.mjs.map +1 -0
  197. package/dist/chunk-ZZ57EH5Z.mjs +173 -0
  198. package/dist/chunk-ZZ57EH5Z.mjs.map +1 -0
  199. package/dist/client-BT1mFQas.d.mts +447 -0
  200. package/dist/client-Nn0q4eO4.d.ts +447 -0
  201. package/dist/client-cache-CIlyBlmx.d.ts +6 -0
  202. package/dist/client-cache-D-EZ7XVW.d.mts +6 -0
  203. package/dist/client-plugins-BI2R6Eae.d.mts +1926 -0
  204. package/dist/client-plugins-DU9oMspX.d.ts +1926 -0
  205. package/dist/client-plugins.cjs +415 -0
  206. package/dist/client-plugins.cjs.map +1 -0
  207. package/dist/client-plugins.d.mts +22 -0
  208. package/dist/client-plugins.d.ts +22 -0
  209. package/dist/client-plugins.mjs +10 -0
  210. package/dist/client-plugins.mjs.map +1 -0
  211. package/dist/client.cjs +5402 -0
  212. package/dist/client.cjs.map +1 -0
  213. package/dist/client.d.mts +447 -0
  214. package/dist/client.d.ts +447 -0
  215. package/dist/client.mjs +110 -0
  216. package/dist/client.mjs.map +1 -0
  217. package/dist/config.cjs +38 -0
  218. package/dist/config.cjs.map +1 -0
  219. package/dist/config.d.mts +29 -0
  220. package/dist/config.d.ts +29 -0
  221. package/dist/config.mjs +10 -0
  222. package/dist/config.mjs.map +1 -0
  223. package/dist/cron.cjs +406 -0
  224. package/dist/cron.cjs.map +1 -0
  225. package/dist/cron.d.mts +78 -0
  226. package/dist/cron.d.ts +78 -0
  227. package/dist/cron.mjs +30 -0
  228. package/dist/cron.mjs.map +1 -0
  229. package/dist/deferred.cjs +438 -0
  230. package/dist/deferred.cjs.map +1 -0
  231. package/dist/deferred.d.mts +42 -0
  232. package/dist/deferred.d.ts +42 -0
  233. package/dist/deferred.mjs +28 -0
  234. package/dist/deferred.mjs.map +1 -0
  235. package/dist/deployment.cjs +199 -0
  236. package/dist/deployment.cjs.map +1 -0
  237. package/dist/deployment.d.mts +34 -0
  238. package/dist/deployment.d.ts +34 -0
  239. package/dist/deployment.mjs +38 -0
  240. package/dist/deployment.mjs.map +1 -0
  241. package/dist/devtools-REQTS3I7.mjs +371 -0
  242. package/dist/devtools-REQTS3I7.mjs.map +1 -0
  243. package/dist/devtools-client-3XRTBND5.mjs +216 -0
  244. package/dist/devtools-client-3XRTBND5.mjs.map +1 -0
  245. package/dist/devtools-ui-NJKFORTG.mjs +1349 -0
  246. package/dist/devtools-ui-NJKFORTG.mjs.map +1 -0
  247. package/dist/docs.cjs +5548 -0
  248. package/dist/docs.cjs.map +1 -0
  249. package/dist/docs.d.mts +69 -0
  250. package/dist/docs.d.ts +69 -0
  251. package/dist/docs.mjs +47 -0
  252. package/dist/docs.mjs.map +1 -0
  253. package/dist/env-types.cjs +232 -0
  254. package/dist/env-types.cjs.map +1 -0
  255. package/dist/env-types.d.mts +12 -0
  256. package/dist/env-types.d.ts +12 -0
  257. package/dist/env-types.mjs +11 -0
  258. package/dist/env-types.mjs.map +1 -0
  259. package/dist/env.cjs +215 -0
  260. package/dist/env.cjs.map +1 -0
  261. package/dist/env.d.mts +45 -0
  262. package/dist/env.d.ts +45 -0
  263. package/dist/env.mjs +22 -0
  264. package/dist/env.mjs.map +1 -0
  265. package/dist/environment/vite.d.mts +22 -0
  266. package/dist/environment/vite.d.ts +22 -0
  267. package/dist/environment.cjs +96 -0
  268. package/dist/environment.cjs.map +1 -0
  269. package/dist/environment.d.mts +18 -0
  270. package/dist/environment.d.ts +18 -0
  271. package/dist/environment.mjs +14 -0
  272. package/dist/environment.mjs.map +1 -0
  273. package/dist/headers.cjs +126 -0
  274. package/dist/headers.cjs.map +1 -0
  275. package/dist/headers.d.mts +22 -0
  276. package/dist/headers.d.ts +22 -0
  277. package/dist/headers.mjs +12 -0
  278. package/dist/headers.mjs.map +1 -0
  279. package/dist/i18n/client.d.mts +32 -0
  280. package/dist/i18n/client.d.ts +32 -0
  281. package/dist/i18n/index.d.mts +20 -0
  282. package/dist/i18n/index.d.ts +20 -0
  283. package/dist/i18n/server.d.mts +30 -0
  284. package/dist/i18n/server.d.ts +30 -0
  285. package/dist/image/server.d.mts +37 -0
  286. package/dist/image/server.d.ts +37 -0
  287. package/dist/image/sharp.d.mts +7 -0
  288. package/dist/image/sharp.d.ts +7 -0
  289. package/dist/image-config-Duob7wER.d.mts +50 -0
  290. package/dist/image-config-Duob7wER.d.ts +50 -0
  291. package/dist/image.cjs +209 -0
  292. package/dist/image.cjs.map +1 -0
  293. package/dist/image.d.mts +39 -0
  294. package/dist/image.d.ts +39 -0
  295. package/dist/image.mjs +165 -0
  296. package/dist/image.mjs.map +1 -0
  297. package/dist/index.cjs +42186 -0
  298. package/dist/index.cjs.map +1 -0
  299. package/dist/index.d.mts +454 -0
  300. package/dist/index.d.ts +454 -0
  301. package/dist/index.mjs +980 -0
  302. package/dist/index.mjs.map +1 -0
  303. package/dist/integration-api-CHT2OKAf.d.mts +93 -0
  304. package/dist/integration-api-CHT2OKAf.d.ts +93 -0
  305. package/dist/integration-orm-GQLGU66X.mjs +13 -0
  306. package/dist/integration-orm-GQLGU66X.mjs.map +1 -0
  307. package/dist/integrations.cjs +2820 -0
  308. package/dist/integrations.cjs.map +1 -0
  309. package/dist/integrations.d.mts +22 -0
  310. package/dist/integrations.d.ts +22 -0
  311. package/dist/integrations.mjs +51 -0
  312. package/dist/integrations.mjs.map +1 -0
  313. package/dist/internal/build-runtime.cjs +643 -322
  314. package/dist/internal/build-runtime.cjs.map +1 -1
  315. package/dist/internal/build-runtime.d.mts +39 -0
  316. package/dist/internal/build-runtime.d.ts +39 -0
  317. package/dist/internal/build-runtime.mjs +11 -10
  318. package/dist/internal/client-runtime.d.mts +2 -0
  319. package/dist/internal/client-runtime.d.ts +2 -0
  320. package/dist/internal/config-runtime.cjs +135 -39
  321. package/dist/internal/config-runtime.cjs.map +1 -1
  322. package/dist/internal/config-runtime.d.mts +39 -0
  323. package/dist/internal/config-runtime.d.ts +39 -0
  324. package/dist/internal/config-runtime.mjs +5 -4
  325. package/dist/internal/production-node-env.d.mts +12 -0
  326. package/dist/internal/production-node-env.d.ts +12 -0
  327. package/dist/internal/production-runtime.d.mts +39 -0
  328. package/dist/internal/production-runtime.d.ts +39 -0
  329. package/dist/layers-VWVDTPUZ.mjs +16 -0
  330. package/dist/layers-VWVDTPUZ.mjs.map +1 -0
  331. package/dist/manager-THKFTOFE.mjs +10 -0
  332. package/dist/manager-THKFTOFE.mjs.map +1 -0
  333. package/dist/markdown.cjs +364 -0
  334. package/dist/markdown.cjs.map +1 -0
  335. package/dist/markdown.d.mts +60 -0
  336. package/dist/markdown.d.ts +60 -0
  337. package/dist/markdown.mjs +18 -0
  338. package/dist/markdown.mjs.map +1 -0
  339. package/dist/metadata-Cm9ujH4I.d.ts +22 -0
  340. package/dist/metadata-DacXbnLA.d.mts +22 -0
  341. package/dist/middleware.cjs +2148 -0
  342. package/dist/middleware.cjs.map +1 -0
  343. package/dist/middleware.d.mts +164 -0
  344. package/dist/middleware.d.ts +164 -0
  345. package/dist/middleware.mjs +49 -0
  346. package/dist/middleware.mjs.map +1 -0
  347. package/dist/navigation-errors-Dvwpzaer.d.mts +13 -0
  348. package/dist/navigation-errors-Dvwpzaer.d.ts +13 -0
  349. package/dist/navigation.cjs +1329 -0
  350. package/dist/navigation.cjs.map +1 -0
  351. package/dist/navigation.d.mts +14 -0
  352. package/dist/navigation.d.ts +14 -0
  353. package/dist/navigation.mjs +33 -0
  354. package/dist/navigation.mjs.map +1 -0
  355. package/dist/nitro-QO5LV6QK.mjs +689 -0
  356. package/dist/nitro-QO5LV6QK.mjs.map +1 -0
  357. package/dist/observability.cjs +186 -0
  358. package/dist/observability.cjs.map +1 -0
  359. package/dist/observability.d.mts +335 -0
  360. package/dist/observability.d.ts +335 -0
  361. package/dist/observability.mjs +16 -0
  362. package/dist/observability.mjs.map +1 -0
  363. package/dist/params-BALtrRim.d.ts +15 -0
  364. package/dist/params-ry-lxqmy.d.mts +15 -0
  365. package/dist/plugin-BJDf43dc.d.mts +165 -0
  366. package/dist/plugin-BJDf43dc.d.ts +165 -0
  367. package/dist/plugin.cjs +23470 -0
  368. package/dist/plugin.cjs.map +1 -1
  369. package/dist/plugin.d.mts +22 -0
  370. package/dist/plugin.d.ts +22 -0
  371. package/dist/plugin.mjs +8 -7
  372. package/dist/production-runtime-4KKq1AVC.d.mts +79 -0
  373. package/dist/production-runtime-C_B79w2P.d.mts +28 -0
  374. package/dist/production-runtime-DDEM1D2q.d.ts +28 -0
  375. package/dist/production-runtime-DRsWDN2x.d.ts +79 -0
  376. package/dist/query/client.d.mts +61 -0
  377. package/dist/query/client.d.ts +61 -0
  378. package/dist/query/index.d.mts +90 -0
  379. package/dist/query/index.d.ts +90 -0
  380. package/dist/query/parsers.d.mts +25 -0
  381. package/dist/query/parsers.d.ts +25 -0
  382. package/dist/query/server.d.mts +55 -0
  383. package/dist/query/server.d.ts +55 -0
  384. package/dist/request-Dsq4kGW0.d.mts +6 -0
  385. package/dist/request-udtobOLv.d.ts +6 -0
  386. package/dist/request.d.mts +2 -0
  387. package/dist/request.d.ts +2 -0
  388. package/dist/resolver-DJqjLMg_.d.mts +14 -0
  389. package/dist/resolver-IH4RmPEl.d.ts +14 -0
  390. package/dist/route-runtime-DoOHzCAD.d.mts +38 -0
  391. package/dist/route-runtime-DoOHzCAD.d.ts +38 -0
  392. package/dist/router.d.mts +36 -0
  393. package/dist/router.d.ts +36 -0
  394. package/dist/routes.d.mts +224 -0
  395. package/dist/routes.d.ts +224 -0
  396. package/dist/runtime-9nQjVM7X.d.mts +206 -0
  397. package/dist/runtime-Cxpq6xZN.d.mts +27 -0
  398. package/dist/runtime-DgeS2skB.d.ts +206 -0
  399. package/dist/runtime-bv63eUiO.d.ts +27 -0
  400. package/dist/server-action-security.d.mts +43 -0
  401. package/dist/server-action-security.d.ts +43 -0
  402. package/dist/server-fn-client.d.mts +32 -0
  403. package/dist/server-fn-client.d.ts +32 -0
  404. package/dist/server-fn.d.mts +93 -0
  405. package/dist/server-fn.d.ts +93 -0
  406. package/dist/server-plugins.d.mts +55 -0
  407. package/dist/server-plugins.d.ts +55 -0
  408. package/dist/server-query-client.d.mts +50 -0
  409. package/dist/server-query-client.d.ts +50 -0
  410. package/dist/server-query.d.mts +36 -0
  411. package/dist/server-query.d.ts +36 -0
  412. package/dist/server.cjs +731 -447
  413. package/dist/server.cjs.map +1 -1
  414. package/dist/server.d.mts +48 -0
  415. package/dist/server.d.ts +48 -0
  416. package/dist/server.mjs +9 -8
  417. package/dist/server.mjs.map +1 -1
  418. package/dist/storage.d.mts +52 -0
  419. package/dist/storage.d.ts +52 -0
  420. package/dist/testing.d.mts +101 -0
  421. package/dist/testing.d.ts +101 -0
  422. package/dist/transport-BmbGTXA5.d.mts +49 -0
  423. package/dist/transport-BmbGTXA5.d.ts +49 -0
  424. package/dist/types-BMxWr97v.d.mts +81 -0
  425. package/dist/types-BMxWr97v.d.ts +81 -0
  426. package/dist/types-C9N-nk5R.d.mts +53 -0
  427. package/dist/types-C9N-nk5R.d.ts +53 -0
  428. package/dist/types-D1A6-XvH.d.mts +73 -0
  429. package/dist/types-D1A6-XvH.d.ts +73 -0
  430. package/dist/utils-B-cUHwoK.d.ts +23 -0
  431. package/dist/utils-Cm41AefV.d.mts +23 -0
  432. package/dist/version.cjs +1 -1
  433. package/dist/version.cjs.map +1 -1
  434. package/dist/version.d.mts +3 -0
  435. package/dist/version.d.ts +3 -0
  436. package/dist/version.mjs +1 -1
  437. package/dist/vite.cjs +682 -437
  438. package/dist/vite.cjs.map +1 -1
  439. package/dist/vite.d.mts +22 -0
  440. package/dist/vite.d.ts +22 -0
  441. package/dist/vite.mjs +6 -5
  442. package/dist/workflows.d.mts +110 -0
  443. package/dist/workflows.d.ts +110 -0
  444. package/package.json +3 -2
  445. package/types/client.d.ts +1 -1
  446. package/types/image.d.ts +4 -0
  447. package/types/images.d.ts +59 -0
package/dist/server.cjs CHANGED
@@ -31,178 +31,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
  ));
32
32
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
33
 
34
- // src/app-markdown.ts
35
- function resolveMdxConfig(config) {
36
- return {
37
- components: config?.components,
38
- markdownRoutes: config?.markdownRoutes ?? true,
39
- className: config?.className ?? "farm-markdown"
40
- };
41
- }
42
- function isFarmMarkdownPageFile(filePath) {
43
- return /(^|[/\\])page\.mdx?$/i.test(filePath);
44
- }
45
- function normalizeFarmMarkdownRoutePath(pathname) {
46
- const withoutExtension = pathname.replace(/\.md$/i, "");
47
- const normalized = withoutExtension.startsWith("/") ? withoutExtension : `/${withoutExtension}`;
48
- return normalized === "/index" ? "/" : normalized.replace(/\/+$/g, "") || "/";
49
- }
50
- function parseMarkdownFrontmatter(source) {
51
- if (!source.startsWith("---")) {
52
- return { frontmatter: {}, body: source };
53
- }
54
- const endIndex = source.indexOf("\n---", 3);
55
- if (endIndex === -1) {
56
- return { frontmatter: {}, body: source };
57
- }
58
- const frontmatterSource = source.slice(3, endIndex).trim();
59
- const closingFenceEnd = endIndex + "\n---".length;
60
- const bodyStart = source.slice(closingFenceEnd, closingFenceEnd + 2) === "\r\n" ? closingFenceEnd + 2 : source[closingFenceEnd] === "\n" ? closingFenceEnd + 1 : closingFenceEnd;
61
- const body = source.slice(bodyStart);
62
- const frontmatter = {};
63
- for (const line of frontmatterSource.split(/\r?\n/)) {
64
- const separator = line.indexOf(":");
65
- if (separator === -1) continue;
66
- const key = line.slice(0, separator).trim();
67
- const value = line.slice(separator + 1).trim().replace(/^["']|["']$/g, "");
68
- if (key && value) frontmatter[key] = value;
69
- }
70
- return { frontmatter, body };
71
- }
72
- function titleFromMarkdown(body, fallback) {
73
- return body.match(/^#\s+(.+)$/m)?.[1]?.trim() || fallback;
74
- }
75
- function createMarkdownMetadata(source, filePath) {
76
- const { frontmatter, body } = parseMarkdownFrontmatter(source);
77
- const routeTitle = titleFromMarkdown(body);
78
- const title = frontmatter.title || routeTitle;
79
- const description = frontmatter.description;
80
- if (!title && !description) {
81
- return void 0;
82
- }
83
- return {
84
- ...title ? { title } : {},
85
- ...description ? { description } : {},
86
- source: filePath
87
- };
88
- }
89
- async function evaluateMdxSource(source, filePath) {
90
- const [{ evaluate }, runtime, remarkGfmModule] = await Promise.all([
91
- import("@mdx-js/mdx"),
92
- import("react/jsx-runtime"),
93
- import("remark-gfm")
94
- ]);
95
- const remarkGfm = remarkGfmModule.default;
96
- return evaluate(source, {
97
- ...runtime,
98
- baseUrl: (0, import_url.pathToFileURL)(filePath),
99
- remarkPlugins: [remarkGfm]
100
- });
101
- }
102
- function createFarmMarkdownRouteModule(input) {
103
- const { body } = parseMarkdownFrontmatter(input.source);
104
- const components = input.components || {};
105
- const className = input.config?.className || "farm-markdown";
106
- let evaluatedPromise;
107
- const loadContent = /* @__PURE__ */ __name(async () => {
108
- evaluatedPromise ?? (evaluatedPromise = evaluateMdxSource(body, input.filePath));
109
- return evaluatedPromise;
110
- }, "loadContent");
111
- async function FarmMarkdownPage(props) {
112
- const evaluated = await loadContent();
113
- const MDXContent = evaluated.default;
114
- return import_react.default.createElement(
115
- "article",
116
- { className, "data-farm-markdown-page": "" },
117
- import_react.default.createElement(MDXContent, {
118
- ...props,
119
- components: {
120
- ...components,
121
- ...props?.components
122
- }
123
- })
124
- );
125
- }
126
- __name(FarmMarkdownPage, "FarmMarkdownPage");
127
- return {
128
- default: FarmMarkdownPage,
129
- metadata: createMarkdownMetadata(input.source, input.filePath),
130
- source: input.source
131
- };
132
- }
133
- async function createFarmMarkdownRouteModuleFromFile(filePath, options = {}) {
134
- const source = await (0, import_promises.readFile)(filePath, "utf8");
135
- return createFarmMarkdownRouteModule({
136
- source,
137
- filePath,
138
- components: options.components,
139
- config: options.config
140
- });
141
- }
142
- async function loadFarmMdxComponents(config, options) {
143
- const configured = config?.components;
144
- if (!configured) {
145
- return {};
146
- }
147
- if (typeof configured !== "string") {
148
- return configured;
149
- }
150
- const modulePath = import_path.default.isAbsolute(configured) ? configured : import_path.default.join(options.root, configured);
151
- const mod = options.loadModule ? await options.loadModule(modulePath) : await import((0, import_url.pathToFileURL)(modulePath).href);
152
- const maybeModule = mod;
153
- return maybeModule.components || maybeModule.default || {};
154
- }
155
- async function createFarmMarkdownSourceResponse(options) {
156
- if (options.request.method !== "GET" && options.request.method !== "HEAD") {
157
- return null;
158
- }
159
- if (options.config?.markdownRoutes === false) {
160
- return null;
161
- }
162
- const url = new URL(options.request.url);
163
- if (!url.pathname.endsWith(".md")) {
164
- return null;
165
- }
166
- const targetPathname = normalizeFarmMarkdownRoutePath(url.pathname);
167
- const source = await options.resolveSource(targetPathname);
168
- if (!source) {
169
- return null;
170
- }
171
- return new Response(options.request.method === "HEAD" ? null : source.source, {
172
- status: 200,
173
- headers: {
174
- "Content-Type": "text/markdown; charset=utf-8",
175
- "Cache-Control": "public, s-maxage=60, stale-while-revalidate=300",
176
- "X-Farm-Markdown-Route": targetPathname,
177
- "X-Farm-Markdown-Source": source.filePath
178
- }
179
- });
180
- }
181
- var import_react, import_promises, import_path, import_url;
182
- var init_app_markdown = __esm({
183
- "src/app-markdown.ts"() {
184
- "use strict";
185
- import_react = __toESM(require("react"));
186
- import_promises = require("fs/promises");
187
- import_path = __toESM(require("path"));
188
- import_url = require("url");
189
- __name(resolveMdxConfig, "resolveMdxConfig");
190
- __name(isFarmMarkdownPageFile, "isFarmMarkdownPageFile");
191
- __name(normalizeFarmMarkdownRoutePath, "normalizeFarmMarkdownRoutePath");
192
- __name(parseMarkdownFrontmatter, "parseMarkdownFrontmatter");
193
- __name(titleFromMarkdown, "titleFromMarkdown");
194
- __name(createMarkdownMetadata, "createMarkdownMetadata");
195
- __name(evaluateMdxSource, "evaluateMdxSource");
196
- __name(createFarmMarkdownRouteModule, "createFarmMarkdownRouteModule");
197
- __name(createFarmMarkdownRouteModuleFromFile, "createFarmMarkdownRouteModuleFromFile");
198
- __name(loadFarmMdxComponents, "loadFarmMdxComponents");
199
- __name(createFarmMarkdownSourceResponse, "createFarmMarkdownSourceResponse");
200
- }
201
- });
202
-
203
34
  // src/markdown.ts
204
35
  function resolveMarkdownConfig(config) {
205
- if (config === false || config === void 0) {
36
+ if (config === false) {
206
37
  return {
207
38
  enabled: false,
208
39
  expose: [],
@@ -210,7 +41,7 @@ function resolveMarkdownConfig(config) {
210
41
  includeMetadata: true
211
42
  };
212
43
  }
213
- if (config === true) {
44
+ if (config === true || config === void 0) {
214
45
  return {
215
46
  enabled: true,
216
47
  expose: true,
@@ -218,7 +49,7 @@ function resolveMarkdownConfig(config) {
218
49
  includeMetadata: true
219
50
  };
220
51
  }
221
- const exposeInput = config.expose ?? config.routes ?? [];
52
+ const exposeInput = config.expose ?? config.routes ?? true;
222
53
  const expose = exposeInput === true ? true : Array.isArray(exposeInput) ? exposeInput.map(normalizeMarkdownRouteInput) : [];
223
54
  return {
224
55
  enabled: config.enabled !== false && (expose === true || expose.length > 0),
@@ -227,11 +58,14 @@ function resolveMarkdownConfig(config) {
227
58
  includeMetadata: config.includeMetadata ?? true
228
59
  };
229
60
  }
230
- function resolveMarkdownMirrorTarget(config, pathname) {
231
- if (!config?.enabled || !pathname.endsWith(".md")) {
61
+ function resolveMarkdownMirrorTarget(config, pathname, options = {}) {
62
+ const hasMarkdownExtension = pathname.toLowerCase().endsWith(".md");
63
+ if (!config?.enabled || !hasMarkdownExtension && !requestAcceptsMarkdown(options.accept)) {
232
64
  return null;
233
65
  }
234
- const targetPathname = normalizeMarkdownRoute(pathname.slice(0, -".md".length) || "/");
66
+ const targetPathname = normalizeMarkdownRoute(
67
+ hasMarkdownExtension ? pathname.slice(0, -".md".length) || "/" : pathname
68
+ );
235
69
  const route = findExposedMarkdownRoute(config, targetPathname);
236
70
  if (!route && config.expose !== true) {
237
71
  return null;
@@ -246,7 +80,10 @@ async function createMarkdownMirrorResponse(options) {
246
80
  return null;
247
81
  }
248
82
  const requestUrl = new URL(options.request.url);
249
- const target = resolveMarkdownMirrorTarget(options.config, requestUrl.pathname);
83
+ const hasMarkdownExtension = requestUrl.pathname.toLowerCase().endsWith(".md");
84
+ const target = resolveMarkdownMirrorTarget(options.config, requestUrl.pathname, {
85
+ accept: options.request.headers.get("accept")
86
+ });
250
87
  if (!target) {
251
88
  return null;
252
89
  }
@@ -274,8 +111,12 @@ async function createMarkdownMirrorResponse(options) {
274
111
  });
275
112
  const headersOut = new Headers({
276
113
  "Content-Type": "text/markdown; charset=utf-8",
114
+ "Content-Location": target.pathname === "/" ? "/index.md" : `${target.pathname}.md`,
277
115
  "X-Farm-Markdown-Route": target.pathname
278
116
  });
117
+ if (!hasMarkdownExtension) {
118
+ headersOut.set("Vary", "Accept");
119
+ }
279
120
  const cache = target.route?.cache ?? options.config?.cache ?? false;
280
121
  headersOut.set("Cache-Control", createMarkdownCacheHeader(cache));
281
122
  return new Response(options.request.method === "HEAD" ? null : markdown, {
@@ -361,11 +202,24 @@ function normalizeMarkdownRouteInput(input) {
361
202
  };
362
203
  }
363
204
  function normalizeMarkdownRoute(route) {
364
- const withoutMarkdownExtension = route.endsWith(".md") ? route.slice(0, -3) : route;
205
+ const withoutMarkdownExtension = route.toLowerCase().endsWith(".md") ? route.slice(0, -3) : route;
365
206
  const withSlash = withoutMarkdownExtension.startsWith("/") ? withoutMarkdownExtension : `/${withoutMarkdownExtension}`;
366
207
  const normalized = withSlash.replace(/\/+/g, "/").replace(/\/$/g, "");
367
208
  return normalized === "" || normalized === "/index" ? "/" : normalized;
368
209
  }
210
+ function requestAcceptsMarkdown(accept) {
211
+ if (!accept) {
212
+ return false;
213
+ }
214
+ return accept.split(",").some((entry) => {
215
+ const [mediaType, ...parameters] = entry.trim().toLowerCase().split(";").map((part) => part.trim());
216
+ if (mediaType !== "text/markdown") {
217
+ return false;
218
+ }
219
+ const quality = parameters.find((parameter) => parameter.startsWith("q="));
220
+ return quality === void 0 || Number(quality.slice(2)) > 0;
221
+ });
222
+ }
369
223
  function findExposedMarkdownRoute(config, pathname) {
370
224
  if (config.expose === true) {
371
225
  return null;
@@ -456,6 +310,7 @@ var init_markdown = __esm({
456
310
  __name(htmlToMarkdown, "htmlToMarkdown");
457
311
  __name(normalizeMarkdownRouteInput, "normalizeMarkdownRouteInput");
458
312
  __name(normalizeMarkdownRoute, "normalizeMarkdownRoute");
313
+ __name(requestAcceptsMarkdown, "requestAcceptsMarkdown");
459
314
  __name(findExposedMarkdownRoute, "findExposedMarkdownRoute");
460
315
  __name(routeMatches, "routeMatches");
461
316
  __name(isHtmlResponse, "isHtmlResponse");
@@ -469,6 +324,182 @@ var init_markdown = __esm({
469
324
  }
470
325
  });
471
326
 
327
+ // src/app-markdown.ts
328
+ function resolveMdxConfig(config) {
329
+ return {
330
+ components: config?.components,
331
+ markdownRoutes: config?.markdownRoutes ?? true,
332
+ className: config?.className ?? "farm-markdown"
333
+ };
334
+ }
335
+ function isFarmMarkdownPageFile(filePath) {
336
+ return /(^|[/\\])page\.mdx?$/i.test(filePath);
337
+ }
338
+ function normalizeFarmMarkdownRoutePath(pathname) {
339
+ const withoutExtension = pathname.replace(/\.md$/i, "");
340
+ const normalized = withoutExtension.startsWith("/") ? withoutExtension : `/${withoutExtension}`;
341
+ return normalized === "/index" ? "/" : normalized.replace(/\/+$/g, "") || "/";
342
+ }
343
+ function parseMarkdownFrontmatter(source) {
344
+ if (!source.startsWith("---")) {
345
+ return { frontmatter: {}, body: source };
346
+ }
347
+ const endIndex = source.indexOf("\n---", 3);
348
+ if (endIndex === -1) {
349
+ return { frontmatter: {}, body: source };
350
+ }
351
+ const frontmatterSource = source.slice(3, endIndex).trim();
352
+ const closingFenceEnd = endIndex + "\n---".length;
353
+ const bodyStart = source.slice(closingFenceEnd, closingFenceEnd + 2) === "\r\n" ? closingFenceEnd + 2 : source[closingFenceEnd] === "\n" ? closingFenceEnd + 1 : closingFenceEnd;
354
+ const body = source.slice(bodyStart);
355
+ const frontmatter = {};
356
+ for (const line of frontmatterSource.split(/\r?\n/)) {
357
+ const separator = line.indexOf(":");
358
+ if (separator === -1) continue;
359
+ const key = line.slice(0, separator).trim();
360
+ const value = line.slice(separator + 1).trim().replace(/^["']|["']$/g, "");
361
+ if (key && value) frontmatter[key] = value;
362
+ }
363
+ return { frontmatter, body };
364
+ }
365
+ function titleFromMarkdown(body, fallback) {
366
+ return body.match(/^#\s+(.+)$/m)?.[1]?.trim() || fallback;
367
+ }
368
+ function createMarkdownMetadata(source, filePath) {
369
+ const { frontmatter, body } = parseMarkdownFrontmatter(source);
370
+ const routeTitle = titleFromMarkdown(body);
371
+ const title = frontmatter.title || routeTitle;
372
+ const description = frontmatter.description;
373
+ if (!title && !description) {
374
+ return void 0;
375
+ }
376
+ return {
377
+ ...title ? { title } : {},
378
+ ...description ? { description } : {},
379
+ source: filePath
380
+ };
381
+ }
382
+ async function evaluateMdxSource(source, filePath) {
383
+ const [{ evaluate }, runtime, remarkGfmModule] = await Promise.all([
384
+ import("@mdx-js/mdx"),
385
+ import("react/jsx-runtime"),
386
+ import("remark-gfm")
387
+ ]);
388
+ const remarkGfm = remarkGfmModule.default;
389
+ return evaluate(source, {
390
+ ...runtime,
391
+ baseUrl: (0, import_url.pathToFileURL)(filePath),
392
+ remarkPlugins: [remarkGfm]
393
+ });
394
+ }
395
+ function createFarmMarkdownRouteModule(input) {
396
+ const { body } = parseMarkdownFrontmatter(input.source);
397
+ const components = input.components || {};
398
+ const className = input.config?.className || "farm-markdown";
399
+ let evaluatedPromise;
400
+ const loadContent = /* @__PURE__ */ __name(async () => {
401
+ evaluatedPromise ?? (evaluatedPromise = evaluateMdxSource(body, input.filePath));
402
+ return evaluatedPromise;
403
+ }, "loadContent");
404
+ async function FarmMarkdownPage(props) {
405
+ const evaluated = await loadContent();
406
+ const MDXContent = evaluated.default;
407
+ return import_react.default.createElement(
408
+ "article",
409
+ { className, "data-farm-markdown-page": "" },
410
+ import_react.default.createElement(MDXContent, {
411
+ ...props,
412
+ components: {
413
+ ...components,
414
+ ...props?.components
415
+ }
416
+ })
417
+ );
418
+ }
419
+ __name(FarmMarkdownPage, "FarmMarkdownPage");
420
+ return {
421
+ default: FarmMarkdownPage,
422
+ metadata: createMarkdownMetadata(input.source, input.filePath),
423
+ source: input.source
424
+ };
425
+ }
426
+ async function createFarmMarkdownRouteModuleFromFile(filePath, options = {}) {
427
+ const source = await (0, import_promises.readFile)(filePath, "utf8");
428
+ return createFarmMarkdownRouteModule({
429
+ source,
430
+ filePath,
431
+ components: options.components,
432
+ config: options.config
433
+ });
434
+ }
435
+ async function loadFarmMdxComponents(config, options) {
436
+ const configured = config?.components;
437
+ if (!configured) {
438
+ return {};
439
+ }
440
+ if (typeof configured !== "string") {
441
+ return configured;
442
+ }
443
+ const modulePath = import_path.default.isAbsolute(configured) ? configured : import_path.default.join(options.root, configured);
444
+ const mod = options.loadModule ? await options.loadModule(modulePath) : await import((0, import_url.pathToFileURL)(modulePath).href);
445
+ const maybeModule = mod;
446
+ return maybeModule.components || maybeModule.default || {};
447
+ }
448
+ async function createFarmMarkdownSourceResponse(options) {
449
+ if (options.request.method !== "GET" && options.request.method !== "HEAD") {
450
+ return null;
451
+ }
452
+ if (options.config?.markdownRoutes === false) {
453
+ return null;
454
+ }
455
+ const url = new URL(options.request.url);
456
+ const hasMarkdownExtension = url.pathname.toLowerCase().endsWith(".md");
457
+ if (!hasMarkdownExtension && !requestAcceptsMarkdown(options.request.headers.get("accept"))) {
458
+ return null;
459
+ }
460
+ const targetPathname = normalizeFarmMarkdownRoutePath(url.pathname);
461
+ const source = await options.resolveSource(targetPathname);
462
+ if (!source) {
463
+ return null;
464
+ }
465
+ const headers = new Headers({
466
+ "Content-Type": "text/markdown; charset=utf-8",
467
+ "Content-Location": targetPathname === "/" ? "/index.md" : `${targetPathname}.md`,
468
+ "Cache-Control": "public, s-maxage=60, stale-while-revalidate=300",
469
+ "X-Farm-Markdown-Route": targetPathname,
470
+ "X-Farm-Markdown-Source": source.filePath
471
+ });
472
+ if (!hasMarkdownExtension) {
473
+ headers.set("Vary", "Accept");
474
+ }
475
+ return new Response(options.request.method === "HEAD" ? null : source.source, {
476
+ status: 200,
477
+ headers
478
+ });
479
+ }
480
+ var import_react, import_promises, import_path, import_url;
481
+ var init_app_markdown = __esm({
482
+ "src/app-markdown.ts"() {
483
+ "use strict";
484
+ import_react = __toESM(require("react"));
485
+ import_promises = require("fs/promises");
486
+ import_path = __toESM(require("path"));
487
+ import_url = require("url");
488
+ init_markdown();
489
+ __name(resolveMdxConfig, "resolveMdxConfig");
490
+ __name(isFarmMarkdownPageFile, "isFarmMarkdownPageFile");
491
+ __name(normalizeFarmMarkdownRoutePath, "normalizeFarmMarkdownRoutePath");
492
+ __name(parseMarkdownFrontmatter, "parseMarkdownFrontmatter");
493
+ __name(titleFromMarkdown, "titleFromMarkdown");
494
+ __name(createMarkdownMetadata, "createMarkdownMetadata");
495
+ __name(evaluateMdxSource, "evaluateMdxSource");
496
+ __name(createFarmMarkdownRouteModule, "createFarmMarkdownRouteModule");
497
+ __name(createFarmMarkdownRouteModuleFromFile, "createFarmMarkdownRouteModuleFromFile");
498
+ __name(loadFarmMdxComponents, "loadFarmMdxComponents");
499
+ __name(createFarmMarkdownSourceResponse, "createFarmMarkdownSourceResponse");
500
+ }
501
+ });
502
+
472
503
  // src/workflows.ts
473
504
  var workflows_exports = {};
474
505
  __export(workflows_exports, {
@@ -621,26 +652,26 @@ async function prepareFarmWorkflowsForNitro(config) {
621
652
  const root = config.root || process.cwd();
622
653
  const distDir = config.distDir || ".farm";
623
654
  const fs9 = await import("fs/promises");
624
- const path23 = await import("path");
625
- const generatedDir = path23.join(root, distDir, ".nitro", "farm-workflows");
655
+ const path24 = await import("path");
656
+ const generatedDir = path24.join(root, distDir, ".nitro", "farm-workflows");
626
657
  await fs9.mkdir(generatedDir, { recursive: true });
627
658
  const tasks = {};
628
659
  const scheduledTasks = createScheduledTasks(workflows);
629
660
  for (const workflow of workflows) {
630
- const wrapperPath = path23.join(generatedDir, `${safeFileName(workflow.id)}.mjs`);
661
+ const wrapperPath = path24.join(generatedDir, `${safeFileName(workflow.id)}.mjs`);
631
662
  await fs9.writeFile(wrapperPath, createNitroTaskWrapper(workflow), "utf8");
632
663
  tasks[workflow.id] = {
633
664
  handler: wrapperPath,
634
665
  description: workflow.description || `Farm workflow ${workflow.id}`
635
666
  };
636
667
  }
637
- const handlerPath = path23.join(generatedDir, "http-handler.mjs");
668
+ const handlerPath = path24.join(generatedDir, "http-handler.mjs");
638
669
  await fs9.writeFile(
639
670
  handlerPath,
640
671
  createNitroWorkflowHTTPHandler(workflowConfig, workflows),
641
672
  "utf8"
642
673
  );
643
- const manifestPath = path23.join(generatedDir, "manifest.json");
674
+ const manifestPath = path24.join(generatedDir, "manifest.json");
644
675
  await fs9.writeFile(
645
676
  manifestPath,
646
677
  JSON.stringify(
@@ -723,10 +754,10 @@ function resolveWorkflowDefinition(module2) {
723
754
  }
724
755
  async function findWorkflowFiles(root, dirs) {
725
756
  const fs9 = await import("fs/promises");
726
- const path23 = await import("path");
757
+ const path24 = await import("path");
727
758
  const files = [];
728
759
  for (const dir of dirs) {
729
- const absoluteDir = path23.isAbsolute(dir) ? dir : path23.join(root, dir);
760
+ const absoluteDir = path24.isAbsolute(dir) ? dir : path24.join(root, dir);
730
761
  if (!await pathExists(absoluteDir)) continue;
731
762
  await walkWorkflowDir(absoluteDir, files);
732
763
  }
@@ -734,10 +765,10 @@ async function findWorkflowFiles(root, dirs) {
734
765
  }
735
766
  async function walkWorkflowDir(dir, files) {
736
767
  const fs9 = await import("fs/promises");
737
- const path23 = await import("path");
768
+ const path24 = await import("path");
738
769
  const entries = await fs9.readdir(dir, { withFileTypes: true });
739
770
  for (const entry of entries) {
740
- const filePath = path23.join(dir, entry.name);
771
+ const filePath = path24.join(dir, entry.name);
741
772
  if (entry.isDirectory()) {
742
773
  if (entry.name === "node_modules" || entry.name.startsWith(".")) continue;
743
774
  await walkWorkflowDir(filePath, files);
@@ -757,12 +788,12 @@ function isWorkflowFile(fileName) {
757
788
  }
758
789
  async function loadWorkflowModule(filePath, root) {
759
790
  const fs9 = await import("fs/promises");
760
- const path23 = await import("path");
761
- const { pathToFileURL: pathToFileURL3 } = await import("url");
791
+ const path24 = await import("path");
792
+ const { pathToFileURL: pathToFileURL4 } = await import("url");
762
793
  const { build } = await import("esbuild");
763
- const outDir = path23.join(root, ".farm", ".workflow-loader");
794
+ const outDir = path24.join(root, ".farm", ".workflow-loader");
764
795
  await fs9.mkdir(outDir, { recursive: true });
765
- const outfile = path23.join(
796
+ const outfile = path24.join(
766
797
  outDir,
767
798
  `workflow-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`
768
799
  );
@@ -783,7 +814,7 @@ async function loadWorkflowModule(filePath, root) {
783
814
  try {
784
815
  return await import(
785
816
  /* @vite-ignore */
786
- `${pathToFileURL3(outfile).href}?t=${Date.now()}`
817
+ `${pathToFileURL4(outfile).href}?t=${Date.now()}`
787
818
  );
788
819
  } finally {
789
820
  await fs9.unlink(outfile).catch(() => void 0);
@@ -1045,7 +1076,7 @@ function normalizeCronJob(name, job) {
1045
1076
  if (!job || typeof job !== "object" || Array.isArray(job)) {
1046
1077
  throw new TypeError(`Farm cron ${JSON.stringify(name)} must be a configuration object.`);
1047
1078
  }
1048
- const path23 = normalizeCronPath(name, job.path);
1079
+ const path24 = normalizeCronPath(name, job.path);
1049
1080
  const rawSchedule = Array.isArray(job.schedule) ? job.schedule : [job.schedule];
1050
1081
  const schedule = [...new Set(rawSchedule.map((value) => normalizeCronExpression(name, value)))];
1051
1082
  if (schedule.length === 0) {
@@ -1054,7 +1085,7 @@ function normalizeCronJob(name, job) {
1054
1085
  return {
1055
1086
  name,
1056
1087
  schedule,
1057
- path: path23,
1088
+ path: path24,
1058
1089
  description: job.description?.trim() || void 0
1059
1090
  };
1060
1091
  }
@@ -1062,13 +1093,13 @@ function normalizeCronPath(name, value) {
1062
1093
  if (typeof value !== "string" || !value.trim().startsWith("/")) {
1063
1094
  throw new TypeError(`Farm cron ${JSON.stringify(name)} path must start with "/".`);
1064
1095
  }
1065
- const path23 = value.trim();
1066
- if (path23.startsWith("//") || path23.includes("?") || path23.includes("#")) {
1096
+ const path24 = value.trim();
1097
+ if (path24.startsWith("//") || path24.includes("?") || path24.includes("#")) {
1067
1098
  throw new TypeError(
1068
1099
  `Farm cron ${JSON.stringify(name)} path must be an application pathname without a host, query, or hash.`
1069
1100
  );
1070
1101
  }
1071
- return path23.length > 1 ? path23.replace(/\/+$/, "") : path23;
1102
+ return path24.length > 1 ? path24.replace(/\/+$/, "") : path24;
1072
1103
  }
1073
1104
  function normalizeCronExpression(name, value) {
1074
1105
  if (typeof value !== "string") {
@@ -2333,7 +2364,7 @@ var init_server_action_security = __esm({
2333
2364
 
2334
2365
  // src/image-config.ts
2335
2366
  function resolveFarmImageConfig(config) {
2336
- const path23 = normalizeImagePath(config?.path ?? DEFAULT_FARM_IMAGE_PATH);
2367
+ const path24 = normalizeImagePath(config?.path ?? DEFAULT_FARM_IMAGE_PATH);
2337
2368
  const deviceSizes = normalizeIntegerList(
2338
2369
  config?.deviceSizes ?? DEFAULT_FARM_IMAGE_DEVICE_SIZES,
2339
2370
  "images.deviceSizes"
@@ -2361,7 +2392,7 @@ function resolveFarmImageConfig(config) {
2361
2392
  );
2362
2393
  return Object.freeze({
2363
2394
  provider: config?.provider ?? "auto",
2364
- path: path23,
2395
+ path: path24,
2365
2396
  domains: Object.freeze([
2366
2397
  ...new Set(
2367
2398
  (config?.domains ?? []).map((domain) => domain.trim().toLowerCase()).filter(Boolean)
@@ -2400,11 +2431,11 @@ function getPublicFarmImageConfig(config) {
2400
2431
  };
2401
2432
  }
2402
2433
  function normalizeImagePath(value) {
2403
- const path23 = value.trim().replace(/\/+$/, "") || "/";
2404
- if (!path23.startsWith("/") || path23.includes("?") || path23.includes("#")) {
2434
+ const path24 = value.trim().replace(/\/+$/, "") || "/";
2435
+ if (!path24.startsWith("/") || path24.includes("?") || path24.includes("#")) {
2405
2436
  throw new TypeError("images.path must be an absolute pathname without a query or hash");
2406
2437
  }
2407
- return path23;
2438
+ return path24;
2408
2439
  }
2409
2440
  function normalizeIntegerList(values, name, max) {
2410
2441
  if (values.length === 0) {
@@ -3243,9 +3274,9 @@ var init_integration_orm = __esm({
3243
3274
  });
3244
3275
 
3245
3276
  // src/integrations.ts
3246
- function defineTypedIntegrationRoute(method, path23, input) {
3277
+ function defineTypedIntegrationRoute(method, path24, input) {
3247
3278
  return {
3248
- path: path23,
3279
+ path: path24,
3249
3280
  method,
3250
3281
  middleware: input.middleware,
3251
3282
  before: input.before,
@@ -3255,7 +3286,7 @@ function defineTypedIntegrationRoute(method, path23, input) {
3255
3286
  input: normalizeIntegrationRouteInputSchemas(input),
3256
3287
  handler: input.handler,
3257
3288
  __operation: defineIntegrationAPIOperation({
3258
- path: path23,
3289
+ path: path24,
3259
3290
  method,
3260
3291
  bodyFormat: input.bodyFormat,
3261
3292
  responseFormat: input.responseFormat,
@@ -3267,52 +3298,52 @@ function defineTypedIntegrationRoute(method, path23, input) {
3267
3298
  }
3268
3299
  function createIntegrationRouteFactory() {
3269
3300
  return {
3270
- get(path23, input) {
3301
+ get(path24, input) {
3271
3302
  return defineTypedIntegrationRoute(
3272
3303
  "GET",
3273
- path23,
3304
+ path24,
3274
3305
  input
3275
3306
  );
3276
3307
  },
3277
- post(path23, input) {
3308
+ post(path24, input) {
3278
3309
  return defineTypedIntegrationRoute(
3279
3310
  "POST",
3280
- path23,
3311
+ path24,
3281
3312
  {
3282
3313
  bodyFormat: "json",
3283
3314
  ...input
3284
3315
  }
3285
3316
  );
3286
3317
  },
3287
- put(path23, input) {
3318
+ put(path24, input) {
3288
3319
  return defineTypedIntegrationRoute(
3289
3320
  "PUT",
3290
- path23,
3321
+ path24,
3291
3322
  {
3292
3323
  bodyFormat: "json",
3293
3324
  ...input
3294
3325
  }
3295
3326
  );
3296
3327
  },
3297
- patch(path23, input) {
3298
- return defineTypedIntegrationRoute("PATCH", path23, {
3328
+ patch(path24, input) {
3329
+ return defineTypedIntegrationRoute("PATCH", path24, {
3299
3330
  bodyFormat: "json",
3300
3331
  ...input
3301
3332
  });
3302
3333
  },
3303
- delete(path23, input) {
3304
- return defineTypedIntegrationRoute("DELETE", path23, {
3334
+ delete(path24, input) {
3335
+ return defineTypedIntegrationRoute("DELETE", path24, {
3305
3336
  bodyFormat: "json",
3306
3337
  ...input
3307
3338
  });
3308
3339
  },
3309
- options(path23, input) {
3310
- return defineTypedIntegrationRoute("OPTIONS", path23, input);
3340
+ options(path24, input) {
3341
+ return defineTypedIntegrationRoute("OPTIONS", path24, input);
3311
3342
  },
3312
- head(path23, input) {
3343
+ head(path24, input) {
3313
3344
  return defineTypedIntegrationRoute(
3314
3345
  "HEAD",
3315
- path23,
3346
+ path24,
3316
3347
  input
3317
3348
  );
3318
3349
  }
@@ -3529,8 +3560,8 @@ async function parseIntegrationConfigSchema(integration, schema, value) {
3529
3560
  function createIntegrationConfigValidationError(integration, error) {
3530
3561
  const issues = Array.isArray(error.issues) && error.issues.length > 0 ? error.issues.map((issue) => {
3531
3562
  const normalizedPath = normalizeIntegrationValidationPath(issue.path);
3532
- const path23 = normalizedPath.length ? `${normalizedPath.join(".")}: ` : "";
3533
- return `${path23}${issue.message || "Invalid config"}`;
3563
+ const path24 = normalizedPath.length ? `${normalizedPath.join(".")}: ` : "";
3564
+ return `${path24}${issue.message || "Invalid config"}`;
3534
3565
  }).join("; ") : error.message || "Invalid config";
3535
3566
  return new Error(`Integration "${integration.type}" config validation failed: ${issues}`);
3536
3567
  }
@@ -4215,8 +4246,8 @@ function normalizeIntegrationValidationIssues(source, error) {
4215
4246
  }
4216
4247
  ];
4217
4248
  }
4218
- function normalizeIntegrationValidationPath(path23) {
4219
- return (path23 || []).map((segment) => {
4249
+ function normalizeIntegrationValidationPath(path24) {
4250
+ return (path24 || []).map((segment) => {
4220
4251
  const key = typeof segment === "object" && segment !== null && "key" in segment ? segment.key : segment;
4221
4252
  return typeof key === "symbol" ? key.description || key.toString() : key;
4222
4253
  });
@@ -4867,13 +4898,13 @@ function getRequestId(req) {
4867
4898
  return headerValue || String(Date.now());
4868
4899
  }
4869
4900
  async function readRequestBody(req) {
4870
- return await new Promise((resolve5, reject) => {
4901
+ return await new Promise((resolve6, reject) => {
4871
4902
  const chunks = [];
4872
4903
  req.on("data", (chunk) => {
4873
4904
  chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
4874
4905
  });
4875
4906
  req.on("end", () => {
4876
- resolve5(Buffer.concat(chunks));
4907
+ resolve6(Buffer.concat(chunks));
4877
4908
  });
4878
4909
  req.on("error", reject);
4879
4910
  });
@@ -5009,8 +5040,8 @@ function createFarmDeploymentMismatchResponse(mismatch) {
5009
5040
  }
5010
5041
  );
5011
5042
  }
5012
- function createFarmDeploymentCookie(deploymentId, path23 = "/", secure = false) {
5013
- const normalizedPath = path23.startsWith("/") ? path23 : `/${path23}`;
5043
+ function createFarmDeploymentCookie(deploymentId, path24 = "/", secure = false) {
5044
+ const normalizedPath = path24.startsWith("/") ? path24 : `/${path24}`;
5014
5045
  return [
5015
5046
  `${FARM_DEPLOYMENT_COOKIE}=${encodeURIComponent(deploymentId)}`,
5016
5047
  `Path=${normalizedPath}`,
@@ -5204,6 +5235,96 @@ var init_devtools_config = __esm({
5204
5235
  }
5205
5236
  });
5206
5237
 
5238
+ // src/auth-config.ts
5239
+ function resolveFarmAuthConfig(input) {
5240
+ const config = input === true ? {} : input && typeof input === "object" ? input : {};
5241
+ const passwordConfig = typeof config.emailAndPassword === "object" ? config.emailAndPassword : {};
5242
+ const resolved = {
5243
+ enabled: input !== void 0 && input !== false && config.enabled !== false,
5244
+ appName: config.appName,
5245
+ basePath: normalizeBasePath(config.basePath),
5246
+ emailAndPassword: {
5247
+ enabled: config.emailAndPassword !== false,
5248
+ requireEmailVerification: passwordConfig.requireEmailVerification ?? false,
5249
+ minPasswordLength: passwordConfig.minPasswordLength ?? 8,
5250
+ maxPasswordLength: passwordConfig.maxPasswordLength ?? 128
5251
+ },
5252
+ session: {
5253
+ expiresIn: config.session?.expiresIn ?? 60 * 60 * 24 * 7,
5254
+ updateAge: config.session?.updateAge ?? 60 * 60 * 24
5255
+ },
5256
+ database: {
5257
+ url: config.database?.url,
5258
+ path: config.database?.path || ".farm/auth.sqlite",
5259
+ migrateInDevelopment: config.database?.migrateInDevelopment ?? true
5260
+ }
5261
+ };
5262
+ validateFarmAuthConfig(resolved);
5263
+ return resolved;
5264
+ }
5265
+ async function resolveFarmAuthIntegration(config, options) {
5266
+ if (!config.enabled) return void 0;
5267
+ const root = import_node_path4.default.resolve(options.root);
5268
+ let modulePath;
5269
+ try {
5270
+ const resolveFromApp = (0, import_node_module2.createRequire)(import_node_path4.default.join(root, "package.json"));
5271
+ modulePath = resolveFromApp.resolve("@farm.js/auth/internal");
5272
+ } catch {
5273
+ throw new Error(
5274
+ "The `auth` config requires @farm.js/auth. Install it with `pnpm add @farm.js/auth` and try again."
5275
+ );
5276
+ }
5277
+ const runtime = await import(
5278
+ /* @vite-ignore */
5279
+ (0, import_node_url2.pathToFileURL)(modulePath).href
5280
+ );
5281
+ if (typeof runtime.createFarmAuthIntegration !== "function") {
5282
+ throw new Error(
5283
+ "The installed @farm.js/auth package is incompatible with this version of @farm.js/core."
5284
+ );
5285
+ }
5286
+ return runtime.createFarmAuthIntegration(config, {
5287
+ ...options,
5288
+ root
5289
+ });
5290
+ }
5291
+ function normalizeBasePath(value) {
5292
+ const route = (value || "/api/auth").trim();
5293
+ const withLeadingSlash = route.startsWith("/") ? route : `/${route}`;
5294
+ const normalized = withLeadingSlash.replace(/\/+/g, "/").replace(/\/+$/, "");
5295
+ return normalized || "/api/auth";
5296
+ }
5297
+ function validateFarmAuthConfig(config) {
5298
+ const { minPasswordLength, maxPasswordLength } = config.emailAndPassword;
5299
+ if (!Number.isInteger(minPasswordLength) || minPasswordLength < 1) {
5300
+ throw new Error("auth.emailAndPassword.minPasswordLength must be a positive integer.");
5301
+ }
5302
+ if (!Number.isInteger(maxPasswordLength) || maxPasswordLength < minPasswordLength) {
5303
+ throw new Error(
5304
+ "auth.emailAndPassword.maxPasswordLength must be an integer greater than or equal to minPasswordLength."
5305
+ );
5306
+ }
5307
+ if (!Number.isInteger(config.session.expiresIn) || config.session.expiresIn < 1) {
5308
+ throw new Error("auth.session.expiresIn must be a positive integer.");
5309
+ }
5310
+ if (!Number.isInteger(config.session.updateAge) || config.session.updateAge < 0) {
5311
+ throw new Error("auth.session.updateAge must be a non-negative integer.");
5312
+ }
5313
+ }
5314
+ var import_node_module2, import_node_path4, import_node_url2;
5315
+ var init_auth_config = __esm({
5316
+ "src/auth-config.ts"() {
5317
+ "use strict";
5318
+ import_node_module2 = require("module");
5319
+ import_node_path4 = __toESM(require("path"));
5320
+ import_node_url2 = require("url");
5321
+ __name(resolveFarmAuthConfig, "resolveFarmAuthConfig");
5322
+ __name(resolveFarmAuthIntegration, "resolveFarmAuthIntegration");
5323
+ __name(normalizeBasePath, "normalizeBasePath");
5324
+ __name(validateFarmAuthConfig, "validateFarmAuthConfig");
5325
+ }
5326
+ });
5327
+
5207
5328
  // src/write-file-if-changed.ts
5208
5329
  function writeFileIfChanged(filePath, content) {
5209
5330
  try {
@@ -5323,11 +5444,11 @@ var init_type_generator = __esm({
5323
5444
  routeGroups.get(key).push(route);
5324
5445
  }
5325
5446
  const nestedStructure = {};
5326
- for (const [path23, routeList] of routeGroups) {
5447
+ for (const [path24, routeList] of routeGroups) {
5327
5448
  const route = routeList[0];
5328
5449
  const importPath = this.getRouteImportPath(route, options.outFile);
5329
5450
  const routeName = this.pathToRouteName(route.path);
5330
- const cleanPath = path23 === "/api" ? "" : path23.replace(/^\/api\//, "");
5451
+ const cleanPath = path24 === "/api" ? "" : path24.replace(/^\/api\//, "");
5331
5452
  const parts = cleanPath ? cleanPath.split("/") : [];
5332
5453
  const allMethods = routeList.flatMap((r) => r.methods);
5333
5454
  for (const method of allMethods) {
@@ -5386,8 +5507,8 @@ ${typeExports}
5386
5507
  const relativeImport = (0, import_path7.relative)((0, import_path7.dirname)(outFile), route.filePath).replace(/\\/g, "/").replace(/\.(ts|tsx|js|jsx)$/, "");
5387
5508
  return relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`;
5388
5509
  }
5389
- pathToRouteName(path23) {
5390
- return (path23 === "/api" ? "root" : path23.replace(/^\/api\//, "")).replace(/\//g, "_").replace(/[^a-zA-Z0-9_]/g, "");
5510
+ pathToRouteName(path24) {
5511
+ return (path24 === "/api" ? "root" : path24.replace(/^\/api\//, "")).replace(/\//g, "_").replace(/[^a-zA-Z0-9_]/g, "");
5391
5512
  }
5392
5513
  structureToTypeString(obj, indent) {
5393
5514
  const spaces = " ".repeat(indent);
@@ -5407,15 +5528,15 @@ ${typeExports}
5407
5528
  toTypePropertyKey(key) {
5408
5529
  return /^[$A-Z_][0-9A-Z_$]*$/i.test(key) ? key : JSON.stringify(key);
5409
5530
  }
5410
- getBaseExportName(path23) {
5411
- const cleanPath = path23.replace(/^\/api\//, "");
5531
+ getBaseExportName(path24) {
5532
+ const cleanPath = path24.replace(/^\/api\//, "");
5412
5533
  if (cleanPath === "") {
5413
5534
  return "api";
5414
5535
  }
5415
5536
  return cleanPath;
5416
5537
  }
5417
- getExportName(path23, method) {
5418
- const cleanPath = path23.replace(/^\/api\//, "");
5538
+ getExportName(path24, method) {
5539
+ const cleanPath = path24.replace(/^\/api\//, "");
5419
5540
  if (cleanPath === "") {
5420
5541
  return method.toLowerCase();
5421
5542
  }
@@ -5865,11 +5986,11 @@ function resolveExistingPath(filePath) {
5865
5986
  try {
5866
5987
  return (0, import_node_fs5.realpathSync)(filePath);
5867
5988
  } catch {
5868
- return import_node_path7.default.resolve(filePath);
5989
+ return import_node_path8.default.resolve(filePath);
5869
5990
  }
5870
5991
  }
5871
5992
  function isDocsSourceFile(filePath) {
5872
- return DOCS_FILE_EXTENSIONS.has(import_node_path7.default.extname(filePath).toLowerCase());
5993
+ return DOCS_FILE_EXTENSIONS.has(import_node_path8.default.extname(filePath).toLowerCase());
5873
5994
  }
5874
5995
  function discoverDocsSourceFiles(contentDir) {
5875
5996
  const files = [];
@@ -5878,7 +5999,7 @@ function discoverDocsSourceFiles(contentDir) {
5878
5999
  (a, b) => a.name.localeCompare(b.name)
5879
6000
  )) {
5880
6001
  if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
5881
- const absolutePath = import_node_path7.default.join(dir, entry.name);
6002
+ const absolutePath = import_node_path8.default.join(dir, entry.name);
5882
6003
  if (entry.isDirectory()) {
5883
6004
  visit(absolutePath);
5884
6005
  } else if (entry.isFile() && isDocsSourceFile(absolutePath)) {
@@ -5896,7 +6017,7 @@ function getGitLastModifiedDates(contentDir) {
5896
6017
  stdio: ["ignore", "pipe", "ignore"]
5897
6018
  }).trim();
5898
6019
  if (!gitRoot) return {};
5899
- const contentPathspec = normalizeRelativePath(import_node_path7.default.relative(gitRoot, contentDir)) || ".";
6020
+ const contentPathspec = normalizeRelativePath(import_node_path8.default.relative(gitRoot, contentDir)) || ".";
5900
6021
  const contentPrefix = contentPathspec === "." ? "" : `${contentPathspec}/`;
5901
6022
  const history = (0, import_node_child_process.execFileSync)(
5902
6023
  "git",
@@ -5938,7 +6059,7 @@ function getGitLastModifiedDates(contentDir) {
5938
6059
  }
5939
6060
  }
5940
6061
  function readManifest(contentDir) {
5941
- const manifestPath = import_node_path7.default.join(contentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST);
6062
+ const manifestPath = import_node_path8.default.join(contentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST);
5942
6063
  if (!(0, import_node_fs5.existsSync)(manifestPath)) return null;
5943
6064
  try {
5944
6065
  const parsed = JSON.parse(
@@ -5961,14 +6082,14 @@ function createFarmDocsLastModifiedManifest(contentDir, options = {}) {
5961
6082
  const fallbackDate = (options.now ?? /* @__PURE__ */ new Date()).toISOString();
5962
6083
  const pages = {};
5963
6084
  for (const sourcePath of discoverDocsSourceFiles(resolvedContentDir)) {
5964
- const relativePath2 = normalizeRelativePath(import_node_path7.default.relative(resolvedContentDir, sourcePath));
6085
+ const relativePath2 = normalizeRelativePath(import_node_path8.default.relative(resolvedContentDir, sourcePath));
5965
6086
  pages[relativePath2] = gitDates[relativePath2] || (options.fallback === "now" ? fallbackDate : (0, import_node_fs5.statSync)(sourcePath).mtime.toISOString());
5966
6087
  }
5967
6088
  return { version: 1, pages };
5968
6089
  }
5969
6090
  function getLastModifiedManifest(contentDir) {
5970
6091
  const resolvedContentDir = resolveExistingPath(contentDir);
5971
- const manifestPath = import_node_path7.default.join(resolvedContentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST);
6092
+ const manifestPath = import_node_path8.default.join(resolvedContentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST);
5972
6093
  const manifestStat = (0, import_node_fs5.existsSync)(manifestPath) ? (0, import_node_fs5.statSync)(manifestPath) : null;
5973
6094
  const signature = manifestStat ? `file:${manifestStat.mtimeMs}:${manifestStat.size}` : "generated";
5974
6095
  const cached = manifestCache.get(resolvedContentDir);
@@ -5982,21 +6103,21 @@ function resolveFarmDocsPageLastModified(contentDir, sourcePath, frontmatter) {
5982
6103
  if (configured) return configured;
5983
6104
  const resolvedContentDir = resolveExistingPath(contentDir);
5984
6105
  const resolvedSourcePath = resolveExistingPath(sourcePath);
5985
- const relativePath2 = normalizeRelativePath(import_node_path7.default.relative(resolvedContentDir, resolvedSourcePath));
5986
- const isInsideContentDir = relativePath2 !== ".." && !relativePath2.startsWith("../") && !import_node_path7.default.isAbsolute(relativePath2);
6106
+ const relativePath2 = normalizeRelativePath(import_node_path8.default.relative(resolvedContentDir, resolvedSourcePath));
6107
+ const isInsideContentDir = relativePath2 !== ".." && !relativePath2.startsWith("../") && !import_node_path8.default.isAbsolute(relativePath2);
5987
6108
  if (isInsideContentDir) {
5988
6109
  const generated = getLastModifiedManifest(resolvedContentDir).pages[relativePath2];
5989
6110
  if (generated) return generated;
5990
6111
  }
5991
6112
  return (0, import_node_fs5.statSync)(resolvedSourcePath).mtime.toISOString();
5992
6113
  }
5993
- var import_node_child_process, import_node_fs5, import_node_path7, FARM_DOCS_LAST_MODIFIED_MANIFEST, COMMIT_MARKER, DOCS_FILE_EXTENSIONS, manifestCache;
6114
+ var import_node_child_process, import_node_fs5, import_node_path8, FARM_DOCS_LAST_MODIFIED_MANIFEST, COMMIT_MARKER, DOCS_FILE_EXTENSIONS, manifestCache;
5994
6115
  var init_last_modified = __esm({
5995
6116
  "src/docs/last-modified.ts"() {
5996
6117
  "use strict";
5997
6118
  import_node_child_process = require("child_process");
5998
6119
  import_node_fs5 = require("fs");
5999
- import_node_path7 = __toESM(require("path"));
6120
+ import_node_path8 = __toESM(require("path"));
6000
6121
  FARM_DOCS_LAST_MODIFIED_MANIFEST = ".farm-docs-last-modified.json";
6001
6122
  COMMIT_MARKER = "__FARM_DOCS_COMMIT__";
6002
6123
  DOCS_FILE_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".mdx"]);
@@ -6434,8 +6555,8 @@ code:not(pre code) {
6434
6555
  }
6435
6556
 
6436
6557
  .code-block-header {
6437
- min-height: 28px;
6438
- padding: 3px 7px 3px 9px;
6558
+ min-height: 34px;
6559
+ padding: 4px 8px 4px 10px;
6439
6560
  }
6440
6561
 
6441
6562
  .code-block-title {
@@ -6649,8 +6770,8 @@ code:not(pre code) {
6649
6770
  }
6650
6771
 
6651
6772
  .code-block-header {
6652
- min-height: 26px;
6653
- padding: 2px 6px 2px 8px;
6773
+ min-height: 32px;
6774
+ padding: 3px 7px 3px 9px;
6654
6775
  }
6655
6776
 
6656
6777
  .code-copy-floating {
@@ -6690,38 +6811,30 @@ code:not(pre code) {
6690
6811
 
6691
6812
  @media (max-width: 640px) {
6692
6813
  .code-block-header {
6693
- min-height: 22px;
6694
- padding: 1px 4px 1px 7px;
6695
- }
6696
-
6697
- .code-block-title {
6698
- font-size: 9px;
6699
- }
6700
-
6701
- .code-copy {
6702
- width: 20px;
6703
- height: 20px;
6704
- }
6705
-
6706
- .code-copy svg {
6707
- width: 12px;
6708
- height: 12px;
6814
+ min-height: 30px;
6815
+ padding: 3px 6px 3px 8px;
6709
6816
  }
6710
6817
 
6711
6818
  .code-copy-floating {
6712
- top: 5px;
6713
- right: 5px;
6819
+ top: 7px;
6820
+ right: 7px;
6714
6821
  }
6715
6822
 
6716
6823
  #nd-docs-layout figure.shiki.code-block pre,
6717
6824
  .code-block pre {
6718
- padding: 10px !important;
6719
- font-size: 11px;
6720
- line-height: 1.55;
6825
+ padding: 12px !important;
6826
+ font-size: 12px;
6827
+ line-height: 1.6;
6828
+ }
6829
+
6830
+ #nd-docs-layout figure.shiki.code-block-plain pre,
6831
+ .code-block-plain pre {
6832
+ padding: 16px 44px 16px 14px !important;
6833
+ line-height: 1.65;
6721
6834
  }
6722
6835
 
6723
6836
  .sh__line {
6724
- min-height: 1.55em;
6837
+ min-height: 1.6em;
6725
6838
  }
6726
6839
  }
6727
6840
 
@@ -7308,9 +7421,9 @@ function isFarmDocsSearchEnabled(docs) {
7308
7421
  }
7309
7422
  function resolveFarmDocsSearchClientModule(root) {
7310
7423
  try {
7311
- const requireFromApp = (0, import_node_module2.createRequire)(import_node_path8.default.join(import_node_path8.default.resolve(root), "package.json"));
7424
+ const requireFromApp = (0, import_node_module3.createRequire)(import_node_path9.default.join(import_node_path9.default.resolve(root), "package.json"));
7312
7425
  const themeEntry = requireFromApp.resolve("@farming-labs/theme");
7313
- const commandSearchModule = import_node_path8.default.join(import_node_path8.default.dirname(themeEntry), "docs-command-search.mjs");
7426
+ const commandSearchModule = import_node_path9.default.join(import_node_path9.default.dirname(themeEntry), "docs-command-search.mjs");
7314
7427
  if ((0, import_node_fs6.existsSync)(commandSearchModule)) return commandSearchModule;
7315
7428
  } catch {
7316
7429
  }
@@ -7450,13 +7563,13 @@ async function mountFarmDocsSearch() {
7450
7563
  window.__FARM_MOUNT_DOCS_SEARCH__ = mountFarmDocsSearch;
7451
7564
  `;
7452
7565
  }
7453
- var import_node_fs6, import_node_module2, import_node_path8;
7566
+ var import_node_fs6, import_node_module3, import_node_path9;
7454
7567
  var init_search_client = __esm({
7455
7568
  "src/docs/search-client.ts"() {
7456
7569
  "use strict";
7457
7570
  import_node_fs6 = require("fs");
7458
- import_node_module2 = require("module");
7459
- import_node_path8 = __toESM(require("path"));
7571
+ import_node_module3 = require("module");
7572
+ import_node_path9 = __toESM(require("path"));
7460
7573
  __name(isFarmDocsSearchEnabled, "isFarmDocsSearchEnabled");
7461
7574
  __name(resolveFarmDocsSearchClientModule, "resolveFarmDocsSearchClientModule");
7462
7575
  __name(generateFarmDocsSearchBootstrapRuntime, "generateFarmDocsSearchBootstrapRuntime");
@@ -7480,9 +7593,9 @@ function resolveFarmDocsFavicon(docs, options) {
7480
7593
  if (typeof configuredFavicon === "string" && configuredFavicon.trim()) {
7481
7594
  return configuredFavicon.trim();
7482
7595
  }
7483
- const publicDir = import_node_path9.default.join(import_node_path9.default.resolve(options.root), "public");
7596
+ const publicDir = import_node_path10.default.join(import_node_path10.default.resolve(options.root), "public");
7484
7597
  for (const fileName of FARM_DOCS_FAVICON_FILES) {
7485
- const faviconPath = import_node_path9.default.join(publicDir, fileName);
7598
+ const faviconPath = import_node_path10.default.join(publicDir, fileName);
7486
7599
  if ((0, import_node_fs7.existsSync)(faviconPath) && (0, import_node_fs7.statSync)(faviconPath).isFile()) {
7487
7600
  return `/${fileName}`;
7488
7601
  }
@@ -7517,10 +7630,10 @@ function isSafeSegment(segment) {
7517
7630
  return segment !== ".." && !segment.includes("/") && !segment.includes("\\");
7518
7631
  }
7519
7632
  function resolveInside(root, target) {
7520
- const resolvedRoot = import_node_path9.default.resolve(root);
7521
- const resolvedTarget = import_node_path9.default.resolve(target);
7522
- const relative4 = import_node_path9.default.relative(resolvedRoot, resolvedTarget);
7523
- if (relative4 === "" || !relative4.startsWith("..") && !import_node_path9.default.isAbsolute(relative4)) {
7633
+ const resolvedRoot = import_node_path10.default.resolve(root);
7634
+ const resolvedTarget = import_node_path10.default.resolve(target);
7635
+ const relative4 = import_node_path10.default.relative(resolvedRoot, resolvedTarget);
7636
+ if (relative4 === "" || !relative4.startsWith("..") && !import_node_path10.default.isAbsolute(relative4)) {
7524
7637
  return resolvedTarget;
7525
7638
  }
7526
7639
  return null;
@@ -7534,16 +7647,16 @@ function isFarmDocsRequest(docs, request) {
7534
7647
  return pathname === entry || pathname === `${entry}.md` || pathname.startsWith(`${entry}/`);
7535
7648
  }
7536
7649
  function resolveFarmDocsContentDir(docs, options) {
7537
- const root = import_node_path9.default.resolve(options.root);
7650
+ const root = import_node_path10.default.resolve(options.root);
7538
7651
  const srcDir = options.srcDir || "src";
7539
7652
  const configuredContentDir = docs.contentDir || docs.config.contentDir;
7540
7653
  if (configuredContentDir) {
7541
- return import_node_path9.default.isAbsolute(configuredContentDir) ? configuredContentDir : import_node_path9.default.join(root, configuredContentDir);
7654
+ return import_node_path10.default.isAbsolute(configuredContentDir) ? configuredContentDir : import_node_path10.default.join(root, configuredContentDir);
7542
7655
  }
7543
7656
  const entryDir = docs.config.entry || trimSlashes2(docs.entry) || "docs";
7544
- const appDocsDir = import_node_path9.default.join(root, srcDir, "app", entryDir);
7657
+ const appDocsDir = import_node_path10.default.join(root, srcDir, "app", entryDir);
7545
7658
  if ((0, import_node_fs7.existsSync)(appDocsDir)) return appDocsDir;
7546
- return import_node_path9.default.join(root, entryDir);
7659
+ return import_node_path10.default.join(root, entryDir);
7547
7660
  }
7548
7661
  function getFarmDocsRouteTypeEntries(docs) {
7549
7662
  if (!docs?.enabled) return [];
@@ -7566,10 +7679,10 @@ function getRequestSlug(docs, request) {
7566
7679
  function findDocsPageFile(contentDir, slug) {
7567
7680
  const segments = slug ? slug.split("/").filter(Boolean) : [];
7568
7681
  if (!segments.every(isSafeSegment)) return null;
7569
- const slugDir = import_node_path9.default.join(contentDir, ...segments);
7570
- const candidates = segments.length === 0 ? DOCS_FILE_NAMES.map((filename) => import_node_path9.default.join(contentDir, filename)) : [
7571
- ...DOCS_FILE_NAMES.map((filename) => import_node_path9.default.join(slugDir, filename)),
7572
- ...DOCS_FILE_EXTENSIONS2.map((extension) => import_node_path9.default.join(contentDir, `${slug}${extension}`))
7682
+ const slugDir = import_node_path10.default.join(contentDir, ...segments);
7683
+ const candidates = segments.length === 0 ? DOCS_FILE_NAMES.map((filename) => import_node_path10.default.join(contentDir, filename)) : [
7684
+ ...DOCS_FILE_NAMES.map((filename) => import_node_path10.default.join(slugDir, filename)),
7685
+ ...DOCS_FILE_EXTENSIONS2.map((extension) => import_node_path10.default.join(contentDir, `${slug}${extension}`))
7573
7686
  ];
7574
7687
  for (const candidate of candidates) {
7575
7688
  const safePath = resolveInside(contentDir, candidate);
@@ -7630,9 +7743,9 @@ function createDocsHref(entry, slug) {
7630
7743
  return normalizedSlug ? `${normalizedEntry}/${normalizedSlug}` : normalizedEntry;
7631
7744
  }
7632
7745
  function pathToSlug(contentDir, filePath) {
7633
- const relative4 = import_node_path9.default.relative(contentDir, filePath).replace(/\\/g, "/");
7746
+ const relative4 = import_node_path10.default.relative(contentDir, filePath).replace(/\\/g, "/");
7634
7747
  if (relative4.startsWith("..")) return null;
7635
- const extension = import_node_path9.default.extname(relative4);
7748
+ const extension = import_node_path10.default.extname(relative4);
7636
7749
  if (!DOCS_FILE_EXTENSIONS2.includes(extension)) return null;
7637
7750
  const withoutExtension = relative4.slice(0, -extension.length);
7638
7751
  if (withoutExtension === "page" || withoutExtension === "index") return "";
@@ -7650,7 +7763,7 @@ function discoverFarmDocsPages(contentDir, docs) {
7650
7763
  const visit = /* @__PURE__ */ __name((dir) => {
7651
7764
  for (const entry of (0, import_node_fs7.readdirSync)(dir, { withFileTypes: true })) {
7652
7765
  if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
7653
- const absolutePath = import_node_path9.default.join(dir, entry.name);
7766
+ const absolutePath = import_node_path10.default.join(dir, entry.name);
7654
7767
  if (entry.isDirectory()) {
7655
7768
  visit(absolutePath);
7656
7769
  continue;
@@ -8489,13 +8602,13 @@ ${renderDocsHashRuntimeScript()}
8489
8602
  ${renderDocsPageActionsRuntimeScript()}`;
8490
8603
  }
8491
8604
  function readCssWithImports(filePath, seen = /* @__PURE__ */ new Set()) {
8492
- const resolved = import_node_path9.default.resolve(filePath);
8605
+ const resolved = import_node_path10.default.resolve(filePath);
8493
8606
  if (seen.has(resolved)) return "";
8494
8607
  seen.add(resolved);
8495
8608
  const source = (0, import_node_fs7.readFileSync)(resolved, "utf8");
8496
8609
  return source.replace(/@import\s+["']([^"']+)["'];?/g, (_match, importPath) => {
8497
8610
  try {
8498
- const importedPath = importPath.startsWith(".") ? import_node_path9.default.resolve(import_node_path9.default.dirname(resolved), importPath) : (0, import_node_module3.createRequire)(resolved).resolve(importPath);
8611
+ const importedPath = importPath.startsWith(".") ? import_node_path10.default.resolve(import_node_path10.default.dirname(resolved), importPath) : (0, import_node_module4.createRequire)(resolved).resolve(importPath);
8499
8612
  return readCssWithImports(importedPath, seen);
8500
8613
  } catch {
8501
8614
  return "";
@@ -8503,13 +8616,13 @@ function readCssWithImports(filePath, seen = /* @__PURE__ */ new Set()) {
8503
8616
  });
8504
8617
  }
8505
8618
  function resolvePixelBorderThemeCss(options) {
8506
- const cacheKey = import_node_path9.default.resolve(options.root);
8619
+ const cacheKey = import_node_path10.default.resolve(options.root);
8507
8620
  const cached = themeCssCache.get(cacheKey);
8508
8621
  if (cached !== void 0) return cached;
8509
8622
  try {
8510
- const requireFromApp = (0, import_node_module3.createRequire)(import_node_path9.default.join(cacheKey, "package.json"));
8623
+ const requireFromApp = (0, import_node_module4.createRequire)(import_node_path10.default.join(cacheKey, "package.json"));
8511
8624
  const themeCssPath = requireFromApp.resolve("@farming-labs/theme/pixel-border/css");
8512
- const requireFromTheme = (0, import_node_module3.createRequire)(themeCssPath);
8625
+ const requireFromTheme = (0, import_node_module4.createRequire)(themeCssPath);
8513
8626
  const fumadocsCssPath = requireFromTheme.resolve("fumadocs-ui/style.css");
8514
8627
  const css = `${readCssWithImports(fumadocsCssPath)}
8515
8628
  ${readCssWithImports(themeCssPath)}`;
@@ -8625,7 +8738,7 @@ function renderFarmDocsBridgeCss(docs) {
8625
8738
  .sh-code { --sh-class: #e5c07b; --sh-identifier: #c8ccd4; --sh-string: #98c379; --sh-keyword: #c678dd; --sh-comment: #5c6370; --sh-property: #e06c75; --sh-sign: #c8ccd4; --sh-space: inherit; }
8626
8739
  .code-block { --fd-code-header-bg: color-mix(in srgb, var(--color-fd-foreground, #fff) 5%, var(--color-fd-background, #000)); --fd-code-body-bg: color-mix(in srgb, var(--color-fd-foreground, #fff) 8%, var(--color-fd-background, #000)); position: relative; width: 100%; min-width: 0; max-width: 100%; margin: 20px 0; overflow: hidden; border: 1px solid var(--color-fd-border, hsl(0 0% 15%)); background: var(--color-fd-background, hsl(0 0% 2%)); box-shadow: 3px 3px 0 0 var(--color-fd-border, hsl(0 0% 15%)); font-family: var(--fd-docs-font-mono); }
8627
8740
  #nd-docs-layout figure.shiki.code-block { box-shadow: 3px 3px 0 0 var(--color-fd-border, hsl(0 0% 15%)) !important; }
8628
- .code-block-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; min-height: 30px; border-bottom: 1px solid var(--color-fd-border, hsl(0 0% 15%)); background-color: var(--fd-code-header-bg); background-image: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--color-fd-foreground, #fff) 7%, transparent), color-mix(in srgb, var(--color-fd-foreground, #fff) 7%, transparent) 1px, transparent 1px, transparent 6px); padding: 4px 8px 4px 10px; }
8741
+ .code-block-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; min-height: 34px; border-bottom: 1px solid var(--color-fd-border, hsl(0 0% 15%)); background-color: var(--fd-code-header-bg); background-image: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--color-fd-foreground, #fff) 4%, transparent), color-mix(in srgb, var(--color-fd-foreground, #fff) 4%, transparent) 1px, transparent 1px, transparent 6px); padding: 4px 8px 4px 10px; }
8629
8742
  .code-block-title { overflow: hidden; color: color-mix(in srgb, var(--color-fd-foreground, #fff) 50%, transparent); font-size: 10px; line-height: 1.2; text-overflow: ellipsis; text-transform: lowercase; white-space: nowrap; }
8630
8743
  .code-copy { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex: 0 0 auto; border: 1px solid var(--color-fd-border, hsl(0 0% 15%)); background: color-mix(in srgb, var(--color-fd-background, #000) 80%, transparent); color: var(--color-fd-muted-foreground, hsl(0 0% 55%)); cursor: pointer; padding: 0; }
8631
8744
  .code-copy-floating { position: absolute; top: 8px; right: 8px; z-index: 2; opacity: 0.72; transition: opacity 150ms ease; }
@@ -8693,7 +8806,7 @@ function renderFarmDocsBridgeCss(docs) {
8693
8806
  .prose h2 { margin-top: 34px; padding-top: 22px; font-size: 23px; }
8694
8807
  .code-block { margin: 16px 0; box-shadow: 2px 2px 0 0 var(--color-fd-border, hsl(0 0% 15%)); }
8695
8808
  #nd-docs-layout figure.shiki.code-block { box-shadow: 2px 2px 0 0 var(--color-fd-border, hsl(0 0% 15%)) !important; }
8696
- .code-block-header { min-height: 26px; padding: 2px 6px 2px 8px; }
8809
+ .code-block-header { min-height: 32px; padding: 3px 7px 3px 9px; }
8697
8810
  .code-copy-floating { top: 6px; right: 6px; }
8698
8811
  #nd-docs-layout figure.shiki.code-block pre, .code-block pre { padding: 12px 11px !important; font-size: 12px; line-height: 1.5; }
8699
8812
  .sh__line { min-height: 1.5em; }
@@ -8703,13 +8816,11 @@ function renderFarmDocsBridgeCss(docs) {
8703
8816
  .fd-page-footer .fd-last-updated-footer { margin-left: 0; }
8704
8817
  }
8705
8818
  @media (max-width: 640px) {
8706
- .code-block-header { min-height: 22px; padding: 1px 4px 1px 7px; }
8707
- .code-block-title { font-size: 9px; }
8708
- .code-copy { width: 20px; height: 20px; }
8709
- .code-copy svg { width: 12px; height: 12px; }
8710
- .code-copy-floating { top: 5px; right: 5px; }
8711
- #nd-docs-layout figure.shiki.code-block pre, .code-block pre { padding: 10px !important; font-size: 11px; line-height: 1.55; }
8712
- .sh__line { min-height: 1.55em; }
8819
+ .code-block-header { min-height: 30px; padding: 3px 6px 3px 8px; }
8820
+ .code-copy-floating { top: 7px; right: 7px; }
8821
+ #nd-docs-layout figure.shiki.code-block pre, .code-block pre { padding: 12px !important; font-size: 12px; line-height: 1.6; }
8822
+ #nd-docs-layout figure.shiki.code-block-plain pre, .code-block-plain pre { padding: 16px 44px 16px 14px !important; line-height: 1.65; }
8823
+ .sh__line { min-height: 1.6em; }
8713
8824
  }
8714
8825
  ${farmDocsPixelBorderCss}
8715
8826
  `;
@@ -8828,13 +8939,13 @@ function createFarmDocsHandler(docs, options) {
8828
8939
  );
8829
8940
  }, "handleFarmDocsRequest");
8830
8941
  }
8831
- var import_node_fs7, import_node_module3, import_node_path9, import_docs, import_marked, import_sugar_high, DOCS_FILE_NAMES, DOCS_FILE_EXTENSIONS2, FARM_DOCS_FALLBACK_FAVICON, FARM_DOCS_FAVICON_FILES, GEIST_SANS_FONT_URL, GEIST_MONO_FONT_URL, CODE_LANGUAGE_LABELS, EXTENSIONLESS_CODE_FILENAMES, SIDEBAR_SECTION_ORDER, SIDEBAR_PAGE_ORDER, themeCssCache;
8942
+ var import_node_fs7, import_node_module4, import_node_path10, import_docs, import_marked, import_sugar_high, DOCS_FILE_NAMES, DOCS_FILE_EXTENSIONS2, FARM_DOCS_FALLBACK_FAVICON, FARM_DOCS_FAVICON_FILES, GEIST_SANS_FONT_URL, GEIST_MONO_FONT_URL, CODE_LANGUAGE_LABELS, EXTENSIONLESS_CODE_FILENAMES, SIDEBAR_SECTION_ORDER, SIDEBAR_PAGE_ORDER, themeCssCache;
8832
8943
  var init_handler = __esm({
8833
8944
  "src/docs/handler.ts"() {
8834
8945
  "use strict";
8835
8946
  import_node_fs7 = require("fs");
8836
- import_node_module3 = require("module");
8837
- import_node_path9 = __toESM(require("path"));
8947
+ import_node_module4 = require("module");
8948
+ import_node_path10 = __toESM(require("path"));
8838
8949
  import_docs = require("@farming-labs/docs");
8839
8950
  import_marked = require("marked");
8840
8951
  import_sugar_high = require("sugar-high");
@@ -9319,18 +9430,18 @@ function sanitizeDocsConfig(config) {
9319
9430
  return cloneSerializable(config) || {};
9320
9431
  }
9321
9432
  async function findDocsConfigPath(rootDir, configPath) {
9322
- const { existsSync: existsSync13 } = await import("fs");
9433
+ const { existsSync: existsSync14 } = await import("fs");
9323
9434
  const root = import_path9.default.resolve(rootDir || process.cwd());
9324
9435
  if (configPath) {
9325
9436
  const resolvedPath = import_path9.default.isAbsolute(configPath) ? configPath : import_path9.default.join(root, configPath);
9326
- if (!existsSync13(resolvedPath)) {
9437
+ if (!existsSync14(resolvedPath)) {
9327
9438
  throw new Error(`Could not find docs config at ${configPath}.`);
9328
9439
  }
9329
9440
  return import_path9.default.resolve(resolvedPath);
9330
9441
  }
9331
9442
  for (const filename of DOCS_CONFIG_FILENAMES) {
9332
9443
  const resolvedPath = import_path9.default.join(root, filename);
9333
- if (existsSync13(resolvedPath)) {
9444
+ if (existsSync14(resolvedPath)) {
9334
9445
  return resolvedPath;
9335
9446
  }
9336
9447
  }
@@ -9338,7 +9449,7 @@ async function findDocsConfigPath(rootDir, configPath) {
9338
9449
  }
9339
9450
  async function loadDocsConfig(rootDir, configPath) {
9340
9451
  const fs9 = await import("fs/promises");
9341
- const { pathToFileURL: pathToFileURL3 } = await import("url");
9452
+ const { pathToFileURL: pathToFileURL4 } = await import("url");
9342
9453
  const root = import_path9.default.resolve(rootDir || process.cwd());
9343
9454
  const resolvedPath = await findDocsConfigPath(root, configPath);
9344
9455
  if (!resolvedPath) return void 0;
@@ -9367,7 +9478,7 @@ async function loadDocsConfig(rootDir, configPath) {
9367
9478
  logLevel: "silent",
9368
9479
  sourcemap: "inline"
9369
9480
  });
9370
- const moduleUrl = pathToFileURL3(modulePath).href + `?t=${Date.now()}`;
9481
+ const moduleUrl = pathToFileURL4(modulePath).href + `?t=${Date.now()}`;
9371
9482
  let importedConfig;
9372
9483
  try {
9373
9484
  importedConfig = await import(
@@ -9468,6 +9579,17 @@ async function resolveConfig(userConfig, mode) {
9468
9579
  const mdx = resolveMdxConfig(userConfig.mdx);
9469
9580
  const env2 = resolveEnv(userConfig.env, process.env);
9470
9581
  setEnv(env2);
9582
+ const auth = resolveFarmAuthConfig(userConfig.auth);
9583
+ if (auth.enabled && userConfig.integrations?.auth) {
9584
+ throw new Error(
9585
+ "Choose either the top-level `auth` config or `integrations.auth`; they cannot both own the auth route."
9586
+ );
9587
+ }
9588
+ const nativeAuthIntegration = await resolveFarmAuthIntegration(auth, {
9589
+ root,
9590
+ mode
9591
+ });
9592
+ const integrations = nativeAuthIntegration ? { ...userConfig.integrations, auth: nativeAuthIntegration } : userConfig.integrations || {};
9471
9593
  const generateBuildId = userConfig.generateBuildId || (() => `build-${Date.now()}`);
9472
9594
  const deploymentId = normalizeFarmDeploymentId(
9473
9595
  userConfig.deploymentId || process.env.FARM_DEPLOYMENT_ID || process.env.VERCEL_GIT_COMMIT_SHA || process.env.CF_PAGES_COMMIT_SHA || (mode === "production" ? await generateBuildId() : "development")
@@ -9492,14 +9614,15 @@ async function resolveConfig(userConfig, mode) {
9492
9614
  devtools: resolveFarmDevtoolsConfig(userConfig.devtools, mode),
9493
9615
  storage: userConfig.storage || {},
9494
9616
  cache: userConfig.cache || {},
9617
+ auth,
9495
9618
  suppressLintOnLink: userConfig.suppressLintOnLink ?? false,
9496
9619
  experimental: {
9497
9620
  serverComponents: false,
9498
9621
  serverActions: false,
9499
9622
  ...userConfig.experimental
9500
9623
  },
9501
- plugins: [...resolveIntegrationPlugins(userConfig.integrations), ...userConfig.plugins || []],
9502
- integrations: userConfig.integrations || {},
9624
+ plugins: [...resolveIntegrationPlugins(integrations), ...userConfig.plugins || []],
9625
+ integrations,
9503
9626
  trailingSlash: userConfig.trailingSlash ?? false,
9504
9627
  redirects: /* @__PURE__ */ __name(() => [...redirects, ...routeRuleRedirects], "redirects"),
9505
9628
  rewrites: /* @__PURE__ */ __name(() => rewrites, "rewrites"),
@@ -9544,7 +9667,7 @@ async function resolveConfig(userConfig, mode) {
9544
9667
  return resolved;
9545
9668
  }
9546
9669
  async function loadConfig(rootDir, configPath, mode = process.env.NODE_ENV === "production" ? "production" : "development", loadEnvironment) {
9547
- const { existsSync: existsSync13 } = await import("fs");
9670
+ const { existsSync: existsSync14 } = await import("fs");
9548
9671
  const loadEnv = loadEnvironment || (await import("vite")).loadEnv;
9549
9672
  const root = rootDir || process.cwd();
9550
9673
  const loadedEnv = loadEnv(mode, root, "");
@@ -9568,7 +9691,7 @@ async function loadConfig(rootDir, configPath, mode = process.env.NODE_ENV === "
9568
9691
  try {
9569
9692
  const absolutePath = relativePath2.startsWith("/") ? relativePath2 : import_path9.default.join(root, relativePath2);
9570
9693
  const normalizedPath = import_path9.default.resolve(absolutePath);
9571
- if (!existsSync13(normalizedPath)) {
9694
+ if (!existsSync14(normalizedPath)) {
9572
9695
  continue;
9573
9696
  }
9574
9697
  const loadedConfig = await loadFarmConfigFile(normalizedPath, { root });
@@ -9598,6 +9721,7 @@ var init_config2 = __esm({
9598
9721
  init_devtools_config();
9599
9722
  init_image_config();
9600
9723
  init_config();
9724
+ init_auth_config();
9601
9725
  init_config_entry();
9602
9726
  FARM_RESOLVED_CUSTOM_CONTEXT = /* @__PURE__ */ Symbol.for("farm.resolvedCustomContext");
9603
9727
  __name(normalizeDeployTarget, "normalizeDeployTarget");
@@ -10394,8 +10518,8 @@ var init_generator = __esm({
10394
10518
  }
10395
10519
  routeGroups.get(key).push(route);
10396
10520
  }
10397
- for (const [path23, routeList] of routeGroups) {
10398
- const openAPIPath = this.convertToOpenAPIPath(path23);
10521
+ for (const [path24, routeList] of routeGroups) {
10522
+ const openAPIPath = this.convertToOpenAPIPath(path24);
10399
10523
  spec.paths[openAPIPath] = {};
10400
10524
  for (const route of routeList) {
10401
10525
  for (const method of route.methods) {
@@ -10409,8 +10533,8 @@ var init_generator = __esm({
10409
10533
  /**
10410
10534
  * Convert Farm.js API path to OpenAPI path format
10411
10535
  */
10412
- convertToOpenAPIPath(path23) {
10413
- return path23.replace(/^\/api/, "");
10536
+ convertToOpenAPIPath(path24) {
10537
+ return path24.replace(/^\/api/, "");
10414
10538
  }
10415
10539
  /**
10416
10540
  * Extract request body schema from endpoint
@@ -10572,8 +10696,8 @@ var init_generator = __esm({
10572
10696
  /**
10573
10697
  * Generate operation summary
10574
10698
  */
10575
- generateSummary(path23, method) {
10576
- const cleanPath = path23.replace(/^\/api\//, "");
10699
+ generateSummary(path24, method) {
10700
+ const cleanPath = path24.replace(/^\/api\//, "");
10577
10701
  const pathParts = cleanPath.split("/");
10578
10702
  const lastPart = pathParts[pathParts.length - 1];
10579
10703
  const action = method === "GET" ? "Get" : method === "POST" ? "Create" : method === "PUT" ? "Update" : method === "DELETE" ? "Delete" : method === "PATCH" ? "Update" : method;
@@ -10582,22 +10706,22 @@ var init_generator = __esm({
10582
10706
  /**
10583
10707
  * Generate operation description
10584
10708
  */
10585
- generateDescription(path23, method) {
10586
- const cleanPath = path23.replace(/^\/api\//, "");
10709
+ generateDescription(path24, method) {
10710
+ const cleanPath = path24.replace(/^\/api\//, "");
10587
10711
  return `${method} ${cleanPath} endpoint`;
10588
10712
  }
10589
10713
  /**
10590
10714
  * Generate operation ID
10591
10715
  */
10592
- generateOperationId(path23, method) {
10593
- const cleanPath = path23.replace(/^\/api\//, "").replace(/\//g, "_");
10716
+ generateOperationId(path24, method) {
10717
+ const cleanPath = path24.replace(/^\/api\//, "").replace(/\//g, "_");
10594
10718
  return `${method.toLowerCase()}_${cleanPath}`;
10595
10719
  }
10596
10720
  /**
10597
10721
  * Generate tags for grouping operations
10598
10722
  */
10599
- generateTags(path23) {
10600
- const cleanPath = path23.replace(/^\/api\//, "");
10723
+ generateTags(path24) {
10724
+ const cleanPath = path24.replace(/^\/api\//, "");
10601
10725
  const pathParts = cleanPath.split("/");
10602
10726
  if (pathParts.length > 1) {
10603
10727
  return [pathParts[0]];
@@ -10610,8 +10734,8 @@ var init_generator = __esm({
10610
10734
  async generateSpecFile(routes, outputPath) {
10611
10735
  const spec = await this.generateSpec(routes);
10612
10736
  const fs9 = require("fs");
10613
- const path23 = require("path");
10614
- const dir = path23.dirname(outputPath);
10737
+ const path24 = require("path");
10738
+ const dir = path24.dirname(outputPath);
10615
10739
  if (!fs9.existsSync(dir)) {
10616
10740
  fs9.mkdirSync(dir, { recursive: true });
10617
10741
  }
@@ -11031,7 +11155,7 @@ async function createFarmDevtoolsSnapshot(input) {
11031
11155
  generatedAt: (input.now?.() || /* @__PURE__ */ new Date()).toISOString(),
11032
11156
  health: resolveHealth(diagnostics),
11033
11157
  project: {
11034
- name: import_node_path10.default.basename(import_node_path10.default.resolve(input.root)),
11158
+ name: import_node_path11.default.basename(import_node_path11.default.resolve(input.root)),
11035
11159
  root: input.root,
11036
11160
  srcDir: input.srcDir,
11037
11161
  basePath: config.basePath || "/",
@@ -11080,11 +11204,11 @@ async function createFarmDevtoolsSnapshot(input) {
11080
11204
  diagnostics
11081
11205
  };
11082
11206
  }
11083
- var import_node_path10;
11207
+ var import_node_path11;
11084
11208
  var init_devtools = __esm({
11085
11209
  "src/devtools.ts"() {
11086
11210
  "use strict";
11087
- import_node_path10 = __toESM(require("path"));
11211
+ import_node_path11 = __toESM(require("path"));
11088
11212
  init_config2();
11089
11213
  init_cron();
11090
11214
  init_route_runtime();
@@ -14144,7 +14268,7 @@ function normalizePositiveDuration(value, fallback, name) {
14144
14268
  }
14145
14269
  __name(normalizePositiveDuration, "normalizePositiveDuration");
14146
14270
  function delay(ms) {
14147
- return new Promise((resolve5) => setTimeout(resolve5, ms));
14271
+ return new Promise((resolve6) => setTimeout(resolve6, ms));
14148
14272
  }
14149
14273
  __name(delay, "delay");
14150
14274
  function normalizeCacheOptionsTags(options) {
@@ -14295,25 +14419,25 @@ function defineRoutes(input) {
14295
14419
  }
14296
14420
  __name(defineRoutes, "defineRoutes");
14297
14421
  var routesBuilder = {
14298
- page(path23, options) {
14422
+ page(path24, options) {
14299
14423
  return normalizeProgrammaticRoute({
14300
14424
  kind: "page",
14301
- path: path23,
14425
+ path: path24,
14302
14426
  ...options
14303
14427
  });
14304
14428
  },
14305
- layout(path23, options) {
14429
+ layout(path24, options) {
14306
14430
  return normalizeProgrammaticRoute({
14307
14431
  kind: "layout",
14308
- path: path23,
14432
+ path: path24,
14309
14433
  ...options
14310
14434
  });
14311
14435
  },
14312
- api(path23, options) {
14436
+ api(path24, options) {
14313
14437
  const { render, runtime, regions, maxDuration, ...methods } = options;
14314
14438
  return normalizeProgrammaticRoute({
14315
14439
  kind: "api",
14316
- path: path23,
14440
+ path: path24,
14317
14441
  render,
14318
14442
  runtime,
14319
14443
  regions,
@@ -14349,7 +14473,7 @@ function getProgrammaticRouteSearchClientOptions(search) {
14349
14473
  return Object.keys(options).length > 0 ? options : void 0;
14350
14474
  }
14351
14475
  __name(getProgrammaticRouteSearchClientOptions, "getProgrammaticRouteSearchClientOptions");
14352
- function resolveProgrammaticRouteSearch(searchConfig, rawSearch, path23, routePath) {
14476
+ function resolveProgrammaticRouteSearch(searchConfig, rawSearch, path24, routePath) {
14353
14477
  const schema = getProgrammaticRouteSearchSchema(searchConfig);
14354
14478
  const search = parseProgrammaticSchema(schema, rawSearch, "search", routePath);
14355
14479
  const options = getProgrammaticRouteSearchOptions(searchConfig);
@@ -14358,7 +14482,7 @@ function resolveProgrammaticRouteSearch(searchConfig, rawSearch, path23, routePa
14358
14482
  schema,
14359
14483
  rawSearch,
14360
14484
  parsedSearch: search,
14361
- path: path23
14485
+ path: path24
14362
14486
  });
14363
14487
  return { search, canonicalPath };
14364
14488
  }
@@ -14541,7 +14665,7 @@ function createRouteModuleFromProgrammaticPage(route) {
14541
14665
  mod.__farmRouteData = route.data;
14542
14666
  mod.__farmRouteParsesProps = true;
14543
14667
  mod.__farmResolveRouteProps = (props) => resolveProgrammaticRouteProps(route, props);
14544
- mod.__farmResolveRouteCanonicalPath = (rawSearch, path23) => resolveProgrammaticRouteSearch(route.search, rawSearch, path23, route.path).canonicalPath;
14668
+ mod.__farmResolveRouteCanonicalPath = (rawSearch, path24) => resolveProgrammaticRouteSearch(route.search, rawSearch, path24, route.path).canonicalPath;
14545
14669
  }
14546
14670
  if (route.pending || route.error || route.notFound) {
14547
14671
  mod.__farmRouteComponents = {
@@ -15748,8 +15872,56 @@ var _RouteManager = class _RouteManager {
15748
15872
  "**/{opengraph-image,twitter-image}.{ts,tsx,js,jsx,png,jpg,jpeg,gif,webp}",
15749
15873
  appDir
15750
15874
  );
15875
+ const canonicalPageGroups = /* @__PURE__ */ new Map();
15876
+ for (const file of pageFiles.filter((candidate) => parseRouteSlotFile(candidate) === null)) {
15877
+ const route = parseRoutePath(file);
15878
+ const pattern = this.createRoutePattern(route);
15879
+ const group = canonicalPageGroups.get(pattern);
15880
+ if (group) {
15881
+ group.files.push(file);
15882
+ } else {
15883
+ canonicalPageGroups.set(pattern, {
15884
+ route,
15885
+ files: [file]
15886
+ });
15887
+ }
15888
+ }
15889
+ for (const [pattern, group] of canonicalPageGroups) {
15890
+ const componentFiles = group.files.filter((file) => !isFarmMarkdownPageFile(file));
15891
+ const markdownFiles = group.files.filter(isFarmMarkdownPageFile);
15892
+ if (componentFiles.length > 1) {
15893
+ throw new Error(
15894
+ `Duplicate page route "${pattern}". Found ${componentFiles.map((file) => import_path5.default.join(appDir, file)).join(" and ")}.`
15895
+ );
15896
+ }
15897
+ if (markdownFiles.length > 1) {
15898
+ throw new Error(
15899
+ `Duplicate markdown representation for page route "${pattern}". Found ${markdownFiles.map((file) => import_path5.default.join(appDir, file)).join(" and ")}.`
15900
+ );
15901
+ }
15902
+ const componentFile = componentFiles[0];
15903
+ const markdownFile = markdownFiles[0];
15904
+ const primaryFile = componentFile || markdownFile;
15905
+ if (!primaryFile) continue;
15906
+ const modulePath = import_path5.default.join(appDir, primaryFile);
15907
+ const existing = this.routes.get(pattern);
15908
+ if (existing?.sourceRoot === source.root) {
15909
+ throw new Error(
15910
+ `Duplicate page route "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
15911
+ );
15912
+ }
15913
+ this.routes.set(pattern, {
15914
+ route: group.route,
15915
+ modulePath,
15916
+ ...markdownFile ? {
15917
+ markdownSourcePath: import_path5.default.join(appDir, markdownFile)
15918
+ } : {},
15919
+ pattern,
15920
+ source: "file",
15921
+ sourceRoot: source.root
15922
+ });
15923
+ }
15751
15924
  for (const [kind, files, target] of [
15752
- ["page", pageFiles.filter((file) => parseRouteSlotFile(file) === null), this.routes],
15753
15925
  ["layout", layoutFiles, this.layouts],
15754
15926
  ["loading", loadingFiles, this.loadings],
15755
15927
  ["error", errorFiles, this.errors]
@@ -17324,6 +17496,7 @@ __name(createTranslatorFromState, "createTranslatorFromState");
17324
17496
  _setFarmI18nSnapshotResolver(() => getFarmI18nClientSnapshot());
17325
17497
 
17326
17498
  // src/server/renderer.ts
17499
+ init_response();
17327
17500
  var cachedClerkProvider = null;
17328
17501
  var importRuntimeModule = new Function("specifier", "return import(specifier);");
17329
17502
  function hasRequestHeader(req, name) {
@@ -18170,6 +18343,15 @@ var _ServerRenderer = class _ServerRenderer {
18170
18343
  });
18171
18344
  });
18172
18345
  } catch (error) {
18346
+ if (isWebResponse(error)) {
18347
+ if (!res.headersSent && !res.writableEnded) {
18348
+ await sendWebResponse(res, error);
18349
+ } else if (!res.writableEnded) {
18350
+ res.end();
18351
+ }
18352
+ completeRender(error.status, pathname);
18353
+ return;
18354
+ }
18173
18355
  if (isFarmRedirectError(error)) {
18174
18356
  const redirect3 = getFarmRedirectError(error);
18175
18357
  const snapshot = getFarmI18nClientSnapshot();
@@ -18470,7 +18652,7 @@ var _ServerRenderer = class _ServerRenderer {
18470
18652
  }
18471
18653
  }
18472
18654
  async renderWithSSR(element, req, res, clearMiddlewareData, options = {}) {
18473
- return new Promise((resolve5, reject) => {
18655
+ return new Promise((resolve6, reject) => {
18474
18656
  const streamStartTime = Date.now();
18475
18657
  const observabilityRoute = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
18476
18658
  const deploymentId = this.getDeploymentId();
@@ -18650,7 +18832,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue(g
18650
18832
  route: observabilityRoute,
18651
18833
  durationMs: Date.now() - streamStartTime
18652
18834
  });
18653
- resolve5();
18835
+ resolve6();
18654
18836
  }
18655
18837
  });
18656
18838
  res.write(shell);
@@ -18661,7 +18843,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue(g
18661
18843
  },
18662
18844
  onShellError(error) {
18663
18845
  didError = true;
18664
- if (!isFarmRedirectError(error) && !isFarmNotFoundError(error)) {
18846
+ if (!isWebResponse(error) && !isFarmRedirectError(error) && !isFarmNotFoundError(error)) {
18665
18847
  logger.error(`SSR shell error: ${error}`);
18666
18848
  emitFarmEvent({
18667
18849
  type: "render.error",
@@ -18676,7 +18858,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue(g
18676
18858
  },
18677
18859
  onError(error) {
18678
18860
  didError = true;
18679
- if (!isFarmRedirectError(error) && !isFarmNotFoundError(error)) {
18861
+ if (!isWebResponse(error) && !isFarmRedirectError(error) && !isFarmNotFoundError(error)) {
18680
18862
  logger.error(`SSR streaming error: ${error}`);
18681
18863
  emitFarmEvent({
18682
18864
  type: "render.error",
@@ -18834,6 +19016,7 @@ var ServerRenderer = _ServerRenderer;
18834
19016
  var import_path6 = __toESM(require("path"));
18835
19017
  init_devtools_config();
18836
19018
  init_config();
19019
+ init_auth_config();
18837
19020
  var defaultDocsConfig = {
18838
19021
  enabled: false,
18839
19022
  entry: "/docs",
@@ -18891,6 +19074,7 @@ var _FarmApp = class _FarmApp {
18891
19074
  deploy: config.deploy || {},
18892
19075
  storage: config.storage || {},
18893
19076
  cache: config.cache || {},
19077
+ auth: isResolvedAuthConfig(config.auth) ? config.auth : resolveFarmAuthConfig(config.auth),
18894
19078
  integrations: config.integrations || {},
18895
19079
  plugins: config.plugins || [],
18896
19080
  migrations: config.migrations || { commands: [] },
@@ -18963,6 +19147,12 @@ function isResolvedI18nConfig(value) {
18963
19147
  return Boolean(value && typeof value === "object" && "enabled" in value);
18964
19148
  }
18965
19149
  __name(isResolvedI18nConfig, "isResolvedI18nConfig");
19150
+ function isResolvedAuthConfig(value) {
19151
+ return Boolean(
19152
+ value && typeof value === "object" && "enabled" in value && "emailAndPassword" in value && "database" in value
19153
+ );
19154
+ }
19155
+ __name(isResolvedAuthConfig, "isResolvedAuthConfig");
18966
19156
  function createFarmApp(config, viteServer) {
18967
19157
  return new FarmApp(config, viteServer);
18968
19158
  }
@@ -19299,7 +19489,7 @@ var HMRManager = _HMRManager;
19299
19489
 
19300
19490
  // src/api/route-manager.ts
19301
19491
  var fs3 = __toESM(require("fs"));
19302
- var path10 = __toESM(require("path"));
19492
+ var path11 = __toESM(require("path"));
19303
19493
  init_route_runtime();
19304
19494
 
19305
19495
  // src/api/runtime.ts
@@ -19632,7 +19822,7 @@ var _APIRouteManager = class _APIRouteManager {
19632
19822
  async discoverRoutes() {
19633
19823
  this.routes.clear();
19634
19824
  for (const appDir of this.appDirs) {
19635
- const apiDir = path10.join(appDir, "api");
19825
+ const apiDir = path11.join(appDir, "api");
19636
19826
  let routeFiles = [];
19637
19827
  if (fs3.existsSync(apiDir)) {
19638
19828
  routeFiles = this.findRouteFiles(apiDir);
@@ -19660,7 +19850,7 @@ var _APIRouteManager = class _APIRouteManager {
19660
19850
  }
19661
19851
  const entries = fs3.readdirSync(dir, { withFileTypes: true });
19662
19852
  for (const entry of entries) {
19663
- const fullPath = path10.join(dir, entry.name);
19853
+ const fullPath = path11.join(dir, entry.name);
19664
19854
  if (entry.isDirectory()) {
19665
19855
  files.push(...this.findRouteFiles(fullPath));
19666
19856
  } else if (entry.name === "route.ts" || entry.name === "route.tsx" || entry.name === "route.js") {
@@ -19674,8 +19864,8 @@ var _APIRouteManager = class _APIRouteManager {
19674
19864
  */
19675
19865
  async loadRoute(filePath, appDir) {
19676
19866
  try {
19677
- const apiDir = path10.join(appDir, "api");
19678
- const relativePath2 = path10.relative(apiDir, path10.dirname(filePath));
19867
+ const apiDir = path11.join(appDir, "api");
19868
+ const relativePath2 = path11.relative(apiDir, path11.dirname(filePath));
19679
19869
  const routePath = "/api/" + (relativePath2 === "." ? "" : relativePath2.replace(/\\/g, "/"));
19680
19870
  const routeModule = await this.loadModule(filePath);
19681
19871
  const endpoints = {};
@@ -19726,7 +19916,7 @@ var _APIRouteManager = class _APIRouteManager {
19726
19916
  }
19727
19917
  }
19728
19918
  async loadProgrammaticApiRoutes(appDir) {
19729
- const candidateRoots = [path10.dirname(appDir), appDir];
19919
+ const candidateRoots = [path11.dirname(appDir), appDir];
19730
19920
  const routeFiles = Array.from(
19731
19921
  new Set(candidateRoots.flatMap((srcRoot) => findProgrammaticRouteFilesInDir(srcRoot)))
19732
19922
  );
@@ -19752,11 +19942,11 @@ var _APIRouteManager = class _APIRouteManager {
19752
19942
  }
19753
19943
  findRootRoutesFile(appDir) {
19754
19944
  const routeNames = ["routes.ts", "routes.tsx", "routes.js"];
19755
- const candidateDirs = [path10.dirname(appDir), appDir];
19945
+ const candidateDirs = [path11.dirname(appDir), appDir];
19756
19946
  const seen = /* @__PURE__ */ new Set();
19757
19947
  for (const dir of candidateDirs) {
19758
19948
  for (const routeName of routeNames) {
19759
- const routesFile = path10.join(dir, routeName);
19949
+ const routesFile = path11.join(dir, routeName);
19760
19950
  if (seen.has(routesFile)) {
19761
19951
  continue;
19762
19952
  }
@@ -19869,7 +20059,7 @@ var APIRouteManager = _APIRouteManager;
19869
20059
 
19870
20060
  // src/middleware/manager.ts
19871
20061
  var fs4 = __toESM(require("fs"));
19872
- var path11 = __toESM(require("path"));
20062
+ var path12 = __toESM(require("path"));
19873
20063
 
19874
20064
  // src/middleware/context.ts
19875
20065
  function parseCookies(cookieHeader) {
@@ -20245,8 +20435,8 @@ var _MiddlewareManager = class _MiddlewareManager {
20245
20435
  const entries = fs4.readdirSync(dir, { withFileTypes: true });
20246
20436
  for (const entry of entries) {
20247
20437
  if (entry.isDirectory() && !entry.name.startsWith(".") && !entry.name.startsWith("_")) {
20248
- const subPath = path11.join(dir, entry.name);
20249
- const subRoutePath = path11.posix.join(routePath, entry.name);
20438
+ const subPath = path12.join(dir, entry.name);
20439
+ const subRoutePath = path12.posix.join(routePath, entry.name);
20250
20440
  await this.discoverInDirectory(subPath, subRoutePath, discovered);
20251
20441
  }
20252
20442
  }
@@ -20257,7 +20447,7 @@ var _MiddlewareManager = class _MiddlewareManager {
20257
20447
  findMiddlewareFile(dir) {
20258
20448
  const extensions = [".ts", ".tsx", ".js", ".jsx"];
20259
20449
  for (const ext of extensions) {
20260
- const filePath = path11.join(dir, `middleware${ext}`);
20450
+ const filePath = path12.join(dir, `middleware${ext}`);
20261
20451
  if (fs4.existsSync(filePath)) {
20262
20452
  return filePath;
20263
20453
  }
@@ -20609,7 +20799,7 @@ var import_path8 = require("path");
20609
20799
  init_type_generator();
20610
20800
 
20611
20801
  // src/routing/generate-route-types.ts
20612
- var path12 = __toESM(require("path"));
20802
+ var path13 = __toESM(require("path"));
20613
20803
  var fs5 = __toESM(require("fs"));
20614
20804
  init_write_file_if_changed();
20615
20805
  function routeSegmentsToTsTypeLiteral(segments) {
@@ -20652,19 +20842,23 @@ function createRoutePattern(route) {
20652
20842
  __name(createRoutePattern, "createRoutePattern");
20653
20843
  var DEFAULT_OUT_FILE = "farm-routes.d.ts";
20654
20844
  async function generateRouteTypes(options) {
20655
- const {
20656
- root,
20657
- srcDir = "src",
20658
- outFile = DEFAULT_OUT_FILE,
20659
- extraRoutes = [],
20660
- suppressLintOnLink = false
20661
- } = options;
20845
+ const root = path13.resolve(options.root);
20846
+ const srcDir = options.srcDir || "src";
20847
+ const outFile = options.outFile || DEFAULT_OUT_FILE;
20848
+ const outPath = path13.isAbsolute(outFile) ? outFile : path13.join(root, srcDir, outFile);
20849
+ const content = await createRouteTypeDeclarations(options, outPath);
20850
+ fs5.mkdirSync(path13.dirname(outPath), { recursive: true });
20851
+ writeFileIfChanged(outPath, content);
20852
+ return outPath;
20853
+ }
20854
+ __name(generateRouteTypes, "generateRouteTypes");
20855
+ async function createRouteTypeDeclarations(options, outPath) {
20856
+ const { root, srcDir = "src", extraRoutes = [], suppressLintOnLink = false } = options;
20662
20857
  const sourceRoots = options.sourceRoots ?? [{ name: "project", root, srcDir, layer: false }];
20663
- const outPath = path12.join(root, srcDir, outFile);
20664
20858
  const patterns = /* @__PURE__ */ new Set();
20665
20859
  const glob = await import("fast-glob");
20666
20860
  for (const source of sourceRoots) {
20667
- const appDir = path12.join(source.root, source.srcDir, "app");
20861
+ const appDir = path13.join(source.root, source.srcDir, "app");
20668
20862
  if (fs5.existsSync(appDir)) {
20669
20863
  const pageFiles = await glob.default("**/page.{ts,tsx,js,jsx,md,mdx}", {
20670
20864
  cwd: appDir,
@@ -20693,18 +20887,19 @@ async function generateRouteTypes(options) {
20693
20887
  const patternLiterals = sortedPatterns.map(routePatternToRouteLiteral);
20694
20888
  const routePathType = suppressLintOnLink ? "string" : typeLiterals.length ? typeLiterals.join(" | ") : "never";
20695
20889
  const routePatternType = suppressLintOnLink ? "string" : patternLiterals.length ? patternLiterals.join(" | ") : "never";
20890
+ const routeTypesImportPath = `./${path13.basename(outPath).replace(/\.d\.ts$/, "")}`;
20696
20891
  const augmentationBlock = suppressLintOnLink ? "" : `
20697
20892
  declare module "@farm.js/core/client" {
20698
20893
  interface LinkDefaultRoute {
20699
- _: import("./farm-routes").RoutePath;
20700
- pattern: import("./farm-routes").RoutePattern;
20894
+ _: import(${JSON.stringify(routeTypesImportPath)}).RoutePath;
20895
+ pattern: import(${JSON.stringify(routeTypesImportPath)}).RoutePattern;
20701
20896
  }
20702
20897
  }
20703
20898
 
20704
20899
  declare module "@farm.js/core" {
20705
20900
  interface LinkDefaultRoute {
20706
- _: import("./farm-routes").RoutePath;
20707
- pattern: import("./farm-routes").RoutePattern;
20901
+ _: import(${JSON.stringify(routeTypesImportPath)}).RoutePath;
20902
+ pattern: import(${JSON.stringify(routeTypesImportPath)}).RoutePattern;
20708
20903
  }
20709
20904
  // Ensure root import ("@farm.js/core") uses the same typed Link signature as client entry.
20710
20905
  const Link: typeof import("@farm.js/core/client").Link;
@@ -20713,8 +20908,8 @@ declare module "@farm.js/core" {
20713
20908
  // Internal declaration path used by @farm.js/core root type re-exports.
20714
20909
  declare module "@farm.js/core/dist/client.js" {
20715
20910
  interface LinkDefaultRoute {
20716
- _: import("./farm-routes").RoutePath;
20717
- pattern: import("./farm-routes").RoutePattern;
20911
+ _: import(${JSON.stringify(routeTypesImportPath)}).RoutePath;
20912
+ pattern: import(${JSON.stringify(routeTypesImportPath)}).RoutePattern;
20718
20913
  }
20719
20914
  }
20720
20915
  `;
@@ -20726,15 +20921,13 @@ declare module "@farm.js/core/dist/client.js" {
20726
20921
  export type RoutePath = ${routePathType};
20727
20922
  export type RoutePattern = ${routePatternType};${augmentationBlock}
20728
20923
  `;
20729
- fs5.mkdirSync(path12.dirname(outPath), { recursive: true });
20730
- writeFileIfChanged(outPath, content);
20731
- return outPath;
20924
+ return content;
20732
20925
  }
20733
- __name(generateRouteTypes, "generateRouteTypes");
20926
+ __name(createRouteTypeDeclarations, "createRouteTypeDeclarations");
20734
20927
 
20735
20928
  // src/env-types.ts
20736
20929
  var fs6 = __toESM(require("fs"));
20737
- var path13 = __toESM(require("path"));
20930
+ var path14 = __toESM(require("path"));
20738
20931
  init_write_file_if_changed();
20739
20932
  var DEFAULT_OUT_FILE2 = "farm-env.d.ts";
20740
20933
  var CONFIG_FILENAMES2 = [
@@ -20756,20 +20949,27 @@ var CONFIG_FILENAMES2 = [
20756
20949
  "config.cjs"
20757
20950
  ];
20758
20951
  async function generateEnvTypes(options) {
20759
- const root = path13.resolve(options.root);
20952
+ const root = path14.resolve(options.root);
20760
20953
  const srcDir = options.srcDir || "src";
20761
- const outPath = path13.join(root, srcDir, options.outFile || DEFAULT_OUT_FILE2);
20954
+ const outFile = options.outFile || DEFAULT_OUT_FILE2;
20955
+ const outPath = path14.isAbsolute(outFile) ? outFile : path14.join(root, srcDir, outFile);
20956
+ const content = createEnvTypeDeclarations(options, outPath);
20957
+ fs6.mkdirSync(path14.dirname(outPath), { recursive: true });
20958
+ writeFileIfChanged(outPath, content);
20959
+ return outPath;
20960
+ }
20961
+ __name(generateEnvTypes, "generateEnvTypes");
20962
+ function createEnvTypeDeclarations(options, outPath) {
20963
+ const root = path14.resolve(options.root);
20762
20964
  const configPath = findConfigPath(root, options.configPath);
20763
20965
  const configPaths = [
20764
20966
  ...(options.layerConfigPaths ?? []).filter((value) => fs6.existsSync(value)),
20765
20967
  ...configPath ? [configPath] : []
20766
20968
  ];
20767
20969
  const content = configPaths.length > 1 ? createLayeredConfigBackedEnvTypes(outPath, configPaths) : configPaths.length === 1 ? createConfigBackedEnvTypes(outPath, configPaths[0]) : createEmptyEnvTypes();
20768
- fs6.mkdirSync(path13.dirname(outPath), { recursive: true });
20769
- writeFileIfChanged(outPath, content);
20770
- return outPath;
20970
+ return content;
20771
20971
  }
20772
- __name(generateEnvTypes, "generateEnvTypes");
20972
+ __name(createEnvTypeDeclarations, "createEnvTypeDeclarations");
20773
20973
  function createLayeredConfigBackedEnvTypes(outPath, configPaths) {
20774
20974
  const imports = configPaths.map(
20775
20975
  (configPath, index) => `import type FarmConfig${index} from ${JSON.stringify(toTypeImportPath(outPath, configPath))};`
@@ -20825,11 +21025,11 @@ export {};
20825
21025
  __name(createLayeredConfigBackedEnvTypes, "createLayeredConfigBackedEnvTypes");
20826
21026
  function findConfigPath(root, configPath) {
20827
21027
  if (configPath) {
20828
- const resolvedPath = path13.isAbsolute(configPath) ? configPath : path13.join(root, configPath);
21028
+ const resolvedPath = path14.isAbsolute(configPath) ? configPath : path14.join(root, configPath);
20829
21029
  return fs6.existsSync(resolvedPath) ? resolvedPath : null;
20830
21030
  }
20831
21031
  for (const filename of CONFIG_FILENAMES2) {
20832
- const resolvedPath = path13.join(root, filename);
21032
+ const resolvedPath = path14.join(root, filename);
20833
21033
  if (fs6.existsSync(resolvedPath)) {
20834
21034
  return resolvedPath;
20835
21035
  }
@@ -20893,19 +21093,19 @@ export {};
20893
21093
  }
20894
21094
  __name(createEmptyEnvTypes, "createEmptyEnvTypes");
20895
21095
  function toTypeImportPath(outPath, targetPath) {
20896
- const relativePath2 = path13.relative(path13.dirname(outPath), targetPath).replace(/\\/g, "/").replace(/\.(tsx?|jsx?|mjs|cjs|mts|cts)$/, "");
21096
+ const relativePath2 = path14.relative(path14.dirname(outPath), targetPath).replace(/\\/g, "/").replace(/\.(tsx?|jsx?|mjs|cjs|mts|cts)$/, "");
20897
21097
  return relativePath2.startsWith(".") ? relativePath2 : `./${relativePath2}`;
20898
21098
  }
20899
21099
  __name(toTypeImportPath, "toTypeImportPath");
20900
21100
 
20901
21101
  // src/image-types.ts
20902
21102
  var import_node_fs3 = require("fs");
20903
- var import_node_path4 = __toESM(require("path"));
21103
+ var import_node_path5 = __toESM(require("path"));
20904
21104
  init_write_file_if_changed();
20905
21105
  var FARM_STATIC_IMAGE_EXTENSIONS = ["avif", "gif", "jpeg", "jpg", "png", "webp"];
20906
21106
  function generateFarmImageTypes(options) {
20907
- const outputPath = options.outFile ? import_node_path4.default.resolve(options.root, options.outFile) : import_node_path4.default.join(options.root, options.srcDir || "src", "farm-images.d.ts");
20908
- (0, import_node_fs3.mkdirSync)(import_node_path4.default.dirname(outputPath), { recursive: true });
21107
+ const outputPath = options.outFile ? import_node_path5.default.resolve(options.root, options.outFile) : import_node_path5.default.join(options.root, options.srcDir || "src", "farm-images.d.ts");
21108
+ (0, import_node_fs3.mkdirSync)(import_node_path5.default.dirname(outputPath), { recursive: true });
20909
21109
  writeFileIfChanged(outputPath, createFarmImageTypeDeclarations());
20910
21110
  return outputPath;
20911
21111
  }
@@ -20934,14 +21134,14 @@ __name(createFarmImageTypeDeclarations, "createFarmImageTypeDeclarations");
20934
21134
 
20935
21135
  // src/i18n/type-generator.ts
20936
21136
  var import_node_fs4 = require("fs");
20937
- var import_node_path5 = require("path");
21137
+ var import_node_path6 = require("path");
20938
21138
  init_write_file_if_changed();
20939
21139
  async function generateFarmI18nTypes(options) {
20940
21140
  if (!options.config.enabled) return void 0;
20941
21141
  const { signatures } = await readFarmI18nCatalogs(options.config);
20942
- const outFile = options.outFile ? (0, import_node_path5.resolve)(options.root, options.outFile) : (0, import_node_path5.join)((0, import_node_path5.resolve)(options.root), options.srcDir || "src", "farm-i18n.d.ts");
21142
+ const outFile = options.outFile ? (0, import_node_path6.resolve)(options.root, options.outFile) : (0, import_node_path6.join)((0, import_node_path6.resolve)(options.root), options.srcDir || "src", "farm-i18n.d.ts");
20943
21143
  const content = renderFarmI18nTypes(options.config.locales, signatures);
20944
- (0, import_node_fs4.mkdirSync)((0, import_node_path5.dirname)(outFile), { recursive: true });
21144
+ (0, import_node_fs4.mkdirSync)((0, import_node_path6.dirname)(outFile), { recursive: true });
20945
21145
  writeFileIfChanged(outFile, content);
20946
21146
  return outFile;
20947
21147
  }
@@ -21003,7 +21203,10 @@ async function generateFarmTypeArtifacts(options) {
21003
21203
  const result = {
21004
21204
  apiRoutes: []
21005
21205
  };
21006
- if (shouldGenerateRoutes) {
21206
+ const unifiedTypesPath = (0, import_path8.join)(root, srcDir, "farm.d.ts");
21207
+ const shouldRefreshUnifiedTypes = shouldGenerateRoutes && !options.routeTypesOutFile || shouldGenerateEnv && !options.envTypesOutFile || shouldGenerateI18n && !options.i18nTypesOutFile;
21208
+ const unifiedSections = [];
21209
+ if (shouldRefreshUnifiedTypes && !options.routeTypesOutFile) {
21007
21210
  const routeOptions = {
21008
21211
  root,
21009
21212
  srcDir,
@@ -21011,10 +21214,17 @@ async function generateFarmTypeArtifacts(options) {
21011
21214
  suppressLintOnLink: options.suppressLintOnLink,
21012
21215
  sourceRoots
21013
21216
  };
21014
- if (options.routeTypesOutFile) {
21015
- routeOptions.outFile = options.routeTypesOutFile;
21016
- }
21017
- result.routeTypesPath = await generateRouteTypes(routeOptions);
21217
+ unifiedSections.push(await createRouteTypeDeclarations(routeOptions, unifiedTypesPath));
21218
+ result.routeTypesPath = unifiedTypesPath;
21219
+ } else if (shouldGenerateRoutes) {
21220
+ result.routeTypesPath = await generateRouteTypes({
21221
+ root,
21222
+ srcDir,
21223
+ outFile: options.routeTypesOutFile,
21224
+ extraRoutes: options.extraRoutes || [],
21225
+ suppressLintOnLink: options.suppressLintOnLink,
21226
+ sourceRoots
21227
+ });
21018
21228
  }
21019
21229
  if (shouldGenerateApi) {
21020
21230
  const generator = new APITypeGenerator(appDirs);
@@ -21026,22 +21236,40 @@ async function generateFarmTypeArtifacts(options) {
21026
21236
  result.apiTypesPath = apiTypesPath;
21027
21237
  result.apiRoutes = apiRoutes;
21028
21238
  }
21029
- if (shouldGenerateEnv) {
21239
+ if (shouldRefreshUnifiedTypes && !options.envTypesOutFile) {
21240
+ unifiedSections.push(
21241
+ createEnvTypeDeclarations(
21242
+ {
21243
+ root,
21244
+ srcDir,
21245
+ configPath: options.configPath,
21246
+ layerConfigPaths: (options.layers ?? []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile))
21247
+ },
21248
+ unifiedTypesPath
21249
+ )
21250
+ );
21251
+ result.envTypesPath = unifiedTypesPath;
21252
+ } else if (shouldGenerateEnv) {
21030
21253
  result.envTypesPath = await generateEnvTypes({
21031
21254
  root,
21032
21255
  srcDir,
21033
21256
  outFile: options.envTypesOutFile,
21257
+ configPath: options.configPath,
21034
21258
  layerConfigPaths: (options.layers ?? []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile))
21035
21259
  });
21036
21260
  }
21037
- if (shouldGenerateImages) {
21261
+ if (shouldGenerateImages && options.imageTypesOutFile) {
21038
21262
  result.imageTypesPath = generateFarmImageTypes({
21039
21263
  root,
21040
21264
  srcDir,
21041
21265
  outFile: options.imageTypesOutFile
21042
21266
  });
21043
21267
  }
21044
- if (shouldGenerateI18n && options.i18nConfig) {
21268
+ if (shouldRefreshUnifiedTypes && options.i18nConfig?.enabled && !options.i18nTypesOutFile) {
21269
+ const { signatures } = await readFarmI18nCatalogs(options.i18nConfig);
21270
+ unifiedSections.push(renderFarmI18nTypes(options.i18nConfig.locales, signatures));
21271
+ result.i18nTypesPath = unifiedTypesPath;
21272
+ } else if (shouldGenerateI18n && options.i18nConfig) {
21045
21273
  result.i18nTypesPath = await generateFarmI18nTypes({
21046
21274
  root,
21047
21275
  srcDir,
@@ -21049,9 +21277,42 @@ async function generateFarmTypeArtifacts(options) {
21049
21277
  outFile: options.i18nTypesOutFile
21050
21278
  });
21051
21279
  }
21280
+ if (shouldRefreshUnifiedTypes) {
21281
+ (0, import_fs4.mkdirSync)((0, import_path8.dirname)(unifiedTypesPath), { recursive: true });
21282
+ writeFileIfChanged(
21283
+ unifiedTypesPath,
21284
+ `/**
21285
+ * Generated by Farm.js. Do not edit.
21286
+ * Contains project-specific route, environment, and internationalization types.
21287
+ */
21288
+
21289
+ import "@farm.js/core/image";
21290
+
21291
+ ${unifiedSections.join("\n")}`
21292
+ );
21293
+ result.typesPath = unifiedTypesPath;
21294
+ removeLegacyTypeArtifacts(root, srcDir);
21295
+ }
21052
21296
  return result;
21053
21297
  }
21054
21298
  __name(generateFarmTypeArtifacts, "generateFarmTypeArtifacts");
21299
+ var LEGACY_TYPE_ARTIFACTS = [
21300
+ ["farm-routes.d.ts", "Auto-generated route types"],
21301
+ ["farm-env.d.ts", "Auto-generated env types"],
21302
+ ["farm-images.d.ts", "Generated by Farm.js"],
21303
+ ["farm-i18n.d.ts", "Generated by Farm.js"]
21304
+ ];
21305
+ function removeLegacyTypeArtifacts(root, srcDir) {
21306
+ for (const [fileName, marker] of LEGACY_TYPE_ARTIFACTS) {
21307
+ const filePath = (0, import_path8.join)(root, srcDir, fileName);
21308
+ if (!(0, import_fs4.existsSync)(filePath)) continue;
21309
+ const source = (0, import_fs4.readFileSync)(filePath, "utf8");
21310
+ if (source.includes(marker)) {
21311
+ (0, import_fs4.unlinkSync)(filePath);
21312
+ }
21313
+ }
21314
+ }
21315
+ __name(removeLegacyTypeArtifacts, "removeLegacyTypeArtifacts");
21055
21316
 
21056
21317
  // src/vite.ts
21057
21318
  init_markdown();
@@ -21060,7 +21321,7 @@ init_response();
21060
21321
  init_integrations();
21061
21322
  init_devtools_config();
21062
21323
  var fs7 = __toESM(require("fs"));
21063
- var path21 = __toESM(require("path"));
21324
+ var path22 = __toESM(require("path"));
21064
21325
  init_layers();
21065
21326
 
21066
21327
  // src/environment-vite.ts
@@ -21407,7 +21668,7 @@ function transformError(id, message) {
21407
21668
  __name(transformError, "transformError");
21408
21669
 
21409
21670
  // package.json
21410
- var version = "0.1.0-beta.5";
21671
+ var version = "0.1.0-beta.8";
21411
21672
 
21412
21673
  // src/version.ts
21413
21674
  var FARM_VERSION = version;
@@ -21441,8 +21702,8 @@ __name(reportAfterError, "reportAfterError");
21441
21702
  function createAfterRequestState(reportError = defaultAfterErrorReporter) {
21442
21703
  let resolveResponseFinished;
21443
21704
  let responseFinished = false;
21444
- const responseFinishedPromise = new Promise((resolve5) => {
21445
- resolveResponseFinished = resolve5;
21705
+ const responseFinishedPromise = new Promise((resolve6) => {
21706
+ resolveResponseFinished = resolve6;
21446
21707
  });
21447
21708
  const state = {
21448
21709
  completion: Promise.resolve(),
@@ -21554,8 +21815,8 @@ function after(callback) {
21554
21815
  throw new Error("after() cannot schedule work after the request lifecycle has completed.");
21555
21816
  }
21556
21817
  let start;
21557
- const ready = new Promise((resolve5) => {
21558
- start = resolve5;
21818
+ const ready = new Promise((resolve6) => {
21819
+ start = resolve6;
21559
21820
  });
21560
21821
  const result = ready.then(callback);
21561
21822
  state.tasks.push({ result, start });
@@ -21610,7 +21871,7 @@ init_image_config();
21610
21871
 
21611
21872
  // src/image-vite.ts
21612
21873
  var import_promises6 = require("fs/promises");
21613
- var import_node_path6 = __toESM(require("path"));
21874
+ var import_node_path7 = __toESM(require("path"));
21614
21875
  var import_image_size2 = require("image-size");
21615
21876
  var FARM_IMAGE_ID_PREFIX = "\0farm:image:";
21616
21877
  var STATIC_IMAGE_RE = /\.(?:avif|gif|jpe?g|png|webp)$/i;
@@ -21683,7 +21944,7 @@ var ALL_TYPE_ARTIFACTS = {
21683
21944
  routes: true,
21684
21945
  api: true,
21685
21946
  env: true,
21686
- images: true,
21947
+ images: false,
21687
21948
  i18n: true
21688
21949
  };
21689
21950
  var createEmptyTypeArtifactSelection = /* @__PURE__ */ __name(() => ({
@@ -21899,7 +22160,7 @@ function fileContainsProgrammaticPageRoute(file) {
21899
22160
  __name(fileContainsProgrammaticPageRoute, "fileContainsProgrammaticPageRoute");
21900
22161
  function rewriteEarlySsrRelativeImports(options) {
21901
22162
  const cleanId = options.id.split("?", 1)[0];
21902
- if (!path21.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
22163
+ if (!path22.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
21903
22164
  return null;
21904
22165
  }
21905
22166
  const replacements = [];
@@ -21919,7 +22180,7 @@ function rewriteEarlySsrRelativeImports(options) {
21919
22180
  const suffixIndex = source.value.search(/[?#]/);
21920
22181
  const sourcePath = suffixIndex === -1 ? source.value : source.value.slice(0, suffixIndex);
21921
22182
  const suffix = suffixIndex === -1 ? "" : source.value.slice(suffixIndex);
21922
- const resolvedPath = path21.resolve(path21.dirname(cleanId), sourcePath);
22183
+ const resolvedPath = path22.resolve(path22.dirname(cleanId), sourcePath);
21923
22184
  replacements.push({
21924
22185
  start: source.start,
21925
22186
  end: source.end,
@@ -21999,7 +22260,7 @@ function farmPlugin(options = {}, initialPluginManager) {
21999
22260
  ...layerRoots.length ? {
22000
22261
  server: {
22001
22262
  fs: {
22002
- allow: [path21.resolve(options.root || process.cwd()), ...layerRoots]
22263
+ allow: [path22.resolve(options.root || process.cwd()), ...layerRoots]
22003
22264
  }
22004
22265
  }
22005
22266
  } : {}
@@ -22024,9 +22285,9 @@ function farmPlugin(options = {}, initialPluginManager) {
22024
22285
  },
22025
22286
  server
22026
22287
  );
22027
- const globalsCSSPath = path21.join(server.config.root, "src/app/globals.css");
22288
+ const globalsCSSPath = path22.join(server.config.root, "src/app/globals.css");
22028
22289
  if (!fs7.existsSync(globalsCSSPath)) {
22029
- const appDir = path21.join(server.config.root, "src/app");
22290
+ const appDir = path22.join(server.config.root, "src/app");
22030
22291
  if (!fs7.existsSync(appDir)) {
22031
22292
  fs7.mkdirSync(appDir, { recursive: true });
22032
22293
  }
@@ -22048,10 +22309,10 @@ function farmPlugin(options = {}, initialPluginManager) {
22048
22309
  });
22049
22310
  }
22050
22311
  const sourceRoots = getFarmSourceRoots(farmConfig);
22051
- server.watcher.add(sourceRoots.map((source) => path21.join(source.root, source.srcDir)));
22312
+ server.watcher.add(sourceRoots.map((source) => path22.join(source.root, source.srcDir)));
22052
22313
  if (farmConfig.i18n.enabled) {
22053
22314
  server.watcher.add(
22054
- farmConfig.i18n.messages.includes("{locale}") ? path21.dirname(farmConfig.i18n.messages) : farmConfig.i18n.messages
22315
+ farmConfig.i18n.messages.includes("{locale}") ? path22.dirname(farmConfig.i18n.messages) : farmConfig.i18n.messages
22055
22316
  );
22056
22317
  }
22057
22318
  const workflowConfig = farmConfig.workflows;
@@ -22061,7 +22322,7 @@ function farmPlugin(options = {}, initialPluginManager) {
22061
22322
  ...farmDocsDevRuntime?.getFarmDocsRouteTypeEntries(farmConfig.docs) ?? []
22062
22323
  ], "getExtraRouteTypes");
22063
22324
  const appDirSlugs = sourceRoots.map(
22064
- (source) => path21.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
22325
+ (source) => path22.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
22065
22326
  );
22066
22327
  const generateTypeArtifacts = /* @__PURE__ */ __name(async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
22067
22328
  try {
@@ -22101,7 +22362,7 @@ function farmPlugin(options = {}, initialPluginManager) {
22101
22362
  }, "generateTypeArtifacts");
22102
22363
  await generateTypeArtifacts("startup");
22103
22364
  const srcDirSlugs = sourceRoots.map(
22104
- (source) => path21.join(source.root, source.srcDir).replace(/\\/g, "/")
22365
+ (source) => path22.join(source.root, source.srcDir).replace(/\\/g, "/")
22105
22366
  );
22106
22367
  const layerConfigFiles = new Set(
22107
22368
  farmConfig.layers.map((layer) => layer.configFile?.replace(/\\/g, "/")).filter((file) => Boolean(file))
@@ -22219,7 +22480,7 @@ function farmPlugin(options = {}, initialPluginManager) {
22219
22480
  await apiRouteManager.discoverRoutes();
22220
22481
  let discoveredWorkflows = [];
22221
22482
  const hasWorkflowDirectory = workflowConfig.enabled && workflowConfig.dirs.some(
22222
- (dir) => fs7.existsSync(path21.isAbsolute(dir) ? dir : path21.join(farmConfig.root, dir))
22483
+ (dir) => fs7.existsSync(path22.isAbsolute(dir) ? dir : path22.join(farmConfig.root, dir))
22223
22484
  );
22224
22485
  if (hasWorkflowDirectory) {
22225
22486
  const { createFarmWorkflowRequestHandler: createFarmWorkflowRequestHandler2, discoverFarmWorkflows: discoverFarmWorkflows2 } = await loadFarmWorkflowsDevRuntime();
@@ -22297,14 +22558,14 @@ function farmPlugin(options = {}, initialPluginManager) {
22297
22558
  farmDocsDevRuntime ? [
22298
22559
  [
22299
22560
  "/assets/Geist-Variable-CrgPqtmy.woff2",
22300
- path21.join(
22561
+ path22.join(
22301
22562
  farmConfig.root,
22302
22563
  "node_modules/geist/dist/fonts/geist-sans/Geist-Variable.woff2"
22303
22564
  )
22304
22565
  ],
22305
22566
  [
22306
22567
  "/assets/GeistMono-Variable-BNLlm6Cd.woff2",
22307
- path21.join(
22568
+ path22.join(
22308
22569
  farmConfig.root,
22309
22570
  "node_modules/geist/dist/fonts/geist-mono/GeistMono-Variable.woff2"
22310
22571
  )
@@ -22468,12 +22729,13 @@ function farmPlugin(options = {}, initialPluginManager) {
22468
22729
  config: farmApp.getConfig().mdx,
22469
22730
  resolveSource: /* @__PURE__ */ __name(async (pathname2) => {
22470
22731
  const match = farmApp.getRouteManager().matchRoute(pathname2);
22471
- if (!match.route || !isFarmMarkdownPageFile(match.route.modulePath)) {
22732
+ const sourcePath = match.route?.markdownSourcePath || (match.route && isFarmMarkdownPageFile(match.route.modulePath) ? match.route.modulePath : null);
22733
+ if (!sourcePath) {
22472
22734
  return null;
22473
22735
  }
22474
22736
  return {
22475
- source: await fs7.promises.readFile(match.route.modulePath, "utf8"),
22476
- filePath: match.route.modulePath
22737
+ source: await fs7.promises.readFile(sourcePath, "utf8"),
22738
+ filePath: sourcePath
22477
22739
  };
22478
22740
  }, "resolveSource")
22479
22741
  });
@@ -22494,16 +22756,37 @@ function farmPlugin(options = {}, initialPluginManager) {
22494
22756
  await sendWebResponse(res, markdownResponse);
22495
22757
  return;
22496
22758
  }
22759
+ const markdownPageTarget = resolveMarkdownMirrorTarget(
22760
+ farmApp.getConfig().md,
22761
+ requestPathname,
22762
+ {
22763
+ accept: "text/markdown"
22764
+ }
22765
+ );
22766
+ if (markdownPageTarget && farmApp.getRouteManager().matchRoute(markdownPageTarget.pathname).route) {
22767
+ const vary = res.getHeader("Vary");
22768
+ const varyValues = String(vary || "").split(",").map((value) => value.trim()).filter(Boolean);
22769
+ if (!varyValues.some((value) => value.toLowerCase() === "accept")) {
22770
+ res.setHeader("Vary", [...varyValues, "Accept"].join(", "));
22771
+ }
22772
+ const alternatePath = markdownPageTarget.pathname === "/" ? "/index.md" : `${markdownPageTarget.pathname}.md`;
22773
+ const alternateLink = `<${alternatePath}>; rel="alternate"; type="text/markdown"`;
22774
+ const currentLink = res.getHeader("Link");
22775
+ res.setHeader(
22776
+ "Link",
22777
+ currentLink ? `${String(currentLink)}, ${alternateLink}` : alternateLink
22778
+ );
22779
+ }
22497
22780
  if (workflowHandler && (requestPathname === workflowConfig.route || requestPathname.startsWith(`${workflowConfig.route}/`))) {
22498
22781
  let workflowBody;
22499
22782
  if (requestMethod !== "GET" && requestMethod !== "HEAD") {
22500
- workflowBody = await new Promise((resolve5) => {
22783
+ workflowBody = await new Promise((resolve6) => {
22501
22784
  let data = "";
22502
22785
  req.on("data", (chunk) => {
22503
22786
  data += chunk;
22504
22787
  });
22505
22788
  req.on("end", () => {
22506
- resolve5(data);
22789
+ resolve6(data);
22507
22790
  });
22508
22791
  });
22509
22792
  }
@@ -22546,13 +22829,13 @@ function farmPlugin(options = {}, initialPluginManager) {
22546
22829
  }
22547
22830
  let body;
22548
22831
  if (req.method !== "GET" && req.method !== "HEAD") {
22549
- body = await new Promise((resolve5) => {
22832
+ body = await new Promise((resolve6) => {
22550
22833
  let data = "";
22551
22834
  req.on("data", (chunk) => {
22552
22835
  data += chunk;
22553
22836
  });
22554
22837
  req.on("end", () => {
22555
- resolve5(data);
22838
+ resolve6(data);
22556
22839
  });
22557
22840
  });
22558
22841
  }
@@ -22658,13 +22941,13 @@ function farmPlugin(options = {}, initialPluginManager) {
22658
22941
  }
22659
22942
  let body;
22660
22943
  if (req.method !== "GET" && req.method !== "HEAD") {
22661
- body = await new Promise((resolve5) => {
22944
+ body = await new Promise((resolve6) => {
22662
22945
  let data = "";
22663
22946
  req.on("data", (chunk) => {
22664
22947
  data += chunk;
22665
22948
  });
22666
22949
  req.on("end", () => {
22667
- resolve5(data);
22950
+ resolve6(data);
22668
22951
  });
22669
22952
  });
22670
22953
  }
@@ -22721,13 +23004,13 @@ function farmPlugin(options = {}, initialPluginManager) {
22721
23004
  }
22722
23005
  let body;
22723
23006
  if (req.method !== "GET" && req.method !== "HEAD") {
22724
- body = await new Promise((resolve5) => {
23007
+ body = await new Promise((resolve6) => {
22725
23008
  let data = "";
22726
23009
  req.on("data", (chunk) => {
22727
23010
  data += chunk;
22728
23011
  });
22729
23012
  req.on("end", () => {
22730
- resolve5(data);
23013
+ resolve6(data);
22731
23014
  });
22732
23015
  });
22733
23016
  }
@@ -23447,8 +23730,8 @@ if (import.meta.hot) {
23447
23730
  }
23448
23731
  logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
23449
23732
  logger.info("Pre-rendering SSG pages...");
23450
- const outDir = path21.join(server?.config.root || process.cwd(), options.outDir || "dist");
23451
- const clientDir = path21.join(outDir, "client");
23733
+ const outDir = path22.join(server?.config.root || process.cwd(), options.outDir || "dist");
23734
+ const clientDir = path22.join(outDir, "client");
23452
23735
  for (const page2 of ssgPages) {
23453
23736
  try {
23454
23737
  const staticRequest = new Request(new URL(page2.urlPath, "http://farm.static"));
@@ -23500,8 +23783,8 @@ if (import.meta.hot) {
23500
23783
  <script type="module" src="/assets/client.js"></script>
23501
23784
  </body>
23502
23785
  </html>`;
23503
- const outputPath = page2.urlPath === "/" ? path21.join(clientDir, "index.html") : path21.join(clientDir, page2.urlPath + ".html");
23504
- fs7.mkdirSync(path21.dirname(outputPath), { recursive: true });
23786
+ const outputPath = page2.urlPath === "/" ? path22.join(clientDir, "index.html") : path22.join(clientDir, page2.urlPath + ".html");
23787
+ fs7.mkdirSync(path22.dirname(outputPath), { recursive: true });
23505
23788
  fs7.writeFileSync(outputPath, fullHtml);
23506
23789
  const revalidateInfo = page2.revalidate ? ` (revalidate: ${page2.revalidate}s)` : "";
23507
23790
  logger.success(` \u2713 ${page2.urlPath}${revalidateInfo}`);
@@ -23510,7 +23793,7 @@ if (import.meta.hot) {
23510
23793
  logger.error(` \u2717 ${page2.urlPath}: ${error}`);
23511
23794
  }
23512
23795
  }
23513
- const manifestPath = path21.join(outDir, "__ssg_manifest.json");
23796
+ const manifestPath = path22.join(outDir, "__ssg_manifest.json");
23514
23797
  fs7.writeFileSync(
23515
23798
  manifestPath,
23516
23799
  JSON.stringify(
@@ -23546,9 +23829,9 @@ if (import.meta.hot) {
23546
23829
  }
23547
23830
  const currentFarmConfig = farmApp?.getConfig();
23548
23831
  const normalizedFile = file.replace(/\\/g, "/");
23549
- const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) => path21.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
23832
+ const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) => path22.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
23550
23833
  if (currentSrcRoot && normalizedFile.startsWith(`${currentSrcRoot}/`) && isProgrammaticRoutesFileName(normalizedFile)) {
23551
- logUpdate("PAGE", `updated ${path21.basename(file)}`);
23834
+ logUpdate("PAGE", `updated ${path22.basename(file)}`);
23552
23835
  for (const mod of modules) {
23553
23836
  server2.moduleGraph.invalidateModule(mod);
23554
23837
  }
@@ -24591,6 +24874,7 @@ async function buildRouteComponentProps(pageModule, params, searchParams, path,
24591
24874
  const parsedSearch = parseClientRouteSchema(schemas?.search, searchParams, 'search');
24592
24875
 
24593
24876
  return {
24877
+ ...(existingProps || {}),
24594
24878
  params: parsedParams,
24595
24879
  search: parsedSearch,
24596
24880
  searchParams: schemas ? Promise.resolve(parsedSearch) : parsedSearch,
@@ -25107,7 +25391,7 @@ function generateClientManifest(bundle) {
25107
25391
  __name(generateClientManifest, "generateClientManifest");
25108
25392
  async function defineConfig2(config = {}) {
25109
25393
  const tailwindcss = (await import("@tailwindcss/vite")).default;
25110
- const appRoot = path21.resolve(config.root || process.cwd());
25394
+ const appRoot = path22.resolve(config.root || process.cwd());
25111
25395
  if (config.extends?.length) {
25112
25396
  const { config: layeredConfig } = await Promise.resolve().then(() => (init_layers(), layers_exports)).then(
25113
25397
  ({ resolveFarmLayers: resolveFarmLayers2 }) => resolveFarmLayers2(config, {
@@ -25293,7 +25577,7 @@ async function defineConfig2(config = {}) {
25293
25577
  // Stub out problematic server-only modules during dev mode
25294
25578
  alias: {
25295
25579
  ...getFarmLayerAliases(config.layers),
25296
- "@": path21.resolve(appRoot, "src"),
25580
+ "@": path22.resolve(appRoot, "src"),
25297
25581
  // Nitro internals that should not be resolved in browser
25298
25582
  "supports-color": "data:text/javascript,export default false; export const supportsColor = false; export const stdout = false; export const stderr = false;",
25299
25583
  "@poppinss/dumper": "data:text/javascript,export default {};",