@farm.js/core 0.1.37 → 0.1.39

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 (250) hide show
  1. package/dist/{agent-mcp-BC0bAGVF.d.mts → agent-mcp-BhneNPb4.d.mts} +1 -1
  2. package/dist/{agent-mcp-jyDHbQKe.d.ts → agent-mcp-HcTYQmNX.d.ts} +1 -1
  3. package/dist/{agent-mcp-handler-SJAHFSPI.cjs → agent-mcp-handler-MRGP3WJ3.cjs} +5 -5
  4. package/dist/{agent-mcp-handler-LPJ2CADR.mjs → agent-mcp-handler-OLRMZONF.mjs} +4 -4
  5. package/dist/agent-runtime.cjs +3 -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 +2 -2
  9. package/dist/api/client.cjs +3 -3
  10. package/dist/api/client.mjs +2 -2
  11. package/dist/api/route-manager.cjs +5 -5
  12. package/dist/api/route-manager.d.mts +3 -3
  13. package/dist/api/route-manager.d.ts +3 -3
  14. package/dist/api/route-manager.mjs +4 -4
  15. package/dist/api/runtime.cjs +4 -4
  16. package/dist/api/runtime.d.mts +2 -2
  17. package/dist/api/runtime.d.ts +2 -2
  18. package/dist/api/runtime.mjs +3 -3
  19. package/dist/api.cjs +7 -7
  20. package/dist/api.d.mts +3 -3
  21. package/dist/api.d.ts +3 -3
  22. package/dist/api.mjs +6 -6
  23. package/dist/{app-CKO3iN1c.d.ts → app-CMkoghtp.d.ts} +21 -3
  24. package/dist/{app-Cbkj9ufe.d.mts → app-DVzmmbNO.d.mts} +21 -3
  25. package/dist/app-markdown.cjs +4 -4
  26. package/dist/app-markdown.d.mts +2 -2
  27. package/dist/app-markdown.d.ts +2 -2
  28. package/dist/app-markdown.mjs +3 -3
  29. package/dist/chunk-2ZYGC6SS.cjs +576 -0
  30. package/dist/{chunk-75X755YZ.cjs → chunk-34UCJRQO.cjs} +2 -2
  31. package/dist/{chunk-CVH2BXPY.cjs → chunk-3LOLJTFV.cjs} +6 -6
  32. package/dist/{chunk-4GPOC4LN.cjs → chunk-472NCAZ7.cjs} +3 -3
  33. package/dist/{chunk-O6WAEAX3.mjs → chunk-5BWWFHR2.mjs} +70 -15
  34. package/dist/{chunk-6LGFV2CQ.cjs → chunk-5OKBARDN.cjs} +2 -2
  35. package/dist/{chunk-3IP27TCG.cjs → chunk-5PWXMJOH.cjs} +19 -19
  36. package/dist/{chunk-WT4TGLXT.cjs → chunk-5ULKUBIA.cjs} +6 -6
  37. package/dist/{chunk-WRPHYQVY.mjs → chunk-677THUVP.mjs} +1 -1
  38. package/dist/chunk-6BK3K2GB.mjs +318 -0
  39. package/dist/{chunk-HEVMCTSR.mjs → chunk-6HB6V3R7.mjs} +1 -1
  40. package/dist/{chunk-NICDYKBS.cjs → chunk-6XWDE2P2.cjs} +22 -4
  41. package/dist/{chunk-CXEN47J3.mjs → chunk-73WX6PRY.mjs} +25 -0
  42. package/dist/{chunk-EXG5LD6B.mjs → chunk-75HN5IZ3.mjs} +21 -9
  43. package/dist/{chunk-7O5M4UKW.cjs → chunk-A657YSP4.cjs} +2 -2
  44. package/dist/{chunk-LBDP3YT3.mjs → chunk-ARC7I3O2.mjs} +1 -1
  45. package/dist/{chunk-Q5FYSK45.cjs → chunk-AS2VPMEE.cjs} +640 -521
  46. package/dist/{chunk-Z5BEWYVO.mjs → chunk-ATSDUUFK.mjs} +27 -1
  47. package/dist/{chunk-EMMQ64QW.cjs → chunk-B5J2YVG7.cjs} +16 -16
  48. package/dist/{chunk-FWE7LEQC.cjs → chunk-BD3D7EZV.cjs} +4 -4
  49. package/dist/{chunk-Z7LA7MHQ.mjs → chunk-BFJTHYTN.mjs} +1 -1
  50. package/dist/{chunk-UJZLSXUB.cjs → chunk-BWIQR4DH.cjs} +30 -4
  51. package/dist/{chunk-W2YDNK66.cjs → chunk-BXDJXFQG.cjs} +4 -4
  52. package/dist/{chunk-MCIZVNOQ.mjs → chunk-BZHXGVMA.mjs} +1 -1
  53. package/dist/{chunk-7DWNJI73.cjs → chunk-CIOT4HGT.cjs} +37 -19
  54. package/dist/{chunk-KDTBF3UU.mjs → chunk-CNNOLE4O.mjs} +1 -1
  55. package/dist/{chunk-TDNWPAVR.mjs → chunk-CUM5NYL5.mjs} +1 -1
  56. package/dist/{chunk-HITLGIAO.cjs → chunk-CY2ZQ5C6.cjs} +7 -6
  57. package/dist/{chunk-KPFKMDM7.mjs → chunk-EGCTIS5F.mjs} +2 -2
  58. package/dist/{chunk-VR4GD5I3.cjs → chunk-EIPC3FDA.cjs} +12 -4
  59. package/dist/{chunk-B5PFZLKV.cjs → chunk-EKN7NSZO.cjs} +25 -8
  60. package/dist/{chunk-6SJ2KJTA.mjs → chunk-EPYU2EBL.mjs} +1 -1
  61. package/dist/{chunk-LBGILORX.mjs → chunk-GKBWWRBG.mjs} +101 -10
  62. package/dist/{chunk-PTZ2TVNE.cjs → chunk-H5CLOUZS.cjs} +5 -5
  63. package/dist/{chunk-DTSROJ5J.mjs → chunk-HD5CF3OE.mjs} +1 -1
  64. package/dist/{chunk-3A4KGQYI.cjs → chunk-HRETEZ2Z.cjs} +27 -15
  65. package/dist/{chunk-ATWHHSY2.cjs → chunk-HRSAQ23K.cjs} +7 -7
  66. package/dist/{chunk-IAIYV4RZ.mjs → chunk-HXRYZWTA.mjs} +1 -1
  67. package/dist/{chunk-4P6ULFMD.mjs → chunk-HYTZYOW2.mjs} +222 -103
  68. package/dist/{chunk-HMRSWN47.mjs → chunk-INL3THCU.mjs} +1 -1
  69. package/dist/{chunk-FBOJ55OM.mjs → chunk-IVLZZZEI.mjs} +1 -1
  70. package/dist/{chunk-ENLZ4R3Y.mjs → chunk-J7K2NZD6.mjs} +7 -6
  71. package/dist/{chunk-PMQHMWZU.cjs → chunk-JCYYXBAJ.cjs} +3 -3
  72. package/dist/{chunk-K3SAEIM3.mjs → chunk-KTSUBU2E.mjs} +2 -2
  73. package/dist/{chunk-LPFV45AY.cjs → chunk-LMPAPBUA.cjs} +19 -19
  74. package/dist/{chunk-EK4QAEFZ.cjs → chunk-LZESP4IR.cjs} +25 -0
  75. package/dist/{chunk-TW4GYDBJ.mjs → chunk-MLY2RP5R.mjs} +10 -2
  76. package/dist/{chunk-BHY547NB.cjs → chunk-NBBEQLOK.cjs} +9 -9
  77. package/dist/{chunk-WQ7T2263.mjs → chunk-OAHTRMIC.mjs} +3 -3
  78. package/dist/{chunk-HZFM2LWQ.mjs → chunk-P3PLW4FR.mjs} +34 -2
  79. package/dist/{chunk-UH6QN5NL.mjs → chunk-P664ZVTV.mjs} +2 -2
  80. package/dist/{chunk-TE2G5ION.cjs → chunk-PGZDEPTM.cjs} +88 -33
  81. package/dist/{chunk-3KGDJLJK.mjs → chunk-POSPE3IO.mjs} +19 -1
  82. package/dist/{chunk-FGRYBX5X.mjs → chunk-PVZE2JGJ.mjs} +2 -2
  83. package/dist/{chunk-TPLJVC7E.mjs → chunk-QFW2IH5E.mjs} +23 -6
  84. package/dist/{chunk-5BXGGEC7.cjs → chunk-QG775BRV.cjs} +17 -17
  85. package/dist/{chunk-S3VWVTVA.mjs → chunk-QRKIMN7T.mjs} +13 -1
  86. package/dist/chunk-QTXBII4Z.cjs +632 -0
  87. package/dist/{chunk-NQ6QFZWD.cjs → chunk-QUCXCDE2.cjs} +1 -1
  88. package/dist/{chunk-NFMDCAOS.mjs → chunk-QYMZOOC5.mjs} +3 -3
  89. package/dist/{chunk-CI6E3UOH.cjs → chunk-RG4A6LB2.cjs} +7 -7
  90. package/dist/{chunk-LOFKRKO7.cjs → chunk-RVXFINNS.cjs} +113 -22
  91. package/dist/{chunk-7SQ5SGYZ.cjs → chunk-RW63BOV7.cjs} +2 -2
  92. package/dist/{chunk-U6MPZ35Q.cjs → chunk-RWFLWR5J.cjs} +8 -8
  93. package/dist/{chunk-EUV4YR3V.cjs → chunk-SGBJ247Q.cjs} +18 -2
  94. package/dist/{chunk-J3ANCZKA.mjs → chunk-SKVTP5PR.mjs} +1 -1
  95. package/dist/{chunk-YCKO6FRS.mjs → chunk-SOP2EAA6.mjs} +1 -1
  96. package/dist/{chunk-ND2CWPOD.mjs → chunk-TS4JHGUJ.mjs} +1 -1
  97. package/dist/chunk-U6QLDL3G.mjs +576 -0
  98. package/dist/{chunk-OW67PDDS.cjs → chunk-ULASELLA.cjs} +13 -1
  99. package/dist/{chunk-4GWRFP22.cjs → chunk-UPJLHLJU.cjs} +35 -3
  100. package/dist/{chunk-WWIKMBRN.mjs → chunk-VNGH5MLF.mjs} +17 -1
  101. package/dist/{chunk-NNSAQX3U.mjs → chunk-VT4WFRHA.mjs} +1 -1
  102. package/dist/{chunk-JPNFPAZ4.mjs → chunk-VWBHM3F6.mjs} +2 -2
  103. package/dist/{chunk-ADOAUDQ6.cjs → chunk-VXEEATVD.cjs} +2 -2
  104. package/dist/{chunk-RRMVL6CJ.mjs → chunk-W36M2BQ4.mjs} +1 -1
  105. package/dist/{chunk-4WQ6PGSJ.cjs → chunk-WEW2JVA4.cjs} +4 -4
  106. package/dist/{chunk-4E5WBPEG.mjs → chunk-WFRT7JPX.mjs} +8 -533
  107. package/dist/{chunk-VXAWRDK7.mjs → chunk-WLL43JMO.mjs} +1 -1
  108. package/dist/chunk-WW46B6HA.cjs +318 -0
  109. package/dist/{chunk-D3C5LBQY.cjs → chunk-WXJLNP33.cjs} +2 -2
  110. package/dist/{chunk-NDILNQ4L.cjs → chunk-XKG2BLFN.cjs} +2 -2
  111. package/dist/{chunk-6TJITR2B.cjs → chunk-YFYUYWL7.cjs} +870 -751
  112. package/dist/{chunk-XOPOIFTJ.mjs → chunk-YKZRDB5Z.mjs} +25 -7
  113. package/dist/{chunk-K4I4O5TS.mjs → chunk-ZUPXLIGB.mjs} +790 -671
  114. package/dist/{chunk-G2TEB74S.cjs → chunk-ZXH4TS3F.cjs} +2 -2
  115. package/dist/{client-plugins-CV4eJ9De.d.mts → client-plugins-CsCuCLBz.d.mts} +58 -7
  116. package/dist/{client-plugins-C8DjftDF.d.ts → client-plugins-D0ke-Hc8.d.ts} +58 -7
  117. package/dist/client-plugins.d.mts +1 -1
  118. package/dist/client-plugins.d.ts +1 -1
  119. package/dist/client.cjs +7 -7
  120. package/dist/client.d.mts +5 -5
  121. package/dist/client.d.ts +5 -5
  122. package/dist/client.mjs +6 -6
  123. package/dist/config.d.mts +1 -1
  124. package/dist/config.d.ts +1 -1
  125. package/dist/{devtools-KVOY2TCZ.mjs → devtools-5AFIPVUJ.mjs} +8 -6
  126. package/dist/{devtools-JXFQNWSH.cjs → devtools-LW4QQ5J3.cjs} +9 -7
  127. package/dist/docs.cjs +12 -10
  128. package/dist/docs.d.mts +20 -2
  129. package/dist/docs.d.ts +20 -2
  130. package/dist/docs.mjs +11 -9
  131. package/dist/headers.cjs +6 -4
  132. package/dist/headers.d.mts +11 -1
  133. package/dist/headers.d.ts +11 -1
  134. package/dist/headers.mjs +5 -3
  135. package/dist/index.cjs +55 -42
  136. package/dist/index.d.mts +15 -15
  137. package/dist/index.d.ts +15 -15
  138. package/dist/index.mjs +55 -42
  139. package/dist/integrations.cjs +5 -3
  140. package/dist/integrations.d.mts +1 -1
  141. package/dist/integrations.d.ts +1 -1
  142. package/dist/integrations.mjs +4 -2
  143. package/dist/internal/app-markdown-runtime.cjs +3 -3
  144. package/dist/internal/app-markdown-runtime.d.mts +2 -2
  145. package/dist/internal/app-markdown-runtime.d.ts +2 -2
  146. package/dist/internal/app-markdown-runtime.mjs +2 -2
  147. package/dist/internal/build-runtime.cjs +30 -29
  148. package/dist/internal/build-runtime.d.mts +3 -3
  149. package/dist/internal/build-runtime.d.ts +3 -3
  150. package/dist/internal/build-runtime.mjs +29 -28
  151. package/dist/internal/cli-runtime.cjs +11 -9
  152. package/dist/internal/cli-runtime.mjs +10 -8
  153. package/dist/internal/client-error-overlay.cjs +4 -4
  154. package/dist/internal/client-error-overlay.mjs +1 -1
  155. package/dist/internal/compression-runtime.d.mts +1 -1
  156. package/dist/internal/compression-runtime.d.ts +1 -1
  157. package/dist/internal/config-runtime.cjs +9 -7
  158. package/dist/internal/config-runtime.d.mts +2 -2
  159. package/dist/internal/config-runtime.d.ts +2 -2
  160. package/dist/internal/config-runtime.mjs +8 -6
  161. package/dist/internal/docs-precompiled-runtime.cjs +19 -13
  162. package/dist/internal/docs-precompiled-runtime.d.mts +5 -0
  163. package/dist/internal/docs-precompiled-runtime.d.ts +5 -0
  164. package/dist/internal/docs-precompiled-runtime.mjs +14 -8
  165. package/dist/internal/infra-analytics-runtime.cjs +5 -5
  166. package/dist/internal/infra-analytics-runtime.mjs +3 -3
  167. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  168. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  169. package/dist/internal/production-node-env.cjs +6 -2
  170. package/dist/internal/production-node-env.d.mts +10 -1
  171. package/dist/internal/production-node-env.d.ts +10 -1
  172. package/dist/internal/production-node-env.mjs +5 -1
  173. package/dist/internal/production-runtime.cjs +38 -16
  174. package/dist/internal/production-runtime.d.mts +51 -11
  175. package/dist/internal/production-runtime.d.ts +51 -11
  176. package/dist/internal/production-runtime.mjs +40 -18
  177. package/dist/markdown.cjs +8 -2
  178. package/dist/markdown.d.mts +1 -1
  179. package/dist/markdown.d.ts +1 -1
  180. package/dist/markdown.mjs +7 -1
  181. package/dist/middleware.cjs +10 -8
  182. package/dist/middleware.d.mts +24 -4
  183. package/dist/middleware.d.ts +24 -4
  184. package/dist/middleware.mjs +10 -8
  185. package/dist/navigation.cjs +6 -6
  186. package/dist/navigation.d.mts +4 -4
  187. package/dist/navigation.d.ts +4 -4
  188. package/dist/navigation.mjs +5 -5
  189. package/dist/plugin.cjs +23 -22
  190. package/dist/plugin.d.mts +1 -1
  191. package/dist/plugin.d.ts +1 -1
  192. package/dist/plugin.mjs +22 -21
  193. package/dist/{production-runtime-C2kkrPVZ.d.ts → production-runtime-BaI3WHnV.d.ts} +1 -1
  194. package/dist/{production-runtime-Du_FHb2-.d.mts → production-runtime-DfRP0cV0.d.mts} +1 -1
  195. package/dist/query/client.cjs +8 -8
  196. package/dist/query/client.mjs +3 -3
  197. package/dist/{render-plan-BnnPTpus.d.ts → render-plan-CfIdJKAf.d.ts} +1 -1
  198. package/dist/{render-plan-Cgx7v8tJ.d.mts → render-plan-Dg8RBYFa.d.mts} +1 -1
  199. package/dist/renderer-client.cjs +5 -5
  200. package/dist/renderer-client.d.mts +3 -3
  201. package/dist/renderer-client.d.ts +3 -3
  202. package/dist/renderer-client.mjs +2 -2
  203. package/dist/renderer.d.mts +13 -4
  204. package/dist/renderer.d.ts +13 -4
  205. package/dist/{request-BNWr7r5e.d.ts → request-CEbHIIl4.d.ts} +4 -2
  206. package/dist/{request-sKayKcop.d.mts → request-DfE02G_A.d.mts} +4 -2
  207. package/dist/request.cjs +3 -3
  208. package/dist/request.d.mts +2 -2
  209. package/dist/request.d.ts +2 -2
  210. package/dist/request.mjs +2 -2
  211. package/dist/{route-rendering-DWFp3Yq4.d.mts → route-rendering-BHyOfXjD.d.mts} +1 -1
  212. package/dist/{route-rendering-Bx4Auw6Q.d.ts → route-rendering-C4oHbv6C.d.ts} +1 -1
  213. package/dist/{router-BK6K42Ij.d.mts → router-DwhA61SB.d.mts} +1 -1
  214. package/dist/{router-DnW_2tQi.d.ts → router-uRN_29Em.d.ts} +1 -1
  215. package/dist/routes.d.mts +1 -1
  216. package/dist/routes.d.ts +1 -1
  217. package/dist/{runtime-DJDaCMd_.d.mts → runtime-BEdHhN4C.d.mts} +1 -1
  218. package/dist/{runtime-CA3Ei5k_.d.ts → runtime-COk03hmx.d.ts} +1 -1
  219. package/dist/server-fn.cjs +3 -3
  220. package/dist/server-fn.mjs +2 -2
  221. package/dist/server-plugins.cjs +5 -5
  222. package/dist/server-plugins.d.mts +2 -2
  223. package/dist/server-plugins.d.ts +2 -2
  224. package/dist/server-plugins.mjs +4 -4
  225. package/dist/server-query.cjs +4 -4
  226. package/dist/server-query.mjs +3 -3
  227. package/dist/server.cjs +49 -48
  228. package/dist/server.d.mts +7 -7
  229. package/dist/server.d.ts +7 -7
  230. package/dist/server.mjs +27 -26
  231. package/dist/{spa-router-Mwbd7g2L.d.ts → spa-router-DrVOBVGg.d.ts} +2 -2
  232. package/dist/{spa-router-D6fUA4Rn.d.mts → spa-router-w4aFOuyn.d.mts} +2 -2
  233. package/dist/testing.cjs +5 -5
  234. package/dist/testing.d.mts +1 -1
  235. package/dist/testing.d.ts +1 -1
  236. package/dist/testing.mjs +4 -4
  237. package/dist/theme/server.cjs +4 -4
  238. package/dist/theme/server.mjs +3 -3
  239. package/dist/{utils-p9Hs-jCc.d.mts → utils-BtYehqeU.d.mts} +1 -1
  240. package/dist/{utils-BwVcAfUR.d.ts → utils-Dhuqwmd2.d.ts} +1 -1
  241. package/dist/version.cjs +2 -2
  242. package/dist/version.mjs +1 -1
  243. package/dist/vite.cjs +23 -22
  244. package/dist/vite.d.mts +1 -1
  245. package/dist/vite.d.ts +1 -1
  246. package/dist/vite.mjs +22 -21
  247. package/package.json +1 -1
  248. package/dist/chunk-655RLQQL.mjs +0 -43
  249. package/dist/chunk-MRMI32SN.cjs +0 -1157
  250. package/dist/chunk-MT763TDW.cjs +0 -43
