@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/vite.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 fs8 = await import("fs/promises");
624
- const path22 = await import("path");
625
- const generatedDir = path22.join(root, distDir, ".nitro", "farm-workflows");
655
+ const path23 = await import("path");
656
+ const generatedDir = path23.join(root, distDir, ".nitro", "farm-workflows");
626
657
  await fs8.mkdir(generatedDir, { recursive: true });
627
658
  const tasks = {};
628
659
  const scheduledTasks = createScheduledTasks(workflows);
629
660
  for (const workflow of workflows) {
630
- const wrapperPath = path22.join(generatedDir, `${safeFileName(workflow.id)}.mjs`);
661
+ const wrapperPath = path23.join(generatedDir, `${safeFileName(workflow.id)}.mjs`);
631
662
  await fs8.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 = path22.join(generatedDir, "http-handler.mjs");
668
+ const handlerPath = path23.join(generatedDir, "http-handler.mjs");
638
669
  await fs8.writeFile(
639
670
  handlerPath,
640
671
  createNitroWorkflowHTTPHandler(workflowConfig, workflows),
641
672
  "utf8"
642
673
  );
643
- const manifestPath = path22.join(generatedDir, "manifest.json");
674
+ const manifestPath = path23.join(generatedDir, "manifest.json");
644
675
  await fs8.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 fs8 = await import("fs/promises");
726
- const path22 = await import("path");
757
+ const path23 = await import("path");
727
758
  const files = [];
728
759
  for (const dir of dirs) {
729
- const absoluteDir = path22.isAbsolute(dir) ? dir : path22.join(root, dir);
760
+ const absoluteDir = path23.isAbsolute(dir) ? dir : path23.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 fs8 = await import("fs/promises");
737
- const path22 = await import("path");
768
+ const path23 = await import("path");
738
769
  const entries = await fs8.readdir(dir, { withFileTypes: true });
739
770
  for (const entry of entries) {
740
- const filePath = path22.join(dir, entry.name);
771
+ const filePath = path23.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 fs8 = await import("fs/promises");
760
- const path22 = await import("path");
761
- const { pathToFileURL: pathToFileURL3 } = await import("url");
791
+ const path23 = await import("path");
792
+ const { pathToFileURL: pathToFileURL4 } = await import("url");
762
793
  const { build } = await import("esbuild");
763
- const outDir = path22.join(root, ".farm", ".workflow-loader");
794
+ const outDir = path23.join(root, ".farm", ".workflow-loader");
764
795
  await fs8.mkdir(outDir, { recursive: true });
765
- const outfile = path22.join(
796
+ const outfile = path23.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 fs8.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 path22 = normalizeCronPath(name, job.path);
1079
+ const path23 = 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: path22,
1088
+ path: path23,
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 path22 = value.trim();
1066
- if (path22.startsWith("//") || path22.includes("?") || path22.includes("#")) {
1096
+ const path23 = value.trim();
1097
+ if (path23.startsWith("//") || path23.includes("?") || path23.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 path22.length > 1 ? path22.replace(/\/+$/, "") : path22;
1102
+ return path23.length > 1 ? path23.replace(/\/+$/, "") : path23;
1072
1103
  }
1073
1104
  function normalizeCronExpression(name, value) {
1074
1105
  if (typeof value !== "string") {
@@ -1925,7 +1956,7 @@ var init_server_action_security = __esm({
1925
1956
 
1926
1957
  // src/image-config.ts
1927
1958
  function resolveFarmImageConfig(config) {
1928
- const path22 = normalizeImagePath(config?.path ?? DEFAULT_FARM_IMAGE_PATH);
1959
+ const path23 = normalizeImagePath(config?.path ?? DEFAULT_FARM_IMAGE_PATH);
1929
1960
  const deviceSizes = normalizeIntegerList(
1930
1961
  config?.deviceSizes ?? DEFAULT_FARM_IMAGE_DEVICE_SIZES,
1931
1962
  "images.deviceSizes"
@@ -1953,7 +1984,7 @@ function resolveFarmImageConfig(config) {
1953
1984
  );
1954
1985
  return Object.freeze({
1955
1986
  provider: config?.provider ?? "auto",
1956
- path: path22,
1987
+ path: path23,
1957
1988
  domains: Object.freeze([
1958
1989
  ...new Set(
1959
1990
  (config?.domains ?? []).map((domain) => domain.trim().toLowerCase()).filter(Boolean)
@@ -1992,11 +2023,11 @@ function getPublicFarmImageConfig(config) {
1992
2023
  };
1993
2024
  }
1994
2025
  function normalizeImagePath(value) {
1995
- const path22 = value.trim().replace(/\/+$/, "") || "/";
1996
- if (!path22.startsWith("/") || path22.includes("?") || path22.includes("#")) {
2026
+ const path23 = value.trim().replace(/\/+$/, "") || "/";
2027
+ if (!path23.startsWith("/") || path23.includes("?") || path23.includes("#")) {
1997
2028
  throw new TypeError("images.path must be an absolute pathname without a query or hash");
1998
2029
  }
1999
- return path22;
2030
+ return path23;
2000
2031
  }
2001
2032
  function normalizeIntegerList(values, name, max) {
2002
2033
  if (values.length === 0) {
@@ -2835,9 +2866,9 @@ var init_integration_orm = __esm({
2835
2866
  });
2836
2867
 
2837
2868
  // src/integrations.ts
2838
- function defineTypedIntegrationRoute(method, path22, input) {
2869
+ function defineTypedIntegrationRoute(method, path23, input) {
2839
2870
  return {
2840
- path: path22,
2871
+ path: path23,
2841
2872
  method,
2842
2873
  middleware: input.middleware,
2843
2874
  before: input.before,
@@ -2847,7 +2878,7 @@ function defineTypedIntegrationRoute(method, path22, input) {
2847
2878
  input: normalizeIntegrationRouteInputSchemas(input),
2848
2879
  handler: input.handler,
2849
2880
  __operation: defineIntegrationAPIOperation({
2850
- path: path22,
2881
+ path: path23,
2851
2882
  method,
2852
2883
  bodyFormat: input.bodyFormat,
2853
2884
  responseFormat: input.responseFormat,
@@ -2859,52 +2890,52 @@ function defineTypedIntegrationRoute(method, path22, input) {
2859
2890
  }
2860
2891
  function createIntegrationRouteFactory() {
2861
2892
  return {
2862
- get(path22, input) {
2893
+ get(path23, input) {
2863
2894
  return defineTypedIntegrationRoute(
2864
2895
  "GET",
2865
- path22,
2896
+ path23,
2866
2897
  input
2867
2898
  );
2868
2899
  },
2869
- post(path22, input) {
2900
+ post(path23, input) {
2870
2901
  return defineTypedIntegrationRoute(
2871
2902
  "POST",
2872
- path22,
2903
+ path23,
2873
2904
  {
2874
2905
  bodyFormat: "json",
2875
2906
  ...input
2876
2907
  }
2877
2908
  );
2878
2909
  },
2879
- put(path22, input) {
2910
+ put(path23, input) {
2880
2911
  return defineTypedIntegrationRoute(
2881
2912
  "PUT",
2882
- path22,
2913
+ path23,
2883
2914
  {
2884
2915
  bodyFormat: "json",
2885
2916
  ...input
2886
2917
  }
2887
2918
  );
2888
2919
  },
2889
- patch(path22, input) {
2890
- return defineTypedIntegrationRoute("PATCH", path22, {
2920
+ patch(path23, input) {
2921
+ return defineTypedIntegrationRoute("PATCH", path23, {
2891
2922
  bodyFormat: "json",
2892
2923
  ...input
2893
2924
  });
2894
2925
  },
2895
- delete(path22, input) {
2896
- return defineTypedIntegrationRoute("DELETE", path22, {
2926
+ delete(path23, input) {
2927
+ return defineTypedIntegrationRoute("DELETE", path23, {
2897
2928
  bodyFormat: "json",
2898
2929
  ...input
2899
2930
  });
2900
2931
  },
2901
- options(path22, input) {
2902
- return defineTypedIntegrationRoute("OPTIONS", path22, input);
2932
+ options(path23, input) {
2933
+ return defineTypedIntegrationRoute("OPTIONS", path23, input);
2903
2934
  },
2904
- head(path22, input) {
2935
+ head(path23, input) {
2905
2936
  return defineTypedIntegrationRoute(
2906
2937
  "HEAD",
2907
- path22,
2938
+ path23,
2908
2939
  input
2909
2940
  );
2910
2941
  }
@@ -3241,8 +3272,8 @@ function normalizeIntegrationValidationIssues(source, error) {
3241
3272
  }
3242
3273
  ];
3243
3274
  }
3244
- function normalizeIntegrationValidationPath(path22) {
3245
- return (path22 || []).map((segment) => {
3275
+ function normalizeIntegrationValidationPath(path23) {
3276
+ return (path23 || []).map((segment) => {
3246
3277
  const key = typeof segment === "object" && segment !== null && "key" in segment ? segment.key : segment;
3247
3278
  return typeof key === "symbol" ? key.description || key.toString() : key;
3248
3279
  });
@@ -3931,8 +3962,8 @@ function createFarmDeploymentMismatchResponse(mismatch) {
3931
3962
  }
3932
3963
  );
3933
3964
  }
3934
- function createFarmDeploymentCookie(deploymentId, path22 = "/", secure = false) {
3935
- const normalizedPath = path22.startsWith("/") ? path22 : `/${path22}`;
3965
+ function createFarmDeploymentCookie(deploymentId, path23 = "/", secure = false) {
3966
+ const normalizedPath = path23.startsWith("/") ? path23 : `/${path23}`;
3936
3967
  return [
3937
3968
  `${FARM_DEPLOYMENT_COOKIE}=${encodeURIComponent(deploymentId)}`,
3938
3969
  `Path=${normalizedPath}`,
@@ -4125,6 +4156,69 @@ var init_devtools_config = __esm({
4125
4156
  }
4126
4157
  });
4127
4158
 
4159
+ // src/auth-config.ts
4160
+ function resolveFarmAuthConfig(input) {
4161
+ const config = input === true ? {} : input && typeof input === "object" ? input : {};
4162
+ const passwordConfig = typeof config.emailAndPassword === "object" ? config.emailAndPassword : {};
4163
+ const resolved = {
4164
+ enabled: input !== void 0 && input !== false && config.enabled !== false,
4165
+ appName: config.appName,
4166
+ basePath: normalizeBasePath(config.basePath),
4167
+ emailAndPassword: {
4168
+ enabled: config.emailAndPassword !== false,
4169
+ requireEmailVerification: passwordConfig.requireEmailVerification ?? false,
4170
+ minPasswordLength: passwordConfig.minPasswordLength ?? 8,
4171
+ maxPasswordLength: passwordConfig.maxPasswordLength ?? 128
4172
+ },
4173
+ session: {
4174
+ expiresIn: config.session?.expiresIn ?? 60 * 60 * 24 * 7,
4175
+ updateAge: config.session?.updateAge ?? 60 * 60 * 24
4176
+ },
4177
+ database: {
4178
+ url: config.database?.url,
4179
+ path: config.database?.path || ".farm/auth.sqlite",
4180
+ migrateInDevelopment: config.database?.migrateInDevelopment ?? true
4181
+ }
4182
+ };
4183
+ validateFarmAuthConfig(resolved);
4184
+ return resolved;
4185
+ }
4186
+ function normalizeBasePath(value) {
4187
+ const route = (value || "/api/auth").trim();
4188
+ const withLeadingSlash = route.startsWith("/") ? route : `/${route}`;
4189
+ const normalized = withLeadingSlash.replace(/\/+/g, "/").replace(/\/+$/, "");
4190
+ return normalized || "/api/auth";
4191
+ }
4192
+ function validateFarmAuthConfig(config) {
4193
+ const { minPasswordLength, maxPasswordLength } = config.emailAndPassword;
4194
+ if (!Number.isInteger(minPasswordLength) || minPasswordLength < 1) {
4195
+ throw new Error("auth.emailAndPassword.minPasswordLength must be a positive integer.");
4196
+ }
4197
+ if (!Number.isInteger(maxPasswordLength) || maxPasswordLength < minPasswordLength) {
4198
+ throw new Error(
4199
+ "auth.emailAndPassword.maxPasswordLength must be an integer greater than or equal to minPasswordLength."
4200
+ );
4201
+ }
4202
+ if (!Number.isInteger(config.session.expiresIn) || config.session.expiresIn < 1) {
4203
+ throw new Error("auth.session.expiresIn must be a positive integer.");
4204
+ }
4205
+ if (!Number.isInteger(config.session.updateAge) || config.session.updateAge < 0) {
4206
+ throw new Error("auth.session.updateAge must be a non-negative integer.");
4207
+ }
4208
+ }
4209
+ var import_node_module2, import_node_path4, import_node_url2;
4210
+ var init_auth_config = __esm({
4211
+ "src/auth-config.ts"() {
4212
+ "use strict";
4213
+ import_node_module2 = require("module");
4214
+ import_node_path4 = __toESM(require("path"));
4215
+ import_node_url2 = require("url");
4216
+ __name(resolveFarmAuthConfig, "resolveFarmAuthConfig");
4217
+ __name(normalizeBasePath, "normalizeBasePath");
4218
+ __name(validateFarmAuthConfig, "validateFarmAuthConfig");
4219
+ }
4220
+ });
4221
+
4128
4222
  // src/write-file-if-changed.ts
4129
4223
  function writeFileIfChanged(filePath, content) {
4130
4224
  try {
@@ -4244,11 +4338,11 @@ var init_type_generator = __esm({
4244
4338
  routeGroups.get(key).push(route);
4245
4339
  }
4246
4340
  const nestedStructure = {};
4247
- for (const [path22, routeList] of routeGroups) {
4341
+ for (const [path23, routeList] of routeGroups) {
4248
4342
  const route = routeList[0];
4249
4343
  const importPath = this.getRouteImportPath(route, options.outFile);
4250
4344
  const routeName = this.pathToRouteName(route.path);
4251
- const cleanPath = path22 === "/api" ? "" : path22.replace(/^\/api\//, "");
4345
+ const cleanPath = path23 === "/api" ? "" : path23.replace(/^\/api\//, "");
4252
4346
  const parts = cleanPath ? cleanPath.split("/") : [];
4253
4347
  const allMethods = routeList.flatMap((r) => r.methods);
4254
4348
  for (const method of allMethods) {
@@ -4307,8 +4401,8 @@ ${typeExports}
4307
4401
  const relativeImport = (0, import_path7.relative)((0, import_path7.dirname)(outFile), route.filePath).replace(/\\/g, "/").replace(/\.(ts|tsx|js|jsx)$/, "");
4308
4402
  return relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`;
4309
4403
  }
4310
- pathToRouteName(path22) {
4311
- return (path22 === "/api" ? "root" : path22.replace(/^\/api\//, "")).replace(/\//g, "_").replace(/[^a-zA-Z0-9_]/g, "");
4404
+ pathToRouteName(path23) {
4405
+ return (path23 === "/api" ? "root" : path23.replace(/^\/api\//, "")).replace(/\//g, "_").replace(/[^a-zA-Z0-9_]/g, "");
4312
4406
  }
4313
4407
  structureToTypeString(obj, indent) {
4314
4408
  const spaces = " ".repeat(indent);
@@ -4328,15 +4422,15 @@ ${typeExports}
4328
4422
  toTypePropertyKey(key) {
4329
4423
  return /^[$A-Z_][0-9A-Z_$]*$/i.test(key) ? key : JSON.stringify(key);
4330
4424
  }
4331
- getBaseExportName(path22) {
4332
- const cleanPath = path22.replace(/^\/api\//, "");
4425
+ getBaseExportName(path23) {
4426
+ const cleanPath = path23.replace(/^\/api\//, "");
4333
4427
  if (cleanPath === "") {
4334
4428
  return "api";
4335
4429
  }
4336
4430
  return cleanPath;
4337
4431
  }
4338
- getExportName(path22, method) {
4339
- const cleanPath = path22.replace(/^\/api\//, "");
4432
+ getExportName(path23, method) {
4433
+ const cleanPath = path23.replace(/^\/api\//, "");
4340
4434
  if (cleanPath === "") {
4341
4435
  return method.toLowerCase();
4342
4436
  }
@@ -4786,11 +4880,11 @@ function resolveExistingPath(filePath) {
4786
4880
  try {
4787
4881
  return (0, import_node_fs5.realpathSync)(filePath);
4788
4882
  } catch {
4789
- return import_node_path7.default.resolve(filePath);
4883
+ return import_node_path8.default.resolve(filePath);
4790
4884
  }
4791
4885
  }
4792
4886
  function isDocsSourceFile(filePath) {
4793
- return DOCS_FILE_EXTENSIONS.has(import_node_path7.default.extname(filePath).toLowerCase());
4887
+ return DOCS_FILE_EXTENSIONS.has(import_node_path8.default.extname(filePath).toLowerCase());
4794
4888
  }
4795
4889
  function discoverDocsSourceFiles(contentDir) {
4796
4890
  const files = [];
@@ -4799,7 +4893,7 @@ function discoverDocsSourceFiles(contentDir) {
4799
4893
  (a, b) => a.name.localeCompare(b.name)
4800
4894
  )) {
4801
4895
  if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
4802
- const absolutePath = import_node_path7.default.join(dir, entry.name);
4896
+ const absolutePath = import_node_path8.default.join(dir, entry.name);
4803
4897
  if (entry.isDirectory()) {
4804
4898
  visit(absolutePath);
4805
4899
  } else if (entry.isFile() && isDocsSourceFile(absolutePath)) {
@@ -4817,7 +4911,7 @@ function getGitLastModifiedDates(contentDir) {
4817
4911
  stdio: ["ignore", "pipe", "ignore"]
4818
4912
  }).trim();
4819
4913
  if (!gitRoot) return {};
4820
- const contentPathspec = normalizeRelativePath(import_node_path7.default.relative(gitRoot, contentDir)) || ".";
4914
+ const contentPathspec = normalizeRelativePath(import_node_path8.default.relative(gitRoot, contentDir)) || ".";
4821
4915
  const contentPrefix = contentPathspec === "." ? "" : `${contentPathspec}/`;
4822
4916
  const history = (0, import_node_child_process.execFileSync)(
4823
4917
  "git",
@@ -4859,7 +4953,7 @@ function getGitLastModifiedDates(contentDir) {
4859
4953
  }
4860
4954
  }
4861
4955
  function readManifest(contentDir) {
4862
- const manifestPath = import_node_path7.default.join(contentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST);
4956
+ const manifestPath = import_node_path8.default.join(contentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST);
4863
4957
  if (!(0, import_node_fs5.existsSync)(manifestPath)) return null;
4864
4958
  try {
4865
4959
  const parsed = JSON.parse(
@@ -4882,14 +4976,14 @@ function createFarmDocsLastModifiedManifest(contentDir, options = {}) {
4882
4976
  const fallbackDate = (options.now ?? /* @__PURE__ */ new Date()).toISOString();
4883
4977
  const pages = {};
4884
4978
  for (const sourcePath of discoverDocsSourceFiles(resolvedContentDir)) {
4885
- const relativePath2 = normalizeRelativePath(import_node_path7.default.relative(resolvedContentDir, sourcePath));
4979
+ const relativePath2 = normalizeRelativePath(import_node_path8.default.relative(resolvedContentDir, sourcePath));
4886
4980
  pages[relativePath2] = gitDates[relativePath2] || (options.fallback === "now" ? fallbackDate : (0, import_node_fs5.statSync)(sourcePath).mtime.toISOString());
4887
4981
  }
4888
4982
  return { version: 1, pages };
4889
4983
  }
4890
4984
  function getLastModifiedManifest(contentDir) {
4891
4985
  const resolvedContentDir = resolveExistingPath(contentDir);
4892
- const manifestPath = import_node_path7.default.join(resolvedContentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST);
4986
+ const manifestPath = import_node_path8.default.join(resolvedContentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST);
4893
4987
  const manifestStat = (0, import_node_fs5.existsSync)(manifestPath) ? (0, import_node_fs5.statSync)(manifestPath) : null;
4894
4988
  const signature = manifestStat ? `file:${manifestStat.mtimeMs}:${manifestStat.size}` : "generated";
4895
4989
  const cached = manifestCache.get(resolvedContentDir);
@@ -4903,21 +4997,21 @@ function resolveFarmDocsPageLastModified(contentDir, sourcePath, frontmatter) {
4903
4997
  if (configured) return configured;
4904
4998
  const resolvedContentDir = resolveExistingPath(contentDir);
4905
4999
  const resolvedSourcePath = resolveExistingPath(sourcePath);
4906
- const relativePath2 = normalizeRelativePath(import_node_path7.default.relative(resolvedContentDir, resolvedSourcePath));
4907
- const isInsideContentDir = relativePath2 !== ".." && !relativePath2.startsWith("../") && !import_node_path7.default.isAbsolute(relativePath2);
5000
+ const relativePath2 = normalizeRelativePath(import_node_path8.default.relative(resolvedContentDir, resolvedSourcePath));
5001
+ const isInsideContentDir = relativePath2 !== ".." && !relativePath2.startsWith("../") && !import_node_path8.default.isAbsolute(relativePath2);
4908
5002
  if (isInsideContentDir) {
4909
5003
  const generated = getLastModifiedManifest(resolvedContentDir).pages[relativePath2];
4910
5004
  if (generated) return generated;
4911
5005
  }
4912
5006
  return (0, import_node_fs5.statSync)(resolvedSourcePath).mtime.toISOString();
4913
5007
  }
4914
- var import_node_child_process, import_node_fs5, import_node_path7, FARM_DOCS_LAST_MODIFIED_MANIFEST, COMMIT_MARKER, DOCS_FILE_EXTENSIONS, manifestCache;
5008
+ var import_node_child_process, import_node_fs5, import_node_path8, FARM_DOCS_LAST_MODIFIED_MANIFEST, COMMIT_MARKER, DOCS_FILE_EXTENSIONS, manifestCache;
4915
5009
  var init_last_modified = __esm({
4916
5010
  "src/docs/last-modified.ts"() {
4917
5011
  "use strict";
4918
5012
  import_node_child_process = require("child_process");
4919
5013
  import_node_fs5 = require("fs");
4920
- import_node_path7 = __toESM(require("path"));
5014
+ import_node_path8 = __toESM(require("path"));
4921
5015
  FARM_DOCS_LAST_MODIFIED_MANIFEST = ".farm-docs-last-modified.json";
4922
5016
  COMMIT_MARKER = "__FARM_DOCS_COMMIT__";
4923
5017
  DOCS_FILE_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".mdx"]);
@@ -5355,8 +5449,8 @@ code:not(pre code) {
5355
5449
  }
5356
5450
 
5357
5451
  .code-block-header {
5358
- min-height: 28px;
5359
- padding: 3px 7px 3px 9px;
5452
+ min-height: 34px;
5453
+ padding: 4px 8px 4px 10px;
5360
5454
  }
5361
5455
 
5362
5456
  .code-block-title {
@@ -5570,8 +5664,8 @@ code:not(pre code) {
5570
5664
  }
5571
5665
 
5572
5666
  .code-block-header {
5573
- min-height: 26px;
5574
- padding: 2px 6px 2px 8px;
5667
+ min-height: 32px;
5668
+ padding: 3px 7px 3px 9px;
5575
5669
  }
5576
5670
 
5577
5671
  .code-copy-floating {
@@ -5611,38 +5705,30 @@ code:not(pre code) {
5611
5705
 
5612
5706
  @media (max-width: 640px) {
5613
5707
  .code-block-header {
5614
- min-height: 22px;
5615
- padding: 1px 4px 1px 7px;
5616
- }
5617
-
5618
- .code-block-title {
5619
- font-size: 9px;
5620
- }
5621
-
5622
- .code-copy {
5623
- width: 20px;
5624
- height: 20px;
5625
- }
5626
-
5627
- .code-copy svg {
5628
- width: 12px;
5629
- height: 12px;
5708
+ min-height: 30px;
5709
+ padding: 3px 6px 3px 8px;
5630
5710
  }
5631
5711
 
5632
5712
  .code-copy-floating {
5633
- top: 5px;
5634
- right: 5px;
5713
+ top: 7px;
5714
+ right: 7px;
5635
5715
  }
5636
5716
 
5637
5717
  #nd-docs-layout figure.shiki.code-block pre,
5638
5718
  .code-block pre {
5639
- padding: 10px !important;
5640
- font-size: 11px;
5641
- line-height: 1.55;
5719
+ padding: 12px !important;
5720
+ font-size: 12px;
5721
+ line-height: 1.6;
5722
+ }
5723
+
5724
+ #nd-docs-layout figure.shiki.code-block-plain pre,
5725
+ .code-block-plain pre {
5726
+ padding: 16px 44px 16px 14px !important;
5727
+ line-height: 1.65;
5642
5728
  }
5643
5729
 
5644
5730
  .sh__line {
5645
- min-height: 1.55em;
5731
+ min-height: 1.6em;
5646
5732
  }
5647
5733
  }
5648
5734
 
@@ -6229,9 +6315,9 @@ function isFarmDocsSearchEnabled(docs) {
6229
6315
  }
6230
6316
  function resolveFarmDocsSearchClientModule(root) {
6231
6317
  try {
6232
- const requireFromApp = (0, import_node_module2.createRequire)(import_node_path8.default.join(import_node_path8.default.resolve(root), "package.json"));
6318
+ const requireFromApp = (0, import_node_module3.createRequire)(import_node_path9.default.join(import_node_path9.default.resolve(root), "package.json"));
6233
6319
  const themeEntry = requireFromApp.resolve("@farming-labs/theme");
6234
- const commandSearchModule = import_node_path8.default.join(import_node_path8.default.dirname(themeEntry), "docs-command-search.mjs");
6320
+ const commandSearchModule = import_node_path9.default.join(import_node_path9.default.dirname(themeEntry), "docs-command-search.mjs");
6235
6321
  if ((0, import_node_fs6.existsSync)(commandSearchModule)) return commandSearchModule;
6236
6322
  } catch {
6237
6323
  }
@@ -6371,13 +6457,13 @@ async function mountFarmDocsSearch() {
6371
6457
  window.__FARM_MOUNT_DOCS_SEARCH__ = mountFarmDocsSearch;
6372
6458
  `;
6373
6459
  }
6374
- var import_node_fs6, import_node_module2, import_node_path8;
6460
+ var import_node_fs6, import_node_module3, import_node_path9;
6375
6461
  var init_search_client = __esm({
6376
6462
  "src/docs/search-client.ts"() {
6377
6463
  "use strict";
6378
6464
  import_node_fs6 = require("fs");
6379
- import_node_module2 = require("module");
6380
- import_node_path8 = __toESM(require("path"));
6465
+ import_node_module3 = require("module");
6466
+ import_node_path9 = __toESM(require("path"));
6381
6467
  __name(isFarmDocsSearchEnabled, "isFarmDocsSearchEnabled");
6382
6468
  __name(resolveFarmDocsSearchClientModule, "resolveFarmDocsSearchClientModule");
6383
6469
  __name(generateFarmDocsSearchBootstrapRuntime, "generateFarmDocsSearchBootstrapRuntime");
@@ -6401,9 +6487,9 @@ function resolveFarmDocsFavicon(docs, options) {
6401
6487
  if (typeof configuredFavicon === "string" && configuredFavicon.trim()) {
6402
6488
  return configuredFavicon.trim();
6403
6489
  }
6404
- const publicDir = import_node_path9.default.join(import_node_path9.default.resolve(options.root), "public");
6490
+ const publicDir = import_node_path10.default.join(import_node_path10.default.resolve(options.root), "public");
6405
6491
  for (const fileName of FARM_DOCS_FAVICON_FILES) {
6406
- const faviconPath = import_node_path9.default.join(publicDir, fileName);
6492
+ const faviconPath = import_node_path10.default.join(publicDir, fileName);
6407
6493
  if ((0, import_node_fs7.existsSync)(faviconPath) && (0, import_node_fs7.statSync)(faviconPath).isFile()) {
6408
6494
  return `/${fileName}`;
6409
6495
  }
@@ -6438,10 +6524,10 @@ function isSafeSegment(segment) {
6438
6524
  return segment !== ".." && !segment.includes("/") && !segment.includes("\\");
6439
6525
  }
6440
6526
  function resolveInside(root, target) {
6441
- const resolvedRoot = import_node_path9.default.resolve(root);
6442
- const resolvedTarget = import_node_path9.default.resolve(target);
6443
- const relative4 = import_node_path9.default.relative(resolvedRoot, resolvedTarget);
6444
- if (relative4 === "" || !relative4.startsWith("..") && !import_node_path9.default.isAbsolute(relative4)) {
6527
+ const resolvedRoot = import_node_path10.default.resolve(root);
6528
+ const resolvedTarget = import_node_path10.default.resolve(target);
6529
+ const relative4 = import_node_path10.default.relative(resolvedRoot, resolvedTarget);
6530
+ if (relative4 === "" || !relative4.startsWith("..") && !import_node_path10.default.isAbsolute(relative4)) {
6445
6531
  return resolvedTarget;
6446
6532
  }
6447
6533
  return null;
@@ -6455,16 +6541,16 @@ function isFarmDocsRequest(docs, request) {
6455
6541
  return pathname === entry || pathname === `${entry}.md` || pathname.startsWith(`${entry}/`);
6456
6542
  }
6457
6543
  function resolveFarmDocsContentDir(docs, options) {
6458
- const root = import_node_path9.default.resolve(options.root);
6544
+ const root = import_node_path10.default.resolve(options.root);
6459
6545
  const srcDir = options.srcDir || "src";
6460
6546
  const configuredContentDir = docs.contentDir || docs.config.contentDir;
6461
6547
  if (configuredContentDir) {
6462
- return import_node_path9.default.isAbsolute(configuredContentDir) ? configuredContentDir : import_node_path9.default.join(root, configuredContentDir);
6548
+ return import_node_path10.default.isAbsolute(configuredContentDir) ? configuredContentDir : import_node_path10.default.join(root, configuredContentDir);
6463
6549
  }
6464
6550
  const entryDir = docs.config.entry || trimSlashes2(docs.entry) || "docs";
6465
- const appDocsDir = import_node_path9.default.join(root, srcDir, "app", entryDir);
6551
+ const appDocsDir = import_node_path10.default.join(root, srcDir, "app", entryDir);
6466
6552
  if ((0, import_node_fs7.existsSync)(appDocsDir)) return appDocsDir;
6467
- return import_node_path9.default.join(root, entryDir);
6553
+ return import_node_path10.default.join(root, entryDir);
6468
6554
  }
6469
6555
  function getFarmDocsRouteTypeEntries(docs) {
6470
6556
  if (!docs?.enabled) return [];
@@ -6487,10 +6573,10 @@ function getRequestSlug(docs, request) {
6487
6573
  function findDocsPageFile(contentDir, slug) {
6488
6574
  const segments = slug ? slug.split("/").filter(Boolean) : [];
6489
6575
  if (!segments.every(isSafeSegment)) return null;
6490
- const slugDir = import_node_path9.default.join(contentDir, ...segments);
6491
- const candidates = segments.length === 0 ? DOCS_FILE_NAMES.map((filename) => import_node_path9.default.join(contentDir, filename)) : [
6492
- ...DOCS_FILE_NAMES.map((filename) => import_node_path9.default.join(slugDir, filename)),
6493
- ...DOCS_FILE_EXTENSIONS2.map((extension) => import_node_path9.default.join(contentDir, `${slug}${extension}`))
6576
+ const slugDir = import_node_path10.default.join(contentDir, ...segments);
6577
+ const candidates = segments.length === 0 ? DOCS_FILE_NAMES.map((filename) => import_node_path10.default.join(contentDir, filename)) : [
6578
+ ...DOCS_FILE_NAMES.map((filename) => import_node_path10.default.join(slugDir, filename)),
6579
+ ...DOCS_FILE_EXTENSIONS2.map((extension) => import_node_path10.default.join(contentDir, `${slug}${extension}`))
6494
6580
  ];
6495
6581
  for (const candidate of candidates) {
6496
6582
  const safePath = resolveInside(contentDir, candidate);
@@ -6551,9 +6637,9 @@ function createDocsHref(entry, slug) {
6551
6637
  return normalizedSlug ? `${normalizedEntry}/${normalizedSlug}` : normalizedEntry;
6552
6638
  }
6553
6639
  function pathToSlug(contentDir, filePath) {
6554
- const relative4 = import_node_path9.default.relative(contentDir, filePath).replace(/\\/g, "/");
6640
+ const relative4 = import_node_path10.default.relative(contentDir, filePath).replace(/\\/g, "/");
6555
6641
  if (relative4.startsWith("..")) return null;
6556
- const extension = import_node_path9.default.extname(relative4);
6642
+ const extension = import_node_path10.default.extname(relative4);
6557
6643
  if (!DOCS_FILE_EXTENSIONS2.includes(extension)) return null;
6558
6644
  const withoutExtension = relative4.slice(0, -extension.length);
6559
6645
  if (withoutExtension === "page" || withoutExtension === "index") return "";
@@ -6571,7 +6657,7 @@ function discoverFarmDocsPages(contentDir, docs) {
6571
6657
  const visit = /* @__PURE__ */ __name((dir) => {
6572
6658
  for (const entry of (0, import_node_fs7.readdirSync)(dir, { withFileTypes: true })) {
6573
6659
  if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
6574
- const absolutePath = import_node_path9.default.join(dir, entry.name);
6660
+ const absolutePath = import_node_path10.default.join(dir, entry.name);
6575
6661
  if (entry.isDirectory()) {
6576
6662
  visit(absolutePath);
6577
6663
  continue;
@@ -7410,13 +7496,13 @@ ${renderDocsHashRuntimeScript()}
7410
7496
  ${renderDocsPageActionsRuntimeScript()}`;
7411
7497
  }
7412
7498
  function readCssWithImports(filePath, seen = /* @__PURE__ */ new Set()) {
7413
- const resolved = import_node_path9.default.resolve(filePath);
7499
+ const resolved = import_node_path10.default.resolve(filePath);
7414
7500
  if (seen.has(resolved)) return "";
7415
7501
  seen.add(resolved);
7416
7502
  const source = (0, import_node_fs7.readFileSync)(resolved, "utf8");
7417
7503
  return source.replace(/@import\s+["']([^"']+)["'];?/g, (_match, importPath) => {
7418
7504
  try {
7419
- const importedPath = importPath.startsWith(".") ? import_node_path9.default.resolve(import_node_path9.default.dirname(resolved), importPath) : (0, import_node_module3.createRequire)(resolved).resolve(importPath);
7505
+ const importedPath = importPath.startsWith(".") ? import_node_path10.default.resolve(import_node_path10.default.dirname(resolved), importPath) : (0, import_node_module4.createRequire)(resolved).resolve(importPath);
7420
7506
  return readCssWithImports(importedPath, seen);
7421
7507
  } catch {
7422
7508
  return "";
@@ -7424,13 +7510,13 @@ function readCssWithImports(filePath, seen = /* @__PURE__ */ new Set()) {
7424
7510
  });
7425
7511
  }
7426
7512
  function resolvePixelBorderThemeCss(options) {
7427
- const cacheKey = import_node_path9.default.resolve(options.root);
7513
+ const cacheKey = import_node_path10.default.resolve(options.root);
7428
7514
  const cached = themeCssCache.get(cacheKey);
7429
7515
  if (cached !== void 0) return cached;
7430
7516
  try {
7431
- const requireFromApp = (0, import_node_module3.createRequire)(import_node_path9.default.join(cacheKey, "package.json"));
7517
+ const requireFromApp = (0, import_node_module4.createRequire)(import_node_path10.default.join(cacheKey, "package.json"));
7432
7518
  const themeCssPath = requireFromApp.resolve("@farming-labs/theme/pixel-border/css");
7433
- const requireFromTheme = (0, import_node_module3.createRequire)(themeCssPath);
7519
+ const requireFromTheme = (0, import_node_module4.createRequire)(themeCssPath);
7434
7520
  const fumadocsCssPath = requireFromTheme.resolve("fumadocs-ui/style.css");
7435
7521
  const css = `${readCssWithImports(fumadocsCssPath)}
7436
7522
  ${readCssWithImports(themeCssPath)}`;
@@ -7546,7 +7632,7 @@ function renderFarmDocsBridgeCss(docs) {
7546
7632
  .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; }
7547
7633
  .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); }
7548
7634
  #nd-docs-layout figure.shiki.code-block { box-shadow: 3px 3px 0 0 var(--color-fd-border, hsl(0 0% 15%)) !important; }
7549
- .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; }
7635
+ .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; }
7550
7636
  .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; }
7551
7637
  .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; }
7552
7638
  .code-copy-floating { position: absolute; top: 8px; right: 8px; z-index: 2; opacity: 0.72; transition: opacity 150ms ease; }
@@ -7614,7 +7700,7 @@ function renderFarmDocsBridgeCss(docs) {
7614
7700
  .prose h2 { margin-top: 34px; padding-top: 22px; font-size: 23px; }
7615
7701
  .code-block { margin: 16px 0; box-shadow: 2px 2px 0 0 var(--color-fd-border, hsl(0 0% 15%)); }
7616
7702
  #nd-docs-layout figure.shiki.code-block { box-shadow: 2px 2px 0 0 var(--color-fd-border, hsl(0 0% 15%)) !important; }
7617
- .code-block-header { min-height: 26px; padding: 2px 6px 2px 8px; }
7703
+ .code-block-header { min-height: 32px; padding: 3px 7px 3px 9px; }
7618
7704
  .code-copy-floating { top: 6px; right: 6px; }
7619
7705
  #nd-docs-layout figure.shiki.code-block pre, .code-block pre { padding: 12px 11px !important; font-size: 12px; line-height: 1.5; }
7620
7706
  .sh__line { min-height: 1.5em; }
@@ -7624,13 +7710,11 @@ function renderFarmDocsBridgeCss(docs) {
7624
7710
  .fd-page-footer .fd-last-updated-footer { margin-left: 0; }
7625
7711
  }
7626
7712
  @media (max-width: 640px) {
7627
- .code-block-header { min-height: 22px; padding: 1px 4px 1px 7px; }
7628
- .code-block-title { font-size: 9px; }
7629
- .code-copy { width: 20px; height: 20px; }
7630
- .code-copy svg { width: 12px; height: 12px; }
7631
- .code-copy-floating { top: 5px; right: 5px; }
7632
- #nd-docs-layout figure.shiki.code-block pre, .code-block pre { padding: 10px !important; font-size: 11px; line-height: 1.55; }
7633
- .sh__line { min-height: 1.55em; }
7713
+ .code-block-header { min-height: 30px; padding: 3px 6px 3px 8px; }
7714
+ .code-copy-floating { top: 7px; right: 7px; }
7715
+ #nd-docs-layout figure.shiki.code-block pre, .code-block pre { padding: 12px !important; font-size: 12px; line-height: 1.6; }
7716
+ #nd-docs-layout figure.shiki.code-block-plain pre, .code-block-plain pre { padding: 16px 44px 16px 14px !important; line-height: 1.65; }
7717
+ .sh__line { min-height: 1.6em; }
7634
7718
  }
7635
7719
  ${farmDocsPixelBorderCss}
7636
7720
  `;
@@ -7749,13 +7833,13 @@ function createFarmDocsHandler(docs, options) {
7749
7833
  );
7750
7834
  }, "handleFarmDocsRequest");
7751
7835
  }
7752
- 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;
7836
+ 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;
7753
7837
  var init_handler = __esm({
7754
7838
  "src/docs/handler.ts"() {
7755
7839
  "use strict";
7756
7840
  import_node_fs7 = require("fs");
7757
- import_node_module3 = require("module");
7758
- import_node_path9 = __toESM(require("path"));
7841
+ import_node_module4 = require("module");
7842
+ import_node_path10 = __toESM(require("path"));
7759
7843
  import_docs = require("@farming-labs/docs");
7760
7844
  import_marked = require("marked");
7761
7845
  import_sugar_high = require("sugar-high");
@@ -8143,18 +8227,18 @@ function sanitizeDocsConfig(config) {
8143
8227
  return cloneSerializable(config) || {};
8144
8228
  }
8145
8229
  async function findDocsConfigPath(rootDir, configPath) {
8146
- const { existsSync: existsSync13 } = await import("fs");
8230
+ const { existsSync: existsSync14 } = await import("fs");
8147
8231
  const root = import_path9.default.resolve(rootDir || process.cwd());
8148
8232
  if (configPath) {
8149
8233
  const resolvedPath = import_path9.default.isAbsolute(configPath) ? configPath : import_path9.default.join(root, configPath);
8150
- if (!existsSync13(resolvedPath)) {
8234
+ if (!existsSync14(resolvedPath)) {
8151
8235
  throw new Error(`Could not find docs config at ${configPath}.`);
8152
8236
  }
8153
8237
  return import_path9.default.resolve(resolvedPath);
8154
8238
  }
8155
8239
  for (const filename of DOCS_CONFIG_FILENAMES) {
8156
8240
  const resolvedPath = import_path9.default.join(root, filename);
8157
- if (existsSync13(resolvedPath)) {
8241
+ if (existsSync14(resolvedPath)) {
8158
8242
  return resolvedPath;
8159
8243
  }
8160
8244
  }
@@ -8162,7 +8246,7 @@ async function findDocsConfigPath(rootDir, configPath) {
8162
8246
  }
8163
8247
  async function loadDocsConfig(rootDir, configPath) {
8164
8248
  const fs8 = await import("fs/promises");
8165
- const { pathToFileURL: pathToFileURL3 } = await import("url");
8249
+ const { pathToFileURL: pathToFileURL4 } = await import("url");
8166
8250
  const root = import_path9.default.resolve(rootDir || process.cwd());
8167
8251
  const resolvedPath = await findDocsConfigPath(root, configPath);
8168
8252
  if (!resolvedPath) return void 0;
@@ -8191,7 +8275,7 @@ async function loadDocsConfig(rootDir, configPath) {
8191
8275
  logLevel: "silent",
8192
8276
  sourcemap: "inline"
8193
8277
  });
8194
- const moduleUrl = pathToFileURL3(modulePath).href + `?t=${Date.now()}`;
8278
+ const moduleUrl = pathToFileURL4(modulePath).href + `?t=${Date.now()}`;
8195
8279
  let importedConfig;
8196
8280
  try {
8197
8281
  importedConfig = await import(
@@ -8289,6 +8373,7 @@ var init_config2 = __esm({
8289
8373
  init_devtools_config();
8290
8374
  init_image_config();
8291
8375
  init_config();
8376
+ init_auth_config();
8292
8377
  init_config_entry();
8293
8378
  __name(getDeployTargetForPreset, "getDeployTargetForPreset");
8294
8379
  DOCS_CONFIG_FILENAMES = [
@@ -9077,8 +9162,8 @@ var init_generator = __esm({
9077
9162
  }
9078
9163
  routeGroups.get(key).push(route);
9079
9164
  }
9080
- for (const [path22, routeList] of routeGroups) {
9081
- const openAPIPath = this.convertToOpenAPIPath(path22);
9165
+ for (const [path23, routeList] of routeGroups) {
9166
+ const openAPIPath = this.convertToOpenAPIPath(path23);
9082
9167
  spec.paths[openAPIPath] = {};
9083
9168
  for (const route of routeList) {
9084
9169
  for (const method of route.methods) {
@@ -9092,8 +9177,8 @@ var init_generator = __esm({
9092
9177
  /**
9093
9178
  * Convert Farm.js API path to OpenAPI path format
9094
9179
  */
9095
- convertToOpenAPIPath(path22) {
9096
- return path22.replace(/^\/api/, "");
9180
+ convertToOpenAPIPath(path23) {
9181
+ return path23.replace(/^\/api/, "");
9097
9182
  }
9098
9183
  /**
9099
9184
  * Extract request body schema from endpoint
@@ -9255,8 +9340,8 @@ var init_generator = __esm({
9255
9340
  /**
9256
9341
  * Generate operation summary
9257
9342
  */
9258
- generateSummary(path22, method) {
9259
- const cleanPath = path22.replace(/^\/api\//, "");
9343
+ generateSummary(path23, method) {
9344
+ const cleanPath = path23.replace(/^\/api\//, "");
9260
9345
  const pathParts = cleanPath.split("/");
9261
9346
  const lastPart = pathParts[pathParts.length - 1];
9262
9347
  const action = method === "GET" ? "Get" : method === "POST" ? "Create" : method === "PUT" ? "Update" : method === "DELETE" ? "Delete" : method === "PATCH" ? "Update" : method;
@@ -9265,22 +9350,22 @@ var init_generator = __esm({
9265
9350
  /**
9266
9351
  * Generate operation description
9267
9352
  */
9268
- generateDescription(path22, method) {
9269
- const cleanPath = path22.replace(/^\/api\//, "");
9353
+ generateDescription(path23, method) {
9354
+ const cleanPath = path23.replace(/^\/api\//, "");
9270
9355
  return `${method} ${cleanPath} endpoint`;
9271
9356
  }
9272
9357
  /**
9273
9358
  * Generate operation ID
9274
9359
  */
9275
- generateOperationId(path22, method) {
9276
- const cleanPath = path22.replace(/^\/api\//, "").replace(/\//g, "_");
9360
+ generateOperationId(path23, method) {
9361
+ const cleanPath = path23.replace(/^\/api\//, "").replace(/\//g, "_");
9277
9362
  return `${method.toLowerCase()}_${cleanPath}`;
9278
9363
  }
9279
9364
  /**
9280
9365
  * Generate tags for grouping operations
9281
9366
  */
9282
- generateTags(path22) {
9283
- const cleanPath = path22.replace(/^\/api\//, "");
9367
+ generateTags(path23) {
9368
+ const cleanPath = path23.replace(/^\/api\//, "");
9284
9369
  const pathParts = cleanPath.split("/");
9285
9370
  if (pathParts.length > 1) {
9286
9371
  return [pathParts[0]];
@@ -9293,8 +9378,8 @@ var init_generator = __esm({
9293
9378
  async generateSpecFile(routes, outputPath) {
9294
9379
  const spec = await this.generateSpec(routes);
9295
9380
  const fs8 = require("fs");
9296
- const path22 = require("path");
9297
- const dir = path22.dirname(outputPath);
9381
+ const path23 = require("path");
9382
+ const dir = path23.dirname(outputPath);
9298
9383
  if (!fs8.existsSync(dir)) {
9299
9384
  fs8.mkdirSync(dir, { recursive: true });
9300
9385
  }
@@ -9714,7 +9799,7 @@ async function createFarmDevtoolsSnapshot(input) {
9714
9799
  generatedAt: (input.now?.() || /* @__PURE__ */ new Date()).toISOString(),
9715
9800
  health: resolveHealth(diagnostics),
9716
9801
  project: {
9717
- name: import_node_path10.default.basename(import_node_path10.default.resolve(input.root)),
9802
+ name: import_node_path11.default.basename(import_node_path11.default.resolve(input.root)),
9718
9803
  root: input.root,
9719
9804
  srcDir: input.srcDir,
9720
9805
  basePath: config.basePath || "/",
@@ -9763,11 +9848,11 @@ async function createFarmDevtoolsSnapshot(input) {
9763
9848
  diagnostics
9764
9849
  };
9765
9850
  }
9766
- var import_node_path10;
9851
+ var import_node_path11;
9767
9852
  var init_devtools = __esm({
9768
9853
  "src/devtools.ts"() {
9769
9854
  "use strict";
9770
- import_node_path10 = __toESM(require("path"));
9855
+ import_node_path11 = __toESM(require("path"));
9771
9856
  init_config2();
9772
9857
  init_cron();
9773
9858
  init_route_runtime();
@@ -12577,7 +12662,7 @@ function normalizePositiveDuration(value, fallback, name) {
12577
12662
  }
12578
12663
  __name(normalizePositiveDuration, "normalizePositiveDuration");
12579
12664
  function delay(ms) {
12580
- return new Promise((resolve5) => setTimeout(resolve5, ms));
12665
+ return new Promise((resolve6) => setTimeout(resolve6, ms));
12581
12666
  }
12582
12667
  __name(delay, "delay");
12583
12668
  function normalizeCacheOptionsTags(options) {
@@ -12713,25 +12798,25 @@ function defineRoutes(input) {
12713
12798
  }
12714
12799
  __name(defineRoutes, "defineRoutes");
12715
12800
  var routesBuilder = {
12716
- page(path22, options) {
12801
+ page(path23, options) {
12717
12802
  return normalizeProgrammaticRoute({
12718
12803
  kind: "page",
12719
- path: path22,
12804
+ path: path23,
12720
12805
  ...options
12721
12806
  });
12722
12807
  },
12723
- layout(path22, options) {
12808
+ layout(path23, options) {
12724
12809
  return normalizeProgrammaticRoute({
12725
12810
  kind: "layout",
12726
- path: path22,
12811
+ path: path23,
12727
12812
  ...options
12728
12813
  });
12729
12814
  },
12730
- api(path22, options) {
12815
+ api(path23, options) {
12731
12816
  const { render, runtime, regions, maxDuration, ...methods } = options;
12732
12817
  return normalizeProgrammaticRoute({
12733
12818
  kind: "api",
12734
- path: path22,
12819
+ path: path23,
12735
12820
  render,
12736
12821
  runtime,
12737
12822
  regions,
@@ -12767,7 +12852,7 @@ function getProgrammaticRouteSearchClientOptions(search) {
12767
12852
  return Object.keys(options).length > 0 ? options : void 0;
12768
12853
  }
12769
12854
  __name(getProgrammaticRouteSearchClientOptions, "getProgrammaticRouteSearchClientOptions");
12770
- function resolveProgrammaticRouteSearch(searchConfig, rawSearch, path22, routePath) {
12855
+ function resolveProgrammaticRouteSearch(searchConfig, rawSearch, path23, routePath) {
12771
12856
  const schema = getProgrammaticRouteSearchSchema(searchConfig);
12772
12857
  const search = parseProgrammaticSchema(schema, rawSearch, "search", routePath);
12773
12858
  const options = getProgrammaticRouteSearchOptions(searchConfig);
@@ -12776,7 +12861,7 @@ function resolveProgrammaticRouteSearch(searchConfig, rawSearch, path22, routePa
12776
12861
  schema,
12777
12862
  rawSearch,
12778
12863
  parsedSearch: search,
12779
- path: path22
12864
+ path: path23
12780
12865
  });
12781
12866
  return { search, canonicalPath };
12782
12867
  }
@@ -12959,7 +13044,7 @@ function createRouteModuleFromProgrammaticPage(route) {
12959
13044
  mod.__farmRouteData = route.data;
12960
13045
  mod.__farmRouteParsesProps = true;
12961
13046
  mod.__farmResolveRouteProps = (props) => resolveProgrammaticRouteProps(route, props);
12962
- mod.__farmResolveRouteCanonicalPath = (rawSearch, path22) => resolveProgrammaticRouteSearch(route.search, rawSearch, path22, route.path).canonicalPath;
13047
+ mod.__farmResolveRouteCanonicalPath = (rawSearch, path23) => resolveProgrammaticRouteSearch(route.search, rawSearch, path23, route.path).canonicalPath;
12963
13048
  }
12964
13049
  if (route.pending || route.error || route.notFound) {
12965
13050
  mod.__farmRouteComponents = {
@@ -14166,8 +14251,56 @@ var _RouteManager = class _RouteManager {
14166
14251
  "**/{opengraph-image,twitter-image}.{ts,tsx,js,jsx,png,jpg,jpeg,gif,webp}",
14167
14252
  appDir
14168
14253
  );
14254
+ const canonicalPageGroups = /* @__PURE__ */ new Map();
14255
+ for (const file of pageFiles.filter((candidate) => parseRouteSlotFile(candidate) === null)) {
14256
+ const route = parseRoutePath(file);
14257
+ const pattern = this.createRoutePattern(route);
14258
+ const group = canonicalPageGroups.get(pattern);
14259
+ if (group) {
14260
+ group.files.push(file);
14261
+ } else {
14262
+ canonicalPageGroups.set(pattern, {
14263
+ route,
14264
+ files: [file]
14265
+ });
14266
+ }
14267
+ }
14268
+ for (const [pattern, group] of canonicalPageGroups) {
14269
+ const componentFiles = group.files.filter((file) => !isFarmMarkdownPageFile(file));
14270
+ const markdownFiles = group.files.filter(isFarmMarkdownPageFile);
14271
+ if (componentFiles.length > 1) {
14272
+ throw new Error(
14273
+ `Duplicate page route "${pattern}". Found ${componentFiles.map((file) => import_path5.default.join(appDir, file)).join(" and ")}.`
14274
+ );
14275
+ }
14276
+ if (markdownFiles.length > 1) {
14277
+ throw new Error(
14278
+ `Duplicate markdown representation for page route "${pattern}". Found ${markdownFiles.map((file) => import_path5.default.join(appDir, file)).join(" and ")}.`
14279
+ );
14280
+ }
14281
+ const componentFile = componentFiles[0];
14282
+ const markdownFile = markdownFiles[0];
14283
+ const primaryFile = componentFile || markdownFile;
14284
+ if (!primaryFile) continue;
14285
+ const modulePath = import_path5.default.join(appDir, primaryFile);
14286
+ const existing = this.routes.get(pattern);
14287
+ if (existing?.sourceRoot === source.root) {
14288
+ throw new Error(
14289
+ `Duplicate page route "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
14290
+ );
14291
+ }
14292
+ this.routes.set(pattern, {
14293
+ route: group.route,
14294
+ modulePath,
14295
+ ...markdownFile ? {
14296
+ markdownSourcePath: import_path5.default.join(appDir, markdownFile)
14297
+ } : {},
14298
+ pattern,
14299
+ source: "file",
14300
+ sourceRoot: source.root
14301
+ });
14302
+ }
14169
14303
  for (const [kind, files, target] of [
14170
- ["page", pageFiles.filter((file) => parseRouteSlotFile(file) === null), this.routes],
14171
14304
  ["layout", layoutFiles, this.layouts],
14172
14305
  ["loading", loadingFiles, this.loadings],
14173
14306
  ["error", errorFiles, this.errors]
@@ -15728,6 +15861,7 @@ __name(createTranslatorFromState, "createTranslatorFromState");
15728
15861
  _setFarmI18nSnapshotResolver(() => getFarmI18nClientSnapshot());
15729
15862
 
15730
15863
  // src/server/renderer.ts
15864
+ init_response();
15731
15865
  var cachedClerkProvider = null;
15732
15866
  var importRuntimeModule = new Function("specifier", "return import(specifier);");
15733
15867
  function hasRequestHeader(req, name) {
@@ -16574,6 +16708,15 @@ var _ServerRenderer = class _ServerRenderer {
16574
16708
  });
16575
16709
  });
16576
16710
  } catch (error) {
16711
+ if (isWebResponse(error)) {
16712
+ if (!res.headersSent && !res.writableEnded) {
16713
+ await sendWebResponse(res, error);
16714
+ } else if (!res.writableEnded) {
16715
+ res.end();
16716
+ }
16717
+ completeRender(error.status, pathname);
16718
+ return;
16719
+ }
16577
16720
  if (isFarmRedirectError(error)) {
16578
16721
  const redirect3 = getFarmRedirectError(error);
16579
16722
  const snapshot = getFarmI18nClientSnapshot();
@@ -16874,7 +17017,7 @@ var _ServerRenderer = class _ServerRenderer {
16874
17017
  }
16875
17018
  }
16876
17019
  async renderWithSSR(element, req, res, clearMiddlewareData, options = {}) {
16877
- return new Promise((resolve5, reject) => {
17020
+ return new Promise((resolve6, reject) => {
16878
17021
  const streamStartTime = Date.now();
16879
17022
  const observabilityRoute = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
16880
17023
  const deploymentId = this.getDeploymentId();
@@ -17054,7 +17197,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue(g
17054
17197
  route: observabilityRoute,
17055
17198
  durationMs: Date.now() - streamStartTime
17056
17199
  });
17057
- resolve5();
17200
+ resolve6();
17058
17201
  }
17059
17202
  });
17060
17203
  res.write(shell);
@@ -17065,7 +17208,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue(g
17065
17208
  },
17066
17209
  onShellError(error) {
17067
17210
  didError = true;
17068
- if (!isFarmRedirectError(error) && !isFarmNotFoundError(error)) {
17211
+ if (!isWebResponse(error) && !isFarmRedirectError(error) && !isFarmNotFoundError(error)) {
17069
17212
  logger.error(`SSR shell error: ${error}`);
17070
17213
  emitFarmEvent({
17071
17214
  type: "render.error",
@@ -17080,7 +17223,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue(g
17080
17223
  },
17081
17224
  onError(error) {
17082
17225
  didError = true;
17083
- if (!isFarmRedirectError(error) && !isFarmNotFoundError(error)) {
17226
+ if (!isWebResponse(error) && !isFarmRedirectError(error) && !isFarmNotFoundError(error)) {
17084
17227
  logger.error(`SSR streaming error: ${error}`);
17085
17228
  emitFarmEvent({
17086
17229
  type: "render.error",
@@ -17238,6 +17381,7 @@ var ServerRenderer = _ServerRenderer;
17238
17381
  var import_path6 = __toESM(require("path"));
17239
17382
  init_devtools_config();
17240
17383
  init_config();
17384
+ init_auth_config();
17241
17385
  var defaultDocsConfig = {
17242
17386
  enabled: false,
17243
17387
  entry: "/docs",
@@ -17295,6 +17439,7 @@ var _FarmApp = class _FarmApp {
17295
17439
  deploy: config.deploy || {},
17296
17440
  storage: config.storage || {},
17297
17441
  cache: config.cache || {},
17442
+ auth: isResolvedAuthConfig(config.auth) ? config.auth : resolveFarmAuthConfig(config.auth),
17298
17443
  integrations: config.integrations || {},
17299
17444
  plugins: config.plugins || [],
17300
17445
  migrations: config.migrations || { commands: [] },
@@ -17367,6 +17512,12 @@ function isResolvedI18nConfig(value) {
17367
17512
  return Boolean(value && typeof value === "object" && "enabled" in value);
17368
17513
  }
17369
17514
  __name(isResolvedI18nConfig, "isResolvedI18nConfig");
17515
+ function isResolvedAuthConfig(value) {
17516
+ return Boolean(
17517
+ value && typeof value === "object" && "enabled" in value && "emailAndPassword" in value && "database" in value
17518
+ );
17519
+ }
17520
+ __name(isResolvedAuthConfig, "isResolvedAuthConfig");
17370
17521
 
17371
17522
  // src/default-styles.ts
17372
17523
  var defaultGlobalCSS = `@import "tailwindcss";
@@ -17699,7 +17850,7 @@ var HMRManager = _HMRManager;
17699
17850
 
17700
17851
  // src/api/route-manager.ts
17701
17852
  var fs3 = __toESM(require("fs"));
17702
- var path10 = __toESM(require("path"));
17853
+ var path11 = __toESM(require("path"));
17703
17854
  init_route_runtime();
17704
17855
 
17705
17856
  // src/api/runtime.ts
@@ -18032,7 +18183,7 @@ var _APIRouteManager = class _APIRouteManager {
18032
18183
  async discoverRoutes() {
18033
18184
  this.routes.clear();
18034
18185
  for (const appDir of this.appDirs) {
18035
- const apiDir = path10.join(appDir, "api");
18186
+ const apiDir = path11.join(appDir, "api");
18036
18187
  let routeFiles = [];
18037
18188
  if (fs3.existsSync(apiDir)) {
18038
18189
  routeFiles = this.findRouteFiles(apiDir);
@@ -18060,7 +18211,7 @@ var _APIRouteManager = class _APIRouteManager {
18060
18211
  }
18061
18212
  const entries = fs3.readdirSync(dir, { withFileTypes: true });
18062
18213
  for (const entry of entries) {
18063
- const fullPath = path10.join(dir, entry.name);
18214
+ const fullPath = path11.join(dir, entry.name);
18064
18215
  if (entry.isDirectory()) {
18065
18216
  files.push(...this.findRouteFiles(fullPath));
18066
18217
  } else if (entry.name === "route.ts" || entry.name === "route.tsx" || entry.name === "route.js") {
@@ -18074,8 +18225,8 @@ var _APIRouteManager = class _APIRouteManager {
18074
18225
  */
18075
18226
  async loadRoute(filePath, appDir) {
18076
18227
  try {
18077
- const apiDir = path10.join(appDir, "api");
18078
- const relativePath2 = path10.relative(apiDir, path10.dirname(filePath));
18228
+ const apiDir = path11.join(appDir, "api");
18229
+ const relativePath2 = path11.relative(apiDir, path11.dirname(filePath));
18079
18230
  const routePath = "/api/" + (relativePath2 === "." ? "" : relativePath2.replace(/\\/g, "/"));
18080
18231
  const routeModule = await this.loadModule(filePath);
18081
18232
  const endpoints = {};
@@ -18126,7 +18277,7 @@ var _APIRouteManager = class _APIRouteManager {
18126
18277
  }
18127
18278
  }
18128
18279
  async loadProgrammaticApiRoutes(appDir) {
18129
- const candidateRoots = [path10.dirname(appDir), appDir];
18280
+ const candidateRoots = [path11.dirname(appDir), appDir];
18130
18281
  const routeFiles = Array.from(
18131
18282
  new Set(candidateRoots.flatMap((srcRoot) => findProgrammaticRouteFilesInDir(srcRoot)))
18132
18283
  );
@@ -18152,11 +18303,11 @@ var _APIRouteManager = class _APIRouteManager {
18152
18303
  }
18153
18304
  findRootRoutesFile(appDir) {
18154
18305
  const routeNames = ["routes.ts", "routes.tsx", "routes.js"];
18155
- const candidateDirs = [path10.dirname(appDir), appDir];
18306
+ const candidateDirs = [path11.dirname(appDir), appDir];
18156
18307
  const seen = /* @__PURE__ */ new Set();
18157
18308
  for (const dir of candidateDirs) {
18158
18309
  for (const routeName of routeNames) {
18159
- const routesFile = path10.join(dir, routeName);
18310
+ const routesFile = path11.join(dir, routeName);
18160
18311
  if (seen.has(routesFile)) {
18161
18312
  continue;
18162
18313
  }
@@ -18269,7 +18420,7 @@ var APIRouteManager = _APIRouteManager;
18269
18420
 
18270
18421
  // src/middleware/manager.ts
18271
18422
  var fs4 = __toESM(require("fs"));
18272
- var path11 = __toESM(require("path"));
18423
+ var path12 = __toESM(require("path"));
18273
18424
 
18274
18425
  // src/middleware/context.ts
18275
18426
  function parseCookies(cookieHeader) {
@@ -18645,8 +18796,8 @@ var _MiddlewareManager = class _MiddlewareManager {
18645
18796
  const entries = fs4.readdirSync(dir, { withFileTypes: true });
18646
18797
  for (const entry of entries) {
18647
18798
  if (entry.isDirectory() && !entry.name.startsWith(".") && !entry.name.startsWith("_")) {
18648
- const subPath = path11.join(dir, entry.name);
18649
- const subRoutePath = path11.posix.join(routePath, entry.name);
18799
+ const subPath = path12.join(dir, entry.name);
18800
+ const subRoutePath = path12.posix.join(routePath, entry.name);
18650
18801
  await this.discoverInDirectory(subPath, subRoutePath, discovered);
18651
18802
  }
18652
18803
  }
@@ -18657,7 +18808,7 @@ var _MiddlewareManager = class _MiddlewareManager {
18657
18808
  findMiddlewareFile(dir) {
18658
18809
  const extensions = [".ts", ".tsx", ".js", ".jsx"];
18659
18810
  for (const ext of extensions) {
18660
- const filePath = path11.join(dir, `middleware${ext}`);
18811
+ const filePath = path12.join(dir, `middleware${ext}`);
18661
18812
  if (fs4.existsSync(filePath)) {
18662
18813
  return filePath;
18663
18814
  }
@@ -19009,7 +19160,7 @@ var import_path8 = require("path");
19009
19160
  init_type_generator();
19010
19161
 
19011
19162
  // src/routing/generate-route-types.ts
19012
- var path12 = __toESM(require("path"));
19163
+ var path13 = __toESM(require("path"));
19013
19164
  var fs5 = __toESM(require("fs"));
19014
19165
  init_write_file_if_changed();
19015
19166
  function routeSegmentsToTsTypeLiteral(segments) {
@@ -19052,19 +19203,23 @@ function createRoutePattern(route) {
19052
19203
  __name(createRoutePattern, "createRoutePattern");
19053
19204
  var DEFAULT_OUT_FILE = "farm-routes.d.ts";
19054
19205
  async function generateRouteTypes(options) {
19055
- const {
19056
- root,
19057
- srcDir = "src",
19058
- outFile = DEFAULT_OUT_FILE,
19059
- extraRoutes = [],
19060
- suppressLintOnLink = false
19061
- } = options;
19206
+ const root = path13.resolve(options.root);
19207
+ const srcDir = options.srcDir || "src";
19208
+ const outFile = options.outFile || DEFAULT_OUT_FILE;
19209
+ const outPath = path13.isAbsolute(outFile) ? outFile : path13.join(root, srcDir, outFile);
19210
+ const content = await createRouteTypeDeclarations(options, outPath);
19211
+ fs5.mkdirSync(path13.dirname(outPath), { recursive: true });
19212
+ writeFileIfChanged(outPath, content);
19213
+ return outPath;
19214
+ }
19215
+ __name(generateRouteTypes, "generateRouteTypes");
19216
+ async function createRouteTypeDeclarations(options, outPath) {
19217
+ const { root, srcDir = "src", extraRoutes = [], suppressLintOnLink = false } = options;
19062
19218
  const sourceRoots = options.sourceRoots ?? [{ name: "project", root, srcDir, layer: false }];
19063
- const outPath = path12.join(root, srcDir, outFile);
19064
19219
  const patterns = /* @__PURE__ */ new Set();
19065
19220
  const glob = await import("fast-glob");
19066
19221
  for (const source of sourceRoots) {
19067
- const appDir = path12.join(source.root, source.srcDir, "app");
19222
+ const appDir = path13.join(source.root, source.srcDir, "app");
19068
19223
  if (fs5.existsSync(appDir)) {
19069
19224
  const pageFiles = await glob.default("**/page.{ts,tsx,js,jsx,md,mdx}", {
19070
19225
  cwd: appDir,
@@ -19093,18 +19248,19 @@ async function generateRouteTypes(options) {
19093
19248
  const patternLiterals = sortedPatterns.map(routePatternToRouteLiteral);
19094
19249
  const routePathType = suppressLintOnLink ? "string" : typeLiterals.length ? typeLiterals.join(" | ") : "never";
19095
19250
  const routePatternType = suppressLintOnLink ? "string" : patternLiterals.length ? patternLiterals.join(" | ") : "never";
19251
+ const routeTypesImportPath = `./${path13.basename(outPath).replace(/\.d\.ts$/, "")}`;
19096
19252
  const augmentationBlock = suppressLintOnLink ? "" : `
19097
19253
  declare module "@farm.js/core/client" {
19098
19254
  interface LinkDefaultRoute {
19099
- _: import("./farm-routes").RoutePath;
19100
- pattern: import("./farm-routes").RoutePattern;
19255
+ _: import(${JSON.stringify(routeTypesImportPath)}).RoutePath;
19256
+ pattern: import(${JSON.stringify(routeTypesImportPath)}).RoutePattern;
19101
19257
  }
19102
19258
  }
19103
19259
 
19104
19260
  declare module "@farm.js/core" {
19105
19261
  interface LinkDefaultRoute {
19106
- _: import("./farm-routes").RoutePath;
19107
- pattern: import("./farm-routes").RoutePattern;
19262
+ _: import(${JSON.stringify(routeTypesImportPath)}).RoutePath;
19263
+ pattern: import(${JSON.stringify(routeTypesImportPath)}).RoutePattern;
19108
19264
  }
19109
19265
  // Ensure root import ("@farm.js/core") uses the same typed Link signature as client entry.
19110
19266
  const Link: typeof import("@farm.js/core/client").Link;
@@ -19113,8 +19269,8 @@ declare module "@farm.js/core" {
19113
19269
  // Internal declaration path used by @farm.js/core root type re-exports.
19114
19270
  declare module "@farm.js/core/dist/client.js" {
19115
19271
  interface LinkDefaultRoute {
19116
- _: import("./farm-routes").RoutePath;
19117
- pattern: import("./farm-routes").RoutePattern;
19272
+ _: import(${JSON.stringify(routeTypesImportPath)}).RoutePath;
19273
+ pattern: import(${JSON.stringify(routeTypesImportPath)}).RoutePattern;
19118
19274
  }
19119
19275
  }
19120
19276
  `;
@@ -19126,15 +19282,13 @@ declare module "@farm.js/core/dist/client.js" {
19126
19282
  export type RoutePath = ${routePathType};
19127
19283
  export type RoutePattern = ${routePatternType};${augmentationBlock}
19128
19284
  `;
19129
- fs5.mkdirSync(path12.dirname(outPath), { recursive: true });
19130
- writeFileIfChanged(outPath, content);
19131
- return outPath;
19285
+ return content;
19132
19286
  }
19133
- __name(generateRouteTypes, "generateRouteTypes");
19287
+ __name(createRouteTypeDeclarations, "createRouteTypeDeclarations");
19134
19288
 
19135
19289
  // src/env-types.ts
19136
19290
  var fs6 = __toESM(require("fs"));
19137
- var path13 = __toESM(require("path"));
19291
+ var path14 = __toESM(require("path"));
19138
19292
  init_write_file_if_changed();
19139
19293
  var DEFAULT_OUT_FILE2 = "farm-env.d.ts";
19140
19294
  var CONFIG_FILENAMES2 = [
@@ -19156,20 +19310,27 @@ var CONFIG_FILENAMES2 = [
19156
19310
  "config.cjs"
19157
19311
  ];
19158
19312
  async function generateEnvTypes(options) {
19159
- const root = path13.resolve(options.root);
19313
+ const root = path14.resolve(options.root);
19160
19314
  const srcDir = options.srcDir || "src";
19161
- const outPath = path13.join(root, srcDir, options.outFile || DEFAULT_OUT_FILE2);
19315
+ const outFile = options.outFile || DEFAULT_OUT_FILE2;
19316
+ const outPath = path14.isAbsolute(outFile) ? outFile : path14.join(root, srcDir, outFile);
19317
+ const content = createEnvTypeDeclarations(options, outPath);
19318
+ fs6.mkdirSync(path14.dirname(outPath), { recursive: true });
19319
+ writeFileIfChanged(outPath, content);
19320
+ return outPath;
19321
+ }
19322
+ __name(generateEnvTypes, "generateEnvTypes");
19323
+ function createEnvTypeDeclarations(options, outPath) {
19324
+ const root = path14.resolve(options.root);
19162
19325
  const configPath = findConfigPath(root, options.configPath);
19163
19326
  const configPaths = [
19164
19327
  ...(options.layerConfigPaths ?? []).filter((value) => fs6.existsSync(value)),
19165
19328
  ...configPath ? [configPath] : []
19166
19329
  ];
19167
19330
  const content = configPaths.length > 1 ? createLayeredConfigBackedEnvTypes(outPath, configPaths) : configPaths.length === 1 ? createConfigBackedEnvTypes(outPath, configPaths[0]) : createEmptyEnvTypes();
19168
- fs6.mkdirSync(path13.dirname(outPath), { recursive: true });
19169
- writeFileIfChanged(outPath, content);
19170
- return outPath;
19331
+ return content;
19171
19332
  }
19172
- __name(generateEnvTypes, "generateEnvTypes");
19333
+ __name(createEnvTypeDeclarations, "createEnvTypeDeclarations");
19173
19334
  function createLayeredConfigBackedEnvTypes(outPath, configPaths) {
19174
19335
  const imports = configPaths.map(
19175
19336
  (configPath, index) => `import type FarmConfig${index} from ${JSON.stringify(toTypeImportPath(outPath, configPath))};`
@@ -19225,11 +19386,11 @@ export {};
19225
19386
  __name(createLayeredConfigBackedEnvTypes, "createLayeredConfigBackedEnvTypes");
19226
19387
  function findConfigPath(root, configPath) {
19227
19388
  if (configPath) {
19228
- const resolvedPath = path13.isAbsolute(configPath) ? configPath : path13.join(root, configPath);
19389
+ const resolvedPath = path14.isAbsolute(configPath) ? configPath : path14.join(root, configPath);
19229
19390
  return fs6.existsSync(resolvedPath) ? resolvedPath : null;
19230
19391
  }
19231
19392
  for (const filename of CONFIG_FILENAMES2) {
19232
- const resolvedPath = path13.join(root, filename);
19393
+ const resolvedPath = path14.join(root, filename);
19233
19394
  if (fs6.existsSync(resolvedPath)) {
19234
19395
  return resolvedPath;
19235
19396
  }
@@ -19293,19 +19454,19 @@ export {};
19293
19454
  }
19294
19455
  __name(createEmptyEnvTypes, "createEmptyEnvTypes");
19295
19456
  function toTypeImportPath(outPath, targetPath) {
19296
- const relativePath2 = path13.relative(path13.dirname(outPath), targetPath).replace(/\\/g, "/").replace(/\.(tsx?|jsx?|mjs|cjs|mts|cts)$/, "");
19457
+ const relativePath2 = path14.relative(path14.dirname(outPath), targetPath).replace(/\\/g, "/").replace(/\.(tsx?|jsx?|mjs|cjs|mts|cts)$/, "");
19297
19458
  return relativePath2.startsWith(".") ? relativePath2 : `./${relativePath2}`;
19298
19459
  }
19299
19460
  __name(toTypeImportPath, "toTypeImportPath");
19300
19461
 
19301
19462
  // src/image-types.ts
19302
19463
  var import_node_fs3 = require("fs");
19303
- var import_node_path4 = __toESM(require("path"));
19464
+ var import_node_path5 = __toESM(require("path"));
19304
19465
  init_write_file_if_changed();
19305
19466
  var FARM_STATIC_IMAGE_EXTENSIONS = ["avif", "gif", "jpeg", "jpg", "png", "webp"];
19306
19467
  function generateFarmImageTypes(options) {
19307
- 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");
19308
- (0, import_node_fs3.mkdirSync)(import_node_path4.default.dirname(outputPath), { recursive: true });
19468
+ 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");
19469
+ (0, import_node_fs3.mkdirSync)(import_node_path5.default.dirname(outputPath), { recursive: true });
19309
19470
  writeFileIfChanged(outputPath, createFarmImageTypeDeclarations());
19310
19471
  return outputPath;
19311
19472
  }
@@ -19334,14 +19495,14 @@ __name(createFarmImageTypeDeclarations, "createFarmImageTypeDeclarations");
19334
19495
 
19335
19496
  // src/i18n/type-generator.ts
19336
19497
  var import_node_fs4 = require("fs");
19337
- var import_node_path5 = require("path");
19498
+ var import_node_path6 = require("path");
19338
19499
  init_write_file_if_changed();
19339
19500
  async function generateFarmI18nTypes(options) {
19340
19501
  if (!options.config.enabled) return void 0;
19341
19502
  const { signatures } = await readFarmI18nCatalogs(options.config);
19342
- 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");
19503
+ 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");
19343
19504
  const content = renderFarmI18nTypes(options.config.locales, signatures);
19344
- (0, import_node_fs4.mkdirSync)((0, import_node_path5.dirname)(outFile), { recursive: true });
19505
+ (0, import_node_fs4.mkdirSync)((0, import_node_path6.dirname)(outFile), { recursive: true });
19345
19506
  writeFileIfChanged(outFile, content);
19346
19507
  return outFile;
19347
19508
  }
@@ -19403,7 +19564,10 @@ async function generateFarmTypeArtifacts(options) {
19403
19564
  const result = {
19404
19565
  apiRoutes: []
19405
19566
  };
19406
- if (shouldGenerateRoutes) {
19567
+ const unifiedTypesPath = (0, import_path8.join)(root, srcDir, "farm.d.ts");
19568
+ const shouldRefreshUnifiedTypes = shouldGenerateRoutes && !options.routeTypesOutFile || shouldGenerateEnv && !options.envTypesOutFile || shouldGenerateI18n && !options.i18nTypesOutFile;
19569
+ const unifiedSections = [];
19570
+ if (shouldRefreshUnifiedTypes && !options.routeTypesOutFile) {
19407
19571
  const routeOptions = {
19408
19572
  root,
19409
19573
  srcDir,
@@ -19411,10 +19575,17 @@ async function generateFarmTypeArtifacts(options) {
19411
19575
  suppressLintOnLink: options.suppressLintOnLink,
19412
19576
  sourceRoots
19413
19577
  };
19414
- if (options.routeTypesOutFile) {
19415
- routeOptions.outFile = options.routeTypesOutFile;
19416
- }
19417
- result.routeTypesPath = await generateRouteTypes(routeOptions);
19578
+ unifiedSections.push(await createRouteTypeDeclarations(routeOptions, unifiedTypesPath));
19579
+ result.routeTypesPath = unifiedTypesPath;
19580
+ } else if (shouldGenerateRoutes) {
19581
+ result.routeTypesPath = await generateRouteTypes({
19582
+ root,
19583
+ srcDir,
19584
+ outFile: options.routeTypesOutFile,
19585
+ extraRoutes: options.extraRoutes || [],
19586
+ suppressLintOnLink: options.suppressLintOnLink,
19587
+ sourceRoots
19588
+ });
19418
19589
  }
19419
19590
  if (shouldGenerateApi) {
19420
19591
  const generator = new APITypeGenerator(appDirs);
@@ -19426,22 +19597,40 @@ async function generateFarmTypeArtifacts(options) {
19426
19597
  result.apiTypesPath = apiTypesPath;
19427
19598
  result.apiRoutes = apiRoutes;
19428
19599
  }
19429
- if (shouldGenerateEnv) {
19600
+ if (shouldRefreshUnifiedTypes && !options.envTypesOutFile) {
19601
+ unifiedSections.push(
19602
+ createEnvTypeDeclarations(
19603
+ {
19604
+ root,
19605
+ srcDir,
19606
+ configPath: options.configPath,
19607
+ layerConfigPaths: (options.layers ?? []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile))
19608
+ },
19609
+ unifiedTypesPath
19610
+ )
19611
+ );
19612
+ result.envTypesPath = unifiedTypesPath;
19613
+ } else if (shouldGenerateEnv) {
19430
19614
  result.envTypesPath = await generateEnvTypes({
19431
19615
  root,
19432
19616
  srcDir,
19433
19617
  outFile: options.envTypesOutFile,
19618
+ configPath: options.configPath,
19434
19619
  layerConfigPaths: (options.layers ?? []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile))
19435
19620
  });
19436
19621
  }
19437
- if (shouldGenerateImages) {
19622
+ if (shouldGenerateImages && options.imageTypesOutFile) {
19438
19623
  result.imageTypesPath = generateFarmImageTypes({
19439
19624
  root,
19440
19625
  srcDir,
19441
19626
  outFile: options.imageTypesOutFile
19442
19627
  });
19443
19628
  }
19444
- if (shouldGenerateI18n && options.i18nConfig) {
19629
+ if (shouldRefreshUnifiedTypes && options.i18nConfig?.enabled && !options.i18nTypesOutFile) {
19630
+ const { signatures } = await readFarmI18nCatalogs(options.i18nConfig);
19631
+ unifiedSections.push(renderFarmI18nTypes(options.i18nConfig.locales, signatures));
19632
+ result.i18nTypesPath = unifiedTypesPath;
19633
+ } else if (shouldGenerateI18n && options.i18nConfig) {
19445
19634
  result.i18nTypesPath = await generateFarmI18nTypes({
19446
19635
  root,
19447
19636
  srcDir,
@@ -19449,9 +19638,42 @@ async function generateFarmTypeArtifacts(options) {
19449
19638
  outFile: options.i18nTypesOutFile
19450
19639
  });
19451
19640
  }
19641
+ if (shouldRefreshUnifiedTypes) {
19642
+ (0, import_fs4.mkdirSync)((0, import_path8.dirname)(unifiedTypesPath), { recursive: true });
19643
+ writeFileIfChanged(
19644
+ unifiedTypesPath,
19645
+ `/**
19646
+ * Generated by Farm.js. Do not edit.
19647
+ * Contains project-specific route, environment, and internationalization types.
19648
+ */
19649
+
19650
+ import "@farm.js/core/image";
19651
+
19652
+ ${unifiedSections.join("\n")}`
19653
+ );
19654
+ result.typesPath = unifiedTypesPath;
19655
+ removeLegacyTypeArtifacts(root, srcDir);
19656
+ }
19452
19657
  return result;
19453
19658
  }
19454
19659
  __name(generateFarmTypeArtifacts, "generateFarmTypeArtifacts");
19660
+ var LEGACY_TYPE_ARTIFACTS = [
19661
+ ["farm-routes.d.ts", "Auto-generated route types"],
19662
+ ["farm-env.d.ts", "Auto-generated env types"],
19663
+ ["farm-images.d.ts", "Generated by Farm.js"],
19664
+ ["farm-i18n.d.ts", "Generated by Farm.js"]
19665
+ ];
19666
+ function removeLegacyTypeArtifacts(root, srcDir) {
19667
+ for (const [fileName, marker] of LEGACY_TYPE_ARTIFACTS) {
19668
+ const filePath = (0, import_path8.join)(root, srcDir, fileName);
19669
+ if (!(0, import_fs4.existsSync)(filePath)) continue;
19670
+ const source = (0, import_fs4.readFileSync)(filePath, "utf8");
19671
+ if (source.includes(marker)) {
19672
+ (0, import_fs4.unlinkSync)(filePath);
19673
+ }
19674
+ }
19675
+ }
19676
+ __name(removeLegacyTypeArtifacts, "removeLegacyTypeArtifacts");
19455
19677
 
19456
19678
  // src/vite.ts
19457
19679
  init_markdown();
@@ -19460,7 +19682,7 @@ init_response();
19460
19682
  init_integrations();
19461
19683
  init_devtools_config();
19462
19684
  var fs7 = __toESM(require("fs"));
19463
- var path21 = __toESM(require("path"));
19685
+ var path22 = __toESM(require("path"));
19464
19686
  init_layers();
19465
19687
 
19466
19688
  // src/environment-vite.ts
@@ -19807,7 +20029,7 @@ function transformError(id, message) {
19807
20029
  __name(transformError, "transformError");
19808
20030
 
19809
20031
  // package.json
19810
- var version = "0.1.0-beta.5";
20032
+ var version = "0.1.0-beta.8";
19811
20033
 
19812
20034
  // src/version.ts
19813
20035
  var FARM_VERSION = version;
@@ -19841,8 +20063,8 @@ __name(reportAfterError, "reportAfterError");
19841
20063
  function createAfterRequestState(reportError = defaultAfterErrorReporter) {
19842
20064
  let resolveResponseFinished;
19843
20065
  let responseFinished = false;
19844
- const responseFinishedPromise = new Promise((resolve5) => {
19845
- resolveResponseFinished = resolve5;
20066
+ const responseFinishedPromise = new Promise((resolve6) => {
20067
+ resolveResponseFinished = resolve6;
19846
20068
  });
19847
20069
  const state = {
19848
20070
  completion: Promise.resolve(),
@@ -19919,7 +20141,7 @@ init_image_config();
19919
20141
 
19920
20142
  // src/image-vite.ts
19921
20143
  var import_promises6 = require("fs/promises");
19922
- var import_node_path6 = __toESM(require("path"));
20144
+ var import_node_path7 = __toESM(require("path"));
19923
20145
  var import_image_size2 = require("image-size");
19924
20146
  var FARM_IMAGE_ID_PREFIX = "\0farm:image:";
19925
20147
  var STATIC_IMAGE_RE = /\.(?:avif|gif|jpe?g|png|webp)$/i;
@@ -19992,7 +20214,7 @@ var ALL_TYPE_ARTIFACTS = {
19992
20214
  routes: true,
19993
20215
  api: true,
19994
20216
  env: true,
19995
- images: true,
20217
+ images: false,
19996
20218
  i18n: true
19997
20219
  };
19998
20220
  var createEmptyTypeArtifactSelection = /* @__PURE__ */ __name(() => ({
@@ -20208,7 +20430,7 @@ function fileContainsProgrammaticPageRoute(file) {
20208
20430
  __name(fileContainsProgrammaticPageRoute, "fileContainsProgrammaticPageRoute");
20209
20431
  function rewriteEarlySsrRelativeImports(options) {
20210
20432
  const cleanId = options.id.split("?", 1)[0];
20211
- if (!path21.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
20433
+ if (!path22.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
20212
20434
  return null;
20213
20435
  }
20214
20436
  const replacements = [];
@@ -20228,7 +20450,7 @@ function rewriteEarlySsrRelativeImports(options) {
20228
20450
  const suffixIndex = source.value.search(/[?#]/);
20229
20451
  const sourcePath = suffixIndex === -1 ? source.value : source.value.slice(0, suffixIndex);
20230
20452
  const suffix = suffixIndex === -1 ? "" : source.value.slice(suffixIndex);
20231
- const resolvedPath = path21.resolve(path21.dirname(cleanId), sourcePath);
20453
+ const resolvedPath = path22.resolve(path22.dirname(cleanId), sourcePath);
20232
20454
  replacements.push({
20233
20455
  start: source.start,
20234
20456
  end: source.end,
@@ -20308,7 +20530,7 @@ function farmPlugin(options = {}, initialPluginManager) {
20308
20530
  ...layerRoots.length ? {
20309
20531
  server: {
20310
20532
  fs: {
20311
- allow: [path21.resolve(options.root || process.cwd()), ...layerRoots]
20533
+ allow: [path22.resolve(options.root || process.cwd()), ...layerRoots]
20312
20534
  }
20313
20535
  }
20314
20536
  } : {}
@@ -20333,9 +20555,9 @@ function farmPlugin(options = {}, initialPluginManager) {
20333
20555
  },
20334
20556
  server
20335
20557
  );
20336
- const globalsCSSPath = path21.join(server.config.root, "src/app/globals.css");
20558
+ const globalsCSSPath = path22.join(server.config.root, "src/app/globals.css");
20337
20559
  if (!fs7.existsSync(globalsCSSPath)) {
20338
- const appDir = path21.join(server.config.root, "src/app");
20560
+ const appDir = path22.join(server.config.root, "src/app");
20339
20561
  if (!fs7.existsSync(appDir)) {
20340
20562
  fs7.mkdirSync(appDir, { recursive: true });
20341
20563
  }
@@ -20357,10 +20579,10 @@ function farmPlugin(options = {}, initialPluginManager) {
20357
20579
  });
20358
20580
  }
20359
20581
  const sourceRoots = getFarmSourceRoots(farmConfig);
20360
- server.watcher.add(sourceRoots.map((source) => path21.join(source.root, source.srcDir)));
20582
+ server.watcher.add(sourceRoots.map((source) => path22.join(source.root, source.srcDir)));
20361
20583
  if (farmConfig.i18n.enabled) {
20362
20584
  server.watcher.add(
20363
- farmConfig.i18n.messages.includes("{locale}") ? path21.dirname(farmConfig.i18n.messages) : farmConfig.i18n.messages
20585
+ farmConfig.i18n.messages.includes("{locale}") ? path22.dirname(farmConfig.i18n.messages) : farmConfig.i18n.messages
20364
20586
  );
20365
20587
  }
20366
20588
  const workflowConfig = farmConfig.workflows;
@@ -20370,7 +20592,7 @@ function farmPlugin(options = {}, initialPluginManager) {
20370
20592
  ...farmDocsDevRuntime?.getFarmDocsRouteTypeEntries(farmConfig.docs) ?? []
20371
20593
  ], "getExtraRouteTypes");
20372
20594
  const appDirSlugs = sourceRoots.map(
20373
- (source) => path21.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
20595
+ (source) => path22.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
20374
20596
  );
20375
20597
  const generateTypeArtifacts = /* @__PURE__ */ __name(async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
20376
20598
  try {
@@ -20410,7 +20632,7 @@ function farmPlugin(options = {}, initialPluginManager) {
20410
20632
  }, "generateTypeArtifacts");
20411
20633
  await generateTypeArtifacts("startup");
20412
20634
  const srcDirSlugs = sourceRoots.map(
20413
- (source) => path21.join(source.root, source.srcDir).replace(/\\/g, "/")
20635
+ (source) => path22.join(source.root, source.srcDir).replace(/\\/g, "/")
20414
20636
  );
20415
20637
  const layerConfigFiles = new Set(
20416
20638
  farmConfig.layers.map((layer) => layer.configFile?.replace(/\\/g, "/")).filter((file) => Boolean(file))
@@ -20528,7 +20750,7 @@ function farmPlugin(options = {}, initialPluginManager) {
20528
20750
  await apiRouteManager.discoverRoutes();
20529
20751
  let discoveredWorkflows = [];
20530
20752
  const hasWorkflowDirectory = workflowConfig.enabled && workflowConfig.dirs.some(
20531
- (dir) => fs7.existsSync(path21.isAbsolute(dir) ? dir : path21.join(farmConfig.root, dir))
20753
+ (dir) => fs7.existsSync(path22.isAbsolute(dir) ? dir : path22.join(farmConfig.root, dir))
20532
20754
  );
20533
20755
  if (hasWorkflowDirectory) {
20534
20756
  const { createFarmWorkflowRequestHandler: createFarmWorkflowRequestHandler2, discoverFarmWorkflows: discoverFarmWorkflows2 } = await loadFarmWorkflowsDevRuntime();
@@ -20606,14 +20828,14 @@ function farmPlugin(options = {}, initialPluginManager) {
20606
20828
  farmDocsDevRuntime ? [
20607
20829
  [
20608
20830
  "/assets/Geist-Variable-CrgPqtmy.woff2",
20609
- path21.join(
20831
+ path22.join(
20610
20832
  farmConfig.root,
20611
20833
  "node_modules/geist/dist/fonts/geist-sans/Geist-Variable.woff2"
20612
20834
  )
20613
20835
  ],
20614
20836
  [
20615
20837
  "/assets/GeistMono-Variable-BNLlm6Cd.woff2",
20616
- path21.join(
20838
+ path22.join(
20617
20839
  farmConfig.root,
20618
20840
  "node_modules/geist/dist/fonts/geist-mono/GeistMono-Variable.woff2"
20619
20841
  )
@@ -20777,12 +20999,13 @@ function farmPlugin(options = {}, initialPluginManager) {
20777
20999
  config: farmApp.getConfig().mdx,
20778
21000
  resolveSource: /* @__PURE__ */ __name(async (pathname2) => {
20779
21001
  const match = farmApp.getRouteManager().matchRoute(pathname2);
20780
- if (!match.route || !isFarmMarkdownPageFile(match.route.modulePath)) {
21002
+ const sourcePath = match.route?.markdownSourcePath || (match.route && isFarmMarkdownPageFile(match.route.modulePath) ? match.route.modulePath : null);
21003
+ if (!sourcePath) {
20781
21004
  return null;
20782
21005
  }
20783
21006
  return {
20784
- source: await fs7.promises.readFile(match.route.modulePath, "utf8"),
20785
- filePath: match.route.modulePath
21007
+ source: await fs7.promises.readFile(sourcePath, "utf8"),
21008
+ filePath: sourcePath
20786
21009
  };
20787
21010
  }, "resolveSource")
20788
21011
  });
@@ -20803,16 +21026,37 @@ function farmPlugin(options = {}, initialPluginManager) {
20803
21026
  await sendWebResponse(res, markdownResponse);
20804
21027
  return;
20805
21028
  }
21029
+ const markdownPageTarget = resolveMarkdownMirrorTarget(
21030
+ farmApp.getConfig().md,
21031
+ requestPathname,
21032
+ {
21033
+ accept: "text/markdown"
21034
+ }
21035
+ );
21036
+ if (markdownPageTarget && farmApp.getRouteManager().matchRoute(markdownPageTarget.pathname).route) {
21037
+ const vary = res.getHeader("Vary");
21038
+ const varyValues = String(vary || "").split(",").map((value) => value.trim()).filter(Boolean);
21039
+ if (!varyValues.some((value) => value.toLowerCase() === "accept")) {
21040
+ res.setHeader("Vary", [...varyValues, "Accept"].join(", "));
21041
+ }
21042
+ const alternatePath = markdownPageTarget.pathname === "/" ? "/index.md" : `${markdownPageTarget.pathname}.md`;
21043
+ const alternateLink = `<${alternatePath}>; rel="alternate"; type="text/markdown"`;
21044
+ const currentLink = res.getHeader("Link");
21045
+ res.setHeader(
21046
+ "Link",
21047
+ currentLink ? `${String(currentLink)}, ${alternateLink}` : alternateLink
21048
+ );
21049
+ }
20806
21050
  if (workflowHandler && (requestPathname === workflowConfig.route || requestPathname.startsWith(`${workflowConfig.route}/`))) {
20807
21051
  let workflowBody;
20808
21052
  if (requestMethod !== "GET" && requestMethod !== "HEAD") {
20809
- workflowBody = await new Promise((resolve5) => {
21053
+ workflowBody = await new Promise((resolve6) => {
20810
21054
  let data = "";
20811
21055
  req.on("data", (chunk) => {
20812
21056
  data += chunk;
20813
21057
  });
20814
21058
  req.on("end", () => {
20815
- resolve5(data);
21059
+ resolve6(data);
20816
21060
  });
20817
21061
  });
20818
21062
  }
@@ -20855,13 +21099,13 @@ function farmPlugin(options = {}, initialPluginManager) {
20855
21099
  }
20856
21100
  let body;
20857
21101
  if (req.method !== "GET" && req.method !== "HEAD") {
20858
- body = await new Promise((resolve5) => {
21102
+ body = await new Promise((resolve6) => {
20859
21103
  let data = "";
20860
21104
  req.on("data", (chunk) => {
20861
21105
  data += chunk;
20862
21106
  });
20863
21107
  req.on("end", () => {
20864
- resolve5(data);
21108
+ resolve6(data);
20865
21109
  });
20866
21110
  });
20867
21111
  }
@@ -20967,13 +21211,13 @@ function farmPlugin(options = {}, initialPluginManager) {
20967
21211
  }
20968
21212
  let body;
20969
21213
  if (req.method !== "GET" && req.method !== "HEAD") {
20970
- body = await new Promise((resolve5) => {
21214
+ body = await new Promise((resolve6) => {
20971
21215
  let data = "";
20972
21216
  req.on("data", (chunk) => {
20973
21217
  data += chunk;
20974
21218
  });
20975
21219
  req.on("end", () => {
20976
- resolve5(data);
21220
+ resolve6(data);
20977
21221
  });
20978
21222
  });
20979
21223
  }
@@ -21030,13 +21274,13 @@ function farmPlugin(options = {}, initialPluginManager) {
21030
21274
  }
21031
21275
  let body;
21032
21276
  if (req.method !== "GET" && req.method !== "HEAD") {
21033
- body = await new Promise((resolve5) => {
21277
+ body = await new Promise((resolve6) => {
21034
21278
  let data = "";
21035
21279
  req.on("data", (chunk) => {
21036
21280
  data += chunk;
21037
21281
  });
21038
21282
  req.on("end", () => {
21039
- resolve5(data);
21283
+ resolve6(data);
21040
21284
  });
21041
21285
  });
21042
21286
  }
@@ -21756,8 +22000,8 @@ if (import.meta.hot) {
21756
22000
  }
21757
22001
  logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
21758
22002
  logger.info("Pre-rendering SSG pages...");
21759
- const outDir = path21.join(server?.config.root || process.cwd(), options.outDir || "dist");
21760
- const clientDir = path21.join(outDir, "client");
22003
+ const outDir = path22.join(server?.config.root || process.cwd(), options.outDir || "dist");
22004
+ const clientDir = path22.join(outDir, "client");
21761
22005
  for (const page2 of ssgPages) {
21762
22006
  try {
21763
22007
  const staticRequest = new Request(new URL(page2.urlPath, "http://farm.static"));
@@ -21809,8 +22053,8 @@ if (import.meta.hot) {
21809
22053
  <script type="module" src="/assets/client.js"></script>
21810
22054
  </body>
21811
22055
  </html>`;
21812
- const outputPath = page2.urlPath === "/" ? path21.join(clientDir, "index.html") : path21.join(clientDir, page2.urlPath + ".html");
21813
- fs7.mkdirSync(path21.dirname(outputPath), { recursive: true });
22056
+ const outputPath = page2.urlPath === "/" ? path22.join(clientDir, "index.html") : path22.join(clientDir, page2.urlPath + ".html");
22057
+ fs7.mkdirSync(path22.dirname(outputPath), { recursive: true });
21814
22058
  fs7.writeFileSync(outputPath, fullHtml);
21815
22059
  const revalidateInfo = page2.revalidate ? ` (revalidate: ${page2.revalidate}s)` : "";
21816
22060
  logger.success(` \u2713 ${page2.urlPath}${revalidateInfo}`);
@@ -21819,7 +22063,7 @@ if (import.meta.hot) {
21819
22063
  logger.error(` \u2717 ${page2.urlPath}: ${error}`);
21820
22064
  }
21821
22065
  }
21822
- const manifestPath = path21.join(outDir, "__ssg_manifest.json");
22066
+ const manifestPath = path22.join(outDir, "__ssg_manifest.json");
21823
22067
  fs7.writeFileSync(
21824
22068
  manifestPath,
21825
22069
  JSON.stringify(
@@ -21855,9 +22099,9 @@ if (import.meta.hot) {
21855
22099
  }
21856
22100
  const currentFarmConfig = farmApp?.getConfig();
21857
22101
  const normalizedFile = file.replace(/\\/g, "/");
21858
- const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) => path21.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
22102
+ const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) => path22.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
21859
22103
  if (currentSrcRoot && normalizedFile.startsWith(`${currentSrcRoot}/`) && isProgrammaticRoutesFileName(normalizedFile)) {
21860
- logUpdate("PAGE", `updated ${path21.basename(file)}`);
22104
+ logUpdate("PAGE", `updated ${path22.basename(file)}`);
21861
22105
  for (const mod of modules) {
21862
22106
  server2.moduleGraph.invalidateModule(mod);
21863
22107
  }
@@ -22900,6 +23144,7 @@ async function buildRouteComponentProps(pageModule, params, searchParams, path,
22900
23144
  const parsedSearch = parseClientRouteSchema(schemas?.search, searchParams, 'search');
22901
23145
 
22902
23146
  return {
23147
+ ...(existingProps || {}),
22903
23148
  params: parsedParams,
22904
23149
  search: parsedSearch,
22905
23150
  searchParams: schemas ? Promise.resolve(parsedSearch) : parsedSearch,
@@ -23416,7 +23661,7 @@ function generateClientManifest(bundle) {
23416
23661
  __name(generateClientManifest, "generateClientManifest");
23417
23662
  async function defineConfig2(config = {}) {
23418
23663
  const tailwindcss = (await import("@tailwindcss/vite")).default;
23419
- const appRoot = path21.resolve(config.root || process.cwd());
23664
+ const appRoot = path22.resolve(config.root || process.cwd());
23420
23665
  if (config.extends?.length) {
23421
23666
  const { config: layeredConfig } = await Promise.resolve().then(() => (init_layers(), layers_exports)).then(
23422
23667
  ({ resolveFarmLayers: resolveFarmLayers2 }) => resolveFarmLayers2(config, {
@@ -23602,7 +23847,7 @@ async function defineConfig2(config = {}) {
23602
23847
  // Stub out problematic server-only modules during dev mode
23603
23848
  alias: {
23604
23849
  ...getFarmLayerAliases(config.layers),
23605
- "@": path21.resolve(appRoot, "src"),
23850
+ "@": path22.resolve(appRoot, "src"),
23606
23851
  // Nitro internals that should not be resolved in browser
23607
23852
  "supports-color": "data:text/javascript,export default false; export const supportsColor = false; export const stdout = false; export const stderr = false;",
23608
23853
  "@poppinss/dumper": "data:text/javascript,export default {};",