@farm.js/core 0.1.0-beta.0

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 (549) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +11 -0
  3. package/dist/after.cjs +227 -0
  4. package/dist/after.cjs.map +1 -0
  5. package/dist/after.d.mts +25 -0
  6. package/dist/after.d.ts +25 -0
  7. package/dist/after.mjs +14 -0
  8. package/dist/after.mjs.map +1 -0
  9. package/dist/agent-runtime.cjs +2379 -0
  10. package/dist/agent-runtime.cjs.map +1 -0
  11. package/dist/agent-runtime.d.mts +93 -0
  12. package/dist/agent-runtime.d.ts +93 -0
  13. package/dist/agent-runtime.mjs +479 -0
  14. package/dist/agent-runtime.mjs.map +1 -0
  15. package/dist/api/route-manager.cjs +1196 -0
  16. package/dist/api/route-manager.cjs.map +1 -0
  17. package/dist/api/route-manager.d.mts +64 -0
  18. package/dist/api/route-manager.d.ts +64 -0
  19. package/dist/api/route-manager.mjs +34 -0
  20. package/dist/api/route-manager.mjs.map +1 -0
  21. package/dist/api/runtime.cjs +272 -0
  22. package/dist/api/runtime.cjs.map +1 -0
  23. package/dist/api/runtime.d.mts +16 -0
  24. package/dist/api/runtime.d.ts +16 -0
  25. package/dist/api/runtime.mjs +16 -0
  26. package/dist/api/runtime.mjs.map +1 -0
  27. package/dist/api.cjs +3199 -0
  28. package/dist/api.cjs.map +1 -0
  29. package/dist/api.d.mts +190 -0
  30. package/dist/api.d.ts +190 -0
  31. package/dist/api.mjs +63 -0
  32. package/dist/api.mjs.map +1 -0
  33. package/dist/app-BiX4qb-d.d.mts +265 -0
  34. package/dist/app-CFRNJXP1.d.ts +265 -0
  35. package/dist/app-markdown.cjs +220 -0
  36. package/dist/app-markdown.cjs.map +1 -0
  37. package/dist/app-markdown.d.mts +21 -0
  38. package/dist/app-markdown.d.ts +21 -0
  39. package/dist/app-markdown.mjs +26 -0
  40. package/dist/app-markdown.mjs.map +1 -0
  41. package/dist/cache.cjs +543 -0
  42. package/dist/cache.cjs.map +1 -0
  43. package/dist/cache.d.mts +78 -0
  44. package/dist/cache.d.ts +78 -0
  45. package/dist/cache.mjs +38 -0
  46. package/dist/cache.mjs.map +1 -0
  47. package/dist/chunk-25D7G34K.mjs +142 -0
  48. package/dist/chunk-25D7G34K.mjs.map +1 -0
  49. package/dist/chunk-3QJO55ZF.mjs +3548 -0
  50. package/dist/chunk-3QJO55ZF.mjs.map +1 -0
  51. package/dist/chunk-3XNTL3FQ.mjs +452 -0
  52. package/dist/chunk-3XNTL3FQ.mjs.map +1 -0
  53. package/dist/chunk-44ZCFSKE.mjs +84 -0
  54. package/dist/chunk-44ZCFSKE.mjs.map +1 -0
  55. package/dist/chunk-4PTK6KT4.mjs +364 -0
  56. package/dist/chunk-4PTK6KT4.mjs.map +1 -0
  57. package/dist/chunk-4S3ORGFA.mjs +44 -0
  58. package/dist/chunk-4S3ORGFA.mjs.map +1 -0
  59. package/dist/chunk-5BY76U2M.mjs +1 -0
  60. package/dist/chunk-5BY76U2M.mjs.map +1 -0
  61. package/dist/chunk-5ZGPRGWV.mjs +136 -0
  62. package/dist/chunk-5ZGPRGWV.mjs.map +1 -0
  63. package/dist/chunk-6XDUHOEM.mjs +157 -0
  64. package/dist/chunk-6XDUHOEM.mjs.map +1 -0
  65. package/dist/chunk-74YTBPTY.mjs +450 -0
  66. package/dist/chunk-74YTBPTY.mjs.map +1 -0
  67. package/dist/chunk-7HO6AEOP.mjs +74 -0
  68. package/dist/chunk-7HO6AEOP.mjs.map +1 -0
  69. package/dist/chunk-7MABZJIM.mjs +29 -0
  70. package/dist/chunk-7MABZJIM.mjs.map +1 -0
  71. package/dist/chunk-7ZY5AIJO.mjs +161 -0
  72. package/dist/chunk-7ZY5AIJO.mjs.map +1 -0
  73. package/dist/chunk-AGS7UJ52.mjs +446 -0
  74. package/dist/chunk-AGS7UJ52.mjs.map +1 -0
  75. package/dist/chunk-AZ7YUVNR.mjs +65 -0
  76. package/dist/chunk-AZ7YUVNR.mjs.map +1 -0
  77. package/dist/chunk-B232I2GP.mjs +163 -0
  78. package/dist/chunk-B232I2GP.mjs.map +1 -0
  79. package/dist/chunk-B6N4ZB2H.mjs +718 -0
  80. package/dist/chunk-B6N4ZB2H.mjs.map +1 -0
  81. package/dist/chunk-BHG3LVHH.mjs +176 -0
  82. package/dist/chunk-BHG3LVHH.mjs.map +1 -0
  83. package/dist/chunk-C3DLZMBU.mjs +597 -0
  84. package/dist/chunk-C3DLZMBU.mjs.map +1 -0
  85. package/dist/chunk-CGILA3WO.mjs +14 -0
  86. package/dist/chunk-CGILA3WO.mjs.map +1 -0
  87. package/dist/chunk-CHFHNEMO.mjs +7088 -0
  88. package/dist/chunk-CHFHNEMO.mjs.map +1 -0
  89. package/dist/chunk-E2MPIBRE.mjs +149 -0
  90. package/dist/chunk-E2MPIBRE.mjs.map +1 -0
  91. package/dist/chunk-E6EPN5BT.mjs +203 -0
  92. package/dist/chunk-E6EPN5BT.mjs.map +1 -0
  93. package/dist/chunk-EVGBEZDF.mjs +215 -0
  94. package/dist/chunk-EVGBEZDF.mjs.map +1 -0
  95. package/dist/chunk-FQYDHKKU.mjs +128 -0
  96. package/dist/chunk-FQYDHKKU.mjs.map +1 -0
  97. package/dist/chunk-G3B5BRDY.mjs +5763 -0
  98. package/dist/chunk-G3B5BRDY.mjs.map +1 -0
  99. package/dist/chunk-GN72QAIH.mjs +146 -0
  100. package/dist/chunk-GN72QAIH.mjs.map +1 -0
  101. package/dist/chunk-GS6K5OCM.mjs +407 -0
  102. package/dist/chunk-GS6K5OCM.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-GZP5W4K3.mjs +158 -0
  106. package/dist/chunk-GZP5W4K3.mjs.map +1 -0
  107. package/dist/chunk-H2FA2SBS.mjs +51 -0
  108. package/dist/chunk-H2FA2SBS.mjs.map +1 -0
  109. package/dist/chunk-HXP3ZSPC.mjs +211 -0
  110. package/dist/chunk-HXP3ZSPC.mjs.map +1 -0
  111. package/dist/chunk-ITN462YM.mjs +98 -0
  112. package/dist/chunk-ITN462YM.mjs.map +1 -0
  113. package/dist/chunk-J23HNLFY.mjs +72 -0
  114. package/dist/chunk-J23HNLFY.mjs.map +1 -0
  115. package/dist/chunk-J4FNJ5IU.mjs +179 -0
  116. package/dist/chunk-J4FNJ5IU.mjs.map +1 -0
  117. package/dist/chunk-JK25YEN6.mjs +219 -0
  118. package/dist/chunk-JK25YEN6.mjs.map +1 -0
  119. package/dist/chunk-JLWMCADZ.mjs +204 -0
  120. package/dist/chunk-JLWMCADZ.mjs.map +1 -0
  121. package/dist/chunk-JN3UU635.mjs +622 -0
  122. package/dist/chunk-JN3UU635.mjs.map +1 -0
  123. package/dist/chunk-K4667E2Q.mjs +1916 -0
  124. package/dist/chunk-K4667E2Q.mjs.map +1 -0
  125. package/dist/chunk-LGHEOHBU.mjs +218 -0
  126. package/dist/chunk-LGHEOHBU.mjs.map +1 -0
  127. package/dist/chunk-LLC7BNXW.mjs +275 -0
  128. package/dist/chunk-LLC7BNXW.mjs.map +1 -0
  129. package/dist/chunk-LM2YNO4U.mjs +24 -0
  130. package/dist/chunk-LM2YNO4U.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-O3HADRW6.mjs +639 -0
  134. package/dist/chunk-O3HADRW6.mjs.map +1 -0
  135. package/dist/chunk-OYXO65LI.mjs +119 -0
  136. package/dist/chunk-OYXO65LI.mjs.map +1 -0
  137. package/dist/chunk-P7QDS5AT.mjs +191 -0
  138. package/dist/chunk-P7QDS5AT.mjs.map +1 -0
  139. package/dist/chunk-PRNYWD7K.mjs +599 -0
  140. package/dist/chunk-PRNYWD7K.mjs.map +1 -0
  141. package/dist/chunk-QF4PHCMA.mjs +422 -0
  142. package/dist/chunk-QF4PHCMA.mjs.map +1 -0
  143. package/dist/chunk-QFQRHRZS.mjs +1224 -0
  144. package/dist/chunk-QFQRHRZS.mjs.map +1 -0
  145. package/dist/chunk-QGOHVJ6J.mjs +63 -0
  146. package/dist/chunk-QGOHVJ6J.mjs.map +1 -0
  147. package/dist/chunk-QKVUNGAH.mjs +39 -0
  148. package/dist/chunk-QKVUNGAH.mjs.map +1 -0
  149. package/dist/chunk-QM6VV26B.mjs +149 -0
  150. package/dist/chunk-QM6VV26B.mjs.map +1 -0
  151. package/dist/chunk-RHIFZZUI.mjs +69 -0
  152. package/dist/chunk-RHIFZZUI.mjs.map +1 -0
  153. package/dist/chunk-RKI6TN3A.mjs +49 -0
  154. package/dist/chunk-RKI6TN3A.mjs.map +1 -0
  155. package/dist/chunk-RSKVYESE.mjs +187 -0
  156. package/dist/chunk-RSKVYESE.mjs.map +1 -0
  157. package/dist/chunk-S2XHZS7W.mjs +180 -0
  158. package/dist/chunk-S2XHZS7W.mjs.map +1 -0
  159. package/dist/chunk-SCFX4UTD.mjs +28 -0
  160. package/dist/chunk-SCFX4UTD.mjs.map +1 -0
  161. package/dist/chunk-SL6HTIOK.mjs +66 -0
  162. package/dist/chunk-SL6HTIOK.mjs.map +1 -0
  163. package/dist/chunk-SOU3Q3ZA.mjs +173 -0
  164. package/dist/chunk-SOU3Q3ZA.mjs.map +1 -0
  165. package/dist/chunk-SPBBQLXI.mjs +207 -0
  166. package/dist/chunk-SPBBQLXI.mjs.map +1 -0
  167. package/dist/chunk-SXZTEK3V.mjs +396 -0
  168. package/dist/chunk-SXZTEK3V.mjs.map +1 -0
  169. package/dist/chunk-T4QJQK76.mjs +459 -0
  170. package/dist/chunk-T4QJQK76.mjs.map +1 -0
  171. package/dist/chunk-TRORP7E4.mjs +41 -0
  172. package/dist/chunk-TRORP7E4.mjs.map +1 -0
  173. package/dist/chunk-TU4YJICB.mjs +728 -0
  174. package/dist/chunk-TU4YJICB.mjs.map +1 -0
  175. package/dist/chunk-TXCFGOHW.mjs +42 -0
  176. package/dist/chunk-TXCFGOHW.mjs.map +1 -0
  177. package/dist/chunk-UHE2TTLK.mjs +466 -0
  178. package/dist/chunk-UHE2TTLK.mjs.map +1 -0
  179. package/dist/chunk-UREJA4GZ.mjs +364 -0
  180. package/dist/chunk-UREJA4GZ.mjs.map +1 -0
  181. package/dist/chunk-USWZZUEH.mjs +25 -0
  182. package/dist/chunk-USWZZUEH.mjs.map +1 -0
  183. package/dist/chunk-UVCIEUJC.mjs +16 -0
  184. package/dist/chunk-UVCIEUJC.mjs.map +1 -0
  185. package/dist/chunk-V6WE6JSZ.mjs +352 -0
  186. package/dist/chunk-V6WE6JSZ.mjs.map +1 -0
  187. package/dist/chunk-V7RBCSDJ.mjs +170 -0
  188. package/dist/chunk-V7RBCSDJ.mjs.map +1 -0
  189. package/dist/chunk-VCANOYFI.mjs +588 -0
  190. package/dist/chunk-VCANOYFI.mjs.map +1 -0
  191. package/dist/chunk-WZ5QFROO.mjs +23 -0
  192. package/dist/chunk-WZ5QFROO.mjs.map +1 -0
  193. package/dist/chunk-Y2OJJD7R.mjs +543 -0
  194. package/dist/chunk-Y2OJJD7R.mjs.map +1 -0
  195. package/dist/chunk-Y7A27276.mjs +538 -0
  196. package/dist/chunk-Y7A27276.mjs.map +1 -0
  197. package/dist/chunk-YHU7SS6L.mjs +365 -0
  198. package/dist/chunk-YHU7SS6L.mjs.map +1 -0
  199. package/dist/chunk-ZBE6MLHL.mjs +230 -0
  200. package/dist/chunk-ZBE6MLHL.mjs.map +1 -0
  201. package/dist/chunk-ZJQNATYV.mjs +299 -0
  202. package/dist/chunk-ZJQNATYV.mjs.map +1 -0
  203. package/dist/client-D_yUjVhe.d.mts +402 -0
  204. package/dist/client-Dkc03WP8.d.ts +402 -0
  205. package/dist/client-cache-CIlyBlmx.d.ts +6 -0
  206. package/dist/client-cache-D-EZ7XVW.d.mts +6 -0
  207. package/dist/client-plugins-BZnpeTGA.d.ts +1848 -0
  208. package/dist/client-plugins-g4bzuCmo.d.mts +1848 -0
  209. package/dist/client-plugins.cjs +415 -0
  210. package/dist/client-plugins.cjs.map +1 -0
  211. package/dist/client-plugins.d.mts +21 -0
  212. package/dist/client-plugins.d.ts +21 -0
  213. package/dist/client-plugins.mjs +10 -0
  214. package/dist/client-plugins.mjs.map +1 -0
  215. package/dist/client.cjs +4571 -0
  216. package/dist/client.cjs.map +1 -0
  217. package/dist/client.d.mts +329 -0
  218. package/dist/client.d.ts +329 -0
  219. package/dist/client.mjs +103 -0
  220. package/dist/client.mjs.map +1 -0
  221. package/dist/config.cjs +38 -0
  222. package/dist/config.cjs.map +1 -0
  223. package/dist/config.d.mts +28 -0
  224. package/dist/config.d.ts +28 -0
  225. package/dist/config.mjs +10 -0
  226. package/dist/config.mjs.map +1 -0
  227. package/dist/cron.cjs +406 -0
  228. package/dist/cron.cjs.map +1 -0
  229. package/dist/cron.d.mts +78 -0
  230. package/dist/cron.d.ts +78 -0
  231. package/dist/cron.mjs +30 -0
  232. package/dist/cron.mjs.map +1 -0
  233. package/dist/deferred.cjs +438 -0
  234. package/dist/deferred.cjs.map +1 -0
  235. package/dist/deferred.d.mts +42 -0
  236. package/dist/deferred.d.ts +42 -0
  237. package/dist/deferred.mjs +28 -0
  238. package/dist/deferred.mjs.map +1 -0
  239. package/dist/deployment.cjs +199 -0
  240. package/dist/deployment.cjs.map +1 -0
  241. package/dist/deployment.d.mts +34 -0
  242. package/dist/deployment.d.ts +34 -0
  243. package/dist/deployment.mjs +38 -0
  244. package/dist/deployment.mjs.map +1 -0
  245. package/dist/devtools-AE4RVXCM.mjs +370 -0
  246. package/dist/devtools-AE4RVXCM.mjs.map +1 -0
  247. package/dist/devtools-client-6WPY2AQU.mjs +225 -0
  248. package/dist/devtools-client-6WPY2AQU.mjs.map +1 -0
  249. package/dist/devtools-ui-NJKFORTG.mjs +1349 -0
  250. package/dist/devtools-ui-NJKFORTG.mjs.map +1 -0
  251. package/dist/docs.cjs +5541 -0
  252. package/dist/docs.cjs.map +1 -0
  253. package/dist/docs.d.mts +69 -0
  254. package/dist/docs.d.ts +69 -0
  255. package/dist/docs.mjs +46 -0
  256. package/dist/docs.mjs.map +1 -0
  257. package/dist/env-types.cjs +223 -0
  258. package/dist/env-types.cjs.map +1 -0
  259. package/dist/env-types.d.mts +11 -0
  260. package/dist/env-types.d.ts +11 -0
  261. package/dist/env-types.mjs +9 -0
  262. package/dist/env-types.mjs.map +1 -0
  263. package/dist/env.cjs +215 -0
  264. package/dist/env.cjs.map +1 -0
  265. package/dist/env.d.mts +45 -0
  266. package/dist/env.d.ts +45 -0
  267. package/dist/env.mjs +22 -0
  268. package/dist/env.mjs.map +1 -0
  269. package/dist/environment/vite.cjs +374 -0
  270. package/dist/environment/vite.cjs.map +1 -0
  271. package/dist/environment/vite.d.mts +22 -0
  272. package/dist/environment/vite.d.ts +22 -0
  273. package/dist/environment/vite.mjs +10 -0
  274. package/dist/environment/vite.mjs.map +1 -0
  275. package/dist/environment.cjs +96 -0
  276. package/dist/environment.cjs.map +1 -0
  277. package/dist/environment.d.mts +18 -0
  278. package/dist/environment.d.ts +18 -0
  279. package/dist/environment.mjs +14 -0
  280. package/dist/environment.mjs.map +1 -0
  281. package/dist/headers.cjs +126 -0
  282. package/dist/headers.cjs.map +1 -0
  283. package/dist/headers.d.mts +22 -0
  284. package/dist/headers.d.ts +22 -0
  285. package/dist/headers.mjs +12 -0
  286. package/dist/headers.mjs.map +1 -0
  287. package/dist/i18n/client.cjs +283 -0
  288. package/dist/i18n/client.cjs.map +1 -0
  289. package/dist/i18n/client.d.mts +32 -0
  290. package/dist/i18n/client.d.ts +32 -0
  291. package/dist/i18n/client.mjs +121 -0
  292. package/dist/i18n/client.mjs.map +1 -0
  293. package/dist/i18n/index.cjs +130 -0
  294. package/dist/i18n/index.cjs.map +1 -0
  295. package/dist/i18n/index.d.mts +20 -0
  296. package/dist/i18n/index.d.ts +20 -0
  297. package/dist/i18n/index.mjs +22 -0
  298. package/dist/i18n/index.mjs.map +1 -0
  299. package/dist/i18n/server.cjs +637 -0
  300. package/dist/i18n/server.cjs.map +1 -0
  301. package/dist/i18n/server.d.mts +30 -0
  302. package/dist/i18n/server.d.ts +30 -0
  303. package/dist/i18n/server.mjs +32 -0
  304. package/dist/i18n/server.mjs.map +1 -0
  305. package/dist/image/server.cjs +477 -0
  306. package/dist/image/server.cjs.map +1 -0
  307. package/dist/image/server.d.mts +37 -0
  308. package/dist/image/server.d.ts +37 -0
  309. package/dist/image/server.mjs +16 -0
  310. package/dist/image/server.mjs.map +1 -0
  311. package/dist/image/sharp.cjs +135 -0
  312. package/dist/image/sharp.cjs.map +1 -0
  313. package/dist/image/sharp.d.mts +7 -0
  314. package/dist/image/sharp.d.ts +7 -0
  315. package/dist/image/sharp.mjs +75 -0
  316. package/dist/image/sharp.mjs.map +1 -0
  317. package/dist/image-config-Duob7wER.d.mts +50 -0
  318. package/dist/image-config-Duob7wER.d.ts +50 -0
  319. package/dist/image.cjs +209 -0
  320. package/dist/image.cjs.map +1 -0
  321. package/dist/image.d.mts +39 -0
  322. package/dist/image.d.ts +39 -0
  323. package/dist/image.mjs +165 -0
  324. package/dist/image.mjs.map +1 -0
  325. package/dist/index.cjs +39433 -0
  326. package/dist/index.cjs.map +1 -0
  327. package/dist/index.d.mts +451 -0
  328. package/dist/index.d.ts +451 -0
  329. package/dist/index.mjs +930 -0
  330. package/dist/index.mjs.map +1 -0
  331. package/dist/integration-api-CHT2OKAf.d.mts +93 -0
  332. package/dist/integration-api-CHT2OKAf.d.ts +93 -0
  333. package/dist/integration-orm-GQLGU66X.mjs +13 -0
  334. package/dist/integration-orm-GQLGU66X.mjs.map +1 -0
  335. package/dist/integrations.cjs +2820 -0
  336. package/dist/integrations.cjs.map +1 -0
  337. package/dist/integrations.d.mts +21 -0
  338. package/dist/integrations.d.ts +21 -0
  339. package/dist/integrations.mjs +51 -0
  340. package/dist/integrations.mjs.map +1 -0
  341. package/dist/internal/build-runtime.cjs +31340 -0
  342. package/dist/internal/build-runtime.cjs.map +1 -0
  343. package/dist/internal/build-runtime.d.mts +38 -0
  344. package/dist/internal/build-runtime.d.ts +38 -0
  345. package/dist/internal/build-runtime.mjs +73 -0
  346. package/dist/internal/build-runtime.mjs.map +1 -0
  347. package/dist/internal/client-runtime.cjs +579 -0
  348. package/dist/internal/client-runtime.cjs.map +1 -0
  349. package/dist/internal/client-runtime.d.mts +2 -0
  350. package/dist/internal/client-runtime.d.ts +2 -0
  351. package/dist/internal/client-runtime.mjs +12 -0
  352. package/dist/internal/client-runtime.mjs.map +1 -0
  353. package/dist/internal/config-runtime.cjs +4172 -0
  354. package/dist/internal/config-runtime.cjs.map +1 -0
  355. package/dist/internal/config-runtime.d.mts +38 -0
  356. package/dist/internal/config-runtime.d.ts +38 -0
  357. package/dist/internal/config-runtime.mjs +38 -0
  358. package/dist/internal/config-runtime.mjs.map +1 -0
  359. package/dist/internal/production-node-env.cjs +65 -0
  360. package/dist/internal/production-node-env.cjs.map +1 -0
  361. package/dist/internal/production-node-env.d.mts +12 -0
  362. package/dist/internal/production-node-env.d.ts +12 -0
  363. package/dist/internal/production-node-env.mjs +8 -0
  364. package/dist/internal/production-node-env.mjs.map +1 -0
  365. package/dist/internal/production-runtime.cjs +1896 -0
  366. package/dist/internal/production-runtime.cjs.map +1 -0
  367. package/dist/internal/production-runtime.d.mts +39 -0
  368. package/dist/internal/production-runtime.d.ts +39 -0
  369. package/dist/internal/production-runtime.mjs +79 -0
  370. package/dist/internal/production-runtime.mjs.map +1 -0
  371. package/dist/layers-VWVDTPUZ.mjs +16 -0
  372. package/dist/layers-VWVDTPUZ.mjs.map +1 -0
  373. package/dist/manager-THKFTOFE.mjs +10 -0
  374. package/dist/manager-THKFTOFE.mjs.map +1 -0
  375. package/dist/markdown.cjs +299 -0
  376. package/dist/markdown.cjs.map +1 -0
  377. package/dist/markdown.d.mts +43 -0
  378. package/dist/markdown.d.ts +43 -0
  379. package/dist/markdown.mjs +14 -0
  380. package/dist/markdown.mjs.map +1 -0
  381. package/dist/metadata-C9NZxMDW.d.mts +22 -0
  382. package/dist/metadata-DAXRaOHx.d.ts +22 -0
  383. package/dist/middleware.cjs +2148 -0
  384. package/dist/middleware.cjs.map +1 -0
  385. package/dist/middleware.d.mts +163 -0
  386. package/dist/middleware.d.ts +163 -0
  387. package/dist/middleware.mjs +49 -0
  388. package/dist/middleware.mjs.map +1 -0
  389. package/dist/navigation-errors-Dvwpzaer.d.mts +13 -0
  390. package/dist/navigation-errors-Dvwpzaer.d.ts +13 -0
  391. package/dist/navigation.cjs +1304 -0
  392. package/dist/navigation.cjs.map +1 -0
  393. package/dist/navigation.d.mts +14 -0
  394. package/dist/navigation.d.ts +14 -0
  395. package/dist/navigation.mjs +33 -0
  396. package/dist/navigation.mjs.map +1 -0
  397. package/dist/nitro-KME62MWG.mjs +691 -0
  398. package/dist/nitro-KME62MWG.mjs.map +1 -0
  399. package/dist/observability.cjs +186 -0
  400. package/dist/observability.cjs.map +1 -0
  401. package/dist/observability.d.mts +335 -0
  402. package/dist/observability.d.ts +335 -0
  403. package/dist/observability.mjs +16 -0
  404. package/dist/observability.mjs.map +1 -0
  405. package/dist/params-BALtrRim.d.ts +15 -0
  406. package/dist/params-ry-lxqmy.d.mts +15 -0
  407. package/dist/plugin-BJDf43dc.d.mts +165 -0
  408. package/dist/plugin-BJDf43dc.d.ts +165 -0
  409. package/dist/plugin.cjs +22285 -0
  410. package/dist/plugin.cjs.map +1 -0
  411. package/dist/plugin.d.mts +21 -0
  412. package/dist/plugin.d.ts +21 -0
  413. package/dist/plugin.mjs +60 -0
  414. package/dist/plugin.mjs.map +1 -0
  415. package/dist/production-runtime-C_B79w2P.d.mts +28 -0
  416. package/dist/production-runtime-DDEM1D2q.d.ts +28 -0
  417. package/dist/production-runtime-DRkCHUvJ.d.ts +79 -0
  418. package/dist/production-runtime-flrjp_nC.d.mts +79 -0
  419. package/dist/query/client.cjs +560 -0
  420. package/dist/query/client.cjs.map +1 -0
  421. package/dist/query/client.d.mts +61 -0
  422. package/dist/query/client.d.ts +61 -0
  423. package/dist/query/client.mjs +364 -0
  424. package/dist/query/client.mjs.map +1 -0
  425. package/dist/query/index.cjs +226 -0
  426. package/dist/query/index.cjs.map +1 -0
  427. package/dist/query/index.d.mts +90 -0
  428. package/dist/query/index.d.ts +90 -0
  429. package/dist/query/index.mjs +31 -0
  430. package/dist/query/index.mjs.map +1 -0
  431. package/dist/query/parsers.cjs +178 -0
  432. package/dist/query/parsers.cjs.map +1 -0
  433. package/dist/query/parsers.d.mts +25 -0
  434. package/dist/query/parsers.d.ts +25 -0
  435. package/dist/query/parsers.mjs +24 -0
  436. package/dist/query/parsers.mjs.map +1 -0
  437. package/dist/query/server.cjs +301 -0
  438. package/dist/query/server.cjs.map +1 -0
  439. package/dist/query/server.d.mts +55 -0
  440. package/dist/query/server.d.ts +55 -0
  441. package/dist/query/server.mjs +105 -0
  442. package/dist/query/server.mjs.map +1 -0
  443. package/dist/request-BrFBuc8G.d.mts +6 -0
  444. package/dist/request-BslSZIRz.d.ts +6 -0
  445. package/dist/request.cjs +71 -0
  446. package/dist/request.cjs.map +1 -0
  447. package/dist/request.d.mts +2 -0
  448. package/dist/request.d.ts +2 -0
  449. package/dist/request.mjs +9 -0
  450. package/dist/request.mjs.map +1 -0
  451. package/dist/resolver-C6iecsDV.d.ts +14 -0
  452. package/dist/resolver-DlOPpjkB.d.mts +14 -0
  453. package/dist/route-runtime-DoOHzCAD.d.mts +38 -0
  454. package/dist/route-runtime-DoOHzCAD.d.ts +38 -0
  455. package/dist/router.cjs +254 -0
  456. package/dist/router.cjs.map +1 -0
  457. package/dist/router.d.mts +36 -0
  458. package/dist/router.d.ts +36 -0
  459. package/dist/router.mjs +14 -0
  460. package/dist/router.mjs.map +1 -0
  461. package/dist/routes.cjs +1213 -0
  462. package/dist/routes.cjs.map +1 -0
  463. package/dist/routes.d.mts +224 -0
  464. package/dist/routes.d.ts +224 -0
  465. package/dist/routes.mjs +52 -0
  466. package/dist/routes.mjs.map +1 -0
  467. package/dist/runtime-B6GvwDS1.d.ts +27 -0
  468. package/dist/runtime-DeAAZ6gO.d.mts +27 -0
  469. package/dist/search-client-6OXIBNYQ.mjs +14 -0
  470. package/dist/search-client-6OXIBNYQ.mjs.map +1 -0
  471. package/dist/server-action-security.cjs +492 -0
  472. package/dist/server-action-security.cjs.map +1 -0
  473. package/dist/server-action-security.d.mts +42 -0
  474. package/dist/server-action-security.d.ts +42 -0
  475. package/dist/server-action-security.mjs +29 -0
  476. package/dist/server-action-security.mjs.map +1 -0
  477. package/dist/server-fn-client.cjs +180 -0
  478. package/dist/server-fn-client.cjs.map +1 -0
  479. package/dist/server-fn-client.d.mts +31 -0
  480. package/dist/server-fn-client.d.ts +31 -0
  481. package/dist/server-fn-client.mjs +9 -0
  482. package/dist/server-fn-client.mjs.map +1 -0
  483. package/dist/server-fn.cjs +284 -0
  484. package/dist/server-fn.cjs.map +1 -0
  485. package/dist/server-fn.d.mts +84 -0
  486. package/dist/server-fn.d.ts +84 -0
  487. package/dist/server-fn.mjs +17 -0
  488. package/dist/server-fn.mjs.map +1 -0
  489. package/dist/server-plugins.cjs +235 -0
  490. package/dist/server-plugins.cjs.map +1 -0
  491. package/dist/server-plugins.d.mts +54 -0
  492. package/dist/server-plugins.d.ts +54 -0
  493. package/dist/server-plugins.mjs +18 -0
  494. package/dist/server-plugins.mjs.map +1 -0
  495. package/dist/server-query-client.cjs +792 -0
  496. package/dist/server-query-client.cjs.map +1 -0
  497. package/dist/server-query-client.d.mts +50 -0
  498. package/dist/server-query-client.d.ts +50 -0
  499. package/dist/server-query-client.mjs +23 -0
  500. package/dist/server-query-client.mjs.map +1 -0
  501. package/dist/server-query.cjs +804 -0
  502. package/dist/server-query.cjs.map +1 -0
  503. package/dist/server-query.d.mts +36 -0
  504. package/dist/server-query.d.ts +36 -0
  505. package/dist/server-query.mjs +18 -0
  506. package/dist/server-query.mjs.map +1 -0
  507. package/dist/server.cjs +25739 -0
  508. package/dist/server.cjs.map +1 -0
  509. package/dist/server.d.mts +47 -0
  510. package/dist/server.d.ts +47 -0
  511. package/dist/server.mjs +511 -0
  512. package/dist/server.mjs.map +1 -0
  513. package/dist/storage.cjs +515 -0
  514. package/dist/storage.cjs.map +1 -0
  515. package/dist/storage.d.mts +52 -0
  516. package/dist/storage.d.ts +52 -0
  517. package/dist/storage.mjs +58 -0
  518. package/dist/storage.mjs.map +1 -0
  519. package/dist/testing.cjs +1882 -0
  520. package/dist/testing.cjs.map +1 -0
  521. package/dist/testing.d.mts +100 -0
  522. package/dist/testing.d.ts +100 -0
  523. package/dist/testing.mjs +324 -0
  524. package/dist/testing.mjs.map +1 -0
  525. package/dist/types-BH1lhg5G.d.mts +81 -0
  526. package/dist/types-BH1lhg5G.d.ts +81 -0
  527. package/dist/types-C9N-nk5R.d.mts +53 -0
  528. package/dist/types-C9N-nk5R.d.ts +53 -0
  529. package/dist/types-D1A6-XvH.d.mts +73 -0
  530. package/dist/types-D1A6-XvH.d.ts +73 -0
  531. package/dist/utils-DA1yo54_.d.ts +23 -0
  532. package/dist/utils-DOXXivjL.d.mts +23 -0
  533. package/dist/vite.cjs +22684 -0
  534. package/dist/vite.cjs.map +1 -0
  535. package/dist/vite.d.mts +21 -0
  536. package/dist/vite.d.ts +21 -0
  537. package/dist/vite.mjs +59 -0
  538. package/dist/vite.mjs.map +1 -0
  539. package/dist/workflows.cjs +586 -0
  540. package/dist/workflows.cjs.map +1 -0
  541. package/dist/workflows.d.mts +110 -0
  542. package/dist/workflows.d.ts +110 -0
  543. package/dist/workflows.mjs +32 -0
  544. package/dist/workflows.mjs.map +1 -0
  545. package/package.json +523 -0
  546. package/types/api.d.ts +88 -0
  547. package/types/client.d.ts +1171 -0
  548. package/types/index.d.ts +17 -0
  549. package/types/middleware.d.ts +266 -0
