@farm.js/core 0.1.0-beta.4 → 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 (441) hide show
  1. package/dist/internal/build-runtime.cjs +1 -1
  2. package/dist/internal/build-runtime.cjs.map +1 -1
  3. package/dist/internal/build-runtime.mjs +5 -5
  4. package/dist/plugin.cjs.map +1 -1
  5. package/dist/plugin.mjs +4 -4
  6. package/dist/server-query-client.cjs +1 -1
  7. package/dist/server-query-client.cjs.map +1 -1
  8. package/dist/server-query-client.mjs +1 -1
  9. package/dist/server.cjs +1 -1
  10. package/dist/server.cjs.map +1 -1
  11. package/dist/server.mjs +4 -4
  12. package/dist/version.cjs +1 -1
  13. package/dist/version.cjs.map +1 -1
  14. package/dist/version.mjs +1 -1
  15. package/dist/vite.cjs +1 -1
  16. package/dist/vite.cjs.map +1 -1
  17. package/dist/vite.mjs +4 -4
  18. package/package.json +1 -1
  19. package/dist/after.cjs +0 -227
  20. package/dist/after.cjs.map +0 -1
  21. package/dist/after.d.mts +0 -25
  22. package/dist/after.d.ts +0 -25
  23. package/dist/after.mjs +0 -14
  24. package/dist/after.mjs.map +0 -1
  25. package/dist/agent-runtime.cjs +0 -2379
  26. package/dist/agent-runtime.cjs.map +0 -1
  27. package/dist/agent-runtime.d.mts +0 -94
  28. package/dist/agent-runtime.d.ts +0 -94
  29. package/dist/agent-runtime.mjs +0 -479
  30. package/dist/agent-runtime.mjs.map +0 -1
  31. package/dist/api/route-manager.d.mts +0 -66
  32. package/dist/api/route-manager.d.ts +0 -66
  33. package/dist/api/runtime.d.mts +0 -3
  34. package/dist/api/runtime.d.ts +0 -3
  35. package/dist/api.cjs +0 -4100
  36. package/dist/api.cjs.map +0 -1
  37. package/dist/api.d.mts +0 -48
  38. package/dist/api.d.ts +0 -48
  39. package/dist/api.mjs +0 -93
  40. package/dist/api.mjs.map +0 -1
  41. package/dist/app-BjN-da13.d.ts +0 -300
  42. package/dist/app-CakAr8Be.d.mts +0 -300
  43. package/dist/app-markdown.cjs +0 -220
  44. package/dist/app-markdown.cjs.map +0 -1
  45. package/dist/app-markdown.d.mts +0 -22
  46. package/dist/app-markdown.d.ts +0 -22
  47. package/dist/app-markdown.mjs +0 -26
  48. package/dist/app-markdown.mjs.map +0 -1
  49. package/dist/cache.cjs +0 -945
  50. package/dist/cache.cjs.map +0 -1
  51. package/dist/cache.d.mts +0 -192
  52. package/dist/cache.d.ts +0 -192
  53. package/dist/cache.mjs +0 -46
  54. package/dist/cache.mjs.map +0 -1
  55. package/dist/chunk-2CUKEMVR.mjs +0 -872
  56. package/dist/chunk-2CUKEMVR.mjs.map +0 -1
  57. package/dist/chunk-2ED5Q2GH.mjs +0 -422
  58. package/dist/chunk-2ED5Q2GH.mjs.map +0 -1
  59. package/dist/chunk-32W4QEJP.mjs +0 -158
  60. package/dist/chunk-32W4QEJP.mjs.map +0 -1
  61. package/dist/chunk-3U3ZUQAQ.mjs +0 -41
  62. package/dist/chunk-3U3ZUQAQ.mjs.map +0 -1
  63. package/dist/chunk-3XNTL3FQ.mjs +0 -452
  64. package/dist/chunk-3XNTL3FQ.mjs.map +0 -1
  65. package/dist/chunk-44ZCFSKE.mjs +0 -84
  66. package/dist/chunk-44ZCFSKE.mjs.map +0 -1
  67. package/dist/chunk-4S3ORGFA.mjs +0 -44
  68. package/dist/chunk-4S3ORGFA.mjs.map +0 -1
  69. package/dist/chunk-5BY76U2M.mjs +0 -1
  70. package/dist/chunk-5BY76U2M.mjs.map +0 -1
  71. package/dist/chunk-5ZGPRGWV.mjs +0 -136
  72. package/dist/chunk-5ZGPRGWV.mjs.map +0 -1
  73. package/dist/chunk-65A7QIKI.mjs +0 -142
  74. package/dist/chunk-65A7QIKI.mjs.map +0 -1
  75. package/dist/chunk-74YTBPTY.mjs +0 -450
  76. package/dist/chunk-74YTBPTY.mjs.map +0 -1
  77. package/dist/chunk-7HO6AEOP.mjs +0 -74
  78. package/dist/chunk-7HO6AEOP.mjs.map +0 -1
  79. package/dist/chunk-7MABZJIM.mjs +0 -29
  80. package/dist/chunk-7MABZJIM.mjs.map +0 -1
  81. package/dist/chunk-7ZY5AIJO.mjs +0 -161
  82. package/dist/chunk-7ZY5AIJO.mjs.map +0 -1
  83. package/dist/chunk-AJWRO5WE.mjs +0 -6241
  84. package/dist/chunk-AJWRO5WE.mjs.map +0 -1
  85. package/dist/chunk-ALCLXXTY.mjs +0 -187
  86. package/dist/chunk-ALCLXXTY.mjs.map +0 -1
  87. package/dist/chunk-AOBXKNS5.mjs +0 -7631
  88. package/dist/chunk-AOBXKNS5.mjs.map +0 -1
  89. package/dist/chunk-AZ7YUVNR.mjs +0 -65
  90. package/dist/chunk-AZ7YUVNR.mjs.map +0 -1
  91. package/dist/chunk-B232I2GP.mjs +0 -163
  92. package/dist/chunk-B232I2GP.mjs.map +0 -1
  93. package/dist/chunk-BHG3LVHH.mjs +0 -176
  94. package/dist/chunk-BHG3LVHH.mjs.map +0 -1
  95. package/dist/chunk-C2ROET2V.mjs +0 -718
  96. package/dist/chunk-C2ROET2V.mjs.map +0 -1
  97. package/dist/chunk-C3DLZMBU.mjs +0 -597
  98. package/dist/chunk-C3DLZMBU.mjs.map +0 -1
  99. package/dist/chunk-CGILA3WO.mjs +0 -14
  100. package/dist/chunk-CGILA3WO.mjs.map +0 -1
  101. package/dist/chunk-E2MPIBRE.mjs +0 -149
  102. package/dist/chunk-E2MPIBRE.mjs.map +0 -1
  103. package/dist/chunk-E6EPN5BT.mjs +0 -203
  104. package/dist/chunk-E6EPN5BT.mjs.map +0 -1
  105. package/dist/chunk-EJ7T4TPB.mjs +0 -622
  106. package/dist/chunk-EJ7T4TPB.mjs.map +0 -1
  107. package/dist/chunk-FQYDHKKU.mjs +0 -128
  108. package/dist/chunk-FQYDHKKU.mjs.map +0 -1
  109. package/dist/chunk-FRPWCMMG.mjs +0 -299
  110. package/dist/chunk-FRPWCMMG.mjs.map +0 -1
  111. package/dist/chunk-GN72QAIH.mjs +0 -146
  112. package/dist/chunk-GN72QAIH.mjs.map +0 -1
  113. package/dist/chunk-GQVGIUSN.mjs +0 -149
  114. package/dist/chunk-GQVGIUSN.mjs.map +0 -1
  115. package/dist/chunk-GS6K5OCM.mjs +0 -407
  116. package/dist/chunk-GS6K5OCM.mjs.map +0 -1
  117. package/dist/chunk-GXASWWJU.mjs +0 -364
  118. package/dist/chunk-GXASWWJU.mjs.map +0 -1
  119. package/dist/chunk-GY2STC2S.mjs +0 -180
  120. package/dist/chunk-GY2STC2S.mjs.map +0 -1
  121. package/dist/chunk-H2FA2SBS.mjs +0 -51
  122. package/dist/chunk-H2FA2SBS.mjs.map +0 -1
  123. package/dist/chunk-HNIQFZKB.mjs +0 -3550
  124. package/dist/chunk-HNIQFZKB.mjs.map +0 -1
  125. package/dist/chunk-ITN462YM.mjs +0 -98
  126. package/dist/chunk-ITN462YM.mjs.map +0 -1
  127. package/dist/chunk-J23HNLFY.mjs +0 -72
  128. package/dist/chunk-J23HNLFY.mjs.map +0 -1
  129. package/dist/chunk-J4FNJ5IU.mjs +0 -179
  130. package/dist/chunk-J4FNJ5IU.mjs.map +0 -1
  131. package/dist/chunk-JDEOUK5V.mjs +0 -427
  132. package/dist/chunk-JDEOUK5V.mjs.map +0 -1
  133. package/dist/chunk-JK25YEN6.mjs +0 -219
  134. package/dist/chunk-JK25YEN6.mjs.map +0 -1
  135. package/dist/chunk-K4667E2Q.mjs +0 -1916
  136. package/dist/chunk-K4667E2Q.mjs.map +0 -1
  137. package/dist/chunk-LGHEOHBU.mjs +0 -218
  138. package/dist/chunk-LGHEOHBU.mjs.map +0 -1
  139. package/dist/chunk-LLC7BNXW.mjs +0 -275
  140. package/dist/chunk-LLC7BNXW.mjs.map +0 -1
  141. package/dist/chunk-LM2YNO4U.mjs +0 -24
  142. package/dist/chunk-LM2YNO4U.mjs.map +0 -1
  143. package/dist/chunk-MIUW47JX.mjs +0 -639
  144. package/dist/chunk-MIUW47JX.mjs.map +0 -1
  145. package/dist/chunk-NM3CRAAL.mjs +0 -467
  146. package/dist/chunk-NM3CRAAL.mjs.map +0 -1
  147. package/dist/chunk-NNLCAVB6.mjs +0 -391
  148. package/dist/chunk-NNLCAVB6.mjs.map +0 -1
  149. package/dist/chunk-P7QDS5AT.mjs +0 -191
  150. package/dist/chunk-P7QDS5AT.mjs.map +0 -1
  151. package/dist/chunk-PFE6GMNE.mjs +0 -603
  152. package/dist/chunk-PFE6GMNE.mjs.map +0 -1
  153. package/dist/chunk-QGOHVJ6J.mjs +0 -63
  154. package/dist/chunk-QGOHVJ6J.mjs.map +0 -1
  155. package/dist/chunk-QGQX7SFC.mjs +0 -180
  156. package/dist/chunk-QGQX7SFC.mjs.map +0 -1
  157. package/dist/chunk-QKVUNGAH.mjs +0 -39
  158. package/dist/chunk-QKVUNGAH.mjs.map +0 -1
  159. package/dist/chunk-QM746KUO.mjs +0 -56
  160. package/dist/chunk-QM746KUO.mjs.map +0 -1
  161. package/dist/chunk-RBRLLZL5.mjs +0 -81
  162. package/dist/chunk-RBRLLZL5.mjs.map +0 -1
  163. package/dist/chunk-RHIFZZUI.mjs +0 -69
  164. package/dist/chunk-RHIFZZUI.mjs.map +0 -1
  165. package/dist/chunk-RSKVYESE.mjs +0 -187
  166. package/dist/chunk-RSKVYESE.mjs.map +0 -1
  167. package/dist/chunk-SADGIRS2.mjs +0 -211
  168. package/dist/chunk-SADGIRS2.mjs.map +0 -1
  169. package/dist/chunk-SCFX4UTD.mjs +0 -28
  170. package/dist/chunk-SCFX4UTD.mjs.map +0 -1
  171. package/dist/chunk-SL6HTIOK.mjs +0 -66
  172. package/dist/chunk-SL6HTIOK.mjs.map +0 -1
  173. package/dist/chunk-SPBBQLXI.mjs +0 -207
  174. package/dist/chunk-SPBBQLXI.mjs.map +0 -1
  175. package/dist/chunk-T4QJQK76.mjs +0 -459
  176. package/dist/chunk-T4QJQK76.mjs.map +0 -1
  177. package/dist/chunk-TQAEEJB4.mjs +0 -157
  178. package/dist/chunk-TQAEEJB4.mjs.map +0 -1
  179. package/dist/chunk-UB5UOSHB.mjs +0 -458
  180. package/dist/chunk-UB5UOSHB.mjs.map +0 -1
  181. package/dist/chunk-USWZZUEH.mjs +0 -25
  182. package/dist/chunk-USWZZUEH.mjs.map +0 -1
  183. package/dist/chunk-UVCIEUJC.mjs +0 -16
  184. package/dist/chunk-UVCIEUJC.mjs.map +0 -1
  185. package/dist/chunk-UXUAWNO5.mjs +0 -396
  186. package/dist/chunk-UXUAWNO5.mjs.map +0 -1
  187. package/dist/chunk-V3XURYJO.mjs +0 -756
  188. package/dist/chunk-V3XURYJO.mjs.map +0 -1
  189. package/dist/chunk-V6WE6JSZ.mjs +0 -352
  190. package/dist/chunk-V6WE6JSZ.mjs.map +0 -1
  191. package/dist/chunk-V7RBCSDJ.mjs +0 -170
  192. package/dist/chunk-V7RBCSDJ.mjs.map +0 -1
  193. package/dist/chunk-VCANOYFI.mjs +0 -588
  194. package/dist/chunk-VCANOYFI.mjs.map +0 -1
  195. package/dist/chunk-VVKWFZAH.mjs +0 -753
  196. package/dist/chunk-VVKWFZAH.mjs.map +0 -1
  197. package/dist/chunk-VY2UYN5R.mjs +0 -224
  198. package/dist/chunk-VY2UYN5R.mjs.map +0 -1
  199. package/dist/chunk-W2CRQFF6.mjs +0 -1352
  200. package/dist/chunk-W2CRQFF6.mjs.map +0 -1
  201. package/dist/chunk-W4UIVMVI.mjs +0 -10
  202. package/dist/chunk-W4UIVMVI.mjs.map +0 -1
  203. package/dist/chunk-WZ5QFROO.mjs +0 -23
  204. package/dist/chunk-WZ5QFROO.mjs.map +0 -1
  205. package/dist/chunk-XIVV5IWN.mjs +0 -541
  206. package/dist/chunk-XIVV5IWN.mjs.map +0 -1
  207. package/dist/chunk-YW7OBE6Q.mjs +0 -119
  208. package/dist/chunk-YW7OBE6Q.mjs.map +0 -1
  209. package/dist/chunk-Z5CQMP54.mjs +0 -365
  210. package/dist/chunk-Z5CQMP54.mjs.map +0 -1
  211. package/dist/chunk-ZBE6MLHL.mjs +0 -230
  212. package/dist/chunk-ZBE6MLHL.mjs.map +0 -1
  213. package/dist/chunk-ZZ57EH5Z.mjs +0 -173
  214. package/dist/chunk-ZZ57EH5Z.mjs.map +0 -1
  215. package/dist/client-BT1mFQas.d.mts +0 -447
  216. package/dist/client-Nn0q4eO4.d.ts +0 -447
  217. package/dist/client-cache-CIlyBlmx.d.ts +0 -6
  218. package/dist/client-cache-D-EZ7XVW.d.mts +0 -6
  219. package/dist/client-plugins-Cw4qUGsw.d.ts +0 -1855
  220. package/dist/client-plugins-DQQ1adXM.d.mts +0 -1855
  221. package/dist/client-plugins.cjs +0 -415
  222. package/dist/client-plugins.cjs.map +0 -1
  223. package/dist/client-plugins.d.mts +0 -22
  224. package/dist/client-plugins.d.ts +0 -22
  225. package/dist/client-plugins.mjs +0 -10
  226. package/dist/client-plugins.mjs.map +0 -1
  227. package/dist/client.cjs +0 -5402
  228. package/dist/client.cjs.map +0 -1
  229. package/dist/client.d.mts +0 -447
  230. package/dist/client.d.ts +0 -447
  231. package/dist/client.mjs +0 -110
  232. package/dist/client.mjs.map +0 -1
  233. package/dist/config.cjs +0 -38
  234. package/dist/config.cjs.map +0 -1
  235. package/dist/config.d.mts +0 -29
  236. package/dist/config.d.ts +0 -29
  237. package/dist/config.mjs +0 -10
  238. package/dist/config.mjs.map +0 -1
  239. package/dist/cron.cjs +0 -406
  240. package/dist/cron.cjs.map +0 -1
  241. package/dist/cron.d.mts +0 -78
  242. package/dist/cron.d.ts +0 -78
  243. package/dist/cron.mjs +0 -30
  244. package/dist/cron.mjs.map +0 -1
  245. package/dist/deferred.cjs +0 -438
  246. package/dist/deferred.cjs.map +0 -1
  247. package/dist/deferred.d.mts +0 -42
  248. package/dist/deferred.d.ts +0 -42
  249. package/dist/deferred.mjs +0 -28
  250. package/dist/deferred.mjs.map +0 -1
  251. package/dist/deployment.cjs +0 -199
  252. package/dist/deployment.cjs.map +0 -1
  253. package/dist/deployment.d.mts +0 -34
  254. package/dist/deployment.d.ts +0 -34
  255. package/dist/deployment.mjs +0 -38
  256. package/dist/deployment.mjs.map +0 -1
  257. package/dist/devtools-LVC3VB5P.mjs +0 -370
  258. package/dist/devtools-LVC3VB5P.mjs.map +0 -1
  259. package/dist/devtools-client-3XRTBND5.mjs +0 -216
  260. package/dist/devtools-client-3XRTBND5.mjs.map +0 -1
  261. package/dist/devtools-ui-NJKFORTG.mjs +0 -1349
  262. package/dist/devtools-ui-NJKFORTG.mjs.map +0 -1
  263. package/dist/docs.cjs +0 -5553
  264. package/dist/docs.cjs.map +0 -1
  265. package/dist/docs.d.mts +0 -69
  266. package/dist/docs.d.ts +0 -69
  267. package/dist/docs.mjs +0 -46
  268. package/dist/docs.mjs.map +0 -1
  269. package/dist/env-types.cjs +0 -223
  270. package/dist/env-types.cjs.map +0 -1
  271. package/dist/env-types.d.mts +0 -11
  272. package/dist/env-types.d.ts +0 -11
  273. package/dist/env-types.mjs +0 -9
  274. package/dist/env-types.mjs.map +0 -1
  275. package/dist/env.cjs +0 -215
  276. package/dist/env.cjs.map +0 -1
  277. package/dist/env.d.mts +0 -45
  278. package/dist/env.d.ts +0 -45
  279. package/dist/env.mjs +0 -22
  280. package/dist/env.mjs.map +0 -1
  281. package/dist/environment/vite.d.mts +0 -22
  282. package/dist/environment/vite.d.ts +0 -22
  283. package/dist/environment.cjs +0 -96
  284. package/dist/environment.cjs.map +0 -1
  285. package/dist/environment.d.mts +0 -18
  286. package/dist/environment.d.ts +0 -18
  287. package/dist/environment.mjs +0 -14
  288. package/dist/environment.mjs.map +0 -1
  289. package/dist/headers.cjs +0 -126
  290. package/dist/headers.cjs.map +0 -1
  291. package/dist/headers.d.mts +0 -22
  292. package/dist/headers.d.ts +0 -22
  293. package/dist/headers.mjs +0 -12
  294. package/dist/headers.mjs.map +0 -1
  295. package/dist/i18n/client.d.mts +0 -32
  296. package/dist/i18n/client.d.ts +0 -32
  297. package/dist/i18n/index.d.mts +0 -20
  298. package/dist/i18n/index.d.ts +0 -20
  299. package/dist/i18n/server.d.mts +0 -30
  300. package/dist/i18n/server.d.ts +0 -30
  301. package/dist/image/server.d.mts +0 -37
  302. package/dist/image/server.d.ts +0 -37
  303. package/dist/image/sharp.d.mts +0 -7
  304. package/dist/image/sharp.d.ts +0 -7
  305. package/dist/image-config-Duob7wER.d.mts +0 -50
  306. package/dist/image-config-Duob7wER.d.ts +0 -50
  307. package/dist/image.cjs +0 -209
  308. package/dist/image.cjs.map +0 -1
  309. package/dist/image.d.mts +0 -39
  310. package/dist/image.d.ts +0 -39
  311. package/dist/image.mjs +0 -165
  312. package/dist/image.mjs.map +0 -1
  313. package/dist/index.cjs +0 -41822
  314. package/dist/index.cjs.map +0 -1
  315. package/dist/index.d.mts +0 -452
  316. package/dist/index.d.ts +0 -452
  317. package/dist/index.mjs +0 -973
  318. package/dist/index.mjs.map +0 -1
  319. package/dist/integration-api-CHT2OKAf.d.mts +0 -93
  320. package/dist/integration-api-CHT2OKAf.d.ts +0 -93
  321. package/dist/integration-orm-GQLGU66X.mjs +0 -13
  322. package/dist/integration-orm-GQLGU66X.mjs.map +0 -1
  323. package/dist/integrations.cjs +0 -2820
  324. package/dist/integrations.cjs.map +0 -1
  325. package/dist/integrations.d.mts +0 -22
  326. package/dist/integrations.d.ts +0 -22
  327. package/dist/integrations.mjs +0 -51
  328. package/dist/integrations.mjs.map +0 -1
  329. package/dist/internal/build-runtime.d.mts +0 -39
  330. package/dist/internal/build-runtime.d.ts +0 -39
  331. package/dist/internal/client-runtime.d.mts +0 -2
  332. package/dist/internal/client-runtime.d.ts +0 -2
  333. package/dist/internal/config-runtime.d.mts +0 -39
  334. package/dist/internal/config-runtime.d.ts +0 -39
  335. package/dist/internal/production-node-env.d.mts +0 -12
  336. package/dist/internal/production-node-env.d.ts +0 -12
  337. package/dist/internal/production-runtime.d.mts +0 -39
  338. package/dist/internal/production-runtime.d.ts +0 -39
  339. package/dist/layers-VWVDTPUZ.mjs +0 -16
  340. package/dist/layers-VWVDTPUZ.mjs.map +0 -1
  341. package/dist/manager-THKFTOFE.mjs +0 -10
  342. package/dist/manager-THKFTOFE.mjs.map +0 -1
  343. package/dist/markdown.cjs +0 -299
  344. package/dist/markdown.cjs.map +0 -1
  345. package/dist/markdown.d.mts +0 -43
  346. package/dist/markdown.d.ts +0 -43
  347. package/dist/markdown.mjs +0 -14
  348. package/dist/markdown.mjs.map +0 -1
  349. package/dist/metadata-BAPg_Nmo.d.ts +0 -22
  350. package/dist/metadata-_6i9oFG3.d.mts +0 -22
  351. package/dist/middleware.cjs +0 -2148
  352. package/dist/middleware.cjs.map +0 -1
  353. package/dist/middleware.d.mts +0 -164
  354. package/dist/middleware.d.ts +0 -164
  355. package/dist/middleware.mjs +0 -49
  356. package/dist/middleware.mjs.map +0 -1
  357. package/dist/navigation-errors-Dvwpzaer.d.mts +0 -13
  358. package/dist/navigation-errors-Dvwpzaer.d.ts +0 -13
  359. package/dist/navigation.cjs +0 -1329
  360. package/dist/navigation.cjs.map +0 -1
  361. package/dist/navigation.d.mts +0 -14
  362. package/dist/navigation.d.ts +0 -14
  363. package/dist/navigation.mjs +0 -33
  364. package/dist/navigation.mjs.map +0 -1
  365. package/dist/nitro-QO5LV6QK.mjs +0 -689
  366. package/dist/nitro-QO5LV6QK.mjs.map +0 -1
  367. package/dist/observability.cjs +0 -186
  368. package/dist/observability.cjs.map +0 -1
  369. package/dist/observability.d.mts +0 -335
  370. package/dist/observability.d.ts +0 -335
  371. package/dist/observability.mjs +0 -16
  372. package/dist/observability.mjs.map +0 -1
  373. package/dist/params-BALtrRim.d.ts +0 -15
  374. package/dist/params-ry-lxqmy.d.mts +0 -15
  375. package/dist/plugin-BJDf43dc.d.mts +0 -165
  376. package/dist/plugin-BJDf43dc.d.ts +0 -165
  377. package/dist/plugin.cjs +0 -23225
  378. package/dist/plugin.d.mts +0 -22
  379. package/dist/plugin.d.ts +0 -22
  380. package/dist/production-runtime-BoJDc5mc.d.ts +0 -79
  381. package/dist/production-runtime-C_B79w2P.d.mts +0 -28
  382. package/dist/production-runtime-DDEM1D2q.d.ts +0 -28
  383. package/dist/production-runtime-DPfgMV9Y.d.mts +0 -79
  384. package/dist/query/client.d.mts +0 -61
  385. package/dist/query/client.d.ts +0 -61
  386. package/dist/query/index.d.mts +0 -90
  387. package/dist/query/index.d.ts +0 -90
  388. package/dist/query/parsers.d.mts +0 -25
  389. package/dist/query/parsers.d.ts +0 -25
  390. package/dist/query/server.d.mts +0 -55
  391. package/dist/query/server.d.ts +0 -55
  392. package/dist/request-BrFBuc8G.d.mts +0 -6
  393. package/dist/request-BslSZIRz.d.ts +0 -6
  394. package/dist/request.d.mts +0 -2
  395. package/dist/request.d.ts +0 -2
  396. package/dist/resolver-C6iecsDV.d.ts +0 -14
  397. package/dist/resolver-DlOPpjkB.d.mts +0 -14
  398. package/dist/route-runtime-DoOHzCAD.d.mts +0 -38
  399. package/dist/route-runtime-DoOHzCAD.d.ts +0 -38
  400. package/dist/router.d.mts +0 -36
  401. package/dist/router.d.ts +0 -36
  402. package/dist/routes.d.mts +0 -224
  403. package/dist/routes.d.ts +0 -224
  404. package/dist/runtime-9nQjVM7X.d.mts +0 -206
  405. package/dist/runtime-B6GvwDS1.d.ts +0 -27
  406. package/dist/runtime-DeAAZ6gO.d.mts +0 -27
  407. package/dist/runtime-DgeS2skB.d.ts +0 -206
  408. package/dist/server-action-security.d.mts +0 -43
  409. package/dist/server-action-security.d.ts +0 -43
  410. package/dist/server-fn-client.d.mts +0 -32
  411. package/dist/server-fn-client.d.ts +0 -32
  412. package/dist/server-fn.d.mts +0 -93
  413. package/dist/server-fn.d.ts +0 -93
  414. package/dist/server-plugins.d.mts +0 -55
  415. package/dist/server-plugins.d.ts +0 -55
  416. package/dist/server-query-client.d.mts +0 -50
  417. package/dist/server-query-client.d.ts +0 -50
  418. package/dist/server-query.d.mts +0 -36
  419. package/dist/server-query.d.ts +0 -36
  420. package/dist/server.d.mts +0 -48
  421. package/dist/server.d.ts +0 -48
  422. package/dist/storage.d.mts +0 -52
  423. package/dist/storage.d.ts +0 -52
  424. package/dist/testing.d.mts +0 -101
  425. package/dist/testing.d.ts +0 -101
  426. package/dist/transport-BmbGTXA5.d.mts +0 -49
  427. package/dist/transport-BmbGTXA5.d.ts +0 -49
  428. package/dist/types-BH1lhg5G.d.mts +0 -81
  429. package/dist/types-BH1lhg5G.d.ts +0 -81
  430. package/dist/types-C9N-nk5R.d.mts +0 -53
  431. package/dist/types-C9N-nk5R.d.ts +0 -53
  432. package/dist/types-D1A6-XvH.d.mts +0 -73
  433. package/dist/types-D1A6-XvH.d.ts +0 -73
  434. package/dist/utils-CHXlMDkg.d.mts +0 -23
  435. package/dist/utils-Drsyz1Vj.d.ts +0 -23
  436. package/dist/version.d.mts +0 -3
  437. package/dist/version.d.ts +0 -3
  438. package/dist/vite.d.mts +0 -22
  439. package/dist/vite.d.ts +0 -22
  440. package/dist/workflows.d.mts +0 -110
  441. 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-VVKWFZAH.mjs.map