@farm.js/core 0.1.16 → 0.1.17

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 (180) hide show
  1. package/dist/agent-runtime.d.mts +3 -3
  2. package/dist/agent-runtime.d.ts +3 -3
  3. package/dist/api/client.cjs +62 -28
  4. package/dist/api/client.d.mts +3 -3
  5. package/dist/api/client.d.ts +3 -3
  6. package/dist/api/client.mjs +3 -3
  7. package/dist/api/route-manager.cjs +69 -32
  8. package/dist/api/route-manager.d.mts +3 -3
  9. package/dist/api/route-manager.d.ts +3 -3
  10. package/dist/api/route-manager.mjs +5 -5
  11. package/dist/api/runtime.cjs +65 -29
  12. package/dist/api/runtime.d.mts +3 -3
  13. package/dist/api/runtime.d.ts +3 -3
  14. package/dist/api/runtime.mjs +6 -3
  15. package/dist/{api-client-B-n3pm_Q.d.mts → api-client-Cx54IR5g.d.mts} +2 -2
  16. package/dist/{api-client-C0_NZEBl.d.ts → api-client-DykpaKcY.d.ts} +2 -2
  17. package/dist/api.cjs +106 -33
  18. package/dist/api.d.mts +5 -5
  19. package/dist/api.d.ts +5 -5
  20. package/dist/api.mjs +8 -8
  21. package/dist/{app-AyjEsCBq.d.ts → app-BHY_10Lm.d.ts} +3 -3
  22. package/dist/{app-CYPHeOo_.d.mts → app-BMk0do23.d.mts} +3 -3
  23. package/dist/app-markdown.d.mts +4 -4
  24. package/dist/app-markdown.d.ts +4 -4
  25. package/dist/app-markdown.mjs +3 -3
  26. package/dist/cache.cjs +62 -28
  27. package/dist/cache.d.mts +11 -1
  28. package/dist/cache.d.ts +11 -1
  29. package/dist/cache.mjs +1 -1
  30. package/dist/{chunk-7HDZYYS4.mjs → chunk-4OOBRCJX.mjs} +27 -5
  31. package/dist/{chunk-NHHKW2T6.mjs → chunk-56DAX2BE.mjs} +170 -52
  32. package/dist/{chunk-B76DT5Y6.mjs → chunk-57J3Y7Y3.mjs} +1 -1
  33. package/dist/{chunk-MOQNHLTS.mjs → chunk-5QOEPUYE.mjs} +5 -2
  34. package/dist/{chunk-HKLRP3BN.mjs → chunk-5SPPCN5J.mjs} +1 -1
  35. package/dist/{chunk-LUC2FAGW.mjs → chunk-6VQIKZZO.mjs} +1 -1
  36. package/dist/{chunk-7ZWL7XOU.mjs → chunk-76DG3LF3.mjs} +1 -1
  37. package/dist/{chunk-EWDK36MM.mjs → chunk-A72YEUZ3.mjs} +1 -1
  38. package/dist/{chunk-ZHOIQC6U.mjs → chunk-ATERBVHQ.mjs} +2 -2
  39. package/dist/{chunk-27JNCYEK.mjs → chunk-EN7WTEAY.mjs} +2 -2
  40. package/dist/{chunk-IGO2HEV7.mjs → chunk-F6SJAKFJ.mjs} +62 -28
  41. package/dist/{chunk-GSDIZACQ.mjs → chunk-FG5H2VCJ.mjs} +2 -2
  42. package/dist/{chunk-LZK5CXDW.mjs → chunk-KLSSO6YD.mjs} +2 -2
  43. package/dist/{chunk-KUO3GBPK.mjs → chunk-L6V3P73N.mjs} +1 -1
  44. package/dist/{chunk-TYVVIQ5M.mjs → chunk-MVIWBEJF.mjs} +32 -25
  45. package/dist/{chunk-KTGFMHET.mjs → chunk-N6UROPT7.mjs} +1 -1
  46. package/dist/{chunk-NDD2YVGU.mjs → chunk-NRVGEI5I.mjs} +10 -3
  47. package/dist/{chunk-IXTEENRS.mjs → chunk-QGVJVSNX.mjs} +5 -5
  48. package/dist/{chunk-6SCB2MXB.mjs → chunk-SXHV42UQ.mjs} +16 -1
  49. package/dist/{chunk-OWTIOHON.mjs → chunk-SYGGPS4A.mjs} +2 -2
  50. package/dist/{chunk-NC333MFA.mjs → chunk-TSWW5BVH.mjs} +7 -4
  51. package/dist/{chunk-LK6FGAQR.mjs → chunk-UDBJCUPA.mjs} +7 -4
  52. package/dist/{chunk-NUD6XBMO.mjs → chunk-UTBVHYS3.mjs} +2 -2
  53. package/dist/{chunk-76MNRHTS.mjs → chunk-UUYF3CHN.mjs} +2 -2
  54. package/dist/{chunk-VVTREAG5.mjs → chunk-WD4YXVLV.mjs} +11 -3
  55. package/dist/{chunk-UQZPTIML.mjs → chunk-WD5PNSOB.mjs} +2 -2
  56. package/dist/{chunk-DPZUDPVJ.mjs → chunk-XP777LRD.mjs} +1 -1
  57. package/dist/{chunk-KATQ6I56.mjs → chunk-XWAYMDLB.mjs} +1 -1
  58. package/dist/{chunk-IL5RWYK7.mjs → chunk-YD4J4XCI.mjs} +1 -1
  59. package/dist/{chunk-Q3MDL7TM.mjs → chunk-ZCNJKLA2.mjs} +30 -11
  60. package/dist/{client-plugins-CqVtZi5X.d.ts → client-plugins-C089bQhN.d.ts} +2 -2
  61. package/dist/{client-plugins-CIPRtSsW.d.mts → client-plugins-JXXmZliS.d.mts} +2 -2
  62. package/dist/client-plugins.d.mts +3 -3
  63. package/dist/client-plugins.d.ts +3 -3
  64. package/dist/client.cjs +62 -28
  65. package/dist/client.d.mts +8 -8
  66. package/dist/client.d.ts +8 -8
  67. package/dist/client.mjs +6 -6
  68. package/dist/config.d.mts +3 -3
  69. package/dist/config.d.ts +3 -3
  70. package/dist/cron.mjs +2 -2
  71. package/dist/{devtools-IU7LKZOH.mjs → devtools-UFVTMQX5.mjs} +7 -7
  72. package/dist/docs.cjs +18 -10
  73. package/dist/docs.mjs +9 -9
  74. package/dist/{endpoint-kSAxE52R.d.ts → endpoint-1zA994xL.d.ts} +1 -1
  75. package/dist/{endpoint-Bu3XgeMK.d.mts → endpoint-DAc96i93.d.mts} +1 -1
  76. package/dist/env.cjs +39 -5
  77. package/dist/env.d.mts +5 -3
  78. package/dist/env.d.ts +5 -3
  79. package/dist/env.mjs +2 -1
  80. package/dist/index.cjs +311 -93
  81. package/dist/index.d.mts +14 -14
  82. package/dist/index.d.ts +14 -14
  83. package/dist/index.mjs +34 -34
  84. package/dist/integrations.d.mts +3 -3
  85. package/dist/integrations.d.ts +3 -3
  86. package/dist/internal/app-markdown-runtime.d.mts +3 -3
  87. package/dist/internal/app-markdown-runtime.d.ts +3 -3
  88. package/dist/internal/app-markdown-runtime.mjs +2 -2
  89. package/dist/internal/build-runtime.cjs +342 -121
  90. package/dist/internal/build-runtime.d.mts +5 -5
  91. package/dist/internal/build-runtime.d.ts +5 -5
  92. package/dist/internal/build-runtime.mjs +23 -23
  93. package/dist/internal/cli-runtime.cjs +77 -31
  94. package/dist/internal/cli-runtime.mjs +13 -13
  95. package/dist/internal/client-error-overlay.cjs +1 -1
  96. package/dist/internal/client-error-overlay.mjs +1 -1
  97. package/dist/internal/compression-runtime.d.mts +3 -3
  98. package/dist/internal/compression-runtime.d.ts +3 -3
  99. package/dist/internal/config-runtime.cjs +14 -2
  100. package/dist/internal/config-runtime.d.mts +4 -4
  101. package/dist/internal/config-runtime.d.ts +4 -4
  102. package/dist/internal/config-runtime.mjs +7 -7
  103. package/dist/internal/product-telemetry-runtime.cjs +1 -1
  104. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  105. package/dist/internal/production-runtime.cjs +101 -41
  106. package/dist/internal/production-runtime.d.mts +9 -9
  107. package/dist/internal/production-runtime.d.ts +9 -9
  108. package/dist/internal/production-runtime.mjs +6 -6
  109. package/dist/markdown.cjs +16 -1
  110. package/dist/markdown.mjs +1 -1
  111. package/dist/{metadata-8g__AMPM.d.ts → metadata-BcNJP4fq.d.ts} +1 -1
  112. package/dist/{metadata-OMX6wFNf.d.mts → metadata-C1Z9vLbb.d.mts} +1 -1
  113. package/dist/middleware.cjs +10 -3
  114. package/dist/middleware.d.mts +5 -5
  115. package/dist/middleware.d.ts +5 -5
  116. package/dist/middleware.mjs +4 -4
  117. package/dist/{nitro-3N4ZXRYM.mjs → nitro-CVZ36JM5.mjs} +4 -4
  118. package/dist/plugin.cjs +256 -105
  119. package/dist/plugin.d.mts +3 -3
  120. package/dist/plugin.d.ts +3 -3
  121. package/dist/plugin.mjs +19 -19
  122. package/dist/{production-runtime-W3M0eNDV.d.mts → production-runtime-jcrTlRTb.d.mts} +1 -1
  123. package/dist/{production-runtime-BJh7o6Cr.d.ts → production-runtime-oKmC0WU-.d.ts} +1 -1
  124. package/dist/{render-plan-io7pvDNc.d.mts → render-plan-BLIfc4jt.d.mts} +1 -1
  125. package/dist/{render-plan-Be4ZGTJP.d.ts → render-plan-DOB9cV-h.d.ts} +1 -1
  126. package/dist/renderer-client.cjs +62 -28
  127. package/dist/renderer-client.d.mts +5 -5
  128. package/dist/renderer-client.d.ts +5 -5
  129. package/dist/renderer-client.mjs +3 -3
  130. package/dist/{request-DZkHYQ89.d.mts → request-Cr53NRHr.d.mts} +1 -1
  131. package/dist/{request-G8JhKr4F.d.ts → request-Dt2gNuQD.d.ts} +1 -1
  132. package/dist/request.d.mts +4 -4
  133. package/dist/request.d.ts +4 -4
  134. package/dist/{route-C_eLaFTZ.d.mts → route-B0XrsrFk.d.mts} +1 -1
  135. package/dist/{route-BxNJT447.d.ts → route-DOEpbyWZ.d.ts} +1 -1
  136. package/dist/{route-rendering-BcLLPJgN.d.ts → route-rendering-CWYd8Mv1.d.ts} +1 -1
  137. package/dist/{route-rendering-CbAKr1TY.d.mts → route-rendering-CeFBEAoZ.d.mts} +1 -1
  138. package/dist/routes.cjs +68 -31
  139. package/dist/routes.d.mts +4 -4
  140. package/dist/routes.d.ts +4 -4
  141. package/dist/routes.mjs +2 -2
  142. package/dist/server-fn-client.d.mts +3 -3
  143. package/dist/server-fn-client.d.ts +3 -3
  144. package/dist/server-fn.cjs +72 -30
  145. package/dist/server-fn.d.mts +1 -1
  146. package/dist/server-fn.d.ts +1 -1
  147. package/dist/server-fn.mjs +2 -2
  148. package/dist/server-plugins.d.mts +4 -4
  149. package/dist/server-plugins.d.ts +4 -4
  150. package/dist/server-query-client.cjs +62 -28
  151. package/dist/server-query-client.d.mts +1 -1
  152. package/dist/server-query-client.d.ts +1 -1
  153. package/dist/server-query-client.mjs +4 -4
  154. package/dist/server-query.cjs +72 -30
  155. package/dist/server-query.d.mts +1 -1
  156. package/dist/server-query.d.ts +1 -1
  157. package/dist/server-query.mjs +3 -3
  158. package/dist/server.cjs +239 -80
  159. package/dist/server.d.mts +9 -9
  160. package/dist/server.d.ts +9 -9
  161. package/dist/server.mjs +22 -22
  162. package/dist/{spa-router-BcS_4nqm.d.mts → spa-router-CQWiYGxS.d.mts} +2 -2
  163. package/dist/{spa-router-BzFBUJkn.d.ts → spa-router-Wjiw-8hB.d.ts} +2 -2
  164. package/dist/testing.cjs +73 -32
  165. package/dist/testing.d.mts +3 -3
  166. package/dist/testing.d.ts +3 -3
  167. package/dist/testing.mjs +11 -7
  168. package/dist/{utils-C4yrAhNc.d.ts → utils-B0XJmG_b.d.ts} +1 -1
  169. package/dist/{utils-5kQP1mFR.d.mts → utils-uUxF0K0P.d.mts} +1 -1
  170. package/dist/version.cjs +1 -1
  171. package/dist/version.mjs +1 -1
  172. package/dist/vite.cjs +260 -109
  173. package/dist/vite.d.mts +3 -3
  174. package/dist/vite.d.ts +3 -3
  175. package/dist/vite.mjs +19 -19
  176. package/dist/workflows.mjs +2 -2
  177. package/package.json +2 -2
  178. package/dist/{chunk-VO5SCWF5.mjs → chunk-BNGS6KJ6.mjs} +0 -0
  179. package/dist/{chunk-MUUZJLCI.mjs → chunk-EGJDUF4Q.mjs} +3 -3
  180. package/dist/{chunk-4L7SZOHZ.mjs → chunk-YHOCRI4H.mjs} +3 -3
