@qwik.dev/core 2.0.0-beta.26 → 2.0.0-beta.27
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/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/backpatch/package.json +1 -1
- package/dist/build/package.json +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/core-internal.d.ts +14 -5
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +417 -430
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +6046 -6042
- package/dist/insights/index.qwik.mjs +80 -57
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.mjs +1 -1
- package/dist/preloader.mjs +86 -86
- package/dist/server.mjs +29 -21
- package/dist/server.prod.mjs +3263 -0
- package/dist/testing/index.d.ts +10 -1
- package/dist/testing/index.mjs +559 -562
- package/dist/testing/package.json +1 -1
- package/package.json +7 -3
|
@@ -1,72 +1,95 @@
|
|
|
1
|
-
import { sync
|
|
2
|
-
import { jsx
|
|
3
|
-
const
|
|
4
|
-
() => ((
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { sync$, component$, isDev } from "@qwik.dev/core";
|
|
2
|
+
import { jsx } from "@qwik.dev/core/jsx-runtime";
|
|
3
|
+
const insightsPing = sync$(
|
|
4
|
+
() => ((w, d, l, n, p, r, S) => {
|
|
5
|
+
var publicApiKey = __QI_KEY__, postUrl = __QI_URL__, qVersion = d.querySelector(`[q\\:version]`)?.getAttribute(`q:version`) || "unknown", manifestHash = d.querySelector(`[q\\:manifest-hash]`)?.getAttribute(`q:manifest-hash`) || "dev", qSymbols = [], existingSymbols = /* @__PURE__ */ new Set(), flushSymbolIndex = 0, lastReqTime = 0, timeoutID, qRouteChangeTime = p.now(), qRouteEl = d.querySelector(`[q\\:route]`), flush = () => {
|
|
6
|
+
timeoutID = void 0;
|
|
7
|
+
if (qSymbols.length > flushSymbolIndex) {
|
|
8
|
+
var payload = {
|
|
9
|
+
qVersion,
|
|
10
|
+
publicApiKey,
|
|
11
|
+
manifestHash,
|
|
12
|
+
previousSymbol: flushSymbolIndex == 0 ? void 0 : qSymbols[flushSymbolIndex - 1].symbol,
|
|
13
|
+
symbols: qSymbols.slice(flushSymbolIndex)
|
|
13
14
|
};
|
|
14
|
-
|
|
15
|
+
n.sendBeacon(postUrl, S(payload));
|
|
16
|
+
flushSymbolIndex = qSymbols.length;
|
|
15
17
|
}
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
+
}, debounceFlush = () => {
|
|
19
|
+
timeoutID != void 0 && clearTimeout(timeoutID);
|
|
20
|
+
timeoutID = setTimeout(flush, 1e3);
|
|
18
21
|
};
|
|
19
|
-
|
|
20
|
-
symbols:
|
|
21
|
-
publicApiKey
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
w.qSymbolTracker = {
|
|
23
|
+
symbols: qSymbols,
|
|
24
|
+
publicApiKey
|
|
25
|
+
};
|
|
26
|
+
if (qRouteEl) {
|
|
27
|
+
new MutationObserver((mutations) => {
|
|
28
|
+
var mutation = mutations.find((m) => m.attributeName === `q:route`);
|
|
29
|
+
if (mutation) {
|
|
30
|
+
qRouteChangeTime = p.now();
|
|
31
|
+
}
|
|
32
|
+
}).observe(qRouteEl, { attributes: true });
|
|
33
|
+
}
|
|
34
|
+
d.addEventListener("visibilitychange", () => d.visibilityState === "hidden" && flush());
|
|
35
|
+
d.addEventListener(`qsymbol`, (_event) => {
|
|
36
|
+
var event = _event, detail = event.detail, symbolRequestTime = detail.reqTime, symbolDeliveredTime = event.timeStamp, symbol = detail.symbol;
|
|
37
|
+
if (!existingSymbols.has(symbol)) {
|
|
38
|
+
existingSymbols.add(symbol);
|
|
39
|
+
var route = qRouteEl?.getAttribute(`q:route`) || "/";
|
|
40
|
+
qSymbols.push({
|
|
41
|
+
symbol,
|
|
42
|
+
route,
|
|
43
|
+
delay: r(0 - lastReqTime + symbolRequestTime),
|
|
44
|
+
latency: r(symbolDeliveredTime - symbolRequestTime),
|
|
45
|
+
timeline: r(0 - qRouteChangeTime + symbolRequestTime),
|
|
46
|
+
interaction: !!detail.element
|
|
47
|
+
});
|
|
48
|
+
lastReqTime = symbolDeliveredTime;
|
|
49
|
+
debounceFlush();
|
|
38
50
|
}
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
manifestHash: d,
|
|
45
|
-
timestamp: (/* @__PURE__ */ new Date()).getTime(),
|
|
46
|
-
source: t.filename,
|
|
47
|
-
line: t.lineno,
|
|
48
|
-
column: t.colno,
|
|
49
|
-
message: t.message,
|
|
50
|
-
error: "message" in e ? e.message : `${e}`,
|
|
51
|
-
stack: "stack" in e && e.stack || ""
|
|
52
|
-
};
|
|
53
|
-
c.sendBeacon(`${h}error/`, b(n));
|
|
51
|
+
});
|
|
52
|
+
w.addEventListener("error", (event) => {
|
|
53
|
+
var error = event.error;
|
|
54
|
+
if (!(error && typeof error === "object")) {
|
|
55
|
+
return;
|
|
54
56
|
}
|
|
57
|
+
var payload = {
|
|
58
|
+
url: `${l}`,
|
|
59
|
+
manifestHash,
|
|
60
|
+
timestamp: (/* @__PURE__ */ new Date()).getTime(),
|
|
61
|
+
source: event.filename,
|
|
62
|
+
line: event.lineno,
|
|
63
|
+
column: event.colno,
|
|
64
|
+
message: event.message,
|
|
65
|
+
error: "message" in error ? error.message : `${error}`,
|
|
66
|
+
stack: "stack" in error ? error.stack || "" : ""
|
|
67
|
+
};
|
|
68
|
+
n.sendBeacon(`${postUrl}error/`, S(payload));
|
|
55
69
|
});
|
|
56
70
|
})(window, document, location, navigator, performance, Math.round, JSON.stringify)
|
|
57
|
-
)
|
|
58
|
-
|
|
71
|
+
);
|
|
72
|
+
const Insights = component$(() => {
|
|
73
|
+
if (!__EXPERIMENTAL__.insights) {
|
|
59
74
|
throw new Error(
|
|
60
75
|
'Insights is experimental and must be enabled with `experimental: ["insights"]` in the `qwikVite` plugin.'
|
|
61
76
|
);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
77
|
+
}
|
|
78
|
+
const key = globalThis.__QI_KEY__;
|
|
79
|
+
const url = globalThis.__QI_URL__;
|
|
80
|
+
if (!key || !url) {
|
|
81
|
+
if (!isDev) {
|
|
82
|
+
console.warn("<Insights />: no config from qwikInsights plugin, skipping...");
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
return /* @__PURE__ */ jsx("script", {
|
|
87
|
+
"document:onQInit$": insightsPing,
|
|
65
88
|
// We must pass the vite injected variables via window because sync$ code doesn't get replaced by the vite plugin
|
|
66
|
-
dangerouslySetInnerHTML: `__QI_KEY__=${JSON.stringify(
|
|
89
|
+
dangerouslySetInnerHTML: `__QI_KEY__=${JSON.stringify(key)};__QI_URL__=${JSON.stringify(url)}`
|
|
67
90
|
});
|
|
68
91
|
});
|
|
69
92
|
export {
|
|
70
|
-
|
|
71
|
-
|
|
93
|
+
Insights,
|
|
94
|
+
insightsPing
|
|
72
95
|
};
|
package/dist/loader/package.json
CHANGED
package/dist/optimizer.mjs
CHANGED
|
@@ -344,7 +344,7 @@ const Et = () => typeof Deno < "u" ? "deno" : typeof Bun < "u" ? "bun" : typeof
|
|
|
344
344
|
r != null && (t[i] = r);
|
|
345
345
|
}), t.entryStrategy = e.entryStrategy?.type ?? "smart", t.manualChunks = e.entryStrategy?.manual ?? void 0, t;
|
|
346
346
|
}, Rr = {
|
|
347
|
-
qwik: "2.0.0-beta.
|
|
347
|
+
qwik: "2.0.0-beta.27-dev+7fc6984"
|
|
348
348
|
}, $t = (e, t = 0) => {
|
|
349
349
|
for (let i = 0; i < e.length; i++) {
|
|
350
350
|
const r = e.charCodeAt(i);
|
package/dist/preloader.mjs
CHANGED
|
@@ -1,128 +1,128 @@
|
|
|
1
|
-
import { isBrowser } from "@qwik.dev/core/build";
|
|
2
|
-
const
|
|
3
|
-
const config = { t: 0,
|
|
4
|
-
const
|
|
1
|
+
import { isBrowser as Nn } from "@qwik.dev/core/build";
|
|
2
|
+
const si = Nn ? document : void 0;
|
|
3
|
+
const config = { t: 0, i: 25, S: 0.65 };
|
|
4
|
+
const oi = Nn && si.createElement("link").relList.supports("modulepreload") ? "modulePreload" : "preload";
|
|
5
5
|
const loadStart = Date.now();
|
|
6
|
-
const
|
|
6
|
+
const li = /\.[mc]?js$/;
|
|
7
7
|
const BundleImportState_None = 0;
|
|
8
8
|
const BundleImportState_Queued = 1;
|
|
9
9
|
const BundleImportState_Preload = 2;
|
|
10
10
|
const BundleImportState_Alias = 3;
|
|
11
11
|
const BundleImportState_Loaded = 4;
|
|
12
|
-
const
|
|
12
|
+
const ui = /* @__PURE__ */ new Map();
|
|
13
13
|
let queueDirty;
|
|
14
|
-
let
|
|
15
|
-
const
|
|
14
|
+
let fi = 0;
|
|
15
|
+
const ai = [];
|
|
16
16
|
const log = (...e) => {
|
|
17
|
-
console.log(`Preloader ${Date.now() - loadStart}ms ${
|
|
17
|
+
console.log(`Preloader ${Date.now() - loadStart}ms ${fi}/${ai.length} queued>`, ...e);
|
|
18
18
|
};
|
|
19
19
|
const sortQueue = () => {
|
|
20
20
|
if (queueDirty) {
|
|
21
|
-
|
|
21
|
+
ai.sort((e, t) => e.Tt - t.Tt);
|
|
22
22
|
queueDirty = 0;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
25
|
+
const hi = () => {
|
|
26
|
+
if (!ai.length) return;
|
|
27
27
|
sortQueue();
|
|
28
|
-
while (
|
|
29
|
-
const e =
|
|
30
|
-
const t = e.
|
|
28
|
+
while (ai.length) {
|
|
29
|
+
const e = ai[0];
|
|
30
|
+
const t = e.Tt;
|
|
31
31
|
const o = 1 - t;
|
|
32
|
-
const n = graph ? config.
|
|
32
|
+
const n = graph ? config.i : (
|
|
33
33
|
// While the graph is not available, we limit to 5 preloads
|
|
34
34
|
5
|
|
35
35
|
);
|
|
36
|
-
if (o >= 0.99 ||
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
if (o >= 0.99 || fi < n) {
|
|
37
|
+
ai.shift();
|
|
38
|
+
di(e);
|
|
39
39
|
} else break;
|
|
40
40
|
}
|
|
41
|
-
if (config.t && !
|
|
42
|
-
const e = [...
|
|
43
|
-
const t = e.reduce((e2, t2) => e2 + t2.
|
|
44
|
-
const o = e.reduce((e2, t2) => e2 + t2
|
|
45
|
-
log(`>>>> done ${e.length}/${
|
|
41
|
+
if (config.t && !ai.length) {
|
|
42
|
+
const e = [...ui.values()].filter((e2) => e2.Nt > BundleImportState_None);
|
|
43
|
+
const t = e.reduce((e2, t2) => e2 + t2.Lt, 0);
|
|
44
|
+
const o = e.reduce((e2, t2) => e2 + t2.zt, 0);
|
|
45
|
+
log(`>>>> done ${e.length}/${ui.size} total: ${t}ms waited, ${o}ms loaded`);
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
const
|
|
49
|
-
if (e.
|
|
50
|
-
|
|
48
|
+
const di = (e) => {
|
|
49
|
+
if (e.Nt >= BundleImportState_Preload) return;
|
|
50
|
+
fi++;
|
|
51
51
|
const t = Date.now();
|
|
52
|
-
e.
|
|
53
|
-
e.
|
|
54
|
-
config.t && log(`<< load ${Math.round((1 - e.
|
|
55
|
-
const o =
|
|
56
|
-
o.href = new URL(`${base}${e.
|
|
57
|
-
o.rel =
|
|
52
|
+
e.Lt = t - e.Ft;
|
|
53
|
+
e.Nt = BundleImportState_Preload;
|
|
54
|
+
config.t && log(`<< load ${Math.round((1 - e.Tt) * 100)}% after ${`${e.Lt}ms`}`, e.It);
|
|
55
|
+
const o = si.createElement("link");
|
|
56
|
+
o.href = new URL(`${base}${e.It}`, si.baseURI).toString();
|
|
57
|
+
o.rel = oi;
|
|
58
58
|
o.as = "script";
|
|
59
59
|
o.onload = o.onerror = () => {
|
|
60
|
-
|
|
60
|
+
fi--;
|
|
61
61
|
const n = Date.now();
|
|
62
|
-
e
|
|
63
|
-
e.
|
|
64
|
-
config.t && log(`>> done after ${e
|
|
62
|
+
e.zt = n - t;
|
|
63
|
+
e.Nt = BundleImportState_Loaded;
|
|
64
|
+
config.t && log(`>> done after ${e.zt}ms`, e.It);
|
|
65
65
|
o.remove();
|
|
66
|
-
|
|
66
|
+
hi();
|
|
67
67
|
};
|
|
68
|
-
|
|
68
|
+
si.head.appendChild(o);
|
|
69
69
|
};
|
|
70
|
-
const
|
|
70
|
+
const pi = (e, t, o) => {
|
|
71
71
|
if (o?.has(e)) return;
|
|
72
|
-
const n = e.
|
|
73
|
-
e.
|
|
74
|
-
if (n - e.
|
|
72
|
+
const n = e.Tt;
|
|
73
|
+
e.Tt = t;
|
|
74
|
+
if (n - e.Tt < 0.01) return;
|
|
75
75
|
if (
|
|
76
76
|
// don't queue until we have initialized the preloader
|
|
77
|
-
base != null && e.
|
|
77
|
+
base != null && e.Nt < BundleImportState_Preload
|
|
78
78
|
) {
|
|
79
|
-
if (e.
|
|
80
|
-
e.
|
|
81
|
-
|
|
82
|
-
config.t && log(`queued ${Math.round((1 - e.
|
|
79
|
+
if (e.Nt === BundleImportState_None) {
|
|
80
|
+
e.Nt = BundleImportState_Queued;
|
|
81
|
+
ai.push(e);
|
|
82
|
+
config.t && log(`queued ${Math.round((1 - e.Tt) * 100)}%`, e.It);
|
|
83
83
|
}
|
|
84
84
|
queueDirty = 1;
|
|
85
85
|
}
|
|
86
|
-
if (e.
|
|
86
|
+
if (e.Mt) {
|
|
87
87
|
o ||= /* @__PURE__ */ new Set();
|
|
88
88
|
o.add(e);
|
|
89
|
-
const t2 = 1 - e.
|
|
90
|
-
for (const n2 of e.
|
|
91
|
-
const e2 =
|
|
92
|
-
if (e2.
|
|
89
|
+
const t2 = 1 - e.Tt;
|
|
90
|
+
for (const n2 of e.Mt) {
|
|
91
|
+
const e2 = ci(n2.It);
|
|
92
|
+
if (e2.Tt === 0) continue;
|
|
93
93
|
let r;
|
|
94
|
-
if (t2 === 1 || t2 >= 0.99 &&
|
|
95
|
-
|
|
96
|
-
r = Math.min(0.01, 1 - n2.
|
|
94
|
+
if (t2 === 1 || t2 >= 0.99 && yi < 100) {
|
|
95
|
+
yi++;
|
|
96
|
+
r = Math.min(0.01, 1 - n2.Dt);
|
|
97
97
|
} else {
|
|
98
|
-
const o2 = 1 - n2.
|
|
99
|
-
const s = n2.
|
|
98
|
+
const o2 = 1 - n2.Dt * t2;
|
|
99
|
+
const s = n2.Wt;
|
|
100
100
|
const l = o2 / s;
|
|
101
|
-
r = Math.max(0.02, e2.
|
|
102
|
-
n2.
|
|
101
|
+
r = Math.max(0.02, e2.Tt * l);
|
|
102
|
+
n2.Wt = l;
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
pi(e2, r, o);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
|
-
const
|
|
109
|
-
const o =
|
|
110
|
-
if (o && o.
|
|
108
|
+
const $i = (e, t) => {
|
|
109
|
+
const o = ci(e);
|
|
110
|
+
if (o && o.Tt > t) pi(o, t);
|
|
111
111
|
};
|
|
112
|
-
let
|
|
112
|
+
let yi;
|
|
113
113
|
const preload = (e, t) => {
|
|
114
114
|
if (!e?.length) return;
|
|
115
|
-
|
|
115
|
+
yi = 0;
|
|
116
116
|
let o = t ? 1 - t : 0.4;
|
|
117
117
|
if (Array.isArray(e)) for (let t2 = e.length - 1; t2 >= 0; t2--) {
|
|
118
118
|
const n = e[t2];
|
|
119
119
|
if (typeof n === "number") o = 1 - n / 10;
|
|
120
|
-
else
|
|
120
|
+
else $i(n, o);
|
|
121
121
|
}
|
|
122
|
-
else
|
|
123
|
-
if (
|
|
122
|
+
else $i(e, o);
|
|
123
|
+
if (Nn) hi();
|
|
124
124
|
};
|
|
125
|
-
if (
|
|
125
|
+
if (Nn) document.addEventListener("qsymbol", (e) => {
|
|
126
126
|
const { symbol: t, href: o } = e.detail;
|
|
127
127
|
if (o) {
|
|
128
128
|
const e2 = t.slice(t.lastIndexOf("_") + 1);
|
|
@@ -131,7 +131,7 @@ if (isBrowser) document.addEventListener("qsymbol", (e) => {
|
|
|
131
131
|
});
|
|
132
132
|
let base;
|
|
133
133
|
let graph;
|
|
134
|
-
const makeBundle = (e, t) => ({
|
|
134
|
+
const makeBundle = (e, t) => ({ It: e, Nt: li.test(e) ? BundleImportState_None : BundleImportState_Alias, Mt: t, Tt: 1, Ft: Date.now(), Lt: 0, zt: 0 });
|
|
135
135
|
const parseBundleGraph = (e) => {
|
|
136
136
|
const t = /* @__PURE__ */ new Map();
|
|
137
137
|
let o = 0;
|
|
@@ -142,15 +142,15 @@ const parseBundleGraph = (e) => {
|
|
|
142
142
|
let l = 1;
|
|
143
143
|
while (s = e[o], typeof s === "number") {
|
|
144
144
|
if (s < 0) l = -s / 10;
|
|
145
|
-
else r.push({
|
|
145
|
+
else r.push({ It: e[s], Dt: l, Wt: 1 });
|
|
146
146
|
o++;
|
|
147
147
|
}
|
|
148
148
|
t.set(n, r);
|
|
149
149
|
}
|
|
150
150
|
return t;
|
|
151
151
|
};
|
|
152
|
-
const
|
|
153
|
-
let t =
|
|
152
|
+
const ci = (e) => {
|
|
153
|
+
let t = ui.get(e);
|
|
154
154
|
if (!t) {
|
|
155
155
|
let o;
|
|
156
156
|
if (graph) {
|
|
@@ -159,37 +159,37 @@ const getBundle = (e) => {
|
|
|
159
159
|
if (!o.length) o = void 0;
|
|
160
160
|
}
|
|
161
161
|
t = makeBundle(e, o);
|
|
162
|
-
|
|
162
|
+
ui.set(e, t);
|
|
163
163
|
}
|
|
164
164
|
return t;
|
|
165
165
|
};
|
|
166
166
|
const loadBundleGraph = (e, t, o) => {
|
|
167
167
|
if (o) {
|
|
168
168
|
if ("d" in o) config.t = !!o.d;
|
|
169
|
-
if ("P" in o) config.
|
|
170
|
-
if ("Q" in o) config.
|
|
169
|
+
if ("P" in o) config.i = o["P"];
|
|
170
|
+
if ("Q" in o) config.S = 1 - o["Q"];
|
|
171
171
|
}
|
|
172
|
-
if (!
|
|
172
|
+
if (!Nn || e == null) return;
|
|
173
173
|
base = e;
|
|
174
174
|
if (t) t.then((e2) => e2.text()).then((e2) => {
|
|
175
175
|
graph = parseBundleGraph(JSON.parse(e2));
|
|
176
176
|
const t2 = [];
|
|
177
177
|
for (const [e3, o2] of graph.entries()) {
|
|
178
|
-
const n =
|
|
179
|
-
n.
|
|
180
|
-
if (n.
|
|
181
|
-
t2.push([n, n.
|
|
182
|
-
n.
|
|
178
|
+
const n = ci(e3);
|
|
179
|
+
n.Mt = o2;
|
|
180
|
+
if (n.Tt < 1) {
|
|
181
|
+
t2.push([n, n.Tt]);
|
|
182
|
+
n.Tt = 1;
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
config.t && log(`parseBundleGraph got ${graph.size} bundles, adjusting ${t2.length}`);
|
|
186
|
-
for (const [e3, o2] of t2)
|
|
187
|
-
|
|
186
|
+
for (const [e3, o2] of t2) pi(e3, o2);
|
|
187
|
+
hi();
|
|
188
188
|
}).catch(console.warn);
|
|
189
189
|
};
|
|
190
190
|
export {
|
|
191
191
|
parseBundleGraph as g,
|
|
192
|
-
|
|
192
|
+
$i as h,
|
|
193
193
|
loadBundleGraph as l,
|
|
194
194
|
preload as p
|
|
195
195
|
};
|
package/dist/server.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/server 2.0.0-beta.
|
|
3
|
+
* @qwik.dev/core/server 2.0.0-beta.27-dev+7fc6984
|
|
4
4
|
* Copyright QwikDev. All Rights Reserved.
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
|
|
@@ -20,12 +20,13 @@ import { isDev as isDev2 } from "@qwik.dev/core/build";
|
|
|
20
20
|
import { isDev } from "@qwik.dev/core/build";
|
|
21
21
|
|
|
22
22
|
// packages/qwik/src/core/shared/utils/qdev.ts
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var
|
|
23
|
+
var g = globalThis;
|
|
24
|
+
var qDev = g.qDev !== false;
|
|
25
|
+
var qInspector = g.qInspector === true;
|
|
26
|
+
var qSerialize = g.qSerialize !== false;
|
|
27
|
+
var qDynamicPlatform = g.qDynamicPlatform !== false;
|
|
28
|
+
var qTest = g.qTest === true;
|
|
29
|
+
var qRuntimeQrl = g.qRuntimeQrl === true;
|
|
29
30
|
|
|
30
31
|
// packages/qwik/src/core/shared/utils/log.ts
|
|
31
32
|
var STYLE = qDev ? `background: #564CE0; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;` : "";
|
|
@@ -139,7 +140,7 @@ var codeToText = (code, ...parts) => {
|
|
|
139
140
|
// 4
|
|
140
141
|
"QRL is not a function",
|
|
141
142
|
// 5
|
|
142
|
-
"Dynamic import not found",
|
|
143
|
+
"Dynamic import {{0}} not found",
|
|
143
144
|
// 6
|
|
144
145
|
"Unknown type argument",
|
|
145
146
|
// 7
|
|
@@ -1218,7 +1219,7 @@ function getBuildBase(opts) {
|
|
|
1218
1219
|
return `${import.meta.env.BASE_URL || "/"}build/`;
|
|
1219
1220
|
}
|
|
1220
1221
|
var versions = {
|
|
1221
|
-
qwik: "2.0.0-beta.
|
|
1222
|
+
qwik: "2.0.0-beta.27-dev+7fc6984",
|
|
1222
1223
|
qwikDom: "2.1.19"
|
|
1223
1224
|
};
|
|
1224
1225
|
|
|
@@ -2330,7 +2331,7 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2330
2331
|
}
|
|
2331
2332
|
$noScriptHere$ = 0;
|
|
2332
2333
|
/** Renders opening tag for DOM element */
|
|
2333
|
-
openElement(elementName, key, varAttrs, constAttrs = null, styleScopedId = null, currentFile = null) {
|
|
2334
|
+
openElement(elementName, key, varAttrs, constAttrs = null, styleScopedId = null, currentFile = null, hasMovedCaptures = true) {
|
|
2334
2335
|
const isQwikStyle = isQwikStyleElement(elementName, varAttrs) || isQwikStyleElement(elementName, constAttrs);
|
|
2335
2336
|
if (
|
|
2336
2337
|
// don't append qwik loader before qwik style elements
|
|
@@ -2357,7 +2358,14 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2357
2358
|
this.write(elementName);
|
|
2358
2359
|
const lastNode = this.getOrCreateLastNode();
|
|
2359
2360
|
if (varAttrs) {
|
|
2360
|
-
innerHTML = this.writeAttrs(
|
|
2361
|
+
innerHTML = this.writeAttrs(
|
|
2362
|
+
elementName,
|
|
2363
|
+
varAttrs,
|
|
2364
|
+
false,
|
|
2365
|
+
styleScopedId,
|
|
2366
|
+
currentFile,
|
|
2367
|
+
hasMovedCaptures
|
|
2368
|
+
);
|
|
2361
2369
|
}
|
|
2362
2370
|
this.write(" " + Q_PROPS_SEPARATOR);
|
|
2363
2371
|
if (key !== null) {
|
|
@@ -2366,7 +2374,14 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2366
2374
|
this.write(EMPTY_ATTR);
|
|
2367
2375
|
}
|
|
2368
2376
|
if (constAttrs && !isObjectEmpty(constAttrs)) {
|
|
2369
|
-
innerHTML = this.writeAttrs(
|
|
2377
|
+
innerHTML = this.writeAttrs(
|
|
2378
|
+
elementName,
|
|
2379
|
+
constAttrs,
|
|
2380
|
+
true,
|
|
2381
|
+
styleScopedId,
|
|
2382
|
+
currentFile,
|
|
2383
|
+
hasMovedCaptures
|
|
2384
|
+
) || innerHTML;
|
|
2370
2385
|
}
|
|
2371
2386
|
this.write(GT);
|
|
2372
2387
|
if (lastNode) {
|
|
@@ -2978,9 +2993,8 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2978
2993
|
this.write(element);
|
|
2979
2994
|
}
|
|
2980
2995
|
}
|
|
2981
|
-
writeAttrs(tag, attrs, isConst, styleScopedId, currentFile) {
|
|
2996
|
+
writeAttrs(tag, attrs, isConst, styleScopedId, currentFile, hasMovedCaptures) {
|
|
2982
2997
|
let innerHTML = void 0;
|
|
2983
|
-
let isLoopElement = null;
|
|
2984
2998
|
for (let key in attrs) {
|
|
2985
2999
|
let value = attrs[key];
|
|
2986
3000
|
if (isSSRUnsafeAttr(key)) {
|
|
@@ -2990,10 +3004,7 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2990
3004
|
continue;
|
|
2991
3005
|
}
|
|
2992
3006
|
if (isHtmlAttributeAnEventName(key)) {
|
|
2993
|
-
|
|
2994
|
-
isLoopElement = attributesContainsIterationProp(attrs);
|
|
2995
|
-
}
|
|
2996
|
-
value = _setEvent(this.serializationCtx, key, value, isLoopElement);
|
|
3007
|
+
value = _setEvent(this.serializationCtx, key, value, hasMovedCaptures);
|
|
2997
3008
|
} else if (key === "ref") {
|
|
2998
3009
|
const lastNode = this.getOrCreateLastNode();
|
|
2999
3010
|
if (isSignal(value)) {
|
|
@@ -3082,9 +3093,6 @@ var isQwikStyleElement = (tag, attrs) => {
|
|
|
3082
3093
|
}
|
|
3083
3094
|
return false;
|
|
3084
3095
|
};
|
|
3085
|
-
var attributesContainsIterationProp = (attrs) => {
|
|
3086
|
-
return Object.prototype.hasOwnProperty.call(attrs, ITERATION_ITEM_SINGLE) || Object.prototype.hasOwnProperty.call(attrs, ITERATION_ITEM_MULTI);
|
|
3087
|
-
};
|
|
3088
3096
|
function newTagError(text) {
|
|
3089
3097
|
return qError(12 /* tagError */, [text]);
|
|
3090
3098
|
}
|