@farm.js/core 0.1.34 → 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/agent-mcp-BVExL8rZ.d.mts +109 -0
- package/dist/agent-mcp-handler-LPJ2CADR.mjs +19 -0
- package/dist/agent-mcp-handler-SJAHFSPI.cjs +19 -0
- package/dist/agent-mcp-luzfXK-P.d.ts +109 -0
- package/dist/agent-runtime.cjs +5 -3
- package/dist/agent-runtime.d.mts +4 -5
- package/dist/agent-runtime.d.ts +4 -5
- package/dist/agent-runtime.mjs +4 -2
- package/dist/api/route-manager.cjs +7 -7
- package/dist/api/route-manager.d.mts +15 -10
- package/dist/api/route-manager.d.ts +15 -10
- package/dist/api/route-manager.mjs +6 -6
- package/dist/api/runtime.cjs +7 -5
- package/dist/api/runtime.d.mts +7 -66
- package/dist/api/runtime.d.ts +7 -66
- package/dist/api/runtime.mjs +7 -5
- package/dist/api.cjs +9 -9
- package/dist/api.d.mts +8 -9
- package/dist/api.d.ts +8 -9
- package/dist/api.mjs +8 -8
- package/dist/{app-q4rmZlXK.d.mts → app-BukwkFIu.d.mts} +52 -12
- package/dist/{app-DgotYGbq.d.ts → app-Yfa2dsFy.d.ts} +52 -12
- package/dist/app-markdown.cjs +6 -6
- package/dist/app-markdown.d.mts +5 -6
- package/dist/app-markdown.d.ts +5 -6
- package/dist/app-markdown.mjs +5 -5
- package/dist/{chunk-XV5DJTBX.mjs → chunk-276VJSM6.mjs} +627 -260
- package/dist/{chunk-36MK5YCW.cjs → chunk-2YTDKNH3.cjs} +547 -240
- package/dist/{chunk-VHANUNEG.mjs → chunk-35GKZR22.mjs} +2 -2
- package/dist/{chunk-LR5QSC2P.mjs → chunk-35WV46VL.mjs} +399 -92
- package/dist/{chunk-UX5S4JEO.cjs → chunk-42NHY7HW.cjs} +57 -7
- package/dist/{chunk-U4PTAHW3.mjs → chunk-4E5AEDKY.mjs} +7 -11
- package/dist/{chunk-NGVORZVZ.mjs → chunk-4E5WBPEG.mjs} +73 -351
- package/dist/{chunk-AQZFOP7S.mjs → chunk-4GLOOWKE.mjs} +5 -5
- package/dist/{chunk-7BT4H4P7.cjs → chunk-4NU4GGTC.cjs} +2 -2
- package/dist/{chunk-AGC75XAE.mjs → chunk-4WCZJQUO.mjs} +55 -5
- package/dist/chunk-4WQ6PGSJ.cjs +367 -0
- package/dist/{chunk-QCFFHV5H.mjs → chunk-4WVJLURN.mjs} +1 -1
- package/dist/chunk-6SJ2KJTA.mjs +314 -0
- package/dist/chunk-75RZHGLS.cjs +135 -0
- package/dist/{chunk-P64MIF5B.cjs → chunk-ADEA7PN3.cjs} +483 -60
- package/dist/{chunk-YQVSHTMR.mjs → chunk-AJQTP4OO.mjs} +1 -1
- package/dist/{chunk-TA5G2HWD.cjs → chunk-AO6RYU5N.cjs} +31 -28
- package/dist/{chunk-MOKLYNHV.cjs → chunk-BO36SELV.cjs} +6 -6
- package/dist/{chunk-7Y6ZNFPX.mjs → chunk-BPOF5U4N.mjs} +17 -7
- package/dist/{chunk-JHWOVJ3M.mjs → chunk-BUGNQIHC.mjs} +5 -0
- package/dist/{chunk-TDFPACVX.cjs → chunk-CBJJH36A.cjs} +50 -25
- package/dist/{chunk-VKNHTSAP.cjs → chunk-CGBDNNSM.cjs} +2 -2
- package/dist/chunk-CI6E3UOH.cjs +314 -0
- package/dist/{chunk-QZCT2CQ4.mjs → chunk-CXEN47J3.mjs} +64 -2
- package/dist/{chunk-ATK2R4CH.cjs → chunk-D227TIEN.cjs} +14 -4
- package/dist/{chunk-QGYRXFU2.cjs → chunk-D2BB47NB.cjs} +8 -8
- package/dist/chunk-DTSROJ5J.mjs +367 -0
- package/dist/{chunk-ODBZYBAB.cjs → chunk-DZ5ZVB2K.cjs} +1 -1
- package/dist/{chunk-ROUTX2E5.cjs → chunk-ECKF2BAM.cjs} +18 -5
- package/dist/{chunk-3LUF2PE2.cjs → chunk-EK4QAEFZ.cjs} +67 -5
- package/dist/{chunk-VVBO3QH7.mjs → chunk-ENLZ4R3Y.mjs} +10 -1
- package/dist/{chunk-XXJU7FCC.cjs → chunk-EUV4YR3V.cjs} +2 -2
- package/dist/{chunk-HR5KPHC2.mjs → chunk-EWET4D2Y.mjs} +1 -1
- package/dist/{chunk-PXKIEXZD.mjs → chunk-F5QO4FNE.mjs} +1 -1
- package/dist/{chunk-MIDIZJZC.cjs → chunk-FO427P6I.cjs} +22 -12
- package/dist/{chunk-AWC4VUZL.cjs → chunk-GQ3Z3IZI.cjs} +14 -14
- package/dist/{chunk-JDPAKVS4.mjs → chunk-GQRWBCWK.mjs} +8 -5
- package/dist/{chunk-75WGQVQA.cjs → chunk-HITLGIAO.cjs} +10 -1
- package/dist/{chunk-WNNYOOIB.mjs → chunk-HOXTWRGB.mjs} +1 -1
- package/dist/{chunk-KROWKCUH.cjs → chunk-JGLC4TO3.cjs} +8 -1
- package/dist/{chunk-QJ3J6MZT.cjs → chunk-JNUWCDTF.cjs} +8 -8
- package/dist/{chunk-BTAG7LI7.cjs → chunk-JZVADIOD.cjs} +2 -2
- package/dist/{chunk-EM6SBQKM.cjs → chunk-KIIMAWOJ.cjs} +37 -2
- package/dist/{chunk-43FMW62B.mjs → chunk-KMTGADN3.mjs} +28 -0
- package/dist/{chunk-GOABMOX3.mjs → chunk-LSZAVSGY.mjs} +468 -45
- package/dist/{chunk-2NQQ5H5G.cjs → chunk-M7MKQXAF.cjs} +2 -1
- package/dist/{chunk-GNSDTTWZ.mjs → chunk-MKYBIIAQ.mjs} +30 -5
- package/dist/{chunk-ZHPHJPQP.cjs → chunk-MRMI32SN.cjs} +88 -366
- package/dist/{chunk-7M52YUMY.cjs → chunk-N2NAS2AM.cjs} +2 -2
- package/dist/{chunk-SJVKK4JE.cjs → chunk-NMHWYWDR.cjs} +1144 -777
- package/dist/chunk-NRDBW4MP.mjs +45 -0
- package/dist/{chunk-657WJNRY.mjs → chunk-O6I6VWKK.mjs} +20 -5
- package/dist/{chunk-O27L4YAA.mjs → chunk-O6WAEAX3.mjs} +2 -2
- package/dist/chunk-OFZUJMCU.mjs +601 -0
- package/dist/{chunk-ZKP7C2B6.mjs → chunk-OHLSEQ57.mjs} +22 -13
- package/dist/{chunk-X242HVD5.mjs → chunk-OO7GXVSR.mjs} +1 -1
- package/dist/chunk-PTZ2TVNE.cjs +178 -0
- package/dist/{chunk-3ATMYLLJ.mjs → chunk-Q2KB32T4.mjs} +1 -1
- package/dist/{chunk-LHODW25H.mjs → chunk-QORUJDIV.mjs} +2 -2
- package/dist/{chunk-UBO4SGH4.mjs → chunk-RHAZ22ZN.mjs} +2 -1
- package/dist/{chunk-G26MUMKL.cjs → chunk-S6VYG6XU.cjs} +23 -8
- package/dist/{chunk-6VVL3MHY.mjs → chunk-SC2WYWPF.mjs} +1 -1
- package/dist/{chunk-MPEYMSCF.cjs → chunk-SDOTRX3V.cjs} +5 -5
- package/dist/{chunk-BMWDEBXO.cjs → chunk-SHLXACIO.cjs} +31 -3
- package/dist/{chunk-LMJ7VRHZ.mjs → chunk-T4OGRVNS.mjs} +13 -3
- package/dist/{chunk-T5CERMEH.cjs → chunk-T5OJPTVN.cjs} +2 -2
- package/dist/{chunk-Z2YLTERK.cjs → chunk-TE2G5ION.cjs} +6 -6
- package/dist/chunk-UH6QN5NL.mjs +178 -0
- package/dist/{chunk-PQDFUSXD.cjs → chunk-UVW64BCB.cjs} +44 -35
- package/dist/{chunk-VCCUOMQN.mjs → chunk-VILIPRS6.mjs} +1 -1
- package/dist/{chunk-A5FGU2WU.cjs → chunk-VQLJWDVW.cjs} +19 -23
- package/dist/{chunk-VPTDD5XF.cjs → chunk-WBKEZXWE.cjs} +5 -0
- package/dist/{chunk-K3F2E6GS.cjs → chunk-WC5UV2HQ.cjs} +2 -2
- package/dist/chunk-WWFTAUFG.cjs +45 -0
- package/dist/{chunk-ZUSJDQ2Q.mjs → chunk-WWIKMBRN.mjs} +1 -1
- package/dist/{chunk-3VSKDFAT.mjs → chunk-WZ77PUAM.mjs} +1 -1
- package/dist/{chunk-CLJYVZAD.mjs → chunk-XCMCS4DA.mjs} +11 -1
- package/dist/{chunk-F6OHXPWR.mjs → chunk-YFILVET3.mjs} +8 -1
- package/dist/{chunk-DZ4DTRJ5.cjs → chunk-YKX5BK66.cjs} +7 -7
- package/dist/chunk-YSLWRWWP.cjs +601 -0
- package/dist/{chunk-LI2LMOLR.mjs → chunk-YWMZUGIS.mjs} +18 -5
- package/dist/chunk-ZLAT2CWY.mjs +135 -0
- package/dist/{chunk-XF7Q24PF.mjs → chunk-ZMMBIVQM.mjs} +35 -0
- package/dist/{chunk-U74I55WB.cjs → chunk-ZWM5KGAA.cjs} +19 -9
- package/dist/{client-plugins-CLObcuCq.d.mts → client-plugins-C3mK9Pol.d.mts} +300 -7
- package/dist/{client-plugins-DZjHC4Mi.d.ts → client-plugins-r1mOtSC1.d.ts} +300 -7
- package/dist/client-plugins.d.mts +4 -5
- package/dist/client-plugins.d.ts +4 -5
- package/dist/client.cjs +5 -5
- package/dist/client.d.mts +8 -9
- package/dist/client.d.ts +8 -9
- package/dist/client.mjs +4 -4
- package/dist/config.d.mts +4 -5
- package/dist/config.d.ts +4 -5
- package/dist/{devtools-RNXCTS4R.mjs → devtools-ERIKFEXX.mjs} +11 -10
- package/dist/{devtools-HU6Y2MNV.cjs → devtools-JZJJY5CK.cjs} +12 -11
- package/dist/docs.cjs +15 -14
- package/dist/docs.d.mts +41 -4
- package/dist/docs.d.ts +41 -4
- package/dist/docs.mjs +14 -13
- package/dist/i18n/client.d.mts +2 -2
- package/dist/i18n/client.d.ts +2 -2
- package/dist/i18n/index.d.mts +3 -3
- package/dist/i18n/index.d.ts +3 -3
- package/dist/i18n/server.d.mts +5 -5
- package/dist/i18n/server.d.ts +5 -5
- 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-a-8Z5kZU.d.mts → index-BJJfLxJo.d.mts} +2 -2
- package/dist/{index-BWVfxIsO.d.ts → index-CwoOP-MW.d.ts} +2 -2
- package/dist/index.cjs +51 -44
- package/dist/index.d.mts +20 -21
- package/dist/index.d.ts +20 -21
- package/dist/index.mjs +50 -43
- package/dist/integrations.cjs +7 -3
- package/dist/integrations.d.mts +4 -5
- package/dist/integrations.d.ts +4 -5
- package/dist/integrations.mjs +6 -2
- package/dist/internal/app-markdown-runtime.cjs +5 -5
- package/dist/internal/app-markdown-runtime.d.mts +5 -6
- package/dist/internal/app-markdown-runtime.d.ts +5 -6
- package/dist/internal/app-markdown-runtime.mjs +4 -4
- package/dist/internal/build-runtime.cjs +32 -30
- package/dist/internal/build-runtime.d.mts +6 -7
- package/dist/internal/build-runtime.d.ts +6 -7
- package/dist/internal/build-runtime.mjs +31 -29
- package/dist/internal/cli-runtime.cjs +17 -16
- package/dist/internal/cli-runtime.mjs +16 -15
- package/dist/internal/client-error-overlay.cjs +6 -6
- package/dist/internal/client-error-overlay.mjs +2 -2
- package/dist/internal/client-runtime.cjs +2 -2
- package/dist/internal/client-runtime.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +4 -5
- package/dist/internal/compression-runtime.d.ts +4 -5
- package/dist/internal/config-runtime.cjs +12 -11
- package/dist/internal/config-runtime.d.mts +5 -6
- package/dist/internal/config-runtime.d.ts +5 -6
- package/dist/internal/config-runtime.mjs +11 -10
- package/dist/internal/isolated-boundary.cjs +3 -2
- package/dist/internal/isolated-boundary.d.mts +1 -1
- package/dist/internal/isolated-boundary.d.ts +1 -1
- package/dist/internal/isolated-boundary.mjs +2 -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 +63 -25
- package/dist/internal/production-runtime.d.mts +117 -37
- package/dist/internal/production-runtime.d.ts +117 -37
- package/dist/internal/production-runtime.mjs +65 -27
- package/dist/internal/server-tree.cjs +12 -0
- package/dist/internal/server-tree.d.mts +27 -0
- package/dist/internal/server-tree.d.ts +27 -0
- package/dist/internal/server-tree.mjs +12 -0
- package/dist/{layers-BRQF5ETU.mjs → layers-UTB43B7A.mjs} +1 -1
- package/dist/layers-VUWIOFEO.cjs +18 -0
- package/dist/markdown.cjs +4 -4
- package/dist/markdown.d.mts +4 -5
- package/dist/markdown.d.ts +4 -5
- package/dist/markdown.mjs +3 -3
- package/dist/middleware.cjs +7 -7
- package/dist/middleware.d.mts +6 -7
- package/dist/middleware.d.ts +6 -7
- package/dist/middleware.mjs +6 -6
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +7 -8
- package/dist/navigation.d.ts +7 -8
- package/dist/navigation.mjs +4 -4
- package/dist/{nitro-HSAQFXSS.cjs → nitro-7F65EZZS.cjs} +3 -3
- package/dist/{nitro-4XGPNIK4.mjs → nitro-MPZJGPXK.mjs} +2 -2
- package/dist/{observability-BupkiN0m.d.mts → observability-CoXunYhS.d.mts} +4 -3
- package/dist/{observability-BupkiN0m.d.ts → observability-CoXunYhS.d.ts} +4 -3
- package/dist/observability.d.mts +1 -1
- package/dist/observability.d.ts +1 -1
- package/dist/plugin.cjs +28 -26
- package/dist/plugin.d.mts +4 -5
- package/dist/plugin.d.ts +4 -5
- package/dist/plugin.mjs +27 -25
- package/dist/{production-runtime-CysZl3EV.d.mts → production-runtime-CCeVZXst.d.mts} +4 -4
- package/dist/{production-runtime-BU5ETAK9.d.ts → production-runtime-DPnsggY3.d.ts} +4 -4
- package/dist/query/client.cjs +6 -6
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan-CKr4ltOd.d.mts → render-plan-BuGaPFe6.d.mts} +1 -1
- package/dist/{render-plan-D72O1qm4.d.ts → render-plan-Cw4f5E_R.d.ts} +1 -1
- package/dist/renderer/react/server.cjs +10 -4
- package/dist/renderer/react/server.d.mts +2 -1
- package/dist/renderer/react/server.d.ts +2 -1
- package/dist/renderer/react/server.mjs +7 -1
- package/dist/renderer-client.cjs +5 -5
- package/dist/renderer-client.d.mts +6 -7
- package/dist/renderer-client.d.ts +6 -7
- package/dist/renderer-client.mjs +2 -2
- package/dist/renderer.d.mts +2 -0
- package/dist/renderer.d.ts +2 -0
- package/dist/{request-DbyOYI2j.d.ts → request-Bkg-hERy.d.ts} +1 -1
- package/dist/{request-Be83WafN.d.mts → request-CsGARcAw.d.mts} +1 -1
- package/dist/request.d.mts +5 -6
- package/dist/request.d.ts +5 -6
- package/dist/{resolver-PPEeiJ6M.d.ts → resolver-DadfRL6F.d.ts} +1 -1
- package/dist/{resolver-DhW0CqZN.d.mts → resolver-khasx3fU.d.mts} +1 -1
- package/dist/{route-rendering-CtVMpV-k.d.ts → route-rendering-BUZMH_64.d.ts} +1 -1
- package/dist/{route-rendering-BG56SzvJ.d.mts → route-rendering-f11yh5dp.d.mts} +1 -1
- package/dist/{router-D94-SDlW.d.ts → router-B8CR9GbD.d.ts} +1 -1
- package/dist/{router-ALUvm8gC.d.mts → router-Cp6yRE8A.d.mts} +1 -1
- package/dist/routes.d.mts +4 -5
- package/dist/routes.d.ts +4 -5
- package/dist/{runtime-BirxPwbZ.d.ts → runtime-BgDQzBiu.d.ts} +2 -2
- package/dist/runtime-CAEv36S_.d.mts +69 -0
- package/dist/runtime-CQVsT330.d.ts +69 -0
- package/dist/{runtime-AOJge4vQ.d.mts → runtime-CV2UCV-5.d.mts} +2 -2
- 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 +5 -6
- package/dist/server-plugins.d.ts +5 -6
- package/dist/server-query.cjs +5 -5
- package/dist/server-query.mjs +4 -4
- package/dist/server.cjs +47 -45
- package/dist/server.d.mts +13 -14
- package/dist/server.d.ts +13 -14
- package/dist/server.mjs +30 -28
- package/dist/{spa-router-CxK3USIz.d.ts → spa-router-BuciWGCZ.d.ts} +3 -3
- package/dist/{spa-router-DbxNRKOB.d.mts → spa-router-DwbqGkGj.d.mts} +3 -3
- package/dist/testing.cjs +9 -9
- package/dist/testing.d.mts +4 -5
- package/dist/testing.d.ts +4 -5
- package/dist/testing.mjs +7 -7
- package/dist/{types-Z0aotQ8w.d.mts → types-CnH8DOqo.d.mts} +1 -1
- package/dist/{types-Z0aotQ8w.d.ts → types-CnH8DOqo.d.ts} +1 -1
- package/dist/{utils-4wVRcpOw.d.mts → utils-B9V0S_yL.d.mts} +1 -1
- package/dist/{utils-311Y8eoK.d.ts → utils-CaoWKtYM.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +28 -26
- package/dist/vite.d.mts +4 -5
- package/dist/vite.d.ts +4 -5
- package/dist/vite.mjs +27 -25
- package/dist/{workflows-CR9ex-gz.d.ts → workflows-jZ4BcdoZ.d.mts} +1 -1
- package/dist/{workflows-CR9ex-gz.d.mts → workflows-jZ4BcdoZ.d.ts} +1 -1
- package/dist/workflows.cjs +3 -3
- package/dist/workflows.d.mts +1 -1
- package/dist/workflows.d.ts +1 -1
- package/dist/workflows.mjs +2 -2
- package/package.json +9 -1
- package/dist/chunk-M64YUMA4.cjs +0 -58
- package/dist/chunk-QLQ32WC4.mjs +0 -58
- package/dist/layers-4PNE2HOY.cjs +0 -18
- package/dist/metadata-2HSU2i_w.d.mts +0 -52
- package/dist/metadata-Cjs8JMRM.d.ts +0 -52
- package/dist/types-DFbjpjXX.d.mts +0 -105
- package/dist/types-DFbjpjXX.d.ts +0 -105
- package/dist/{chunk-2F2ER724.cjs → chunk-BPMATOP2.cjs} +2 -2
- package/dist/{chunk-IHNMMXHV.mjs → chunk-OTC5BDGO.mjs} +3 -3
|
@@ -1,11 +1,9 @@
|
|
|
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
|
+
var _chunk4WQ6PGSJcjs = require('./chunk-4WQ6PGSJ.cjs');
|
|
3
4
|
|
|
4
5
|
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _chunkJ63ZH5OQcjs = require('./chunk-J63ZH5OQ.cjs');
|
|
6
|
+
var _chunkEUV4YR3Vcjs = require('./chunk-EUV4YR3V.cjs');
|
|
9
7
|
|
|
10
8
|
|
|
11
9
|
|
|
@@ -17,344 +15,6 @@ var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
|
|
|
17
15
|
|
|
18
16
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
19
17
|
|
|
20
|
-
// src/llms-txt.ts
|
|
21
|
-
function resolveFarmLlmsTxtConfig(input) {
|
|
22
|
-
if (!input) return { enabled: false, include: [], exclude: [], full: false };
|
|
23
|
-
if (input === true) return { enabled: true, include: [], exclude: [], full: true };
|
|
24
|
-
if (typeof input !== "object") {
|
|
25
|
-
throw new TypeError("agent.llmsTxt must be true, false, or an options object.");
|
|
26
|
-
}
|
|
27
|
-
if (input.enabled === false) return { enabled: false, include: [], exclude: [], full: false };
|
|
28
|
-
for (const key of ["title", "summary", "details"]) {
|
|
29
|
-
if (input[key] !== void 0 && typeof input[key] !== "string") {
|
|
30
|
-
throw new TypeError(`agent.llmsTxt.${key} must be a string.`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
if (input.full !== void 0 && typeof input.full !== "boolean") {
|
|
34
|
-
throw new TypeError("agent.llmsTxt.full must be a boolean.");
|
|
35
|
-
}
|
|
36
|
-
if (input.revalidate !== void 0 && (typeof input.revalidate !== "number" || !Number.isFinite(input.revalidate) || input.revalidate < 0)) {
|
|
37
|
-
throw new TypeError("agent.llmsTxt.revalidate must be a number of seconds.");
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
enabled: true,
|
|
41
|
-
...input.title ? { title: input.title } : {},
|
|
42
|
-
...input.summary ? { summary: input.summary } : {},
|
|
43
|
-
...input.details ? { details: input.details } : {},
|
|
44
|
-
include: resolveRoutePatterns(input.include, "include"),
|
|
45
|
-
exclude: resolveRoutePatterns(input.exclude, "exclude"),
|
|
46
|
-
full: input.full !== false,
|
|
47
|
-
...input.revalidate !== void 0 ? { revalidate: input.revalidate } : {}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmLlmsTxtConfig, "resolveFarmLlmsTxtConfig");
|
|
51
|
-
function resolveRoutePatterns(value, key) {
|
|
52
|
-
if (value === void 0) return [];
|
|
53
|
-
if (!Array.isArray(value)) {
|
|
54
|
-
throw new TypeError(`agent.llmsTxt.${key} must be an array of route patterns.`);
|
|
55
|
-
}
|
|
56
|
-
return value.map((pattern, index) => {
|
|
57
|
-
if (typeof pattern !== "string" || !pattern.startsWith("/")) {
|
|
58
|
-
throw new TypeError(
|
|
59
|
-
`agent.llmsTxt.${key}[${index}] must be a route pattern starting with "/", such as "/docs/[...slug]".`
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
return pattern;
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveRoutePatterns, "resolveRoutePatterns");
|
|
66
|
-
function collectFarmLlmsTxtPages(sources, options) {
|
|
67
|
-
const include = _nullishCoalesce(options.include, () => ( []));
|
|
68
|
-
const exclude = _nullishCoalesce(options.exclude, () => ( []));
|
|
69
|
-
const pages = /* @__PURE__ */ new Map();
|
|
70
|
-
for (const source of sources) {
|
|
71
|
-
const path = source.pattern;
|
|
72
|
-
if (path.includes("[") || pages.has(path)) continue;
|
|
73
|
-
if (include.length && !include.some((pattern) => _chunkXXJU7FCCcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
if (exclude.some((pattern) => _chunkXXJU7FCCcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) continue;
|
|
77
|
-
if (isMetadataNoIndex(source.metadata)) continue;
|
|
78
|
-
const target = _chunkXXJU7FCCcjs.isFarmMarkdownMirrorExposed.call(void 0, options.markdown, path) ? _chunkXXJU7FCCcjs.getFarmMarkdownMirrorPath.call(void 0, path) : path;
|
|
79
|
-
const description = readMetadataString(source.metadata, "description");
|
|
80
|
-
pages.set(path, {
|
|
81
|
-
path,
|
|
82
|
-
title: _nullishCoalesce(readMetadataTitle(source.metadata), () => ( fallbackPageTitle(path))),
|
|
83
|
-
url: `${options.origin}${_chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, target, options.basePath)}`,
|
|
84
|
-
...description ? { description } : {}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
return [...pages.values()].sort((left, right) => left.path.localeCompare(right.path));
|
|
88
|
-
}
|
|
89
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, collectFarmLlmsTxtPages, "collectFarmLlmsTxtPages");
|
|
90
|
-
function isMetadataNoIndex(metadata) {
|
|
91
|
-
if (!metadata || typeof metadata !== "object") return false;
|
|
92
|
-
const robots = metadata.robots;
|
|
93
|
-
if (typeof robots === "string") {
|
|
94
|
-
return robots.split(",").map((directive) => directive.trim().toLowerCase()).some((directive) => directive === "noindex" || directive === "none");
|
|
95
|
-
}
|
|
96
|
-
return Boolean(
|
|
97
|
-
robots && typeof robots === "object" && robots.index === false
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, isMetadataNoIndex, "isMetadataNoIndex");
|
|
101
|
-
function createFarmDefaultLlmsTxt(options) {
|
|
102
|
-
const { config, pages } = options;
|
|
103
|
-
const summary = _nullishCoalesce(config.summary, () => ( readMetadataString(options.rootMetadata, "description")));
|
|
104
|
-
return {
|
|
105
|
-
title: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(config.title, () => ( readMetadataTitle(options.rootMetadata))), () => ( _optionalChain([pages, 'access', _2 => _2.find, 'call', _3 => _3((page) => page.path === "/"), 'optionalAccess', _4 => _4.title]))), () => ( new URL(options.origin).host)),
|
|
106
|
-
...summary ? { summary } : {},
|
|
107
|
-
...config.details ? { details: config.details } : {},
|
|
108
|
-
sections: pages.length ? [
|
|
109
|
-
{
|
|
110
|
-
title: "Pages",
|
|
111
|
-
links: pages.map(({ title, url, description }) => ({
|
|
112
|
-
title,
|
|
113
|
-
url,
|
|
114
|
-
...description ? { description } : {}
|
|
115
|
-
}))
|
|
116
|
-
}
|
|
117
|
-
] : []
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmDefaultLlmsTxt, "createFarmDefaultLlmsTxt");
|
|
121
|
-
function serializeFarmLlmsTxt(value) {
|
|
122
|
-
if (typeof value === "string") {
|
|
123
|
-
if (!value.trim()) throw new TypeError("llms.ts returned an empty llms.txt");
|
|
124
|
-
return value.endsWith("\n") ? value : `${value}
|
|
125
|
-
`;
|
|
126
|
-
}
|
|
127
|
-
if (!isRecord(value)) {
|
|
128
|
-
throw new TypeError("llms.ts must return llms.txt text, an llms.txt object, or a Response");
|
|
129
|
-
}
|
|
130
|
-
const title = requireText(value.title, "llms.ts must return a non-empty title");
|
|
131
|
-
const summary = optionalText(value.summary, "llms.ts summary must be a string");
|
|
132
|
-
const details = optionalText(value.details, "llms.ts details must be a string");
|
|
133
|
-
if (value.sections !== void 0 && !Array.isArray(value.sections)) {
|
|
134
|
-
throw new TypeError("llms.ts sections must be an array");
|
|
135
|
-
}
|
|
136
|
-
const blocks = [`# ${toSingleLine(title)}`];
|
|
137
|
-
if (_optionalChain([summary, 'optionalAccess', _5 => _5.trim, 'call', _6 => _6()])) blocks.push(`> ${toSingleLine(summary)}`);
|
|
138
|
-
if (_optionalChain([details, 'optionalAccess', _7 => _7.trim, 'call', _8 => _8()])) blocks.push(details.trim());
|
|
139
|
-
for (const [sectionIndex, section] of (_nullishCoalesce(value.sections, () => ( []))).entries()) {
|
|
140
|
-
if (!isRecord(section)) {
|
|
141
|
-
throw new TypeError(`llms.ts section ${sectionIndex} must be an object`);
|
|
142
|
-
}
|
|
143
|
-
const sectionTitle = requireText(
|
|
144
|
-
section.title,
|
|
145
|
-
`llms.ts section ${sectionIndex} must include a non-empty title`
|
|
146
|
-
);
|
|
147
|
-
if (!Array.isArray(section.links)) {
|
|
148
|
-
throw new TypeError(`llms.ts section "${sectionTitle}" must include a links array`);
|
|
149
|
-
}
|
|
150
|
-
const links = section.links.map((link, linkIndex) => {
|
|
151
|
-
const where = `llms.ts section "${sectionTitle}" link ${linkIndex}`;
|
|
152
|
-
if (!isRecord(link)) throw new TypeError(`${where} must be an object`);
|
|
153
|
-
const linkTitle = requireText(link.title, `${where} must include a non-empty title`);
|
|
154
|
-
const url = requireText(link.url, `${where} must include a non-empty url`);
|
|
155
|
-
const description = optionalText(link.description, `${where} description must be a string`);
|
|
156
|
-
return `- [${escapeLinkText(linkTitle)}](${escapeLinkUrl(url)})${_optionalChain([description, 'optionalAccess', _9 => _9.trim, 'call', _10 => _10()]) ? `: ${toSingleLine(description)}` : ""}`;
|
|
157
|
-
});
|
|
158
|
-
blocks.push(`## ${toSingleLine(sectionTitle)}`, links.join("\n"));
|
|
159
|
-
}
|
|
160
|
-
return `${blocks.filter(Boolean).join("\n\n")}
|
|
161
|
-
`;
|
|
162
|
-
}
|
|
163
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, serializeFarmLlmsTxt, "serializeFarmLlmsTxt");
|
|
164
|
-
function createFarmLlmsMarkdownReader(fetchMarkdown) {
|
|
165
|
-
return async (url) => {
|
|
166
|
-
try {
|
|
167
|
-
const response = await fetchMarkdown(
|
|
168
|
-
new Request(url, {
|
|
169
|
-
headers: { accept: "text/markdown", [_chunkJ63ZH5OQcjs.FARM_INTERNAL_READ_HEADER]: "llms-full" }
|
|
170
|
-
})
|
|
171
|
-
);
|
|
172
|
-
const type = _nullishCoalesce(response.headers.get("content-type"), () => ( ""));
|
|
173
|
-
if (!response.ok || !type.toLowerCase().startsWith("text/markdown")) {
|
|
174
|
-
await _optionalChain([response, 'access', _11 => _11.body, 'optionalAccess', _12 => _12.cancel, 'call', _13 => _13()]);
|
|
175
|
-
return null;
|
|
176
|
-
}
|
|
177
|
-
return await response.text();
|
|
178
|
-
} catch (e) {
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmLlmsMarkdownReader, "createFarmLlmsMarkdownReader");
|
|
184
|
-
var FARM_LLMS_FULL_PAGE_TIMEOUT_MS = 3e4;
|
|
185
|
-
var LLMS_PAGE_TIMED_OUT = /* @__PURE__ */ Symbol("farm.llms.pageTimedOut");
|
|
186
|
-
async function renderFarmLlmsFullTxt(value, options) {
|
|
187
|
-
const index = serializeFarmLlmsTxt(value);
|
|
188
|
-
if (typeof value === "string") return index;
|
|
189
|
-
const llms = value;
|
|
190
|
-
const links = [];
|
|
191
|
-
const seen = /* @__PURE__ */ new Set();
|
|
192
|
-
for (const section of _nullishCoalesce(llms.sections, () => ( []))) {
|
|
193
|
-
for (const link of section.links) {
|
|
194
|
-
if (seen.has(link.url)) continue;
|
|
195
|
-
seen.add(link.url);
|
|
196
|
-
links.push(link);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
const pageTimeout = _nullishCoalesce(options.pageTimeout, () => ( FARM_LLMS_FULL_PAGE_TIMEOUT_MS));
|
|
200
|
-
const readWithinTimeout = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (url) => {
|
|
201
|
-
let timer;
|
|
202
|
-
const timedOut = new Promise((resolve) => {
|
|
203
|
-
timer = setTimeout(resolve, pageTimeout, LLMS_PAGE_TIMED_OUT);
|
|
204
|
-
});
|
|
205
|
-
try {
|
|
206
|
-
const content = await Promise.race([options.readMarkdown(url), timedOut]);
|
|
207
|
-
if (content !== LLMS_PAGE_TIMED_OUT) return content;
|
|
208
|
-
_optionalChain([options, 'access', _14 => _14.onIncomplete, 'optionalCall', _15 => _15()]);
|
|
209
|
-
return null;
|
|
210
|
-
} finally {
|
|
211
|
-
clearTimeout(timer);
|
|
212
|
-
}
|
|
213
|
-
}, "readWithinTimeout");
|
|
214
|
-
const contents = await mapWithConcurrency(
|
|
215
|
-
links,
|
|
216
|
-
_nullishCoalesce(options.concurrency, () => ( 4)),
|
|
217
|
-
(link) => shouldInlineLlmsLink(link.url, options.origin) ? readWithinTimeout(link.url) : null
|
|
218
|
-
);
|
|
219
|
-
const blocks = [`# ${toSingleLine(llms.title)}`];
|
|
220
|
-
if (_optionalChain([llms, 'access', _16 => _16.summary, 'optionalAccess', _17 => _17.trim, 'call', _18 => _18()])) blocks.push(`> ${toSingleLine(llms.summary)}`);
|
|
221
|
-
if (_optionalChain([llms, 'access', _19 => _19.details, 'optionalAccess', _20 => _20.trim, 'call', _21 => _21()])) blocks.push(llms.details.trim());
|
|
222
|
-
const pages = links.map((link, index2) => {
|
|
223
|
-
const parts = [`## ${toSingleLine(link.title)}`, `URL: ${escapeLinkUrl(link.url)}`];
|
|
224
|
-
if (_optionalChain([link, 'access', _22 => _22.description, 'optionalAccess', _23 => _23.trim, 'call', _24 => _24()])) parts.push(toSingleLine(link.description));
|
|
225
|
-
const content = stripFrontmatter(_nullishCoalesce(contents[index2], () => ( ""))).trim();
|
|
226
|
-
if (content) parts.push(content);
|
|
227
|
-
return parts.join("\n\n");
|
|
228
|
-
});
|
|
229
|
-
if (pages.length) blocks.push(pages.join("\n\n---\n\n"));
|
|
230
|
-
return `${blocks.join("\n\n")}
|
|
231
|
-
`;
|
|
232
|
-
}
|
|
233
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, renderFarmLlmsFullTxt, "renderFarmLlmsFullTxt");
|
|
234
|
-
function createFarmLlmsFullRenderer(options = {}) {
|
|
235
|
-
const now = _nullishCoalesce(options.now, () => ( Date.now));
|
|
236
|
-
const ttl = (_nullishCoalesce(options.revalidate, () => ( 0))) * 1e3;
|
|
237
|
-
const maxEntries = _nullishCoalesce(options.maxEntries, () => ( 16));
|
|
238
|
-
const entries = /* @__PURE__ */ new Map();
|
|
239
|
-
let queue = Promise.resolve();
|
|
240
|
-
const settle = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (body, complete, onSettled) => onSettled ? body.then((value) => (onSettled(complete()), value)) : body, "settle");
|
|
241
|
-
return (origin, render, onSettled) => {
|
|
242
|
-
const entry = entries.get(origin);
|
|
243
|
-
if (entry && entry.expires > now()) return settle(entry.body, entry.complete, onSettled);
|
|
244
|
-
entries.delete(origin);
|
|
245
|
-
let complete = true;
|
|
246
|
-
const body = queue.then(
|
|
247
|
-
() => render({
|
|
248
|
-
incomplete: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => {
|
|
249
|
-
complete = false;
|
|
250
|
-
}, "incomplete")
|
|
251
|
-
})
|
|
252
|
-
);
|
|
253
|
-
queue = body.catch(() => {
|
|
254
|
-
});
|
|
255
|
-
const pending = { body, expires: Number.POSITIVE_INFINITY, complete: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => complete, "complete") };
|
|
256
|
-
entries.set(origin, pending);
|
|
257
|
-
if (entries.size > maxEntries) entries.delete(entries.keys().next().value);
|
|
258
|
-
body.then(
|
|
259
|
-
() => {
|
|
260
|
-
if (entries.get(origin) !== pending) return;
|
|
261
|
-
if (ttl > 0 && complete) pending.expires = now() + ttl;
|
|
262
|
-
else entries.delete(origin);
|
|
263
|
-
},
|
|
264
|
-
() => {
|
|
265
|
-
if (entries.get(origin) === pending) entries.delete(origin);
|
|
266
|
-
}
|
|
267
|
-
);
|
|
268
|
-
return settle(body, pending.complete, onSettled);
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmLlmsFullRenderer, "createFarmLlmsFullRenderer");
|
|
272
|
-
function stripFrontmatter(markdown) {
|
|
273
|
-
const match = /^\uFEFF?---\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/.exec(markdown);
|
|
274
|
-
return match ? markdown.slice(match[0].length) : markdown;
|
|
275
|
-
}
|
|
276
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, stripFrontmatter, "stripFrontmatter");
|
|
277
|
-
function shouldInlineLlmsLink(url, origin) {
|
|
278
|
-
let target;
|
|
279
|
-
try {
|
|
280
|
-
target = new URL(url, origin);
|
|
281
|
-
} catch (e2) {
|
|
282
|
-
return false;
|
|
283
|
-
}
|
|
284
|
-
return target.origin === origin && !/\/llms(-full)?\.txt$/.test(target.pathname);
|
|
285
|
-
}
|
|
286
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, shouldInlineLlmsLink, "shouldInlineLlmsLink");
|
|
287
|
-
async function mapWithConcurrency(items, limit, run) {
|
|
288
|
-
const results = [];
|
|
289
|
-
let next = 0;
|
|
290
|
-
const worker = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
|
|
291
|
-
while (next < items.length) {
|
|
292
|
-
const index = next++;
|
|
293
|
-
results[index] = await run(items[index]);
|
|
294
|
-
}
|
|
295
|
-
}, "worker");
|
|
296
|
-
await Promise.all(Array.from({ length: Math.min(Math.max(limit, 1), items.length) }, worker));
|
|
297
|
-
return results;
|
|
298
|
-
}
|
|
299
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, mapWithConcurrency, "mapWithConcurrency");
|
|
300
|
-
function readMetadataTitle(metadata) {
|
|
301
|
-
if (!isRecord(metadata)) return void 0;
|
|
302
|
-
const { title } = metadata;
|
|
303
|
-
if (typeof title === "string") return title.trim() || void 0;
|
|
304
|
-
if (isRecord(title)) {
|
|
305
|
-
for (const key of ["absolute", "default"]) {
|
|
306
|
-
const value = title[key];
|
|
307
|
-
if (typeof value === "string" && value.trim()) return value.trim();
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
return void 0;
|
|
311
|
-
}
|
|
312
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, readMetadataTitle, "readMetadataTitle");
|
|
313
|
-
function readMetadataString(metadata, key) {
|
|
314
|
-
if (!isRecord(metadata)) return void 0;
|
|
315
|
-
const value = metadata[key];
|
|
316
|
-
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
317
|
-
}
|
|
318
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, readMetadataString, "readMetadataString");
|
|
319
|
-
function fallbackPageTitle(path) {
|
|
320
|
-
if (path === "/") return "Home";
|
|
321
|
-
const segments = path.split("/").filter(Boolean);
|
|
322
|
-
const segment = _nullishCoalesce(segments[segments.length - 1], () => ( path));
|
|
323
|
-
const words = segment.replace(/[-_]+/g, " ").trim();
|
|
324
|
-
return words ? words[0].toUpperCase() + words.slice(1) : path;
|
|
325
|
-
}
|
|
326
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, fallbackPageTitle, "fallbackPageTitle");
|
|
327
|
-
function toSingleLine(value) {
|
|
328
|
-
return value.replace(/\s+/g, " ").trim();
|
|
329
|
-
}
|
|
330
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, toSingleLine, "toSingleLine");
|
|
331
|
-
function escapeLinkText(value) {
|
|
332
|
-
return toSingleLine(value).replace(/[\\[\]]/g, "\\$&");
|
|
333
|
-
}
|
|
334
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, escapeLinkText, "escapeLinkText");
|
|
335
|
-
function escapeLinkUrl(value) {
|
|
336
|
-
return value.trim().replace(
|
|
337
|
-
/[\s()<>]/g,
|
|
338
|
-
(character) => character === "(" ? "%28" : character === ")" ? "%29" : encodeURIComponent(character)
|
|
339
|
-
);
|
|
340
|
-
}
|
|
341
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, escapeLinkUrl, "escapeLinkUrl");
|
|
342
|
-
function requireText(value, message) {
|
|
343
|
-
if (typeof value !== "string" || !value.trim()) throw new TypeError(message);
|
|
344
|
-
return value;
|
|
345
|
-
}
|
|
346
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, requireText, "requireText");
|
|
347
|
-
function optionalText(value, message) {
|
|
348
|
-
if (value === void 0) return void 0;
|
|
349
|
-
if (typeof value !== "string") throw new TypeError(message);
|
|
350
|
-
return value;
|
|
351
|
-
}
|
|
352
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, optionalText, "optionalText");
|
|
353
|
-
function isRecord(value) {
|
|
354
|
-
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
355
|
-
}
|
|
356
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, isRecord, "isRecord");
|
|
357
|
-
|
|
358
18
|
// src/agent-crawlers.ts
|
|
359
19
|
var FARM_AI_CRAWLERS = {
|
|
360
20
|
search: [
|
|
@@ -452,7 +112,7 @@ function toAbsoluteHttpUrl(value) {
|
|
|
452
112
|
try {
|
|
453
113
|
const url = new URL(String(value));
|
|
454
114
|
return url.protocol === "https:" || url.protocol === "http:" ? url : null;
|
|
455
|
-
} catch (
|
|
115
|
+
} catch (e) {
|
|
456
116
|
return null;
|
|
457
117
|
}
|
|
458
118
|
}
|
|
@@ -485,6 +145,73 @@ function resolveDefaultSitemap(options) {
|
|
|
485
145
|
}
|
|
486
146
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveDefaultSitemap, "resolveDefaultSitemap");
|
|
487
147
|
|
|
148
|
+
// src/agent-sitemap.ts
|
|
149
|
+
function resolveFarmAgentSitemap(input) {
|
|
150
|
+
if (!input) return { enabled: false, include: [], exclude: [] };
|
|
151
|
+
if (input === true) return { enabled: true, include: [], exclude: [] };
|
|
152
|
+
if (typeof input !== "object") {
|
|
153
|
+
throw new TypeError("agent.sitemap must be true, false, or an options object.");
|
|
154
|
+
}
|
|
155
|
+
if (input.enabled === false) return { enabled: false, include: [], exclude: [] };
|
|
156
|
+
return {
|
|
157
|
+
enabled: true,
|
|
158
|
+
include: resolveRoutePatterns(input.include, "include"),
|
|
159
|
+
exclude: resolveRoutePatterns(input.exclude, "exclude")
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmAgentSitemap, "resolveFarmAgentSitemap");
|
|
163
|
+
function resolveRoutePatterns(value, key) {
|
|
164
|
+
if (value === void 0) return [];
|
|
165
|
+
if (!Array.isArray(value)) {
|
|
166
|
+
throw new TypeError(`agent.sitemap.${key} must be an array of route patterns.`);
|
|
167
|
+
}
|
|
168
|
+
return value.map((pattern, index) => {
|
|
169
|
+
if (typeof pattern !== "string" || !pattern.startsWith("/")) {
|
|
170
|
+
throw new TypeError(
|
|
171
|
+
`agent.sitemap.${key}[${index}] must be a route pattern starting with "/", such as "/admin/[...path]".`
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
return pattern;
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveRoutePatterns, "resolveRoutePatterns");
|
|
178
|
+
function createFarmDefaultSitemap(sources, options) {
|
|
179
|
+
const { include, exclude } = options.config;
|
|
180
|
+
const base = _nullishCoalesce(toAbsoluteHttpOrigin(options.metadataBase), () => ( options.origin));
|
|
181
|
+
const entries = /* @__PURE__ */ new Map();
|
|
182
|
+
for (const source of sources) {
|
|
183
|
+
const path = source.pattern;
|
|
184
|
+
if (path.includes("[") || path.includes("(") || entries.has(path)) continue;
|
|
185
|
+
if (include.length && !include.some((pattern) => _chunkEUV4YR3Vcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) {
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
if (exclude.some((pattern) => _chunkEUV4YR3Vcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) continue;
|
|
189
|
+
const module = isRecord(source.module) ? source.module : void 0;
|
|
190
|
+
if (_chunk4WQ6PGSJcjs.isFarmMetadataNoIndex.call(void 0, _optionalChain([module, 'optionalAccess', _2 => _2.metadata]))) continue;
|
|
191
|
+
if (_optionalChain([module, 'optionalAccess', _3 => _3.__farmRouteGuard])) continue;
|
|
192
|
+
entries.set(path, {
|
|
193
|
+
url: new URL(_chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, path, options.basePath), base).href,
|
|
194
|
+
...source.lastModified ? { lastModified: source.lastModified } : {}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
return [...entries.entries()].sort(([left], [right]) => left.localeCompare(right)).map(([, entry]) => entry);
|
|
198
|
+
}
|
|
199
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmDefaultSitemap, "createFarmDefaultSitemap");
|
|
200
|
+
function toAbsoluteHttpOrigin(value) {
|
|
201
|
+
if (typeof value !== "string" && !(value instanceof URL)) return void 0;
|
|
202
|
+
try {
|
|
203
|
+
const url = new URL(String(value));
|
|
204
|
+
return url.protocol === "https:" || url.protocol === "http:" ? url.origin : void 0;
|
|
205
|
+
} catch (e2) {
|
|
206
|
+
return void 0;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, toAbsoluteHttpOrigin, "toAbsoluteHttpOrigin");
|
|
210
|
+
function isRecord(value) {
|
|
211
|
+
return Boolean(value && typeof value === "object");
|
|
212
|
+
}
|
|
213
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isRecord, "isRecord");
|
|
214
|
+
|
|
488
215
|
// src/security.ts
|
|
489
216
|
function resolveFarmSecurityConfig(input) {
|
|
490
217
|
if (input === void 0) return { csp: false };
|
|
@@ -657,7 +384,7 @@ async function applyFarmCspHashesToHtml(html, security) {
|
|
|
657
384
|
_chunkS3JO3N4Hcjs.__name.call(void 0, applyFarmCspHashesToHtml, "applyFarmCspHashesToHtml");
|
|
658
385
|
function applyFarmCspNonceToResponse(response, security) {
|
|
659
386
|
if (!security.csp || !security.csp.nonce) return response;
|
|
660
|
-
if (!_optionalChain([response, 'access',
|
|
387
|
+
if (!_optionalChain([response, 'access', _4 => _4.headers, 'access', _5 => _5.get, 'call', _6 => _6("content-type"), 'optionalAccess', _7 => _7.toLowerCase, 'call', _8 => _8(), 'access', _9 => _9.includes, 'call', _10 => _10("text/html")])) return response;
|
|
661
388
|
const nonce = createFarmCspNonce(security);
|
|
662
389
|
const securityHeader = getFarmSecurityHeader(security, nonce);
|
|
663
390
|
if (!response.body) {
|
|
@@ -879,7 +606,7 @@ var rawTextElements = /* @__PURE__ */ new Map([
|
|
|
879
606
|
["xmp", /<\/xmp(?=[\s/>]|$)/gi]
|
|
880
607
|
]);
|
|
881
608
|
function stampScriptTag(tag, nonce) {
|
|
882
|
-
const opening = _optionalChain([tag, 'access',
|
|
609
|
+
const opening = _optionalChain([tag, 'access', _11 => _11.match, 'call', _12 => _12(/^<script\b/i), 'optionalAccess', _13 => _13[0]]);
|
|
883
610
|
if (!opening) return tag;
|
|
884
611
|
const attributes = stripScriptNonceAttribute(tag).slice(opening.length, -1);
|
|
885
612
|
return `<script nonce="${nonce}"${attributes}>`;
|
|
@@ -935,7 +662,7 @@ function collectFarmInlineScriptContents(html) {
|
|
|
935
662
|
}
|
|
936
663
|
_chunkS3JO3N4Hcjs.__name.call(void 0, collectFarmInlineScriptContents, "collectFarmInlineScriptContents");
|
|
937
664
|
function findScriptTagAttributeRange(tag, expectedName) {
|
|
938
|
-
const opening = _optionalChain([tag, 'access',
|
|
665
|
+
const opening = _optionalChain([tag, 'access', _14 => _14.match, 'call', _15 => _15(/^<script\b/i), 'optionalAccess', _16 => _16[0]]);
|
|
939
666
|
if (!opening) return void 0;
|
|
940
667
|
let offset = opening.length;
|
|
941
668
|
while (offset < tag.length - 1) {
|
|
@@ -965,7 +692,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, findScriptTagAttributeRange, "findScriptTa
|
|
|
965
692
|
function findRawTextEnd(input, tagName, offset = 0) {
|
|
966
693
|
const closing = rawTextElements.get(tagName);
|
|
967
694
|
closing.lastIndex = offset;
|
|
968
|
-
return _nullishCoalesce(_optionalChain([closing, 'access',
|
|
695
|
+
return _nullishCoalesce(_optionalChain([closing, 'access', _17 => _17.exec, 'call', _18 => _18(input), 'optionalAccess', _19 => _19.index]), () => ( -1));
|
|
969
696
|
}
|
|
970
697
|
_chunkS3JO3N4Hcjs.__name.call(void 0, findRawTextEnd, "findRawTextEnd");
|
|
971
698
|
function matchingSuffixLength(input, token) {
|
|
@@ -1011,9 +738,9 @@ var MAX_REPORTED_PRELOAD_WARNINGS = 256;
|
|
|
1011
738
|
function resolveFarmPerformanceConfig(config) {
|
|
1012
739
|
return {
|
|
1013
740
|
preload: {
|
|
1014
|
-
mode: _optionalChain([config, 'optionalAccess',
|
|
1015
|
-
maxImages: normalizeBudget(_optionalChain([config, 'optionalAccess',
|
|
1016
|
-
maxFonts: normalizeBudget(_optionalChain([config, 'optionalAccess',
|
|
741
|
+
mode: _optionalChain([config, 'optionalAccess', _20 => _20.preload, 'optionalAccess', _21 => _21.mode]) === "warn" ? "warn" : "enforce",
|
|
742
|
+
maxImages: normalizeBudget(_optionalChain([config, 'optionalAccess', _22 => _22.preload, 'optionalAccess', _23 => _23.maxImages]), DEFAULT_PRELOAD_CONFIG.maxImages),
|
|
743
|
+
maxFonts: normalizeBudget(_optionalChain([config, 'optionalAccess', _24 => _24.preload, 'optionalAccess', _25 => _25.maxFonts]), DEFAULT_PRELOAD_CONFIG.maxFonts)
|
|
1017
744
|
}
|
|
1018
745
|
};
|
|
1019
746
|
}
|
|
@@ -1027,7 +754,7 @@ function manageFarmHtmlPreloads(html, config) {
|
|
|
1027
754
|
index,
|
|
1028
755
|
kind,
|
|
1029
756
|
href: readHtmlAttribute(element.value, "href"),
|
|
1030
|
-
highPriority: _optionalChain([readHtmlAttribute, 'call',
|
|
757
|
+
highPriority: _optionalChain([readHtmlAttribute, 'call', _26 => _26(element.value, "fetchpriority"), 'optionalAccess', _27 => _27.toLowerCase, 'call', _28 => _28()]) === "high"
|
|
1031
758
|
}
|
|
1032
759
|
] : [];
|
|
1033
760
|
});
|
|
@@ -1051,7 +778,7 @@ function manageFarmLinkHeaderPreloads(value, config) {
|
|
|
1051
778
|
index,
|
|
1052
779
|
kind,
|
|
1053
780
|
href: getLinkHeaderTarget(link),
|
|
1054
|
-
highPriority: _optionalChain([getLinkHeaderParameter, 'call',
|
|
781
|
+
highPriority: _optionalChain([getLinkHeaderParameter, 'call', _29 => _29(link, "fetchpriority"), 'optionalAccess', _30 => _30.toLowerCase, 'call', _31 => _31()]) === "high"
|
|
1055
782
|
}
|
|
1056
783
|
] : [];
|
|
1057
784
|
});
|
|
@@ -1074,7 +801,7 @@ function manageFarmDocumentPreloads(html, linkHeader, config) {
|
|
|
1074
801
|
index,
|
|
1075
802
|
kind,
|
|
1076
803
|
href: readHtmlAttribute(element.value, "href"),
|
|
1077
|
-
highPriority: _optionalChain([readHtmlAttribute, 'call',
|
|
804
|
+
highPriority: _optionalChain([readHtmlAttribute, 'call', _32 => _32(element.value, "fetchpriority"), 'optionalAccess', _33 => _33.toLowerCase, 'call', _34 => _34()]) === "high"
|
|
1078
805
|
});
|
|
1079
806
|
}
|
|
1080
807
|
for (const [index, link] of links.entries()) {
|
|
@@ -1084,7 +811,7 @@ function manageFarmDocumentPreloads(html, linkHeader, config) {
|
|
|
1084
811
|
index: headerOffset + index,
|
|
1085
812
|
kind,
|
|
1086
813
|
href: getLinkHeaderTarget(link),
|
|
1087
|
-
highPriority: _optionalChain([getLinkHeaderParameter, 'call',
|
|
814
|
+
highPriority: _optionalChain([getLinkHeaderParameter, 'call', _35 => _35(link, "fetchpriority"), 'optionalAccess', _36 => _36.toLowerCase, 'call', _37 => _37()]) === "high"
|
|
1088
815
|
});
|
|
1089
816
|
}
|
|
1090
817
|
const budget = selectPreloadsWithinBudget(candidates, config);
|
|
@@ -1165,13 +892,13 @@ function selectPreloadsWithinBudget(candidates, config) {
|
|
|
1165
892
|
}
|
|
1166
893
|
_chunkS3JO3N4Hcjs.__name.call(void 0, selectPreloadsWithinBudget, "selectPreloadsWithinBudget");
|
|
1167
894
|
function getHtmlPreloadKind(link) {
|
|
1168
|
-
const rel = _optionalChain([readHtmlAttribute, 'call',
|
|
895
|
+
const rel = _optionalChain([readHtmlAttribute, 'call', _38 => _38(link, "rel"), 'optionalAccess', _39 => _39.toLowerCase, 'call', _40 => _40(), 'access', _41 => _41.split, 'call', _42 => _42(/\s+/)]) || [];
|
|
1169
896
|
if (!rel.includes("preload")) return void 0;
|
|
1170
897
|
return normalizePreloadKind(readHtmlAttribute(link, "as"));
|
|
1171
898
|
}
|
|
1172
899
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getHtmlPreloadKind, "getHtmlPreloadKind");
|
|
1173
900
|
function getLinkHeaderPreloadKind(link) {
|
|
1174
|
-
const relations = _nullishCoalesce(_optionalChain([getLinkHeaderParameter, 'call',
|
|
901
|
+
const relations = _nullishCoalesce(_optionalChain([getLinkHeaderParameter, 'call', _43 => _43(link, "rel"), 'optionalAccess', _44 => _44.toLowerCase, 'call', _45 => _45(), 'access', _46 => _46.split, 'call', _47 => _47(/\s+/)]), () => ( []));
|
|
1175
902
|
if (!relations.includes("preload")) return void 0;
|
|
1176
903
|
return normalizePreloadKind(getLinkHeaderParameter(link, "as"));
|
|
1177
904
|
}
|
|
@@ -1217,7 +944,7 @@ function splitLinkParameters(value) {
|
|
|
1217
944
|
}
|
|
1218
945
|
_chunkS3JO3N4Hcjs.__name.call(void 0, splitLinkParameters, "splitLinkParameters");
|
|
1219
946
|
function normalizePreloadKind(value) {
|
|
1220
|
-
const normalized = _optionalChain([value, 'optionalAccess',
|
|
947
|
+
const normalized = _optionalChain([value, 'optionalAccess', _48 => _48.toLowerCase, 'call', _49 => _49()]);
|
|
1221
948
|
return normalized === "image" || normalized === "font" ? normalized : void 0;
|
|
1222
949
|
}
|
|
1223
950
|
_chunkS3JO3N4Hcjs.__name.call(void 0, normalizePreloadKind, "normalizePreloadKind");
|
|
@@ -1225,7 +952,7 @@ function readHtmlAttribute(element, name) {
|
|
|
1225
952
|
const match = element.match(
|
|
1226
953
|
new RegExp(`\\s${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`, "i")
|
|
1227
954
|
);
|
|
1228
|
-
return _nullishCoalesce(_nullishCoalesce(_optionalChain([match, 'optionalAccess',
|
|
955
|
+
return _nullishCoalesce(_nullishCoalesce(_optionalChain([match, 'optionalAccess', _50 => _50[1]]), () => ( _optionalChain([match, 'optionalAccess', _51 => _51[2]]))), () => ( _optionalChain([match, 'optionalAccess', _52 => _52[3]])));
|
|
1229
956
|
}
|
|
1230
957
|
_chunkS3JO3N4Hcjs.__name.call(void 0, readHtmlAttribute, "readHtmlAttribute");
|
|
1231
958
|
function findHtmlLinkElements(html) {
|
|
@@ -1249,7 +976,7 @@ function findHtmlLinkElements(html) {
|
|
|
1249
976
|
}
|
|
1250
977
|
rawTextTag.lastIndex = start;
|
|
1251
978
|
const rawText = rawTextTag.exec(lowerHtml);
|
|
1252
|
-
if (_optionalChain([rawText, 'optionalAccess',
|
|
979
|
+
if (_optionalChain([rawText, 'optionalAccess', _53 => _53[1]])) {
|
|
1253
980
|
const openingEnd = findHtmlTagEnd2(html, start);
|
|
1254
981
|
if (openingEnd === -1) break;
|
|
1255
982
|
if (rawText[1] === "svg" && html[openingEnd - 2] === "/") {
|
|
@@ -1394,7 +1121,7 @@ function applyFarmPreviewRobotsTag(response) {
|
|
|
1394
1121
|
try {
|
|
1395
1122
|
response.headers.set("X-Robots-Tag", FARM_PREVIEW_ROBOTS_TAG);
|
|
1396
1123
|
return response;
|
|
1397
|
-
} catch (
|
|
1124
|
+
} catch (e3) {
|
|
1398
1125
|
const headers = new Headers(response.headers);
|
|
1399
1126
|
headers.set("X-Robots-Tag", FARM_PREVIEW_ROBOTS_TAG);
|
|
1400
1127
|
return new Response(response.body, {
|
|
@@ -1427,9 +1154,4 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, applyFarmPreviewRobotsTag, "applyFarmPrevi
|
|
|
1427
1154
|
|
|
1428
1155
|
|
|
1429
1156
|
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
exports.resolveFarmLlmsTxtConfig = resolveFarmLlmsTxtConfig; exports.collectFarmLlmsTxtPages = collectFarmLlmsTxtPages; exports.createFarmDefaultLlmsTxt = createFarmDefaultLlmsTxt; exports.serializeFarmLlmsTxt = serializeFarmLlmsTxt; exports.createFarmLlmsMarkdownReader = createFarmLlmsMarkdownReader; exports.renderFarmLlmsFullTxt = renderFarmLlmsFullTxt; exports.createFarmLlmsFullRenderer = createFarmLlmsFullRenderer; exports.resolveFarmAgentCrawlers = resolveFarmAgentCrawlers; exports.createFarmAgentRobots = createFarmAgentRobots; exports.resolveFarmSecurityConfig = resolveFarmSecurityConfig; exports.getFarmSecurityHeader = getFarmSecurityHeader; exports.createFarmCspNonce = createFarmCspNonce; exports.addFarmCspNonceToScriptTags = addFarmCspNonceToScriptTags; exports.applyFarmCspHashesToHtml = applyFarmCspHashesToHtml; exports.applyFarmCspNonceToResponse = applyFarmCspNonceToResponse; exports.farmCspBlocksFrameworkInlineScripts = farmCspBlocksFrameworkInlineScripts; exports.createFarmCspNonceRewriter = createFarmCspNonceRewriter; exports.resolveFarmPerformanceConfig = resolveFarmPerformanceConfig; exports.manageFarmHtmlPreloads = manageFarmHtmlPreloads; exports.manageFarmLinkHeaderPreloads = manageFarmLinkHeaderPreloads; exports.manageFarmDocumentPreloads = manageFarmDocumentPreloads; exports.reportFarmPreloadWarnings = reportFarmPreloadWarnings; exports.FARM_PREVIEW_ROBOTS_TAG = FARM_PREVIEW_ROBOTS_TAG; exports.resolveFarmNoindexPreviews = resolveFarmNoindexPreviews; exports.applyFarmPreviewRobotsTag = applyFarmPreviewRobotsTag;
|
|
1157
|
+
exports.resolveFarmAgentCrawlers = resolveFarmAgentCrawlers; exports.createFarmAgentRobots = createFarmAgentRobots; exports.resolveFarmAgentSitemap = resolveFarmAgentSitemap; exports.createFarmDefaultSitemap = createFarmDefaultSitemap; exports.resolveFarmSecurityConfig = resolveFarmSecurityConfig; exports.getFarmSecurityHeader = getFarmSecurityHeader; exports.createFarmCspNonce = createFarmCspNonce; exports.addFarmCspNonceToScriptTags = addFarmCspNonceToScriptTags; exports.applyFarmCspHashesToHtml = applyFarmCspHashesToHtml; exports.applyFarmCspNonceToResponse = applyFarmCspNonceToResponse; exports.farmCspBlocksFrameworkInlineScripts = farmCspBlocksFrameworkInlineScripts; exports.createFarmCspNonceRewriter = createFarmCspNonceRewriter; exports.resolveFarmPerformanceConfig = resolveFarmPerformanceConfig; exports.manageFarmHtmlPreloads = manageFarmHtmlPreloads; exports.manageFarmLinkHeaderPreloads = manageFarmLinkHeaderPreloads; exports.manageFarmDocumentPreloads = manageFarmDocumentPreloads; exports.reportFarmPreloadWarnings = reportFarmPreloadWarnings; exports.FARM_PREVIEW_ROBOTS_TAG = FARM_PREVIEW_ROBOTS_TAG; exports.resolveFarmNoindexPreviews = resolveFarmNoindexPreviews; exports.applyFarmPreviewRobotsTag = applyFarmPreviewRobotsTag;
|
|
@@ -27,7 +27,7 @@ var _chunkE2ROOWQCcjs = require('./chunk-E2ROOWQC.cjs');
|
|
|
27
27
|
var _chunkJSROZYYOcjs = require('./chunk-JSROZYYO.cjs');
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _chunkCBJJH36Acjs = require('./chunk-CBJJH36A.cjs');
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -119,7 +119,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, withTimeout, "withTimeout");
|
|
|
119
119
|
var formatSeconds = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (ms) => ms < 1e3 ? `${ms}ms` : `${Number((ms / 1e3).toFixed(1))}s`, "formatSeconds");
|
|
120
120
|
function collectSchemaOwners(config) {
|
|
121
121
|
const owners = [];
|
|
122
|
-
const integrationSchemas =
|
|
122
|
+
const integrationSchemas = _chunkCBJJH36Acjs.getIntegrationSchemas.call(void 0, config.integrations);
|
|
123
123
|
let integrationClient;
|
|
124
124
|
for (const [name, schema] of Object.entries(integrationSchemas)) {
|
|
125
125
|
owners.push({
|