@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
|
@@ -0,0 +1,367 @@
|
|
|
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
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkEUV4YR3Vcjs = require('./chunk-EUV4YR3V.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkJ63ZH5OQcjs = require('./chunk-J63ZH5OQ.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
15
|
+
|
|
16
|
+
// src/llms-txt.ts
|
|
17
|
+
function resolveFarmLlmsTxtConfig(input) {
|
|
18
|
+
if (!input) return { enabled: false, include: [], exclude: [], full: false };
|
|
19
|
+
if (input === true) return { enabled: true, include: [], exclude: [], full: true };
|
|
20
|
+
if (typeof input !== "object") {
|
|
21
|
+
throw new TypeError("agent.llmsTxt must be true, false, or an options object.");
|
|
22
|
+
}
|
|
23
|
+
if (input.enabled === false) return { enabled: false, include: [], exclude: [], full: false };
|
|
24
|
+
for (const key of ["title", "summary", "details"]) {
|
|
25
|
+
if (input[key] !== void 0 && typeof input[key] !== "string") {
|
|
26
|
+
throw new TypeError(`agent.llmsTxt.${key} must be a string.`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (input.full !== void 0 && typeof input.full !== "boolean") {
|
|
30
|
+
throw new TypeError("agent.llmsTxt.full must be a boolean.");
|
|
31
|
+
}
|
|
32
|
+
if (input.revalidate !== void 0 && (typeof input.revalidate !== "number" || !Number.isFinite(input.revalidate) || input.revalidate < 0)) {
|
|
33
|
+
throw new TypeError("agent.llmsTxt.revalidate must be a number of seconds.");
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
enabled: true,
|
|
37
|
+
...input.title ? { title: input.title } : {},
|
|
38
|
+
...input.summary ? { summary: input.summary } : {},
|
|
39
|
+
...input.details ? { details: input.details } : {},
|
|
40
|
+
include: resolveRoutePatterns(input.include, "include"),
|
|
41
|
+
exclude: resolveRoutePatterns(input.exclude, "exclude"),
|
|
42
|
+
full: input.full !== false,
|
|
43
|
+
...input.revalidate !== void 0 ? { revalidate: input.revalidate } : {}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmLlmsTxtConfig, "resolveFarmLlmsTxtConfig");
|
|
47
|
+
function resolveRoutePatterns(value, key) {
|
|
48
|
+
if (value === void 0) return [];
|
|
49
|
+
if (!Array.isArray(value)) {
|
|
50
|
+
throw new TypeError(`agent.llmsTxt.${key} must be an array of route patterns.`);
|
|
51
|
+
}
|
|
52
|
+
return value.map((pattern, index) => {
|
|
53
|
+
if (typeof pattern !== "string" || !pattern.startsWith("/")) {
|
|
54
|
+
throw new TypeError(
|
|
55
|
+
`agent.llmsTxt.${key}[${index}] must be a route pattern starting with "/", such as "/docs/[...slug]".`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return pattern;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveRoutePatterns, "resolveRoutePatterns");
|
|
62
|
+
function collectFarmLlmsTxtPages(sources, options) {
|
|
63
|
+
const include = _nullishCoalesce(options.include, () => ( []));
|
|
64
|
+
const exclude = _nullishCoalesce(options.exclude, () => ( []));
|
|
65
|
+
const pages = /* @__PURE__ */ new Map();
|
|
66
|
+
for (const source of sources) {
|
|
67
|
+
const path = source.pattern;
|
|
68
|
+
if (path.includes("[") || pages.has(path)) continue;
|
|
69
|
+
if (include.length && !include.some((pattern) => _chunkEUV4YR3Vcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (exclude.some((pattern) => _chunkEUV4YR3Vcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) continue;
|
|
73
|
+
if (isFarmMetadataNoIndex(source.metadata)) continue;
|
|
74
|
+
const target = _chunkEUV4YR3Vcjs.isFarmMarkdownMirrorExposed.call(void 0, options.markdown, path) ? _chunkEUV4YR3Vcjs.getFarmMarkdownMirrorPath.call(void 0, path) : path;
|
|
75
|
+
const description = readMetadataString(source.metadata, "description");
|
|
76
|
+
pages.set(path, {
|
|
77
|
+
path,
|
|
78
|
+
title: _nullishCoalesce(readMetadataTitle(source.metadata), () => ( fallbackPageTitle(path))),
|
|
79
|
+
url: `${options.origin}${_chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, target, options.basePath)}`,
|
|
80
|
+
...description ? { description } : {}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return [...pages.values()].sort((left, right) => left.path.localeCompare(right.path));
|
|
84
|
+
}
|
|
85
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, collectFarmLlmsTxtPages, "collectFarmLlmsTxtPages");
|
|
86
|
+
function isFarmMetadataNoIndex(metadata) {
|
|
87
|
+
if (!metadata || typeof metadata !== "object") return false;
|
|
88
|
+
const robots = metadata.robots;
|
|
89
|
+
if (typeof robots === "string") {
|
|
90
|
+
return robots.split(",").map((directive) => directive.trim().toLowerCase()).some((directive) => directive === "noindex" || directive === "none");
|
|
91
|
+
}
|
|
92
|
+
return Boolean(
|
|
93
|
+
robots && typeof robots === "object" && robots.index === false
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isFarmMetadataNoIndex, "isFarmMetadataNoIndex");
|
|
97
|
+
function createFarmDefaultLlmsTxt(options) {
|
|
98
|
+
const { config, pages } = options;
|
|
99
|
+
const mcp = _nullishCoalesce(options.mcp, () => ( []));
|
|
100
|
+
const summary = _nullishCoalesce(config.summary, () => ( readMetadataString(options.rootMetadata, "description")));
|
|
101
|
+
return {
|
|
102
|
+
title: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(config.title, () => ( readMetadataTitle(options.rootMetadata))), () => ( _optionalChain([pages, 'access', _ => _.find, 'call', _2 => _2((page) => page.path === "/"), 'optionalAccess', _3 => _3.title]))), () => ( new URL(options.origin).host)),
|
|
103
|
+
...summary ? { summary } : {},
|
|
104
|
+
...config.details ? { details: config.details } : {},
|
|
105
|
+
sections: [
|
|
106
|
+
...pages.length ? [
|
|
107
|
+
{
|
|
108
|
+
title: "Pages",
|
|
109
|
+
links: pages.map(({ title, url, description }) => ({
|
|
110
|
+
title,
|
|
111
|
+
url,
|
|
112
|
+
...description ? { description } : {}
|
|
113
|
+
}))
|
|
114
|
+
}
|
|
115
|
+
] : [],
|
|
116
|
+
...mcp.length ? [{ title: "MCP", links: mcp }] : []
|
|
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', _4 => _4.trim, 'call', _5 => _5()])) blocks.push(`> ${toSingleLine(summary)}`);
|
|
138
|
+
if (_optionalChain([details, 'optionalAccess', _6 => _6.trim, 'call', _7 => _7()])) 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', _8 => _8.trim, 'call', _9 => _9()]) ? `: ${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', _10 => _10.body, 'optionalAccess', _11 => _11.cancel, 'call', _12 => _12()]);
|
|
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', _13 => _13.onIncomplete, 'optionalCall', _14 => _14()]);
|
|
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', _15 => _15.summary, 'optionalAccess', _16 => _16.trim, 'call', _17 => _17()])) blocks.push(`> ${toSingleLine(llms.summary)}`);
|
|
221
|
+
if (_optionalChain([llms, 'access', _18 => _18.details, 'optionalAccess', _19 => _19.trim, 'call', _20 => _20()])) 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', _21 => _21.description, 'optionalAccess', _22 => _22.trim, 'call', _23 => _23()])) 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
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
exports.resolveFarmLlmsTxtConfig = resolveFarmLlmsTxtConfig; exports.collectFarmLlmsTxtPages = collectFarmLlmsTxtPages; exports.isFarmMetadataNoIndex = isFarmMetadataNoIndex; exports.createFarmDefaultLlmsTxt = createFarmDefaultLlmsTxt; exports.serializeFarmLlmsTxt = serializeFarmLlmsTxt; exports.createFarmLlmsMarkdownReader = createFarmLlmsMarkdownReader; exports.renderFarmLlmsFullTxt = renderFarmLlmsFullTxt; exports.createFarmLlmsFullRenderer = createFarmLlmsFullRenderer;
|
|
@@ -3,22 +3,23 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkG2TEB74Scjs = require('./chunk-G2TEB74S.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var _chunkZ2HLU4IXcjs = require('./chunk-Z2HLU4IX.cjs');
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
|
|
14
|
+
var _chunk4GWRFP22cjs = require('./chunk-4GWRFP22.cjs');
|
|
17
15
|
|
|
18
16
|
|
|
19
17
|
var _chunkE3UK5IIBcjs = require('./chunk-E3UK5IIB.cjs');
|
|
20
18
|
|
|
21
19
|
|
|
20
|
+
var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
|
|
21
|
+
|
|
22
|
+
|
|
22
23
|
var _chunkFJ3M4CUXcjs = require('./chunk-FJ3M4CUX.cjs');
|
|
23
24
|
|
|
24
25
|
|
|
@@ -82,19 +83,19 @@ var WebResponseHeaderMap = _WebResponseHeaderMap;
|
|
|
82
83
|
var _WebCookieJar = class _WebCookieJar {
|
|
83
84
|
constructor(request, headers) {
|
|
84
85
|
this.headers = headers;
|
|
85
|
-
this.cookies =
|
|
86
|
+
this.cookies = _chunkG2TEB74Scjs.parseMiddlewareCookieHeader.call(void 0, request.headers.get("cookie"));
|
|
86
87
|
}
|
|
87
88
|
get(name) {
|
|
88
89
|
return this.cookies[name];
|
|
89
90
|
}
|
|
90
91
|
set(name, value, options = {}) {
|
|
91
92
|
this.cookies[name] = value;
|
|
92
|
-
const cookieString =
|
|
93
|
+
const cookieString = _chunkG2TEB74Scjs.serializeMiddlewareCookie.call(void 0, name, value, options);
|
|
93
94
|
this.headers.appendSetCookie(cookieString);
|
|
94
95
|
}
|
|
95
96
|
delete(name, options = {}) {
|
|
96
97
|
delete this.cookies[name];
|
|
97
|
-
this.headers.appendSetCookie(
|
|
98
|
+
this.headers.appendSetCookie(_chunkG2TEB74Scjs.serializeMiddlewareCookieDeletion.call(void 0, name, options));
|
|
98
99
|
}
|
|
99
100
|
getAll() {
|
|
100
101
|
return { ...this.cookies };
|
|
@@ -260,7 +261,7 @@ function createHandledResponse(body, init, headers) {
|
|
|
260
261
|
return new Response(body, { ...init, headers: responseHeaders });
|
|
261
262
|
}
|
|
262
263
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createHandledResponse, "createHandledResponse");
|
|
263
|
-
function createWebMiddlewareContext(request, parent, trustProxy = false, clientAddress) {
|
|
264
|
+
function createWebMiddlewareContext(request, parent, trustProxy = false, clientAddress, toRoutePathname) {
|
|
264
265
|
let currentRequest = withNodeRequestShape(request, trustProxy, clientAddress);
|
|
265
266
|
let handledResponse = null;
|
|
266
267
|
const url = new URL(currentRequest.url);
|
|
@@ -281,6 +282,7 @@ function createWebMiddlewareContext(request, parent, trustProxy = false, clientA
|
|
|
281
282
|
response: responseShim.response,
|
|
282
283
|
url,
|
|
283
284
|
pathname: url.pathname,
|
|
285
|
+
routePathname: _chunk4GWRFP22cjs.toMiddlewareRoutePathname.call(void 0, url.pathname, toRoutePathname),
|
|
284
286
|
searchParams: url.searchParams,
|
|
285
287
|
method: currentRequest.method || "GET",
|
|
286
288
|
params: {},
|
|
@@ -323,6 +325,7 @@ function createWebMiddlewareContext(request, parent, trustProxy = false, clientA
|
|
|
323
325
|
ctx.request = currentRequest;
|
|
324
326
|
ctx.url = nextUrl;
|
|
325
327
|
ctx.pathname = nextUrl.pathname;
|
|
328
|
+
ctx.routePathname = _chunk4GWRFP22cjs.toMiddlewareRoutePathname.call(void 0, nextUrl.pathname, toRoutePathname);
|
|
326
329
|
ctx.searchParams = nextUrl.searchParams;
|
|
327
330
|
ctx.route = nextUrl.pathname;
|
|
328
331
|
},
|
|
@@ -375,7 +378,7 @@ function createWebMiddlewareContext(request, parent, trustProxy = false, clientA
|
|
|
375
378
|
}
|
|
376
379
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createWebMiddlewareContext, "createWebMiddlewareContext");
|
|
377
380
|
function matchesMiddlewareConfig2(pathname, config, ctx) {
|
|
378
|
-
return
|
|
381
|
+
return _chunk4GWRFP22cjs.matchesMiddlewareConfig.call(void 0, pathname, config, ctx);
|
|
379
382
|
}
|
|
380
383
|
_chunkS3JO3N4Hcjs.__name.call(void 0, matchesMiddlewareConfig2, "matchesMiddlewareConfig");
|
|
381
384
|
function getConfigHandlers(entry) {
|
|
@@ -408,7 +411,7 @@ function normalizeConfigMiddleware(config) {
|
|
|
408
411
|
globalConfig = middlewareConfig;
|
|
409
412
|
continue;
|
|
410
413
|
}
|
|
411
|
-
|
|
414
|
+
_chunk4GWRFP22cjs.compileMiddlewareConfig.call(void 0, middlewareConfig);
|
|
412
415
|
entries.push({
|
|
413
416
|
path: "/",
|
|
414
417
|
filePath: `farm.config.ts#middleware-${index}`,
|
|
@@ -423,11 +426,11 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, normalizeConfigMiddleware, "normalizeConfi
|
|
|
423
426
|
function normalizeFileMiddleware(modules = []) {
|
|
424
427
|
const entries = [];
|
|
425
428
|
for (const moduleEntry of modules) {
|
|
426
|
-
const normalized =
|
|
429
|
+
const normalized = _chunkG2TEB74Scjs.normalizeMiddlewareModule.call(void 0, moduleEntry.module, moduleEntry.path);
|
|
427
430
|
if (!normalized) {
|
|
428
431
|
continue;
|
|
429
432
|
}
|
|
430
|
-
if (normalized.config)
|
|
433
|
+
if (normalized.config) _chunk4GWRFP22cjs.compileMiddlewareConfig.call(void 0, normalized.config);
|
|
431
434
|
entries.push({
|
|
432
435
|
path: moduleEntry.path,
|
|
433
436
|
filePath: moduleEntry.filePath || moduleEntry.path,
|
|
@@ -471,24 +474,25 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, emptyResult, "emptyResult");
|
|
|
471
474
|
function createProductionMiddlewareRunner(options = {}) {
|
|
472
475
|
const configMiddleware = normalizeConfigMiddleware(options.config);
|
|
473
476
|
const fileMiddleware = normalizeFileMiddleware(options.modules);
|
|
474
|
-
for (const entry of fileMiddleware)
|
|
477
|
+
for (const entry of fileMiddleware) _chunk4GWRFP22cjs.compileMiddlewareRoute.call(void 0, entry);
|
|
475
478
|
const entries = [...configMiddleware.entries, ...fileMiddleware];
|
|
476
479
|
const globalConfig = configMiddleware.globalConfig;
|
|
477
|
-
if (globalConfig)
|
|
480
|
+
if (globalConfig) _chunk4GWRFP22cjs.compileMiddlewareConfig.call(void 0, globalConfig);
|
|
478
481
|
const toMiddlewarePathnames = _chunkKNBBQHO2cjs.createFarmAPIMiddlewarePathnames.call(void 0, options.apiBasePath);
|
|
479
482
|
return /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async function runProductionMiddleware(request, requestOptions = {}) {
|
|
480
483
|
if (!globalConfig && entries.length === 0) {
|
|
481
484
|
return emptyResult(request);
|
|
482
485
|
}
|
|
486
|
+
const toRoutePathname = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (pathname) => _optionalChain([options, 'access', _15 => _15.i18n, 'optionalAccess', _16 => _16.enabled]) ? _chunkBIDYX3SLcjs.stripFarmLocaleFromPathname.call(void 0, pathname, options.i18n) : _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, pathname, _nullishCoalesce(_optionalChain([options, 'access', _17 => _17.i18n, 'optionalAccess', _18 => _18.basePath]), () => ( "/"))), "toRoutePathname");
|
|
483
487
|
let contextState = createWebMiddlewareContext(
|
|
484
488
|
request,
|
|
485
489
|
void 0,
|
|
486
|
-
_optionalChain([options, 'access',
|
|
487
|
-
requestOptions.clientAddress
|
|
490
|
+
_optionalChain([options, 'access', _19 => _19.server, 'optionalAccess', _20 => _20.trustProxy]) === true,
|
|
491
|
+
requestOptions.clientAddress,
|
|
492
|
+
toRoutePathname
|
|
488
493
|
);
|
|
489
494
|
let ctx = contextState.ctx;
|
|
490
495
|
let currentRequest = contextState.getRequest();
|
|
491
|
-
const toRoutePathname = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (pathname) => _optionalChain([options, 'access', _17 => _17.i18n, 'optionalAccess', _18 => _18.enabled]) ? _chunkBIDYX3SLcjs.stripFarmLocaleFromPathname.call(void 0, pathname, options.i18n) : _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, pathname, _nullishCoalesce(_optionalChain([options, 'access', _19 => _19.i18n, 'optionalAccess', _20 => _20.basePath]), () => ( "/"))), "toRoutePathname");
|
|
492
496
|
const initialRequestPathname = ctx.pathname;
|
|
493
497
|
const initialPathname = toRoutePathname(initialRequestPathname);
|
|
494
498
|
const matchPathnames = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (pathname, requestPathname) => options.rawPathRouting && requestPathname !== pathname ? [
|
|
@@ -499,7 +503,7 @@ function createProductionMiddlewareRunner(options = {}) {
|
|
|
499
503
|
] : toMiddlewarePathnames(pathname), "matchPathnames");
|
|
500
504
|
let parentData;
|
|
501
505
|
if (globalConfig) {
|
|
502
|
-
const globalMatch =
|
|
506
|
+
const globalMatch = _chunk4GWRFP22cjs.matchesMiddlewareConfigAt.call(void 0,
|
|
503
507
|
matchPathnames(initialPathname, initialRequestPathname),
|
|
504
508
|
globalConfig,
|
|
505
509
|
ctx
|
|
@@ -516,11 +520,11 @@ function createProductionMiddlewareRunner(options = {}) {
|
|
|
516
520
|
for (let pathname = initialPathname, requestPathname = initialRequestPathname, pass = 0; ; pass++) {
|
|
517
521
|
const pathnames = matchPathnames(pathname, requestPathname);
|
|
518
522
|
if (pass > 0 && globalConfig) {
|
|
519
|
-
if (!
|
|
523
|
+
if (!_chunk4GWRFP22cjs.matchesMiddlewareConfigAt.call(void 0, pathnames, globalConfig, ctx).matched) return;
|
|
520
524
|
}
|
|
521
525
|
for (const entry of entries) {
|
|
522
526
|
if (ran.has(entry)) continue;
|
|
523
|
-
const routeMatch = entry.source === "config" ? { matched: true } :
|
|
527
|
+
const routeMatch = entry.source === "config" ? { matched: true } : _chunk4GWRFP22cjs.matchesMiddlewareRouteAt.call(void 0, pathnames, entry);
|
|
524
528
|
if (routeMatch.matched) yield { entry, routeMatch, pathname, pathnames };
|
|
525
529
|
}
|
|
526
530
|
const rewrittenRequestPathname = new URL(currentRequest.url).pathname;
|
|
@@ -532,7 +536,7 @@ function createProductionMiddlewareRunner(options = {}) {
|
|
|
532
536
|
}
|
|
533
537
|
_chunkS3JO3N4Hcjs.__name.call(void 0, applicableMiddleware, "applicableMiddleware");
|
|
534
538
|
for (const { entry, routeMatch, pathname, pathnames } of applicableMiddleware()) {
|
|
535
|
-
const configMatch = entry.config ?
|
|
539
|
+
const configMatch = entry.config ? _chunk4GWRFP22cjs.matchesMiddlewareConfigAt.call(void 0, pathnames, entry.config, ctx) : { matched: true };
|
|
536
540
|
if (!configMatch.matched) {
|
|
537
541
|
continue;
|
|
538
542
|
}
|
|
@@ -542,7 +546,8 @@ function createProductionMiddlewareRunner(options = {}) {
|
|
|
542
546
|
currentRequest,
|
|
543
547
|
parentData,
|
|
544
548
|
_optionalChain([options, 'access', _21 => _21.server, 'optionalAccess', _22 => _22.trustProxy]) === true,
|
|
545
|
-
requestOptions.clientAddress
|
|
549
|
+
requestOptions.clientAddress,
|
|
550
|
+
toRoutePathname
|
|
546
551
|
);
|
|
547
552
|
ctx = contextState.ctx;
|
|
548
553
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkXSIRSMAScjs = require('./chunk-XSIRSMAS.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkE2ROOWQCcjs = require('./chunk-E2ROOWQC.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkJSROZYYOcjs = require('./chunk-JSROZYYO.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _chunkSYQ3MOWWcjs = require('./chunk-SYQ3MOWW.cjs');
|
|
@@ -20,7 +20,7 @@ var _chunkTIWHTW3Qcjs = require('./chunk-TIWHTW3Q.cjs');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunkWBKEZXWEcjs = require('./chunk-WBKEZXWE.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
|
|
@@ -29,7 +29,7 @@ var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
|
|
|
29
29
|
var _chunkM7MKQXAFcjs = require('./chunk-M7MKQXAF.cjs');
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkFUCSUGDMcjs = require('./chunk-FUCSUGDM.cjs');
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
var _chunkUFDAAQFXcjs = require('./chunk-UFDAAQFX.cjs');
|
|
@@ -736,7 +736,7 @@ async function createRouteTypeDeclarations(options, outPath) {
|
|
|
736
736
|
}
|
|
737
737
|
}
|
|
738
738
|
}
|
|
739
|
-
for (const route of await
|
|
739
|
+
for (const route of await _chunkFUCSUGDMcjs.discoverProgrammaticRoutePaths.call(void 0, source.root, source.srcDir)) {
|
|
740
740
|
patterns.add(route);
|
|
741
741
|
routeModulePatterns.add(route);
|
|
742
742
|
}
|
|
@@ -1089,8 +1089,8 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
1089
1089
|
const shouldGenerateEnv = options.env !== false;
|
|
1090
1090
|
const shouldGenerateImages = options.images !== false;
|
|
1091
1091
|
const shouldGenerateI18n = options.i18n !== false && _optionalChain([options, 'access', _46 => _46.i18nConfig, 'optionalAccess', _47 => _47.enabled]);
|
|
1092
|
-
const sourceRoots =
|
|
1093
|
-
const appDirs =
|
|
1092
|
+
const sourceRoots = _chunkWBKEZXWEcjs.getFarmSourceRoots.call(void 0, { root, srcDir, layers: options.layers });
|
|
1093
|
+
const appDirs = _chunkWBKEZXWEcjs.getFarmAppDirectories.call(void 0, { root, srcDir, layers: options.layers });
|
|
1094
1094
|
const result = {
|
|
1095
1095
|
apiRoutes: [],
|
|
1096
1096
|
stalePaths: []
|