@@ -1,4 +1,4 @@
1
- import { w as FarmConfig, P as ParsedRoute, ao as ResolvedFarmRouteRuntimeConfig, ap as ApplicationMetadataRouteKind, k as RouteModule, a0 as LayoutModule, a5 as SSGCollectionResult, b as FarmRequest, c as FarmResponse, aq as ResolvedFarmAPIConfig, m as FarmMdxResolvedConfig, ar as ResolvedFarmDevtoolsConfig, as as ResolvedFarmDevIndicatorsConfig, at as ResolvedFarmAuthConfig, au as ResolvedFarmPerformanceConfig, av as ResolvedFarmSecurityConfig } from './client-plugins-CqVtZi5X.js';
1
+ import { w as FarmConfig, P as ParsedRoute, ao as ResolvedFarmRouteRuntimeConfig, ap as ApplicationMetadataRouteKind, k as RouteModule, a0 as LayoutModule, a5 as SSGCollectionResult, b as FarmRequest, c as FarmResponse, aq as ResolvedFarmAPIConfig, m as FarmMdxResolvedConfig, ar as ResolvedFarmDevtoolsConfig, as as ResolvedFarmDevIndicatorsConfig, at as ResolvedFarmAuthConfig, au as ResolvedFarmPerformanceConfig, av as ResolvedFarmSecurityConfig } from './client-plugins-C089bQhN.js';
2
2
  import { F as FarmDocsResolvedConfig } from './types-D-1WTE72.js';
