@docubook/flame 2.0.0-beta.4 → 2.0.0

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.
Files changed (62) hide show
  1. package/.docu/components/Theme.tsx +42 -34
  2. package/.docu/components/Toc.tsx +1 -1
  3. package/.docu/components/home/BackgroundBlobs.tsx +31 -0
  4. package/.docu/components/home/index.tsx +1 -0
  5. package/.docu/lib/build.deno.js +1 -1
  6. package/.docu/lib/{build.impl-CT-YLyLn.js → build.impl-CAQr352X.js} +60 -29
  7. package/.docu/lib/build.impl-CAQr352X.js.map +1 -0
  8. package/.docu/lib/build.impl-NLhjTqTa.js +2 -0
  9. package/.docu/lib/build.node.js +1 -1
  10. package/.docu/lib/clean.js +1 -1
  11. package/.docu/lib/deploy.deno.js +1 -1
  12. package/.docu/lib/deploy.node.js +1 -1
  13. package/.docu/lib/{deploy.shared-CmOzm3b5.js → deploy.shared-CvgObu6_.js} +45 -17
  14. package/.docu/lib/deploy.shared-CvgObu6_.js.map +1 -0
  15. package/.docu/lib/{html.shared-WwQnhDty.js → html.shared-CsEFmy_Y.js} +194 -165
  16. package/.docu/lib/html.shared-CsEFmy_Y.js.map +1 -0
  17. package/.docu/lib/{logger-Cz0CPMi8.js → logger-DwxYdOL7.js} +4 -3
  18. package/.docu/lib/logger-DwxYdOL7.js.map +1 -0
  19. package/.docu/lib/{paths-Bl2cdp9E.js → paths-Cbz-dj4s.js} +5 -9
  20. package/.docu/lib/{paths-Bl2cdp9E.js.map → paths-Cbz-dj4s.js.map} +1 -1
  21. package/.docu/lib/preview.deno.js +1 -1
  22. package/.docu/lib/{preview.impl-BaYhTRBW.js → preview.impl-BwrVLNIQ.js} +3 -3
  23. package/.docu/lib/{preview.impl-BaYhTRBW.js.map → preview.impl-BwrVLNIQ.js.map} +1 -1
  24. package/.docu/lib/preview.node.js +1 -1
  25. package/.docu/lib/server.deno.js +1 -1
  26. package/.docu/lib/{server.impl-l8hXfV_0.js → server.impl-Cs6DEy4V.js} +43 -52
  27. package/.docu/lib/server.impl-Cs6DEy4V.js.map +1 -0
  28. package/.docu/lib/server.node.js +1 -1
  29. package/.docu/node/build.impl.ts +71 -34
  30. package/.docu/node/build.ts +68 -34
  31. package/.docu/node/cache-key.ts +8 -4
  32. package/.docu/node/client.ts +36 -27
  33. package/.docu/node/deploy.shared.ts +44 -18
  34. package/.docu/node/deploy.ts +5 -20
  35. package/.docu/node/home-client.ts +6 -0
  36. package/.docu/node/html.shared.ts +5 -4
  37. package/.docu/node/html.ts +4 -3
  38. package/.docu/node/hydrate.node.ts +87 -115
  39. package/.docu/node/hydrate.ts +74 -80
  40. package/.docu/node/mdx-manifest.d.ts +3 -4
  41. package/.docu/node/mdx.ts +12 -6
  42. package/.docu/node/paths.ts +2 -9
  43. package/.docu/node/plugin-builder.ts +25 -13
  44. package/.docu/node/plugin.ts +33 -9
  45. package/.docu/node/search-indexer.ts +10 -4
  46. package/.docu/node/search.ts +8 -2
  47. package/.docu/node/server-routes.ts +59 -50
  48. package/.docu/node/server.impl.ts +4 -2
  49. package/.docu/node/server.ts +12 -16
  50. package/.docu/node/types.ts +12 -1
  51. package/.docu/pages/404.tsx +12 -9
  52. package/.docu/pages/index.tsx +8 -29
  53. package/.docu/styles/base.css +128 -0
  54. package/.docu/styles/globals.css +5 -137
  55. package/.docu/styles/site.css +7 -0
  56. package/package.json +6 -5
  57. package/.docu/lib/build.impl-CT-YLyLn.js.map +0 -1
  58. package/.docu/lib/build.impl-cJPJeQ8r.js +0 -2
  59. package/.docu/lib/deploy.shared-CmOzm3b5.js.map +0 -1
  60. package/.docu/lib/html.shared-WwQnhDty.js.map +0 -1
  61. package/.docu/lib/logger-Cz0CPMi8.js.map +0 -1
  62. package/.docu/lib/server.impl-l8hXfV_0.js.map +0 -1
@@ -0,0 +1,128 @@
1
+ @custom-variant dark (&:is(.dark *));
2
+
3
+ @theme {
4
+ --color-base-100: oklch(var(--base-100, 100% 0 0));
5
+ --color-base-200: oklch(var(--base-200, 100% 0 0));
6
+ --color-base-300: oklch(var(--base-300, 100% 0 0));
7
+ --color-base-content: oklch(var(--base-content, 100% 0 0));
8
+ --color-border: hsl(var(--border-color));
9
+ --color-input: hsl(var(--input));
10
+ --color-ring: hsl(var(--ring));
11
+ --color-background: hsl(var(--background));
12
+ --color-foreground: hsl(var(--foreground));
13
+ --color-primary: hsl(var(--primary));
14
+ --color-primary-foreground: hsl(var(--primary-foreground));
15
+ --color-secondary: hsl(var(--secondary));
16
+ --color-secondary-foreground: hsl(var(--secondary-foreground));
17
+ --color-destructive: hsl(var(--destructive));
18
+ --color-destructive-foreground: hsl(var(--destructive-foreground));
19
+ --color-muted: hsl(var(--muted));
20
+ --color-muted-foreground: hsl(var(--muted-foreground));
21
+ --color-accent: hsl(var(--accent));
22
+ --color-accent-foreground: hsl(var(--accent-foreground));
23
+ --color-primary-content: hsl(var(--primary-foreground));
24
+ --color-secondary-content: hsl(var(--secondary-foreground));
25
+ --color-accent-content: hsl(var(--accent-foreground));
26
+ --color-popover: hsl(var(--popover));
27
+ --color-popover-foreground: hsl(var(--popover-foreground));
28
+ --color-card: hsl(var(--card));
29
+ --color-card-foreground: hsl(var(--card-foreground));
30
+ --radius-lg: var(--radius);
31
+ --radius-md: calc(var(--radius) - 2px);
32
+ --radius-sm: calc(var(--radius) - 4px);
33
+ --animate-accordion-down: accordion-down 0.2s ease-out;
34
+ --animate-accordion-up: accordion-up 0.2s ease-out;
35
+
36
+ @keyframes accordion-down {
37
+ from {
38
+ height: 0;
39
+ }
40
+ to {
41
+ height: var(--radix-accordion-content-height);
42
+ }
43
+ }
44
+
45
+ @keyframes accordion-up {
46
+ from {
47
+ height: var(--radix-accordion-content-height);
48
+ }
49
+ to {
50
+ height: 0;
51
+ }
52
+ }
53
+ }
54
+
55
+ @layer base {
56
+ :root {
57
+ --base-100: 100% 0 0;
58
+ --base-200: 97% 0.002 260;
59
+ --base-300: 92% 0.004 260;
60
+ --base-content: 22% 0.03 260;
61
+ --background: 0 0% 100%;
62
+ --foreground: 220 30% 15%;
63
+ --card: 0 0% 100%;
64
+ --card-foreground: 220 30% 15%;
65
+ --popover: 0 0% 100%;
66
+ --popover-foreground: 220 30% 15%;
67
+ --primary: 210 81% 56%;
68
+ --primary-foreground: 210 40% 98%;
69
+ --secondary: 210 20% 94%;
70
+ --secondary-foreground: 220 30% 15%;
71
+ --muted: 210 20% 94%;
72
+ --muted-foreground: 220 15% 38%;
73
+ --accent: 200 100% 40%;
74
+ --accent-foreground: 200 40% 98%;
75
+ --destructive: 0 85% 60%;
76
+ --destructive-foreground: 210 40% 98%;
77
+ --border-color: 210 20% 88%;
78
+ --input: 210 20% 88%;
79
+ --ring: 210 81% 56%;
80
+ --radius: 0.5rem;
81
+ }
82
+
83
+ .dark {
84
+ --base-100: 22% 0.02 260;
85
+ --base-200: 19% 0.02 260;
86
+ --base-300: 0.6 0 0 / 0.25;
87
+ --base-content: 95% 0.01 260;
88
+ --background: 225 20% 11%;
89
+ --foreground: 210 20% 93%;
90
+ --card: 225 18% 14%;
91
+ --card-foreground: 210 20% 93%;
92
+ --popover: 225 18% 14%;
93
+ --popover-foreground: 210 20% 93%;
94
+ --primary: 210 100% 67%;
95
+ --primary-foreground: 210 0% 10%;
96
+ --secondary: 220 15% 18%;
97
+ --secondary-foreground: 210 20% 90%;
98
+ --muted: 220 12% 20%;
99
+ --muted-foreground: 215 12% 58%;
100
+ --accent: 200 100% 62%;
101
+ --accent-foreground: 200 0% 10%;
102
+ --destructive: 0 80% 65%;
103
+ --destructive-foreground: 0 0% 10%;
104
+ --border-color: 220 10% 28%;
105
+ --input: 220 10% 28%;
106
+ --ring: 210 100% 67%;
107
+ --radius: 0.5rem;
108
+ }
109
+
110
+ * {
111
+ @apply border-border;
112
+ }
113
+
114
+ body {
115
+ @apply bg-background text-foreground;
116
+ transition:
117
+ background-color 0.2s ease,
118
+ color 0.2s ease;
119
+ }
120
+
121
+ summary::-webkit-details-marker {
122
+ display: none;
123
+ }
124
+
125
+ summary::marker {
126
+ display: none;
127
+ }
128
+ }
@@ -1,5 +1,7 @@
1
- @import "tailwindcss";
1
+ @import "tailwindcss" source(none);
2
2
  @import "@docubook/markdown/styles.css";
