@farm.js/core 0.1.26 → 0.1.28
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/agent-runtime.d.mts +8 -9
- package/dist/agent-runtime.d.ts +8 -9
- package/dist/api/client.cjs +5 -7
- package/dist/api/client.d.mts +5 -5
- package/dist/api/client.d.ts +5 -5
- package/dist/api/client.mjs +4 -6
- package/dist/api/route-manager.cjs +12 -10
- package/dist/api/route-manager.d.mts +7 -8
- package/dist/api/route-manager.d.ts +7 -8
- package/dist/api/route-manager.mjs +11 -9
- package/dist/api/runtime.cjs +15 -8
- package/dist/api/runtime.d.mts +36 -3
- package/dist/api/runtime.d.ts +36 -3
- package/dist/api/runtime.mjs +14 -7
- package/dist/{api-client-Cx54IR5g.d.mts → api-client-BjMmY8OD.d.mts} +2 -3
- package/dist/{api-client-DykpaKcY.d.ts → api-client-CyFtZFJ4.d.ts} +2 -3
- package/dist/api.cjs +16 -14
- package/dist/api.d.mts +9 -10
- package/dist/api.d.ts +9 -10
- package/dist/api.mjs +16 -14
- package/dist/{app-29vG5tmY.d.mts → app-DSSq6wiN.d.mts} +3 -4
- package/dist/{app-Cx71s_PT.d.ts → app-M8nVWvNU.d.ts} +3 -4
- package/dist/app-markdown.cjs +10 -4
- package/dist/app-markdown.d.mts +9 -10
- package/dist/app-markdown.d.ts +9 -10
- package/dist/app-markdown.mjs +9 -3
- package/dist/cache-invalidation-BD0z_lfu.d.mts +4 -0
- package/dist/cache-invalidation-BD0z_lfu.d.ts +4 -0
- package/dist/cache.cjs +6 -4
- package/dist/cache.d.mts +11 -6
- package/dist/cache.d.ts +11 -6
- package/dist/cache.mjs +7 -5
- package/dist/{chunk-OFKG57MZ.mjs → chunk-2CNBR3EB.mjs} +2 -2
- package/dist/{chunk-JM5GQL4H.mjs → chunk-2DLN6HG4.mjs} +1 -1
- package/dist/{chunk-UUYF3CHN.mjs → chunk-2N5PX3LS.mjs} +2 -2
- package/dist/{chunk-H6G5INWM.cjs → chunk-2SDO73HK.cjs} +14 -156
- package/dist/{chunk-3TQWUUNP.cjs → chunk-3LUF2PE2.cjs} +10 -5
- package/dist/{chunk-SYGGPS4A.mjs → chunk-4IEPYMHF.mjs} +3 -3
- package/dist/{chunk-WD5PNSOB.mjs → chunk-4V7GIE2U.mjs} +6 -4
- package/dist/{chunk-2CT6XUNO.cjs → chunk-55ZY4ZA7.cjs} +4 -4
- package/dist/chunk-5MKEDGLD.cjs +53 -0
- package/dist/{chunk-I7PUUDGY.cjs → chunk-63H6BKXG.cjs} +2 -2
- package/dist/{chunk-FG5H2VCJ.mjs → chunk-6ZCMSZ5U.mjs} +2 -2
- package/dist/{chunk-ZMN3H73H.cjs → chunk-75DYEVXI.cjs} +13 -11
- package/dist/{chunk-QJ4D3UKJ.cjs → chunk-A672WZEG.cjs} +4 -4
- package/dist/{chunk-IXTFU4PL.cjs → chunk-BJPBQNIE.cjs} +14 -14
- package/dist/{chunk-QGG336NI.mjs → chunk-BXFWA23T.mjs} +2 -2
- package/dist/chunk-CNOQY6Z7.mjs +156 -0
- package/dist/{chunk-DW34V5SM.cjs → chunk-CTV2TTNP.cjs} +4 -4
- package/dist/{chunk-OAVTUMJP.cjs → chunk-D4JE5NNV.cjs} +12 -12
- package/dist/{chunk-KLSSO6YD.mjs → chunk-E76XC6ZG.mjs} +2 -2
- package/dist/{chunk-G3HRIVEY.cjs → chunk-ES4B2IXW.cjs} +2 -2
- package/dist/{chunk-W2HZKYES.cjs → chunk-EWZ3XHKQ.cjs} +2 -2
- package/dist/{chunk-BD2U4ZL6.cjs → chunk-EXLKRR4U.cjs} +10 -10
- package/dist/{chunk-SZ4LYNUX.cjs → chunk-F52CDFJM.cjs} +89 -83
- package/dist/{chunk-ARXCHQLX.mjs → chunk-FB3H4INL.mjs} +4 -4
- package/dist/{chunk-QPPQHB6X.mjs → chunk-FVCSLZWT.mjs} +19 -13
- package/dist/{chunk-WD4YXVLV.mjs → chunk-GZYH4OER.mjs} +1 -1
- package/dist/{chunk-DX4VKYAJ.cjs → chunk-I26CZYPV.cjs} +6 -4
- package/dist/{chunk-3TQG7CGC.cjs → chunk-ID6OVSLH.cjs} +164 -129
- package/dist/{chunk-F6SJAKFJ.mjs → chunk-IV6CQY7O.mjs} +12 -154
- package/dist/{chunk-6D242YGO.mjs → chunk-JATSG2ZO.mjs} +1 -1
- package/dist/{chunk-U74A3P2P.cjs → chunk-JLRDISQL.cjs} +7 -7
- package/dist/{chunk-H7CJRJ4L.cjs → chunk-JUFRXDTK.cjs} +18 -18
- package/dist/{chunk-OOIL3BWR.mjs → chunk-K3YEZLSY.mjs} +65 -8
- package/dist/{chunk-Y4YWHNKU.cjs → chunk-KH7BN726.cjs} +9 -9
- package/dist/{chunk-WFPRVVF2.cjs → chunk-KOQ555NR.cjs} +22 -14
- package/dist/{chunk-VZWO3XVL.mjs → chunk-KXGDXYUC.mjs} +3 -3
- package/dist/{chunk-3IL5UC5I.cjs → chunk-KZLND3D2.cjs} +2 -2
- package/dist/{chunk-QLXEYIAW.cjs → chunk-MH24QDVJ.cjs} +13 -13
- package/dist/{chunk-TKDY6AJP.mjs → chunk-MKMBQSNQ.mjs} +1 -1
- package/dist/{chunk-OCE65DDM.mjs → chunk-MNUGPHLN.mjs} +1 -1
- package/dist/{chunk-74RZNRY6.mjs → chunk-NVBS5WSZ.mjs} +1 -1
- package/dist/chunk-NYJMY3JA.cjs +156 -0
- package/dist/{chunk-VVJCWBIE.mjs → chunk-O3DTUAX2.mjs} +2 -2
- package/dist/chunk-O6XNAMBV.mjs +53 -0
- package/dist/{chunk-YAOX43YI.cjs → chunk-PZNCMPJF.cjs} +5 -5
- package/dist/{chunk-YMUH2BLR.mjs → chunk-PZPDGOU5.mjs} +14 -6
- package/dist/{chunk-52SH7TKB.mjs → chunk-QG5HNS7P.mjs} +2 -2
- package/dist/{chunk-CEYUWDWA.mjs → chunk-QZCT2CQ4.mjs} +10 -5
- package/dist/{chunk-RAI7NULA.mjs → chunk-REGFZJEJ.mjs} +1 -1
- package/dist/{chunk-QMV4QELL.mjs → chunk-S5GDHOE4.mjs} +4 -2
- package/dist/{chunk-CRQPYWLK.cjs → chunk-SORB3MAR.cjs} +14 -14
- package/dist/{chunk-DU2CASV6.mjs → chunk-T7HQ3I4C.mjs} +1 -1
- package/dist/{chunk-RCYINC4A.cjs → chunk-TII23GJC.cjs} +3 -3
- package/dist/{chunk-PPIW3MH6.mjs → chunk-UX2DD2VK.mjs} +1 -1
- package/dist/{chunk-I4J452B7.cjs → chunk-VHJGDMCG.cjs} +3 -3
- package/dist/{chunk-3WSWXPYM.cjs → chunk-VQXDC5UV.cjs} +4 -4
- package/dist/{chunk-B6ZCT36X.cjs → chunk-WNLBF77X.cjs} +4 -4
- package/dist/{chunk-GDUYXFIS.mjs → chunk-X7WVQMIB.mjs} +4 -4
- package/dist/{chunk-5SPPCN5J.mjs → chunk-XNPDONUH.mjs} +1 -1
- package/dist/{chunk-QIH2HD6H.cjs → chunk-XSPGWQWA.cjs} +86 -29
- package/dist/{chunk-ALIFMS4A.cjs → chunk-Y7GW7J46.cjs} +1 -1
- package/dist/{chunk-L6V3P73N.mjs → chunk-YDQZGSDS.mjs} +5 -5
- package/dist/{chunk-C3VRMB6H.cjs → chunk-ZCU4NZ3M.cjs} +6 -6
- package/dist/{chunk-UXQXGB5A.mjs → chunk-ZRIE4KMG.mjs} +63 -28
- package/dist/{client-plugins-B8RPJnot.d.mts → client-plugins-CgYNY7jF.d.mts} +1656 -1477
- package/dist/{client-plugins-bPBf4haK.d.ts → client-plugins-Fl9Og3yB.d.ts} +1656 -1477
- package/dist/client-plugins.d.mts +8 -9
- package/dist/client-plugins.d.ts +8 -9
- package/dist/client.cjs +12 -13
- package/dist/client.d.mts +10 -11
- package/dist/client.d.ts +10 -11
- package/dist/client.mjs +11 -12
- package/dist/config.d.mts +8 -9
- package/dist/config.d.ts +8 -9
- package/dist/{devtools-5D4ZDRPR.mjs → devtools-3E7ZANMZ.mjs} +7 -4
- package/dist/{devtools-QZJEUOJW.cjs → devtools-5AREISIA.cjs} +8 -5
- package/dist/docs.cjs +10 -7
- package/dist/docs.mjs +9 -6
- package/dist/{endpoint-1zA994xL.d.ts → endpoint-CA-TNX60.d.ts} +1 -1
- package/dist/{endpoint-DAc96i93.d.mts → endpoint-CCHFqyTE.d.mts} +1 -1
- package/dist/index.cjs +58 -55
- package/dist/index.d.mts +17 -18
- package/dist/index.d.ts +17 -18
- package/dist/index.mjs +69 -66
- package/dist/{integration-api-BbaiokCC.d.ts → integration-api-0y4FXJpC.d.mts} +128 -1
- package/dist/{integration-api-BbaiokCC.d.mts → integration-api-BPJo5oXb.d.ts} +128 -1
- package/dist/integrations.d.mts +8 -9
- package/dist/integrations.d.ts +8 -9
- package/dist/internal/app-markdown-runtime.cjs +9 -3
- package/dist/internal/app-markdown-runtime.d.mts +9 -9
- package/dist/internal/app-markdown-runtime.d.ts +9 -9
- package/dist/internal/app-markdown-runtime.mjs +8 -2
- package/dist/internal/build-runtime.cjs +26 -24
- package/dist/internal/build-runtime.d.mts +10 -11
- package/dist/internal/build-runtime.d.ts +10 -11
- package/dist/internal/build-runtime.mjs +25 -23
- package/dist/internal/cli-runtime.cjs +16 -12
- package/dist/internal/cli-runtime.mjs +15 -11
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +5 -1
- package/dist/internal/client-runtime.d.mts +1 -0
- package/dist/internal/client-runtime.d.ts +1 -0
- package/dist/internal/client-runtime.mjs +4 -0
- package/dist/internal/compression-runtime.d.mts +8 -9
- package/dist/internal/compression-runtime.d.ts +8 -9
- package/dist/internal/config-runtime.cjs +8 -5
- package/dist/internal/config-runtime.d.mts +9 -10
- package/dist/internal/config-runtime.d.ts +9 -10
- package/dist/internal/config-runtime.mjs +7 -4
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +20 -16
- package/dist/internal/production-runtime.d.mts +13 -14
- package/dist/internal/production-runtime.d.ts +13 -14
- package/dist/internal/production-runtime.mjs +20 -16
- package/dist/markdown.cjs +8 -2
- package/dist/markdown.d.mts +36 -153
- package/dist/markdown.d.ts +36 -153
- package/dist/markdown.mjs +7 -1
- package/dist/{metadata-C3na4CBj.d.mts → metadata-B0X-qtcQ.d.mts} +1 -1
- package/dist/{metadata-CzBP4Mfp.d.ts → metadata-BdDKgd7K.d.ts} +1 -1
- package/dist/middleware.cjs +4 -4
- package/dist/middleware.d.mts +9 -10
- package/dist/middleware.d.ts +9 -10
- package/dist/middleware.mjs +3 -3
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +10 -11
- package/dist/navigation.d.ts +10 -11
- package/dist/navigation.mjs +4 -4
- package/dist/{nitro-ZKLGOTVY.mjs → nitro-NAKCRVHX.mjs} +4 -3
- package/dist/{nitro-KQDU7CFE.cjs → nitro-VYDZGYFY.cjs} +4 -3
- package/dist/plugin.cjs +26 -21
- package/dist/plugin.d.mts +9 -10
- package/dist/plugin.d.ts +9 -10
- package/dist/plugin.mjs +26 -21
- package/dist/{production-runtime-DP94hPGe.d.mts → production-runtime-BjgFgDIg.d.mts} +1 -1
- package/dist/{production-runtime-CYg4wM4E.d.ts → production-runtime-Dx_qMA3t.d.ts} +1 -1
- package/dist/query/client.cjs +6 -6
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan-Bl6Fzg5z.d.ts → render-plan-B41EWmBb.d.ts} +1 -1
- package/dist/{render-plan-CKAJg0jC.d.mts → render-plan-_1TAWODt.d.mts} +1 -1
- package/dist/renderer-client.cjs +13 -14
- package/dist/renderer-client.d.mts +6 -7
- package/dist/renderer-client.d.ts +6 -7
- package/dist/renderer-client.mjs +6 -7
- package/dist/{request-CrBCcPZZ.d.mts → request-BhE4luLv.d.mts} +1 -1
- package/dist/{request-CR-Bp1Px.d.ts → request-Dbf3G0zM.d.ts} +1 -1
- package/dist/request.d.mts +9 -10
- package/dist/request.d.ts +9 -10
- package/dist/{route-rendering-CZH5FegB.d.ts → route-rendering-Z7PveTZE.d.ts} +1 -1
- package/dist/{route-rendering-C1NAHo-C.d.mts → route-rendering-zzfx_GHf.d.mts} +1 -1
- package/dist/{router-B57eDJ3u.d.mts → router-BatNMsa1.d.mts} +1 -1
- package/dist/{router-Cg_kD3Bd.d.ts → router-DtNRhQl3.d.ts} +1 -1
- package/dist/routes.cjs +6 -5
- package/dist/routes.d.mts +6 -7
- package/dist/routes.d.ts +6 -7
- package/dist/routes.mjs +5 -4
- package/dist/server-fn-client.d.mts +4 -4
- package/dist/server-fn-client.d.ts +4 -4
- package/dist/server-fn.cjs +6 -5
- package/dist/server-fn.d.mts +2 -1
- package/dist/server-fn.d.ts +2 -1
- package/dist/server-fn.mjs +5 -4
- package/dist/server-plugins.d.mts +8 -9
- package/dist/server-plugins.d.ts +8 -9
- package/dist/server-query-client.cjs +5 -7
- package/dist/server-query-client.d.mts +2 -1
- package/dist/server-query-client.d.ts +2 -1
- package/dist/server-query-client.mjs +4 -6
- package/dist/server-query.cjs +7 -6
- package/dist/server-query.d.mts +2 -1
- package/dist/server-query.d.ts +2 -1
- package/dist/server-query.mjs +6 -5
- package/dist/server.cjs +235 -131
- package/dist/server.d.mts +14 -15
- package/dist/server.d.ts +14 -15
- package/dist/server.mjs +222 -118
- package/dist/{spa-router-BstQUO6Q.d.ts → spa-router-BE3bwU-J.d.ts} +2 -2
- package/dist/{spa-router-DTdbuinx.d.mts → spa-router-DQOnHZVj.d.mts} +2 -2
- package/dist/testing.cjs +17 -15
- package/dist/testing.d.mts +7 -8
- package/dist/testing.d.ts +7 -8
- package/dist/testing.mjs +14 -12
- package/dist/{utils-CS3ZLnEJ.d.mts → utils-DLK1ERNl.d.mts} +1 -1
- package/dist/{utils-D3rdsIvM.d.ts → utils-u7ZBSWAK.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +22 -20
- package/dist/vite.d.mts +8 -9
- package/dist/vite.d.ts +8 -9
- package/dist/vite.mjs +21 -19
- package/package.json +1 -1
- package/dist/route-B0XrsrFk.d.mts +0 -128
- package/dist/route-DOEpbyWZ.d.ts +0 -128
- package/dist/{chunk-YOYF2E4U.mjs → chunk-LNZ7JZUS.mjs} +0 -0
- package/dist/{chunk-N4RLRSWW.cjs → chunk-SUIBNSNO.cjs} +0 -0
- package/dist/{chunk-TIKNUAU7.mjs → chunk-VUMAE7NC.mjs} +3 -3
- package/dist/{chunk-WM6HL7E7.cjs → chunk-ZHVYQL3H.cjs} +2 -2
|
@@ -28,7 +28,7 @@ var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _chunk55ZY4ZA7cjs = require('./chunk-55ZY4ZA7.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
var _chunkYFPGHF5Fcjs = require('./chunk-YFPGHF5F.cjs');
|
|
@@ -47,7 +47,7 @@ var _chunkVEKFLAQMcjs = require('./chunk-VEKFLAQM.cjs');
|
|
|
47
47
|
var _chunkOHY2ZWUGcjs = require('./chunk-OHY2ZWUG.cjs');
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
var
|
|
50
|
+
var _chunkXSPGWQWAcjs = require('./chunk-XSPGWQWA.cjs');
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
var _chunkUYIHRDE4cjs = require('./chunk-UYIHRDE4.cjs');
|
|
@@ -129,13 +129,16 @@ async function resolveFarmMCPPlugin(config, options) {
|
|
|
129
129
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmMCPPlugin, "resolveFarmMCPPlugin");
|
|
130
130
|
|
|
131
131
|
// src/agent-config.ts
|
|
132
|
-
|
|
132
|
+
var DEFAULT_JSON_LD = { type: "WebSite" };
|
|
133
|
+
function resolveFarmAgentConfig(input, context = {}) {
|
|
133
134
|
const jsonLd = _optionalChain([input, 'optionalAccess', _ => _.jsonLd]);
|
|
134
135
|
return {
|
|
135
|
-
jsonLd: !jsonLd ? false : jsonLd === true ? {} : jsonLd,
|
|
136
|
-
noindexPreviews:
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
jsonLd: jsonLd === void 0 ? { ...DEFAULT_JSON_LD } : !jsonLd ? false : jsonLd === true ? {} : jsonLd,
|
|
137
|
+
noindexPreviews: _chunk55ZY4ZA7cjs.resolveFarmNoindexPreviews.call(void 0, _optionalChain([input, 'optionalAccess', _2 => _2.noindexPreviews])),
|
|
138
|
+
// The docs engine answers /llms.txt with its own pages; a default here would replace it.
|
|
139
|
+
// llms-full.txt renders every listed page, so it stays opt-in.
|
|
140
|
+
llmsTxt: _chunk55ZY4ZA7cjs.resolveFarmLlmsTxtConfig.call(void 0, _nullishCoalesce(_optionalChain([input, 'optionalAccess', _3 => _3.llmsTxt]), () => ( (context.docs ? false : { full: false })))),
|
|
141
|
+
crawlers: _chunk55ZY4ZA7cjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([input, 'optionalAccess', _4 => _4.crawlers])),
|
|
139
142
|
apiCatalog: resolveFarmApiCatalogEnabled(_optionalChain([input, 'optionalAccess', _5 => _5.apiCatalog]))
|
|
140
143
|
};
|
|
141
144
|
}
|
|
@@ -288,6 +291,10 @@ function hasCustomFarmRouteContext(config) {
|
|
|
288
291
|
return config[FARM_RESOLVED_CUSTOM_CONTEXT] === true;
|
|
289
292
|
}
|
|
290
293
|
_chunkS3JO3N4Hcjs.__name.call(void 0, hasCustomFarmRouteContext, "hasCustomFarmRouteContext");
|
|
294
|
+
function isResolvedFarmConfig(config) {
|
|
295
|
+
return Object.prototype.hasOwnProperty.call(config, FARM_RESOLVED_CUSTOM_CONTEXT);
|
|
296
|
+
}
|
|
297
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isResolvedFarmConfig, "isResolvedFarmConfig");
|
|
291
298
|
function normalizeDeployTarget(target) {
|
|
292
299
|
if (!target) return void 0;
|
|
293
300
|
if (target === "cloudflare-pages" || target === "cloudflare_pages") return "cloudflare";
|
|
@@ -680,9 +687,9 @@ async function resolveConfig(userConfig, mode) {
|
|
|
680
687
|
const routeRules = _chunkQ5B3KJBPcjs.normalizeRouteRules.call(void 0, userConfig.routeRules);
|
|
681
688
|
const routeRuleRedirects = _chunkQ5B3KJBPcjs.routeRulesToRedirects.call(void 0, routeRules);
|
|
682
689
|
const routeRuleHeaders = _chunkQ5B3KJBPcjs.routeRulesToHeaders.call(void 0, routeRules);
|
|
683
|
-
const security =
|
|
684
|
-
const securityHeader =
|
|
685
|
-
if (
|
|
690
|
+
const security = _chunk55ZY4ZA7cjs.resolveFarmSecurityConfig.call(void 0, userConfig.security);
|
|
691
|
+
const securityHeader = _chunk55ZY4ZA7cjs.getFarmSecurityHeader.call(void 0, security);
|
|
692
|
+
if (_chunk55ZY4ZA7cjs.farmCspBlocksFrameworkInlineScripts.call(void 0, security)) {
|
|
686
693
|
_chunk5QIKR7RRcjs.logger.warn(
|
|
687
694
|
"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."
|
|
688
695
|
);
|
|
@@ -691,7 +698,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
691
698
|
const root = userConfig.root || process.cwd();
|
|
692
699
|
const srcDir = userConfig.srcDir || "src";
|
|
693
700
|
const docs = await resolveDocsConfig(userConfig.docs, { root, srcDir });
|
|
694
|
-
const md =
|
|
701
|
+
const md = _chunkXSPGWQWAcjs.resolveMarkdownConfig.call(void 0, userConfig.md);
|
|
695
702
|
const mdx = _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, userConfig.mdx);
|
|
696
703
|
const env = _chunkVEKFLAQMcjs.resolveEnv.call(void 0, userConfig.env, process.env);
|
|
697
704
|
_chunkVEKFLAQMcjs.setEnv.call(void 0, env);
|
|
@@ -765,7 +772,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
765
772
|
ppr: false,
|
|
766
773
|
...userConfig.experimental
|
|
767
774
|
},
|
|
768
|
-
agent: resolveFarmAgentConfig(userConfig.agent),
|
|
775
|
+
agent: resolveFarmAgentConfig(userConfig.agent, { docs: docs.enabled }),
|
|
769
776
|
plugins: [
|
|
770
777
|
..._chunkZ5HIWVDPcjs.resolveIntegrationPlugins.call(void 0, integrations),
|
|
771
778
|
...nativeMCPPlugin ? [nativeMCPPlugin] : [],
|
|
@@ -782,7 +789,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
782
789
|
], "headers"),
|
|
783
790
|
routeRules,
|
|
784
791
|
images: _chunkYFPGHF5Fcjs.resolveFarmImageConfig.call(void 0, userConfig.images),
|
|
785
|
-
performance:
|
|
792
|
+
performance: _chunk55ZY4ZA7cjs.resolveFarmPerformanceConfig.call(void 0, userConfig.performance),
|
|
786
793
|
theme: _chunkOI6CMLWXcjs.resolveFarmThemeConfig.call(void 0, userConfig.theme, basePath),
|
|
787
794
|
publicDir: userConfig.publicDir || "public",
|
|
788
795
|
i18n: _chunkHBTUGXHScjs.resolveFarmI18nConfig.call(void 0, userConfig.i18n, { root, mode, basePath }),
|
|
@@ -886,4 +893,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, loadConfig, "loadConfig");
|
|
|
886
893
|
|
|
887
894
|
|
|
888
895
|
|
|
889
|
-
|
|
896
|
+
|
|
897
|
+
exports.hasCustomFarmRouteContext = hasCustomFarmRouteContext; exports.isResolvedFarmConfig = isResolvedFarmConfig; exports.normalizeDeployTarget = normalizeDeployTarget; exports.getPresetForDeployTarget = getPresetForDeployTarget; exports.getDeployTargetForPreset = getDeployTargetForPreset; exports.getDefaultDeployOutputDir = getDefaultDeployOutputDir; exports.resolveDeployOutputPath = resolveDeployOutputPath; exports.resolveDeployConfig = resolveDeployConfig; exports.resolveMigrationsConfig = resolveMigrationsConfig; exports.resolveDocsConfig = resolveDocsConfig; exports.resolveConfig = resolveConfig; exports.loadConfig = loadConfig;
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "./chunk-IOEH4VWN.mjs";
|
|
7
7
|
import {
|
|
8
8
|
APIRouteConflictError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BXFWA23T.mjs";
|
|
10
10
|
import {
|
|
11
11
|
findProgrammaticRouteFilesInDir
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LNZ7JZUS.mjs";
|
|
13
13
|
import {
|
|
14
14
|
isFarmAPIRouteFileName
|
|
15
15
|
} from "./chunk-CU625VAY.mjs";
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
invokeAPIRouteEndpoint,
|
|
20
20
|
matchAPIRouteAtBasePath,
|
|
21
21
|
resolveAPIRouteEndpoint
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-X7WVQMIB.mjs";
|
|
23
23
|
import {
|
|
24
24
|
isProgrammaticRoutesFileName
|
|
25
25
|
} from "./chunk-EA5K5BKU.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
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 _chunkZHVYQL3Hcjs = require('./chunk-ZHVYQL3H.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkHBTUGXHScjs = require('./chunk-HBTUGXHS.cjs');
|
|
@@ -415,7 +415,7 @@ function farmMiddlewarePlugin(options = {}) {
|
|
|
415
415
|
mode: server.config.mode === "production" ? "production" : "development",
|
|
416
416
|
basePath: _nullishCoalesce(options.basePath, () => ( "/"))
|
|
417
417
|
});
|
|
418
|
-
manager = new (0,
|
|
418
|
+
manager = new (0, _chunkZHVYQL3Hcjs.MiddlewareManager)(
|
|
419
419
|
getMiddlewareAppDirectory(server.config.root, srcDir),
|
|
420
420
|
server,
|
|
421
421
|
void 0,
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkVQXDC5UVcjs = require('./chunk-VQXDC5UV.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkKOQ555NRcjs = require('./chunk-KOQ555NR.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
var _chunk75WGQVQAcjs = require('./chunk-75WGQVQA.cjs');
|
|
@@ -39,7 +39,7 @@ function createFarmDocsAdapterRuntimeConfig(docs, options, moduleConfig) {
|
|
|
39
39
|
...moduleConfig ? { ...moduleConfig, ...docs.configOverrides } : _nullishCoalesce(docs.runtimeConfig, () => ( docs.config)),
|
|
40
40
|
entry: docs.config.entry || docs.entry.replace(/^\/+|\/+$/g, "") || "docs",
|
|
41
41
|
docsPath: docs.entry,
|
|
42
|
-
contentDir:
|
|
42
|
+
contentDir: _chunkVQXDC5UVcjs.resolveFarmDocsContentDir.call(void 0, docs, options)
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmDocsAdapterRuntimeConfig, "createFarmDocsAdapterRuntimeConfig");
|
|
@@ -274,25 +274,25 @@ function getDocsDescription(docs) {
|
|
|
274
274
|
}
|
|
275
275
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getDocsDescription, "getDocsDescription");
|
|
276
276
|
function getLoadedDocsPages(context) {
|
|
277
|
-
return
|
|
277
|
+
return _chunkVQXDC5UVcjs.discoverFarmDocsPages.call(void 0, context.contentDir, context.docs).map((page) => _chunkVQXDC5UVcjs.loadFarmDocsPage.call(void 0, context.contentDir, context.docs, page.slug)).filter((page) => Boolean(page));
|
|
278
278
|
}
|
|
279
279
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getLoadedDocsPages, "getLoadedDocsPages");
|
|
280
280
|
function toDocsSourcePage(page) {
|
|
281
281
|
return {
|
|
282
|
-
...
|
|
282
|
+
..._chunkVQXDC5UVcjs.toFarmDocsMarkdownPage.call(void 0, page),
|
|
283
283
|
sourcePath: page.sourcePath
|
|
284
284
|
};
|
|
285
285
|
}
|
|
286
286
|
_chunkS3JO3N4Hcjs.__name.call(void 0, toDocsSourcePage, "toDocsSourcePage");
|
|
287
287
|
function toDocsSitemapPage(page) {
|
|
288
288
|
return {
|
|
289
|
-
...
|
|
289
|
+
..._chunkVQXDC5UVcjs.toFarmDocsMarkdownPage.call(void 0, page),
|
|
290
290
|
sourcePath: page.sourcePath
|
|
291
291
|
};
|
|
292
292
|
}
|
|
293
293
|
_chunkS3JO3N4Hcjs.__name.call(void 0, toDocsSitemapPage, "toDocsSitemapPage");
|
|
294
294
|
function toDocsLlmsPage(page) {
|
|
295
|
-
return
|
|
295
|
+
return _chunkVQXDC5UVcjs.toFarmDocsMarkdownPage.call(void 0, page);
|
|
296
296
|
}
|
|
297
297
|
_chunkS3JO3N4Hcjs.__name.call(void 0, toDocsLlmsPage, "toDocsLlmsPage");
|
|
298
298
|
function getDocsLlmsOptions(context, request) {
|
|
@@ -386,7 +386,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, renderAgentsDocument, "renderAgentsDocumen
|
|
|
386
386
|
function buildAgentSpec(context, request) {
|
|
387
387
|
const url = new URL(request.url);
|
|
388
388
|
const origin = url.origin;
|
|
389
|
-
const pages =
|
|
389
|
+
const pages = _chunkVQXDC5UVcjs.discoverFarmDocsPages.call(void 0, context.contentDir, context.docs);
|
|
390
390
|
const spec = _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).buildDocsAgentDiscoverySpec(getDocsDiscoveryOptions(context, request));
|
|
391
391
|
const title = getDocsTitle(context.docs);
|
|
392
392
|
return {
|
|
@@ -428,7 +428,7 @@ function buildAgentSpec(context, request) {
|
|
|
428
428
|
}
|
|
429
429
|
_chunkS3JO3N4Hcjs.__name.call(void 0, buildAgentSpec, "buildAgentSpec");
|
|
430
430
|
function buildDiagnostics(context) {
|
|
431
|
-
const pages =
|
|
431
|
+
const pages = _chunkVQXDC5UVcjs.discoverFarmDocsPages.call(void 0, context.contentDir, context.docs);
|
|
432
432
|
const diagnostics = _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).buildDocsDiagnostics(context.docs.config, {
|
|
433
433
|
entry: context.docs.entry,
|
|
434
434
|
mcp: {
|
|
@@ -500,12 +500,12 @@ async function resolveAPIContext(options) {
|
|
|
500
500
|
config: options.config,
|
|
501
501
|
configPath: options.configPath
|
|
502
502
|
}));
|
|
503
|
-
const docs = isResolvedDocsConfig(docsInput) ? docsInput : await
|
|
503
|
+
const docs = isResolvedDocsConfig(docsInput) ? docsInput : await _chunkKOQ555NRcjs.resolveDocsConfig.call(void 0, docsInput, { root, srcDir });
|
|
504
504
|
return {
|
|
505
505
|
root,
|
|
506
506
|
srcDir,
|
|
507
507
|
docs,
|
|
508
|
-
contentDir:
|
|
508
|
+
contentDir: _chunkVQXDC5UVcjs.resolveFarmDocsContentDir.call(void 0, docs, { root, srcDir })
|
|
509
509
|
};
|
|
510
510
|
}
|
|
511
511
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveAPIContext, "resolveAPIContext");
|
|
@@ -568,10 +568,10 @@ async function handleDocsAPIGet(request, context) {
|
|
|
568
568
|
if (format === "markdown" || url.pathname.endsWith(".md")) {
|
|
569
569
|
const pathParam = url.searchParams.get("path") || url.searchParams.get("slug");
|
|
570
570
|
const slug = normalizeDocsApiSlug(_nullishCoalesce(_nullishCoalesce(pathParam, () => ( pathTarget.slug)), () => ( "")), context.docs);
|
|
571
|
-
const page =
|
|
571
|
+
const page = _chunkVQXDC5UVcjs.loadFarmDocsPage.call(void 0, context.contentDir, context.docs, slug);
|
|
572
572
|
if (!page) return text("Docs page not found\n", "text/plain; charset=utf-8", { status: 404 });
|
|
573
573
|
return text(
|
|
574
|
-
_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsMarkdownDocument(
|
|
574
|
+
_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsMarkdownDocument(_chunkVQXDC5UVcjs.toFarmDocsMarkdownPage.call(void 0, page), {
|
|
575
575
|
origin: new URL(request.url).origin,
|
|
576
576
|
llms: getDocsLlmsOptions(context, request),
|
|
577
577
|
sitemap: context.docs.config.sitemap
|
|
@@ -0,0 +1,156 @@
|
|
|
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 _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
|
+
|
|
5
|
+
// src/cache-key.ts
|
|
6
|
+
function createRouteDataCacheKey(key) {
|
|
7
|
+
return createFarmCacheKey(Array.isArray(key) ? key : [key]);
|
|
8
|
+
}
|
|
9
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, createRouteDataCacheKey, "createRouteDataCacheKey");
|
|
10
|
+
function createFarmCacheKey(parts) {
|
|
11
|
+
return stableSerialize(parts);
|
|
12
|
+
}
|
|
13
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmCacheKey, "createFarmCacheKey");
|
|
14
|
+
function getFunctionCacheIdentity(fn) {
|
|
15
|
+
const name = fn.name || "anonymous";
|
|
16
|
+
return `${name}:${hashFunctionSource(String(fn))}`;
|
|
17
|
+
}
|
|
18
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getFunctionCacheIdentity, "getFunctionCacheIdentity");
|
|
19
|
+
function hashFunctionSource(source) {
|
|
20
|
+
let hash = 2166136261;
|
|
21
|
+
for (let index = 0; index < source.length; index++) {
|
|
22
|
+
hash ^= source.charCodeAt(index);
|
|
23
|
+
hash = Math.imul(hash, 16777619);
|
|
24
|
+
}
|
|
25
|
+
return (hash >>> 0).toString(36);
|
|
26
|
+
}
|
|
27
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, hashFunctionSource, "hashFunctionSource");
|
|
28
|
+
function compareCodepoint(a, b) {
|
|
29
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
30
|
+
}
|
|
31
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, compareCodepoint, "compareCodepoint");
|
|
32
|
+
function serializeBinaryBytes(bytes) {
|
|
33
|
+
return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
34
|
+
}
|
|
35
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, serializeBinaryBytes, "serializeBinaryBytes");
|
|
36
|
+
function serializeCanonicalStringEntries(entries, seen) {
|
|
37
|
+
const valuesByKey = /* @__PURE__ */ new Map();
|
|
38
|
+
for (const [key, item] of entries) {
|
|
39
|
+
const values = valuesByKey.get(key);
|
|
40
|
+
if (values) values.push(item);
|
|
41
|
+
else valuesByKey.set(key, [item]);
|
|
42
|
+
}
|
|
43
|
+
return Array.from(valuesByKey.keys()).sort(compareCodepoint).flatMap(
|
|
44
|
+
(key) => valuesByKey.get(key).map((item) => `[${stableSerialize(key, seen)},${stableSerialize(item, seen)}]`)
|
|
45
|
+
).join(",");
|
|
46
|
+
}
|
|
47
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, serializeCanonicalStringEntries, "serializeCanonicalStringEntries");
|
|
48
|
+
function isPlainCacheKeyObject(value) {
|
|
49
|
+
const prototype = Object.getPrototypeOf(value);
|
|
50
|
+
if (prototype === null) return true;
|
|
51
|
+
const constructor = _optionalChain([Object, 'access', _ => _.getOwnPropertyDescriptor, 'call', _2 => _2(prototype, "constructor"), 'optionalAccess', _3 => _3.value]);
|
|
52
|
+
return Object.getPrototypeOf(prototype) === null && typeof constructor === "function" && constructor.name === "Object";
|
|
53
|
+
}
|
|
54
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isPlainCacheKeyObject, "isPlainCacheKeyObject");
|
|
55
|
+
function getCacheKeyValueType(value) {
|
|
56
|
+
const prototype = Object.getPrototypeOf(value);
|
|
57
|
+
const constructor = prototype ? _optionalChain([Object, 'access', _4 => _4.getOwnPropertyDescriptor, 'call', _5 => _5(prototype, "constructor"), 'optionalAccess', _6 => _6.value]) : void 0;
|
|
58
|
+
if (typeof constructor === "function" && constructor.name) {
|
|
59
|
+
return constructor.name;
|
|
60
|
+
}
|
|
61
|
+
return Object.prototype.toString.call(value).slice(8, -1) || "object";
|
|
62
|
+
}
|
|
63
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getCacheKeyValueType, "getCacheKeyValueType");
|
|
64
|
+
function stableSerialize(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
65
|
+
if (value === null) return "null";
|
|
66
|
+
if (value === void 0) return "undefined";
|
|
67
|
+
const valueType = typeof value;
|
|
68
|
+
if (valueType === "string") return JSON.stringify(value);
|
|
69
|
+
if (valueType === "number" || valueType === "boolean" || valueType === "bigint") {
|
|
70
|
+
return `${valueType}:${String(value)}`;
|
|
71
|
+
}
|
|
72
|
+
if (valueType === "symbol") {
|
|
73
|
+
return `symbol:${String(value)}`;
|
|
74
|
+
}
|
|
75
|
+
if (valueType === "function") {
|
|
76
|
+
return `function:${getFunctionCacheIdentity(value)}`;
|
|
77
|
+
}
|
|
78
|
+
if (value instanceof Date) {
|
|
79
|
+
return Number.isNaN(value.getTime()) ? "date:invalid" : `date:${value.toISOString()}`;
|
|
80
|
+
}
|
|
81
|
+
if (value instanceof URL) {
|
|
82
|
+
return `url:${value.toString()}`;
|
|
83
|
+
}
|
|
84
|
+
if (value instanceof RegExp) {
|
|
85
|
+
return `regexp:${value.toString()}`;
|
|
86
|
+
}
|
|
87
|
+
if (value instanceof ArrayBuffer) {
|
|
88
|
+
return `arraybuffer:${serializeBinaryBytes(new Uint8Array(value))}`;
|
|
89
|
+
}
|
|
90
|
+
if (typeof SharedArrayBuffer !== "undefined" && value instanceof SharedArrayBuffer) {
|
|
91
|
+
return `sharedarraybuffer:${serializeBinaryBytes(new Uint8Array(value))}`;
|
|
92
|
+
}
|
|
93
|
+
if (ArrayBuffer.isView(value)) {
|
|
94
|
+
const viewType = Object.prototype.toString.call(value).slice(8, -1);
|
|
95
|
+
const bytes = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
96
|
+
return `binary:${viewType}:${serializeBinaryBytes(bytes)}`;
|
|
97
|
+
}
|
|
98
|
+
if (value && typeof value === "object") {
|
|
99
|
+
if (seen.has(value)) {
|
|
100
|
+
return "[Circular]";
|
|
101
|
+
}
|
|
102
|
+
seen.add(value);
|
|
103
|
+
if (Array.isArray(value)) {
|
|
104
|
+
const items = [];
|
|
105
|
+
for (let index = 0; index < value.length; index++) {
|
|
106
|
+
items.push(
|
|
107
|
+
Object.prototype.hasOwnProperty.call(value, index) ? stableSerialize(value[index], seen) : "[Hole]"
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
seen.delete(value);
|
|
111
|
+
return `[${items.join(",")}]`;
|
|
112
|
+
}
|
|
113
|
+
if (value instanceof Set) {
|
|
114
|
+
const items = Array.from(value, (item) => stableSerialize(item, seen)).sort(compareCodepoint);
|
|
115
|
+
seen.delete(value);
|
|
116
|
+
return `set:[${items.join(",")}]`;
|
|
117
|
+
}
|
|
118
|
+
if (value instanceof Map) {
|
|
119
|
+
const items = Array.from(
|
|
120
|
+
value,
|
|
121
|
+
([key, item]) => `[${stableSerialize(key, seen)},${stableSerialize(item, seen)}]`
|
|
122
|
+
).sort(compareCodepoint);
|
|
123
|
+
seen.delete(value);
|
|
124
|
+
return `map:[${items.join(",")}]`;
|
|
125
|
+
}
|
|
126
|
+
if (value instanceof URLSearchParams) {
|
|
127
|
+
const serialized2 = serializeCanonicalStringEntries(value, seen);
|
|
128
|
+
seen.delete(value);
|
|
129
|
+
return `urlsearchparams:[${serialized2}]`;
|
|
130
|
+
}
|
|
131
|
+
if (value instanceof Headers) {
|
|
132
|
+
const serialized2 = serializeCanonicalStringEntries(value, seen);
|
|
133
|
+
seen.delete(value);
|
|
134
|
+
return `headers:[${serialized2}]`;
|
|
135
|
+
}
|
|
136
|
+
if (!isPlainCacheKeyObject(value)) {
|
|
137
|
+
throw new TypeError(
|
|
138
|
+
`Cache keys do not support ${getCacheKeyValueType(value)} values. Convert the value to an explicit stable string or structured key before caching.`
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
const entries = Object.entries(value).sort(
|
|
142
|
+
([a], [b]) => compareCodepoint(a, b)
|
|
143
|
+
);
|
|
144
|
+
const serialized = entries.map(([key, item]) => `${JSON.stringify(key)}:${stableSerialize(item, seen)}`).join(",");
|
|
145
|
+
seen.delete(value);
|
|
146
|
+
return `{${serialized}}`;
|
|
147
|
+
}
|
|
148
|
+
return String(value);
|
|
149
|
+
}
|
|
150
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, stableSerialize, "stableSerialize");
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
exports.createRouteDataCacheKey = createRouteDataCacheKey; exports.createFarmCacheKey = createFarmCacheKey; exports.getFunctionCacheIdentity = getFunctionCacheIdentity;
|
|
@@ -26,13 +26,13 @@ import {
|
|
|
26
26
|
} from "./chunk-DAATZTKJ.mjs";
|
|
27
27
|
import {
|
|
28
28
|
discoverProgrammaticRoutePaths
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-LNZ7JZUS.mjs";
|
|
30
30
|
import {
|
|
31
31
|
readFarmI18nCatalogs
|
|
32
32
|
} from "./chunk-FV45CKBC.mjs";
|
|
33
33
|
import {
|
|
34
34
|
resolvePluginRoutes
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-4IEPYMHF.mjs";
|
|
36
36
|
import {
|
|
37
37
|
parseRoutePath
|
|
38
38
|
} from "./chunk-KI3MESHB.mjs";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveFarmAPICanonicalPathname,
|
|
3
|
+
resolveFarmAPIServerRoutePath
|
|
4
|
+
} from "./chunk-I6XDAKWQ.mjs";
|
|
5
|
+
import {
|
|
6
|
+
matchAPIRoute
|
|
7
|
+
} from "./chunk-O7BH5O46.mjs";
|
|
8
|
+
import {
|
|
9
|
+
__name
|
|
10
|
+
} from "./chunk-LPEX4YW6.mjs";
|
|
11
|
+
|
|
12
|
+
// src/mcp-catalog.ts
|
|
13
|
+
var CATALOGS = /* @__PURE__ */ Symbol.for("farm.mcp.catalogs");
|
|
14
|
+
function catalogs() {
|
|
15
|
+
const state = globalThis;
|
|
16
|
+
return state[CATALOGS] ?? (state[CATALOGS] = /* @__PURE__ */ new Map());
|
|
17
|
+
}
|
|
18
|
+
__name(catalogs, "catalogs");
|
|
19
|
+
function _publishFarmMCPCatalog(server, tools) {
|
|
20
|
+
const entry = { server, tools };
|
|
21
|
+
catalogs().set(server.path, entry);
|
|
22
|
+
return () => {
|
|
23
|
+
if (catalogs().get(server.path) === entry) catalogs().delete(server.path);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
__name(_publishFarmMCPCatalog, "_publishFarmMCPCatalog");
|
|
27
|
+
function _findFarmMCPEndpointTool(method, pathname, serverBasePath) {
|
|
28
|
+
const upperMethod = method.toUpperCase();
|
|
29
|
+
for (const { server, tools } of catalogs().values()) {
|
|
30
|
+
const routes = /* @__PURE__ */ new Map();
|
|
31
|
+
for (const tool of tools) {
|
|
32
|
+
if (tool.kind === "endpoint" && tool.method === upperMethod) {
|
|
33
|
+
routes.set(tool.path, { path: tool.path, name: tool.name });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (routes.size === 0) continue;
|
|
37
|
+
const canonical = serverBasePath ? resolveFarmAPICanonicalPathname(pathname, serverBasePath) : pathname;
|
|
38
|
+
const match = matchAPIRoute(routes, canonical);
|
|
39
|
+
if (match) {
|
|
40
|
+
return {
|
|
41
|
+
name: match.route.name,
|
|
42
|
+
endpoint: resolveFarmAPIServerRoutePath(server.path, serverBasePath)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
__name(_findFarmMCPEndpointTool, "_findFarmMCPEndpointTool");
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
_publishFarmMCPCatalog,
|
|
52
|
+
_findFarmMCPEndpointTool
|
|
53
|
+
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkVHJGDMCGcjs = require('./chunk-VHJGDMCG.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkWMAPPDMMcjs = require('./chunk-WMAPPDMM.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkTKJZFIMLcjs = require('./chunk-TKJZFIML.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkWPYFSQKKcjs = require('./chunk-WPYFSQKK.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -64,7 +64,7 @@ function mergePluginAPIRoutes(existing, plugins, expected, options = {}) {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
const api = createPluginLocalAPI(existing, options.bodySizeLimit);
|
|
67
|
-
for (const definition of
|
|
67
|
+
for (const definition of _chunkVHJGDMCGcjs.resolvePluginRoutes.call(void 0, plugins, { api })) {
|
|
68
68
|
_chunkWMAPPDMMcjs.registerAPIRouteShape.call(void 0, shapes, definition.path, `plugin:${definition.path}`, "app");
|
|
69
69
|
let route = routes.get(definition.path);
|
|
70
70
|
if (_optionalChain([route, 'optionalAccess', _ => _.methods, 'access', _2 => _2.includes, 'call', _3 => _3(definition.method)])) {
|
|
@@ -256,7 +256,7 @@ async function invokeAPIRouteEndpointInContext(endpoint, request, params) {
|
|
|
256
256
|
invalidations: []
|
|
257
257
|
};
|
|
258
258
|
} catch (error) {
|
|
259
|
-
if (
|
|
259
|
+
if (_chunkVHJGDMCGcjs.isEndpointFailure.call(void 0, error)) {
|
|
260
260
|
return createEndpointFailureResponse(error);
|
|
261
261
|
}
|
|
262
262
|
throw error;
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
resolveFarmNoindexPreviews,
|
|
29
29
|
resolveFarmPerformanceConfig,
|
|
30
30
|
resolveFarmSecurityConfig
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-REGFZJEJ.mjs";
|
|
32
32
|
import {
|
|
33
33
|
resolveFarmImageConfig
|
|
34
34
|
} from "./chunk-G2KY33I6.mjs";
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
} from "./chunk-FA2W42OV.mjs";
|
|
48
48
|
import {
|
|
49
49
|
resolveMarkdownConfig
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-K3YEZLSY.mjs";
|
|
51
51
|
import {
|
|
52
52
|
bundleNodeModule
|
|
53
53
|
} from "./chunk-SFGWNC43.mjs";
|
|
@@ -129,12 +129,15 @@ async function resolveFarmMCPPlugin(config, options) {
|
|
|
129
129
|
__name(resolveFarmMCPPlugin, "resolveFarmMCPPlugin");
|
|
130
130
|
|
|
131
131
|
// src/agent-config.ts
|
|
132
|
-
|
|
132
|
+
var DEFAULT_JSON_LD = { type: "WebSite" };
|
|
133
|
+
function resolveFarmAgentConfig(input, context = {}) {
|
|
133
134
|
const jsonLd = input?.jsonLd;
|
|
134
135
|
return {
|
|
135
|
-
jsonLd: !jsonLd ? false : jsonLd === true ? {} : jsonLd,
|
|
136
|
+
jsonLd: jsonLd === void 0 ? { ...DEFAULT_JSON_LD } : !jsonLd ? false : jsonLd === true ? {} : jsonLd,
|
|
136
137
|
noindexPreviews: resolveFarmNoindexPreviews(input?.noindexPreviews),
|
|
137
|
-
|
|
138
|
+
// The docs engine answers /llms.txt with its own pages; a default here would replace it.
|
|
139
|
+
// llms-full.txt renders every listed page, so it stays opt-in.
|
|
140
|
+
llmsTxt: resolveFarmLlmsTxtConfig(input?.llmsTxt ?? (context.docs ? false : { full: false })),
|
|
138
141
|
crawlers: resolveFarmAgentCrawlers(input?.crawlers),
|
|
139
142
|
apiCatalog: resolveFarmApiCatalogEnabled(input?.apiCatalog)
|
|
140
143
|
};
|
|
@@ -288,6 +291,10 @@ function hasCustomFarmRouteContext(config) {
|
|
|
288
291
|
return config[FARM_RESOLVED_CUSTOM_CONTEXT] === true;
|
|
289
292
|
}
|
|
290
293
|
__name(hasCustomFarmRouteContext, "hasCustomFarmRouteContext");
|
|
294
|
+
function isResolvedFarmConfig(config) {
|
|
295
|
+
return Object.prototype.hasOwnProperty.call(config, FARM_RESOLVED_CUSTOM_CONTEXT);
|
|
296
|
+
}
|
|
297
|
+
__name(isResolvedFarmConfig, "isResolvedFarmConfig");
|
|
291
298
|
function normalizeDeployTarget(target) {
|
|
292
299
|
if (!target) return void 0;
|
|
293
300
|
if (target === "cloudflare-pages" || target === "cloudflare_pages") return "cloudflare";
|
|
@@ -765,7 +772,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
765
772
|
ppr: false,
|
|
766
773
|
...userConfig.experimental
|
|
767
774
|
},
|
|
768
|
-
agent: resolveFarmAgentConfig(userConfig.agent),
|
|
775
|
+
agent: resolveFarmAgentConfig(userConfig.agent, { docs: docs.enabled }),
|
|
769
776
|
plugins: [
|
|
770
777
|
...resolveIntegrationPlugins(integrations),
|
|
771
778
|
...nativeMCPPlugin ? [nativeMCPPlugin] : [],
|
|
@@ -876,6 +883,7 @@ __name(loadConfig, "loadConfig");
|
|
|
876
883
|
|
|
877
884
|
export {
|
|
878
885
|
hasCustomFarmRouteContext,
|
|
886
|
+
isResolvedFarmConfig,
|
|
879
887
|
normalizeDeployTarget,
|
|
880
888
|
getPresetForDeployTarget,
|
|
881
889
|
getDeployTargetForPreset,
|
|
@@ -182,7 +182,10 @@ function renderMetadataHead(metadata, options = {}) {
|
|
|
182
182
|
);
|
|
183
183
|
}
|
|
184
184
|
appendNamedMetaRecord(tags, resolvedMetadata.other);
|
|
185
|
-
appendOpenGraph(tags, resolvedMetadata.openGraph, metadataBase
|
|
185
|
+
appendOpenGraph(tags, resolvedMetadata.openGraph, metadataBase, {
|
|
186
|
+
title: explicitTitle,
|
|
187
|
+
description: resolvedMetadata.description
|
|
188
|
+
});
|
|
186
189
|
appendTwitter(tags, resolvedMetadata.twitter, metadataBase);
|
|
187
190
|
appendVerification(tags, resolvedMetadata.verification);
|
|
188
191
|
if (options.jsonLd) {
|
|
@@ -220,10 +223,12 @@ function mergeNestedMetadata(base, next) {
|
|
|
220
223
|
return next ?? base;
|
|
221
224
|
}
|
|
222
225
|
__name(mergeNestedMetadata, "mergeNestedMetadata");
|
|
223
|
-
function appendOpenGraph(tags,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
226
|
+
function appendOpenGraph(tags, input, metadataBase, page) {
|
|
227
|
+
const description = typeof page.description === "string" ? page.description : void 0;
|
|
228
|
+
if (!isRecord(input) && !page.title && !description) return;
|
|
229
|
+
const openGraph = isRecord(input) ? input : {};
|
|
230
|
+
appendMetaProperty(tags, "og:title", openGraph.title ?? page.title);
|
|
231
|
+
appendMetaProperty(tags, "og:description", openGraph.description ?? description);
|
|
227
232
|
appendMetaProperty(tags, "og:url", resolveMetadataUrl(openGraph.url, metadataBase));
|
|
228
233
|
appendMetaProperty(tags, "og:site_name", openGraph.siteName);
|
|
229
234
|
appendMetaProperty(tags, "og:type", openGraph.type ?? "website");
|