@docubook/flame 1.5.1 → 1.5.2

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,9 +1,9 @@
1
1
  import {
2
2
  runBuildCli
3
- } from "./chunk-E4OIJWCU.js";
4
- import "./chunk-AI7QAMMZ.js";
5
- import "./chunk-RE4NGTMT.js";
6
- import "./chunk-PTRZ2S2C.js";
3
+ } from "./chunk-7J3N2MCP.js";
4
+ import "./chunk-QGEFJH47.js";
5
+ import "./chunk-EOK6KATZ.js";
6
+ import "./chunk-GLOJMRT4.js";
7
7
  import "./chunk-J5NMYSBJ.js";
8
8
 
9
9
  // .docu/node/build.deno.ts
@@ -0,0 +1,12 @@
1
+ import {
2
+ runBuild,
3
+ runBuildCli
4
+ } from "./chunk-7J3N2MCP.js";
5
+ import "./chunk-QGEFJH47.js";
6
+ import "./chunk-EOK6KATZ.js";
7
+ import "./chunk-GLOJMRT4.js";
8
+ import "./chunk-J5NMYSBJ.js";
9
+ export {
10
+ runBuild,
11
+ runBuildCli
12
+ };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  runBuildCli
3
- } from "./chunk-E4OIJWCU.js";
4
- import "./chunk-AI7QAMMZ.js";
5
- import "./chunk-RE4NGTMT.js";
6
- import "./chunk-PTRZ2S2C.js";
3
+ } from "./chunk-7J3N2MCP.js";
4
+ import "./chunk-QGEFJH47.js";
5
+ import "./chunk-EOK6KATZ.js";
6
+ import "./chunk-GLOJMRT4.js";
7
7
  import "./chunk-J5NMYSBJ.js";
8
8
 
9
9
  // .docu/node/build.node.ts
