@farm.js/core 0.1.35 → 0.1.36

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 (214) hide show
  1. package/dist/{metadata-WGpBYcGn.d.mts → agent-mcp-BVExL8rZ.d.mts} +45 -2
  2. package/dist/agent-mcp-handler-LPJ2CADR.mjs +19 -0
  3. package/dist/agent-mcp-handler-SJAHFSPI.cjs +19 -0
  4. package/dist/{metadata-BnLDsUOS.d.ts → agent-mcp-luzfXK-P.d.ts} +45 -2
  5. package/dist/agent-runtime.cjs +5 -3
  6. package/dist/agent-runtime.d.mts +1 -1
  7. package/dist/agent-runtime.d.ts +1 -1
  8. package/dist/agent-runtime.mjs +4 -2
  9. package/dist/api/route-manager.cjs +6 -6
  10. package/dist/api/route-manager.d.mts +10 -4
  11. package/dist/api/route-manager.d.ts +10 -4
  12. package/dist/api/route-manager.mjs +5 -5
  13. package/dist/api/runtime.cjs +4 -4
  14. package/dist/api/runtime.d.mts +4 -62
  15. package/dist/api/runtime.d.ts +4 -62
  16. package/dist/api/runtime.mjs +3 -3
  17. package/dist/api.cjs +8 -8
  18. package/dist/api.d.mts +3 -3
  19. package/dist/api.d.ts +3 -3
  20. package/dist/api.mjs +7 -7
  21. package/dist/{app-D_j9AAVL.d.mts → app-BukwkFIu.d.mts} +17 -3
  22. package/dist/{app-BXB3JZYc.d.ts → app-Yfa2dsFy.d.ts} +17 -3
  23. package/dist/app-markdown.cjs +4 -4
  24. package/dist/app-markdown.d.mts +2 -2
  25. package/dist/app-markdown.d.ts +2 -2
  26. package/dist/app-markdown.mjs +3 -3
  27. package/dist/{chunk-4KU5Q7C2.mjs → chunk-276VJSM6.mjs} +221 -48
  28. package/dist/{chunk-PFQKNERH.cjs → chunk-2YTDKNH3.cjs} +364 -197
  29. package/dist/{chunk-UAORZ7QA.mjs → chunk-35GKZR22.mjs} +2 -2
  30. package/dist/{chunk-QAU5JD57.mjs → chunk-35WV46VL.mjs} +203 -36
  31. package/dist/{chunk-EFCQPQMG.cjs → chunk-42NHY7HW.cjs} +54 -4
  32. package/dist/{chunk-SOMHP6GF.mjs → chunk-4E5AEDKY.mjs} +2 -2
  33. package/dist/{chunk-UJD4PHYB.mjs → chunk-4E5WBPEG.mjs} +72 -354
  34. package/dist/{chunk-2G2NNLE2.mjs → chunk-4GLOOWKE.mjs} +4 -4
  35. package/dist/{chunk-62XKI4Z3.cjs → chunk-4NU4GGTC.cjs} +2 -2
  36. package/dist/{chunk-4JHOT46A.mjs → chunk-4WCZJQUO.mjs} +54 -4
  37. package/dist/chunk-4WQ6PGSJ.cjs +367 -0
  38. package/dist/{chunk-SMHH4VDG.mjs → chunk-4WVJLURN.mjs} +1 -1
  39. package/dist/chunk-6SJ2KJTA.mjs +314 -0
  40. package/dist/{chunk-IPXLADVO.cjs → chunk-ADEA7PN3.cjs} +122 -61
  41. package/dist/{chunk-CP6X4AEU.mjs → chunk-AJQTP4OO.mjs} +1 -1
  42. package/dist/{chunk-4MMGO7YW.cjs → chunk-AO6RYU5N.cjs} +31 -28
  43. package/dist/{chunk-GFHLGIYC.cjs → chunk-BO36SELV.cjs} +6 -6
  44. package/dist/{chunk-6TJOML4E.mjs → chunk-BPOF5U4N.mjs} +4 -4
  45. package/dist/{chunk-JHWOVJ3M.mjs → chunk-BUGNQIHC.mjs} +5 -0
  46. package/dist/{chunk-FTFYRMQQ.cjs → chunk-CBJJH36A.cjs} +50 -25
  47. package/dist/{chunk-7GLPRTTF.cjs → chunk-CGBDNNSM.cjs} +2 -2
  48. package/dist/chunk-CI6E3UOH.cjs +314 -0
  49. package/dist/{chunk-X6W5FFH6.cjs → chunk-D2BB47NB.cjs} +8 -8
  50. package/dist/chunk-DTSROJ5J.mjs +367 -0
  51. package/dist/{chunk-YC6V7PWE.cjs → chunk-DZ5ZVB2K.cjs} +1 -1
  52. package/dist/{chunk-DBNKI4NF.cjs → chunk-ECKF2BAM.cjs} +6 -2
  53. package/dist/{chunk-Q3VLETLE.mjs → chunk-EWET4D2Y.mjs} +1 -1
  54. package/dist/{chunk-HUMR6LSU.mjs → chunk-F5QO4FNE.mjs} +1 -1
  55. package/dist/{chunk-XBML5KMG.cjs → chunk-FO427P6I.cjs} +22 -12
  56. package/dist/{chunk-SAZVVAJH.mjs → chunk-GQRWBCWK.mjs} +8 -5
  57. package/dist/{chunk-F6Z3Y5KL.mjs → chunk-HOXTWRGB.mjs} +1 -1
  58. package/dist/{chunk-3BHT4WMP.cjs → chunk-JNUWCDTF.cjs} +6 -6
  59. package/dist/{chunk-73MC7ZL6.cjs → chunk-JZVADIOD.cjs} +2 -2
  60. package/dist/{chunk-OMVAU7NT.cjs → chunk-KIIMAWOJ.cjs} +11 -1
  61. package/dist/{chunk-43FMW62B.mjs → chunk-KMTGADN3.mjs} +28 -0
  62. package/dist/{chunk-6ETPZTJI.mjs → chunk-LSZAVSGY.mjs} +116 -55
  63. package/dist/{chunk-HMIJDL7S.mjs → chunk-MKYBIIAQ.mjs} +30 -5
  64. package/dist/{chunk-RU3M2FIK.cjs → chunk-MRMI32SN.cjs} +87 -369
  65. package/dist/{chunk-7L5V3KQO.cjs → chunk-N2NAS2AM.cjs} +2 -2
  66. package/dist/{chunk-ICUQICNC.cjs → chunk-NMHWYWDR.cjs} +654 -481
  67. package/dist/{chunk-G5RT7EXW.mjs → chunk-O6I6VWKK.mjs} +20 -5
  68. package/dist/{chunk-PDOCJ6RY.mjs → chunk-O6WAEAX3.mjs} +1 -1
  69. package/dist/{chunk-6DU6UFUE.mjs → chunk-OHLSEQ57.mjs} +16 -8
  70. package/dist/{chunk-3PXS2MHU.mjs → chunk-OO7GXVSR.mjs} +1 -1
  71. package/dist/chunk-PTZ2TVNE.cjs +178 -0
  72. package/dist/{chunk-6WCPV6G2.mjs → chunk-Q2KB32T4.mjs} +1 -1
  73. package/dist/{chunk-XCACDAZZ.cjs → chunk-S6VYG6XU.cjs} +23 -8
  74. package/dist/{chunk-VFQT3LAO.cjs → chunk-SDOTRX3V.cjs} +5 -5
  75. package/dist/{chunk-BMWDEBXO.cjs → chunk-SHLXACIO.cjs} +31 -3
  76. package/dist/{chunk-22LTEMGQ.mjs → chunk-T4OGRVNS.mjs} +13 -3
  77. package/dist/{chunk-ZXGAFZDO.cjs → chunk-T5OJPTVN.cjs} +2 -2
  78. package/dist/{chunk-VZJR7UTG.cjs → chunk-TE2G5ION.cjs} +2 -2
  79. package/dist/chunk-UH6QN5NL.mjs +178 -0
  80. package/dist/{chunk-F7JZENPF.cjs → chunk-UVW64BCB.cjs} +38 -30
  81. package/dist/{chunk-OKZUAXHF.mjs → chunk-VILIPRS6.mjs} +1 -1
  82. package/dist/{chunk-3UH7MRCP.cjs → chunk-VQLJWDVW.cjs} +13 -13
  83. package/dist/{chunk-VPTDD5XF.cjs → chunk-WBKEZXWE.cjs} +5 -0
  84. package/dist/{chunk-EJQT6KZN.cjs → chunk-WC5UV2HQ.cjs} +2 -2
  85. package/dist/{chunk-YULD7ICZ.mjs → chunk-WZ77PUAM.mjs} +1 -1
  86. package/dist/{chunk-C35ZBVRD.mjs → chunk-YWMZUGIS.mjs} +6 -2
  87. package/dist/{chunk-Y7RKTKYI.mjs → chunk-ZMMBIVQM.mjs} +10 -0
  88. package/dist/{chunk-ULAWS2PA.cjs → chunk-ZWM5KGAA.cjs} +6 -6
  89. package/dist/{client-plugins-CvIslxWi.d.mts → client-plugins-C3mK9Pol.d.mts} +98 -5
  90. package/dist/{client-plugins-HIyulDym.d.ts → client-plugins-r1mOtSC1.d.ts} +98 -5
  91. package/dist/client-plugins.d.mts +1 -1
  92. package/dist/client-plugins.d.ts +1 -1
  93. package/dist/client.d.mts +5 -5
  94. package/dist/client.d.ts +5 -5
  95. package/dist/config.d.mts +1 -1
  96. package/dist/config.d.ts +1 -1
  97. package/dist/{devtools-EE5RIBTH.mjs → devtools-ERIKFEXX.mjs} +9 -8
  98. package/dist/{devtools-EAUY43BS.cjs → devtools-JZJJY5CK.cjs} +10 -9
  99. package/dist/docs.cjs +12 -11
  100. package/dist/docs.d.mts +2 -2
  101. package/dist/docs.d.ts +2 -2
  102. package/dist/docs.mjs +11 -10
  103. package/dist/image/server.cjs +3 -3
  104. package/dist/image/server.mjs +2 -2
  105. package/dist/image/sharp.cjs +10 -10
  106. package/dist/image/sharp.mjs +2 -2
  107. package/dist/index.cjs +39 -35
  108. package/dist/index.d.mts +13 -13
  109. package/dist/index.d.ts +13 -13
  110. package/dist/index.mjs +38 -34
  111. package/dist/integrations.cjs +7 -3
  112. package/dist/integrations.d.mts +1 -1
  113. package/dist/integrations.d.ts +1 -1
  114. package/dist/integrations.mjs +6 -2
  115. package/dist/internal/app-markdown-runtime.cjs +3 -3
  116. package/dist/internal/app-markdown-runtime.d.mts +2 -2
  117. package/dist/internal/app-markdown-runtime.d.ts +2 -2
  118. package/dist/internal/app-markdown-runtime.mjs +2 -2
  119. package/dist/internal/build-runtime.cjs +27 -25
  120. package/dist/internal/build-runtime.d.mts +3 -3
  121. package/dist/internal/build-runtime.d.ts +3 -3
  122. package/dist/internal/build-runtime.mjs +26 -24
  123. package/dist/internal/cli-runtime.cjs +14 -13
  124. package/dist/internal/cli-runtime.mjs +13 -12
  125. package/dist/internal/client-error-overlay.cjs +4 -4
  126. package/dist/internal/client-error-overlay.mjs +1 -1
  127. package/dist/internal/compression-runtime.d.mts +1 -1
  128. package/dist/internal/compression-runtime.d.ts +1 -1
  129. package/dist/internal/config-runtime.cjs +10 -9
  130. package/dist/internal/config-runtime.d.mts +2 -2
  131. package/dist/internal/config-runtime.d.ts +2 -2
  132. package/dist/internal/config-runtime.mjs +9 -8
  133. package/dist/internal/isolated-boundary.cjs +2 -2
  134. package/dist/internal/isolated-boundary.d.mts +0 -1
  135. package/dist/internal/isolated-boundary.d.ts +0 -1
  136. package/dist/internal/isolated-boundary.mjs +1 -1
  137. package/dist/internal/metadata-image-runtime.cjs +3 -3
  138. package/dist/internal/metadata-image-runtime.mjs +2 -2
  139. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  140. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  141. package/dist/internal/production-runtime.cjs +23 -9
  142. package/dist/internal/production-runtime.d.mts +67 -27
  143. package/dist/internal/production-runtime.d.ts +67 -27
  144. package/dist/internal/production-runtime.mjs +26 -12
  145. package/dist/{layers-BRQF5ETU.mjs → layers-UTB43B7A.mjs} +1 -1
  146. package/dist/layers-VUWIOFEO.cjs +18 -0
  147. package/dist/markdown.cjs +1 -1
  148. package/dist/markdown.d.mts +1 -1
  149. package/dist/markdown.d.ts +1 -1
  150. package/dist/markdown.mjs +1 -1
  151. package/dist/middleware.cjs +6 -6
  152. package/dist/middleware.d.mts +3 -3
  153. package/dist/middleware.d.ts +3 -3
  154. package/dist/middleware.mjs +5 -5
  155. package/dist/navigation.d.mts +4 -4
  156. package/dist/navigation.d.ts +4 -4
  157. package/dist/{nitro-OVPLKPE2.cjs → nitro-7F65EZZS.cjs} +3 -3
  158. package/dist/{nitro-MXRDCXWZ.mjs → nitro-MPZJGPXK.mjs} +2 -2
  159. package/dist/plugin.cjs +23 -21
  160. package/dist/plugin.d.mts +1 -1
  161. package/dist/plugin.d.ts +1 -1
  162. package/dist/plugin.mjs +22 -20
  163. package/dist/{production-runtime-0sRnuYc-.d.mts → production-runtime-CCeVZXst.d.mts} +1 -1
  164. package/dist/{production-runtime-Crq6CJ-2.d.ts → production-runtime-DPnsggY3.d.ts} +1 -1
  165. package/dist/{render-plan-gs9GGPzw.d.mts → render-plan-BuGaPFe6.d.mts} +1 -1
  166. package/dist/{render-plan-8ozZh2Qv.d.ts → render-plan-Cw4f5E_R.d.ts} +1 -1
  167. package/dist/renderer/react/server.cjs +3 -3
  168. package/dist/renderer/react/server.mjs +1 -1
  169. package/dist/renderer-client.d.mts +3 -3
  170. package/dist/renderer-client.d.ts +3 -3
  171. package/dist/{request-B5G8rLBH.d.ts → request-Bkg-hERy.d.ts} +1 -1
  172. package/dist/{request-fkhiynXe.d.mts → request-CsGARcAw.d.mts} +1 -1
  173. package/dist/request.d.mts +2 -2
  174. package/dist/request.d.ts +2 -2
  175. package/dist/{route-rendering-lS5nUMua.d.ts → route-rendering-BUZMH_64.d.ts} +1 -1
  176. package/dist/{route-rendering-CLnS7AZj.d.mts → route-rendering-f11yh5dp.d.mts} +1 -1
  177. package/dist/{router-4iuiYnOW.d.ts → router-B8CR9GbD.d.ts} +1 -1
  178. package/dist/{router-ifU8Dui1.d.mts → router-Cp6yRE8A.d.mts} +1 -1
  179. package/dist/routes.d.mts +1 -1
  180. package/dist/routes.d.ts +1 -1
  181. package/dist/runtime-CAEv36S_.d.mts +69 -0
  182. package/dist/runtime-CQVsT330.d.ts +69 -0
  183. package/dist/server-action-security.cjs +3 -3
  184. package/dist/server-action-security.mjs +2 -2
  185. package/dist/server-fn.cjs +4 -4
  186. package/dist/server-fn.mjs +3 -3
  187. package/dist/server-plugins.d.mts +2 -2
  188. package/dist/server-plugins.d.ts +2 -2
  189. package/dist/server-query.cjs +5 -5
  190. package/dist/server-query.mjs +4 -4
  191. package/dist/server.cjs +42 -40
  192. package/dist/server.d.mts +7 -7
  193. package/dist/server.d.ts +7 -7
  194. package/dist/server.mjs +25 -23
  195. package/dist/{spa-router-DaJk5Re4.d.ts → spa-router-BuciWGCZ.d.ts} +2 -2
  196. package/dist/{spa-router-Bq7VCOwx.d.mts → spa-router-DwbqGkGj.d.mts} +2 -2
  197. package/dist/testing.cjs +8 -8
  198. package/dist/testing.d.mts +1 -1
  199. package/dist/testing.d.ts +1 -1
  200. package/dist/testing.mjs +6 -6
  201. package/dist/{utils-XJn0c9bj.d.mts → utils-B9V0S_yL.d.mts} +1 -1
  202. package/dist/{utils-BXLmFsVR.d.ts → utils-CaoWKtYM.d.ts} +1 -1
  203. package/dist/version.cjs +2 -2
  204. package/dist/version.mjs +1 -1
  205. package/dist/vite.cjs +23 -21
  206. package/dist/vite.d.mts +1 -1
  207. package/dist/vite.d.ts +1 -1
  208. package/dist/vite.mjs +22 -20
  209. package/dist/workflows.cjs +3 -3
  210. package/dist/workflows.mjs +2 -2
  211. package/package.json +1 -1
  212. package/dist/layers-4PNE2HOY.cjs +0 -18
  213. package/dist/{chunk-2F2ER724.cjs → chunk-BPMATOP2.cjs} +2 -2
  214. package/dist/{chunk-IHNMMXHV.mjs → chunk-OTC5BDGO.mjs} +3 -3
