@docubook/flame 2.0.0-beta.0 → 2.0.0-beta.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.
Files changed (54) hide show
  1. package/.docu/components/ScrollTo.tsx +17 -11
  2. package/.docu/components/Toc.tsx +32 -7
  3. package/.docu/lib/build.deno.js +6 -9
  4. package/.docu/lib/build.deno.js.map +1 -0
  5. package/.docu/lib/build.impl-BJsi28mD.js +377 -0
  6. package/.docu/lib/build.impl-BJsi28mD.js.map +1 -0
  7. package/.docu/lib/build.impl-yVLaa1eQ.js +2 -0
  8. package/.docu/lib/build.node.js +6 -9
  9. package/.docu/lib/build.node.js.map +1 -0
  10. package/.docu/lib/clean.js +25 -25
  11. package/.docu/lib/clean.js.map +1 -0
  12. package/.docu/lib/deno-DmEaKggj.js +20 -0
  13. package/.docu/lib/deno-DmEaKggj.js.map +1 -0
  14. package/.docu/lib/deploy.deno.js +9 -9
  15. package/.docu/lib/deploy.deno.js.map +1 -0
  16. package/.docu/lib/deploy.node.js +8 -8
  17. package/.docu/lib/deploy.node.js.map +1 -0
  18. package/.docu/lib/deploy.shared-D3UWafa6.js +295 -0
  19. package/.docu/lib/deploy.shared-D3UWafa6.js.map +1 -0
  20. package/.docu/lib/html.shared-DSn-7_6t.js +2467 -0
  21. package/.docu/lib/html.shared-DSn-7_6t.js.map +1 -0
  22. package/.docu/lib/logger-CycvLCrQ.js +312 -0
  23. package/.docu/lib/logger-CycvLCrQ.js.map +1 -0
  24. package/.docu/lib/node-DPTySdwG.js +80 -0
  25. package/.docu/lib/node-DPTySdwG.js.map +1 -0
  26. package/.docu/lib/paths-BtOIPBQ9.js +52 -0
  27. package/.docu/lib/paths-BtOIPBQ9.js.map +1 -0
  28. package/.docu/lib/preview.deno.js +7 -11
  29. package/.docu/lib/preview.deno.js.map +1 -0
  30. package/.docu/lib/preview.impl-CXJS2tQS.js +77 -0
  31. package/.docu/lib/preview.impl-CXJS2tQS.js.map +1 -0
  32. package/.docu/lib/preview.node.js +7 -11
  33. package/.docu/lib/preview.node.js.map +1 -0
  34. package/.docu/lib/server.deno.js +7 -12
  35. package/.docu/lib/server.deno.js.map +1 -0
  36. package/.docu/lib/server.impl-CJuWimfN.js +358 -0
  37. package/.docu/lib/server.impl-CJuWimfN.js.map +1 -0
  38. package/.docu/lib/server.node.js +7 -12
  39. package/.docu/lib/server.node.js.map +1 -0
  40. package/.docu/lib/utils-DA17MyQG.js +167 -0
  41. package/.docu/lib/utils-DA17MyQG.js.map +1 -0
  42. package/.docu/node/hydrate.node.ts +116 -166
  43. package/bin/compile-lib.mjs +30 -28
  44. package/package.json +6 -6
  45. package/.docu/lib/build.impl-S4DS5XPH.js +0 -12
  46. package/.docu/lib/chunk-4IQXHHPF.js +0 -62
  47. package/.docu/lib/chunk-C3RCUTUE.js +0 -470
  48. package/.docu/lib/chunk-D3QTSBR4.js +0 -434
  49. package/.docu/lib/chunk-EOK6KATZ.js +0 -191
  50. package/.docu/lib/chunk-IVM5UM44.js +0 -301
  51. package/.docu/lib/chunk-JMQI3FKV.js +0 -92
  52. package/.docu/lib/chunk-LXJLSXQI.js +0 -2691
  53. package/.docu/lib/chunk-O326MYJE.js +0 -330
  54. package/.docu/lib/chunk-UISOJ4RW.js +0 -114
@@ -1,32 +1,32 @@
1
- import {
2
- logger
3
- } from "./chunk-IVM5UM44.js";
4
- import "./chunk-4IQXHHPF.js";
5
-
6
- // .docu/node/clean.ts
7
- import { rm } from "node:fs/promises";
1
+ import { t as logger } from "./logger-CycvLCrQ.js";
8
2
  import { existsSync } from "node:fs";
