@farm.js/core 0.1.35 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{metadata-BnLDsUOS.d.ts → agent-mcp-BC0bAGVF.d.mts} +45 -2
- package/dist/agent-mcp-handler-LPJ2CADR.mjs +19 -0
- package/dist/agent-mcp-handler-SJAHFSPI.cjs +19 -0
- package/dist/{metadata-WGpBYcGn.d.mts → agent-mcp-jyDHbQKe.d.ts} +45 -2
- package/dist/agent-runtime.cjs +6 -4
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/agent-runtime.mjs +5 -3
- package/dist/api/client.cjs +3 -3
- package/dist/api/client.mjs +2 -2
- package/dist/api/route-manager.cjs +9 -9
- package/dist/api/route-manager.d.mts +10 -4
- package/dist/api/route-manager.d.ts +10 -4
- package/dist/api/route-manager.mjs +8 -8
- package/dist/api/runtime.cjs +6 -6
- package/dist/api/runtime.d.mts +4 -62
- package/dist/api/runtime.d.ts +4 -62
- package/dist/api/runtime.mjs +5 -5
- package/dist/api.cjs +13 -12
- package/dist/api.d.mts +3 -3
- package/dist/api.d.ts +3 -3
- package/dist/api.mjs +12 -11
- package/dist/{app-BXB3JZYc.d.ts → app-CKO3iN1c.d.ts} +17 -3
- package/dist/{app-D_j9AAVL.d.mts → app-Cbkj9ufe.d.mts} +17 -3
- package/dist/app-markdown.cjs +6 -4
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +5 -3
- package/dist/{chunk-F7JZENPF.cjs → chunk-3A4KGQYI.cjs} +38 -30
- package/dist/{chunk-4MMGO7YW.cjs → chunk-3IP27TCG.cjs} +43 -32
- package/dist/{chunk-FDR64H6B.mjs → chunk-3KGDJLJK.mjs} +41 -2
- package/dist/{chunk-UJD4PHYB.mjs → chunk-4E5WBPEG.mjs} +72 -354
- package/dist/{chunk-KXWRO25S.cjs → chunk-4GPOC4LN.cjs} +3 -3
- package/dist/{chunk-Z2HLU4IX.cjs → chunk-4GWRFP22.cjs} +23 -2
- package/dist/{chunk-4KU5Q7C2.mjs → chunk-4P6ULFMD.mjs} +253 -67
- package/dist/chunk-4WQ6PGSJ.cjs +367 -0
- package/dist/{chunk-SMHH4VDG.mjs → chunk-4WVJLURN.mjs} +1 -1
- package/dist/{chunk-2F2ER724.cjs → chunk-5BXGGEC7.cjs} +27 -22
- package/dist/{chunk-3BHT4WMP.cjs → chunk-5D2JIPLH.cjs} +8 -8
- package/dist/{chunk-AHGECQEW.mjs → chunk-666CKENS.mjs} +1 -1
- package/dist/{chunk-GFHLGIYC.cjs → chunk-6LGFV2CQ.cjs} +8 -8
- package/dist/chunk-6SJ2KJTA.mjs +314 -0
- package/dist/{chunk-PFQKNERH.cjs → chunk-6TJITR2B.cjs} +457 -218
- package/dist/{chunk-73MC7ZL6.cjs → chunk-75X755YZ.cjs} +2 -2
- package/dist/{chunk-3UH7MRCP.cjs → chunk-7DWNJI73.cjs} +13 -13
- package/dist/{chunk-7L5V3KQO.cjs → chunk-7O5M4UKW.cjs} +2 -2
- package/dist/{chunk-BJPBQNIE.cjs → chunk-7SQ5SGYZ.cjs} +2 -2
- package/dist/{chunk-27ZWSI3W.cjs → chunk-ADOAUDQ6.cjs} +2 -2
- package/dist/{chunk-CP6X4AEU.mjs → chunk-AJQTP4OO.mjs} +1 -1
- package/dist/{chunk-YKX5BK66.cjs → chunk-ATWHHSY2.cjs} +7 -7
- package/dist/{chunk-EFCQPQMG.cjs → chunk-B5PFZLKV.cjs} +89 -8
- package/dist/{chunk-FNO7A7CM.cjs → chunk-BHY547NB.cjs} +34 -16
- package/dist/{chunk-JHWOVJ3M.mjs → chunk-BUGNQIHC.mjs} +5 -0
- package/dist/{chunk-7GLPRTTF.cjs → chunk-CGBDNNSM.cjs} +2 -2
- package/dist/chunk-CI6E3UOH.cjs +314 -0
- package/dist/{chunk-2G2NNLE2.mjs → chunk-CQMVIOYP.mjs} +5 -5
- package/dist/{chunk-X6W5FFH6.cjs → chunk-CVH2BXPY.cjs} +8 -8
- package/dist/{chunk-TKSCR644.cjs → chunk-D3C5LBQY.cjs} +2 -2
- package/dist/{chunk-PZNL3WEG.mjs → chunk-DMEPTZTI.mjs} +22 -11
- package/dist/chunk-DTSROJ5J.mjs +367 -0
- package/dist/{chunk-DBNKI4NF.cjs → chunk-ECKF2BAM.cjs} +6 -2
- package/dist/{chunk-GQ3Z3IZI.cjs → chunk-EMMQ64QW.cjs} +18 -18
- package/dist/{chunk-6DU6UFUE.mjs → chunk-EXG5LD6B.mjs} +16 -8
- package/dist/{chunk-HUMR6LSU.mjs → chunk-F5QO4FNE.mjs} +1 -1
- package/dist/{chunk-YULD7ICZ.mjs → chunk-FBOJ55OM.mjs} +1 -1
- package/dist/{chunk-IHNMMXHV.mjs → chunk-FGRYBX5X.mjs} +15 -10
- package/dist/{chunk-D227TIEN.cjs → chunk-FWE7LEQC.cjs} +13 -13
- package/dist/{chunk-3BU22U3M.cjs → chunk-G2TEB74S.cjs} +5 -2
- package/dist/{chunk-G5RT7EXW.mjs → chunk-HEVMCTSR.mjs} +21 -6
- package/dist/{chunk-W7LF2J2S.mjs → chunk-HMRSWN47.mjs} +1 -1
- package/dist/{chunk-JG6DJF5A.mjs → chunk-HZFM2LWQ.mjs} +22 -1
- package/dist/{chunk-UAORZ7QA.mjs → chunk-IAIYV4RZ.mjs} +2 -2
- package/dist/{chunk-F2SE2VDO.mjs → chunk-IHQIOZLC.mjs} +1 -1
- package/dist/{chunk-2NNMOPDN.mjs → chunk-J3ANCZKA.mjs} +4 -1
- package/dist/{chunk-C4SPBWFM.cjs → chunk-JEZO6VUR.cjs} +10 -1
- package/dist/{chunk-SC2WYWPF.mjs → chunk-JPNFPAZ4.mjs} +3 -3
- package/dist/{chunk-F6Z3Y5KL.mjs → chunk-K3SAEIM3.mjs} +5 -2
- package/dist/{chunk-QAU5JD57.mjs → chunk-K4I4O5TS.mjs} +289 -50
- package/dist/{chunk-KN7K4VQN.mjs → chunk-KDTBF3UU.mjs} +1 -1
- package/dist/{chunk-OMVAU7NT.cjs → chunk-KIIMAWOJ.cjs} +11 -1
- package/dist/{chunk-43FMW62B.mjs → chunk-KMTGADN3.mjs} +28 -0
- package/dist/{chunk-QORUJDIV.mjs → chunk-KPFKMDM7.mjs} +2 -2
- package/dist/{chunk-YSCV4SJF.cjs → chunk-L5H2GSUC.cjs} +4 -4
- package/dist/{chunk-YDQZGSDS.mjs → chunk-LBDP3YT3.mjs} +1 -1
- package/dist/{chunk-6ETPZTJI.mjs → chunk-LBGILORX.mjs} +116 -55
- package/dist/{chunk-IPXLADVO.cjs → chunk-LOFKRKO7.cjs} +122 -61
- package/dist/{chunk-ULAWS2PA.cjs → chunk-LPFV45AY.cjs} +29 -26
- package/dist/{chunk-3KZS4SUS.mjs → chunk-MCIZVNOQ.mjs} +1 -1
- package/dist/{chunk-RU3M2FIK.cjs → chunk-MRMI32SN.cjs} +87 -369
- package/dist/{chunk-XCMCS4DA.mjs → chunk-ND2CWPOD.mjs} +2 -2
- package/dist/{chunk-XCACDAZZ.cjs → chunk-NDILNQ4L.cjs} +25 -10
- package/dist/{chunk-6TJOML4E.mjs → chunk-NFMDCAOS.mjs} +14 -11
- package/dist/{chunk-UXFQ3UDA.cjs → chunk-NICDYKBS.cjs} +42 -3
- package/dist/{chunk-EZDQRNQ7.mjs → chunk-NNSAQX3U.mjs} +23 -5
- package/dist/{chunk-YC6V7PWE.cjs → chunk-NQ6QFZWD.cjs} +1 -1
- package/dist/{chunk-PDOCJ6RY.mjs → chunk-O6WAEAX3.mjs} +1 -1
- package/dist/{chunk-U4KT7QP3.cjs → chunk-OW67PDDS.cjs} +14 -1
- package/dist/{chunk-77GNHH2Z.cjs → chunk-PMQHMWZU.cjs} +3 -3
- package/dist/chunk-PTZ2TVNE.cjs +178 -0
- package/dist/{chunk-6WCPV6G2.mjs → chunk-Q2KB32T4.mjs} +1 -1
- package/dist/{chunk-ICUQICNC.cjs → chunk-Q5FYSK45.cjs} +718 -532
- package/dist/{chunk-5SJWVY6R.mjs → chunk-QHSH7IH4.mjs} +9 -0
- package/dist/{chunk-Q3VLETLE.mjs → chunk-RRMVL6CJ.mjs} +4 -4
- package/dist/{chunk-IZY3V5XW.mjs → chunk-S3VWVTVA.mjs} +14 -1
- package/dist/{chunk-FFFW3OQ7.cjs → chunk-S6FJO323.cjs} +2 -2
- package/dist/{chunk-VFQT3LAO.cjs → chunk-SDOTRX3V.cjs} +5 -5
- package/dist/chunk-SGBZPZUW.mjs +75 -0
- package/dist/{chunk-BMWDEBXO.cjs → chunk-SHLXACIO.cjs} +31 -3
- package/dist/{chunk-ZXGAFZDO.cjs → chunk-T5OJPTVN.cjs} +2 -2
- package/dist/{chunk-2ELDTQRN.mjs → chunk-TDNWPAVR.mjs} +1 -1
- package/dist/{chunk-VZJR7UTG.cjs → chunk-TE2G5ION.cjs} +2 -2
- package/dist/{chunk-IHNIDL6H.cjs → chunk-TO4GJ56K.cjs} +22 -11
- package/dist/{chunk-4JHOT46A.mjs → chunk-TPLJVC7E.mjs} +86 -5
- package/dist/{chunk-NRSN7G7E.mjs → chunk-TW4GYDBJ.mjs} +1 -1
- package/dist/{chunk-XBML5KMG.cjs → chunk-U6MPZ35Q.cjs} +24 -14
- package/dist/chunk-UH6QN5NL.mjs +178 -0
- package/dist/{chunk-FTFYRMQQ.cjs → chunk-UJZLSXUB.cjs} +53 -28
- package/dist/chunk-UXHS27O6.cjs +75 -0
- package/dist/{chunk-DQQOKWYA.cjs → chunk-VR4GD5I3.cjs} +3 -3
- package/dist/{chunk-22LTEMGQ.mjs → chunk-VXAWRDK7.mjs} +14 -4
- package/dist/{chunk-62XKI4Z3.cjs → chunk-W2YDNK66.cjs} +6 -3
- package/dist/{chunk-VPTDD5XF.cjs → chunk-WBKEZXWE.cjs} +5 -0
- package/dist/{chunk-EJQT6KZN.cjs → chunk-WC5UV2HQ.cjs} +2 -2
- package/dist/{chunk-SAZVVAJH.mjs → chunk-WQ7T2263.mjs} +18 -7
- package/dist/chunk-WRPHYQVY.mjs +109 -0
- package/dist/chunk-WT4TGLXT.cjs +109 -0
- package/dist/{chunk-SOMHP6GF.mjs → chunk-XOPOIFTJ.mjs} +2 -2
- package/dist/{chunk-3PXS2MHU.mjs → chunk-YCKO6FRS.mjs} +1 -1
- package/dist/{chunk-C35ZBVRD.mjs → chunk-YWMZUGIS.mjs} +6 -2
- package/dist/{chunk-HMIJDL7S.mjs → chunk-Z5BEWYVO.mjs} +31 -6
- package/dist/{chunk-OKZUAXHF.mjs → chunk-Z7LA7MHQ.mjs} +1 -1
- package/dist/{chunk-Y7RKTKYI.mjs → chunk-ZMMBIVQM.mjs} +10 -0
- package/dist/{client-plugins-HIyulDym.d.ts → client-plugins-C8DjftDF.d.ts} +112 -5
- package/dist/{client-plugins-CvIslxWi.d.mts → client-plugins-CV4eJ9De.d.mts} +112 -5
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.cjs +8 -8
- package/dist/client.d.mts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/client.mjs +7 -7
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{devtools-EAUY43BS.cjs → devtools-JXFQNWSH.cjs} +11 -10
- package/dist/{devtools-EE5RIBTH.mjs → devtools-KVOY2TCZ.mjs} +10 -9
- package/dist/docs.cjs +13 -12
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +12 -11
- package/dist/headers.cjs +4 -4
- package/dist/headers.mjs +3 -3
- package/dist/i18n/client.cjs +11 -11
- package/dist/i18n/client.mjs +3 -3
- package/dist/image/server.cjs +3 -3
- package/dist/image/server.mjs +2 -2
- package/dist/image/sharp.cjs +10 -10
- package/dist/image/sharp.mjs +2 -2
- package/dist/index.cjs +61 -54
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.mjs +60 -53
- package/dist/integrations.cjs +8 -4
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.mjs +7 -3
- package/dist/internal/app-markdown-runtime.cjs +5 -3
- package/dist/internal/app-markdown-runtime.d.mts +19 -5
- package/dist/internal/app-markdown-runtime.d.ts +19 -5
- package/dist/internal/app-markdown-runtime.mjs +4 -2
- package/dist/internal/build-runtime.cjs +38 -34
- package/dist/internal/build-runtime.d.mts +3 -3
- package/dist/internal/build-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.mjs +37 -33
- package/dist/internal/cli-runtime.cjs +17 -16
- package/dist/internal/cli-runtime.mjs +16 -15
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +2 -2
- package/dist/internal/client-runtime.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +11 -10
- package/dist/internal/config-runtime.d.mts +2 -2
- package/dist/internal/config-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.mjs +10 -9
- package/dist/internal/infra-analytics-runtime.cjs +5 -5
- package/dist/internal/infra-analytics-runtime.mjs +3 -3
- package/dist/internal/isolated-boundary.cjs +2 -2
- package/dist/internal/isolated-boundary.d.mts +0 -1
- package/dist/internal/isolated-boundary.d.ts +0 -1
- package/dist/internal/isolated-boundary.mjs +1 -1
- package/dist/internal/metadata-image-runtime.cjs +3 -3
- package/dist/internal/metadata-image-runtime.mjs +2 -2
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +27 -48
- package/dist/internal/production-runtime.d.mts +67 -27
- package/dist/internal/production-runtime.d.ts +67 -27
- package/dist/internal/production-runtime.mjs +34 -55
- package/dist/{layers-BRQF5ETU.mjs → layers-UTB43B7A.mjs} +1 -1
- package/dist/layers-VUWIOFEO.cjs +18 -0
- package/dist/markdown.cjs +1 -1
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/middleware.cjs +10 -10
- package/dist/middleware.d.mts +6 -4
- package/dist/middleware.d.ts +6 -4
- package/dist/middleware.mjs +9 -9
- package/dist/navigation.cjs +7 -7
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +6 -6
- package/dist/{nitro-OVPLKPE2.cjs → nitro-7F65EZZS.cjs} +3 -3
- package/dist/{nitro-MXRDCXWZ.mjs → nitro-MPZJGPXK.mjs} +2 -2
- package/dist/plugin.cjs +31 -28
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.mjs +30 -27
- package/dist/{production-runtime-Crq6CJ-2.d.ts → production-runtime-C2kkrPVZ.d.ts} +1 -1
- package/dist/{production-runtime-0sRnuYc-.d.mts → production-runtime-Du_FHb2-.d.mts} +1 -1
- package/dist/query/client.cjs +9 -9
- package/dist/query/client.mjs +4 -4
- package/dist/{render-plan-8ozZh2Qv.d.ts → render-plan-BnnPTpus.d.ts} +1 -1
- package/dist/{render-plan-gs9GGPzw.d.mts → render-plan-Cgx7v8tJ.d.mts} +1 -1
- package/dist/renderer/react/server.cjs +3 -3
- package/dist/renderer/react/server.mjs +1 -1
- package/dist/renderer-client.cjs +12 -12
- package/dist/renderer-client.d.mts +3 -3
- package/dist/renderer-client.d.ts +3 -3
- package/dist/renderer-client.mjs +4 -4
- package/dist/{request-B5G8rLBH.d.ts → request-BNWr7r5e.d.ts} +1 -1
- package/dist/{request-fkhiynXe.d.mts → request-sKayKcop.d.mts} +1 -1
- package/dist/request.cjs +3 -3
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/request.mjs +2 -2
- package/dist/{route-rendering-lS5nUMua.d.ts → route-rendering-Bx4Auw6Q.d.ts} +1 -1
- package/dist/{route-rendering-CLnS7AZj.d.mts → route-rendering-DWFp3Yq4.d.mts} +1 -1
- package/dist/{router-ifU8Dui1.d.mts → router-BK6K42Ij.d.mts} +1 -1
- package/dist/{router-4iuiYnOW.d.ts → router-DnW_2tQi.d.ts} +1 -1
- package/dist/routes.cjs +2 -2
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/routes.mjs +1 -1
- package/dist/runtime-CA3Ei5k_.d.ts +69 -0
- package/dist/runtime-DJDaCMd_.d.mts +69 -0
- package/dist/server-action-security.cjs +3 -3
- package/dist/server-action-security.mjs +2 -2
- package/dist/server-fn.cjs +5 -5
- package/dist/server-fn.mjs +4 -4
- package/dist/server-plugins.cjs +5 -5
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server-plugins.mjs +4 -4
- package/dist/server-query.cjs +6 -6
- package/dist/server-query.mjs +5 -5
- package/dist/server.cjs +57 -54
- package/dist/server.d.mts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.mjs +35 -32
- package/dist/{spa-router-Bq7VCOwx.d.mts → spa-router-D6fUA4Rn.d.mts} +2 -2
- package/dist/{spa-router-DaJk5Re4.d.ts → spa-router-Mwbd7g2L.d.ts} +2 -2
- package/dist/testing.cjs +13 -13
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.mjs +10 -10
- package/dist/theme/server.cjs +4 -4
- package/dist/theme/server.mjs +3 -3
- package/dist/{utils-BXLmFsVR.d.ts → utils-BwVcAfUR.d.ts} +1 -1
- package/dist/{utils-XJn0c9bj.d.mts → utils-p9Hs-jCc.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +31 -28
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.mjs +30 -27
- package/dist/workflows.cjs +3 -3
- package/dist/workflows.mjs +2 -2
- package/package.json +1 -1
- package/types/middleware.d.ts +5 -1
- package/dist/chunk-FXEF4PPL.mjs +0 -47
- package/dist/chunk-XD32KALF.cjs +0 -47
- package/dist/layers-4PNE2HOY.cjs +0 -18
- /package/dist/{chunk-SJNMVDDF.cjs → chunk-FUCSUGDM.cjs} +0 -0
- /package/dist/{chunk-UDNPLXW7.mjs → chunk-MYIZXDZA.mjs} +0 -0
|
@@ -1,13 +1,11 @@
|
|
|
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
6
|
var _chunkEUV4YR3Vcjs = require('./chunk-EUV4YR3V.cjs');
|
|
6
7
|
|
|
7
8
|
|
|
8
|
-
var _chunkJ63ZH5OQcjs = require('./chunk-J63ZH5OQ.cjs');
|
|
9
|
-
|
|
10
|
-
|
|
11
9
|
|
|
12
10
|
var _chunkFJ3M4CUXcjs = require('./chunk-FJ3M4CUX.cjs');
|
|
13
11
|
|
|
@@ -17,348 +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) => _chunkEUV4YR3Vcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
if (exclude.some((pattern) => _chunkEUV4YR3Vcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) continue;
|
|
77
|
-
if (isMetadataNoIndex(source.metadata)) continue;
|
|
78
|
-
const target = _chunkEUV4YR3Vcjs.isFarmMarkdownMirrorExposed.call(void 0, options.markdown, path) ? _chunkEUV4YR3Vcjs.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 mcp = _nullishCoalesce(options.mcp, () => ( []));
|
|
104
|
-
const summary = _nullishCoalesce(config.summary, () => ( readMetadataString(options.rootMetadata, "description")));
|
|
105
|
-
return {
|
|
106
|
-
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)),
|
|
107
|
-
...summary ? { summary } : {},
|
|
108
|
-
...config.details ? { details: config.details } : {},
|
|
109
|
-
sections: [
|
|
110
|
-
...pages.length ? [
|
|
111
|
-
{
|
|
112
|
-
title: "Pages",
|
|
113
|
-
links: pages.map(({ title, url, description }) => ({
|
|
114
|
-
title,
|
|
115
|
-
url,
|
|
116
|
-
...description ? { description } : {}
|
|
117
|
-
}))
|
|
118
|
-
}
|
|
119
|
-
] : [],
|
|
120
|
-
...mcp.length ? [{ title: "MCP", links: mcp }] : []
|
|
121
|
-
]
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmDefaultLlmsTxt, "createFarmDefaultLlmsTxt");
|
|
125
|
-
function serializeFarmLlmsTxt(value) {
|
|
126
|
-
if (typeof value === "string") {
|
|
127
|
-
if (!value.trim()) throw new TypeError("llms.ts returned an empty llms.txt");
|
|
128
|
-
return value.endsWith("\n") ? value : `${value}
|
|
129
|
-
`;
|
|
130
|
-
}
|
|
131
|
-
if (!isRecord(value)) {
|
|
132
|
-
throw new TypeError("llms.ts must return llms.txt text, an llms.txt object, or a Response");
|
|
133
|
-
}
|
|
134
|
-
const title = requireText(value.title, "llms.ts must return a non-empty title");
|
|
135
|
-
const summary = optionalText(value.summary, "llms.ts summary must be a string");
|
|
136
|
-
const details = optionalText(value.details, "llms.ts details must be a string");
|
|
137
|
-
if (value.sections !== void 0 && !Array.isArray(value.sections)) {
|
|
138
|
-
throw new TypeError("llms.ts sections must be an array");
|
|
139
|
-
}
|
|
140
|
-
const blocks = [`# ${toSingleLine(title)}`];
|
|
141
|
-
if (_optionalChain([summary, 'optionalAccess', _5 => _5.trim, 'call', _6 => _6()])) blocks.push(`> ${toSingleLine(summary)}`);
|
|
142
|
-
if (_optionalChain([details, 'optionalAccess', _7 => _7.trim, 'call', _8 => _8()])) blocks.push(details.trim());
|
|
143
|
-
for (const [sectionIndex, section] of (_nullishCoalesce(value.sections, () => ( []))).entries()) {
|
|
144
|
-
if (!isRecord(section)) {
|
|
145
|
-
throw new TypeError(`llms.ts section ${sectionIndex} must be an object`);
|
|
146
|
-
}
|
|
147
|
-
const sectionTitle = requireText(
|
|
148
|
-
section.title,
|
|
149
|
-
`llms.ts section ${sectionIndex} must include a non-empty title`
|
|
150
|
-
);
|
|
151
|
-
if (!Array.isArray(section.links)) {
|
|
152
|
-
throw new TypeError(`llms.ts section "${sectionTitle}" must include a links array`);
|
|
153
|
-
}
|
|
154
|
-
const links = section.links.map((link, linkIndex) => {
|
|
155
|
-
const where = `llms.ts section "${sectionTitle}" link ${linkIndex}`;
|
|
156
|
-
if (!isRecord(link)) throw new TypeError(`${where} must be an object`);
|
|
157
|
-
const linkTitle = requireText(link.title, `${where} must include a non-empty title`);
|
|
158
|
-
const url = requireText(link.url, `${where} must include a non-empty url`);
|
|
159
|
-
const description = optionalText(link.description, `${where} description must be a string`);
|
|
160
|
-
return `- [${escapeLinkText(linkTitle)}](${escapeLinkUrl(url)})${_optionalChain([description, 'optionalAccess', _9 => _9.trim, 'call', _10 => _10()]) ? `: ${toSingleLine(description)}` : ""}`;
|
|
161
|
-
});
|
|
162
|
-
blocks.push(`## ${toSingleLine(sectionTitle)}`, links.join("\n"));
|
|
163
|
-
}
|
|
164
|
-
return `${blocks.filter(Boolean).join("\n\n")}
|
|
165
|
-
`;
|
|
166
|
-
}
|
|
167
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, serializeFarmLlmsTxt, "serializeFarmLlmsTxt");
|
|
168
|
-
function createFarmLlmsMarkdownReader(fetchMarkdown) {
|
|
169
|
-
return async (url) => {
|
|
170
|
-
try {
|
|
171
|
-
const response = await fetchMarkdown(
|
|
172
|
-
new Request(url, {
|
|
173
|
-
headers: { accept: "text/markdown", [_chunkJ63ZH5OQcjs.FARM_INTERNAL_READ_HEADER]: "llms-full" }
|
|
174
|
-
})
|
|
175
|
-
);
|
|
176
|
-
const type = _nullishCoalesce(response.headers.get("content-type"), () => ( ""));
|
|
177
|
-
if (!response.ok || !type.toLowerCase().startsWith("text/markdown")) {
|
|
178
|
-
await _optionalChain([response, 'access', _11 => _11.body, 'optionalAccess', _12 => _12.cancel, 'call', _13 => _13()]);
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
return await response.text();
|
|
182
|
-
} catch (e) {
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmLlmsMarkdownReader, "createFarmLlmsMarkdownReader");
|
|
188
|
-
var FARM_LLMS_FULL_PAGE_TIMEOUT_MS = 3e4;
|
|
189
|
-
var LLMS_PAGE_TIMED_OUT = /* @__PURE__ */ Symbol("farm.llms.pageTimedOut");
|
|
190
|
-
async function renderFarmLlmsFullTxt(value, options) {
|
|
191
|
-
const index = serializeFarmLlmsTxt(value);
|
|
192
|
-
if (typeof value === "string") return index;
|
|
193
|
-
const llms = value;
|
|
194
|
-
const links = [];
|
|
195
|
-
const seen = /* @__PURE__ */ new Set();
|
|
196
|
-
for (const section of _nullishCoalesce(llms.sections, () => ( []))) {
|
|
197
|
-
for (const link of section.links) {
|
|
198
|
-
if (seen.has(link.url)) continue;
|
|
199
|
-
seen.add(link.url);
|
|
200
|
-
links.push(link);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
const pageTimeout = _nullishCoalesce(options.pageTimeout, () => ( FARM_LLMS_FULL_PAGE_TIMEOUT_MS));
|
|
204
|
-
const readWithinTimeout = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (url) => {
|
|
205
|
-
let timer;
|
|
206
|
-
const timedOut = new Promise((resolve) => {
|
|
207
|
-
timer = setTimeout(resolve, pageTimeout, LLMS_PAGE_TIMED_OUT);
|
|
208
|
-
});
|
|
209
|
-
try {
|
|
210
|
-
const content = await Promise.race([options.readMarkdown(url), timedOut]);
|
|
211
|
-
if (content !== LLMS_PAGE_TIMED_OUT) return content;
|
|
212
|
-
_optionalChain([options, 'access', _14 => _14.onIncomplete, 'optionalCall', _15 => _15()]);
|
|
213
|
-
return null;
|
|
214
|
-
} finally {
|
|
215
|
-
clearTimeout(timer);
|
|
216
|
-
}
|
|
217
|
-
}, "readWithinTimeout");
|
|
218
|
-
const contents = await mapWithConcurrency(
|
|
219
|
-
links,
|
|
220
|
-
_nullishCoalesce(options.concurrency, () => ( 4)),
|
|
221
|
-
(link) => shouldInlineLlmsLink(link.url, options.origin) ? readWithinTimeout(link.url) : null
|
|
222
|
-
);
|
|
223
|
-
const blocks = [`# ${toSingleLine(llms.title)}`];
|
|
224
|
-
if (_optionalChain([llms, 'access', _16 => _16.summary, 'optionalAccess', _17 => _17.trim, 'call', _18 => _18()])) blocks.push(`> ${toSingleLine(llms.summary)}`);
|
|
225
|
-
if (_optionalChain([llms, 'access', _19 => _19.details, 'optionalAccess', _20 => _20.trim, 'call', _21 => _21()])) blocks.push(llms.details.trim());
|
|
226
|
-
const pages = links.map((link, index2) => {
|
|
227
|
-
const parts = [`## ${toSingleLine(link.title)}`, `URL: ${escapeLinkUrl(link.url)}`];
|
|
228
|
-
if (_optionalChain([link, 'access', _22 => _22.description, 'optionalAccess', _23 => _23.trim, 'call', _24 => _24()])) parts.push(toSingleLine(link.description));
|
|
229
|
-
const content = stripFrontmatter(_nullishCoalesce(contents[index2], () => ( ""))).trim();
|
|
230
|
-
if (content) parts.push(content);
|
|
231
|
-
return parts.join("\n\n");
|
|
232
|
-
});
|
|
233
|
-
if (pages.length) blocks.push(pages.join("\n\n---\n\n"));
|
|
234
|
-
return `${blocks.join("\n\n")}
|
|
235
|
-
`;
|
|
236
|
-
}
|
|
237
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, renderFarmLlmsFullTxt, "renderFarmLlmsFullTxt");
|
|
238
|
-
function createFarmLlmsFullRenderer(options = {}) {
|
|
239
|
-
const now = _nullishCoalesce(options.now, () => ( Date.now));
|
|
240
|
-
const ttl = (_nullishCoalesce(options.revalidate, () => ( 0))) * 1e3;
|
|
241
|
-
const maxEntries = _nullishCoalesce(options.maxEntries, () => ( 16));
|
|
242
|
-
const entries = /* @__PURE__ */ new Map();
|
|
243
|
-
let queue = Promise.resolve();
|
|
244
|
-
const settle = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (body, complete, onSettled) => onSettled ? body.then((value) => (onSettled(complete()), value)) : body, "settle");
|
|
245
|
-
return (origin, render, onSettled) => {
|
|
246
|
-
const entry = entries.get(origin);
|
|
247
|
-
if (entry && entry.expires > now()) return settle(entry.body, entry.complete, onSettled);
|
|
248
|
-
entries.delete(origin);
|
|
249
|
-
let complete = true;
|
|
250
|
-
const body = queue.then(
|
|
251
|
-
() => render({
|
|
252
|
-
incomplete: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => {
|
|
253
|
-
complete = false;
|
|
254
|
-
}, "incomplete")
|
|
255
|
-
})
|
|
256
|
-
);
|
|
257
|
-
queue = body.catch(() => {
|
|
258
|
-
});
|
|
259
|
-
const pending = { body, expires: Number.POSITIVE_INFINITY, complete: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => complete, "complete") };
|
|
260
|
-
entries.set(origin, pending);
|
|
261
|
-
if (entries.size > maxEntries) entries.delete(entries.keys().next().value);
|
|
262
|
-
body.then(
|
|
263
|
-
() => {
|
|
264
|
-
if (entries.get(origin) !== pending) return;
|
|
265
|
-
if (ttl > 0 && complete) pending.expires = now() + ttl;
|
|
266
|
-
else entries.delete(origin);
|
|
267
|
-
},
|
|
268
|
-
() => {
|
|
269
|
-
if (entries.get(origin) === pending) entries.delete(origin);
|
|
270
|
-
}
|
|
271
|
-
);
|
|
272
|
-
return settle(body, pending.complete, onSettled);
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmLlmsFullRenderer, "createFarmLlmsFullRenderer");
|
|
276
|
-
function stripFrontmatter(markdown) {
|
|
277
|
-
const match = /^\uFEFF?---\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/.exec(markdown);
|
|
278
|
-
return match ? markdown.slice(match[0].length) : markdown;
|
|
279
|
-
}
|
|
280
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, stripFrontmatter, "stripFrontmatter");
|
|
281
|
-
function shouldInlineLlmsLink(url, origin) {
|
|
282
|
-
let target;
|
|
283
|
-
try {
|
|
284
|
-
target = new URL(url, origin);
|
|
285
|
-
} catch (e2) {
|
|
286
|
-
return false;
|
|
287
|
-
}
|
|
288
|
-
return target.origin === origin && !/\/llms(-full)?\.txt$/.test(target.pathname);
|
|
289
|
-
}
|
|
290
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, shouldInlineLlmsLink, "shouldInlineLlmsLink");
|
|
291
|
-
async function mapWithConcurrency(items, limit, run) {
|
|
292
|
-
const results = [];
|
|
293
|
-
let next = 0;
|
|
294
|
-
const worker = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
|
|
295
|
-
while (next < items.length) {
|
|
296
|
-
const index = next++;
|
|
297
|
-
results[index] = await run(items[index]);
|
|
298
|
-
}
|
|
299
|
-
}, "worker");
|
|
300
|
-
await Promise.all(Array.from({ length: Math.min(Math.max(limit, 1), items.length) }, worker));
|
|
301
|
-
return results;
|
|
302
|
-
}
|
|
303
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, mapWithConcurrency, "mapWithConcurrency");
|
|
304
|
-
function readMetadataTitle(metadata) {
|
|
305
|
-
if (!isRecord(metadata)) return void 0;
|
|
306
|
-
const { title } = metadata;
|
|
307
|
-
if (typeof title === "string") return title.trim() || void 0;
|
|
308
|
-
if (isRecord(title)) {
|
|
309
|
-
for (const key of ["absolute", "default"]) {
|
|
310
|
-
const value = title[key];
|
|
311
|
-
if (typeof value === "string" && value.trim()) return value.trim();
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
return void 0;
|
|
315
|
-
}
|
|
316
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, readMetadataTitle, "readMetadataTitle");
|
|
317
|
-
function readMetadataString(metadata, key) {
|
|
318
|
-
if (!isRecord(metadata)) return void 0;
|
|
319
|
-
const value = metadata[key];
|
|
320
|
-
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
321
|
-
}
|
|
322
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, readMetadataString, "readMetadataString");
|
|
323
|
-
function fallbackPageTitle(path) {
|
|
324
|
-
if (path === "/") return "Home";
|
|
325
|
-
const segments = path.split("/").filter(Boolean);
|
|
326
|
-
const segment = _nullishCoalesce(segments[segments.length - 1], () => ( path));
|
|
327
|
-
const words = segment.replace(/[-_]+/g, " ").trim();
|
|
328
|
-
return words ? words[0].toUpperCase() + words.slice(1) : path;
|
|
329
|
-
}
|
|
330
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, fallbackPageTitle, "fallbackPageTitle");
|
|
331
|
-
function toSingleLine(value) {
|
|
332
|
-
return value.replace(/\s+/g, " ").trim();
|
|
333
|
-
}
|
|
334
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, toSingleLine, "toSingleLine");
|
|
335
|
-
function escapeLinkText(value) {
|
|
336
|
-
return toSingleLine(value).replace(/[\\[\]]/g, "\\$&");
|
|
337
|
-
}
|
|
338
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, escapeLinkText, "escapeLinkText");
|
|
339
|
-
function escapeLinkUrl(value) {
|
|
340
|
-
return value.trim().replace(
|
|
341
|
-
/[\s()<>]/g,
|
|
342
|
-
(character) => character === "(" ? "%28" : character === ")" ? "%29" : encodeURIComponent(character)
|
|
343
|
-
);
|
|
344
|
-
}
|
|
345
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, escapeLinkUrl, "escapeLinkUrl");
|
|
346
|
-
function requireText(value, message) {
|
|
347
|
-
if (typeof value !== "string" || !value.trim()) throw new TypeError(message);
|
|
348
|
-
return value;
|
|
349
|
-
}
|
|
350
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, requireText, "requireText");
|
|
351
|
-
function optionalText(value, message) {
|
|
352
|
-
if (value === void 0) return void 0;
|
|
353
|
-
if (typeof value !== "string") throw new TypeError(message);
|
|
354
|
-
return value;
|
|
355
|
-
}
|
|
356
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, optionalText, "optionalText");
|
|
357
|
-
function isRecord(value) {
|
|
358
|
-
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
359
|
-
}
|
|
360
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, isRecord, "isRecord");
|
|
361
|
-
|
|
362
18
|
// src/agent-crawlers.ts
|
|
363
19
|
var FARM_AI_CRAWLERS = {
|
|
364
20
|
search: [
|
|
@@ -456,7 +112,7 @@ function toAbsoluteHttpUrl(value) {
|
|
|
456
112
|
try {
|
|
457
113
|
const url = new URL(String(value));
|
|
458
114
|
return url.protocol === "https:" || url.protocol === "http:" ? url : null;
|
|
459
|
-
} catch (
|
|
115
|
+
} catch (e) {
|
|
460
116
|
return null;
|
|
461
117
|
}
|
|
462
118
|
}
|
|
@@ -489,6 +145,73 @@ function resolveDefaultSitemap(options) {
|
|
|
489
145
|
}
|
|
490
146
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveDefaultSitemap, "resolveDefaultSitemap");
|
|
491
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
|
+
|
|
492
215
|
// src/security.ts
|
|
493
216
|
function resolveFarmSecurityConfig(input) {
|
|
494
217
|
if (input === void 0) return { csp: false };
|
|
@@ -661,7 +384,7 @@ async function applyFarmCspHashesToHtml(html, security) {
|
|
|
661
384
|
_chunkS3JO3N4Hcjs.__name.call(void 0, applyFarmCspHashesToHtml, "applyFarmCspHashesToHtml");
|
|
662
385
|
function applyFarmCspNonceToResponse(response, security) {
|
|
663
386
|
if (!security.csp || !security.csp.nonce) return response;
|
|
664
|
-
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;
|
|
665
388
|
const nonce = createFarmCspNonce(security);
|
|
666
389
|
const securityHeader = getFarmSecurityHeader(security, nonce);
|
|
667
390
|
if (!response.body) {
|
|
@@ -883,7 +606,7 @@ var rawTextElements = /* @__PURE__ */ new Map([
|
|
|
883
606
|
["xmp", /<\/xmp(?=[\s/>]|$)/gi]
|
|
884
607
|
]);
|
|
885
608
|
function stampScriptTag(tag, nonce) {
|
|
886
|
-
const opening = _optionalChain([tag, 'access',
|
|
609
|
+
const opening = _optionalChain([tag, 'access', _11 => _11.match, 'call', _12 => _12(/^<script\b/i), 'optionalAccess', _13 => _13[0]]);
|
|
887
610
|
if (!opening) return tag;
|
|
888
611
|
const attributes = stripScriptNonceAttribute(tag).slice(opening.length, -1);
|
|
889
612
|
return `<script nonce="${nonce}"${attributes}>`;
|
|
@@ -939,7 +662,7 @@ function collectFarmInlineScriptContents(html) {
|
|
|
939
662
|
}
|
|
940
663
|
_chunkS3JO3N4Hcjs.__name.call(void 0, collectFarmInlineScriptContents, "collectFarmInlineScriptContents");
|
|
941
664
|
function findScriptTagAttributeRange(tag, expectedName) {
|
|
942
|
-
const opening = _optionalChain([tag, 'access',
|
|
665
|
+
const opening = _optionalChain([tag, 'access', _14 => _14.match, 'call', _15 => _15(/^<script\b/i), 'optionalAccess', _16 => _16[0]]);
|
|
943
666
|
if (!opening) return void 0;
|
|
944
667
|
let offset = opening.length;
|
|
945
668
|
while (offset < tag.length - 1) {
|
|
@@ -969,7 +692,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, findScriptTagAttributeRange, "findScriptTa
|
|
|
969
692
|
function findRawTextEnd(input, tagName, offset = 0) {
|
|
970
693
|
const closing = rawTextElements.get(tagName);
|
|
971
694
|
closing.lastIndex = offset;
|
|
972
|
-
return _nullishCoalesce(_optionalChain([closing, 'access',
|
|
695
|
+
return _nullishCoalesce(_optionalChain([closing, 'access', _17 => _17.exec, 'call', _18 => _18(input), 'optionalAccess', _19 => _19.index]), () => ( -1));
|
|
973
696
|
}
|
|
974
697
|
_chunkS3JO3N4Hcjs.__name.call(void 0, findRawTextEnd, "findRawTextEnd");
|
|
975
698
|
function matchingSuffixLength(input, token) {
|
|
@@ -1015,9 +738,9 @@ var MAX_REPORTED_PRELOAD_WARNINGS = 256;
|
|
|
1015
738
|
function resolveFarmPerformanceConfig(config) {
|
|
1016
739
|
return {
|
|
1017
740
|
preload: {
|
|
1018
|
-
mode: _optionalChain([config, 'optionalAccess',
|
|
1019
|
-
maxImages: normalizeBudget(_optionalChain([config, 'optionalAccess',
|
|
1020
|
-
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)
|
|
1021
744
|
}
|
|
1022
745
|
};
|
|
1023
746
|
}
|
|
@@ -1031,7 +754,7 @@ function manageFarmHtmlPreloads(html, config) {
|
|
|
1031
754
|
index,
|
|
1032
755
|
kind,
|
|
1033
756
|
href: readHtmlAttribute(element.value, "href"),
|
|
1034
|
-
highPriority: _optionalChain([readHtmlAttribute, 'call',
|
|
757
|
+
highPriority: _optionalChain([readHtmlAttribute, 'call', _26 => _26(element.value, "fetchpriority"), 'optionalAccess', _27 => _27.toLowerCase, 'call', _28 => _28()]) === "high"
|
|
1035
758
|
}
|
|
1036
759
|
] : [];
|
|
1037
760
|
});
|
|
@@ -1055,7 +778,7 @@ function manageFarmLinkHeaderPreloads(value, config) {
|
|
|
1055
778
|
index,
|
|
1056
779
|
kind,
|
|
1057
780
|
href: getLinkHeaderTarget(link),
|
|
1058
|
-
highPriority: _optionalChain([getLinkHeaderParameter, 'call',
|
|
781
|
+
highPriority: _optionalChain([getLinkHeaderParameter, 'call', _29 => _29(link, "fetchpriority"), 'optionalAccess', _30 => _30.toLowerCase, 'call', _31 => _31()]) === "high"
|
|
1059
782
|
}
|
|
1060
783
|
] : [];
|
|
1061
784
|
});
|
|
@@ -1078,7 +801,7 @@ function manageFarmDocumentPreloads(html, linkHeader, config) {
|
|
|
1078
801
|
index,
|
|
1079
802
|
kind,
|
|
1080
803
|
href: readHtmlAttribute(element.value, "href"),
|
|
1081
|
-
highPriority: _optionalChain([readHtmlAttribute, 'call',
|
|
804
|
+
highPriority: _optionalChain([readHtmlAttribute, 'call', _32 => _32(element.value, "fetchpriority"), 'optionalAccess', _33 => _33.toLowerCase, 'call', _34 => _34()]) === "high"
|
|
1082
805
|
});
|
|
1083
806
|
}
|
|
1084
807
|
for (const [index, link] of links.entries()) {
|
|
@@ -1088,7 +811,7 @@ function manageFarmDocumentPreloads(html, linkHeader, config) {
|
|
|
1088
811
|
index: headerOffset + index,
|
|
1089
812
|
kind,
|
|
1090
813
|
href: getLinkHeaderTarget(link),
|
|
1091
|
-
highPriority: _optionalChain([getLinkHeaderParameter, 'call',
|
|
814
|
+
highPriority: _optionalChain([getLinkHeaderParameter, 'call', _35 => _35(link, "fetchpriority"), 'optionalAccess', _36 => _36.toLowerCase, 'call', _37 => _37()]) === "high"
|
|
1092
815
|
});
|
|
1093
816
|
}
|
|
1094
817
|
const budget = selectPreloadsWithinBudget(candidates, config);
|
|
@@ -1169,13 +892,13 @@ function selectPreloadsWithinBudget(candidates, config) {
|
|
|
1169
892
|
}
|
|
1170
893
|
_chunkS3JO3N4Hcjs.__name.call(void 0, selectPreloadsWithinBudget, "selectPreloadsWithinBudget");
|
|
1171
894
|
function getHtmlPreloadKind(link) {
|
|
1172
|
-
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+/)]) || [];
|
|
1173
896
|
if (!rel.includes("preload")) return void 0;
|
|
1174
897
|
return normalizePreloadKind(readHtmlAttribute(link, "as"));
|
|
1175
898
|
}
|
|
1176
899
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getHtmlPreloadKind, "getHtmlPreloadKind");
|
|
1177
900
|
function getLinkHeaderPreloadKind(link) {
|
|
1178
|
-
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+/)]), () => ( []));
|
|
1179
902
|
if (!relations.includes("preload")) return void 0;
|
|
1180
903
|
return normalizePreloadKind(getLinkHeaderParameter(link, "as"));
|
|
1181
904
|
}
|
|
@@ -1221,7 +944,7 @@ function splitLinkParameters(value) {
|
|
|
1221
944
|
}
|
|
1222
945
|
_chunkS3JO3N4Hcjs.__name.call(void 0, splitLinkParameters, "splitLinkParameters");
|
|
1223
946
|
function normalizePreloadKind(value) {
|
|
1224
|
-
const normalized = _optionalChain([value, 'optionalAccess',
|
|
947
|
+
const normalized = _optionalChain([value, 'optionalAccess', _48 => _48.toLowerCase, 'call', _49 => _49()]);
|
|
1225
948
|
return normalized === "image" || normalized === "font" ? normalized : void 0;
|
|
1226
949
|
}
|
|
1227
950
|
_chunkS3JO3N4Hcjs.__name.call(void 0, normalizePreloadKind, "normalizePreloadKind");
|
|
@@ -1229,7 +952,7 @@ function readHtmlAttribute(element, name) {
|
|
|
1229
952
|
const match = element.match(
|
|
1230
953
|
new RegExp(`\\s${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`, "i")
|
|
1231
954
|
);
|
|
1232
|
-
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]])));
|
|
1233
956
|
}
|
|
1234
957
|
_chunkS3JO3N4Hcjs.__name.call(void 0, readHtmlAttribute, "readHtmlAttribute");
|
|
1235
958
|
function findHtmlLinkElements(html) {
|
|
@@ -1253,7 +976,7 @@ function findHtmlLinkElements(html) {
|
|
|
1253
976
|
}
|
|
1254
977
|
rawTextTag.lastIndex = start;
|
|
1255
978
|
const rawText = rawTextTag.exec(lowerHtml);
|
|
1256
|
-
if (_optionalChain([rawText, 'optionalAccess',
|
|
979
|
+
if (_optionalChain([rawText, 'optionalAccess', _53 => _53[1]])) {
|
|
1257
980
|
const openingEnd = findHtmlTagEnd2(html, start);
|
|
1258
981
|
if (openingEnd === -1) break;
|
|
1259
982
|
if (rawText[1] === "svg" && html[openingEnd - 2] === "/") {
|
|
@@ -1398,7 +1121,7 @@ function applyFarmPreviewRobotsTag(response) {
|
|
|
1398
1121
|
try {
|
|
1399
1122
|
response.headers.set("X-Robots-Tag", FARM_PREVIEW_ROBOTS_TAG);
|
|
1400
1123
|
return response;
|
|
1401
|
-
} catch (
|
|
1124
|
+
} catch (e3) {
|
|
1402
1125
|
const headers = new Headers(response.headers);
|
|
1403
1126
|
headers.set("X-Robots-Tag", FARM_PREVIEW_ROBOTS_TAG);
|
|
1404
1127
|
return new Response(response.body, {
|
|
@@ -1431,9 +1154,4 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, applyFarmPreviewRobotsTag, "applyFarmPrevi
|
|
|
1431
1154
|
|
|
1432
1155
|
|
|
1433
1156
|
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
_hydrateFarmI18n,
|
|
3
3
|
isFarmLocaleChangeHref
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IHQIOZLC.mjs";
|
|
5
5
|
import {
|
|
6
6
|
getHashTargetElement
|
|
7
7
|
} from "./chunk-2PQNJXFM.mjs";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
isFarmBlockedNavigationURL,
|
|
10
10
|
isFarmExternalNavigationURL,
|
|
11
11
|
resolveFarmNavigationURL
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-QHSH7IH4.mjs";
|
|
13
13
|
import {
|
|
14
14
|
createClientCancellation
|
|
15
15
|
} from "./chunk-QVYLBY73.mjs";
|