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

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 (193) hide show
  1. package/dist/agent-runtime.d.mts +2 -1
  2. package/dist/agent-runtime.d.ts +2 -1
  3. package/dist/api/route-manager.cjs +313 -10
  4. package/dist/api/route-manager.cjs.map +1 -1
  5. package/dist/api/route-manager.d.mts +3 -2
  6. package/dist/api/route-manager.d.ts +3 -2
  7. package/dist/api/route-manager.mjs +6 -5
  8. package/dist/api/runtime.cjs +313 -10
  9. package/dist/api/runtime.cjs.map +1 -1
  10. package/dist/api/runtime.d.mts +2 -1
  11. package/dist/api/runtime.d.ts +2 -1
  12. package/dist/api/runtime.mjs +4 -3
  13. package/dist/api.cjs +642 -57
  14. package/dist/api.cjs.map +1 -1
  15. package/dist/api.d.mts +3 -2
  16. package/dist/api.d.ts +3 -2
  17. package/dist/api.mjs +29 -9
  18. package/dist/{app-DOKxo-LH.d.ts → app-BjN-da13.d.ts} +38 -3
  19. package/dist/{app-BB3Iu3xh.d.mts → app-CakAr8Be.d.mts} +38 -3
  20. package/dist/app-markdown.d.mts +2 -1
  21. package/dist/app-markdown.d.ts +2 -1
  22. package/dist/cache.cjs +395 -12
  23. package/dist/cache.cjs.map +1 -1
  24. package/dist/cache.d.mts +100 -6
  25. package/dist/cache.d.ts +100 -6
  26. package/dist/cache.mjs +8 -2
  27. package/dist/{chunk-XUBZ7JI4.mjs → chunk-2CUKEMVR.mjs} +187 -16
  28. package/dist/chunk-2CUKEMVR.mjs.map +1 -0
  29. package/dist/{chunk-OHC6VCDI.mjs → chunk-2NHCNRF6.mjs} +521 -42
  30. package/dist/chunk-2NHCNRF6.mjs.map +1 -0
  31. package/dist/{chunk-6WXJ54TC.mjs → chunk-65A7QIKI.mjs} +5 -5
  32. package/dist/{chunk-6WXJ54TC.mjs.map → chunk-65A7QIKI.mjs.map} +1 -1
  33. package/dist/{chunk-5QH4IKY3.mjs → chunk-7N62DNSO.mjs} +2 -2
  34. package/dist/{chunk-XJSHJN4M.mjs → chunk-A2LUXHD2.mjs} +593 -49
  35. package/dist/chunk-A2LUXHD2.mjs.map +1 -0
  36. package/dist/chunk-ALCLXXTY.mjs +187 -0
  37. package/dist/chunk-ALCLXXTY.mjs.map +1 -0
  38. package/dist/{chunk-CSU4KJJF.mjs → chunk-C2ROET2V.mjs} +2 -2
  39. package/dist/{chunk-JNYVN7YP.mjs → chunk-EEABSBKK.mjs} +2 -2
  40. package/dist/{chunk-JNYVN7YP.mjs.map → chunk-EEABSBKK.mjs.map} +1 -1
  41. package/dist/{chunk-BIOIOWXZ.mjs → chunk-HNIQFZKB.mjs} +2 -2
  42. package/dist/{chunk-MH6FKW2I.mjs → chunk-J5YWQVI5.mjs} +4 -4
  43. package/dist/chunk-J5YWQVI5.mjs.map +1 -0
  44. package/dist/{chunk-G5I34UA6.mjs → chunk-JDEOUK5V.mjs} +4 -4
  45. package/dist/{chunk-T543TMFY.mjs → chunk-NM3CRAAL.mjs} +3 -2
  46. package/dist/chunk-NM3CRAAL.mjs.map +1 -0
  47. package/dist/{chunk-LWMGIEJA.mjs → chunk-PFE6GMNE.mjs} +47 -37
  48. package/dist/chunk-PFE6GMNE.mjs.map +1 -0
  49. package/dist/{chunk-6VS6CKAV.mjs → chunk-QM746KUO.mjs} +8 -1
  50. package/dist/chunk-QM746KUO.mjs.map +1 -0
  51. package/dist/{chunk-5FW6PQ3J.mjs → chunk-QTZZ2ISQ.mjs} +41 -16
  52. package/dist/chunk-QTZZ2ISQ.mjs.map +1 -0
  53. package/dist/{chunk-SHRJG6OG.mjs → chunk-RBRLLZL5.mjs} +18 -3
  54. package/dist/chunk-RBRLLZL5.mjs.map +1 -0
  55. package/dist/{chunk-NRRFGX45.mjs → chunk-TQAEEJB4.mjs} +3 -3
  56. package/dist/{chunk-45LKHSHJ.mjs → chunk-UB5UOSHB.mjs} +24 -12
  57. package/dist/chunk-UB5UOSHB.mjs.map +1 -0
  58. package/dist/chunk-V3XURYJO.mjs +756 -0
  59. package/dist/chunk-V3XURYJO.mjs.map +1 -0
  60. package/dist/{chunk-HZYXGV4K.mjs → chunk-VY2UYN5R.mjs} +24 -4
  61. package/dist/chunk-VY2UYN5R.mjs.map +1 -0
  62. package/dist/{chunk-C33RALN7.mjs → chunk-W2CRQFF6.mjs} +79 -15
  63. package/dist/chunk-W2CRQFF6.mjs.map +1 -0
  64. package/dist/{chunk-LG3YINQN.mjs → chunk-Z5CQMP54.mjs} +3 -3
  65. package/dist/{client-DiViK9yK.d.mts → client-BT1mFQas.d.mts} +23 -4
  66. package/dist/{client-DpEBJbts.d.ts → client-Nn0q4eO4.d.ts} +23 -4
  67. package/dist/{client-plugins-CTnsZz_A.d.ts → client-plugins-Cw4qUGsw.d.ts} +6 -0
  68. package/dist/{client-plugins-Cnr0D3kk.d.mts → client-plugins-DQQ1adXM.d.mts} +6 -0
  69. package/dist/client-plugins.d.mts +2 -1
  70. package/dist/client-plugins.d.ts +2 -1
  71. package/dist/client.cjs +665 -82
  72. package/dist/client.cjs.map +1 -1
  73. package/dist/client.d.mts +71 -5
  74. package/dist/client.d.ts +71 -5
  75. package/dist/client.mjs +10 -7
  76. package/dist/config.d.mts +2 -1
  77. package/dist/config.d.ts +2 -1
  78. package/dist/{devtools-HE4FTUDN.mjs → devtools-LVC3VB5P.mjs} +4 -4
  79. package/dist/docs.cjs +11 -1
  80. package/dist/docs.cjs.map +1 -1
  81. package/dist/docs.mjs +4 -4
  82. package/dist/index.cjs +2113 -198
  83. package/dist/index.cjs.map +1 -1
  84. package/dist/index.d.mts +16 -16
  85. package/dist/index.d.ts +16 -16
  86. package/dist/index.mjs +49 -21
  87. package/dist/index.mjs.map +1 -1
  88. package/dist/integrations.d.mts +2 -1
  89. package/dist/integrations.d.ts +2 -1
  90. package/dist/internal/build-runtime.cjs +1455 -90
  91. package/dist/internal/build-runtime.cjs.map +1 -1
  92. package/dist/internal/build-runtime.d.mts +4 -3
  93. package/dist/internal/build-runtime.d.ts +4 -3
  94. package/dist/internal/build-runtime.mjs +15 -14
  95. package/dist/internal/config-runtime.cjs +12 -1
  96. package/dist/internal/config-runtime.cjs.map +1 -1
  97. package/dist/internal/config-runtime.d.mts +3 -2
  98. package/dist/internal/config-runtime.d.ts +3 -2
  99. package/dist/internal/config-runtime.mjs +3 -3
  100. package/dist/internal/production-runtime.cjs +282 -6
  101. package/dist/internal/production-runtime.cjs.map +1 -1
  102. package/dist/internal/production-runtime.d.mts +4 -4
  103. package/dist/internal/production-runtime.d.ts +4 -4
  104. package/dist/internal/production-runtime.mjs +4 -2
  105. package/dist/{metadata-eoVmHoyv.d.ts → metadata-BAPg_Nmo.d.ts} +1 -1
  106. package/dist/{metadata-Dp8AdvsB.d.mts → metadata-_6i9oFG3.d.mts} +1 -1
  107. package/dist/middleware.d.mts +4 -3
  108. package/dist/middleware.d.ts +4 -3
  109. package/dist/navigation.cjs +40 -15
  110. package/dist/navigation.cjs.map +1 -1
  111. package/dist/navigation.mjs +2 -2
  112. package/dist/plugin.cjs +913 -53
  113. package/dist/plugin.cjs.map +1 -1
  114. package/dist/plugin.d.mts +2 -1
  115. package/dist/plugin.d.ts +2 -1
  116. package/dist/plugin.mjs +11 -10
  117. package/dist/{production-runtime-BqTnUTai.d.ts → production-runtime-BoJDc5mc.d.ts} +1 -1
  118. package/dist/{production-runtime-DtDdG9fc.d.mts → production-runtime-DPfgMV9Y.d.mts} +1 -1
  119. package/dist/routes.cjs +276 -6
  120. package/dist/routes.cjs.map +1 -1
  121. package/dist/routes.d.mts +1 -1
  122. package/dist/routes.d.ts +1 -1
  123. package/dist/routes.mjs +3 -3
  124. package/dist/{runtime-C1B7pSGT.d.mts → runtime-9nQjVM7X.d.mts} +8 -9
  125. package/dist/{runtime-CdPHt0bv.d.ts → runtime-DgeS2skB.d.ts} +8 -9
  126. package/dist/server-action-security.cjs +28 -10
  127. package/dist/server-action-security.cjs.map +1 -1
  128. package/dist/server-action-security.d.mts +2 -1
  129. package/dist/server-action-security.d.ts +2 -1
  130. package/dist/server-action-security.mjs +2 -2
  131. package/dist/server-fn-client.d.mts +1 -0
  132. package/dist/server-fn-client.d.ts +1 -0
  133. package/dist/server-fn.cjs +785 -3
  134. package/dist/server-fn.cjs.map +1 -1
  135. package/dist/server-fn.d.mts +10 -1
  136. package/dist/server-fn.d.ts +10 -1
  137. package/dist/server-fn.mjs +6 -3
  138. package/dist/server-plugins.d.mts +3 -2
  139. package/dist/server-plugins.d.ts +3 -2
  140. package/dist/server-query-client.cjs +279 -8
  141. package/dist/server-query-client.cjs.map +1 -1
  142. package/dist/server-query-client.mjs +4 -4
  143. package/dist/server-query.cjs +381 -10
  144. package/dist/server-query.cjs.map +1 -1
  145. package/dist/server-query.mjs +5 -5
  146. package/dist/server.cjs +1086 -76
  147. package/dist/server.cjs.map +1 -1
  148. package/dist/server.d.mts +8 -7
  149. package/dist/server.d.ts +8 -7
  150. package/dist/server.mjs +31 -16
  151. package/dist/server.mjs.map +1 -1
  152. package/dist/testing.cjs +341 -20
  153. package/dist/testing.cjs.map +1 -1
  154. package/dist/testing.d.mts +3 -2
  155. package/dist/testing.d.ts +3 -2
  156. package/dist/testing.mjs +7 -6
  157. package/dist/testing.mjs.map +1 -1
  158. package/dist/transport-BmbGTXA5.d.mts +49 -0
  159. package/dist/transport-BmbGTXA5.d.ts +49 -0
  160. package/dist/{utils-8USa5BiY.d.mts → utils-CHXlMDkg.d.mts} +1 -1
  161. package/dist/{utils-DKJb6K6G.d.ts → utils-Drsyz1Vj.d.ts} +1 -1
  162. package/dist/version.cjs +1 -1
  163. package/dist/version.cjs.map +1 -1
  164. package/dist/version.mjs +1 -1
  165. package/dist/vite.cjs +914 -54
  166. package/dist/vite.cjs.map +1 -1
  167. package/dist/vite.d.mts +2 -1
  168. package/dist/vite.d.ts +2 -1
  169. package/dist/vite.mjs +11 -10
  170. package/package.json +1 -1
  171. package/types/api.d.ts +44 -0
  172. package/types/client.d.ts +85 -4
  173. package/dist/chunk-45LKHSHJ.mjs.map +0 -1
  174. package/dist/chunk-5FW6PQ3J.mjs.map +0 -1
  175. package/dist/chunk-6VS6CKAV.mjs.map +0 -1
  176. package/dist/chunk-C33RALN7.mjs.map +0 -1
  177. package/dist/chunk-GZWT6VI5.mjs +0 -382
  178. package/dist/chunk-GZWT6VI5.mjs.map +0 -1
  179. package/dist/chunk-HZYXGV4K.mjs.map +0 -1
  180. package/dist/chunk-LWMGIEJA.mjs.map +0 -1
  181. package/dist/chunk-MH6FKW2I.mjs.map +0 -1
  182. package/dist/chunk-OHC6VCDI.mjs.map +0 -1
  183. package/dist/chunk-SHRJG6OG.mjs.map +0 -1
  184. package/dist/chunk-T543TMFY.mjs.map +0 -1
  185. package/dist/chunk-XJSHJN4M.mjs.map +0 -1
  186. package/dist/chunk-XUBZ7JI4.mjs.map +0 -1
  187. /package/dist/{chunk-5QH4IKY3.mjs.map → chunk-7N62DNSO.mjs.map} +0 -0
  188. /package/dist/{chunk-CSU4KJJF.mjs.map → chunk-C2ROET2V.mjs.map} +0 -0
  189. /package/dist/{chunk-BIOIOWXZ.mjs.map → chunk-HNIQFZKB.mjs.map} +0 -0
  190. /package/dist/{chunk-G5I34UA6.mjs.map → chunk-JDEOUK5V.mjs.map} +0 -0
  191. /package/dist/{chunk-NRRFGX45.mjs.map → chunk-TQAEEJB4.mjs.map} +0 -0
  192. /package/dist/{chunk-LG3YINQN.mjs.map → chunk-Z5CQMP54.mjs.map} +0 -0
  193. /package/dist/{devtools-HE4FTUDN.mjs.map → devtools-LVC3VB5P.mjs.map} +0 -0
