@farming-labs/theme 0.1.128 → 0.1.130
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/docs-api.mjs +17 -10
- package/package.json +2 -2
package/dist/docs-api.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { getNextAppDir } from "./get-app-dir.mjs";
|
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import matter from "gray-matter";
|
|
6
|
-
import { DEFAULT_SITEMAP_MD_DOCS_ROUTE, buildDocsAskAIContext, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsRobotsResponse, createDocsSitemapResponse, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, formatDocsAskAIPackageHints, getDocsLlmsTxtMaxCharsIssue, getDocsMarkdownVaryHeader, hasDocsMarkdownSignatureAgent, normalizeDocsRelated, performDocsSearch, renderDocsLlmsTxt, renderDocsMarkdownNotFound, renderDocsRelatedMarkdownLines, resolveAskAISearchRequestConfig, resolveChangelogConfig, resolveDocsI18n, resolveDocsLlmsTxtRequest, resolveDocsLlmsTxtSections, resolveDocsLocale, resolveDocsSitemapConfig, resolvePageSidebarFolderIndexBehavior, resolveSearchRequestConfig, selectDocsLlmsTxtContent } from "@farming-labs/docs";
|
|
6
|
+
import { DEFAULT_SITEMAP_MD_DOCS_ROUTE, buildDocsAskAIContext, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsRobotsResponse, createDocsSitemapResponse, detectDocsMarkdownAgentRequest, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, formatDocsAskAIPackageHints, getDocsLlmsTxtMaxCharsIssue, getDocsMarkdownVaryHeader, hasDocsMarkdownSignatureAgent, normalizeDocsRelated, performDocsSearch, renderDocsLlmsTxt, renderDocsMarkdownNotFound, renderDocsRelatedMarkdownLines, resolveAskAISearchRequestConfig, resolveChangelogConfig, resolveDocsI18n, resolveDocsLlmsTxtRequest, resolveDocsLlmsTxtSections, resolveDocsLocale, resolveDocsSitemapConfig, resolvePageSidebarFolderIndexBehavior, resolveSearchRequestConfig, selectDocsLlmsTxtContent } from "@farming-labs/docs";
|
|
7
7
|
import { buildApiReferenceOpenApiDocumentAsync, createDocsMcpHttpHandler, createFilesystemDocsMcpSource, readDocsSitemapManifest, resolveApiReferenceConfig, resolveDocsMcpConfig } from "@farming-labs/docs/server";
|
|
8
8
|
|
|
9
9
|
//#region src/docs-api.ts
|
|
@@ -992,6 +992,13 @@ function acceptsMarkdown(request) {
|
|
|
992
992
|
return Number.isFinite(quality) ? quality > 0 : true;
|
|
993
993
|
});
|
|
994
994
|
}
|
|
995
|
+
function resolveMarkdownHeaderDelivery(request) {
|
|
996
|
+
if (hasDocsMarkdownSignatureAgent(request)) return "signature_agent";
|
|
997
|
+
if (acceptsMarkdown(request)) return "accept_header";
|
|
998
|
+
const agentDetection = detectDocsMarkdownAgentRequest(request);
|
|
999
|
+
if (!agentDetection.detected) return null;
|
|
1000
|
+
return agentDetection.method === "heuristic" ? "heuristic" : "user_agent";
|
|
1001
|
+
}
|
|
995
1002
|
function resolveMarkdownRequest(entry, url, request) {
|
|
996
1003
|
if (url.searchParams.get("format")?.trim() === "markdown") return {
|
|
997
1004
|
requestedPath: url.searchParams.get("path")?.trim() ?? "",
|
|
@@ -1008,9 +1015,9 @@ function resolveMarkdownRequest(entry, url, request) {
|
|
|
1008
1015
|
requestedPath: pathname.slice(slugPrefix.length, -3),
|
|
1009
1016
|
delivery: "md_route"
|
|
1010
1017
|
};
|
|
1011
|
-
const
|
|
1012
|
-
if (
|
|
1013
|
-
const delivery =
|
|
1018
|
+
const headerDelivery = resolveMarkdownHeaderDelivery(request);
|
|
1019
|
+
if (headerDelivery) {
|
|
1020
|
+
const delivery = headerDelivery;
|
|
1014
1021
|
if (pathname === normalizedEntry) return {
|
|
1015
1022
|
requestedPath: "",
|
|
1016
1023
|
delivery
|
|
@@ -1078,9 +1085,9 @@ function resolvePublicMarkdownRequest(entry, docsPath, url, request) {
|
|
|
1078
1085
|
requestedPath: pathname.slice(1, -3),
|
|
1079
1086
|
delivery: "md_route"
|
|
1080
1087
|
};
|
|
1081
|
-
const
|
|
1082
|
-
if (
|
|
1083
|
-
const delivery =
|
|
1088
|
+
const headerDelivery = resolveMarkdownHeaderDelivery(request);
|
|
1089
|
+
if (headerDelivery) {
|
|
1090
|
+
const delivery = headerDelivery;
|
|
1084
1091
|
return {
|
|
1085
1092
|
requestedPath: pathname === "/" ? "" : pathname.slice(1),
|
|
1086
1093
|
delivery
|
|
@@ -1097,9 +1104,9 @@ function resolvePublicMarkdownRequest(entry, docsPath, url, request) {
|
|
|
1097
1104
|
requestedPath: pathname.slice(slugPrefix.length, -3),
|
|
1098
1105
|
delivery: "md_route"
|
|
1099
1106
|
};
|
|
1100
|
-
const
|
|
1101
|
-
if (
|
|
1102
|
-
const delivery =
|
|
1107
|
+
const headerDelivery = resolveMarkdownHeaderDelivery(request);
|
|
1108
|
+
if (headerDelivery) {
|
|
1109
|
+
const delivery = headerDelivery;
|
|
1103
1110
|
if (pathname === docsPath) return {
|
|
1104
1111
|
requestedPath: "",
|
|
1105
1112
|
delivery
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/theme",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.130",
|
|
4
4
|
"description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"tsdown": "^0.20.3",
|
|
140
140
|
"typescript": "^5.9.3",
|
|
141
141
|
"vitest": "^3.2.4",
|
|
142
|
-
"@farming-labs/docs": "0.1.
|
|
142
|
+
"@farming-labs/docs": "0.1.130"
|
|
143
143
|
},
|
|
144
144
|
"peerDependencies": {
|
|
145
145
|
"@farming-labs/docs": ">=0.0.1",
|