@@ -4,13 +4,13 @@ import {
4
4
  _runServerFunctionForCaller,
5
5
  createServerFn,
6
6
  createServerFunctionDescriptor
7
- } from "./chunk-Q3VLETLE.mjs";
7
+ } from "./chunk-EWET4D2Y.mjs";
8
8
  import {
9
9
  createFarmServerQueryResult
10
10
  } from "./chunk-KGB5UXJJ.mjs";
11
11
  import {
12
12
  getServerActionExecutionContext
13
- } from "./chunk-SMHH4VDG.mjs";
13
+ } from "./chunk-4WVJLURN.mjs";
14
14
  import {
15
15
  createRouteDataCacheTag,
16
16
  getFarmDataCache
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  compileFarmDocsAdapterEdgeManifest,
12
12
  createFarmDocsAPIHandler
13
- } from "./chunk-SOMHP6GF.mjs";
13
+ } from "./chunk-4E5AEDKY.mjs";
14
14
  import {
15
15
  FARM_DOCS_LAST_MODIFIED_MANIFEST,
16
16
  createFarmDocsHandler,
@@ -20,7 +20,7 @@ import {
20
20
  loadFarmDocsPage,
21
21
  resolveFarmDocsContentDir,
22
22
  toFarmDocsMarkdownPage
23
- } from "./chunk-PDOCJ6RY.mjs";
23
+ } from "./chunk-O6WAEAX3.mjs";
24
24
  import {
25
25
  generateFarmDocsSearchClientRuntime,
26
26
  isFarmDocsSearchEnabled,
@@ -37,7 +37,7 @@ import {
37
37
  getDeployTargetForPreset,
38
38
  hasCustomFarmRouteContext,
39
39
  resolveDeployOutputPath
40
- } from "./chunk-6DU6UFUE.mjs";
40
+ } from "./chunk-OHLSEQ57.mjs";
41
41
  import {
42
42
  resolveFarmInstrumentationFile
43
43
  } from "./chunk-ZZSRYEYU.mjs";
