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

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 (424) hide show
  1. package/package.json +1 -1
  2. package/dist/after.cjs +0 -227
  3. package/dist/after.cjs.map +0 -1
  4. package/dist/after.d.mts +0 -25
  5. package/dist/after.d.ts +0 -25
  6. package/dist/after.mjs +0 -14
  7. package/dist/after.mjs.map +0 -1
  8. package/dist/agent-runtime.cjs +0 -2379
  9. package/dist/agent-runtime.cjs.map +0 -1
  10. package/dist/agent-runtime.d.mts +0 -94
  11. package/dist/agent-runtime.d.ts +0 -94
  12. package/dist/agent-runtime.mjs +0 -479
  13. package/dist/agent-runtime.mjs.map +0 -1
  14. package/dist/api/route-manager.d.mts +0 -66
  15. package/dist/api/route-manager.d.ts +0 -66
  16. package/dist/api/runtime.d.mts +0 -3
  17. package/dist/api/runtime.d.ts +0 -3
  18. package/dist/api.cjs +0 -4100
  19. package/dist/api.cjs.map +0 -1
  20. package/dist/api.d.mts +0 -48
  21. package/dist/api.d.ts +0 -48
  22. package/dist/api.mjs +0 -93
  23. package/dist/api.mjs.map +0 -1
  24. package/dist/app-BjN-da13.d.ts +0 -300
  25. package/dist/app-CakAr8Be.d.mts +0 -300
  26. package/dist/app-markdown.cjs +0 -220
  27. package/dist/app-markdown.cjs.map +0 -1
  28. package/dist/app-markdown.d.mts +0 -22
  29. package/dist/app-markdown.d.ts +0 -22
  30. package/dist/app-markdown.mjs +0 -26
  31. package/dist/app-markdown.mjs.map +0 -1
  32. package/dist/cache.cjs +0 -945
  33. package/dist/cache.cjs.map +0 -1
  34. package/dist/cache.d.mts +0 -192
  35. package/dist/cache.d.ts +0 -192
  36. package/dist/cache.mjs +0 -46
  37. package/dist/cache.mjs.map +0 -1
  38. package/dist/chunk-2CUKEMVR.mjs +0 -872
  39. package/dist/chunk-2CUKEMVR.mjs.map +0 -1
  40. package/dist/chunk-2ED5Q2GH.mjs +0 -422
  41. package/dist/chunk-2ED5Q2GH.mjs.map +0 -1
  42. package/dist/chunk-2NHCNRF6.mjs +0 -6241
  43. package/dist/chunk-2NHCNRF6.mjs.map +0 -1
  44. package/dist/chunk-32W4QEJP.mjs +0 -158
  45. package/dist/chunk-32W4QEJP.mjs.map +0 -1
  46. package/dist/chunk-3XNTL3FQ.mjs +0 -452
  47. package/dist/chunk-3XNTL3FQ.mjs.map +0 -1
  48. package/dist/chunk-44ZCFSKE.mjs +0 -84
  49. package/dist/chunk-44ZCFSKE.mjs.map +0 -1
  50. package/dist/chunk-4S3ORGFA.mjs +0 -44
  51. package/dist/chunk-4S3ORGFA.mjs.map +0 -1
  52. package/dist/chunk-5BY76U2M.mjs +0 -1
  53. package/dist/chunk-5BY76U2M.mjs.map +0 -1
  54. package/dist/chunk-5ZGPRGWV.mjs +0 -136
  55. package/dist/chunk-5ZGPRGWV.mjs.map +0 -1
  56. package/dist/chunk-65A7QIKI.mjs +0 -142
  57. package/dist/chunk-65A7QIKI.mjs.map +0 -1
  58. package/dist/chunk-74YTBPTY.mjs +0 -450
  59. package/dist/chunk-74YTBPTY.mjs.map +0 -1
  60. package/dist/chunk-7HO6AEOP.mjs +0 -74
  61. package/dist/chunk-7HO6AEOP.mjs.map +0 -1
  62. package/dist/chunk-7MABZJIM.mjs +0 -29
  63. package/dist/chunk-7MABZJIM.mjs.map +0 -1
  64. package/dist/chunk-7N62DNSO.mjs +0 -41
  65. package/dist/chunk-7N62DNSO.mjs.map +0 -1
  66. package/dist/chunk-7ZY5AIJO.mjs +0 -161
  67. package/dist/chunk-7ZY5AIJO.mjs.map +0 -1
  68. package/dist/chunk-A2LUXHD2.mjs +0 -7631
  69. package/dist/chunk-A2LUXHD2.mjs.map +0 -1
  70. package/dist/chunk-ALCLXXTY.mjs +0 -187
  71. package/dist/chunk-ALCLXXTY.mjs.map +0 -1
  72. package/dist/chunk-AZ7YUVNR.mjs +0 -65
  73. package/dist/chunk-AZ7YUVNR.mjs.map +0 -1
  74. package/dist/chunk-B232I2GP.mjs +0 -163
  75. package/dist/chunk-B232I2GP.mjs.map +0 -1
  76. package/dist/chunk-BHG3LVHH.mjs +0 -176
  77. package/dist/chunk-BHG3LVHH.mjs.map +0 -1
  78. package/dist/chunk-C2ROET2V.mjs +0 -718
  79. package/dist/chunk-C2ROET2V.mjs.map +0 -1
  80. package/dist/chunk-C3DLZMBU.mjs +0 -597
  81. package/dist/chunk-C3DLZMBU.mjs.map +0 -1
  82. package/dist/chunk-CGILA3WO.mjs +0 -14
  83. package/dist/chunk-CGILA3WO.mjs.map +0 -1
  84. package/dist/chunk-E2MPIBRE.mjs +0 -149
  85. package/dist/chunk-E2MPIBRE.mjs.map +0 -1
  86. package/dist/chunk-E6EPN5BT.mjs +0 -203
  87. package/dist/chunk-E6EPN5BT.mjs.map +0 -1
  88. package/dist/chunk-EEABSBKK.mjs +0 -10
  89. package/dist/chunk-EEABSBKK.mjs.map +0 -1
  90. package/dist/chunk-EJ7T4TPB.mjs +0 -622
  91. package/dist/chunk-EJ7T4TPB.mjs.map +0 -1
  92. package/dist/chunk-FQYDHKKU.mjs +0 -128
  93. package/dist/chunk-FQYDHKKU.mjs.map +0 -1
  94. package/dist/chunk-FRPWCMMG.mjs +0 -299
  95. package/dist/chunk-FRPWCMMG.mjs.map +0 -1
  96. package/dist/chunk-GN72QAIH.mjs +0 -146
  97. package/dist/chunk-GN72QAIH.mjs.map +0 -1
  98. package/dist/chunk-GQVGIUSN.mjs +0 -149
  99. package/dist/chunk-GQVGIUSN.mjs.map +0 -1
  100. package/dist/chunk-GS6K5OCM.mjs +0 -407
  101. package/dist/chunk-GS6K5OCM.mjs.map +0 -1
  102. package/dist/chunk-GXASWWJU.mjs +0 -364
  103. package/dist/chunk-GXASWWJU.mjs.map +0 -1
  104. package/dist/chunk-GY2STC2S.mjs +0 -180
  105. package/dist/chunk-GY2STC2S.mjs.map +0 -1
  106. package/dist/chunk-H2FA2SBS.mjs +0 -51
  107. package/dist/chunk-H2FA2SBS.mjs.map +0 -1
  108. package/dist/chunk-HNIQFZKB.mjs +0 -3550
  109. package/dist/chunk-HNIQFZKB.mjs.map +0 -1
  110. package/dist/chunk-ITN462YM.mjs +0 -98
  111. package/dist/chunk-ITN462YM.mjs.map +0 -1
  112. package/dist/chunk-J23HNLFY.mjs +0 -72
  113. package/dist/chunk-J23HNLFY.mjs.map +0 -1
  114. package/dist/chunk-J4FNJ5IU.mjs +0 -179
  115. package/dist/chunk-J4FNJ5IU.mjs.map +0 -1
  116. package/dist/chunk-J5YWQVI5.mjs +0 -211
  117. package/dist/chunk-J5YWQVI5.mjs.map +0 -1
  118. package/dist/chunk-JDEOUK5V.mjs +0 -427
  119. package/dist/chunk-JDEOUK5V.mjs.map +0 -1
  120. package/dist/chunk-JK25YEN6.mjs +0 -219
  121. package/dist/chunk-JK25YEN6.mjs.map +0 -1
  122. package/dist/chunk-K4667E2Q.mjs +0 -1916
  123. package/dist/chunk-K4667E2Q.mjs.map +0 -1
  124. package/dist/chunk-LGHEOHBU.mjs +0 -218
  125. package/dist/chunk-LGHEOHBU.mjs.map +0 -1
  126. package/dist/chunk-LLC7BNXW.mjs +0 -275
  127. package/dist/chunk-LLC7BNXW.mjs.map +0 -1
  128. package/dist/chunk-LM2YNO4U.mjs +0 -24
  129. package/dist/chunk-LM2YNO4U.mjs.map +0 -1
  130. package/dist/chunk-MIUW47JX.mjs +0 -639
  131. package/dist/chunk-MIUW47JX.mjs.map +0 -1
  132. package/dist/chunk-NM3CRAAL.mjs +0 -467
  133. package/dist/chunk-NM3CRAAL.mjs.map +0 -1
  134. package/dist/chunk-NNLCAVB6.mjs +0 -391
  135. package/dist/chunk-NNLCAVB6.mjs.map +0 -1
  136. package/dist/chunk-P7QDS5AT.mjs +0 -191
  137. package/dist/chunk-P7QDS5AT.mjs.map +0 -1
  138. package/dist/chunk-PFE6GMNE.mjs +0 -603
  139. package/dist/chunk-PFE6GMNE.mjs.map +0 -1
  140. package/dist/chunk-QGOHVJ6J.mjs +0 -63
  141. package/dist/chunk-QGOHVJ6J.mjs.map +0 -1
  142. package/dist/chunk-QGQX7SFC.mjs +0 -180
  143. package/dist/chunk-QGQX7SFC.mjs.map +0 -1
  144. package/dist/chunk-QKVUNGAH.mjs +0 -39
  145. package/dist/chunk-QKVUNGAH.mjs.map +0 -1
  146. package/dist/chunk-QM746KUO.mjs +0 -56
  147. package/dist/chunk-QM746KUO.mjs.map +0 -1
  148. package/dist/chunk-QTZZ2ISQ.mjs +0 -753
  149. package/dist/chunk-QTZZ2ISQ.mjs.map +0 -1
  150. package/dist/chunk-RBRLLZL5.mjs +0 -81
  151. package/dist/chunk-RBRLLZL5.mjs.map +0 -1
  152. package/dist/chunk-RHIFZZUI.mjs +0 -69
  153. package/dist/chunk-RHIFZZUI.mjs.map +0 -1
  154. package/dist/chunk-RSKVYESE.mjs +0 -187
  155. package/dist/chunk-RSKVYESE.mjs.map +0 -1
  156. package/dist/chunk-SCFX4UTD.mjs +0 -28
  157. package/dist/chunk-SCFX4UTD.mjs.map +0 -1
  158. package/dist/chunk-SL6HTIOK.mjs +0 -66
  159. package/dist/chunk-SL6HTIOK.mjs.map +0 -1
  160. package/dist/chunk-SPBBQLXI.mjs +0 -207
  161. package/dist/chunk-SPBBQLXI.mjs.map +0 -1
  162. package/dist/chunk-T4QJQK76.mjs +0 -459
  163. package/dist/chunk-T4QJQK76.mjs.map +0 -1
  164. package/dist/chunk-TQAEEJB4.mjs +0 -157
  165. package/dist/chunk-TQAEEJB4.mjs.map +0 -1
  166. package/dist/chunk-UB5UOSHB.mjs +0 -458
  167. package/dist/chunk-UB5UOSHB.mjs.map +0 -1
  168. package/dist/chunk-USWZZUEH.mjs +0 -25
  169. package/dist/chunk-USWZZUEH.mjs.map +0 -1
  170. package/dist/chunk-UVCIEUJC.mjs +0 -16
  171. package/dist/chunk-UVCIEUJC.mjs.map +0 -1
  172. package/dist/chunk-UXUAWNO5.mjs +0 -396
  173. package/dist/chunk-UXUAWNO5.mjs.map +0 -1
  174. package/dist/chunk-V3XURYJO.mjs +0 -756
  175. package/dist/chunk-V3XURYJO.mjs.map +0 -1
  176. package/dist/chunk-V6WE6JSZ.mjs +0 -352
  177. package/dist/chunk-V6WE6JSZ.mjs.map +0 -1
  178. package/dist/chunk-V7RBCSDJ.mjs +0 -170
  179. package/dist/chunk-V7RBCSDJ.mjs.map +0 -1
  180. package/dist/chunk-VCANOYFI.mjs +0 -588
  181. package/dist/chunk-VCANOYFI.mjs.map +0 -1
  182. package/dist/chunk-VY2UYN5R.mjs +0 -224
  183. package/dist/chunk-VY2UYN5R.mjs.map +0 -1
  184. package/dist/chunk-W2CRQFF6.mjs +0 -1352
  185. package/dist/chunk-W2CRQFF6.mjs.map +0 -1
  186. package/dist/chunk-WZ5QFROO.mjs +0 -23
  187. package/dist/chunk-WZ5QFROO.mjs.map +0 -1
  188. package/dist/chunk-XIVV5IWN.mjs +0 -541
  189. package/dist/chunk-XIVV5IWN.mjs.map +0 -1
  190. package/dist/chunk-YW7OBE6Q.mjs +0 -119
  191. package/dist/chunk-YW7OBE6Q.mjs.map +0 -1
  192. package/dist/chunk-Z5CQMP54.mjs +0 -365
  193. package/dist/chunk-Z5CQMP54.mjs.map +0 -1
  194. package/dist/chunk-ZBE6MLHL.mjs +0 -230
  195. package/dist/chunk-ZBE6MLHL.mjs.map +0 -1
  196. package/dist/chunk-ZZ57EH5Z.mjs +0 -173
  197. package/dist/chunk-ZZ57EH5Z.mjs.map +0 -1
  198. package/dist/client-BT1mFQas.d.mts +0 -447
  199. package/dist/client-Nn0q4eO4.d.ts +0 -447
  200. package/dist/client-cache-CIlyBlmx.d.ts +0 -6
  201. package/dist/client-cache-D-EZ7XVW.d.mts +0 -6
  202. package/dist/client-plugins-Cw4qUGsw.d.ts +0 -1855
  203. package/dist/client-plugins-DQQ1adXM.d.mts +0 -1855
  204. package/dist/client-plugins.cjs +0 -415
  205. package/dist/client-plugins.cjs.map +0 -1
  206. package/dist/client-plugins.d.mts +0 -22
  207. package/dist/client-plugins.d.ts +0 -22
  208. package/dist/client-plugins.mjs +0 -10
  209. package/dist/client-plugins.mjs.map +0 -1
  210. package/dist/client.cjs +0 -5402
  211. package/dist/client.cjs.map +0 -1
  212. package/dist/client.d.mts +0 -447
  213. package/dist/client.d.ts +0 -447
  214. package/dist/client.mjs +0 -110
  215. package/dist/client.mjs.map +0 -1
  216. package/dist/config.cjs +0 -38
  217. package/dist/config.cjs.map +0 -1
  218. package/dist/config.d.mts +0 -29
  219. package/dist/config.d.ts +0 -29
  220. package/dist/config.mjs +0 -10
  221. package/dist/config.mjs.map +0 -1
  222. package/dist/cron.cjs +0 -406
  223. package/dist/cron.cjs.map +0 -1
  224. package/dist/cron.d.mts +0 -78
  225. package/dist/cron.d.ts +0 -78
  226. package/dist/cron.mjs +0 -30
  227. package/dist/cron.mjs.map +0 -1
  228. package/dist/deferred.cjs +0 -438
  229. package/dist/deferred.cjs.map +0 -1
  230. package/dist/deferred.d.mts +0 -42
  231. package/dist/deferred.d.ts +0 -42
  232. package/dist/deferred.mjs +0 -28
  233. package/dist/deferred.mjs.map +0 -1
  234. package/dist/deployment.cjs +0 -199
  235. package/dist/deployment.cjs.map +0 -1
  236. package/dist/deployment.d.mts +0 -34
  237. package/dist/deployment.d.ts +0 -34
  238. package/dist/deployment.mjs +0 -38
  239. package/dist/deployment.mjs.map +0 -1
  240. package/dist/devtools-LVC3VB5P.mjs +0 -370
  241. package/dist/devtools-LVC3VB5P.mjs.map +0 -1
  242. package/dist/devtools-client-3XRTBND5.mjs +0 -216
  243. package/dist/devtools-client-3XRTBND5.mjs.map +0 -1
  244. package/dist/devtools-ui-NJKFORTG.mjs +0 -1349
  245. package/dist/devtools-ui-NJKFORTG.mjs.map +0 -1
  246. package/dist/docs.cjs +0 -5553
  247. package/dist/docs.cjs.map +0 -1
  248. package/dist/docs.d.mts +0 -69
  249. package/dist/docs.d.ts +0 -69
  250. package/dist/docs.mjs +0 -46
  251. package/dist/docs.mjs.map +0 -1
  252. package/dist/env-types.cjs +0 -223
  253. package/dist/env-types.cjs.map +0 -1
  254. package/dist/env-types.d.mts +0 -11
  255. package/dist/env-types.d.ts +0 -11
  256. package/dist/env-types.mjs +0 -9
  257. package/dist/env-types.mjs.map +0 -1
  258. package/dist/env.cjs +0 -215
  259. package/dist/env.cjs.map +0 -1
  260. package/dist/env.d.mts +0 -45
  261. package/dist/env.d.ts +0 -45
  262. package/dist/env.mjs +0 -22
  263. package/dist/env.mjs.map +0 -1
  264. package/dist/environment/vite.d.mts +0 -22
  265. package/dist/environment/vite.d.ts +0 -22
  266. package/dist/environment.cjs +0 -96
  267. package/dist/environment.cjs.map +0 -1
  268. package/dist/environment.d.mts +0 -18
  269. package/dist/environment.d.ts +0 -18
  270. package/dist/environment.mjs +0 -14
  271. package/dist/environment.mjs.map +0 -1
  272. package/dist/headers.cjs +0 -126
  273. package/dist/headers.cjs.map +0 -1
  274. package/dist/headers.d.mts +0 -22
  275. package/dist/headers.d.ts +0 -22
  276. package/dist/headers.mjs +0 -12
  277. package/dist/headers.mjs.map +0 -1
  278. package/dist/i18n/client.d.mts +0 -32
  279. package/dist/i18n/client.d.ts +0 -32
  280. package/dist/i18n/index.d.mts +0 -20
  281. package/dist/i18n/index.d.ts +0 -20
  282. package/dist/i18n/server.d.mts +0 -30
  283. package/dist/i18n/server.d.ts +0 -30
  284. package/dist/image/server.d.mts +0 -37
  285. package/dist/image/server.d.ts +0 -37
  286. package/dist/image/sharp.d.mts +0 -7
  287. package/dist/image/sharp.d.ts +0 -7
  288. package/dist/image-config-Duob7wER.d.mts +0 -50
  289. package/dist/image-config-Duob7wER.d.ts +0 -50
  290. package/dist/image.cjs +0 -209
  291. package/dist/image.cjs.map +0 -1
  292. package/dist/image.d.mts +0 -39
  293. package/dist/image.d.ts +0 -39
  294. package/dist/image.mjs +0 -165
  295. package/dist/image.mjs.map +0 -1
  296. package/dist/index.cjs +0 -41822
  297. package/dist/index.cjs.map +0 -1
  298. package/dist/index.d.mts +0 -451
  299. package/dist/index.d.ts +0 -451
  300. package/dist/index.mjs +0 -973
  301. package/dist/index.mjs.map +0 -1
  302. package/dist/integration-api-CHT2OKAf.d.mts +0 -93
  303. package/dist/integration-api-CHT2OKAf.d.ts +0 -93
  304. package/dist/integration-orm-GQLGU66X.mjs +0 -13
  305. package/dist/integration-orm-GQLGU66X.mjs.map +0 -1
  306. package/dist/integrations.cjs +0 -2820
  307. package/dist/integrations.cjs.map +0 -1
  308. package/dist/integrations.d.mts +0 -22
  309. package/dist/integrations.d.ts +0 -22
  310. package/dist/integrations.mjs +0 -51
  311. package/dist/integrations.mjs.map +0 -1
  312. package/dist/internal/build-runtime.d.mts +0 -39
  313. package/dist/internal/build-runtime.d.ts +0 -39
  314. package/dist/internal/client-runtime.d.mts +0 -2
  315. package/dist/internal/client-runtime.d.ts +0 -2
  316. package/dist/internal/config-runtime.d.mts +0 -39
  317. package/dist/internal/config-runtime.d.ts +0 -39
  318. package/dist/internal/production-node-env.d.mts +0 -12
  319. package/dist/internal/production-node-env.d.ts +0 -12
  320. package/dist/internal/production-runtime.d.mts +0 -39
  321. package/dist/internal/production-runtime.d.ts +0 -39
  322. package/dist/layers-VWVDTPUZ.mjs +0 -16
  323. package/dist/layers-VWVDTPUZ.mjs.map +0 -1
  324. package/dist/manager-THKFTOFE.mjs +0 -10
  325. package/dist/manager-THKFTOFE.mjs.map +0 -1
  326. package/dist/markdown.cjs +0 -299
  327. package/dist/markdown.cjs.map +0 -1
  328. package/dist/markdown.d.mts +0 -43
  329. package/dist/markdown.d.ts +0 -43
  330. package/dist/markdown.mjs +0 -14
  331. package/dist/markdown.mjs.map +0 -1
  332. package/dist/metadata-BAPg_Nmo.d.ts +0 -22
  333. package/dist/metadata-_6i9oFG3.d.mts +0 -22
  334. package/dist/middleware.cjs +0 -2148
  335. package/dist/middleware.cjs.map +0 -1
  336. package/dist/middleware.d.mts +0 -164
  337. package/dist/middleware.d.ts +0 -164
  338. package/dist/middleware.mjs +0 -49
  339. package/dist/middleware.mjs.map +0 -1
  340. package/dist/navigation-errors-Dvwpzaer.d.mts +0 -13
  341. package/dist/navigation-errors-Dvwpzaer.d.ts +0 -13
  342. package/dist/navigation.cjs +0 -1329
  343. package/dist/navigation.cjs.map +0 -1
  344. package/dist/navigation.d.mts +0 -14
  345. package/dist/navigation.d.ts +0 -14
  346. package/dist/navigation.mjs +0 -33
  347. package/dist/navigation.mjs.map +0 -1
  348. package/dist/nitro-QO5LV6QK.mjs +0 -689
  349. package/dist/nitro-QO5LV6QK.mjs.map +0 -1
  350. package/dist/observability.cjs +0 -186
  351. package/dist/observability.cjs.map +0 -1
  352. package/dist/observability.d.mts +0 -335
  353. package/dist/observability.d.ts +0 -335
  354. package/dist/observability.mjs +0 -16
  355. package/dist/observability.mjs.map +0 -1
  356. package/dist/params-BALtrRim.d.ts +0 -15
  357. package/dist/params-ry-lxqmy.d.mts +0 -15
  358. package/dist/plugin-BJDf43dc.d.mts +0 -165
  359. package/dist/plugin-BJDf43dc.d.ts +0 -165
  360. package/dist/plugin.cjs +0 -23225
  361. package/dist/plugin.d.mts +0 -22
  362. package/dist/plugin.d.ts +0 -22
  363. package/dist/production-runtime-BoJDc5mc.d.ts +0 -79
  364. package/dist/production-runtime-C_B79w2P.d.mts +0 -28
  365. package/dist/production-runtime-DDEM1D2q.d.ts +0 -28
  366. package/dist/production-runtime-DPfgMV9Y.d.mts +0 -79
  367. package/dist/query/client.d.mts +0 -61
  368. package/dist/query/client.d.ts +0 -61
  369. package/dist/query/index.d.mts +0 -90
  370. package/dist/query/index.d.ts +0 -90
  371. package/dist/query/parsers.d.mts +0 -25
  372. package/dist/query/parsers.d.ts +0 -25
  373. package/dist/query/server.d.mts +0 -55
  374. package/dist/query/server.d.ts +0 -55
  375. package/dist/request-BrFBuc8G.d.mts +0 -6
  376. package/dist/request-BslSZIRz.d.ts +0 -6
  377. package/dist/request.d.mts +0 -2
  378. package/dist/request.d.ts +0 -2
  379. package/dist/resolver-C6iecsDV.d.ts +0 -14
  380. package/dist/resolver-DlOPpjkB.d.mts +0 -14
  381. package/dist/route-runtime-DoOHzCAD.d.mts +0 -38
  382. package/dist/route-runtime-DoOHzCAD.d.ts +0 -38
  383. package/dist/router.d.mts +0 -36
  384. package/dist/router.d.ts +0 -36
  385. package/dist/routes.d.mts +0 -224
  386. package/dist/routes.d.ts +0 -224
  387. package/dist/runtime-9nQjVM7X.d.mts +0 -206
  388. package/dist/runtime-B6GvwDS1.d.ts +0 -27
  389. package/dist/runtime-DeAAZ6gO.d.mts +0 -27
  390. package/dist/runtime-DgeS2skB.d.ts +0 -206
  391. package/dist/server-action-security.d.mts +0 -43
  392. package/dist/server-action-security.d.ts +0 -43
  393. package/dist/server-fn-client.d.mts +0 -32
  394. package/dist/server-fn-client.d.ts +0 -32
  395. package/dist/server-fn.d.mts +0 -93
  396. package/dist/server-fn.d.ts +0 -93
  397. package/dist/server-plugins.d.mts +0 -55
  398. package/dist/server-plugins.d.ts +0 -55
  399. package/dist/server-query-client.d.mts +0 -50
  400. package/dist/server-query-client.d.ts +0 -50
  401. package/dist/server-query.d.mts +0 -36
  402. package/dist/server-query.d.ts +0 -36
  403. package/dist/server.d.mts +0 -48
  404. package/dist/server.d.ts +0 -48
  405. package/dist/storage.d.mts +0 -52
  406. package/dist/storage.d.ts +0 -52
  407. package/dist/testing.d.mts +0 -101
  408. package/dist/testing.d.ts +0 -101
  409. package/dist/transport-BmbGTXA5.d.mts +0 -49
  410. package/dist/transport-BmbGTXA5.d.ts +0 -49
  411. package/dist/types-BH1lhg5G.d.mts +0 -81
  412. package/dist/types-BH1lhg5G.d.ts +0 -81
  413. package/dist/types-C9N-nk5R.d.mts +0 -53
  414. package/dist/types-C9N-nk5R.d.ts +0 -53
  415. package/dist/types-D1A6-XvH.d.mts +0 -73
  416. package/dist/types-D1A6-XvH.d.ts +0 -73
  417. package/dist/utils-CHXlMDkg.d.mts +0 -23
  418. package/dist/utils-Drsyz1Vj.d.ts +0 -23
  419. package/dist/version.d.mts +0 -3
  420. package/dist/version.d.ts +0 -3
  421. package/dist/vite.d.mts +0 -22
  422. package/dist/vite.d.ts +0 -22
  423. package/dist/workflows.d.mts +0 -110
  424. package/dist/workflows.d.ts +0 -110
