@farming-labs/next 0.1.80 → 0.1.82
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/config.mjs +4 -59
- package/package.json +3 -3
package/dist/config.mjs
CHANGED
|
@@ -92,44 +92,6 @@ export const { GET, POST } = createDocsAPI({
|
|
|
92
92
|
ai: docsConfig.ai,
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
-
export const revalidate = false;
|
|
96
|
-
`;
|
|
97
|
-
const DOCS_MARKDOWN_ROUTE_TEMPLATE = `\
|
|
98
|
-
${GENERATED_BANNER}
|
|
99
|
-
import docsConfig from "@/docs.config";
|
|
100
|
-
import { createDocsAPI } from "@farming-labs/next/api";
|
|
101
|
-
|
|
102
|
-
const docsApi = createDocsAPI({
|
|
103
|
-
entry: docsConfig.entry,
|
|
104
|
-
contentDir: docsConfig.contentDir,
|
|
105
|
-
i18n: docsConfig.i18n,
|
|
106
|
-
changelog: docsConfig.changelog,
|
|
107
|
-
feedback: docsConfig.feedback,
|
|
108
|
-
mcp: docsConfig.mcp,
|
|
109
|
-
sitemap: docsConfig.sitemap,
|
|
110
|
-
search: docsConfig.search,
|
|
111
|
-
analytics: docsConfig.analytics,
|
|
112
|
-
observability: docsConfig.observability,
|
|
113
|
-
ai: docsConfig.ai,
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
type MarkdownRouteContext = {
|
|
117
|
-
params?: Promise<{ slug?: string[] }> | { slug?: string[] };
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export async function GET(request: Request, context: MarkdownRouteContext = {}) {
|
|
121
|
-
const params = context.params ? await context.params : undefined;
|
|
122
|
-
const slug = params?.slug?.join("/") ?? "";
|
|
123
|
-
const url = new URL(request.url);
|
|
124
|
-
|
|
125
|
-
url.pathname = "/api/docs";
|
|
126
|
-
url.search = "";
|
|
127
|
-
url.searchParams.set("format", "markdown");
|
|
128
|
-
if (slug) url.searchParams.set("path", slug);
|
|
129
|
-
|
|
130
|
-
return docsApi.GET(new Request(url.toString(), request));
|
|
131
|
-
}
|
|
132
|
-
|
|
133
95
|
export const revalidate = false;
|
|
134
96
|
`;
|
|
135
97
|
const DOCS_MCP_ROUTE_TEMPLATE = `\
|
|
@@ -856,7 +818,8 @@ function buildDocsMarkdownRewrites(entry) {
|
|
|
856
818
|
};
|
|
857
819
|
const markdownSignatureAgentHeader = {
|
|
858
820
|
type: "header",
|
|
859
|
-
key: "signature-agent"
|
|
821
|
+
key: "signature-agent",
|
|
822
|
+
value: ".+"
|
|
860
823
|
};
|
|
861
824
|
return [
|
|
862
825
|
{
|
|
@@ -880,12 +843,12 @@ function buildDocsMarkdownRewrites(entry) {
|
|
|
880
843
|
{
|
|
881
844
|
source: `/${normalizedEntry}`,
|
|
882
845
|
has: [markdownSignatureAgentHeader],
|
|
883
|
-
destination: "/api/docs
|
|
846
|
+
destination: "/api/docs?format=markdown"
|
|
884
847
|
},
|
|
885
848
|
{
|
|
886
849
|
source: `/${normalizedEntry}/:slug*`,
|
|
887
850
|
has: [markdownSignatureAgentHeader],
|
|
888
|
-
destination: "/api/docs
|
|
851
|
+
destination: "/api/docs?format=markdown&path=:slug*"
|
|
889
852
|
}
|
|
890
853
|
];
|
|
891
854
|
}
|
|
@@ -1131,12 +1094,6 @@ function withDocs(nextConfig = {}) {
|
|
|
1131
1094
|
mkdirSync(docsApiRouteDir, { recursive: true });
|
|
1132
1095
|
writeFileSync(join(docsApiRouteDir, "route.ts"), DOCS_API_ROUTE_TEMPLATE);
|
|
1133
1096
|
}
|
|
1134
|
-
const docsMarkdownRouteDir = join(root, appDir, "api", "docs", "markdown", "[[...slug]]");
|
|
1135
|
-
const docsMarkdownRoutePath = join(docsMarkdownRouteDir, "route.ts");
|
|
1136
|
-
if (!isStaticExport && (!hasFile(docsMarkdownRouteDir, "route") || isManagedGeneratedFile(docsMarkdownRoutePath))) {
|
|
1137
|
-
mkdirSync(docsMarkdownRouteDir, { recursive: true });
|
|
1138
|
-
writeFileSync(docsMarkdownRoutePath, DOCS_MARKDOWN_ROUTE_TEMPLATE);
|
|
1139
|
-
}
|
|
1140
1097
|
const mcp = readMcpConfig(root);
|
|
1141
1098
|
const sitemap = readSitemapConfig(root);
|
|
1142
1099
|
const docsMcpRouteDir = join(root, appDir, "api", "docs", "mcp");
|
|
@@ -1319,18 +1276,6 @@ function withDocs(nextConfig = {}) {
|
|
|
1319
1276
|
skillTraceFile,
|
|
1320
1277
|
sitemapManifestTraceFile
|
|
1321
1278
|
])],
|
|
1322
|
-
"/api/docs/markdown": [...new Set([
|
|
1323
|
-
...existingTracingIncludes["/api/docs/markdown"] ?? [],
|
|
1324
|
-
docsTraceGlob,
|
|
1325
|
-
skillTraceFile,
|
|
1326
|
-
sitemapManifestTraceFile
|
|
1327
|
-
])],
|
|
1328
|
-
"/api/docs/markdown/:path*": [...new Set([
|
|
1329
|
-
...existingTracingIncludes["/api/docs/markdown/:path*"] ?? [],
|
|
1330
|
-
docsTraceGlob,
|
|
1331
|
-
skillTraceFile,
|
|
1332
|
-
sitemapManifestTraceFile
|
|
1333
|
-
])],
|
|
1334
1279
|
[DEFAULT_MCP_ROUTE]: [...new Set([...existingTracingIncludes[DEFAULT_MCP_ROUTE] ?? [], docsTraceGlob])]
|
|
1335
1280
|
};
|
|
1336
1281
|
return withMDX(nextConfig);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/next",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.82",
|
|
4
4
|
"description": "Next.js adapter for @farming-labs/docs — MDX config wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -100,8 +100,8 @@
|
|
|
100
100
|
"tsdown": "^0.20.3",
|
|
101
101
|
"typescript": "^5.9.3",
|
|
102
102
|
"vitest": "^3.2.4",
|
|
103
|
-
"@farming-labs/
|
|
104
|
-
"@farming-labs/
|
|
103
|
+
"@farming-labs/docs": "0.1.82",
|
|
104
|
+
"@farming-labs/theme": "0.1.82"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
107
107
|
"@farming-labs/docs": ">=0.0.1",
|