@farming-labs/svelte 0.1.101 → 0.1.103
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/server.d.ts +1 -1
- package/dist/server.js +60 -2
- package/package.json +2 -2
package/dist/server.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* import config from "./docs.config";
|
|
13
13
|
*
|
|
14
14
|
* // Bundle content at build time for serverless deployments
|
|
15
|
-
* const contentFiles = import.meta.glob(["/docs/**\/*.{md,mdx,svx}", "/skill.md"], {
|
|
15
|
+
* const contentFiles = import.meta.glob(["/docs/**\/*.{md,mdx,svx}", "/AGENTS.md", "/skill.md"], {
|
|
16
16
|
* query: "?raw", import: "default", eager: true,
|
|
17
17
|
* }) as Record<string, string>;
|
|
18
18
|
*
|
package/dist/server.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* import config from "./docs.config";
|
|
13
13
|
*
|
|
14
14
|
* // Bundle content at build time for serverless deployments
|
|
15
|
-
* const contentFiles = import.meta.glob(["/docs/**\/*.{md,mdx,svx}", "/skill.md"], {
|
|
15
|
+
* const contentFiles = import.meta.glob(["/docs/**\/*.{md,mdx,svx}", "/AGENTS.md", "/skill.md"], {
|
|
16
16
|
* query: "?raw", import: "default", eager: true,
|
|
17
17
|
* }) as Record<string, string>;
|
|
18
18
|
*
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
import fs from "node:fs";
|
|
31
31
|
import path from "node:path";
|
|
32
32
|
import matter from "gray-matter";
|
|
33
|
-
import { applySidebarFolderIndexBehavior, buildDocsAskAIContext, buildDocsAgentDiscoverySpec, createDocsRobotsResponse, createDocsSitemapResponse, createDocsAgentTraceContext, createDocsAgentTraceId, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, formatDocsAskAIPackageHints, findDocsMarkdownPage, getDocsLlmsTxtMaxCharsIssue, getDocsMarkdownCanonicalLinkHeader, getDocsMarkdownVaryHeader, isDocsAgentDiscoveryRequest, isDocsSkillRequest, normalizeDocsRelated, parseDocsAgentFeedbackData, performDocsSearch, renderDocsMarkdownDocument, renderDocsMarkdownNotFound, renderDocsLlmsTxt, renderDocsSkillDocument, readDocsSitemapManifestFromContentMap, stripGeneratedAgentProvenance, resolveDocsAgentMdxContent, resolveDocsAgentFeedbackConfig, resolveDocsAgentFeedbackRequest, resolvePageSidebarFolderIndexBehavior, resolveAskAISearchRequestConfig, resolveSearchRequestConfig, resolveDocsI18n, resolveDocsLlmsTxtRequest, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsMetadataBaseUrl, resolveDocsPath, resolvePageReadingTime, resolveReadingTimeOptions, resolveDocsSitemapPageLastmod, resolveDocsSkillFormat, renderDocsPageStructuredDataJson, selectDocsLlmsTxtContent, validateDocsAgentFeedbackPayload, } from "@farming-labs/docs";
|
|
33
|
+
import { applySidebarFolderIndexBehavior, buildDocsAskAIContext, buildDocsAgentDiscoverySpec, createDocsRobotsResponse, createDocsSitemapResponse, createDocsAgentTraceContext, createDocsAgentTraceId, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, formatDocsAskAIPackageHints, findDocsMarkdownPage, getDocsLlmsTxtMaxCharsIssue, getDocsMarkdownCanonicalLinkHeader, getDocsMarkdownVaryHeader, isDocsAgentDiscoveryRequest, isDocsAgentsRequest, isDocsSkillRequest, normalizeDocsRelated, parseDocsAgentFeedbackData, performDocsSearch, renderDocsMarkdownDocument, renderDocsMarkdownNotFound, renderDocsLlmsTxt, renderDocsAgentsDocument, renderDocsSkillDocument, readDocsSitemapManifestFromContentMap, stripGeneratedAgentProvenance, resolveDocsAgentMdxContent, resolveDocsAgentFeedbackConfig, resolveDocsAgentFeedbackRequest, resolvePageSidebarFolderIndexBehavior, resolveAskAISearchRequestConfig, resolveSearchRequestConfig, resolveDocsI18n, resolveDocsLlmsTxtRequest, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsMetadataBaseUrl, resolveDocsPath, resolvePageReadingTime, resolveReadingTimeOptions, resolveDocsSitemapPageLastmod, resolveDocsAgentsFormat, resolveDocsSkillFormat, renderDocsPageStructuredDataJson, selectDocsLlmsTxtContent, validateDocsAgentFeedbackPayload, } from "@farming-labs/docs";
|
|
34
34
|
import { buildApiReferenceOpenApiDocumentAsync, createDocsMcpHttpHandler, readDocsSitemapManifest, resolveApiReferenceConfig, resolveDocsMcpConfig, serializeDocsIconRegistry, serializeOpenDocsProviders, } from "@farming-labs/docs/server";
|
|
35
35
|
import { loadDocsNavTree, loadDocsContent, flattenNavTree } from "./content.js";
|
|
36
36
|
import { renderMarkdown } from "./markdown.js";
|
|
@@ -137,6 +137,34 @@ function readRootSkillDocument(contentMap, rootDir) {
|
|
|
137
137
|
}
|
|
138
138
|
return null;
|
|
139
139
|
}
|
|
140
|
+
function readRootAgentsDocument(contentMap, rootDir) {
|
|
141
|
+
if (contentMap) {
|
|
142
|
+
for (const key of [
|
|
143
|
+
"/AGENTS.md",
|
|
144
|
+
"AGENTS.md",
|
|
145
|
+
"./AGENTS.md",
|
|
146
|
+
"/AGENT.md",
|
|
147
|
+
"AGENT.md",
|
|
148
|
+
"./AGENT.md",
|
|
149
|
+
]) {
|
|
150
|
+
const raw = contentMap[key];
|
|
151
|
+
if (typeof raw === "string")
|
|
152
|
+
return raw;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
for (const fileName of ["AGENTS.md", "AGENT.md"]) {
|
|
156
|
+
const candidate = path.join(rootDir, fileName);
|
|
157
|
+
try {
|
|
158
|
+
if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {
|
|
159
|
+
return fs.readFileSync(candidate, "utf-8");
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
140
168
|
function navTreeFromMap(contentMap, dirPrefix, entry, ordering) {
|
|
141
169
|
const dirs = [];
|
|
142
170
|
for (const key of Object.keys(contentMap)) {
|
|
@@ -707,6 +735,36 @@ export function createDocsServer(config = {}) {
|
|
|
707
735
|
},
|
|
708
736
|
});
|
|
709
737
|
}
|
|
738
|
+
if (isDocsAgentsRequest(event.url) || resolveDocsAgentsFormat(event.url) === "agents") {
|
|
739
|
+
return new Response(readRootAgentsDocument(preloaded, rootDir) ??
|
|
740
|
+
renderDocsAgentsDocument({
|
|
741
|
+
origin: event.url.origin,
|
|
742
|
+
entry,
|
|
743
|
+
search: config.search,
|
|
744
|
+
mcp: mcpConfig,
|
|
745
|
+
feedback: agentFeedbackDiscovery,
|
|
746
|
+
llms: {
|
|
747
|
+
enabled: llmsEnabled,
|
|
748
|
+
baseUrl: llmsBaseUrl || undefined,
|
|
749
|
+
siteTitle: llmsTitle,
|
|
750
|
+
siteDescription: llmsDesc,
|
|
751
|
+
maxChars: typeof llmsTxtConfig === "object" ? llmsTxtConfig.maxChars : undefined,
|
|
752
|
+
sections: typeof llmsTxtConfig === "object" ? llmsTxtConfig.sections : undefined,
|
|
753
|
+
},
|
|
754
|
+
sitemap: config.sitemap,
|
|
755
|
+
robots: config.robots,
|
|
756
|
+
openapi: openapiDiscovery,
|
|
757
|
+
markdown: {
|
|
758
|
+
acceptHeader: false,
|
|
759
|
+
},
|
|
760
|
+
}), {
|
|
761
|
+
headers: {
|
|
762
|
+
"Content-Type": "text/markdown; charset=utf-8",
|
|
763
|
+
"Cache-Control": "public, max-age=0, s-maxage=3600",
|
|
764
|
+
"X-Robots-Tag": "noindex",
|
|
765
|
+
},
|
|
766
|
+
});
|
|
767
|
+
}
|
|
710
768
|
if (isDocsSkillRequest(event.url) || resolveDocsSkillFormat(event.url) === "skill") {
|
|
711
769
|
return new Response(readRootSkillDocument(preloaded, rootDir) ??
|
|
712
770
|
renderDocsSkillDocument({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/svelte",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.103",
|
|
4
4
|
"description": "SvelteKit adapter for @farming-labs/docs — content loading and navigation utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/node": "^22.10.0",
|
|
58
58
|
"typescript": "^5.9.3",
|
|
59
|
-
"@farming-labs/docs": "0.1.
|
|
59
|
+
"@farming-labs/docs": "0.1.103"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"@farming-labs/docs": "*"
|