3
+ @import "@docubook/ui-react/styles.css";
4
+ @import "./base.css";
3
5
 
4
6
  @plugin "daisyui" {
5
7
  themes:
@@ -7,9 +9,8 @@
7
9
  dark;
8
10
  }
9
11
  @plugin "@tailwindcss/typography";
10
- @source "../../.docu/components";
11
- @source "../../.docu/pages";
12
- @import "@docubook/ui-react/styles.css";
12
+ @source "../components";
13
+ @source "../pages/docs";
13
14
 
14
15
  /* daisyUI breadcrumbs underline every li child on hover (including plain
15
16
  spans) — crumbs are not links, so strip the underline (and pointer cursor)
@@ -36,139 +37,6 @@
36
37
  );
37
38
  @source inline("label");
38
39
 
39
- @custom-variant dark (&:is(.dark *));
40
-
41
- @theme {
42
- --color-base-100: oklch(var(--base-100, 100% 0 0));
43
- --color-base-200: oklch(var(--base-200, 100% 0 0));
44
- --color-base-300: oklch(var(--base-300, 100% 0 0));
45
- --color-base-content: oklch(var(--base-content, 100% 0 0));
46
- --color-border: hsl(var(--border-color));
47
- --color-input: hsl(var(--input));
48
- --color-ring: hsl(var(--ring));
49
- --color-background: hsl(var(--background));
50
- --color-foreground: hsl(var(--foreground));
51
- --color-primary: hsl(var(--primary));
52
- --color-primary-foreground: hsl(var(--primary-foreground));
53
- --color-secondary: hsl(var(--secondary));
54
- --color-secondary-foreground: hsl(var(--secondary-foreground));
55
- --color-destructive: hsl(var(--destructive));
56
- --color-destructive-foreground: hsl(var(--destructive-foreground));
57
- --color-muted: hsl(var(--muted));
58
- --color-muted-foreground: hsl(var(--muted-foreground));
59
- --color-accent: hsl(var(--accent));
60
- --color-accent-foreground: hsl(var(--accent-foreground));
61
- --color-primary-content: hsl(var(--primary-foreground));
62
- --color-secondary-content: hsl(var(--secondary-foreground));
63
- --color-accent-content: hsl(var(--accent-foreground));
64
- --color-popover: hsl(var(--popover));
65
- --color-popover-foreground: hsl(var(--popover-foreground));
66
- --color-card: hsl(var(--card));
67
- --color-card-foreground: hsl(var(--card-foreground));
68
- --radius-lg: var(--radius);
69
- --radius-md: calc(var(--radius) - 2px);
70
- --radius-sm: calc(var(--radius) - 4px);
71
- --animate-accordion-down: accordion-down 0.2s ease-out;
72
- --animate-accordion-up: accordion-up 0.2s ease-out;
73
-
74
- @keyframes accordion-down {
75
- from {
76
- height: 0;
77
- }
78
- to {
79
- height: var(--radix-accordion-content-height);
80
- }
81
- }
82
-
83
- @keyframes accordion-up {
84
- from {
85
- height: var(--radix-accordion-content-height);
86
- }
87
- to {
88
- height: 0;
89
- }
90
- }
91
- }
92
-
93
- /* CSS variables - Modern Blue Theme + daisyUI tokens */
94
- @layer base {
95
- :root {
96
- --base-100: 100% 0 0;
97
- --base-200: 97% 0.002 260;
98
- --base-300: 92% 0.004 260;
99
- --base-content: 22% 0.03 260;
100
- --background: 0 0% 100%;
101
- --foreground: 220 30% 15%;
102
- --card: 0 0% 100%;
103
- --card-foreground: 220 30% 15%;
104
- --popover: 0 0% 100%;
105
- --popover-foreground: 220 30% 15%;
106
- --primary: 210 81% 56%;
107
- --primary-foreground: 210 40% 98%;
108
- --secondary: 210 20% 94%;
109
- --secondary-foreground: 220 30% 15%;
110
- --muted: 210 20% 94%;
111
- --muted-foreground: 220 15% 38%;
112
- --accent: 200 100% 40%;
113
- --accent-foreground: 200 40% 98%;
114
- --destructive: 0 85% 60%;
115
- --destructive-foreground: 210 40% 98%;
116
- --border-color: 210 20% 88%;
117
- --input: 210 20% 88%;
118
- --ring: 210 81% 56%;
119
- --radius: 0.5rem;
120
- }
121
-
122
- .dark {
123
- --base-100: 22% 0.02 260;
124
- --base-200: 19% 0.02 260;
125
- --base-300: 0.6 0 0 / 0.25;
126
- --base-content: 95% 0.01 260;
127
- --background: 225 20% 11%;
128
- --foreground: 210 20% 93%;
129
- --card: 225 18% 14%;
130
- --card-foreground: 210 20% 93%;
131
- --popover: 225 18% 14%;
132
- --popover-foreground: 210 20% 93%;
133
- --primary: 210 100% 67%;
134
- --primary-foreground: 210 0% 10%;
135
- --secondary: 220 15% 18%;
136
- --secondary-foreground: 210 20% 90%;
137
- --muted: 220 12% 20%;
138
- --muted-foreground: 215 12% 58%;
139
- --accent: 200 100% 62%;
140
- --accent-foreground: 200 0% 10%;
141
- --destructive: 0 80% 65%;
142
- --destructive-foreground: 0 0% 10%;
143
- --border-color: 220 10% 28%;
144
- --input: 220 10% 28%;
145
- --ring: 210 100% 67%;
146
- --radius: 0.5rem;
147
- }
148
- }
149
-
150
- /* Base layer - reset & base styles */
151
- @layer base {
152
- * {
153
- @apply border-border;
154
- }
155
-
156
- body {
157
- @apply bg-background text-foreground;
158
- transition:
159
- background-color 0.2s ease,
160
- color 0.2s ease;
161
- }
162
-
163
- /* Remove default summary marker from details elements */
164
- summary::-webkit-details-marker {
165
- display: none;
166
- }
167
- summary::marker {
168
- display: none;
169
- }
170
- }
171
-
172
40
  /* Code block utilities */
