@demiurgejs/core 0.2.0-beta.4 → 0.2.0-beta.5

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 (116) hide show
  1. package/README.md +23 -0
  2. package/bin/demiurge.mjs +17 -1
  3. package/dist/adapter/index.d.ts +1 -1
  4. package/dist/adapter/index.d.ts.map +1 -1
  5. package/dist/browser/file-router.d.ts +1 -1
  6. package/dist/chunks/{document-shell-CpJnFtSC.js → document-shell-9GPwtcTt.js} +2 -2
  7. package/dist/chunks/{document-shell-CpJnFtSC.js.map → document-shell-9GPwtcTt.js.map} +1 -1
  8. package/dist/chunks/{image-codec-BmzWnH6W.js → image-codec-Dh1POFhE.js} +2 -2
  9. package/dist/chunks/{image-codec-BmzWnH6W.js.map → image-codec-Dh1POFhE.js.map} +1 -1
  10. package/dist/chunks/{images-BQ80950B.js → images-CG7ZzayG.js} +2 -2
  11. package/dist/chunks/{images-BQ80950B.js.map → images-CG7ZzayG.js.map} +1 -1
  12. package/dist/chunks/{index-BVk9zWbe.js → index-0MNiR_wo.js} +4 -3
  13. package/dist/chunks/{index-BVk9zWbe.js.map → index-0MNiR_wo.js.map} +1 -1
  14. package/dist/chunks/plugin-BZauDxRY.js +2310 -0
  15. package/dist/chunks/plugin-BZauDxRY.js.map +1 -0
  16. package/dist/chunks/streaming-GYIsVTQH.js +560 -0
  17. package/dist/chunks/streaming-GYIsVTQH.js.map +1 -0
  18. package/dist/chunks/testing-CUwGj2ie.js +4751 -0
  19. package/dist/chunks/testing-CUwGj2ie.js.map +1 -0
  20. package/dist/chunks/{vite-DO70kZA6.js → vite-QoqrGl6f.js} +43 -43
  21. package/dist/chunks/vite-QoqrGl6f.js.map +1 -0
  22. package/dist/cli.d.ts +4 -2
  23. package/dist/cli.d.ts.map +1 -1
  24. package/dist/cli.js +224 -98
  25. package/dist/cli.js.map +1 -1
  26. package/dist/config/index.js +2 -2
  27. package/dist/config/types.d.ts +11 -1
  28. package/dist/config/types.d.ts.map +1 -1
  29. package/dist/edge/index.js +3 -3
  30. package/dist/index.d.ts +3 -3
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +161 -139
  33. package/dist/index.js.map +1 -1
  34. package/dist/inspect/command.d.ts +28 -0
  35. package/dist/inspect/command.d.ts.map +1 -0
  36. package/dist/inspect/index.d.ts +9 -0
  37. package/dist/inspect/index.d.ts.map +1 -0
  38. package/dist/inspect/redact.d.ts +35 -0
  39. package/dist/inspect/redact.d.ts.map +1 -0
  40. package/dist/inspect/report.d.ts +24 -0
  41. package/dist/inspect/report.d.ts.map +1 -0
  42. package/dist/inspect/types.d.ts +102 -0
  43. package/dist/inspect/types.d.ts.map +1 -0
  44. package/dist/internal/testing.js +12 -12
  45. package/dist/node/http.d.ts +5 -0
  46. package/dist/node/http.d.ts.map +1 -1
  47. package/dist/node/index.d.ts +1 -1
  48. package/dist/node/index.d.ts.map +1 -1
  49. package/dist/node/index.js +26 -24
  50. package/dist/node/index.js.map +1 -1
  51. package/dist/route/index.d.ts +1 -0
  52. package/dist/route/index.d.ts.map +1 -1
  53. package/dist/route/mutation.d.ts.map +1 -1
  54. package/dist/route/serialization.d.ts +24 -0
  55. package/dist/route/serialization.d.ts.map +1 -0
  56. package/dist/route/webhook.d.ts +6 -1
  57. package/dist/route/webhook.d.ts.map +1 -1
  58. package/dist/router/manifest.d.ts.map +1 -1
  59. package/dist/security/audit.d.ts +2 -1
  60. package/dist/security/audit.d.ts.map +1 -1
  61. package/dist/security/authorization.d.ts +36 -0
  62. package/dist/security/authorization.d.ts.map +1 -0
  63. package/dist/security/csrf.d.ts.map +1 -1
  64. package/dist/security/env-startup.d.ts +0 -2
  65. package/dist/security/env-startup.d.ts.map +1 -1
  66. package/dist/security/env.d.ts +27 -8
  67. package/dist/security/env.d.ts.map +1 -1
  68. package/dist/security/exceptions.d.ts +29 -0
  69. package/dist/security/exceptions.d.ts.map +1 -0
  70. package/dist/security/finding-codes.d.ts +56 -0
  71. package/dist/security/finding-codes.d.ts.map +1 -0
  72. package/dist/security/index.d.ts +5 -2
  73. package/dist/security/index.d.ts.map +1 -1
  74. package/dist/security/policy.d.ts +2 -5
  75. package/dist/security/policy.d.ts.map +1 -1
  76. package/dist/security/report.d.ts +2 -1
  77. package/dist/security/report.d.ts.map +1 -1
  78. package/dist/security/request.d.ts +1 -0
  79. package/dist/security/request.d.ts.map +1 -1
  80. package/dist/security/types.d.ts +138 -5
  81. package/dist/security/types.d.ts.map +1 -1
  82. package/dist/security/upload.d.ts +3 -3
  83. package/dist/security/upload.d.ts.map +1 -1
  84. package/dist/security/verification.d.ts.map +1 -1
  85. package/dist/server/request-handler.d.ts +3 -2
  86. package/dist/server/request-handler.d.ts.map +1 -1
  87. package/dist/server-only/browser.d.ts +2 -0
  88. package/dist/server-only/browser.d.ts.map +1 -0
  89. package/dist/server-only/browser.js +4 -0
  90. package/dist/server-only/browser.js.map +1 -0
  91. package/dist/server-only/index.d.ts +2 -0
  92. package/dist/server-only/index.d.ts.map +1 -0
  93. package/dist/server-only/index.js +2 -0
  94. package/dist/server-only/index.js.map +1 -0
  95. package/dist/static/index.js +4 -4
  96. package/dist/vite/index.d.ts +9 -4
  97. package/dist/vite/index.d.ts.map +1 -1
  98. package/dist/vite/index.js +28 -21
  99. package/dist/vite/plugin.d.ts +18 -2
  100. package/dist/vite/plugin.d.ts.map +1 -1
  101. package/dist/vite/policy-verification.d.ts +33 -2
  102. package/dist/vite/policy-verification.d.ts.map +1 -1
  103. package/dist/vite/route-audit.d.ts +14 -2
  104. package/dist/vite/route-audit.d.ts.map +1 -1
  105. package/dist/vite/server-only-boundary.d.ts +8 -0
  106. package/dist/vite/server-only-boundary.d.ts.map +1 -0
  107. package/package.json +6 -1
  108. package/dist/chunks/env-startup-DOBYWlZD.js +0 -257
  109. package/dist/chunks/env-startup-DOBYWlZD.js.map +0 -1
  110. package/dist/chunks/plugin-BQgMiHxa.js +0 -1827
  111. package/dist/chunks/plugin-BQgMiHxa.js.map +0 -1
  112. package/dist/chunks/streaming-BEbPN7Uk.js +0 -469
  113. package/dist/chunks/streaming-BEbPN7Uk.js.map +0 -1
  114. package/dist/chunks/testing-DueXbMo4.js +0 -4167
  115. package/dist/chunks/testing-DueXbMo4.js.map +0 -1
  116. package/dist/chunks/vite-DO70kZA6.js.map +0 -1
