@farm.js/core 0.1.34 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-mcp-BVExL8rZ.d.mts +109 -0
- package/dist/agent-mcp-handler-LPJ2CADR.mjs +19 -0
- package/dist/agent-mcp-handler-SJAHFSPI.cjs +19 -0
- package/dist/agent-mcp-luzfXK-P.d.ts +109 -0
- package/dist/agent-runtime.cjs +5 -3
- package/dist/agent-runtime.d.mts +4 -5
- package/dist/agent-runtime.d.ts +4 -5
- package/dist/agent-runtime.mjs +4 -2
- package/dist/api/route-manager.cjs +7 -7
- package/dist/api/route-manager.d.mts +15 -10
- package/dist/api/route-manager.d.ts +15 -10
- package/dist/api/route-manager.mjs +6 -6
- package/dist/api/runtime.cjs +7 -5
- package/dist/api/runtime.d.mts +7 -66
- package/dist/api/runtime.d.ts +7 -66
- package/dist/api/runtime.mjs +7 -5
- package/dist/api.cjs +9 -9
- package/dist/api.d.mts +8 -9
- package/dist/api.d.ts +8 -9
- package/dist/api.mjs +8 -8
- package/dist/{app-q4rmZlXK.d.mts → app-BukwkFIu.d.mts} +52 -12
- package/dist/{app-DgotYGbq.d.ts → app-Yfa2dsFy.d.ts} +52 -12
- package/dist/app-markdown.cjs +6 -6
- package/dist/app-markdown.d.mts +5 -6
- package/dist/app-markdown.d.ts +5 -6
- package/dist/app-markdown.mjs +5 -5
- package/dist/{chunk-XV5DJTBX.mjs → chunk-276VJSM6.mjs} +627 -260
- package/dist/{chunk-36MK5YCW.cjs → chunk-2YTDKNH3.cjs} +547 -240
- package/dist/{chunk-VHANUNEG.mjs → chunk-35GKZR22.mjs} +2 -2
- package/dist/{chunk-LR5QSC2P.mjs → chunk-35WV46VL.mjs} +399 -92
- package/dist/{chunk-UX5S4JEO.cjs → chunk-42NHY7HW.cjs} +57 -7
- package/dist/{chunk-U4PTAHW3.mjs → chunk-4E5AEDKY.mjs} +7 -11
- package/dist/{chunk-NGVORZVZ.mjs → chunk-4E5WBPEG.mjs} +73 -351
- package/dist/{chunk-AQZFOP7S.mjs → chunk-4GLOOWKE.mjs} +5 -5
- package/dist/{chunk-7BT4H4P7.cjs → chunk-4NU4GGTC.cjs} +2 -2
- package/dist/{chunk-AGC75XAE.mjs → chunk-4WCZJQUO.mjs} +55 -5
- package/dist/chunk-4WQ6PGSJ.cjs +367 -0
- package/dist/{chunk-QCFFHV5H.mjs → chunk-4WVJLURN.mjs} +1 -1
- package/dist/chunk-6SJ2KJTA.mjs +314 -0
- package/dist/chunk-75RZHGLS.cjs +135 -0
- package/dist/{chunk-P64MIF5B.cjs → chunk-ADEA7PN3.cjs} +483 -60
- package/dist/{chunk-YQVSHTMR.mjs → chunk-AJQTP4OO.mjs} +1 -1
- package/dist/{chunk-TA5G2HWD.cjs → chunk-AO6RYU5N.cjs} +31 -28
- package/dist/{chunk-MOKLYNHV.cjs → chunk-BO36SELV.cjs} +6 -6
- package/dist/{chunk-7Y6ZNFPX.mjs → chunk-BPOF5U4N.mjs} +17 -7
- package/dist/{chunk-JHWOVJ3M.mjs → chunk-BUGNQIHC.mjs} +5 -0
- package/dist/{chunk-TDFPACVX.cjs → chunk-CBJJH36A.cjs} +50 -25
- package/dist/{chunk-VKNHTSAP.cjs → chunk-CGBDNNSM.cjs} +2 -2
- package/dist/chunk-CI6E3UOH.cjs +314 -0
- package/dist/{chunk-QZCT2CQ4.mjs → chunk-CXEN47J3.mjs} +64 -2
- package/dist/{chunk-ATK2R4CH.cjs → chunk-D227TIEN.cjs} +14 -4
- package/dist/{chunk-QGYRXFU2.cjs → chunk-D2BB47NB.cjs} +8 -8
- package/dist/chunk-DTSROJ5J.mjs +367 -0
- package/dist/{chunk-ODBZYBAB.cjs → chunk-DZ5ZVB2K.cjs} +1 -1
- package/dist/{chunk-ROUTX2E5.cjs → chunk-ECKF2BAM.cjs} +18 -5
- package/dist/{chunk-3LUF2PE2.cjs → chunk-EK4QAEFZ.cjs} +67 -5
- package/dist/{chunk-VVBO3QH7.mjs → chunk-ENLZ4R3Y.mjs} +10 -1
- package/dist/{chunk-XXJU7FCC.cjs → chunk-EUV4YR3V.cjs} +2 -2
- package/dist/{chunk-HR5KPHC2.mjs → chunk-EWET4D2Y.mjs} +1 -1
- package/dist/{chunk-PXKIEXZD.mjs → chunk-F5QO4FNE.mjs} +1 -1
- package/dist/{chunk-MIDIZJZC.cjs → chunk-FO427P6I.cjs} +22 -12
- package/dist/{chunk-AWC4VUZL.cjs → chunk-GQ3Z3IZI.cjs} +14 -14
- package/dist/{chunk-JDPAKVS4.mjs → chunk-GQRWBCWK.mjs} +8 -5
- package/dist/{chunk-75WGQVQA.cjs → chunk-HITLGIAO.cjs} +10 -1
- package/dist/{chunk-WNNYOOIB.mjs → chunk-HOXTWRGB.mjs} +1 -1
- package/dist/{chunk-KROWKCUH.cjs → chunk-JGLC4TO3.cjs} +8 -1
- package/dist/{chunk-QJ3J6MZT.cjs → chunk-JNUWCDTF.cjs} +8 -8
- package/dist/{chunk-BTAG7LI7.cjs → chunk-JZVADIOD.cjs} +2 -2
- package/dist/{chunk-EM6SBQKM.cjs → chunk-KIIMAWOJ.cjs} +37 -2
- package/dist/{chunk-43FMW62B.mjs → chunk-KMTGADN3.mjs} +28 -0
- package/dist/{chunk-GOABMOX3.mjs → chunk-LSZAVSGY.mjs} +468 -45
- package/dist/{chunk-2NQQ5H5G.cjs → chunk-M7MKQXAF.cjs} +2 -1
- package/dist/{chunk-GNSDTTWZ.mjs → chunk-MKYBIIAQ.mjs} +30 -5
- package/dist/{chunk-ZHPHJPQP.cjs → chunk-MRMI32SN.cjs} +88 -366
- package/dist/{chunk-7M52YUMY.cjs → chunk-N2NAS2AM.cjs} +2 -2
- package/dist/{chunk-SJVKK4JE.cjs → chunk-NMHWYWDR.cjs} +1144 -777
- package/dist/chunk-NRDBW4MP.mjs +45 -0
- package/dist/{chunk-657WJNRY.mjs → chunk-O6I6VWKK.mjs} +20 -5
- package/dist/{chunk-O27L4YAA.mjs → chunk-O6WAEAX3.mjs} +2 -2
- package/dist/chunk-OFZUJMCU.mjs +601 -0
- package/dist/{chunk-ZKP7C2B6.mjs → chunk-OHLSEQ57.mjs} +22 -13
- package/dist/{chunk-X242HVD5.mjs → chunk-OO7GXVSR.mjs} +1 -1
- package/dist/chunk-PTZ2TVNE.cjs +178 -0
- package/dist/{chunk-3ATMYLLJ.mjs → chunk-Q2KB32T4.mjs} +1 -1
- package/dist/{chunk-LHODW25H.mjs → chunk-QORUJDIV.mjs} +2 -2
- package/dist/{chunk-UBO4SGH4.mjs → chunk-RHAZ22ZN.mjs} +2 -1
- package/dist/{chunk-G26MUMKL.cjs → chunk-S6VYG6XU.cjs} +23 -8
- package/dist/{chunk-6VVL3MHY.mjs → chunk-SC2WYWPF.mjs} +1 -1
- package/dist/{chunk-MPEYMSCF.cjs → chunk-SDOTRX3V.cjs} +5 -5
- package/dist/{chunk-BMWDEBXO.cjs → chunk-SHLXACIO.cjs} +31 -3
- package/dist/{chunk-LMJ7VRHZ.mjs → chunk-T4OGRVNS.mjs} +13 -3
- package/dist/{chunk-T5CERMEH.cjs → chunk-T5OJPTVN.cjs} +2 -2
- package/dist/{chunk-Z2YLTERK.cjs → chunk-TE2G5ION.cjs} +6 -6
- package/dist/chunk-UH6QN5NL.mjs +178 -0
- package/dist/{chunk-PQDFUSXD.cjs → chunk-UVW64BCB.cjs} +44 -35
- package/dist/{chunk-VCCUOMQN.mjs → chunk-VILIPRS6.mjs} +1 -1
- package/dist/{chunk-A5FGU2WU.cjs → chunk-VQLJWDVW.cjs} +19 -23
- package/dist/{chunk-VPTDD5XF.cjs → chunk-WBKEZXWE.cjs} +5 -0
- package/dist/{chunk-K3F2E6GS.cjs → chunk-WC5UV2HQ.cjs} +2 -2
- package/dist/chunk-WWFTAUFG.cjs +45 -0
- package/dist/{chunk-ZUSJDQ2Q.mjs → chunk-WWIKMBRN.mjs} +1 -1
- package/dist/{chunk-3VSKDFAT.mjs → chunk-WZ77PUAM.mjs} +1 -1
- package/dist/{chunk-CLJYVZAD.mjs → chunk-XCMCS4DA.mjs} +11 -1
- package/dist/{chunk-F6OHXPWR.mjs → chunk-YFILVET3.mjs} +8 -1
- package/dist/{chunk-DZ4DTRJ5.cjs → chunk-YKX5BK66.cjs} +7 -7
- package/dist/chunk-YSLWRWWP.cjs +601 -0
- package/dist/{chunk-LI2LMOLR.mjs → chunk-YWMZUGIS.mjs} +18 -5
- package/dist/chunk-ZLAT2CWY.mjs +135 -0
- package/dist/{chunk-XF7Q24PF.mjs → chunk-ZMMBIVQM.mjs} +35 -0
- package/dist/{chunk-U74I55WB.cjs → chunk-ZWM5KGAA.cjs} +19 -9
- package/dist/{client-plugins-CLObcuCq.d.mts → client-plugins-C3mK9Pol.d.mts} +300 -7
- package/dist/{client-plugins-DZjHC4Mi.d.ts → client-plugins-r1mOtSC1.d.ts} +300 -7
- package/dist/client-plugins.d.mts +4 -5
- package/dist/client-plugins.d.ts +4 -5
- package/dist/client.cjs +5 -5
- package/dist/client.d.mts +8 -9
- package/dist/client.d.ts +8 -9
- package/dist/client.mjs +4 -4
- package/dist/config.d.mts +4 -5
- package/dist/config.d.ts +4 -5
- package/dist/{devtools-RNXCTS4R.mjs → devtools-ERIKFEXX.mjs} +11 -10
- package/dist/{devtools-HU6Y2MNV.cjs → devtools-JZJJY5CK.cjs} +12 -11
- package/dist/docs.cjs +15 -14
- package/dist/docs.d.mts +41 -4
- package/dist/docs.d.ts +41 -4
- package/dist/docs.mjs +14 -13
- package/dist/i18n/client.d.mts +2 -2
- package/dist/i18n/client.d.ts +2 -2
- package/dist/i18n/index.d.mts +3 -3
- package/dist/i18n/index.d.ts +3 -3
- package/dist/i18n/server.d.mts +5 -5
- package/dist/i18n/server.d.ts +5 -5
- package/dist/image/server.cjs +3 -3
- package/dist/image/server.mjs +2 -2
- package/dist/image/sharp.cjs +10 -10
- package/dist/image/sharp.mjs +2 -2
- package/dist/{index-a-8Z5kZU.d.mts → index-BJJfLxJo.d.mts} +2 -2
- package/dist/{index-BWVfxIsO.d.ts → index-CwoOP-MW.d.ts} +2 -2
- package/dist/index.cjs +51 -44
- package/dist/index.d.mts +20 -21
- package/dist/index.d.ts +20 -21
- package/dist/index.mjs +50 -43
- package/dist/integrations.cjs +7 -3
- package/dist/integrations.d.mts +4 -5
- package/dist/integrations.d.ts +4 -5
- package/dist/integrations.mjs +6 -2
- package/dist/internal/app-markdown-runtime.cjs +5 -5
- package/dist/internal/app-markdown-runtime.d.mts +5 -6
- package/dist/internal/app-markdown-runtime.d.ts +5 -6
- package/dist/internal/app-markdown-runtime.mjs +4 -4
- package/dist/internal/build-runtime.cjs +32 -30
- package/dist/internal/build-runtime.d.mts +6 -7
- package/dist/internal/build-runtime.d.ts +6 -7
- package/dist/internal/build-runtime.mjs +31 -29
- package/dist/internal/cli-runtime.cjs +17 -16
- package/dist/internal/cli-runtime.mjs +16 -15
- package/dist/internal/client-error-overlay.cjs +6 -6
- package/dist/internal/client-error-overlay.mjs +2 -2
- package/dist/internal/client-runtime.cjs +2 -2
- package/dist/internal/client-runtime.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +4 -5
- package/dist/internal/compression-runtime.d.ts +4 -5
- package/dist/internal/config-runtime.cjs +12 -11
- package/dist/internal/config-runtime.d.mts +5 -6
- package/dist/internal/config-runtime.d.ts +5 -6
- package/dist/internal/config-runtime.mjs +11 -10
- package/dist/internal/isolated-boundary.cjs +3 -2
- package/dist/internal/isolated-boundary.d.mts +1 -1
- package/dist/internal/isolated-boundary.d.ts +1 -1
- package/dist/internal/isolated-boundary.mjs +2 -1
- package/dist/internal/metadata-image-runtime.cjs +3 -3
- package/dist/internal/metadata-image-runtime.mjs +2 -2
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +63 -25
- package/dist/internal/production-runtime.d.mts +117 -37
- package/dist/internal/production-runtime.d.ts +117 -37
- package/dist/internal/production-runtime.mjs +65 -27
- package/dist/internal/server-tree.cjs +12 -0
- package/dist/internal/server-tree.d.mts +27 -0
- package/dist/internal/server-tree.d.ts +27 -0
- package/dist/internal/server-tree.mjs +12 -0
- package/dist/{layers-BRQF5ETU.mjs → layers-UTB43B7A.mjs} +1 -1
- package/dist/layers-VUWIOFEO.cjs +18 -0
- package/dist/markdown.cjs +4 -4
- package/dist/markdown.d.mts +4 -5
- package/dist/markdown.d.ts +4 -5
- package/dist/markdown.mjs +3 -3
- package/dist/middleware.cjs +7 -7
- package/dist/middleware.d.mts +6 -7
- package/dist/middleware.d.ts +6 -7
- package/dist/middleware.mjs +6 -6
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +7 -8
- package/dist/navigation.d.ts +7 -8
- package/dist/navigation.mjs +4 -4
- package/dist/{nitro-HSAQFXSS.cjs → nitro-7F65EZZS.cjs} +3 -3
- package/dist/{nitro-4XGPNIK4.mjs → nitro-MPZJGPXK.mjs} +2 -2
- package/dist/{observability-BupkiN0m.d.mts → observability-CoXunYhS.d.mts} +4 -3
- package/dist/{observability-BupkiN0m.d.ts → observability-CoXunYhS.d.ts} +4 -3
- package/dist/observability.d.mts +1 -1
- package/dist/observability.d.ts +1 -1
- package/dist/plugin.cjs +28 -26
- package/dist/plugin.d.mts +4 -5
- package/dist/plugin.d.ts +4 -5
- package/dist/plugin.mjs +27 -25
- package/dist/{production-runtime-CysZl3EV.d.mts → production-runtime-CCeVZXst.d.mts} +4 -4
- package/dist/{production-runtime-BU5ETAK9.d.ts → production-runtime-DPnsggY3.d.ts} +4 -4
- package/dist/query/client.cjs +6 -6
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan-CKr4ltOd.d.mts → render-plan-BuGaPFe6.d.mts} +1 -1
- package/dist/{render-plan-D72O1qm4.d.ts → render-plan-Cw4f5E_R.d.ts} +1 -1
- package/dist/renderer/react/server.cjs +10 -4
- package/dist/renderer/react/server.d.mts +2 -1
- package/dist/renderer/react/server.d.ts +2 -1
- package/dist/renderer/react/server.mjs +7 -1
- package/dist/renderer-client.cjs +5 -5
- package/dist/renderer-client.d.mts +6 -7
- package/dist/renderer-client.d.ts +6 -7
- package/dist/renderer-client.mjs +2 -2
- package/dist/renderer.d.mts +2 -0
- package/dist/renderer.d.ts +2 -0
- package/dist/{request-DbyOYI2j.d.ts → request-Bkg-hERy.d.ts} +1 -1
- package/dist/{request-Be83WafN.d.mts → request-CsGARcAw.d.mts} +1 -1
- package/dist/request.d.mts +5 -6
- package/dist/request.d.ts +5 -6
- package/dist/{resolver-PPEeiJ6M.d.ts → resolver-DadfRL6F.d.ts} +1 -1
- package/dist/{resolver-DhW0CqZN.d.mts → resolver-khasx3fU.d.mts} +1 -1
- package/dist/{route-rendering-CtVMpV-k.d.ts → route-rendering-BUZMH_64.d.ts} +1 -1
- package/dist/{route-rendering-BG56SzvJ.d.mts → route-rendering-f11yh5dp.d.mts} +1 -1
- package/dist/{router-D94-SDlW.d.ts → router-B8CR9GbD.d.ts} +1 -1
- package/dist/{router-ALUvm8gC.d.mts → router-Cp6yRE8A.d.mts} +1 -1
- package/dist/routes.d.mts +4 -5
- package/dist/routes.d.ts +4 -5
- package/dist/{runtime-BirxPwbZ.d.ts → runtime-BgDQzBiu.d.ts} +2 -2
- package/dist/runtime-CAEv36S_.d.mts +69 -0
- package/dist/runtime-CQVsT330.d.ts +69 -0
- package/dist/{runtime-AOJge4vQ.d.mts → runtime-CV2UCV-5.d.mts} +2 -2
- package/dist/server-action-security.cjs +3 -3
- package/dist/server-action-security.mjs +2 -2
- package/dist/server-fn.cjs +4 -4
- package/dist/server-fn.mjs +3 -3
- package/dist/server-plugins.d.mts +5 -6
- package/dist/server-plugins.d.ts +5 -6
- package/dist/server-query.cjs +5 -5
- package/dist/server-query.mjs +4 -4
- package/dist/server.cjs +47 -45
- package/dist/server.d.mts +13 -14
- package/dist/server.d.ts +13 -14
- package/dist/server.mjs +30 -28
- package/dist/{spa-router-CxK3USIz.d.ts → spa-router-BuciWGCZ.d.ts} +3 -3
- package/dist/{spa-router-DbxNRKOB.d.mts → spa-router-DwbqGkGj.d.mts} +3 -3
- package/dist/testing.cjs +9 -9
- package/dist/testing.d.mts +4 -5
- package/dist/testing.d.ts +4 -5
- package/dist/testing.mjs +7 -7
- package/dist/{types-Z0aotQ8w.d.mts → types-CnH8DOqo.d.mts} +1 -1
- package/dist/{types-Z0aotQ8w.d.ts → types-CnH8DOqo.d.ts} +1 -1
- package/dist/{utils-4wVRcpOw.d.mts → utils-B9V0S_yL.d.mts} +1 -1
- package/dist/{utils-311Y8eoK.d.ts → utils-CaoWKtYM.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +28 -26
- package/dist/vite.d.mts +4 -5
- package/dist/vite.d.ts +4 -5
- package/dist/vite.mjs +27 -25
- package/dist/{workflows-CR9ex-gz.d.ts → workflows-jZ4BcdoZ.d.mts} +1 -1
- package/dist/{workflows-CR9ex-gz.d.mts → workflows-jZ4BcdoZ.d.ts} +1 -1
- package/dist/workflows.cjs +3 -3
- package/dist/workflows.d.mts +1 -1
- package/dist/workflows.d.ts +1 -1
- package/dist/workflows.mjs +2 -2
- package/package.json +9 -1
- package/dist/chunk-M64YUMA4.cjs +0 -58
- package/dist/chunk-QLQ32WC4.mjs +0 -58
- package/dist/layers-4PNE2HOY.cjs +0 -18
- package/dist/metadata-2HSU2i_w.d.mts +0 -52
- package/dist/metadata-Cjs8JMRM.d.ts +0 -52
- package/dist/types-DFbjpjXX.d.mts +0 -105
- package/dist/types-DFbjpjXX.d.ts +0 -105
- package/dist/{chunk-2F2ER724.cjs → chunk-BPMATOP2.cjs} +2 -2
- package/dist/{chunk-IHNMMXHV.mjs → chunk-OTC5BDGO.mjs} +3 -3
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getFarmMarkdownMirrorPath,
|
|
3
|
+
isFarmMarkdownMirrorExposed,
|
|
4
|
+
matchesFarmMarkdownRoutePattern
|
|
5
|
+
} from "./chunk-WWIKMBRN.mjs";
|
|
6
|
+
import {
|
|
7
|
+
FARM_INTERNAL_READ_HEADER
|
|
8
|
+
} from "./chunk-MVL2RAJW.mjs";
|
|
9
|
+
import {
|
|
10
|
+
applyFarmBasePath
|
|
11
|
+
} from "./chunk-4RB44K6Z.mjs";
|
|
12
|
+
import {
|
|
13
|
+
__name
|
|
14
|
+
} from "./chunk-LPEX4YW6.mjs";
|
|
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
|
+
__name(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
|
+
__name(resolveRoutePatterns, "resolveRoutePatterns");
|
|
62
|
+
function collectFarmLlmsTxtPages(sources, options) {
|
|
63
|
+
const include = options.include ?? [];
|
|
64
|
+
const exclude = 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) => matchesFarmMarkdownRoutePattern(pattern, path))) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (exclude.some((pattern) => matchesFarmMarkdownRoutePattern(pattern, path))) continue;
|
|
73
|
+
if (isFarmMetadataNoIndex(source.metadata)) continue;
|
|
74
|
+
const target = isFarmMarkdownMirrorExposed(options.markdown, path) ? getFarmMarkdownMirrorPath(path) : path;
|
|
75
|
+
const description = readMetadataString(source.metadata, "description");
|
|
76
|
+
pages.set(path, {
|
|
77
|
+
path,
|
|
78
|
+
title: readMetadataTitle(source.metadata) ?? fallbackPageTitle(path),
|
|
79
|
+
url: `${options.origin}${applyFarmBasePath(target, options.basePath)}`,
|
|
80
|
+
...description ? { description } : {}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return [...pages.values()].sort((left, right) => left.path.localeCompare(right.path));
|
|
84
|
+
}
|
|
85
|
+
__name(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
|
+
__name(isFarmMetadataNoIndex, "isFarmMetadataNoIndex");
|
|
97
|
+
function createFarmDefaultLlmsTxt(options) {
|
|
98
|
+
const { config, pages } = options;
|
|
99
|
+
const mcp = options.mcp ?? [];
|
|
100
|
+
const summary = config.summary ?? readMetadataString(options.rootMetadata, "description");
|
|
101
|
+
return {
|
|
102
|
+
title: config.title ?? readMetadataTitle(options.rootMetadata) ?? pages.find((page) => page.path === "/")?.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
|
+
__name(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 (summary?.trim()) blocks.push(`> ${toSingleLine(summary)}`);
|
|
138
|
+
if (details?.trim()) blocks.push(details.trim());
|
|
139
|
+
for (const [sectionIndex, section] of (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)})${description?.trim() ? `: ${toSingleLine(description)}` : ""}`;
|
|
157
|
+
});
|
|
158
|
+
blocks.push(`## ${toSingleLine(sectionTitle)}`, links.join("\n"));
|
|
159
|
+
}
|
|
160
|
+
return `${blocks.filter(Boolean).join("\n\n")}
|
|
161
|
+
`;
|
|
162
|
+
}
|
|
163
|
+
__name(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", [FARM_INTERNAL_READ_HEADER]: "llms-full" }
|
|
170
|
+
})
|
|
171
|
+
);
|
|
172
|
+
const type = response.headers.get("content-type") ?? "";
|
|
173
|
+
if (!response.ok || !type.toLowerCase().startsWith("text/markdown")) {
|
|
174
|
+
await response.body?.cancel();
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
return await response.text();
|
|
178
|
+
} catch {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
__name(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 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 = options.pageTimeout ?? FARM_LLMS_FULL_PAGE_TIMEOUT_MS;
|
|
200
|
+
const readWithinTimeout = /* @__PURE__ */ __name(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
|
+
options.onIncomplete?.();
|
|
209
|
+
return null;
|
|
210
|
+
} finally {
|
|
211
|
+
clearTimeout(timer);
|
|
212
|
+
}
|
|
213
|
+
}, "readWithinTimeout");
|
|
214
|
+
const contents = await mapWithConcurrency(
|
|
215
|
+
links,
|
|
216
|
+
options.concurrency ?? 4,
|
|
217
|
+
(link) => shouldInlineLlmsLink(link.url, options.origin) ? readWithinTimeout(link.url) : null
|
|
218
|
+
);
|
|
219
|
+
const blocks = [`# ${toSingleLine(llms.title)}`];
|
|
220
|
+
if (llms.summary?.trim()) blocks.push(`> ${toSingleLine(llms.summary)}`);
|
|
221
|
+
if (llms.details?.trim()) blocks.push(llms.details.trim());
|
|
222
|
+
const pages = links.map((link, index2) => {
|
|
223
|
+
const parts = [`## ${toSingleLine(link.title)}`, `URL: ${escapeLinkUrl(link.url)}`];
|
|
224
|
+
if (link.description?.trim()) parts.push(toSingleLine(link.description));
|
|
225
|
+
const content = stripFrontmatter(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
|
+
__name(renderFarmLlmsFullTxt, "renderFarmLlmsFullTxt");
|
|
234
|
+
function createFarmLlmsFullRenderer(options = {}) {
|
|
235
|
+
const now = options.now ?? Date.now;
|
|
236
|
+
const ttl = (options.revalidate ?? 0) * 1e3;
|
|
237
|
+
const maxEntries = options.maxEntries ?? 16;
|
|
238
|
+
const entries = /* @__PURE__ */ new Map();
|
|
239
|
+
let queue = Promise.resolve();
|
|
240
|
+
const settle = /* @__PURE__ */ __name((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__ */ __name(() => {
|
|
249
|
+
complete = false;
|
|
250
|
+
}, "incomplete")
|
|
251
|
+
})
|
|
252
|
+
);
|
|
253
|
+
queue = body.catch(() => {
|
|
254
|
+
});
|
|
255
|
+
const pending = { body, expires: Number.POSITIVE_INFINITY, complete: /* @__PURE__ */ __name(() => 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
|
+
__name(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
|
+
__name(stripFrontmatter, "stripFrontmatter");
|
|
277
|
+
function shouldInlineLlmsLink(url, origin) {
|
|
278
|
+
let target;
|
|
279
|
+
try {
|
|
280
|
+
target = new URL(url, origin);
|
|
281
|
+
} catch {
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
return target.origin === origin && !/\/llms(-full)?\.txt$/.test(target.pathname);
|
|
285
|
+
}
|
|
286
|
+
__name(shouldInlineLlmsLink, "shouldInlineLlmsLink");
|
|
287
|
+
async function mapWithConcurrency(items, limit, run) {
|
|
288
|
+
const results = [];
|
|
289
|
+
let next = 0;
|
|
290
|
+
const worker = /* @__PURE__ */ __name(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
|
+
__name(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
|
+
__name(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
|
+
__name(readMetadataString, "readMetadataString");
|
|
319
|
+
function fallbackPageTitle(path) {
|
|
320
|
+
if (path === "/") return "Home";
|
|
321
|
+
const segments = path.split("/").filter(Boolean);
|
|
322
|
+
const segment = segments[segments.length - 1] ?? path;
|
|
323
|
+
const words = segment.replace(/[-_]+/g, " ").trim();
|
|
324
|
+
return words ? words[0].toUpperCase() + words.slice(1) : path;
|
|
325
|
+
}
|
|
326
|
+
__name(fallbackPageTitle, "fallbackPageTitle");
|
|
327
|
+
function toSingleLine(value) {
|
|
328
|
+
return value.replace(/\s+/g, " ").trim();
|
|
329
|
+
}
|
|
330
|
+
__name(toSingleLine, "toSingleLine");
|
|
331
|
+
function escapeLinkText(value) {
|
|
332
|
+
return toSingleLine(value).replace(/[\\[\]]/g, "\\$&");
|
|
333
|
+
}
|
|
334
|
+
__name(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
|
+
__name(escapeLinkUrl, "escapeLinkUrl");
|
|
342
|
+
function requireText(value, message) {
|
|
343
|
+
if (typeof value !== "string" || !value.trim()) throw new TypeError(message);
|
|
344
|
+
return value;
|
|
345
|
+
}
|
|
346
|
+
__name(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
|
+
__name(optionalText, "optionalText");
|
|
353
|
+
function isRecord(value) {
|
|
354
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
355
|
+
}
|
|
356
|
+
__name(isRecord, "isRecord");
|
|
357
|
+
|
|
358
|
+
export {
|
|
359
|
+
resolveFarmLlmsTxtConfig,
|
|
360
|
+
collectFarmLlmsTxtPages,
|
|
361
|
+
isFarmMetadataNoIndex,
|
|
362
|
+
createFarmDefaultLlmsTxt,
|
|
363
|
+
serializeFarmLlmsTxt,
|
|
364
|
+
createFarmLlmsMarkdownReader,
|
|
365
|
+
renderFarmLlmsFullTxt,
|
|
366
|
+
createFarmLlmsFullRenderer
|
|
367
|
+
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
var _chunkWWFTAUFGcjs = require('./chunk-WWFTAUFG.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
3
7
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
8
|
|
|
5
9
|
// src/client/isolated-boundary.ts
|
|
@@ -63,6 +67,7 @@ function isolateFarmServerPageGraph(ReactRuntime, element) {
|
|
|
63
67
|
return ReactRuntime.createElement(Context.Provider, { value: false }, element);
|
|
64
68
|
}
|
|
65
69
|
_chunkS3JO3N4Hcjs.__name.call(void 0, isolateFarmServerPageGraph, "isolateFarmServerPageGraph");
|
|
70
|
+
var warnedUnserializableBoundaries = /* @__PURE__ */ new Set();
|
|
66
71
|
function createFarmIsolatedClientBoundary(ReactRuntime, Component, moduleReference, exportName, islandStrategy) {
|
|
67
72
|
function FarmIsolatedClientBoundary(props) {
|
|
68
73
|
const Context = getBoundaryGraphContext(ReactRuntime);
|
|
@@ -75,9 +80,12 @@ function createFarmIsolatedClientBoundary(ReactRuntime, Component, moduleReferen
|
|
|
75
80
|
try {
|
|
76
81
|
serializedProps = serializeBoundaryPayload(props);
|
|
77
82
|
} catch (error) {
|
|
78
|
-
|
|
83
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
84
|
+
const warningKey = `${moduleReference}#${exportName}:${message}`;
|
|
85
|
+
if (typeof window === "undefined" && !warnedUnserializableBoundaries.has(warningKey)) {
|
|
86
|
+
warnedUnserializableBoundaries.add(warningKey);
|
|
79
87
|
console.warn(
|
|
80
|
-
`[Farm.js] Could not isolate ${moduleReference}#${exportName}: ${
|
|
88
|
+
`[Farm.js] Could not isolate ${moduleReference}#${exportName}: ${message}. The server-rendered component was preserved without client hydration.`
|
|
81
89
|
);
|
|
82
90
|
}
|
|
83
91
|
return ReactRuntime.createElement(Component, props);
|
|
@@ -109,6 +117,11 @@ function createFarmIsolatedClientBoundary(ReactRuntime, Component, moduleReferen
|
|
|
109
117
|
}
|
|
110
118
|
_chunkS3JO3N4Hcjs.__name.call(void 0, FarmIsolatedClientBoundary, "FarmIsolatedClientBoundary");
|
|
111
119
|
FarmIsolatedClientBoundary.displayName = `FarmIsolated(${Component.displayName || Component.name || exportName})`;
|
|
120
|
+
_chunkWWFTAUFGcjs.markFarmClientReference.call(void 0, FarmIsolatedClientBoundary, {
|
|
121
|
+
reference: moduleReference,
|
|
122
|
+
exportName,
|
|
123
|
+
Component
|
|
124
|
+
});
|
|
112
125
|
return FarmIsolatedClientBoundary;
|
|
113
126
|
}
|
|
114
127
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmIsolatedClientBoundary, "createFarmIsolatedClientBoundary");
|
|
@@ -300,7 +313,7 @@ function createFarmIsolatedHydrationRuntime(options) {
|
|
|
300
313
|
_chunkS3JO3N4Hcjs.__name.call(void 0, hydrate, "hydrate");
|
|
301
314
|
function updateModule(reference, module) {
|
|
302
315
|
const originals = module.__farm_client_boundary_originals__;
|
|
303
|
-
let updated = 0;
|
|
316
|
+
let updated = _chunkWWFTAUFGcjs.updateFarmServerTreeModule.call(void 0, reference, module);
|
|
304
317
|
for (const [container, record] of roots) {
|
|
305
318
|
if (record.reference !== reference) continue;
|
|
306
319
|
const Component = _optionalChain([originals, 'optionalAccess', _15 => _15[record.exportName]]);
|
|
@@ -355,7 +368,7 @@ function createFarmIsolatedHydrationRuntime(options) {
|
|
|
355
368
|
}
|
|
356
369
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmIsolatedHydrationRuntime, "createFarmIsolatedHydrationRuntime");
|
|
357
370
|
function createFarmServerPageBoundary(ReactRuntime, runtime) {
|
|
358
|
-
return /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, function FarmServerPage(props) {
|
|
371
|
+
return /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, function FarmServerPage({ as = "div", ...props }) {
|
|
359
372
|
const ref = ReactRuntime.useRef(null);
|
|
360
373
|
const html = props.dangerouslySetInnerHTML.__html;
|
|
361
374
|
ReactRuntime.useLayoutEffect(() => {
|
|
@@ -376,7 +389,7 @@ function createFarmServerPageBoundary(ReactRuntime, runtime) {
|
|
|
376
389
|
});
|
|
377
390
|
};
|
|
378
391
|
}, [html]);
|
|
379
|
-
return ReactRuntime.createElement(
|
|
392
|
+
return ReactRuntime.createElement(as, { ...props, ref });
|
|
380
393
|
}, "FarmServerPage");
|
|
381
394
|
}
|
|
382
395
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmServerPageBoundary, "createFarmServerPageBoundary");
|
|
@@ -17,6 +17,7 @@ async function resolveFarmNotFoundMetadata(layoutModules, notFoundModule) {
|
|
|
17
17
|
if (typeof layout.generateMetadata === "function") {
|
|
18
18
|
metadata = mergeMetadata(metadata, await layout.generateMetadata({ params: {} }));
|
|
19
19
|
}
|
|
20
|
+
metadata = await mergeModuleViewport(metadata, layout, { params: {} });
|
|
20
21
|
}
|
|
21
22
|
let own = {};
|
|
22
23
|
let latestTitle;
|
|
@@ -28,6 +29,7 @@ async function resolveFarmNotFoundMetadata(layoutModules, notFoundModule) {
|
|
|
28
29
|
own = mergeMetadata(own, generated);
|
|
29
30
|
if (_optionalChain([generated, 'optionalAccess', _3 => _3.title]) !== void 0) latestTitle = generated.title;
|
|
30
31
|
}
|
|
32
|
+
own = await mergeModuleViewport(own, notFoundModule, { params: {}, searchParams: {} });
|
|
31
33
|
}
|
|
32
34
|
const title = isRecord(latestTitle) && normalizeContent(latestTitle.absolute) ? latestTitle : own.title;
|
|
33
35
|
return mergeMetadata(metadata, { ...own, title: _nullishCoalesce(title, () => ( FARM_NOT_FOUND_TITLE)) });
|
|
@@ -46,10 +48,67 @@ function mergeMetadata(base, next) {
|
|
|
46
48
|
twitter: mergeNestedMetadata(base.twitter, next.twitter),
|
|
47
49
|
alternates: mergeNestedMetadata(base.alternates, next.alternates),
|
|
48
50
|
icons: mergeNestedMetadata(base.icons, next.icons),
|
|
49
|
-
verification: mergeNestedMetadata(base.verification, next.verification)
|
|
51
|
+
verification: mergeNestedMetadata(base.verification, next.verification),
|
|
52
|
+
viewport: mergeNestedMetadata(base.viewport, next.viewport)
|
|
50
53
|
};
|
|
51
54
|
}
|
|
52
55
|
_chunkS3JO3N4Hcjs.__name.call(void 0, mergeMetadata, "mergeMetadata");
|
|
56
|
+
async function mergeModuleViewport(metadata, module, props) {
|
|
57
|
+
let merged = metadata;
|
|
58
|
+
if (isRecord(_optionalChain([module, 'optionalAccess', _4 => _4.viewport]))) {
|
|
59
|
+
merged = mergeMetadata(merged, { viewport: module.viewport });
|
|
60
|
+
}
|
|
61
|
+
if (typeof _optionalChain([module, 'optionalAccess', _5 => _5.generateViewport]) === "function") {
|
|
62
|
+
const generated = await module.generateViewport(props);
|
|
63
|
+
if (isRecord(generated)) merged = mergeMetadata(merged, { viewport: generated });
|
|
64
|
+
}
|
|
65
|
+
return merged;
|
|
66
|
+
}
|
|
67
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, mergeModuleViewport, "mergeModuleViewport");
|
|
68
|
+
var DEFAULT_VIEWPORT = { width: "device-width", initialScale: 1 };
|
|
69
|
+
var VIEWPORT_CONTENT_KEYS = [
|
|
70
|
+
["width", "width"],
|
|
71
|
+
["height", "height"],
|
|
72
|
+
["initialScale", "initial-scale"],
|
|
73
|
+
["minimumScale", "minimum-scale"],
|
|
74
|
+
["maximumScale", "maximum-scale"],
|
|
75
|
+
["userScalable", "user-scalable"],
|
|
76
|
+
["viewportFit", "viewport-fit"],
|
|
77
|
+
["interactiveWidget", "interactive-widget"]
|
|
78
|
+
];
|
|
79
|
+
function renderViewportHead(viewport) {
|
|
80
|
+
const marker = ` ${FARM_METADATA_ATTRIBUTE}`;
|
|
81
|
+
if (typeof viewport === "string") {
|
|
82
|
+
return `<meta name="viewport" content="${escapeAttribute(viewport)}"${marker}>`;
|
|
83
|
+
}
|
|
84
|
+
const resolved = {
|
|
85
|
+
...DEFAULT_VIEWPORT,
|
|
86
|
+
...isRecord(viewport) ? viewport : {}
|
|
87
|
+
};
|
|
88
|
+
const content = VIEWPORT_CONTENT_KEYS.flatMap(([key, name]) => {
|
|
89
|
+
const value = resolved[key];
|
|
90
|
+
if (value === void 0 || value === null || value === "") return [];
|
|
91
|
+
if (typeof value === "boolean") return [`${name}=${value ? "yes" : "no"}`];
|
|
92
|
+
return [`${name}=${String(value)}`];
|
|
93
|
+
}).join(", ");
|
|
94
|
+
const tags = content ? [`<meta name="viewport" content="${escapeAttribute(content)}"${marker}>`] : [];
|
|
95
|
+
const themeColors = Array.isArray(resolved.themeColor) ? resolved.themeColor : resolved.themeColor === void 0 ? [] : [resolved.themeColor];
|
|
96
|
+
for (const entry of themeColors) {
|
|
97
|
+
const color = typeof entry === "string" ? entry : isRecord(entry) ? entry.color : void 0;
|
|
98
|
+
const content2 = normalizeContent(color);
|
|
99
|
+
if (!content2) continue;
|
|
100
|
+
const media = isRecord(entry) ? normalizeContent(entry.media) : void 0;
|
|
101
|
+
tags.push(
|
|
102
|
+
`<meta name="theme-color" content="${escapeAttribute(content2)}"${media ? ` media="${escapeAttribute(media)}"` : ""}${marker}>`
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
const colorScheme = normalizeContent(resolved.colorScheme);
|
|
106
|
+
if (colorScheme) {
|
|
107
|
+
tags.push(`<meta name="color-scheme" content="${escapeAttribute(colorScheme)}"${marker}>`);
|
|
108
|
+
}
|
|
109
|
+
return tags.join("\n ");
|
|
110
|
+
}
|
|
111
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, renderViewportHead, "renderViewportHead");
|
|
53
112
|
function mergeMetadataTitle(base, next) {
|
|
54
113
|
if (next === void 0) return base;
|
|
55
114
|
const parentTemplate = isRecord(base) ? normalizeContent(base.template) : void 0;
|
|
@@ -137,8 +196,8 @@ function renderMetadataHead(metadata, options = {}) {
|
|
|
137
196
|
appendMetaName(tags, "author", resolvedMetadata.author);
|
|
138
197
|
if (Array.isArray(resolvedMetadata.authors)) {
|
|
139
198
|
for (const author of resolvedMetadata.authors) {
|
|
140
|
-
appendMetaName(tags, "author", _optionalChain([author, 'optionalAccess',
|
|
141
|
-
if (_optionalChain([author, 'optionalAccess',
|
|
199
|
+
appendMetaName(tags, "author", _optionalChain([author, 'optionalAccess', _6 => _6.name]));
|
|
200
|
+
if (_optionalChain([author, 'optionalAccess', _7 => _7.url])) {
|
|
142
201
|
appendLink(tags, "author", resolveMetadataUrl(author.url, metadataBase));
|
|
143
202
|
}
|
|
144
203
|
}
|
|
@@ -209,7 +268,8 @@ function renderMetadataHead(metadata, options = {}) {
|
|
|
209
268
|
tags: tags.length > 0 ? `
|
|
210
269
|
${tags.join("\n ")}` : "",
|
|
211
270
|
hasFavicon,
|
|
212
|
-
hasExplicitTitle: Boolean(explicitTitle)
|
|
271
|
+
hasExplicitTitle: Boolean(explicitTitle),
|
|
272
|
+
viewport: renderViewportHead(resolvedMetadata.viewport)
|
|
213
273
|
};
|
|
214
274
|
}
|
|
215
275
|
_chunkS3JO3N4Hcjs.__name.call(void 0, renderMetadataHead, "renderMetadataHead");
|
|
@@ -485,4 +545,6 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, escapeAttribute, "escapeAttribute");
|
|
|
485
545
|
|
|
486
546
|
|
|
487
547
|
|
|
488
|
-
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
exports.FARM_METADATA_ATTRIBUTE = FARM_METADATA_ATTRIBUTE; exports.resolveFarmNotFoundMetadata = resolveFarmNotFoundMetadata; exports.mergeMetadata = mergeMetadata; exports.mergeModuleViewport = mergeModuleViewport; exports.renderViewportHead = renderViewportHead; exports.addMetadataImageReference = addMetadataImageReference; exports.addMetadataMarkdownAlternate = addMetadataMarkdownAlternate; exports.renderMetadataHead = renderMetadataHead; exports.resolveMetadataTitle = resolveMetadataTitle;
|
|
@@ -40,7 +40,16 @@ async function hydrateFarmDocsAdapterRuntime() {
|
|
|
40
40
|
}
|
|
41
41
|
__name(generateFarmDocsAdapterClientRuntime, "generateFarmDocsAdapterClientRuntime");
|
|
42
42
|
|
|
43
|
+
// src/docs/config-secrets.ts
|
|
44
|
+
function isSecretDocsConfigKey(key) {
|
|
45
|
+
const normalized = key.replace(/[-_]/g, "").toLowerCase();
|
|
46
|
+
if (!normalized || normalized.endsWith("env")) return false;
|
|
47
|
+
return /apikey|token|secret|password|authorization|credential/.test(normalized);
|
|
48
|
+
}
|
|
49
|
+
__name(isSecretDocsConfigKey, "isSecretDocsConfigKey");
|
|
50
|
+
|
|
43
51
|
export {
|
|
44
52
|
getFarmDocsAdapterConfigModule,
|
|
45
|
-
generateFarmDocsAdapterClientRuntime
|
|
53
|
+
generateFarmDocsAdapterClientRuntime,
|
|
54
|
+
isSecretDocsConfigKey
|
|
46
55
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkJ63ZH5OQcjs = require('./chunk-J63ZH5OQ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk75RZHGLScjs = require('./chunk-75RZHGLS.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkFJ3M4CUXcjs = require('./chunk-FJ3M4CUX.cjs');
|
|
@@ -442,7 +442,7 @@ async function createMarkdownMirrorResponse(options) {
|
|
|
442
442
|
for (const form of actions) {
|
|
443
443
|
if (!_optionalChain([form, 'access', _16 => _16.action, 'optionalAccess', _17 => _17.startsWith, 'call', _18 => _18("/")])) continue;
|
|
444
444
|
const pathname = new URL(form.action, pageUrl.origin).pathname;
|
|
445
|
-
const tool = _nullishCoalesce(
|
|
445
|
+
const tool = _nullishCoalesce(_chunk75RZHGLScjs._findFarmMCPEndpointTool.call(void 0, form.method, pathname, options.apiServerBasePath), () => ( _chunk75RZHGLScjs._findFarmMCPEndpointTool.call(void 0, form.method, _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, pathname), options.apiServerBasePath)));
|
|
446
446
|
if (tool) form.tool = tool;
|
|
447
447
|
}
|
|
448
448
|
const markdown = pageResponse.status < 400 && requestUrl.searchParams.has("actions") ? "" : convertHtmlToMarkdown(
|