@docubook/flame 1.5.4 → 1.6.1

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.
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  runBuildCli
3
- } from "./chunk-NYCIAZTI.js";
4
- import "./chunk-C67LPMQA.js";
3
+ } from "./chunk-XX2VVJMV.js";
4
+ import "./chunk-IJFMQFWW.js";
5
5
  import "./chunk-EOK6KATZ.js";
6
- import "./chunk-GXQB4ETN.js";
7
- import "./chunk-J5NMYSBJ.js";
6
+ import "./chunk-2VUUBIN3.js";
7
+ import "./chunk-4IQXHHPF.js";
8
8
 
9
9
  // .docu/node/build.deno.ts
10
10
  await runBuildCli();
@@ -0,0 +1,12 @@
1
+ import {
2
+ runBuild,
3
+ runBuildCli
4
+ } from "./chunk-XX2VVJMV.js";
5
+ import "./chunk-IJFMQFWW.js";
6
+ import "./chunk-EOK6KATZ.js";
7
+ import "./chunk-2VUUBIN3.js";
8
+ import "./chunk-4IQXHHPF.js";
9
+ export {
10
+ runBuild,
11
+ runBuildCli
12
+ };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  runBuildCli
3
- } from "./chunk-NYCIAZTI.js";
4
- import "./chunk-C67LPMQA.js";
3
+ } from "./chunk-XX2VVJMV.js";
4
+ import "./chunk-IJFMQFWW.js";
5
5
  import "./chunk-EOK6KATZ.js";
6
- import "./chunk-GXQB4ETN.js";
7
- import "./chunk-J5NMYSBJ.js";
6
+ import "./chunk-2VUUBIN3.js";
7
+ import "./chunk-4IQXHHPF.js";
8
8
 
9
9
  // .docu/node/build.node.ts
10
10
  await runBuildCli();
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  loadDocuConfig
3
- } from "./chunk-J5NMYSBJ.js";
3
+ } from "./chunk-4IQXHHPF.js";
4
4
 
5
5
  // package.json