package/dist/cli.js CHANGED
@@ -1,11 +1,128 @@
1
- import { readdir as g, readFile as b } from "node:fs/promises";
2
- import { resolve as p, join as D, relative as m, sep as v, isAbsolute as y } from "node:path";
3
- import { pathToFileURL as R } from "node:url";
4
- import { c as E } from "./chunks/vite-DO70kZA6.js";
5
- import { p as S } from "./chunks/manifest-vO6c0G0W.js";
6
- import { generateStaticOutput as N, generateVercelStaticOutput as T } from "./static/index.js";
7
- const I = /* @__PURE__ */ new Set(["--host", "--origin", "--out-dir", "--port"]), V = "virtual:demiurge/client-entry", _ = "virtual:demiurge/server-entry", O = "dist", j = "dist/server", U = ".demiurge/server";
8
- function J(t, e = {}) {
1
+ import { readdir as D, readFile as N } from "node:fs/promises";
2
+ import { relative as l, sep as f, resolve as d, join as I, isAbsolute as E } from "node:path";
3
+ import { pathToFileURL as b } from "node:url";
4
+ import { t as _, c as O } from "./chunks/vite-QoqrGl6f.js";
5
+ import { p as P } from "./chunks/manifest-vO6c0G0W.js";
6
+ import { generateStaticOutput as C, generateVercelStaticOutput as $ } from "./static/index.js";
7
+ import { t as V, a as j } from "./chunks/testing-CUwGj2ie.js";
8
+ import { v as F, B as S } from "./chunks/plugin-BZauDxRY.js";
9
+ import "./chunks/index-0MNiR_wo.js";
10
+ import "node:fs";
11
+ import "magic-string";
12
+ import "vite";
13
+ import "react-dom/server";
14
+ import "react";
15
+ import "react/jsx-runtime";
16
+ import "node:stream";
17
+ import "node:stream/promises";
18
+ import "node:net";
19
+ import "node:crypto";
20
+ const x = 1, A = 1, U = [
21
+ "authorization-result",
22
+ "cookie-values",
23
+ "csrf-token",
24
+ "environment-values",
25
+ "rate-limit-state",
26
+ "request-headers",
27
+ "response-headers",
28
+ "session-record"
29
+ ];
30
+ async function L(t) {
31
+ const e = t.options ?? {}, r = await F(t.root, e), o = r.inspections.map((i) => M(r.routesDir, i)).sort((i, s) => i.file.localeCompare(s.file));
32
+ return {
33
+ findings: r.findings,
34
+ redactions: [],
35
+ request: U,
36
+ resolutions: {
37
+ findings: "static",
38
+ redactions: "static",
39
+ request: "request",
40
+ routes: "static"
41
+ },
42
+ routes: o,
43
+ routesDir: h(l(t.root, r.routesDir)),
44
+ version: x
45
+ };
46
+ }
47
+ function q(t) {
48
+ return Object.entries(t ?? {}).filter(([, e]) => e.sensitive).map(([e]) => e).sort();
49
+ }
50
+ function R(t) {
51
+ return t.findings.filter((e) => e.severity === "error").length;
52
+ }
53
+ function k(t) {
54
+ const e = R(t), r = t.findings.length - e;
55
+ return [
56
+ `Demiurge inspected ${t.routes.length} route files in ${t.routesDir}.`,
57
+ `Findings: ${e} error, ${r} warning.`,
58
+ `The report states ${t.request.length} facts that only a request supplies.`,
59
+ ...t.findings.map(
60
+ (o) => ` ${o.severity}: ${h(o.file)} [${o.code}] ${o.message}`
61
+ )
62
+ ].join(`
63
+ `);
64
+ }
65
+ function M(t, e) {
66
+ const r = h(l(t, e.file)), o = r.replace(/\.tsx?$/, "").split("/"), i = o.at(-1)?.startsWith("@") ?? !1;
67
+ return {
68
+ declaredAccess: e.accessState,
69
+ declaredDocumentCsp: e.documentCspState,
70
+ declaresDocumentPolicy: e.declaresDocumentPolicy,
71
+ file: r,
72
+ kind: i ? "attached" : e.declaresPageRoute ? "page" : "resource",
73
+ methods: e.methods,
74
+ ...i ? {} : { pattern: V(j(o)) }
75
+ };
76
+ }
77
+ function h(t) {
78
+ return t.split(f).join("/");
79
+ }
80
+ const W = 0, B = 1, J = 2;
81
+ async function Ot(t) {
82
+ if (t.arguments.length > 0)
83
+ return v(
84
+ "invalid-argument",
85
+ "The inspect command accepts no argument.",
86
+ `The command received ${t.arguments.join(" ")}.`
87
+ );
88
+ let e;
89
+ try {
90
+ e = await t.loadConfig();
91
+ } catch (o) {
92
+ return v(
93
+ "configuration-unreadable",
94
+ "Demiurge could not read the configuration.",
95
+ o instanceof Error ? o.message : String(o)
96
+ );
97
+ }
98
+ const r = await L({
99
+ options: _(e),
100
+ root: e.root
101
+ });
102
+ return {
103
+ exitCode: R(r) > 0 ? B : W,
104
+ stderr: k(r),
105
+ stdout: S(r, {
106
+ secretEnvKeys: q(e.env)
107
+ })
108
+ };
109
+ }
110
+ function v(t, e, r) {
111
+ const o = {
112
+ code: t,
113
+ detail: r,
114
+ title: e,
115
+ version: A
116
+ };
117
+ return {
118
+ exitCode: J,
119
+ stderr: `${e}
120
+ ${r}`,
121
+ stdout: S(o)
122
+ };
123
+ }
124
+ const K = /* @__PURE__ */ new Set(["--host", "--origin", "--out-dir", "--port"]), G = "virtual:demiurge/client-entry", X = "virtual:demiurge/server-entry", T = "dist", Y = "dist/server", z = ".demiurge/server";
125
+ function St(t, e = {}) {
9
126
  const r = t[0];
10
127
  if (!r || r === "--help" || r === "-h" || r === "help")
11
128
  return {
@@ -13,7 +130,7 @@ function J(t, e = {}) {
13
130
  host: "localhost",
14
131
  port: 4173
15
132
  };
16
- if (r !== "build" && r !== "dev" && r !== "preview")
133
+ if (r !== "build" && r !== "dev" && r !== "inspect" && r !== "preview")
17
134
  throw new Error(`Unknown command: ${r}`);
18
135
  const o = {
19
136
  command: r,
@@ -21,30 +138,31 @@ function J(t, e = {}) {
21
138
  origin: e.SITE_ORIGIN,
22
139
  port: r === "dev" ? 5173 : 4173
23
140
  };
24
- for (let n = 1; n < t.length; n += 1) {
25
- const i = t[n];
26
- if (i === "--help" || i === "-h")
141
+ for (let i = 1; i < t.length; i += 1) {
142
+ const s = t[i];
143
+ if (s === "--help" || s === "-h")
27
144
  return { command: "help", host: "localhost", port: 4173 };
28
- const [s, c] = i.split("=", 2);
29
- if (!I.has(s))
30
- throw new Error(`Unknown option: ${i}`);
31
- const a = c ?? t[++n];
145
+ const [n, u] = s.split("=", 2);
146
+ if (!K.has(n))
147
+ throw new Error(`Unknown option: ${s}`);
148
+ const a = u ?? t[++i];
32
149
  if (!a || a.startsWith("--"))
33
- throw new Error(`Option ${s} requires a value.`);
34
- if (s === "--host" && (o.host = a), s === "--origin" && (o.origin = a), s === "--out-dir" && (o.outDir = a), s === "--port") {
35
- const u = Number(a);
36
- if (!Number.isSafeInteger(u) || u < 0 || u > 65535)
150
+ throw new Error(`Option ${n} requires a value.`);
151
+ if (n === "--host" && (o.host = a), n === "--origin" && (o.origin = a), n === "--out-dir" && (o.outDir = a), n === "--port") {
152
+ const c = Number(a);
153
+ if (!Number.isSafeInteger(c) || c < 0 || c > 65535)
37
154
  throw new Error("The server port must be an integer from 0 through 65535.");
38
- o.port = u;
155
+ o.port = c;
39
156
  }
40
157
  }
41
158
  return o;
42
159
  }
43
- const G = `Usage: demiurge <command> [options]
160
+ const Rt = `Usage: demiurge <command> [options]
44
161
 
45
162
  Commands:
46
163
  dev Start the development server
47
164
  build Build production output
165
+ inspect Write the static inspection report as JSON
48
166
  preview Serve static output with its declared headers
49
167
 
50
168
  Options:
@@ -54,10 +172,14 @@ Options:
54
172
  --port <port> Set the server port (dev: 5173, preview: 4173)
55
173
  -h, --help Show this help
56
174
 
175
+ The inspect command writes JSON to standard output and a summary to standard
176
+ error. It exits with 0 for no error finding, 1 for at least one error finding,
177
+ and 2 for an invalid argument or an unreadable configuration.
178
+
57
179
  Demiurge reads demiurge.config.ts from the project root.`;
58
- async function H(t, e) {
180
+ async function Tt(t, e) {
59
181
  const { createServer: r } = await import("vite"), o = await r(
60
- await E({
182
+ await O({
61
183
  config: e,
62
184
  overrides: {
63
185
  mode: "development",
@@ -67,60 +189,60 @@ async function H(t, e) {
67
189
  );
68
190
  return await o.listen(), o;
69
191
  }
70
- async function Y(t, e, r) {
71
- const o = e.root, n = r?.build ?? (await import("vite")).build, i = r?.createViteConfig ?? ((d) => E({ config: e, overrides: d })), s = p(
192
+ async function Dt(t, e, r) {
193
+ const o = e.root, i = r?.build ?? (await import("vite")).build, s = r?.createViteConfig ?? ((p) => O({ config: e, overrides: p })), n = d(
72
194
  o,
73
- t.outDir ?? e.deployment?.outDir ?? O
74
- ), c = p(o, U);
75
- await F(
195
+ t.outDir ?? e.deployment?.outDir ?? T
196
+ ), u = d(o, z);
197
+ await Q(
76
198
  o,
77
- s,
78
- D(o, "public"),
79
- c
80
- ), await n(
81
- await i({
199
+ n,
200
+ I(o, "public"),
201
+ u
202
+ ), await i(
203
+ await s({
82
204
  define: { "process.env.NODE_ENV": JSON.stringify("production") },
83
205
  mode: "production",
84
206
  build: {
85
207
  emptyOutDir: !0,
86
- outDir: s,
87
- rollupOptions: { input: V }
208
+ outDir: n,
209
+ rollupOptions: { input: G }
88
210
  }
89
211
  })
90
212
  );
91
- const a = e.deployment?.server, u = a ? p(o, a.outDir ?? j) : void 0;
92
- return a && u && await n(
93
- await i({
213
+ const a = e.deployment?.server, c = a ? d(o, a.outDir ?? Y) : void 0;
214
+ return a && c && await i(
215
+ await s({
94
216
  define: { "process.env.NODE_ENV": JSON.stringify("production") },
95
217
  mode: "production",
96
218
  build: {
97
219
  copyPublicDir: !1,
98
220
  emptyOutDir: !0,
99
- outDir: u,
100
- rollupOptions: { input: p(o, a.entry) },
221
+ outDir: c,
222
+ rollupOptions: { input: d(o, a.entry) },
101
223
  ssr: !0
102
224
  }
103
225
  })
104
- ), e.deployment?.static ? { ...await C({
105
- build: n,
226
+ ), e.deployment?.static ? { ...await H({
227
+ build: i,
106
228
  config: e,
107
- createViteConfig: i,
108
- frameworkServerOutDir: c,
229
+ createViteConfig: s,
230
+ frameworkServerOutDir: u,
109
231
  options: t,
110
- outDir: s,
232
+ outDir: n,
111
233
  root: o,
112
234
  runtime: r
113
- }), outDir: s, serverOutDir: u } : { outDir: s, serverOutDir: u };
235
+ }), outDir: n, serverOutDir: c } : { outDir: n, serverOutDir: c };
114
236
  }
115
- async function C({
237
+ async function H({
116
238
  build: t,
117
239
  config: e,
118
240
  createViteConfig: r,
119
241
  frameworkServerOutDir: o,
120
- options: n,
121
- outDir: i,
122
- root: s,
123
- runtime: c
242
+ options: i,
243
+ outDir: s,
244
+ root: n,
245
+ runtime: u
124
246
  }) {
125
247
  await t(
126
248
  await r({
@@ -131,78 +253,82 @@ async function C({
131
253
  emptyOutDir: !0,
132
254
  outDir: o,
133
255
  rollupOptions: {
134
- input: _,
256
+ input: X,
135
257
  output: { entryFileNames: "server-entry.js" }
136
258
  },
137
259
  ssr: !0
138
260
  }
139
261
  })
140
262
  );
141
- const a = S(
142
- c ? await c.readText(p(i, "demiurge-manifest.json")) : await b(p(i, "demiurge-manifest.json"), "utf8")
143
- ), u = `${R(p(o, "server-entry.js")).href}?build=${c?.now() ?? Date.now()}`, l = c ? await c.importModule(u) : await import(u);
144
- if (!A(l.routes))
263
+ const a = P(
264
+ u ? await u.readText(d(s, "demiurge-manifest.json")) : await N(d(s, "demiurge-manifest.json"), "utf8")
265
+ ), c = `${b(d(o, "server-entry.js")).href}?build=${u?.now() ?? Date.now()}`, m = u ? await u.importModule(c) : await import(c);
266
+ if (!Z(m.routes))
145
267
  throw new Error("The framework server bundle does not export routes.");
146
- const d = await (c?.generate ?? N)({
268
+ const p = await (u?.generate ?? C)({
147
269
  fonts: e.assets?.fonts,
148
270
  images: e.assets?.images,
149
- origin: n.origin ?? e.deployment?.static?.origin,
150
- outDir: i,
151
- root: s,
152
- routes: l.routes,
271
+ origin: i.origin ?? e.deployment?.static?.origin,
272
+ outDir: s,
273
+ root: n,
274
+ routes: m.routes,
153
275
  ssr: a,
154
276
  staticFileHeaders: e.security?.staticFileHeaders ?? []
155
- }), h = e.deployment?.static?.provider;
156
- return { deploymentOutDir: h ? await T({
157
- deployment: h,
158
- manifest: d,
159
- outDir: i,
160
- projectRoot: s
161
- }) : void 0, manifest: d };
162
- }
163
- function q(t, e, r) {
164
- return p(t, e ?? r ?? O);
165
- }
166
- async function F(t, e, r, o) {
167
- const n = m(t, e);
168
- if (!n || n === ".." || n.startsWith(`..${v}`) || y(n))
277
+ }), g = e.deployment?.static?.provider;
278
+ return { deploymentOutDir: g ? await $({
279
+ deployment: g,
280
+ manifest: p,
281
+ outDir: s,
282
+ projectRoot: n
283
+ }) : void 0, manifest: p };
284
+ }
285
+ function Nt(t, e, r) {
286
+ return d(t, e ?? r ?? T);
287
+ }
288
+ async function Q(t, e, r, o) {
289
+ const i = l(t, e);
290
+ if (!i || i === ".." || i.startsWith(`..${f}`) || E(i))
169
291
  throw new Error("The static output directory must be inside the Vite root.");
170
- if (r && f(e, r))
292
+ if (r && w(e, r))
171
293
  throw new Error("The static output directory must not overlap the Vite public directory.");
172
- if (f(e, o))
294
+ if (w(e, o))
173
295
  throw new Error("The static output directory must not overlap the framework server directory.");
174
- let i;
296
+ let s;
175
297
  try {
176
- i = await g(e);
177
- } catch (s) {
178
- if ($(s)) return;
179
- throw s;
298
+ s = await D(e);
299
+ } catch (n) {
300
+ if (tt(n)) return;
301
+ throw n;
180
302
  }
181
- if (i.length && !i.includes("demiurge-manifest.json") && !i.includes("demiurge-static-manifest.json"))
303
+ if (s.length && !s.includes("demiurge-manifest.json") && !s.includes("demiurge-static-manifest.json"))
182
304
  throw new Error(
183
305
  "The static output directory contains files that a Demiurge build did not create."
184
306
  );
185
307
  }
186
- function A(t) {
308
+ function Z(t) {
187
309
  return !t || typeof t != "object" || Array.isArray(t) ? !1 : Object.values(t).every((e) => typeof e == "function");
188
310
  }
189
- function f(t, e) {
190
- const r = m(t, e), o = m(e, t);
191
- return w(r) || w(o);
311
+ function w(t, e) {
312
+ const r = l(t, e), o = l(e, t);
313
+ return y(r) || y(o);
192
314
  }
193
- function w(t) {
194
- return !t || t !== ".." && !t.startsWith(`..${v}`) && !y(t);
315
+ function y(t) {
316
+ return !t || t !== ".." && !t.startsWith(`..${f}`) && !E(t);
195
317
  }
196
- function $(t) {
318
+ function tt(t) {
197
319
  return t instanceof Error && "code" in t && t.code === "ENOENT";
198
320
  }
199
321
  export {
200
- G as helpText,
201
- J as parseCliArguments,
202
- S as parseClientManifest,
203
- q as resolvePreviewOutputDirectory,
204
- Y as runBuild,
205
- H as runDev,
206
- F as validateBuildOutputDirectory
322
+ B as INSPECT_EXIT_FINDINGS,
323
+ J as INSPECT_EXIT_INVALID,
324
+ W as INSPECT_EXIT_OK,
325
+ Rt as helpText,
326
+ St as parseCliArguments,
327
+ P as parseClientManifest,
328
+ Nt as resolvePreviewOutputDirectory,
329
+ Dt as runBuild,
330
+ Tt as runDev,
331
+ Ot as runInspectCommand,
332
+ Q as validateBuildOutputDirectory
207
333
  };
208
334
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sources":["../src/cli.ts"],"sourcesContent":["import { readFile, readdir } from \"node:fs/promises\";\nimport { isAbsolute, join, relative, resolve, sep } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport type { InlineConfig } from \"vite\";\nimport { createDemiurgeViteConfig } from \"./config/vite\";\nimport type { ResolvedDemiurgeConfig } from \"./config/types\";\nimport { parseClientManifest } from \"./manifest\";\nimport type { RouteImporter } from \"./route\";\nimport {\n generateVercelStaticOutput,\n generateStaticOutput,\n type GenerateStaticOutputOptions,\n type StaticOutputManifest,\n} from \"./static\";\n\nexport { parseClientManifest } from \"./manifest\";\nexport type { ClientBuildManifest } from \"./manifest\";\n\ntype CliEnvironment = Record<string, string | undefined>;\n\nconst cliOptionNames = new Set([\"--host\", \"--origin\", \"--out-dir\", \"--port\"]);\n\nconst CLIENT_ENTRY = \"virtual:demiurge/client-entry\";\nconst SERVER_ENTRY = \"virtual:demiurge/server-entry\";\nconst DEFAULT_CLIENT_OUT_DIR = \"dist\";\nconst DEFAULT_SERVER_OUT_DIR = \"dist/server\";\nconst FRAMEWORK_SERVER_OUT_DIR = \".demiurge/server\";\n\nexport type CliOptions = {\n command: \"build\" | \"dev\" | \"help\" | \"preview\";\n host: string;\n origin?: string;\n outDir?: string;\n port: number;\n};\n\nexport type BuildRuntime = {\n build: (config: InlineConfig) => Promise<unknown>;\n createViteConfig: (overrides: InlineConfig) => Promise<InlineConfig>;\n generate: (\n options: GenerateStaticOutputOptions,\n ) => Promise<StaticOutputManifest>;\n importModule: (specifier: string) => Promise<Record<string, unknown>>;\n now: () => number;\n readText: (file: string) => Promise<string>;\n};\n\nexport type BuildResult = {\n deploymentOutDir?: string;\n manifest?: StaticOutputManifest;\n outDir: string;\n serverOutDir?: string;\n};\n\nexport function parseCliArguments(\n arguments_: string[],\n environment: CliEnvironment = {},\n): CliOptions {\n const command = arguments_[0];\n if (!command || command === \"--help\" || command === \"-h\" || command === \"help\") {\n return {\n command: \"help\",\n host: \"localhost\",\n port: 4173,\n };\n }\n if (command !== \"build\" && command !== \"dev\" && command !== \"preview\") {\n throw new Error(`Unknown command: ${command}`);\n }\n\n const options: CliOptions = {\n command,\n host: \"localhost\",\n origin: environment.SITE_ORIGIN,\n port: command === \"dev\" ? 5173 : 4173,\n };\n\n for (let index = 1; index < arguments_.length; index += 1) {\n const argument = arguments_[index]!;\n if (argument === \"--help\" || argument === \"-h\") {\n return { command: \"help\", host: \"localhost\", port: 4173 };\n }\n const [name, inlineValue] = argument.split(\"=\", 2);\n if (!cliOptionNames.has(name!)) {\n throw new Error(`Unknown option: ${argument}`);\n }\n const value = inlineValue ?? arguments_[++index];\n if (!value || value.startsWith(\"--\")) {\n throw new Error(`Option ${name} requires a value.`);\n }\n\n if (name === \"--host\") options.host = value;\n if (name === \"--origin\") options.origin = value;\n if (name === \"--out-dir\") options.outDir = value;\n if (name === \"--port\") {\n const port = Number(value);\n if (!Number.isSafeInteger(port) || port < 0 || port > 65_535) {\n throw new Error(\"The server port must be an integer from 0 through 65535.\");\n }\n options.port = port;\n }\n }\n\n return options;\n}\n\nexport const helpText = `Usage: demiurge <command> [options]\n\nCommands:\n dev Start the development server\n build Build production output\n preview Serve static output with its declared headers\n\nOptions:\n --host <host> Set the server host (default: localhost)\n --origin <origin> Set the build origin (default: SITE_ORIGIN)\n --out-dir <directory> Set the client output directory (default: dist)\n --port <port> Set the server port (dev: 5173, preview: 4173)\n -h, --help Show this help\n\nDemiurge reads demiurge.config.ts from the project root.`;\n\nexport async function runDev(\n options: CliOptions,\n config: ResolvedDemiurgeConfig,\n) {\n const { createServer } = await import(\"vite\");\n const server = await createServer(\n await createDemiurgeViteConfig({\n config,\n overrides: {\n mode: \"development\",\n server: { host: options.host, port: options.port },\n },\n }),\n );\n await server.listen();\n return server;\n}\n\nexport async function runBuild(\n options: CliOptions,\n config: ResolvedDemiurgeConfig,\n runtime?: BuildRuntime,\n): Promise<BuildResult> {\n const root = config.root;\n const build = runtime?.build ?? (await import(\"vite\")).build;\n const createViteConfig = runtime?.createViteConfig ??\n ((overrides: InlineConfig) => createDemiurgeViteConfig({ config, overrides }));\n\n const outDir = resolve(\n root,\n options.outDir ?? config.deployment?.outDir ?? DEFAULT_CLIENT_OUT_DIR,\n );\n const frameworkServerOutDir = resolve(root, FRAMEWORK_SERVER_OUT_DIR);\n\n await validateBuildOutputDirectory(\n root,\n outDir,\n join(root, \"public\"),\n frameworkServerOutDir,\n );\n\n await build(\n await createViteConfig({\n define: { \"process.env.NODE_ENV\": JSON.stringify(\"production\") },\n mode: \"production\",\n build: {\n emptyOutDir: true,\n outDir,\n rollupOptions: { input: CLIENT_ENTRY },\n },\n }),\n );\n\n const applicationServer = config.deployment?.server;\n const serverOutDir = applicationServer\n ? resolve(root, applicationServer.outDir ?? DEFAULT_SERVER_OUT_DIR)\n : undefined;\n\n if (applicationServer && serverOutDir) {\n await build(\n await createViteConfig({\n define: { \"process.env.NODE_ENV\": JSON.stringify(\"production\") },\n mode: \"production\",\n build: {\n copyPublicDir: false,\n emptyOutDir: true,\n outDir: serverOutDir,\n rollupOptions: { input: resolve(root, applicationServer.entry) },\n ssr: true,\n },\n }),\n );\n }\n\n if (!config.deployment?.static) return { outDir, serverOutDir };\n\n const staticResult = await buildStaticOutput({\n build,\n config,\n createViteConfig,\n frameworkServerOutDir,\n options,\n outDir,\n root,\n runtime,\n });\n\n return { ...staticResult, outDir, serverOutDir };\n}\n\nasync function buildStaticOutput({\n build,\n config,\n createViteConfig,\n frameworkServerOutDir,\n options,\n outDir,\n root,\n runtime,\n}: {\n build: (config: InlineConfig) => Promise<unknown>;\n config: ResolvedDemiurgeConfig;\n createViteConfig: (overrides: InlineConfig) => Promise<InlineConfig>;\n frameworkServerOutDir: string;\n options: CliOptions;\n outDir: string;\n root: string;\n runtime?: BuildRuntime;\n}) {\n await build(\n await createViteConfig({\n define: { \"process.env.NODE_ENV\": JSON.stringify(\"production\") },\n mode: \"production\",\n build: {\n copyPublicDir: false,\n emptyOutDir: true,\n outDir: frameworkServerOutDir,\n rollupOptions: {\n input: SERVER_ENTRY,\n output: { entryFileNames: \"server-entry.js\" },\n },\n ssr: true,\n },\n }),\n );\n\n const clientManifest = parseClientManifest(\n runtime\n ? await runtime.readText(resolve(outDir, \"demiurge-manifest.json\"))\n : await readFile(resolve(outDir, \"demiurge-manifest.json\"), \"utf8\"),\n );\n const serverEntryUrl = `${\n pathToFileURL(resolve(frameworkServerOutDir, \"server-entry.js\")).href\n }?build=${runtime?.now() ?? Date.now()}`;\n const serverEntry = runtime\n ? await runtime.importModule(serverEntryUrl)\n : await import(serverEntryUrl);\n if (!isRouteImporterRecord(serverEntry.routes)) {\n throw new Error(\"The framework server bundle does not export routes.\");\n }\n\n const manifest = await (runtime?.generate ?? generateStaticOutput)({\n fonts: config.assets?.fonts,\n images: config.assets?.images,\n origin: options.origin ?? config.deployment?.static?.origin,\n outDir,\n root,\n routes: serverEntry.routes,\n ssr: clientManifest,\n staticFileHeaders: config.security?.staticFileHeaders ?? [],\n });\n\n const provider = config.deployment?.static?.provider;\n const deploymentOutDir = provider\n ? await generateVercelStaticOutput({\n deployment: provider,\n manifest,\n outDir,\n projectRoot: root,\n })\n : undefined;\n\n return { deploymentOutDir, manifest };\n}\n\nexport function resolvePreviewOutputDirectory(\n root: string,\n outDir: string | undefined,\n configuredOutDir?: string,\n) {\n return resolve(root, outDir ?? configuredOutDir ?? DEFAULT_CLIENT_OUT_DIR);\n}\n\nexport async function validateBuildOutputDirectory(\n root: string,\n outDir: string,\n publicDir: false | string,\n serverOutDir: string,\n) {\n const pathFromRoot = relative(root, outDir);\n if (\n !pathFromRoot ||\n pathFromRoot === \"..\" ||\n pathFromRoot.startsWith(`..${sep}`) ||\n isAbsolute(pathFromRoot)\n ) {\n throw new Error(\"The static output directory must be inside the Vite root.\");\n }\n\n if (publicDir && pathsOverlap(outDir, publicDir)) {\n throw new Error(\"The static output directory must not overlap the Vite public directory.\");\n }\n\n if (pathsOverlap(outDir, serverOutDir)) {\n throw new Error(\"The static output directory must not overlap the framework server directory.\");\n }\n\n let entries: string[];\n try {\n entries = await readdir(outDir);\n } catch (error) {\n if (isMissingPath(error)) return;\n throw error;\n }\n\n if (\n entries.length &&\n !entries.includes(\"demiurge-manifest.json\") &&\n !entries.includes(\"demiurge-static-manifest.json\")\n ) {\n throw new Error(\n \"The static output directory contains files that a Demiurge build did not create.\",\n );\n }\n}\n\nfunction isRouteImporterRecord(\n value: unknown,\n): value is Record<string, RouteImporter> {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return false;\n }\n\n return Object.values(value).every((load) => typeof load === \"function\");\n}\n\nfunction pathsOverlap(left: string, right: string) {\n const fromLeft = relative(left, right);\n const fromRight = relative(right, left);\n return isSameOrChildPath(fromLeft) || isSameOrChildPath(fromRight);\n}\n\nfunction isSameOrChildPath(pathname: string) {\n return !pathname ||\n (pathname !== \"..\" && !pathname.startsWith(`..${sep}`) &&\n !isAbsolute(pathname));\n}\n\nfunction isMissingPath(error: unknown) {\n return error instanceof Error && \"code\" in error && error.code === \"ENOENT\";\n}\n"],"names":["cliOptionNames","CLIENT_ENTRY","SERVER_ENTRY","DEFAULT_CLIENT_OUT_DIR","DEFAULT_SERVER_OUT_DIR","FRAMEWORK_SERVER_OUT_DIR","parseCliArguments","arguments_","environment","command","options","index","argument","name","inlineValue","value","port","helpText","runDev","config","createServer","server","createDemiurgeViteConfig","runBuild","runtime","root","build","createViteConfig","overrides","outDir","resolve","frameworkServerOutDir","validateBuildOutputDirectory","join","applicationServer","serverOutDir","buildStaticOutput","clientManifest","parseClientManifest","readFile","serverEntryUrl","pathToFileURL","serverEntry","isRouteImporterRecord","manifest","generateStaticOutput","provider","generateVercelStaticOutput","resolvePreviewOutputDirectory","configuredOutDir","publicDir","pathFromRoot","relative","sep","isAbsolute","pathsOverlap","entries","readdir","error","isMissingPath","load","left","right","fromLeft","fromRight","isSameOrChildPath","pathname"],"mappings":";;;;;;AAoBA,MAAMA,wBAAqB,IAAI,CAAC,UAAU,YAAY,aAAa,QAAQ,CAAC,GAEtEC,IAAe,iCACfC,IAAe,iCACfC,IAAyB,QACzBC,IAAyB,eACzBC,IAA2B;AA4B1B,SAASC,EACdC,GACAC,IAA8B,IAClB;AACZ,QAAMC,IAAUF,EAAW,CAAC;AAC5B,MAAI,CAACE,KAAWA,MAAY,YAAYA,MAAY,QAAQA,MAAY;AACtE,WAAO;AAAA,MACL,SAAS;AAAA,MACT,MAAM;AAAA,MACN,MAAM;AAAA,IAAA;AAGV,MAAIA,MAAY,WAAWA,MAAY,SAASA,MAAY;AAC1D,UAAM,IAAI,MAAM,oBAAoBA,CAAO,EAAE;AAG/C,QAAMC,IAAsB;AAAA,IAC1B,SAAAD;AAAA,IACA,MAAM;AAAA,IACN,QAAQD,EAAY;AAAA,IACpB,MAAMC,MAAY,QAAQ,OAAO;AAAA,EAAA;AAGnC,WAASE,IAAQ,GAAGA,IAAQJ,EAAW,QAAQI,KAAS,GAAG;AACzD,UAAMC,IAAWL,EAAWI,CAAK;AACjC,QAAIC,MAAa,YAAYA,MAAa;AACxC,aAAO,EAAE,SAAS,QAAQ,MAAM,aAAa,MAAM,KAAA;AAErD,UAAM,CAACC,GAAMC,CAAW,IAAIF,EAAS,MAAM,KAAK,CAAC;AACjD,QAAI,CAACZ,EAAe,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AAkB;AAC3C,SAAO,CAACA,KACLA,MAAa,QAAQ,CAACA,EAAS,WAAW,KAAKb,CAAG,EAAE,KACnD,CAACC,EAAWY,CAAQ;AAC1B;AAEA,SAASP,EAAcD,GAAgB;AACrC,SAAOA,aAAiB,SAAS,UAAUA,KAASA,EAAM,SAAS;AACrE;"}
1
+ {"version":3,"file":"cli.js","sources":["../src/inspect/types.ts","../src/inspect/report.ts","../src/inspect/command.ts","../src/cli.ts"],"sourcesContent":["import type { HttpMethod } from \"../route\";\nimport type {\n DocumentCspState,\n RouteAccessState,\n StaticPolicyFinding,\n} from \"../vite/policy-verification\";\n\n/**\n * The version of the static policy report. ADR 0019 raises this integer when\n * the framework removes a field or changes the meaning of a field.\n */\nexport const STATIC_POLICY_REPORT_VERSION = 1;\n\n/**\n * The version of the problem document that the inspect command writes when it\n * cannot produce a report.\n */\nexport const INSPECTION_PROBLEM_VERSION = 1;\n\n/**\n * The origin of one fact in a report. The value `static` states that the build\n * knows the fact. The value `request` states that only a request supplies it.\n */\nexport type InspectionResolution = \"request\" | \"static\";\n\n/** The rule that removed one value from a report. */\nexport type InspectionRedactionReason =\n /** A cookie holds the value. */\n | \"cookie-value\"\n /** An `env.secret(...)` declaration produced the value. */\n | \"environment-secret\"\n /** A session record holds the value. */\n | \"session-record\";\n\n/** One value that the serializer removed from a report. */\nexport type InspectionRedaction = {\n /** The name of the field that held the value. */\n name: string;\n /** The dotted path of the field inside the report. */\n path: string;\n /** The rule that removed the value. */\n reason: InspectionRedactionReason;\n};\n\n/** The named sections of the static policy report. */\nexport type StaticPolicyReportSection =\n | \"findings\"\n | \"redactions\"\n | \"request\"\n | \"routes\";\n\n/** The kind of route file that the static pass read. */\nexport type StaticRouteKind = \"attached\" | \"page\" | \"resource\";\n\n/**\n * The statically readable description of one route file.\n *\n * Each declared field states what the file itself declares. The framework\n * resolves the cascade of the route tree and reports the result of the\n * cascade in the `findings` section.\n */\nexport type StaticRouteReport = {\n /** The access state that the route file declares. */\n declaredAccess: RouteAccessState;\n /** The Content-Security-Policy state that the route file declares. */\n declaredDocumentCsp: DocumentCspState;\n /** `true` when the route file declares a document policy. */\n declaresDocumentPolicy: boolean;\n /** The path of the route file, relative to the route directory. */\n file: string;\n /** The kind of the route file. */\n kind: StaticRouteKind;\n /** The HTTP methods that the route file exports. */\n methods: HttpMethod[];\n /** The route pattern. An attached file has no pattern. */\n pattern?: string;\n};\n\n/**\n * The report that `demiurge inspect` writes to standard output. Each section\n * states the resolution of its facts in the `resolutions` record.\n */\nexport type StaticPolicyReport = {\n /** The static policy findings, sorted by file, export name, and code. */\n findings: StaticPolicyFinding[];\n /** The values that the serializer removed. */\n redactions: InspectionRedaction[];\n /** The names of the facts that only a request supplies. */\n request: string[];\n /** The resolution of each section of the report. */\n resolutions: Record<StaticPolicyReportSection, InspectionResolution>;\n /** Every route file under the route directory. */\n routes: StaticRouteReport[];\n /** The route directory, relative to the project root. */\n routesDir: string;\n /** The version of this report shape. */\n version: number;\n};\n\n/** The reason that the inspect command could not produce a report. */\nexport type InspectionProblemCode =\n /** The framework could not read the configuration. */\n | \"configuration-unreadable\"\n /** The command received an invalid argument. */\n | \"invalid-argument\";\n\n/**\n * The document that the inspect command writes when it cannot produce a\n * report. The command then exits with code 2.\n */\nexport type InspectionProblem = {\n /** The stable code of the condition. */\n code: InspectionProblemCode;\n /** The description of the condition. */\n detail: string;\n /** The short name of the condition. */\n title: string;\n /** The version of this problem shape. */\n version: number;\n};\n","import { relative, sep } from \"node:path\";\nimport { toRoutePattern, toRouteSegments } from \"../router\";\nimport type { EnvSchema } from \"../security\";\nimport {\n inspectRoutePolicies,\n type DemiurgeVitePluginOptions,\n} from \"../vite/plugin\";\nimport type { RouteFileInspection } from \"../vite/policy-verification\";\nimport {\n STATIC_POLICY_REPORT_VERSION,\n type StaticPolicyReport,\n type StaticRouteReport,\n} from \"./types\";\n\nexport type StaticPolicyReportOptions = {\n /** The plugin options of the application. */\n options?: DemiurgeVitePluginOptions;\n /** The absolute path of the project root. */\n root: string;\n};\n\n// A build knows the route tree and the policy cascade. It does not know a\n// header, a cookie, a session, or an authorization result, because a request\n// supplies each one. The report names these facts, so a reader learns which\n// answer needs a running application.\nconst requestFacts = [\n \"authorization-result\",\n \"cookie-values\",\n \"csrf-token\",\n \"environment-values\",\n \"rate-limit-state\",\n \"request-headers\",\n \"response-headers\",\n \"session-record\",\n];\n\n/**\n * Builds the static inspection report of an application.\n *\n * The function reads the route tree and resolves the policy cascade through\n * `inspectRoutePolicies`. It loads no route module, so it runs no data loader\n * and no mutation handler.\n */\nexport async function createStaticPolicyReport(\n input: StaticPolicyReportOptions,\n): Promise<StaticPolicyReport> {\n const options = input.options ?? {};\n const pass = await inspectRoutePolicies(input.root, options);\n const routes = pass.inspections\n .map((inspection) => toStaticRouteReport(pass.routesDir, inspection))\n .sort((left, right) => left.file.localeCompare(right.file));\n\n return {\n findings: pass.findings,\n redactions: [],\n request: requestFacts,\n resolutions: {\n findings: \"static\",\n redactions: \"static\",\n request: \"request\",\n routes: \"static\",\n },\n routes,\n routesDir: toPosixPath(relative(input.root, pass.routesDir)),\n version: STATIC_POLICY_REPORT_VERSION,\n };\n}\n\n/** Reads the names of the variables that `env.secret(...)` declared. */\nexport function findSecretEnvKeys(schema: EnvSchema | undefined) {\n return Object.entries(schema ?? {})\n .filter(([, variable]) => variable.sensitive)\n .map(([key]) => key)\n .sort();\n}\n\n/** Counts the findings that carry error severity. */\nexport function countErrorFindings(report: StaticPolicyReport) {\n return report.findings.filter((finding) => finding.severity === \"error\")\n .length;\n}\n\n/** Writes the human summary that the command sends to standard error. */\nexport function formatStaticPolicyReportSummary(report: StaticPolicyReport) {\n const errors = countErrorFindings(report);\n const warnings = report.findings.length - errors;\n\n return [\n `Demiurge inspected ${report.routes.length} route files in ${report.routesDir}.`,\n `Findings: ${errors} error, ${warnings} warning.`,\n `The report states ${report.request.length} facts that only a request supplies.`,\n ...report.findings.map((finding) =>\n ` ${finding.severity}: ${toPosixPath(finding.file)} [${finding.code}] ${finding.message}`\n ),\n ].join(\"\\n\");\n}\n\nfunction toStaticRouteReport(\n routesDir: string,\n inspection: RouteFileInspection,\n): StaticRouteReport {\n const file = toPosixPath(relative(routesDir, inspection.file));\n const fileSegments = file.replace(/\\.tsx?$/, \"\").split(\"/\");\n const attached = fileSegments.at(-1)?.startsWith(\"@\") ?? false;\n\n return {\n declaredAccess: inspection.accessState,\n declaredDocumentCsp: inspection.documentCspState,\n declaresDocumentPolicy: inspection.declaresDocumentPolicy,\n file,\n kind: attached\n ? \"attached\"\n : inspection.declaresPageRoute\n ? \"page\"\n : \"resource\",\n methods: inspection.methods,\n ...(attached\n ? {}\n : { pattern: toRoutePattern(toRouteSegments(fileSegments)) }),\n };\n}\n\nfunction toPosixPath(pathname: string) {\n return pathname.split(sep).join(\"/\");\n}\n","import type { ResolvedDemiurgeConfig } from \"../config/types\";\nimport { toPluginOptions } from \"../config/vite\";\nimport {\n countErrorFindings,\n createStaticPolicyReport,\n findSecretEnvKeys,\n formatStaticPolicyReportSummary,\n} from \"./report\";\nimport { serializeInspectionReport } from \"./redact\";\nimport {\n INSPECTION_PROBLEM_VERSION,\n type InspectionProblem,\n type InspectionProblemCode,\n} from \"./types\";\n\n/** The exit codes of the `demiurge inspect` command. */\nexport const INSPECT_EXIT_OK = 0;\nexport const INSPECT_EXIT_FINDINGS = 1;\nexport const INSPECT_EXIT_INVALID = 2;\n\nexport type InspectCommandInput = {\n /** The arguments that follow the command name. */\n arguments: readonly string[];\n /** Reads the configuration of the application. */\n loadConfig: () => Promise<ResolvedDemiurgeConfig>;\n};\n\nexport type InspectCommandResult = {\n /** The exit code of the command. */\n exitCode: number;\n /** The human summary that the command writes to standard error. */\n stderr: string;\n /** The JSON document that the command writes to standard output. */\n stdout: string;\n};\n\n/**\n * Runs the `demiurge inspect` command.\n *\n * The command reads the route tree, resolves the policy cascade, and returns\n * one JSON document. The command loads no route module, so it runs no data\n * loader and no mutation handler.\n */\nexport async function runInspectCommand(\n input: InspectCommandInput,\n): Promise<InspectCommandResult> {\n if (input.arguments.length > 0) {\n return toProblemResult(\n \"invalid-argument\",\n \"The inspect command accepts no argument.\",\n `The command received ${input.arguments.join(\" \")}.`,\n );\n }\n\n let config: ResolvedDemiurgeConfig;\n\n try {\n config = await input.loadConfig();\n } catch (error) {\n return toProblemResult(\n \"configuration-unreadable\",\n \"Demiurge could not read the configuration.\",\n error instanceof Error ? error.message : String(error),\n );\n }\n\n const report = await createStaticPolicyReport({\n options: toPluginOptions(config),\n root: config.root,\n });\n\n return {\n exitCode: countErrorFindings(report) > 0\n ? INSPECT_EXIT_FINDINGS\n : INSPECT_EXIT_OK,\n stderr: formatStaticPolicyReportSummary(report),\n stdout: serializeInspectionReport(report, {\n secretEnvKeys: findSecretEnvKeys(config.env),\n }),\n };\n}\n\nfunction toProblemResult(\n code: InspectionProblemCode,\n title: string,\n detail: string,\n): InspectCommandResult {\n const problem: InspectionProblem = {\n code,\n detail,\n title,\n version: INSPECTION_PROBLEM_VERSION,\n };\n\n return {\n exitCode: INSPECT_EXIT_INVALID,\n stderr: `${title}\\n${detail}`,\n stdout: serializeInspectionReport(problem),\n };\n}\n","import { readFile, readdir } from \"node:fs/promises\";\nimport { isAbsolute, join, relative, resolve, sep } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport type { InlineConfig } from \"vite\";\nimport { createDemiurgeViteConfig } from \"./config/vite\";\nimport type { ResolvedDemiurgeConfig } from \"./config/types\";\nimport { parseClientManifest } from \"./manifest\";\nimport type { RouteImporter } from \"./route\";\nimport {\n generateVercelStaticOutput,\n generateStaticOutput,\n type GenerateStaticOutputOptions,\n type StaticOutputManifest,\n} from \"./static\";\n\nexport { parseClientManifest } from \"./manifest\";\nexport type { ClientBuildManifest } from \"./manifest\";\nexport {\n INSPECT_EXIT_FINDINGS,\n INSPECT_EXIT_INVALID,\n INSPECT_EXIT_OK,\n runInspectCommand,\n} from \"./inspect\";\nexport type { InspectCommandResult } from \"./inspect\";\n\ntype CliEnvironment = Record<string, string | undefined>;\n\nconst cliOptionNames = new Set([\"--host\", \"--origin\", \"--out-dir\", \"--port\"]);\n\nconst CLIENT_ENTRY = \"virtual:demiurge/client-entry\";\nconst SERVER_ENTRY = \"virtual:demiurge/server-entry\";\nconst DEFAULT_CLIENT_OUT_DIR = \"dist\";\nconst DEFAULT_SERVER_OUT_DIR = \"dist/server\";\nconst FRAMEWORK_SERVER_OUT_DIR = \".demiurge/server\";\n\nexport type CliOptions = {\n command: \"build\" | \"dev\" | \"help\" | \"inspect\" | \"preview\";\n host: string;\n origin?: string;\n outDir?: string;\n port: number;\n};\n\nexport type BuildRuntime = {\n build: (config: InlineConfig) => Promise<unknown>;\n createViteConfig: (overrides: InlineConfig) => Promise<InlineConfig>;\n generate: (\n options: GenerateStaticOutputOptions,\n ) => Promise<StaticOutputManifest>;\n importModule: (specifier: string) => Promise<Record<string, unknown>>;\n now: () => number;\n readText: (file: string) => Promise<string>;\n};\n\nexport type BuildResult = {\n deploymentOutDir?: string;\n manifest?: StaticOutputManifest;\n outDir: string;\n serverOutDir?: string;\n};\n\nexport function parseCliArguments(\n arguments_: string[],\n environment: CliEnvironment = {},\n): CliOptions {\n const command = arguments_[0];\n if (!command || command === \"--help\" || command === \"-h\" || command === \"help\") {\n return {\n command: \"help\",\n host: \"localhost\",\n port: 4173,\n };\n }\n if (\n command !== \"build\" && command !== \"dev\" && command !== \"inspect\" &&\n command !== \"preview\"\n ) {\n throw new Error(`Unknown command: ${command}`);\n }\n\n const options: CliOptions = {\n command,\n host: \"localhost\",\n origin: environment.SITE_ORIGIN,\n port: command === \"dev\" ? 5173 : 4173,\n };\n\n for (let index = 1; index < arguments_.length; index += 1) {\n const argument = arguments_[index]!;\n if (argument === \"--help\" || argument === \"-h\") {\n return { command: \"help\", host: \"localhost\", port: 4173 };\n }\n const [name, inlineValue] = argument.split(\"=\", 2);\n if (!cliOptionNames.has(name!)) {\n throw new Error(`Unknown option: ${argument}`);\n }\n const value = inlineValue ?? arguments_[++index];\n if (!value || value.startsWith(\"--\")) {\n throw new Error(`Option ${name} requires a value.`);\n }\n\n if (name === \"--host\") options.host = value;\n if (name === \"--origin\") options.origin = value;\n if (name === \"--out-dir\") options.outDir = value;\n if (name === \"--port\") {\n const port = Number(value);\n if (!Number.isSafeInteger(port) || port < 0 || port > 65_535) {\n throw new Error(\"The server port must be an integer from 0 through 65535.\");\n }\n options.port = port;\n }\n }\n\n return options;\n}\n\nexport const helpText = `Usage: demiurge <command> [options]\n\nCommands:\n dev Start the development server\n build Build production output\n inspect Write the static inspection report as JSON\n preview Serve static output with its declared headers\n\nOptions:\n --host <host> Set the server host (default: localhost)\n --origin <origin> Set the build origin (default: SITE_ORIGIN)\n --out-dir <directory> Set the client output directory (default: dist)\n --port <port> Set the server port (dev: 5173, preview: 4173)\n -h, --help Show this help\n\nThe inspect command writes JSON to standard output and a summary to standard\nerror. It exits with 0 for no error finding, 1 for at least one error finding,\nand 2 for an invalid argument or an unreadable configuration.\n\nDemiurge reads demiurge.config.ts from the project root.`;\n\nexport async function runDev(\n options: CliOptions,\n config: ResolvedDemiurgeConfig,\n) {\n const { createServer } = await import(\"vite\");\n const server = await createServer(\n await createDemiurgeViteConfig({\n config,\n overrides: {\n mode: \"development\",\n server: { host: options.host, port: options.port },\n },\n }),\n );\n await server.listen();\n return server;\n}\n\nexport async function runBuild(\n options: CliOptions,\n config: ResolvedDemiurgeConfig,\n runtime?: BuildRuntime,\n): Promise<BuildResult> {\n const root = config.root;\n const build = runtime?.build ?? (await import(\"vite\")).build;\n const createViteConfig = runtime?.createViteConfig ??\n ((overrides: InlineConfig) => createDemiurgeViteConfig({ config, overrides }));\n\n const outDir = resolve(\n root,\n options.outDir ?? config.deployment?.outDir ?? DEFAULT_CLIENT_OUT_DIR,\n );\n const frameworkServerOutDir = resolve(root, FRAMEWORK_SERVER_OUT_DIR);\n\n await validateBuildOutputDirectory(\n root,\n outDir,\n join(root, \"public\"),\n frameworkServerOutDir,\n );\n\n await build(\n await createViteConfig({\n define: { \"process.env.NODE_ENV\": JSON.stringify(\"production\") },\n mode: \"production\",\n build: {\n emptyOutDir: true,\n outDir,\n rollupOptions: { input: CLIENT_ENTRY },\n },\n }),\n );\n\n const applicationServer = config.deployment?.server;\n const serverOutDir = applicationServer\n ? resolve(root, applicationServer.outDir ?? DEFAULT_SERVER_OUT_DIR)\n : undefined;\n\n if (applicationServer && serverOutDir) {\n await build(\n await createViteConfig({\n define: { \"process.env.NODE_ENV\": JSON.stringify(\"production\") },\n mode: \"production\",\n build: {\n copyPublicDir: false,\n emptyOutDir: true,\n outDir: serverOutDir,\n rollupOptions: { input: resolve(root, applicationServer.entry) },\n ssr: true,\n },\n }),\n );\n }\n\n if (!config.deployment?.static) return { outDir, serverOutDir };\n\n const staticResult = await buildStaticOutput({\n build,\n config,\n createViteConfig,\n frameworkServerOutDir,\n options,\n outDir,\n root,\n runtime,\n });\n\n return { ...staticResult, outDir, serverOutDir };\n}\n\nasync function buildStaticOutput({\n build,\n config,\n createViteConfig,\n frameworkServerOutDir,\n options,\n outDir,\n root,\n runtime,\n}: {\n build: (config: InlineConfig) => Promise<unknown>;\n config: ResolvedDemiurgeConfig;\n createViteConfig: (overrides: InlineConfig) => Promise<InlineConfig>;\n frameworkServerOutDir: string;\n options: CliOptions;\n outDir: string;\n root: string;\n runtime?: BuildRuntime;\n}) {\n await build(\n await createViteConfig({\n define: { \"process.env.NODE_ENV\": JSON.stringify(\"production\") },\n mode: \"production\",\n build: {\n copyPublicDir: false,\n emptyOutDir: true,\n outDir: frameworkServerOutDir,\n rollupOptions: {\n input: SERVER_ENTRY,\n output: { entryFileNames: \"server-entry.js\" },\n },\n ssr: true,\n },\n }),\n );\n\n const clientManifest = parseClientManifest(\n runtime\n ? await runtime.readText(resolve(outDir, \"demiurge-manifest.json\"))\n : await readFile(resolve(outDir, \"demiurge-manifest.json\"), \"utf8\"),\n );\n const serverEntryUrl = `${\n pathToFileURL(resolve(frameworkServerOutDir, \"server-entry.js\")).href\n }?build=${runtime?.now() ?? Date.now()}`;\n const serverEntry = runtime\n ? await runtime.importModule(serverEntryUrl)\n : await import(serverEntryUrl);\n if (!isRouteImporterRecord(serverEntry.routes)) {\n throw new Error(\"The framework server bundle does not export routes.\");\n }\n\n const manifest = await (runtime?.generate ?? generateStaticOutput)({\n fonts: config.assets?.fonts,\n images: config.assets?.images,\n origin: options.origin ?? config.deployment?.static?.origin,\n outDir,\n root,\n routes: serverEntry.routes,\n ssr: clientManifest,\n staticFileHeaders: config.security?.staticFileHeaders ?? [],\n });\n\n const provider = config.deployment?.static?.provider;\n const deploymentOutDir = provider\n ? await generateVercelStaticOutput({\n deployment: provider,\n manifest,\n outDir,\n projectRoot: root,\n })\n : undefined;\n\n return { deploymentOutDir, manifest };\n}\n\nexport function resolvePreviewOutputDirectory(\n root: string,\n outDir: string | undefined,\n configuredOutDir?: string,\n) {\n return resolve(root, outDir ?? configuredOutDir ?? DEFAULT_CLIENT_OUT_DIR);\n}\n\nexport async function validateBuildOutputDirectory(\n root: string,\n outDir: string,\n publicDir: false | string,\n serverOutDir: string,\n) {\n const pathFromRoot = relative(root, outDir);\n if (\n !pathFromRoot ||\n pathFromRoot === \"..\" ||\n pathFromRoot.startsWith(`..${sep}`) ||\n isAbsolute(pathFromRoot)\n ) {\n throw new Error(\"The static output directory must be inside the Vite root.\");\n }\n\n if (publicDir && pathsOverlap(outDir, publicDir)) {\n throw new Error(\"The static output directory must not overlap the Vite public directory.\");\n }\n\n if (pathsOverlap(outDir, serverOutDir)) {\n throw new Error(\"The static output directory must not overlap the framework server directory.\");\n }\n\n let entries: string[];\n try {\n entries = await readdir(outDir);\n } catch (error) {\n if (isMissingPath(error)) return;\n throw error;\n }\n\n if (\n entries.length &&\n !entries.includes(\"demiurge-manifest.json\") &&\n !entries.includes(\"demiurge-static-manifest.json\")\n ) {\n throw new Error(\n \"The static output directory contains files that a Demiurge build did not create.\",\n );\n }\n}\n\nfunction isRouteImporterRecord(\n value: unknown,\n): value is Record<string, RouteImporter> {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return false;\n }\n\n return Object.values(value).every((load) => typeof load === \"function\");\n}\n\nfunction pathsOverlap(left: string, right: string) {\n const fromLeft = relative(left, right);\n const fromRight = relative(right, left);\n return isSameOrChildPath(fromLeft) || isSameOrChildPath(fromRight);\n}\n\nfunction isSameOrChildPath(pathname: string) {\n return !pathname ||\n (pathname !== \"..\" && !pathname.startsWith(`..${sep}`) &&\n !isAbsolute(pathname));\n}\n\nfunction isMissingPath(error: unknown) {\n return error instanceof Error && \"code\" in error && error.code === \"ENOENT\";\n}\n"],"names":["STATIC_POLICY_REPORT_VERSION","INSPECTION_PROBLEM_VERSION","requestFacts","createStaticPolicyReport","input","options","pass","inspectRoutePolicies","routes","inspection","toStaticRouteReport","left","right","toPosixPath","relative","findSecretEnvKeys","schema","variable","key","countErrorFindings","report","finding","formatStaticPolicyReportSummary","errors","warnings","routesDir","file","fileSegments","attached","toRoutePattern","toRouteSegments","pathname","sep","INSPECT_EXIT_OK","INSPECT_EXIT_FINDINGS","INSPECT_EXIT_INVALID","runInspectCommand","toProblemResult","config","error","toPluginOptions","serializeInspectionReport","code","title","detail","problem","cliOptionNames","CLIENT_ENTRY","SERVER_ENTRY","DEFAULT_CLIENT_OUT_DIR","DEFAULT_SERVER_OUT_DIR","FRAMEWORK_SERVER_OUT_DIR","parseCliArguments","arguments_","environment","command","index","argument","name","inlineValue","value","port","helpText","runDev","createServer","server","createDemiurgeViteConfig","runBuild","runtime","root","build","createViteConfig","overrides","outDir","resolve","frameworkServerOutDir","validateBuildOutputDirectory","join","applicationServer","serverOutDir","buildStaticOutput","clientManifest","parseClientManifest","readFile","serverEntryUrl","pathToFileURL","serverEntry","isRouteImporterRecord","manifest","generateStaticOutput","provider","generateVercelStaticOutput","resolvePreviewOutputDirectory","configuredOutDir","publicDir","pathFromRoot","isAbsolute","pathsOverlap","entries","readdir","isMissingPath","load","fromLeft","fromRight","isSameOrChildPath"],"mappings":";;;;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AS,OAAOA,KAAU,YAAY,MAAM,QAAQA,CAAK,IACrD,KAGF,OAAO,OAAOA,CAAK,EAAE,MAAM,CAACyC,MAAS,OAAOA,KAAS,UAAU;AACxE;AAEA,SAASJ,EAAatF,GAAcC,GAAe;AACjD,QAAM0F,IAAWxF,EAASH,GAAMC,CAAK,GAC/B2F,IAAYzF,EAASF,GAAOD,CAAI;AACtC,SAAO6F,EAAkBF,CAAQ,KAAKE,EAAkBD,CAAS;AACnE;AAEA,SAASC,EAAkBzE,GAAkB;AAC3C,SAAO,CAACA,KACLA,MAAa,QAAQ,CAACA,EAAS,WAAW,KAAKC,CAAG,EAAE,KACnD,CAACgE,EAAWjE,CAAQ;AAC1B;AAEA,SAASqE,GAAc7D,GAAgB;AACrC,SAAOA,aAAiB,SAAS,UAAUA,KAASA,EAAM,SAAS;AACrE;"}
@@ -1,7 +1,7 @@
1
1
  import { existsSync as f } from "node:fs";
2
2
  import { join as u, resolve as a, dirname as s } from "node:path";
3
- import { D as r, v as d } from "../chunks/vite-DO70kZA6.js";
4
- import { c as F, t as M } from "../chunks/vite-DO70kZA6.js";
3
+ import { D as r, v as d } from "../chunks/vite-QoqrGl6f.js";
4
+ import { c as F, t as M } from "../chunks/vite-QoqrGl6f.js";
5
5
  function x(e) {
6
6
  return e;
7
7
  }
@@ -55,7 +55,17 @@ export type DemiurgeConfig<Locale extends string = string> = {
55
55
  routing?: DemiurgeRoutingConfig<Locale>;
56
56
  security?: DemiurgeSecurityConfig;
57
57
  vite?: DemiurgeViteExtension;
58
- unstable_viteConfig?: (config: ViteUserConfig) => ViteUserConfig | Promise<ViteUserConfig>;
58
+ /**
59
+ * This callback is unsafe and unstable.
60
+ *
61
+ * It has no compatibility guarantee between Demiurge versions. It receives
62
+ * the resolved Vite configuration of the framework, after the framework
63
+ * adds its own build-time security plugins. Those plugins enforce the
64
+ * server-only module boundary and the client environment boundary. An
65
+ * application that removes or reorders a framework plugin in this callback
66
+ * loses that boundary. The application then owns the removed boundary.
67
+ */
68
+ unsafe_unstable_viteConfig?: (config: ViteUserConfig) => ViteUserConfig | Promise<ViteUserConfig>;
59
69
  };
60
70
  export type ResolvedDemiurgeConfig = DemiurgeConfig & {
61
71
  configFile: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,MAAM,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EACV,2BAA2B,EAC3B,sBAAsB,EACvB,MAAM,WAAW,CAAC;AAGnB,MAAM,MAAM,qBAAqB,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,IAAI;IAClE,OAAO,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,GAAG;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACH,CAAC;AAGF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,EAAE;QACT,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACzB,CAAC;AAGF,MAAM,MAAM,sBAAsB,GAAG;IACnC,iBAAiB,CAAC,EAAE,SAAS,2BAA2B,EAAE,CAAC;CAC5D,CAAC;AAGF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,M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KACnB,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,cAAc,GAAG;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
@@ -1,10 +1,10 @@
1
- import { a as E, c as p, b as y, d as w, s as S } from "../chunks/index-BVk9zWbe.js";
2
- import { c as b } from "../chunks/testing-DueXbMo4.js";
1
+ import { a as E, c as p, b as y, d as w, s as S } from "../chunks/index-0MNiR_wo.js";
2
+ import { c as b } from "../chunks/testing-CUwGj2ie.js";
3
3
  import { renderToReadableStream as R } from "react-dom/server";
4
4
  import "react";
5
5
  import "react/jsx-runtime";
6
6
  import { i as L, I as v, R as A, c as T } from "../chunks/static-files-ehaD1kE7.js";
7
- import { c as P } from "../chunks/document-shell-CpJnFtSC.js";
7
+ import { c as P } from "../chunks/document-shell-9GPwtcTt.js";
8
8
  const C = /* @__PURE__ */ new Set([
9
9
  "/demiurge-manifest.json",
10
10
  "/index.html"