3
3
  import { FarmMarkdownResolvedConfig } from './markdown.js';
4
4
  import { F as FarmWorkflowsResolvedConfig } from './workflows-CR9ex-gz.js';
@@ -7,9 +7,9 @@ import { R as ResolvedFarmImageConfig } from './image-config-Duob7wER.js';
7
7
  import { ProgrammaticRedirectRoute, ProgrammaticRouteSearchClientOptions } from './routes.js';
8
8
  import { ViteDevServer } from 'vite';
9
9
  import { F as FarmIslandStrategy } from './island-CfGru1MO.js';
10
- import { M as MetadataImageKind } from './metadata-8g__AMPM.js';
10
+ import { M as MetadataImageKind } from './metadata-BcNJP4fq.js';
11
11
  import { FarmServerRendererRuntime, FarmRenderer } from './renderer.js';
12
- import { F as FarmRouteRenderPlan } from './render-plan-Be4ZGTJP.js';
12
+ import { F as FarmRouteRenderPlan } from './render-plan-DOB9cV-h.js';
13
13
  import { R as ResolvedFarmI18nConfig } from './types-Z0aotQ8w.js';
14
14
  import { F as FarmI18nRuntime } from './runtime-BirxPwbZ.js';
15
15
  import { R as ResolvedFarmThemeConfig } from './types-DQnyD3VD.js';
