@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
@@ -0,0 +1,689 @@
1
+ import {
2
+ routeRulesToNitroRouteRules
3
+ } from "./chunk-YW7OBE6Q.mjs";
4
+ import {
5
+ prepareFarmWorkflowsForNitro
6
+ } from "./chunk-XIVV5IWN.mjs";
7
+ import {
8
+ createFarmCronCloudflareConfig,
9
+ mergeScheduledTasks,
10
+ prepareFarmCronForNitro
11
+ } from "./chunk-GXASWWJU.mjs";
12
+ import "./chunk-GQVGIUSN.mjs";
13
+ import {
14
+ __name
15
+ } from "./chunk-CGILA3WO.mjs";
16
+
17
+ // src/nitro/index.ts
18
+ import path from "path";
19
+ async function createNitroConfig(config, routeManager, apiRouteManager, serverRenderer, preset = "node-server") {
20
+ const root = config.root || process.cwd();
21
+ const srcDir = config.srcDir || "src";
22
+ const distDir = ".farm";
23
+ const nitroBuildDir = path.join(root, distDir, ".nitro");
24
+ const outputDir = path.join(root, distDir, ".output");
25
+ const serverDir = path.join(nitroBuildDir, "server");
26
+ const { mkdir, writeFile } = await import("fs/promises");
27
+ await mkdir(serverDir, { recursive: true });
28
+ await mkdir(path.join(serverDir, "api"), { recursive: true });
29
+ await mkdir(path.join(serverDir, "routes"), { recursive: true });
30
+ const farmWorkflows = await prepareFarmWorkflowsForNitro({
31
+ ...config,
32
+ distDir
33
+ });
34
+ const farmCron = await prepareFarmCronForNitro({
35
+ ...config,
36
+ distDir
37
+ });
38
+ const scheduledTasks = mergeScheduledTasks(farmWorkflows.scheduledTasks, farmCron.scheduledTasks);
39
+ const cloudflareCronConfig = createFarmCronCloudflareConfig(farmCron.jobs);
40
+ const registryFile = path.join(serverDir, "farm-registry.ts");
41
+ const routePaths = {};
42
+ for (const [pattern, entry] of routeManager.getRoutes()) {
43
+ const bundledPath = entry.modulePath.replace(/.*\/src\/app\//, "").replace(/\.(tsx?|jsx?)$/, ".js");
44
+ routePaths[pattern] = bundledPath;
45
+ }
46
+ const clientManifestPath = path.join(root, distDir, "client", "farm-client-manifest.json");
47
+ await writeFile(
48
+ registryFile,
49
+ `
50
+ // Auto-generated by Farm.js
51
+ // Runtime registry for route managers and renderers
52
+ export const farmRegistry: {
53
+ apiRouteManager?: any;
54
+ routeManager?: any;
55
+ serverRenderer?: any;
56
+ env?: any;
57
+ deploymentId?: string;
58
+ basePath?: string;
59
+ clientManifest?: any;
60
+ routePaths?: Record<string, string>;
61
+ } = {
62
+ env: ${JSON.stringify(config.env || { server: {}, public: {} }, null, 2)},
63
+ deploymentId: ${JSON.stringify(config.deploymentId)},
64
+ basePath: ${JSON.stringify(config.basePath)},
65
+ routePaths: ${JSON.stringify(routePaths, null, 2)},
66
+ };
67
+ `,
68
+ "utf-8"
69
+ );
70
+ const apiHandlerFile = path.join(serverDir, "api", "[...].ts");
71
+ await mkdir(path.dirname(apiHandlerFile), { recursive: true });
72
+ await writeFile(
73
+ apiHandlerFile,
74
+ `
75
+ // Auto-generated by Farm.js
76
+ // This handler intercepts all /api/* requests
77
+ import { defineEventHandler, getHeaders, readBody, sendWebResponse, setResponseStatus, getRequestURL } from 'h3';
78
+ import type { H3Event } from 'h3';
79
+ import { farmRegistry } from '../farm-registry';
80
+
81
+ export default defineEventHandler(async (event: H3Event) => {
82
+ // Get URL using H3's abstraction (works in all environments)
83
+ const url = getRequestURL(event);
84
+ const urlPath = url.pathname;
85
+
86
+ // Only handle API routes - for Vercel, Nitro routes /api/* to this handler
87
+ // According to https://nitro.build/deploy/providers/vercel
88
+ // This handler should process all /api/* routes
89
+ if (!urlPath.startsWith('/api/')) {
90
+ // Return undefined to let Nitro's routing system handle non-API routes
91
+ return undefined;
92
+ }
93
+
94
+ // Ensure registry is populated (lazy initialization)
95
+ // In serverless environments, the registry needs to be initialized at runtime
96
+ if (!farmRegistry.apiRouteManager) {
97
+ // Try to initialize from global if available (set during build)
98
+ if (typeof globalThis !== 'undefined' && (globalThis as any).__FARM_REGISTRY__) {
99
+ Object.assign(farmRegistry, (globalThis as any).__FARM_REGISTRY__);
100
+ }
101
+ // If still not available, try the init function (if it exists)
102
+ if (!farmRegistry.apiRouteManager && (farmRegistry as any).__INIT__) {
103
+ (farmRegistry as any).__INIT__();
104
+ }
105
+ }
106
+
107
+ const apiRouteManager = farmRegistry.apiRouteManager;
108
+ if (!apiRouteManager) {
109
+ console.error('API route manager not initialized. Registry keys:', Object.keys(farmRegistry));
110
+ setResponseStatus(event, 500);
111
+ return { error: 'API route manager not initialized. Please check server logs.' };
112
+ }
113
+
114
+ const startTime = Date.now();
115
+ const method = event.method || 'GET';
116
+ const host = url.host || 'localhost';
117
+
118
+ // Log API request (only in development)
119
+ if (process.env.NODE_ENV === 'development' || !process.env.NODE_ENV) {
120
+ try {
121
+ const pc = await import('picocolors');
122
+ const log = [
123
+ pc.default.dim('[') + pc.default.bold(pc.default.blue('FARM')) + pc.default.dim(']'),
124
+ pc.default.dim('[') + pc.default.bold(pc.default.white(method.padEnd(3))) + pc.default.dim(']'),
125
+ pc.default.cyan('[API]'),
126
+ pc.default.gray(\`\${url.protocol}//\${host}\${urlPath}\`),
127
+ ].join(' ');
128
+ console.log(log);
129
+ } catch {
130
+ // picocolors not available, use simple log
131
+ console.log(\`[FARM] [\${method}] [API] \${urlPath}\`);
132
+ }
133
+ }
134
+
135
+ try {
136
+ // Convert H3 event to Web Request using H3 abstractions
137
+ const protocol = url.protocol.replace(':', '') || 'http';
138
+ const host = url.host || 'localhost';
139
+ const fullUrl = url.toString();
140
+
141
+ const headers = new Headers();
142
+ const h3Headers = getHeaders(event);
143
+
144
+ for (const [key, value] of Object.entries(h3Headers)) {
145
+ if (value) {
146
+ headers.set(key, Array.isArray(value) ? value.join(', ') : String(value));
147
+ }
148
+ }
149
+
150
+ // Get body
151
+ let body: string | undefined;
152
+ const method = event.method || 'GET';
153
+ if (method !== 'GET' && method !== 'HEAD') {
154
+ const bodyData = await readBody(event).catch(() => undefined);
155
+ if (bodyData) {
156
+ body = typeof bodyData === 'string' ? bodyData : JSON.stringify(bodyData);
157
+ }
158
+ }
159
+
160
+ // Create Web Request
161
+ const request = new Request(fullUrl, {
162
+ method,
163
+ headers,
164
+ body: body || undefined,
165
+ });
166
+
167
+ // Call better-call handler
168
+ const betterCallHandler = apiRouteManager.getHandler();
169
+ if (!betterCallHandler) {
170
+ setResponseStatus(event, 404);
171
+ return { error: 'API handler not found' };
172
+ }
173
+
174
+ const response = await betterCallHandler(request);
175
+
176
+ // Log API response (only in development)
177
+ if (process.env.NODE_ENV === 'development' || !process.env.NODE_ENV) {
178
+ const duration = Date.now() - startTime;
179
+ const status = response.status;
180
+ try {
181
+ const pc = await import('picocolors');
182
+ let statusColor = pc.default.green;
183
+ if (status >= 500) statusColor = pc.default.red;
184
+ else if (status >= 400) statusColor = pc.default.yellow;
185
+ else if (status >= 300) statusColor = pc.default.cyan;
186
+
187
+ const log = [
188
+ pc.default.dim('[') + pc.default.bold(pc.default.blue('FARM')) + pc.default.dim(']'),
189
+ status >= 400 ? pc.default.red('\u2717') : pc.default.green('\u2713'),
190
+ pc.default.cyan('[API]'),
191
+ pc.default.gray(urlPath),
192
+ pc.default.dim('-'),
193
+ statusColor(status.toString()),
194
+ pc.default.dim(\`(\${duration}ms)\`),
195
+ ].join(' ');
196
+ console.log(log);
197
+ } catch {
198
+ // picocolors not available, use simple log
199
+ console.log(\`[FARM] [\${method}] [API] \${urlPath} - \${response.status} (\${duration}ms)\`);
200
+ }
201
+ }
202
+
203
+ return sendWebResponse(response);
204
+ } catch (error: any) {
205
+ console.error('API handler error:', error);
206
+ setResponseStatus(event, 500);
207
+ return {
208
+ error: error.message || 'Internal Server Error',
209
+ };
210
+ }
211
+ });
212
+ `,
213
+ "utf-8"
214
+ );
215
+ const ssrHandlerFile = path.join(serverDir, "routes", "[...].ts");
216
+ await mkdir(path.dirname(ssrHandlerFile), { recursive: true });
217
+ await writeFile(
218
+ ssrHandlerFile,
219
+ `
220
+ // Auto-generated by Farm.js
221
+ // This handler handles all page routes (SSR)
222
+ import { defineEventHandler, setResponseStatus, getRequestURL, setHeader, getHeaders, readBody, sendWebResponse, setCookie } from 'h3';
223
+ import type { H3Event } from 'h3';
224
+ import { farmRegistry } from '../farm-registry';
225
+ import React from 'react';
226
+ import { renderToString } from 'react-dom/server';
227
+
228
+ export default defineEventHandler(async (event: H3Event) => {
229
+ try {
230
+ // Ensure registry is populated (lazy initialization)
231
+ // In serverless environments, the registry needs to be initialized at runtime
232
+ if (!farmRegistry.routeManager || !farmRegistry.serverRenderer) {
233
+ // Try to initialize from global if available (set during build)
234
+ if (typeof globalThis !== 'undefined' && (globalThis as any).__FARM_REGISTRY__) {
235
+ Object.assign(farmRegistry, (globalThis as any).__FARM_REGISTRY__);
236
+ }
237
+ // If still not available, try the init function (if it exists)
238
+ if ((!farmRegistry.routeManager || !farmRegistry.serverRenderer) && (farmRegistry as any).__INIT__) {
239
+ (farmRegistry as any).__INIT__();
240
+ }
241
+ }
242
+
243
+ const routeManager = farmRegistry.routeManager;
244
+ const serverRenderer = farmRegistry.serverRenderer;
245
+
246
+ if (!routeManager || !serverRenderer) {
247
+ console.error('Route manager or renderer not initialized. Registry keys:', Object.keys(farmRegistry));
248
+ setResponseStatus(event, 500);
249
+ setHeader(event, 'Content-Type', 'text/html; charset=utf-8');
250
+ return '<!DOCTYPE html><html><head><title>Error</title></head><body><h1>500 Internal Server Error</h1><p>Route manager or renderer not initialized. Please check server logs.</p></body></html>';
251
+ }
252
+
253
+ // Get URL from H3 event
254
+ const url = getRequestURL(event);
255
+ const pathname = url.pathname;
256
+ const redirectMatch = routeManager.matchRedirect(pathname);
257
+ if (redirectMatch) {
258
+ setResponseStatus(event, redirectMatch.statusCode);
259
+ setHeader(event, 'Location', redirectMatch.destination);
260
+ return \`Redirecting to \${redirectMatch.destination}\`;
261
+ }
262
+ const apiRouteManager = farmRegistry.apiRouteManager;
263
+
264
+ if (apiRouteManager?.matchRoute(pathname)) {
265
+ const handler = apiRouteManager.getHandler();
266
+ if (!handler) {
267
+ setResponseStatus(event, 404);
268
+ return { error: 'API handler not found' };
269
+ }
270
+
271
+ const headers = new Headers();
272
+ const h3Headers = getHeaders(event);
273
+ for (const [key, value] of Object.entries(h3Headers)) {
274
+ if (value) {
275
+ headers.set(key, Array.isArray(value) ? value.join(', ') : String(value));
276
+ }
277
+ }
278
+
279
+ let body: string | undefined;
280
+ const method = event.method || 'GET';
281
+ if (method !== 'GET' && method !== 'HEAD') {
282
+ const bodyData = await readBody(event).catch(() => undefined);
283
+ if (bodyData) {
284
+ body = typeof bodyData === 'string' ? bodyData : JSON.stringify(bodyData);
285
+ }
286
+ }
287
+
288
+ const response = await handler(new Request(url.toString(), {
289
+ method,
290
+ headers,
291
+ body: body || undefined,
292
+ }));
293
+
294
+ return sendWebResponse(response);
295
+ }
296
+
297
+ // Skip API routes - let the API handler process them
298
+ if (pathname.startsWith('/api/')) {
299
+ // Return undefined to let Nitro's API handler process
300
+ return undefined;
301
+ }
302
+
303
+ // Skip static assets - let Nitro serve them
304
+ // Only skip if it's clearly a static file (has extension and not in root)
305
+ if (pathname.startsWith('/assets/') || (pathname.includes('.') && !pathname.startsWith('/api/'))) {
306
+ // Check if it's a static file by extension
307
+ const staticExtensions = ['.js', '.css', '.png', '.jpg', '.jpeg', '.gif', '.svg', '.ico', '.woff', '.woff2', '.ttf', '.eot'];
308
+ const hasStaticExtension = staticExtensions.some(ext => pathname.toLowerCase().endsWith(ext));
309
+ if (hasStaticExtension) {
310
+ return; // Let Nitro's static file handler process
311
+ }
312
+ }
313
+
314
+ // Try to use Node.js req/res if available (for node-server preset)
315
+ if (event.node && event.node.req && event.node.res) {
316
+ await serverRenderer.renderPage(event.node.req as any, event.node.res as any);
317
+ return undefined; // Response already sent
318
+ }
319
+
320
+ if (farmRegistry.deploymentId) {
321
+ setHeader(event, 'x-farm-deployment-id', farmRegistry.deploymentId);
322
+ setCookie(event, '__farm_deployment', farmRegistry.deploymentId, {
323
+ httpOnly: true,
324
+ sameSite: 'lax',
325
+ secure: url.protocol === 'https:',
326
+ path: farmRegistry.basePath || '/',
327
+ });
328
+ }
329
+
330
+ // For serverless (Vercel), render to string and send HTML
331
+ try {
332
+ // Match route
333
+ const { route, params, layouts } = routeManager.matchRoute(pathname);
334
+
335
+ if (!route) {
336
+ setResponseStatus(event, 404);
337
+ setHeader(event, 'Content-Type', 'text/html; charset=utf-8');
338
+ return '<!DOCTYPE html><html><head><title>404 Not Found</title></head><body><h1>404 Not Found</h1></body></html>';
339
+ }
340
+
341
+ // Get search params
342
+ const searchParamsObject: Record<string, string | string[] | undefined> = {};
343
+ url.searchParams.forEach((value, key) => {
344
+ const existing = searchParamsObject[key];
345
+ if (existing) {
346
+ if (Array.isArray(existing)) {
347
+ existing.push(value);
348
+ } else {
349
+ searchParamsObject[key] = [existing, value];
350
+ }
351
+ } else {
352
+ searchParamsObject[key] = value;
353
+ }
354
+ });
355
+
356
+ // Load route module - in production, use bundled SSR output
357
+ // Get bundled path from registry or construct it
358
+ let routeModule;
359
+ const routePaths = farmRegistry.routePaths || {};
360
+ const bundledPath = routePaths[pathname] || route.modulePath
361
+ .replace(/.*\\/src\\/app\\//, '')
362
+ .replace(/\\.(tsx?|jsx?)$/, '.js');
363
+
364
+ try {
365
+ // Try to load from bundled SSR output (copied to Nitro's server/farm directory)
366
+ // Nitro bundles everything, so we need to use the correct import path
367
+ routeModule = await import('./farm/' + bundledPath);
368
+ } catch (importError) {
369
+ // Fallback: try route manager's load method (for node-server preset)
370
+ try {
371
+ routeModule = await routeManager.loadRouteModule(route.modulePath);
372
+ } catch (loadError) {
373
+ // Last resort: try just the filename
374
+ const bundledName = bundledPath.split('/').pop() || 'page.js';
375
+ try {
376
+ routeModule = await import('./farm/' + bundledName);
377
+ } catch {
378
+ throw new Error(\`Failed to load route module: \${route.modulePath}. Tried: ./farm/\${bundledPath}, ./farm/\${bundledName}\`);
379
+ }
380
+ }
381
+ }
382
+
383
+ if (!routeModule.default) {
384
+ throw new Error(\`Route module \${route.modulePath} does not export a default component\`);
385
+ }
386
+
387
+ // Load layout modules
388
+ const layoutModules = await Promise.all(
389
+ layouts.map(async (layout) => {
390
+ const bundledPath = layout.modulePath
391
+ .replace(/.*\\/src\\/app\\//, '')
392
+ .replace(/\\.(tsx?|jsx?)$/, '.js');
393
+
394
+ try {
395
+ // Try to load from bundled SSR output
396
+ return await import('./farm/' + bundledPath);
397
+ } catch {
398
+ // Fallback to route manager's load method
399
+ try {
400
+ return await routeManager.loadLayoutModule(layout.modulePath);
401
+ } catch {
402
+ // Last resort: try just the filename
403
+ const bundledName = bundledPath.split('/').pop() || 'layout.js';
404
+ try {
405
+ return await import('./farm/' + bundledName);
406
+ } catch {
407
+ // Return a dummy layout if all fails
408
+ return { default: ({ children }: any) => children };
409
+ }
410
+ }
411
+ }
412
+ })
413
+ );
414
+
415
+ // Create page props
416
+ const rawPageProps = {
417
+ params,
418
+ searchParams: Promise.resolve(searchParamsObject),
419
+ path: pathname,
420
+ };
421
+ const pageProps = routeModule.__farmResolveRouteProps
422
+ ? await routeModule.__farmResolveRouteProps(rawPageProps)
423
+ : (() => {
424
+ const routeSchemas = routeModule.__farmRouteParsesProps
425
+ ? {}
426
+ : routeModule.__farmRouteSchemas || {};
427
+ const parsedParams = routeSchemas.params?.parse
428
+ ? routeSchemas.params.parse(params)
429
+ : params;
430
+ const parsedSearch = routeSchemas.search?.parse
431
+ ? routeSchemas.search.parse(searchParamsObject)
432
+ : searchParamsObject;
433
+ return {
434
+ ...rawPageProps,
435
+ params: parsedParams,
436
+ search: parsedSearch,
437
+ searchParams: Promise.resolve(parsedSearch),
438
+ };
439
+ })();
440
+
441
+ // Create page element
442
+ const PageComponent = routeModule.default;
443
+ let pageElement;
444
+ if (PageComponent.constructor.name === "AsyncFunction" || PageComponent.toString().includes("async")) {
445
+ pageElement = await PageComponent(pageProps);
446
+ } else {
447
+ pageElement = React.createElement(PageComponent, pageProps);
448
+ }
449
+
450
+ // Wrap with layouts
451
+ for (let i = layoutModules.length - 1; i >= 0; i--) {
452
+ const layoutModule = layoutModules[i];
453
+ const LayoutComponent = layoutModule.default;
454
+ pageElement = React.createElement(LayoutComponent, {
455
+ children: pageElement,
456
+ params,
457
+ } as any);
458
+ }
459
+
460
+ // Render to string
461
+ const html = renderToString(pageElement);
462
+
463
+ // Get client script path from manifest
464
+ const clientManifest = farmRegistry.clientManifest || {};
465
+ // Find the client script for this route - check manifest structure
466
+ let clientScript = '/assets/page-wbYjx1yQ.js'; // Default fallback
467
+ if (clientManifest && typeof clientManifest === 'object') {
468
+ // Manifest structure: { "assets/page-xxx.js": { ... } }
469
+ const manifestEntry = Object.values(clientManifest).find((entry: any) =>
470
+ entry && entry.name === 'page'
471
+ ) as any;
472
+ if (manifestEntry && manifestEntry.chunks && manifestEntry.chunks[0]) {
473
+ clientScript = '/' + manifestEntry.chunks[0];
474
+ } else if (Object.keys(clientManifest).length > 0) {
475
+ // Fallback to first asset in manifest
476
+ clientScript = '/' + Object.keys(clientManifest)[0];
477
+ }
478
+ }
479
+
480
+ // Build full HTML
481
+ const serializedDeploymentId = JSON.stringify(farmRegistry.deploymentId || '').replace(/</g, '\\u003c');
482
+ const fullHtml = \`<!DOCTYPE html>
483
+ <html lang="en">
484
+ <head>
485
+ <meta charset="utf-8">
486
+ <meta name="viewport" content="width=device-width, initial-scale=1">
487
+ <link rel="icon" href="data:,">
488
+ <title>Farm.js App</title>
489
+ <script>
490
+ window.__FARM_DEPLOYMENT_ID__ = \${serializedDeploymentId};
491
+ window.__FARM_PROPS__ = \${JSON.stringify(pageProps)};
492
+ window.__FARM_PATH__ = \${JSON.stringify(pathname)};
493
+ </script>
494
+ </head>
495
+ <body>
496
+ <div id="root">\${html}</div>
497
+ <script type="module" src="\${clientScript}"></script>
498
+ </body>
499
+ </html>\`;
500
+
501
+ setHeader(event, 'Content-Type', 'text/html; charset=utf-8');
502
+ return fullHtml;
503
+
504
+ } catch (renderError: any) {
505
+ setResponseStatus(event, 500);
506
+ setHeader(event, 'Content-Type', 'text/html; charset=utf-8');
507
+ return \`<!DOCTYPE html><html><head><title>Error</title></head><body><h1>Error</h1><p>\${renderError.message || 'Internal Server Error'}</p></body></html>\`;
508
+ }
509
+ } catch (error: any) {
510
+ setResponseStatus(event, 500);
511
+ setHeader(event, 'Content-Type', 'text/html; charset=utf-8');
512
+ return \`<!DOCTYPE html><html><head><title>Error</title></head><body><h1>Error</h1><p>\${error.message || 'Internal Server Error'}</p></body></html>\`;
513
+ }
514
+ });
515
+ `,
516
+ "utf-8"
517
+ );
518
+ const nitroConfig = {
519
+ preset,
520
+ // rootDir must be the project root for Nitro to correctly resolve paths
521
+ rootDir: root,
522
+ // srcDir should point to where source files are (for scanning)
523
+ // But we're using scanDirs to point to our server directory
524
+ srcDir: root,
525
+ // buildDir is where Nitro builds (temporary working directory)
526
+ buildDir: nitroBuildDir,
527
+ // output.dir is where the final deployable output goes
528
+ // This ensures everything ends up in .farm/.output
529
+ compatibilityDate: "2024-12-01",
530
+ // Vercel-specific configuration
531
+ ...preset === "vercel" ? {
532
+ vercel: {
533
+ // Ensure proper function configuration
534
+ config: {}
535
+ }
536
+ } : {},
537
+ // Tell Nitro to scan the server directory we created
538
+ // This ensures our handlers are discovered by Nitro
539
+ scanDirs: [serverDir],
540
+ tasks: {
541
+ ...farmWorkflows.tasks,
542
+ ...farmCron.tasks
543
+ },
544
+ scheduledTasks,
545
+ ...preset === "cloudflare-module" && cloudflareCronConfig ? {
546
+ cloudflare: cloudflareCronConfig
547
+ } : {},
548
+ handlers: farmWorkflows.handlerPath ? [
549
+ {
550
+ route: `${config.workflows.route}/**`,
551
+ handler: farmWorkflows.handlerPath
552
+ }
553
+ ] : [],
554
+ // Route rules for Vercel
555
+ routeRules: {
556
+ "/api/**": {
557
+ cors: true,
558
+ headers: {
559
+ "Access-Control-Allow-Origin": "*",
560
+ "Access-Control-Allow-Methods": "*",
561
+ "Access-Control-Allow-Headers": "*"
562
+ }
563
+ },
564
+ "/**": {
565
+ prerender: false
566
+ },
567
+ ...routeRulesToNitroRouteRules(config.routeRules)
568
+ },
569
+ // // Exclude certain directories from scanning
570
+ // scanDirsExclude: [
571
+ // '**/node_modules/**',
572
+ // '**/.git/**',
573
+ // '**/.output/**',
574
+ // '**/.nitro/**',
575
+ // ],
576
+ output: {
577
+ // CRITICAL: All output MUST go to .farm/.output (NOT .nitro/.output)
578
+ // This ensures consistency and that deployment always uses .farm/.output
579
+ // By explicitly setting dir, serverDir, and publicDir, we prevent Nitro
580
+ // from creating its own .output directory inside .nitro
581
+ dir: outputDir,
582
+ // .farm/.output
583
+ serverDir: path.join(outputDir, "server"),
584
+ // .farm/.output/server
585
+ publicDir: path.join(outputDir, "public")
586
+ // .farm/.output/public
587
+ },
588
+ // Use Nitro hooks to populate the runtime registry
589
+ // This allows us to pass complex objects (route managers, renderers) at runtime
590
+ hooks: {
591
+ "build:before": /* @__PURE__ */ __name(async (nitro) => {
592
+ const registryPath = path.join(serverDir, "farm-registry.ts");
593
+ const { farmRegistry } = await import(
594
+ /* @vite-ignore */
595
+ registryPath
596
+ );
597
+ const routePaths2 = {};
598
+ for (const [pattern, entry] of routeManager.getRoutes()) {
599
+ const bundledPath = entry.modulePath.replace(/.*\/src\/app\//, "").replace(/\.(tsx?|jsx?)$/, ".js");
600
+ routePaths2[pattern] = bundledPath;
601
+ }
602
+ farmRegistry.routePaths = routePaths2;
603
+ try {
604
+ const clientManifestPath2 = path.join(
605
+ root,
606
+ distDir,
607
+ "client",
608
+ "farm-client-manifest.json"
609
+ );
610
+ const { readFile } = await import("fs/promises");
611
+ const manifestContent = await readFile(clientManifestPath2, "utf-8");
612
+ farmRegistry.clientManifest = JSON.parse(manifestContent);
613
+ } catch (error) {
614
+ farmRegistry.clientManifest = {};
615
+ }
616
+ farmRegistry.__INIT__ = () => {
617
+ farmRegistry.apiRouteManager = apiRouteManager;
618
+ farmRegistry.routeManager = routeManager;
619
+ farmRegistry.serverRenderer = serverRenderer;
620
+ farmRegistry.env = config.env || { server: {}, public: {} };
621
+ farmRegistry.deploymentId = config.deploymentId;
622
+ farmRegistry.basePath = config.basePath;
623
+ };
624
+ if (typeof globalThis !== "undefined") {
625
+ globalThis.__FARM_REGISTRY__ = {
626
+ apiRouteManager,
627
+ routeManager,
628
+ serverRenderer,
629
+ env: farmRegistry.env,
630
+ deploymentId: farmRegistry.deploymentId,
631
+ basePath: farmRegistry.basePath,
632
+ clientManifest: farmRegistry.clientManifest,
633
+ routePaths: farmRegistry.routePaths
634
+ };
635
+ }
636
+ }, "build:before")
637
+ },
638
+ // API base URL (default is /api)
639
+ apiBaseURL: "/api",
640
+ // Include public directory and client build
641
+ publicAssets: [
642
+ {
643
+ baseURL: "/",
644
+ dir: path.join(root, "public")
645
+ },
646
+ // Include client build assets
647
+ {
648
+ baseURL: "/",
649
+ dir: path.join(root, distDir, "client")
650
+ }
651
+ ],
652
+ // Build configuration
653
+ minify: process.env.NODE_ENV === "production",
654
+ sourceMap: true,
655
+ // Bundle all dependencies to avoid workspace issues on Vercel
656
+ // This ensures all farm package code is bundled into the serverless function
657
+ // so it doesn't need to resolve workspace dependencies at runtime
658
+ // This is similar to how Next.js and Nuxt bundle their core packages
659
+ // bundle: true,
660
+ // External dependencies that should NOT be bundled (provided by runtime)
661
+ // We exclude React/ReactDOM to reduce bundle size (they're in node_modules)
662
+ externals: {
663
+ external: ["react", "react-dom"]
664
+ // Keep React external - it's in the serverless function's node_modules
665
+ // This reduces bundle size significantly
666
+ },
667
+ // Runtime config
668
+ runtimeConfig: {
669
+ public: {}
670
+ },
671
+ // Experimental features
672
+ experimental: {
673
+ tasks: farmWorkflows.workflows.length > 0 || farmCron.jobs.length > 0,
674
+ wasm: false
675
+ // Disable for now to avoid issues
676
+ }
677
+ };
678
+ return nitroConfig;
679
+ }
680
+ __name(createNitroConfig, "createNitroConfig");
681
+ function getNitroPreset(preset) {
682
+ return preset || "node-server";
683
+ }
684
+ __name(getNitroPreset, "getNitroPreset");
685
+ export {
686
+ createNitroConfig,
687
+ getNitroPreset
688
+ };
689
+ //# sourceMappingURL=nitro-QO5LV6QK.mjs.map