@@ -2,9 +2,10 @@ import {
2
2
  defineSchema
3
3
  } from "./chunk-44SYJEG3.mjs";
4
4
  import {
5
+ assertSupportedMiddlewareMatcher,
5
6
  compileMiddlewareConfig,
6
7
  matchesCompiledMiddlewareConfig
7
- } from "./chunk-HZFM2LWQ.mjs";
8
+ } from "./chunk-P3PLW4FR.mjs";
8
9
  import {
9
10
  bufferFarmRequestBody,
10
11
  clearRequestContext,
@@ -285,6 +286,15 @@ function resolveIntegrationPlugins(integrations) {
285
286
  if (!integration || !isFarmIntegration(integration)) {
286
287
  continue;
287
288
  }
289
+ for (const entry of integration.middleware || []) {
290
+ if (!entry.matcher) continue;
291
+ const matchers = Array.isArray(entry.matcher) ? entry.matcher : [entry.matcher];
292
+ try {
293
+ matchers.forEach(assertSupportedMiddlewareMatcher);
294
+ } catch (error) {
295
+ throw new Error(`Integration "${key}": ${error.message}`);
296
+ }
297
+ }
288
298
  const owner = createIntegrationPluginOwner(key, integration, "lifecycle");
289
299
  plugins.push(withIntegrationPluginOwner(createIntegrationPlugin(key, integration), owner));
290
300
  plugins.push(...resolveIntegrationPluginContributions(key, integration));
@@ -2033,6 +2043,21 @@ function resolveIntegrationMiddlewareParams(entry, pathname, config) {
2033
2043
  return null;
2034
2044
  }
2035
2045
  __name(resolveIntegrationMiddlewareParams, "resolveIntegrationMiddlewareParams");
2046
+ function integrationMiddlewareMayHandlePath(integrations, pathname, catchAllProbe) {
2047
+ if (!integrations) return false;
2048
+ const covers = /* @__PURE__ */ __name((entry) => resolveIntegrationMiddlewareParams(entry, pathname, void 0) !== null, "covers");
2049
+ return Object.values(integrations).some(
2050
+ (integration) => isFarmIntegration(integration) && (integration.middleware || []).some((entry) => {
2051
+ if (catchAllProbe === void 0) return covers(entry);
2052
+ if (!entry.matcher) return false;
2053
+ const specific = (Array.isArray(entry.matcher) ? entry.matcher : [entry.matcher]).filter(
2054
+ (matcher) => resolveIntegrationMiddlewareParams({ matcher }, catchAllProbe, void 0) === null
2055
+ );
2056
+ return specific.length > 0 && covers({ matcher: specific });
2057
+ })
2058
+ );
2059
+ }
2060
+ __name(integrationMiddlewareMayHandlePath, "integrationMiddlewareMayHandlePath");
2036
2061
  var FARM_INTEGRATION_API_BASE_PATH_KEY = "__farmAPIServerBasePath";
2037
2062
  var integrationAPIPathnames = /* @__PURE__ */ new WeakMap();
2038
2063
  function getIntegrationAPIPathnames(config) {
@@ -2183,5 +2208,6 @@ export {
2183
2208
  getRegisteredIntegrationAPIManifest,
2184
2209
  dispatchIntegrationRequest,
2185
2210
  dispatchIntegrationRequests,
2211
+ integrationMiddlewareMayHandlePath,
2186
2212
  FARM_INTEGRATION_API_BASE_PATH_KEY
2187
2213
  };
@@ -7,13 +7,13 @@ var _chunkSU7MH53Pcjs = require('./chunk-SU7MH53P.cjs');
7
7
 
8
8
 
9
9
 
10
- var _chunkFWE7LEQCcjs = require('./chunk-FWE7LEQC.cjs');
10
+ var _chunkBD3D7EZVcjs = require('./chunk-BD3D7EZV.cjs');
11
11
 
12
12
 
13
13
  var _chunkS6FJO323cjs = require('./chunk-S6FJO323.cjs');
14
14
 
15
15
 
16
- var _chunkOW67PDDScjs = require('./chunk-OW67PDDS.cjs');
16
+ var _chunkULASELLAcjs = require('./chunk-ULASELLA.cjs');
17
17
 
18
18
 
19
19
  var _chunkBIDYX3SLcjs = require('./chunk-BIDYX3SL.cjs');
@@ -52,7 +52,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, shouldBlockUnload, "shouldBlockUnload");
52
52
  function navigateViaRouter(href, basePath, replace, options = {}) {
53
53
  if (typeof window === "undefined") return;
54
54
  const url = _chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, href, basePath);
55
- const spaRouter = _chunkFWE7LEQCcjs.getInstalledFarmSPARouter.call(void 0, );
55
+ const spaRouter = _chunkBD3D7EZVcjs.getInstalledFarmSPARouter.call(void 0, );
56
56
  if (spaRouter) {
57
57
  void spaRouter.navigate(url, {
58
58
  replace,
@@ -65,7 +65,7 @@ function navigateViaRouter(href, basePath, replace, options = {}) {
65
65
  } else {
66
66
  window.history.pushState(null, "", url);
67
67
  }
68
- _chunkFWE7LEQCcjs.notifyHistoryChange.call(void 0, "url-search");
68
+ _chunkBD3D7EZVcjs.notifyHistoryChange.call(void 0, "url-search");
69
69
  }
70
70
  _chunkS3JO3N4Hcjs.__name.call(void 0, navigateViaRouter, "navigateViaRouter");
71
71
  function useRouter(options = {}) {
@@ -85,7 +85,7 @@ function useRouter(options = {}) {
85
85
  setState(readRouterState(basePath, routeMatcher));
86
86
  }, "handlePopState");
87
87
  handlePopState();
88
- const unsubscribe = _chunkFWE7LEQCcjs.subscribeHistoryChange.call(void 0, handlePopState);
88
+ const unsubscribe = _chunkBD3D7EZVcjs.subscribeHistoryChange.call(void 0, handlePopState);
89
89
  return unsubscribe;
90
90
  }, [basePath, routeMatcher]);
91
91
  const push = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (href, navigateOptions) => {
@@ -96,11 +96,11 @@ function useRouter(options = {}) {
96
96
  }, "replace");
97
97
  const pushState = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (pageState, href) => {
98
98
  if (typeof window === "undefined") return;
99
- _chunkFWE7LEQCcjs.getRouter.call(void 0, ).pushState(pageState, resolveClientHref(href, basePath));
99
+ _chunkBD3D7EZVcjs.getRouter.call(void 0, ).pushState(pageState, resolveClientHref(href, basePath));
100
100
  }, "pushState");
101
101
  const replaceState = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (pageState, href) => {
102
102
  if (typeof window === "undefined") return;
103
- _chunkFWE7LEQCcjs.getRouter.call(void 0, ).replaceState(pageState, resolveClientHref(href, basePath));
103
+ _chunkBD3D7EZVcjs.getRouter.call(void 0, ).replaceState(pageState, resolveClientHref(href, basePath));
104
104
  }, "replaceState");
