@demiurgejs/core 0.2.0-beta.5 → 0.2.0-beta.7
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.
- package/README.md +14 -0
- package/bin/demiurge.mjs +6 -0
- package/dist/browser/file-router.d.ts +1 -0
- package/dist/browser/file-router.d.ts.map +1 -1
- package/dist/chunks/{document-shell-9GPwtcTt.js → document-shell-C0aPrkhd.js} +2 -2
- package/dist/chunks/{document-shell-9GPwtcTt.js.map → document-shell-C0aPrkhd.js.map} +1 -1
- package/dist/chunks/image-CRerJ5BY.js +145 -0
- package/dist/chunks/image-CRerJ5BY.js.map +1 -0
- package/dist/chunks/{image-codec-Dh1POFhE.js → image-codec-CQ8Cwxwb.js} +2 -2
- package/dist/chunks/{image-codec-Dh1POFhE.js.map → image-codec-CQ8Cwxwb.js.map} +1 -1
- package/dist/chunks/{images-CG7ZzayG.js → images-QgdmLyQ3.js} +11 -11
- package/dist/chunks/{images-CG7ZzayG.js.map → images-QgdmLyQ3.js.map} +1 -1
- package/dist/chunks/{index-0MNiR_wo.js → index-LYve1rQp.js} +286 -351
- package/dist/chunks/index-LYve1rQp.js.map +1 -0
- package/dist/chunks/links-iU22QkCE.js +68 -0
- package/dist/chunks/links-iU22QkCE.js.map +1 -0
- package/dist/chunks/{plugin-BZauDxRY.js → plugin-bkP6WwrS.js} +13 -12
- package/dist/chunks/{plugin-BZauDxRY.js.map → plugin-bkP6WwrS.js.map} +1 -1
- package/dist/chunks/runtime-BH519j2t.js +294 -0
- package/dist/chunks/runtime-BH519j2t.js.map +1 -0
- package/dist/chunks/streaming-BlKlC3nw.js +427 -0
- package/dist/chunks/streaming-BlKlC3nw.js.map +1 -0
- package/dist/chunks/{testing-CUwGj2ie.js → testing-BEW1nchS.js} +645 -630
- package/dist/chunks/testing-BEW1nchS.js.map +1 -0
- package/dist/chunks/{vite-QoqrGl6f.js → vite-BADZA8Fl.js} +73 -70
- package/dist/chunks/vite-BADZA8Fl.js.map +1 -0
- package/dist/cli.d.ts +8 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +186 -122
- package/dist/cli.js.map +1 -1
- package/dist/config/index.js +2 -2
- package/dist/config/types.d.ts +3 -1
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/validate.d.ts.map +1 -1
- package/dist/data/cache.d.ts +5 -0
- package/dist/data/cache.d.ts.map +1 -1
- package/dist/data/index.d.ts +1 -1
- package/dist/data/index.d.ts.map +1 -1
- package/dist/data/testing.d.ts.map +1 -1
- package/dist/data/testing.js +101 -67
- package/dist/data/testing.js.map +1 -1
- package/dist/data/tiered.d.ts.map +1 -1
- package/dist/edge/index.js +27 -26
- package/dist/edge/index.js.map +1 -1
- package/dist/edge/stores.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +910 -891
- package/dist/index.js.map +1 -1
- package/dist/internal/testing.js +2 -2
- package/dist/kv/index.js +7 -6
- package/dist/kv/index.js.map +1 -1
- package/dist/kv/store.d.ts.map +1 -1
- package/dist/node/http.d.ts +2 -0
- package/dist/node/http.d.ts.map +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +12 -11
- package/dist/node/index.js.map +1 -1
- package/dist/node/serve.d.ts +4 -0
- package/dist/node/serve.d.ts.map +1 -1
- package/dist/redis/index.js +29 -28
- package/dist/redis/index.js.map +1 -1
- package/dist/redis/store.d.ts.map +1 -1
- package/dist/route/serialization.d.ts +4 -4
- package/dist/route/serialization.d.ts.map +1 -1
- package/dist/static/index.d.ts.map +1 -1
- package/dist/static/index.js +255 -255
- package/dist/static/index.js.map +1 -1
- package/dist/static/testing.d.ts +26 -0
- package/dist/static/testing.d.ts.map +1 -0
- package/dist/static/testing.js +76 -0
- package/dist/static/testing.js.map +1 -0
- package/dist/testing/index.d.ts +47 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +99 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/vercel/build.d.ts +31 -0
- package/dist/vercel/build.d.ts.map +1 -0
- package/dist/vercel/config.d.ts +15 -0
- package/dist/vercel/config.d.ts.map +1 -0
- package/dist/vercel/index.d.ts +7 -0
- package/dist/vercel/index.d.ts.map +1 -0
- package/dist/vercel/index.js +11 -0
- package/dist/vercel/index.js.map +1 -0
- package/dist/vercel/runtime.d.ts +29 -0
- package/dist/vercel/runtime.d.ts.map +1 -0
- package/dist/vite/index.js +1 -1
- package/package.json +13 -1
- package/dist/chunks/index-0MNiR_wo.js.map +0 -1
- package/dist/chunks/streaming-GYIsVTQH.js +0 -560
- package/dist/chunks/streaming-GYIsVTQH.js.map +0 -1
- package/dist/chunks/testing-CUwGj2ie.js.map +0 -1
- package/dist/chunks/vite-QoqrGl6f.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { readdir as
|
|
2
|
-
import { relative as
|
|
3
|
-
import { pathToFileURL as
|
|
4
|
-
import { t as
|
|
5
|
-
import { p as
|
|
6
|
-
import { generateStaticOutput as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import "./chunks/
|
|
1
|
+
import { readdir as _, readFile as P } from "node:fs/promises";
|
|
2
|
+
import { relative as m, sep as v, resolve as d, join as O, isAbsolute as D } from "node:path";
|
|
3
|
+
import { pathToFileURL as h } from "node:url";
|
|
4
|
+
import { t as C, c as T } from "./chunks/vite-BADZA8Fl.js";
|
|
5
|
+
import { p as $ } from "./chunks/manifest-vO6c0G0W.js";
|
|
6
|
+
import { generateStaticOutput as j, generateVercelStaticOutput as V } from "./static/index.js";
|
|
7
|
+
import { g as F } from "./chunks/runtime-BH519j2t.js";
|
|
8
|
+
import { t as x, a as L } from "./chunks/testing-BEW1nchS.js";
|
|
9
|
+
import { v as A, B as R } from "./chunks/plugin-bkP6WwrS.js";
|
|
10
|
+
import "./chunks/index-LYve1rQp.js";
|
|
10
11
|
import "node:fs";
|
|
11
12
|
import "magic-string";
|
|
12
13
|
import "vite";
|
|
@@ -17,7 +18,7 @@ import "node:stream";
|
|
|
17
18
|
import "node:stream/promises";
|
|
18
19
|
import "node:net";
|
|
19
20
|
import "node:crypto";
|
|
20
|
-
const
|
|
21
|
+
const H = 1, U = 1, q = [
|
|
21
22
|
"authorization-result",
|
|
22
23
|
"cookie-values",
|
|
23
24
|
"csrf-token",
|
|
@@ -27,12 +28,12 @@ const x = 1, A = 1, U = [
|
|
|
27
28
|
"response-headers",
|
|
28
29
|
"session-record"
|
|
29
30
|
];
|
|
30
|
-
async function
|
|
31
|
-
const e = t.options ?? {}, r = await
|
|
31
|
+
async function k(t) {
|
|
32
|
+
const e = t.options ?? {}, r = await A(t.root, e), o = r.inspections.map((i) => W(r.routesDir, i)).sort((i, n) => i.file.localeCompare(n.file));
|
|
32
33
|
return {
|
|
33
34
|
findings: r.findings,
|
|
34
35
|
redactions: [],
|
|
35
|
-
request:
|
|
36
|
+
request: q,
|
|
36
37
|
resolutions: {
|
|
37
38
|
findings: "static",
|
|
38
39
|
redactions: "static",
|
|
@@ -40,30 +41,30 @@ async function L(t) {
|
|
|
40
41
|
routes: "static"
|
|
41
42
|
},
|
|
42
43
|
routes: o,
|
|
43
|
-
routesDir:
|
|
44
|
-
version:
|
|
44
|
+
routesDir: y(m(t.root, r.routesDir)),
|
|
45
|
+
version: H
|
|
45
46
|
};
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
+
function B(t) {
|
|
48
49
|
return Object.entries(t ?? {}).filter(([, e]) => e.sensitive).map(([e]) => e).sort();
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function N(t) {
|
|
51
52
|
return t.findings.filter((e) => e.severity === "error").length;
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
-
const e =
|
|
54
|
+
function M(t) {
|
|
55
|
+
const e = N(t), r = t.findings.length - e;
|
|
55
56
|
return [
|
|
56
57
|
`Demiurge inspected ${t.routes.length} route files in ${t.routesDir}.`,
|
|
57
58
|
`Findings: ${e} error, ${r} warning.`,
|
|
58
59
|
`The report states ${t.request.length} facts that only a request supplies.`,
|
|
59
60
|
...t.findings.map(
|
|
60
|
-
(o) => ` ${o.severity}: ${
|
|
61
|
+
(o) => ` ${o.severity}: ${y(o.file)} [${o.code}] ${o.message}`
|
|
61
62
|
)
|
|
62
63
|
].join(`
|
|
63
64
|
`);
|
|
64
65
|
}
|
|
65
|
-
function
|
|
66
|
-
const r =
|
|
66
|
+
function W(t, e) {
|
|
67
|
+
const r = y(m(t, e.file)), o = r.replace(/\.tsx?$/, "").split("/"), i = o.at(-1)?.startsWith("@") ?? !1;
|
|
67
68
|
return {
|
|
68
69
|
declaredAccess: e.accessState,
|
|
69
70
|
declaredDocumentCsp: e.documentCspState,
|
|
@@ -71,16 +72,16 @@ function M(t, e) {
|
|
|
71
72
|
file: r,
|
|
72
73
|
kind: i ? "attached" : e.declaresPageRoute ? "page" : "resource",
|
|
73
74
|
methods: e.methods,
|
|
74
|
-
...i ? {} : { pattern:
|
|
75
|
+
...i ? {} : { pattern: x(L(o)) }
|
|
75
76
|
};
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
-
return t.split(
|
|
78
|
+
function y(t) {
|
|
79
|
+
return t.split(v).join("/");
|
|
79
80
|
}
|
|
80
|
-
const
|
|
81
|
-
async function
|
|
81
|
+
const G = 0, J = 1, K = 2;
|
|
82
|
+
async function Tt(t) {
|
|
82
83
|
if (t.arguments.length > 0)
|
|
83
|
-
return
|
|
84
|
+
return g(
|
|
84
85
|
"invalid-argument",
|
|
85
86
|
"The inspect command accepts no argument.",
|
|
86
87
|
`The command received ${t.arguments.join(" ")}.`
|
|
@@ -89,40 +90,40 @@ async function Ot(t) {
|
|
|
89
90
|
try {
|
|
90
91
|
e = await t.loadConfig();
|
|
91
92
|
} catch (o) {
|
|
92
|
-
return
|
|
93
|
+
return g(
|
|
93
94
|
"configuration-unreadable",
|
|
94
95
|
"Demiurge could not read the configuration.",
|
|
95
96
|
o instanceof Error ? o.message : String(o)
|
|
96
97
|
);
|
|
97
98
|
}
|
|
98
|
-
const r = await
|
|
99
|
-
options:
|
|
99
|
+
const r = await k({
|
|
100
|
+
options: C(e),
|
|
100
101
|
root: e.root
|
|
101
102
|
});
|
|
102
103
|
return {
|
|
103
|
-
exitCode:
|
|
104
|
-
stderr:
|
|
105
|
-
stdout:
|
|
106
|
-
secretEnvKeys:
|
|
104
|
+
exitCode: N(r) > 0 ? J : G,
|
|
105
|
+
stderr: M(r),
|
|
106
|
+
stdout: R(r, {
|
|
107
|
+
secretEnvKeys: B(e.env)
|
|
107
108
|
})
|
|
108
109
|
};
|
|
109
110
|
}
|
|
110
|
-
function
|
|
111
|
+
function g(t, e, r) {
|
|
111
112
|
const o = {
|
|
112
113
|
code: t,
|
|
113
114
|
detail: r,
|
|
114
115
|
title: e,
|
|
115
|
-
version:
|
|
116
|
+
version: U
|
|
116
117
|
};
|
|
117
118
|
return {
|
|
118
|
-
exitCode:
|
|
119
|
+
exitCode: K,
|
|
119
120
|
stderr: `${e}
|
|
120
121
|
${r}`,
|
|
121
|
-
stdout:
|
|
122
|
+
stdout: R(o)
|
|
122
123
|
};
|
|
123
124
|
}
|
|
124
|
-
const
|
|
125
|
-
function
|
|
125
|
+
const X = /* @__PURE__ */ new Set(["--host", "--origin", "--out-dir", "--port"]), Y = "virtual:demiurge/client-entry", I = "virtual:demiurge/server-entry", w = "dist", b = "dist/server", z = ".demiurge/server";
|
|
126
|
+
function Rt(t, e = {}) {
|
|
126
127
|
const r = t[0];
|
|
127
128
|
if (!r || r === "--help" || r === "-h" || r === "help")
|
|
128
129
|
return {
|
|
@@ -130,25 +131,25 @@ function St(t, e = {}) {
|
|
|
130
131
|
host: "localhost",
|
|
131
132
|
port: 4173
|
|
132
133
|
};
|
|
133
|
-
if (r !== "build" && r !== "dev" && r !== "inspect" && r !== "preview")
|
|
134
|
+
if (r !== "build" && r !== "dev" && r !== "inspect" && r !== "preview" && r !== "start")
|
|
134
135
|
throw new Error(`Unknown command: ${r}`);
|
|
135
136
|
const o = {
|
|
136
137
|
command: r,
|
|
137
|
-
host: "localhost",
|
|
138
|
+
host: r === "start" ? e.HOST ?? "127.0.0.1" : "localhost",
|
|
138
139
|
origin: e.SITE_ORIGIN,
|
|
139
140
|
port: r === "dev" ? 5173 : 4173
|
|
140
141
|
};
|
|
141
142
|
for (let i = 1; i < t.length; i += 1) {
|
|
142
|
-
const
|
|
143
|
-
if (
|
|
143
|
+
const n = t[i];
|
|
144
|
+
if (n === "--help" || n === "-h")
|
|
144
145
|
return { command: "help", host: "localhost", port: 4173 };
|
|
145
|
-
const [
|
|
146
|
-
if (!
|
|
147
|
-
throw new Error(`Unknown option: ${
|
|
146
|
+
const [s, u] = n.split("=", 2);
|
|
147
|
+
if (!X.has(s))
|
|
148
|
+
throw new Error(`Unknown option: ${n}`);
|
|
148
149
|
const a = u ?? t[++i];
|
|
149
150
|
if (!a || a.startsWith("--"))
|
|
150
|
-
throw new Error(`Option ${
|
|
151
|
-
if (
|
|
151
|
+
throw new Error(`Option ${s} requires a value.`);
|
|
152
|
+
if (s === "--host" && (o.host = a), s === "--origin" && (o.origin = a), s === "--out-dir" && (o.outDir = a), s === "--port") {
|
|
152
153
|
const c = Number(a);
|
|
153
154
|
if (!Number.isSafeInteger(c) || c < 0 || c > 65535)
|
|
154
155
|
throw new Error("The server port must be an integer from 0 through 65535.");
|
|
@@ -157,16 +158,17 @@ function St(t, e = {}) {
|
|
|
157
158
|
}
|
|
158
159
|
return o;
|
|
159
160
|
}
|
|
160
|
-
const
|
|
161
|
+
const Nt = `Usage: demiurge <command> [options]
|
|
161
162
|
|
|
162
163
|
Commands:
|
|
163
164
|
dev Start the development server
|
|
164
165
|
build Build production output
|
|
166
|
+
start Run built Node production output
|
|
165
167
|
inspect Write the static inspection report as JSON
|
|
166
168
|
preview Serve static output with its declared headers
|
|
167
169
|
|
|
168
170
|
Options:
|
|
169
|
-
--host <host> Set the server host (
|
|
171
|
+
--host <host> Set the server host (start: HOST or 127.0.0.1; otherwise: localhost)
|
|
170
172
|
--origin <origin> Set the build origin (default: SITE_ORIGIN)
|
|
171
173
|
--out-dir <directory> Set the client output directory (default: dist)
|
|
172
174
|
--port <port> Set the server port (dev: 5173, preview: 4173)
|
|
@@ -177,9 +179,9 @@ error. It exits with 0 for no error finding, 1 for at least one error finding,
|
|
|
177
179
|
and 2 for an invalid argument or an unreadable configuration.
|
|
178
180
|
|
|
179
181
|
Demiurge reads demiurge.config.ts from the project root.`;
|
|
180
|
-
async function
|
|
182
|
+
async function It(t, e) {
|
|
181
183
|
const { createServer: r } = await import("vite"), o = await r(
|
|
182
|
-
await
|
|
184
|
+
await T({
|
|
183
185
|
config: e,
|
|
184
186
|
overrides: {
|
|
185
187
|
mode: "development",
|
|
@@ -189,59 +191,120 @@ async function Tt(t, e) {
|
|
|
189
191
|
);
|
|
190
192
|
return await o.listen(), o;
|
|
191
193
|
}
|
|
192
|
-
async function
|
|
193
|
-
const o = e.root, i = r?.build ?? (await import("vite")).build,
|
|
194
|
+
async function bt(t, e, r) {
|
|
195
|
+
const o = e.root, i = r?.build ?? (await import("vite")).build, n = r?.createViteConfig ?? ((p) => T({ config: e, overrides: p })), s = d(
|
|
194
196
|
o,
|
|
195
|
-
t.outDir ?? e.deployment?.outDir ??
|
|
197
|
+
t.outDir ?? e.deployment?.outDir ?? w
|
|
196
198
|
), u = d(o, z);
|
|
197
|
-
await
|
|
199
|
+
await tt(
|
|
198
200
|
o,
|
|
199
|
-
|
|
200
|
-
|
|
201
|
+
s,
|
|
202
|
+
O(o, "public"),
|
|
201
203
|
u
|
|
202
204
|
), await i(
|
|
203
|
-
await
|
|
205
|
+
await n({
|
|
204
206
|
define: { "process.env.NODE_ENV": JSON.stringify("production") },
|
|
205
207
|
mode: "production",
|
|
206
208
|
build: {
|
|
207
209
|
emptyOutDir: !0,
|
|
208
|
-
outDir:
|
|
209
|
-
rollupOptions: { input:
|
|
210
|
+
outDir: s,
|
|
211
|
+
rollupOptions: { input: Y }
|
|
210
212
|
}
|
|
211
213
|
})
|
|
212
214
|
);
|
|
213
|
-
const a = e.deployment?.server, c = a ? d(o, a.outDir ??
|
|
214
|
-
|
|
215
|
-
await
|
|
215
|
+
const a = e.deployment?.server, c = a ? d(o, a.outDir ?? b) : void 0;
|
|
216
|
+
a && c && await i(
|
|
217
|
+
await n({
|
|
216
218
|
define: { "process.env.NODE_ENV": JSON.stringify("production") },
|
|
217
219
|
mode: "production",
|
|
218
220
|
build: {
|
|
219
221
|
copyPublicDir: !1,
|
|
220
222
|
emptyOutDir: !0,
|
|
221
223
|
outDir: c,
|
|
222
|
-
rollupOptions: {
|
|
224
|
+
rollupOptions: {
|
|
225
|
+
input: a.entry ? d(o, a.entry) : I,
|
|
226
|
+
output: { entryFileNames: "server-entry.js" }
|
|
227
|
+
},
|
|
223
228
|
ssr: !0
|
|
224
|
-
}
|
|
229
|
+
},
|
|
230
|
+
...a.provider ? {
|
|
231
|
+
ssr: {
|
|
232
|
+
external: ["@demiurgejs/core", "react", "react-dom"],
|
|
233
|
+
noExternal: !0
|
|
234
|
+
}
|
|
235
|
+
} : {}
|
|
225
236
|
})
|
|
226
|
-
)
|
|
237
|
+
);
|
|
238
|
+
const l = a?.provider;
|
|
239
|
+
if (l && a && c) {
|
|
240
|
+
if (e.security?.staticFileHeaders?.length)
|
|
241
|
+
throw new Error(
|
|
242
|
+
"Vercel Node deployment does not support security.staticFileHeaders. Remove the rules or use a deployment that serves the browser output directly."
|
|
243
|
+
);
|
|
244
|
+
return { deploymentOutDir: await F({
|
|
245
|
+
clientDir: s,
|
|
246
|
+
deployment: l,
|
|
247
|
+
projectRoot: o,
|
|
248
|
+
serverDir: c
|
|
249
|
+
}), outDir: s, serverOutDir: c };
|
|
250
|
+
}
|
|
251
|
+
return e.deployment?.static ? { ...await Z({
|
|
227
252
|
build: i,
|
|
228
253
|
config: e,
|
|
229
|
-
createViteConfig:
|
|
254
|
+
createViteConfig: n,
|
|
230
255
|
frameworkServerOutDir: u,
|
|
231
256
|
options: t,
|
|
232
|
-
outDir:
|
|
257
|
+
outDir: s,
|
|
233
258
|
root: o,
|
|
234
259
|
runtime: r
|
|
235
|
-
}), outDir:
|
|
260
|
+
}), outDir: s, serverOutDir: c } : { outDir: s, serverOutDir: c };
|
|
236
261
|
}
|
|
237
|
-
async function
|
|
262
|
+
async function _t(t, e, r = process.env, o) {
|
|
263
|
+
const i = e.deployment?.server;
|
|
264
|
+
if (!i)
|
|
265
|
+
throw new Error(
|
|
266
|
+
"The start command requires deployment.server in demiurge.config.ts."
|
|
267
|
+
);
|
|
268
|
+
const n = r.ALLOWED_HOSTS?.split(",").map((p) => p.trim()).filter(Boolean);
|
|
269
|
+
if (!n?.length)
|
|
270
|
+
throw new Error(
|
|
271
|
+
"The start command requires ALLOWED_HOSTS as a comma-separated host allowlist."
|
|
272
|
+
);
|
|
273
|
+
const s = e.root, u = d(
|
|
274
|
+
s,
|
|
275
|
+
t.outDir ?? e.deployment?.outDir ?? w
|
|
276
|
+
), a = d(
|
|
277
|
+
s,
|
|
278
|
+
i.outDir ?? b
|
|
279
|
+
), c = h(O(a, "server-entry.js")).href, l = o ? await o.importModule(c) : await import(c);
|
|
280
|
+
if (!Q(l))
|
|
281
|
+
throw new Error(
|
|
282
|
+
"The application server bundle does not export a Node build runtime."
|
|
283
|
+
);
|
|
284
|
+
return (o?.serve ?? (await import("./node/index.js")).serveNodeBuild)({
|
|
285
|
+
allowedHosts: n,
|
|
286
|
+
base: h(`${s}/`).href,
|
|
287
|
+
clientDir: m(s, u),
|
|
288
|
+
createHandler: l.createHandler,
|
|
289
|
+
env: r,
|
|
290
|
+
host: t.host,
|
|
291
|
+
port: t.port,
|
|
292
|
+
readyPath: "/.well-known/ready",
|
|
293
|
+
shutdown: { signals: ["SIGINT", "SIGTERM"] },
|
|
294
|
+
static: l.createStatic
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
function Q(t) {
|
|
298
|
+
return typeof t.createHandler == "function" && (t.createStatic === void 0 || typeof t.createStatic == "function");
|
|
299
|
+
}
|
|
300
|
+
async function Z({
|
|
238
301
|
build: t,
|
|
239
302
|
config: e,
|
|
240
303
|
createViteConfig: r,
|
|
241
304
|
frameworkServerOutDir: o,
|
|
242
305
|
options: i,
|
|
243
|
-
outDir:
|
|
244
|
-
root:
|
|
306
|
+
outDir: n,
|
|
307
|
+
root: s,
|
|
245
308
|
runtime: u
|
|
246
309
|
}) {
|
|
247
310
|
await t(
|
|
@@ -253,82 +316,83 @@ async function H({
|
|
|
253
316
|
emptyOutDir: !0,
|
|
254
317
|
outDir: o,
|
|
255
318
|
rollupOptions: {
|
|
256
|
-
input:
|
|
319
|
+
input: I,
|
|
257
320
|
output: { entryFileNames: "server-entry.js" }
|
|
258
321
|
},
|
|
259
322
|
ssr: !0
|
|
260
323
|
}
|
|
261
324
|
})
|
|
262
325
|
);
|
|
263
|
-
const a =
|
|
264
|
-
u ? await u.readText(d(
|
|
265
|
-
), c = `${
|
|
266
|
-
if (!
|
|
326
|
+
const a = $(
|
|
327
|
+
u ? await u.readText(d(n, "demiurge-manifest.json")) : await P(d(n, "demiurge-manifest.json"), "utf8")
|
|
328
|
+
), c = `${h(d(o, "server-entry.js")).href}?build=${u?.now() ?? Date.now()}`, l = u ? await u.importModule(c) : await import(c);
|
|
329
|
+
if (!et(l.routes))
|
|
267
330
|
throw new Error("The framework server bundle does not export routes.");
|
|
268
|
-
const
|
|
331
|
+
const f = await (u?.generate ?? j)({
|
|
269
332
|
fonts: e.assets?.fonts,
|
|
270
333
|
images: e.assets?.images,
|
|
271
334
|
origin: i.origin ?? e.deployment?.static?.origin,
|
|
272
|
-
outDir:
|
|
273
|
-
root:
|
|
274
|
-
routes:
|
|
335
|
+
outDir: n,
|
|
336
|
+
root: s,
|
|
337
|
+
routes: l.routes,
|
|
275
338
|
ssr: a,
|
|
276
339
|
staticFileHeaders: e.security?.staticFileHeaders ?? []
|
|
277
|
-
}),
|
|
278
|
-
return { deploymentOutDir:
|
|
279
|
-
deployment:
|
|
280
|
-
manifest:
|
|
281
|
-
outDir:
|
|
282
|
-
projectRoot:
|
|
283
|
-
}) : void 0, manifest:
|
|
340
|
+
}), p = e.deployment?.static?.provider;
|
|
341
|
+
return { deploymentOutDir: p ? await V({
|
|
342
|
+
deployment: p,
|
|
343
|
+
manifest: f,
|
|
344
|
+
outDir: n,
|
|
345
|
+
projectRoot: s
|
|
346
|
+
}) : void 0, manifest: f };
|
|
284
347
|
}
|
|
285
|
-
function
|
|
286
|
-
return d(t, e ?? r ??
|
|
348
|
+
function Pt(t, e, r) {
|
|
349
|
+
return d(t, e ?? r ?? w);
|
|
287
350
|
}
|
|
288
|
-
async function
|
|
289
|
-
const i =
|
|
290
|
-
if (!i || i === ".." || i.startsWith(`..${
|
|
351
|
+
async function tt(t, e, r, o) {
|
|
352
|
+
const i = m(t, e);
|
|
353
|
+
if (!i || i === ".." || i.startsWith(`..${v}`) || D(i))
|
|
291
354
|
throw new Error("The static output directory must be inside the Vite root.");
|
|
292
|
-
if (r &&
|
|
355
|
+
if (r && E(e, r))
|
|
293
356
|
throw new Error("The static output directory must not overlap the Vite public directory.");
|
|
294
|
-
if (
|
|
357
|
+
if (E(e, o))
|
|
295
358
|
throw new Error("The static output directory must not overlap the framework server directory.");
|
|
296
|
-
let
|
|
359
|
+
let n;
|
|
297
360
|
try {
|
|
298
|
-
|
|
299
|
-
} catch (
|
|
300
|
-
if (
|
|
301
|
-
throw
|
|
361
|
+
n = await _(e);
|
|
362
|
+
} catch (s) {
|
|
363
|
+
if (rt(s)) return;
|
|
364
|
+
throw s;
|
|
302
365
|
}
|
|
303
|
-
if (
|
|
366
|
+
if (n.length && !n.includes("demiurge-manifest.json") && !n.includes("demiurge-static-manifest.json"))
|
|
304
367
|
throw new Error(
|
|
305
368
|
"The static output directory contains files that a Demiurge build did not create."
|
|
306
369
|
);
|
|
307
370
|
}
|
|
308
|
-
function
|
|
371
|
+
function et(t) {
|
|
309
372
|
return !t || typeof t != "object" || Array.isArray(t) ? !1 : Object.values(t).every((e) => typeof e == "function");
|
|
310
373
|
}
|
|
311
|
-
function
|
|
312
|
-
const r =
|
|
313
|
-
return
|
|
374
|
+
function E(t, e) {
|
|
375
|
+
const r = m(t, e), o = m(e, t);
|
|
376
|
+
return S(r) || S(o);
|
|
314
377
|
}
|
|
315
|
-
function
|
|
316
|
-
return !t || t !== ".." && !t.startsWith(`..${
|
|
378
|
+
function S(t) {
|
|
379
|
+
return !t || t !== ".." && !t.startsWith(`..${v}`) && !D(t);
|
|
317
380
|
}
|
|
318
|
-
function
|
|
381
|
+
function rt(t) {
|
|
319
382
|
return t instanceof Error && "code" in t && t.code === "ENOENT";
|
|
320
383
|
}
|
|
321
384
|
export {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
385
|
+
J as INSPECT_EXIT_FINDINGS,
|
|
386
|
+
K as INSPECT_EXIT_INVALID,
|
|
387
|
+
G as INSPECT_EXIT_OK,
|
|
388
|
+
Nt as helpText,
|
|
389
|
+
Rt as parseCliArguments,
|
|
390
|
+
$ as parseClientManifest,
|
|
391
|
+
Pt as resolvePreviewOutputDirectory,
|
|
392
|
+
bt as runBuild,
|
|
393
|
+
It as runDev,
|
|
394
|
+
Tt as runInspectCommand,
|
|
395
|
+
_t as runStart,
|
|
396
|
+
tt as validateBuildOutputDirectory
|
|
333
397
|
};
|
|
334
398
|
//# sourceMappingURL=cli.js.map
|