doccupine 0.0.152 → 0.0.154
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/lib/constants.d.ts +1 -1
- package/dist/lib/constants.js +1 -1
- package/dist/lib/layout.js +1 -1
- package/dist/templates/package.js +16 -16
- package/dist/templates/utils/icons.d.ts +1 -1
- package/dist/templates/utils/mermaid.d.ts +1 -1
- package/dist/templates/utils/mermaid.js +47 -1
- package/package.json +5 -5
package/dist/lib/constants.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const DEFAULT_DESCRIPTION = "Doccupine is a free and open-source documentation platform. Write MDX, get a production-ready site with AI chat, built-in components, and an MCP server - in one command.";
|
|
2
2
|
export declare const DEFAULT_SITE_NAME = "Doccupine";
|
|
3
3
|
export declare const DEFAULT_META_DESCRIPTION = "Generated with Doccupine";
|
|
4
|
-
export declare const DEFAULT_FAVICON = "https://docs.doccupine.com/
|
|
4
|
+
export declare const DEFAULT_FAVICON = "https://docs.doccupine.com/icon.png";
|
|
5
5
|
export declare const DEFAULT_OG_IMAGE = "https://docs.doccupine.com/preview.png";
|
|
6
6
|
export declare const DEFAULT_URL = "https://docs.doccupine.com";
|
package/dist/lib/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const DEFAULT_DESCRIPTION = "Doccupine is a free and open-source documentation platform. Write MDX, get a production-ready site with AI chat, built-in components, and an MCP server - in one command.";
|
|
2
2
|
export const DEFAULT_SITE_NAME = "Doccupine";
|
|
3
3
|
export const DEFAULT_META_DESCRIPTION = "Generated with Doccupine";
|
|
4
|
-
export const DEFAULT_FAVICON = "https://docs.doccupine.com/
|
|
4
|
+
export const DEFAULT_FAVICON = "https://docs.doccupine.com/icon.png";
|
|
5
5
|
export const DEFAULT_OG_IMAGE = "https://docs.doccupine.com/preview.png";
|
|
6
6
|
export const DEFAULT_URL = "https://docs.doccupine.com";
|
package/dist/lib/layout.js
CHANGED
|
@@ -124,7 +124,7 @@ const THEME_INIT_SCRIPT = `(function(){try{var c=document.cookie.split(";").map(
|
|
|
124
124
|
export const rootLayoutTemplate = (fontConfig, analyticsEnabled = false) => {
|
|
125
125
|
return `import type { Metadata } from "next";
|
|
126
126
|
${fontImportLine(fontConfig)}
|
|
127
|
-
import { StyledComponentsRegistry } from "cherry-styled-components";
|
|
127
|
+
import { StyledComponentsRegistry } from "cherry-styled-components/next";
|
|
128
128
|
import { colorsDark, colorsLight, theme, themeDark } from "@/app/theme";
|
|
129
129
|
import { CherryThemeProvider } from "@/components/layout/CherryThemeProvider";
|
|
130
130
|
import { config } from "@/utils/config";
|
|
@@ -12,48 +12,48 @@ export const packageJsonTemplate = JSON.stringify({
|
|
|
12
12
|
"type-check": "tsgo --noEmit",
|
|
13
13
|
},
|
|
14
14
|
dependencies: {
|
|
15
|
-
"@langchain/anthropic": "^1.5.
|
|
16
|
-
"@langchain/core": "^1.2.
|
|
15
|
+
"@langchain/anthropic": "^1.5.5",
|
|
16
|
+
"@langchain/core": "^1.2.7",
|
|
17
17
|
"@langchain/google-genai": "^2.2.0",
|
|
18
|
-
"@langchain/openai": "^1.5.
|
|
18
|
+
"@langchain/openai": "^1.5.7",
|
|
19
19
|
"@mdx-js/react": "^3.1.1",
|
|
20
20
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
21
21
|
"beautiful-mermaid": "^1.1.3",
|
|
22
|
-
"cherry-styled-components": "^0.2.
|
|
23
|
-
langchain: "^1.5.
|
|
24
|
-
"lucide-react": "^1.
|
|
22
|
+
"cherry-styled-components": "^0.2.16",
|
|
23
|
+
langchain: "^1.5.8",
|
|
24
|
+
"lucide-react": "^1.31.0",
|
|
25
25
|
minisearch: "^7.2.0",
|
|
26
|
-
next: "16.3.
|
|
26
|
+
next: "16.3.1",
|
|
27
27
|
"next-mdx-remote": "^6.0.0",
|
|
28
|
-
"posthog-js": "^1.
|
|
29
|
-
"posthog-node": "^5.
|
|
28
|
+
"posthog-js": "^1.417.1",
|
|
29
|
+
"posthog-node": "^5.49.1",
|
|
30
30
|
react: "19.2.8",
|
|
31
31
|
"react-dom": "19.2.8",
|
|
32
32
|
"rehype-highlight": "^7.0.2",
|
|
33
33
|
"rehype-parse": "^9.0.1",
|
|
34
34
|
"rehype-stringify": "^10.0.1",
|
|
35
35
|
"remark-gfm": "^4.0.1",
|
|
36
|
-
"styled-components": "^6.5.
|
|
36
|
+
"styled-components": "^6.5.2",
|
|
37
37
|
unified: "^11.0.5",
|
|
38
38
|
zod: "^4.4.3",
|
|
39
39
|
},
|
|
40
40
|
devDependencies: {
|
|
41
|
-
"@next/env": "16.3.
|
|
42
|
-
"@next/eslint-plugin-next": "16.3.
|
|
41
|
+
"@next/env": "16.3.1",
|
|
42
|
+
"@next/eslint-plugin-next": "16.3.1",
|
|
43
43
|
"@types/node": "^26",
|
|
44
44
|
"@types/react": "^19",
|
|
45
45
|
"@types/react-dom": "^19",
|
|
46
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
47
|
-
"@typescript-eslint/parser": "^8.
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "^8.67.0",
|
|
47
|
+
"@typescript-eslint/parser": "^8.67.0",
|
|
48
48
|
"@typescript/native-preview": "^7.0.0-dev.20260707.2",
|
|
49
49
|
eslint: "^10",
|
|
50
50
|
"eslint-plugin-import": "^2.32.0",
|
|
51
51
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
52
52
|
"eslint-plugin-react": "^7.37.5",
|
|
53
53
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
54
|
-
globals: "^17.
|
|
54
|
+
globals: "^17.11.0",
|
|
55
55
|
prettier: "^3.9.6",
|
|
56
|
-
tsx: "^4.23.
|
|
56
|
+
tsx: "^4.23.12",
|
|
57
57
|
typescript: "npm:@typescript/typescript6@^6.0.2",
|
|
58
58
|
},
|
|
59
59
|
}, null, 2) + "\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const iconsTemplate = "import type { Metadata } from \"next\";\nimport iconsData from \"@/icons.json\";\nimport { config } from \"@/utils/config\";\n\n// icons.json is written by the Doccupine CLI from icon files at the project\n// root (icon.png, icon-dark.png, apple-icon.png). Every URL carries a\n// content-hash query so a replaced icon busts browser caches.\ninterface IconManifest {\n icon?: string;\n iconDark?: string;\n appleIcon?: string;\n}\n\nconst icons = iconsData as IconManifest;\n\nconst fallbackIcon = config.icon || \"https://docs.doccupine.com/
|
|
1
|
+
export declare const iconsTemplate = "import type { Metadata } from \"next\";\nimport iconsData from \"@/icons.json\";\nimport { config } from \"@/utils/config\";\n\n// icons.json is written by the Doccupine CLI from icon files at the project\n// root (icon.png, icon-dark.png, apple-icon.png). Every URL carries a\n// content-hash query so a replaced icon busts browser caches.\ninterface IconManifest {\n icon?: string;\n iconDark?: string;\n appleIcon?: string;\n}\n\nconst icons = iconsData as IconManifest;\n\nconst fallbackIcon = config.icon || \"https://docs.doccupine.com/icon.png\";\n\n/** Single icon URL for JSON-LD logos and other one-value consumers. */\nexport const primaryIconUrl: string = icons.icon ?? fallbackIcon;\n\nfunction buildSiteIcons(): Metadata[\"icons\"] {\n if (!icons.icon && !icons.appleIcon) return fallbackIcon;\n const iconEntries: { url: string; media?: string }[] = [];\n if (icons.icon && icons.iconDark) {\n iconEntries.push({\n url: icons.icon,\n media: \"(prefers-color-scheme: light)\",\n });\n iconEntries.push({\n url: icons.iconDark,\n media: \"(prefers-color-scheme: dark)\",\n });\n } else if (icons.icon) {\n iconEntries.push({ url: icons.icon });\n }\n return {\n icon: iconEntries.length > 0 ? iconEntries : fallbackIcon,\n ...(icons.appleIcon ? { apple: icons.appleIcon } : {}),\n };\n}\n\nexport const siteIcons: Metadata[\"icons\"] = buildSiteIcons();\n\n/**\n * Icon entries for the web app manifest. Only the root icon files are\n * listed - their true pixel dimensions are unknown to the generator, so the\n * spec's \"any\" stands in - and a site without them gets a manifest without\n * icons rather than a guessed format.\n */\nexport const manifestIcons: { src: string; sizes: string; type: string }[] = [\n ...(icons.icon ? [{ src: icons.icon, sizes: \"any\", type: \"image/png\" }] : []),\n ...(icons.appleIcon\n ? [{ src: icons.appleIcon, sizes: \"any\", type: \"image/png\" }]\n : []),\n];\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const mermaidTemplate = "import \"server-only\";\nimport { renderMermaidSVG } from \"beautiful-mermaid\";\n\nconst DIAGRAM_OPTIONS = {\n bg: \"var(--mermaid-bg)\",\n fg: \"var(--mermaid-fg)\",\n line: \"var(--mermaid-line)\",\n accent: \"var(--mermaid-accent)\",\n muted: \"var(--mermaid-muted)\",\n surface: \"var(--mermaid-surface)\",\n border: \"var(--mermaid-border)\",\n transparent: true,\n};\n\nexport type MermaidResult =\n | { ok: true; svg: string; width: number | null }\n | { ok: false; error: string };\n\nfunction normalizeSvg(svg: string): {\n ok: true;\n svg: string;\n width: number | null;\n} {\n const openTag = /^<svg\\b[^>]*>/.exec(svg);\n if (!openTag) return { ok: true, svg, width: null };\n\n const widthMatch = /\\swidth=\"([\\d.]+)\"/.exec(openTag[0]);\n const width = widthMatch ? Number.parseFloat(widthMatch[1]) : null;\n\n const stripped = openTag[0].replace(/\\s(?:width|height)=\"[^\"]*\"/g, \"\");\n return {\n ok: true,\n svg: stripped + svg.slice(openTag[0].length),\n width: width !== null && Number.isFinite(width) ? width : null,\n };\n}\n\nexport function renderDiagram(code: string): MermaidResult {\n try {\n return normalizeSvg(renderMermaidSVG(code, DIAGRAM_OPTIONS));\n } catch (error) {\n return {\n ok: false,\n error: error instanceof Error ? error.message : String(error),\n };\n }\n}\n";
|
|
1
|
+
export declare const mermaidTemplate = "import \"server-only\";\nimport { renderMermaidSVG } from \"beautiful-mermaid\";\n\nconst DIAGRAM_OPTIONS = {\n bg: \"var(--mermaid-bg)\",\n fg: \"var(--mermaid-fg)\",\n line: \"var(--mermaid-line)\",\n accent: \"var(--mermaid-accent)\",\n muted: \"var(--mermaid-muted)\",\n surface: \"var(--mermaid-surface)\",\n border: \"var(--mermaid-border)\",\n transparent: true,\n};\n\nexport type MermaidResult =\n | { ok: true; svg: string; width: number | null }\n | { ok: false; error: string };\n\nfunction parseColor(value: string): [number, number, number] | null {\n const hex = /^#([0-9a-f]{3,8})$/i.exec(value.trim());\n if (hex) {\n let channels = hex[1];\n if (channels.length === 3 || channels.length === 4) {\n channels = channels\n .slice(0, 3)\n .split(\"\")\n .map((c) => c + c)\n .join(\"\");\n }\n if (channels.length !== 6 && channels.length !== 8) return null;\n return [\n Number.parseInt(channels.slice(0, 2), 16),\n Number.parseInt(channels.slice(2, 4), 16),\n Number.parseInt(channels.slice(4, 6), 16),\n ];\n }\n const rgb = /^rgba?\\(\\s*(\\d+)[\\s,]+(\\d+)[\\s,]+(\\d+)/i.exec(value.trim());\n if (rgb) return [Number(rgb[1]), Number(rgb[2]), Number(rgb[3])];\n return null;\n}\n\n// beautiful-mermaid labels nodes with the theme foreground (white in dark\n// mode) even when the diagram sets an explicit fill via classDef/style, which\n// leaves white text on light colored boxes. The SVG renders once and is shared\n// by both modes, so bake a literal contrast color into the labels of nodes\n// whose shape has a literal fill.\nfunction contrastNodeLabels(svg: string): string {\n return svg.replace(/<g class=\"node\"[^>]*>[\\s\\S]*?<\\/g>/g, (group) => {\n const shapeFill = /fill=\"([^\"]*)\"/.exec(group)?.[1] ?? \"\";\n if (shapeFill.startsWith(\"var(\") || shapeFill === \"none\") return group;\n const rgb = parseColor(shapeFill);\n // YIQ perceived brightness. Unparseable literals (named colors) default\n // to black text \u2014 classDef fills are overwhelmingly light pastels.\n const yiq = rgb ? (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000 : 255;\n const label = yiq >= 128 ? \"#000000\" : \"#ffffff\";\n return group.replace(\n /(<text[^>]*fill=\")var\\(--_text\\)(\")/g,\n \"$1\" + label + \"$2\",\n );\n });\n}\n\nfunction normalizeSvg(svg: string): {\n ok: true;\n svg: string;\n width: number | null;\n} {\n const openTag = /^<svg\\b[^>]*>/.exec(svg);\n if (!openTag) return { ok: true, svg, width: null };\n\n const widthMatch = /\\swidth=\"([\\d.]+)\"/.exec(openTag[0]);\n const width = widthMatch ? Number.parseFloat(widthMatch[1]) : null;\n\n const stripped = openTag[0].replace(/\\s(?:width|height)=\"[^\"]*\"/g, \"\");\n return {\n ok: true,\n svg: stripped + svg.slice(openTag[0].length),\n width: width !== null && Number.isFinite(width) ? width : null,\n };\n}\n\nexport function renderDiagram(code: string): MermaidResult {\n try {\n return normalizeSvg(\n contrastNodeLabels(renderMermaidSVG(code, DIAGRAM_OPTIONS)),\n );\n } catch (error) {\n return {\n ok: false,\n error: error instanceof Error ? error.message : String(error),\n };\n }\n}\n";
|
|
@@ -16,6 +16,50 @@ export type MermaidResult =
|
|
|
16
16
|
| { ok: true; svg: string; width: number | null }
|
|
17
17
|
| { ok: false; error: string };
|
|
18
18
|
|
|
19
|
+
function parseColor(value: string): [number, number, number] | null {
|
|
20
|
+
const hex = /^#([0-9a-f]{3,8})$/i.exec(value.trim());
|
|
21
|
+
if (hex) {
|
|
22
|
+
let channels = hex[1];
|
|
23
|
+
if (channels.length === 3 || channels.length === 4) {
|
|
24
|
+
channels = channels
|
|
25
|
+
.slice(0, 3)
|
|
26
|
+
.split("")
|
|
27
|
+
.map((c) => c + c)
|
|
28
|
+
.join("");
|
|
29
|
+
}
|
|
30
|
+
if (channels.length !== 6 && channels.length !== 8) return null;
|
|
31
|
+
return [
|
|
32
|
+
Number.parseInt(channels.slice(0, 2), 16),
|
|
33
|
+
Number.parseInt(channels.slice(2, 4), 16),
|
|
34
|
+
Number.parseInt(channels.slice(4, 6), 16),
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
const rgb = /^rgba?\\(\\s*(\\d+)[\\s,]+(\\d+)[\\s,]+(\\d+)/i.exec(value.trim());
|
|
38
|
+
if (rgb) return [Number(rgb[1]), Number(rgb[2]), Number(rgb[3])];
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// beautiful-mermaid labels nodes with the theme foreground (white in dark
|
|
43
|
+
// mode) even when the diagram sets an explicit fill via classDef/style, which
|
|
44
|
+
// leaves white text on light colored boxes. The SVG renders once and is shared
|
|
45
|
+
// by both modes, so bake a literal contrast color into the labels of nodes
|
|
46
|
+
// whose shape has a literal fill.
|
|
47
|
+
function contrastNodeLabels(svg: string): string {
|
|
48
|
+
return svg.replace(/<g class="node"[^>]*>[\\s\\S]*?<\\/g>/g, (group) => {
|
|
49
|
+
const shapeFill = /fill="([^"]*)"/.exec(group)?.[1] ?? "";
|
|
50
|
+
if (shapeFill.startsWith("var(") || shapeFill === "none") return group;
|
|
51
|
+
const rgb = parseColor(shapeFill);
|
|
52
|
+
// YIQ perceived brightness. Unparseable literals (named colors) default
|
|
53
|
+
// to black text — classDef fills are overwhelmingly light pastels.
|
|
54
|
+
const yiq = rgb ? (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000 : 255;
|
|
55
|
+
const label = yiq >= 128 ? "#000000" : "#ffffff";
|
|
56
|
+
return group.replace(
|
|
57
|
+
/(<text[^>]*fill=")var\\(--_text\\)(")/g,
|
|
58
|
+
"$1" + label + "$2",
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
19
63
|
function normalizeSvg(svg: string): {
|
|
20
64
|
ok: true;
|
|
21
65
|
svg: string;
|
|
@@ -37,7 +81,9 @@ function normalizeSvg(svg: string): {
|
|
|
37
81
|
|
|
38
82
|
export function renderDiagram(code: string): MermaidResult {
|
|
39
83
|
try {
|
|
40
|
-
return normalizeSvg(
|
|
84
|
+
return normalizeSvg(
|
|
85
|
+
contrastNodeLabels(renderMermaidSVG(code, DIAGRAM_OPTIONS)),
|
|
86
|
+
);
|
|
41
87
|
} catch (error) {
|
|
42
88
|
return {
|
|
43
89
|
ok: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doccupine",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.154",
|
|
4
4
|
"description": "Free and open-source documentation platform. Write MDX, get a production-ready site with AI chat, built-in components, and an MCP server - in one command.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=22.12.0"
|
|
12
12
|
},
|
|
13
|
-
"packageManager": "pnpm@11.
|
|
13
|
+
"packageManager": "pnpm@11.21.0",
|
|
14
14
|
"scripts": {
|
|
15
15
|
"clean": "node scripts/clean.mjs",
|
|
16
16
|
"build": "pnpm clean && tsc",
|
|
@@ -42,20 +42,20 @@
|
|
|
42
42
|
"author": "Luan Gjokaj",
|
|
43
43
|
"license": "SEE LICENSE IN LICENSE",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@readme/openapi-parser": "^7.0.
|
|
45
|
+
"@readme/openapi-parser": "^7.0.1",
|
|
46
46
|
"chalk": "^6.0.0",
|
|
47
47
|
"chokidar": "^5.0.0",
|
|
48
48
|
"commander": "^15.0.0",
|
|
49
49
|
"fs-extra": "^11.4.0",
|
|
50
50
|
"gray-matter": "^4.0.3",
|
|
51
|
-
"next": "^16.3.
|
|
51
|
+
"next": "^16.3.1",
|
|
52
52
|
"prompts": "^2.4.2",
|
|
53
53
|
"react": "^19.2.8",
|
|
54
54
|
"react-dom": "^19.2.8"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/fs-extra": "^11.0.4",
|
|
58
|
-
"@types/node": "^26.
|
|
58
|
+
"@types/node": "^26.2.0",
|
|
59
59
|
"@types/prompts": "^2.4.9",
|
|
60
60
|
"prettier": "^3.9.6",
|
|
61
61
|
"typescript": "^7.0.2",
|