@farm.js/core 0.1.15 → 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 +5 -2
  2. package/dist/agent-runtime.d.ts +5 -2
  3. package/dist/api/client.cjs +62 -28
  4. package/dist/api/client.d.mts +3 -2
  5. package/dist/api/client.d.ts +3 -2
  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 +5 -2
  9. package/dist/api/route-manager.d.ts +5 -2
  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 -2
  13. package/dist/api/runtime.d.ts +3 -2
  14. package/dist/api/runtime.mjs +6 -3
  15. package/dist/{api-client-C8d7BZNp.d.mts → api-client-Cx54IR5g.d.mts} +2 -1
  16. package/dist/{api-client-BWrEbxfO.d.ts → api-client-DykpaKcY.d.ts} +2 -1
  17. package/dist/api.cjs +106 -33
  18. package/dist/api.d.mts +7 -4
  19. package/dist/api.d.ts +7 -4
  20. package/dist/api.mjs +8 -8
  21. package/dist/{app-wIYse61b.d.ts → app-BHY_10Lm.d.ts} +3 -3
  22. package/dist/{app-B3nVSjen.d.mts → app-BMk0do23.d.mts} +3 -3
  23. package/dist/app-markdown.d.mts +6 -3
  24. package/dist/app-markdown.d.ts +6 -3
  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-FOGLGRDS.mjs → chunk-4OOBRCJX.mjs} +122 -8
  31. package/dist/{chunk-JRF3C33L.mjs → chunk-56DAX2BE.mjs} +172 -53
  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-FBHGHMOA.mjs → chunk-MVIWBEJF.mjs} +37 -27
  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-GNTPTTLA.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-NJ47VORC.mjs → chunk-UTBVHYS3.mjs} +2 -2
  53. package/dist/{chunk-76MNRHTS.mjs → chunk-UUYF3CHN.mjs} +2 -2
  54. package/dist/{chunk-S3QW3BIS.mjs → chunk-WD4YXVLV.mjs} +99 -6
  55. package/dist/{chunk-W7IVHTOP.mjs → chunk-WD5PNSOB.mjs} +16 -3
  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-UE75PB52.mjs → chunk-YD4J4XCI.mjs} +1 -1
  59. package/dist/{chunk-Q3MDL7TM.mjs → chunk-ZCNJKLA2.mjs} +30 -11
  60. package/dist/{client-plugins-CslwYp3E.d.ts → client-plugins-C089bQhN.d.ts} +16 -4
  61. package/dist/{client-plugins-C1EgdoJM.d.mts → client-plugins-JXXmZliS.d.mts} +16 -4
  62. package/dist/client-plugins.d.mts +5 -2
  63. package/dist/client-plugins.d.ts +5 -2
  64. package/dist/client.cjs +62 -28
  65. package/dist/client.d.mts +8 -7
  66. package/dist/client.d.ts +8 -7
  67. package/dist/client.mjs +6 -6
  68. package/dist/config.d.mts +5 -2
  69. package/dist/config.d.ts +5 -2
  70. package/dist/cron.mjs +2 -2
  71. package/dist/{devtools-PCGEBRSC.mjs → devtools-UFVTMQX5.mjs} +7 -7
  72. package/dist/docs.cjs +83 -4
  73. package/dist/docs.mjs +9 -9
  74. package/dist/{route-CHBaW55F.d.ts → endpoint-1zA994xL.d.ts} +3 -128
  75. package/dist/{route-C6UClI1z.d.mts → endpoint-DAc96i93.d.mts} +3 -128
  76. package/dist/env.cjs +135 -8
  77. package/dist/env.d.mts +22 -2
  78. package/dist/env.d.ts +22 -2
  79. package/dist/env.mjs +4 -1
  80. package/dist/index.cjs +516 -105
  81. package/dist/index.d.mts +16 -15
  82. package/dist/index.d.ts +16 -15
  83. package/dist/index.mjs +46 -34
  84. package/dist/integrations.d.mts +5 -2
  85. package/dist/integrations.d.ts +5 -2
  86. package/dist/internal/app-markdown-runtime.d.mts +5 -2
  87. package/dist/internal/app-markdown-runtime.d.ts +5 -2
  88. package/dist/internal/app-markdown-runtime.mjs +2 -2
  89. package/dist/internal/build-runtime.cjs +600 -284
  90. package/dist/internal/build-runtime.d.mts +7 -4
  91. package/dist/internal/build-runtime.d.ts +7 -4
  92. package/dist/internal/build-runtime.mjs +23 -23
  93. package/dist/internal/cli-runtime.cjs +143 -33
  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 +5 -2
  98. package/dist/internal/compression-runtime.d.ts +5 -2
  99. package/dist/internal/config-runtime.cjs +80 -4
  100. package/dist/internal/config-runtime.d.mts +6 -3
  101. package/dist/internal/config-runtime.d.ts +6 -3
  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 +11 -8
  107. package/dist/internal/production-runtime.d.ts +11 -8
  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-BsUcOEXg.d.ts → metadata-BcNJP4fq.d.ts} +1 -1
  112. package/dist/{metadata-B1bxCPUY.d.mts → metadata-C1Z9vLbb.d.mts} +1 -1
  113. package/dist/middleware.cjs +10 -3
  114. package/dist/middleware.d.mts +7 -4
  115. package/dist/middleware.d.ts +7 -4
  116. package/dist/middleware.mjs +4 -4
  117. package/dist/{nitro-ICBP5APY.mjs → nitro-CVZ36JM5.mjs} +8 -5
  118. package/dist/plugin.cjs +358 -106
  119. package/dist/plugin.d.mts +5 -2
  120. package/dist/plugin.d.ts +5 -2
  121. package/dist/plugin.mjs +19 -19
  122. package/dist/{production-runtime-BDllolVh.d.mts → production-runtime-jcrTlRTb.d.mts} +1 -1
  123. package/dist/{production-runtime-CsNn2-zx.d.ts → production-runtime-oKmC0WU-.d.ts} +1 -1
  124. package/dist/{render-plan-CNUlzylR.d.mts → render-plan-BLIfc4jt.d.mts} +1 -1
  125. package/dist/{render-plan-EG4hNFjy.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 -4
  128. package/dist/renderer-client.d.ts +5 -4
  129. package/dist/renderer-client.mjs +3 -3
  130. package/dist/{request-Blh_f7Z3.d.mts → request-Cr53NRHr.d.mts} +1 -1
  131. package/dist/{request-DsVSQVfD.d.ts → request-Dt2gNuQD.d.ts} +1 -1
  132. package/dist/request.d.mts +6 -3
  133. package/dist/request.d.ts +6 -3
  134. package/dist/route-B0XrsrFk.d.mts +128 -0
  135. package/dist/route-DOEpbyWZ.d.ts +128 -0
  136. package/dist/{route-rendering-hUETRCbM.d.ts → route-rendering-CWYd8Mv1.d.ts} +1 -1
  137. package/dist/{route-rendering-LT4XSoQK.d.mts → route-rendering-CeFBEAoZ.d.mts} +1 -1
  138. package/dist/routes.cjs +68 -31
  139. package/dist/routes.d.mts +5 -3
  140. package/dist/routes.d.ts +5 -3
  141. package/dist/routes.mjs +2 -2
  142. package/dist/server-fn-client.d.mts +3 -2
  143. package/dist/server-fn-client.d.ts +3 -2
  144. package/dist/server-fn.cjs +212 -32
  145. package/dist/server-fn.d.mts +72 -1
  146. package/dist/server-fn.d.ts +72 -1
  147. package/dist/server-fn.mjs +13 -2
  148. package/dist/server-plugins.d.mts +6 -3
  149. package/dist/server-plugins.d.ts +6 -3
  150. package/dist/server-query-client.cjs +62 -28
  151. package/dist/server-query-client.d.mts +1 -0
  152. package/dist/server-query-client.d.ts +1 -0
  153. package/dist/server-query-client.mjs +4 -4
  154. package/dist/server-query.cjs +131 -32
  155. package/dist/server-query.d.mts +6 -1
  156. package/dist/server-query.d.ts +6 -1
  157. package/dist/server-query.mjs +4 -3
  158. package/dist/server.cjs +393 -84
  159. package/dist/server.d.mts +9 -8
  160. package/dist/server.d.ts +9 -8
  161. package/dist/server.mjs +22 -22
  162. package/dist/{spa-router-csKR9Ebj.d.mts → spa-router-CQWiYGxS.d.mts} +2 -2
  163. package/dist/{spa-router-Y_2FSJQK.d.ts → spa-router-Wjiw-8hB.d.ts} +2 -2
  164. package/dist/testing.cjs +73 -32
  165. package/dist/testing.d.mts +5 -3
  166. package/dist/testing.d.ts +5 -3
  167. package/dist/testing.mjs +11 -7
  168. package/dist/{utils-jISOE9SD.d.ts → utils-B0XJmG_b.d.ts} +1 -1
  169. package/dist/{utils-DR2wfZAn.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 +500 -252
  173. package/dist/vite.d.mts +5 -2
  174. package/dist/vite.d.ts +5 -2
  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
package/dist/api.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  farmApiPlugin
3
- } from "./chunk-LK6FGAQR.mjs";
3
+ } from "./chunk-UDBJCUPA.mjs";
4
4
  import {
5
5
  APIClientError,
6
6
  FARM_API_ROUTE_META_SYMBOL,
@@ -13,17 +13,17 @@ import {
13
13
  isAPIRouteRef,
14
14
  resolveServerFnInvalidateTargets,
15
15
  settleServerFnOptimisticUpdates
16
- } from "./chunk-KUO3GBPK.mjs";
16
+ } from "./chunk-L6V3P73N.mjs";
17
17
  import "./chunk-72AK62H5.mjs";