3
+ import { rm } from "node:fs/promises";
4
+ //#region .docu/node/clean.ts
9
5
  var DIST = ".docu/dist";
10
6
  var CACHE = ".docu/build-cache.json";
11
7
  async function clean() {
12
- logger.buildStart();
13
- logger.spinner.start("Cleaning build artifacts...");
14
- let removed = 0;
15
- if (existsSync(DIST)) {
16
- await rm(DIST, { recursive: true, force: true });
17
- removed++;
18
- }
19
- if (existsSync(CACHE)) {
20
- await rm(CACHE, { force: true });
21
- removed++;
22
- }
23
- if (removed === 0) {
24
- logger.spinner.info("Nothing to clean");
25
- } else {
26
- logger.spinner.stop(`Cleaned ${removed} item(s)`);
27
- }
8
+ logger.buildStart();
9
+ logger.spinner.start("Cleaning build artifacts...");
10
+ let removed = 0;
11
+ if (existsSync(DIST)) {
12
+ await rm(DIST, {
13
+ recursive: true,
14
+ force: true
15
+ });
16
+ removed++;
17
+ }
18
+ if (existsSync(CACHE)) {
19
+ await rm(CACHE, { force: true });
20
+ removed++;
21
+ }
22
+ if (removed === 0) logger.spinner.info("Nothing to clean");
23
+ else logger.spinner.stop(`Cleaned ${removed} item(s)`);
28
24
  }
29
25
  clean().catch((err) => {
30
- console.error("Clean failed:", err);
31
- process.exit(1);
26
+ console.error("Clean failed:", err);
27
+ process.exit(1);
32
28
  });
29
+ //#endregion
30
+ export {};
31
+
32
+ //# sourceMappingURL=clean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clean.js","names":[],"sources":["../node/clean.ts"],"sourcesContent":["import { rm } from \"node:fs/promises\";\nimport { existsSync } from \"node:fs\";\nimport { logger } from \"./logger\";\n\nconst DIST = \".docu/dist\";\nconst CACHE = \".docu/build-cache.json\";\n\nasync function clean() {\n logger.buildStart();\n logger.spinner.start(\"Cleaning build artifacts...\");\n\n let removed = 0;\n\n if (existsSync(DIST)) {\n await rm(DIST, { recursive: true, force: true });\n removed++;\n }\n\n if (existsSync(CACHE)) {\n await rm(CACHE, { force: true });\n removed++;\n }\n\n if (removed === 0) {\n logger.spinner.info(\"Nothing to clean\");\n } else {\n logger.spinner.stop(`Cleaned ${removed} item(s)`);\n }\n}\n\nclean().catch((err) => {\n console.error(\"Clean failed:\", err);\n process.exit(1);\n});\n"],"mappings":";;;;AAIA,IAAM,OAAO;AACb,IAAM,QAAQ;AAEd,eAAe,QAAQ;CACrB,OAAO,WAAW;CAClB,OAAO,QAAQ,MAAM,6BAA6B;CAElD,IAAI,UAAU;CAEd,IAAI,WAAW,IAAI,GAAG;EACpB,MAAM,GAAG,MAAM;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;EAC/C;CACF;CAEA,IAAI,WAAW,KAAK,GAAG;EACrB,MAAM,GAAG,OAAO,EAAE,OAAO,KAAK,CAAC;EAC/B;CACF;CAEA,IAAI,YAAY,GACd,OAAO,QAAQ,KAAK,kBAAkB;MAEtC,OAAO,QAAQ,KAAK,WAAW,QAAQ,SAAS;AAEpD;AAEA,MAAM,CAAC,CAAC,OAAO,QAAQ;CACrB,QAAQ,MAAM,iBAAiB,GAAG;CAClC,QAAQ,KAAK,CAAC;AAChB,CAAC"}
@@ -0,0 +1,20 @@
1
+ //#region .docu/node/runtime/deno.ts
2
+ var denoAdapter = {
3
+ name: "deno",
4
+ serve(fetch, options) {
5
+ const server = Deno.serve({
6
+ port: options.port,
7
+ hostname: options.hostname,
8
+ onListen: () => {}
9
+ }, fetch);
10
+ return {
11
+ port: server.addr.port,
12
+ hostname: server.addr.hostname,
13
+ stop: () => server.shutdown()
14
+ };
15
+ }
16
+ };
17
+ //#endregion
18
+ export { denoAdapter as t };
19
+
20
+ //# sourceMappingURL=deno-DmEaKggj.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deno-DmEaKggj.js","names":[],"sources":["../node/runtime/deno.ts"],"sourcesContent":["import type { FetchHandler, RuntimeAdapter, ServerOptions } from \"./types\";\n\n/** Minimal ambient view of the Deno global — only what the adapter touches. */\ndeclare const Deno: {\n serve(\n options: { port?: number; hostname?: string; onListen?: (addr: unknown) => void },\n handler: (req: Request) => Response | Promise<Response>\n ): {\n addr: { port: number; hostname: string };\n shutdown(): Promise<void>;\n };\n};\n\nexport const denoAdapter: RuntimeAdapter = {\n name: \"deno\",\n\n serve(fetch: FetchHandler, options: ServerOptions) {\n const server = Deno.serve(\n {\n port: options.port,\n hostname: options.hostname,\n onListen: () => {\n // Suppress Deno's default \"Listening on ...\" log; callers print their own.\n },\n },\n fetch\n );\n return {\n port: server.addr.port,\n hostname: server.addr.hostname,\n stop: () => server.shutdown(),\n };\n },\n};\n"],"mappings":";AAaA,IAAa,cAA8B;CACzC,MAAM;CAEN,MAAM,OAAqB,SAAwB;EACjD,MAAM,SAAS,KAAK,MAClB;GACE,MAAM,QAAQ;GACd,UAAU,QAAQ;GAClB,gBAAgB,CAEhB;EACF,GACA,KACF;EACA,OAAO;GACL,MAAM,OAAO,KAAK;GAClB,UAAU,OAAO,KAAK;GACtB,YAAY,OAAO,SAAS;EAC9B;CACF;AACF"}
@@ -1,13 +1,13 @@
1
- import {
2
- runDeploy
3
- } from "./chunk-O326MYJE.js";
4
- import "./chunk-4IQXHHPF.js";
5
-
6
- // .docu/node/deploy.deno.ts
1
+ import { t as runDeploy } from "./deploy.shared-D3UWafa6.js";
2
+ //#region .docu/node/deploy.deno.ts
7
3
  try {
8
- await runDeploy();
4
+ await runDeploy();
9
5
  } catch (err) {
10
- console.error("Deploy failed:", err);
11
- process.exit(1);
6
+ console.error("Deploy failed:", err);
7
+ process.exit(1);
12
8
  }