@@ -76,15 +76,16 @@ import {
76
76
  resolveFarmIsolatedClientHydrationMode,
77
77
  resolveFarmNotFoundComponentPath,
78
78
  usesFarmServerTree
79
- } from "./chunk-4KU5Q7C2.mjs";
79
+ } from "./chunk-276VJSM6.mjs";
80
80
  import {
81
81
  findRequestBoundSourceBlockers,
82
82
  generateFarmTypeArtifacts,
83
83
  parseRouteRenderingDirective,
84
84
  resolveRouteRenderingConfigFromFile
85
- } from "./chunk-2G2NNLE2.mjs";
85
+ } from "./chunk-4GLOOWKE.mjs";
86
86
  import {
87
87
  FARM_API_CATALOG_PATH,
88
+ FARM_APP_MANIFEST_LEGACY_PATH,
88
89
  FARM_APP_MANIFEST_PATH,
89
90
  HOISTED_HEAD_ELEMENT,
90
91
  getRouteDirectoryDepth,
@@ -93,7 +94,12 @@ import {
93
94
  resolveFarmAppManifestInput,
94
95
  routeBoundaryCoversDirectory,
95
96
  stripRouteGroups
96
- } from "./chunk-6ETPZTJI.mjs";
97
+ } from "./chunk-LSZAVSGY.mjs";
98
+ import {
99
+ FARM_DEFAULT_MCP_PATH,
100
+ createFarmDefaultMCPServer,
101
+ farmConfigMountsMCP
102
+ } from "./chunk-UH6QN5NL.mjs";
97
103
  import {
98
104
  isFarmPreviewDeploymentEnvironment
99
105
  } from "./chunk-BOYNDCZL.mjs";