18
- import "./chunk-HKLRP3BN.mjs";
18
+ import "./chunk-5SPPCN5J.mjs";
19
19
  import "./chunk-QVYLBY73.mjs";
20
20
  import "./chunk-R3DS7A2T.mjs";
21
21
  import "./chunk-IOEH4VWN.mjs";
22
22
  import {
23
23
  APIRouteConflictError,
24
24
  APIRouteManager
25
- } from "./chunk-ZHOIQC6U.mjs";
26
- import "./chunk-VO5SCWF5.mjs";
25
+ } from "./chunk-ATERBVHQ.mjs";
26
+ import "./chunk-BNGS6KJ6.mjs";
27
27
  import "./chunk-CU625VAY.mjs";
28
28
  import "./chunk-JNGIWIY6.mjs";
29
29
  import "./chunk-FV45CKBC.mjs";
@@ -34,7 +34,7 @@ import {
34
34
  isWebResponse,
35
35
  normalizeRouteResponse,
36
36
  resolveAPIRouteEndpoint
37
- } from "./chunk-DPZUDPVJ.mjs";
37
+ } from "./chunk-XP777LRD.mjs";
38
38
  import {
39
39
  resolveFarmAPIServerBasePath
40
40
  } from "./chunk-I6XDAKWQ.mjs";