@@ -1,4 +1,4 @@
1
- import { w as FarmConfig, P as ParsedRoute, ao as ResolvedFarmRouteRuntimeConfig, ap as ApplicationMetadataRouteKind, k as RouteModule, a0 as LayoutModule, a5 as SSGCollectionResult, b as FarmRequest, c as FarmResponse, aq as ResolvedFarmAPIConfig, m as FarmMdxResolvedConfig, ar as ResolvedFarmDevtoolsConfig, as as ResolvedFarmDevIndicatorsConfig, at as ResolvedFarmAuthConfig, au as ResolvedFarmPerformanceConfig, av as ResolvedFarmSecurityConfig } from './client-plugins-CIPRtSsW.mjs';
1
+ import { w as FarmConfig, P as ParsedRoute, ao as ResolvedFarmRouteRuntimeConfig, ap as ApplicationMetadataRouteKind, k as RouteModule, a0 as LayoutModule, a5 as SSGCollectionResult, b as FarmRequest, c as FarmResponse, aq as ResolvedFarmAPIConfig, m as FarmMdxResolvedConfig, ar as ResolvedFarmDevtoolsConfig, as as ResolvedFarmDevIndicatorsConfig, at as ResolvedFarmAuthConfig, au as ResolvedFarmPerformanceConfig, av as ResolvedFarmSecurityConfig } from './client-plugins-JXXmZliS.mjs';
2
2
  import { F as FarmDocsResolvedConfig } from './types-D-1WTE72.mjs';
3
3
  import { FarmMarkdownResolvedConfig } from './markdown.mjs';
4
4
  import { F as FarmWorkflowsResolvedConfig } from './workflows-CR9ex-gz.mjs';
@@ -7,9 +7,9 @@ import { R as ResolvedFarmImageConfig } from './image-config-Duob7wER.mjs';
7
7
  import { ProgrammaticRedirectRoute, ProgrammaticRouteSearchClientOptions } from './routes.mjs';
8
8
  import { ViteDevServer } from 'vite';
9
9
  import { F as FarmIslandStrategy } from './island-CfGru1MO.mjs';
10
- import { M as MetadataImageKind } from './metadata-OMX6wFNf.mjs';
10
+ import { M as MetadataImageKind } from './metadata-C1Z9vLbb.mjs';
11
11
  import { FarmServerRendererRuntime, FarmRenderer } from './renderer.mjs';
12
- import { F as FarmRouteRenderPlan } from './render-plan-io7pvDNc.mjs';
12
+ import { F as FarmRouteRenderPlan } from './render-plan-BLIfc4jt.mjs';
13
13
  import { R as ResolvedFarmI18nConfig } from './types-Z0aotQ8w.mjs';
14
14
  import { F as FarmI18nRuntime } from './runtime-AOJge4vQ.mjs';
15
15
  import { R as ResolvedFarmThemeConfig } from './types-DQnyD3VD.mjs';