6
6
  var package_default = {
7
7
  name: "@docubook/flame",
8
- version: "1.5.4",
8
+ version: "1.6.1",
9
9
  description: "A blazing-fast React + MDX framework powered by Bun, built for modern documentation experiences.",
10
10
  type: "module",
11
11
  bin: {
@@ -16,10 +16,11 @@ var DOCS_DIR = join(PROJECT_ROOT, "docs");
16
16
  var DOCS_ASSETS_DIR = join(PROJECT_ROOT, "docs/assets");
17
17
  var DOCU_CONFIG_PATH = join(PROJECT_ROOT, "docu.json");
18
18
  var _config = null;
19
- async function cleanOldBundles() {
19
+ async function cleanOldBundles(preserve) {
20
20
  try {
21
21
  const files = await readdir(ASSETS_DIR);
22
22
  for (const file of files) {
23
+ if (preserve?.has(file)) continue;
23
24
  if (file.startsWith("client.") || file.startsWith("client-")) {
24
25
  await unlink(join(ASSETS_DIR, file));
25
26
  }
@@ -32,7 +33,9 @@ async function cleanOldBundles() {
32
33
  try {
33
34
  await rm(join(ASSETS_DIR, "chunks"), { recursive: true, force: true });
34
35
  } catch (err) {
35
- console.error("Failed to clean old chunks:", err.message);
36
+ if (err.code !== "ENOENT") {
37
+ console.warn("[flame] Failed to clean chunks dir:", err.message);
38
+ }
36
39
  }
37
40
  }
38
41
  function loadDocuConfig() {
@@ -0,0 +1,271 @@
1
+ import {
2
+ DIST_DIR,
3
+ PROJECT_ROOT
4
+ } from "./chunk-4IQXHHPF.js";
5
+
6
+ // .docu/node/deploy.shared.ts
7
+ import { writeFile, mkdir } from "node:fs/promises";
8
+ import { existsSync } from "node:fs";
9
+ import { join } from "node:path";
10
+ var WORKFLOW_DIR = join(PROJECT_ROOT, ".github/workflows");
11
+ var WORKFLOW_FILE = join(WORKFLOW_DIR, "deploy.yml");
12
+ var NGINX_CONF = `server {
13
+ listen 80;
14
+ server_name _;
15
+ root /usr/share/nginx/html;
16
+ index index.html;
17
+
18
+ gzip on;
19
+ gzip_types text/html text/css application/javascript image/svg+xml;
20
+
21
+ # Security headers (HSTS effective when HTTPS is terminated upstream)
22
+ add_header X-Frame-Options "DENY" always;
23
+ add_header X-Content-Type-Options "nosniff" always;
24
+ add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
25
+ add_header Referrer-Policy "strict-origin-when-cross-origin" always;
26
+ add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
27
+
28
+ location /assets/ {
29
+ expires 1y;
30
+ add_header Cache-Control "public, immutable";
31
+ add_header X-Frame-Options "DENY" always;
32
+ add_header X-Content-Type-Options "nosniff" always;
33
+ add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
34
+ add_header Referrer-Policy "strict-origin-when-cross-origin" always;
35
+ add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
36
+ }
37
+
38
+ location /docs/assets/ {
39
+ expires 7d;
40
+ add_header Cache-Control "public";
41
+ add_header X-Frame-Options "DENY" always;
42
+ add_header X-Content-Type-Options "nosniff" always;
43
+ add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
44
+ add_header Referrer-Policy "strict-origin-when-cross-origin" always;
45
+ add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
46
+ }
47
+
48
+ location / {
49
+ try_files $uri $uri.html $uri/ =404;
50
+ }
51
+ }
52
+ `;
53
+ var DOCKERIGNORE = `node_modules
54
+ .git
55
+ *.DS_Store
56
+ .docu/dist
57
+ .docu/lib
58
+ .env
59
+ .env.*
60
+ .npmrc
61
+ *.log
62
+ `;
63
+ function detectPkgManager(dir) {
64
+ const bunLockFile = existsSync(join(dir, "bun.lock")) ? "bun.lock" : existsSync(join(dir, "bun.lockb")) ? "bun.lockb" : null;
65
+ if (bunLockFile) {
66
+ return {
67
+ baseImage: "oven/bun:1",
68
+ lockFile: bunLockFile,
69
+ installCmd: "bun install --frozen-lockfile",
70
+ runCmd: "bun",
71
+ cache: "",
72
+ setupAction: "bun"
73
+ };
74
+ }
75
+ if (existsSync(join(dir, "pnpm-lock.yaml"))) {
76
+ return {
77
+ baseImage: "node:22-alpine",
78
+ lockFile: "pnpm-lock.yaml",
79
+ installCmd: "corepack enable && pnpm install --frozen-lockfile",
80
+ runCmd: "pnpm",
81
+ cache: "pnpm",
82
+ setupAction: "pnpm"
83
+ };
84
+ }
85
+ if (existsSync(join(dir, "yarn.lock"))) {
86
+ return {
87
+ baseImage: "node:22-alpine",
88
+ lockFile: "yarn.lock",
89
+ installCmd: "yarn install --frozen-lockfile",
90
+ runCmd: "yarn",
91
+ cache: "yarn",
92
+ setupAction: "node"
93
+ };
94
+ }
95
+ return {
96
+ baseImage: "node:22-alpine",
97
+ lockFile: "package-lock.json",
98
+ installCmd: "npm ci",
99
+ runCmd: "npm",
100
+ cache: "npm",
101
+ setupAction: "node"
102
+ };
103
+ }
104
+ var HEADERS_FILE = `/*
105
+ X-Frame-Options: DENY
106
+ X-Content-Type-Options: nosniff
107
+ Referrer-Policy: strict-origin-when-cross-origin
108
+
109
+ /assets/*
110
+ Cache-Control: public, max-age=31536000, immutable
111
+ `;
112
+ var isDocker = !!process.env.FLAME_DEPLOY_DOCKER;
113
+ var isSilent = !!process.env.FLAME_DEPLOY_SILENT;
114
+ var log = isSilent ? { info: () => {
115
+ }, ok: () => {
116
+ }, created: () => {
117
+ }, out: () => {
118
+ } } : {
119
+ info: (m) => console.log(m),
120
+ ok: () => console.log("\n\u2705 Ready to deploy!"),
121
+ created: (m) => console.log(m),
122
+ out: (m) => console.log(m)
123
+ };
124
+ async function runBuild() {
125
+ process.env.NODE_ENV = "production";
126
+ if (isSilent) {
127
+ process.env.FLAME_BUILD_SILENT = "1";
128
+ process.env.LOG_LEVEL = "error";
129
+ }
130
+ const { runBuildCli } = await import("./build.impl-5VMX2INF.js");
131
+ await runBuildCli();
132
+ }
133
+ async function writeDockerFiles() {
134
+ const dockerDir = PROJECT_ROOT;
135
+ const pm = detectPkgManager(dockerDir);
136
+ if (!existsSync(join(dockerDir, "Dockerfile"))) {
137
+ await writeFile(
138
+ join(dockerDir, "Dockerfile"),
139
+ `FROM ${pm.baseImage} AS builder
140
+ WORKDIR /app
141
+ COPY package.json ${pm.lockFile} ./
142
+ RUN ${pm.installCmd}
143
+ COPY . .
144
+ RUN ${pm.runCmd} run build
145
+
146
+ FROM nginx:alpine
147
+ COPY --from=builder /app/.docu/dist /usr/share/nginx/html
148
+ COPY nginx.conf /etc/nginx/conf.d/default.conf
149
+ USER nginx
150
+ EXPOSE 80
151
+ CMD ["nginx", "-g", "daemon off;"]
152
+ `
153
+ );
154
+ log.created("\u{1F4C4} Created Dockerfile");
155
+ }
156
+ if (!existsSync(join(dockerDir, "nginx.conf"))) {
157
+ await writeFile(join(dockerDir, "nginx.conf"), NGINX_CONF);
158
+ log.created("\u{1F4C4} Created nginx.conf");
159
+ }
160
+ if (!existsSync(join(dockerDir, ".dockerignore"))) {
161
+ await writeFile(join(dockerDir, ".dockerignore"), DOCKERIGNORE);
162
+ log.created("\u{1F4C4} Created .dockerignore");
163
+ }
164
+ }
165
+ function generateWorkflowYml() {
166
+ const pm = detectPkgManager(PROJECT_ROOT);
167
+ const setupSteps = [
168
+ " - uses: actions/checkout@v7",
169
+ " with:",
170
+ " fetch-depth: 0",
171
+ ""
172
+ ];
173
+ if (pm.setupAction === "bun") {
174
+ setupSteps.push(
175
+ " - uses: oven-sh/setup-bun@v2",
176
+ " with:",
177
+ " bun-version: latest",
178
+ ""
179
+ );
180
+ } else if (pm.setupAction === "pnpm") {
181
+ setupSteps.push(
182
+ " - uses: pnpm/action-setup@v6",
183
+ "",
184
+ " - uses: actions/setup-node@v6",
185
+ " with:",
186
+ " node-version: 22",
187
+ ` cache: ${pm.cache}`,
188
+ ""
189
+ );
190
+ } else {
191
+ setupSteps.push(
192
+ " - uses: actions/setup-node@v6",
193
+ " with:",
194
+ " node-version: 22",
195
+ ` cache: ${pm.cache}`,
196
+ ""
197
+ );
198
+ }
199
+ return [
200
+ `name: Deploy to GitHub Pages`,
201
+ "",
202
+ "on:",
203
+ " push:",
204
+ " branches: [main]",
205
+ " workflow_dispatch:",
206
+ "",
207
+ "permissions:",
208
+ " contents: read",
209
+ " pages: write",
210
+ " id-token: write",
211
+ "",
212
+ "concurrency:",
213
+ ' group: "pages"',
214
+ " cancel-in-progress: false",
215
+ "",
216
+ "jobs:",
217
+ " build:",
218
+ " runs-on: ubuntu-latest",
219
+ " steps:",
220
+ ...setupSteps,
221
+ ` - run: ${pm.installCmd}`,
222
+ "",
223
+ ` - run: ${pm.runCmd} run build`,
224
+ "",
225
+ " - name: Add .nojekyll",
226
+ " run: touch .docu/dist/.nojekyll",
227
+ "",
228
+ " - uses: actions/upload-pages-artifact@v3",
229
+ " with:",
230
+ " path: .docu/dist",
231
+ "",
232
+ " deploy:",
233
+ " environment:",
234
+ " name: github-pages",
235
+ " url: ${{ steps.deployment.outputs.page_url }}",
236
+ " runs-on: ubuntu-latest",
237
+ " needs: build",
238
+ " steps:",
239
+ " - id: deployment",
240
+ " uses: actions/deploy-pages@v4"
241
+ ].join("\n");
242
+ }
243
+ async function writeGhaWorkflow() {
244
+ if (!existsSync(WORKFLOW_FILE)) {
245
+ await mkdir(WORKFLOW_DIR, { recursive: true });
246
+ await writeFile(WORKFLOW_FILE, generateWorkflowYml());
247
+ log.created("\u{1F4C4} Created .github/workflows/deploy.yml");
248
+ }
249
+ }
250
+ async function runDeploy() {
251
+ log.info("\u{1F4E6} Building for production...\n");
252
+ await runBuild();
253
+ await writeFile(join(DIST_DIR, ".nojekyll"), "");
254
+ await writeFile(join(DIST_DIR, "_headers"), HEADERS_FILE);
255
+ if (isDocker) {
256
+ await writeDockerFiles();
257
+ } else {
258
+ await writeGhaWorkflow();
259
+ }
260
+ log.ok();
261
+ log.out(" Output: .docu/dist/");
262
+ if (isDocker) {
263
+ log.out(" Run: docker build -t my-docs . && docker run -p 80:80 my-docs");
264
+ } else {
265
+ log.out(" Push to GitHub and enable Pages (Settings \u2192 Pages \u2192 Source: GitHub Actions)");
266
+ }
267
+ }
268
+
269
+ export {
270
+ runDeploy
271
+ };
@@ -14,7 +14,7 @@ import {
14
14
  htmlShell,
15
15
  initSentry,
16
16
  loadPlugins
17
- } from "./chunk-C67LPMQA.js";
17
+ } from "./chunk-IJFMQFWW.js";
18
18
  import {
19
19
  SECURITY_HEADERS,
20
20
  generateNonce,
@@ -27,13 +27,13 @@ import {
27
27
  } from "./chunk-EOK6KATZ.js";
28
28
  import {
29
29
  logger
30
- } from "./chunk-GXQB4ETN.js";
30
+ } from "./chunk-2VUUBIN3.js";
31
31
  import {
32
32
  DIST_DIR,
33
33
  DOCS_DIR,
34
34
  PROJECT_ROOT,
35
35
  loadDocuConfig
36
- } from "./chunk-J5NMYSBJ.js";
36
+ } from "./chunk-4IQXHHPF.js";
37
37
 
38
38
  // .docu/node/server.impl.ts
39
39
  import { watch } from "node:fs";
@@ -240,7 +240,7 @@ function serveStatic(pathname) {
240
240
  }
241
241
  function serverErrorResponse(error) {
242
242
  const msg = error instanceof Error ? error.message : "Unknown error";
243
- const st = error instanceof Error ? error.stack : void 0;
243
+ const st = process.env.NODE_ENV !== "production" && error instanceof Error ? error.stack : void 0;
244
244
  return new Response(errorHtml(msg, st), {
245
245
  status: 500,
246
246
  headers: {
@@ -15,7 +15,7 @@ import {
15
15
  STYLES_DIR,
16
16
  cleanOldBundles,
17
17
  loadDocuConfig
18
- } from "./chunk-J5NMYSBJ.js";
18
+ } from "./chunk-4IQXHHPF.js";
19
19
 
20
20
  // .docu/node/plugin-loader.ts
21
21
  import { resolve } from "node:path";
@@ -706,9 +706,29 @@ function resolveTailwindBin() {
706
706
  const binRel = typeof pkg.bin === "string" ? pkg.bin : pkg.bin.tailwindcss;
707
707
  return join2(dirname(pkgPath), binRel);
708
708
  }
709
- async function runTailwind(outputCss) {
709
+ function tailwindCacheKey() {
710
+ const globalsPath = join2(STYLES_DIR, "globals.css");
711
+ const globalsContent = existsSync(globalsPath) ? readFileSync(globalsPath, "utf-8") : "";
712
+ let themeSuffix = "";
713
+ try {
714
+ const themeColors = getThemeConfig();
715
+ if (themeColors) {
716
+ themeSuffix = JSON.stringify(themeColors);
717
+ }
718
+ } catch {
719
+ }
720
+ return createHash("md5").update(globalsContent + themeSuffix).digest("hex").slice(0, 16);
721
+ }
722
+ async function buildTailwindCss(key) {
723
+ const cachedFile = `client-${key}.css`;
724
+ const cachedPath = join2(ASSETS_DIR, cachedFile);
725
+ if (existsSync(cachedPath)) {
726
+ const content = readFileSync(cachedPath, "utf-8");
727
+ return { file: cachedFile, content };
728
+ }
729
+ const tmpCss = join2(ASSETS_DIR, `_tmp-${key}.css`);
710
730
  const bin = resolveTailwindBin();
711
- const twArgs = ["-i", join2(STYLES_DIR, "globals.css"), "-o", outputCss, "--minify"];
731
+ const twArgs = ["-i", join2(STYLES_DIR, "globals.css"), "-o", tmpCss, "--minify"];
712
732
  const isDeno = "Deno" in globalThis;
713
733
  const args = isDeno ? ["run", "-A", bin, ...twArgs] : [bin, ...twArgs];
714
734
  try {
@@ -718,6 +738,24 @@ async function runTailwind(outputCss) {
718
738
  throw new Error(`Tailwind CSS build failed:
719
739
  ${stderr}`, { cause: err });
720
740
  }
741
+ let cssContent = await readFile(tmpCss, "utf-8");
742
+ await unlink(tmpCss);
743
+ try {
744
+ const themeColors = getThemeConfig();
745
+ if (themeColors) {
746
+ cssContent = buildThemeCss(cssContent, themeColors);
747
+ }
748
+ } catch (err) {
749
+ console.warn(
750
+ `[flame] Failed to resolve theme config, falling back to globals.css only: ${err instanceof Error ? err.message : String(err)}`
751
+ );
752
+ }
753
+ const cssFile = `client-${key}.css`;
754
+ const outPath = join2(ASSETS_DIR, cssFile);
755
+ if (!existsSync(outPath)) {
756
+ await writeFile(outPath, cssContent);
757
+ }
758
+ return { file: cssFile, content: cssContent };
721
759
  }
722
760
  var NODE_BUILTINS_RE = new RegExp(
723
761
  `^(node:.*|${builtinModules.map((m) => m.replace(/\//g, "\\/")).join("|")})$`
@@ -749,7 +787,10 @@ function scanDirLucideIcons(dir, set) {
749
787
  }
750
788
  }
751
789
  }
752
- } catch {
790
+ } catch (err) {
791
+ console.warn(
792
+ `[flame] Failed to scan lucide icons: ${err instanceof Error ? err.message : String(err)}`
793
+ );
753
794
  }
754
795
  }
755
796
  function collectAllLucideIcons() {
@@ -768,7 +809,8 @@ function collectAllLucideIcons() {
768
809
  }
769
810
  async function buildClientBundle() {
770
811
  await mkdir(ASSETS_DIR, { recursive: true });
771
- await cleanOldBundles();
812
+ const twKey = tailwindCacheKey();
813
+ await cleanOldBundles(/* @__PURE__ */ new Set([`client-${twKey}.css`]));
772
814
  const nodeEnv = process.env.NODE_ENV || "development";
773
815
  const esbuild = await import("esbuild");
774
816
  const { build } = esbuild;
@@ -781,10 +823,8 @@ async function buildClientBundle() {
781
823
  bundle: true,
782
824
  outdir: ASSETS_DIR,
783
825
  entryNames: "client-[hash]",
784
- chunkNames: "chunks/[name]-[hash]",
785
826
  platform: "browser",
786
827
  format: "esm",
787
- splitting: true,
788
828
  minify: nodeEnv === "production",
789
829
  define: { "process.env.NODE_ENV": JSON.stringify(nodeEnv) },
790
830
  jsx: "automatic",
@@ -814,7 +854,7 @@ async function buildClientBundle() {
814
854
  }
815
855
  if (args.importer) {
816
856
  const normalized = normalizeImporterPath(args.importer);
817
- if (normalized.endsWith("/.docu/components/Lucide.tsx") || normalized.includes("/mdx-content/dist/")) {
857
+ if (normalized.includes("/mdx-content/dist/")) {
818
858
  return { path: getLucideRealEntry(), namespace: "file" };
819
859
  }
820
860
  }
@@ -862,23 +902,7 @@ async function buildClientBundle() {
862
902
  throw new Error("Client bundle produced no output files");
863
903
  }
864
904
  const jsFile = basename(jsOutput);
865
- const tmpCss = join2(ASSETS_DIR, "_tmp.css");
866
- await runTailwind(tmpCss);
867
- let cssContent = await readFile(tmpCss, "utf-8");
868
- try {
869
- const themeColors = getThemeConfig();
870
- if (themeColors) {
871
- cssContent = buildThemeCss(cssContent, themeColors);
872
- }
873
- } catch (err) {
874
- console.warn(
875
- `[flame] Failed to resolve theme config, falling back to globals.css only: ${err instanceof Error ? err.message : String(err)}`
876
- );
877
- }
878
- const cssHash = createHash("md5").update(cssContent).digest("hex").slice(0, 8);
879
- const cssFile = `client-${cssHash}.css`;
880
- await writeFile(join2(ASSETS_DIR, cssFile), cssContent);
881
- await unlink(tmpCss);
905
+ const { file: cssFile } = await buildTailwindCss(twKey);
882
906
  await writeFile(join2(ASSETS_DIR, "manifest.json"), JSON.stringify({ js: jsFile, css: cssFile }));
883
907
  return { js: jsFile, css: cssFile };
884
908
  }
@@ -2361,6 +2385,7 @@ function htmlShell(opts) {
2361
2385
  <title>${escapeHtml(title)}</title>
2362
2386
  <meta name="description" content="${escapeHtml(description)}">
2363
2387
  ${favicon ? `<link rel="icon" type="image/x-icon" href="${escapeHtml(resolvePath(favicon))}">` : ""}${themeStyle}
2388
+ <link rel="preload" href="${escapeHtml(assetPrefix + css)}" as="style">
2364
2389
  <link rel="stylesheet" href="${escapeHtml(assetPrefix + css)}">
2365
2390
  ${csp ? `<meta http-equiv="Content-Security-Policy" content="${escapeHtml(csp)}">` : ""}
2366
2391
  ${seoTags}
@@ -2368,6 +2393,7 @@ function htmlShell(opts) {
2368
2393
  </head>
2369
2394
  <body>
2370
2395
  <div id="root">${body}</div>
2396
+ <link rel="modulepreload" href="${escapeHtml(assetPrefix + js)}">
2371
2397
  <script type="module"${nonceAttr} src="${escapeHtml(assetPrefix + js)}"></script>${extraScripts ? `
2372
2398
  ${extraScripts}` : ""}${bodyInjection}
2373
2399
  </body>
@@ -7,10 +7,10 @@ import {
7
7
  } from "./chunk-EOK6KATZ.js";
8
8
  import {
9
9
  logger
10
- } from "./chunk-GXQB4ETN.js";
10
+ } from "./chunk-2VUUBIN3.js";
11
11
  import {
12
12
  DIST_DIR
13
- } from "./chunk-J5NMYSBJ.js";
13
+ } from "./chunk-4IQXHHPF.js";
14
14
 
15
15
  // .docu/node/preview.impl.ts
16
16
  import { existsSync, statSync, readFileSync } from "node:fs";
@@ -13,14 +13,15 @@ import {
13
13
  htmlShell,
14
14
  initSentry,
15
15
  loadPlugins
16
- } from "./chunk-C67LPMQA.js";
16
+ } from "./chunk-IJFMQFWW.js";
17
17
  import {
18
+ cspHeader,
18
19
  generateNonce,
19
20
  scanMdxFiles
20
21
  } from "./chunk-EOK6KATZ.js";
21
22
  import {
22
23
  logger
23
- } from "./chunk-GXQB4ETN.js";
24
+ } from "./chunk-2VUUBIN3.js";
24
25
  import {
25
26
  ASSETS_DIR,
26
27
  CACHE_FILE,
@@ -29,7 +30,7 @@ import {
29
30
  DOCS_DIR,
30
31
  PROJECT_ROOT,
31
32
  loadDocuConfig
32
- } from "./chunk-J5NMYSBJ.js";
33
+ } from "./chunk-4IQXHHPF.js";
33
34
 
34
35
  // .docu/node/build.impl.ts
35
36
  import { readFile, writeFile, mkdir, readdir, copyFile } from "node:fs/promises";
@@ -145,12 +146,14 @@ ${msg}`, { cause: err });
145
146
  const depth = slug ? slug.split("/").length : 1;
146
147
  const favicon = docuConfig.meta?.favicon || "/docs/assets/images/favicon.ico";
147
148
  const seo = buildSeoMeta(docuConfig, frontmatter, slug || "");
149
+ const csp = cspHeader(nonce, process.env.NODE_ENV !== "production");
148
150
  let html = htmlShell({
149
151
  title,
150
152
  description,
151
153
  body,
152
154
  favicon,
153
155
  seo,
156
+ csp,
154
157
  css: assetManifest.css,
155
158
  js: assetManifest.js,
156
159
  nonce,
@@ -322,15 +325,17 @@ async function runBuild() {
322
325
  const landingPage = React.createElement(IndexPage);
323
326
  const landingFavicon = docuConfig.meta?.favicon || "/docs/assets/images/favicon.ico";
324
327
  const landingSeo = buildSeoMeta(docuConfig, docuConfig.meta, "");
328
+ const landingNonce = generateNonce();
325
329
  const landingHtml = htmlShell({
326
330
  title: docuConfig.meta?.title || "DocuBook",
327
331
  description: docuConfig.meta?.description || "",
328
332
  body: renderToString(landingPage),
329
333
  favicon: landingFavicon,
330
334
  seo: landingSeo,
335
+ csp: cspHeader(landingNonce, process.env.NODE_ENV !== "production"),
331
336
  css: assetManifest.css,
332
337
  js: assetManifest.js,
333
- nonce: generateNonce(),
338
+ nonce: landingNonce,
334
339
  themeCss: inlineThemeCss
335
340
  });
336
341
  await writeFile(join(DIST_DIR, "index.html"), landingHtml);
@@ -340,15 +345,17 @@ async function runBuild() {
340
345
  React.createElement(NotFoundPage)
341
346
  );
342
347
  const notFoundFavicon = docuConfig.meta?.favicon || "/docs/assets/images/favicon.ico";
348
+ const notFoundNonce = generateNonce();
343
349
  const notFoundHtml = htmlShell({
344
350
  title: "404 - Not Found",
345
351
  description: "",
346
352
  body: renderToString(notFoundPage),
347
353
  favicon: notFoundFavicon,
348
354
  headExtra: ['<meta name="robots" content="noindex,follow">'],
355
+ csp: cspHeader(notFoundNonce, process.env.NODE_ENV !== "production"),
349
356
  css: assetManifest.css,
350
357
  js: assetManifest.js,
351
- nonce: generateNonce(),
358
+ nonce: notFoundNonce,
352
359
  themeCss: inlineThemeCss
353
360
  });
354
361
  await writeFile(join(DIST_DIR, "404.html"), notFoundHtml);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-GXQB4ETN.js";
4
- import "./chunk-J5NMYSBJ.js";
3
+ } from "./chunk-2VUUBIN3.js";
4
+ import "./chunk-4IQXHHPF.js";
5
5
 
6
6
  // .docu/node/clean.ts
7
7
  import { rm } from "node:fs/promises";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  runDeploy
3
- } from "./chunk-VKMZLLG5.js";
4
- import "./chunk-J5NMYSBJ.js";
3
+ } from "./chunk-EINCC7ET.js";
4
+ import "./chunk-4IQXHHPF.js";
5
5
 
6
6
  // .docu/node/deploy.deno.ts
7
7
  try {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  runDeploy
3
- } from "./chunk-VKMZLLG5.js";
4
- import "./chunk-J5NMYSBJ.js";
3
+ } from "./chunk-EINCC7ET.js";
4
+ import "./chunk-4IQXHHPF.js";
5
5
 
6
6
  // .docu/node/deploy.node.ts
7
7
  runDeploy().catch((err) => {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  runPreview
3
- } from "./chunk-XLH7Z4QO.js";
3
+ } from "./chunk-P3ZT4S3D.js";
4
4
  import "./chunk-EOK6KATZ.js";
5
- import "./chunk-GXQB4ETN.js";
6
- import "./chunk-J5NMYSBJ.js";
5
+ import "./chunk-2VUUBIN3.js";
6
+ import "./chunk-4IQXHHPF.js";
7
7
 
8
8
  // .docu/node/preview.deno.ts
9
9
  import { denoAdapter } from "@docubook/runt";