@farm.js/core 0.1.72 → 0.1.73
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-handler-VIT4GOSR.mjs → agent-mcp-handler-RK7LDYEL.mjs} +4 -4
- package/dist/{agent-mcp-handler-KE4J3W7S.cjs → agent-mcp-handler-VBCA3WZ6.cjs} +5 -5
- package/dist/{agent-mcp.d-BO3rZXEM.d.ts → agent-mcp.d-D_gHjCAE.d.ts} +1 -1
- package/dist/{agent-mcp.d-Cwff7lcA.d.mts → agent-mcp.d-PvEf-1mi.d.mts} +1 -1
- package/dist/agent-runtime.d.mts +2 -2
- package/dist/agent-runtime.d.ts +2 -2
- package/dist/{analyzer-5Q75LTIL.mjs → analyzer-MFYCJT75.mjs} +2 -2
- package/dist/analyzer-V5ZMRIIY.cjs +16 -0
- package/dist/api/node.d.mts +4 -4
- package/dist/api/node.d.ts +4 -4
- package/dist/api/route-manager.d.mts +4 -4
- package/dist/api/route-manager.d.ts +4 -4
- package/dist/api/runtime.d.mts +3 -3
- package/dist/api/runtime.d.ts +3 -3
- package/dist/api.d.mts +5 -5
- package/dist/api.d.ts +5 -5
- package/dist/{app-manifest.d-DwjGkYlP.d.ts → app-manifest.d-BpVTg43i.d.ts} +1 -1
- package/dist/{app-manifest.d-USD_IbFd.d.mts → app-manifest.d-CN7cEWHX.d.mts} +1 -1
- package/dist/app-markdown.cjs +4 -4
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +3 -3
- package/dist/{app.d-fW06_h8h.d.mts → app.d-BFWzAdTe.d.mts} +10 -4
- package/dist/{app.d-DAmF2MAk.d.ts → app.d-DO4PTCWm.d.ts} +10 -4
- package/dist/{chunk-OSMUE5ST.mjs → chunk-462MUII7.mjs} +3 -3
- package/dist/{chunk-MWUDEYBI.mjs → chunk-4CTCSKAF.mjs} +1 -1
- package/dist/{chunk-FSSONJRV.cjs → chunk-4YHGQDTT.cjs} +12 -12
- package/dist/{chunk-YCNHUIPR.cjs → chunk-4Z3YLMSW.cjs} +10 -10
- package/dist/{chunk-O32QPFVV.cjs → chunk-5PDMBWAF.cjs} +5 -5
- package/dist/{chunk-E2V7RRFL.mjs → chunk-6O6PAZZR.mjs} +1 -1
- package/dist/{chunk-LXEJNWF5.mjs → chunk-73K53YPP.mjs} +2 -2
- package/dist/{chunk-WIJF3PBM.mjs → chunk-7GMBETHM.mjs} +1 -1
- package/dist/{chunk-DGNMXL2O.mjs → chunk-B67CW2LM.mjs} +1 -1
- package/dist/{chunk-E3LE6EZH.cjs → chunk-CLEWORVY.cjs} +2 -2
- package/dist/{chunk-KPJYBSHL.mjs → chunk-CPMME66W.mjs} +149 -22
- package/dist/{chunk-VAWDGGW3.mjs → chunk-CYRIIVD4.mjs} +26 -15
- package/dist/{chunk-RFWWXEIF.mjs → chunk-FRO4BB2T.mjs} +1 -1
- package/dist/{chunk-N3XO5AL5.cjs → chunk-GPO3LJDJ.cjs} +2 -2
- package/dist/{chunk-645ENY7W.mjs → chunk-GZOKWJIW.mjs} +4 -4
- package/dist/{chunk-NAXKOTPP.cjs → chunk-HFUOLILA.cjs} +21 -21
- package/dist/{chunk-C2JOS77Z.cjs → chunk-HGB4PM2C.cjs} +178 -51
- package/dist/{chunk-BE7AQXJB.cjs → chunk-HTXKSREF.cjs} +255 -89
- package/dist/{chunk-Z3GPAFIA.mjs → chunk-HY6IVQ54.mjs} +1 -1
- package/dist/{chunk-3JN5M3T5.mjs → chunk-IBVN7SW5.mjs} +247 -81
- package/dist/{chunk-OSEQL34Q.cjs → chunk-ILQ5DKYF.cjs} +2 -2
- package/dist/{chunk-AUAMXI6N.mjs → chunk-IXZSBO76.mjs} +1 -1
- package/dist/{chunk-77VNYVVX.mjs → chunk-JMOCMXTQ.mjs} +1 -1
- package/dist/{chunk-5R4Q5FN7.cjs → chunk-KDOZORJD.cjs} +52 -41
- package/dist/{chunk-7QCJDYZQ.cjs → chunk-KTDG4THT.cjs} +2 -2
- package/dist/{chunk-L6E4SHUB.cjs → chunk-LGR7565L.cjs} +6 -6
- package/dist/chunk-LRPPXKCX.mjs +58 -0
- package/dist/{chunk-5XFKWHZD.mjs → chunk-MJEKMT6B.mjs} +95 -106
- package/dist/chunk-NDOE76QC.cjs +58 -0
- package/dist/{chunk-REP6HWJN.mjs → chunk-OBYM5S5G.mjs} +2 -2
- package/dist/{chunk-ZUVAGMQ5.cjs → chunk-ODBM54RT.cjs} +7 -7
- package/dist/{chunk-J5ASGNKF.mjs → chunk-OIP62QEL.mjs} +1 -1
- package/dist/{chunk-3WG7GJQL.cjs → chunk-OXNZUCHN.cjs} +9 -9
- package/dist/{chunk-C5AM2XDN.cjs → chunk-PXAHSCR6.cjs} +4 -4
- package/dist/{chunk-BSXKZPFE.mjs → chunk-QGCSUC5O.mjs} +112 -70
- package/dist/{chunk-EXN4DTVF.cjs → chunk-QKEZLYON.cjs} +2 -2
- package/dist/{chunk-QUYAGU65.mjs → chunk-REK6HZSU.mjs} +267 -231
- package/dist/{chunk-5X6OHJEE.cjs → chunk-ROCF6UQD.cjs} +5 -8
- package/dist/{chunk-KQAB5LML.mjs → chunk-SUQACHER.mjs} +2 -2
- package/dist/{chunk-NV26EGMC.mjs → chunk-SVQX5HYW.mjs} +2 -2
- package/dist/{chunk-CBLRSZQL.cjs → chunk-TAU3OF5B.cjs} +223 -234
- package/dist/{chunk-IWCYRDRQ.cjs → chunk-TDCP3Z4T.cjs} +3 -3
- package/dist/{chunk-TP4RAV7Y.cjs → chunk-TU6VAH4V.cjs} +8 -8
- package/dist/{chunk-ZDZUFD67.cjs → chunk-UVQRMUAR.cjs} +1 -1
- package/dist/{chunk-JMFTKNBA.mjs → chunk-UVZMSRHF.mjs} +2 -2
- package/dist/{chunk-GF22VGMS.cjs → chunk-VPETSSWN.cjs} +2 -2
- package/dist/{chunk-AYVGD3PK.mjs → chunk-XI3OXOMK.mjs} +1 -1
- package/dist/{chunk-HLMUWKAP.cjs → chunk-XUSJVHHD.cjs} +408 -366
- package/dist/{chunk-ET6WW3FY.cjs → chunk-YZK64PZT.cjs} +433 -397
- package/dist/{chunk-DS7JGFW5.mjs → chunk-Z3IN6GEX.mjs} +4 -7
- package/dist/{client-component.d-ciHeCxr-.d.mts → client-component.d-C71rMuHF.d.mts} +2 -2
- package/dist/{client-component.d-9J7CkTWW.d.ts → client-component.d-sF-Znk0j.d.ts} +2 -2
- package/dist/{client-plugins.d-JnRz5a1o.d.mts → client-plugins.d-B-Gd9mWR.d.mts} +1 -1
- package/dist/{client-plugins.d-CUOhfapO.d.ts → client-plugins.d-MFibjgBg.d.ts} +1 -1
- package/dist/client-plugins.d.mts +2 -2
- package/dist/client-plugins.d.ts +2 -2
- package/dist/client.d.mts +7 -7
- package/dist/client.d.ts +7 -7
- package/dist/config.d.mts +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/desktop.d.mts +3 -3
- package/dist/desktop.d.ts +3 -3
- package/dist/{devtools-IZFUYWPG.cjs → devtools-6K4QXFRL.cjs} +5 -5
- package/dist/{devtools-7JPQMSTQ.mjs → devtools-TDIJ6HVC.mjs} +4 -4
- package/dist/docs.cjs +8 -8
- package/dist/docs.d.mts +3 -3
- package/dist/docs.d.ts +3 -3
- package/dist/docs.mjs +7 -7
- package/dist/environment/vite.cjs +3 -3
- package/dist/environment/vite.mjs +2 -2
- package/dist/{headers.d-rbbTKGaN.d.mts → headers.d-BUxGJTsj.d.mts} +1 -1
- package/dist/{headers.d-CqpTL_fZ.d.ts → headers.d-uQ6BR59u.d.ts} +1 -1
- package/dist/index.cjs +24 -22
- package/dist/{index.d-CMKvzHLW.d.ts → index.d-BCGfxCXY.d.ts} +1 -1
- package/dist/{index.d-D_B2D9Il.d.mts → index.d-CuWOJ-un.d.mts} +1 -1
- package/dist/index.d.mts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.mjs +23 -21
- package/dist/integrations/orm.d.mts +2 -2
- package/dist/integrations/orm.d.ts +2 -2
- package/dist/integrations.d.mts +2 -2
- package/dist/integrations.d.ts +2 -2
- package/dist/internal/app-markdown-runtime.cjs +3 -3
- package/dist/internal/app-markdown-runtime.d.mts +3 -3
- package/dist/internal/app-markdown-runtime.d.ts +3 -3
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +23 -23
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +22 -22
- package/dist/internal/cli-runtime.cjs +9 -9
- package/dist/internal/cli-runtime.mjs +8 -8
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.d.mts +5 -5
- package/dist/internal/client-runtime.d.ts +5 -5
- package/dist/internal/compression-runtime.d.mts +2 -2
- package/dist/internal/compression-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.cjs +6 -6
- package/dist/internal/config-runtime.d.mts +4 -4
- package/dist/internal/config-runtime.d.ts +4 -4
- package/dist/internal/config-runtime.mjs +5 -5
- package/dist/internal/infra-analytics-runtime.cjs +9 -9
- package/dist/internal/infra-analytics-runtime.mjs +7 -7
- package/dist/internal/native-server-fns.cjs +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +11 -11
- package/dist/internal/production-runtime.d.mts +10 -10
- package/dist/internal/production-runtime.d.ts +10 -10
- package/dist/internal/production-runtime.mjs +10 -10
- package/dist/markdown.cjs +2 -2
- package/dist/markdown.d.mts +2 -2
- package/dist/markdown.d.ts +2 -2
- package/dist/markdown.mjs +1 -1
- package/dist/middleware.d.mts +2 -2
- package/dist/middleware.d.ts +2 -2
- package/dist/{mount.d-ImEO7q8a.d.mts → mount.d-BIYmcGGg.d.mts} +1 -1
- package/dist/{mount.d-B0XMxDRh.d.ts → mount.d-q8k0cJV0.d.ts} +1 -1
- package/dist/{native-tree-L2IIEBXH.mjs → native-tree-OYGKP2NZ.mjs} +2 -2
- package/dist/{native-tree-GF4BH33L.cjs → native-tree-R6CQMDTI.cjs} +3 -3
- package/dist/{navigation-delegate.d-RRx1CSlb.d.ts → navigation-delegate.d-Btfs6Uoa.d.ts} +1 -1
- package/dist/{navigation-delegate.d-83Q7ksf7.d.mts → navigation-delegate.d-CYBUupsv.d.mts} +1 -1
- package/dist/navigation.d.mts +5 -5
- package/dist/navigation.d.ts +5 -5
- package/dist/{observability.d-B2363jB6.d.mts → observability.d-DdJRiaIX.d.mts} +27 -3
- package/dist/{observability.d-B2363jB6.d.ts → observability.d-DdJRiaIX.d.ts} +27 -3
- package/dist/observability.d.mts +1 -1
- package/dist/observability.d.ts +1 -1
- package/dist/plugin.cjs +15 -15
- package/dist/plugin.d.mts +5 -5
- package/dist/plugin.d.ts +5 -5
- package/dist/plugin.mjs +14 -14
- package/dist/{render-plan.d-Ds2sXJ5m.d.ts → render-plan.d-0FHusf1D.d.ts} +1 -1
- package/dist/{render-plan.d-wP8nTeRV.d.mts → render-plan.d-BlyxqKMu.d.mts} +1 -1
- package/dist/renderer-client.d.mts +5 -5
- package/dist/renderer-client.d.ts +5 -5
- package/dist/{request.d-zpSn6pu_.d.ts → request.d-CPdVjssg.d.ts} +1 -1
- package/dist/{request.d-F3h7K37m.d.mts → request.d-CX-gks1l.d.mts} +1 -1
- package/dist/request.d.mts +3 -3
- package/dist/request.d.ts +3 -3
- package/dist/{route-rendering.d-Mw0ZKG2e.d.mts → route-rendering.d-CcvZ_4N2.d.mts} +1 -1
- package/dist/{route-rendering.d-BL0_AdKj.d.ts → route-rendering.d-DcOoSNoG.d.ts} +1 -1
- package/dist/{router.d-NGVsU11T.d.mts → router.d-C8RHma4A.d.mts} +1 -1
- package/dist/{router.d-BwXigemZ.d.ts → router.d-D2QnK8cM.d.ts} +1 -1
- package/dist/routes.d.mts +2 -2
- package/dist/routes.d.ts +2 -2
- package/dist/{rsc-pipeline-DHYZLWSF.mjs → rsc-pipeline-LC2FBZAR.mjs} +5 -5
- package/dist/{rsc-pipeline-BNXYMG4G.cjs → rsc-pipeline-NTAM65NT.cjs} +6 -6
- package/dist/{runtime-XPYKUNL3.mjs → runtime-MWAC7NWR.mjs} +5 -5
- package/dist/{runtime-IWOT6ZVC.cjs → runtime-U4PAMTVH.cjs} +7 -7
- package/dist/{runtime.d-OBIZWpx1.d.ts → runtime.d-1l_1bLrL.d.ts} +1 -1
- package/dist/{runtime.d-BA3MzhXz.d.mts → runtime.d-BQUHHq8M.d.mts} +1 -1
- package/dist/server-plugins.d.mts +4 -4
- package/dist/server-plugins.d.ts +4 -4
- package/dist/server.cjs +37 -35
- package/dist/server.d.mts +11 -11
- package/dist/server.d.ts +11 -11
- package/dist/server.mjs +20 -18
- package/dist/{spa-router.d-DrYT944-.d.ts → spa-router.d-BJtXNeqo.d.ts} +2 -2
- package/dist/{spa-router.d-BG2XzE5p.d.mts → spa-router.d-BzPdi48R.d.mts} +2 -2
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/{utils.d-C1k9BJeD.d.mts → utils.d-B4ZW-6z6.d.mts} +1 -1
- package/dist/{utils.d-DcF4wxey.d.ts → utils.d-DquC6qxy.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +17 -15
- package/dist/vite.d.mts +16 -7
- package/dist/vite.d.ts +16 -7
- package/dist/vite.mjs +16 -14
- package/package.json +1 -1
- package/dist/analyzer-UJG4MIZW.cjs +0 -16
- package/dist/chunk-V3UOEWCB.cjs +0 -46
- package/dist/chunk-VE3FWJBO.mjs +0 -46
|
@@ -8,7 +8,7 @@ var _chunkGVYZCJZHcjs = require('./chunk-GVYZCJZH.cjs');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkNDOE76QCcjs = require('./chunk-NDOE76QC.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -18,7 +18,7 @@ var _chunkERMUL73Lcjs = require('./chunk-ERMUL73L.cjs');
|
|
|
18
18
|
var _chunk6JHZPB52cjs = require('./chunk-6JHZPB52.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkHGB4PM2Ccjs = require('./chunk-HGB4PM2C.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
var _chunkKORZ6PREcjs = require('./chunk-KORZ6PRE.cjs');
|
|
@@ -974,7 +974,7 @@ function toFarmDocsPublicSitemapConfig(sitemap, basePath) {
|
|
|
974
974
|
};
|
|
975
975
|
}
|
|
976
976
|
function buildFarmDocsSitemapManifest(pages, docs, origin, basePath) {
|
|
977
|
-
return
|
|
977
|
+
return _chunkNDOE76QCcjs.docsEngine.call(void 0, ).buildDocsSitemapManifest({
|
|
978
978
|
pages: pages.map((page) => ({
|
|
979
979
|
...toFarmDocsMarkdownPage(page, basePath),
|
|
980
980
|
sourcePath: page.sourcePath
|
|
@@ -985,7 +985,7 @@ function buildFarmDocsSitemapManifest(pages, docs, origin, basePath) {
|
|
|
985
985
|
});
|
|
986
986
|
}
|
|
987
987
|
function renderFarmDocsRobotsTxt(docs, origin, basePath) {
|
|
988
|
-
return
|
|
988
|
+
return _chunkNDOE76QCcjs.docsEngine.call(void 0, ).renderDocsRobotsTxt({
|
|
989
989
|
entry: getFarmDocsPublicEntry(docs, basePath),
|
|
990
990
|
sitemap: toFarmDocsPublicSitemapConfig(_nullishCoalesce(docs.config.sitemap, () => ( true)), basePath),
|
|
991
991
|
robots: _nullishCoalesce(docs.config.robots, () => ( true)),
|
|
@@ -1182,9 +1182,9 @@ function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded,
|
|
|
1182
1182
|
"Content-Type": contentType,
|
|
1183
1183
|
"Cache-Control": "public, max-age=60"
|
|
1184
1184
|
});
|
|
1185
|
-
const llmsFormat =
|
|
1185
|
+
const llmsFormat = _chunkNDOE76QCcjs.docsEngine.call(void 0, ).resolveDocsLlmsTxtFormat(url);
|
|
1186
1186
|
if (llmsFormat) {
|
|
1187
|
-
const generated =
|
|
1187
|
+
const generated = _chunkNDOE76QCcjs.docsEngine.call(void 0, ).renderDocsLlmsTxt(
|
|
1188
1188
|
getPages().map(toDocsLlmsPage),
|
|
1189
1189
|
getDocsLlmsOptions(docs, request, basePath)
|
|
1190
1190
|
);
|
|
@@ -1193,10 +1193,10 @@ function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded,
|
|
|
1193
1193
|
headers: textHeaders("text/plain; charset=utf-8")
|
|
1194
1194
|
});
|
|
1195
1195
|
}
|
|
1196
|
-
const sitemapFormat =
|
|
1196
|
+
const sitemapFormat = _chunkNDOE76QCcjs.docsEngine.call(void 0, ).resolveDocsSitemapRequest(url, _nullishCoalesce(docs.config.sitemap, () => ( true)));
|
|
1197
1197
|
if (sitemapFormat === "xml") {
|
|
1198
1198
|
return new Response(
|
|
1199
|
-
|
|
1199
|
+
_chunkNDOE76QCcjs.docsEngine.call(void 0, ).renderDocsSitemapXml(sitemapManifest(), {
|
|
1200
1200
|
baseUrl: url.origin,
|
|
1201
1201
|
includeLastmod: true
|
|
1202
1202
|
}),
|
|
@@ -1208,7 +1208,7 @@ function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded,
|
|
|
1208
1208
|
}
|
|
1209
1209
|
if (sitemapFormat === "markdown") {
|
|
1210
1210
|
return new Response(
|
|
1211
|
-
|
|
1211
|
+
_chunkNDOE76QCcjs.docsEngine.call(void 0, ).renderDocsSitemapMarkdown(sitemapManifest(), {
|
|
1212
1212
|
includeDescriptions: true
|
|
1213
1213
|
}),
|
|
1214
1214
|
{
|
|
@@ -1217,14 +1217,14 @@ function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded,
|
|
|
1217
1217
|
}
|
|
1218
1218
|
);
|
|
1219
1219
|
}
|
|
1220
|
-
if (
|
|
1220
|
+
if (_chunkNDOE76QCcjs.docsEngine.call(void 0, ).resolveDocsRobotsRequest(url, _nullishCoalesce(docs.config.robots, () => ( true)))) {
|
|
1221
1221
|
return new Response(renderFarmDocsRobotsTxt(docs, url.origin, basePath), {
|
|
1222
1222
|
status: 200,
|
|
1223
1223
|
headers: textHeaders("text/plain; charset=utf-8")
|
|
1224
1224
|
});
|
|
1225
1225
|
}
|
|
1226
|
-
if (
|
|
1227
|
-
const spec =
|
|
1226
|
+
if (_chunkNDOE76QCcjs.docsEngine.call(void 0, ).isDocsAgentDiscoveryRequest(url)) {
|
|
1227
|
+
const spec = _chunkNDOE76QCcjs.docsEngine.call(void 0, ).buildDocsAgentDiscoverySpec(
|
|
1228
1228
|
getDocsDiscoveryOptions(docs, request, basePath)
|
|
1229
1229
|
);
|
|
1230
1230
|
const title = getDocsTitle(docs);
|
|
@@ -1245,9 +1245,9 @@ function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded,
|
|
|
1245
1245
|
}
|
|
1246
1246
|
);
|
|
1247
1247
|
}
|
|
1248
|
-
if (
|
|
1248
|
+
if (_chunkNDOE76QCcjs.docsEngine.call(void 0, ).isDocsAgentsRequest(url)) {
|
|
1249
1249
|
return new Response(
|
|
1250
|
-
`${
|
|
1250
|
+
`${_chunkNDOE76QCcjs.docsEngine.call(void 0, ).renderDocsAgentsDocument(getDocsDiscoveryOptions(docs, request, basePath)).trim()}
|
|
1251
1251
|
`,
|
|
1252
1252
|
{
|
|
1253
1253
|
status: 200,
|
|
@@ -1255,9 +1255,9 @@ function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded,
|
|
|
1255
1255
|
}
|
|
1256
1256
|
);
|
|
1257
1257
|
}
|
|
1258
|
-
if (
|
|
1258
|
+
if (_chunkNDOE76QCcjs.docsEngine.call(void 0, ).isDocsSkillRequest(url)) {
|
|
1259
1259
|
return new Response(
|
|
1260
|
-
`${
|
|
1260
|
+
`${_chunkNDOE76QCcjs.docsEngine.call(void 0, ).renderDocsSkillDocument(getDocsDiscoveryOptions(docs, request, basePath)).trim()}
|
|
1261
1261
|
`,
|
|
1262
1262
|
{
|
|
1263
1263
|
status: 200,
|
|
@@ -1283,11 +1283,11 @@ function shouldReturnMarkdown(request) {
|
|
|
1283
1283
|
if (url.pathname.endsWith(".md")) return true;
|
|
1284
1284
|
const accept = request.headers.get("accept");
|
|
1285
1285
|
const markdown = Math.max(
|
|
1286
|
-
|
|
1287
|
-
|
|
1286
|
+
_chunkHGB4PM2Ccjs.farmAcceptQuality.call(void 0, accept, "text/markdown"),
|
|
1287
|
+
_chunkHGB4PM2Ccjs.farmAcceptQuality.call(void 0, accept, "text/plain")
|
|
1288
1288
|
);
|
|
1289
1289
|
if (markdown <= 0) return false;
|
|
1290
|
-
return markdown >=
|
|
1290
|
+
return markdown >= _chunkHGB4PM2Ccjs.farmAcceptQuality.call(void 0, accept, "text/html", { wildcards: true });
|
|
1291
1291
|
}
|
|
1292
1292
|
function escapeAttribute(value) {
|
|
1293
1293
|
return escapeHtml(value).replace(/'/g, "'");
|
|
@@ -1980,7 +1980,7 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1980
1980
|
if (!_optionalChain([docs, 'optionalAccess', _82 => _82.enabled]) || incomingRequest.method !== "GET" && incomingRequest.method !== "HEAD") {
|
|
1981
1981
|
return null;
|
|
1982
1982
|
}
|
|
1983
|
-
await
|
|
1983
|
+
await _chunkNDOE76QCcjs.loadFarmDocsEngine.call(void 0, );
|
|
1984
1984
|
const request = toFarmDocsRouteRequest(incomingRequest, basePath);
|
|
1985
1985
|
const requestUrl = new URL(request.url);
|
|
1986
1986
|
if (request !== incomingRequest && (requestUrl.pathname === "/api/docs" || requestUrl.pathname.startsWith("/api/docs/"))) {
|
|
@@ -2043,7 +2043,7 @@ function createFarmDocsHandler(docs, options) {
|
|
|
2043
2043
|
return omitFarmDocsHeadBody(
|
|
2044
2044
|
request,
|
|
2045
2045
|
new Response(
|
|
2046
|
-
|
|
2046
|
+
_chunkNDOE76QCcjs.docsEngine.call(void 0, ).renderDocsMarkdownDocument(toFarmDocsMarkdownPage(page, basePath), {
|
|
2047
2047
|
origin,
|
|
2048
2048
|
llms: _nullishCoalesce(docs.config.llmsTxt, () => ( true)),
|
|
2049
2049
|
sitemap: toFarmDocsPublicSitemapConfig(docs.config.sitemap, basePath)
|
|
@@ -15,34 +15,160 @@ var _chunkA25FXJ7Dcjs = require('./chunk-A25FXJ7D.cjs');
|
|
|
15
15
|
var _chunkD22BUQKWcjs = require('./chunk-D22BUQKW.cjs');
|
|
16
16
|
|
|
17
17
|
// src/agent-identity.ts
|
|
18
|
-
var
|
|
19
|
-
["ChatGPT-User", "openai", "agent"],
|
|
20
|
-
["OAI-SearchBot", "openai", "crawler"],
|
|
21
|
-
["GPTBot", "openai", "crawler"],
|
|
22
|
-
["
|
|
23
|
-
["Claude-
|
|
24
|
-
["
|
|
25
|
-
["
|
|
26
|
-
["
|
|
27
|
-
["
|
|
28
|
-
["
|
|
29
|
-
["
|
|
18
|
+
var CLIENT_TOKENS = [
|
|
19
|
+
["ChatGPT-User", "ChatGPT-User", "openai", "agent"],
|
|
20
|
+
["OAI-SearchBot", "OAI-SearchBot", "openai", "crawler"],
|
|
21
|
+
["GPTBot", "GPTBot", "openai", "crawler"],
|
|
22
|
+
["codex[_-][a-z]+(?:[_-][a-z]+)*", "Codex", "openai", "harness"],
|
|
23
|
+
["Claude-User", "Claude-User", "anthropic", "agent"],
|
|
24
|
+
["Claude-SearchBot", "Claude-SearchBot", "anthropic", "crawler"],
|
|
25
|
+
["ClaudeBot", "ClaudeBot", "anthropic", "crawler"],
|
|
26
|
+
["claude-code", "Claude Code", "anthropic", "harness"],
|
|
27
|
+
["Perplexity-User", "Perplexity-User", "perplexity", "agent"],
|
|
28
|
+
["PerplexityBot", "PerplexityBot", "perplexity", "crawler"],
|
|
29
|
+
["Google-CloudVertexBot", "Google-CloudVertexBot", "google", "crawler"],
|
|
30
|
+
["MistralAI-User", "MistralAI-User", "other", "agent"],
|
|
31
|
+
["Meta-ExternalFetcher", "Meta-ExternalFetcher", "other", "agent"],
|
|
32
|
+
["Meta-ExternalAgent", "Meta-ExternalAgent", "other", "crawler"],
|
|
33
|
+
["Amazonbot", "Amazonbot", "other", "crawler"],
|
|
34
|
+
["DuckAssistBot", "DuckAssistBot", "other", "crawler"],
|
|
35
|
+
["CCBot", "CCBot", "other", "crawler"],
|
|
36
|
+
["Bytespider", "Bytespider", "other", "crawler"],
|
|
37
|
+
["Googlebot", "Googlebot", "google", "search"],
|
|
38
|
+
["Google-InspectionTool", "Google-InspectionTool", "google", "search"],
|
|
39
|
+
["bingbot", "Bingbot", "microsoft", "search"],
|
|
40
|
+
["Applebot", "Applebot", "unknown", "search"],
|
|
41
|
+
["DuckDuckBot", "DuckDuckBot", "unknown", "search"],
|
|
42
|
+
["YandexBot", "YandexBot", "unknown", "search"],
|
|
43
|
+
["Baiduspider", "Baiduspider", "unknown", "search"],
|
|
44
|
+
["PetalBot", "PetalBot", "unknown", "search"],
|
|
45
|
+
["BingPreview", "BingPreview", "microsoft", "preview"],
|
|
46
|
+
["facebookexternalhit", "facebookexternalhit", "unknown", "preview"],
|
|
47
|
+
["Slackbot-LinkExpanding", "Slackbot", "unknown", "preview"],
|
|
48
|
+
["Slackbot", "Slackbot", "unknown", "preview"],
|
|
49
|
+
["Twitterbot", "Twitterbot", "unknown", "preview"],
|
|
50
|
+
["Discordbot", "Discordbot", "unknown", "preview"],
|
|
51
|
+
["LinkedInBot", "LinkedInBot", "unknown", "preview"],
|
|
52
|
+
["TelegramBot", "TelegramBot", "unknown", "preview"],
|
|
53
|
+
["WhatsApp", "WhatsApp", "unknown", "preview"],
|
|
54
|
+
["UptimeRobot", "UptimeRobot", "unknown", "monitor"],
|
|
55
|
+
["vercel-cron", "Vercel Cron", "unknown", "monitor"],
|
|
56
|
+
["farmjs-clock", "Farm.js clock", "unknown", "monitor"],
|
|
57
|
+
["farmjs-infra-safe-fetch", "Farm.js Infra", "unknown", "bot"],
|
|
58
|
+
["FarmjsInfra-Discovery", "Farm.js Infra", "unknown", "bot"],
|
|
59
|
+
["GoogleOther", "GoogleOther", "google", "bot"],
|
|
60
|
+
["HeadlessChrome", "Headless Chrome", "unknown", "bot"],
|
|
61
|
+
["PhantomJS", "PhantomJS", "unknown", "bot"],
|
|
62
|
+
["Chrome-Lighthouse", "Lighthouse", "unknown", "bot"],
|
|
63
|
+
["Scrapy", "Scrapy", "unknown", "bot"],
|
|
64
|
+
["curl", "curl", "unknown", "script"],
|
|
65
|
+
["Wget", "Wget", "unknown", "script"],
|
|
66
|
+
["python-requests", "python-requests", "unknown", "script"],
|
|
67
|
+
["python-httpx", "python-httpx", "unknown", "script"],
|
|
68
|
+
["Python-urllib", "Python-urllib", "unknown", "script"],
|
|
69
|
+
["aiohttp", "aiohttp", "unknown", "script"],
|
|
70
|
+
["axios", "axios", "unknown", "script"],
|
|
71
|
+
["node-fetch", "node-fetch", "unknown", "script"],
|
|
72
|
+
["undici", "undici", "unknown", "script"],
|
|
73
|
+
// Node's built-in fetch sends exactly `node`.
|
|
74
|
+
["node", "Node.js", "unknown", "script"],
|
|
75
|
+
["Bun", "Bun", "unknown", "script"],
|
|
76
|
+
["Deno", "Deno", "unknown", "script"],
|
|
77
|
+
["Go-http-client", "Go", "unknown", "script"],
|
|
78
|
+
["okhttp", "OkHttp", "unknown", "script"],
|
|
79
|
+
["Java-http-client", "Java", "unknown", "script"],
|
|
80
|
+
["Java", "Java", "unknown", "script"],
|
|
81
|
+
["Apache-HttpClient", "Apache HttpClient", "unknown", "script"],
|
|
82
|
+
["PostmanRuntime", "Postman", "unknown", "script"],
|
|
83
|
+
["insomnia", "Insomnia", "unknown", "script"],
|
|
84
|
+
["HTTPie", "HTTPie", "unknown", "script"],
|
|
85
|
+
["libwww-perl", "libwww-perl", "unknown", "script"],
|
|
86
|
+
["Ruby", "Ruby", "unknown", "script"],
|
|
87
|
+
["got", "got", "unknown", "script"]
|
|
30
88
|
];
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
89
|
+
var CLIENT_PATTERN = new RegExp(
|
|
90
|
+
`(?:^|[\\s;(])(?:${CLIENT_TOKENS.map(([token]) => `(${token})`).join("|")})(?=[/\\s;)]|$)`,
|
|
91
|
+
"gi"
|
|
92
|
+
);
|
|
93
|
+
var PRECEDENCE = [
|
|
94
|
+
"harness",
|
|
95
|
+
"agent",
|
|
96
|
+
"crawler",
|
|
97
|
+
"search",
|
|
98
|
+
"preview",
|
|
99
|
+
"monitor",
|
|
100
|
+
"bot",
|
|
101
|
+
"script"
|
|
102
|
+
];
|
|
103
|
+
var AI_CATEGORIES = /* @__PURE__ */ new Set(["agent", "crawler", "harness"]);
|
|
104
|
+
var BROWSERS = [
|
|
105
|
+
[/\bEdg(?:e|A|iOS)?\//, "Edge"],
|
|
106
|
+
[/\bOPR\//, "Opera"],
|
|
107
|
+
[/\bSamsungBrowser\//, "Samsung Internet"],
|
|
108
|
+
[/\b(?:Firefox|FxiOS)\//, "Firefox"],
|
|
109
|
+
[/\b(?:Chrome|CriOS)\//, "Chrome"],
|
|
110
|
+
[/\bVersion\/[\d.]+ (?:Mobile\/\w+ )?Safari\//, "Safari"]
|
|
111
|
+
];
|
|
112
|
+
var BOT_WORD = /(?:bot|crawler|spider|scraper)(?:[/\s;)_-]|$)/i;
|
|
36
113
|
var UNKNOWN = { family: "unknown", category: "unknown", identity: "unknown" };
|
|
114
|
+
function matchToken(userAgent) {
|
|
115
|
+
let best = null;
|
|
116
|
+
let vendor;
|
|
117
|
+
for (const match of userAgent.matchAll(CLIENT_PATTERN)) {
|
|
118
|
+
const index = match.findIndex((group, i) => i > 0 && group !== void 0) - 1;
|
|
119
|
+
const [, name, family, category] = CLIENT_TOKENS[index];
|
|
120
|
+
if (family !== "unknown") {
|
|
121
|
+
if (vendor && vendor !== family) return false;
|
|
122
|
+
vendor = family;
|
|
123
|
+
}
|
|
124
|
+
if (!best || PRECEDENCE.indexOf(category) < PRECEDENCE.indexOf(best.category))
|
|
125
|
+
best = { name, family, category };
|
|
126
|
+
}
|
|
127
|
+
return best;
|
|
128
|
+
}
|
|
37
129
|
function classifyFarmAgent(userAgent) {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
130
|
+
const match = matchToken((_nullishCoalesce(userAgent, () => ( ""))).slice(0, 2048));
|
|
131
|
+
if (match && AI_CATEGORIES.has(match.category)) {
|
|
132
|
+
const { family, category } = match;
|
|
133
|
+
return {
|
|
134
|
+
family,
|
|
135
|
+
category,
|
|
136
|
+
identity: "self-reported"
|
|
137
|
+
};
|
|
43
138
|
}
|
|
44
139
|
return { ...UNKNOWN };
|
|
45
140
|
}
|
|
141
|
+
function classifyFarmClient(request) {
|
|
142
|
+
const { headers } = request;
|
|
143
|
+
const userAgent = (_nullishCoalesce(headers.get("user-agent"), () => ( ""))).slice(0, 2048);
|
|
144
|
+
const match = matchToken(userAgent);
|
|
145
|
+
if (match === false) return { ...UNKNOWN };
|
|
146
|
+
if (match && AI_CATEGORIES.has(match.category)) return declared(match);
|
|
147
|
+
if (/"https:\/\/chatgpt\.com\/?"/i.test(_nullishCoalesce(headers.get("signature-agent"), () => ( ""))))
|
|
148
|
+
return declared({ name: "ChatGPT agent", family: "openai", category: "agent" });
|
|
149
|
+
if (isMcpRequest(request))
|
|
150
|
+
return declared({ name: "MCP client", family: "unknown", category: "harness" });
|
|
151
|
+
if (match) return declared(match);
|
|
152
|
+
const browser = browserName(userAgent);
|
|
153
|
+
if (browser !== void 0 && headers.has("sec-fetch-site") && headers.has("sec-fetch-dest"))
|
|
154
|
+
return declared({ name: browser, family: "unknown", category: "browser" });
|
|
155
|
+
if (BOT_WORD.test(userAgent) || userAgent.includes("://"))
|
|
156
|
+
return declared({ name: "", family: "unknown", category: "bot" });
|
|
157
|
+
return { ...UNKNOWN };
|
|
158
|
+
}
|
|
159
|
+
function declared({ name, family, category }) {
|
|
160
|
+
return { family, category, identity: "self-reported", ...name ? { name } : {} };
|
|
161
|
+
}
|
|
162
|
+
function isMcpRequest(request) {
|
|
163
|
+
const { headers } = request;
|
|
164
|
+
if (headers.has("mcp-protocol-version") || headers.has("mcp-session-id")) return true;
|
|
165
|
+
const accept = _nullishCoalesce(headers.get("accept"), () => ( ""));
|
|
166
|
+
return request.method === "POST" && /(?:^|[\s,])application\/json(?:[\s;,]|$)/i.test(accept) && /(?:^|[\s,])text\/event-stream(?:[\s;,]|$)/i.test(accept);
|
|
167
|
+
}
|
|
168
|
+
function browserName(userAgent) {
|
|
169
|
+
if (!userAgent.startsWith("Mozilla/5.0 (") || /compatible;|:\/\//i.test(userAgent)) return;
|
|
170
|
+
return _nullishCoalesce(_optionalChain([BROWSERS, 'access', _2 => _2.find, 'call', _3 => _3(([pattern]) => pattern.test(userAgent)), 'optionalAccess', _4 => _4[1]]), () => ( ""));
|
|
171
|
+
}
|
|
46
172
|
var FARM_INTERNAL_READ_HEADER = "x-farm-internal-read";
|
|
47
173
|
function emitFarmAgentRead(request, surface, status, view) {
|
|
48
174
|
if (request.headers.has(FARM_INTERNAL_READ_HEADER)) return;
|
|
@@ -72,7 +198,7 @@ function parseMarkdownHeadingsFromLines(lines) {
|
|
|
72
198
|
const headings = [];
|
|
73
199
|
const used = /* @__PURE__ */ new Map();
|
|
74
200
|
let index = 0;
|
|
75
|
-
if (_optionalChain([lines, 'access',
|
|
201
|
+
if (_optionalChain([lines, 'access', _5 => _5[0], 'optionalAccess', _6 => _6.trim, 'call', _7 => _7()]) === "---") {
|
|
76
202
|
const close = lines.findIndex((line, lineIndex) => lineIndex > 0 && line.trim() === "---");
|
|
77
203
|
if (close > 0) index = close + 1;
|
|
78
204
|
}
|
|
@@ -286,7 +412,7 @@ Continue: ${next} (about ${remaining} more tokens)
|
|
|
286
412
|
function readOpenFences(lines) {
|
|
287
413
|
const open = [];
|
|
288
414
|
let fence;
|
|
289
|
-
let frontMatter = _optionalChain([lines, 'access',
|
|
415
|
+
let frontMatter = _optionalChain([lines, 'access', _8 => _8[0], 'optionalAccess', _9 => _9.trim, 'call', _10 => _10()]) === "---";
|
|
290
416
|
for (let index = 0; index < lines.length; index++) {
|
|
291
417
|
open.push(frontMatter && index > 0 ? { opener: "", closer: "" } : fence);
|
|
292
418
|
const line = lines[index];
|
|
@@ -415,7 +541,7 @@ function resolveMarkdownConfig(config) {
|
|
|
415
541
|
}
|
|
416
542
|
function resolveMarkdownMirrorTarget(config, pathname, options = {}) {
|
|
417
543
|
const hasMarkdownExtension = pathname.toLowerCase().endsWith(".md");
|
|
418
|
-
if (!_optionalChain([config, 'optionalAccess',
|
|
544
|
+
if (!_optionalChain([config, 'optionalAccess', _11 => _11.enabled]) || !hasMarkdownExtension && !requestAcceptsMarkdown(options.accept)) {
|
|
419
545
|
return null;
|
|
420
546
|
}
|
|
421
547
|
const targetPathname = _resolveFarmMarkdownIndexAlias(
|
|
@@ -424,7 +550,7 @@ function resolveMarkdownMirrorTarget(config, pathname, options = {}) {
|
|
|
424
550
|
),
|
|
425
551
|
options.routePathname
|
|
426
552
|
);
|
|
427
|
-
const routePathname = _nullishCoalesce(_optionalChain([options, 'access',
|
|
553
|
+
const routePathname = _nullishCoalesce(_optionalChain([options, 'access', _12 => _12.routePathname, 'optionalCall', _13 => _13(targetPathname)]), () => ( targetPathname));
|
|
428
554
|
const route = findExposedMarkdownRoute(config, routePathname);
|
|
429
555
|
if (!route && config.expose !== true) {
|
|
430
556
|
return null;
|
|
@@ -439,7 +565,7 @@ async function createMarkdownMirrorResponse(options) {
|
|
|
439
565
|
if (options.request.method !== "GET" && options.request.method !== "HEAD") {
|
|
440
566
|
return null;
|
|
441
567
|
}
|
|
442
|
-
const requestUrl = _optionalChain([options, 'access',
|
|
568
|
+
const requestUrl = _optionalChain([options, 'access', _14 => _14.requestUrl, 'optionalAccess', _15 => _15.href]) === options.request.url ? options.requestUrl : new URL(options.request.url);
|
|
443
569
|
const hasMarkdownExtension = requestUrl.pathname.toLowerCase().endsWith(".md");
|
|
444
570
|
const target = resolveMarkdownMirrorTarget(options.config, requestUrl.pathname, {
|
|
445
571
|
accept: options.request.headers.get("accept"),
|
|
@@ -481,7 +607,7 @@ async function createMarkdownMirrorResponse(options) {
|
|
|
481
607
|
options.request.method === "HEAD"
|
|
482
608
|
);
|
|
483
609
|
if (accessResponse || options.request.method === "HEAD") {
|
|
484
|
-
void _optionalChain([pageResponse, 'access',
|
|
610
|
+
void _optionalChain([pageResponse, 'access', _16 => _16.body, 'optionalAccess', _17 => _17.cancel, 'call', _18 => _18(), 'access', _19 => _19.catch, 'call', _20 => _20(() => {
|
|
485
611
|
})]);
|
|
486
612
|
return _nullishCoalesce(accessResponse, () => ( new Response(null, {
|
|
487
613
|
status: pageResponse.status,
|
|
@@ -496,7 +622,7 @@ async function createMarkdownMirrorResponse(options) {
|
|
|
496
622
|
const region = pageResponse.status < 400 && /<form\b/i.test(html) ? readHtmlContentRegion(html) : void 0;
|
|
497
623
|
const actions = region === void 0 ? [] : extractPageActionsFromRegion(region, pageUrl);
|
|
498
624
|
for (const form of actions) {
|
|
499
|
-
if (!_optionalChain([form, 'access',
|
|
625
|
+
if (!_optionalChain([form, 'access', _21 => _21.action, 'optionalAccess', _22 => _22.startsWith, 'call', _23 => _23("/")])) continue;
|
|
500
626
|
const pathname = new URL(form.action, pageUrl.origin).pathname;
|
|
501
627
|
const tool = _nullishCoalesce(_chunkLRB5OVRTcjs._findFarmMCPEndpointTool.call(void 0, form.method, pathname, options.apiServerBasePath), () => ( _chunkLRB5OVRTcjs._findFarmMCPEndpointTool.call(void 0, form.method, _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, pathname), options.apiServerBasePath)));
|
|
502
628
|
if (tool) form.tool = tool;
|
|
@@ -504,8 +630,8 @@ async function createMarkdownMirrorResponse(options) {
|
|
|
504
630
|
const markdown = pageResponse.status < 400 && requestUrl.searchParams.has("actions") ? "" : convertHtmlToMarkdown(
|
|
505
631
|
html,
|
|
506
632
|
{
|
|
507
|
-
title: _optionalChain([target, 'access',
|
|
508
|
-
includeMetadata: _nullishCoalesce(_optionalChain([options, 'access',
|
|
633
|
+
title: _optionalChain([target, 'access', _24 => _24.route, 'optionalAccess', _25 => _25.title]),
|
|
634
|
+
includeMetadata: _nullishCoalesce(_optionalChain([options, 'access', _26 => _26.config, 'optionalAccess', _27 => _27.includeMetadata]), () => ( true)),
|
|
509
635
|
sourcePath: target.pathname,
|
|
510
636
|
actionsPath: actions.length > 0 ? `${markdownPath}?actions` : void 0
|
|
511
637
|
},
|
|
@@ -519,12 +645,12 @@ async function createMarkdownMirrorResponse(options) {
|
|
|
519
645
|
if (!hasMarkdownExtension) {
|
|
520
646
|
headersOut.set("Vary", "Accept");
|
|
521
647
|
}
|
|
522
|
-
for (const token of _nullishCoalesce(_optionalChain([pageResponse, 'access',
|
|
648
|
+
for (const token of _nullishCoalesce(_optionalChain([pageResponse, 'access', _28 => _28.headers, 'access', _29 => _29.get, 'call', _30 => _30("vary"), 'optionalAccess', _31 => _31.split, 'call', _32 => _32(",")]), () => ( []))) {
|
|
523
649
|
const name = token.trim();
|
|
524
650
|
if (name && name.toLowerCase() !== "accept") appendHeaderToken(headersOut, "Vary", name);
|
|
525
651
|
}
|
|
526
652
|
const pageCacheControl = pageResponse.headers.get("cache-control");
|
|
527
|
-
const cache = _nullishCoalesce(_nullishCoalesce(_optionalChain([target, 'access',
|
|
653
|
+
const cache = _nullishCoalesce(_nullishCoalesce(_optionalChain([target, 'access', _33 => _33.route, 'optionalAccess', _34 => _34.cache]), () => ( _optionalChain([options, 'access', _35 => _35.config, 'optionalAccess', _36 => _36.cache]))), () => ( false));
|
|
528
654
|
headersOut.set(
|
|
529
655
|
"Cache-Control",
|
|
530
656
|
pageCacheControl && isPrivateCacheControl(pageCacheControl) ? pageCacheControl : _chunkNLBHLPEOcjs.withoutFarmDeploymentCookie.call(void 0, headers.get("cookie")) || headers.has("authorization") ? "private, no-store" : createMarkdownCacheHeader(cache)
|
|
@@ -533,7 +659,7 @@ async function createMarkdownMirrorResponse(options) {
|
|
|
533
659
|
if (pageResponse.status >= 400) {
|
|
534
660
|
preserveMarkdownResponseControlHeaders(pageResponse.headers, headersOut);
|
|
535
661
|
}
|
|
536
|
-
const robots = [pageResponse.headers.get("x-robots-tag"), readHtmlMetaContent(html, "robots")].filter((value) => Boolean(_optionalChain([value, 'optionalAccess',
|
|
662
|
+
const robots = [pageResponse.headers.get("x-robots-tag"), readHtmlMetaContent(html, "robots")].filter((value) => Boolean(_optionalChain([value, 'optionalAccess', _37 => _37.trim, 'call', _38 => _38()]))).join(", ");
|
|
537
663
|
if (robots) headersOut.set("X-Robots-Tag", robots);
|
|
538
664
|
const canonical = readHtmlCanonicalHref(html);
|
|
539
665
|
if (canonical) {
|
|
@@ -858,7 +984,7 @@ function getFarmMarkdownAlternatePath(config, pathname, options = {}) {
|
|
|
858
984
|
return target ? target.markdownPath : null;
|
|
859
985
|
}
|
|
860
986
|
function isFarmMarkdownMirrorExposed(config, pathname) {
|
|
861
|
-
if (!_optionalChain([config, 'optionalAccess',
|
|
987
|
+
if (!_optionalChain([config, 'optionalAccess', _39 => _39.enabled])) return false;
|
|
862
988
|
return config.expose === true || findExposedMarkdownRoute(config, pathname) !== null;
|
|
863
989
|
}
|
|
864
990
|
function matchesFarmMarkdownRoutePattern(pattern, pathname) {
|
|
@@ -944,7 +1070,7 @@ function extractHtmlBody(html) {
|
|
|
944
1070
|
const body = rootMatch ? rootMatch[1] : bodyMatch ? bodyMatch[1] : html;
|
|
945
1071
|
const main = extractFirstElementContent(body, ["main"]);
|
|
946
1072
|
if (main !== void 0) return main;
|
|
947
|
-
const articles = _nullishCoalesce(_optionalChain([body, 'access',
|
|
1073
|
+
const articles = _nullishCoalesce(_optionalChain([body, 'access', _40 => _40.match, 'call', _41 => _41(/<article\b/gi), 'optionalAccess', _42 => _42.length]), () => ( 0));
|
|
948
1074
|
return articles === 1 ? _nullishCoalesce(extractFirstElementContent(body, ["article"]), () => ( body)) : body;
|
|
949
1075
|
}
|
|
950
1076
|
function extractFirstElementContent(html, tagNames) {
|
|
@@ -958,7 +1084,7 @@ function extractFirstElementContent(html, tagNames) {
|
|
|
958
1084
|
}
|
|
959
1085
|
function readHtmlMetaContent(html, name) {
|
|
960
1086
|
for (const match of html.matchAll(/<meta\b([^>]*)>/gi)) {
|
|
961
|
-
if (_optionalChain([readHtmlAttribute, 'call',
|
|
1087
|
+
if (_optionalChain([readHtmlAttribute, 'call', _43 => _43(match[1], "name"), 'optionalAccess', _44 => _44.toLowerCase, 'call', _45 => _45()]) === name) {
|
|
962
1088
|
return readHtmlAttribute(match[1], "content");
|
|
963
1089
|
}
|
|
964
1090
|
}
|
|
@@ -966,8 +1092,8 @@ function readHtmlMetaContent(html, name) {
|
|
|
966
1092
|
}
|
|
967
1093
|
function readHtmlCanonicalHref(html) {
|
|
968
1094
|
for (const match of html.matchAll(/<link\b([^>]*)>/gi)) {
|
|
969
|
-
const rel = _optionalChain([readHtmlAttribute, 'call',
|
|
970
|
-
if (_optionalChain([rel, 'optionalAccess',
|
|
1095
|
+
const rel = _optionalChain([readHtmlAttribute, 'call', _46 => _46(match[1], "rel"), 'optionalAccess', _47 => _47.toLowerCase, 'call', _48 => _48(), 'access', _49 => _49.split, 'call', _50 => _50(/\s+/)]);
|
|
1096
|
+
if (_optionalChain([rel, 'optionalAccess', _51 => _51.includes, 'call', _52 => _52("canonical")])) return readHtmlAttribute(match[1], "href");
|
|
971
1097
|
}
|
|
972
1098
|
return void 0;
|
|
973
1099
|
}
|
|
@@ -994,7 +1120,7 @@ function extractPageActionsFromRegion(region, pageUrl) {
|
|
|
994
1120
|
return actions;
|
|
995
1121
|
}
|
|
996
1122
|
function readPageForm(attributes, content, pageUrl, labelsFor) {
|
|
997
|
-
const method = _optionalChain([readDecodedAttribute, 'call',
|
|
1123
|
+
const method = _optionalChain([readDecodedAttribute, 'call', _53 => _53(attributes, "method"), 'optionalAccess', _54 => _54.trim, 'call', _55 => _55(), 'access', _56 => _56.toLowerCase, 'call', _57 => _57()]);
|
|
998
1124
|
if (method === "dialog") return void 0;
|
|
999
1125
|
const target = resolveFormTarget(readDecodedAttribute(attributes, "action"), pageUrl);
|
|
1000
1126
|
const form = {
|
|
@@ -1004,11 +1130,11 @@ function readPageForm(attributes, content, pageUrl, labelsFor) {
|
|
|
1004
1130
|
submit: []
|
|
1005
1131
|
};
|
|
1006
1132
|
const name = _nullishCoalesce(_nullishCoalesce(readDecodedAttribute(attributes, "aria-label"), () => ( readDecodedAttribute(attributes, "name"))), () => ( readDecodedAttribute(attributes, "id")));
|
|
1007
|
-
if (_optionalChain([name, 'optionalAccess',
|
|
1133
|
+
if (_optionalChain([name, 'optionalAccess', _58 => _58.trim, 'call', _59 => _59()])) form.name = name.trim();
|
|
1008
1134
|
if (target) form.action = target;
|
|
1009
1135
|
else form.requiresJavaScript = true;
|
|
1010
1136
|
if (form.method === "POST") {
|
|
1011
|
-
const enctype = _optionalChain([readDecodedAttribute, 'call',
|
|
1137
|
+
const enctype = _optionalChain([readDecodedAttribute, 'call', _60 => _60(attributes, "enctype"), 'optionalAccess', _61 => _61.trim, 'call', _62 => _62(), 'access', _63 => _63.toLowerCase, 'call', _64 => _64()]);
|
|
1012
1138
|
form.enctype = enctype && FORM_ENCTYPES.has(enctype) ? enctype : "application/x-www-form-urlencoded";
|
|
1013
1139
|
}
|
|
1014
1140
|
const wrappingLabels = [...content.matchAll(/<label\b[^>]*>([\s\S]*?)<\/label>/gi)].map(
|
|
@@ -1019,13 +1145,13 @@ function readPageForm(attributes, content, pageUrl, labelsFor) {
|
|
|
1019
1145
|
})
|
|
1020
1146
|
);
|
|
1021
1147
|
const labelOf = (controlAttributes, index) => {
|
|
1022
|
-
const aria = _optionalChain([readDecodedAttribute, 'call',
|
|
1148
|
+
const aria = _optionalChain([readDecodedAttribute, 'call', _65 => _65(controlAttributes, "aria-label"), 'optionalAccess', _66 => _66.trim, 'call', _67 => _67()]);
|
|
1023
1149
|
if (aria) return aria;
|
|
1024
1150
|
const id = readDecodedAttribute(controlAttributes, "id");
|
|
1025
1151
|
const forLabel = id ? labelsFor.get(id) : void 0;
|
|
1026
1152
|
if (forLabel) return forLabel;
|
|
1027
1153
|
const wrapping = wrappingLabels.find((label) => label.start < index && index < label.end);
|
|
1028
|
-
return _optionalChain([wrapping, 'optionalAccess',
|
|
1154
|
+
return _optionalChain([wrapping, 'optionalAccess', _68 => _68.text]) || void 0;
|
|
1029
1155
|
};
|
|
1030
1156
|
const groups = /* @__PURE__ */ new Map();
|
|
1031
1157
|
const controls = /<(input)\b([^>]*)>|<(select|textarea|button)\b([^>]*)>([\s\S]*?)<\/\3>/gi;
|
|
@@ -1036,7 +1162,7 @@ function readPageForm(attributes, content, pageUrl, labelsFor) {
|
|
|
1036
1162
|
if (hasHtmlAttribute(controlAttributes, "disabled")) continue;
|
|
1037
1163
|
const label = labelOf(controlAttributes, match.index);
|
|
1038
1164
|
const fieldName = readDecodedAttribute(controlAttributes, "name");
|
|
1039
|
-
const typeAttribute = _optionalChain([readDecodedAttribute, 'call',
|
|
1165
|
+
const typeAttribute = _optionalChain([readDecodedAttribute, 'call', _69 => _69(controlAttributes, "type"), 'optionalAccess', _70 => _70.trim, 'call', _71 => _71(), 'access', _72 => _72.toLowerCase, 'call', _73 => _73()]);
|
|
1040
1166
|
const type = tag === "input" ? _nullishCoalesce(typeAttribute, () => ( "text")) : tag === "button" ? _nullishCoalesce(typeAttribute, () => ( "submit")) : tag;
|
|
1041
1167
|
if (tag === "button" && !["button", "reset"].includes(type) || tag === "input" && (type === "submit" || type === "image")) {
|
|
1042
1168
|
const submit = {
|
|
@@ -1050,7 +1176,7 @@ function readPageForm(attributes, content, pageUrl, labelsFor) {
|
|
|
1050
1176
|
const resolved = resolveFormTarget(formAction, pageUrl);
|
|
1051
1177
|
if (resolved) submit.action = resolved;
|
|
1052
1178
|
}
|
|
1053
|
-
const formMethod = _optionalChain([readDecodedAttribute, 'call',
|
|
1179
|
+
const formMethod = _optionalChain([readDecodedAttribute, 'call', _74 => _74(controlAttributes, "formmethod"), 'optionalAccess', _75 => _75.toLowerCase, 'call', _76 => _76()]);
|
|
1054
1180
|
if (formMethod === "get" || formMethod === "post") submit.method = formMethod.toUpperCase();
|
|
1055
1181
|
form.submit.push(submit);
|
|
1056
1182
|
continue;
|
|
@@ -1128,7 +1254,7 @@ function readPageForm(attributes, content, pageUrl, labelsFor) {
|
|
|
1128
1254
|
function resolveFormTarget(action, pageUrl) {
|
|
1129
1255
|
let target;
|
|
1130
1256
|
try {
|
|
1131
|
-
target = new URL(_optionalChain([action, 'optionalAccess',
|
|
1257
|
+
target = new URL(_optionalChain([action, 'optionalAccess', _77 => _77.trim, 'call', _78 => _78()]) || pageUrl.href, pageUrl);
|
|
1132
1258
|
} catch (e5) {
|
|
1133
1259
|
return void 0;
|
|
1134
1260
|
}
|
|
@@ -1155,7 +1281,7 @@ function readHtmlAttribute(attributes, name) {
|
|
|
1155
1281
|
}
|
|
1156
1282
|
function readCodeLanguage(attributesList) {
|
|
1157
1283
|
for (const attributes of attributesList) {
|
|
1158
|
-
const language = _nullishCoalesce(_nullishCoalesce(readHtmlAttribute(attributes, "data-language"), () => ( readHtmlAttribute(attributes, "data-lang"))), () => ( _optionalChain([readHtmlAttribute, 'call',
|
|
1284
|
+
const language = _nullishCoalesce(_nullishCoalesce(readHtmlAttribute(attributes, "data-language"), () => ( readHtmlAttribute(attributes, "data-lang"))), () => ( _optionalChain([readHtmlAttribute, 'call', _79 => _79(attributes, "class"), 'optionalAccess', _80 => _80.match, 'call', _81 => _81(/(?:^|\s)lang(?:uage)?-(\S+)/), 'optionalAccess', _82 => _82[1]])));
|
|
1159
1285
|
if (language && /^[\w#+.-]+$/.test(language)) return language;
|
|
1160
1286
|
}
|
|
1161
1287
|
return void 0;
|
|
@@ -1263,7 +1389,7 @@ function matchClosingTags(html) {
|
|
|
1263
1389
|
while (match = tags.exec(html)) {
|
|
1264
1390
|
const name = match[2].toLowerCase();
|
|
1265
1391
|
if (match[1]) {
|
|
1266
|
-
const start = _optionalChain([open, 'access',
|
|
1392
|
+
const start = _optionalChain([open, 'access', _83 => _83.get, 'call', _84 => _84(name), 'optionalAccess', _85 => _85.pop, 'call', _86 => _86()]);
|
|
1267
1393
|
if (start !== void 0) closes.set(start, match.index + match[0].length);
|
|
1268
1394
|
} else if (!VOID_TAGS.has(name) && !isSelfClosingTag(match[0])) {
|
|
1269
1395
|
let starts = open.get(name);
|
|
@@ -1296,7 +1422,7 @@ function resolveStreamedBoundaries(html, { boundaries, placeholders }) {
|
|
|
1296
1422
|
let cursor = 0;
|
|
1297
1423
|
let match;
|
|
1298
1424
|
while (match = openingTag.exec(html)) {
|
|
1299
|
-
const id = _optionalChain([/\sid="([^"]*)"/, 'access',
|
|
1425
|
+
const id = _optionalChain([/\sid="([^"]*)"/, 'access', _87 => _87.exec, 'call', _88 => _88(match[2]), 'optionalAccess', _89 => _89[1]]);
|
|
1300
1426
|
if (!id || !wanted.has(id) || segments.has(id)) continue;
|
|
1301
1427
|
const close = closingTags.get(match.index);
|
|
1302
1428
|
if (close === void 0) continue;
|
|
@@ -1393,4 +1519,5 @@ function decodeHtml(input) {
|
|
|
1393
1519
|
|
|
1394
1520
|
|
|
1395
1521
|
|
|
1396
|
-
|
|
1522
|
+
|
|
1523
|
+
exports.classifyFarmAgent = classifyFarmAgent; exports.classifyFarmClient = classifyFarmClient; exports.FARM_INTERNAL_READ_HEADER = FARM_INTERNAL_READ_HEADER; exports.emitFarmAgentRead = emitFarmAgentRead; exports.createFarmMarkdownViewResponse = createFarmMarkdownViewResponse; exports.FARM_MARKDOWN_CONTENT_TYPE = FARM_MARKDOWN_CONTENT_TYPE; exports.FARM_MARKDOWN_PAGE_CHECK_HEADER = FARM_MARKDOWN_PAGE_CHECK_HEADER; exports._getFarmMarkdownPageCheckToken = _getFarmMarkdownPageCheckToken; exports._isFarmMarkdownPageCheck = _isFarmMarkdownPageCheck; exports.farmRequestWantsMarkdown = farmRequestWantsMarkdown; exports.createFarmMarkdownErrorBody = createFarmMarkdownErrorBody; exports.resolveMarkdownConfig = resolveMarkdownConfig; exports.resolveMarkdownMirrorTarget = resolveMarkdownMirrorTarget; exports.createMarkdownMirrorResponse = createMarkdownMirrorResponse; exports.applyMarkdownNegotiationHeaders = applyMarkdownNegotiationHeaders; exports.htmlToMarkdown = htmlToMarkdown; exports._resolveFarmMarkdownIndexAlias = _resolveFarmMarkdownIndexAlias; exports._getFarmMarkdownPath = _getFarmMarkdownPath; exports.farmAcceptQuality = farmAcceptQuality; exports.requestAcceptsMarkdown = requestAcceptsMarkdown; exports.getFarmMarkdownMirrorPath = getFarmMarkdownMirrorPath; exports.getFarmMarkdownAlternatePath = getFarmMarkdownAlternatePath; exports.isFarmMarkdownMirrorExposed = isFarmMarkdownMirrorExposed; exports.matchesFarmMarkdownRoutePattern = matchesFarmMarkdownRoutePattern; exports._readFarmRenderedHtml = _readFarmRenderedHtml; exports.extractFarmPageActions = extractFarmPageActions;
|