@@ -1,10 +1,10 @@
1
- import { l as FarmMdxComponents, m as FarmMdxResolvedConfig, k as RouteModule } from './client-plugins-CIPRtSsW.mjs';
2
- export { o as FarmMdxComponent, p as FarmMdxUserConfig, r as resolveFarmMdxComponentsModulePath, n as resolveMdxConfig } from './client-plugins-CIPRtSsW.mjs';
1
+ import { l as FarmMdxComponents, m as FarmMdxResolvedConfig, k as RouteModule } from './client-plugins-JXXmZliS.mjs';
2
+ export { o as FarmMdxComponent, p as FarmMdxUserConfig, r as resolveFarmMdxComponentsModulePath, n as resolveMdxConfig } from './client-plugins-JXXmZliS.mjs';
3
3
  export { FarmMarkdownPageModuleInput, FarmMarkdownPageSource, createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, createMarkdownMetadata, isFarmMarkdownPageFile, normalizeFarmMarkdownRoutePath, parseMarkdownFrontmatter, titleFromMarkdown } from './internal/app-markdown-runtime.mjs';
4
4
  export { FARM_MARKDOWN_CONTENT_TYPE, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from './markdown.mjs';
5
5
  import './lifecycle-DK06VuKP.mjs';
6
- import './route-C_eLaFTZ.mjs';
7
- import './endpoint-Bu3XgeMK.mjs';
6
+ import './route-B0XrsrFk.mjs';
7
+ import './endpoint-DAc96i93.mjs';
8
8
  import './cache.mjs';
9
9
  import './renderer.mjs';
10
10
  import './deployment.mjs';
@@ -1,10 +1,10 @@
1
- import { l as FarmMdxComponents, m as FarmMdxResolvedConfig, k as RouteModule } from './client-plugins-CqVtZi5X.js';
2
- export { o as FarmMdxComponent, p as FarmMdxUserConfig, r as resolveFarmMdxComponentsModulePath, n as resolveMdxConfig } from './client-plugins-CqVtZi5X.js';
1
+ import { l as FarmMdxComponents, m as FarmMdxResolvedConfig, k as RouteModule } from './client-plugins-C089bQhN.js';
2
+ export { o as FarmMdxComponent, p as FarmMdxUserConfig, r as resolveFarmMdxComponentsModulePath, n as resolveMdxConfig } from './client-plugins-C089bQhN.js';
3
3
  export { FarmMarkdownPageModuleInput, FarmMarkdownPageSource, createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, createMarkdownMetadata, isFarmMarkdownPageFile, normalizeFarmMarkdownRoutePath, parseMarkdownFrontmatter, titleFromMarkdown } from './internal/app-markdown-runtime.js';
4
4
  export { FARM_MARKDOWN_CONTENT_TYPE, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from './markdown.js';
5
5
  import './lifecycle-DK06VuKP.js';
6
- import './route-BxNJT447.js';
7
- import './endpoint-kSAxE52R.js';
6
+ import './route-DOEpbyWZ.js';
7
+ import './endpoint-1zA994xL.js';
8
8
  import './cache.js';
9
9
  import './renderer.js';
10
10
  import './deployment.js';
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createFarmMarkdownRouteModuleFromFile,
3
3
  loadFarmMdxComponents
4
- } from "./chunk-KATQ6I56.mjs";
4
+ } from "./chunk-XWAYMDLB.mjs";
5
5
  import {
6
6
  createFarmMarkdownRouteModule,
7
7
  createFarmMarkdownSourceResponse,
@@ -10,7 +10,7 @@ import {
10
10
  normalizeFarmMarkdownRoutePath,
11
11
  parseMarkdownFrontmatter,
12
12
  titleFromMarkdown
13
- } from "./chunk-LUC2FAGW.mjs";
13
+ } from "./chunk-6VQIKZZO.mjs";
14
14
  import {
15
15
  resolveFarmMdxComponentsModulePath,
16
16
  resolveMdxConfig
@@ -19,7 +19,7 @@ import {
19
19
  FARM_MARKDOWN_CONTENT_TYPE,
20
20
  createFarmMarkdownErrorBody,
21
21
  farmRequestWantsMarkdown
22
- } from "./chunk-6SCB2MXB.mjs";
22
+ } from "./chunk-SXHV42UQ.mjs";
23
23
  import "./chunk-LPEX4YW6.mjs";