package/dist/plugin.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { aI as APIHandlerLifecyclePayload, aE as APIRouteDiscoveredPayload, aL as BundleLifecyclePayload, U as BundleResultPayload, aJ as ErrorLifecyclePayload, V as FarmPlugin, ay as FarmPluginBuildHooks, aA as FarmPluginClientConfig, ad as FarmPluginContext, az as FarmPluginDevHooks, av as FarmPluginDiscoveredRoute, ax as FarmPluginRenderHooks, ah as FarmPluginRouteRuntimePayload, aw as FarmPluginRouterHooks, an as FarmPluginRuntimeAfterEvent, ak as FarmPluginRuntimeBaseEvent, am as FarmPluginRuntimeBeforeEvent, aq as FarmPluginRuntimeCloseEvent, al as FarmPluginRuntimeContextEvent, ao as FarmPluginRuntimeErrorEvent, ar as FarmPluginRuntimeHooks, ag as FarmPluginRuntimeKind, at as FarmPluginRuntimeRequestHandler, as as FarmPluginRuntimeRequestOptions, au as FarmPluginRuntimeSession, ap as FarmPluginRuntimeStartEvent, ai as FarmPluginSetupContext, aj as FarmPluginStateContext, ae as FarmRequestPluginContext, af as FarmRequestStore, aK as HMRUpdatePayload, aD as MiddlewareDiscoveredPayload, aM as NitroBuildLifecyclePayload, a2 as PluginManager, ac as PluginRequestContext, aH as RenderLifecyclePayload, aB as RouteDiscoveredPayload, aF as RouteMatchPayload, aG as RouteMatchResultPayload, aC as RoutesGeneratedPayload, aN as ShutdownPayload, a1 as definePlugin, f as farmPlugin } from './client-plugins-Cnr0D3kk.mjs';
1
+ export { aI as APIHandlerLifecyclePayload, aE as APIRouteDiscoveredPayload, aL as BundleLifecyclePayload, U as BundleResultPayload, aJ as ErrorLifecyclePayload, V as FarmPlugin, ay as FarmPluginBuildHooks, aA as FarmPluginClientConfig, ad as FarmPluginContext, az as FarmPluginDevHooks, av as FarmPluginDiscoveredRoute, ax as FarmPluginRenderHooks, ah as FarmPluginRouteRuntimePayload, aw as FarmPluginRouterHooks, an as FarmPluginRuntimeAfterEvent, ak as FarmPluginRuntimeBaseEvent, am as FarmPluginRuntimeBeforeEvent, aq as FarmPluginRuntimeCloseEvent, al as FarmPluginRuntimeContextEvent, ao as FarmPluginRuntimeErrorEvent, ar as FarmPluginRuntimeHooks, ag as FarmPluginRuntimeKind, at as FarmPluginRuntimeRequestHandler, as as FarmPluginRuntimeRequestOptions, au as FarmPluginRuntimeSession, ap as FarmPluginRuntimeStartEvent, ai as FarmPluginSetupContext, aj as FarmPluginStateContext, ae as FarmRequestPluginContext, af as FarmRequestStore, aK as HMRUpdatePayload, aD as MiddlewareDiscoveredPayload, aM as NitroBuildLifecyclePayload, a2 as PluginManager, ac as PluginRequestContext, aH as RenderLifecyclePayload, aB as RouteDiscoveredPayload, aF as RouteMatchPayload, aG as RouteMatchResultPayload, aC as RoutesGeneratedPayload, aN as ShutdownPayload, a1 as definePlugin, f as farmPlugin } from './client-plugins-DQQ1adXM.mjs';
2
2
  import 'vite';