@@ -113,7 +119,7 @@ import {
113
119
  } from "./chunk-GHFS7RUB.mjs";
114
120
  import {
115
121
  getFarmAppDirectories
116
- } from "./chunk-JHWOVJ3M.mjs";
122
+ } from "./chunk-BUGNQIHC.mjs";
117
123
  import {
118
124
  REACT_RENDERER,
119
125
  getFarmRendererCapabilities,
@@ -125,7 +131,7 @@ import {
125
131
  } from "./chunk-DAATZTKJ.mjs";
126
132
  import {
127
133
  applyFarmCspHashesToHtml
128
- } from "./chunk-UJD4PHYB.mjs";
134
+ } from "./chunk-4E5WBPEG.mjs";
129
135
  import {
130
136
  applyFarmCronVercelCrons,
131
137
  createFarmCronCloudflareConfig,
@@ -137,7 +143,7 @@ import {
137
143
  } from "./chunk-4OOBRCJX.mjs";
138
144
  import {
139
145
  isFarmMarkdownPageFile
140
- } from "./chunk-4JHOT46A.mjs";
146
+ } from "./chunk-4WCZJQUO.mjs";
141
147
  import {
142
148
  resolveFarmMdxComponentsModulePath,
143
149
  resolveMdxConfig
@@ -148,16 +154,17 @@ import {
148
154
  import {
149
155
  applyFarmWorkflowVercelCrons,
150
156
  prepareFarmWorkflowsForNitro
151
- } from "./chunk-6WCPV6G2.mjs";
157
+ } from "./chunk-Q2KB32T4.mjs";
152
158
  import {
159
+ FARM_INTEGRATION_API_BASE_PATH_KEY,
153
160
  getFarmIntegrationPluginServerRuntime,
154
161
  getIntegrationProviders
155
- } from "./chunk-HMIJDL7S.mjs";
162
+ } from "./chunk-MKYBIIAQ.mjs";
156
163
  import {
157
164
  appendMiddlewareDirectory,
158
165
  appendMiddlewareRoutePath,
159
166
  compareMiddlewareRouteLocations
160
- } from "./chunk-6TJOML4E.mjs";
167
+ } from "./chunk-BPOF5U4N.mjs";
161
168
  import {
162
169
  compileMiddlewareConfig,
163
170
  matchesCompiledMiddlewareConfig,
@@ -165,7 +172,7 @@ import {
165
172
  } from "./chunk-JG6DJF5A.mjs";
166
173
  import {
167
174
  APIRouteManager
168
- } from "./chunk-22LTEMGQ.mjs";
175
+ } from "./chunk-T4OGRVNS.mjs";
169
176
  import {
170
177
  readFarmI18nCatalogs
171
178
  } from "./chunk-QCFBDFRS.mjs";
@@ -190,6 +197,9 @@ import {
190
197
  resolveFarmAPIServerBasePath,
191
198
  resolveFarmAPIServerRoutePath
192
199
  } from "./chunk-BTHHUD7Q.mjs";
200
+ import {
201
+ FARM_VERSION
202
+ } from "./chunk-OO7GXVSR.mjs";
193
203
  import {
194
204
  getFarmPresetRuntime
195
205
  } from "./chunk-2A3EQHXX.mjs";
@@ -257,7 +267,7 @@ __name(resolveHashedClientJsSrc, "resolveHashedClientJsSrc");
257
267
  // src/nitro/universal-build.ts
258
268
  import os from "os";
259
269
  import path6 from "path";
260
- import { constants as fsConstants, existsSync as existsSync2, readFileSync, realpathSync } from "fs";
270
+ import { constants as fsConstants, existsSync as existsSync2, readFileSync, realpathSync, statSync } from "fs";
261
271
  import { fileURLToPath } from "url";
262
272
  import { builtinModules, createRequire } from "module";
263
273
  import { isDeepStrictEqual } from "util";