@@ -52,7 +52,7 @@ import {
52
52
  createRouteFactory,
53
53
  isEndpointFailure,
54
54
  resolvePluginRoutes
55
- } from "./chunk-OWTIOHON.mjs";
55
+ } from "./chunk-SYGGPS4A.mjs";
56
56
  import "./chunk-W3B4PKAW.mjs";
57
57
  import "./chunk-5WI2S4CO.mjs";
58
58
  import "./chunk-EA5K5BKU.mjs";
@@ -86,7 +86,7 @@ import {
86
86
  resolveFarmAPIRequestURL
87
87
  } from "./chunk-7LTCDQRS.mjs";
88
88
  import "./chunk-IXUY2F5U.mjs";
89
- import "./chunk-IGO2HEV7.mjs";
89
+ import "./chunk-F6SJAKFJ.mjs";
90
90
  import "./chunk-4SIYUGRY.mjs";
91
91
  import "./chunk-C4NCTZLM.mjs";
92
92
  import "./chunk-FUZEBRP3.mjs";
@@ -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-CslwYp3E.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-BsUcOEXg.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-EG4hNFjy.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-C1EgdoJM.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-B1bxCPUY.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-CNUlzylR.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,9 +1,10 @@
1
- import { l as FarmMdxComponents, m as FarmMdxResolvedConfig, k as RouteModule } from './client-plugins-C1EgdoJM.mjs';
2
- export { o as FarmMdxComponent, p as FarmMdxUserConfig, r as resolveFarmMdxComponentsModulePath, n as resolveMdxConfig } from './client-plugins-C1EgdoJM.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-C6UClI1z.mjs';
6
+ import './route-B0XrsrFk.mjs';
7
+ import './endpoint-DAc96i93.mjs';
7
8
  import './cache.mjs';
8
9
  import './renderer.mjs';
9
10
  import './deployment.mjs';
@@ -29,6 +30,8 @@ import './server-fn-error-DDh14a0V.mjs';
29
30
  import 'esbuild';
30
31
  import './image-config-Duob7wER.mjs';
31
32
  import './types-Z0aotQ8w.mjs';
33
+ import './server-fn.mjs';
34
+ import './server-query.mjs';
32
35
  import './types-DQnyD3VD.mjs';