@@ -0,0 +1,1213 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/routes.ts
22
+ var routes_exports = {};
23
+ __export(routes_exports, {
24
+ PROGRAMMATIC_ROUTE_FILE_NAMES: () => PROGRAMMATIC_ROUTE_FILE_NAMES,
25
+ api: () => api,
26
+ createLayoutModuleFromProgrammaticLayout: () => createLayoutModuleFromProgrammaticLayout,
27
+ createProgrammaticRouteModuleId: () => createProgrammaticRouteModuleId,
28
+ createRoute: () => createRoute,
29
+ createRouteModuleFromProgrammaticPage: () => createRouteModuleFromProgrammaticPage,
30
+ defineRoutes: () => defineRoutes,
31
+ getProgrammaticRouteManifest: () => getProgrammaticRouteManifest,
32
+ getProgrammaticRouteSearchClientOptions: () => getProgrammaticRouteSearchClientOptions,
33
+ getProgrammaticRouteSearchSchema: () => getProgrammaticRouteSearchSchema,
34
+ isProgrammaticRouteDefinition: () => isProgrammaticRouteDefinition,
35
+ isProgrammaticRouteManifest: () => isProgrammaticRouteManifest,
36
+ isProgrammaticRoutesFileName: () => isProgrammaticRoutesFileName,
37
+ layout: () => layout,
38
+ page: () => page,
39
+ parseProgrammaticRouteModuleId: () => parseProgrammaticRouteModuleId,
40
+ parseProgrammaticRoutePath: () => parseProgrammaticRoutePath,
41
+ redirect: () => redirect,
42
+ routesBuilder: () => routesBuilder,
43
+ scanProgrammaticPagePaths: () => scanProgrammaticPagePaths
44
+ });
45
+ module.exports = __toCommonJS(routes_exports);
46
+ var import_react = require("react");
47
+
48
+ // src/observability.ts
49
+ var runtimeHandlers = /* @__PURE__ */ new Set();
50
+ var observabilityState = {
51
+ logs: false,
52
+ handlers: []
53
+ };
54
+ function emitFarmEvent(input) {
55
+ const event = {
56
+ timestamp: Date.now(),
57
+ level: inferFarmEventLevel(input.type),
58
+ ...input
59
+ };
60
+ if (!shouldEmitFarmEvent(event)) {
61
+ return event;
62
+ }
63
+ if (observabilityState.logs) {
64
+ logFarmEvent(event);
65
+ }
66
+ for (const handler of [...observabilityState.handlers, ...runtimeHandlers]) {
67
+ try {
68
+ Promise.resolve(handler(event)).catch((error) => {
69
+ console.warn(`[farm:observability] event handler failed: ${formatError(error)}`);
70
+ });
71
+ } catch (error) {
72
+ console.warn(`[farm:observability] event handler failed: ${formatError(error)}`);
73
+ }
74
+ }
75
+ return event;
76
+ }
77
+ __name(emitFarmEvent, "emitFarmEvent");
78
+ function shouldEmitFarmEvent(event) {
79
+ if (!observabilityState.logs && observabilityState.handlers.length === 0 && runtimeHandlers.size === 0) {
80
+ return false;
81
+ }
82
+ if (observabilityState.events && !observabilityState.events.has(event.type)) {
83
+ return false;
84
+ }
85
+ return true;
86
+ }
87
+ __name(shouldEmitFarmEvent, "shouldEmitFarmEvent");
88
+ function inferFarmEventLevel(type) {
89
+ if (type === "error" || type.endsWith(".error") || type.endsWith(".failed")) {
90
+ return "error";
91
+ }
92
+ if (type.endsWith(".bypass") || type.endsWith(".invalidated") || type.endsWith(".stale") || type.endsWith(".notFound")) {
93
+ return "warn";
94
+ }
95
+ if (type.endsWith(".hit") || type.endsWith(".miss") || type.endsWith(".start") || type.endsWith(".shellReady")) {
96
+ return "debug";
97
+ }
98
+ return "info";
99
+ }
100
+ __name(inferFarmEventLevel, "inferFarmEventLevel");
101
+ function logFarmEvent(event) {
102
+ const message = `[farm:${event.level}] ${event.type}${formatFarmEventDetails(event)}`;
103
+ switch (event.level) {
104
+ case "error":
105
+ console.error(message);
106
+ break;
107
+ case "warn":
108
+ console.warn(message);
109
+ break;
110
+ default:
111
+ console.log(message);
112
+ break;
113
+ }
114
+ }
115
+ __name(logFarmEvent, "logFarmEvent");
116
+ function formatFarmEventDetails(event) {
117
+ const details = [];
118
+ const record = event;
119
+ for (const key of [
120
+ "route",
121
+ "pathname",
122
+ "method",
123
+ "status",
124
+ "key",
125
+ "tag",
126
+ "path",
127
+ "reason",
128
+ "durationMs",
129
+ "integration",
130
+ "operation",
131
+ "plugin",
132
+ "hook",
133
+ "target",
134
+ "count"
135
+ ]) {
136
+ const value = record[key];
137
+ if (value !== void 0) {
138
+ details.push(`${key}=${formatDetailValue(value)}`);
139
+ }
140
+ }
141
+ return details.length > 0 ? ` ${details.join(" ")}` : "";
142
+ }
143
+ __name(formatFarmEventDetails, "formatFarmEventDetails");
144
+ function formatDetailValue(value) {
145
+ if (typeof value === "string") {
146
+ return value;
147
+ }
148
+ if (typeof value === "number" || typeof value === "boolean") {
149
+ return String(value);
150
+ }
151
+ try {
152
+ return JSON.stringify(value);
153
+ } catch {
154
+ return String(value);
155
+ }
156
+ }
157
+ __name(formatDetailValue, "formatDetailValue");
158
+ function formatError(error) {
159
+ return error instanceof Error ? error.message : String(error);
160
+ }
161
+ __name(formatError, "formatError");
162
+
163
+ // src/cache.ts
164
+ var _FarmDataCache = class _FarmDataCache {
165
+ constructor() {
166
+ this.entries = /* @__PURE__ */ new Map();
167
+ this.inflight = /* @__PURE__ */ new Map();
168
+ this.invalidatedTagVersions = /* @__PURE__ */ new Map();
169
+ this.version = 0;
170
+ }
171
+ get size() {
172
+ return this.entries.size;
173
+ }
174
+ get(key, options = {}) {
175
+ return this.getEntry(key, options)?.value;
176
+ }
177
+ getEntry(key, options = {}) {
178
+ const entry = this.entries.get(key);
179
+ if (!entry) {
180
+ emitFarmEvent({ type: "cache.miss", key });
181
+ return void 0;
182
+ }
183
+ const stale = this.isStale(entry, options.now);
184
+ if (stale) {
185
+ emitFarmEvent({
186
+ type: "cache.stale",
187
+ key,
188
+ tags: Array.from(entry.tags),
189
+ revalidate: entry.revalidate
190
+ });
191
+ }
192
+ if (!options.allowStale && stale) {
193
+ emitFarmEvent({ type: "cache.miss", key, reason: "stale" });
194
+ return void 0;
195
+ }
196
+ emitFarmEvent({
197
+ type: "cache.hit",
198
+ key,
199
+ tags: Array.from(entry.tags),
200
+ revalidate: entry.revalidate,
201
+ stale
202
+ });
203
+ return this.toPublicEntry(entry);
204
+ }
205
+ set(key, value, options = {}) {
206
+ const tags = /* @__PURE__ */ new Set();
207
+ for (const tag of options.tags ?? []) {
208
+ tags.add(normalizeCacheTag(tag));
209
+ }
210
+ for (const routePath of options.paths ?? []) {
211
+ tags.add(createPathCacheTag(routePath));
212
+ }
213
+ const entry = {
214
+ key,
215
+ value,
216
+ tags,
217
+ createdAt: options.createdAt ?? Date.now(),
218
+ createdVersion: ++this.version,
219
+ revalidate: normalizeRevalidate(options.revalidate)
220
+ };
221
+ this.entries.set(key, entry);
222
+ emitFarmEvent({
223
+ type: "cache.set",
224
+ key,
225
+ tags: Array.from(tags),
226
+ revalidate: entry.revalidate
227
+ });
228
+ return this.toPublicEntry(entry);
229
+ }
230
+ delete(key) {
231
+ const deleted = this.entries.delete(key);
232
+ emitFarmEvent({ type: "cache.delete", key, deleted });
233
+ return deleted;
234
+ }
235
+ clear() {
236
+ const count = this.entries.size;
237
+ this.entries.clear();
238
+ this.inflight.clear();
239
+ this.invalidatedTagVersions.clear();
240
+ this.version = 0;
241
+ emitFarmEvent({ type: "cache.clear", count });
242
+ }
243
+ isStale(entry, now = Date.now()) {
244
+ if (typeof entry.revalidate === "number" && entry.revalidate > 0 && now - entry.createdAt >= entry.revalidate * 1e3) {
245
+ return true;
246
+ }
247
+ for (const tag of entry.tags) {
248
+ const invalidatedVersion = this.invalidatedTagVersions.get(normalizeCacheTag(tag));
249
+ if (typeof invalidatedVersion === "number" && typeof entry.createdVersion === "number" && invalidatedVersion > entry.createdVersion) {
250
+ return true;
251
+ }
252
+ }
253
+ return false;
254
+ }
255
+ revalidateTag(tag, options = {}) {
256
+ const normalized = normalizeCacheTag(tag);
257
+ const count = this.invalidateTag(normalized);
258
+ emitFarmEvent(
259
+ options.source === "updateTag" ? { type: "cache.updateTag", tag: normalized, count } : { type: "cache.revalidateTag", tag: normalized, profile: options.profile, count }
260
+ );
261
+ return count;
262
+ }
263
+ revalidatePath(routePath) {
264
+ const normalizedPath = normalizeRevalidatePath(routePath);
265
+ const pathTag = createPathCacheTag(normalizedPath);
266
+ const pprCount = this.countEntriesForTags([pathTag, "ppr"]);
267
+ const count = this.invalidateTag(pathTag);
268
+ emitFarmEvent({ type: "cache.revalidatePath", path: normalizedPath, count });
269
+ if (pprCount > 0) {
270
+ emitFarmEvent({
271
+ type: "ppr.shell.invalidated",
272
+ route: normalizedPath,
273
+ reason: "revalidatePath",
274
+ count: pprCount
275
+ });
276
+ }
277
+ return count;
278
+ }
279
+ async getOrSet(key, producer, options = {}) {
280
+ const cached = this.getEntry(key);
281
+ if (cached) {
282
+ return cached.value;
283
+ }
284
+ const inflight = this.inflight.get(key);
285
+ if (inflight) {
286
+ emitFarmEvent({ type: "cache.dedupe", key });
287
+ return inflight;
288
+ }
289
+ const promise = Promise.resolve().then(producer).then((value) => {
290
+ this.set(key, value, options);
291
+ return value;
292
+ }).catch((error) => {
293
+ emitFarmEvent({ type: "cache.error", key, operation: "set", error });
294
+ throw error;
295
+ }).finally(() => {
296
+ this.inflight.delete(key);
297
+ });
298
+ this.inflight.set(key, promise);
299
+ return promise;
300
+ }
301
+ countEntriesForTag(tag) {
302
+ let count = 0;
303
+ for (const entry of this.entries.values()) {
304
+ if (entry.tags.has(tag)) {
305
+ count++;
306
+ }
307
+ }
308
+ return count;
309
+ }
310
+ countEntriesForTags(tags) {
311
+ let count = 0;
312
+ for (const entry of this.entries.values()) {
313
+ if (tags.every((tag) => entry.tags.has(tag))) {
314
+ count++;
315
+ }
316
+ }
317
+ return count;
318
+ }
319
+ invalidateTag(normalizedTag) {
320
+ this.invalidatedTagVersions.set(normalizedTag, ++this.version);
321
+ return this.countEntriesForTag(normalizedTag);
322
+ }
323
+ toPublicEntry(entry) {
324
+ return {
325
+ key: entry.key,
326
+ value: entry.value,
327
+ tags: Array.from(entry.tags),
328
+ createdAt: entry.createdAt,
329
+ createdVersion: entry.createdVersion,
330
+ revalidate: entry.revalidate
331
+ };
332
+ }
333
+ };
334
+ __name(_FarmDataCache, "FarmDataCache");
335
+ var FarmDataCache = _FarmDataCache;
336
+ var FARM_DATA_CACHE_SYMBOL = /* @__PURE__ */ Symbol.for("farm.dataCache");
337
+ var farmDataCacheGlobal = globalThis;
338
+ var sharedFarmDataCache = farmDataCacheGlobal[FARM_DATA_CACHE_SYMBOL] ?? (farmDataCacheGlobal[FARM_DATA_CACHE_SYMBOL] = new FarmDataCache());
339
+ var functionIds = /* @__PURE__ */ new WeakMap();
340
+ var nextFunctionId = 0;
341
+ function getFarmDataCache() {
342
+ return sharedFarmDataCache;
343
+ }
344
+ __name(getFarmDataCache, "getFarmDataCache");
345
+ function createPathCacheTag(routePath) {
346
+ return `path:${normalizeRevalidatePath(routePath)}`;
347
+ }
348
+ __name(createPathCacheTag, "createPathCacheTag");
349
+ function createRouteDataCacheTag(key) {
350
+ return `route-data:${createRouteDataCacheKey(key)}`;
351
+ }
352
+ __name(createRouteDataCacheTag, "createRouteDataCacheTag");
353
+ function createRouteDataCacheKey(key) {
354
+ return createFarmCacheKey(Array.isArray(key) ? key : [key]);
355
+ }
356
+ __name(createRouteDataCacheKey, "createRouteDataCacheKey");
357
+ function normalizeRevalidatePath(routePath) {
358
+ if (typeof routePath !== "string") {
359
+ throw new TypeError("revalidatePath expects a path string.");
360
+ }
361
+ let normalized = routePath.trim();
362
+ if (!normalized) {
363
+ throw new Error("revalidatePath expects a non-empty path.");
364
+ }
365
+ try {
366
+ if (/^https?:\/\//.test(normalized)) {
367
+ normalized = new URL(normalized).pathname;
368
+ }
369
+ } catch {
370
+ }
371
+ normalized = normalized.split("?")[0] ?? normalized;
372
+ normalized = normalized.startsWith("/") ? normalized : `/${normalized}`;
373
+ normalized = normalized.replace(/\/{2,}/g, "/");
374
+ if (normalized.length > 1) {
375
+ normalized = normalized.replace(/\/+$/, "");
376
+ }
377
+ return normalized || "/";
378
+ }
379
+ __name(normalizeRevalidatePath, "normalizeRevalidatePath");
380
+ function createFarmCacheKey(parts) {
381
+ return stableSerialize(parts);
382
+ }
383
+ __name(createFarmCacheKey, "createFarmCacheKey");
384
+ function normalizeRevalidate(revalidate) {
385
+ if (revalidate === false || revalidate === void 0) {
386
+ return revalidate;
387
+ }
388
+ if (!Number.isFinite(revalidate) || revalidate <= 0) {
389
+ return void 0;
390
+ }
391
+ return revalidate;
392
+ }
393
+ __name(normalizeRevalidate, "normalizeRevalidate");
394
+ function normalizeCacheTag(tag) {
395
+ if (typeof tag !== "string") {
396
+ throw new TypeError("Cache tags must be strings.");
397
+ }
398
+ const normalized = tag.trim();
399
+ if (!normalized) {
400
+ throw new Error("Cache tags cannot be empty.");
401
+ }
402
+ return normalized;
403
+ }
404
+ __name(normalizeCacheTag, "normalizeCacheTag");
405
+ function getFunctionCacheIdentity(fn) {
406
+ if (fn.name) {
407
+ return `name:${fn.name}`;
408
+ }
409
+ let id = functionIds.get(fn);
410
+ if (!id) {
411
+ id = ++nextFunctionId;
412
+ functionIds.set(fn, id);
413
+ }
414
+ return `anonymous:${id}`;
415
+ }
416
+ __name(getFunctionCacheIdentity, "getFunctionCacheIdentity");
417
+ function stableSerialize(value, seen = /* @__PURE__ */ new WeakSet()) {
418
+ if (value === null) return "null";
419
+ if (value === void 0) return "undefined";
420
+ const valueType = typeof value;
421
+ if (valueType === "string") return JSON.stringify(value);
422
+ if (valueType === "number" || valueType === "boolean" || valueType === "bigint") {
423
+ return `${valueType}:${String(value)}`;
424
+ }
425
+ if (valueType === "symbol") {
426
+ return `symbol:${String(value)}`;
427
+ }
428
+ if (valueType === "function") {
429
+ return `function:${getFunctionCacheIdentity(value)}`;
430
+ }
431
+ if (value instanceof Date) {
432
+ return `date:${value.toISOString()}`;
433
+ }
434
+ if (value instanceof URL) {
435
+ return `url:${value.toString()}`;
436
+ }
437
+ if (value instanceof RegExp) {
438
+ return `regexp:${value.toString()}`;
439
+ }
440
+ if (Array.isArray(value)) {
441
+ return `[${value.map((item) => stableSerialize(item, seen)).join(",")}]`;
442
+ }
443
+ if (value && typeof value === "object") {
444
+ if (seen.has(value)) {
445
+ return "[Circular]";
446
+ }
447
+ seen.add(value);
448
+ const entries = Object.entries(value).sort(
449
+ ([a], [b]) => a.localeCompare(b)
450
+ );
451
+ const serialized = entries.map(([key, item]) => `${JSON.stringify(key)}:${stableSerialize(item, seen)}`).join(",");
452
+ seen.delete(value);
453
+ return `{${serialized}}`;
454
+ }
455
+ return String(value);
456
+ }
457
+ __name(stableSerialize, "stableSerialize");
458
+
459
+ // src/route-context.ts
460
+ var FARM_ROUTE_CONTEXT_SYMBOL = /* @__PURE__ */ Symbol.for("farm.routeContext");
461
+ function getFarmRouteContext(props) {
462
+ if (!props || typeof props !== "object") {
463
+ return void 0;
464
+ }
465
+ return props[FARM_ROUTE_CONTEXT_SYMBOL];
466
+ }
467
+ __name(getFarmRouteContext, "getFarmRouteContext");
468
+
469
+ // src/route-runtime.ts
470
+ function normalizeFarmRouteRuntimeConfig(value, source = "Route configuration") {
471
+ if (!value) return {};
472
+ const normalized = {};
473
+ if (value.runtime !== void 0) {
474
+ if (value.runtime !== "auto" && value.runtime !== "node" && value.runtime !== "edge") {
475
+ throw new TypeError(`${source} runtime must be "auto", "node", or "edge"`);
476
+ }
477
+ normalized.runtime = value.runtime;
478
+ }
479
+ if (value.regions !== void 0) {
480
+ if (value.regions === "auto") {
481
+ normalized.regions = "auto";
482
+ } else {
483
+ if (!Array.isArray(value.regions) || value.regions.length === 0) {
484
+ throw new TypeError(`${source} regions must be "auto" or a non-empty string array`);
485
+ }
486
+ const regions = Array.from(
487
+ new Set(
488
+ value.regions.map((region) => {
489
+ if (typeof region !== "string" || !region.trim() || /[\u0000-\u001f\u007f]/.test(region)) {
490
+ throw new TypeError(`${source} regions must contain non-empty region identifiers`);
491
+ }
492
+ return region.trim();
493
+ })
494
+ )
495
+ );
496
+ normalized.regions = regions;
497
+ }
498
+ }
499
+ if (value.maxDuration !== void 0) {
500
+ if (value.maxDuration === "auto") {
501
+ normalized.maxDuration = "auto";
502
+ } else if (typeof value.maxDuration !== "number" || !Number.isInteger(value.maxDuration) || value.maxDuration <= 0) {
503
+ throw new TypeError(`${source} maxDuration must be "auto" or a positive integer in seconds`);
504
+ } else {
505
+ normalized.maxDuration = value.maxDuration;
506
+ }
507
+ }
508
+ return normalized;
509
+ }
510
+ __name(normalizeFarmRouteRuntimeConfig, "normalizeFarmRouteRuntimeConfig");
511
+
512
+ // src/routes.ts
513
+ var FARM_ROUTES_BRAND = /* @__PURE__ */ Symbol.for("farm.routes");
514
+ var PROGRAMMATIC_ROUTE_FILE_NAMES = [
515
+ "farm.route.ts",
516
+ "farm.route.tsx",
517
+ "farm.route.js",
518
+ "farm.route.jsx",
519
+ "farm.routes.ts",
520
+ "farm.routes.tsx",
521
+ "farm.routes.js",
522
+ "farm.routes.jsx",
523
+ "routes.ts",
524
+ "routes.tsx",
525
+ "routes.js",
526
+ "routes.jsx"
527
+ ];
528
+ function defineRoutes(input) {
529
+ const routes = typeof input === "function" ? input(routesBuilder) : input;
530
+ const manifest = {
531
+ __farmRoutes: true,
532
+ routes: routes.map(normalizeProgrammaticRoute)
533
+ };
534
+ Object.defineProperty(manifest, FARM_ROUTES_BRAND, {
535
+ value: true,
536
+ enumerable: false
537
+ });
538
+ return manifest;
539
+ }
540
+ __name(defineRoutes, "defineRoutes");
541
+ var routesBuilder = {
542
+ page(path, options) {
543
+ return normalizeProgrammaticRoute({
544
+ kind: "page",
545
+ path,
546
+ ...options
547
+ });
548
+ },
549
+ layout(path, options) {
550
+ return normalizeProgrammaticRoute({
551
+ kind: "layout",
552
+ path,
553
+ ...options
554
+ });
555
+ },
556
+ api(path, options) {
557
+ const { render, runtime, regions, maxDuration, ...methods } = options;
558
+ return normalizeProgrammaticRoute({
559
+ kind: "api",
560
+ path,
561
+ render,
562
+ runtime,
563
+ regions,
564
+ maxDuration,
565
+ methods: normalizeApiMethods(methods)
566
+ });
567
+ },
568
+ redirect(source, destination, options = {}) {
569
+ return normalizeProgrammaticRoute({
570
+ kind: "redirect",
571
+ source,
572
+ destination,
573
+ ...options
574
+ });
575
+ }
576
+ };
577
+ var page = routesBuilder.page;
578
+ var layout = routesBuilder.layout;
579
+ var api = routesBuilder.api;
580
+ var redirect = routesBuilder.redirect;
581
+ function getProgrammaticRouteSearchSchema(search) {
582
+ if (!search) return void 0;
583
+ if (isProgrammaticRouteSchema(search)) return search;
584
+ return search.schema;
585
+ }
586
+ __name(getProgrammaticRouteSearchSchema, "getProgrammaticRouteSearchSchema");
587
+ function getProgrammaticRouteSearchClientOptions(search) {
588
+ if (!search || isProgrammaticRouteSchema(search)) return void 0;
589
+ const options = {};
590
+ if (typeof search.stripDefaults !== "undefined") options.stripDefaults = search.stripDefaults;
591
+ if (search.preserve?.length) options.preserve = [...search.preserve];
592
+ if (search.temporary?.length) options.temporary = [...search.temporary];
593
+ return Object.keys(options).length > 0 ? options : void 0;
594
+ }
595
+ __name(getProgrammaticRouteSearchClientOptions, "getProgrammaticRouteSearchClientOptions");
596
+ function resolveProgrammaticRouteSearch(searchConfig, rawSearch, path, routePath) {
597
+ const schema = getProgrammaticRouteSearchSchema(searchConfig);
598
+ const search = parseProgrammaticSchema(schema, rawSearch, "search", routePath);
599
+ const options = getProgrammaticRouteSearchOptions(searchConfig);
600
+ const canonicalPath = resolveProgrammaticRouteCanonicalPath({
601
+ options,
602
+ schema,
603
+ rawSearch,
604
+ parsedSearch: search,
605
+ path
606
+ });
607
+ return { search, canonicalPath };
608
+ }
609
+ __name(resolveProgrammaticRouteSearch, "resolveProgrammaticRouteSearch");
610
+ function getProgrammaticRouteSearchOptions(search) {
611
+ if (!search || isProgrammaticRouteSchema(search)) return void 0;
612
+ return search;
613
+ }
614
+ __name(getProgrammaticRouteSearchOptions, "getProgrammaticRouteSearchOptions");
615
+ function isProgrammaticRouteSchema(value) {
616
+ return !!value && typeof value === "object" && typeof value.parse === "function";
617
+ }
618
+ __name(isProgrammaticRouteSchema, "isProgrammaticRouteSchema");
619
+ function resolveProgrammaticRouteCanonicalPath(input) {
620
+ const options = input.options;
621
+ if (!options?.temporary?.length && !options?.stripDefaults) {
622
+ return void 0;
623
+ }
624
+ const params = createSearchParams(input.rawSearch);
625
+ const original = params.toString();
626
+ for (const key of options.temporary || []) {
627
+ params.delete(key);
628
+ }
629
+ if (options.stripDefaults) {
630
+ const defaultSearch = parseDefaultSearch(input.schema);
631
+ if (defaultSearch !== void 0) {
632
+ const keys = options.stripDefaults === true ? Array.from(new Set(Array.from(params.keys()))) : [...options.stripDefaults];
633
+ for (const key of keys) {
634
+ if (params.has(key) && searchValuesEqual(
635
+ readSearchValue(input.parsedSearch, key),
636
+ readSearchValue(defaultSearch, key)
637
+ )) {
638
+ params.delete(key);
639
+ }
640
+ }
641
+ }
642
+ }
643
+ const next = params.toString();
644
+ if (next === original) {
645
+ return void 0;
646
+ }
647
+ return next ? `${input.path}?${next}` : input.path;
648
+ }
649
+ __name(resolveProgrammaticRouteCanonicalPath, "resolveProgrammaticRouteCanonicalPath");
650
+ function createSearchParams(value) {
651
+ const params = new URLSearchParams();
652
+ for (const [key, item] of Object.entries(value)) {
653
+ if (item == null) continue;
654
+ const values = Array.isArray(item) ? item : [item];
655
+ for (const entry of values) {
656
+ if (entry != null) params.append(key, String(entry));
657
+ }
658
+ }
659
+ return params;
660
+ }
661
+ __name(createSearchParams, "createSearchParams");
662
+ function parseDefaultSearch(schema) {
663
+ if (!schema) return void 0;
664
+ try {
665
+ const value = schema.parse({});
666
+ return value && typeof value === "object" ? value : void 0;
667
+ } catch {
668
+ return void 0;
669
+ }
670
+ }
671
+ __name(parseDefaultSearch, "parseDefaultSearch");
672
+ function readSearchValue(value, key) {
673
+ return value && typeof value === "object" ? value[key] : void 0;
674
+ }
675
+ __name(readSearchValue, "readSearchValue");
676
+ function searchValuesEqual(left, right) {
677
+ return JSON.stringify(normalizeComparableValue(left)) === JSON.stringify(normalizeComparableValue(right));
678
+ }
679
+ __name(searchValuesEqual, "searchValuesEqual");
680
+ function normalizeComparableValue(value) {
681
+ if (Array.isArray(value)) {
682
+ return value.map(normalizeComparableValue);
683
+ }
684
+ if (value && typeof value === "object") {
685
+ return Object.keys(value).sort().reduce((output, key) => {
686
+ output[key] = normalizeComparableValue(value[key]);
687
+ return output;
688
+ }, {});
689
+ }
690
+ return value;
691
+ }
692
+ __name(normalizeComparableValue, "normalizeComparableValue");
693
+ function createRoute(path, options) {
694
+ return routesBuilder.page(path, options);
695
+ }
696
+ __name(createRoute, "createRoute");
697
+ function isProgrammaticRoutesFileName(fileName) {
698
+ const normalized = fileName.replace(/\\/g, "/");
699
+ const baseName = normalized.split("/").pop() || normalized;
700
+ return PROGRAMMATIC_ROUTE_FILE_NAMES.includes(baseName);
701
+ }
702
+ __name(isProgrammaticRoutesFileName, "isProgrammaticRoutesFileName");
703
+ function getProgrammaticRouteManifest(mod) {
704
+ if (!mod) return null;
705
+ const candidates = [mod.default, mod.routes, mod.Route];
706
+ for (const candidate of candidates) {
707
+ if (isProgrammaticRouteManifest(candidate)) {
708
+ return candidate;
709
+ }
710
+ if (isProgrammaticRouteDefinition(candidate)) {
711
+ return defineRoutes([candidate]);
712
+ }
713
+ if (Array.isArray(candidate)) {
714
+ return defineRoutes(candidate);
715
+ }
716
+ }
717
+ const routeDefinitions = Object.values(mod).filter(isProgrammaticRouteDefinition);
718
+ if (routeDefinitions.length > 0) {
719
+ return defineRoutes(routeDefinitions);
720
+ }
721
+ return null;
722
+ }
723
+ __name(getProgrammaticRouteManifest, "getProgrammaticRouteManifest");
724
+ function isProgrammaticRouteManifest(value) {
725
+ return !!value && typeof value === "object" && value.__farmRoutes === true && Array.isArray(value.routes);
726
+ }
727
+ __name(isProgrammaticRouteManifest, "isProgrammaticRouteManifest");
728
+ function isProgrammaticRouteDefinition(value) {
729
+ if (!value || typeof value !== "object") {
730
+ return false;
731
+ }
732
+ const kind = value.kind;
733
+ return kind === "page" || kind === "layout" || kind === "api" || kind === "redirect";
734
+ }
735
+ __name(isProgrammaticRouteDefinition, "isProgrammaticRouteDefinition");
736
+ function createProgrammaticRouteModuleId(filePath, kind, routePath) {
737
+ return `${filePath}?farm-route=${kind}:${encodeURIComponent(normalizeRoutePath(routePath))}`;
738
+ }
739
+ __name(createProgrammaticRouteModuleId, "createProgrammaticRouteModuleId");
740
+ function parseProgrammaticRouteModuleId(moduleId) {
741
+ const queryIndex = moduleId.indexOf("?");
742
+ if (queryIndex === -1) {
743
+ return null;
744
+ }
745
+ const filePath = moduleId.slice(0, queryIndex);
746
+ const params = new URLSearchParams(moduleId.slice(queryIndex + 1));
747
+ const value = params.get("farm-route");
748
+ if (!value) {
749
+ return null;
750
+ }
751
+ const separator = value.indexOf(":");
752
+ if (separator === -1) {
753
+ return null;
754
+ }
755
+ const kind = value.slice(0, separator);
756
+ if (kind !== "page" && kind !== "layout" && kind !== "api") {
757
+ return null;
758
+ }
759
+ return {
760
+ filePath,
761
+ kind,
762
+ routePath: normalizeRoutePath(value.slice(separator + 1))
763
+ };
764
+ }
765
+ __name(parseProgrammaticRouteModuleId, "parseProgrammaticRouteModuleId");
766
+ function parseProgrammaticRoutePath(routePath, type = "page") {
767
+ const fileName = type === "layout" ? "layout.tsx" : "page.tsx";
768
+ const normalized = normalizeRoutePath(routePath);
769
+ const filePath = normalized === "/" ? fileName : `${normalized.slice(1).replace(/\/+$/, "")}/${fileName}`;
770
+ return {
771
+ filePath,
772
+ type,
773
+ segments: normalized === "/" ? [] : normalized.slice(1).split("/").map(parseRouteSegment)
774
+ };
775
+ }
776
+ __name(parseProgrammaticRoutePath, "parseProgrammaticRoutePath");
777
+ function createRouteModuleFromProgrammaticPage(route) {
778
+ const mod = {
779
+ default: createProgrammaticPageComponent(route),
780
+ ...normalizeFarmRouteRuntimeConfig(route, `Route "${route.path}"`)
781
+ };
782
+ if (route.params || route.search || route.guard || route.data) {
783
+ mod.__farmRouteSchemas = {
784
+ params: route.params,
785
+ search: getProgrammaticRouteSearchSchema(route.search)
786
+ };
787
+ mod.__farmRouteSearch = getProgrammaticRouteSearchClientOptions(route.search);
788
+ mod.__farmRouteGuard = route.guard;
789
+ mod.__farmRouteData = route.data;
790
+ mod.__farmRouteParsesProps = true;
791
+ mod.__farmResolveRouteProps = (props) => resolveProgrammaticRouteProps(route, props);
792
+ mod.__farmResolveRouteCanonicalPath = (rawSearch, path) => resolveProgrammaticRouteSearch(route.search, rawSearch, path, route.path).canonicalPath;
793
+ }
794
+ if (route.pending || route.error || route.notFound) {
795
+ mod.__farmRouteComponents = {
796
+ pending: route.pending,
797
+ error: route.error,
798
+ notFound: route.notFound
799
+ };
800
+ }
801
+ if (route.render === "static" || route.staticPaths) {
802
+ mod.ssg = true;
803
+ mod.dynamic = "force-static";
804
+ } else if (route.render === "dynamic") {
805
+ mod.ssg = false;
806
+ mod.dynamic = "force-dynamic";
807
+ }
808
+ if (typeof route.revalidate !== "undefined") {
809
+ mod.revalidate = route.revalidate;
810
+ }
811
+ if (route.ppr) {
812
+ mod.ppr = true;
813
+ }
814
+ if (route.metadata) {
815
+ mod.metadata = route.metadata;
816
+ }
817
+ if (route.generateMetadata) {
818
+ mod.generateMetadata = route.generateMetadata;
819
+ }
820
+ if (route.staticPaths) {
821
+ mod.getStaticPaths = async () => normalizeStaticPaths(route.path, await route.staticPaths());
822
+ }
823
+ return mod;
824
+ }
825
+ __name(createRouteModuleFromProgrammaticPage, "createRouteModuleFromProgrammaticPage");
826
+ function createLayoutModuleFromProgrammaticLayout(route) {
827
+ return {
828
+ default: route.component,
829
+ ...normalizeFarmRouteRuntimeConfig(route, `Layout "${route.path}"`),
830
+ metadata: route.metadata,
831
+ generateMetadata: route.generateMetadata
832
+ };
833
+ }
834
+ __name(createLayoutModuleFromProgrammaticLayout, "createLayoutModuleFromProgrammaticLayout");
835
+ function scanProgrammaticPagePaths(source) {
836
+ const paths = /* @__PURE__ */ new Set();
837
+ const callRe = /\b(?:page|createRoute)\s*\(\s*(["'`])([^"'`]+)\1/g;
838
+ for (const match of source.matchAll(callRe)) {
839
+ if (match[2]) {
840
+ paths.add(normalizeRoutePath(match[2]));
841
+ }
842
+ }
843
+ return Array.from(paths);
844
+ }
845
+ __name(scanProgrammaticPagePaths, "scanProgrammaticPagePaths");
846
+ function createProgrammaticPageComponent(route) {
847
+ if (!route.params && !route.search && !route.guard && !route.data && !route.pending && !route.error && !route.notFound) {
848
+ return route.component;
849
+ }
850
+ const Component = route.component;
851
+ if (route.pending) {
852
+ const PendingComponent = route.pending;
853
+ const routePropsResources = /* @__PURE__ */ new WeakMap();
854
+ const FarmProgrammaticPageContent2 = /* @__PURE__ */ __name(function FarmProgrammaticPageContent3(props) {
855
+ try {
856
+ const resolvedProps = readProgrammaticRouteProps(route, props, routePropsResources);
857
+ return (0, import_react.createElement)(Component, stripProgrammaticRoutePropsMarker(resolvedProps));
858
+ } catch (error) {
859
+ if (isPromiseLike(error) || isProgrammaticRedirectSignal(error)) {
860
+ throw error;
861
+ }
862
+ if (isProgrammaticNotFoundSignal(error) && route.notFound) {
863
+ return (0, import_react.createElement)(route.notFound, createProgrammaticRouteErrorProps(error, props));
864
+ }
865
+ if (route.error) {
866
+ return (0, import_react.createElement)(route.error, createProgrammaticRouteErrorProps(error, props));
867
+ }
868
+ throw error;
869
+ }
870
+ }, "FarmProgrammaticPageContent");
871
+ const PageContent = FarmProgrammaticPageContent2;
872
+ const FarmProgrammaticPage = /* @__PURE__ */ __name(function FarmProgrammaticPage2(props) {
873
+ return (0, import_react.createElement)(
874
+ import_react.Suspense,
875
+ {
876
+ fallback: (0, import_react.createElement)(PendingComponent, createProgrammaticRoutePendingProps(props))
877
+ },
878
+ (0, import_react.createElement)(PageContent, props)
879
+ );
880
+ }, "FarmProgrammaticPage");
881
+ return FarmProgrammaticPage;
882
+ }
883
+ const FarmProgrammaticPageContent = /* @__PURE__ */ __name(async function FarmProgrammaticPageContent2(props) {
884
+ try {
885
+ const resolvedProps = isProgrammaticRoutePropsResolved(props) ? props : await resolveProgrammaticRouteProps(route, props);
886
+ return (0, import_react.createElement)(Component, stripProgrammaticRoutePropsMarker(resolvedProps));
887
+ } catch (error) {
888
+ if (isProgrammaticRedirectSignal(error)) {
889
+ throw error;
890
+ }
891
+ if (isProgrammaticNotFoundSignal(error) && route.notFound) {
892
+ return (0, import_react.createElement)(route.notFound, createProgrammaticRouteErrorProps(error, props));
893
+ }
894
+ if (route.error) {
895
+ return (0, import_react.createElement)(route.error, createProgrammaticRouteErrorProps(error, props));
896
+ }
897
+ throw error;
898
+ }
899
+ }, "FarmProgrammaticPageContent");
900
+ return FarmProgrammaticPageContent;
901
+ }
902
+ __name(createProgrammaticPageComponent, "createProgrammaticPageComponent");
903
+ function readProgrammaticRouteProps(route, props, resources) {
904
+ if (isProgrammaticRoutePropsResolved(props)) {
905
+ return props;
906
+ }
907
+ let resource = resources.get(props);
908
+ if (!resource) {
909
+ const deferredRouteProps = props.__farmRoutePropsPromise;
910
+ const promise = Promise.resolve(
911
+ isPromiseLike(deferredRouteProps) ? deferredRouteProps : resolveProgrammaticRouteProps(route, props)
912
+ );
913
+ resource = { status: "pending", promise };
914
+ resources.set(props, resource);
915
+ promise.then(
916
+ (value) => resources.set(props, { status: "resolved", value }),
917
+ (error) => resources.set(props, { status: "rejected", error })
918
+ );
919
+ }
920
+ if (resource.status === "pending") throw resource.promise;
921
+ if (resource.status === "rejected") throw resource.error;
922
+ return resource.value;
923
+ }
924
+ __name(readProgrammaticRouteProps, "readProgrammaticRouteProps");
925
+ function isPromiseLike(value) {
926
+ return Boolean(
927
+ value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function"
928
+ );
929
+ }
930
+ __name(isPromiseLike, "isPromiseLike");
931
+ function createProgrammaticRoutePendingProps(props) {
932
+ return {
933
+ params: props.params,
934
+ searchParams: props.searchParams,
935
+ path: props.path
936
+ };
937
+ }
938
+ __name(createProgrammaticRoutePendingProps, "createProgrammaticRoutePendingProps");
939
+ function createProgrammaticRouteErrorProps(error, props) {
940
+ return {
941
+ error,
942
+ params: props.params,
943
+ searchParams: props.searchParams,
944
+ path: props.path
945
+ };
946
+ }
947
+ __name(createProgrammaticRouteErrorProps, "createProgrammaticRouteErrorProps");
948
+ function isProgrammaticRedirectSignal(error) {
949
+ if (!error || typeof error !== "object") return false;
950
+ const digest = error.digest;
951
+ return typeof digest === "string" && digest.startsWith("FARM_REDIRECT;");
952
+ }
953
+ __name(isProgrammaticRedirectSignal, "isProgrammaticRedirectSignal");
954
+ function isProgrammaticNotFoundSignal(error) {
955
+ if (!error || typeof error !== "object") return false;
956
+ const digest = error.digest;
957
+ return digest === "FARM_NOT_FOUND";
958
+ }
959
+ __name(isProgrammaticNotFoundSignal, "isProgrammaticNotFoundSignal");
960
+ async function resolveProgrammaticRouteProps(route, props) {
961
+ const rawSearch = await props.searchParams;
962
+ const params = parseProgrammaticSchema(route.params, props.params, "params", route.path);
963
+ const { search, canonicalPath } = resolveProgrammaticRouteSearch(
964
+ route.search,
965
+ rawSearch,
966
+ props.path,
967
+ route.path
968
+ );
969
+ const routeContextValue = getFarmRouteContext(props);
970
+ const pluginContext = props.context;
971
+ const baseProps = {
972
+ ...props,
973
+ params,
974
+ search,
975
+ searchParams: Promise.resolve(search)
976
+ };
977
+ const routeContextProps = {
978
+ ...baseProps,
979
+ context: routeContextValue,
980
+ pluginContext
981
+ };
982
+ if (route.guard) {
983
+ await route.guard(routeContextProps);
984
+ }
985
+ if (!route.data) {
986
+ return markProgrammaticRoutePropsResolved(addCanonicalPath(baseProps, canonicalPath));
987
+ }
988
+ const before = route.data.before ? await route.data.before(routeContextProps) : void 0;
989
+ const dataContext = {
990
+ ...routeContextProps,
991
+ before
992
+ };
993
+ const data = await resolveProgrammaticRouteData(route, route.data, dataContext);
994
+ if (route.data.after) {
995
+ await route.data.after({
996
+ ...routeContextProps,
997
+ before,
998
+ data
999
+ });
1000
+ }
1001
+ return markProgrammaticRoutePropsResolved({
1002
+ ...baseProps,
1003
+ data,
1004
+ ...canonicalPath ? { __farmCanonicalPath: canonicalPath } : {}
1005
+ });
1006
+ }
1007
+ __name(resolveProgrammaticRouteProps, "resolveProgrammaticRouteProps");
1008
+ async function resolveProgrammaticRouteData(route, dataHooks, context) {
1009
+ if (!dataHooks?.key) {
1010
+ return dataHooks.main(context);
1011
+ }
1012
+ const routeDataKey = await dataHooks.key(context);
1013
+ if (routeDataKey == null) {
1014
+ return dataHooks.main(context);
1015
+ }
1016
+ const cacheKey = createFarmCacheKey(["route-data", routeDataKey]);
1017
+ const cacheOptions = {
1018
+ tags: [
1019
+ createRouteDataCacheTag(routeDataKey),
1020
+ ...await resolveProgrammaticRouteDataKeys(dataHooks.tags, context)
1021
+ ],
1022
+ paths: [
1023
+ ...typeof context.path === "string" ? [context.path] : [],
1024
+ ...await resolveProgrammaticRouteDataKeys(dataHooks.paths, context)
1025
+ ],
1026
+ revalidate: normalizeProgrammaticRouteStaleTime(dataHooks.staleTime)
1027
+ };
1028
+ return getFarmDataCache().getOrSet(cacheKey, () => dataHooks.main(context), cacheOptions);
1029
+ }
1030
+ __name(resolveProgrammaticRouteData, "resolveProgrammaticRouteData");
1031
+ async function resolveProgrammaticRouteDataKeys(input, context) {
1032
+ if (!input) return [];
1033
+ const value = typeof input === "function" ? await input(context) : input;
1034
+ return value.filter((item) => typeof item === "string" && item.trim().length > 0);
1035
+ }
1036
+ __name(resolveProgrammaticRouteDataKeys, "resolveProgrammaticRouteDataKeys");
1037
+ function normalizeProgrammaticRouteStaleTime(staleTime) {
1038
+ if (staleTime === void 0) return void 0;
1039
+ if (staleTime === false) return false;
1040
+ if (typeof staleTime === "number") {
1041
+ if (!Number.isFinite(staleTime) || staleTime <= 0) return void 0;
1042
+ return Math.max(1, Math.ceil(staleTime / 1e3));
1043
+ }
1044
+ const match = staleTime.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)$/);
1045
+ if (!match) return void 0;
1046
+ const value = Number(match[1]);
1047
+ if (!Number.isFinite(value) || value <= 0) return void 0;
1048
+ const unit = match[2];
1049
+ const milliseconds = unit === "ms" ? value : unit === "s" ? value * 1e3 : unit === "m" ? value * 6e4 : value * 36e5;
1050
+ return Math.max(1, Math.ceil(milliseconds / 1e3));
1051
+ }
1052
+ __name(normalizeProgrammaticRouteStaleTime, "normalizeProgrammaticRouteStaleTime");
1053
+ function isProgrammaticRoutePropsResolved(value) {
1054
+ return !!value && typeof value === "object" && value.__farmRoutePropsResolved === true;
1055
+ }
1056
+ __name(isProgrammaticRoutePropsResolved, "isProgrammaticRoutePropsResolved");
1057
+ function markProgrammaticRoutePropsResolved(props) {
1058
+ return {
1059
+ ...props,
1060
+ __farmRoutePropsResolved: true
1061
+ };
1062
+ }
1063
+ __name(markProgrammaticRoutePropsResolved, "markProgrammaticRoutePropsResolved");
1064
+ function addCanonicalPath(props, canonicalPath) {
1065
+ return canonicalPath ? { ...props, __farmCanonicalPath: canonicalPath } : props;
1066
+ }
1067
+ __name(addCanonicalPath, "addCanonicalPath");
1068
+ function stripProgrammaticRoutePropsMarker(props) {
1069
+ if (!isProgrammaticRoutePropsResolved(props)) {
1070
+ return props;
1071
+ }
1072
+ const {
1073
+ __farmRoutePropsResolved,
1074
+ __farmCanonicalPath,
1075
+ __farmRoutePropsPromise,
1076
+ ...componentProps
1077
+ } = props;
1078
+ return componentProps;
1079
+ }
1080
+ __name(stripProgrammaticRoutePropsMarker, "stripProgrammaticRoutePropsMarker");
1081
+ function parseProgrammaticSchema(schema, value, label, routePath) {
1082
+ if (!schema) {
1083
+ return value;
1084
+ }
1085
+ try {
1086
+ return schema.parse(value);
1087
+ } catch (error) {
1088
+ const message = error instanceof Error ? error.message : String(error);
1089
+ throw new Error(`Invalid ${label} for route "${routePath}": ${message}`);
1090
+ }
1091
+ }
1092
+ __name(parseProgrammaticSchema, "parseProgrammaticSchema");
1093
+ function normalizeProgrammaticRoute(route) {
1094
+ if (route.kind === "redirect") {
1095
+ return {
1096
+ ...route,
1097
+ source: normalizeRoutePath(route.source)
1098
+ };
1099
+ }
1100
+ if (route.kind === "api") {
1101
+ return {
1102
+ ...route,
1103
+ ...normalizeFarmRouteRuntimeConfig(route, `API route "${route.path}"`),
1104
+ path: normalizeRoutePath(route.path),
1105
+ methods: normalizeApiMethods(route.methods)
1106
+ };
1107
+ }
1108
+ return {
1109
+ ...route,
1110
+ ...normalizeFarmRouteRuntimeConfig(
1111
+ route,
1112
+ `${route.kind === "layout" ? "Layout" : "Route"} "${route.path}"`
1113
+ ),
1114
+ path: normalizeRoutePath(route.path)
1115
+ };
1116
+ }
1117
+ __name(normalizeProgrammaticRoute, "normalizeProgrammaticRoute");
1118
+ function normalizeRoutePath(routePath) {
1119
+ const withSlash = routePath.startsWith("/") ? routePath : `/${routePath}`;
1120
+ const withoutTrailing = withSlash.length > 1 ? withSlash.replace(/\/+$/, "") : withSlash;
1121
+ return withoutTrailing || "/";
1122
+ }
1123
+ __name(normalizeRoutePath, "normalizeRoutePath");
1124
+ function parseRouteSegment(segment) {
1125
+ if (segment.startsWith("[") && segment.endsWith("]")) {
1126
+ let name = segment.slice(1, -1);
1127
+ let isOptional = false;
1128
+ let isCatchAll = false;
1129
+ if (name.startsWith("[") && name.endsWith("]")) {
1130
+ isOptional = true;
1131
+ name = name.slice(1, -1);
1132
+ }
1133
+ if (name.startsWith("...")) {
1134
+ isCatchAll = true;
1135
+ name = name.slice(3);
1136
+ }
1137
+ return {
1138
+ segment: name,
1139
+ isDynamic: true,
1140
+ isOptional,
1141
+ isCatchAll
1142
+ };
1143
+ }
1144
+ return {
1145
+ segment,
1146
+ isDynamic: false,
1147
+ isOptional: false,
1148
+ isCatchAll: false
1149
+ };
1150
+ }
1151
+ __name(parseRouteSegment, "parseRouteSegment");
1152
+ function normalizeApiMethods(methods) {
1153
+ const normalized = {};
1154
+ for (const [method, handler] of Object.entries(methods)) {
1155
+ const normalizedMethod = method.toUpperCase();
1156
+ if (handler && isProgrammaticRouteMethod(normalizedMethod)) {
1157
+ normalized[normalizedMethod] = handler;
1158
+ }
1159
+ }
1160
+ return normalized;
1161
+ }
1162
+ __name(normalizeApiMethods, "normalizeApiMethods");
1163
+ function isProgrammaticRouteMethod(method) {
1164
+ return method === "GET" || method === "HEAD" || method === "POST" || method === "PUT" || method === "DELETE" || method === "PATCH" || method === "OPTIONS";
1165
+ }
1166
+ __name(isProgrammaticRouteMethod, "isProgrammaticRouteMethod");
1167
+ function normalizeStaticPaths(routePath, paths) {
1168
+ const dynamicSegments = parseProgrammaticRoutePath(routePath).segments.filter(
1169
+ (segment) => segment.isDynamic
1170
+ );
1171
+ return paths.map((entry) => {
1172
+ if (typeof entry === "string" || Array.isArray(entry)) {
1173
+ if (dynamicSegments.length !== 1) {
1174
+ throw new Error(
1175
+ `staticPaths for "${routePath}" must return objects when the route has ${dynamicSegments.length} dynamic params.`
1176
+ );
1177
+ }
1178
+ const value = Array.isArray(entry) ? entry.join("/") : entry;
1179
+ return { [dynamicSegments[0].segment]: String(value) };
1180
+ }
1181
+ return Object.fromEntries(
1182
+ Object.entries(entry).map(([key, value]) => [
1183
+ key,
1184
+ Array.isArray(value) ? value.map(String).join("/") : String(value)
1185
+ ])
1186
+ );
1187
+ });
1188
+ }
1189
+ __name(normalizeStaticPaths, "normalizeStaticPaths");
1190
+ // Annotate the CommonJS export names for ESM import in node:
1191
+ 0 && (module.exports = {
1192
+ PROGRAMMATIC_ROUTE_FILE_NAMES,
1193
+ api,
1194
+ createLayoutModuleFromProgrammaticLayout,
1195
+ createProgrammaticRouteModuleId,
1196
+ createRoute,
1197
+ createRouteModuleFromProgrammaticPage,
1198
+ defineRoutes,
1199
+ getProgrammaticRouteManifest,
1200
+ getProgrammaticRouteSearchClientOptions,
1201
+ getProgrammaticRouteSearchSchema,
1202
+ isProgrammaticRouteDefinition,
1203
+ isProgrammaticRouteManifest,
1204
+ isProgrammaticRoutesFileName,
1205
+ layout,
1206
+ page,
1207
+ parseProgrammaticRouteModuleId,
1208
+ parseProgrammaticRoutePath,
1209
+ redirect,
1210
+ routesBuilder,
1211
+ scanProgrammaticPagePaths
1212
+ });
1213
+ //# sourceMappingURL=routes.cjs.map