13
9
  process.exit(0);
10
+ //#endregion
11
+ export {};
12
+
13
+ //# sourceMappingURL=deploy.deno.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.deno.js","names":[],"sources":["../node/deploy.deno.ts"],"sourcesContent":["import { runDeploy } from \"./deploy.shared\";\n\ntry {\n await runDeploy();\n} catch (err) {\n console.error(\"Deploy failed:\", err);\n process.exit(1);\n}\n// See build.deno.ts — react-dom/server's browser build keeps Deno's event\n// loop alive after the in-process build; force a clean exit.\nprocess.exit(0);\n"],"mappings":";;AAEA,IAAI;CACF,MAAM,UAAU;AAClB,SAAS,KAAK;CACZ,QAAQ,MAAM,kBAAkB,GAAG;CACnC,QAAQ,KAAK,CAAC;AAChB;AAGA,QAAQ,KAAK,CAAC"}
@@ -1,10 +1,10 @@
1
- import {
2
- runDeploy
3
- } from "./chunk-O326MYJE.js";
4
- import "./chunk-4IQXHHPF.js";
5
-
6
- // .docu/node/deploy.node.ts
1
+ import { t as runDeploy } from "./deploy.shared-D3UWafa6.js";
2
+ //#region .docu/node/deploy.node.ts
7
3
  runDeploy().catch((err) => {
8
- console.error("Deploy failed:", err);
9
- process.exit(1);
4
+ console.error("Deploy failed:", err);
5
+ process.exit(1);
10
6
  });
