@farm.js/core 0.1.35 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{metadata-WGpBYcGn.d.mts → agent-mcp-BVExL8rZ.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-BnLDsUOS.d.ts → agent-mcp-luzfXK-P.d.ts} +45 -2
- package/dist/agent-runtime.cjs +5 -3
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/agent-runtime.mjs +4 -2
- package/dist/api/route-manager.cjs +6 -6
- package/dist/api/route-manager.d.mts +10 -4
- package/dist/api/route-manager.d.ts +10 -4
- package/dist/api/route-manager.mjs +5 -5
- package/dist/api/runtime.cjs +4 -4
- package/dist/api/runtime.d.mts +4 -62
- package/dist/api/runtime.d.ts +4 -62
- package/dist/api/runtime.mjs +3 -3
- package/dist/api.cjs +8 -8
- package/dist/api.d.mts +3 -3
- package/dist/api.d.ts +3 -3
- package/dist/api.mjs +7 -7
- package/dist/{app-D_j9AAVL.d.mts → app-BukwkFIu.d.mts} +17 -3
- package/dist/{app-BXB3JZYc.d.ts → app-Yfa2dsFy.d.ts} +17 -3
- package/dist/app-markdown.cjs +4 -4
- package/dist/app-markdown.d.mts +2 -2
- package/dist/app-markdown.d.ts +2 -2
- package/dist/app-markdown.mjs +3 -3
- package/dist/{chunk-4KU5Q7C2.mjs → chunk-276VJSM6.mjs} +221 -48
- package/dist/{chunk-PFQKNERH.cjs → chunk-2YTDKNH3.cjs} +364 -197
- package/dist/{chunk-UAORZ7QA.mjs → chunk-35GKZR22.mjs} +2 -2
- package/dist/{chunk-QAU5JD57.mjs → chunk-35WV46VL.mjs} +203 -36
- package/dist/{chunk-EFCQPQMG.cjs → chunk-42NHY7HW.cjs} +54 -4
- package/dist/{chunk-SOMHP6GF.mjs → chunk-4E5AEDKY.mjs} +2 -2
- package/dist/{chunk-UJD4PHYB.mjs → chunk-4E5WBPEG.mjs} +72 -354
- package/dist/{chunk-2G2NNLE2.mjs → chunk-4GLOOWKE.mjs} +4 -4
- package/dist/{chunk-62XKI4Z3.cjs → chunk-4NU4GGTC.cjs} +2 -2
- package/dist/{chunk-4JHOT46A.mjs → chunk-4WCZJQUO.mjs} +54 -4
- package/dist/chunk-4WQ6PGSJ.cjs +367 -0
- package/dist/{chunk-SMHH4VDG.mjs → chunk-4WVJLURN.mjs} +1 -1
- package/dist/chunk-6SJ2KJTA.mjs +314 -0
- package/dist/{chunk-IPXLADVO.cjs → chunk-ADEA7PN3.cjs} +122 -61
- package/dist/{chunk-CP6X4AEU.mjs → chunk-AJQTP4OO.mjs} +1 -1
- package/dist/{chunk-4MMGO7YW.cjs → chunk-AO6RYU5N.cjs} +31 -28
- package/dist/{chunk-GFHLGIYC.cjs → chunk-BO36SELV.cjs} +6 -6
- package/dist/{chunk-6TJOML4E.mjs → chunk-BPOF5U4N.mjs} +4 -4
- package/dist/{chunk-JHWOVJ3M.mjs → chunk-BUGNQIHC.mjs} +5 -0
- package/dist/{chunk-FTFYRMQQ.cjs → chunk-CBJJH36A.cjs} +50 -25
- package/dist/{chunk-7GLPRTTF.cjs → chunk-CGBDNNSM.cjs} +2 -2
- package/dist/chunk-CI6E3UOH.cjs +314 -0
- package/dist/{chunk-X6W5FFH6.cjs → chunk-D2BB47NB.cjs} +8 -8
- package/dist/chunk-DTSROJ5J.mjs +367 -0
- package/dist/{chunk-YC6V7PWE.cjs → chunk-DZ5ZVB2K.cjs} +1 -1
- package/dist/{chunk-DBNKI4NF.cjs → chunk-ECKF2BAM.cjs} +6 -2
- package/dist/{chunk-Q3VLETLE.mjs → chunk-EWET4D2Y.mjs} +1 -1
- package/dist/{chunk-HUMR6LSU.mjs → chunk-F5QO4FNE.mjs} +1 -1
- package/dist/{chunk-XBML5KMG.cjs → chunk-FO427P6I.cjs} +22 -12
- package/dist/{chunk-SAZVVAJH.mjs → chunk-GQRWBCWK.mjs} +8 -5
- package/dist/{chunk-F6Z3Y5KL.mjs → chunk-HOXTWRGB.mjs} +1 -1
- package/dist/{chunk-3BHT4WMP.cjs → chunk-JNUWCDTF.cjs} +6 -6
- package/dist/{chunk-73MC7ZL6.cjs → chunk-JZVADIOD.cjs} +2 -2
- package/dist/{chunk-OMVAU7NT.cjs → chunk-KIIMAWOJ.cjs} +11 -1
- package/dist/{chunk-43FMW62B.mjs → chunk-KMTGADN3.mjs} +28 -0
- package/dist/{chunk-6ETPZTJI.mjs → chunk-LSZAVSGY.mjs} +116 -55
- package/dist/{chunk-HMIJDL7S.mjs → chunk-MKYBIIAQ.mjs} +30 -5
- package/dist/{chunk-RU3M2FIK.cjs → chunk-MRMI32SN.cjs} +87 -369
- package/dist/{chunk-7L5V3KQO.cjs → chunk-N2NAS2AM.cjs} +2 -2
- package/dist/{chunk-ICUQICNC.cjs → chunk-NMHWYWDR.cjs} +654 -481
- package/dist/{chunk-G5RT7EXW.mjs → chunk-O6I6VWKK.mjs} +20 -5
- package/dist/{chunk-PDOCJ6RY.mjs → chunk-O6WAEAX3.mjs} +1 -1
- package/dist/{chunk-6DU6UFUE.mjs → chunk-OHLSEQ57.mjs} +16 -8
- package/dist/{chunk-3PXS2MHU.mjs → chunk-OO7GXVSR.mjs} +1 -1
- package/dist/chunk-PTZ2TVNE.cjs +178 -0
- package/dist/{chunk-6WCPV6G2.mjs → chunk-Q2KB32T4.mjs} +1 -1
- package/dist/{chunk-XCACDAZZ.cjs → chunk-S6VYG6XU.cjs} +23 -8
- package/dist/{chunk-VFQT3LAO.cjs → chunk-SDOTRX3V.cjs} +5 -5
- package/dist/{chunk-BMWDEBXO.cjs → chunk-SHLXACIO.cjs} +31 -3
- package/dist/{chunk-22LTEMGQ.mjs → chunk-T4OGRVNS.mjs} +13 -3
- package/dist/{chunk-ZXGAFZDO.cjs → chunk-T5OJPTVN.cjs} +2 -2
- package/dist/{chunk-VZJR7UTG.cjs → chunk-TE2G5ION.cjs} +2 -2
- package/dist/chunk-UH6QN5NL.mjs +178 -0
- package/dist/{chunk-F7JZENPF.cjs → chunk-UVW64BCB.cjs} +38 -30
- package/dist/{chunk-OKZUAXHF.mjs → chunk-VILIPRS6.mjs} +1 -1
- package/dist/{chunk-3UH7MRCP.cjs → chunk-VQLJWDVW.cjs} +13 -13
- package/dist/{chunk-VPTDD5XF.cjs → chunk-WBKEZXWE.cjs} +5 -0
- package/dist/{chunk-EJQT6KZN.cjs → chunk-WC5UV2HQ.cjs} +2 -2
- package/dist/{chunk-YULD7ICZ.mjs → chunk-WZ77PUAM.mjs} +1 -1
- package/dist/{chunk-C35ZBVRD.mjs → chunk-YWMZUGIS.mjs} +6 -2
- package/dist/{chunk-Y7RKTKYI.mjs → chunk-ZMMBIVQM.mjs} +10 -0
- package/dist/{chunk-ULAWS2PA.cjs → chunk-ZWM5KGAA.cjs} +6 -6
- package/dist/{client-plugins-CvIslxWi.d.mts → client-plugins-C3mK9Pol.d.mts} +98 -5
- package/dist/{client-plugins-HIyulDym.d.ts → client-plugins-r1mOtSC1.d.ts} +98 -5
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.d.mts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{devtools-EE5RIBTH.mjs → devtools-ERIKFEXX.mjs} +9 -8
- package/dist/{devtools-EAUY43BS.cjs → devtools-JZJJY5CK.cjs} +10 -9
- package/dist/docs.cjs +12 -11
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +11 -10
- 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 +39 -35
- package/dist/index.d.mts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.mjs +38 -34
- package/dist/integrations.cjs +7 -3
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.mjs +6 -2
- package/dist/internal/app-markdown-runtime.cjs +3 -3
- package/dist/internal/app-markdown-runtime.d.mts +2 -2
- package/dist/internal/app-markdown-runtime.d.ts +2 -2
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +27 -25
- package/dist/internal/build-runtime.d.mts +3 -3
- package/dist/internal/build-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.mjs +26 -24
- package/dist/internal/cli-runtime.cjs +14 -13
- package/dist/internal/cli-runtime.mjs +13 -12
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.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 +10 -9
- package/dist/internal/config-runtime.d.mts +2 -2
- package/dist/internal/config-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.mjs +9 -8
- 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 +23 -9
- package/dist/internal/production-runtime.d.mts +67 -27
- package/dist/internal/production-runtime.d.ts +67 -27
- package/dist/internal/production-runtime.mjs +26 -12
- 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 +6 -6
- package/dist/middleware.d.mts +3 -3
- package/dist/middleware.d.ts +3 -3
- package/dist/middleware.mjs +5 -5
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/{nitro-OVPLKPE2.cjs → nitro-7F65EZZS.cjs} +3 -3
- package/dist/{nitro-MXRDCXWZ.mjs → nitro-MPZJGPXK.mjs} +2 -2
- package/dist/plugin.cjs +23 -21
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.mjs +22 -20
- package/dist/{production-runtime-0sRnuYc-.d.mts → production-runtime-CCeVZXst.d.mts} +1 -1
- package/dist/{production-runtime-Crq6CJ-2.d.ts → production-runtime-DPnsggY3.d.ts} +1 -1
- package/dist/{render-plan-gs9GGPzw.d.mts → render-plan-BuGaPFe6.d.mts} +1 -1
- package/dist/{render-plan-8ozZh2Qv.d.ts → render-plan-Cw4f5E_R.d.ts} +1 -1
- package/dist/renderer/react/server.cjs +3 -3
- package/dist/renderer/react/server.mjs +1 -1
- package/dist/renderer-client.d.mts +3 -3
- package/dist/renderer-client.d.ts +3 -3
- package/dist/{request-B5G8rLBH.d.ts → request-Bkg-hERy.d.ts} +1 -1
- package/dist/{request-fkhiynXe.d.mts → request-CsGARcAw.d.mts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering-lS5nUMua.d.ts → route-rendering-BUZMH_64.d.ts} +1 -1
- package/dist/{route-rendering-CLnS7AZj.d.mts → route-rendering-f11yh5dp.d.mts} +1 -1
- package/dist/{router-4iuiYnOW.d.ts → router-B8CR9GbD.d.ts} +1 -1
- package/dist/{router-ifU8Dui1.d.mts → router-Cp6yRE8A.d.mts} +1 -1
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/runtime-CAEv36S_.d.mts +69 -0
- package/dist/runtime-CQVsT330.d.ts +69 -0
- package/dist/server-action-security.cjs +3 -3
- package/dist/server-action-security.mjs +2 -2
- package/dist/server-fn.cjs +4 -4
- package/dist/server-fn.mjs +3 -3
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server-query.cjs +5 -5
- package/dist/server-query.mjs +4 -4
- package/dist/server.cjs +42 -40
- package/dist/server.d.mts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.mjs +25 -23
- package/dist/{spa-router-DaJk5Re4.d.ts → spa-router-BuciWGCZ.d.ts} +2 -2
- package/dist/{spa-router-Bq7VCOwx.d.mts → spa-router-DwbqGkGj.d.mts} +2 -2
- package/dist/testing.cjs +8 -8
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.mjs +6 -6
- package/dist/{utils-XJn0c9bj.d.mts → utils-B9V0S_yL.d.mts} +1 -1
- package/dist/{utils-BXLmFsVR.d.ts → utils-CaoWKtYM.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +23 -21
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.mjs +22 -20
- package/dist/workflows.cjs +3 -3
- package/dist/workflows.mjs +2 -2
- package/package.json +1 -1
- package/dist/layers-4PNE2HOY.cjs +0 -18
- package/dist/{chunk-2F2ER724.cjs → chunk-BPMATOP2.cjs} +2 -2
- package/dist/{chunk-IHNMMXHV.mjs → chunk-OTC5BDGO.mjs} +3 -3
|
@@ -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
|
+
};
|
|
@@ -16,7 +16,7 @@ var _chunkQ5B3KJBPcjs = require('./chunk-Q5B3KJBP.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkWBKEZXWEcjs = require('./chunk-WBKEZXWE.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -29,7 +29,10 @@ var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkMRMI32SNcjs = require('./chunk-MRMI32SN.cjs');
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
var _chunk4WQ6PGSJcjs = require('./chunk-4WQ6PGSJ.cjs');
|
|
33
36
|
|
|
34
37
|
|
|
35
38
|
var _chunkYFPGHF5Fcjs = require('./chunk-YFPGHF5F.cjs');
|
|
@@ -38,7 +41,7 @@ var _chunkYFPGHF5Fcjs = require('./chunk-YFPGHF5F.cjs');
|
|
|
38
41
|
var _chunk6EXBPJ24cjs = require('./chunk-6EXBPJ24.cjs');
|
|
39
42
|
|
|
40
43
|
|
|
41
|
-
var
|
|
44
|
+
var _chunkT5OJPTVNcjs = require('./chunk-T5OJPTVN.cjs');
|
|
42
45
|
|
|
43
46
|
|
|
44
47
|
|
|
@@ -54,16 +57,16 @@ var _chunkEUV4YR3Vcjs = require('./chunk-EUV4YR3V.cjs');
|
|
|
54
57
|
var _chunkUYIHRDE4cjs = require('./chunk-UYIHRDE4.cjs');
|
|
55
58
|
|
|
56
59
|
|
|
57
|
-
var
|
|
60
|
+
var _chunkSDOTRX3Vcjs = require('./chunk-SDOTRX3V.cjs');
|
|
58
61
|
|
|
59
62
|
|
|
60
63
|
var _chunkOI6CMLWXcjs = require('./chunk-OI6CMLWX.cjs');
|
|
61
64
|
|
|
62
65
|
|
|
63
|
-
var
|
|
66
|
+
var _chunkCBJJH36Acjs = require('./chunk-CBJJH36A.cjs');
|
|
64
67
|
|
|
65
68
|
|
|
66
|
-
var
|
|
69
|
+
var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
67
70
|
|
|
68
71
|
|
|
69
72
|
var _chunkHLJ6MBUZcjs = require('./chunk-HLJ6MBUZ.cjs');
|
|
@@ -135,13 +138,18 @@ function resolveFarmAgentConfig(input, context = {}) {
|
|
|
135
138
|
const jsonLd = _optionalChain([input, 'optionalAccess', _ => _.jsonLd]);
|
|
136
139
|
return {
|
|
137
140
|
jsonLd: jsonLd === void 0 ? { ...DEFAULT_JSON_LD } : !jsonLd ? false : jsonLd === true ? {} : jsonLd,
|
|
138
|
-
noindexPreviews:
|
|
141
|
+
noindexPreviews: _chunkMRMI32SNcjs.resolveFarmNoindexPreviews.call(void 0, _optionalChain([input, 'optionalAccess', _2 => _2.noindexPreviews])),
|
|
139
142
|
// The docs engine answers /llms.txt with its own pages; a default here would replace it.
|
|
140
143
|
// llms-full.txt renders every listed page, so it stays opt-in.
|
|
141
|
-
llmsTxt:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
llmsTxt: _chunk4WQ6PGSJcjs.resolveFarmLlmsTxtConfig.call(void 0, _nullishCoalesce(_optionalChain([input, 'optionalAccess', _3 => _3.llmsTxt]), () => ( (context.docs ? false : { full: false })))),
|
|
145
|
+
// Same rule as llms.txt: the docs engine answers /sitemap.xml with its own pages.
|
|
146
|
+
sitemap: _chunkMRMI32SNcjs.resolveFarmAgentSitemap.call(void 0, _nullishCoalesce(_optionalChain([input, 'optionalAccess', _4 => _4.sitemap]), () => ( !context.docs))),
|
|
147
|
+
crawlers: _chunkMRMI32SNcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([input, 'optionalAccess', _5 => _5.crawlers])),
|
|
148
|
+
apiCatalog: resolveFarmAgentBoolean(_optionalChain([input, 'optionalAccess', _6 => _6.apiCatalog]), "apiCatalog", false),
|
|
149
|
+
aiCatalog: resolveFarmAgentBoolean(_optionalChain([input, 'optionalAccess', _7 => _7.aiCatalog]), "aiCatalog", true),
|
|
150
|
+
manifest: resolveFarmAgentBoolean(_optionalChain([input, 'optionalAccess', _8 => _8.manifest]), "manifest", true),
|
|
151
|
+
// Same rule as llms.txt: the docs engine serves its own MCP server at /mcp.
|
|
152
|
+
mcp: resolveFarmAgentBoolean(_optionalChain([input, 'optionalAccess', _9 => _9.mcp]), "mcp", !context.docs)
|
|
145
153
|
};
|
|
146
154
|
}
|
|
147
155
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmAgentConfig, "resolveFarmAgentConfig");
|
|
@@ -226,7 +234,7 @@ async function applyFarmDocsFrameworkAutoDetection(userConfig, options) {
|
|
|
226
234
|
/* @vite-ignore */
|
|
227
235
|
_url.pathToFileURL.call(void 0, configEntryPath).href
|
|
228
236
|
);
|
|
229
|
-
const withDocs = _optionalChain([frameworkConfig, 'optionalAccess',
|
|
237
|
+
const withDocs = _optionalChain([frameworkConfig, 'optionalAccess', _10 => _10.withDocs]);
|
|
230
238
|
if (typeof withDocs !== "function") {
|
|
231
239
|
noticeOnce(
|
|
232
240
|
"missing-withdocs",
|
|
@@ -236,7 +244,7 @@ async function applyFarmDocsFrameworkAutoDetection(userConfig, options) {
|
|
|
236
244
|
return userConfig;
|
|
237
245
|
}
|
|
238
246
|
const applied = withDocs(userConfig);
|
|
239
|
-
const adapter = _optionalChain([applied, 'optionalAccess',
|
|
247
|
+
const adapter = _optionalChain([applied, 'optionalAccess', _11 => _11.docs, 'optionalAccess', _12 => _12.adapter]);
|
|
240
248
|
if (!isSupportedAdapterDescriptor(adapter)) {
|
|
241
249
|
noticeOnce(
|
|
242
250
|
"unsupported-descriptor",
|
|
@@ -351,7 +359,7 @@ var PLATFORM_BUILD_ENV_TARGETS = [
|
|
|
351
359
|
];
|
|
352
360
|
function detectPlatformDeployTarget(env = process.env) {
|
|
353
361
|
for (const [key, target] of PLATFORM_BUILD_ENV_TARGETS) {
|
|
354
|
-
const value = _optionalChain([env, 'access',
|
|
362
|
+
const value = _optionalChain([env, 'access', _13 => _13[key], 'optionalAccess', _14 => _14.trim, 'call', _15 => _15(), 'access', _16 => _16.toLowerCase, 'call', _17 => _17()]);
|
|
355
363
|
if (value === "1" || value === "true") return target;
|
|
356
364
|
}
|
|
357
365
|
return void 0;
|
|
@@ -391,7 +399,7 @@ function resolveDeployConfig(config, overrides = {}) {
|
|
|
391
399
|
);
|
|
392
400
|
}
|
|
393
401
|
}
|
|
394
|
-
const platformOutput = resolvedTarget === "vercel" ? _optionalChain([deploy, 'access',
|
|
402
|
+
const platformOutput = resolvedTarget === "vercel" ? _optionalChain([deploy, 'access', _18 => _18.vercel, 'optionalAccess', _19 => _19.outputDirectory]) : resolvedTarget === "cloudflare" ? _optionalChain([deploy, 'access', _20 => _20.cloudflare, 'optionalAccess', _21 => _21.outputDir]) : resolvedTarget === "netlify" ? _optionalChain([deploy, 'access', _22 => _22.netlify, 'optionalAccess', _23 => _23.outputDir]) : void 0;
|
|
395
403
|
const outputDir = overrides.outputDir || deploy.outputDir || deploy.output || platformOutput || getDefaultDeployOutputDir(resolvedTarget, preset, distDir);
|
|
396
404
|
return {
|
|
397
405
|
...deploy,
|
|
@@ -587,14 +595,14 @@ async function resolveDocsConfig(userDocs, options = {}) {
|
|
|
587
595
|
config: void 0,
|
|
588
596
|
configPath: void 0
|
|
589
597
|
});
|
|
590
|
-
const loadedDocsConfig = sanitizeDocsConfig(_optionalChain([loadedConfig, 'optionalAccess',
|
|
598
|
+
const loadedDocsConfig = sanitizeDocsConfig(_optionalChain([loadedConfig, 'optionalAccess', _24 => _24.config]) || {});
|
|
591
599
|
const mergedDocsConfig = {
|
|
592
600
|
...loadedDocsConfig,
|
|
593
601
|
...inlineDocsConfig,
|
|
594
602
|
...directDocsConfig
|
|
595
603
|
};
|
|
596
604
|
const runtimeDocsConfig = {
|
|
597
|
-
..._optionalChain([loadedConfig, 'optionalAccess',
|
|
605
|
+
..._optionalChain([loadedConfig, 'optionalAccess', _25 => _25.config]) || {},
|
|
598
606
|
...isRecord(docsOptions.config) ? docsOptions.config : {},
|
|
599
607
|
...omitUndefined({
|
|
600
608
|
...docsOptions,
|
|
@@ -620,7 +628,7 @@ async function resolveDocsConfig(userDocs, options = {}) {
|
|
|
620
628
|
entry: entryRoute,
|
|
621
629
|
...docsOptions.adapter ? { adapter: docsOptions.adapter } : {},
|
|
622
630
|
contentDir,
|
|
623
|
-
configPath: _optionalChain([loadedConfig, 'optionalAccess',
|
|
631
|
+
configPath: _optionalChain([loadedConfig, 'optionalAccess', _26 => _26.configPath]),
|
|
624
632
|
config: {
|
|
625
633
|
...mergedDocsConfig,
|
|
626
634
|
entry: docsEntry,
|
|
@@ -658,7 +666,7 @@ function validateConfigRouteSources(routes, field) {
|
|
|
658
666
|
_chunkS3JO3N4Hcjs.__name.call(void 0, validateConfigRouteSources, "validateConfigRouteSources");
|
|
659
667
|
async function resolveConfig(userConfig, mode) {
|
|
660
668
|
const projectRoot = userConfig.root || process.cwd();
|
|
661
|
-
const layerResolution = await
|
|
669
|
+
const layerResolution = await _chunkWBKEZXWEcjs.resolveFarmLayers.call(void 0, userConfig, {
|
|
662
670
|
root: projectRoot,
|
|
663
671
|
mode
|
|
664
672
|
});
|
|
@@ -689,9 +697,9 @@ async function resolveConfig(userConfig, mode) {
|
|
|
689
697
|
const routeRules = _chunkQ5B3KJBPcjs.normalizeRouteRules.call(void 0, userConfig.routeRules);
|
|
690
698
|
const routeRuleRedirects = _chunkQ5B3KJBPcjs.routeRulesToRedirects.call(void 0, routeRules);
|
|
691
699
|
const routeRuleHeaders = _chunkQ5B3KJBPcjs.routeRulesToHeaders.call(void 0, routeRules);
|
|
692
|
-
const security =
|
|
693
|
-
const securityHeader =
|
|
694
|
-
if (
|
|
700
|
+
const security = _chunkMRMI32SNcjs.resolveFarmSecurityConfig.call(void 0, userConfig.security);
|
|
701
|
+
const securityHeader = _chunkMRMI32SNcjs.getFarmSecurityHeader.call(void 0, security);
|
|
702
|
+
if (_chunkMRMI32SNcjs.farmCspBlocksFrameworkInlineScripts.call(void 0, security)) {
|
|
695
703
|
_chunk5QIKR7RRcjs.logger.warn(
|
|
696
704
|
"security.csp blocks the inline scripts Farm injects for theming and hydration. Set security.csp.nonce to true for managed dynamic nonces and prerendered hashes, or make the governing script directive allow 'unsafe-inline' without a nonce, hash, or 'strict-dynamic' source."
|
|
697
705
|
);
|
|
@@ -708,7 +716,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
708
716
|
const api = await _chunkS3A45T7Fcjs.resolveFarmAPIConfig.call(void 0, userConfig.api, { root, mode, env });
|
|
709
717
|
const auth = _chunk6MVFL3R5cjs.resolveFarmAuthConfig.call(void 0, userConfig.auth);
|
|
710
718
|
const mcp = resolveFarmMCPConfig(userConfig.mcp);
|
|
711
|
-
if (auth.enabled && _optionalChain([userConfig, 'access',
|
|
719
|
+
if (auth.enabled && _optionalChain([userConfig, 'access', _27 => _27.integrations, 'optionalAccess', _28 => _28.auth])) {
|
|
712
720
|
throw new Error(
|
|
713
721
|
"Choose either the top-level `auth` config or `integrations.auth`; they cannot both own the auth route."
|
|
714
722
|
);
|
|
@@ -718,7 +726,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
718
726
|
mode
|
|
719
727
|
});
|
|
720
728
|
const nativeMCPPlugin = await resolveFarmMCPPlugin(mcp, { root });
|
|
721
|
-
if (nativeMCPPlugin && _optionalChain([userConfig, 'access',
|
|
729
|
+
if (nativeMCPPlugin && _optionalChain([userConfig, 'access', _29 => _29.plugins, 'optionalAccess', _30 => _30.some, 'call', _31 => _31((plugin) => _optionalChain([plugin, 'optionalAccess', _32 => _32.name]) === "farm:api-mcp")])) {
|
|
722
730
|
throw new Error(
|
|
723
731
|
"Choose either the top-level `mcp` config or `apiMcp()` in `plugins`; they configure the same MCP transport."
|
|
724
732
|
);
|
|
@@ -756,7 +764,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
756
764
|
mdx,
|
|
757
765
|
migrations: resolveMigrationsConfig(userConfig.migrations),
|
|
758
766
|
cron: _chunk6EXBPJ24cjs.resolveCronConfig.call(void 0, userConfig.cron),
|
|
759
|
-
workflows:
|
|
767
|
+
workflows: _chunkSDOTRX3Vcjs.resolveWorkflowsConfig.call(void 0, userConfig.workflows),
|
|
760
768
|
api,
|
|
761
769
|
observability: _nullishCoalesce(userConfig.observability, () => ( false)),
|
|
762
770
|
telemetry: userConfig.telemetry !== false,
|
|
@@ -777,7 +785,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
777
785
|
},
|
|
778
786
|
agent: resolveFarmAgentConfig(userConfig.agent, { docs: docs.enabled }),
|
|
779
787
|
plugins: [
|
|
780
|
-
...
|
|
788
|
+
..._chunkCBJJH36Acjs.resolveIntegrationPlugins.call(void 0, integrations),
|
|
781
789
|
...nativeMCPPlugin ? [nativeMCPPlugin] : [],
|
|
782
790
|
...userConfig.plugins || []
|
|
783
791
|
],
|
|
@@ -792,7 +800,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
792
800
|
], "headers"),
|
|
793
801
|
routeRules,
|
|
794
802
|
images: _chunkYFPGHF5Fcjs.resolveFarmImageConfig.call(void 0, userConfig.images),
|
|
795
|
-
performance:
|
|
803
|
+
performance: _chunkMRMI32SNcjs.resolveFarmPerformanceConfig.call(void 0, userConfig.performance),
|
|
796
804
|
theme: _chunkOI6CMLWXcjs.resolveFarmThemeConfig.call(void 0, userConfig.theme, basePath),
|
|
797
805
|
publicDir: userConfig.publicDir || "public",
|
|
798
806
|
i18n: _chunkHLJ6MBUZcjs.resolveFarmI18nConfig.call(void 0, userConfig.i18n, { root, mode, basePath }),
|
|
@@ -800,8 +808,8 @@ async function resolveConfig(userConfig, mode) {
|
|
|
800
808
|
middleware: userConfig.middleware || {},
|
|
801
809
|
notFound: userConfig.notFound || {},
|
|
802
810
|
context: userConfig.context || (() => void 0),
|
|
803
|
-
server:
|
|
804
|
-
serverActions:
|
|
811
|
+
server: _chunkKIIMAWOJcjs.resolveFarmServerConfig.call(void 0, userConfig.server),
|
|
812
|
+
serverActions: _chunkT5OJPTVNcjs.resolveServerActionsConfig.call(void 0, userConfig.serverActions),
|
|
805
813
|
security,
|
|
806
814
|
deploymentId,
|
|
807
815
|
distDir: userConfig.distDir || ".farm",
|
|
@@ -870,7 +878,7 @@ async function loadConfig(rootDir, configPath, mode = process.env.NODE_ENV === "
|
|
|
870
878
|
if (!existsSync(normalizedPath)) {
|
|
871
879
|
continue;
|
|
872
880
|
}
|
|
873
|
-
const loadedConfig = await
|
|
881
|
+
const loadedConfig = await _chunkWBKEZXWEcjs.loadFarmConfigFile.call(void 0, normalizedPath, { root });
|
|
874
882
|
return loadedConfig.root === void 0 ? { ...loadedConfig, root } : loadedConfig;
|
|
875
883
|
} catch (error) {
|
|
876
884
|
const configError = new Error(
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkTE2G5IONcjs = require('./chunk-TE2G5ION.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkUVW64BCBcjs = require('./chunk-UVW64BCB.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -40,7 +40,7 @@ function createFarmDocsAdapterRuntimeConfig(docs, options, moduleConfig) {
|
|
|
40
40
|
...moduleConfig ? { ...moduleConfig, ...docs.configOverrides } : _nullishCoalesce(docs.runtimeConfig, () => ( docs.config)),
|
|
41
41
|
entry: docs.config.entry || docs.entry.replace(/^\/+|\/+$/g, "") || "docs",
|
|
42
42
|
docsPath: docs.entry,
|
|
43
|
-
contentDir:
|
|
43
|
+
contentDir: _chunkTE2G5IONcjs.resolveFarmDocsContentDir.call(void 0, docs, options)
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmDocsAdapterRuntimeConfig, "createFarmDocsAdapterRuntimeConfig");
|
|
@@ -277,25 +277,25 @@ function getDocsDescription(docs) {
|
|
|
277
277
|
}
|
|
278
278
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getDocsDescription, "getDocsDescription");
|
|
279
279
|
function getLoadedDocsPages(context) {
|
|
280
|
-
return
|
|
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));
|
|
281
281
|
}
|
|
282
282
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getLoadedDocsPages, "getLoadedDocsPages");
|
|
283
283
|
function toDocsSourcePage(page) {
|
|
284
284
|
return {
|
|
285
|
-
...
|
|
285
|
+
..._chunkTE2G5IONcjs.toFarmDocsMarkdownPage.call(void 0, page),
|
|
286
286
|
sourcePath: page.sourcePath
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
289
|
_chunkS3JO3N4Hcjs.__name.call(void 0, toDocsSourcePage, "toDocsSourcePage");
|
|
290
290
|
function toDocsSitemapPage(page) {
|
|
291
291
|
return {
|
|
292
|
-
...
|
|
292
|
+
..._chunkTE2G5IONcjs.toFarmDocsMarkdownPage.call(void 0, page),
|
|
293
293
|
sourcePath: page.sourcePath
|
|
294
294
|
};
|
|
295
295
|
}
|
|
296
296
|
_chunkS3JO3N4Hcjs.__name.call(void 0, toDocsSitemapPage, "toDocsSitemapPage");
|
|
297
297
|
function toDocsLlmsPage(page) {
|
|
298
|
-
return
|
|
298
|
+
return _chunkTE2G5IONcjs.toFarmDocsMarkdownPage.call(void 0, page);
|
|
299
299
|
}
|
|
300
300
|
_chunkS3JO3N4Hcjs.__name.call(void 0, toDocsLlmsPage, "toDocsLlmsPage");
|
|
301
301
|
function getDocsLlmsOptions(context, request) {
|
|
@@ -389,7 +389,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, renderAgentsDocument, "renderAgentsDocumen
|
|
|
389
389
|
function buildAgentSpec(context, request) {
|
|
390
390
|
const url = new URL(request.url);
|
|
391
391
|
const origin = url.origin;
|
|
392
|
-
const pages =
|
|
392
|
+
const pages = _chunkTE2G5IONcjs.discoverFarmDocsPages.call(void 0, context.contentDir, context.docs);
|
|
393
393
|
const spec = _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).buildDocsAgentDiscoverySpec(getDocsDiscoveryOptions(context, request));
|
|
394
394
|
const title = getDocsTitle(context.docs);
|
|
395
395
|
return {
|
|
@@ -479,7 +479,7 @@ function buildPublicConfig(context) {
|
|
|
479
479
|
}
|
|
480
480
|
_chunkS3JO3N4Hcjs.__name.call(void 0, buildPublicConfig, "buildPublicConfig");
|
|
481
481
|
function buildDiagnostics(context) {
|
|
482
|
-
const pages =
|
|
482
|
+
const pages = _chunkTE2G5IONcjs.discoverFarmDocsPages.call(void 0, context.contentDir, context.docs);
|
|
483
483
|
const diagnostics = _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).buildDocsDiagnostics(context.docs.config, {
|
|
484
484
|
entry: context.docs.entry,
|
|
485
485
|
mcp: {
|
|
@@ -551,12 +551,12 @@ async function resolveAPIContext(options) {
|
|
|
551
551
|
config: options.config,
|
|
552
552
|
configPath: options.configPath
|
|
553
553
|
}));
|
|
554
|
-
const docs = isResolvedDocsConfig(docsInput) ? docsInput : await
|
|
554
|
+
const docs = isResolvedDocsConfig(docsInput) ? docsInput : await _chunkUVW64BCBcjs.resolveDocsConfig.call(void 0, docsInput, { root, srcDir });
|
|
555
555
|
return {
|
|
556
556
|
root,
|
|
557
557
|
srcDir,
|
|
558
558
|
docs,
|
|
559
|
-
contentDir:
|
|
559
|
+
contentDir: _chunkTE2G5IONcjs.resolveFarmDocsContentDir.call(void 0, docs, { root, srcDir }),
|
|
560
560
|
diagnostics: options.diagnostics === true
|
|
561
561
|
};
|
|
562
562
|
}
|
|
@@ -615,10 +615,10 @@ async function handleDocsAPIGet(request, context) {
|
|
|
615
615
|
if (format === "markdown" || url.pathname.endsWith(".md")) {
|
|
616
616
|
const pathParam = url.searchParams.get("path") || url.searchParams.get("slug");
|
|
617
617
|
const slug = normalizeDocsApiSlug(_nullishCoalesce(_nullishCoalesce(pathParam, () => ( pathTarget.slug)), () => ( "")), context.docs);
|
|
618
|
-
const page =
|
|
618
|
+
const page = _chunkTE2G5IONcjs.loadFarmDocsPage.call(void 0, context.contentDir, context.docs, slug);
|
|
619
619
|
if (!page) return text("Docs page not found\n", "text/plain; charset=utf-8", { status: 404 });
|
|
620
620
|
return text(
|
|
621
|
-
_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsMarkdownDocument(
|
|
621
|
+
_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsMarkdownDocument(_chunkTE2G5IONcjs.toFarmDocsMarkdownPage.call(void 0, page), {
|
|
622
622
|
origin: new URL(request.url).origin,
|
|
623
623
|
llms: getDocsLlmsOptions(context, request),
|
|
624
624
|
sitemap: context.docs.config.sitemap
|
|
@@ -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, {
|
|
@@ -67,6 +67,7 @@ function isolateFarmServerPageGraph(ReactRuntime, element) {
|
|
|
67
67
|
return ReactRuntime.createElement(Context.Provider, { value: false }, element);
|
|
68
68
|
}
|
|
69
69
|
__name(isolateFarmServerPageGraph, "isolateFarmServerPageGraph");
|
|
70
|
+
var warnedUnserializableBoundaries = /* @__PURE__ */ new Set();
|
|
70
71
|
function createFarmIsolatedClientBoundary(ReactRuntime, Component, moduleReference, exportName, islandStrategy) {
|
|
71
72
|
function FarmIsolatedClientBoundary(props) {
|
|
72
73
|
const Context = getBoundaryGraphContext(ReactRuntime);
|
|
@@ -79,9 +80,12 @@ function createFarmIsolatedClientBoundary(ReactRuntime, Component, moduleReferen
|
|
|
79
80
|
try {
|
|
80
81
|
serializedProps = serializeBoundaryPayload(props);
|
|
81
82
|
} catch (error) {
|
|
82
|
-
|
|
83
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
84
|
+
const warningKey = `${moduleReference}#${exportName}:${message}`;
|
|
85
|
+
if (typeof window === "undefined" && !warnedUnserializableBoundaries.has(warningKey)) {
|
|
86
|
+
warnedUnserializableBoundaries.add(warningKey);
|
|
83
87
|
console.warn(
|
|
84
|
-
`[Farm.js] Could not isolate ${moduleReference}#${exportName}: ${
|
|
88
|
+
`[Farm.js] Could not isolate ${moduleReference}#${exportName}: ${message}. The server-rendered component was preserved without client hydration.`
|
|
85
89
|
);
|
|
86
90
|
}
|
|
87
91
|
return ReactRuntime.createElement(Component, props);
|
|
@@ -118,6 +118,15 @@ var DEFAULT_FARM_SERVER_REQUEST_TIMEOUT = 3e5;
|
|
|
118
118
|
var DEFAULT_FARM_SERVER_KEEP_ALIVE_TIMEOUT = 5e3;
|
|
119
119
|
var DEFAULT_FARM_SERVER_GRACEFUL_SHUTDOWN_TIMEOUT = 3e4;
|
|
120
120
|
var MAX_FARM_SERVER_TIMEOUT = 2147483647;
|
|
121
|
+
function createFarmWeakETag(body) {
|
|
122
|
+
let hash = 2166136261;
|
|
123
|
+
for (let index = 0; index < body.length; index++) {
|
|
124
|
+
hash ^= body.charCodeAt(index);
|
|
125
|
+
hash = Math.imul(hash, 16777619);
|
|
126
|
+
}
|
|
127
|
+
return `W/"${(hash >>> 0).toString(16).padStart(8, "0")}"`;
|
|
128
|
+
}
|
|
129
|
+
__name(createFarmWeakETag, "createFarmWeakETag");
|
|
121
130
|
function matchesFarmIfNoneMatch(value, etag) {
|
|
122
131
|
const expected = parseEntityTag(trimOptionalWhitespace(etag));
|
|
123
132
|
if (!expected) return false;
|
|
@@ -483,6 +492,7 @@ export {
|
|
|
483
492
|
copyRequestContext,
|
|
484
493
|
createFarmNodeRequestAbortSignal,
|
|
485
494
|
DEFAULT_FARM_SERVER_BODY_SIZE_LIMIT,
|
|
495
|
+
createFarmWeakETag,
|
|
486
496
|
matchesFarmIfNoneMatch,
|
|
487
497
|
resolveFarmServerConfig,
|
|
488
498
|
parseBodySizeLimit,
|
|
@@ -20,21 +20,21 @@ var _chunkM2L4MYDQcjs = require('./chunk-M2L4MYDQ.cjs');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunkSHLXACIOcjs = require('./chunk-SHLXACIO.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
|
|
30
|
-
|
|
31
|
-
|
|
32
29
|
var _chunkE3UK5IIBcjs = require('./chunk-E3UK5IIB.cjs');
|
|
33
30
|
|
|
34
31
|
|
|
35
32
|
var _chunkUQZ4AYTHcjs = require('./chunk-UQZ4AYTH.cjs');
|
|
36
33
|
|
|
37
34
|
|
|
35
|
+
var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
|
|
36
|
+
|
|
37
|
+
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
var _chunkOX6O6WVAcjs = require('./chunk-OX6O6WVA.cjs');
|
|
@@ -327,11 +327,11 @@ var _MiddlewareManager = class _MiddlewareManager {
|
|
|
327
327
|
try {
|
|
328
328
|
let module;
|
|
329
329
|
if (this.viteServer) {
|
|
330
|
-
module = await
|
|
330
|
+
module = await _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, this.viteServer, filePath);
|
|
331
331
|
} else {
|
|
332
332
|
module = await import(
|
|
333
333
|
/* @vite-ignore */
|
|
334
|
-
|
|
334
|
+
_chunkSHLXACIOcjs.toFileModuleUrl.call(void 0, filePath)
|
|
335
335
|
);
|
|
336
336
|
}
|
|
337
337
|
const normalized = _chunk3BU22U3Mcjs.normalizeMiddlewareModule.call(void 0, module, routePath);
|