3
3
  import './plugin-BJDf43dc.mjs';
4
4
  import './env.mjs';
@@ -18,4 +18,5 @@ import './cron.mjs';
18
18
  import './server-action-security.mjs';
19
19
  import './image-config-Duob7wER.mjs';
20
20
  import './types-BH1lhg5G.mjs';
21
+ import './cache.mjs';
21
22
  import './route-runtime-DoOHzCAD.mjs';
package/dist/plugin.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { aI as APIHandlerLifecyclePayload, aE as APIRouteDiscoveredPayload, aL as BundleLifecyclePayload, U as BundleResultPayload, aJ as ErrorLifecyclePayload, V as FarmPlugin, ay as FarmPluginBuildHooks, aA as FarmPluginClientConfig, ad as FarmPluginContext, az as FarmPluginDevHooks, av as FarmPluginDiscoveredRoute, ax as FarmPluginRenderHooks, ah as FarmPluginRouteRuntimePayload, aw as FarmPluginRouterHooks, an as FarmPluginRuntimeAfterEvent, ak as FarmPluginRuntimeBaseEvent, am as FarmPluginRuntimeBeforeEvent, aq as FarmPluginRuntimeCloseEvent, al as FarmPluginRuntimeContextEvent, ao as FarmPluginRuntimeErrorEvent, ar as FarmPluginRuntimeHooks, ag as FarmPluginRuntimeKind, at as FarmPluginRuntimeRequestHandler, as as FarmPluginRuntimeRequestOptions, au as FarmPluginRuntimeSession, ap as FarmPluginRuntimeStartEvent, ai as FarmPluginSetupContext, aj as FarmPluginStateContext, ae as FarmRequestPluginContext, af as FarmRequestStore, aK as HMRUpdatePayload, aD as MiddlewareDiscoveredPayload, aM as NitroBuildLifecyclePayload, a2 as PluginManager, ac as PluginRequestContext, aH as RenderLifecyclePayload, aB as RouteDiscoveredPayload, aF as RouteMatchPayload, aG as RouteMatchResultPayload, aC as RoutesGeneratedPayload, aN as ShutdownPayload, a1 as definePlugin, f as farmPlugin } from './client-plugins-CTnsZz_A.js';
1
+ export { aI as APIHandlerLifecyclePayload, aE as APIRouteDiscoveredPayload, aL as BundleLifecyclePayload, U as BundleResultPayload, aJ as ErrorLifecyclePayload, V as FarmPlugin, ay as FarmPluginBuildHooks, aA as FarmPluginClientConfig, ad as FarmPluginContext, az as FarmPluginDevHooks, av as FarmPluginDiscoveredRoute, ax as FarmPluginRenderHooks, ah as FarmPluginRouteRuntimePayload, aw as FarmPluginRouterHooks, an as FarmPluginRuntimeAfterEvent, ak as FarmPluginRuntimeBaseEvent, am as FarmPluginRuntimeBeforeEvent, aq as FarmPluginRuntimeCloseEvent, al as FarmPluginRuntimeContextEvent, ao as FarmPluginRuntimeErrorEvent, ar as FarmPluginRuntimeHooks, ag as FarmPluginRuntimeKind, at as FarmPluginRuntimeRequestHandler, as as FarmPluginRuntimeRequestOptions, au as FarmPluginRuntimeSession, ap as FarmPluginRuntimeStartEvent, ai as FarmPluginSetupContext, aj as FarmPluginStateContext, ae as FarmRequestPluginContext, af as FarmRequestStore, aK as HMRUpdatePayload, aD as MiddlewareDiscoveredPayload, aM as NitroBuildLifecyclePayload, a2 as PluginManager, ac as PluginRequestContext, aH as RenderLifecyclePayload, aB as RouteDiscoveredPayload, aF as RouteMatchPayload, aG as RouteMatchResultPayload, aC as RoutesGeneratedPayload, aN as ShutdownPayload, a1 as definePlugin, f as farmPlugin } from './client-plugins-Cw4qUGsw.js';
2
2
  import 'vite';
