@farming-labs/theme 0.2.33 → 0.2.34

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.
@@ -40,6 +40,8 @@ interface DocsAPIOptions {
40
40
  docsPath?: string;
41
41
  /** Override the docs content directory when it does not live in app/<entry>. */
42
42
  contentDir?: string;
43
+ /** Set when the docs site is built without runtime API routes. */
44
+ staticExport?: boolean;
43
45
  /** Changelog configuration. */
44
46
  changelog?: boolean | ChangelogConfig;
45
47
  /** Search language (default: "english") */
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, 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";
6
+ import { DEFAULT_SITEMAP_MD_DOCS_ROUTE, buildDocsAskAIContext, buildDocsConfigMap, buildDocsDiagnostics, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsRobotsResponse, createDocsSitemapResponse, detectDocsMarkdownAgentRequest, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsTelemetryAgentSurfaceEvent, emitDocsTelemetryProjectEvent, formatDocsAskAIPackageHints, getDocsLlmsTxtMaxCharsIssue, getDocsMarkdownVaryHeader, hasDocsMarkdownSignatureAgent, inferDocsTelemetryAgentSurface, isDocsConfigRequest, isDocsDiagnosticsRequest, 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
@@ -251,6 +251,7 @@ function buildAgentSpec({ origin, entry, i18n, search, mcp, feedback, llms, site
251
251
  api: {
252
252
  docs: DEFAULT_DOCS_API_ROUTE,
253
253
  config: `${DEFAULT_DOCS_API_ROUTE}?format=config`,
254
+ diagnostics: `${DEFAULT_DOCS_API_ROUTE}?format=diagnostics`,
254
255
  agentSpec: DEFAULT_AGENT_SPEC_ROUTE,
255
256
  agentSpecDefault: DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE,
256
257
  agentSpecFallback: DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE,
@@ -2428,6 +2429,16 @@ function createDocsAPI(options) {
2428
2429
  setConfigMapFallback("i18n", i18nConfig ?? void 0);
2429
2430
  setConfigMapFallback("mcp", rawMcpConfig);
2430
2431
  setConfigMapFallback("apiReference", apiReferenceConfig);
2432
+ const docsDiagnosticsInput = {
2433
+ ...docsConfigMapInput,
2434
+ docsPath: docsConfigMapInput.docsPath ?? docsPath,
2435
+ contentDir: docsConfigMapInput.contentDir ?? contentDir,
2436
+ feedback: docsConfigMapInput.feedback ?? options?.feedback,
2437
+ llmsTxt: docsConfigMapInput.llmsTxt ?? llmsConfig,
2438
+ sitemap: docsConfigMapInput.sitemap ?? sitemapConfig,
2439
+ robots: docsConfigMapInput.robots ?? robotsConfig,
2440
+ staticExport: docsConfigMapInput.staticExport ?? options?.staticExport
2441
+ };
2431
2442
  function trackTelemetryRequest(request) {
2432
2443
  emitDocsTelemetryProjectEvent(telemetryConfig, {
2433
2444
  framework: "next",
@@ -2595,6 +2606,17 @@ function createDocsAPI(options) {
2595
2606
  "Cache-Control": "public, max-age=0, s-maxage=3600",
2596
2607
  "X-Robots-Tag": "noindex"
2597
2608
  } });
2609
+ if (isDocsDiagnosticsRequest(url)) return Response.json(buildDocsDiagnostics(docsDiagnosticsInput, {
2610
+ adapter: "next",
2611
+ entry,
2612
+ i18n,
2613
+ mcp: mcpConfig,
2614
+ feedback: agentFeedbackConfig,
2615
+ openapi: openapiDiscovery
2616
+ }), { headers: {
2617
+ "Cache-Control": "public, max-age=0, s-maxage=3600",
2618
+ "X-Robots-Tag": "noindex"
2619
+ } });
2598
2620
  if (resolveAgentSpecRequest(url)) {
2599
2621
  await emitDocsAnalyticsEvent(analytics, {
2600
2622
  type: "agent_spec_request",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/theme",
3
- "version": "0.2.33",
3
+ "version": "0.2.34",
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.33"
149
+ "@farming-labs/docs": "0.2.34"
150
150
  },
151
151
  "peerDependencies": {
152
152
  "@farming-labs/docs": ">=0.0.1",