@farm.js/core 0.1.35 → 0.1.37
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.
- package/dist/{metadata-BnLDsUOS.d.ts → agent-mcp-BC0bAGVF.d.mts} +45 -2
- package/dist/agent-mcp-handler-LPJ2CADR.mjs +19 -0
- package/dist/agent-mcp-handler-SJAHFSPI.cjs +19 -0
- package/dist/{metadata-WGpBYcGn.d.mts → agent-mcp-jyDHbQKe.d.ts} +45 -2
- package/dist/agent-runtime.cjs +6 -4
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/agent-runtime.mjs +5 -3
- package/dist/api/client.cjs +3 -3
- package/dist/api/client.mjs +2 -2
- package/dist/api/route-manager.cjs +9 -9
- package/dist/api/route-manager.d.mts +10 -4
- package/dist/api/route-manager.d.ts +10 -4
- package/dist/api/route-manager.mjs +8 -8
- package/dist/api/runtime.cjs +6 -6
- package/dist/api/runtime.d.mts +4 -62
- package/dist/api/runtime.d.ts +4 -62
- package/dist/api/runtime.mjs +5 -5
- package/dist/api.cjs +13 -12
- package/dist/api.d.mts +3 -3
- package/dist/api.d.ts +3 -3
- package/dist/api.mjs +12 -11
- package/dist/{app-BXB3JZYc.d.ts → app-CKO3iN1c.d.ts} +17 -3
- package/dist/{app-D_j9AAVL.d.mts → app-Cbkj9ufe.d.mts} +17 -3
- package/dist/app-markdown.cjs +6 -4
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +5 -3
- package/dist/{chunk-F7JZENPF.cjs → chunk-3A4KGQYI.cjs} +38 -30
- package/dist/{chunk-4MMGO7YW.cjs → chunk-3IP27TCG.cjs} +43 -32
- package/dist/{chunk-FDR64H6B.mjs → chunk-3KGDJLJK.mjs} +41 -2
- package/dist/{chunk-UJD4PHYB.mjs → chunk-4E5WBPEG.mjs} +72 -354
- package/dist/{chunk-KXWRO25S.cjs → chunk-4GPOC4LN.cjs} +3 -3
- package/dist/{chunk-Z2HLU4IX.cjs → chunk-4GWRFP22.cjs} +23 -2
- package/dist/{chunk-4KU5Q7C2.mjs → chunk-4P6ULFMD.mjs} +253 -67
- package/dist/chunk-4WQ6PGSJ.cjs +367 -0
- package/dist/{chunk-SMHH4VDG.mjs → chunk-4WVJLURN.mjs} +1 -1
- package/dist/{chunk-2F2ER724.cjs → chunk-5BXGGEC7.cjs} +27 -22
- package/dist/{chunk-3BHT4WMP.cjs → chunk-5D2JIPLH.cjs} +8 -8
- package/dist/{chunk-AHGECQEW.mjs → chunk-666CKENS.mjs} +1 -1
- package/dist/{chunk-GFHLGIYC.cjs → chunk-6LGFV2CQ.cjs} +8 -8
- package/dist/chunk-6SJ2KJTA.mjs +314 -0
- package/dist/{chunk-PFQKNERH.cjs → chunk-6TJITR2B.cjs} +457 -218
- package/dist/{chunk-73MC7ZL6.cjs → chunk-75X755YZ.cjs} +2 -2
- package/dist/{chunk-3UH7MRCP.cjs → chunk-7DWNJI73.cjs} +13 -13
- package/dist/{chunk-7L5V3KQO.cjs → chunk-7O5M4UKW.cjs} +2 -2
- package/dist/{chunk-BJPBQNIE.cjs → chunk-7SQ5SGYZ.cjs} +2 -2
- package/dist/{chunk-27ZWSI3W.cjs → chunk-ADOAUDQ6.cjs} +2 -2
- package/dist/{chunk-CP6X4AEU.mjs → chunk-AJQTP4OO.mjs} +1 -1
- package/dist/{chunk-YKX5BK66.cjs → chunk-ATWHHSY2.cjs} +7 -7
- package/dist/{chunk-EFCQPQMG.cjs → chunk-B5PFZLKV.cjs} +89 -8
- package/dist/{chunk-FNO7A7CM.cjs → chunk-BHY547NB.cjs} +34 -16
- package/dist/{chunk-JHWOVJ3M.mjs → chunk-BUGNQIHC.mjs} +5 -0
- package/dist/{chunk-7GLPRTTF.cjs → chunk-CGBDNNSM.cjs} +2 -2
- package/dist/chunk-CI6E3UOH.cjs +314 -0
- package/dist/{chunk-2G2NNLE2.mjs → chunk-CQMVIOYP.mjs} +5 -5
- package/dist/{chunk-X6W5FFH6.cjs → chunk-CVH2BXPY.cjs} +8 -8
- package/dist/{chunk-TKSCR644.cjs → chunk-D3C5LBQY.cjs} +2 -2
- package/dist/{chunk-PZNL3WEG.mjs → chunk-DMEPTZTI.mjs} +22 -11
- package/dist/chunk-DTSROJ5J.mjs +367 -0
- package/dist/{chunk-DBNKI4NF.cjs → chunk-ECKF2BAM.cjs} +6 -2
- package/dist/{chunk-GQ3Z3IZI.cjs → chunk-EMMQ64QW.cjs} +18 -18
- package/dist/{chunk-6DU6UFUE.mjs → chunk-EXG5LD6B.mjs} +16 -8
- package/dist/{chunk-HUMR6LSU.mjs → chunk-F5QO4FNE.mjs} +1 -1
- package/dist/{chunk-YULD7ICZ.mjs → chunk-FBOJ55OM.mjs} +1 -1
- package/dist/{chunk-IHNMMXHV.mjs → chunk-FGRYBX5X.mjs} +15 -10
- package/dist/{chunk-D227TIEN.cjs → chunk-FWE7LEQC.cjs} +13 -13
- package/dist/{chunk-3BU22U3M.cjs → chunk-G2TEB74S.cjs} +5 -2
- package/dist/{chunk-G5RT7EXW.mjs → chunk-HEVMCTSR.mjs} +21 -6
- package/dist/{chunk-W7LF2J2S.mjs → chunk-HMRSWN47.mjs} +1 -1
- package/dist/{chunk-JG6DJF5A.mjs → chunk-HZFM2LWQ.mjs} +22 -1
- package/dist/{chunk-UAORZ7QA.mjs → chunk-IAIYV4RZ.mjs} +2 -2
- package/dist/{chunk-F2SE2VDO.mjs → chunk-IHQIOZLC.mjs} +1 -1
- package/dist/{chunk-2NNMOPDN.mjs → chunk-J3ANCZKA.mjs} +4 -1
- package/dist/{chunk-C4SPBWFM.cjs → chunk-JEZO6VUR.cjs} +10 -1
- package/dist/{chunk-SC2WYWPF.mjs → chunk-JPNFPAZ4.mjs} +3 -3
- package/dist/{chunk-F6Z3Y5KL.mjs → chunk-K3SAEIM3.mjs} +5 -2
- package/dist/{chunk-QAU5JD57.mjs → chunk-K4I4O5TS.mjs} +289 -50
- package/dist/{chunk-KN7K4VQN.mjs → chunk-KDTBF3UU.mjs} +1 -1
- package/dist/{chunk-OMVAU7NT.cjs → chunk-KIIMAWOJ.cjs} +11 -1
- package/dist/{chunk-43FMW62B.mjs → chunk-KMTGADN3.mjs} +28 -0
- package/dist/{chunk-QORUJDIV.mjs → chunk-KPFKMDM7.mjs} +2 -2
- package/dist/{chunk-YSCV4SJF.cjs → chunk-L5H2GSUC.cjs} +4 -4
- package/dist/{chunk-YDQZGSDS.mjs → chunk-LBDP3YT3.mjs} +1 -1
- package/dist/{chunk-6ETPZTJI.mjs → chunk-LBGILORX.mjs} +116 -55
- package/dist/{chunk-IPXLADVO.cjs → chunk-LOFKRKO7.cjs} +122 -61
- package/dist/{chunk-ULAWS2PA.cjs → chunk-LPFV45AY.cjs} +29 -26
- package/dist/{chunk-3KZS4SUS.mjs → chunk-MCIZVNOQ.mjs} +1 -1
- package/dist/{chunk-RU3M2FIK.cjs → chunk-MRMI32SN.cjs} +87 -369
- package/dist/{chunk-XCMCS4DA.mjs → chunk-ND2CWPOD.mjs} +2 -2
- package/dist/{chunk-XCACDAZZ.cjs → chunk-NDILNQ4L.cjs} +25 -10
- package/dist/{chunk-6TJOML4E.mjs → chunk-NFMDCAOS.mjs} +14 -11
- package/dist/{chunk-UXFQ3UDA.cjs → chunk-NICDYKBS.cjs} +42 -3
- package/dist/{chunk-EZDQRNQ7.mjs → chunk-NNSAQX3U.mjs} +23 -5
- package/dist/{chunk-YC6V7PWE.cjs → chunk-NQ6QFZWD.cjs} +1 -1
- package/dist/{chunk-PDOCJ6RY.mjs → chunk-O6WAEAX3.mjs} +1 -1
- package/dist/{chunk-U4KT7QP3.cjs → chunk-OW67PDDS.cjs} +14 -1
- package/dist/{chunk-77GNHH2Z.cjs → chunk-PMQHMWZU.cjs} +3 -3
- package/dist/chunk-PTZ2TVNE.cjs +178 -0
- package/dist/{chunk-6WCPV6G2.mjs → chunk-Q2KB32T4.mjs} +1 -1
- package/dist/{chunk-ICUQICNC.cjs → chunk-Q5FYSK45.cjs} +718 -532
- package/dist/{chunk-5SJWVY6R.mjs → chunk-QHSH7IH4.mjs} +9 -0
- package/dist/{chunk-Q3VLETLE.mjs → chunk-RRMVL6CJ.mjs} +4 -4
- package/dist/{chunk-IZY3V5XW.mjs → chunk-S3VWVTVA.mjs} +14 -1
- package/dist/{chunk-FFFW3OQ7.cjs → chunk-S6FJO323.cjs} +2 -2
- package/dist/{chunk-VFQT3LAO.cjs → chunk-SDOTRX3V.cjs} +5 -5
- package/dist/chunk-SGBZPZUW.mjs +75 -0
- package/dist/{chunk-BMWDEBXO.cjs → chunk-SHLXACIO.cjs} +31 -3
- package/dist/{chunk-ZXGAFZDO.cjs → chunk-T5OJPTVN.cjs} +2 -2
- package/dist/{chunk-2ELDTQRN.mjs → chunk-TDNWPAVR.mjs} +1 -1
- package/dist/{chunk-VZJR7UTG.cjs → chunk-TE2G5ION.cjs} +2 -2
- package/dist/{chunk-IHNIDL6H.cjs → chunk-TO4GJ56K.cjs} +22 -11
- package/dist/{chunk-4JHOT46A.mjs → chunk-TPLJVC7E.mjs} +86 -5
- package/dist/{chunk-NRSN7G7E.mjs → chunk-TW4GYDBJ.mjs} +1 -1
- package/dist/{chunk-XBML5KMG.cjs → chunk-U6MPZ35Q.cjs} +24 -14
- package/dist/chunk-UH6QN5NL.mjs +178 -0
- package/dist/{chunk-FTFYRMQQ.cjs → chunk-UJZLSXUB.cjs} +53 -28
- package/dist/chunk-UXHS27O6.cjs +75 -0
- package/dist/{chunk-DQQOKWYA.cjs → chunk-VR4GD5I3.cjs} +3 -3
- package/dist/{chunk-22LTEMGQ.mjs → chunk-VXAWRDK7.mjs} +14 -4
- package/dist/{chunk-62XKI4Z3.cjs → chunk-W2YDNK66.cjs} +6 -3
- package/dist/{chunk-VPTDD5XF.cjs → chunk-WBKEZXWE.cjs} +5 -0
- package/dist/{chunk-EJQT6KZN.cjs → chunk-WC5UV2HQ.cjs} +2 -2
- package/dist/{chunk-SAZVVAJH.mjs → chunk-WQ7T2263.mjs} +18 -7
- package/dist/chunk-WRPHYQVY.mjs +109 -0
- package/dist/chunk-WT4TGLXT.cjs +109 -0
- package/dist/{chunk-SOMHP6GF.mjs → chunk-XOPOIFTJ.mjs} +2 -2
- package/dist/{chunk-3PXS2MHU.mjs → chunk-YCKO6FRS.mjs} +1 -1
- package/dist/{chunk-C35ZBVRD.mjs → chunk-YWMZUGIS.mjs} +6 -2
- package/dist/{chunk-HMIJDL7S.mjs → chunk-Z5BEWYVO.mjs} +31 -6
- package/dist/{chunk-OKZUAXHF.mjs → chunk-Z7LA7MHQ.mjs} +1 -1
- package/dist/{chunk-Y7RKTKYI.mjs → chunk-ZMMBIVQM.mjs} +10 -0
- package/dist/{client-plugins-HIyulDym.d.ts → client-plugins-C8DjftDF.d.ts} +112 -5
- package/dist/{client-plugins-CvIslxWi.d.mts → client-plugins-CV4eJ9De.d.mts} +112 -5
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.cjs +8 -8
- package/dist/client.d.mts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/client.mjs +7 -7
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{devtools-EAUY43BS.cjs → devtools-JXFQNWSH.cjs} +11 -10
- package/dist/{devtools-EE5RIBTH.mjs → devtools-KVOY2TCZ.mjs} +10 -9
- package/dist/docs.cjs +13 -12
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +12 -11
- package/dist/headers.cjs +4 -4
- package/dist/headers.mjs +3 -3
- package/dist/i18n/client.cjs +11 -11
- package/dist/i18n/client.mjs +3 -3
- package/dist/image/server.cjs +3 -3
- package/dist/image/server.mjs +2 -2
- package/dist/image/sharp.cjs +10 -10
- package/dist/image/sharp.mjs +2 -2
- package/dist/index.cjs +61 -54
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.mjs +60 -53
- package/dist/integrations.cjs +8 -4
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.mjs +7 -3
- package/dist/internal/app-markdown-runtime.cjs +5 -3
- package/dist/internal/app-markdown-runtime.d.mts +19 -5
- package/dist/internal/app-markdown-runtime.d.ts +19 -5
- package/dist/internal/app-markdown-runtime.mjs +4 -2
- package/dist/internal/build-runtime.cjs +38 -34
- package/dist/internal/build-runtime.d.mts +3 -3
- package/dist/internal/build-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.mjs +37 -33
- package/dist/internal/cli-runtime.cjs +17 -16
- package/dist/internal/cli-runtime.mjs +16 -15
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +2 -2
- package/dist/internal/client-runtime.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +11 -10
- package/dist/internal/config-runtime.d.mts +2 -2
- package/dist/internal/config-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.mjs +10 -9
- package/dist/internal/infra-analytics-runtime.cjs +5 -5
- package/dist/internal/infra-analytics-runtime.mjs +3 -3
- package/dist/internal/isolated-boundary.cjs +2 -2
- package/dist/internal/isolated-boundary.d.mts +0 -1
- package/dist/internal/isolated-boundary.d.ts +0 -1
- package/dist/internal/isolated-boundary.mjs +1 -1
- package/dist/internal/metadata-image-runtime.cjs +3 -3
- package/dist/internal/metadata-image-runtime.mjs +2 -2
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +27 -48
- package/dist/internal/production-runtime.d.mts +67 -27
- package/dist/internal/production-runtime.d.ts +67 -27
- package/dist/internal/production-runtime.mjs +34 -55
- package/dist/{layers-BRQF5ETU.mjs → layers-UTB43B7A.mjs} +1 -1
- package/dist/layers-VUWIOFEO.cjs +18 -0
- package/dist/markdown.cjs +1 -1
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/middleware.cjs +10 -10
- package/dist/middleware.d.mts +6 -4
- package/dist/middleware.d.ts +6 -4
- package/dist/middleware.mjs +9 -9
- package/dist/navigation.cjs +7 -7
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +6 -6
- package/dist/{nitro-OVPLKPE2.cjs → nitro-7F65EZZS.cjs} +3 -3
- package/dist/{nitro-MXRDCXWZ.mjs → nitro-MPZJGPXK.mjs} +2 -2
- package/dist/plugin.cjs +31 -28
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.mjs +30 -27
- package/dist/{production-runtime-Crq6CJ-2.d.ts → production-runtime-C2kkrPVZ.d.ts} +1 -1
- package/dist/{production-runtime-0sRnuYc-.d.mts → production-runtime-Du_FHb2-.d.mts} +1 -1
- package/dist/query/client.cjs +9 -9
- package/dist/query/client.mjs +4 -4
- package/dist/{render-plan-8ozZh2Qv.d.ts → render-plan-BnnPTpus.d.ts} +1 -1
- package/dist/{render-plan-gs9GGPzw.d.mts → render-plan-Cgx7v8tJ.d.mts} +1 -1
- package/dist/renderer/react/server.cjs +3 -3
- package/dist/renderer/react/server.mjs +1 -1
- package/dist/renderer-client.cjs +12 -12
- package/dist/renderer-client.d.mts +3 -3
- package/dist/renderer-client.d.ts +3 -3
- package/dist/renderer-client.mjs +4 -4
- package/dist/{request-B5G8rLBH.d.ts → request-BNWr7r5e.d.ts} +1 -1
- package/dist/{request-fkhiynXe.d.mts → request-sKayKcop.d.mts} +1 -1
- package/dist/request.cjs +3 -3
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/request.mjs +2 -2
- package/dist/{route-rendering-lS5nUMua.d.ts → route-rendering-Bx4Auw6Q.d.ts} +1 -1
- package/dist/{route-rendering-CLnS7AZj.d.mts → route-rendering-DWFp3Yq4.d.mts} +1 -1
- package/dist/{router-ifU8Dui1.d.mts → router-BK6K42Ij.d.mts} +1 -1
- package/dist/{router-4iuiYnOW.d.ts → router-DnW_2tQi.d.ts} +1 -1
- package/dist/routes.cjs +2 -2
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/routes.mjs +1 -1
- package/dist/runtime-CA3Ei5k_.d.ts +69 -0
- package/dist/runtime-DJDaCMd_.d.mts +69 -0
- package/dist/server-action-security.cjs +3 -3
- package/dist/server-action-security.mjs +2 -2
- package/dist/server-fn.cjs +5 -5
- package/dist/server-fn.mjs +4 -4
- package/dist/server-plugins.cjs +5 -5
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server-plugins.mjs +4 -4
- package/dist/server-query.cjs +6 -6
- package/dist/server-query.mjs +5 -5
- package/dist/server.cjs +57 -54
- package/dist/server.d.mts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.mjs +35 -32
- package/dist/{spa-router-Bq7VCOwx.d.mts → spa-router-D6fUA4Rn.d.mts} +2 -2
- package/dist/{spa-router-DaJk5Re4.d.ts → spa-router-Mwbd7g2L.d.ts} +2 -2
- package/dist/testing.cjs +13 -13
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.mjs +10 -10
- package/dist/theme/server.cjs +4 -4
- package/dist/theme/server.mjs +3 -3
- package/dist/{utils-BXLmFsVR.d.ts → utils-BwVcAfUR.d.ts} +1 -1
- package/dist/{utils-XJn0c9bj.d.mts → utils-p9Hs-jCc.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +31 -28
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.mjs +30 -27
- package/dist/workflows.cjs +3 -3
- package/dist/workflows.mjs +2 -2
- package/package.json +1 -1
- package/types/middleware.d.ts +5 -1
- package/dist/chunk-FXEF4PPL.mjs +0 -47
- package/dist/chunk-XD32KALF.cjs +0 -47
- package/dist/layers-4PNE2HOY.cjs +0 -18
- /package/dist/{chunk-SJNMVDDF.cjs → chunk-FUCSUGDM.cjs} +0 -0
- /package/dist/{chunk-UDNPLXW7.mjs → chunk-MYIZXDZA.mjs} +0 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import {
|
|
2
|
+
collectFarmLlmsTxtPages
|
|
3
|
+
} from "./chunk-DTSROJ5J.mjs";
|
|
4
|
+
import {
|
|
5
|
+
getFarmMarkdownMirrorPath,
|
|
6
|
+
isFarmMarkdownMirrorExposed
|
|
7
|
+
} from "./chunk-WWIKMBRN.mjs";
|
|
8
|
+
import {
|
|
9
|
+
_listFarmMCPCatalogs,
|
|
10
|
+
_listFarmRegisteredMCPServers
|
|
11
|
+
} from "./chunk-ZLAT2CWY.mjs";
|
|
12
|
+
import {
|
|
13
|
+
applyFarmBasePath,
|
|
14
|
+
stripFarmBasePath
|
|
15
|
+
} from "./chunk-4RB44K6Z.mjs";
|
|
16
|
+
import {
|
|
17
|
+
__name
|
|
18
|
+
} from "./chunk-LPEX4YW6.mjs";
|
|
19
|
+
|
|
20
|
+
// src/agent-mcp.ts
|
|
21
|
+
var FARM_DEFAULT_MCP_PATH = "/mcp";
|
|
22
|
+
var FARM_DEFAULT_MCP_PROTOCOL_VERSIONS = [
|
|
23
|
+
"2025-11-25",
|
|
24
|
+
"2025-06-18",
|
|
25
|
+
"2025-03-26",
|
|
26
|
+
"2024-11-05"
|
|
27
|
+
];
|
|
28
|
+
var FARM_DEFAULT_MCP_DESCRIPTION = "Read-only access to this site's public pages: list, search, and read them as Markdown.";
|
|
29
|
+
var READ_ONLY = {
|
|
30
|
+
readOnlyHint: true,
|
|
31
|
+
destructiveHint: false,
|
|
32
|
+
idempotentHint: true,
|
|
33
|
+
openWorldHint: false
|
|
34
|
+
};
|
|
35
|
+
var PAGE_SCHEMA = {
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: {
|
|
38
|
+
path: { type: "string", description: `The page's path, such as "/about".` },
|
|
39
|
+
title: { type: "string" },
|
|
40
|
+
url: { type: "string", description: "The page's absolute URL." },
|
|
41
|
+
description: { type: "string" }
|
|
42
|
+
},
|
|
43
|
+
required: ["path", "title", "url"]
|
|
44
|
+
};
|
|
45
|
+
var PAGES_OUTPUT_SCHEMA = {
|
|
46
|
+
type: "object",
|
|
47
|
+
properties: { pages: { type: "array", items: PAGE_SCHEMA } },
|
|
48
|
+
required: ["pages"]
|
|
49
|
+
};
|
|
50
|
+
var FARM_DEFAULT_MCP_TOOLS = [
|
|
51
|
+
{
|
|
52
|
+
name: "list_pages",
|
|
53
|
+
title: "List pages",
|
|
54
|
+
description: "List this site's public pages with each page's path, title, URL, and description. Pass a page's path to read_page to read it as Markdown.",
|
|
55
|
+
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
56
|
+
outputSchema: PAGES_OUTPUT_SCHEMA,
|
|
57
|
+
annotations: READ_ONLY
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "search_pages",
|
|
61
|
+
title: "Search pages",
|
|
62
|
+
description: "Search this site's public pages by title, description, and path. Every word of the query must match. Returns the matching pages, best match first.",
|
|
63
|
+
inputSchema: {
|
|
64
|
+
type: "object",
|
|
65
|
+
properties: {
|
|
66
|
+
query: {
|
|
67
|
+
type: "string",
|
|
68
|
+
minLength: 1,
|
|
69
|
+
maxLength: 200,
|
|
70
|
+
description: 'Words to look for, such as "pricing" or "getting started".'
|
|
71
|
+
},
|
|
72
|
+
limit: {
|
|
73
|
+
type: "integer",
|
|
74
|
+
minimum: 1,
|
|
75
|
+
maximum: 50,
|
|
76
|
+
default: 10,
|
|
77
|
+
description: "The most pages to return."
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
required: ["query"],
|
|
81
|
+
additionalProperties: false
|
|
82
|
+
},
|
|
83
|
+
outputSchema: PAGES_OUTPUT_SCHEMA,
|
|
84
|
+
annotations: READ_ONLY
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "read_page",
|
|
88
|
+
title: "Read a page",
|
|
89
|
+
description: `Read one of this site's public pages as Markdown. Takes a path from list_pages or search_pages, such as "/" or "/about".`,
|
|
90
|
+
inputSchema: {
|
|
91
|
+
type: "object",
|
|
92
|
+
properties: {
|
|
93
|
+
path: {
|
|
94
|
+
type: "string",
|
|
95
|
+
minLength: 1,
|
|
96
|
+
maxLength: 2048,
|
|
97
|
+
description: `The page's path, such as "/about", or its full URL on this site.`
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
required: ["path"],
|
|
101
|
+
additionalProperties: false
|
|
102
|
+
},
|
|
103
|
+
annotations: READ_ONLY
|
|
104
|
+
}
|
|
105
|
+
];
|
|
106
|
+
function collectFarmDefaultMCPPages(sources, options) {
|
|
107
|
+
const readable = [];
|
|
108
|
+
for (const source of sources) {
|
|
109
|
+
const module = isRecord(source.module) ? source.module : void 0;
|
|
110
|
+
if (module?.__farmRouteGuard) continue;
|
|
111
|
+
if (!isFarmMarkdownMirrorExposed(options.markdown, source.pattern)) continue;
|
|
112
|
+
readable.push({ pattern: source.pattern, metadata: module?.metadata });
|
|
113
|
+
}
|
|
114
|
+
return collectFarmLlmsTxtPages(readable, {
|
|
115
|
+
origin: options.origin,
|
|
116
|
+
basePath: options.basePath,
|
|
117
|
+
markdown: options.markdown
|
|
118
|
+
}).map((page) => ({
|
|
119
|
+
path: page.path,
|
|
120
|
+
title: page.title,
|
|
121
|
+
url: `${options.origin}${applyFarmBasePath(page.path, options.basePath)}`,
|
|
122
|
+
...page.description ? { description: page.description } : {},
|
|
123
|
+
markdownUrl: `${options.origin}${applyFarmBasePath(
|
|
124
|
+
getFarmMarkdownMirrorPath(page.path),
|
|
125
|
+
options.basePath
|
|
126
|
+
)}`
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
__name(collectFarmDefaultMCPPages, "collectFarmDefaultMCPPages");
|
|
130
|
+
function createFarmDefaultMCPServer(app, farmVersion) {
|
|
131
|
+
const name = typeof app?.name === "string" && app.name.trim() ? app.name.trim() : "farm-app";
|
|
132
|
+
const version = typeof app?.version === "string" && app.version.trim() ? app.version.trim() : farmVersion;
|
|
133
|
+
return {
|
|
134
|
+
name,
|
|
135
|
+
version,
|
|
136
|
+
description: FARM_DEFAULT_MCP_DESCRIPTION,
|
|
137
|
+
protocolVersions: [...FARM_DEFAULT_MCP_PROTOCOL_VERSIONS],
|
|
138
|
+
path: FARM_DEFAULT_MCP_PATH
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
__name(createFarmDefaultMCPServer, "createFarmDefaultMCPServer");
|
|
142
|
+
function resolveFarmDefaultMCPServer(server) {
|
|
143
|
+
if (!server) return void 0;
|
|
144
|
+
if (_listFarmMCPCatalogs().length > 0 || _listFarmRegisteredMCPServers().length > 0) {
|
|
145
|
+
return void 0;
|
|
146
|
+
}
|
|
147
|
+
return server;
|
|
148
|
+
}
|
|
149
|
+
__name(resolveFarmDefaultMCPServer, "resolveFarmDefaultMCPServer");
|
|
150
|
+
function isFarmDefaultMCPPathname(pathname, basePath) {
|
|
151
|
+
const path = stripFarmBasePath(pathname, basePath);
|
|
152
|
+
return path === FARM_DEFAULT_MCP_PATH || path === `${FARM_DEFAULT_MCP_PATH}/`;
|
|
153
|
+
}
|
|
154
|
+
__name(isFarmDefaultMCPPathname, "isFarmDefaultMCPPathname");
|
|
155
|
+
function farmConfigMountsMCP(config) {
|
|
156
|
+
const { mcp } = config;
|
|
157
|
+
if (isRecord(mcp) && mcp.enabled !== false) return true;
|
|
158
|
+
return Boolean(
|
|
159
|
+
config.plugins?.some((plugin) => isRecord(plugin) && plugin.name === "farm:api-mcp")
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
__name(farmConfigMountsMCP, "farmConfigMountsMCP");
|
|
163
|
+
function isRecord(value) {
|
|
164
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
165
|
+
}
|
|
166
|
+
__name(isRecord, "isRecord");
|
|
167
|
+
|
|
168
|
+
export {
|
|
169
|
+
FARM_DEFAULT_MCP_PATH,
|
|
170
|
+
FARM_DEFAULT_MCP_PROTOCOL_VERSIONS,
|
|
171
|
+
FARM_DEFAULT_MCP_DESCRIPTION,
|
|
172
|
+
FARM_DEFAULT_MCP_TOOLS,
|
|
173
|
+
collectFarmDefaultMCPPages,
|
|
174
|
+
createFarmDefaultMCPServer,
|
|
175
|
+
resolveFarmDefaultMCPServer,
|
|
176
|
+
isFarmDefaultMCPPathname,
|
|
177
|
+
farmConfigMountsMCP
|
|
178
|
+
};
|
|
@@ -4,7 +4,7 @@ var _chunkG643DQCHcjs = require('./chunk-G643DQCH.cjs');
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk4GWRFP22cjs = require('./chunk-4GWRFP22.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ var _chunkZ2HLU4IXcjs = require('./chunk-Z2HLU4IX.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -24,6 +24,10 @@ var _chunkUQZ4AYTHcjs = require('./chunk-UQZ4AYTH.cjs');
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
+
var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
27
31
|
var _chunkNZKJGRB3cjs = require('./chunk-NZKJGRB3.cjs');
|
|
28
32
|
|
|
29
33
|
|
|
@@ -839,9 +843,9 @@ function createIntegrationPlugin(integrationKey, integration) {
|
|
|
839
843
|
if (!bodyLoaded) {
|
|
840
844
|
bodyLoaded = true;
|
|
841
845
|
if (req.method && req.method !== "GET" && req.method !== "HEAD") {
|
|
842
|
-
requestBody = await
|
|
846
|
+
requestBody = await _chunkKIIMAWOJcjs.readNodeRequestBody.call(void 0,
|
|
843
847
|
req,
|
|
844
|
-
|
|
848
|
+
_chunkKIIMAWOJcjs.resolveFarmServerConfig.call(void 0, context.config.server).bodySizeLimit
|
|
845
849
|
);
|
|
846
850
|
}
|
|
847
851
|
}
|
|
@@ -851,7 +855,7 @@ function createIntegrationPlugin(integrationKey, integration) {
|
|
|
851
855
|
try {
|
|
852
856
|
return createWebRequest(req, fullUrl, await getRequestBody());
|
|
853
857
|
} catch (error) {
|
|
854
|
-
const response =
|
|
858
|
+
const response = _chunkKIIMAWOJcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
|
|
855
859
|
if (!response) throw error;
|
|
856
860
|
await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, response);
|
|
857
861
|
return null;
|
|
@@ -1558,12 +1562,12 @@ function createFormInput(formData) {
|
|
|
1558
1562
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createFormInput, "createFormInput");
|
|
1559
1563
|
async function dispatchIntegrationRequest(runtime, request, options = {}) {
|
|
1560
1564
|
try {
|
|
1561
|
-
request = await
|
|
1565
|
+
request = await _chunkKIIMAWOJcjs.bufferFarmRequestBody.call(void 0,
|
|
1562
1566
|
request,
|
|
1563
|
-
|
|
1567
|
+
_chunkKIIMAWOJcjs.resolveFarmServerConfig.call(void 0, runtime.config.server).bodySizeLimit
|
|
1564
1568
|
);
|
|
1565
1569
|
} catch (error) {
|
|
1566
|
-
const response =
|
|
1570
|
+
const response = _chunkKIIMAWOJcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
|
|
1567
1571
|
if (response) return response;
|
|
1568
1572
|
throw error;
|
|
1569
1573
|
}
|
|
@@ -1577,10 +1581,12 @@ async function dispatchIntegrationRequest(runtime, request, options = {}) {
|
|
|
1577
1581
|
const middleware = [...integration.middleware || []];
|
|
1578
1582
|
const forwardedSetCookies = [];
|
|
1579
1583
|
for (const entry of middleware) {
|
|
1584
|
+
if (_optionalChain([options, 'access', _24 => _24.ranMiddleware, 'optionalAccess', _25 => _25.has, 'call', _26 => _26(entry)])) continue;
|
|
1580
1585
|
const params = resolveIntegrationMiddlewareParams(entry, pathname, runtime.config);
|
|
1581
1586
|
if (!params) {
|
|
1582
1587
|
continue;
|
|
1583
1588
|
}
|
|
1589
|
+
_optionalChain([options, 'access', _27 => _27.ranMiddleware, 'optionalAccess', _28 => _28.add, 'call', _29 => _29(entry)]);
|
|
1584
1590
|
const handlerContext = createServerIntegrationHandlerContext({
|
|
1585
1591
|
runtime,
|
|
1586
1592
|
route: {
|
|
@@ -1819,7 +1825,7 @@ async function dispatchIntegrationRequest(runtime, request, options = {}) {
|
|
|
1819
1825
|
}
|
|
1820
1826
|
}
|
|
1821
1827
|
if (forwardedSetCookies.length > 0) {
|
|
1822
|
-
_optionalChain([options, 'access',
|
|
1828
|
+
_optionalChain([options, 'access', _30 => _30.onForwardedCookies, 'optionalCall', _31 => _31(forwardedSetCookies)]);
|
|
1823
1829
|
}
|
|
1824
1830
|
return null;
|
|
1825
1831
|
}
|
|
@@ -1845,6 +1851,7 @@ async function dispatchIntegrationRequests(integrations, runtime, request, optio
|
|
|
1845
1851
|
request.clone(),
|
|
1846
1852
|
{
|
|
1847
1853
|
currentRequest: options.currentRequest,
|
|
1854
|
+
ranMiddleware: options.ranMiddleware,
|
|
1848
1855
|
onForwardedCookies: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (cookies) => setCookies.push(...cookies), "onForwardedCookies")
|
|
1849
1856
|
}
|
|
1850
1857
|
);
|
|
@@ -1931,38 +1938,38 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, createServerIntegrationHandlerContext, "cr
|
|
|
1931
1938
|
function createServerIntegrationRequestContextStore(request, currentRequest) {
|
|
1932
1939
|
return {
|
|
1933
1940
|
get(key) {
|
|
1934
|
-
const requestValue =
|
|
1941
|
+
const requestValue = _chunkKIIMAWOJcjs.getRequestContext.call(void 0, request, key);
|
|
1935
1942
|
if (requestValue !== void 0) {
|
|
1936
1943
|
return requestValue;
|
|
1937
1944
|
}
|
|
1938
1945
|
if (currentRequest) {
|
|
1939
|
-
return
|
|
1946
|
+
return _chunkKIIMAWOJcjs.getRequestContext.call(void 0, currentRequest, key);
|
|
1940
1947
|
}
|
|
1941
1948
|
return void 0;
|
|
1942
1949
|
},
|
|
1943
1950
|
set(key, value, options) {
|
|
1944
|
-
|
|
1951
|
+
_chunkKIIMAWOJcjs.setRequestContext.call(void 0, request, key, value, options);
|
|
1945
1952
|
if (currentRequest) {
|
|
1946
|
-
|
|
1953
|
+
_chunkKIIMAWOJcjs.setRequestContext.call(void 0, currentRequest, key, value, options);
|
|
1947
1954
|
}
|
|
1948
1955
|
},
|
|
1949
1956
|
has(key) {
|
|
1950
|
-
return
|
|
1957
|
+
return _chunkKIIMAWOJcjs.hasRequestContext.call(void 0, request, key) || !!currentRequest && _chunkKIIMAWOJcjs.hasRequestContext.call(void 0, currentRequest, key);
|
|
1951
1958
|
},
|
|
1952
1959
|
delete(key) {
|
|
1953
|
-
const deletedRequest =
|
|
1954
|
-
const deletedCurrent = currentRequest ?
|
|
1960
|
+
const deletedRequest = _chunkKIIMAWOJcjs.deleteRequestContext.call(void 0, request, key);
|
|
1961
|
+
const deletedCurrent = currentRequest ? _chunkKIIMAWOJcjs.deleteRequestContext.call(void 0, currentRequest, key) : false;
|
|
1955
1962
|
return deletedRequest || deletedCurrent;
|
|
1956
1963
|
},
|
|
1957
1964
|
clear() {
|
|
1958
|
-
|
|
1965
|
+
_chunkKIIMAWOJcjs.clearRequestContext.call(void 0, request);
|
|
1959
1966
|
if (currentRequest) {
|
|
1960
|
-
|
|
1967
|
+
_chunkKIIMAWOJcjs.clearRequestContext.call(void 0, currentRequest);
|
|
1961
1968
|
}
|
|
1962
1969
|
},
|
|
1963
1970
|
snapshot(options) {
|
|
1964
|
-
const merged = currentRequest ?
|
|
1965
|
-
const requestSnapshot =
|
|
1971
|
+
const merged = currentRequest ? _chunkKIIMAWOJcjs.getRequestContextSnapshot.call(void 0, currentRequest, options) : /* @__PURE__ */ new Map();
|
|
1972
|
+
const requestSnapshot = _chunkKIIMAWOJcjs.getRequestContextSnapshot.call(void 0, request, options);
|
|
1966
1973
|
for (const [key, value] of requestSnapshot) {
|
|
1967
1974
|
merged.set(key, value);
|
|
1968
1975
|
}
|
|
@@ -2006,28 +2013,45 @@ function resolveIntegrationMiddlewareParams(entry, pathname, config) {
|
|
|
2006
2013
|
const params = resolveMatcherParams(entry.matcher, pathname);
|
|
2007
2014
|
if (params || !entry.matcher) return params;
|
|
2008
2015
|
const routePathname = resolveIntegrationRoutePathname(pathname, config);
|
|
2009
|
-
|
|
2010
|
-
|
|
2016
|
+
const candidates = [.../* @__PURE__ */ new Set([pathname, ...getIntegrationAPIPathnames(config)(routePathname)])];
|
|
2017
|
+
for (const candidate of candidates) {
|
|
2018
|
+
if (candidate === pathname) continue;
|
|
2019
|
+
const routeParams = resolveMatcherParams(entry.matcher, candidate);
|
|
2011
2020
|
if (routeParams) return routeParams;
|
|
2012
2021
|
}
|
|
2013
2022
|
let compiled = compiledIntegrationGuards.get(entry);
|
|
2014
2023
|
if (!compiled) {
|
|
2015
|
-
compiled =
|
|
2024
|
+
compiled = _chunk4GWRFP22cjs.compileMiddlewareConfig.call(void 0, {
|
|
2016
2025
|
matcher: typeof entry.matcher === "string" ? entry.matcher : [...entry.matcher]
|
|
2017
2026
|
});
|
|
2018
2027
|
compiledIntegrationGuards.set(entry, compiled);
|
|
2019
2028
|
}
|
|
2020
|
-
for (const candidate of
|
|
2021
|
-
const result =
|
|
2029
|
+
for (const candidate of candidates) {
|
|
2030
|
+
const result = _chunk4GWRFP22cjs.matchesCompiledMiddlewareConfig.call(void 0, candidate, compiled, noMiddlewareContext);
|
|
2022
2031
|
if (result.matched) return _nullishCoalesce(result.params, () => ( {}));
|
|
2023
2032
|
}
|
|
2024
2033
|
return null;
|
|
2025
2034
|
}
|
|
2026
2035
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveIntegrationMiddlewareParams, "resolveIntegrationMiddlewareParams");
|
|
2036
|
+
var FARM_INTEGRATION_API_BASE_PATH_KEY = "__farmAPIServerBasePath";
|
|
2037
|
+
var integrationAPIPathnames = /* @__PURE__ */ new WeakMap();
|
|
2038
|
+
function getIntegrationAPIPathnames(config) {
|
|
2039
|
+
if (!config) return (pathname) => [pathname];
|
|
2040
|
+
let toPathnames = integrationAPIPathnames.get(config);
|
|
2041
|
+
if (!toPathnames) {
|
|
2042
|
+
const recorded = config[FARM_INTEGRATION_API_BASE_PATH_KEY];
|
|
2043
|
+
const api2 = config.api;
|
|
2044
|
+
const serverBasePath = typeof recorded === "string" ? recorded : typeof _optionalChain([api2, 'optionalAccess', _32 => _32.baseURL]) === "string" && typeof api2.basePath === "string" ? _chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, api2) : void 0;
|
|
2045
|
+
toPathnames = _chunkKNBBQHO2cjs.createFarmAPIMiddlewarePathnames.call(void 0, serverBasePath);
|
|
2046
|
+
integrationAPIPathnames.set(config, toPathnames);
|
|
2047
|
+
}
|
|
2048
|
+
return toPathnames;
|
|
2049
|
+
}
|
|
2050
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getIntegrationAPIPathnames, "getIntegrationAPIPathnames");
|
|
2027
2051
|
function resolveIntegrationRoutePathname(pathname, config) {
|
|
2028
|
-
const basePath = typeof _optionalChain([config, 'optionalAccess',
|
|
2052
|
+
const basePath = typeof _optionalChain([config, 'optionalAccess', _33 => _33.basePath]) === "string" ? config.basePath : void 0;
|
|
2029
2053
|
let routePathname = basePath ? _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, pathname, basePath) : pathname;
|
|
2030
|
-
const i18n = _optionalChain([config, 'optionalAccess',
|
|
2054
|
+
const i18n = _optionalChain([config, 'optionalAccess', _34 => _34.i18n]);
|
|
2031
2055
|
if (i18n && Array.isArray(i18n.locales) && i18n.locales.length > 0) {
|
|
2032
2056
|
routePathname = _chunkBIDYX3SLcjs.resolveFarmLocalePath.call(void 0, routePathname, {
|
|
2033
2057
|
locales: i18n.locales,
|
|
@@ -2159,4 +2183,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, normalizeMatcher, "normalizeMatcher");
|
|
|
2159
2183
|
|
|
2160
2184
|
|
|
2161
2185
|
|
|
2162
|
-
|
|
2186
|
+
|
|
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;
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
|
|
3
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
|
+
|
|
5
|
+
// src/api/dev-dispatch.ts
|
|
6
|
+
var _http = require('http'); var _http2 = _interopRequireDefault(_http);
|
|
7
|
+
var _https = require('https'); var _https2 = _interopRequireDefault(_https);
|
|
8
|
+
var _stream = require('stream');
|
|
9
|
+
function createFarmDevServerDispatch(server) {
|
|
10
|
+
return (request) => new Promise((resolve, reject) => {
|
|
11
|
+
const address = _optionalChain([server, 'access', _ => _.httpServer, 'optionalAccess', _2 => _2.address, 'call', _3 => _3()]);
|
|
12
|
+
if (!address || typeof address === "string") {
|
|
13
|
+
throw new Error(
|
|
14
|
+
"Farm cannot dispatch an app endpoint request: the Vite dev server has no listening HTTP server."
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
const url = new URL(request.url);
|
|
18
|
+
const headers = {};
|
|
19
|
+
request.headers.forEach((value, name) => {
|
|
20
|
+
headers[name] = value;
|
|
21
|
+
});
|
|
22
|
+
headers.host = url.host;
|
|
23
|
+
const secure = Boolean(server.config.server.https);
|
|
24
|
+
const outgoing = (secure ? _https2.default : _http2.default).request(
|
|
25
|
+
{
|
|
26
|
+
host: loopbackAddress(address),
|
|
27
|
+
port: address.port,
|
|
28
|
+
method: request.method,
|
|
29
|
+
path: `${url.pathname}${url.search}`,
|
|
30
|
+
headers,
|
|
31
|
+
signal: request.signal,
|
|
32
|
+
// The listener is this process's own dev server, often with a self-signed certificate.
|
|
33
|
+
...secure ? { rejectUnauthorized: false } : {}
|
|
34
|
+
},
|
|
35
|
+
(incoming) => {
|
|
36
|
+
const responseHeaders = new Headers();
|
|
37
|
+
for (const [name, value] of Object.entries(incoming.headers)) {
|
|
38
|
+
if (value === void 0) continue;
|
|
39
|
+
for (const entry of Array.isArray(value) ? value : [value]) {
|
|
40
|
+
responseHeaders.append(name, entry);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const status = _nullishCoalesce(incoming.statusCode, () => ( 502));
|
|
44
|
+
const hasBody = request.method !== "HEAD" && status !== 204 && status !== 205 && status !== 304;
|
|
45
|
+
if (!hasBody) incoming.resume();
|
|
46
|
+
try {
|
|
47
|
+
resolve(
|
|
48
|
+
new Response(
|
|
49
|
+
hasBody ? _stream.Readable.toWeb(incoming) : null,
|
|
50
|
+
{ status, statusText: incoming.statusMessage, headers: responseHeaders }
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
incoming.destroy();
|
|
55
|
+
reject(error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
outgoing.on("error", reject);
|
|
60
|
+
if (request.body) {
|
|
61
|
+
_stream.Readable.fromWeb(request.body).on("error", (error) => outgoing.destroy(error)).pipe(outgoing);
|
|
62
|
+
} else {
|
|
63
|
+
outgoing.end();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmDevServerDispatch, "createFarmDevServerDispatch");
|
|
68
|
+
function loopbackAddress({ address }) {
|
|
69
|
+
return address === "0.0.0.0" ? "127.0.0.1" : address === "::" ? "::1" : address;
|
|
70
|
+
}
|
|
71
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, loopbackAddress, "loopbackAddress");
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
exports.createFarmDevServerDispatch = createFarmDevServerDispatch;
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
var _chunkAI7QMY7Ocjs = require('./chunk-AI7QMY7O.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkNICDYKBScjs = require('./chunk-NICDYKBS.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
10
10
|
|
|
11
11
|
// src/headers.ts
|
|
12
12
|
function headers() {
|
|
13
|
-
return new Headers(
|
|
13
|
+
return new Headers(_chunkNICDYKBScjs.getCurrentRequest.call(void 0, ).headers);
|
|
14
14
|
}
|
|
15
15
|
_chunkS3JO3N4Hcjs.__name.call(void 0, headers, "headers");
|
|
16
16
|
function cookies() {
|
|
17
|
-
const cookieHeader =
|
|
17
|
+
const cookieHeader = _chunkNICDYKBScjs.getCurrentRequest.call(void 0, ).headers.get("cookie") || "";
|
|
18
18
|
const parsed = _chunkAI7QMY7Ocjs.parseRequestCookieHeader.call(void 0, cookieHeader);
|
|
19
19
|
return {
|
|
20
20
|
get(name) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
findProgrammaticRouteFilesInDir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MYIZXDZA.mjs";
|
|
4
4
|
import {
|
|
5
5
|
isFarmAPIRouteFileName
|
|
6
6
|
} from "./chunk-CU625VAY.mjs";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
matchAPIRouteAtBasePath,
|
|
18
18
|
mergePluginAPIRoutes,
|
|
19
19
|
resolveAPIRouteEndpoint
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-HEVMCTSR.mjs";
|
|
21
21
|
import {
|
|
22
22
|
registerAPIRouteShape
|
|
23
23
|
} from "./chunk-W3B4PKAW.mjs";
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
import {
|
|
32
32
|
loadFarmDevModule,
|
|
33
33
|
toFileModuleUrl
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-KMTGADN3.mjs";
|
|
35
35
|
import {
|
|
36
36
|
logger
|
|
37
37
|
} from "./chunk-KI3MESHB.mjs";
|
|
@@ -68,6 +68,15 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
68
68
|
this.i18n = options.i18n;
|
|
69
69
|
this.bodySizeLimit = options.bodySizeLimit;
|
|
70
70
|
this.basePath = options.basePath;
|
|
71
|
+
this.dispatch = options.dispatch;
|
|
72
|
+
}
|
|
73
|
+
/** Every file the current handlers were loaded from: route files and root routes files. */
|
|
74
|
+
getSourceFiles() {
|
|
75
|
+
const files = /* @__PURE__ */ new Set();
|
|
76
|
+
for (const sources of this.endpointSources.values()) {
|
|
77
|
+
for (const { filePath } of sources.values()) files.add(filePath);
|
|
78
|
+
}
|
|
79
|
+
return files;
|
|
71
80
|
}
|
|
72
81
|
/**
|
|
73
82
|
* Discover route.ts files in /app/api and explicit endpoints in root routes.ts
|
|
@@ -94,7 +103,8 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
94
103
|
}
|
|
95
104
|
this.routes = new Map(
|
|
96
105
|
mergePluginAPIRoutes([...this.routes.values()], this.plugins, void 0, {
|
|
97
|
-
bodySizeLimit: this.bodySizeLimit
|
|
106
|
+
bodySizeLimit: this.bodySizeLimit,
|
|
107
|
+
dispatch: this.dispatch
|
|
98
108
|
}).map((route) => [route.path, route])
|
|
99
109
|
);
|
|
100
110
|
} catch (error) {
|
|
@@ -1,6 +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
|
|
3
|
+
var _chunkLPFV45AYcjs = require('./chunk-LPFV45AY.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunk4GWRFP22cjs = require('./chunk-4GWRFP22.cjs');
|
|
4
7
|
|
|
5
8
|
|
|
6
9
|
var _chunkHLJ6MBUZcjs = require('./chunk-HLJ6MBUZ.cjs');
|
|
@@ -210,7 +213,7 @@ var _MiddlewareChainImpl = class _MiddlewareChainImpl {
|
|
|
210
213
|
*/
|
|
211
214
|
when(condition, fn) {
|
|
212
215
|
const conditionalMiddleware = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (ctx, next) => {
|
|
213
|
-
const shouldRun = typeof condition === "function" ? condition
|
|
216
|
+
const shouldRun = typeof condition === "function" ? _chunk4GWRFP22cjs.matchesMiddlewarePredicate.call(void 0, condition, ctx) : condition;
|
|
214
217
|
if (!shouldRun) {
|
|
215
218
|
return next();
|
|
216
219
|
}
|
|
@@ -415,7 +418,7 @@ function farmMiddlewarePlugin(options = {}) {
|
|
|
415
418
|
mode: server.config.mode === "production" ? "production" : "development",
|
|
416
419
|
basePath: _nullishCoalesce(options.basePath, () => ( "/"))
|
|
417
420
|
});
|
|
418
|
-
manager = new (0,
|
|
421
|
+
manager = new (0, _chunkLPFV45AYcjs.MiddlewareManager)(
|
|
419
422
|
getMiddlewareAppDirectory(server.config.root, srcDir),
|
|
420
423
|
server,
|
|
421
424
|
options.middleware,
|
|
@@ -190,6 +190,7 @@ function createFarmConfigResolutionPlugin(options) {
|
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
192
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmConfigResolutionPlugin, "createFarmConfigResolutionPlugin");
|
|
193
|
+
var FARM_CONFIG_ROOT = /* @__PURE__ */ Symbol.for("farm.configRoot");
|
|
193
194
|
async function loadFarmConfigFile(configPath, options) {
|
|
194
195
|
const { transform } = await import("rolldown/utils");
|
|
195
196
|
const cacheRoot = _path2.default.resolve(options.cacheRoot || options.root);
|
|
@@ -207,6 +208,9 @@ async function loadFarmConfigFile(configPath, options) {
|
|
|
207
208
|
plugins: [createFarmConfigResolutionPlugin({ transform })]
|
|
208
209
|
});
|
|
209
210
|
const moduleUrl = `${_url.pathToFileURL.call(void 0, modulePath).href}?t=${Date.now()}`;
|
|
211
|
+
const configRootState = globalThis;
|
|
212
|
+
const previousConfigRoot = configRootState[FARM_CONFIG_ROOT];
|
|
213
|
+
configRootState[FARM_CONFIG_ROOT] = cacheRoot;
|
|
210
214
|
try {
|
|
211
215
|
const loaded = await import(
|
|
212
216
|
/* @vite-ignore */
|
|
@@ -218,6 +222,7 @@ async function loadFarmConfigFile(configPath, options) {
|
|
|
218
222
|
}
|
|
219
223
|
return config;
|
|
220
224
|
} finally {
|
|
225
|
+
configRootState[FARM_CONFIG_ROOT] = previousConfigRoot;
|
|
221
226
|
await _promises.unlink.call(void 0, modulePath).catch(() => void 0);
|
|
222
227
|
}
|
|
223
228
|
}
|
|
@@ -8,7 +8,7 @@ var _chunkLYLEZIG3cjs = require('./chunk-LYLEZIG3.cjs');
|
|
|
8
8
|
var _chunkTKJZFIMLcjs = require('./chunk-TKJZFIML.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -137,7 +137,7 @@ async function finalizeMetadataImageResponse(body, headers, options) {
|
|
|
137
137
|
responseHeaders.set("ETag", etag);
|
|
138
138
|
responseHeaders.set("Content-Length", String(body.byteLength));
|
|
139
139
|
responseHeaders.set("X-Content-Type-Options", "nosniff");
|
|
140
|
-
if (
|
|
140
|
+
if (_chunkKIIMAWOJcjs.matchesFarmIfNoneMatch.call(void 0, options.ifNoneMatch, etag)) {
|
|
141
141
|
return new Response(null, { status: 304, headers: responseHeaders });
|
|
142
142
|
}
|
|
143
143
|
return new Response(_optionalChain([options, 'access', _4 => _4.method, 'optionalAccess', _5 => _5.toUpperCase, 'call', _6 => _6()]) === "HEAD" ? null : body, {
|