3
3
  import './plugin-BJDf43dc.js';
4
4
  import './env.js';
@@ -18,4 +18,5 @@ import './cron.js';
18
18
  import './server-action-security.js';
19
19
  import './image-config-Duob7wER.js';
20
20
  import './types-BH1lhg5G.js';
21
+ import './cache.js';
21
22
  import './route-runtime-DoOHzCAD.js';
package/dist/plugin.mjs CHANGED
@@ -5,20 +5,20 @@ import {
5
5
  import "./chunk-RSKVYESE.mjs";
6
6
  import {
7
7
  farmPlugin
8
- } from "./chunk-XJSHJN4M.mjs";
8
+ } from "./chunk-A2LUXHD2.mjs";
9
9
  import "./chunk-LGHEOHBU.mjs";
10
10
  import "./chunk-FRPWCMMG.mjs";
11
11
  import "./chunk-V6WE6JSZ.mjs";
12
12
  import "./chunk-3XNTL3FQ.mjs";
13
13
  import "./chunk-BHG3LVHH.mjs";
14
14
  import "./chunk-USWZZUEH.mjs";
15
- import "./chunk-5QH4IKY3.mjs";
15
+ import "./chunk-7N62DNSO.mjs";
16
16
  import "./chunk-7HO6AEOP.mjs";
