@qwik.dev/router 2.0.0-beta.10 → 2.0.0-beta.11
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/lib/adapters/azure-swa/vite/index.cjs +2 -2
- package/lib/adapters/azure-swa/vite/index.mjs +73 -69
- package/lib/adapters/bun-server/vite/index.cjs +2 -2
- package/lib/adapters/bun-server/vite/index.mjs +77 -73
- package/lib/adapters/cloud-run/vite/index.cjs +2 -2
- package/lib/adapters/cloud-run/vite/index.mjs +104 -100
- package/lib/adapters/cloudflare-pages/vite/{index-DwovcBp3.js → index-Bg_9YkM5.js} +1 -1
- package/lib/adapters/cloudflare-pages/vite/{index-C455V8_A.cjs → index-C1aDmh1S.cjs} +1 -1
- package/lib/adapters/cloudflare-pages/vite/index-CHT9Y93A.js +254 -0
- package/lib/adapters/cloudflare-pages/vite/{index-DKcVHRBy.cjs → index-Ck7KvpK1.cjs} +1 -1
- package/lib/adapters/cloudflare-pages/vite/{index-D3HITboM.js → index-Cp1cjAds.js} +1 -1
- package/lib/adapters/cloudflare-pages/vite/index-D9RL9dvJ.cjs +5 -0
- package/lib/adapters/cloudflare-pages/vite/index.cjs +1 -1
- package/lib/adapters/cloudflare-pages/vite/index.mjs +1 -1
- package/lib/adapters/deno-server/vite/index.cjs +2 -2
- package/lib/adapters/deno-server/vite/index.mjs +81 -77
- package/lib/adapters/netlify-edge/vite/index.cjs +3 -3
- package/lib/adapters/netlify-edge/vite/index.mjs +119 -115
- package/lib/adapters/node-server/vite/index.cjs +2 -2
- package/lib/adapters/node-server/vite/index.mjs +78 -74
- package/lib/adapters/shared/vite/index.cjs +2 -2
- package/lib/adapters/shared/vite/index.mjs +108 -104
- package/lib/adapters/ssg/vite/index.cjs +2 -2
- package/lib/adapters/ssg/vite/index.mjs +100 -96
- package/lib/adapters/vercel-edge/vite/index.cjs +2 -2
- package/lib/adapters/vercel-edge/vite/index.mjs +114 -110
- package/lib/index.qwik.cjs +39 -33
- package/lib/index.qwik.mjs +39 -33
- package/lib/middleware/request-handler/index.cjs +8 -8
- package/lib/middleware/request-handler/index.mjs +598 -587
- package/lib/vite/index.cjs +17 -17
- package/lib/vite/index.d.ts +3 -3
- package/lib/vite/index.mjs +242 -230
- package/package.json +4 -4
- package/lib/adapters/cloudflare-pages/vite/index-BIeHg2Cj.cjs +0 -5
- package/lib/adapters/cloudflare-pages/vite/index-bogwy7wh.js +0 -250
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
import y, { existsSync as
|
|
2
|
-
import { join as
|
|
1
|
+
import y, { existsSync as E } from "node:fs";
|
|
2
|
+
import { join as m, resolve as D, dirname as x, basename as q } from "node:path";
|
|
3
3
|
import { getErrorHtml as R } from "@qwik.dev/router/middleware/request-handler";
|
|
4
|
-
async function
|
|
4
|
+
async function O(e, r, t, i, u) {
|
|
5
5
|
t && !t.endsWith("/") && (t += "/");
|
|
6
|
-
const
|
|
6
|
+
const h = /* @__PURE__ */ new Set([
|
|
7
7
|
t + "/" + (globalThis.__QWIK_BUILD_DIR__ || "build") + "/",
|
|
8
8
|
t + "/" + (globalThis.__QWIK_ASSETS_DIR__ || "assets") + "/"
|
|
9
|
-
]), o = new Set(i.map(
|
|
10
|
-
if (
|
|
9
|
+
]), o = new Set(i.map(_)), d = [], c = async (a, l, f) => {
|
|
10
|
+
if (f = _(f), h.has(f))
|
|
11
11
|
return;
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
!o.has(
|
|
12
|
+
const w = m(a, l);
|
|
13
|
+
if (l === "index.html" || l === "q-data.json") {
|
|
14
|
+
!o.has(f) && u && await y.promises.unlink(w);
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
|
|
17
|
+
if (l === "404.html") {
|
|
18
|
+
const s = await y.promises.readFile(w, "utf-8");
|
|
19
|
+
d.push([f, s]);
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
const
|
|
26
|
-
await Promise.all(
|
|
22
|
+
const k = await y.promises.stat(w);
|
|
23
|
+
k.isDirectory() ? await p(w, f + l + "/") : k.isFile() && o.add(f + l);
|
|
24
|
+
}, p = async (a, l) => {
|
|
25
|
+
const f = await y.promises.readdir(a);
|
|
26
|
+
await Promise.all(f.map((w) => c(a, w, l)));
|
|
27
27
|
};
|
|
28
|
-
y.existsSync(e) && await
|
|
29
|
-
const
|
|
30
|
-
await
|
|
28
|
+
y.existsSync(e) && await p(e, t);
|
|
29
|
+
const n = T(t, d), g = j(o);
|
|
30
|
+
await A(g, n, r);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function _(e) {
|
|
33
33
|
return e.endsWith("/") ? e : e + "/";
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
if (
|
|
35
|
+
function T(e, r) {
|
|
36
|
+
if (r.sort((t, i) => t[0].length > i[0].length ? -1 : t[0].length < i[0].length ? 1 : t[0] < i[0] ? -1 : t[0] > i[0] ? 1 : 0), !r.some((t) => t[0] === e)) {
|
|
37
37
|
const t = R(404, "Resource Not Found");
|
|
38
|
-
|
|
38
|
+
r.push([e, t]);
|
|
39
39
|
}
|
|
40
|
-
return JSON.stringify(
|
|
40
|
+
return JSON.stringify(r, null, 2).slice(1, -1);
|
|
41
41
|
}
|
|
42
42
|
function j(e) {
|
|
43
43
|
return JSON.stringify(Array.from(new Set(e)).sort()).slice(1, -1);
|
|
44
44
|
}
|
|
45
|
-
const
|
|
46
|
-
const i = /* @__PURE__ */ new Set(),
|
|
47
|
-
const
|
|
48
|
-
let
|
|
49
|
-
const
|
|
45
|
+
const A = async (e, r, t) => {
|
|
46
|
+
const i = /* @__PURE__ */ new Set(), u = async (o) => {
|
|
47
|
+
const d = await y.promises.readFile(o, "utf-8");
|
|
48
|
+
let c = !1;
|
|
49
|
+
const p = d.replace(
|
|
50
50
|
/(['"])__QWIK_ROUTER_(STATIC_PATHS|NOT_FOUND)_ARRAY__\1/g,
|
|
51
|
-
(
|
|
51
|
+
(n, g, a) => (c = !0, a === "STATIC_PATHS" ? e : r)
|
|
52
52
|
);
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
const
|
|
56
|
-
for (const
|
|
57
|
-
if (
|
|
58
|
-
await
|
|
59
|
-
else if (
|
|
60
|
-
const
|
|
61
|
-
i.delete(
|
|
53
|
+
c && await y.promises.writeFile(o, p);
|
|
54
|
+
}, h = async (o) => {
|
|
55
|
+
const d = await y.promises.readdir(o, { withFileTypes: !0 });
|
|
56
|
+
for (const c of d)
|
|
57
|
+
if (c.isDirectory())
|
|
58
|
+
await h(m(o, c.name));
|
|
59
|
+
else if (c.name.endsWith("js")) {
|
|
60
|
+
const p = u(m(o, c.name)).finally(() => {
|
|
61
|
+
i.delete(p);
|
|
62
62
|
});
|
|
63
|
-
i.add(
|
|
63
|
+
i.add(p);
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
|
-
await
|
|
66
|
+
await h(t), await Promise.all(i);
|
|
67
67
|
};
|
|
68
|
-
function
|
|
69
|
-
let
|
|
70
|
-
const
|
|
68
|
+
function F(e) {
|
|
69
|
+
let r = null, t = null, i = null, u = null, h = null, o = !1, d;
|
|
70
|
+
const c = [];
|
|
71
71
|
return {
|
|
72
72
|
name: `vite-plugin-qwik-router-ssg-${e.name}`,
|
|
73
73
|
enforce: "post",
|
|
74
74
|
apply: "build",
|
|
75
|
-
config(
|
|
76
|
-
return typeof e.config == "function" && (
|
|
75
|
+
config(n) {
|
|
76
|
+
return typeof e.config == "function" && (n = e.config(n)), n.define = {
|
|
77
77
|
"process.env.NODE_ENV": JSON.stringify("production"),
|
|
78
|
-
...
|
|
79
|
-
},
|
|
78
|
+
...n.define
|
|
79
|
+
}, n;
|
|
80
80
|
},
|
|
81
|
-
configResolved(
|
|
82
|
-
if (o = !!
|
|
83
|
-
if (
|
|
84
|
-
(
|
|
85
|
-
), !
|
|
81
|
+
configResolved(n) {
|
|
82
|
+
if (o = !!n.build.ssr, d = n.command, o) {
|
|
83
|
+
if (r = n.plugins.find(
|
|
84
|
+
(g) => g.name === "vite-plugin-qwik-router"
|
|
85
|
+
), !r)
|
|
86
86
|
throw new Error("Missing vite-plugin-qwik-router");
|
|
87
|
-
if (t =
|
|
88
|
-
(
|
|
87
|
+
if (t = n.plugins.find(
|
|
88
|
+
(g) => g.name === "vite-plugin-qwik"
|
|
89
89
|
), !t)
|
|
90
90
|
throw new Error("Missing vite-plugin-qwik");
|
|
91
|
-
if (i =
|
|
91
|
+
if (i = n.build.outDir, n.build?.ssr !== !0)
|
|
92
92
|
throw new Error(
|
|
93
93
|
`"build.ssr" must be set to "true" in order to use the "${e.name}" adapter.`
|
|
94
94
|
);
|
|
95
|
-
if (!
|
|
95
|
+
if (!n.build?.rollupOptions?.input)
|
|
96
96
|
throw new Error(
|
|
97
97
|
`"build.rollupOptions.input" must be set in order to use the "${e.name}" adapter.`
|
|
98
98
|
);
|
|
@@ -100,76 +100,76 @@ function A(e) {
|
|
|
100
100
|
},
|
|
101
101
|
buildStart() {
|
|
102
102
|
if (o && e.ssg !== null) {
|
|
103
|
-
const { srcDir:
|
|
104
|
-
this.emitFile({
|
|
103
|
+
const { srcDir: n } = t.api.getOptions();
|
|
104
|
+
d === "build" && i && n && (this.emitFile({
|
|
105
105
|
id: "@qwik-router-config",
|
|
106
106
|
type: "chunk",
|
|
107
107
|
fileName: "@qwik-router-config.js"
|
|
108
108
|
}), this.emitFile({
|
|
109
|
-
id: `${
|
|
109
|
+
id: `${n}/entry.ssr`,
|
|
110
110
|
type: "chunk",
|
|
111
111
|
fileName: "entry.ssr.js"
|
|
112
|
-
});
|
|
112
|
+
}));
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
|
-
generateBundle(
|
|
115
|
+
generateBundle(n, g) {
|
|
116
116
|
if (o) {
|
|
117
|
-
|
|
118
|
-
for (const
|
|
119
|
-
const l =
|
|
120
|
-
l.type === "chunk" && l.isEntry && (
|
|
117
|
+
c.length = 0;
|
|
118
|
+
for (const a in g) {
|
|
119
|
+
const l = g[a];
|
|
120
|
+
l.type === "chunk" && l.isEntry && (c.push(a), l.name === "entry.ssr" ? u = m(i, a) : l.name === "@qwik-router-config" && (h = m(i, a)));
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
124
|
closeBundle: {
|
|
125
125
|
sequential: !0,
|
|
126
126
|
async handler() {
|
|
127
|
-
if (o && i &&
|
|
128
|
-
const
|
|
129
|
-
if (e.ssg !== null &&
|
|
130
|
-
let
|
|
131
|
-
|
|
127
|
+
if (o && i && r?.api && t?.api) {
|
|
128
|
+
const n = e.staticPaths || [], g = r.api.getRoutes(), a = r.api.getBasePathname(), l = t.api.getClientOutDir(), f = t.api.getClientPublicOutDir(), w = t.api.getAssetsDir(), k = t.api.getRootDir() ?? void 0;
|
|
129
|
+
if (e.ssg !== null && u && h && l && f) {
|
|
130
|
+
let s = e.ssg?.origin ?? e.origin;
|
|
131
|
+
s || (s = "https://yoursite.qwik.dev"), s.length > 0 && !/:\/\//.test(s) && (s = `https://${s}`), s.startsWith("//") && (s = `https:${s}`);
|
|
132
132
|
try {
|
|
133
|
-
|
|
133
|
+
s = new URL(s).origin;
|
|
134
134
|
} catch {
|
|
135
135
|
this.warn(
|
|
136
|
-
`Invalid "origin" option: "${
|
|
137
|
-
),
|
|
136
|
+
`Invalid "origin" option: "${s}". Using default origin: "https://yoursite.qwik.dev"`
|
|
137
|
+
), s = "https://yoursite.qwik.dev";
|
|
138
138
|
}
|
|
139
|
-
const
|
|
139
|
+
const v = await import("./index-CrwlB95_.js"), b = {
|
|
140
140
|
maxWorkers: e.maxWorkers,
|
|
141
|
-
basePathname:
|
|
142
|
-
outDir:
|
|
143
|
-
rootDir:
|
|
141
|
+
basePathname: a,
|
|
142
|
+
outDir: f,
|
|
143
|
+
rootDir: k,
|
|
144
144
|
...e.ssg,
|
|
145
|
-
origin:
|
|
146
|
-
renderModulePath:
|
|
147
|
-
qwikRouterConfigModulePath:
|
|
148
|
-
}, P = await
|
|
145
|
+
origin: s,
|
|
146
|
+
renderModulePath: u,
|
|
147
|
+
qwikRouterConfigModulePath: h
|
|
148
|
+
}, P = await v.generate(b);
|
|
149
149
|
if (P.errors > 0) {
|
|
150
|
-
const
|
|
150
|
+
const S = new Error(
|
|
151
151
|
`Error while running SSG from "${e.name}" adapter. At least one path failed to render.`
|
|
152
152
|
);
|
|
153
|
-
|
|
153
|
+
S.stack = void 0, this.error(S);
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
n.push(...P.staticPaths);
|
|
156
156
|
}
|
|
157
|
-
await
|
|
158
|
-
|
|
157
|
+
await O(
|
|
158
|
+
f,
|
|
159
159
|
i,
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
w ? m(a, w) : a,
|
|
161
|
+
n,
|
|
162
162
|
!!e.cleanStaticGenerated
|
|
163
163
|
), typeof e.generate == "function" && await e.generate({
|
|
164
|
-
outputEntries:
|
|
164
|
+
outputEntries: c,
|
|
165
165
|
serverOutDir: i,
|
|
166
166
|
clientOutDir: l,
|
|
167
|
-
clientPublicOutDir:
|
|
168
|
-
basePathname:
|
|
169
|
-
routes:
|
|
170
|
-
assetsDir:
|
|
171
|
-
warn: (
|
|
172
|
-
error: (
|
|
167
|
+
clientPublicOutDir: f,
|
|
168
|
+
basePathname: a,
|
|
169
|
+
routes: g,
|
|
170
|
+
assetsDir: w,
|
|
171
|
+
warn: (s) => this.warn(s),
|
|
172
|
+
error: (s) => this.error(s)
|
|
173
173
|
}), this.warn(
|
|
174
174
|
`
|
|
175
175
|
==============================================
|
|
@@ -177,6 +177,10 @@ Note: Make sure that you are serving the built files with proper cache headers.
|
|
|
177
177
|
See https://qwik.dev/docs/deployments/#cache-headers for more information.
|
|
178
178
|
==============================================`
|
|
179
179
|
), e.ssg !== null && setTimeout(() => {
|
|
180
|
+
console.warn(
|
|
181
|
+
"SSG seems to be hanging after completion, forcing process to exit. Everything is likely fine."
|
|
182
|
+
), process.exit(0);
|
|
183
|
+
}, 5e3).unref(), e.ssg !== null && setTimeout(() => {
|
|
180
184
|
process.exit(0);
|
|
181
185
|
}, 5e3).unref();
|
|
182
186
|
}
|
|
@@ -184,22 +188,22 @@ See https://qwik.dev/docs/deployments/#cache-headers for more information.
|
|
|
184
188
|
}
|
|
185
189
|
};
|
|
186
190
|
}
|
|
187
|
-
function
|
|
191
|
+
function I(e, r) {
|
|
188
192
|
const t = D("/");
|
|
189
193
|
let i = e;
|
|
190
|
-
for (let
|
|
191
|
-
if (i =
|
|
194
|
+
for (let u = 0; u < 20; u++) {
|
|
195
|
+
if (i = x(i), q(i) === r)
|
|
192
196
|
return i;
|
|
193
197
|
if (i === t)
|
|
194
198
|
break;
|
|
195
199
|
}
|
|
196
|
-
throw new Error(`Unable to find "${
|
|
200
|
+
throw new Error(`Unable to find "${r}" directory from "${e}"`);
|
|
197
201
|
}
|
|
198
|
-
function
|
|
199
|
-
const
|
|
200
|
-
return
|
|
202
|
+
function G(e = {}) {
|
|
203
|
+
const r = process?.env;
|
|
204
|
+
return F({
|
|
201
205
|
name: "netlify-edge",
|
|
202
|
-
origin:
|
|
206
|
+
origin: r?.ORIGIN ?? r?.URL ?? "https://yoursitename.netlify.app",
|
|
203
207
|
ssg: e.ssg,
|
|
204
208
|
staticPaths: e.staticPaths,
|
|
205
209
|
cleanStaticGenerated: !0,
|
|
@@ -229,8 +233,8 @@ function W(e = {}) {
|
|
|
229
233
|
},
|
|
230
234
|
async generate({ serverOutDir: t, basePathname: i }) {
|
|
231
235
|
if (e.functionRoutes !== !1) {
|
|
232
|
-
const
|
|
233
|
-
typeof e.excludedPath == "string" ?
|
|
236
|
+
const u = [];
|
|
237
|
+
typeof e.excludedPath == "string" ? u.push(e.excludedPath) : Array.isArray(e.excludedPath) ? u.push(...e.excludedPath) : u.push(
|
|
234
238
|
"/build/*",
|
|
235
239
|
"/favicon.ico",
|
|
236
240
|
"/robots.txt",
|
|
@@ -239,18 +243,18 @@ function W(e = {}) {
|
|
|
239
243
|
"/service-worker.js",
|
|
240
244
|
"/sitemap.xml"
|
|
241
245
|
);
|
|
242
|
-
const
|
|
246
|
+
const h = {
|
|
243
247
|
functions: [
|
|
244
248
|
{
|
|
245
249
|
path: i + "*",
|
|
246
250
|
function: "entry.netlify-edge",
|
|
247
251
|
cache: "manual",
|
|
248
|
-
excludedPath:
|
|
252
|
+
excludedPath: u
|
|
249
253
|
}
|
|
250
254
|
],
|
|
251
255
|
version: 1
|
|
252
|
-
}, o =
|
|
253
|
-
|
|
256
|
+
}, o = m(t, "entry.netlify-edge.js"), d = m(t, "entry.netlify-edge.mjs");
|
|
257
|
+
E(d) && await y.promises.writeFile(
|
|
254
258
|
o,
|
|
255
259
|
[
|
|
256
260
|
"import entry_netlifyEdge from './entry.netlify-edge.mjs';",
|
|
@@ -258,15 +262,15 @@ function W(e = {}) {
|
|
|
258
262
|
].join(`
|
|
259
263
|
`)
|
|
260
264
|
);
|
|
261
|
-
const
|
|
265
|
+
const c = I(t, "edge-functions");
|
|
262
266
|
await y.promises.writeFile(
|
|
263
|
-
|
|
264
|
-
JSON.stringify(
|
|
267
|
+
m(c, "manifest.json"),
|
|
268
|
+
JSON.stringify(h, null, 2)
|
|
265
269
|
);
|
|
266
270
|
}
|
|
267
271
|
}
|
|
268
272
|
});
|
|
269
273
|
}
|
|
270
274
|
export {
|
|
271
|
-
|
|
275
|
+
G as netlifyEdgeAdapter
|
|
272
276
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("node:path"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("node:path"),D=require("@qwik.dev/router/middleware/request-handler"),p=require("node:fs");async function b(e,s,t,n,m){t&&!t.endsWith("/")&&(t+="/");const h=new Set([t+"/"+(globalThis.__QWIK_BUILD_DIR__||"build")+"/",t+"/"+(globalThis.__QWIK_ASSETS_DIR__||"assets")+"/"]),o=new Set(n.map(_)),g=[],c=async(a,l,u)=>{if(u=_(u),h.has(u))return;const f=y.join(a,l);if(l==="index.html"||l==="q-data.json"){!o.has(u)&&m&&await p.promises.unlink(f);return}if(l==="404.html"){const r=await p.promises.readFile(f,"utf-8");g.push([u,r]);return}const S=await p.promises.stat(f);S.isDirectory()?await w(f,u+l+"/"):S.isFile()&&o.add(u+l)},w=async(a,l)=>{const u=await p.promises.readdir(a);await Promise.all(u.map(f=>c(a,f,l)))};p.existsSync(e)&&await w(e,t);const i=O(t,g),d=R(o);await T(d,i,s)}function _(e){return e.endsWith("/")?e:e+"/"}function O(e,s){if(s.sort((t,n)=>t[0].length>n[0].length?-1:t[0].length<n[0].length?1:t[0]<n[0]?-1:t[0]>n[0]?1:0),!s.some(t=>t[0]===e)){const t=D.getErrorHtml(404,"Resource Not Found");s.push([e,t])}return JSON.stringify(s,null,2).slice(1,-1)}function R(e){return JSON.stringify(Array.from(new Set(e)).sort()).slice(1,-1)}const T=async(e,s,t)=>{const n=new Set,m=async o=>{const g=await p.promises.readFile(o,"utf-8");let c=!1;const w=g.replace(/(['"])__QWIK_ROUTER_(STATIC_PATHS|NOT_FOUND)_ARRAY__\1/g,(i,d,a)=>(c=!0,a==="STATIC_PATHS"?e:s));c&&await p.promises.writeFile(o,w)},h=async o=>{const g=await p.promises.readdir(o,{withFileTypes:!0});for(const c of g)if(c.isDirectory())await h(y.join(o,c.name));else if(c.name.endsWith("js")){const w=m(y.join(o,c.name)).finally(()=>{n.delete(w)});n.add(w)}};await h(t),await Promise.all(n)};function E(e){let s=null,t=null,n=null,m=null,h=null,o=!1,g;const c=[];return{name:`vite-plugin-qwik-router-ssg-${e.name}`,enforce:"post",apply:"build",config(i){return typeof e.config=="function"&&(i=e.config(i)),i.define={"process.env.NODE_ENV":JSON.stringify("production"),...i.define},i},configResolved(i){if(o=!!i.build.ssr,g=i.command,o){if(s=i.plugins.find(d=>d.name==="vite-plugin-qwik-router"),!s)throw new Error("Missing vite-plugin-qwik-router");if(t=i.plugins.find(d=>d.name==="vite-plugin-qwik"),!t)throw new Error("Missing vite-plugin-qwik");if(n=i.build.outDir,i.build?.ssr!==!0)throw new Error(`"build.ssr" must be set to "true" in order to use the "${e.name}" adapter.`);if(!i.build?.rollupOptions?.input)throw new Error(`"build.rollupOptions.input" must be set in order to use the "${e.name}" adapter.`)}},buildStart(){if(o&&e.ssg!==null){const{srcDir:i}=t.api.getOptions();g==="build"&&n&&i&&(this.emitFile({id:"@qwik-router-config",type:"chunk",fileName:"@qwik-router-config.js"}),this.emitFile({id:`${i}/entry.ssr`,type:"chunk",fileName:"entry.ssr.js"}))}},generateBundle(i,d){if(o){c.length=0;for(const a in d){const l=d[a];l.type==="chunk"&&l.isEntry&&(c.push(a),l.name==="entry.ssr"?m=y.join(n,a):l.name==="@qwik-router-config"&&(h=y.join(n,a)))}}},closeBundle:{sequential:!0,async handler(){if(o&&n&&s?.api&&t?.api){const i=e.staticPaths||[],d=s.api.getRoutes(),a=s.api.getBasePathname(),l=t.api.getClientOutDir(),u=t.api.getClientPublicOutDir(),f=t.api.getAssetsDir(),S=t.api.getRootDir()??void 0;if(e.ssg!==null&&m&&h&&l&&u){let r=e.ssg?.origin??e.origin;r||(r="https://yoursite.qwik.dev"),r.length>0&&!/:\/\//.test(r)&&(r=`https://${r}`),r.startsWith("//")&&(r=`https:${r}`);try{r=new URL(r).origin}catch{this.warn(`Invalid "origin" option: "${r}". Using default origin: "https://yoursite.qwik.dev"`),r="https://yoursite.qwik.dev"}const q=await Promise.resolve().then(()=>require("./index-BqUeglYs.cjs")),P={maxWorkers:e.maxWorkers,basePathname:a,outDir:u,rootDir:S,...e.ssg,origin:r,renderModulePath:m,qwikRouterConfigModulePath:h},k=await q.generate(P);if(k.errors>0){const v=new Error(`Error while running SSG from "${e.name}" adapter. At least one path failed to render.`);v.stack=void 0,this.error(v)}i.push(...k.staticPaths)}await b(u,n,f?y.join(a,f):a,i,!!e.cleanStaticGenerated),typeof e.generate=="function"&&await e.generate({outputEntries:c,serverOutDir:n,clientOutDir:l,clientPublicOutDir:u,basePathname:a,routes:d,assetsDir:f,warn:r=>this.warn(r),error:r=>this.error(r)}),this.warn(`
|
|
2
2
|
==============================================
|
|
3
3
|
Note: Make sure that you are serving the built files with proper cache headers.
|
|
4
4
|
See https://qwik.dev/docs/deployments/#cache-headers for more information.
|
|
5
|
-
==============================================`),e.ssg!==null&&setTimeout(()=>{process.exit(0)},5e3).unref()}}}}}function A(e={}){const
|
|
5
|
+
==============================================`),e.ssg!==null&&setTimeout(()=>{console.warn("SSG seems to be hanging after completion, forcing process to exit. Everything is likely fine."),process.exit(0)},5e3).unref(),e.ssg!==null&&setTimeout(()=>{process.exit(0)},5e3).unref()}}}}}function A(e={}){const s=process?.env;return E({name:e.name||"node-server",origin:s?.ORIGIN??s?.URL??"https://yoursitename.qwik.dev",ssg:e.ssg,cleanStaticGenerated:!0,config(){return{ssr:{target:"node"},build:{ssr:!0},publicDir:!1}}})}exports.nodeServerAdapter=A;
|