@@ -13,14 +13,14 @@ import {
13
13
  htmlShell,
14
14
  initSentry,
15
15
  loadPlugins
16
- } from "./chunk-AI7QAMMZ.js";
16
+ } from "./chunk-QGEFJH47.js";
17
17
  import {
18
18
  generateNonce,
19
19
  scanMdxFiles
20
- } from "./chunk-RE4NGTMT.js";
20
+ } from "./chunk-EOK6KATZ.js";
21
21
  import {
22
22
  logger
23
- } from "./chunk-PTRZ2S2C.js";
23
+ } from "./chunk-GLOJMRT4.js";
24
24
  import {
25
25
  ASSETS_DIR,
26
26
  CACHE_FILE,
@@ -1,4 +1,5 @@
1
1
  // .docu/node/security.ts
2
+ import { randomBytes } from "node:crypto";
2
3
  import { resolve } from "node:path";
3
4
  import { realpathSync } from "node:fs";
4
5
  var SECURITY_HEADERS = {
@@ -9,7 +10,7 @@ var SECURITY_HEADERS = {
9
10
  "Permissions-Policy": "camera=(), microphone=(), geolocation=()"
10
11
  };
11
12
  function generateNonce() {
12
- return crypto.randomUUID();
13
+ return randomBytes(16).toString("base64");
13
14
  }
14
15
  function cspHeader(nonce, allowEval = false) {
15
16
  const scriptSrc = allowEval ? `script-src 'self' 'nonce-${nonce}' 'unsafe-eval'` : `script-src 'self' 'nonce-${nonce}'`;
@@ -89,11 +90,16 @@ function wrapPluginResponse(pluginResponse, allowEval = false) {
89
90
  securedHeaders.set(key, value);
90
91
  }
91
92
  }
93
+ let body = pluginResponse.body;
92
94
  const contentType = securedHeaders.get("Content-Type") || "";
93
95
  if (contentType.includes("text/html") && !securedHeaders.has("Content-Security-Policy")) {
94
- securedHeaders.set("Content-Security-Policy", cspHeader(generateNonce(), allowEval));
96
+ const nonce = generateNonce();
97
+ securedHeaders.set("Content-Security-Policy", cspHeader(nonce, allowEval));
98
+ if (typeof body === "string") {
99
+ body = injectNonce(body, nonce);
100
+ }
95
101
  }
96
- return new Response(pluginResponse.body, {
102
+ return new Response(body, {
97
103
  status: pluginResponse.status,
98
104
  statusText: pluginResponse.statusText,
99
105
  headers: securedHeaders
@@ -5,7 +5,7 @@ import {
5
5
  // package.json
6
6
  var package_default = {
7
7
  name: "@docubook/flame",
8
- version: "1.5.1",
8
+ version: "1.5.2",
9
9
  description: "A blazing-fast React + MDX framework powered by Bun, built for modern documentation experiences.",
10
10
  type: "module",
11
11
  bin: {
@@ -12,7 +12,7 @@ var WORKFLOW_FILE = join(WORKFLOW_DIR, "deploy.yml");
12
12
  async function runDeploy() {
13
13
  console.log("\u{1F4E6} Building for production...\n");
14
14
  process.env.NODE_ENV = "production";
15
- const { runBuildCli } = await import("./build.impl-7KJ4ZTAJ.js");
15
+ const { runBuildCli } = await import("./build.impl-FA57P3VC.js");
16
16
  await runBuildCli();
17
17
  await writeFile(join(DIST_DIR, ".nojekyll"), "");
18
18
  if (!existsSync(WORKFLOW_FILE)) {
@@ -4,10 +4,10 @@ import {
4
4
  generateNonce,
5
5
  getContentType,
6
6
  injectNonce
7
- } from "./chunk-RE4NGTMT.js";
7
+ } from "./chunk-EOK6KATZ.js";
8
8
  import {
9
9
  logger
10
- } from "./chunk-PTRZ2S2C.js";
10
+ } from "./chunk-GLOJMRT4.js";
11
11
  import {
12
12
  DIST_DIR
13
13
  } from "./chunk-J5NMYSBJ.js";
@@ -5,7 +5,7 @@ import {
5
5
  isExternalUrl,
6
6
  normalizeImporterPath,
7
7
  scanMdxFiles
8
- } from "./chunk-RE4NGTMT.js";
8
+ } from "./chunk-EOK6KATZ.js";
9
9
  import {
10
10
  ASSETS_DIR,
11
11
  DOCS_DIR,
@@ -1031,6 +1031,7 @@ async function initSentry() {
1031
1031
  initialized = true;
1032
1032
  } catch {
1033
1033
  sentry = null;
1034
+ initialized = false;
1034
1035
  }
1035
1036
  }
1036
1037
  function captureException(err, context) {
@@ -14,7 +14,7 @@ import {
14
14
  htmlShell,
15
15
  initSentry,
16
16
  loadPlugins
17
- } from "./chunk-AI7QAMMZ.js";
17
+ } from "./chunk-QGEFJH47.js";
18
18
  import {
19
19
  SECURITY_HEADERS,
20
20
  generateNonce,
@@ -24,10 +24,10 @@ import {
24
24
  isSlugSafe,
25
25
  stripDocsHtmlSuffix,
26
26
  wrapPluginResponse
27
- } from "./chunk-RE4NGTMT.js";
27
+ } from "./chunk-EOK6KATZ.js";
28
28
  import {
29
29
  logger
30
- } from "./chunk-PTRZ2S2C.js";
30
+ } from "./chunk-GLOJMRT4.js";
31
31
  import {
32
32
  DIST_DIR,
33
33
  DOCS_DIR,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-PTRZ2S2C.js";
3
+ } from "./chunk-GLOJMRT4.js";
4
4
  import "./chunk-J5NMYSBJ.js";
5
5
 
6
6
  // .docu/node/clean.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runDeploy
3
- } from "./chunk-IR5TVJOV.js";
3
+ } from "./chunk-NXO2BF64.js";
4
4
  import "./chunk-J5NMYSBJ.js";
5
5
 
6
6
  // .docu/node/deploy.deno.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runDeploy
3
- } from "./chunk-IR5TVJOV.js";
3
+ } from "./chunk-NXO2BF64.js";
4
4
  import "./chunk-J5NMYSBJ.js";
5
5
 
6
6
  // .docu/node/deploy.node.ts
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  runPreview
3
- } from "./chunk-TE52TIEW.js";
4
- import "./chunk-RE4NGTMT.js";
5
- import "./chunk-PTRZ2S2C.js";
3
+ } from "./chunk-Q3AXTF2V.js";
4
+ import "./chunk-EOK6KATZ.js";
5
+ import "./chunk-GLOJMRT4.js";
6
6
  import "./chunk-J5NMYSBJ.js";
7
7
 
8
8
  // .docu/node/preview.deno.ts
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  runPreview
3
- } from "./chunk-TE52TIEW.js";
4
- import "./chunk-RE4NGTMT.js";
5
- import "./chunk-PTRZ2S2C.js";
3
+ } from "./chunk-Q3AXTF2V.js";
4
+ import "./chunk-EOK6KATZ.js";
5
+ import "./chunk-GLOJMRT4.js";
6
6
  import "./chunk-J5NMYSBJ.js";
