@farm.js/core 0.1.34 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-runtime.cjs +3 -3
- package/dist/agent-runtime.d.mts +4 -5
- package/dist/agent-runtime.d.ts +4 -5
- package/dist/agent-runtime.mjs +2 -2
- package/dist/api/route-manager.cjs +5 -5
- package/dist/api/route-manager.d.mts +6 -7
- package/dist/api/route-manager.d.ts +6 -7
- package/dist/api/route-manager.mjs +4 -4
- package/dist/api/runtime.cjs +6 -4
- package/dist/api/runtime.d.mts +4 -5
- package/dist/api/runtime.d.ts +4 -5
- package/dist/api/runtime.mjs +6 -4
- package/dist/api.cjs +6 -6
- package/dist/api.d.mts +7 -8
- package/dist/api.d.ts +7 -8
- package/dist/api.mjs +5 -5
- package/dist/{app-DgotYGbq.d.ts → app-BXB3JZYc.d.ts} +38 -12
- package/dist/{app-q4rmZlXK.d.mts → app-D_j9AAVL.d.mts} +38 -12
- package/dist/app-markdown.cjs +5 -5
- package/dist/app-markdown.d.mts +5 -6
- package/dist/app-markdown.d.ts +5 -6
- package/dist/app-markdown.mjs +4 -4
- package/dist/{chunk-LMJ7VRHZ.mjs → chunk-22LTEMGQ.mjs} +1 -1
- package/dist/{chunk-AQZFOP7S.mjs → chunk-2G2NNLE2.mjs} +1 -1
- package/dist/{chunk-QJ3J6MZT.cjs → chunk-3BHT4WMP.cjs} +2 -2
- package/dist/{chunk-X242HVD5.mjs → chunk-3PXS2MHU.mjs} +1 -1
- package/dist/{chunk-A5FGU2WU.cjs → chunk-3UH7MRCP.cjs} +19 -23
- package/dist/{chunk-AGC75XAE.mjs → chunk-4JHOT46A.mjs} +1 -1
- package/dist/{chunk-XV5DJTBX.mjs → chunk-4KU5Q7C2.mjs} +424 -230
- package/dist/{chunk-TA5G2HWD.cjs → chunk-4MMGO7YW.cjs} +21 -21
- package/dist/{chunk-7BT4H4P7.cjs → chunk-62XKI4Z3.cjs} +2 -2
- package/dist/{chunk-ZKP7C2B6.mjs → chunk-6DU6UFUE.mjs} +12 -11
- package/dist/{chunk-GOABMOX3.mjs → chunk-6ETPZTJI.mjs} +366 -4
- package/dist/{chunk-7Y6ZNFPX.mjs → chunk-6TJOML4E.mjs} +13 -3
- package/dist/{chunk-3ATMYLLJ.mjs → chunk-6WCPV6G2.mjs} +1 -1
- package/dist/{chunk-BTAG7LI7.cjs → chunk-73MC7ZL6.cjs} +2 -2
- package/dist/chunk-75RZHGLS.cjs +135 -0
- package/dist/{chunk-VKNHTSAP.cjs → chunk-7GLPRTTF.cjs} +2 -2
- package/dist/{chunk-7M52YUMY.cjs → chunk-7L5V3KQO.cjs} +2 -2
- package/dist/{chunk-LI2LMOLR.mjs → chunk-C35ZBVRD.mjs} +12 -3
- package/dist/{chunk-YQVSHTMR.mjs → chunk-CP6X4AEU.mjs} +1 -1
- package/dist/{chunk-QZCT2CQ4.mjs → chunk-CXEN47J3.mjs} +64 -2
- package/dist/{chunk-ATK2R4CH.cjs → chunk-D227TIEN.cjs} +14 -4
- package/dist/{chunk-ROUTX2E5.cjs → chunk-DBNKI4NF.cjs} +12 -3
- package/dist/{chunk-UX5S4JEO.cjs → chunk-EFCQPQMG.cjs} +3 -3
- package/dist/{chunk-K3F2E6GS.cjs → chunk-EJQT6KZN.cjs} +2 -2
- 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-WNNYOOIB.mjs → chunk-F6Z3Y5KL.mjs} +1 -1
- package/dist/{chunk-PQDFUSXD.cjs → chunk-F7JZENPF.cjs} +33 -32
- package/dist/{chunk-TDFPACVX.cjs → chunk-FTFYRMQQ.cjs} +18 -18
- package/dist/{chunk-657WJNRY.mjs → chunk-G5RT7EXW.mjs} +1 -1
- package/dist/{chunk-MOKLYNHV.cjs → chunk-GFHLGIYC.cjs} +6 -6
- package/dist/{chunk-AWC4VUZL.cjs → chunk-GQ3Z3IZI.cjs} +14 -14
- package/dist/{chunk-75WGQVQA.cjs → chunk-HITLGIAO.cjs} +10 -1
- package/dist/{chunk-GNSDTTWZ.mjs → chunk-HMIJDL7S.mjs} +1 -1
- package/dist/{chunk-PXKIEXZD.mjs → chunk-HUMR6LSU.mjs} +1 -1
- package/dist/{chunk-SJVKK4JE.cjs → chunk-ICUQICNC.cjs} +912 -718
- package/dist/{chunk-P64MIF5B.cjs → chunk-IPXLADVO.cjs} +387 -25
- package/dist/{chunk-KROWKCUH.cjs → chunk-JGLC4TO3.cjs} +8 -1
- package/dist/{chunk-2NQQ5H5G.cjs → chunk-M7MKQXAF.cjs} +2 -1
- package/dist/chunk-NRDBW4MP.mjs +45 -0
- package/dist/chunk-OFZUJMCU.mjs +601 -0
- package/dist/{chunk-VCCUOMQN.mjs → chunk-OKZUAXHF.mjs} +1 -1
- package/dist/{chunk-EM6SBQKM.cjs → chunk-OMVAU7NT.cjs} +27 -2
- package/dist/{chunk-O27L4YAA.mjs → chunk-PDOCJ6RY.mjs} +2 -2
- package/dist/{chunk-36MK5YCW.cjs → chunk-PFQKNERH.cjs} +346 -206
- package/dist/{chunk-HR5KPHC2.mjs → chunk-Q3VLETLE.mjs} +1 -1
- package/dist/{chunk-LR5QSC2P.mjs → chunk-QAU5JD57.mjs} +211 -71
- package/dist/{chunk-LHODW25H.mjs → chunk-QORUJDIV.mjs} +2 -2
- package/dist/{chunk-UBO4SGH4.mjs → chunk-RHAZ22ZN.mjs} +2 -1
- package/dist/{chunk-ZHPHJPQP.cjs → chunk-RU3M2FIK.cjs} +18 -14
- package/dist/{chunk-JDPAKVS4.mjs → chunk-SAZVVAJH.mjs} +3 -3
- package/dist/{chunk-6VVL3MHY.mjs → chunk-SC2WYWPF.mjs} +1 -1
- package/dist/{chunk-QCFFHV5H.mjs → chunk-SMHH4VDG.mjs} +1 -1
- package/dist/{chunk-U4PTAHW3.mjs → chunk-SOMHP6GF.mjs} +7 -11
- package/dist/{chunk-VHANUNEG.mjs → chunk-UAORZ7QA.mjs} +2 -2
- package/dist/{chunk-NGVORZVZ.mjs → chunk-UJD4PHYB.mjs} +15 -11
- package/dist/{chunk-U74I55WB.cjs → chunk-ULAWS2PA.cjs} +13 -3
- package/dist/{chunk-MPEYMSCF.cjs → chunk-VFQT3LAO.cjs} +5 -5
- package/dist/{chunk-Z2YLTERK.cjs → chunk-VZJR7UTG.cjs} +6 -6
- package/dist/chunk-WWFTAUFG.cjs +45 -0
- package/dist/{chunk-ZUSJDQ2Q.mjs → chunk-WWIKMBRN.mjs} +1 -1
- package/dist/{chunk-QGYRXFU2.cjs → chunk-X6W5FFH6.cjs} +8 -8
- package/dist/{chunk-MIDIZJZC.cjs → chunk-XBML5KMG.cjs} +8 -8
- package/dist/{chunk-G26MUMKL.cjs → chunk-XCACDAZZ.cjs} +4 -4
- package/dist/{chunk-CLJYVZAD.mjs → chunk-XCMCS4DA.mjs} +11 -1
- package/dist/{chunk-XF7Q24PF.mjs → chunk-Y7RKTKYI.mjs} +25 -0
- package/dist/{chunk-ODBZYBAB.cjs → chunk-YC6V7PWE.cjs} +1 -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-3VSKDFAT.mjs → chunk-YULD7ICZ.mjs} +1 -1
- package/dist/chunk-ZLAT2CWY.mjs +135 -0
- package/dist/{chunk-T5CERMEH.cjs → chunk-ZXGAFZDO.cjs} +2 -2
- package/dist/{client-plugins-CLObcuCq.d.mts → client-plugins-CvIslxWi.d.mts} +207 -7
- package/dist/{client-plugins-DZjHC4Mi.d.ts → client-plugins-HIyulDym.d.ts} +207 -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-HU6Y2MNV.cjs → devtools-EAUY43BS.cjs} +9 -9
- package/dist/{devtools-RNXCTS4R.mjs → devtools-EE5RIBTH.mjs} +8 -8
- package/dist/docs.cjs +12 -12
- package/dist/docs.d.mts +41 -4
- package/dist/docs.d.ts +41 -4
- package/dist/docs.mjs +11 -11
- 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 +38 -35
- package/dist/index.d.mts +19 -20
- package/dist/index.d.ts +19 -20
- package/dist/index.mjs +37 -34
- package/dist/integrations.cjs +3 -3
- package/dist/integrations.d.mts +4 -5
- package/dist/integrations.d.ts +4 -5
- package/dist/integrations.mjs +2 -2
- package/dist/internal/app-markdown-runtime.cjs +4 -4
- 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 +3 -3
- package/dist/internal/build-runtime.cjs +26 -26
- package/dist/internal/build-runtime.d.mts +6 -7
- package/dist/internal/build-runtime.d.ts +6 -7
- package/dist/internal/build-runtime.mjs +25 -25
- package/dist/internal/cli-runtime.cjs +13 -13
- package/dist/internal/cli-runtime.mjs +12 -12
- 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 +9 -9
- package/dist/internal/config-runtime.d.mts +5 -6
- package/dist/internal/config-runtime.d.ts +5 -6
- package/dist/internal/config-runtime.mjs +8 -8
- package/dist/internal/isolated-boundary.cjs +3 -2
- package/dist/internal/isolated-boundary.d.mts +1 -0
- package/dist/internal/isolated-boundary.d.ts +1 -0
- 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 +47 -23
- package/dist/internal/production-runtime.d.mts +58 -18
- package/dist/internal/production-runtime.d.ts +58 -18
- package/dist/internal/production-runtime.mjs +43 -19
- 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/markdown.cjs +3 -3
- package/dist/markdown.d.mts +4 -5
- package/dist/markdown.d.ts +4 -5
- package/dist/markdown.mjs +2 -2
- package/dist/{metadata-Cjs8JMRM.d.ts → metadata-BnLDsUOS.d.ts} +16 -2
- package/dist/{metadata-2HSU2i_w.d.mts → metadata-WGpBYcGn.d.mts} +16 -2
- package/dist/middleware.cjs +4 -4
- package/dist/middleware.d.mts +6 -7
- package/dist/middleware.d.ts +6 -7
- package/dist/middleware.mjs +3 -3
- 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-4XGPNIK4.mjs → nitro-MXRDCXWZ.mjs} +2 -2
- package/dist/{nitro-HSAQFXSS.cjs → nitro-OVPLKPE2.cjs} +3 -3
- 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 +22 -22
- package/dist/plugin.d.mts +4 -5
- package/dist/plugin.d.ts +4 -5
- package/dist/plugin.mjs +21 -21
- package/dist/{production-runtime-CysZl3EV.d.mts → production-runtime-0sRnuYc-.d.mts} +4 -4
- package/dist/{production-runtime-BU5ETAK9.d.ts → production-runtime-Crq6CJ-2.d.ts} +4 -4
- package/dist/query/client.cjs +6 -6
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan-D72O1qm4.d.ts → render-plan-8ozZh2Qv.d.ts} +1 -1
- package/dist/{render-plan-CKr4ltOd.d.mts → render-plan-gs9GGPzw.d.mts} +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-B5G8rLBH.d.ts} +1 -1
- package/dist/{request-Be83WafN.d.mts → request-fkhiynXe.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-BG56SzvJ.d.mts → route-rendering-CLnS7AZj.d.mts} +1 -1
- package/dist/{route-rendering-CtVMpV-k.d.ts → route-rendering-lS5nUMua.d.ts} +1 -1
- package/dist/{router-D94-SDlW.d.ts → router-4iuiYnOW.d.ts} +1 -1
- package/dist/{router-ALUvm8gC.d.mts → router-ifU8Dui1.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-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 +41 -41
- package/dist/server.d.mts +13 -14
- package/dist/server.d.ts +13 -14
- package/dist/server.mjs +24 -24
- package/dist/{spa-router-DbxNRKOB.d.mts → spa-router-Bq7VCOwx.d.mts} +3 -3
- package/dist/{spa-router-CxK3USIz.d.ts → spa-router-DaJk5Re4.d.ts} +3 -3
- package/dist/testing.cjs +7 -7
- package/dist/testing.d.mts +4 -5
- package/dist/testing.d.ts +4 -5
- package/dist/testing.mjs +5 -5
- 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-311Y8eoK.d.ts → utils-BXLmFsVR.d.ts} +1 -1
- package/dist/{utils-4wVRcpOw.d.mts → utils-XJn0c9bj.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +22 -22
- package/dist/vite.d.mts +4 -5
- package/dist/vite.d.ts +4 -5
- package/dist/vite.mjs +21 -21
- 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/types-DFbjpjXX.d.mts +0 -105
- package/dist/types-DFbjpjXX.d.ts +0 -105
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkEUV4YR3Vcjs = require('./chunk-EUV4YR3V.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkJ63ZH5OQcjs = require('./chunk-J63ZH5OQ.cjs');
|
|
@@ -70,12 +70,12 @@ function collectFarmLlmsTxtPages(sources, options) {
|
|
|
70
70
|
for (const source of sources) {
|
|
71
71
|
const path = source.pattern;
|
|
72
72
|
if (path.includes("[") || pages.has(path)) continue;
|
|
73
|
-
if (include.length && !include.some((pattern) =>
|
|
73
|
+
if (include.length && !include.some((pattern) => _chunkEUV4YR3Vcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) {
|
|
74
74
|
continue;
|
|
75
75
|
}
|
|
76
|
-
if (exclude.some((pattern) =>
|
|
76
|
+
if (exclude.some((pattern) => _chunkEUV4YR3Vcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) continue;
|
|
77
77
|
if (isMetadataNoIndex(source.metadata)) continue;
|
|
78
|
-
const target =
|
|
78
|
+
const target = _chunkEUV4YR3Vcjs.isFarmMarkdownMirrorExposed.call(void 0, options.markdown, path) ? _chunkEUV4YR3Vcjs.getFarmMarkdownMirrorPath.call(void 0, path) : path;
|
|
79
79
|
const description = readMetadataString(source.metadata, "description");
|
|
80
80
|
pages.set(path, {
|
|
81
81
|
path,
|
|
@@ -100,21 +100,25 @@ function isMetadataNoIndex(metadata) {
|
|
|
100
100
|
_chunkS3JO3N4Hcjs.__name.call(void 0, isMetadataNoIndex, "isMetadataNoIndex");
|
|
101
101
|
function createFarmDefaultLlmsTxt(options) {
|
|
102
102
|
const { config, pages } = options;
|
|
103
|
+
const mcp = _nullishCoalesce(options.mcp, () => ( []));
|
|
103
104
|
const summary = _nullishCoalesce(config.summary, () => ( readMetadataString(options.rootMetadata, "description")));
|
|
104
105
|
return {
|
|
105
106
|
title: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(config.title, () => ( readMetadataTitle(options.rootMetadata))), () => ( _optionalChain([pages, 'access', _2 => _2.find, 'call', _3 => _3((page) => page.path === "/"), 'optionalAccess', _4 => _4.title]))), () => ( new URL(options.origin).host)),
|
|
106
107
|
...summary ? { summary } : {},
|
|
107
108
|
...config.details ? { details: config.details } : {},
|
|
108
|
-
sections:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
title,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
sections: [
|
|
110
|
+
...pages.length ? [
|
|
111
|
+
{
|
|
112
|
+
title: "Pages",
|
|
113
|
+
links: pages.map(({ title, url, description }) => ({
|
|
114
|
+
title,
|
|
115
|
+
url,
|
|
116
|
+
...description ? { description } : {}
|
|
117
|
+
}))
|
|
118
|
+
}
|
|
119
|
+
] : [],
|
|
120
|
+
...mcp.length ? [{ title: "MCP", links: mcp }] : []
|
|
121
|
+
]
|
|
118
122
|
};
|
|
119
123
|
}
|
|
120
124
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmDefaultLlmsTxt, "createFarmDefaultLlmsTxt");
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-IOEH4VWN.mjs";
|
|
7
7
|
import {
|
|
8
8
|
APIRouteConflictError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-22LTEMGQ.mjs";
|
|
10
10
|
import {
|
|
11
11
|
findProgrammaticRouteFilesInDir
|
|
12
12
|
} from "./chunk-UDNPLXW7.mjs";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
matchAPIRouteAtBasePath,
|
|
21
21
|
mergePluginAPIRoutes,
|
|
22
22
|
resolveAPIRouteEndpoint
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-G5RT7EXW.mjs";
|
|
24
24
|
import {
|
|
25
25
|
isProgrammaticRoutesFileName
|
|
26
26
|
} from "./chunk-EA5K5BKU.mjs";
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
createFarmRequestBodyErrorResponse,
|
|
29
29
|
readNodeRequestBody,
|
|
30
30
|
resolveFarmServerConfig
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-Y7RKTKYI.mjs";
|
|
32
32
|
import {
|
|
33
33
|
createCliColors
|
|
34
34
|
} from "./chunk-I2BHUNBU.mjs";
|
|
@@ -3,17 +3,18 @@ import {
|
|
|
3
3
|
loadFarmDocsPage,
|
|
4
4
|
resolveFarmDocsContentDir,
|
|
5
5
|
toFarmDocsMarkdownPage
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PDOCJ6RY.mjs";
|
|
7
7
|
import {
|
|
8
8
|
docsEngine,
|
|
9
9
|
loadFarmDocsEngine
|
|
10
10
|
} from "./chunk-2VQKKQ6D.mjs";
|
|
11
11
|
import {
|
|
12
12
|
resolveDocsConfig
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-6DU6UFUE.mjs";
|
|
14
14
|
import {
|
|
15
|
-
getFarmDocsAdapterConfigModule
|
|
16
|
-
|
|
15
|
+
getFarmDocsAdapterConfigModule,
|
|
16
|
+
isSecretDocsConfigKey
|
|
17
|
+
} from "./chunk-ENLZ4R3Y.mjs";
|
|
17
18
|
import {
|
|
18
19
|
__name
|
|
19
20
|
} from "./chunk-LPEX4YW6.mjs";
|
|
@@ -118,7 +119,8 @@ async function createFarmDocsAdapterHandler(docs, options) {
|
|
|
118
119
|
clientEntry: options.clientEntry,
|
|
119
120
|
stylesheets: getFarmDocsAdapterStylesheets(options),
|
|
120
121
|
resolveLayoutFonts: options.resolveLayoutFonts,
|
|
121
|
-
loadReactModule: /* @__PURE__ */ __name(() => options.loadModule(docs.adapter.react), "loadReactModule")
|
|
122
|
+
loadReactModule: /* @__PURE__ */ __name(() => options.loadModule(docs.adapter.react), "loadReactModule"),
|
|
123
|
+
...options.registerMCPServer ? { registerMCPServer: options.registerMCPServer } : {}
|
|
122
124
|
});
|
|
123
125
|
}
|
|
124
126
|
__name(createFarmDocsAdapterHandler, "createFarmDocsAdapterHandler");
|
|
@@ -433,12 +435,6 @@ function buildAgentSpec(context, request) {
|
|
|
433
435
|
}
|
|
434
436
|
__name(buildAgentSpec, "buildAgentSpec");
|
|
435
437
|
var REDACTED_DOCS_CONFIG_VALUE = "[redacted]";
|
|
436
|
-
function isSecretDocsConfigKey(key) {
|
|
437
|
-
const normalized = key.replace(/[-_]/g, "").toLowerCase();
|
|
438
|
-
if (!normalized || normalized.endsWith("env")) return false;
|
|
439
|
-
return /apikey|token|secret|password|authorization|credential/.test(normalized);
|
|
440
|
-
}
|
|
441
|
-
__name(isSecretDocsConfigKey, "isSecretDocsConfigKey");
|
|
442
438
|
function redactDocsConfigValue(value, key, inHeaders) {
|
|
443
439
|
if (Array.isArray(value)) {
|
|
444
440
|
return value.map((entry) => redactDocsConfigValue(entry, key, inHeaders));
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
_runServerFunctionForCaller,
|
|
5
5
|
createServerFn,
|
|
6
6
|
createServerFunctionDescriptor
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-Q3VLETLE.mjs";
|
|
8
8
|
import {
|
|
9
9
|
createFarmServerQueryResult
|
|
10
10
|
} from "./chunk-KGB5UXJJ.mjs";
|
|
11
11
|
import {
|
|
12
12
|
getServerActionExecutionContext
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-SMHH4VDG.mjs";
|
|
14
14
|
import {
|
|
15
15
|
createRouteDataCacheTag,
|
|
16
16
|
getFarmDataCache
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
getFarmMarkdownMirrorPath,
|
|
3
3
|
isFarmMarkdownMirrorExposed,
|
|
4
4
|
matchesFarmMarkdownRoutePattern
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-WWIKMBRN.mjs";
|
|
6
6
|
import {
|
|
7
7
|
FARM_INTERNAL_READ_HEADER
|
|
8
8
|
} from "./chunk-MVL2RAJW.mjs";
|
|
@@ -100,21 +100,25 @@ function isMetadataNoIndex(metadata) {
|
|
|
100
100
|
__name(isMetadataNoIndex, "isMetadataNoIndex");
|
|
101
101
|
function createFarmDefaultLlmsTxt(options) {
|
|
102
102
|
const { config, pages } = options;
|
|
103
|
+
const mcp = options.mcp ?? [];
|
|
103
104
|
const summary = config.summary ?? readMetadataString(options.rootMetadata, "description");
|
|
104
105
|
return {
|
|
105
106
|
title: config.title ?? readMetadataTitle(options.rootMetadata) ?? pages.find((page) => page.path === "/")?.title ?? new URL(options.origin).host,
|
|
106
107
|
...summary ? { summary } : {},
|
|
107
108
|
...config.details ? { details: config.details } : {},
|
|
108
|
-
sections:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
title,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
sections: [
|
|
110
|
+
...pages.length ? [
|
|
111
|
+
{
|
|
112
|
+
title: "Pages",
|
|
113
|
+
links: pages.map(({ title, url, description }) => ({
|
|
114
|
+
title,
|
|
115
|
+
url,
|
|
116
|
+
...description ? { description } : {}
|
|
117
|
+
}))
|
|
118
|
+
}
|
|
119
|
+
] : [],
|
|
120
|
+
...mcp.length ? [{ title: "MCP", links: mcp }] : []
|
|
121
|
+
]
|
|
118
122
|
};
|
|
119
123
|
}
|
|
120
124
|
__name(createFarmDefaultLlmsTxt, "createFarmDefaultLlmsTxt");
|
|
@@ -1,6 +1,7 @@
|
|
|
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
|
-
|
|
3
|
+
|
|
4
|
+
var _chunkM7MKQXAFcjs = require('./chunk-M7MKQXAF.cjs');
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
|
|
@@ -193,7 +194,16 @@ var _path = require('path'); var path = _interopRequireWildcard(_path);
|
|
|
193
194
|
|
|
194
195
|
// src/middleware/path.ts
|
|
195
196
|
function appendMiddlewareRoutePath(routePath, directoryName) {
|
|
196
|
-
|
|
197
|
+
const marker = _chunkM7MKQXAFcjs.parseInterceptionMarker.call(void 0, directoryName);
|
|
198
|
+
if (marker) {
|
|
199
|
+
const owner = routePath.split("/").filter(Boolean);
|
|
200
|
+
const parts = [
|
|
201
|
+
...marker.root ? [] : owner.slice(0, Math.max(0, owner.length - marker.up)),
|
|
202
|
+
...marker.remainder ? [marker.remainder] : []
|
|
203
|
+
];
|
|
204
|
+
return `/${parts.join("/")}`;
|
|
205
|
+
}
|
|
206
|
+
if (directoryName.startsWith("(") && directoryName.endsWith(")") || _chunkM7MKQXAFcjs.isRouteSlotSegment.call(void 0, directoryName)) {
|
|
197
207
|
return routePath;
|
|
198
208
|
}
|
|
199
209
|
return routePath === "/" ? `/${directoryName}` : `${routePath}/${directoryName}`;
|
|
@@ -287,7 +297,7 @@ var _MiddlewareManager = class _MiddlewareManager {
|
|
|
287
297
|
}
|
|
288
298
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
289
299
|
for (const entry of entries) {
|
|
290
|
-
if (entry.isDirectory() && !entry.name.startsWith(".")
|
|
300
|
+
if (entry.isDirectory() && !entry.name.startsWith(".")) {
|
|
291
301
|
await this.discoverInDirectory(
|
|
292
302
|
path.join(dir, entry.name),
|
|
293
303
|
appendMiddlewareRoutePath(routePath, entry.name),
|
|
@@ -9,7 +9,7 @@ var _chunkCMGMGHUZcjs = require('./chunk-CMGMGHUZ.cjs');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkOMVAU7NTcjs = require('./chunk-OMVAU7NT.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
@@ -136,10 +136,10 @@ function createFarmWorkflowRequestHandler(options) {
|
|
|
136
136
|
try {
|
|
137
137
|
payload = await readWorkflowPayload(
|
|
138
138
|
request,
|
|
139
|
-
|
|
139
|
+
_chunkOMVAU7NTcjs.resolveFarmServerConfig.call(void 0, options.server).bodySizeLimit
|
|
140
140
|
);
|
|
141
141
|
} catch (error) {
|
|
142
|
-
const response =
|
|
142
|
+
const response = _chunkOMVAU7NTcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
|
|
143
143
|
if (response) return response;
|
|
144
144
|
if (error instanceof SyntaxError) {
|
|
145
145
|
return Response.json({ error: "Invalid workflow request body." }, { status: 400 });
|
|
@@ -220,7 +220,7 @@ async function prepareFarmWorkflowsForNitro(config) {
|
|
|
220
220
|
createNitroWorkflowHTTPHandler(
|
|
221
221
|
workflowConfig,
|
|
222
222
|
workflows,
|
|
223
|
-
|
|
223
|
+
_chunkOMVAU7NTcjs.resolveFarmServerConfig.call(void 0, config.server)
|
|
224
224
|
),
|
|
225
225
|
"utf8"
|
|
226
226
|
);
|
|
@@ -591,7 +591,7 @@ async function readWorkflowPayload(request, bodySizeLimit) {
|
|
|
591
591
|
if (request.method === "GET" || request.method === "HEAD") {
|
|
592
592
|
return _chunkQNPEUFHQcjs.searchParamsToObject.call(void 0, url.searchParams);
|
|
593
593
|
}
|
|
594
|
-
const bytes = await
|
|
594
|
+
const bytes = await _chunkOMVAU7NTcjs.readFarmRequestBody.call(void 0, request, bodySizeLimit);
|
|
595
595
|
const text = new TextDecoder().decode(bytes);
|
|
596
596
|
if (!text) return {};
|
|
597
597
|
const contentType = (request.headers.get("content-type") || "").split(";", 1)[0].trim().toLowerCase();
|
|
@@ -15,10 +15,10 @@ var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
|
|
|
15
15
|
var _chunkHREOKQWTcjs = require('./chunk-HREOKQWT.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkEUV4YR3Vcjs = require('./chunk-EUV4YR3V.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkOMVAU7NTcjs = require('./chunk-OMVAU7NT.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -1181,11 +1181,11 @@ function shouldReturnMarkdown(request) {
|
|
|
1181
1181
|
if (url.pathname.endsWith(".md")) return true;
|
|
1182
1182
|
const accept = request.headers.get("accept");
|
|
1183
1183
|
const markdown = Math.max(
|
|
1184
|
-
|
|
1185
|
-
|
|
1184
|
+
_chunkEUV4YR3Vcjs.farmAcceptQuality.call(void 0, accept, "text/markdown"),
|
|
1185
|
+
_chunkEUV4YR3Vcjs.farmAcceptQuality.call(void 0, accept, "text/plain")
|
|
1186
1186
|
);
|
|
1187
1187
|
if (markdown <= 0) return false;
|
|
1188
|
-
return markdown >=
|
|
1188
|
+
return markdown >= _chunkEUV4YR3Vcjs.farmAcceptQuality.call(void 0, accept, "text/html", { wildcards: true });
|
|
1189
1189
|
}
|
|
1190
1190
|
_chunkS3JO3N4Hcjs.__name.call(void 0, shouldReturnMarkdown, "shouldReturnMarkdown");
|
|
1191
1191
|
function escapeAttribute(value) {
|
|
@@ -1947,7 +1947,7 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1947
1947
|
ETag: etag,
|
|
1948
1948
|
"X-Content-Type-Options": "nosniff"
|
|
1949
1949
|
});
|
|
1950
|
-
if (
|
|
1950
|
+
if (_chunkOMVAU7NTcjs.matchesFarmIfNoneMatch.call(void 0, request.headers.get("if-none-match"), etag)) {
|
|
1951
1951
|
return new Response(null, { status: 304, headers });
|
|
1952
1952
|
}
|
|
1953
1953
|
if (request.method === "HEAD") return new Response(null, { status: 200, headers });
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
|
+
|
|
5
|
+
// src/client/client-reference.ts
|
|
6
|
+
var CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("farm.isolated-hydration.client-reference");
|
|
7
|
+
function markFarmClientReference(boundary, reference) {
|
|
8
|
+
Object.defineProperty(boundary, CLIENT_REFERENCE, { value: reference });
|
|
9
|
+
}
|
|
10
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, markFarmClientReference, "markFarmClientReference");
|
|
11
|
+
function getFarmClientReference(type) {
|
|
12
|
+
if (!type || typeof type !== "function" && typeof type !== "object") return void 0;
|
|
13
|
+
return type[CLIENT_REFERENCE];
|
|
14
|
+
}
|
|
15
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getFarmClientReference, "getFarmClientReference");
|
|
16
|
+
var SERVER_TREE_UPDATES = /* @__PURE__ */ Symbol.for("farm.isolated-hydration.server-tree-updates");
|
|
17
|
+
function getListeners() {
|
|
18
|
+
const shared = globalThis;
|
|
19
|
+
return _nullishCoalesce(shared[SERVER_TREE_UPDATES], () => ( (shared[SERVER_TREE_UPDATES] = /* @__PURE__ */ new Set())));
|
|
20
|
+
}
|
|
21
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getListeners, "getListeners");
|
|
22
|
+
function subscribeFarmServerTreeUpdates(listener) {
|
|
23
|
+
const listeners = getListeners();
|
|
24
|
+
listeners.add(listener);
|
|
25
|
+
return () => {
|
|
26
|
+
listeners.delete(listener);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, subscribeFarmServerTreeUpdates, "subscribeFarmServerTreeUpdates");
|
|
30
|
+
function updateFarmServerTreeModule(reference, module) {
|
|
31
|
+
const listeners = globalThis[SERVER_TREE_UPDATES];
|
|
32
|
+
let updated = 0;
|
|
33
|
+
if (listeners) {
|
|
34
|
+
for (const listener of listeners) if (listener(reference, module)) updated++;
|
|
35
|
+
}
|
|
36
|
+
return updated;
|
|
37
|
+
}
|
|
38
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, updateFarmServerTreeModule, "updateFarmServerTreeModule");
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
exports.markFarmClientReference = markFarmClientReference; exports.getFarmClientReference = getFarmClientReference; exports.subscribeFarmServerTreeUpdates = subscribeFarmServerTreeUpdates; exports.updateFarmServerTreeModule = updateFarmServerTreeModule;
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkGFHLGIYCcjs = require('./chunk-GFHLGIYC.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkSK35NQKKcjs = require('./chunk-SK35NQKK.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkZXGAFZDOcjs = require('./chunk-ZXGAFZDO.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -35,7 +35,7 @@ function createServerQuery(options) {
|
|
|
35
35
|
throw new TypeError("createServerQuery requires a key function");
|
|
36
36
|
}
|
|
37
37
|
const staleTime = normalizeServerQueryStaleTime(options.staleTime);
|
|
38
|
-
const execute =
|
|
38
|
+
const execute = _chunkGFHLGIYCcjs.createServerFn.call(void 0, {
|
|
39
39
|
input: options.input,
|
|
40
40
|
middleware: options.middleware,
|
|
41
41
|
handler: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (context) => {
|
|
@@ -45,7 +45,7 @@ function createServerQuery(options) {
|
|
|
45
45
|
const cacheKey = _chunkNYJMY3JAcjs.createFarmCacheKey.call(void 0, ["route-data", routeKey]);
|
|
46
46
|
const producer = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
|
|
47
47
|
const value = await options.handler(context);
|
|
48
|
-
return
|
|
48
|
+
return _chunkGFHLGIYCcjs._parseServerFnSchema.call(void 0, options.output, value, "output", "createServerQuery");
|
|
49
49
|
}, "producer");
|
|
50
50
|
let data;
|
|
51
51
|
let updatedAt;
|
|
@@ -70,7 +70,7 @@ function createServerQuery(options) {
|
|
|
70
70
|
});
|
|
71
71
|
const query = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (input) => {
|
|
72
72
|
const result = await execute(input);
|
|
73
|
-
return
|
|
73
|
+
return _chunkZXGAFZDOcjs.getServerActionExecutionContext.call(void 0, ) ? result : result.data;
|
|
74
74
|
}, "query");
|
|
75
75
|
Object.defineProperties(query, {
|
|
76
76
|
[FARM_SERVER_QUERY_SYMBOL]: {
|
|
@@ -90,10 +90,10 @@ function createServerQuery(options) {
|
|
|
90
90
|
enumerable: false
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
|
-
|
|
93
|
+
_chunkGFHLGIYCcjs._attachServerFunctionDescriptor.call(void 0,
|
|
94
94
|
query,
|
|
95
|
-
|
|
96
|
-
const result = await
|
|
95
|
+
_chunkGFHLGIYCcjs.createServerFunctionDescriptor.call(void 0, "query", options, async (value) => {
|
|
96
|
+
const result = await _chunkGFHLGIYCcjs._runServerFunctionForCaller.call(void 0,
|
|
97
97
|
execute,
|
|
98
98
|
value
|
|
99
99
|
);
|
|
@@ -17,7 +17,7 @@ var _chunkLYLEZIG3cjs = require('./chunk-LYLEZIG3.cjs');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkXCACDAZZcjs = require('./chunk-XCACDAZZ.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
var _chunkWMAPPDMMcjs = require('./chunk-WMAPPDMM.cjs');
|
|
@@ -93,7 +93,7 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
93
93
|
await this.loadProgrammaticApiRoutes(appDir);
|
|
94
94
|
}
|
|
95
95
|
this.routes = new Map(
|
|
96
|
-
|
|
96
|
+
_chunkXCACDAZZcjs.mergePluginAPIRoutes.call(void 0, [...this.routes.values()], this.plugins, void 0, {
|
|
97
97
|
bodySizeLimit: this.bodySizeLimit
|
|
98
98
|
}).map((route) => [route.path, route])
|
|
99
99
|
);
|
|
@@ -140,7 +140,7 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
140
140
|
const routeModule = await this.loadModule(filePath);
|
|
141
141
|
const endpoints = {};
|
|
142
142
|
const availableMethods = [];
|
|
143
|
-
for (const method of
|
|
143
|
+
for (const method of _chunkXCACDAZZcjs.API_ROUTE_METHODS) {
|
|
144
144
|
if (routeModule[method]) {
|
|
145
145
|
endpoints[method] = routeModule[method];
|
|
146
146
|
availableMethods.push(method);
|
|
@@ -322,7 +322,7 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
322
322
|
const url = new URL(request.url);
|
|
323
323
|
const pathname = url.pathname;
|
|
324
324
|
const method = request.method.toUpperCase();
|
|
325
|
-
const match =
|
|
325
|
+
const match = _chunkXCACDAZZcjs.matchAPIRouteAtBasePath.call(void 0, this.routes, pathname, this.basePath);
|
|
326
326
|
if (!match) {
|
|
327
327
|
return new Response(JSON.stringify({ error: "Not Found" }), {
|
|
328
328
|
status: 404,
|
|
@@ -330,19 +330,19 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
330
330
|
});
|
|
331
331
|
}
|
|
332
332
|
const { route, params } = match;
|
|
333
|
-
const endpoint =
|
|
333
|
+
const endpoint = _chunkXCACDAZZcjs.resolveAPIRouteEndpoint.call(void 0, route, method);
|
|
334
334
|
if (!endpoint) {
|
|
335
335
|
return new Response(JSON.stringify({ error: "Method Not Allowed" }), {
|
|
336
336
|
status: 405,
|
|
337
337
|
headers: {
|
|
338
|
-
Allow:
|
|
338
|
+
Allow: _chunkXCACDAZZcjs.getAllowedAPIRouteMethods.call(void 0, route).join(", "),
|
|
339
339
|
"Content-Type": "application/json"
|
|
340
340
|
}
|
|
341
341
|
});
|
|
342
342
|
}
|
|
343
343
|
const invoke = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
|
|
344
344
|
try {
|
|
345
|
-
return await
|
|
345
|
+
return await _chunkXCACDAZZcjs.invokeAPIRouteEndpoint.call(void 0, endpoint, request, params, this.bodySizeLimit);
|
|
346
346
|
} catch (error) {
|
|
347
347
|
if (options.throwOnError) throw error;
|
|
348
348
|
console.error(`[API Error] ${pathname}:`, error);
|
|
@@ -364,7 +364,7 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
364
364
|
return Boolean(this.matchRoute(pathname));
|
|
365
365
|
}
|
|
366
366
|
matchRoute(pathname) {
|
|
367
|
-
return
|
|
367
|
+
return _chunkXCACDAZZcjs.matchAPIRouteAtBasePath.call(void 0, this.routes, pathname, this.basePath);
|
|
368
368
|
}
|
|
369
369
|
/**
|
|
370
370
|
* Get all routes for client type generation
|
|
@@ -15,7 +15,7 @@ var _chunkLSKZMJMPcjs = require('./chunk-LSKZMJMP.cjs');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkOMVAU7NTcjs = require('./chunk-OMVAU7NT.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
|
|
@@ -186,11 +186,11 @@ function isFarmAPIPathname(pathname, serverBasePath = _chunkS3A45T7Fcjs.DEFAULT_
|
|
|
186
186
|
return basePath !== "/" && (pathname === basePath || pathname.startsWith(`${basePath}/`));
|
|
187
187
|
}
|
|
188
188
|
_chunkS3JO3N4Hcjs.__name.call(void 0, isFarmAPIPathname, "isFarmAPIPathname");
|
|
189
|
-
async function invokeAPIRouteEndpoint(endpoint, request, params = {}, bodySizeLimit =
|
|
189
|
+
async function invokeAPIRouteEndpoint(endpoint, request, params = {}, bodySizeLimit = _chunkOMVAU7NTcjs.DEFAULT_FARM_SERVER_BODY_SIZE_LIMIT) {
|
|
190
190
|
try {
|
|
191
|
-
request = await
|
|
191
|
+
request = await _chunkOMVAU7NTcjs.bufferFarmRequestBody.call(void 0, request, bodySizeLimit);
|
|
192
192
|
} catch (error) {
|
|
193
|
-
const response2 =
|
|
193
|
+
const response2 = _chunkOMVAU7NTcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
|
|
194
194
|
if (response2) return response2;
|
|
195
195
|
throw error;
|
|
196
196
|
}
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
FARM_METADATA_ATTRIBUTE,
|
|
18
18
|
renderMetadataHead,
|
|
19
19
|
resolveMetadataTitle
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-CXEN47J3.mjs";
|
|
21
21
|
import {
|
|
22
22
|
createFarmDeploymentMismatchError,
|
|
23
23
|
createFarmDeploymentRequestHeaders,
|
|
@@ -70,7 +70,17 @@ function applyFarmMetadataToDocument(metadata, pathname) {
|
|
|
70
70
|
const rendered = renderMetadataHead(metadata, { pathname });
|
|
71
71
|
const template = document.createElement("template");
|
|
72
72
|
template.innerHTML = rendered.tags;
|
|
73
|
+
const viewport = document.createElement("template");
|
|
74
|
+
viewport.innerHTML = rendered.viewport;
|
|
73
75
|
removeAll(OWNED_SELECTORS);
|
|
76
|
+
const charset = document.head.querySelector("meta[charset]");
|
|
77
|
+
for (const element of Array.from(viewport.content.children).reverse()) {
|
|
78
|
+
const name = element.getAttribute("name");
|
|
79
|
+
if (name && document.head.querySelector(`meta[name="${name}"]:not([${MANAGED_ATTRIBUTE}])`)) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
document.head.insertBefore(element, charset ? charset.nextSibling : document.head.firstChild);
|
|
83
|
+
}
|
|
74
84
|
removeAll(PAGE_JSON_LD_SELECTOR);
|
|
75
85
|
if (metadata?.icons) removeAll(ICON_SELECTORS);
|
|
76
86
|
if (metadata?.manifest) removeAll(MANIFEST_SELECTOR);
|
|
@@ -419,6 +419,30 @@ async function readNodeRequestBody(request, limit) {
|
|
|
419
419
|
});
|
|
420
420
|
}
|
|
421
421
|
__name(readNodeRequestBody, "readNodeRequestBody");
|
|
422
|
+
function createFarmNodeRequestBodyStream(request) {
|
|
423
|
+
let iterator;
|
|
424
|
+
return new ReadableStream(
|
|
425
|
+
{
|
|
426
|
+
async pull(controller) {
|
|
427
|
+
iterator ?? (iterator = request[Symbol.asyncIterator]());
|
|
428
|
+
const { value, done } = await iterator.next();
|
|
429
|
+
if (done) {
|
|
430
|
+
controller.close();
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
controller.enqueue(
|
|
434
|
+
value instanceof Uint8Array ? value : new TextEncoder().encode(String(value))
|
|
435
|
+
);
|
|
436
|
+
},
|
|
437
|
+
async cancel(reason) {
|
|
438
|
+
await iterator?.return?.(reason);
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
// No eager pull: the request stays untouched until the handler reads it.
|
|
442
|
+
{ highWaterMark: 0 }
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
__name(createFarmNodeRequestBodyStream, "createFarmNodeRequestBodyStream");
|
|
422
446
|
function createFarmRequestBodyErrorResponse(error) {
|
|
423
447
|
if (!(error instanceof FarmRequestBodyError)) return null;
|
|
424
448
|
return new Response(error.status === 413 ? "Payload Too Large" : "Bad Request", {
|
|
@@ -466,5 +490,6 @@ export {
|
|
|
466
490
|
bufferFarmRequestBody,
|
|
467
491
|
readFarmRequestBody,
|
|
468
492
|
readNodeRequestBody,
|
|
493
|
+
createFarmNodeRequestBodyStream,
|
|
469
494
|
createFarmRequestBodyErrorResponse
|
|
470
495
|
};
|
|
@@ -137,7 +137,14 @@ function getEventTargetAssetUrl(value) {
|
|
|
137
137
|
return void 0;
|
|
138
138
|
}
|
|
139
139
|
const tagName = typeof target.tagName === "string" ? target.tagName.toLowerCase() : "";
|
|
140
|
-
if (tagName
|
|
140
|
+
if (tagName === "script") {
|
|
141
|
+
if (target.type !== "module" && target.noModule !== true) return void 0;
|
|
142
|
+
} else if (tagName === "link") {
|
|
143
|
+
const rel = typeof target.rel === "string" ? target.rel.toLowerCase().split(/\s+/) : [];
|
|
144
|
+
if (!rel.some((value2) => ["stylesheet", "modulepreload", "preload"].includes(value2))) {
|
|
145
|
+
return void 0;
|
|
146
|
+
}
|
|
147
|
+
} else {
|
|
141
148
|
return void 0;
|
|
142
149
|
}
|
|
143
150
|
return typeof target.src === "string" && target.src ? target.src : typeof target.href === "string" && target.href ? target.href : void 0;
|