@@ -766,10 +776,14 @@ export default async function farmNetlifyHandler(request, context) {
766
776
  __name(createFarmNetlifyEntry, "createFarmNetlifyEntry");
767
777
 
768
778
  // src/nitro/node-server-entry.ts
779
+ var FARM_NODE_ENV_MODULE_FILE = "farm-node-env.mjs";
780
+ var FARM_NODE_ENV_MODULE_SOURCE = `if (!process.env.NODE_ENV) process.env.NODE_ENV = "production";
781
+ `;
769
782
  function createFarmNodeServerEntry(options) {
770
783
  const serverConfig = JSON.stringify(options.server);
771
784
  const nitroEntryImport = `./${options.nitroEntryFile.replace(/^\.\//, "")}`;
772
785
  return `
786
+ import "./${FARM_NODE_ENV_MODULE_FILE}";
773
787
  import "#nitro/virtual/polyfills";
774
788
  import { NodeRequest, serve } from ${JSON.stringify(options.nodeAdapterModule)};
775
789
  import wsAdapter from ${JSON.stringify(options.websocketAdapterModule)};
@@ -4998,6 +5012,28 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4998
5012
  };
4999
5013
  }
5000
5014
  __name(buildSSRInMemory, "buildSSRInMemory");
5015
+ function readFarmAppPackageIdentity(root) {
5016
+ try {
5017
+ return JSON.parse(readFileSync(path6.join(root, "package.json"), "utf8"));
5018
+ } catch {
5019
+ return {};
5020
+ }
5021
+ }
5022
+ __name(readFarmAppPackageIdentity, "readFarmAppPackageIdentity");
5023
+ function readFarmPageLastModified(pageRoutes) {
5024
+ const lastModified = {};
5025
+ for (const route of pageRoutes) {
5026
+ if (route.pattern.includes("[")) continue;
5027
+ try {
5028
+ lastModified[route.pattern] = statSync(
5029
+ route.markdownSourcePath ?? route.modulePath
5030
+ ).mtime.toISOString();
5031
+ } catch {
5032
+ }
5033
+ }
5034
+ return lastModified;
5035
+ }
5036
+ __name(readFarmPageLastModified, "readFarmPageLastModified");
5001
5037
  function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
5002
5038
  const llmsTxt = agent?.llmsTxt;
5003
5039
  const ownedByFile = /* @__PURE__ */ __name((kind) => applicationMetadataRoutes.some(
@@ -5006,7 +5042,7 @@ function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
5006
5042
  return [
5007
5043
  ...llmsTxt?.enabled || ownedByFile("llms") ? ["/llms.txt"] : [],
5008
5044
  ...llmsTxt?.enabled && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
5009
- ...ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
5045
+ ...agent?.sitemap?.enabled || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
5010
5046
  ...agent?.crawlers?.enabled || ownedByFile("robots") ? ["/robots.txt"] : []
5011
5047
  ];
5012
5048
  }
@@ -5072,7 +5108,7 @@ function matchLocalIntegrationRequest(request) {
5072
5108
  });` : "return null;"}
5073
5109
  }
5074
5110
 
5075
- async function handleIntegrationRequest(request) {
5111
+ async function handleIntegrationRequest(request, ranMiddleware) {
5076
5112
  ${options.hasServerRuntimeIntegrations ? `return dispatchIntegrationRequests(
5077
5113
  serverRuntimeIntegrations,
5078
5114
  {
@@ -5081,6 +5117,7 @@ async function handleIntegrationRequest(request) {
5081
5117
  isProd: true,
5082
5118
  },
5083
5119
  request,
5120
+ { ranMiddleware },
5084
5121
  );` : `return { response: null, setCookies: [] };`}
5085
5122
  }
5086
5123
 
@@ -5361,6 +5398,10 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
5361
5398
  const servesAgentRobotsTxt = Boolean(config.agent?.crawlers?.enabled) && !applicationMetadataRoutes.some(
5362
5399
  (metadata) => metadata.kind === "robots" && metadata.pattern === "/"
5363
5400
  );
5401
+ const servesAgentSitemap = Boolean(config.agent?.sitemap?.enabled) && !applicationMetadataRoutes.some(
5402
+ (metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
5403
+ );
5404
+ const servesDefaultMCP = config.agent?.mcp === true && !farmConfigMountsMCP(config) && !apiRoutes.some((route) => route.path === "/api/mcp");
5364
5405
  const servesAiCatalog = config.agent?.aiCatalog !== false;
5365
5406
  const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
5366
5407
  const hasInfraAnalyticsRuntime = config.analytics !== false && resolveFarmInstrumentationRuntime(preset) === "nodejs";
@@ -5686,6 +5727,10 @@ function renderFarmRouteServerTree(element) { return element; }`;
5686
5727
  createFarmCacheKey,
5687
5728
  createFarmMetadataRouteResponse,
5688
5729
  createFarmAgentRobots,
5730
+ createFarmDefaultSitemap,
5731
+ collectFarmDefaultMCPPages,
5732
+ resolveFarmDefaultMCPServer,
5733
+ handleFarmDefaultMCPRequest,
5689
5734
  createFarmAiCatalogResponse,
5690
5735
  createFarmApiCatalogResponse,
5691
5736
  createFarmAppManifestResponse,
@@ -6062,6 +6107,7 @@ const serverRuntimeIntegrations = Object.fromEntries(
6062
6107
  );
6063
6108
  const integrationRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs, {
6064
6109
  integrations: configuredIntegrations,
6110
+ ${JSON.stringify(FARM_INTEGRATION_API_BASE_PATH_KEY)}: ${JSON.stringify(resolveFarmAPIServerBasePath(config.api))},
6065
6111
  });
6066
6112
  const farmInfraAnalytics = ${hasInfraAnalyticsRuntime ? hasPluginRuntime ? "createFarmInfraAnalyticsPlugin()" : "createFarmInfraAnalyticsRecorder()" : "null"};
6067
6113
  const configuredPlugins = [
@@ -6210,18 +6256,25 @@ const farmDocsAPIHandler = ${config.docs?.enabled ? hasPrecompiledDocs ? "farmDo
6210
6256
 
6211
6257
  // API routes bundled at build time
6212
6258
  const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
6213
- ]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path8, methods }) => ({ path: path8, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)} })` : ""};
6259
+ ]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path8, methods }) => ({ path: path8, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)}, dispatch: dispatchFarmPluginAPIRequest })` : ""};
6260
+ // A plugin calling an app endpoint (an MCP tool, say) goes through the whole
6261
+ // pipeline, so the endpoint's middleware and integration guards run for it.
6262
+ function dispatchFarmPluginAPIRequest(request) {
6263
+ const url = new URL(request.url);
6264
+ url.pathname = applyFarmBasePath(url.pathname);
6265
+ return handleFarmRequest(url.href === request.url ? request : new Request(url, request));
6266
+ }
6214
6267
  const farmLocalAPIBasePath = ${JSON.stringify(resolveFarmAPIServerBasePath(config.api))};
6215
6268
  const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
6216
6269
  ${config.agent?.apiCatalog ? `const farmApiCatalogInput = ${JSON.stringify(resolveFarmApiCatalogInput(config))};