17
17
  import "./chunk-74YTBPTY.mjs";
18
18
  import "./chunk-7MABZJIM.mjs";
19
19
  import "./chunk-YW7OBE6Q.mjs";
20
20
  import "./chunk-GY2STC2S.mjs";
21
- import "./chunk-45LKHSHJ.mjs";
21
+ import "./chunk-UB5UOSHB.mjs";
22
22
  import "./chunk-LLC7BNXW.mjs";
23
23
  import "./chunk-QGQX7SFC.mjs";
24
24
  import "./chunk-XIVV5IWN.mjs";
@@ -29,27 +29,28 @@ import "./chunk-P7QDS5AT.mjs";
29
29
  import "./chunk-T4QJQK76.mjs";
30
30
  import "./chunk-E6EPN5BT.mjs";
31
31
  import "./chunk-QGOHVJ6J.mjs";
32
- import "./chunk-LG3YINQN.mjs";
32
+ import "./chunk-Z5CQMP54.mjs";
33
33
  import "./chunk-2ED5Q2GH.mjs";
34
34
  import "./chunk-GN72QAIH.mjs";
35
35
  import "./chunk-FQYDHKKU.mjs";
36
- import "./chunk-CSU4KJJF.mjs";
36
+ import "./chunk-C2ROET2V.mjs";
37
37
  import "./chunk-QKVUNGAH.mjs";
38
38
  import "./chunk-GQVGIUSN.mjs";
39
39
  import "./chunk-J4FNJ5IU.mjs";
40
- import "./chunk-LWMGIEJA.mjs";
40
+ import "./chunk-PFE6GMNE.mjs";
41
41
  import "./chunk-RHIFZZUI.mjs";
42
42
  import "./chunk-LM2YNO4U.mjs";
43
- import "./chunk-JNYVN7YP.mjs";
44
- import "./chunk-5FW6PQ3J.mjs";
43
+ import "./chunk-EEABSBKK.mjs";
44
+ import "./chunk-QTZZ2ISQ.mjs";
45
45
  import "./chunk-ITN462YM.mjs";
46
46
  import "./chunk-B232I2GP.mjs";
47
47
  import "./chunk-JK25YEN6.mjs";
48
48
  import "./chunk-GS6K5OCM.mjs";
49
49
  import "./chunk-44ZCFSKE.mjs";
50
- import "./chunk-GZWT6VI5.mjs";
50
+ import "./chunk-ALCLXXTY.mjs";
51
+ import "./chunk-V3XURYJO.mjs";
51
52
  import "./chunk-WZ5QFROO.mjs";
52
- import "./chunk-SHRJG6OG.mjs";
53
+ import "./chunk-RBRLLZL5.mjs";
53
54
  import "./chunk-7ZY5AIJO.mjs";
54
55
  import "./chunk-ZBE6MLHL.mjs";
55
56
  import "./chunk-CGILA3WO.mjs";
@@ -1,4 +1,4 @@
1
- import { X as ReadonlyMiddlewareStore, Y as FarmMiddlewareConfig, Z as MiddlewareModule } from './client-plugins-CTnsZz_A.js';
1
+ import { X as ReadonlyMiddlewareStore, Y as FarmMiddlewareConfig, Z as MiddlewareModule } from './client-plugins-Cw4qUGsw.js';
2
2
  import { R as ResolvedFarmI18nConfig } from './types-BH1lhg5G.js';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { X as ReadonlyMiddlewareStore, Y as FarmMiddlewareConfig, Z as MiddlewareModule } from './client-plugins-Cnr0D3kk.mjs';
1
+ import { X as ReadonlyMiddlewareStore, Y as FarmMiddlewareConfig, Z as MiddlewareModule } from './client-plugins-DQQ1adXM.mjs';
2
2
  import { R as ResolvedFarmI18nConfig } from './types-BH1lhg5G.mjs';
3
3
 
4
4
  /**
package/dist/routes.cjs CHANGED
@@ -162,11 +162,51 @@ __name(formatError, "formatError");
162
162
 
163
163
  // src/cache.ts
164
164
  var _FarmDataCache = class _FarmDataCache {
165
- constructor() {
165
+ constructor(config = {}) {
166
166
  this.entries = /* @__PURE__ */ new Map();
