@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
|
|
2
|
-
import { join as
|
|
3
|
-
import { getErrorHtml as
|
|
4
|
-
async function
|
|
1
|
+
import g from "node:fs";
|
|
2
|
+
import { join as p, resolve as E, dirname as P, basename as q } from "node:path";
|
|
3
|
+
import { getErrorHtml as O } from "@qwik.dev/router/middleware/request-handler";
|
|
4
|
+
async function C(e, n, t, i, w) {
|
|
5
5
|
t && !t.endsWith("/") && (t += "/");
|
|
6
|
-
const
|
|
6
|
+
const m = /* @__PURE__ */ new Set([
|
|
7
7
|
t + "/" + (globalThis.__QWIK_BUILD_DIR__ || "build") + "/",
|
|
8
8
|
t + "/" + (globalThis.__QWIK_ASSETS_DIR__ || "assets") + "/"
|
|
9
|
-
]), s = new Set(
|
|
10
|
-
if (
|
|
9
|
+
]), s = new Set(i.map(_)), h = [], c = async (l, u, d) => {
|
|
10
|
+
if (d = _(d), m.has(d))
|
|
11
11
|
return;
|
|
12
|
-
const y =
|
|
13
|
-
if (
|
|
14
|
-
!s.has(
|
|
12
|
+
const y = p(l, u);
|
|
13
|
+
if (u === "index.html" || u === "q-data.json") {
|
|
14
|
+
!s.has(d) && w && await g.promises.unlink(y);
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
|
|
17
|
+
if (u === "404.html") {
|
|
18
|
+
const o = await g.promises.readFile(y, "utf-8");
|
|
19
|
+
h.push([d, o]);
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
const
|
|
26
|
-
await Promise.all(
|
|
22
|
+
const v = await g.promises.stat(y);
|
|
23
|
+
v.isDirectory() ? await f(y, d + u + "/") : v.isFile() && s.add(d + u);
|
|
24
|
+
}, f = async (l, u) => {
|
|
25
|
+
const d = await g.promises.readdir(l);
|
|
26
|
+
await Promise.all(d.map((y) => c(l, y, u)));
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
await
|
|
28
|
+
g.existsSync(e) && await f(e, t);
|
|
29
|
+
const r = R(t, h), a = T(s);
|
|
30
|
+
await I(a, r, n);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function _(e) {
|
|
33
33
|
return e.endsWith("/") ? e : e + "/";
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
if (n.sort((t,
|
|
37
|
-
const t =
|
|
35
|
+
function R(e, n) {
|
|
36
|
+
if (n.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), !n.some((t) => t[0] === e)) {
|
|
37
|
+
const t = O(404, "Resource Not Found");
|
|
38
38
|
n.push([e, t]);
|
|
39
39
|
}
|
|
40
40
|
return JSON.stringify(n, null, 2).slice(1, -1);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function T(e) {
|
|
43
43
|
return JSON.stringify(Array.from(new Set(e)).sort()).slice(1, -1);
|
|
44
44
|
}
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
let
|
|
49
|
-
const
|
|
45
|
+
const I = async (e, n, t) => {
|
|
46
|
+
const i = /* @__PURE__ */ new Set(), w = async (s) => {
|
|
47
|
+
const h = await g.promises.readFile(s, "utf-8");
|
|
48
|
+
let c = !1;
|
|
49
|
+
const f = h.replace(
|
|
50
50
|
/(['"])__QWIK_ROUTER_(STATIC_PATHS|NOT_FOUND)_ARRAY__\1/g,
|
|
51
|
-
(
|
|
51
|
+
(r, a, l) => (c = !0, l === "STATIC_PATHS" ? e : n)
|
|
52
52
|
);
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
const
|
|
56
|
-
for (const
|
|
57
|
-
if (
|
|
58
|
-
await p(
|
|
59
|
-
else if (
|
|
60
|
-
const
|
|
61
|
-
|
|
53
|
+
c && await g.promises.writeFile(s, f);
|
|
54
|
+
}, m = async (s) => {
|
|
55
|
+
const h = await g.promises.readdir(s, { withFileTypes: !0 });
|
|
56
|
+
for (const c of h)
|
|
57
|
+
if (c.isDirectory())
|
|
58
|
+
await m(p(s, c.name));
|
|
59
|
+
else if (c.name.endsWith("js")) {
|
|
60
|
+
const f = w(p(s, c.name)).finally(() => {
|
|
61
|
+
i.delete(f);
|
|
62
62
|
});
|
|
63
|
-
|
|
63
|
+
i.add(f);
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
|
-
await
|
|
66
|
+
await m(t), await Promise.all(i);
|
|
67
67
|
};
|
|
68
|
-
function
|
|
69
|
-
let n = null, t = null,
|
|
70
|
-
const
|
|
68
|
+
function A(e) {
|
|
69
|
+
let n = null, t = null, i = null, w = null, m = null, s = !1, h;
|
|
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(r) {
|
|
76
|
+
return typeof e.config == "function" && (r = e.config(r)), r.define = {
|
|
77
77
|
"process.env.NODE_ENV": JSON.stringify("production"),
|
|
78
|
-
...
|
|
79
|
-
},
|
|
78
|
+
...r.define
|
|
79
|
+
}, r;
|
|
80
80
|
},
|
|
81
|
-
configResolved(
|
|
82
|
-
if (s = !!
|
|
83
|
-
if (n =
|
|
84
|
-
(
|
|
81
|
+
configResolved(r) {
|
|
82
|
+
if (s = !!r.build.ssr, h = r.command, s) {
|
|
83
|
+
if (n = r.plugins.find(
|
|
84
|
+
(a) => a.name === "vite-plugin-qwik-router"
|
|
85
85
|
), !n)
|
|
86
86
|
throw new Error("Missing vite-plugin-qwik-router");
|
|
87
|
-
if (t =
|
|
88
|
-
(
|
|
87
|
+
if (t = r.plugins.find(
|
|
88
|
+
(a) => a.name === "vite-plugin-qwik"
|
|
89
89
|
), !t)
|
|
90
90
|
throw new Error("Missing vite-plugin-qwik");
|
|
91
|
-
if (
|
|
91
|
+
if (i = r.build.outDir, r.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 (!r.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,33 +100,33 @@ function I(e) {
|
|
|
100
100
|
},
|
|
101
101
|
buildStart() {
|
|
102
102
|
if (s && e.ssg !== null) {
|
|
103
|
-
const { srcDir:
|
|
104
|
-
this.emitFile({
|
|
103
|
+
const { srcDir: r } = t.api.getOptions();
|
|
104
|
+
h === "build" && i && r && (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: `${r}/entry.ssr`,
|
|
110
110
|
type: "chunk",
|
|
111
111
|
fileName: "entry.ssr.js"
|
|
112
|
-
});
|
|
112
|
+
}));
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
|
-
generateBundle(
|
|
115
|
+
generateBundle(r, a) {
|
|
116
116
|
if (s) {
|
|
117
|
-
|
|
118
|
-
for (const
|
|
119
|
-
const u = l
|
|
120
|
-
u.type === "chunk" && u.isEntry && (
|
|
117
|
+
c.length = 0;
|
|
118
|
+
for (const l in a) {
|
|
119
|
+
const u = a[l];
|
|
120
|
+
u.type === "chunk" && u.isEntry && (c.push(l), u.name === "entry.ssr" ? w = p(i, l) : u.name === "@qwik-router-config" && (m = p(i, l)));
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
124
|
closeBundle: {
|
|
125
125
|
sequential: !0,
|
|
126
126
|
async handler() {
|
|
127
|
-
if (s &&
|
|
128
|
-
const
|
|
129
|
-
if (e.ssg !== null &&
|
|
127
|
+
if (s && i && n?.api && t?.api) {
|
|
128
|
+
const r = e.staticPaths || [], a = n.api.getRoutes(), l = n.api.getBasePathname(), u = t.api.getClientOutDir(), d = t.api.getClientPublicOutDir(), y = t.api.getAssetsDir(), v = t.api.getRootDir() ?? void 0;
|
|
129
|
+
if (e.ssg !== null && w && m && u && d) {
|
|
130
130
|
let o = e.ssg?.origin ?? e.origin;
|
|
131
131
|
o || (o = "https://yoursite.qwik.dev"), o.length > 0 && !/:\/\//.test(o) && (o = `https://${o}`), o.startsWith("//") && (o = `https:${o}`);
|
|
132
132
|
try {
|
|
@@ -136,38 +136,38 @@ function I(e) {
|
|
|
136
136
|
`Invalid "origin" option: "${o}". Using default origin: "https://yoursite.qwik.dev"`
|
|
137
137
|
), o = "https://yoursite.qwik.dev";
|
|
138
138
|
}
|
|
139
|
-
const
|
|
139
|
+
const b = await import("./index-CrwlB95_.js"), D = {
|
|
140
140
|
maxWorkers: e.maxWorkers,
|
|
141
|
-
basePathname:
|
|
142
|
-
outDir:
|
|
143
|
-
rootDir:
|
|
141
|
+
basePathname: l,
|
|
142
|
+
outDir: d,
|
|
143
|
+
rootDir: v,
|
|
144
144
|
...e.ssg,
|
|
145
145
|
origin: o,
|
|
146
|
-
renderModulePath:
|
|
147
|
-
qwikRouterConfigModulePath:
|
|
148
|
-
}, k = await
|
|
146
|
+
renderModulePath: w,
|
|
147
|
+
qwikRouterConfigModulePath: m
|
|
148
|
+
}, k = await b.generate(D);
|
|
149
149
|
if (k.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
|
+
r.push(...k.staticPaths);
|
|
156
156
|
}
|
|
157
|
-
await
|
|
158
|
-
|
|
159
|
-
r,
|
|
160
|
-
f ? m(a, f) : a,
|
|
157
|
+
await C(
|
|
158
|
+
d,
|
|
161
159
|
i,
|
|
160
|
+
y ? p(l, y) : l,
|
|
161
|
+
r,
|
|
162
162
|
!!e.cleanStaticGenerated
|
|
163
163
|
), typeof e.generate == "function" && await e.generate({
|
|
164
|
-
outputEntries:
|
|
165
|
-
serverOutDir:
|
|
164
|
+
outputEntries: c,
|
|
165
|
+
serverOutDir: i,
|
|
166
166
|
clientOutDir: u,
|
|
167
|
-
clientPublicOutDir:
|
|
168
|
-
basePathname:
|
|
169
|
-
routes:
|
|
170
|
-
assetsDir:
|
|
167
|
+
clientPublicOutDir: d,
|
|
168
|
+
basePathname: l,
|
|
169
|
+
routes: a,
|
|
170
|
+
assetsDir: y,
|
|
171
171
|
warn: (o) => this.warn(o),
|
|
172
172
|
error: (o) => this.error(o)
|
|
173
173
|
}), this.warn(
|
|
@@ -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,26 +188,26 @@ See https://qwik.dev/docs/deployments/#cache-headers for more information.
|
|
|
184
188
|
}
|
|
185
189
|
};
|
|
186
190
|
}
|
|
187
|
-
function
|
|
188
|
-
const t =
|
|
189
|
-
let
|
|
190
|
-
for (let
|
|
191
|
-
if (
|
|
192
|
-
return
|
|
193
|
-
if (
|
|
191
|
+
function F(e, n) {
|
|
192
|
+
const t = E("/");
|
|
193
|
+
let i = e;
|
|
194
|
+
for (let w = 0; w < 20; w++) {
|
|
195
|
+
if (i = P(i), q(i) === n)
|
|
196
|
+
return i;
|
|
197
|
+
if (i === t)
|
|
194
198
|
break;
|
|
195
199
|
}
|
|
196
200
|
throw new Error(`Unable to find "${n}" directory from "${e}"`);
|
|
197
201
|
}
|
|
198
202
|
function U(e = {}) {
|
|
199
|
-
return
|
|
203
|
+
return A({
|
|
200
204
|
name: "vercel-edge",
|
|
201
205
|
origin: process?.env?.VERCEL_URL || "https://yoursitename.vercel.app",
|
|
202
206
|
ssg: e.ssg,
|
|
203
207
|
staticPaths: e.staticPaths,
|
|
204
208
|
cleanStaticGenerated: !0,
|
|
205
209
|
config(n) {
|
|
206
|
-
const t = n.build?.outDir ||
|
|
210
|
+
const t = n.build?.outDir || p(".vercel", "output", "functions", "_qwik-router.func");
|
|
207
211
|
return {
|
|
208
212
|
resolve: {
|
|
209
213
|
conditions: e.target === "node" ? ["node", "import", "module", "browser", "default"] : ["edge-light", "webworker", "worker", "browser", "module", "main"]
|
|
@@ -225,35 +229,35 @@ function U(e = {}) {
|
|
|
225
229
|
publicDir: !1
|
|
226
230
|
};
|
|
227
231
|
},
|
|
228
|
-
async generate({ clientPublicOutDir: n, serverOutDir: t, basePathname:
|
|
229
|
-
const
|
|
232
|
+
async generate({ clientPublicOutDir: n, serverOutDir: t, basePathname: i, outputEntries: w }) {
|
|
233
|
+
const m = F(t, "output");
|
|
230
234
|
if (e.outputConfig !== !1) {
|
|
231
235
|
const a = {
|
|
232
236
|
routes: [
|
|
233
237
|
{ handle: "filesystem" },
|
|
234
238
|
{
|
|
235
|
-
src:
|
|
239
|
+
src: i + ".*",
|
|
236
240
|
dest: "/_qwik-router"
|
|
237
241
|
}
|
|
238
242
|
],
|
|
239
243
|
version: 3
|
|
240
244
|
};
|
|
241
|
-
await
|
|
242
|
-
m
|
|
245
|
+
await g.promises.writeFile(
|
|
246
|
+
p(m, "config.json"),
|
|
243
247
|
JSON.stringify(a, null, 2)
|
|
244
248
|
);
|
|
245
249
|
}
|
|
246
250
|
let s = e.vcConfigEntryPoint;
|
|
247
|
-
s || (
|
|
248
|
-
const
|
|
251
|
+
s || (w.some((a) => a === "entry.vercel-edge.mjs") ? s = "entry.vercel-edge.mjs" : s = "entry.vercel-edge.js");
|
|
252
|
+
const h = p(t, ".vc-config.json"), c = {
|
|
249
253
|
runtime: "edge",
|
|
250
254
|
entrypoint: s,
|
|
251
255
|
envVarsInUse: e.vcConfigEnvVarsInUse
|
|
252
256
|
};
|
|
253
|
-
await
|
|
254
|
-
let
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
+
await g.promises.writeFile(h, JSON.stringify(c, null, 2));
|
|
258
|
+
let f = p(m, "static");
|
|
259
|
+
const r = i.split("/").filter((a) => a.length > 0);
|
|
260
|
+
r.length > 0 && (f = p(f, ...r)), await g.promises.rm(f, { recursive: !0, force: !0 }), await g.promises.mkdir(P(f), { recursive: !0 }), await g.promises.rename(n, f);
|
|
257
261
|
}
|
|
258
262
|
});
|
|
259
263
|
}
|
package/lib/index.qwik.cjs
CHANGED
|
@@ -75,7 +75,9 @@ const loadClientData = async (url, element, opts, retryCount = 0) => {
|
|
|
75
75
|
const redirectedURL = new URL(rsp.url);
|
|
76
76
|
const isQData = redirectedURL.pathname.endsWith("/q-data.json");
|
|
77
77
|
if (!isQData || redirectedURL.origin !== location.origin) {
|
|
78
|
-
|
|
78
|
+
if (!opts?.isPrefetch) {
|
|
79
|
+
location.href = redirectedURL.href;
|
|
80
|
+
}
|
|
79
81
|
return;
|
|
80
82
|
}
|
|
81
83
|
}
|
|
@@ -376,23 +378,31 @@ const resolveHead = (endpoint, routeLocation, contentModules, locale, defaults)
|
|
|
376
378
|
}
|
|
377
379
|
return data;
|
|
378
380
|
};
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
resolveValue: getData,
|
|
383
|
-
...routeLocation
|
|
384
|
-
};
|
|
385
|
-
for (let i = contentModules.length - 1; i >= 0; i--) {
|
|
386
|
-
const contentModuleHead = contentModules[i] && contentModules[i].head;
|
|
381
|
+
const fns = [];
|
|
382
|
+
for (const contentModule of contentModules) {
|
|
383
|
+
const contentModuleHead = contentModule?.head;
|
|
387
384
|
if (contentModuleHead) {
|
|
388
385
|
if (typeof contentModuleHead === "function") {
|
|
389
|
-
|
|
386
|
+
fns.unshift(contentModuleHead);
|
|
390
387
|
} else if (typeof contentModuleHead === "object") {
|
|
391
388
|
resolveDocumentHead(head, contentModuleHead);
|
|
392
389
|
}
|
|
393
390
|
}
|
|
394
391
|
}
|
|
395
|
-
|
|
392
|
+
if (fns.length) {
|
|
393
|
+
const headProps = {
|
|
394
|
+
head,
|
|
395
|
+
withLocale: (fn) => core.withLocale(locale, fn),
|
|
396
|
+
resolveValue: getData,
|
|
397
|
+
...routeLocation
|
|
398
|
+
};
|
|
399
|
+
core.withLocale(locale, () => {
|
|
400
|
+
for (const fn of fns) {
|
|
401
|
+
resolveDocumentHead(head, fn(headProps));
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
return head;
|
|
396
406
|
};
|
|
397
407
|
const resolveDocumentHead = (resolvedHead, updatedHead) => {
|
|
398
408
|
if (typeof updatedHead.title === "string") {
|
|
@@ -572,7 +582,7 @@ const deepFreeze = (obj) => {
|
|
|
572
582
|
});
|
|
573
583
|
return Object.freeze(obj);
|
|
574
584
|
};
|
|
575
|
-
const loadRoute = async (routes, menus, cacheModules, pathname) => {
|
|
585
|
+
const loadRoute = async (routes, menus, cacheModules, pathname, isInternal) => {
|
|
576
586
|
if (!Array.isArray(routes)) {
|
|
577
587
|
return null;
|
|
578
588
|
}
|
|
@@ -589,9 +599,11 @@ const loadRoute = async (routes, menus, cacheModules, pathname) => {
|
|
|
589
599
|
loaders.forEach((moduleLoader, i) => {
|
|
590
600
|
loadModule(moduleLoader, pendingLoads, (routeModule) => modules[i] = routeModule, cacheModules);
|
|
591
601
|
});
|
|
592
|
-
const menuLoader = getMenuLoader(menus, pathname);
|
|
593
602
|
let menu = void 0;
|
|
594
|
-
|
|
603
|
+
{
|
|
604
|
+
const menuLoader = getMenuLoader(menus, pathname);
|
|
605
|
+
loadModule(menuLoader, pendingLoads, (menuModule) => menu = menuModule?.default, cacheModules);
|
|
606
|
+
}
|
|
595
607
|
if (pendingLoads.length > 0) {
|
|
596
608
|
await Promise.all(pendingLoads);
|
|
597
609
|
}
|
|
@@ -628,7 +640,7 @@ const loadModule = (moduleLoader, pendingLoads, moduleSetter, cacheModules) => {
|
|
|
628
640
|
const getMenuLoader = (menus, pathname) => {
|
|
629
641
|
if (menus) {
|
|
630
642
|
pathname = pathname.endsWith("/") ? pathname : pathname + "/";
|
|
631
|
-
const menu = menus.find((m) => m[MenuDataProp.Pathname] === pathname || pathname.startsWith(m[MenuDataProp.Pathname]
|
|
643
|
+
const menu = menus.find((m) => m[MenuDataProp.Pathname] === pathname || pathname.startsWith(m[MenuDataProp.Pathname]));
|
|
632
644
|
if (menu) {
|
|
633
645
|
return menu[MenuDataProp.MenuLoader];
|
|
634
646
|
}
|
|
@@ -855,6 +867,7 @@ const startViewTransition = (params) => {
|
|
|
855
867
|
params.update?.();
|
|
856
868
|
}
|
|
857
869
|
};
|
|
870
|
+
const transitionCss = "@layer qwik {\n @supports selector(html:active-view-transition-type(type)) {\n html:active-view-transition-type(qwik-navigation) {\n :root {\n view-transition-name: none;\n }\n }\n }\n @supports not selector(html:active-view-transition-type(type)) {\n :root {\n view-transition-name: none;\n }\n }\n}\n";
|
|
858
871
|
const QWIK_CITY_SCROLLER = "_qCityScroller";
|
|
859
872
|
const QWIK_ROUTER_SCROLLER = "_qRouterScroller";
|
|
860
873
|
const preventNav = {};
|
|
@@ -862,18 +875,7 @@ const internalState = {
|
|
|
862
875
|
navCount: 0
|
|
863
876
|
};
|
|
864
877
|
const useQwikRouter = (props) => {
|
|
865
|
-
core.useStyles$(
|
|
866
|
-
@layer qwik {
|
|
867
|
-
@supports selector(html:active-view-transition-type(type)) {
|
|
868
|
-
html:active-view-transition-type(qwik-navigation) {
|
|
869
|
-
:root{view-transition-name:none}
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
@supports not selector(html:active-view-transition-type(type)) {
|
|
873
|
-
:root{view-transition-name:none}
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
`);
|
|
878
|
+
core.useStyles$(transitionCss);
|
|
877
879
|
const env = useQwikRouterEnv();
|
|
878
880
|
if (!env?.params) {
|
|
879
881
|
throw new Error(`Missing Qwik Router Env Data for help visit https://github.com/QwikDev/qwik/issues/6237`);
|
|
@@ -1427,6 +1429,7 @@ const RouterOutlet = core.component$(() => {
|
|
|
1427
1429
|
return core.SkipRender;
|
|
1428
1430
|
});
|
|
1429
1431
|
var store;
|
|
1432
|
+
// @__NO_SIDE_EFFECTS__
|
|
1430
1433
|
function getGlobalConfig(config2) {
|
|
1431
1434
|
return {
|
|
1432
1435
|
lang: config2?.lang ?? store?.lang,
|
|
@@ -1435,6 +1438,7 @@ function getGlobalConfig(config2) {
|
|
|
1435
1438
|
abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
|
|
1436
1439
|
};
|
|
1437
1440
|
}
|
|
1441
|
+
// @__NO_SIDE_EFFECTS__
|
|
1438
1442
|
function getDotPath(issue) {
|
|
1439
1443
|
if (issue.path) {
|
|
1440
1444
|
let key = "";
|
|
@@ -1453,11 +1457,12 @@ function getDotPath(issue) {
|
|
|
1453
1457
|
}
|
|
1454
1458
|
return null;
|
|
1455
1459
|
}
|
|
1460
|
+
// @__NO_SIDE_EFFECTS__
|
|
1456
1461
|
function flatten(issues) {
|
|
1457
1462
|
const flatErrors = {};
|
|
1458
1463
|
for (const issue of issues) {
|
|
1459
1464
|
if (issue.path) {
|
|
1460
|
-
const dotPath = getDotPath(issue);
|
|
1465
|
+
const dotPath = /* @__PURE__ */ getDotPath(issue);
|
|
1461
1466
|
if (dotPath) {
|
|
1462
1467
|
if (!flatErrors.nested) {
|
|
1463
1468
|
flatErrors.nested = {};
|
|
@@ -1484,10 +1489,11 @@ function flatten(issues) {
|
|
|
1484
1489
|
}
|
|
1485
1490
|
return flatErrors;
|
|
1486
1491
|
}
|
|
1492
|
+
// @__NO_SIDE_EFFECTS__
|
|
1487
1493
|
async function safeParseAsync(schema, input, config2) {
|
|
1488
|
-
const dataset = await schema
|
|
1489
|
-
{
|
|
1490
|
-
getGlobalConfig(config2)
|
|
1494
|
+
const dataset = await schema["~run"](
|
|
1495
|
+
{ value: input },
|
|
1496
|
+
/* @__PURE__ */ getGlobalConfig(config2)
|
|
1491
1497
|
);
|
|
1492
1498
|
return {
|
|
1493
1499
|
typed: dataset.typed,
|
|
@@ -1663,7 +1669,7 @@ const valibotQrl = (qrl) => {
|
|
|
1663
1669
|
async validate(ev, inputData) {
|
|
1664
1670
|
const schema = await qrl.resolve().then((obj) => typeof obj === "function" ? obj(ev) : obj);
|
|
1665
1671
|
const data = inputData ?? await ev.parseBody();
|
|
1666
|
-
const result = await safeParseAsync(schema, data);
|
|
1672
|
+
const result = await /* @__PURE__ */ safeParseAsync(schema, data);
|
|
1667
1673
|
if (result.success) {
|
|
1668
1674
|
return {
|
|
1669
1675
|
success: true,
|
|
@@ -1677,7 +1683,7 @@ const valibotQrl = (qrl) => {
|
|
|
1677
1683
|
success: false,
|
|
1678
1684
|
status: 400,
|
|
1679
1685
|
error: {
|
|
1680
|
-
formErrors: flatten(result.issues).root ?? [],
|
|
1686
|
+
formErrors: (/* @__PURE__ */ flatten(result.issues)).root ?? [],
|
|
1681
1687
|
fieldErrors: flattenValibotIssues(result.issues)
|
|
1682
1688
|
}
|
|
1683
1689
|
};
|