6217
- ` : ""}${config.analytics !== false ? `const farmAppManifestInput = ${JSON.stringify(
6270
+ ` : ""}${config.agent?.manifest !== false ? `const farmAppManifestInput = ${JSON.stringify(
6218
6271
  resolveFarmAppManifestInput(config, {
6219
6272
  build: config.deploymentId,
6220
6273
  packages: resolveFarmAppPackages(config.root),
6221
6274
  webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? collectFarmWebMCPTools(config.root, config.srcDir) : []
6222
6275
  })
6223
6276
  )};
6224
- ` : ""}
6277
+ ${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}` : ""}
6225
6278
  function isFarmLocalAPIPathname(pathname) {
6226
6279
  return farmLocalAPIBasePath !== "/" &&
6227
6280
  (pathname === farmLocalAPIBasePath ||
@@ -6728,7 +6781,8 @@ function ensureFarmDocumentHead(markup) {
6728
6781
  }
6729
6782
 
6730
6783
  function ensureFarmDocumentRoot(markup) {
6731
- if (/\\sid=["']root["']/i.test(markup)) return markup;
6784
+ // Only a #root that opens the body is the container; page content can have id="root" too.
6785
+ if (/<body\\b[^>]*>\\s*<div\\b[^>]*\\sid=["']root["']/i.test(markup)) return markup;
6732
6786
  return markup
6733
6787
  .replace(/<body\\b([^>]*)>/i, function(_match, attributes) {
6734
6788
  return "<body" + attributes + '><div id="root">';
@@ -7107,7 +7161,7 @@ function createFarmAgentRobotsResponse(request) {
7107
7161
  "robots",
7108
7162
  createFarmAgentRobots({
7109
7163
  crawlers: farmAgentCrawlers,
7110
- sitemapPath: ${applicationMetadataRoutes.some(
7164
+ sitemapPath: ${servesAgentSitemap || applicationMetadataRoutes.some(
7111
7165
  (metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
7112
7166
  ) ? JSON.stringify("/sitemap.xml") : "undefined"},
7113
7167
  metadataBase: rootLayout && rootLayout.module && rootLayout.module.metadata
@@ -7120,6 +7174,68 @@ function createFarmAgentRobotsResponse(request) {
7120
7174
  );
7121
7175
  }
7122
7176
  ` : ""}
7177
+ ${servesAgentSitemap ? `// sitemap.xml from agent.sitemap, built the same way as in development. Each page's
7178
+ // lastmod is its file's modification time, read at build time.
7179
+ const farmAgentSitemapConfig = ${JSON.stringify(config.agent.sitemap)};
7180
+ const farmAgentSitemapLastModified = ${JSON.stringify(readFarmPageLastModified(pageRoutes))};
7181
+ function createFarmAgentSitemapResponse(request) {
7182
+ const rootLayout = layoutRoutes.find((layout) => layout.pattern === "/");
7183
+ return createFarmMetadataRouteResponse(
7184
+ "sitemap",
7185
+ createFarmDefaultSitemap(
7186
+ pageRoutes.map((route) => ({
7187
+ pattern: route.pattern,
7188
+ module: route.module,
7189
+ lastModified: farmAgentSitemapLastModified[route.pattern],
7190
+ })),
7191
+ {
7192
+ origin: new URL(request.url).origin,
7193
+ config: farmAgentSitemapConfig,
7194
+ metadataBase: rootLayout && rootLayout.module && rootLayout.module.metadata
7195
+ ? rootLayout.module.metadata.metadataBase
7196
+ : undefined,
7197
+ basePath: ${JSON.stringify(config.basePath)},
7198
+ },
7199
+ ),
7200
+ {},
7201
+ { method: request.method },
7202
+ );
7203
+ }
7204
+ ` : ""}
7205
+ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as in development. It steps
7206
+ // aside for a page route that answers /mcp and for any MCP server published or
7207
+ // registered at runtime, such as the docs engine's.
7208
+ const farmDefaultMCPServer = ${JSON.stringify(
7209
+ createFarmDefaultMCPServer(readFarmAppPackageIdentity(config.root), FARM_VERSION)
7210
+ )};
7211
+ let farmDefaultMCPRouteFree;
7212
+ function getFarmDefaultMCPServer() {
7213
+ if (farmDefaultMCPRouteFree === undefined) {
7214
+ farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(FARM_DEFAULT_MCP_PATH)});
7215
+ }
7216
+ return farmDefaultMCPRouteFree ? resolveFarmDefaultMCPServer(farmDefaultMCPServer) : undefined;
7217
+ }
7218
+ async function handleFarmDefaultMCP(request) {
7219
+ const origin = new URL(request.url).origin;
7220
+ return handleFarmDefaultMCPRequest(request, {
7221
+ server: getFarmDefaultMCPServer(),
7222
+ basePath: ${JSON.stringify(config.basePath)},
7223
+ listPages: () =>
7224
+ collectFarmDefaultMCPPages(
7225
+ pageRoutes.map((route) => ({ pattern: route.pattern, module: route.module })),
7226
+ { origin, basePath: ${JSON.stringify(config.basePath)}, markdown: farmMarkdownConfig },
7227
+ ),
7228
+ // A fresh request through this handler, so the caller's cookies never shape a page.
7229
+ // The handler sees paths below the base path, as the server passes them in.
7230
+ readMarkdown: (url) => {
7231
+ const page = new URL(url);
7232
+ page.pathname = stripFarmBasePath(page.pathname);
7233
+ return farmDefaultMCPReadMarkdown(page.href);
7234
+ },
7235
+ });
7236
+ }
7237
+ const farmDefaultMCPReadMarkdown = createFarmLlmsMarkdownReader((page) => handleFarmRequest(page));
7238
+ ` : ""}
7123
7239
  // Static pages and root metadata for llms.txt, built the same way as in development.
7124
7240
  function createFarmLlmsTxtContext(request, full) {
7125
7241
  const origin = new URL(request.url).origin;
@@ -7142,7 +7258,7 @@ function createFarmLlmsTxtContext(request, full) {
7142
7258
  rootMetadata: rootLayout && rootLayout.module && rootLayout.module.metadata,
7143
7259
  ${servesAiCatalog ? `mcp: listFarmMCPLlmsTxtLinks(origin, {
7144
7260
  basePath: ${JSON.stringify(config.basePath)},
7145
- apiServerBasePath: farmLocalAPIBasePath,
7261
+ apiServerBasePath: farmLocalAPIBasePath,${servesDefaultMCP ? "\n defaultMCP: getFarmDefaultMCPServer," : ""}
7146
7262
  }),` : ""}
7147
7263
  }),
7148
7264
  // llms-full.txt reads each page's .md mirror through this same handler,
@@ -7823,7 +7939,11 @@ async function handleFarmRequestInContext(
7823
7939
  }
7824
7940
 
7825
7941
  ${hasServerRuntimeIntegrations ? `
7826
- const integrationDispatch = await handleIntegrationRequest(cloneFarmRequestWithContext(request));
7942
+ const farmIntegrationRanMiddleware = new Set();
7943
+ const integrationDispatch = await handleIntegrationRequest(
7944
+ cloneFarmRequestWithContext(request),
7945
+ farmIntegrationRanMiddleware,
7946
+ );
7827
7947
  if (integrationDispatch.response) {
7828
7948
  return integrationDispatch.response;
7829
7949
  }
@@ -7831,7 +7951,7 @@ async function handleFarmRequestInContext(
7831
7951
  // its rotated Set-Cookie values back here. They belong on whatever response
7832
7952
  // the page or API handler produces, so they ride the same deferred-header
7833
7953
  // channel the file middleware runner already uses.
7834
- const farmIntegrationSetCookies = integrationDispatch.setCookies;
7954
+ let farmIntegrationSetCookies = integrationDispatch.setCookies;
7835
7955
  ` : ""}
7836
7956
 
7837
7957
  ${hasMiddlewareRuntime ? `
@@ -7842,7 +7962,23 @@ async function handleFarmRequestInContext(
7842
7962
  if (middlewareResult.response) {
7843
7963
  return middlewareResult.response;
7844
7964
  }
7845
- request = middlewareResult.request;
7965
+ request = middlewareResult.request;${hasServerRuntimeIntegrations ? `
7966
+ // A ctx.rewrite() target is guarded as a direct request for it is: integration
7967
+ // guards (protectedRoutes) and routes see the rewritten URL, as in dev. Guards
7968
+ // that already ran for the original URL are skipped, so each runs once.
7969
+ if (request.url !== url.href) {
7970
+ const rewrittenDispatch = await handleIntegrationRequest(
7971
+ cloneFarmRequestWithContext(request),
7972
+ farmIntegrationRanMiddleware,
7973
+ );
7974
+ farmIntegrationSetCookies = [...farmIntegrationSetCookies, ...rewrittenDispatch.setCookies];
7975
+ if (rewrittenDispatch.response) {
7976
+ return applyProductionMiddlewareHeaders(
7977
+ rewrittenDispatch.response,
7978
+ withFarmIntegrationSetCookies(middlewareResult.headers, integrationDispatch.setCookies),
7979
+ );
7980
+ }
7981
+ }` : ""}
7846
7982
  const middlewareData = middlewareResult.data;
7847
7983
  const middlewareContext = middlewareResult.context;
7848
7984
  const middlewareHeaders = ${hasServerRuntimeIntegrations ? "withFarmIntegrationSetCookies(middlewareResult.headers, farmIntegrationSetCookies)" : "middlewareResult.headers"};
@@ -7871,7 +8007,10 @@ async function handleFarmRequestInContext(
7871
8007
  // API routes, as in dev.
7872
8008
  const farmAiCatalogResponse = createFarmAiCatalogResponse(
7873
8009
  request,
7874
- { basePath: ${JSON.stringify(config.basePath)}, apiServerBasePath: farmLocalAPIBasePath },
8010
+ {
8011
+ basePath: ${JSON.stringify(config.basePath)},
8012
+ apiServerBasePath: farmLocalAPIBasePath,${servesDefaultMCP ? "\n defaultMCP: getFarmDefaultMCPServer," : ""}
8013
+ },
7875
8014
  url,
7876
8015
  );
7877
8016
  if (farmAiCatalogResponse) {
@@ -8027,15 +8166,18 @@ async function handleFarmRequestInContext(
8027
8166
  return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
8028
8167
  }
8029
8168
  ` : ""}
8030
- ${config.analytics !== false ? `
8031
- // /.well-known/farmjs: the app's manifest, only for a request Farm Infra signed.
8032
- if (normalizeRuntimePath(routePathname) === ${JSON.stringify(FARM_APP_MANIFEST_PATH)}) {
8033
- const farmAppManifest = await createFarmAppManifestResponse(request, farmAppManifestInput, {
8034
- development: false,
8035
- });
8036
- if (farmAppManifest) {
8037
- return applyProductionMiddlewareHeaders(farmAppManifest, middlewareHeaders);
8038
- }
8169
+ ${config.agent?.manifest !== false ? `
8170
+ // agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
8171
+ // public manifest; Farm Infra's signed request gets the full view.
8172
+ if (
8173
+ [${JSON.stringify(FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
8174
+ normalizeRuntimePath(routePathname),
8175
+ )
8176
+ ) {
8177
+ return applyProductionMiddlewareHeaders(
8178
+ await createFarmAppManifestResponse(request, farmAppManifestInput),
8179
+ middlewareHeaders,
8180
+ );
8039
8181
  }
8040
8182
  ` : ""}
8041
8183
  ${config.agent?.apiCatalog ? `
@@ -8056,6 +8198,15 @@ async function handleFarmRequestInContext(
8056
8198
  );
8057
8199
  }
8058
8200
  ` : ""}
8201
+ ${servesAgentSitemap ? `
8202
+ // agent.sitemap with no sitemap.ts: serve the generated file.
8203
+ if (normalizeRuntimePath(routePathname) === "/sitemap.xml") {
8204
+ return applyProductionMiddlewareHeaders(
8205
+ createFarmAgentSitemapResponse(request),
8206
+ middlewareHeaders,
8207
+ );
8208
+ }
8209
+ ` : ""}
8059
8210
  ${config.agent?.llmsTxt?.enabled ? `
8060
8211
  // agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
8061
8212
  const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
@@ -8989,6 +9140,18 @@ async function handleFarmRequestInContext(
8989
9140
  }
8990
9141
  }
8991
9142
 
9143
+ ${servesDefaultMCP ? `
9144
+ // agent.mcp: no app route answered /mcp, so the default read-only server may.
9145
+ if (
9146
+ normalizeRuntimePath(routePathname) === ${JSON.stringify(FARM_DEFAULT_MCP_PATH)} &&
9147
+ getFarmDefaultMCPServer()
9148
+ ) {
9149
+ return applyProductionMiddlewareHeaders(
9150
+ await handleFarmDefaultMCP(request),
9151
+ middlewareHeaders,
9152
+ );
9153
+ }
9154
+ ` : ""}
8992
9155
  // 404 fallback - render proper HTML page
8993
9156
  return renderFarmNotFoundResponse();
8994
9157
 
@@ -9665,6 +9828,10 @@ function toFarmNodeResponse(request, response) {
9665
9828
  await fs.writeFile(nitroEntryPath, nitroEntryCode);
9666
9829
  const farmNodeServerEntryPath = preset === "node-server" ? path6.join(ssrOutputDir, "farm-node-server-entry.mjs") : null;
9667
9830
  if (farmNodeServerEntryPath && nodeAdapterModule) {
9831
+ await fs.writeFile(
9832
+ path6.join(ssrOutputDir, FARM_NODE_ENV_MODULE_FILE),
9833
+ FARM_NODE_ENV_MODULE_SOURCE
9834
+ );
9668
9835
  await fs.writeFile(
9669
9836
  farmNodeServerEntryPath,
9670
9837
  createFarmNodeServerEntry({
@@ -10746,7 +10913,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
10746
10913
  __name(resolveLegacyPageEntry, "resolveLegacyPageEntry");
10747
10914
  async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
10748
10915
  const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
10749
- import("./nitro-MXRDCXWZ.mjs"),
10916
+ import("./nitro-MPZJGPXK.mjs"),
10750
10917
  import("nitro/builder")
10751
10918
  ]);
10752
10919
  let nitroConfig = await createNitroConfig(
@@ -112,6 +112,55 @@ function isFarmMarkdownPublicSourceResponse(response) {
112
112
  return publicSourceResponses.has(response);
113
113
  }
114
114
  _chunkS3JO3N4Hcjs.__name.call(void 0, isFarmMarkdownPublicSourceResponse, "isFarmMarkdownPublicSourceResponse");
115
+ var ANONYMOUS_REQUEST_HEADERS = /* @__PURE__ */ new Set([
116
+ "accept",
117
+ "accept-encoding",
118
+ "accept-language",
119
+ "cache-control",
120
+ "connection",
121
+ "dnt",
122
+ "forwarded",
123
+ "host",
124
+ "if-match",
125
+ "if-modified-since",
126
+ "if-none-match",
127
+ "if-range",
128
+ "if-unmodified-since",
129
+ "keep-alive",
130
+ "origin",
131
+ "pragma",
132
+ "priority",
133
+ "purpose",
134
+ "range",
135
+ "referer",
136
+ "save-data",
137
+ "sec-gpc",
138
+ "sec-purpose",
139
+ "te",
140
+ "traceparent",
141
+ "tracestate",
142
+ "upgrade-insecure-requests",
143
+ "user-agent",
144
+ "via",
145
+ "x-forwarded-for",
146
+ "x-forwarded-host",
147
+ "x-forwarded-port",
148
+ "x-forwarded-proto",
149
+ "x-real-ip",
150
+ "x-request-id"
151
+ ]);
152
+ function isAnonymousRequestHeader(name) {
153
+ const lower = name.toLowerCase();
154
+ return ANONYMOUS_REQUEST_HEADERS.has(lower) || lower.startsWith("sec-fetch-") || lower.startsWith("sec-ch-");
155
+ }
156
+ _chunkS3JO3N4Hcjs.__name.call(void 0, isAnonymousRequestHeader, "isAnonymousRequestHeader");
157
+ function hasOnlyAnonymousHeaders(headers) {
158
+ for (const name of headers.keys()) {
159
+ if (!isAnonymousRequestHeader(name)) return false;
160
+ }
161
+ return true;
162
+ }
163
+ _chunkS3JO3N4Hcjs.__name.call(void 0, hasOnlyAnonymousHeaders, "hasOnlyAnonymousHeaders");
115
164
  async function createFarmMarkdownSourceResponse(options) {
116
165
  if (options.request.method !== "GET" && options.request.method !== "HEAD") {
117
166
  return null;
@@ -129,13 +178,14 @@ async function createFarmMarkdownSourceResponse(options) {
129
178
  if (!source) {
130
179
  return null;
131
180
  }
132
- const anonymous = !options.request.headers.has("cookie") && !options.request.headers.has("authorization");
181
+ const anonymous = hasOnlyAnonymousHeaders(options.request.headers);
133
182
  if (options.renderPage && (hasMarkdownExtension || !anonymous)) {
134
183
  const publicUrl = new URL(url);
135
184
  publicUrl.pathname = targetPathname;
136
- const publicHeaders = new Headers(options.request.headers);
137
- publicHeaders.delete("cookie");
138
- publicHeaders.delete("authorization");
185
+ const publicHeaders = new Headers();
186
+ for (const [name, value] of options.request.headers) {
187
+ if (isAnonymousRequestHeader(name)) publicHeaders.append(name, value);
188
+ }
139
189
  publicHeaders.set("accept", "text/markdown");
140
190
  const publicResponse = await options.renderPage(
141
191
  new Request(publicUrl, {
@@ -3,14 +3,14 @@ import {
3
3
  loadFarmDocsPage,
4
4
  resolveFarmDocsContentDir,
5
5
  toFarmDocsMarkdownPage
6
- } from "./chunk-PDOCJ6RY.mjs";
6
+ } from "./chunk-O6WAEAX3.mjs";
7
7
  import {
8
8
  docsEngine,
9
9
  loadFarmDocsEngine
10
10
  } from "./chunk-2VQKKQ6D.mjs";
11
11
  import {
12
12
  resolveDocsConfig
13
- } from "./chunk-6DU6UFUE.mjs";
13
+ } from "./chunk-OHLSEQ57.mjs";
14
14
  import {
15
15
  getFarmDocsAdapterConfigModule,
16
16
  isSecretDocsConfigKey