@farming-labs/next 0.2.58 → 0.2.60
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/api.d.mts +1 -0
- package/dist/api.mjs +9 -0
- package/dist/config.mjs +23 -4
- package/package.json +3 -3
package/dist/api.d.mts
CHANGED
|
@@ -16,6 +16,7 @@ type DocsAPICloudIntegration = DocsCloudServer$1 | DocsAPICloudOptions;
|
|
|
16
16
|
*/
|
|
17
17
|
declare function resolveNextProjectRoot(metaUrl: string): string;
|
|
18
18
|
declare function createDocsAPI(options?: DocsAPIOptions, cloudIntegration?: DocsAPICloudIntegration): {
|
|
19
|
+
HEAD(request: Request): Promise<Response>;
|
|
19
20
|
GET(request: Request): Promise<Response>;
|
|
20
21
|
POST(request: Request): Promise<Response>;
|
|
21
22
|
};
|
package/dist/api.mjs
CHANGED
|
@@ -124,6 +124,15 @@ function createDocsAPI(options = {}, cloudIntegration) {
|
|
|
124
124
|
if (isDocsCloudGetRequest(request)) return integration.docsCloud.handleRequest(request, integration.routeOptions);
|
|
125
125
|
return handlers.GET(request);
|
|
126
126
|
},
|
|
127
|
+
async HEAD(request) {
|
|
128
|
+
if (!isDocsCloudGetRequest(request)) return handlers.HEAD(request);
|
|
129
|
+
const response = await integration.docsCloud.handleRequest(request, integration.routeOptions);
|
|
130
|
+
return new Response(null, {
|
|
131
|
+
status: response.status,
|
|
132
|
+
statusText: response.statusText,
|
|
133
|
+
headers: response.headers
|
|
134
|
+
});
|
|
135
|
+
},
|
|
127
136
|
async POST(request) {
|
|
128
137
|
if (await isDocsCloudPostRequest(request)) return integration.docsCloud.handleRequest(request, integration.routeOptions);
|
|
129
138
|
return handlers.POST(request);
|
package/dist/config.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { dirname, isAbsolute, join, relative } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { DOCS_AI_AGENT_USER_AGENT_HEADER_PATTERN, DOCS_BOT_LIKE_USER_AGENT_HEADER_PATTERN, DOCS_TRADITIONAL_BOT_USER_AGENT_HEADER_PATTERN } from "@farming-labs/docs";
|
|
4
|
+
import { DEFAULT_AGENT_SKILLS_INDEX_ROUTE, DEFAULT_AGENT_SKILLS_ROUTE_PREFIX, DEFAULT_API_CATALOG_ROUTE, DOCS_AI_AGENT_USER_AGENT_HEADER_PATTERN, DOCS_BOT_LIKE_USER_AGENT_HEADER_PATTERN, DOCS_TRADITIONAL_BOT_USER_AGENT_HEADER_PATTERN } from "@farming-labs/docs";
|
|
5
5
|
import { ensureDocsReviewWorkflow } from "@farming-labs/docs/server";
|
|
6
6
|
import matter from "gray-matter";
|
|
7
7
|
import createMDX from "@next/mdx";
|
|
@@ -85,7 +85,7 @@ const docsCloud = createDocsCloudServer({
|
|
|
85
85
|
config: docsConfig,
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
-
export const { GET, POST } = createDocsAPI(docsConfig, docsCloud);
|
|
88
|
+
export const { GET, HEAD, POST } = createDocsAPI(docsConfig, docsCloud);
|
|
89
89
|
|
|
90
90
|
export const revalidate = false;
|
|
91
91
|
`;
|
|
@@ -1410,6 +1410,22 @@ function buildAgentSpecRewrites() {
|
|
|
1410
1410
|
}
|
|
1411
1411
|
];
|
|
1412
1412
|
}
|
|
1413
|
+
function buildStandardsDiscoveryRewrites() {
|
|
1414
|
+
return [
|
|
1415
|
+
{
|
|
1416
|
+
source: DEFAULT_API_CATALOG_ROUTE,
|
|
1417
|
+
destination: "/api/docs?format=api-catalog"
|
|
1418
|
+
},
|
|
1419
|
+
{
|
|
1420
|
+
source: DEFAULT_AGENT_SKILLS_INDEX_ROUTE,
|
|
1421
|
+
destination: "/api/docs?format=agent-skills"
|
|
1422
|
+
},
|
|
1423
|
+
{
|
|
1424
|
+
source: `${DEFAULT_AGENT_SKILLS_ROUTE_PREFIX}/:name/SKILL.md`,
|
|
1425
|
+
destination: "/api/docs?format=agent-skill&name=:name"
|
|
1426
|
+
}
|
|
1427
|
+
];
|
|
1428
|
+
}
|
|
1413
1429
|
function buildLlmsTxtRewrites(entry, docsPath) {
|
|
1414
1430
|
const internalBase = `/${normalizeRouteSegment(entry)}`;
|
|
1415
1431
|
const publicBase = docsPath;
|
|
@@ -1650,6 +1666,7 @@ function buildHiddenFolderRedirects(docsDir, docsPath) {
|
|
|
1650
1666
|
function mergeDocsMarkdownRewrites(entry, docsPath, mcp, sitemap, agentFeedback, robots, result) {
|
|
1651
1667
|
const autoBeforeFilesRewrites = [
|
|
1652
1668
|
...buildAgentSpecRewrites(),
|
|
1669
|
+
...buildStandardsDiscoveryRewrites(),
|
|
1653
1670
|
...buildMcpRewrites(mcp),
|
|
1654
1671
|
...buildAgentsMdRewrites(),
|
|
1655
1672
|
...buildSkillMdRewrites(),
|
|
@@ -1702,9 +1719,11 @@ function withDocs(nextConfig = {}) {
|
|
|
1702
1719
|
if (!hasFile(layoutDir, "layout") || isManagedGeneratedFile(docsLayoutPath)) writeFileSync(join(layoutDir, "layout.tsx"), DOCS_LAYOUT_TEMPLATE);
|
|
1703
1720
|
const isStaticExport = nextConfig.output === "export";
|
|
1704
1721
|
const docsApiRouteDir = join(root, appDir, "api", "docs");
|
|
1705
|
-
|
|
1722
|
+
const existingDocsApiRoutePath = FILE_EXTS.map((ext) => join(docsApiRouteDir, `route.${ext}`)).find((filePath) => existsSync(filePath));
|
|
1723
|
+
const docsApiRoutePath = existingDocsApiRoutePath ?? join(docsApiRouteDir, "route.ts");
|
|
1724
|
+
if (!isStaticExport && (!existingDocsApiRoutePath || isManagedGeneratedFile(existingDocsApiRoutePath))) {
|
|
1706
1725
|
mkdirSync(docsApiRouteDir, { recursive: true });
|
|
1707
|
-
writeFileSync(
|
|
1726
|
+
writeFileSync(docsApiRoutePath, DOCS_API_ROUTE_TEMPLATE);
|
|
1708
1727
|
}
|
|
1709
1728
|
const mcp = readMcpConfig(root);
|
|
1710
1729
|
const sitemap = readSitemapConfig(root);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/next",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.60",
|
|
4
4
|
"description": "Next.js adapter for @farming-labs/docs — MDX config wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -106,8 +106,8 @@
|
|
|
106
106
|
"tsdown": "^0.20.3",
|
|
107
107
|
"typescript": "^5.9.3",
|
|
108
108
|
"vitest": "^4.1.8",
|
|
109
|
-
"@farming-labs/docs": "0.2.
|
|
110
|
-
"@farming-labs/theme": "0.2.
|
|
109
|
+
"@farming-labs/docs": "0.2.60",
|
|
110
|
+
"@farming-labs/theme": "0.2.60"
|
|
111
111
|
},
|
|
112
112
|
"peerDependencies": {
|
|
113
113
|
"@farming-labs/docs": ">=0.0.1",
|