173
41
  @layer utilities {
174
42
  .prose {
@@ -0,0 +1,7 @@
1
+ @import "tailwindcss" source(none);
2
+ @import "./base.css";
3
+
4
+ @source "../components/home";
5
+ @source "../components/Theme.tsx";
6
+ @source "../pages/index.tsx";
7
+ @source "../pages/404.tsx";
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@docubook/flame",
3
- "version": "2.0.0-beta.4",
3
+ "version": "2.0.0",
4
4
  "description": "A blazing-fast React + MDX framework powered by Bun, built for modern documentation experiences.",
5
5
  "type": "module",
6
+ "types": "./.docu/node/plugin.ts",
6
7
  "bin": {
7
8
  "flame": "./bin/cli.js"
8
9
  },
@@ -45,10 +46,10 @@
45
46
  "author-url": "https://wildan.dev",
46
47
  "license": "MIT",
47
48
  "dependencies": {
48
- "@docubook/core": "^2.0.0-beta.4",
49
- "@docubook/markdown": "^2.0.0-beta.4",
50
- "@docubook/themes-colors": "^2.0.0-beta.4",
51
- "@docubook/ui-react": "^2.0.0-beta.4",
49
+ "@docubook/core": "^2.0.0",
50
+ "@docubook/markdown": "^2.0.0",
51
+ "@docubook/themes-colors": "^2.0.0",
52
+ "@docubook/ui-react": "^2.0.0",
52
53
  "@mdx-js/react": "^3.0.1",
53
54
  "@tailwindcss/cli": "4.3.0",
54
55
  "@tailwindcss/typography": "0.5.16",
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.impl-CT-YLyLn.js","names":[],"sources":["../node/types.ts","../node/seo.ts","../node/build.impl.ts"],"sourcesContent":["import type { ThemeConfig } from \"@docubook/themes-colors\";\nimport type { PluginEntry } from \"./plugin\";\n\nexport interface DocuRouteContext {\n title?: string;\n icon?: string;\n description?: string;\n}\n\nexport interface DocuRoute {\n title: string;\n href: string;\n noLink?: boolean;\n items?: DocuRoute[];\n context?: DocuRouteContext;\n}\n\nexport interface DocuMeta {\n title: string;\n description: string;\n baseURL: string;\n favicon?: string;\n /** Default OG image path (e.g. /docs/assets/images/og.png). Used when page frontmatter has no image. */\n ogImage?: string;\n}\n\nexport interface SocialLink {\n name: string;\n url: string;\n}\n\nexport interface DocuNavbar {\n logoText: string;\n logo?: { src?: string; alt?: string };\n menu: { title: string; href: string }[];\n}\n\nexport interface DocuFooter {\n social: SocialLink[];\n}\n\nexport interface DocuSidebar {\n /** How context sections are displayed.\n * \"dropdown\" — context switcher dropdown (default)\n * \"separator\" — inline group headers in sidebar */\n context?: \"dropdown\" | \"separator\";\n}\n\nexport interface RepoConfig {\n url: string;\n path: string;\n edit: boolean;\n}\n\nexport interface HeroAction {\n text: string;\n link: string;\n theme?: \"primary\" | \"secondary\" | \"ghost\";\n icon?: string;\n}\n\nexport interface Hero {\n tagline?: string;\n headline: string;\n description?: string;\n actions?: HeroAction[];\n}\n\nexport interface HomeFeature {\n icon?: string;\n title: string;\n description: string;\n link?: string;\n}\n\nexport interface HomeConfig {\n hero?: Hero;\n features?: HomeFeature[];\n}\n\nexport interface DocuConfig {\n meta: DocuMeta;\n home?: HomeConfig;\n navbar: DocuNavbar;\n footer: DocuFooter;\n repo: RepoConfig;\n sidebar?: DocuSidebar;\n routes: DocuRoute[];\n themes?: {\n colors: ThemeConfig;\n };\n /** List of DocuBook plugins to load. Empty by default — no-op when absent. */\n plugins?: PluginEntry[];\n}\n\nexport interface BuildCacheEntry {\n hash: string;\n mtime: number;\n builtAt: number;\n}\n\n/** Version stamp stored as `__meta__` — extends entry so the index signature stays valid. */\nexport interface BuildCacheMeta extends BuildCacheEntry {\n version: number;\n runtime: string;\n}\n\nexport interface BuildCache {\n [path: string]: BuildCacheEntry;\n __meta__?: BuildCacheMeta;\n __assets__?: BuildCacheEntry;\n __bundle__?: BuildCacheEntry;\n}\n\n/** Narrow a cache slot to a real page/asset entry (guards `__meta__` shape). */\nexport function isCacheEntry(value: unknown): value is BuildCacheEntry {\n if (typeof value !== \"object\" || value === null) return false;\n const v = value as Record<string, unknown>;\n return typeof v.hash === \"string\" && typeof v.mtime === \"number\" && typeof v.builtAt === \"number\";\n}\n\nexport interface CliArgs {\n force?: boolean;\n clean?: boolean;\n ssr?: boolean;\n}\n\nexport interface ParsedDoc {\n compiledSource: string;\n frontmatter: Record<string, unknown>;\n raw: string;\n scope?: Record<string, unknown>;\n}\n\nexport type { TocItem } from \"@docubook/core\";\n","import type { DocuConfig } from \"./types\";\nimport { frontmatterField } from \"./mdx\";\n\nexport interface SeoMeta {\n /** Absolute canonical URL */\n url: string;\n /** Site name for og:site_name */\n siteName: string;\n /** Absolute OG image URL (from frontmatter.image, if set) */\n image?: string;\n}\n\n/**\n * Build SEO metadata from config and per-page frontmatter.\n * All fields are derived from existing data — no extra config required.\n */\nexport function buildSeoMeta(\n config: DocuConfig,\n frontmatter: Record<string, unknown>,\n slug: string\n): SeoMeta {\n const baseURL = config.meta?.baseURL?.replace(/\\/+$/, \"\") || \"\";\n const url = slug ? `${baseURL}/docs/${slug}` : `${baseURL}/`;\n\n const result: SeoMeta = {\n url,\n siteName: config.meta?.title || \"\",\n };\n\n // Per-page image from frontmatter, fallback to global default from config\n const image = frontmatterField(frontmatter, \"image\") || config.meta?.ogImage;\n if (image) {\n // Resolve using URL constructor — handles absolute, root-relative, and relative paths\n try {\n result.image = new URL(image, image.startsWith(\"/\") ? baseURL : `${baseURL}/docs/`).href;\n } catch {\n result.image = image;\n }\n }\n\n return result;\n}\n","/**\n * Runtime-neutral static build — mirror of `build.ts` (Bun-only via its\n * transitive imports, protected) with the Bun-coupled modules swapped for\n * their neutral counterparts: `html.shared` (pure escaping) and\n * `hydrate.node` (esbuild client bundling). Everything else is identical.\n * The Node/Deno build entries call `runBuildCli()`.\n */\n\nimport { readFile, writeFile, mkdir, readdir, copyFile, rename, unlink } from \"node:fs/promises\";\nimport { existsSync } from \"node:fs\";\nimport { createHash } from \"node:crypto\";\nimport { join, dirname } from \"node:path\";\nimport React from \"react\";\nimport { renderToString } from \"react-dom/server\";\nimport {\n compileMdx,\n compileMdxModule,\n frontmatterField,\n getGitLastModifiedBatch,\n getPageContent,\n getPageFrontmatter,\n getPageStripped,\n registerPageContent,\n} from \"./mdx\";\nimport {\n DOCS_DIR,\n DIST_DIR,\n ASSETS_DIR,\n CACHE_FILE,\n DOCS_ASSETS_DIR,\n PROJECT_ROOT,\n loadDocuConfig,\n} from \"./paths\";\nimport { htmlShell } from \"./html.shared\";\nimport { generateSearchIndex } from \"./search-indexer\";\nimport { buildClientBundle, computeInlineThemeCss } from \"./hydrate.node\";\nimport { logger } from \"./logger\";\nimport { initSentry, captureException } from \"./sentry\";\nimport { loadPlugins } from \"./plugin-loader\";\nimport { BuildPluginBuilder } from \"./plugin-builder\";\nimport { scanMdxFiles, resolveDocsIndexSource, DEFAULT_FAVICON } from \"./utils\";\nimport type { BuildCache, BuildCacheMeta, CliArgs } from \"./types\";\nimport { isCacheEntry } from \"./types\";\nimport {\n BUILD_CACHE_VERSION,\n atomicWriteFile,\n hashMdxSources,\n hookMemoryPressure,\n runtimeStamp,\n} from \"./cache-key\";\nimport { clearDerivedPageCaches } from \"./mdx\";\nimport { generateNonce, cspHeader } from \"./security\";\nimport type { PageMeta, PageContext } from \"./plugin\";\nimport { buildSeoMeta } from \"./seo\";\nimport DocsPage from \"../pages/docs/[[...slug]]\";\nimport IndexPage from \"../pages/index\";\nimport NotFoundPage from \"../pages/404\";\nimport { DocsLayout } from \"../components/DocsLayout\";\n\nfunction parseArgs(): CliArgs {\n const args = process.argv.slice(2);\n return {\n force: args.includes(\"--force\") || args.includes(\"-f\"),\n clean: args.includes(\"--clean\") || args.includes(\"-c\"),\n };\n}\n\nfunction hashContent(content: string): string {\n return createHash(\"sha256\").update(content).digest(\"hex\").slice(0, 16);\n}\n\nasync function readCache(): Promise<BuildCache> {\n try {\n if (existsSync(CACHE_FILE)) {\n const data = await readFile(CACHE_FILE, \"utf-8\");\n const parsed = JSON.parse(data) as BuildCache;\n const meta = parsed.__meta__ as BuildCacheMeta | undefined;\n if (!meta || meta.version !== BUILD_CACHE_VERSION || meta.runtime !== runtimeStamp()) {\n return {};\n }\n return parsed;\n }\n } catch (err) {\n console.error(\"Failed to load build cache:\", (err as Error).message);\n }\n return {};\n}\n\nfunction stampCache(cache: BuildCache): void {\n cache.__meta__ = {\n hash: `${BUILD_CACHE_VERSION}:${runtimeStamp()}`,\n mtime: 0,\n builtAt: Date.now(),\n version: BUILD_CACHE_VERSION,\n runtime: runtimeStamp(),\n };\n}\n\nasync function writeCache(cache: BuildCache): Promise<void> {\n stampCache(cache);\n await atomicWriteFile(writeFile, rename, unlink, CACHE_FILE, JSON.stringify(cache, null, 2));\n}\n\nfunction parseConcurrency(): number {\n return Math.max(1, parseInt(process.env.BUILD_CONCURRENCY || \"4\", 10) || 4);\n}\n\ntype RebuildDecision = \"yes\" | \"hash_check\" | \"no\";\n\nfunction shouldRebuild(path: string, mtime: number, cache: BuildCache): RebuildDecision {\n const cached = cache[path];\n if (!isCacheEntry(cached)) return \"yes\";\n // Any mtime drift vs the recorded one — a newer edit, or mtime moving\n // backwards (rsync -a, cp -p, snapshot restore) — falls through to the\n // hash check: hashing an unchanged file is cheap, serving a stale page\n // is not. Only an untouched mtime skips without reading the file.\n if (mtime !== cached.mtime) return \"hash_check\";\n return \"no\";\n}\n\nlet assetManifest = { js: \"client.js\", css: \"client.css\" };\n\n/**\n * Reuse manifest.json on bundle cache hit; fall back to a full rebuild\n * when the manifest is missing or malformed.\n */\nasync function resolveAssetManifest(\n bundleHit: boolean,\n mdxSources: Record<string, string>\n): Promise<{ js: string; css: string }> {\n if (!bundleHit) return buildClientBundle(mdxSources);\n try {\n const manifest = JSON.parse(await readFile(join(ASSETS_DIR, \"manifest.json\"), \"utf-8\")) as {\n js?: string;\n css?: string;\n };\n if (typeof manifest.js === \"string\" && typeof manifest.css === \"string\") {\n return { js: manifest.js, css: manifest.css };\n }\n } catch {\n // corrupt/missing manifest — rebuild below\n }\n return buildClientBundle(mdxSources);\n}\n\nlet inlineThemeCss: string | undefined;\n\nasync function renderDocsPage(\n docuConfig: ReturnType<typeof loadDocuConfig>,\n slug: string,\n rawMdx: string,\n filePath: string,\n gitDates?: Map<string, string>,\n builder?: BuildPluginBuilder | null,\n nonce?: string\n): Promise<string> {\n let content = rawMdx;\n if (builder) {\n const transformed = await builder.runOnLoad(filePath, content);\n if (transformed?.contents) {\n content = transformed.contents;\n }\n }\n\n let result;\n try {\n const remarkPlugins = builder?.collectRemarkPlugins();\n const rehypePlugins = builder?.collectRehypePlugins();\n // Parse-once: reuse the prePass frontmatter + stripped content so the\n // SSR phase does not re-extract them. Only when the prePass actually\n // registered them — otherwise compileMdx does its own extraction.\n const preFm = getPageFrontmatter(`/${slug}`);\n const preStripped = getPageStripped(`/${slug}`);\n const pre =\n preFm !== undefined && preStripped !== undefined\n ? { frontmatter: preFm, strippedContent: preStripped }\n : undefined;\n result = await compileMdx(\n content,\n filePath,\n gitDates,\n remarkPlugins,\n rehypePlugins,\n undefined,\n pre\n );\n } catch (err) {\n const msg = err instanceof Error ? err.message : \"Unknown MDX error\";\n throw new Error(`MDX Error in: docs/${slug}.mdx\\n${msg}`, { cause: err });\n }\n\n let frontmatter = result.frontmatter as Record<string, unknown>;\n if (builder) {\n frontmatter = await builder.runTransformFrontmatterChain(frontmatter, {\n slug,\n filePath,\n content,\n });\n }\n\n const title = frontmatterField(frontmatter, \"title\") || slug || \"Docs\";\n const description = frontmatterField(frontmatter, \"description\");\n const slugParts = slug ? slug.split(\"/\") : [];\n\n const page = React.createElement(\n DocsLayout,\n { repoUrl: docuConfig.repo?.url },\n React.createElement(DocsPage, {\n slug: slugParts,\n title,\n description,\n date: frontmatterField(frontmatter, \"date\") || undefined,\n // Render MDX content as its own root: client hydrates the island as a\n // separate root, so SSR must be root-relative too or useId-based ids\n // (mdx-compiler components) mismatch during hydration.\n content: renderToString(result.content),\n tocs: result.tocs,\n filePath,\n repoUrl: docuConfig.repo?.url,\n mdxSlug: slug,\n })\n );\n\n const body = renderToString(page);\n\n const ctx: PageContext = { slug, filePath, frontmatter, content, config: docuConfig };\n const headExtra = builder?.collectHead(ctx);\n const bodyExtra = builder?.collectBody(ctx);\n\n const depth = slug ? slug.split(\"/\").length : 1;\n const favicon = docuConfig.meta?.favicon || DEFAULT_FAVICON;\n const seo = buildSeoMeta(docuConfig, frontmatter, slug || \"\");\n // MDX content hydrates from the bundled ESM module (mdx-hydrate), not\n // new Function — no 'unsafe-eval' needed in the CSP.\n const csp = nonce ? cspHeader(nonce) : undefined;\n let html = htmlShell({\n title,\n description,\n body,\n favicon,\n seo,\n csp,\n css: assetManifest.css,\n js: assetManifest.js,\n nonce,\n themeCss: inlineThemeCss,\n depth,\n headExtra,\n bodyExtra,\n });\n\n if (builder) {\n html = await builder.runTransformHtmlChain(html, ctx);\n }\n\n return html;\n}\n\nasync function copyDirectoryRecursive(src: string, dest: string): Promise<void> {\n if (!existsSync(src)) return;\n await mkdir(dest, { recursive: true });\n const entries = await readdir(src, { withFileTypes: true });\n for (const entry of entries) {\n const srcPath = join(src, entry.name);\n const destPath = join(dest, entry.name);\n if (entry.isDirectory()) {\n await copyDirectoryRecursive(srcPath, destPath);\n } else {\n await copyFile(srcPath, destPath);\n }\n }\n}\n\nexport async function runBuild(): Promise<void> {\n const docuConfig = loadDocuConfig();\n const args = parseArgs();\n\n hookMemoryPressure(clearDerivedPageCaches);\n\n logger.buildStart();\n\n if (args.clean) {\n const { rm } = await import(\"node:fs/promises\");\n try {\n await rm(DIST_DIR, { recursive: true, force: true });\n } catch (err) {\n console.error(\"Failed to clean dist directory:\", (err as Error).message);\n }\n }\n\n await mkdir(DIST_DIR, { recursive: true });\n await mkdir(ASSETS_DIR, { recursive: true });\n\n await copyDirectoryRecursive(DOCS_ASSETS_DIR, join(DIST_DIR, \"docs\", \"assets\"));\n\n const mdxFiles = await scanMdxFiles(DOCS_DIR);\n const cache = args.force ? {} : await readCache();\n let built = 0;\n let skipped = 0;\n\n const pluginsConfig = docuConfig.plugins ?? [];\n const builder = pluginsConfig.length > 0 ? new BuildPluginBuilder(docuConfig) : null;\n if (builder) {\n const plugins = await loadPlugins(pluginsConfig);\n for (const plugin of plugins) {\n await plugin.setup(builder);\n }\n await builder.runOnStart();\n }\n\n // Pre-compile every page's MDX to an ESM module (program format) so the\n // client bundle can hydrate the content island statically — no new Function.\n // Mirrors the page loop's transform + plugin chain so SSR and client trees\n // match. Runs for all files regardless of cache; the bundle is shared by\n // every page, so a content change invalidates the page cache anyway.\n const mdxSources: Record<string, string> = {};\n const prePassTasks = mdxFiles.map(async (file) => {\n let raw: string;\n try {\n raw = await readFile(file.absPath, \"utf-8\");\n } catch {\n return;\n }\n // Cache the original content so the page loop does not re-read the file\n // (one disk read per file — the frontmatter is parsed once here too).\n registerPageContent(`/${file.path}`, raw);\n let content = raw;\n if (builder) {\n const relPath = file.absPath.replace(PROJECT_ROOT + \"/\", \"\");\n const transformed = await builder.runOnLoad(relPath, content);\n if (transformed?.contents) content = transformed.contents;\n }\n const remarkPlugins = builder?.collectRemarkPlugins();\n const rehypePlugins = builder?.collectRehypePlugins();\n mdxSources[file.path] = await compileMdxModule(\n content,\n remarkPlugins,\n rehypePlugins,\n `/${file.path}`\n );\n });\n await Promise.all(prePassTasks);\n\n // The docs root (index.mdx, or index.md) renders with slug \"\" — mirror that\n // key so the index page hydrates too. Its render has its own try/catch; skip\n // on error.\n const indexSource = resolveDocsIndexSource(DOCS_DIR);\n if (indexSource) {\n try {\n const indexRaw = await readFile(indexSource, \"utf-8\");\n let indexContent = indexRaw;\n if (builder) {\n const relPath = indexSource.replace(PROJECT_ROOT + \"/\", \"\");\n const transformed = await builder.runOnLoad(relPath, indexContent);\n if (transformed?.contents) indexContent = transformed.contents;\n }\n mdxSources[\"\"] = await compileMdxModule(\n indexContent,\n builder?.collectRemarkPlugins(),\n builder?.collectRehypePlugins()\n );\n } catch {\n // ignore — the index render reports its own error\n }\n }\n\n logger.bundleStart();\n let t = performance.now();\n const bundleHash = hashMdxSources(mdxSources);\n const lastBundle = cache[\"__bundle__\"];\n const bundleHit =\n isCacheEntry(lastBundle) &&\n lastBundle.hash === bundleHash &&\n existsSync(join(ASSETS_DIR, \"manifest.json\"));\n assetManifest = await resolveAssetManifest(bundleHit, mdxSources);\n logger.bundleDone(Math.round(performance.now() - t));\n\n inlineThemeCss = computeInlineThemeCss();\n\n const lastManifest = cache[\"__assets__\"];\n const assetsChanged =\n !isCacheEntry(lastManifest) || lastManifest.hash !== `${assetManifest.js}:${assetManifest.css}`;\n if (assetsChanged) {\n cache[\"__assets__\"] = {\n hash: `${assetManifest.js}:${assetManifest.css}`,\n mtime: 0,\n builtAt: Date.now(),\n };\n }\n if (!bundleHit) {\n cache[\"__bundle__\"] = { hash: bundleHash, mtime: 0, builtAt: Date.now() };\n }\n\n logger.spinner.start(\"Building pages...\");\n t = performance.now();\n\n const allRelPaths = mdxFiles.map((f) => f.absPath.replace(PROJECT_ROOT + \"/\", \"\"));\n\n if (indexSource) {\n allRelPaths.push(indexSource.replace(PROJECT_ROOT + \"/\", \"\"));\n }\n const gitDates = await getGitLastModifiedBatch(allRelPaths);\n\n const CONCURRENCY = parseConcurrency();\n const buildTasks = [];\n const errors: string[] = [];\n\n for (const file of mdxFiles) {\n const rebuildDecision = shouldRebuild(file.path, file.mtime, cache);\n\n if (rebuildDecision === \"no\") {\n const outputPath = join(DIST_DIR, \"docs\", `${file.path}.html`);\n if (existsSync(outputPath) && !assetsChanged) {\n skipped++;\n continue;\n }\n }\n\n let rawMdx = getPageContent(`/${file.path}`);\n if (rawMdx === undefined) {\n try {\n rawMdx = await readFile(file.absPath, \"utf-8\");\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== \"ENOENT\") throw err;\n continue;\n }\n }\n\n if (rebuildDecision === \"hash_check\") {\n const contentHash = hashContent(rawMdx);\n const cached = cache[file.path];\n if (isCacheEntry(cached) && cached.hash === contentHash) {\n if (!assetsChanged) {\n const outputPath = join(DIST_DIR, \"docs\", `${file.path}.html`);\n if (existsSync(outputPath)) {\n cache[file.path] = { ...cached, mtime: file.mtime, builtAt: Date.now() };\n skipped++;\n continue;\n }\n }\n }\n }\n\n const relPath = file.absPath.replace(PROJECT_ROOT + \"/\", \"\");\n const capturedRawMdx = rawMdx;\n const capturedFile = file;\n\n buildTasks.push(async () => {\n try {\n const pageNonce = generateNonce();\n const html = await renderDocsPage(\n docuConfig,\n capturedFile.path,\n capturedRawMdx,\n relPath,\n gitDates,\n builder,\n pageNonce\n );\n const outputPath = join(DIST_DIR, \"docs\", `${capturedFile.path}.html`);\n await mkdir(dirname(outputPath), { recursive: true });\n await writeFile(outputPath, html);\n cache[capturedFile.path] = {\n hash: hashContent(capturedRawMdx),\n mtime: capturedFile.mtime,\n builtAt: Date.now(),\n };\n built++;\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n errors.push(msg);\n console.error(`\\n\\u274C ${msg}\\n`);\n }\n });\n }\n\n for (let i = 0; i < buildTasks.length; i += CONCURRENCY) {\n await Promise.all(buildTasks.slice(i, i + CONCURRENCY).map((fn) => fn()));\n }\n\n if (indexSource) {\n try {\n const indexRaw = await readFile(indexSource, \"utf-8\");\n const indexRelPath = indexSource.replace(PROJECT_ROOT + \"/\", \"\");\n const indexHtml = await renderDocsPage(\n docuConfig,\n \"\",\n indexRaw,\n indexRelPath,\n gitDates,\n builder,\n generateNonce()\n );\n await mkdir(join(DIST_DIR, \"docs\"), { recursive: true });\n await writeFile(join(DIST_DIR, \"docs\", \"index.html\"), indexHtml);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n errors.push(`index: ${msg}`);\n console.error(`\\n❌ Failed to build index: ${msg}\\n`);\n }\n } else {\n const msg = \"docs root index: docs/index.mdx (or docs/index.md) not found\";\n errors.push(`index: ${msg}`);\n console.error(`\\n❌ Failed to build index: ${msg}\\n`);\n }\n\n const landingPage = React.createElement(IndexPage);\n const landingFavicon = docuConfig.meta?.favicon || DEFAULT_FAVICON;\n const landingSeo = buildSeoMeta(\n docuConfig,\n docuConfig.meta as unknown as Record<string, unknown>,\n \"\"\n );\n const landingNonce = generateNonce();\n const landingHtml = htmlShell({\n title: docuConfig.meta?.title || \"DocuBook\",\n description: docuConfig.meta?.description || \"\",\n body: renderToString(landingPage),\n favicon: landingFavicon,\n seo: landingSeo,\n csp: cspHeader(landingNonce),\n css: assetManifest.css,\n js: assetManifest.js,\n nonce: landingNonce,\n themeCss: inlineThemeCss,\n });\n await writeFile(join(DIST_DIR, \"index.html\"), landingHtml);\n\n const notFoundPage = React.createElement(\n DocsLayout,\n { repoUrl: docuConfig.repo?.url },\n React.createElement(NotFoundPage)\n );\n const notFoundFavicon = docuConfig.meta?.favicon || DEFAULT_FAVICON;\n const notFoundNonce = generateNonce();\n const notFoundHtml = htmlShell({\n title: \"404 - Not Found\",\n description: \"\",\n body: renderToString(notFoundPage),\n favicon: notFoundFavicon,\n headExtra: ['<meta name=\"robots\" content=\"noindex,follow\">'],\n csp: cspHeader(notFoundNonce),\n css: assetManifest.css,\n js: assetManifest.js,\n nonce: notFoundNonce,\n themeCss: inlineThemeCss,\n // Served as the static-host fallback at ANY requested path — relative\n // depth can never be right there, so use root-absolute asset URLs.\n absoluteAssets: true,\n });\n await writeFile(join(DIST_DIR, \"404.html\"), notFoundHtml);\n\n logger.spinner.stop(\n `Built ${built} pages (${skipped} cached) \\x1b[90m(${Math.round(performance.now() - t)}ms)\\x1b[0m`\n );\n\n if (builder) {\n const pages: PageMeta[] = mdxFiles.map((f) => ({\n slug: f.path,\n title: f.path.split(\"/\").pop() || f.path,\n filePath: join(DOCS_DIR, f.path),\n outputPath: join(DIST_DIR, \"docs\", `${f.path}.html`),\n }));\n await builder.runOnEnd(pages);\n }\n\n logger.indexStart();\n t = performance.now();\n // No content changed (all pages cached) → the aggregated index is\n // unchanged too; reuse the existing file instead of regenerating it.\n const indexSkipped = built === 0 && existsSync(join(ASSETS_DIR, \"search-index.json\"));\n const indexCount = indexSkipped ? 0 : await generateSearchIndex();\n logger.indexDone(indexCount, Math.round(performance.now() - t), indexSkipped);\n\n logger.routes();\n\n await writeCache(cache);\n\n if (errors.length > 0) {\n console.error(`\\n\\u274C Build completed with ${errors.length} error(s)\\n`);\n process.exit(1);\n }\n}\n\nexport async function runBuildCli(): Promise<void> {\n try {\n await initSentry();\n await runBuild();\n } catch (err) {\n captureException(err);\n console.error(\"Build failed:\", err);\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;;;;;AAmHA,SAAgB,aAAa,OAA0C;CACrE,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,MAAM,IAAI;CACV,OAAO,OAAO,EAAE,SAAS,YAAY,OAAO,EAAE,UAAU,YAAY,OAAO,EAAE,YAAY;AAC3F;;;;;;;ACvGA,SAAgB,aACd,QACA,aACA,MACS;CACT,MAAM,UAAU,OAAO,MAAM,SAAS,QAAQ,QAAQ,EAAE,KAAK;CAG7D,MAAM,SAAkB;EACtB,KAHU,OAAO,GAAG,QAAQ,QAAQ,SAAS,GAAG,QAAQ;EAIxD,UAAU,OAAO,MAAM,SAAS;CAClC;CAGA,MAAM,QAAQ,iBAAiB,aAAa,OA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AI,KAAK,EAAE;GACpC,UAAU,KAAK,UAAU,EAAE,IAAI;GAC/B,YAAY,KAAK,UAAU,QAAQ,GAAG,EAAE,KAAK,MAAM;EACrD,EAAE;EACF,MAAM,QAAQ,SAAS,KAAK;CAC9B;CAEA,OAAO,WAAW;CAClB,IAAI,YAAY,IAAI;CAGpB,MAAM,eAAe,UAAU,KAAK,WAAW,KAAK,YAAY,mBAAmB,CAAC;CACpF,MAAM,aAAa,eAAe,IAAI,MAAM,oBAAoB;CAChE,OAAO,UAAU,YAAY,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,GAAG,YAAY;CAE5E,OAAO,OAAO;CAEd,MAAM,WAAW,KAAK;CAEtB,IAAI,OAAO,SAAS,GAAG;EACrB,QAAQ,MAAM,iCAAiC,OAAO,OAAO,YAAY;EACzE,QAAQ,KAAK,CAAC;CAChB;AACF;AAEA,eAAsB,cAA6B;CACjD,IAAI;EACF,MAAM,WAAW;EACjB,MAAM,SAAS;CACjB,SAAS,KAAK;EACZ,iBAAiB,GAAG;EACpB,QAAQ,MAAM,iBAAiB,GAAG;EAClC,QAAQ,KAAK,CAAC;CAChB;AACF"}
@@ -1,2 +0,0 @@
1
- import { n as runBuildCli } from "./build.impl-CT-YLyLn.js";
2
- export { runBuildCli };
@@ -1 +0,0 @@
1
- {"version":3,"file":"deploy.shared-CmOzm3b5.js","names":[],"sources":["../node/deploy.shared.ts"],"sourcesContent":["/**\n * Runtime-neutral deploy — 3 modes:\n * 1. `flame deploy` → build + generate GitHub Actions workflow\n * 2. `flame deploy --docker` → build + generate Docker deployment files\n * 3. `flame deploy --docker --silent` → same as #2, minimal output\n *\n * Mirror of deploy.ts (Bun-only, protected) for Node.js and Deno.\n * Runs the neutral build in-process, then prepares .docu/dist.\n */\n\nimport { writeFile, mkdir } from \"node:fs/promises\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport { DIST_DIR, PROJECT_ROOT, FRAMEWORK_ROOT } from \"./paths\";\n\nconst FLAME_MAJOR = JSON.parse(\n readFileSync(resolve(FRAMEWORK_ROOT, \"package.json\"), \"utf-8\")\n).version.split(\".\")[0];\n\nconst WORKFLOW_DIR = join(PROJECT_ROOT, \".github/workflows\");\nconst WORKFLOW_FILE = join(WORKFLOW_DIR, \"deploy.yml\");\n\nexport const NGINX_CONF = `server {\n listen 80;\n server_name _;\n root /usr/share/nginx/html;\n index index.html;\n\n gzip on;\n gzip_types text/html text/css application/javascript image/svg+xml;\n\n # Security headers (HSTS effective when HTTPS is terminated upstream)\n add_header X-Frame-Options \"DENY\" always;\n add_header X-Content-Type-Options \"nosniff\" always;\n add_header Strict-Transport-Security \"max-age=63072000; includeSubDomains\" always;\n add_header Referrer-Policy \"strict-origin-when-cross-origin\" always;\n add_header Permissions-Policy \"camera=(), microphone=(), geolocation=()\" always;\n add_header Content-Security-Policy \"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' https: data:; font-src 'self' data:; connect-src 'self' https:; frame-src https://www.youtube-nocookie.com; frame-ancestors 'none'\" always;\n\n location /assets/ {\n expires 1y;\n add_header Cache-Control \"public, immutable\";\n add_header X-Frame-Options \"DENY\" always;\n add_header X-Content-Type-Options \"nosniff\" always;\n add_header Strict-Transport-Security \"max-age=63072000; includeSubDomains\" always;\n add_header Referrer-Policy \"strict-origin-when-cross-origin\" always;\n add_header Permissions-Policy \"camera=(), microphone=(), geolocation=()\" always;\n add_header Content-Security-Policy \"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' https: data:; font-src 'self' data:; connect-src 'self' https:; frame-src https://www.youtube-nocookie.com; frame-ancestors 'none'\" always;\n }\n\n location /docs/assets/ {\n expires 7d;\n add_header Cache-Control \"public\";\n add_header X-Frame-Options \"DENY\" always;\n add_header X-Content-Type-Options \"nosniff\" always;\n add_header Strict-Transport-Security \"max-age=63072000; includeSubDomains\" always;\n add_header Referrer-Policy \"strict-origin-when-cross-origin\" always;\n add_header Permissions-Policy \"camera=(), microphone=(), geolocation=()\" always;\n add_header Content-Security-Policy \"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' https: data:; font-src 'self' data:; connect-src 'self' https:; frame-src https://www.youtube-nocookie.com; frame-ancestors 'none'\" always;\n }\n\n location / {\n try_files $uri $uri.html $uri/ =404;\n }\n}\n`;\n\nexport const DOCKERIGNORE = `node_modules\n*.DS_Store\n.docu/dist\n.docu/lib\n.env\n.env.*\n.npmrc\n*.log\n`;\n\nexport function detectPkgManager(dir: string): {\n baseImage: string;\n lockFile: string;\n installCmd: string;\n runCmd: string;\n cache: string;\n setupAction: string;\n} {\n const bunLockFile = existsSync(join(dir, \"bun.lock\"))\n ? \"bun.lock\"\n : existsSync(join(dir, \"bun.lockb\"))\n ? \"bun.lockb\"\n : null;\n if (bunLockFile) {\n return {\n baseImage: \"oven/bun:1-debian\",\n lockFile: bunLockFile,\n installCmd: \"bun install --frozen-lockfile\",\n runCmd: \"bun\",\n cache: \"\",\n setupAction: \"bun\",\n };\n }\n if (existsSync(join(dir, \"pnpm-lock.yaml\"))) {\n return {\n baseImage: \"node:22-alpine\",\n lockFile: \"pnpm-lock.yaml\",\n installCmd: \"corepack enable && pnpm install --frozen-lockfile\",\n runCmd: \"pnpm\",\n cache: \"pnpm\",\n setupAction: \"pnpm\",\n };\n }\n if (existsSync(join(dir, \"yarn.lock\"))) {\n return {\n baseImage: \"node:22-alpine\",\n lockFile: \"yarn.lock\",\n installCmd: \"yarn install --frozen-lockfile\",\n runCmd: \"yarn\",\n cache: \"yarn\",\n setupAction: \"node\",\n };\n }\n // default: npm\n return {\n baseImage: \"node:22-alpine\",\n lockFile: \"package-lock.json\",\n installCmd: \"npm ci\",\n runCmd: \"npm\",\n cache: \"npm\",\n setupAction: \"node\",\n };\n}\n\nexport const HEADERS_FILE = `/*\n X-Frame-Options: DENY\n X-Content-Type-Options: nosniff\n Strict-Transport-Security: max-age=63072000; includeSubDomains; preload\n Referrer-Policy: strict-origin-when-cross-origin\n Permissions-Policy: camera=(), microphone=(), geolocation=()\n Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' https: data:; font-src 'self' data:; connect-src 'self' https:; frame-src https://www.youtube-nocookie.com; frame-ancestors 'none'\n\n/assets/*\n Cache-Control: public, max-age=31536000, immutable\n`;\n\nconst isDocker = !!process.env.FLAME_DEPLOY_DOCKER;\nconst isSilent = !!process.env.FLAME_DEPLOY_SILENT;\nconst isCi = !!process.env.FLAME_DEPLOY_CI;\n\n/** Logger that no-ops all non-error output in silent mode. */\nconst log = isSilent\n ? { info: () => {}, ok: () => {}, created: () => {}, out: () => {} }\n : {\n info: (m: string) => console.log(m),\n ok: () => console.log(\"\\n✅ Ready to deploy!\"),\n created: (m: string) => console.log(m),\n out: (m: string) => console.log(m),\n };\n\nasync function runBuild() {\n process.env.NODE_ENV = \"production\";\n if (isSilent) {\n process.env.FLAME_BUILD_SILENT = \"1\";\n process.env.LOG_LEVEL = \"error\";\n }\n const { runBuildCli } = await import(\"./build.impl\");\n await runBuildCli();\n}\n\nasync function writeDockerFiles() {\n const dockerDir = PROJECT_ROOT;\n\n if (!existsSync(join(dockerDir, \"Dockerfile\"))) {\n await writeFile(\n join(dockerDir, \"Dockerfile\"),\n `FROM ghcr.io/docubook/flame:${FLAME_MAJOR} AS builder\nENV NODE_ENV=production\nWORKDIR /app\nCOPY . .\nRUN flame build\n\nFROM nginx:alpine\nCOPY --from=builder /app/.docu/dist /usr/share/nginx/html\nCOPY nginx.conf /etc/nginx/conf.d/default.conf\nEXPOSE 80\nCMD [\"nginx\", \"-g\", \"daemon off;\"]\n`\n );\n log.created(\"📄 Created Dockerfile\");\n }\n\n if (!existsSync(join(dockerDir, \"nginx.conf\"))) {\n await writeFile(join(dockerDir, \"nginx.conf\"), NGINX_CONF);\n log.created(\"📄 Created nginx.conf\");\n }\n\n if (!existsSync(join(dockerDir, \".dockerignore\"))) {\n await writeFile(join(dockerDir, \".dockerignore\"), DOCKERIGNORE);\n log.created(\"📄 Created .dockerignore\");\n }\n}\n\nfunction generateWorkflowYml(): string {\n const pm = detectPkgManager(PROJECT_ROOT);\n\n const setupSteps: string[] = [\n \" - uses: actions/checkout@v7\",\n \" with:\",\n \" fetch-depth: 0\",\n \"\",\n ];\n\n if (pm.setupAction === \"bun\") {\n setupSteps.push(\n \" - uses: oven-sh/setup-bun@v2\",\n \" with:\",\n \" bun-version: latest\",\n \"\"\n );\n } else if (pm.setupAction === \"pnpm\") {\n setupSteps.push(\n \" - uses: pnpm/action-setup@v6\",\n \"\",\n \" - uses: actions/setup-node@v6\",\n \" with:\",\n \" node-version: 22\",\n ` cache: ${pm.cache}`,\n \"\"\n );\n } else {\n // npm / yarn\n setupSteps.push(\n \" - uses: actions/setup-node@v6\",\n \" with:\",\n \" node-version: 22\",\n ` cache: ${pm.cache}`,\n \"\"\n );\n }\n\n return [\n `name: Deploy to GitHub Pages`,\n \"\",\n \"on:\",\n \" push:\",\n \" branches: [main]\",\n \" workflow_dispatch:\",\n \"\",\n \"permissions:\",\n \" contents: read\",\n \" pages: write\",\n \" id-token: write\",\n \"\",\n \"concurrency:\",\n ' group: \"pages\"',\n \" cancel-in-progress: false\",\n \"\",\n \"jobs:\",\n \" build:\",\n \" runs-on: ubuntu-latest\",\n \" steps:\",\n ...setupSteps,\n ` - run: ${pm.installCmd}`,\n \"\",\n ` - run: ${pm.runCmd} run build`,\n \"\",\n \" - name: Add .nojekyll\",\n \" run: touch .docu/dist/.nojekyll\",\n \"\",\n \" - uses: actions/upload-pages-artifact@v3\",\n \" with:\",\n \" path: .docu/dist\",\n \"\",\n \" deploy:\",\n \" environment:\",\n \" name: github-pages\",\n \" url: ${{ steps.deployment.outputs.page_url }}\",\n \" runs-on: ubuntu-latest\",\n \" needs: build\",\n \" steps:\",\n \" - id: deployment\",\n \" uses: actions/deploy-pages@v4\",\n ].join(\"\\n\");\n}\n\nfunction generateDockerWorkflowYml(): string {\n const imageName = \"ghcr.io/${{ github.repository }}\";\n return [\n `name: Build & Push Docker Image`,\n \"\",\n \"on:\",\n \" push:\",\n \" branches: [main]\",\n \" workflow_dispatch:\",\n \"\",\n \"permissions:\",\n \" contents: read\",\n \" packages: write\",\n \"\",\n \"jobs:\",\n \" build:\",\n \" runs-on: ubuntu-latest\",\n \" steps:\",\n \" - uses: actions/checkout@v4\",\n \" with:\",\n \" fetch-depth: 0\",\n \"\",\n \" - name: Log in to GHCR\",\n \" uses: docker/login-action@v3\",\n \" with:\",\n \" registry: ghcr.io\",\n \" username: ${{ github.actor }}\",\n \" password: ${{ secrets.GITHUB_TOKEN }}\",\n \"\",\n \" - name: Build & push\",\n \" uses: docker/build-push-action@v5\",\n \" with:\",\n \" context: .\",\n ` tags: ${imageName}:latest`,\n \" push: true\",\n ].join(\"\\n\");\n}\n\nasync function writeGhaWorkflow() {\n if (!existsSync(WORKFLOW_FILE)) {\n await mkdir(WORKFLOW_DIR, { recursive: true });\n await writeFile(WORKFLOW_FILE, generateWorkflowYml());\n log.created(\"📄 Created .github/workflows/deploy.yml\");\n }\n}\n\nconst DOCKER_WORKFLOW_FILE = join(WORKFLOW_DIR, \"deploy-docker.yml\");\n\nasync function writeDockerWorkflow() {\n if (!existsSync(DOCKER_WORKFLOW_FILE)) {\n await mkdir(WORKFLOW_DIR, { recursive: true });\n await writeFile(DOCKER_WORKFLOW_FILE, generateDockerWorkflowYml());\n log.created(\"📄 Created .github/workflows/deploy-docker.yml\");\n }\n}\n\nexport async function runDeploy(): Promise<void> {\n log.info(\"📦 Building for production...\\n\");\n await runBuild();\n\n // Common: .nojekyll + _headers\n await writeFile(join(DIST_DIR, \".nojekyll\"), \"\");\n await writeFile(join(DIST_DIR, \"_headers\"), HEADERS_FILE);\n\n if (isDocker) {\n await writeDockerFiles();\n if (isCi) await writeDockerWorkflow();\n } else {\n await writeGhaWorkflow();\n }\n\n log.ok();\n log.out(\" Output: .docu/dist/\");\n if (isDocker) {\n log.out(\" Build locally: docker build -t my-docs . && docker run -p 80:80 my-docs\");\n if (isCi) {\n log.out(\" Push to GitHub — CI will build & push Docker image to GHCR\");\n log.out(\" Then pull latest image on your hosting platform (Coolify, etc.)\");\n } else {\n log.out(\" For Coolify: connect repo, set build pack to Dockerfile\");\n }\n } else {\n log.out(\" Push to GitHub and enable Pages (Settings → Pages → Source: GitHub Actions)\");\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,IAAM,cAAc,KAAK,MACvB,aAAa,QAAQ,gBAAgB,cAAc,GAAG,OAAO,CAC/D,CAAC,CAAC,QAAQ,MAAM,GAAG,CAAC,CAAC;AAErB,IAAM,eAAe,KAAK,cAAc,mBAAmB;AAC3D,IAAM,gBAAgB,KAAK,cAAc,YAAY;AAErD,IAAa,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6C1B,IAAa,eAAe;;;;;;;;;AAU5B,SAAgB,iBAAiB,KAO/B;CACA,MAAM,cAAc,WAAW,KAAK,KAAK,UAAU,CAAC,IAChD,aACA,WAAW,KAAK,KAAK,WAAW,CAAC,IAC/B,cACA;CACN,IAAI,aACF,OAAO;EACL,WAAW;EACX,UAAU;EACV,YAAY;EACZ,QAAQ;EACR,OAAO;EACP,aAAa;CACf;CAEF,IAAI,WAAW,KAAK,KAAK,gBAAgB,CAAC,GACxC,OAAO;EACL,WAAW;EACX,UAAU;EACV,YAAY;EACZ,QAAQ;EACR,OAAO;EACP,aAAa;CACf;CAEF,IAAI,WAAW,KAAK,KAAK,WAAW,CAAC,GACnC,OAAO;EACL,WAAW;EACX,UAAU;EACV,YAAY;EACZ,QAAQ;EACR,OAAO;EACP,aAAa;CACf;CAGF,OAAO;EACL,WAAW;EACX,UAAU;EACV,YAAY;EACZ,QAAQ;EACR,OAAO;EACP,aAAa;CACf;AACF;AAEA,IAAa,eAAe;;;;;;;;;;;AAY5B,IAAM,WAAW,CAAC,CAAC,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