33
36
  import './font.mjs';
34
37
  import './after.mjs';
@@ -1,9 +1,10 @@
1
- import { l as FarmMdxComponents, m as FarmMdxResolvedConfig, k as RouteModule } from './client-plugins-CslwYp3E.js';
2
- export { o as FarmMdxComponent, p as FarmMdxUserConfig, r as resolveFarmMdxComponentsModulePath, n as resolveMdxConfig } from './client-plugins-CslwYp3E.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-CHBaW55F.js';
6
+ import './route-DOEpbyWZ.js';
7
+ import './endpoint-1zA994xL.js';
7
8
  import './cache.js';
8
9
  import './renderer.js';
9
10
  import './deployment.js';
@@ -29,6 +30,8 @@ import './server-fn-error-DDh14a0V.js';
29
30
  import 'esbuild';
30
31
  import './image-config-Duob7wER.js';
31
32
  import './types-Z0aotQ8w.js';
33
+ import './server-fn.js';
34
+ import './server-query.js';
32
35
  import './types-DQnyD3VD.js';
33
36
  import './font.js';
34
37
  import './after.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,9 +1,13 @@
1
+ import {
2
+ readFarmEnvironmentValue
3
+ } from "./chunk-ONUEYC6N.mjs";
1
4
  import {
2
5
  __name
3
6
  } from "./chunk-LPEX4YW6.mjs";
4
7
 
5
8
  // src/env.ts
6
9
  var FARM_ENV_SYMBOL = /* @__PURE__ */ Symbol.for("farm.env");
10
+ var FARM_ENV_RUNTIME_SYMBOL = /* @__PURE__ */ Symbol.for("farm.env.runtime");
7
11
  var farmEnvGlobal = globalThis;
8
12
  var currentEnv = getInitialEnv();
