@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
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
DEFAULT_FARM_SERVER_BODY_SIZE_LIMIT,
|
|
16
16
|
bufferFarmRequestBody,
|
|
17
17
|
createFarmRequestBodyErrorResponse
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ZMMBIVQM.mjs";
|
|
19
19
|
import {
|
|
20
20
|
resolveFarmAPICanonicalPathname
|
|
21
21
|
} from "./chunk-BTHHUD7Q.mjs";
|
|
@@ -66,7 +66,7 @@ function mergePluginAPIRoutes(existing, plugins, expected, options = {}) {
|
|
|
66
66
|
endpoints: { ...route.endpoints }
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
const api = createPluginLocalAPI(existing, options.bodySizeLimit);
|
|
69
|
+
const api = createPluginLocalAPI(existing, options.bodySizeLimit, options.dispatch);
|
|
70
70
|
for (const definition of resolvePluginRoutes(plugins, { api })) {
|
|
71
71
|
registerAPIRouteShape(shapes, definition.path, `plugin:${definition.path}`, "app");
|
|
72
72
|
let route = routes.get(definition.path);
|
|
@@ -101,7 +101,18 @@ ${actualSignature || "(none)"}`
|
|
|
101
101
|
return result;
|
|
102
102
|
}
|
|
103
103
|
__name(mergePluginAPIRoutes, "mergePluginAPIRoutes");
|
|
104
|
-
|
|
104
|
+
var DISPATCH_DROPPED_HEADERS = [
|
|
105
|
+
"accept-encoding",
|
|
106
|
+
"connection",
|
|
107
|
+
"content-length",
|
|
108
|
+
"keep-alive",
|
|
109
|
+
"proxy-connection",
|
|
110
|
+
"te",
|
|
111
|
+
"trailer",
|
|
112
|
+
"transfer-encoding",
|
|
113
|
+
"upgrade"
|
|
114
|
+
];
|
|
115
|
+
function createPluginLocalAPI(routes, bodySizeLimit, dispatch) {
|
|
105
116
|
const endpoints = /* @__PURE__ */ new Map();
|
|
106
117
|
for (const route of routes) {
|
|
107
118
|
for (const method of route.methods) {
|
|
@@ -119,8 +130,12 @@ function createPluginLocalAPI(routes, bodySizeLimit) {
|
|
|
119
130
|
}),
|
|
120
131
|
output: endpoint.__output,
|
|
121
132
|
mcp: endpoint.__mcp === true ? true : endpoint.__mcp ? Object.freeze({ ...endpoint.__mcp }) : void 0,
|
|
122
|
-
invoke(request, params = {}) {
|
|
123
|
-
|
|
133
|
+
async invoke(request, params = {}) {
|
|
134
|
+
if (!dispatch)
|
|
135
|
+
return invokeAPIRouteEndpoint(endpoint, request, { ...params }, bodySizeLimit);
|
|
136
|
+
const headers = new Headers(request.headers);
|
|
137
|
+
for (const name of DISPATCH_DROPPED_HEADERS) headers.delete(name);
|
|
138
|
+
return dispatch(new Request(request, { headers }));
|
|
124
139
|
}
|
|
125
140
|
});
|
|
126
141
|
endpoints.set(`${normalizedMethod} ${route.path}`, descriptor);
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
loadFarmConfigFile,
|
|
18
18
|
resolveFarmLayers
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-BUGNQIHC.mjs";
|
|
20
20
|
import {
|
|
21
21
|
isReactRenderer,
|
|
22
22
|
resolveFarmRenderer
|
|
@@ -25,11 +25,14 @@ import {
|
|
|
25
25
|
farmCspBlocksFrameworkInlineScripts,
|
|
26
26
|
getFarmSecurityHeader,
|
|
27
27
|
resolveFarmAgentCrawlers,
|
|
28
|
-
|
|
28
|
+
resolveFarmAgentSitemap,
|
|
29
29
|
resolveFarmNoindexPreviews,
|
|
30
30
|
resolveFarmPerformanceConfig,
|
|
31
31
|
resolveFarmSecurityConfig
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-4E5WBPEG.mjs";
|
|
33
|
+
import {
|
|
34
|
+
resolveFarmLlmsTxtConfig
|
|
35
|
+
} from "./chunk-DTSROJ5J.mjs";
|
|
33
36
|
import {
|
|
34
37
|
resolveFarmImageConfig
|
|
35
38
|
} from "./chunk-G2KY33I6.mjs";
|
|
@@ -38,7 +41,7 @@ import {
|
|
|
38
41
|
} from "./chunk-YHOCRI4H.mjs";
|
|
39
42
|
import {
|
|
40
43
|
resolveServerActionsConfig
|
|
41
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-4WVJLURN.mjs";
|
|
42
45
|
import {
|
|
43
46
|
resolveEnv,
|
|
44
47
|
setEnv
|
|
@@ -54,16 +57,16 @@ import {
|
|
|
54
57
|
} from "./chunk-SFGWNC43.mjs";
|
|
55
58
|
import {
|
|
56
59
|
resolveWorkflowsConfig
|
|
57
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-Q2KB32T4.mjs";
|
|
58
61
|
import {
|
|
59
62
|
resolveFarmThemeConfig
|
|
60
63
|
} from "./chunk-AELACLOB.mjs";
|
|
61
64
|
import {
|
|
62
65
|
resolveIntegrationPlugins
|
|
63
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-MKYBIIAQ.mjs";
|
|
64
67
|
import {
|
|
65
68
|
resolveFarmServerConfig
|
|
66
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-ZMMBIVQM.mjs";
|
|
67
70
|
import {
|
|
68
71
|
resolveFarmI18nConfig
|
|
69
72
|
} from "./chunk-BCMSYSN2.mjs";
|
|
@@ -139,9 +142,14 @@ function resolveFarmAgentConfig(input, context = {}) {
|
|
|
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
144
|
llmsTxt: resolveFarmLlmsTxtConfig(input?.llmsTxt ?? (context.docs ? false : { full: false })),
|
|
145
|
+
// Same rule as llms.txt: the docs engine answers /sitemap.xml with its own pages.
|
|
146
|
+
sitemap: resolveFarmAgentSitemap(input?.sitemap ?? !context.docs),
|
|
142
147
|
crawlers: resolveFarmAgentCrawlers(input?.crawlers),
|
|
143
148
|
apiCatalog: resolveFarmAgentBoolean(input?.apiCatalog, "apiCatalog", false),
|
|
144
|
-
aiCatalog: resolveFarmAgentBoolean(input?.aiCatalog, "aiCatalog", true)
|
|
149
|
+
aiCatalog: resolveFarmAgentBoolean(input?.aiCatalog, "aiCatalog", true),
|
|
150
|
+
manifest: resolveFarmAgentBoolean(input?.manifest, "manifest", true),
|
|
151
|
+
// Same rule as llms.txt: the docs engine serves its own MCP server at /mcp.
|
|
152
|
+
mcp: resolveFarmAgentBoolean(input?.mcp, "mcp", !context.docs)
|
|
145
153
|
};
|
|
146
154
|
}
|
|
147
155
|
__name(resolveFarmAgentConfig, "resolveFarmAgentConfig");
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunk4WQ6PGSJcjs = require('./chunk-4WQ6PGSJ.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkEUV4YR3Vcjs = require('./chunk-EUV4YR3V.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunk75RZHGLScjs = require('./chunk-75RZHGLS.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
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 (_optionalChain([module, 'optionalAccess', _ => _.__farmRouteGuard])) continue;
|
|
111
|
+
if (!_chunkEUV4YR3Vcjs.isFarmMarkdownMirrorExposed.call(void 0, options.markdown, source.pattern)) continue;
|
|
112
|
+
readable.push({ pattern: source.pattern, metadata: _optionalChain([module, 'optionalAccess', _2 => _2.metadata]) });
|
|
113
|
+
}
|
|
114
|
+
return _chunk4WQ6PGSJcjs.collectFarmLlmsTxtPages.call(void 0, 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}${_chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, page.path, options.basePath)}`,
|
|
122
|
+
...page.description ? { description: page.description } : {},
|
|
123
|
+
markdownUrl: `${options.origin}${_chunkI57LW5VZcjs.applyFarmBasePath.call(void 0,
|
|
124
|
+
_chunkEUV4YR3Vcjs.getFarmMarkdownMirrorPath.call(void 0, page.path),
|
|
125
|
+
options.basePath
|
|
126
|
+
)}`
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, collectFarmDefaultMCPPages, "collectFarmDefaultMCPPages");
|
|
130
|
+
function createFarmDefaultMCPServer(app, farmVersion) {
|
|
131
|
+
const name = typeof _optionalChain([app, 'optionalAccess', _3 => _3.name]) === "string" && app.name.trim() ? app.name.trim() : "farm-app";
|
|
132
|
+
const version = typeof _optionalChain([app, 'optionalAccess', _4 => _4.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
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmDefaultMCPServer, "createFarmDefaultMCPServer");
|
|
142
|
+
function resolveFarmDefaultMCPServer(server) {
|
|
143
|
+
if (!server) return void 0;
|
|
144
|
+
if (_chunk75RZHGLScjs._listFarmMCPCatalogs.call(void 0, ).length > 0 || _chunk75RZHGLScjs._listFarmRegisteredMCPServers.call(void 0, ).length > 0) {
|
|
145
|
+
return void 0;
|
|
146
|
+
}
|
|
147
|
+
return server;
|
|
148
|
+
}
|
|
149
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmDefaultMCPServer, "resolveFarmDefaultMCPServer");
|
|
150
|
+
function isFarmDefaultMCPPathname(pathname, basePath) {
|
|
151
|
+
const path = _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, pathname, basePath);
|
|
152
|
+
return path === FARM_DEFAULT_MCP_PATH || path === `${FARM_DEFAULT_MCP_PATH}/`;
|
|
153
|
+
}
|
|
154
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isFarmDefaultMCPPathname, "isFarmDefaultMCPPathname");
|
|
155
|
+
function farmConfigMountsMCP(config) {
|
|
156
|
+
const { mcp } = config;
|
|
157
|
+
if (isRecord(mcp) && mcp.enabled !== false) return true;
|
|
158
|
+
return Boolean(
|
|
159
|
+
_optionalChain([config, 'access', _5 => _5.plugins, 'optionalAccess', _6 => _6.some, 'call', _7 => _7((plugin) => isRecord(plugin) && plugin.name === "farm:api-mcp")])
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, farmConfigMountsMCP, "farmConfigMountsMCP");
|
|
163
|
+
function isRecord(value) {
|
|
164
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
165
|
+
}
|
|
166
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isRecord, "isRecord");
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
exports.FARM_DEFAULT_MCP_PATH = FARM_DEFAULT_MCP_PATH; exports.FARM_DEFAULT_MCP_PROTOCOL_VERSIONS = FARM_DEFAULT_MCP_PROTOCOL_VERSIONS; exports.FARM_DEFAULT_MCP_DESCRIPTION = FARM_DEFAULT_MCP_DESCRIPTION; exports.FARM_DEFAULT_MCP_TOOLS = FARM_DEFAULT_MCP_TOOLS; exports.collectFarmDefaultMCPPages = collectFarmDefaultMCPPages; exports.createFarmDefaultMCPServer = createFarmDefaultMCPServer; exports.resolveFarmDefaultMCPServer = resolveFarmDefaultMCPServer; exports.isFarmDefaultMCPPathname = isFarmDefaultMCPPathname; exports.farmConfigMountsMCP = farmConfigMountsMCP;
|
|
@@ -15,7 +15,7 @@ var _chunkLSKZMJMPcjs = require('./chunk-LSKZMJMP.cjs');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
|
|
@@ -66,7 +66,7 @@ function mergePluginAPIRoutes(existing, plugins, expected, options = {}) {
|
|
|
66
66
|
endpoints: { ...route.endpoints }
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
const api = createPluginLocalAPI(existing, options.bodySizeLimit);
|
|
69
|
+
const api = createPluginLocalAPI(existing, options.bodySizeLimit, options.dispatch);
|
|
70
70
|
for (const definition of _chunkIWZKTWHZcjs.resolvePluginRoutes.call(void 0, plugins, { api })) {
|
|
71
71
|
_chunkWMAPPDMMcjs.registerAPIRouteShape.call(void 0, shapes, definition.path, `plugin:${definition.path}`, "app");
|
|
72
72
|
let route = routes.get(definition.path);
|
|
@@ -101,7 +101,18 @@ ${actualSignature || "(none)"}`
|
|
|
101
101
|
return result;
|
|
102
102
|
}
|
|
103
103
|
_chunkS3JO3N4Hcjs.__name.call(void 0, mergePluginAPIRoutes, "mergePluginAPIRoutes");
|
|
104
|
-
|
|
104
|
+
var DISPATCH_DROPPED_HEADERS = [
|
|
105
|
+
"accept-encoding",
|
|
106
|
+
"connection",
|
|
107
|
+
"content-length",
|
|
108
|
+
"keep-alive",
|
|
109
|
+
"proxy-connection",
|
|
110
|
+
"te",
|
|
111
|
+
"trailer",
|
|
112
|
+
"transfer-encoding",
|
|
113
|
+
"upgrade"
|
|
114
|
+
];
|
|
115
|
+
function createPluginLocalAPI(routes, bodySizeLimit, dispatch) {
|
|
105
116
|
const endpoints = /* @__PURE__ */ new Map();
|
|
106
117
|
for (const route of routes) {
|
|
107
118
|
for (const method of route.methods) {
|
|
@@ -119,8 +130,12 @@ function createPluginLocalAPI(routes, bodySizeLimit) {
|
|
|
119
130
|
}),
|
|
120
131
|
output: endpoint.__output,
|
|
121
132
|
mcp: endpoint.__mcp === true ? true : endpoint.__mcp ? Object.freeze({ ...endpoint.__mcp }) : void 0,
|
|
122
|
-
invoke(request, params = {}) {
|
|
123
|
-
|
|
133
|
+
async invoke(request, params = {}) {
|
|
134
|
+
if (!dispatch)
|
|
135
|
+
return invokeAPIRouteEndpoint(endpoint, request, { ...params }, bodySizeLimit);
|
|
136
|
+
const headers = new Headers(request.headers);
|
|
137
|
+
for (const name of DISPATCH_DROPPED_HEADERS) headers.delete(name);
|
|
138
|
+
return dispatch(new Request(request, { headers }));
|
|
124
139
|
}
|
|
125
140
|
});
|
|
126
141
|
endpoints.set(`${normalizedMethod} ${route.path}`, descriptor);
|
|
@@ -186,11 +201,11 @@ function isFarmAPIPathname(pathname, serverBasePath = _chunkS3A45T7Fcjs.DEFAULT_
|
|
|
186
201
|
return basePath !== "/" && (pathname === basePath || pathname.startsWith(`${basePath}/`));
|
|
187
202
|
}
|
|
188
203
|
_chunkS3JO3N4Hcjs.__name.call(void 0, isFarmAPIPathname, "isFarmAPIPathname");
|
|
189
|
-
async function invokeAPIRouteEndpoint(endpoint, request, params = {}, bodySizeLimit =
|
|
204
|
+
async function invokeAPIRouteEndpoint(endpoint, request, params = {}, bodySizeLimit = _chunkKIIMAWOJcjs.DEFAULT_FARM_SERVER_BODY_SIZE_LIMIT) {
|
|
190
205
|
try {
|
|
191
|
-
request = await
|
|
206
|
+
request = await _chunkKIIMAWOJcjs.bufferFarmRequestBody.call(void 0, request, bodySizeLimit);
|
|
192
207
|
} catch (error) {
|
|
193
|
-
const response2 =
|
|
208
|
+
const response2 = _chunkKIIMAWOJcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
|
|
194
209
|
if (response2) return response2;
|
|
195
210
|
throw error;
|
|
196
211
|
}
|
|
@@ -9,7 +9,7 @@ var _chunkCMGMGHUZcjs = require('./chunk-CMGMGHUZ.cjs');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
@@ -136,10 +136,10 @@ function createFarmWorkflowRequestHandler(options) {
|
|
|
136
136
|
try {
|
|
137
137
|
payload = await readWorkflowPayload(
|
|
138
138
|
request,
|
|
139
|
-
|
|
139
|
+
_chunkKIIMAWOJcjs.resolveFarmServerConfig.call(void 0, options.server).bodySizeLimit
|
|
140
140
|
);
|
|
141
141
|
} catch (error) {
|
|
142
|
-
const response =
|
|
142
|
+
const response = _chunkKIIMAWOJcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
|
|
143
143
|
if (response) return response;
|
|
144
144
|
if (error instanceof SyntaxError) {
|
|
145
145
|
return Response.json({ error: "Invalid workflow request body." }, { status: 400 });
|
|
@@ -220,7 +220,7 @@ async function prepareFarmWorkflowsForNitro(config) {
|
|
|
220
220
|
createNitroWorkflowHTTPHandler(
|
|
221
221
|
workflowConfig,
|
|
222
222
|
workflows,
|
|
223
|
-
|
|
223
|
+
_chunkKIIMAWOJcjs.resolveFarmServerConfig.call(void 0, config.server)
|
|
224
224
|
),
|
|
225
225
|
"utf8"
|
|
226
226
|
);
|
|
@@ -591,7 +591,7 @@ async function readWorkflowPayload(request, bodySizeLimit) {
|
|
|
591
591
|
if (request.method === "GET" || request.method === "HEAD") {
|
|
592
592
|
return _chunkQNPEUFHQcjs.searchParamsToObject.call(void 0, url.searchParams);
|
|
593
593
|
}
|
|
594
|
-
const bytes = await
|
|
594
|
+
const bytes = await _chunkKIIMAWOJcjs.readFarmRequestBody.call(void 0, request, bodySizeLimit);
|
|
595
595
|
const text = new TextDecoder().decode(bytes);
|
|
596
596
|
if (!text) return {};
|
|
597
597
|
const contentType = (request.headers.get("content-type") || "").split(";", 1)[0].trim().toLowerCase();
|
|
@@ -34,15 +34,42 @@ async function loadFarmDevModule(server, id, environmentName = "ssr") {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
_chunkS3JO3N4Hcjs.__name.call(void 0, loadFarmDevModule, "loadFarmDevModule");
|
|
37
|
+
function invalidateFarmDevDependents(server, file, targets, environmentName = "ssr") {
|
|
38
|
+
const environment = server.environments[environmentName];
|
|
39
|
+
const graph = _optionalChain([environment, 'optionalAccess', _6 => _6.moduleGraph]);
|
|
40
|
+
if (!graph || targets.size === 0) return [];
|
|
41
|
+
const posix = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (filePath) => filePath.replace(/\\/g, "/"), "posix");
|
|
42
|
+
const byFile = new Map([...targets].map((target) => [posix(target), target]));
|
|
43
|
+
const reached = /* @__PURE__ */ new Set();
|
|
44
|
+
const seen = /* @__PURE__ */ new Set();
|
|
45
|
+
const queue = [..._nullishCoalesce(graph.getModulesByFile(posix(file)), () => ( []))];
|
|
46
|
+
while (queue.length > 0) {
|
|
47
|
+
const node = queue.pop();
|
|
48
|
+
if (seen.has(node)) continue;
|
|
49
|
+
seen.add(node);
|
|
50
|
+
const target = node.file ? byFile.get(posix(node.file)) : void 0;
|
|
51
|
+
if (target) reached.add(target);
|
|
52
|
+
queue.push(...node.importers);
|
|
53
|
+
}
|
|
54
|
+
if (reached.size === 0) return [];
|
|
55
|
+
const evaluatedModules = _optionalChain([environment, 'access', _7 => _7.runner, 'optionalAccess', _8 => _8.evaluatedModules]);
|
|
56
|
+
for (const node of seen) {
|
|
57
|
+
graph.invalidateModule(node);
|
|
58
|
+
const evaluated = node.id ? _optionalChain([evaluatedModules, 'optionalAccess', _9 => _9.getModuleById, 'call', _10 => _10(node.id)]) : void 0;
|
|
59
|
+
if (evaluated) evaluatedModules.invalidateModule(evaluated);
|
|
60
|
+
}
|
|
61
|
+
return [...reached];
|
|
62
|
+
}
|
|
63
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, invalidateFarmDevDependents, "invalidateFarmDevDependents");
|
|
37
64
|
function invalidateFailedFarmDevModules(server) {
|
|
38
65
|
for (const entry of Object.values(server.environments)) {
|
|
39
66
|
const environment = entry;
|
|
40
67
|
const failures = failedModules.get(environment);
|
|
41
|
-
if (!_optionalChain([failures, 'optionalAccess',
|
|
68
|
+
if (!_optionalChain([failures, 'optionalAccess', _11 => _11.size])) continue;
|
|
42
69
|
const runner = environment.runner;
|
|
43
70
|
for (const [id, failed] of failures) {
|
|
44
71
|
const evaluated = runner.evaluatedModules.getModuleById(id);
|
|
45
|
-
if (_optionalChain([evaluated, 'optionalAccess',
|
|
72
|
+
if (_optionalChain([evaluated, 'optionalAccess', _12 => _12.promise]) !== failed) continue;
|
|
46
73
|
const transformed = environment.moduleGraph.getModuleById(id);
|
|
47
74
|
if (transformed) environment.moduleGraph.invalidateModule(transformed);
|
|
48
75
|
if (evaluated) runner.evaluatedModules.invalidateModule(evaluated);
|
|
@@ -64,4 +91,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, toFileModuleUrl, "toFileModuleUrl");
|
|
|
64
91
|
|
|
65
92
|
|
|
66
93
|
|
|
67
|
-
|
|
94
|
+
|
|
95
|
+
exports.FarmDevEnvironmentError = FarmDevEnvironmentError; exports.loadFarmDevModule = loadFarmDevModule; exports.invalidateFarmDevDependents = invalidateFarmDevDependents; exports.invalidateFailedFarmDevModules = invalidateFailedFarmDevModules; exports.toFileModuleUrl = toFileModuleUrl;
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
matchAPIRouteAtBasePath,
|
|
18
18
|
mergePluginAPIRoutes,
|
|
19
19
|
resolveAPIRouteEndpoint
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-O6I6VWKK.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) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
var _chunkSVRTJOUFcjs = require('./chunk-SVRTJOUF.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -107,7 +107,7 @@ function resolveServerActionsConfig(config) {
|
|
|
107
107
|
const allowedOrigins = (_nullishCoalesce(_optionalChain([config, 'optionalAccess', _ => _.allowedOrigins]), () => ( []))).map(
|
|
108
108
|
(value) => _chunkSVRTJOUFcjs.normalizeAllowedOriginPattern.call(void 0, value, SERVER_ACTION_ALLOWED_ORIGINS_LABEL)
|
|
109
109
|
);
|
|
110
|
-
const bodySizeLimit =
|
|
110
|
+
const bodySizeLimit = _chunkKIIMAWOJcjs.parseBodySizeLimit.call(void 0,
|
|
111
111
|
_nullishCoalesce(_optionalChain([config, 'optionalAccess', _2 => _2.bodySizeLimit]), () => ( DEFAULT_SERVER_ACTION_BODY_SIZE_LIMIT)),
|
|
112
112
|
"serverActions.bodySizeLimit"
|
|
113
113
|
);
|
|
@@ -18,7 +18,7 @@ var _chunkHREOKQWTcjs = require('./chunk-HREOKQWT.cjs');
|
|
|
18
18
|
var _chunkEUV4YR3Vcjs = require('./chunk-EUV4YR3V.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -1947,7 +1947,7 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1947
1947
|
ETag: etag,
|
|
1948
1948
|
"X-Content-Type-Options": "nosniff"
|
|
1949
1949
|
});
|
|
1950
|
-
if (
|
|
1950
|
+
if (_chunkKIIMAWOJcjs.matchesFarmIfNoneMatch.call(void 0, request.headers.get("if-none-match"), etag)) {
|
|
1951
1951
|
return new Response(null, { status: 304, headers });
|
|
1952
1952
|
}
|
|
1953
1953
|
if (request.method === "HEAD") return new Response(null, { status: 200, headers });
|