@farming-labs/next 0.2.94 → 0.2.96
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/code-block-themes-CCE5ViGj.mjs +25 -0
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +7 -4
- package/package.json +3 -3
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
|
|
4
|
+
//#region src/code-block-themes.ts
|
|
5
|
+
const DEFAULT_CODE_BLOCK_THEMES = {
|
|
6
|
+
light: "github-light",
|
|
7
|
+
dark: "github-dark"
|
|
8
|
+
};
|
|
9
|
+
const SHADCN_CODE_BLOCK_THEMES = {
|
|
10
|
+
light: "github-light-default",
|
|
11
|
+
dark: "vesper"
|
|
12
|
+
};
|
|
13
|
+
const SHADCN_THEME_IMPORT = /(?:from\s*|import\s*)["']@farming-labs\/theme\/shadcn["']/;
|
|
14
|
+
function resolveCodeBlockThemes({ root, configPath, theme }) {
|
|
15
|
+
const configFile = join(root, configPath);
|
|
16
|
+
const fallback = existsSync(configFile) && SHADCN_THEME_IMPORT.test(readFileSync(configFile, "utf8")) ? SHADCN_CODE_BLOCK_THEMES : DEFAULT_CODE_BLOCK_THEMES;
|
|
17
|
+
const codeBlock = theme?.ui?.codeBlock;
|
|
18
|
+
return {
|
|
19
|
+
light: codeBlock?.theme ?? fallback.light,
|
|
20
|
+
dark: codeBlock?.darkTheme ?? fallback.dark
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { resolveCodeBlockThemes as t };
|
package/dist/config.d.mts
CHANGED
|
@@ -2,6 +2,6 @@ import { DocsConfig } from "@farming-labs/docs";
|
|
|
2
2
|
import { NextConfig } from "next";
|
|
3
3
|
|
|
4
4
|
//#region src/config.d.ts
|
|
5
|
-
declare function withDocs(nextConfig?: NextConfig, docsConfig?: Pick<DocsConfig, "agent" | "mcp">): NextConfig;
|
|
5
|
+
declare function withDocs(nextConfig?: NextConfig, docsConfig?: Pick<DocsConfig, "agent" | "mcp" | "theme">): NextConfig;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { withDocs };
|
package/dist/config.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as resolveCodeBlockThemes } from "./code-block-themes-CCE5ViGj.mjs";
|
|
1
2
|
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
2
3
|
import { dirname, extname, isAbsolute, join, relative } from "node:path";
|
|
3
4
|
import { fileURLToPath } from "node:url";
|
|
@@ -1898,6 +1899,11 @@ function withDocs(nextConfig = {}, docsConfig) {
|
|
|
1898
1899
|
const workspaceRoot = findDocsWorkspaceRoot(root);
|
|
1899
1900
|
const docsConfigPath = readDocsConfigPath(root);
|
|
1900
1901
|
const docsConfigAbsolutePath = join(root, docsConfigPath);
|
|
1902
|
+
const codeBlockThemes = resolveCodeBlockThemes({
|
|
1903
|
+
root,
|
|
1904
|
+
configPath: docsConfigPath,
|
|
1905
|
+
theme: docsConfig?.theme
|
|
1906
|
+
});
|
|
1901
1907
|
const mcp = docsConfig ? resolveMcpConfig(docsConfig.mcp) : readMcpConfig(root);
|
|
1902
1908
|
const nextBasePath = normalizeRoutePrefix(nextConfig.basePath);
|
|
1903
1909
|
if (mcp.enabled && mcp.protectedResource && nextBasePath) throw new Error(`@farming-labs/next: mcp.security.protectedResource cannot be combined with Next.js basePath ${JSON.stringify(nextBasePath)} because RFC 9728 metadata must be hosted at origin-root well-known URLs. Host the protected docs app at the origin root or publish the metadata and MCP proxy at the edge.`);
|
|
@@ -2016,10 +2022,7 @@ function withDocs(nextConfig = {}, docsConfig) {
|
|
|
2016
2022
|
extension: /\.mdx?$/,
|
|
2017
2023
|
options: {
|
|
2018
2024
|
remarkPlugins,
|
|
2019
|
-
rehypePlugins: ["@farming-labs/next/mdx-plugins/rehype-toc", ["@farming-labs/next/mdx-plugins/rehype-code", { themes:
|
|
2020
|
-
dark: "github-dark",
|
|
2021
|
-
light: "github-light"
|
|
2022
|
-
} }]]
|
|
2025
|
+
rehypePlugins: ["@farming-labs/next/mdx-plugins/rehype-toc", ["@farming-labs/next/mdx-plugins/rehype-code", { themes: codeBlockThemes }]]
|
|
2023
2026
|
}
|
|
2024
2027
|
});
|
|
2025
2028
|
const defaultExts = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/next",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.96",
|
|
4
4
|
"description": "Next.js adapter for @farming-labs/docs — MDX config wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -109,8 +109,8 @@
|
|
|
109
109
|
"tsdown": "^0.20.3",
|
|
110
110
|
"typescript": "^5.9.3",
|
|
111
111
|
"vitest": "^4.1.8",
|
|
112
|
-
"@farming-labs/docs": "0.2.
|
|
113
|
-
"@farming-labs/theme": "0.2.
|
|
112
|
+
"@farming-labs/docs": "0.2.96",
|
|
113
|
+
"@farming-labs/theme": "0.2.96"
|
|
114
114
|
},
|
|
115
115
|
"peerDependencies": {
|
|
116
116
|
"@farming-labs/docs": ">=0.2.73",
|