@farming-labs/next 0.1.28 → 0.1.30
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 +38 -9
- package/package.json +3 -3
package/dist/config.mjs
CHANGED
|
@@ -148,6 +148,14 @@ const INTERNAL_DOCS_CONFIG_ALIAS = "@farming-labs/next-internal-docs-config";
|
|
|
148
148
|
const NEXT_PACKAGE_ROOT = fileURLToPath(new URL("..", import.meta.url));
|
|
149
149
|
const DEFAULT_AGENT_SPEC_ROUTE = "/api/docs/agent/spec";
|
|
150
150
|
const DEFAULT_AGENT_FEEDBACK_ROUTE = "/api/docs/agent/feedback";
|
|
151
|
+
const MARKDOWN_ACCEPT_HEADER_VALUE = [
|
|
152
|
+
"(?:^|.*,\\s*)",
|
|
153
|
+
"text/markdown",
|
|
154
|
+
"(?:\\s*;",
|
|
155
|
+
"(?!\\s*(?:[^,;]*;\\s*)*q\\s*=\\s*(?:0+(?:\\.0*)?|\\.0+)\\s*(?:;|,|$))",
|
|
156
|
+
"[^,]*)?",
|
|
157
|
+
"(?:\\s*,.*|$)"
|
|
158
|
+
].join("");
|
|
151
159
|
function resolvePackageAlias(packageName, fallbacks = []) {
|
|
152
160
|
return [join(NEXT_PACKAGE_ROOT, "node_modules", packageName), ...fallbacks.map((value) => join(NEXT_PACKAGE_ROOT, value))].find((value) => existsSync(value));
|
|
153
161
|
}
|
|
@@ -695,13 +703,31 @@ function readAgentFeedbackConfig(root) {
|
|
|
695
703
|
}
|
|
696
704
|
function buildDocsMarkdownRewrites(entry) {
|
|
697
705
|
const normalizedEntry = entry.replace(/^\/+|\/+$/g, "") || "docs";
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
706
|
+
const markdownAcceptHeader = {
|
|
707
|
+
type: "header",
|
|
708
|
+
key: "accept",
|
|
709
|
+
value: MARKDOWN_ACCEPT_HEADER_VALUE
|
|
710
|
+
};
|
|
711
|
+
return [
|
|
712
|
+
{
|
|
713
|
+
source: `/${normalizedEntry}.md`,
|
|
714
|
+
destination: "/api/docs?format=markdown"
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
source: `/${normalizedEntry}/:slug*.md`,
|
|
718
|
+
destination: "/api/docs?format=markdown&path=:slug*"
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
source: `/${normalizedEntry}`,
|
|
722
|
+
has: [markdownAcceptHeader],
|
|
723
|
+
destination: "/api/docs?format=markdown"
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
source: `/${normalizedEntry}/:slug*`,
|
|
727
|
+
has: [markdownAcceptHeader],
|
|
728
|
+
destination: "/api/docs?format=markdown&path=:slug*"
|
|
729
|
+
}
|
|
730
|
+
];
|
|
705
731
|
}
|
|
706
732
|
function buildAgentSpecRewrites() {
|
|
707
733
|
return [{
|
|
@@ -736,8 +762,11 @@ function mergeDocsMarkdownRewrites(entry, agentFeedback, result) {
|
|
|
736
762
|
...buildDocsMarkdownRewrites(entry),
|
|
737
763
|
...buildAgentFeedbackRewrites(agentFeedback)
|
|
738
764
|
];
|
|
739
|
-
if (!result) return
|
|
740
|
-
if (Array.isArray(result)) return
|
|
765
|
+
if (!result) return { beforeFiles: dedupeRewrites(autoRewrites) };
|
|
766
|
+
if (Array.isArray(result)) return {
|
|
767
|
+
beforeFiles: dedupeRewrites(autoRewrites),
|
|
768
|
+
afterFiles: result
|
|
769
|
+
};
|
|
741
770
|
return {
|
|
742
771
|
beforeFiles: dedupeRewrites([...autoRewrites, ...result.beforeFiles ?? []]),
|
|
743
772
|
afterFiles: result.afterFiles ?? [],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/next",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
4
4
|
"description": "Next.js adapter for @farming-labs/docs — MDX config wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -95,8 +95,8 @@
|
|
|
95
95
|
"tsdown": "^0.20.3",
|
|
96
96
|
"typescript": "^5.9.3",
|
|
97
97
|
"vitest": "^3.2.4",
|
|
98
|
-
"@farming-labs/docs": "0.1.
|
|
99
|
-
"@farming-labs/theme": "0.1.
|
|
98
|
+
"@farming-labs/docs": "0.1.30",
|
|
99
|
+
"@farming-labs/theme": "0.1.30"
|
|
100
100
|
},
|
|
101
101
|
"peerDependencies": {
|
|
102
102
|
"@farming-labs/docs": ">=0.0.1",
|