@@ -1,753 +0,0 @@
1
- import {
2
- _hydrateFarmI18n,
3
- getFarmI18nClientState,
4
- isFarmLocaleChangeHref
5
- } from "./chunk-ITN462YM.mjs";
6
- import {
7
- createFarmDeploymentMismatchError,
8
- createFarmDeploymentRequestHeaders,
9
- isFarmDeploymentMismatchResponse
10
- } from "./chunk-B232I2GP.mjs";
11
- import {
12
- readDeferredDataResponse
13
- } from "./chunk-GS6K5OCM.mjs";
14
- import {
15
- stripFarmLocaleFromPathname
16
- } from "./chunk-44ZCFSKE.mjs";
17
- import {
18
- createFarmRouter
19
- } from "./chunk-ZBE6MLHL.mjs";
20
- import {
21
- __name
22
- } from "./chunk-CGILA3WO.mjs";
23
-
24
- // src/client/spa-router.ts
25
- var FARM_PAGE_STATE_KEY = "__farmPageState";
26
- var FARM_INTERCEPT_FROM_KEY = "__farmInterceptFrom";
27
- var IDLE_NAVIGATION_STATE = {
28
- state: "idle",
29
- pending: false,
30
- from: null,
31
- to: null,
32
- action: null,
33
- startedAt: null
34
- };
35
- var routerInstance = null;
36
- var _SPARouter = class _SPARouter {
37
- constructor(options = {}) {
38
- this.cache = /* @__PURE__ */ new Map();
39
- this.prefetchingUrls = /* @__PURE__ */ new Set();
40
- this.observers = /* @__PURE__ */ new Map();
41
- this.blockers = /* @__PURE__ */ new Set();
42
- this.navigationListeners = /* @__PURE__ */ new Set();
43
- this.navigationState = IDLE_NAVIGATION_STATE;
44
- this.scrollElements = /* @__PURE__ */ new Map();
45
- this.options = {
46
- prefetchTimeout: options.prefetchTimeout ?? 100,
47
- cacheMaxAge: options.cacheMaxAge ?? 3e4,
48
- // 30 seconds
49
- scrollRestoration: options.scrollRestoration ?? true,
50
- shouldUseDocumentNavigation: options.shouldUseDocumentNavigation ?? (() => false),
51
- deploymentId: options.deploymentId ?? readBrowserDeploymentId()
52
- };
53
- if (typeof window !== "undefined") {
54
- window.addEventListener("popstate", this.handlePopState.bind(this));
55
- window.addEventListener("beforeunload", (event) => {
56
- if (this.blockers.size > 0) {
57
- event.preventDefault();
58
- event.returnValue = "";
59
- }
60
- this.saveScrollPosition(window.location.pathname);
61
- });
62
- }
63
- }
64
- /**
65
- * Set the navigation handler that updates React
66
- */
67
- setNavigationHandler(handler) {
68
- this.onNavigate = handler;
69
- }
70
- /**
71
- * Connect Farm's browser plugin lifecycle to SPA navigation.
72
- */
73
- setClientPluginManager(manager) {
74
- this.clientPlugins = manager;
75
- }
76
- /**
77
- * Navigate to a new URL
78
- */
79
- async navigate(href, options = {}) {
80
- const { replace = false, scroll = true, state, viewTransition = false } = options;
81
- const url = new URL(href, window.location.origin);
82
- const pathname = url.pathname;
83
- const search = url.search;
84
- const fullPath = pathname + search;
85
- if (isFarmLocaleChangeHref(url.toString()) || this.options.shouldUseDocumentNavigation(pathname)) {
86
- if (replace) window.location.replace(url.toString());
87
- else window.location.assign(url.toString());
88
- return;
89
- }
90
- if (pathname === window.location.pathname && search === window.location.search) {
91
- if (url.hash) {
92
- window.location.hash = url.hash;
93
- }
94
- return;
95
- }
96
- const from = window.location.pathname + window.location.search;
97
- if (await this.shouldBlockNavigation({
98
- from,
99
- to: fullPath,
100
- action: replace ? "replace" : "push"
101
- })) {
102
- return;
103
- }
104
- if (this.options.scrollRestoration) {
105
- this.saveScrollPosition(window.location.pathname);
106
- }
107
- this.startNavigation({
108
- from,
109
- to: createNavigationLocation(url),
110
- action: replace ? "replace" : "push"
111
- });
112
- let clientNavigation;
113
- try {
114
- clientNavigation = await this.clientPlugins?.beginNavigation({
115
- from,
116
- to: url,
117
- action: replace ? "replace" : "push"
118
- });
119
- const pageData = await this.fetchPageData(fullPath, true, from);
120
- if (clientNavigation) {
121
- await this.clientPlugins?.markNavigationLoaded(clientNavigation, pageData);
122
- }
123
- if (pageData.isClientComponent === false && !pageData.interception) {
124
- this.finishNavigation();
125
- window.location.assign(pageData.canonicalPath || fullPath);
126
- return;
127
- }
128
- await this.runViewTransition(
129
- viewTransition,
130
- () => this.commitNavigation({
131
- fullPath,
132
- pageData,
133
- pathname,
134
- replace,
135
- scroll,
136
- state,
137
- url
138
- })
139
- );
140
- if (clientNavigation) {
141
- await this.clientPlugins?.resolveNavigation(clientNavigation);
142
- void this.clientPlugins?.scheduleNavigationRendered(clientNavigation);
143
- }
144
- this.finishNavigation();
145
- } catch (error) {
146
- if (clientNavigation) {
147
- await this.clientPlugins?.failNavigation(clientNavigation, error);
148
- }
149
- this.finishNavigation();
150
- console.error("[Farm.js] Navigation error:", error);
151
- window.location.href = href;
152
- }
153
- }
154
- /**
155
- * Prefetch a URL
156
- */
157
- async prefetch(href) {
158
- if (isFarmLocaleChangeHref(href)) return;
159
- const url = new URL(href, window.location.origin);
160
- const fullPath = url.pathname + url.search;
161
- const interceptFrom = window.location.pathname + window.location.search;
162
- if (this.prefetchingUrls.has(fullPath)) return;
163
- if (this.isCached(fullPath, interceptFrom)) return;
164
- this.prefetchingUrls.add(fullPath);
165
- try {
166
- await this.fetchPageData(fullPath, false, interceptFrom);
167
- } catch (error) {
168
- console.warn("[Farm.js] Prefetch failed:", href, error);
169
- } finally {
170
- this.prefetchingUrls.delete(fullPath);
171
- }
172
- }
173
- /**
174
- * Observe an element for viewport intersection (prefetch when visible)
175
- */
176
- observeForPrefetch(element) {
177
- if (typeof IntersectionObserver === "undefined") return;
178
- const href = element.getAttribute("href");
179
- if (!href || this.isExternalUrl(href)) return;
180
- const observer = new IntersectionObserver(
181
- (entries) => {
182
- for (const entry of entries) {
183
- if (entry.isIntersecting) {
184
- setTimeout(() => {
185
- this.prefetch(href);
186
- }, this.options.prefetchTimeout);
187
- observer.unobserve(element);
188
- this.observers.delete(element);
189
- }
190
- }
191
- },
192
- { rootMargin: "200px" }
193
- // Start prefetching when 200px from viewport
194
- );
195
- observer.observe(element);
196
- this.observers.set(element, observer);
197
- }
198
- /**
199
- * Stop observing an element
200
- */
201
- unobserveForPrefetch(element) {
202
- const observer = this.observers.get(element);
203
- if (observer) {
204
- observer.unobserve(element);
205
- this.observers.delete(element);
206
- }
207
- }
208
- addBlocker(blocker) {
209
- this.blockers.add(blocker);
210
- return () => {
211
- this.blockers.delete(blocker);
212
- };
213
- }
214
- getNavigationState() {
215
- return this.navigationState;
216
- }
217
- subscribeNavigation(listener) {
218
- this.navigationListeners.add(listener);
219
- listener(this.navigationState);
220
- return () => {
221
- this.navigationListeners.delete(listener);
222
- };
223
- }
224
- registerScrollElement(key, element) {
225
- this.scrollElements.set(key, element);
226
- this.restoreScrollElement(window.location.pathname, key, element);
227
- return () => {
228
- if (this.scrollElements.get(key) === element) {
229
- this.scrollElements.delete(key);
230
- }
231
- };
232
- }
233
- pushState(state, href) {
234
- this.writePageState("push", state, href);
235
- }
236
- replaceState(state, href) {
237
- this.writePageState("replace", state, href);
238
- }
239
- async commitNavigation(options) {
240
- const historyPath = options.pageData.canonicalPath || options.fullPath;
241
- const historyState = createHistoryState(
242
- historyPath,
243
- options.state,
244
- void 0,
245
- options.pageData.interception?.from ?? null
246
- );
247
- if (options.replace) {
248
- window.history.replaceState(historyState, "", historyPath);
249
- } else {
250
- window.history.pushState(historyState, "", historyPath);
251
- }
252
- if (options.pageData.metadata?.title) {
253
- document.title = options.pageData.metadata.title;
254
- }
255
- if (options.pageData.metadata?.description) {
256
- let metaDesc = document.querySelector('meta[name="description"]');
257
- if (!metaDesc) {
258
- metaDesc = document.createElement("meta");
259
- metaDesc.setAttribute("name", "description");
260
- document.head.appendChild(metaDesc);
261
- }
262
- metaDesc.setAttribute("content", options.pageData.metadata.description);
263
- }
264
- _hydrateFarmI18n(options.pageData.i18n);
265
- if (this.onNavigate) {
266
- await this.onNavigate(options.pageData);
267
- }
268
- if (options.scroll) {
269
- if (options.url.hash) {
270
- const element = document.querySelector(options.url.hash);
271
- if (element) {
272
- element.scrollIntoView();
273
- }
274
- } else {
275
- window.scrollTo(0, 0);
276
- }
277
- } else if (this.options.scrollRestoration) {
278
- this.restoreScrollPosition(options.pathname);
279
- }
280
- }
281
- async runViewTransition(mode, callback) {
282
- if (!mode || typeof document === "undefined") {
283
- await callback();
284
- return;
285
- }
286
- const startViewTransition = document.startViewTransition;
287
- if (typeof startViewTransition !== "function") {
288
- await callback();
289
- return;
290
- }
291
- const transition = startViewTransition.call(document, () => callback());
292
- const updateDone = transition?.updateCallbackDone || transition?.ready;
293
- if (updateDone && typeof updateDone.then === "function") {
294
- await updateDone;
295
- }
296
- transition?.finished?.catch?.(() => void 0);
297
- }
298
- /**
299
- * Fetch page data from cache or server
300
- */
301
- async fetchPageData(path, recover = true, interceptFrom) {
302
- const cacheKey = getPageDataCacheKey(path, interceptFrom);
303
- const cached = this.cache.get(cacheKey);
304
- if (cached && Date.now() - cached.timestamp < this.options.cacheMaxAge) {
305
- return cached.data;
306
- }
307
- const response = await fetch(`/__farm/page-data?path=${encodeURIComponent(path)}`, {
308
- headers: createFarmDeploymentRequestHeaders(this.options.deploymentId, {
309
- Accept: "application/x-farm-deferred+json, application/json",
310
- "X-Farm-SPA": "1",
311
- ...interceptFrom ? { "X-Farm-Intercept-From": interceptFrom } : {}
312
- })
313
- });
314
- if (isFarmDeploymentMismatchResponse(response, this.options.deploymentId)) {
315
- const error = createFarmDeploymentMismatchError(
316
- response,
317
- this.options.deploymentId || "unknown"
318
- );
319
- dispatchDeploymentMismatch(error);
320
- if (recover) {
321
- window.location.assign(path);
322
- }
323
- throw error;
324
- }
325
- if (!response.ok) {
326
- throw new Error(`Failed to fetch page data: ${response.status}`);
327
- }
328
- const data = await readDeferredDataResponse(response);
329
- this.cache.set(cacheKey, {
330
- data,
331
- timestamp: Date.now()
332
- });
333
- return data;
334
- }
335
- /**
336
- * Handle browser back/forward navigation
337
- */
338
- async handlePopState(event) {
339
- if (document.documentElement.dataset.farmDocsRuntime === "true") return;
340
- const path = window.location.pathname + window.location.search;
341
- if (await this.shouldBlockNavigation({
342
- from: event.state?.path || path,
343
- to: path,
344
- action: "pop"
345
- })) {
346
- return;
347
- }
348
- this.startNavigation({
349
- from: event.state?.path || path,
350
- to: createNavigationLocation(new URL(window.location.href)),
351
- action: "pop"
352
- });
353
- let clientNavigation;
354
- try {
355
- clientNavigation = await this.clientPlugins?.beginNavigation({
356
- from: null,
357
- to: window.location.href,
358
- action: "pop"
359
- });
360
- const interceptFrom = typeof event.state?.[FARM_INTERCEPT_FROM_KEY] === "string" ? event.state[FARM_INTERCEPT_FROM_KEY] : void 0;
361
- const pageData = await this.fetchPageData(path, true, interceptFrom);
362
- if (clientNavigation) {
363
- await this.clientPlugins?.markNavigationLoaded(clientNavigation, pageData);
364
- }
365
- if (pageData.metadata?.title) {
366
- document.title = pageData.metadata.title;
367
- }
368
- _hydrateFarmI18n(pageData.i18n);
369
- if (this.onNavigate) {
370
- await this.onNavigate(pageData);
371
- }
372
- if (this.options.scrollRestoration) {
373
- this.restoreScrollPosition(window.location.pathname);
374
- }
375
- if (clientNavigation) {
376
- await this.clientPlugins?.resolveNavigation(clientNavigation);
377
- void this.clientPlugins?.scheduleNavigationRendered(clientNavigation);
378
- }
379
- this.finishNavigation();
380
- } catch (error) {
381
- if (clientNavigation) {
382
- await this.clientPlugins?.failNavigation(clientNavigation, error);
383
- }
384
- this.finishNavigation();
385
- console.error("[Farm.js] Popstate navigation error:", error);
386
- window.location.reload();
387
- }
388
- }
389
- /**
390
- * Check if URL is cached
391
- */
392
- isCached(path, interceptFrom) {
393
- const cached = this.cache.get(getPageDataCacheKey(path, interceptFrom));
394
- return cached !== void 0 && Date.now() - cached.timestamp < this.options.cacheMaxAge;
395
- }
396
- /**
397
- * Check if URL is external
398
- */
399
- isExternalUrl(href) {
400
- return href.startsWith("http://") || href.startsWith("https://") || href.startsWith("//");
401
- }
402
- async shouldBlockNavigation(context) {
403
- for (const blocker of this.blockers) {
404
- if (await blocker(context)) {
405
- return true;
406
- }
407
- }
408
- return false;
409
- }
410
- startNavigation(options) {
411
- this.setNavigationState({
412
- state: "loading",
413
- pending: true,
414
- from: options.from,
415
- to: options.to,
416
- action: options.action,
417
- startedAt: Date.now()
418
- });
419
- }
420
- finishNavigation() {
421
- this.setNavigationState(IDLE_NAVIGATION_STATE);
422
- }
423
- setNavigationState(state) {
424
- this.navigationState = state;
425
- for (const listener of this.navigationListeners) {
426
- listener(state);
427
- }
428
- }
429
- writePageState(action, state, href) {
430
- if (typeof window === "undefined") return;
431
- const url = href ? new URL(href, window.location.origin).toString() : window.location.href;
432
- const nextState = createHistoryState(
433
- new URL(url).pathname + new URL(url).search,
434
- state,
435
- window.history.state
436
- );
437
- if (action === "replace") {
438
- window.history.replaceState(nextState, "", url);
439
- } else {
440
- window.history.pushState(nextState, "", url);
441
- }
442
- window.dispatchEvent(new PopStateEvent("popstate", { state: nextState }));
443
- }
444
- /**
445
- * Save scroll position for a path
446
- */
447
- saveScrollPosition(path) {
448
- try {
449
- sessionStorage.setItem(
450
- `farm-scroll-${path}`,
451
- JSON.stringify({ x: window.scrollX, y: window.scrollY })
452
- );
453
- for (const [key, element] of this.scrollElements) {
454
- sessionStorage.setItem(
455
- getScrollElementStorageKey(path, key),
456
- JSON.stringify({ x: element.scrollLeft, y: element.scrollTop })
457
- );
458
- }
459
- } catch {
460
- }
461
- }
462
- /**
463
- * Restore scroll position for a path
464
- */
465
- restoreScrollPosition(path) {
466
- try {
467
- const saved = sessionStorage.getItem(`farm-scroll-${path}`);
468
- if (saved) {
469
- const { x, y } = JSON.parse(saved);
470
- setTimeout(() => window.scrollTo(x, y), 0);
471
- }
472
- for (const [key, element] of this.scrollElements) {
473
- this.restoreScrollElement(path, key, element);
474
- }
475
- } catch {
476
- }
477
- }
478
- restoreScrollElement(path, key, element) {
479
- try {
480
- const saved = sessionStorage.getItem(getScrollElementStorageKey(path, key));
481
- if (!saved) return;
482
- const { x, y } = JSON.parse(saved);
483
- setTimeout(() => {
484
- element.scrollLeft = x;
485
- element.scrollTop = y;
486
- }, 0);
487
- } catch {
488
- }
489
- }
490
- /**
491
- * Clear the page cache
492
- */
493
- clearCache() {
494
- this.cache.clear();
495
- }
496
- };
497
- __name(_SPARouter, "SPARouter");
498
- var SPARouter = _SPARouter;
499
- function readBrowserDeploymentId() {
500
- if (typeof window === "undefined") return void 0;
501
- const runtimeId = window.__FARM_DEPLOYMENT_ID__;
502
- if (typeof runtimeId === "string" && runtimeId) return runtimeId;
503
- return document.querySelector('meta[name="farm-deployment-id"]')?.content;
504
- }
505
- __name(readBrowserDeploymentId, "readBrowserDeploymentId");
506
- function dispatchDeploymentMismatch(error) {
507
- if (typeof window === "undefined" || typeof CustomEvent === "undefined") return;
508
- window.dispatchEvent(new CustomEvent("farm:deployment-mismatch", { detail: error }));
509
- }
510
- __name(dispatchDeploymentMismatch, "dispatchDeploymentMismatch");
511
- function getRouter() {
512
- if (typeof window === "undefined") {
513
- return new SPARouter();
514
- }
515
- const installedRouter = window.__FARM_SPA_ROUTER__;
516
- if (installedRouter) {
517
- routerInstance = installedRouter;
518
- return installedRouter;
519
- }
520
- if (!routerInstance) {
521
- routerInstance = new SPARouter();
522
- }
523
- return routerInstance;
524
- }
525
- __name(getRouter, "getRouter");
526
- function navigateTo(href, options) {
527
- return getRouter().navigate(href, options);
528
- }
529
- __name(navigateTo, "navigateTo");
530
- function prefetch(href) {
531
- return getRouter().prefetch(href);
532
- }
533
- __name(prefetch, "prefetch");
534
- function pushState(state, href) {
535
- getRouter().pushState(state, href);
536
- }
537
- __name(pushState, "pushState");
538
- function replaceState(state, href) {
539
- getRouter().replaceState(state, href);
540
- }
541
- __name(replaceState, "replaceState");
542
- function readPageState() {
543
- if (typeof window === "undefined") return null;
544
- const state = window.history.state;
545
- if (!state || typeof state !== "object") return null;
546
- return state[FARM_PAGE_STATE_KEY] ?? null;
547
- }
548
- __name(readPageState, "readPageState");
549
- function createHistoryState(path, pageState, currentState, interceptFrom) {
550
- const base = currentState && typeof currentState === "object" ? { ...currentState } : {};
551
- const nextState = {
552
- ...base,
553
- path,
554
- [FARM_PAGE_STATE_KEY]: pageState
555
- };
556
- if (interceptFrom === null) {
557
- delete nextState[FARM_INTERCEPT_FROM_KEY];
558
- } else if (interceptFrom) {
559
- nextState[FARM_INTERCEPT_FROM_KEY] = interceptFrom;
560
- }
561
- return nextState;
562
- }
563
- __name(createHistoryState, "createHistoryState");
564
- function getPageDataCacheKey(path, interceptFrom) {
565
- return interceptFrom ? `${path}
566
- intercept:${interceptFrom}` : path;
567
- }
568
- __name(getPageDataCacheKey, "getPageDataCacheKey");
569
- function createNavigationLocation(url) {
570
- return {
571
- href: url.href,
572
- pathname: url.pathname,
573
- search: url.search,
574
- hash: url.hash
575
- };
576
- }
577
- __name(createNavigationLocation, "createNavigationLocation");
578
- function getScrollElementStorageKey(path, key) {
579
- return `farm-scroll-${path}:${key}`;
580
- }
581
- __name(getScrollElementStorageKey, "getScrollElementStorageKey");
582
-
583
- // src/client/router.ts
584
- import { useEffect, useMemo, useRef, useState } from "react";
585
- function useRouter(options = {}) {
586
- const basePath = options.basePath || "";
587
- const routes = options.routes;
588
- const routeKey = routes?.map((route) => typeof route === "string" ? route : route.path).join("\n") || "";
589
- const routeMatcher = useMemo(
590
- () => routeKey ? createFarmRouter(routeKey.split("\n")) : null,
591
- [routeKey]
592
- );
593
- const [state, setState] = useState(() => {
594
- return readRouterState(basePath, routeMatcher);
595
- });
596
- useEffect(() => {
597
- if (typeof window === "undefined") return;
598
- const handlePopState = /* @__PURE__ */ __name(() => {
599
- setState(readRouterState(basePath, routeMatcher));
600
- }, "handlePopState");
601
- handlePopState();
602
- window.addEventListener("popstate", handlePopState);
603
- return () => window.removeEventListener("popstate", handlePopState);
604
- }, [basePath, routeMatcher]);
605
- const push = /* @__PURE__ */ __name((href) => {
606
- if (typeof window === "undefined") return;
607
- const url = href.startsWith("/") ? basePath + href : href;
608
- window.history.pushState(null, "", url);
609
- window.dispatchEvent(new PopStateEvent("popstate"));
610
- }, "push");
611
- const replace = /* @__PURE__ */ __name((href) => {
612
- if (typeof window === "undefined") return;
613
- const url = href.startsWith("/") ? basePath + href : href;
614
- window.history.replaceState(null, "", url);
615
- window.dispatchEvent(new PopStateEvent("popstate"));
616
- }, "replace");
617
- const pushState2 = /* @__PURE__ */ __name((pageState, href) => {
618
- if (typeof window === "undefined") return;
619
- getRouter().pushState(pageState, resolveClientHref(href, basePath));
620
- }, "pushState");
621
- const replaceState2 = /* @__PURE__ */ __name((pageState, href) => {
622
- if (typeof window === "undefined") return;
623
- getRouter().replaceState(pageState, resolveClientHref(href, basePath));
624
- }, "replaceState");
625
- const back = /* @__PURE__ */ __name(() => {
626
- if (typeof window !== "undefined") {
627
- window.history.back();
628
- }
629
- }, "back");
630
- const forward = /* @__PURE__ */ __name(() => {
631
- if (typeof window !== "undefined") {
632
- window.history.forward();
633
- }
634
- }, "forward");
635
- return {
636
- ...state,
637
- push,
638
- replace,
639
- pushState: pushState2,
640
- replaceState: replaceState2,
641
- back,
642
- forward
643
- };
644
- }
645
- __name(useRouter, "useRouter");
646
- function usePageState() {
647
- const [state, setState] = useState(() => readPageState());
648
- useEffect(() => {
649
- if (typeof window === "undefined") return;
650
- const handlePopState = /* @__PURE__ */ __name(() => {
651
- setState(readPageState());
652
- }, "handlePopState");
653
- handlePopState();
654
- window.addEventListener("popstate", handlePopState);
655
- return () => window.removeEventListener("popstate", handlePopState);
656
- }, []);
657
- return state;
658
- }
659
- __name(usePageState, "usePageState");
660
- function useNavigation() {
661
- const [state, setState] = useState(
662
- () => getRouter().getNavigationState()
663
- );
664
- useEffect(() => {
665
- if (typeof window === "undefined") return;
666
- return getRouter().subscribeNavigation(setState);
667
- }, []);
668
- return state;
669
- }
670
- __name(useNavigation, "useNavigation");
671
- function useBlocker(options) {
672
- const optionsRef = useRef(options);
673
- optionsRef.current = options;
674
- const active = Boolean(options.when);
675
- useEffect(() => {
676
- if (typeof window === "undefined" || !active) {
677
- return;
678
- }
679
- return getRouter().addBlocker(async (context) => {
680
- const current = optionsRef.current;
681
- const when = typeof current.when === "function" ? current.when(context) : current.when;
682
- if (!when) return false;
683
- if (current.shouldBlock && !await current.shouldBlock(context)) {
684
- return false;
685
- }
686
- if (current.message && typeof window.confirm === "function") {
687
- return !window.confirm(current.message);
688
- }
689
- return true;
690
- });
691
- }, [active]);
692
- return { active };
693
- }
694
- __name(useBlocker, "useBlocker");
695
- function useScrollRestoration(key) {
696
- const ref = useRef(null);
697
- useEffect(() => {
698
- const element = ref.current;
699
- if (!element) return;
700
- return getRouter().registerScrollElement(key, element);
701
- }, [key]);
702
- return ref;
703
- }
704
- __name(useScrollRestoration, "useScrollRestoration");
705
- function readRouterState(basePath, routeMatcher) {
706
- if (typeof window === "undefined") {
707
- return {
708
- pathname: "/",
709
- searchParams: new URLSearchParams(),
710
- params: {},
711
- pageState: null
712
- };
713
- }
714
- const url = new URL(window.location.href);
715
- const pathname = normalizeClientPathname(url.pathname, basePath);
716
- const i18n = getFarmI18nClientState();
717
- const routePathname = i18n ? stripFarmLocaleFromPathname(pathname, i18n) : pathname;
718
- return {
719
- pathname,
720
- searchParams: url.searchParams,
721
- params: routeMatcher?.match(routePathname)?.params || {},
722
- pageState: readPageState()
723
- };
724
- }
725
- __name(readRouterState, "readRouterState");
726
- function normalizeClientPathname(pathname, basePath) {
727
- const normalizedBase = basePath.replace(/\/+$/, "");
728
- const isUnderBase = normalizedBase && (pathname === normalizedBase || pathname.startsWith(`${normalizedBase}/`));
729
- const withoutBase = isUnderBase ? pathname.slice(normalizedBase.length) || "/" : pathname;
730
- return withoutBase || "/";
731
- }
732
- __name(normalizeClientPathname, "normalizeClientPathname");
733
- function resolveClientHref(href, basePath) {
734
- if (!href) return void 0;
735
- return href.startsWith("/") ? basePath + href : href;
736
- }
737
- __name(resolveClientHref, "resolveClientHref");
738
-
739
- export {
740
- SPARouter,
741
- getRouter,
742
- navigateTo,
743
- prefetch,
744
- pushState,
745
- replaceState,
746
- readPageState,
747
- useRouter,
748
- usePageState,
749
- useNavigation,
750
- useBlocker,
751
- useScrollRestoration
752
- };
753
- //# sourceMappingURL=chunk-QTZZ2ISQ.mjs.map