7
+ //#endregion
8
+ export {};
9
+
10
+ //# sourceMappingURL=deploy.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.node.js","names":[],"sources":["../node/deploy.node.ts"],"sourcesContent":["import { runDeploy } from \"./deploy.shared\";\n\nrunDeploy().catch((err) => {\n console.error(\"Deploy failed:\", err);\n process.exit(1);\n});\n"],"mappings":";;AAEA,UAAU,CAAC,CAAC,OAAO,QAAQ;CACzB,QAAQ,MAAM,kBAAkB,GAAG;CACnC,QAAQ,KAAK,CAAC;AAChB,CAAC"}
@@ -0,0 +1,295 @@
1
+ import { c as PROJECT_ROOT, o as FRAMEWORK_ROOT, r as DIST_DIR } from "./paths-BtOIPBQ9.js";
2
+ import { existsSync, readFileSync } from "node:fs";
3
+ import { join, resolve } from "node:path";
4
+ import { mkdir, writeFile } from "node:fs/promises";
5
+ //#region .docu/node/deploy.shared.ts
6
+ /**
7
+ * Runtime-neutral deploy — 3 modes:
8
+ * 1. `flame deploy` → build + generate GitHub Actions workflow
9
+ * 2. `flame deploy --docker` → build + generate Docker deployment files
10
+ * 3. `flame deploy --docker --silent` → same as #2, minimal output
11
+ *
12
+ * Mirror of deploy.ts (Bun-only, protected) for Node.js and Deno.
13
+ * Runs the neutral build in-process, then prepares .docu/dist.
14
+ */
15
+ var FLAME_MAJOR = JSON.parse(readFileSync(resolve(FRAMEWORK_ROOT, "package.json"), "utf-8")).version.split(".")[0];
16
+ var WORKFLOW_DIR = join(PROJECT_ROOT, ".github/workflows");
17
+ var WORKFLOW_FILE = join(WORKFLOW_DIR, "deploy.yml");
18
+ var NGINX_CONF = `server {
19
+ listen 80;
20
+ server_name _;
21
+ root /usr/share/nginx/html;
22
+ index index.html;
23
+
24
+ gzip on;
25
+ gzip_types text/html text/css application/javascript image/svg+xml;
26
+
27
+ # Security headers (HSTS effective when HTTPS is terminated upstream)
28
+ add_header X-Frame-Options "DENY" always;
29
+ add_header X-Content-Type-Options "nosniff" always;
30
+ add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
31
+ add_header Referrer-Policy "strict-origin-when-cross-origin" always;
32
+ add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
33
+ 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;
34
+
35
+ location /assets/ {
36
+ expires 1y;
37
+ add_header Cache-Control "public, immutable";
38
+ add_header X-Frame-Options "DENY" always;
39
+ add_header X-Content-Type-Options "nosniff" always;
40
+ add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
41
+ add_header Referrer-Policy "strict-origin-when-cross-origin" always;
42
+ add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
43
+ 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;
44
+ }
45
+
46
+ location /docs/assets/ {
47
+ expires 7d;
48
+ add_header Cache-Control "public";
49
+ add_header X-Frame-Options "DENY" always;
50
+ add_header X-Content-Type-Options "nosniff" always;
51
+ add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
52
+ add_header Referrer-Policy "strict-origin-when-cross-origin" always;
53
+ add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
54
+ 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;
55
+ }
56
+
57
+ location / {
58
+ try_files $uri $uri.html $uri/ =404;
59
+ }
60
+ }
61
+ `;
62
+ var DOCKERIGNORE = `node_modules
63
+ *.DS_Store
64
+ .docu/dist
65
+ .docu/lib
66
+ .env
67
+ .env.*
68
+ .npmrc
69
+ *.log
70
+ `;
71
+ function detectPkgManager(dir) {
72
+ const bunLockFile = existsSync(join(dir, "bun.lock")) ? "bun.lock" : existsSync(join(dir, "bun.lockb")) ? "bun.lockb" : null;
73
+ if (bunLockFile) return {
74
+ baseImage: "oven/bun:1-debian",
75
+ lockFile: bunLockFile,
76
+ installCmd: "bun install --frozen-lockfile",
77
+ runCmd: "bun",
78
+ cache: "",
79
+ setupAction: "bun"
80
+ };
81
+ if (existsSync(join(dir, "pnpm-lock.yaml"))) return {
82
+ baseImage: "node:22-alpine",
83
+ lockFile: "pnpm-lock.yaml",
84
+ installCmd: "corepack enable && pnpm install --frozen-lockfile",
85
+ runCmd: "pnpm",
86
+ cache: "pnpm",
87
+ setupAction: "pnpm"
88
+ };
89
+ if (existsSync(join(dir, "yarn.lock"))) return {
90
+ baseImage: "node:22-alpine",
91
+ lockFile: "yarn.lock",
92
+ installCmd: "yarn install --frozen-lockfile",
93
+ runCmd: "yarn",
94
+ cache: "yarn",
95
+ setupAction: "node"
96
+ };
97
+ return {
98
+ baseImage: "node:22-alpine",
99
+ lockFile: "package-lock.json",
100
+ installCmd: "npm ci",
101
+ runCmd: "npm",
102
+ cache: "npm",
103
+ setupAction: "node"
104
+ };
105
+ }
106
+ var HEADERS_FILE = `/*
107
+ X-Frame-Options: DENY
108
+ X-Content-Type-Options: nosniff
109
+ Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
110
+ Referrer-Policy: strict-origin-when-cross-origin
111
+ Permissions-Policy: camera=(), microphone=(), geolocation=()
112
+ 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'
113
+
114
+ /assets/*
115
+ Cache-Control: public, max-age=31536000, immutable
116
+ `;
117
+ var isDocker = !!process.env.FLAME_DEPLOY_DOCKER;
118
+ var isSilent = !!process.env.FLAME_DEPLOY_SILENT;
119
+ var isCi = !!process.env.FLAME_DEPLOY_CI;
120
+ /** Logger that no-ops all non-error output in silent mode. */
121
+ var log = isSilent ? {
122
+ info: () => {},
123
+ ok: () => {},
124
+ created: () => {},
125
+ out: () => {}
126
+ } : {
127
+ info: (m) => console.log(m),
128
+ ok: () => console.log("\nāœ… Ready to deploy!"),
129
+ created: (m) => console.log(m),
130
+ out: (m) => console.log(m)
131
+ };
132
+ async function runBuild() {
133
+ process.env.NODE_ENV = "production";
134
+ if (isSilent) {
135
+ process.env.FLAME_BUILD_SILENT = "1";
136
+ process.env.LOG_LEVEL = "error";
137
+ }
138
+ const { runBuildCli } = await import("./build.impl-yVLaa1eQ.js");
139
+ await runBuildCli();
140
+ }
141
+ async function writeDockerFiles() {
142
+ const dockerDir = PROJECT_ROOT;
143
+ if (!existsSync(join(dockerDir, "Dockerfile"))) {
144
+ await writeFile(join(dockerDir, "Dockerfile"), `FROM ghcr.io/docubook/flame:${FLAME_MAJOR} AS builder
145
+ ENV NODE_ENV=production
146
+ WORKDIR /app
147
+ COPY . .
148
+ RUN flame build
149
+
150
+ FROM nginx:alpine
151
+ COPY --from=builder /app/.docu/dist /usr/share/nginx/html
152
+ COPY nginx.conf /etc/nginx/conf.d/default.conf
153
+ EXPOSE 80
154
+ CMD ["nginx", "-g", "daemon off;"]
155
+ `);
156
+ log.created("šŸ“„ Created Dockerfile");
157
+ }
158
+ if (!existsSync(join(dockerDir, "nginx.conf"))) {
159
+ await writeFile(join(dockerDir, "nginx.conf"), NGINX_CONF);
160
+ log.created("šŸ“„ Created nginx.conf");
161
+ }
162
+ if (!existsSync(join(dockerDir, ".dockerignore"))) {
163
+ await writeFile(join(dockerDir, ".dockerignore"), DOCKERIGNORE);
164
+ log.created("šŸ“„ Created .dockerignore");
165
+ }
166
+ }
167
+ function generateWorkflowYml() {
168
+ const pm = detectPkgManager(PROJECT_ROOT);
169
+ const setupSteps = [
170
+ " - uses: actions/checkout@v7",
171
+ " with:",
172
+ " fetch-depth: 0",
173
+ ""
174
+ ];
175
+ if (pm.setupAction === "bun") setupSteps.push(" - uses: oven-sh/setup-bun@v2", " with:", " bun-version: latest", "");
176
+ else if (pm.setupAction === "pnpm") setupSteps.push(" - uses: pnpm/action-setup@v6", "", " - uses: actions/setup-node@v6", " with:", " node-version: 22", ` cache: ${pm.cache}`, "");
177
+ else setupSteps.push(" - uses: actions/setup-node@v6", " with:", " node-version: 22", ` cache: ${pm.cache}`, "");
178
+ return [
179
+ `name: Deploy to GitHub Pages`,
180
+ "",
181
+ "on:",
182
+ " push:",
183
+ " branches: [main]",
184
+ " workflow_dispatch:",
185
+ "",
186
+ "permissions:",
187
+ " contents: read",
188
+ " pages: write",
189
+ " id-token: write",
190
+ "",
191
+ "concurrency:",
192
+ " group: \"pages\"",
193
+ " cancel-in-progress: false",
194
+ "",
195
+ "jobs:",
196
+ " build:",
197
+ " runs-on: ubuntu-latest",
198
+ " steps:",
199
+ ...setupSteps,
200
+ ` - run: ${pm.installCmd}`,
201
+ "",
202
+ ` - run: ${pm.runCmd} run build`,
203
+ "",
204
+ " - name: Add .nojekyll",
205
+ " run: touch .docu/dist/.nojekyll",
206
+ "",
207
+ " - uses: actions/upload-pages-artifact@v3",
208
+ " with:",
209
+ " path: .docu/dist",
210
+ "",
211
+ " deploy:",
212
+ " environment:",
213
+ " name: github-pages",
214
+ " url: ${{ steps.deployment.outputs.page_url }}",
215
+ " runs-on: ubuntu-latest",
216
+ " needs: build",
217
+ " steps:",
218
+ " - id: deployment",
219
+ " uses: actions/deploy-pages@v4"
220
+ ].join("\n");
221
+ }
222
+ function generateDockerWorkflowYml() {
223
+ return [
224
+ `name: Build & Push Docker Image`,
225
+ "",
226
+ "on:",
227
+ " push:",
228
+ " branches: [main]",
229
+ " workflow_dispatch:",
230
+ "",
231
+ "permissions:",
232
+ " contents: read",
233
+ " packages: write",
234
+ "",
235
+ "jobs:",
236
+ " build:",
237
+ " runs-on: ubuntu-latest",
238
+ " steps:",
239
+ " - uses: actions/checkout@v4",
240
+ " with:",
241
+ " fetch-depth: 0",
242
+ "",
243
+ " - name: Log in to GHCR",
244
+ " uses: docker/login-action@v3",
245
+ " with:",
246
+ " registry: ghcr.io",
247
+ " username: ${{ github.actor }}",
248
+ " password: ${{ secrets.GITHUB_TOKEN }}",
249
+ "",
250
+ " - name: Build & push",
251
+ " uses: docker/build-push-action@v5",
252
+ " with:",
253
+ " context: .",
254
+ ` tags: ghcr.io/\${{ github.repository }}:latest`,
255
+ " push: true"
256
+ ].join("\n");
257
+ }
258
+ async function writeGhaWorkflow() {
259
+ if (!existsSync(WORKFLOW_FILE)) {
260
+ await mkdir(WORKFLOW_DIR, { recursive: true });
261
+ await writeFile(WORKFLOW_FILE, generateWorkflowYml());
262
+ log.created("šŸ“„ Created .github/workflows/deploy.yml");
263
+ }
264
+ }
265
+ var DOCKER_WORKFLOW_FILE = join(WORKFLOW_DIR, "deploy-docker.yml");
266
+ async function writeDockerWorkflow() {
267
+ if (!existsSync(DOCKER_WORKFLOW_FILE)) {
268
+ await mkdir(WORKFLOW_DIR, { recursive: true });
269
+ await writeFile(DOCKER_WORKFLOW_FILE, generateDockerWorkflowYml());
270
+ log.created("šŸ“„ Created .github/workflows/deploy-docker.yml");
271
+ }
272
+ }
273
+ async function runDeploy() {
274
+ log.info("šŸ“¦ Building for production...\n");
275
+ await runBuild();
276
+ await writeFile(join(DIST_DIR, ".nojekyll"), "");
277
+ await writeFile(join(DIST_DIR, "_headers"), HEADERS_FILE);
278
+ if (isDocker) {
279
+ await writeDockerFiles();
280
+ if (isCi) await writeDockerWorkflow();
281
+ } else await writeGhaWorkflow();
282
+ log.ok();
283
+ log.out(" Output: .docu/dist/");
284
+ if (isDocker) {
285
+ log.out(" Build locally: docker build -t my-docs . && docker run -p 80:80 my-docs");
286
+ if (isCi) {
287
+ log.out(" Push to GitHub — CI will build & push Docker image to GHCR");
288
+ log.out(" Then pull latest image on your hosting platform (Coolify, etc.)");
289
+ } else log.out(" For Coolify: connect repo, set build pack to Dockerfile");
290
+ } else log.out(" Push to GitHub and enable Pages (Settings → Pages → Source: GitHub Actions)");
291
+ }
292
+ //#endregion
293
+ export { runDeploy as t };
294
+
295
+ //# sourceMappingURL=deploy.shared-D3UWafa6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.shared-D3UWafa6.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,CA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