9
13
  function resolveEnv(config, source = getProcessEnv()) {
@@ -14,23 +18,45 @@ function resolveEnv(config, source = getProcessEnv()) {
14
18
  return resolved;
15
19
  }
16
20
  __name(resolveEnv, "resolveEnv");
21
+ function createBundledEnv(env2, source = getProcessEnv()) {
22
+ const resolved = normalizeResolvedEnv(env2 ?? {});
23
+ const server = {};
24
+ const runtime = {};
25
+ for (const [key, value] of Object.entries(resolved.server)) {
26
+ const raw = source[key];
27
+ const type = getRuntimeEnvType(value);
28
+ if (raw !== void 0 && isSameEnvValue(coerceRuntimeEnvValue(raw, type), value)) {
29
+ runtime[key] = type;
30
+ } else {
31
+ server[key] = value;
32
+ }
33
+ }
34
+ return {
35
+ server,
36
+ public: resolved.public,
37
+ ...Object.keys(runtime).length > 0 ? { runtime: { server: runtime } } : {}
38
+ };
39
+ }
40
+ __name(createBundledEnv, "createBundledEnv");
17
41
  function setEnv(env2) {
18
- currentEnv = normalizeResolvedEnv(env2);
42
+ currentEnv = prepareEnv(env2);
19
43
  if (typeof window === "undefined") {
20
44
  farmEnvGlobal[FARM_ENV_SYMBOL] = currentEnv;
21
45
  }
22
46
  }
23
47
  __name(setEnv, "setEnv");
24
48
  function getResolvedEnv() {
25
- return getCurrentEnv();
49
+ const env2 = getCurrentEnv();
50
+ if (typeof window === "undefined") readRuntimeServerEnv(env2);
51
+ return env2;
26
52
  }
27
53
  __name(getResolvedEnv, "getResolvedEnv");
28
54
  function getEnv(key) {
29
- assertServerEnvAccess();
55
+ const server = getEnvScope("server");
30
56
  if (key === void 0) {
31
- return getCurrentEnv().server;
57
+ return server;
32
58
  }
33
- return getCurrentEnv().server[key];
59
+ return readServerEnvKey(server, key);
34
60
  }
35
61
  __name(getEnv, "getEnv");
36
62
  function getPublicEnv(key) {
@@ -78,7 +104,7 @@ function createEnvProxy(scope) {
78
104
  return void 0;
79
105
  }
80
106
  const env2 = getEnvScope(scope);
81
- return env2[property];
107
+ return scope === "server" ? readServerEnvKey(env2, property) : env2[property];
82
108
  },
83
109
  ownKeys() {
84
110
  return Reflect.ownKeys(getEnvScope(scope));
@@ -102,12 +128,99 @@ function createEnvProxy(scope) {
102
128
  }
103
129
  __name(createEnvProxy, "createEnvProxy");
104
130
  function getEnvScope(scope) {
131
+ const env2 = getCurrentEnv();
105
132
  if (scope === "server") {
106
133
  assertServerEnvAccess();
134
+ readRuntimeServerEnv(env2);
107
135
  }
108
- return getCurrentEnv()[scope] || {};
136
+ return env2[scope] || {};
109
137
  }
110
138
  __name(getEnvScope, "getEnvScope");
139
+ function readServerEnvKey(server, key) {
140
+ const value = server[key];
141
+ if (value === void 0) {
142
+ const state = getCurrentEnv()[FARM_ENV_RUNTIME_SYMBOL];
143
+ if (state && key in state.pending && !state.warned.has(key)) {
144
+ state.warned.add(key);
145
+ console.warn(
146
+ `[Farm] Server env "${key}" was set when this app was built but is not set where the server runs, so it reads as undefined. Farm reads server env at runtime and does not store it in the build output; set "${key}" in the server's environment.`
147
+ );
148
+ }
149
+ }
150
+ return value;
151
+ }
152
+ __name(readServerEnvKey, "readServerEnvKey");
153
+ function readRuntimeServerEnv(env2) {
154
+ const state = env2[FARM_ENV_RUNTIME_SYMBOL];
155
+ if (!state) return;
156
+ for (const [key, type] of Object.entries(state.pending)) {
157
+ const raw = readFarmEnvironmentValue(key);
158
+ if (raw === void 0) continue;
159
+ env2.server[key] = coerceRuntimeEnvValue(raw, type);
160
+ delete state.pending[key];
161
+ }
162
+ }
163
+ __name(readRuntimeServerEnv, "readRuntimeServerEnv");
164
+ function getRuntimeEnvType(value) {
165
+ if (typeof value === "number") return "number";
166
+ if (typeof value === "boolean") return "boolean";
167
+ if (value !== null && typeof value === "object" && !(value instanceof Date)) return "json";
168
+ return "string";
169
+ }
170
+ __name(getRuntimeEnvType, "getRuntimeEnvType");
171
+ function coerceRuntimeEnvValue(raw, type) {
172
+ if (type === "number") {
173
+ const value = Number(raw);
174
+ return raw.trim() !== "" && Number.isFinite(value) ? value : raw;
175
+ }
176
+ if (type === "boolean") {
177
+ if (/^(true|1)$/i.test(raw.trim())) return true;
178
+ if (/^(false|0|)$/i.test(raw.trim())) return false;
179
+ return raw;
180
+ }
181
+ if (type === "json") {
182
+ try {
183
+ return JSON.parse(raw);
184
+ } catch {
185
+ return raw;
186
+ }
187
+ }
188
+ return raw;
189
+ }
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");
209
+ function prepareEnv(env2) {
210
+ const normalized = normalizeResolvedEnv(env2);
211
+ const runtime = env2.runtime?.server;
212
+ if (!isRecord(runtime) || Object.keys(runtime).length === 0) return normalized;
213
+ const prepared = { server: { ...normalized.server }, public: normalized.public };
214
+ Object.defineProperty(prepared, FARM_ENV_RUNTIME_SYMBOL, {
215
+ value: {
216
+ pending: { ...runtime },
217
+ warned: /* @__PURE__ */ new Set()
218
+ },
219
+ enumerable: false
220
+ });
221
+ return prepared;
222
+ }
223
+ __name(prepareEnv, "prepareEnv");
111
224
  function assertServerEnvAccess() {
112
225
  if (typeof window !== "undefined") {
113
226
  throw new Error("Farm server env is not available in the browser. Use publicEnv.");
@@ -138,7 +251,7 @@ __name(getCurrentEnv, "getCurrentEnv");
138
251
  function getInjectedEnv() {
139
252
  try {
140
253
  if (typeof __FARM_ENV__ !== "undefined" && __FARM_ENV__) {
141
- return normalizeResolvedEnv(__FARM_ENV__);
254
+ return prepareEnv(__FARM_ENV__);
142
255
  }
143
256
  } catch {
144
257
  }
@@ -176,6 +289,7 @@ __name(getProcessEnv, "getProcessEnv");
176
289
 
177
290
  export {
178
291
  resolveEnv,
292
+ createBundledEnv,
179
293
  setEnv,
180
294
  getResolvedEnv,
181
295
  getEnv,