7
7
 
8
8
  // .docu/node/preview.node.ts
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  runServer
3
- } from "./chunk-7ZEUL6PR.js";
4
- import "./chunk-AI7QAMMZ.js";
5
- import "./chunk-RE4NGTMT.js";
6
- import "./chunk-PTRZ2S2C.js";
3
+ } from "./chunk-TEXSBNMR.js";
4
+ import "./chunk-QGEFJH47.js";
5
+ import "./chunk-EOK6KATZ.js";
6
+ import "./chunk-GLOJMRT4.js";
7
7
  import "./chunk-J5NMYSBJ.js";
8
8
 
9
9
  // .docu/node/server.deno.ts
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  runServer
3
- } from "./chunk-7ZEUL6PR.js";
4
- import "./chunk-AI7QAMMZ.js";
5
- import "./chunk-RE4NGTMT.js";
6
- import "./chunk-PTRZ2S2C.js";
3
+ } from "./chunk-TEXSBNMR.js";
4
+ import "./chunk-QGEFJH47.js";
5
+ import "./chunk-EOK6KATZ.js";
6
+ import "./chunk-GLOJMRT4.js";
7
7
  import "./chunk-J5NMYSBJ.js";
8
8
 
9
9
  // .docu/node/server.node.ts
@@ -1,3 +1,4 @@
1
+ import { randomBytes } from "node:crypto";
1
2
  import { resolve } from "node:path";
2
3
  import { realpathSync } from "node:fs";
3
4
 
@@ -10,7 +11,7 @@ export const SECURITY_HEADERS: Record<string, string> = {
10
11
  };
11
12
 
12
13
  export function generateNonce(): string {
13
- return crypto.randomUUID();
14
+ return randomBytes(16).toString("base64");
14
15
  }
15
16
 
16
17
  export function cspHeader(nonce: string, allowEval = false): string {
@@ -117,11 +118,16 @@ export function wrapPluginResponse(
117
118
  securedHeaders.set(key, value);
118
119
  }
119
120
  }
121
+ let body = pluginResponse.body;
120
122
  const contentType = securedHeaders.get("Content-Type") || "";
121
123
  if (contentType.includes("text/html") && !securedHeaders.has("Content-Security-Policy")) {
122
- securedHeaders.set("Content-Security-Policy", cspHeader(generateNonce(), allowEval));
124
+ const nonce = generateNonce();
125
+ securedHeaders.set("Content-Security-Policy", cspHeader(nonce, allowEval));
126
+ if (typeof body === "string") {
127
+ body = injectNonce(body, nonce);
128
+ }
123
129
  }
124
- return new Response(pluginResponse.body, {
130
+ return new Response(body, {
125
131
  status: pluginResponse.status,
126
132
  statusText: pluginResponse.statusText,
127
133
  headers: securedHeaders,
@@ -22,6 +22,7 @@ export async function initSentry(): Promise<void> {
22
22
  } catch {
23
23
  // @sentry/bun not installed — silently skip
24
24
  sentry = null;
25
+ initialized = false;
25
26
  }
26
27
  }
27
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docubook/flame",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "A blazing-fast React + MDX framework powered by Bun, built for modern documentation experiences.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -56,8 +56,8 @@
56
56
  "unified": "^11.0.0",
57
57
  "@docubook/core": "^1.8.2",
58
58
  "@docubook/mdx-content": "^3.4.3",
59
+ "@docubook/themes-colors": "^1.0.1",
59
60
  "@docubook/runt": "^1.0.0",
60
- "@docubook/themes-colors": "^1.0.0",
61
61
  "@docubook/ui-react": "^1.0.0"
62
62
  },
63
63
  "peerDependencies": {
@@ -1,12 +0,0 @@
1
- import {
2
- runBuild,
3
- runBuildCli
4
- } from "./chunk-E4OIJWCU.js";
5
- import "./chunk-AI7QAMMZ.js";
6
- import "./chunk-RE4NGTMT.js";
7
- import "./chunk-PTRZ2S2C.js";
8
- import "./chunk-J5NMYSBJ.js";
9
- export {
10
- runBuild,
11
- runBuildCli
12
- };