105
105
  const back = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => {
106
106
  if (typeof window !== "undefined") {
@@ -124,25 +124,25 @@ function useRouter(options = {}) {
124
124
  }
125
125
  _chunkS3JO3N4Hcjs.__name.call(void 0, useRouter, "useRouter");
126
126
  function usePageState() {
127
- const [state, setState] = _react.useState.call(void 0, () => _chunkFWE7LEQCcjs.readPageState.call(void 0, ));
127
+ const [state, setState] = _react.useState.call(void 0, () => _chunkBD3D7EZVcjs.readPageState.call(void 0, ));
128
128
  _react.useEffect.call(void 0, () => {
129
129
  if (typeof window === "undefined") return;
130
130
  const handlePopState = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => {
131
- setState(_chunkFWE7LEQCcjs.readPageState.call(void 0, ));
131
+ setState(_chunkBD3D7EZVcjs.readPageState.call(void 0, ));
132
132
  }, "handlePopState");
133
133
  handlePopState();
134
- return _chunkFWE7LEQCcjs.subscribeHistoryChange.call(void 0, handlePopState);
134
+ return _chunkBD3D7EZVcjs.subscribeHistoryChange.call(void 0, handlePopState);
135
135
  }, []);
136
136
  return state;
137
137
  }
138
138
  _chunkS3JO3N4Hcjs.__name.call(void 0, usePageState, "usePageState");
139
139
  function useNavigation() {
140
140
  const [state, setState] = _react.useState.call(void 0,
141
- () => _chunkFWE7LEQCcjs.getRouter.call(void 0, ).getNavigationState()
141
+ () => _chunkBD3D7EZVcjs.getRouter.call(void 0, ).getNavigationState()
142
142
  );
143
143
  _react.useEffect.call(void 0, () => {
144
144
  if (typeof window === "undefined") return;
145
- return _chunkFWE7LEQCcjs.getRouter.call(void 0, ).subscribeNavigation(setState);
145
+ return _chunkBD3D7EZVcjs.getRouter.call(void 0, ).subscribeNavigation(setState);
146
146
  }, []);
147
147
  return state;
148
148
  }
@@ -155,7 +155,7 @@ function useBlocker(options) {
155
155
  if (typeof window === "undefined" || !active) {
156
156
  return;
157
157
  }
158
- return _chunkFWE7LEQCcjs.getRouter.call(void 0, ).addBlocker(
158
+ return _chunkBD3D7EZVcjs.getRouter.call(void 0, ).addBlocker(
159
159
  async (context) => {
160
160
  const current = optionsRef.current;
161
161
  const when = typeof current.when === "function" ? current.when(context) : current.when;
@@ -179,7 +179,7 @@ function useScrollRestoration(key) {
179
179
  _react.useEffect.call(void 0, () => {
180
180
  const element = ref.current;
181
181
  if (!element) return;
182
- return _chunkFWE7LEQCcjs.getRouter.call(void 0, ).registerScrollElement(key, element);
182
+ return _chunkBD3D7EZVcjs.getRouter.call(void 0, ).registerScrollElement(key, element);
183
183
  }, [key]);
184
184
  return ref;
185
185
  }
@@ -201,7 +201,7 @@ function readRouterState(basePath, routeMatcher) {
201
201
  pathname,
202
202
  searchParams: url.searchParams,
203
203
  params: _optionalChain([routeMatcher, 'optionalAccess', _5 => _5.match, 'call', _6 => _6(routePathname), 'optionalAccess', _7 => _7.params]) || {},
204
- pageState: typeof window === "undefined" ? null : _chunkFWE7LEQCcjs.readPageState.call(void 0, )
204
+ pageState: typeof window === "undefined" ? null : _chunkBD3D7EZVcjs.readPageState.call(void 0, )
205
205
  };
206
206
  }
207
207
  _chunkS3JO3N4Hcjs.__name.call(void 0, readRouterState, "readRouterState");
@@ -213,7 +213,7 @@ function readCurrentUrl() {
213
213
  return void 0;
214
214
  }
215
215
  }
216
- const request = _chunkOW67PDDScjs._resolveCurrentRequest.call(void 0, );
216
+ const request = _chunkULASELLAcjs._resolveCurrentRequest.call(void 0, );
217
217
  if (!request) return void 0;
218
218
  try {
219
219
  return new URL(request.url);
@@ -17,7 +17,7 @@ var _chunkJ7FSKED3cjs = require('./chunk-J7FSKED3.cjs');
17
17
 
18
18
 
19
19
 
20
- var _chunkEK4QAEFZcjs = require('./chunk-EK4QAEFZ.cjs');
20
+ var _chunkLZESP4IRcjs = require('./chunk-LZESP4IR.cjs');
21
21
 
22
22
 
23
23
 
@@ -31,7 +31,7 @@ var _chunkQBK2AA4Ucjs = require('./chunk-QBK2AA4U.cjs');
31
31
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
32
32
 
33
33
  // src/client/metadata-reconciler.ts
34
- var MANAGED_ATTRIBUTE = _chunkEK4QAEFZcjs.FARM_METADATA_ATTRIBUTE;
34
+ var MANAGED_ATTRIBUTE = _chunkLZESP4IRcjs.FARM_METADATA_ATTRIBUTE;
35
35
  var OWNED_SELECTORS = [
36
36
  'meta[name="description"]',
37
37
  'meta[name="keywords"]',
@@ -66,8 +66,8 @@ function removeAll(selector) {
66
66
  }
67
67
  _chunkS3JO3N4Hcjs.__name.call(void 0, removeAll, "removeAll");
68
68
  function applyFarmMetadataToDocument(metadata, pathname) {
69
- document.title = _chunkEK4QAEFZcjs.resolveMetadataTitle.call(void 0, _optionalChain([metadata, 'optionalAccess', _ => _.title])) || "Farm.js App";
70
- const rendered = _chunkEK4QAEFZcjs.renderMetadataHead.call(void 0, metadata, { pathname });
69
+ document.title = _chunkLZESP4IRcjs.resolveMetadataTitle.call(void 0, _optionalChain([metadata, 'optionalAccess', _ => _.title])) || "Farm.js App";
70
+ const rendered = _chunkLZESP4IRcjs.renderMetadataHead.call(void 0, metadata, { pathname });
71
71
  const template = document.createElement("template");
72
72
  template.innerHTML = rendered.tags;
73
73
  const viewport = document.createElement("template");
@@ -27,7 +27,7 @@ import {
27
27
  } from "./chunk-ZMSZZXOR.mjs";
28
28
  import {
29
29
  getIntegrationSchemas
30
- } from "./chunk-Z5BEWYVO.mjs";
30
+ } from "./chunk-ATSDUUFK.mjs";
31
31
  import {
32
32
  __name
33
33
  } from "./chunk-LPEX4YW6.mjs";
@@ -4,7 +4,8 @@ var _chunkG643DQCHcjs = require('./chunk-G643DQCH.cjs');
4
4
 
5
5
 
6
6
 
7
- var _chunk4GWRFP22cjs = require('./chunk-4GWRFP22.cjs');
7
+
8
+ var _chunkUPJLHLJUcjs = require('./chunk-UPJLHLJU.cjs');
8
9
 
9
10
 
10
11
 
@@ -285,6 +286,15 @@ function resolveIntegrationPlugins(integrations) {
285
286
  if (!integration || !isFarmIntegration(integration)) {
286
287
  continue;
287
288
  }
289
+ for (const entry of integration.middleware || []) {
290
+ if (!entry.matcher) continue;
291
+ const matchers = Array.isArray(entry.matcher) ? entry.matcher : [entry.matcher];
292
+ try {
293
+ matchers.forEach(_chunkUPJLHLJUcjs.assertSupportedMiddlewareMatcher);
294
+ } catch (error) {
295
+ throw new Error(`Integration "${key}": ${error.message}`);
296
+ }
297
+ }
288
298
  const owner = createIntegrationPluginOwner(key, integration, "lifecycle");
289
299
  plugins.push(withIntegrationPluginOwner(createIntegrationPlugin(key, integration), owner));
290
300
  plugins.push(...resolveIntegrationPluginContributions(key, integration));
@@ -2021,18 +2031,33 @@ function resolveIntegrationMiddlewareParams(entry, pathname, config) {
2021
2031
  }
2022
2032
  let compiled = compiledIntegrationGuards.get(entry);
2023
2033
  if (!compiled) {
2024
- compiled = _chunk4GWRFP22cjs.compileMiddlewareConfig.call(void 0, {
2034
+ compiled = _chunkUPJLHLJUcjs.compileMiddlewareConfig.call(void 0, {
2025
2035
  matcher: typeof entry.matcher === "string" ? entry.matcher : [...entry.matcher]
2026
2036
  });
2027
2037
  compiledIntegrationGuards.set(entry, compiled);
2028
2038
  }
2029
2039
  for (const candidate of candidates) {
2030
- const result = _chunk4GWRFP22cjs.matchesCompiledMiddlewareConfig.call(void 0, candidate, compiled, noMiddlewareContext);
2040
+ const result = _chunkUPJLHLJUcjs.matchesCompiledMiddlewareConfig.call(void 0, candidate, compiled, noMiddlewareContext);
2031
2041
  if (result.matched) return _nullishCoalesce(result.params, () => ( {}));
2032
2042
  }
2033
2043
  return null;
2034
2044
  }
2035
2045
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveIntegrationMiddlewareParams, "resolveIntegrationMiddlewareParams");
2046
+ function integrationMiddlewareMayHandlePath(integrations, pathname, catchAllProbe) {
2047
+ if (!integrations) return false;
2048
+ const covers = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (entry) => resolveIntegrationMiddlewareParams(entry, pathname, void 0) !== null, "covers");
2049
+ return Object.values(integrations).some(
2050
+ (integration) => isFarmIntegration(integration) && (integration.middleware || []).some((entry) => {
2051
+ if (catchAllProbe === void 0) return covers(entry);
2052
+ if (!entry.matcher) return false;
2053
+ const specific = (Array.isArray(entry.matcher) ? entry.matcher : [entry.matcher]).filter(
2054
+ (matcher) => resolveIntegrationMiddlewareParams({ matcher }, catchAllProbe, void 0) === null
2055
+ );
2056
+ return specific.length > 0 && covers({ matcher: specific });
2057
+ })
2058
+ );
2059
+ }
2060
+ _chunkS3JO3N4Hcjs.__name.call(void 0, integrationMiddlewareMayHandlePath, "integrationMiddlewareMayHandlePath");
2036
2061
  var FARM_INTEGRATION_API_BASE_PATH_KEY = "__farmAPIServerBasePath";
2037
2062
  var integrationAPIPathnames = /* @__PURE__ */ new WeakMap();
2038
2063
  function getIntegrationAPIPathnames(config) {
@@ -2184,4 +2209,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, normalizeMatcher, "normalizeMatcher");
2184
2209
 
2185
2210
 
2186
2211
 
2187
- exports.getFarmPluginIntegrationContext = getFarmPluginIntegrationContext; exports.FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY = FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY; exports.FARM_INTEGRATION_SET_COOKIES_KEY = FARM_INTEGRATION_SET_COOKIES_KEY; exports.forwardIntegrationSetCookies = forwardIntegrationSetCookies; exports.defineIntegrationSchema = defineIntegrationSchema; exports.getFarmIntegrationPluginServerRuntime = getFarmIntegrationPluginServerRuntime; exports.getFarmIntegrationPluginOwner = getFarmIntegrationPluginOwner; exports.createIntegrationRoute = createIntegrationRoute; exports.integrationRoute = integrationRoute; exports.defineIntegration = defineIntegration; exports.isFarmIntegration = isFarmIntegration; exports.resolveIntegrationPlugins = resolveIntegrationPlugins; exports.getIntegrationProviders = getIntegrationProviders; exports.isFarmIntegrationProviderComponentReference = isFarmIntegrationProviderComponentReference; exports.getIntegrationDocumentNavigationMatchers = getIntegrationDocumentNavigationMatchers; exports.getIntegrationSchemas = getIntegrationSchemas; exports.getRegisteredIntegrationRuntime = getRegisteredIntegrationRuntime; exports.getRegisteredIntegrations = getRegisteredIntegrations; exports.getRegisteredIntegrationSchemas = getRegisteredIntegrationSchemas; exports.matchIntegrationRoute = matchIntegrationRoute; exports.matchRegisteredIntegrationRoute = matchRegisteredIntegrationRoute; exports.getRegisteredIntegrationAPIManifest = getRegisteredIntegrationAPIManifest; exports.dispatchIntegrationRequest = dispatchIntegrationRequest; exports.dispatchIntegrationRequests = dispatchIntegrationRequests; exports.FARM_INTEGRATION_API_BASE_PATH_KEY = FARM_INTEGRATION_API_BASE_PATH_KEY;
2212
+
2213
+ exports.getFarmPluginIntegrationContext = getFarmPluginIntegrationContext; exports.FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY = FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY; exports.FARM_INTEGRATION_SET_COOKIES_KEY = FARM_INTEGRATION_SET_COOKIES_KEY; exports.forwardIntegrationSetCookies = forwardIntegrationSetCookies; exports.defineIntegrationSchema = defineIntegrationSchema; exports.getFarmIntegrationPluginServerRuntime = getFarmIntegrationPluginServerRuntime; exports.getFarmIntegrationPluginOwner = getFarmIntegrationPluginOwner; exports.createIntegrationRoute = createIntegrationRoute; exports.integrationRoute = integrationRoute; exports.defineIntegration = defineIntegration; exports.isFarmIntegration = isFarmIntegration; exports.resolveIntegrationPlugins = resolveIntegrationPlugins; exports.getIntegrationProviders = getIntegrationProviders; exports.isFarmIntegrationProviderComponentReference = isFarmIntegrationProviderComponentReference; exports.getIntegrationDocumentNavigationMatchers = getIntegrationDocumentNavigationMatchers; exports.getIntegrationSchemas = getIntegrationSchemas; exports.getRegisteredIntegrationRuntime = getRegisteredIntegrationRuntime; exports.getRegisteredIntegrations = getRegisteredIntegrations; exports.getRegisteredIntegrationSchemas = getRegisteredIntegrationSchemas; exports.matchIntegrationRoute = matchIntegrationRoute; exports.matchRegisteredIntegrationRoute = matchRegisteredIntegrationRoute; exports.getRegisteredIntegrationAPIManifest = getRegisteredIntegrationAPIManifest; exports.dispatchIntegrationRequest = dispatchIntegrationRequest; exports.dispatchIntegrationRequests = dispatchIntegrationRequests; exports.integrationMiddlewareMayHandlePath = integrationMiddlewareMayHandlePath; exports.FARM_INTEGRATION_API_BASE_PATH_KEY = FARM_INTEGRATION_API_BASE_PATH_KEY;
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkLPFV45AYcjs = require('./chunk-LPFV45AY.cjs');
3
+ var _chunkLMPAPBUAcjs = require('./chunk-LMPAPBUA.cjs');
4
4
 
5
5
 
6
- var _chunk4GWRFP22cjs = require('./chunk-4GWRFP22.cjs');
6
+ var _chunkUPJLHLJUcjs = require('./chunk-UPJLHLJU.cjs');
7
7
 
8
8
 
9
9
  var _chunkHLJ6MBUZcjs = require('./chunk-HLJ6MBUZ.cjs');
@@ -213,7 +213,7 @@ var _MiddlewareChainImpl = class _MiddlewareChainImpl {
213
213
  */
214
214
  when(condition, fn) {
215
215
  const conditionalMiddleware = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (ctx, next) => {
216
- const shouldRun = typeof condition === "function" ? _chunk4GWRFP22cjs.matchesMiddlewarePredicate.call(void 0, condition, ctx) : condition;
216
+ const shouldRun = typeof condition === "function" ? _chunkUPJLHLJUcjs.matchesMiddlewarePredicate.call(void 0, condition, ctx) : condition;
217
217
  if (!shouldRun) {
218
218
  return next();
219
219
  }
@@ -418,7 +418,7 @@ function farmMiddlewarePlugin(options = {}) {
418
418
  mode: server.config.mode === "production" ? "production" : "development",
419
419
  basePath: _nullishCoalesce(options.basePath, () => ( "/"))
420
420
  });
421
- manager = new (0, _chunkLPFV45AYcjs.MiddlewareManager)(
421
+ manager = new (0, _chunkLMPAPBUAcjs.MiddlewareManager)(
422
422
  getMiddlewareAppDirectory(server.config.root, srcDir),
423
423
  server,
424
424
  options.middleware,
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-FUZEBRP3.mjs";
7
7
  import {
8
8
  getCurrentRequestOrNull
9
- } from "./chunk-3KGDJLJK.mjs";
9
+ } from "./chunk-POSPE3IO.mjs";
10
10
  import {
11
11
  __name
12
12
  } from "./chunk-LPEX4YW6.mjs";
@@ -3,18 +3,19 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkTE2G5IONcjs = require('./chunk-TE2G5ION.cjs');
6
+
7
+ var _chunkPGZDEPTMcjs = require('./chunk-PGZDEPTM.cjs');
7
8
 
8
9
 
9
10
 
10
11
  var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
11
12
 
12
13
 
13
- var _chunk3A4KGQYIcjs = require('./chunk-3A4KGQYI.cjs');
14
+ var _chunkHRETEZ2Zcjs = require('./chunk-HRETEZ2Z.cjs');
14
15
 
15
16
 
16
17
 
17
- var _chunkHITLGIAOcjs = require('./chunk-HITLGIAO.cjs');
18
+ var _chunkCY2ZQ5C6cjs = require('./chunk-CY2ZQ5C6.cjs');
18
19
 
19
20
 
20
21
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
@@ -27,8 +28,17 @@ function hasFarmDocsRuntimeAdapter(docs) {
27
28
  return Boolean(_optionalChain([docs, 'optionalAccess', _ => _.enabled]) && _optionalChain([docs, 'access', _2 => _2.adapter, 'optionalAccess', _3 => _3.server]) && docs.adapter.react);
28
29
  }
29
30
  _chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmDocsRuntimeAdapter, "hasFarmDocsRuntimeAdapter");
31
+ function assertFarmDocsAdapterServesNoGuardedPages(docs, options, isPathGuarded) {
32
+ if (!isPathGuarded || !hasFarmDocsRuntimeAdapter(docs)) return;
33
+ const guarded = _chunkPGZDEPTMcjs.discoverFarmDocsPages.call(void 0, _chunkPGZDEPTMcjs.resolveFarmDocsContentDir.call(void 0, docs, options), docs).filter((page) => isPathGuarded(page.href) || isPathGuarded(_chunkPGZDEPTMcjs.getFarmDocsMarkdownPath.call(void 0, page.href))).map((page) => page.href);
34
+ if (guarded.length === 0) return;
35
+ throw new Error(
36
+ `Docs pages behind a path guard (${guarded.join(", ")}) would be public: the docs adapter ${JSON.stringify(docs.adapter.id)} serves their content in llms-full.txt, search, Markdown, and MCP without running the app's guards. Move those pages out of the docs content directory, or set docs.adapter = false to use Farm's built-in docs runtime, which keeps guarded pages off anonymous surfaces.`
37
+ );
38
+ }
39
+ _chunkS3JO3N4Hcjs.__name.call(void 0, assertFarmDocsAdapterServesNoGuardedPages, "assertFarmDocsAdapterServesNoGuardedPages");
30
40
  async function loadFarmDocsConfigModule(docs, loadModule) {
31
- const configModule = _chunkHITLGIAOcjs.getFarmDocsAdapterConfigModule.call(void 0, docs);
41
+ const configModule = _chunkCY2ZQ5C6cjs.getFarmDocsAdapterConfigModule.call(void 0, docs);
32
42
  if (!configModule) return void 0;
33
43
  const loaded = await loadModule(configModule);
34
44
  const config = _nullishCoalesce(_optionalChain([loaded, 'optionalAccess', _4 => _4.default]), () => ( loaded));
@@ -40,7 +50,7 @@ function createFarmDocsAdapterRuntimeConfig(docs, options, moduleConfig) {
40
50
  ...moduleConfig ? { ...moduleConfig, ...docs.configOverrides } : _nullishCoalesce(docs.runtimeConfig, () => ( docs.config)),
41
51
  entry: docs.config.entry || docs.entry.replace(/^\/+|\/+$/g, "") || "docs",
42
52
  docsPath: docs.entry,
43
- contentDir: _chunkTE2G5IONcjs.resolveFarmDocsContentDir.call(void 0, docs, options)
53
+ contentDir: _chunkPGZDEPTMcjs.resolveFarmDocsContentDir.call(void 0, docs, options)
44
54
  };
45
55
  }
46
56
  _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmDocsAdapterRuntimeConfig, "createFarmDocsAdapterRuntimeConfig");
@@ -99,6 +109,7 @@ async function createFarmDocsAdapterHandler(docs, options) {
99
109
  if (!hasFarmDocsRuntimeAdapter(docs)) {
100
110
  throw new Error("Farm docs adapter requires server and react runtime entrypoints.");
101
111
  }
112
+ assertFarmDocsAdapterServesNoGuardedPages(docs, options, options.isPathGuarded);
102
113
  const serverModule = await options.loadModule(
103
114
  docs.adapter.server
104
115
  );
@@ -277,25 +288,25 @@ function getDocsDescription(docs) {
277
288
  }
278
289
  _chunkS3JO3N4Hcjs.__name.call(void 0, getDocsDescription, "getDocsDescription");
279
290
  function getLoadedDocsPages(context) {
280
- return _chunkTE2G5IONcjs.discoverFarmDocsPages.call(void 0, context.contentDir, context.docs).map((page) => _chunkTE2G5IONcjs.loadFarmDocsPage.call(void 0, context.contentDir, context.docs, page.slug)).filter((page) => Boolean(page));
291
+ return _chunkPGZDEPTMcjs.discoverFarmDocsPages.call(void 0, context.contentDir, context.docs).filter((page) => !context.isPathGuarded(page.href)).map((page) => _chunkPGZDEPTMcjs.loadFarmDocsPage.call(void 0, context.contentDir, context.docs, page.slug)).filter((page) => Boolean(page));
281
292
  }
282
293
  _chunkS3JO3N4Hcjs.__name.call(void 0, getLoadedDocsPages, "getLoadedDocsPages");
283
294
  function toDocsSourcePage(page) {
284
295
  return {
285
- ..._chunkTE2G5IONcjs.toFarmDocsMarkdownPage.call(void 0, page),
296
+ ..._chunkPGZDEPTMcjs.toFarmDocsMarkdownPage.call(void 0, page),
286
297
  sourcePath: page.sourcePath
287
298
  };
288
299
  }
289
300
  _chunkS3JO3N4Hcjs.__name.call(void 0, toDocsSourcePage, "toDocsSourcePage");
290
301
  function toDocsSitemapPage(page) {
291
302
  return {
292
- ..._chunkTE2G5IONcjs.toFarmDocsMarkdownPage.call(void 0, page),
303
+ ..._chunkPGZDEPTMcjs.toFarmDocsMarkdownPage.call(void 0, page),
293
304
  sourcePath: page.sourcePath
294
305
  };
295
306
  }
296
307
  _chunkS3JO3N4Hcjs.__name.call(void 0, toDocsSitemapPage, "toDocsSitemapPage");
297
308
  function toDocsLlmsPage(page) {
298
- return _chunkTE2G5IONcjs.toFarmDocsMarkdownPage.call(void 0, page);
309
+ return _chunkPGZDEPTMcjs.toFarmDocsMarkdownPage.call(void 0, page);
299
310
  }
300
311
  _chunkS3JO3N4Hcjs.__name.call(void 0, toDocsLlmsPage, "toDocsLlmsPage");
301
312
  function getDocsLlmsOptions(context, request) {
@@ -389,7 +400,9 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, renderAgentsDocument, "renderAgentsDocumen
389
400
  function buildAgentSpec(context, request) {
390
401
  const url = new URL(request.url);
391
402
  const origin = url.origin;
392
- const pages = _chunkTE2G5IONcjs.discoverFarmDocsPages.call(void 0, context.contentDir, context.docs);
403
+ const pages = _chunkPGZDEPTMcjs.discoverFarmDocsPages.call(void 0, context.contentDir, context.docs).filter(
404
+ (page) => !context.isPathGuarded(page.href)
405
+ );
393
406
  const spec = _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).buildDocsAgentDiscoverySpec(getDocsDiscoveryOptions(context, request));
394
407
  const title = getDocsTitle(context.docs);
395
408
  return {
@@ -449,7 +462,7 @@ function redactDocsConfigValue(value, key, inHeaders) {
449
462
  );
450
463
  }
451
464
  if (value === null || value === void 0 || typeof value === "function") return value;
452
- return inHeaders || _chunkHITLGIAOcjs.isSecretDocsConfigKey.call(void 0, key) ? REDACTED_DOCS_CONFIG_VALUE : value;
465
+ return inHeaders || _chunkCY2ZQ5C6cjs.isSecretDocsConfigKey.call(void 0, key) ? REDACTED_DOCS_CONFIG_VALUE : value;
453
466
  }
454
467
  _chunkS3JO3N4Hcjs.__name.call(void 0, redactDocsConfigValue, "redactDocsConfigValue");
455
468
  function toPublicDocsPath(value, root) {
@@ -479,7 +492,7 @@ function buildPublicConfig(context) {
479
492
  }
480
493
  _chunkS3JO3N4Hcjs.__name.call(void 0, buildPublicConfig, "buildPublicConfig");
481
494
  function buildDiagnostics(context) {
482
- const pages = _chunkTE2G5IONcjs.discoverFarmDocsPages.call(void 0, context.contentDir, context.docs);
495
+ const pages = _chunkPGZDEPTMcjs.discoverFarmDocsPages.call(void 0, context.contentDir, context.docs);
483
496
  const diagnostics = _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).buildDocsDiagnostics(context.docs.config, {
484
497
  entry: context.docs.entry,
485
498
  mcp: {
@@ -551,13 +564,15 @@ async function resolveAPIContext(options) {
551
564
  config: options.config,
552
565
  configPath: options.configPath
553
566
  }));
554
- const docs = isResolvedDocsConfig(docsInput) ? docsInput : await _chunk3A4KGQYIcjs.resolveDocsConfig.call(void 0, docsInput, { root, srcDir });
567
+ const docs = isResolvedDocsConfig(docsInput) ? docsInput : await _chunkHRETEZ2Zcjs.resolveDocsConfig.call(void 0, docsInput, { root, srcDir });
568
+ const guardedPaths = new Set(_nullishCoalesce(_optionalChain([runtimeConfig, 'optionalAccess', _20 => _20.guardedPaths]), () => ( [])));
555
569
  return {
556
570
  root,
557
571
  srcDir,
558
572
  docs,
559
- contentDir: _chunkTE2G5IONcjs.resolveFarmDocsContentDir.call(void 0, docs, { root, srcDir }),
560
- diagnostics: options.diagnostics === true
573
+ contentDir: _chunkPGZDEPTMcjs.resolveFarmDocsContentDir.call(void 0, docs, { root, srcDir }),
574
+ diagnostics: options.diagnostics === true,
575
+ isPathGuarded: _nullishCoalesce(options.isPathGuarded, () => ( ((pathname) => guardedPaths.has(pathname))))
561
576
  };
562
577
  }
563
578
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveAPIContext, "resolveAPIContext");
@@ -615,10 +630,12 @@ async function handleDocsAPIGet(request, context) {
615
630
  if (format === "markdown" || url.pathname.endsWith(".md")) {
616
631
  const pathParam = url.searchParams.get("path") || url.searchParams.get("slug");
617
632
  const slug = normalizeDocsApiSlug(_nullishCoalesce(_nullishCoalesce(pathParam, () => ( pathTarget.slug)), () => ( "")), context.docs);
618
- const page = _chunkTE2G5IONcjs.loadFarmDocsPage.call(void 0, context.contentDir, context.docs, slug);
619
- if (!page) return text("Docs page not found\n", "text/plain; charset=utf-8", { status: 404 });
633
+ const page = _chunkPGZDEPTMcjs.loadFarmDocsPage.call(void 0, context.contentDir, context.docs, slug);
634
+ if (!page || context.isPathGuarded(page.href)) {
635
+ return text("Docs page not found\n", "text/plain; charset=utf-8", { status: 404 });
636
+ }
620
637
  return text(
621
- _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsMarkdownDocument(_chunkTE2G5IONcjs.toFarmDocsMarkdownPage.call(void 0, page), {
638
+ _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsMarkdownDocument(_chunkPGZDEPTMcjs.toFarmDocsMarkdownPage.call(void 0, page), {
622
639
  origin: new URL(request.url).origin,
623
640
  llms: getDocsLlmsOptions(context, request),
624
641
  sitemap: context.docs.config.sitemap
@@ -693,4 +710,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmDocsAPIHandler, "createFarmDocsA
693
710
 
694
711
 
695
712
 
696
- exports.hasFarmDocsRuntimeAdapter = hasFarmDocsRuntimeAdapter; exports.compileFarmDocsAdapterEdgeManifest = compileFarmDocsAdapterEdgeManifest; exports.createFarmDocsAdapterHandler = createFarmDocsAdapterHandler; exports.isFarmDocsAPIRequest = isFarmDocsAPIRequest; exports.createDocsAPI = createDocsAPI; exports.createFarmDocsAPIHandler = createFarmDocsAPIHandler;
713
+
714
+ exports.hasFarmDocsRuntimeAdapter = hasFarmDocsRuntimeAdapter; exports.assertFarmDocsAdapterServesNoGuardedPages = assertFarmDocsAdapterServesNoGuardedPages; exports.compileFarmDocsAdapterEdgeManifest = compileFarmDocsAdapterEdgeManifest; exports.createFarmDocsAdapterHandler = createFarmDocsAdapterHandler; exports.isFarmDocsAPIRequest = isFarmDocsAPIRequest; exports.createDocsAPI = createDocsAPI; exports.createFarmDocsAPIHandler = createFarmDocsAPIHandler;
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-CBBLJMR5.mjs";
13
13
  import {
14
14
  resolveFarmRequestURL
15
- } from "./chunk-3KGDJLJK.mjs";
15
+ } from "./chunk-POSPE3IO.mjs";
16
16
  import {
17
17
  __name
18
18
  } from "./chunk-LPEX4YW6.mjs";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-JM5XPKWH.mjs";
10
10
  import {
11
11
  getCurrentRequestOrNull
12
- } from "./chunk-3KGDJLJK.mjs";
12
+ } from "./chunk-POSPE3IO.mjs";
13
13
  import {
14
14
  __name
15
15
  } from "./chunk-LPEX4YW6.mjs";
@@ -20,15 +20,16 @@ async function hydrateFarmDocsAdapterRuntime() {
20
20
  async function hydrateFarmDocsAdapterRuntime() {
21
21
  const runtime = window.__FARM_DOCS_ADAPTER__;
22
22
  if (!runtime) return false;
23
- const FarmDocsAdapterReact = await import(${JSON.stringify(reactModule)});
23
+ // The docs server flags pages whose config holds what its JSON copy cannot (icons,
24
+ // MDX components, callbacks); the adapter restores those from the module itself.
25
+ // Fetch it alongside the adapter rather than after it: they don't depend on each other.
26
+ const [FarmDocsAdapterReact, configModule] = await Promise.all([
27
+ import(${JSON.stringify(reactModule)}),
28
+ runtime.configModule ? ${configModule ? `import(${JSON.stringify(configModule)})` : "undefined"} : undefined,
29
+ ]);
24
30
  if (typeof FarmDocsAdapterReact.hydrateFarmDocs !== "function") {
25
31
  throw new Error("The configured Farm docs adapter does not export hydrateFarmDocs().");
26
32
  }
27
- // The docs server flags pages whose config holds what its JSON copy cannot (icons,
28
- // MDX components, callbacks); the adapter restores those from the module itself.
29
- const configModule = runtime.configModule
30
- ? ${configModule ? `await import(${JSON.stringify(configModule)})` : "undefined"}
31
- : undefined;
32
33
  FarmDocsAdapterReact.hydrateFarmDocs({
33
34
  config: runtime.config || {},
34
35
  data: runtime.data,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  useRouter
3
- } from "./chunk-JPNFPAZ4.mjs";
3
+ } from "./chunk-VWBHM3F6.mjs";
4
4
  import {
5
5
  getRouter
6
- } from "./chunk-ND2CWPOD.mjs";
6
+ } from "./chunk-TS4JHGUJ.mjs";
7
7
  import {
8
8
  applyFarmBasePath
9
9
  } from "./chunk-4RB44K6Z.mjs";
@@ -3,18 +3,21 @@
3
3
  var _chunkAI7QMY7Ocjs = require('./chunk-AI7QMY7O.cjs');
4
4
 
5
5
 
6
- var _chunkNICDYKBScjs = require('./chunk-NICDYKBS.cjs');
6
+ var _chunk6XWDE2P2cjs = require('./chunk-6XWDE2P2.cjs');
7
+
8
+
9
+ var _chunkULASELLAcjs = require('./chunk-ULASELLA.cjs');
7
10
 
8
11
 
9
12
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
10
13
 
11
14
  // src/headers.ts
12
15
  function headers() {
13
- return new Headers(_chunkNICDYKBScjs.getCurrentRequest.call(void 0, ).headers);
16
+ return new Headers(_chunk6XWDE2P2cjs.getCurrentRequest.call(void 0, ).headers);
14
17
  }
15
18
  _chunkS3JO3N4Hcjs.__name.call(void 0, headers, "headers");
16
19
  function cookies() {
17
- const cookieHeader = _chunkNICDYKBScjs.getCurrentRequest.call(void 0, ).headers.get("cookie") || "";
20
+ const cookieHeader = _chunk6XWDE2P2cjs.getCurrentRequest.call(void 0, ).headers.get("cookie") || "";
18
21
  const parsed = _chunkAI7QMY7Ocjs.parseRequestCookieHeader.call(void 0, cookieHeader);
19
22
  return {
20
23
  get(name) {
@@ -35,8 +38,13 @@ function cookies() {
35
38
  };
36
39
  }
37
40
  _chunkS3JO3N4Hcjs.__name.call(void 0, cookies, "cookies");
41
+ function getCspNonce() {
42
+ return _chunkULASELLAcjs._resolveCurrentCspNonce.call(void 0, );
43
+ }
44
+ _chunkS3JO3N4Hcjs.__name.call(void 0, getCspNonce, "getCspNonce");
45
+
38
46
 
39
47
 
40
48
 
41
49
 
42
- exports.headers = headers; exports.cookies = cookies;
50
+ exports.headers = headers; exports.cookies = cookies; exports.getCspNonce = getCspNonce;