24
24
  export {
25
25
  FARM_MARKDOWN_CONTENT_TYPE,
package/dist/cache.cjs CHANGED
@@ -658,6 +658,8 @@ var _FarmDataCache = class _FarmDataCache {
658
658
  constructor(config = {}) {
659
659
  this.entries = /* @__PURE__ */ new Map();
660
660
  this.inflight = /* @__PURE__ */ new Map();
661
+ /** Local entries by tag, so tag counts and pruning never scan unrelated entries. */
662
+ this.entriesByTag = /* @__PURE__ */ new Map();
661
663
  this.invalidatedTagVersions = /* @__PURE__ */ new Map();
662
664
  this.activeGenerations = /* @__PURE__ */ new Set();
663
665
  this.version = 0;
@@ -676,6 +678,7 @@ var _FarmDataCache = class _FarmDataCache {
676
678
  configure(config = {}) {
677
679
  this.generation++;
678
680
  this.entries.clear();
681
+ this.entriesByTag.clear();
679
682
  this.inflight.clear();
680
683
  this.invalidatedTagVersions.clear();
681
684
  this.activeGenerations.clear();
@@ -842,14 +845,12 @@ var _FarmDataCache = class _FarmDataCache {
842
845
  return entry;
843
846
  }
844
847
  delete(key) {
845
- const deleted = this.entries.delete(key);
846
- if (deleted) this.pruneInvalidatedTagVersions();
848
+ const deleted = this.deleteLocalEntry(key);
847
849
  emitFarmEvent({ type: "cache.delete", key, deleted });
848
850
  return deleted;
849
851
  }
850
852
  async deleteAsync(key) {
851
- const deleted = this.entries.delete(key);
852
- if (deleted) this.pruneInvalidatedTagVersions();
853
+ const deleted = this.deleteLocalEntry(key);
853
854
  if (this.adapter) {
854
855
  await this.adapter.delete(this.createAdapterKey(key));
855
856
  }
@@ -860,6 +861,7 @@ var _FarmDataCache = class _FarmDataCache {
860
861
  const count = this.entries.size;
861
862
  this.generation++;
862
863
  this.entries.clear();
864
+ this.entriesByTag.clear();
863
865
  this.inflight.clear();
864
866
  this.invalidatedTagVersions.clear();
865
867
  this.activeGenerations.clear();
@@ -945,23 +947,32 @@ var _FarmDataCache = class _FarmDataCache {
945
947
  return cached.value;
946
948
  }
947
949
  const inflight = this.inflight.get(key);
948
- if (inflight) {
950
+ if (inflight && !this.wasInvalidatedSince(inflight.tags, inflight.startVersion)) {
949
951
  emitFarmEvent({ type: "cache.dedupe", key });
950
- return inflight;
952
+ return inflight.promise;
951
953
  }
952
954
  const tags = Array.from(normalizeCacheOptionsTags(options));
953
955
  const generation = this.generation;
956
+ const startVersion = this.version;
954
957
  const promise = this.fillCacheEntry(key, producer, options, tags, generation).catch((error) => {
955
958
  emitFarmEvent({ type: "cache.error", key, operation: "set", error });
956
959
  throw error;
957
960
  }).finally(() => {
958
- if (this.inflight.get(key) === promise) {
961
+ if (this.inflight.get(key)?.promise === promise) {
959
962
  this.inflight.delete(key);
960
963
  }
961
964
  });
962
- this.inflight.set(key, promise);
965
+ this.inflight.set(key, { promise, tags, startVersion });
963
966
  return promise;
964
967
  }
968
+ /** A fill that started before one of its tags was invalidated cannot satisfy later readers. */
969
+ wasInvalidatedSince(tags, version) {
970
+ for (const tag of tags) {
971
+ const invalidatedVersion = this.invalidatedTagVersions.get(tag);
972
+ if (invalidatedVersion !== void 0 && invalidatedVersion > version) return true;
973
+ }
974
+ return false;
975
+ }
965
976
  async fillCacheEntry(key, producer, options, tags, generation) {
966
977
  const adapter = this.adapter;
967
978
  const namespace = this.namespace;
@@ -1002,7 +1013,7 @@ var _FarmDataCache = class _FarmDataCache {
1002
1013
  return value;
1003
1014
  } finally {
1004
1015
  this.activeGenerations.delete(activeGeneration);
1005
- this.pruneInvalidatedTagVersions();
1016
+ this.pruneInvalidatedTagVersions(activeGeneration.tags);
1006
1017
  if (leaseToken && adapter?.releaseLease) {
1007
1018
  try {
1008
1019
  await adapter.releaseLease(leaseKey, leaseToken);
@@ -1047,18 +1058,9 @@ var _FarmDataCache = class _FarmDataCache {
1047
1058
  }
1048
1059
  return void 0;
1049
1060
  }
1050
- countEntriesForTag(tag) {
1051
- let count = 0;
1052
- for (const entry of this.entries.values()) {
1053
- if (entry.tags.has(tag)) {
1054
- count++;
1055
- }
1056
- }
1057
- return count;
1058
- }
1059
1061
  countEntriesForTags(tags) {
1060
1062
  let count = 0;
1061
- for (const entry of this.entries.values()) {
1063
+ for (const entry of this.entriesByTag.get(tags[0]) ?? []) {
1062
1064
  if (tags.every((tag) => entry.tags.has(tag))) {
1063
1065
  count++;
1064
1066
  }
@@ -1066,10 +1068,10 @@ var _FarmDataCache = class _FarmDataCache {
1066
1068
  return count;
1067
1069
  }
1068
1070
  invalidateTag(normalizedTag) {
1069
- const count = this.countEntriesForTag(normalizedTag);
1071
+ const count = this.entriesByTag.get(normalizedTag)?.size ?? 0;
1070
1072
  this.invalidatedTagVersions.delete(normalizedTag);
1071
1073
  this.invalidatedTagVersions.set(normalizedTag, ++this.version);
1072
- this.pruneInvalidatedTagVersions();
1074
+ this.pruneInvalidatedTagVersions([normalizedTag]);
1073
1075
  return count;
1074
1076
  }
1075
1077
  toPublicEntry(entry) {
@@ -1099,19 +1101,51 @@ var _FarmDataCache = class _FarmDataCache {
1099
1101
  this.entries.set(key, entry);
1100
1102
  }
1101
1103
  storeLocalEntry(entry) {
1102
- this.entries.delete(entry.key);
1104
+ const removed = [];
1105
+ const replaced = this.detachLocalEntry(entry.key);
1106
+ if (replaced) removed.push(replaced);
1103
1107
  this.entries.set(entry.key, entry);
1108
+ for (const tag of entry.tags) {
1109
+ let tagged = this.entriesByTag.get(tag);
1110
+ if (!tagged) this.entriesByTag.set(tag, tagged = /* @__PURE__ */ new Set());
1111
+ tagged.add(entry);
1112
+ }
1104
1113
  while (this.entries.size > this.maxEntries) {
1105
1114
  const oldestKey = this.entries.keys().next().value;
1106
1115
  if (oldestKey === void 0) break;
1107
- this.entries.delete(oldestKey);
1116
+ removed.push(this.detachLocalEntry(oldestKey));
1108
1117
  }
1109
- this.pruneInvalidatedTagVersions();
1118
+ for (const removedEntry of removed) this.pruneInvalidatedTagVersions(removedEntry.tags);
1119
+ }
1120
+ deleteLocalEntry(key) {
1121
+ const entry = this.detachLocalEntry(key);
1122
+ if (!entry) return false;
1123
+ this.pruneInvalidatedTagVersions(entry.tags);
1124
+ return true;
1125
+ }
1126
+ detachLocalEntry(key) {
1127
+ const entry = this.entries.get(key);
1128
+ if (!entry) return void 0;
1129
+ this.entries.delete(key);
1130
+ for (const tag of entry.tags) {
1131
+ const tagged = this.entriesByTag.get(tag);
1132
+ if (!tagged) continue;
1133
+ tagged.delete(entry);
1134
+ if (tagged.size === 0) this.entriesByTag.delete(tag);
1135
+ }
1136
+ return entry;
1110
1137
  }
1111
- pruneInvalidatedTagVersions() {
1112
- tags: for (const [tag, invalidatedVersion] of this.invalidatedTagVersions) {
1113
- for (const entry of this.entries.values()) {
1114
- if (entry.tags.has(tag) && entry.createdVersion < invalidatedVersion) continue tags;
1138
+ /**
1139
+ * Drop invalidation versions that no local entry or active fill can be stale against.
1140
+ * Callers pass only the tags whose dependents just changed, so the cost is bounded by
1141
+ * the entries sharing those tags rather than by the whole cache.
1142
+ */
1143
+ pruneInvalidatedTagVersions(tags) {
1144
+ tags: for (const tag of tags) {
1145
+ const invalidatedVersion = this.invalidatedTagVersions.get(tag);
1146
+ if (invalidatedVersion === void 0) continue;
1147
+ for (const entry of this.entriesByTag.get(tag) ?? []) {
1148
+ if (entry.createdVersion < invalidatedVersion) continue tags;
1115
1149
  }
1116
1150
  for (const generation of this.activeGenerations) {
1117
1151
  if (generation.tags.has(tag) && generation.createdVersion < invalidatedVersion)
package/dist/cache.d.mts CHANGED
@@ -160,6 +160,8 @@ interface FarmCacheStaleEntry {
160
160
  declare class FarmDataCache {
161
161
  private entries;
162
162
  private inflight;
163
+ /** Local entries by tag, so tag counts and pruning never scan unrelated entries. */
164
+ private entriesByTag;
163
165
  private invalidatedTagVersions;
164
166
  private activeGenerations;
165
167
  private version;
@@ -197,15 +199,23 @@ declare class FarmDataCache {
197
199
  revalidatePath(routePath: string): number;
198
200
  revalidatePathAsync(routePath: string): Promise<number>;
199
201
  getOrSet<T>(key: string, producer: () => Promise<T> | T, options?: FarmCacheOptions): Promise<T>;
202
+ /** A fill that started before one of its tags was invalidated cannot satisfy later readers. */
203
+ private wasInvalidatedSince;
200
204
  private fillCacheEntry;
201
205
  private waitForAdapterEntry;
202
- private countEntriesForTag;
203
206
  private countEntriesForTags;
204
207
  private invalidateTag;
205
208
  private toPublicEntry;
206
209
  private hydrateLocalEntry;
207
210
  private touchEntry;
208
211
  private storeLocalEntry;
212
+ private deleteLocalEntry;
213
+ private detachLocalEntry;
214
+ /**
215
+ * Drop invalidation versions that no local entry or active fill can be stale against.
216
+ * Callers pass only the tags whose dependents just changed, so the cost is bounded by
217
+ * the entries sharing those tags rather than by the whole cache.
218
+ */
209
219
  private pruneInvalidatedTagVersions;
210
220
  private createAdapterKey;
211
221
  private createAdapterTag;
package/dist/cache.d.ts CHANGED
@@ -160,6 +160,8 @@ interface FarmCacheStaleEntry {
160
160
  declare class FarmDataCache {
161
161
  private entries;
162
162
  private inflight;
163
+ /** Local entries by tag, so tag counts and pruning never scan unrelated entries. */
164
+ private entriesByTag;
163
165
  private invalidatedTagVersions;
164
166
  private activeGenerations;
165
167
  private version;
@@ -197,15 +199,23 @@ declare class FarmDataCache {
197
199
  revalidatePath(routePath: string): number;
198
200
  revalidatePathAsync(routePath: string): Promise<number>;
199
201
  getOrSet<T>(key: string, producer: () => Promise<T> | T, options?: FarmCacheOptions): Promise<T>;
202
+ /** A fill that started before one of its tags was invalidated cannot satisfy later readers. */
203
+ private wasInvalidatedSince;
200
204
  private fillCacheEntry;
201
205
  private waitForAdapterEntry;
202
- private countEntriesForTag;
203
206
  private countEntriesForTags;
204
207
  private invalidateTag;
205
208
  private toPublicEntry;
206
209
  private hydrateLocalEntry;
207
210
  private touchEntry;
208
211
  private storeLocalEntry;
212
+ private deleteLocalEntry;
213
+ private detachLocalEntry;
214
+ /**
215
+ * Drop invalidation versions that no local entry or active fill can be stale against.
216
+ * Callers pass only the tags whose dependents just changed, so the cost is bounded by
217
+ * the entries sharing those tags rather than by the whole cache.
218
+ */
209
219
  private pruneInvalidatedTagVersions;
210
220
  private createAdapterKey;
211
221
  private createAdapterTag;
package/dist/cache.mjs CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  storageCacheAdapter,
18
18
  unstable_cache,
19
19
  updateTag
20
- } from "./chunk-IGO2HEV7.mjs";
20
+ } from "./chunk-F6SJAKFJ.mjs";
21
21
  import {
22
22
  applyFarmCacheInvalidations
23
23
  } from "./chunk-4SIYUGRY.mjs";
@@ -1,3 +1,6 @@
1
+ import {
2
+ readFarmEnvironmentValue
3
+ } from "./chunk-ONUEYC6N.mjs";
1
4
  import {
2
5
  __name
3
6
  } from "./chunk-LPEX4YW6.mjs";
@@ -20,10 +23,12 @@ function createBundledEnv(env2, source = getProcessEnv()) {
20
23
  const server = {};
21
24
  const runtime = {};
22
25
  for (const [key, value] of Object.entries(resolved.server)) {
23
- if (source[key] === void 0) {
24
- server[key] = value;
26
+ const raw = source[key];
27
+ const type = getRuntimeEnvType(value);
28
+ if (raw !== void 0 && isSameEnvValue(coerceRuntimeEnvValue(raw, type), value)) {
29
+ runtime[key] = type;
25
30
  } else {
26
- runtime[key] = getRuntimeEnvType(value);
31
+ server[key] = value;
27
32
  }
28
33
  }
29
34
  return {
@@ -148,9 +153,8 @@ __name(readServerEnvKey, "readServerEnvKey");
148
153
  function readRuntimeServerEnv(env2) {
149
154
  const state = env2[FARM_ENV_RUNTIME_SYMBOL];
150
155
  if (!state) return;
151
- const source = getProcessEnv();
152
156
  for (const [key, type] of Object.entries(state.pending)) {
153
- const raw = source[key];
157
+ const raw = readFarmEnvironmentValue(key);
154
158
  if (raw === void 0) continue;
155
159
  env2.server[key] = coerceRuntimeEnvValue(raw, type);
156
160
  delete state.pending[key];
@@ -184,6 +188,24 @@ function coerceRuntimeEnvValue(raw, type) {
184
188
  return raw;
185
189
  }
186
190
  __name(coerceRuntimeEnvValue, "coerceRuntimeEnvValue");
191
+ function isSameEnvValue(left, right) {
192
+ if (Object.is(left, right)) return true;
193
+ if (Array.isArray(left) || Array.isArray(right)) {
194
+ return Array.isArray(left) && Array.isArray(right) && left.length === right.length && left.every((item, index) => isSameEnvValue(item, right[index]));
195
+ }
196
+ if (!isPlainObject(left) || !isPlainObject(right)) return false;
197
+ const keys = Object.keys(left);
198
+ return keys.length === Object.keys(right).length && keys.every(
199
+ (key) => Object.prototype.hasOwnProperty.call(right, key) && isSameEnvValue(left[key], right[key])
200
+ );
201
+ }
202
+ __name(isSameEnvValue, "isSameEnvValue");
203
+ function isPlainObject(value) {
204
+ if (!value || typeof value !== "object") return false;
205
+ const prototype = Object.getPrototypeOf(value);
206
+ return prototype === Object.prototype || prototype === null;
207
+ }
208
+ __name(isPlainObject, "isPlainObject");
187
209
  function prepareEnv(env2) {
188
210
  const normalized = normalizeResolvedEnv(env2);
189
211
  const runtime = env2.runtime?.server;