167
167
  this.inflight = /* @__PURE__ */ new Map();
168
168
  this.invalidatedTagVersions = /* @__PURE__ */ new Map();
169
169
  this.version = 0;
170
+ this.namespace = "farm";
171
+ this.local = true;
172
+ this.lease = {
173
+ enabled: true,
174
+ ttlMs: 1e4,
175
+ waitTimeoutMs: 1e4,
176
+ pollIntervalMs: 25
177
+ };
178
+ this.configure(config);
179
+ }
180
+ configure(config = {}) {
181
+ this.adapter = config.adapter;
182
+ this.namespace = normalizeCacheNamespace(config.namespace || "farm");
183
+ this.local = !config.adapter;
184
+ this.lease = config.lease === false ? { ...this.lease, enabled: false } : {
185
+ enabled: true,
186
+ ttlMs: normalizePositiveDuration(config.lease?.ttlMs, 1e4, "cache.lease.ttlMs"),
187
+ waitTimeoutMs: normalizePositiveDuration(
188
+ config.lease?.waitTimeoutMs,
189
+ 1e4,
190
+ "cache.lease.waitTimeoutMs"
191
+ ),
192
+ pollIntervalMs: normalizePositiveDuration(
193
+ config.lease?.pollIntervalMs,
194
+ 25,
195
+ "cache.lease.pollIntervalMs"
196
+ )
197
+ };
198
+ if (!this.local) {
199
+ this.entries.clear();
200
+ this.inflight.clear();
201
+ this.invalidatedTagVersions.clear();
202
+ this.version = 0;
203
+ }
204
+ }
205
+ get adapterName() {
206
+ return this.adapter?.name || (this.adapter ? "custom" : "memory");
207
+ }
208
+ get hasAdapter() {
209
+ return this.adapter !== void 0;
170
210
  }
171
211
  get size() {
172
212
  return this.entries.size;
@@ -202,6 +242,45 @@ var _FarmDataCache = class _FarmDataCache {
202
242
  });
203
243
  return this.toPublicEntry(entry);
204
244
  }
