@farming-labs/theme 0.1.80 → 0.1.81
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 +12 -6
- 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 { buildDocsAskAIContext, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsSitemapResponse, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, formatDocsAskAIPackageHints, getDocsMarkdownVaryHeader, normalizeDocsRelated, performDocsSearch, renderDocsRelatedMarkdownLines, resolveAskAISearchRequestConfig, resolveChangelogConfig, resolveDocsI18n, resolveDocsLocale, resolveDocsSitemapConfig, resolvePageSidebarFolderIndexBehavior, resolveSearchRequestConfig } from "@farming-labs/docs";
|
|
6
|
+
import { buildDocsAskAIContext, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsSitemapResponse, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, formatDocsAskAIPackageHints, getDocsMarkdownVaryHeader, hasDocsMarkdownSignatureAgent, normalizeDocsRelated, performDocsSearch, renderDocsMarkdownNotFound, renderDocsRelatedMarkdownLines, resolveAskAISearchRequestConfig, resolveChangelogConfig, resolveDocsI18n, resolveDocsLocale, resolveDocsSitemapConfig, resolvePageSidebarFolderIndexBehavior, resolveSearchRequestConfig } from "@farming-labs/docs";
|
|
7
7
|
import { createDocsMcpHttpHandler, createFilesystemDocsMcpSource, readDocsSitemapManifest, resolveDocsMcpConfig } from "@farming-labs/docs/server";
|
|
8
8
|
|
|
9
9
|
//#region src/docs-api.ts
|
|
@@ -885,14 +885,16 @@ function resolveMarkdownRequest(entry, url, request) {
|
|
|
885
885
|
requestedPath: pathname.slice(slugPrefix.length, -3),
|
|
886
886
|
delivery: "md_route"
|
|
887
887
|
};
|
|
888
|
-
|
|
888
|
+
const hasSignatureAgent = hasDocsMarkdownSignatureAgent(request);
|
|
889
|
+
if (acceptsMarkdown(request) || hasSignatureAgent) {
|
|
890
|
+
const delivery = hasSignatureAgent ? "signature_agent" : "accept_header";
|
|
889
891
|
if (pathname === normalizedEntry) return {
|
|
890
892
|
requestedPath: "",
|
|
891
|
-
delivery
|
|
893
|
+
delivery
|
|
892
894
|
};
|
|
893
895
|
if (pathname.startsWith(slugPrefix)) return {
|
|
894
896
|
requestedPath: pathname.slice(slugPrefix.length),
|
|
895
|
-
delivery
|
|
897
|
+
delivery
|
|
896
898
|
};
|
|
897
899
|
}
|
|
898
900
|
return null;
|
|
@@ -1795,10 +1797,14 @@ function createDocsAPI(options) {
|
|
|
1795
1797
|
found: false
|
|
1796
1798
|
}
|
|
1797
1799
|
});
|
|
1798
|
-
return new Response(
|
|
1800
|
+
return new Response(renderDocsMarkdownNotFound({
|
|
1801
|
+
entry,
|
|
1802
|
+
requestedPath: markdownRequest.requestedPath,
|
|
1803
|
+
sitemap: sitemapConfig
|
|
1804
|
+
}), {
|
|
1799
1805
|
status: 404,
|
|
1800
1806
|
headers: {
|
|
1801
|
-
"Content-Type": "text/
|
|
1807
|
+
"Content-Type": "text/markdown; charset=utf-8",
|
|
1802
1808
|
...varyHeader ? { Vary: varyHeader } : {},
|
|
1803
1809
|
"X-Robots-Tag": "noindex"
|
|
1804
1810
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/theme",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.81",
|
|
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.81"
|
|
143
143
|
},
|
|
144
144
|
"peerDependencies": {
|
|
145
145
|
"@farming-labs/docs": ">=0.0.1",
|