@farming-labs/theme 0.2.31 → 0.2.33
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 +23 -1
- 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, detectDocsMarkdownAgentRequest, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsTelemetryAgentSurfaceEvent, emitDocsTelemetryProjectEvent, formatDocsAskAIPackageHints, getDocsLlmsTxtMaxCharsIssue, getDocsMarkdownVaryHeader, hasDocsMarkdownSignatureAgent, inferDocsTelemetryAgentSurface, normalizeDocsRelated, performDocsSearch, renderDocsLlmsTxt, renderDocsMarkdownDocument, renderDocsMarkdownNotFound, resolveAskAISearchRequestConfig, resolveChangelogConfig, resolveDocsI18n, resolveDocsLlmsTxtRequest, resolveDocsLlmsTxtSections, resolveDocsLocale, resolveDocsMarkdownRecovery, resolveDocsMetadataBaseUrl, resolveDocsSitemapConfig, resolvePageSidebarFolderIndexBehavior, resolveSearchRequestConfig, selectDocsLlmsTxtContent } from "@farming-labs/docs";
|
|
6
|
+
import { DEFAULT_SITEMAP_MD_DOCS_ROUTE, buildDocsAskAIContext, buildDocsConfigMap, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsRobotsResponse, createDocsSitemapResponse, detectDocsMarkdownAgentRequest, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsTelemetryAgentSurfaceEvent, emitDocsTelemetryProjectEvent, formatDocsAskAIPackageHints, getDocsLlmsTxtMaxCharsIssue, getDocsMarkdownVaryHeader, hasDocsMarkdownSignatureAgent, inferDocsTelemetryAgentSurface, isDocsConfigRequest, normalizeDocsRelated, performDocsSearch, renderDocsLlmsTxt, renderDocsMarkdownDocument, renderDocsMarkdownNotFound, resolveAskAISearchRequestConfig, resolveChangelogConfig, resolveDocsI18n, resolveDocsLlmsTxtRequest, resolveDocsLlmsTxtSections, resolveDocsLocale, resolveDocsMarkdownRecovery, resolveDocsMetadataBaseUrl, 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
|
|
@@ -250,6 +250,7 @@ function buildAgentSpec({ origin, entry, i18n, search, mcp, feedback, llms, site
|
|
|
250
250
|
},
|
|
251
251
|
api: {
|
|
252
252
|
docs: DEFAULT_DOCS_API_ROUTE,
|
|
253
|
+
config: `${DEFAULT_DOCS_API_ROUTE}?format=config`,
|
|
253
254
|
agentSpec: DEFAULT_AGENT_SPEC_ROUTE,
|
|
254
255
|
agentSpecDefault: DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE,
|
|
255
256
|
agentSpecFallback: DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE,
|
|
@@ -259,6 +260,10 @@ function buildAgentSpec({ origin, entry, i18n, search, mcp, feedback, llms, site
|
|
|
259
260
|
agents: `${DEFAULT_DOCS_API_ROUTE}?format=agents`,
|
|
260
261
|
openapi: `${DEFAULT_DOCS_API_ROUTE}?format=openapi`
|
|
261
262
|
},
|
|
263
|
+
config: {
|
|
264
|
+
format: "docs-config-map.v1",
|
|
265
|
+
endpoint: `${DEFAULT_DOCS_API_ROUTE}?format=config`
|
|
266
|
+
},
|
|
262
267
|
markdown: {
|
|
263
268
|
enabled: true,
|
|
264
269
|
acceptHeader: "text/markdown",
|
|
@@ -2410,6 +2415,19 @@ function createDocsAPI(options) {
|
|
|
2410
2415
|
apiReference: apiReferenceConfig,
|
|
2411
2416
|
metadata: options?.metadata
|
|
2412
2417
|
};
|
|
2418
|
+
const { rootDir: _rootDir, language: _language, ...docsConfigMapOptions } = options ?? {};
|
|
2419
|
+
const docsConfigMapInput = { ...docsConfigMapOptions };
|
|
2420
|
+
const setConfigMapFallback = (key, value) => {
|
|
2421
|
+
if (Object.prototype.hasOwnProperty.call(docsConfigMapInput, key) || value === void 0) return;
|
|
2422
|
+
docsConfigMapInput[key] = value;
|
|
2423
|
+
};
|
|
2424
|
+
setConfigMapFallback("entry", entry);
|
|
2425
|
+
setConfigMapFallback("ai", Object.keys(aiConfig).length > 0 ? aiConfig : void 0);
|
|
2426
|
+
setConfigMapFallback("cloud", cloudConfig);
|
|
2427
|
+
setConfigMapFallback("search", searchConfig);
|
|
2428
|
+
setConfigMapFallback("i18n", i18nConfig ?? void 0);
|
|
2429
|
+
setConfigMapFallback("mcp", rawMcpConfig);
|
|
2430
|
+
setConfigMapFallback("apiReference", apiReferenceConfig);
|
|
2413
2431
|
function trackTelemetryRequest(request) {
|
|
2414
2432
|
emitDocsTelemetryProjectEvent(telemetryConfig, {
|
|
2415
2433
|
framework: "next",
|
|
@@ -2573,6 +2591,10 @@ function createDocsAPI(options) {
|
|
|
2573
2591
|
const ctx = resolveContextFromRequest(request);
|
|
2574
2592
|
const url = new URL(request.url);
|
|
2575
2593
|
const requestAnalyticsProperties = getRequestAnalyticsProperties(request);
|
|
2594
|
+
if (isDocsConfigRequest(url)) return Response.json(buildDocsConfigMap(docsConfigMapInput), { headers: {
|
|
2595
|
+
"Cache-Control": "public, max-age=0, s-maxage=3600",
|
|
2596
|
+
"X-Robots-Tag": "noindex"
|
|
2597
|
+
} });
|
|
2576
2598
|
if (resolveAgentSpecRequest(url)) {
|
|
2577
2599
|
await emitDocsAnalyticsEvent(analytics, {
|
|
2578
2600
|
type: "agent_spec_request",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/theme",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.33",
|
|
4
4
|
"description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"tsdown": "^0.20.3",
|
|
147
147
|
"typescript": "^5.9.3",
|
|
148
148
|
"vitest": "^4.1.8",
|
|
149
|
-
"@farming-labs/docs": "0.2.
|
|
149
|
+
"@farming-labs/docs": "0.2.33"
|
|
150
150
|
},
|
|
151
151
|
"peerDependencies": {
|
|
152
152
|
"@farming-labs/docs": ">=0.0.1",
|