245
+ async getEntryAsync(key, options = {}) {
246
+ if (this.local) {
247
+ const localEntry = this.getEntry(key, options);
248
+ if (localEntry) return localEntry;
249
+ }
250
+ if (!this.adapter) {
251
+ return this.local ? void 0 : this.getEntry(key, options);
252
+ }
253
+ const entry = await this.adapter.get(this.createAdapterKey(key));
254
+ if (!entry) {
255
+ emitFarmEvent({ type: "cache.miss", key });
256
+ return void 0;
257
+ }
258
+ assertFarmCacheEntry(entry, key);
259
+ const stale = await this.isAdapterEntryStale(entry, options.now);
260
+ if (stale) {
261
+ emitFarmEvent({
262
+ type: "cache.stale",
263
+ key,
264
+ tags: [...entry.tags],
265
+ revalidate: entry.revalidate
266
+ });
267
+ if (!options.allowStale) {
268
+ emitFarmEvent({ type: "cache.miss", key, reason: "stale" });
269
+ return void 0;
270
+ }
271
+ }
272
+ emitFarmEvent({
273
+ type: "cache.hit",
274
+ key,
275
+ tags: [...entry.tags],
276
+ revalidate: entry.revalidate,
277
+ stale
278
+ });
279
+ if (this.local && !stale) {
280
+ this.hydrateLocalEntry(entry);
281
+ }
282
+ return { ...entry, key };
283
+ }
205
284
  set(key, value, options = {}) {
206
285
  const tags = /* @__PURE__ */ new Set();
207
286
  for (const tag of options.tags ?? []) {
@@ -214,6 +293,7 @@ var _FarmDataCache = class _FarmDataCache {
214
293
  key,
215
294
  value,
216
295
  tags,
296
+ tagVersions: void 0,
217
297
  createdAt: options.createdAt ?? Date.now(),
218
298
  createdVersion: ++this.version,
219
299
  revalidate: normalizeRevalidate(options.revalidate)
@@ -227,11 +307,45 @@ var _FarmDataCache = class _FarmDataCache {
227
307
  });
228
308
  return this.toPublicEntry(entry);
229
309
  }
310
+ async setAsync(key, value, options = {}, tagVersions) {
311
+ const tags = normalizeCacheOptionsTags(options);
312
+ const capturedVersions = tagVersions ?? await this.getAdapterTagVersions(Array.from(tags.values()));
313
+ const entry = {
314
+ key,
315
+ value,
316
+ tags: Array.from(tags),
317
+ tagVersions: capturedVersions,
318
+ createdAt: options.createdAt ?? Date.now(),
319
+ createdVersion: ++this.version,
320
+ revalidate: normalizeRevalidate(options.revalidate)
321
+ };
322
+ if (this.local) {
323
+ this.hydrateLocalEntry(entry);
324
+ }
325
+ if (this.adapter) {
326
+ await this.adapter.set(this.createAdapterKey(key), entry);
327
+ }
328
+ emitFarmEvent({
329
+ type: "cache.set",
330
+ key,
331
+ tags: [...entry.tags],
332
+ revalidate: entry.revalidate
333
+ });
334
+ return entry;
335
+ }
230
336
  delete(key) {
231
337
  const deleted = this.entries.delete(key);
232
338
  emitFarmEvent({ type: "cache.delete", key, deleted });
233
339
  return deleted;
234
340
  }
341
+ async deleteAsync(key) {
342
+ const deleted = this.entries.delete(key);
343
+ if (this.adapter) {
344
+ await this.adapter.delete(this.createAdapterKey(key));
345
+ }
346
+ emitFarmEvent({ type: "cache.delete", key, deleted: this.adapter ? true : deleted });
347
+ return this.adapter ? true : deleted;
348
+ }
235
349
  clear() {
236
350
  const count = this.entries.size;
237
351
  this.entries.clear();
@@ -240,6 +354,10 @@ var _FarmDataCache = class _FarmDataCache {
240
354
  this.version = 0;
241
355
  emitFarmEvent({ type: "cache.clear", count });
242
356
  }
357
+ async clearAsync() {
358
+ this.clear();
359
+ await this.adapter?.clear?.();
360
+ }
243
361
  isStale(entry, now = Date.now()) {
244
362
  if (typeof entry.revalidate === "number" && entry.revalidate > 0 && now - entry.createdAt >= entry.revalidate * 1e3) {
245
363
  return true;
@@ -252,6 +370,12 @@ var _FarmDataCache = class _FarmDataCache {
252
370
  }
253
371
  return false;
254
372
  }
373
+ async isStaleAsync(entry, now = Date.now()) {
374
+ if (this.adapter) {
375
+ return this.isAdapterEntryStale(entry, now);
376
+ }
377
+ return this.isStale(entry, now);
378
+ }
255
379
  revalidateTag(tag, options = {}) {
256
380
  const normalized = normalizeCacheTag(tag);
257
381
  const count = this.invalidateTag(normalized);
@@ -260,6 +384,15 @@ var _FarmDataCache = class _FarmDataCache {
260
384
  );
261
385
  return count;
262
386
  }
387
+ async revalidateTagAsync(tag, options = {}) {
388
+ const normalized = normalizeCacheTag(tag);
389
+ const count = this.invalidateTag(normalized);
390
+ await this.adapter?.invalidateTags?.([this.createAdapterTag(normalized)]);
391
+ emitFarmEvent(
392
+ options.source === "updateTag" ? { type: "cache.updateTag", tag: normalized, count } : { type: "cache.revalidateTag", tag: normalized, profile: options.profile, count }
393
+ );
394
+ return count;
395
+ }
263
396
  revalidatePath(routePath) {
264
397
  const normalizedPath = normalizeRevalidatePath(routePath);
265
398
  const pathTag = createPathCacheTag(normalizedPath);
@@ -276,8 +409,25 @@ var _FarmDataCache = class _FarmDataCache {
276
409
  }
277
410
  return count;
278
411
  }
412
+ async revalidatePathAsync(routePath) {
413
+ const normalizedPath = normalizeRevalidatePath(routePath);
414
+ const pathTag = createPathCacheTag(normalizedPath);
415
+ const pprCount = this.countEntriesForTags([pathTag, "ppr"]);
416
+ const count = this.invalidateTag(pathTag);
417
+ await this.adapter?.invalidateTags?.([this.createAdapterTag(pathTag)]);
418
+ emitFarmEvent({ type: "cache.revalidatePath", path: normalizedPath, count });
419
+ if (pprCount > 0) {
420
+ emitFarmEvent({
421
+ type: "ppr.shell.invalidated",
422
+ route: normalizedPath,
423
+ reason: "revalidatePath",
424
+ count: pprCount
425
+ });
426
+ }
427
+ return count;
428
+ }
279
429
  async getOrSet(key, producer, options = {}) {
280
- const cached = this.getEntry(key);
430
+ const cached = await this.getEntryAsync(key);
281
431
  if (cached) {
282
432
  return cached.value;
283
433
  }
@@ -286,10 +436,8 @@ var _FarmDataCache = class _FarmDataCache {
286
436
  emitFarmEvent({ type: "cache.dedupe", key });
287
437
  return inflight;
288
438
  }
289
- const promise = Promise.resolve().then(producer).then((value) => {
290
- this.set(key, value, options);
291
- return value;
292
- }).catch((error) => {
439
+ const tags = Array.from(normalizeCacheOptionsTags(options));
440
+ const promise = this.fillCacheEntry(key, producer, options, tags).catch((error) => {
293
441
  emitFarmEvent({ type: "cache.error", key, operation: "set", error });
294
442
  throw error;
295
443
  }).finally(() => {
@@ -298,6 +446,40 @@ var _FarmDataCache = class _FarmDataCache {
298
446
  this.inflight.set(key, promise);
299
447
  return promise;
300
448
  }
449
+ async fillCacheEntry(key, producer, options, tags) {
450
+ const leaseKey = `${this.namespace}:lease:${key}`;
451
+ let leaseToken;
452
+ if (this.adapter?.acquireLease && this.adapter.releaseLease && this.lease.enabled) {
453
+ leaseToken = await this.adapter.acquireLease(leaseKey, this.lease.ttlMs);
454
+ if (!leaseToken) {
455
+ const shared = await this.waitForAdapterEntry(key);
456
+ if (shared) {
457
+ emitFarmEvent({ type: "cache.dedupe", key });
458
+ return shared.value;
459
+ }
460
+ leaseToken = await this.adapter.acquireLease(leaseKey, this.lease.ttlMs);
461
+ }
462
+ }
463
+ try {
464
+ const initialTagVersions = await this.getAdapterTagVersions(tags);
465
+ const value = await producer();
466
+ await this.setAsync(key, value, options, initialTagVersions);
467
+ return value;
468
+ } finally {
469
+ if (leaseToken && this.adapter?.releaseLease) {
470
+ await this.adapter.releaseLease(leaseKey, leaseToken);
471
+ }
472
+ }
473
+ }
474
+ async waitForAdapterEntry(key) {
475
+ const deadline = Date.now() + this.lease.waitTimeoutMs;
476
+ while (Date.now() < deadline) {
477
+ await delay(this.lease.pollIntervalMs);
478
+ const entry = await this.getEntryAsync(key);
479
+ if (entry) return entry;
480
+ }
481
+ return void 0;
482
+ }
301
483
  countEntriesForTag(tag) {
302
484
  let count = 0;
303
485
  for (const entry of this.entries.values()) {
@@ -325,11 +507,53 @@ var _FarmDataCache = class _FarmDataCache {
325
507
  key: entry.key,
326
508
  value: entry.value,
327
509
  tags: Array.from(entry.tags),
510
+ tagVersions: entry.tagVersions,
328
511
  createdAt: entry.createdAt,
329
512
  createdVersion: entry.createdVersion,
330
513
  revalidate: entry.revalidate
331
514
  };
332
515
  }
516
+ hydrateLocalEntry(entry) {
517
+ this.entries.set(entry.key, {
518
+ key: entry.key,
519
+ value: entry.value,
520
+ tags: new Set(entry.tags.map(normalizeCacheTag)),
521
+ tagVersions: entry.tagVersions,
522
+ createdAt: entry.createdAt,
523
+ createdVersion: entry.createdVersion ?? ++this.version,
524
+ revalidate: normalizeRevalidate(entry.revalidate)
525
+ });
526
+ }
527
+ createAdapterKey(key) {
528
+ return `${this.namespace}:entry:${key}`;
529
+ }
530
+ createAdapterTag(tag) {
531
+ return `${this.namespace}:tag:${tag}`;
532
+ }
533
+ async getAdapterTagVersions(tags) {
534
+ if (!this.adapter?.getTagVersions || tags.length === 0) return {};
535
+ const normalized = tags.map(normalizeCacheTag);
536
+ const physicalTags = normalized.map((tag) => this.createAdapterTag(tag));
537
+ const versions = await this.adapter.getTagVersions(physicalTags);
538
+ return Object.fromEntries(
539
+ normalized.map((tag, index) => [
540
+ tag,
541
+ normalizeAdapterVersion(versions[physicalTags[index]])
542
+ ])
543
+ );
544
+ }
545
+ async isAdapterEntryStale(entry, now = Date.now()) {
546
+ if (typeof entry.revalidate === "number" && entry.revalidate > 0 && now - entry.createdAt >= entry.revalidate * 1e3) {
547
+ return true;
548
+ }
549
+ const currentVersions = await this.getAdapterTagVersions(entry.tags);
550
+ for (const tag of entry.tags) {
551
+ if (normalizeAdapterVersion(currentVersions[tag]) > normalizeAdapterVersion(entry.tagVersions?.[tag])) {
552
+ return true;
553
+ }
554
+ }
555
+ return false;
556
+ }
333
557
  };
334
558
  __name(_FarmDataCache, "FarmDataCache");
335
559
  var FarmDataCache = _FarmDataCache;
@@ -402,6 +626,52 @@ function normalizeCacheTag(tag) {
402
626
  return normalized;
403
627
  }
404
628
  __name(normalizeCacheTag, "normalizeCacheTag");
629
+ function normalizeCacheNamespace(namespace) {
630
+ if (typeof namespace !== "string") {
631
+ throw new TypeError("Cache namespace must be a string.");
632
+ }
633
+ const normalized = namespace.trim().replace(/:+$/g, "");
634
+ if (!normalized) {
635
+ throw new Error("Cache namespace cannot be empty.");
636
+ }
637
+ return normalized;
638
+ }
639
+ __name(normalizeCacheNamespace, "normalizeCacheNamespace");
640
+ function normalizeAdapterVersion(value) {
641
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
642
+ }
643
+ __name(normalizeAdapterVersion, "normalizeAdapterVersion");
644
+ function normalizePositiveDuration(value, fallback, name) {
645
+ if (value === void 0) return fallback;
646
+ if (!Number.isFinite(value) || value <= 0) {
647
+ throw new TypeError(`${name} must be a positive number of milliseconds.`);
648
+ }
649
+ return Math.floor(value);
650
+ }
651
+ __name(normalizePositiveDuration, "normalizePositiveDuration");
652
+ function delay(ms) {
653
+ return new Promise((resolve) => setTimeout(resolve, ms));
654
+ }
655
+ __name(delay, "delay");
656
+ function normalizeCacheOptionsTags(options) {
657
+ const tags = /* @__PURE__ */ new Set();
658
+ for (const tag of options.tags ?? []) {
659
+ tags.add(normalizeCacheTag(tag));
660
+ }
661
+ for (const routePath of options.paths ?? []) {
662
+ tags.add(createPathCacheTag(routePath));
663
+ }
664
+ return tags;
665
+ }
666
+ __name(normalizeCacheOptionsTags, "normalizeCacheOptionsTags");
667
+ function assertFarmCacheEntry(entry, expectedKey) {
668
+ if (!entry || typeof entry !== "object" || entry.key !== expectedKey || !Array.isArray(entry.tags) || typeof entry.createdAt !== "number") {
669
+ throw new TypeError(
670
+ `Cache adapter returned an invalid entry for ${JSON.stringify(expectedKey)}.`
671
+ );
672
+ }
673
+ }
674
+ __name(assertFarmCacheEntry, "assertFarmCacheEntry");
405
675
  function getFunctionCacheIdentity(fn) {
406
676
  if (fn.name) {
407
677
  return `name:${fn.name}`;