@qwik.dev/core 2.0.0-beta.2 → 2.0.0-beta.4
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.darwin-x64.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/build/package.json +1 -1
- package/dist/cli.cjs +2 -2
- package/dist/core-internal.d.ts +112 -30
- package/dist/core.cjs +343 -227
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +338 -226
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +404 -328
- package/dist/core.prod.mjs +406 -330
- package/dist/insights/vite/index.cjs +1 -1
- package/dist/insights/vite/index.mjs +10 -10
- package/dist/loader/index.cjs +1 -1
- package/dist/loader/index.mjs +1 -1
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +108 -108
- package/dist/optimizer.mjs +106 -106
- package/dist/preloader.cjs +3 -3
- package/dist/preloader.mjs +3 -3
- package/dist/qwikloader.js +1 -1
- package/dist/server.cjs +27 -14
- package/dist/server.mjs +27 -14
- package/dist/starters/features/playwright/playwright-report/index.html +10 -8
- package/dist/testing/index.cjs +242 -141
- package/dist/testing/index.mjs +233 -133
- package/dist/testing/package.json +1 -1
- package/package.json +6 -6
- package/public.d.ts +1 -0
package/dist/optimizer.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/optimizer 2.0.0-beta.
|
|
3
|
+
* @qwik.dev/core/optimizer 2.0.0-beta.4-dev+9849dcf
|
|
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
|
|
@@ -54,7 +54,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
54
54
|
var decoder = new TextDecoder;
|
|
55
55
|
var toUTF8String = (input, start = 0, end = input.length) => decoder.decode(input.slice(start, end));
|
|
56
56
|
exports2.toUTF8String = toUTF8String;
|
|
57
|
-
var toHexString = (input, start = 0, end = input.length) => input.slice(start, end).reduce((
|
|
57
|
+
var toHexString = (input, start = 0, end = input.length) => input.slice(start, end).reduce((memo, i) => memo + ("0" + i.toString(16)).slice(-2), "");
|
|
58
58
|
exports2.toHexString = toHexString;
|
|
59
59
|
var readInt16LE = (input, offset = 0) => {
|
|
60
60
|
const val = input[offset] + 256 * input[offset + 1];
|
|
@@ -1257,7 +1257,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
1257
1257
|
}
|
|
1258
1258
|
};
|
|
1259
1259
|
var versions = {
|
|
1260
|
-
qwik: "2.0.0-beta.
|
|
1260
|
+
qwik: "2.0.0-beta.4-dev+9849dcf"
|
|
1261
1261
|
};
|
|
1262
1262
|
async function getSystem() {
|
|
1263
1263
|
const sysEnv = getEnv();
|
|
@@ -1326,11 +1326,11 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
1326
1326
|
const wasmPath = sys.path.join(__dirname, "..", "bindings", "qwik_wasm_bg.wasm");
|
|
1327
1327
|
const mod = await sys.dynamicImport("../bindings/qwik.wasm.cjs");
|
|
1328
1328
|
const fs = await sys.dynamicImport("node:fs");
|
|
1329
|
-
return new Promise((
|
|
1330
|
-
fs.readFile(wasmPath, (
|
|
1329
|
+
return new Promise((resolve, reject) => {
|
|
1330
|
+
fs.readFile(wasmPath, (err, buf) => {
|
|
1331
1331
|
null != err ? reject(err) : resolve(buf);
|
|
1332
|
-
})
|
|
1333
|
-
})
|
|
1332
|
+
});
|
|
1333
|
+
}).then(buf => WebAssembly.compile(buf)).then(wasm => mod.default(wasm)).then(() => mod);
|
|
1334
1334
|
}
|
|
1335
1335
|
if ("webworker" === sysEnv || "browsermain" === sysEnv) {
|
|
1336
1336
|
let version = versions.qwik;
|
|
@@ -1412,9 +1412,9 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
1412
1412
|
stripCtxName: void 0,
|
|
1413
1413
|
isServer: void 0
|
|
1414
1414
|
};
|
|
1415
|
-
Object.entries(opts).forEach((
|
|
1415
|
+
Object.entries(opts).forEach(([key, value]) => {
|
|
1416
1416
|
null != value && (output[key] = value);
|
|
1417
|
-
})
|
|
1417
|
+
});
|
|
1418
1418
|
output.entryStrategy = (null == (_a = opts.entryStrategy) ? void 0 : _a.type) ?? "smart";
|
|
1419
1419
|
output.manualChunks = (null == (_b = opts.entryStrategy) ? void 0 : _b.manual) ?? void 0;
|
|
1420
1420
|
return output;
|
|
@@ -1430,7 +1430,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
1430
1430
|
var extraSymbols = new Set([ "_run", "_task" ]);
|
|
1431
1431
|
function prioritizeSymbolNames(manifest) {
|
|
1432
1432
|
const symbols = manifest.symbols;
|
|
1433
|
-
return Object.keys(symbols).sort((
|
|
1433
|
+
return Object.keys(symbols).sort((symbolNameA, symbolNameB) => {
|
|
1434
1434
|
const a = symbols[symbolNameA];
|
|
1435
1435
|
const b = symbols[symbolNameB];
|
|
1436
1436
|
if ("eventHandler" === a.ctxKind && "eventHandler" !== b.ctxKind) {
|
|
@@ -1489,10 +1489,10 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
1489
1489
|
return 1;
|
|
1490
1490
|
}
|
|
1491
1491
|
return 0;
|
|
1492
|
-
})
|
|
1492
|
+
});
|
|
1493
1493
|
}
|
|
1494
|
-
var EVENT_PRIORITY = (() => [ "click", "dblclick", "contextmenu", "auxclick", "pointerdown", "pointerup", "pointermove", "pointerover", "pointerenter", "pointerleave", "pointerout", "pointercancel", "gotpointercapture", "lostpointercapture", "touchstart", "touchend", "touchmove", "touchcancel", "mousedown", "mouseup", "mousemove", "mouseenter", "mouseleave", "mouseover", "mouseout", "wheel", "gesturestart", "gesturechange", "gestureend", "keydown", "keyup", "keypress", "input", "change", "search", "invalid", "beforeinput", "select", "focusin", "focusout", "focus", "blur", "submit", "reset", "scroll" ].map(
|
|
1495
|
-
var FUNCTION_PRIORITY = (() => [ "useTask$", "useVisibleTask$", "component$", "useStyles$", "useStylesScoped$" ].map(
|
|
1494
|
+
var EVENT_PRIORITY = (() => [ "click", "dblclick", "contextmenu", "auxclick", "pointerdown", "pointerup", "pointermove", "pointerover", "pointerenter", "pointerleave", "pointerout", "pointercancel", "gotpointercapture", "lostpointercapture", "touchstart", "touchend", "touchmove", "touchcancel", "mousedown", "mouseup", "mousemove", "mouseenter", "mouseleave", "mouseover", "mouseout", "wheel", "gesturestart", "gesturechange", "gestureend", "keydown", "keyup", "keypress", "input", "change", "search", "invalid", "beforeinput", "select", "focusin", "focusout", "focus", "blur", "submit", "reset", "scroll" ].map(n => `on${n.toLowerCase()}$`))();
|
|
1495
|
+
var FUNCTION_PRIORITY = (() => [ "useTask$", "useVisibleTask$", "component$", "useStyles$", "useStylesScoped$" ].map(n => n.toLowerCase()))();
|
|
1496
1496
|
function sortBundleNames(manifest) {
|
|
1497
1497
|
return Object.keys(manifest.bundles).sort(sortAlphabetical);
|
|
1498
1498
|
}
|
|
@@ -1598,14 +1598,14 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
1598
1598
|
idx.has(v) || strongConnect(v);
|
|
1599
1599
|
}
|
|
1600
1600
|
const sccIndex = new Map;
|
|
1601
|
-
sccList.forEach((
|
|
1601
|
+
sccList.forEach((comp, i) => {
|
|
1602
1602
|
for (const v of comp) {
|
|
1603
1603
|
sccIndex.set(v, i);
|
|
1604
1604
|
}
|
|
1605
|
-
})
|
|
1605
|
+
});
|
|
1606
1606
|
const sccDAG = Array.from({
|
|
1607
1607
|
length: sccList.length
|
|
1608
|
-
}, (
|
|
1608
|
+
}, () => new Set);
|
|
1609
1609
|
for (const v of Object.keys(graph)) {
|
|
1610
1610
|
const i = sccIndex.get(v);
|
|
1611
1611
|
for (const w of graph[v].imports || []) {
|
|
@@ -1680,7 +1680,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
1680
1680
|
return canonPath(bundle.fileName);
|
|
1681
1681
|
};
|
|
1682
1682
|
let qwikHandlersName;
|
|
1683
|
-
const qrlNames = new Set(segments.map(
|
|
1683
|
+
const qrlNames = new Set(segments.map(h => h.name));
|
|
1684
1684
|
for (const outputBundle of Object.values(outputBundles)) {
|
|
1685
1685
|
if ("asset" === outputBundle.type) {
|
|
1686
1686
|
outputBundle.fileName.endsWith("js.map") || (manifest.assets[outputBundle.fileName] = {
|
|
@@ -1698,18 +1698,18 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
1698
1698
|
for (const symbol of outputBundle.exports) {
|
|
1699
1699
|
qrlNames.has(symbol) && (manifest.mapping[symbol] && 1 === outputBundle.exports.length || (manifest.mapping[symbol] = bundleFileName));
|
|
1700
1700
|
}
|
|
1701
|
-
const bundleImports = outputBundle.imports.filter(
|
|
1701
|
+
const bundleImports = outputBundle.imports.filter(i => outputBundle.code.includes(path.basename(i))).map(i => getBundleName(i)).filter(Boolean);
|
|
1702
1702
|
bundleImports.length > 0 && (bundle.imports = bundleImports);
|
|
1703
|
-
const bundleDynamicImports = outputBundle.dynamicImports.filter(
|
|
1703
|
+
const bundleDynamicImports = outputBundle.dynamicImports.filter(i => outputBundle.code.includes(path.basename(i))).map(i => getBundleName(i)).filter(Boolean);
|
|
1704
1704
|
bundleDynamicImports.length > 0 && (bundle.dynamicImports = bundleDynamicImports);
|
|
1705
1705
|
const ids = outputBundle.moduleIds || Object.keys(outputBundle.modules);
|
|
1706
|
-
const modulePaths = ids.filter(
|
|
1706
|
+
const modulePaths = ids.filter(m => !m.startsWith("\0")).map(m => path.relative(opts.rootDir, m));
|
|
1707
1707
|
if (modulePaths.length > 0) {
|
|
1708
1708
|
bundle.origins = modulePaths;
|
|
1709
|
-
modulePaths.some(
|
|
1710
|
-
modulePaths.some(
|
|
1711
|
-
modulePaths.some(
|
|
1712
|
-
modulePaths.some(
|
|
1709
|
+
modulePaths.some(m => /[/\\](core|qwik)[/\\]dist[/\\]preloader\.[cm]js$/.test(m)) && (manifest.preloader = bundleFileName);
|
|
1710
|
+
modulePaths.some(m => /[/\\](core|qwik)[/\\]dist[/\\]core(.min|.prod)?\.[cm]js$/.test(m)) && (manifest.core = bundleFileName);
|
|
1711
|
+
modulePaths.some(m => /[/\\](core|qwik)[/\\](dist[/\\])?qwikloader(\.debug)?\.[^/]*js$/.test(m)) && (manifest.qwikLoader = bundleFileName);
|
|
1712
|
+
modulePaths.some(m => /[/\\](core|qwik)[/\\]handlers\.[cm]js$/.test(m)) && (qwikHandlersName = bundleFileName);
|
|
1713
1713
|
}
|
|
1714
1714
|
manifest.bundles[bundleFileName] = bundle;
|
|
1715
1715
|
}
|
|
@@ -1799,11 +1799,11 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
1799
1799
|
}
|
|
1800
1800
|
for (const bundleName of Object.keys(graph)) {
|
|
1801
1801
|
const bundle = graph[bundleName];
|
|
1802
|
-
const imports = (null == (_a = bundle.imports) ? void 0 : _a.filter(
|
|
1803
|
-
const dynamicImports = (null == (_b = bundle.dynamicImports) ? void 0 : _b.filter(
|
|
1802
|
+
const imports = (null == (_a = bundle.imports) ? void 0 : _a.filter(dep => graph[dep])) || [];
|
|
1803
|
+
const dynamicImports = (null == (_b = bundle.dynamicImports) ? void 0 : _b.filter(dep => {
|
|
1804
1804
|
var _a2;
|
|
1805
|
-
return graph[dep] && (graph[dep].symbols || (null == (_a2 = graph[dep].origins) ? void 0 : _a2.some(
|
|
1806
|
-
}))
|
|
1805
|
+
return graph[dep] && (graph[dep].symbols || (null == (_a2 = graph[dep].origins) ? void 0 : _a2.some(o => !o.includes("node_modules"))));
|
|
1806
|
+
})) || [];
|
|
1807
1807
|
graph[bundleName] = {
|
|
1808
1808
|
...bundle,
|
|
1809
1809
|
imports: imports,
|
|
@@ -1850,7 +1850,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
1850
1850
|
probability += .08 * (dep.interactivity || 0);
|
|
1851
1851
|
if (bundle.origins && dep.origins) {
|
|
1852
1852
|
for (const origin of bundle.origins) {
|
|
1853
|
-
if (dep.origins.some(
|
|
1853
|
+
if (dep.origins.some(o => o.startsWith(origin))) {
|
|
1854
1854
|
probability += .25;
|
|
1855
1855
|
break;
|
|
1856
1856
|
}
|
|
@@ -1861,7 +1861,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
1861
1861
|
depProbability.set(depName, Math.min(probability, .99));
|
|
1862
1862
|
}
|
|
1863
1863
|
if (dynDeps.size > 0) {
|
|
1864
|
-
const sorted = Array.from(dynDeps).sort((
|
|
1864
|
+
const sorted = Array.from(dynDeps).sort((a, b) => depProbability.get(b) - depProbability.get(a));
|
|
1865
1865
|
let lastProbability = -1;
|
|
1866
1866
|
for (const depName of sorted) {
|
|
1867
1867
|
if (depProbability.get(depName) !== lastProbability) {
|
|
@@ -1933,7 +1933,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
1933
1933
|
const report = await eslint.lintText(code, {
|
|
1934
1934
|
filePath: filePath
|
|
1935
1935
|
});
|
|
1936
|
-
report.forEach(
|
|
1936
|
+
report.forEach(file => {
|
|
1937
1937
|
for (const message of file.messages) {
|
|
1938
1938
|
if (null != message.ruleId && !message.ruleId.startsWith("qwik/")) {
|
|
1939
1939
|
continue;
|
|
@@ -1941,7 +1941,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
1941
1941
|
const err = createRollupError(file.filePath, message);
|
|
1942
1942
|
ctx.warn(err);
|
|
1943
1943
|
}
|
|
1944
|
-
})
|
|
1944
|
+
});
|
|
1945
1945
|
} catch (err) {
|
|
1946
1946
|
console.warn(err);
|
|
1947
1947
|
}
|
|
@@ -1987,7 +1987,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
1987
1987
|
var findLocation = e => {
|
|
1988
1988
|
const stack = e.stack;
|
|
1989
1989
|
if ("string" === typeof stack) {
|
|
1990
|
-
const lines = stack.split("\n").filter(
|
|
1990
|
+
const lines = stack.split("\n").filter(l => !l.includes("/node_modules/") && !l.includes("(node:"));
|
|
1991
1991
|
for (let i = 1; i < lines.length; i++) {
|
|
1992
1992
|
const line = lines[i].replace("file:///", "/");
|
|
1993
1993
|
if (/^\s+at/.test(line)) {
|
|
@@ -2204,9 +2204,9 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
2204
2204
|
opts.srcDir ||= srcDir;
|
|
2205
2205
|
}
|
|
2206
2206
|
Array.isArray(updatedOpts.tsconfigFileNames) && updatedOpts.tsconfigFileNames.length > 0 && (opts.tsconfigFileNames = updatedOpts.tsconfigFileNames);
|
|
2207
|
-
Array.isArray(opts.srcInputs) ? opts.srcInputs.forEach(
|
|
2207
|
+
Array.isArray(opts.srcInputs) ? opts.srcInputs.forEach(i => {
|
|
2208
2208
|
i.path = normalizePath(path.resolve(opts.rootDir, i.path));
|
|
2209
|
-
})
|
|
2209
|
+
}) : "string" === typeof opts.srcDir && (opts.srcDir = normalizePath(path.resolve(opts.rootDir, normalizePath(opts.srcDir))));
|
|
2210
2210
|
if (!updatedOpts.csr) {
|
|
2211
2211
|
if (Array.isArray(updatedOpts.input)) {
|
|
2212
2212
|
opts.input = [ ...updatedOpts.input ];
|
|
@@ -2236,12 +2236,12 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
2236
2236
|
} else {
|
|
2237
2237
|
opts.input ||= [];
|
|
2238
2238
|
}
|
|
2239
|
-
Array.isArray(opts.input) && (opts.input = opts.input.reduce((
|
|
2239
|
+
Array.isArray(opts.input) && (opts.input = opts.input.reduce((inputs, i) => {
|
|
2240
2240
|
let input = i;
|
|
2241
2241
|
i.startsWith("@") || i.startsWith("~") || i.startsWith("#") || (input = normalizePath(path.resolve(opts.rootDir, i)));
|
|
2242
2242
|
inputs.includes(input) || inputs.push(input);
|
|
2243
2243
|
return inputs;
|
|
2244
|
-
}
|
|
2244
|
+
}, []));
|
|
2245
2245
|
"string" === typeof updatedOpts.outDir ? opts.outDir = normalizePath(path.resolve(opts.rootDir, normalizePath(updatedOpts.outDir))) : opts.outDir || ("ssr" === opts.target ? opts.outDir = normalizePath(path.resolve(opts.rootDir, SSR_OUT_DIR)) : "lib" === opts.target ? opts.outDir = normalizePath(path.resolve(opts.rootDir, LIB_OUT_DIR)) : opts.outDir = normalizePath(path.resolve(opts.rootDir, CLIENT_OUT_DIR)));
|
|
2246
2246
|
}
|
|
2247
2247
|
"function" === typeof updatedOpts.manifestOutput && (opts.manifestOutput = updatedOpts.manifestOutput);
|
|
@@ -2302,13 +2302,13 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
2302
2302
|
}
|
|
2303
2303
|
const path = getPath();
|
|
2304
2304
|
if (Array.isArray(opts.srcInputs)) {
|
|
2305
|
-
optimizer.sys.getInputFiles = async rootDir => opts.srcInputs.map(
|
|
2305
|
+
optimizer.sys.getInputFiles = async rootDir => opts.srcInputs.map(i => {
|
|
2306
2306
|
const relInput = {
|
|
2307
2307
|
path: normalizePath(path.relative(rootDir, i.path)),
|
|
2308
2308
|
code: i.code
|
|
2309
2309
|
};
|
|
2310
2310
|
return relInput;
|
|
2311
|
-
})
|
|
2311
|
+
});
|
|
2312
2312
|
debug(`buildStart() opts.srcInputs (${opts.srcInputs.length} files)`);
|
|
2313
2313
|
}
|
|
2314
2314
|
debug("transformedOutputs.clear()");
|
|
@@ -2518,13 +2518,13 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
2518
2518
|
const strip = "client" === opts.target || "ssr" === opts.target;
|
|
2519
2519
|
debug(`transform(${count})`, `Transforming ${id2} (for: ${isServer ? "server" : "client"}${strip ? ", strip" : ""})`);
|
|
2520
2520
|
const mode = "lib" === opts.target ? "lib" : "development" === opts.buildMode ? "dev" : "prod";
|
|
2521
|
-
"lib" !== mode && (code = code.replaceAll(/__EXPERIMENTAL__\.(\w+)/g, (
|
|
2521
|
+
"lib" !== mode && (code = code.replaceAll(/__EXPERIMENTAL__\.(\w+)/g, (_, feature) => {
|
|
2522
2522
|
var _a2;
|
|
2523
2523
|
if (null == (_a2 = opts.experimental) ? void 0 : _a2[feature]) {
|
|
2524
2524
|
return "true";
|
|
2525
2525
|
}
|
|
2526
2526
|
return "false";
|
|
2527
|
-
}))
|
|
2527
|
+
}));
|
|
2528
2528
|
let filePath = base;
|
|
2529
2529
|
opts.srcDir && (filePath = path.relative(opts.srcDir, pathId));
|
|
2530
2530
|
filePath = normalizePath(filePath);
|
|
@@ -2566,7 +2566,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
2566
2566
|
const now = Date.now();
|
|
2567
2567
|
const newOutput = await optimizer2.transformModules(transformOpts2);
|
|
2568
2568
|
debug(`transform(${count})`, `done in ${Date.now() - now}ms`);
|
|
2569
|
-
const module2 = newOutput.modules.find(
|
|
2569
|
+
const module2 = newOutput.modules.find(mod => !isAdditionalFile(mod));
|
|
2570
2570
|
diagnosticsCallback(newOutput.diagnostics, optimizer2, srcDir);
|
|
2571
2571
|
isServer ? 0 === newOutput.diagnostics.length && linter && linter.lint(ctx, code, id2) : clientResults.set(id2, newOutput);
|
|
2572
2572
|
const deps = new Set;
|
|
@@ -2620,17 +2620,17 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
2620
2620
|
const buildPath = path.resolve(opts.rootDir, opts.outDir, "build");
|
|
2621
2621
|
const canonPath = p => path.relative(buildPath, path.resolve(opts.rootDir, opts.outDir, p));
|
|
2622
2622
|
outputAnalyzer.canonPath = canonPath;
|
|
2623
|
-
const segments = Array.from(clientResults.values()).flatMap(
|
|
2623
|
+
const segments = Array.from(clientResults.values()).flatMap(r => r.modules).map(mod => mod.segment).filter(h => !!h);
|
|
2624
2624
|
const manifest = generateManifestFromBundles(path, segments, injections, rollupBundle, opts, debug, canonPath);
|
|
2625
2625
|
extra && Object.assign(manifest, extra);
|
|
2626
2626
|
for (const symbol of Object.values(manifest.symbols)) {
|
|
2627
2627
|
symbol.origin && (symbol.origin = normalizePath(symbol.origin));
|
|
2628
2628
|
}
|
|
2629
2629
|
for (const bundle of Object.values(manifest.bundles)) {
|
|
2630
|
-
bundle.origins && (bundle.origins = bundle.origins.map(
|
|
2630
|
+
bundle.origins && (bundle.origins = bundle.origins.map(abs => {
|
|
2631
2631
|
const relPath = path.relative(opts.rootDir, abs);
|
|
2632
2632
|
return normalizePath(relPath);
|
|
2633
|
-
})
|
|
2633
|
+
}).sort());
|
|
2634
2634
|
}
|
|
2635
2635
|
manifest.manifestHash = hashCode(JSON.stringify(manifest));
|
|
2636
2636
|
return manifest;
|
|
@@ -2638,7 +2638,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
2638
2638
|
return outputAnalyzer;
|
|
2639
2639
|
};
|
|
2640
2640
|
const getOptions = () => opts;
|
|
2641
|
-
const getTransformedOutputs = () => Array.from(clientTransformedOutputs.values()).map(
|
|
2641
|
+
const getTransformedOutputs = () => Array.from(clientTransformedOutputs.values()).map(t => t[0]);
|
|
2642
2642
|
const debug = (...str) => {
|
|
2643
2643
|
opts.debug && console.debug(`[QWIK PLUGIN: ${id}]`, ...str);
|
|
2644
2644
|
};
|
|
@@ -2853,12 +2853,12 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
2853
2853
|
},
|
|
2854
2854
|
outputOptions: rollupOutputOpts => normalizeRollupOutputOptionsObject(qwikPlugin, rollupOutputOpts, false),
|
|
2855
2855
|
async buildStart() {
|
|
2856
|
-
qwikPlugin.onDiagnostics((
|
|
2857
|
-
diagnostics.forEach(
|
|
2856
|
+
qwikPlugin.onDiagnostics((diagnostics, optimizer, srcDir) => {
|
|
2857
|
+
diagnostics.forEach(d => {
|
|
2858
2858
|
const id = qwikPlugin.normalizePath(optimizer.sys.path.join(srcDir, d.file));
|
|
2859
2859
|
"error" === d.category ? this.error(createRollupError2(id, d)) : this.warn(createRollupError2(id, d));
|
|
2860
|
-
})
|
|
2861
|
-
})
|
|
2860
|
+
});
|
|
2861
|
+
});
|
|
2862
2862
|
await qwikPlugin.buildStart(this);
|
|
2863
2863
|
},
|
|
2864
2864
|
resolveId(id, importer) {
|
|
@@ -2889,10 +2889,10 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
2889
2889
|
function normalizeRollupOutputOptions(qwikPlugin, rollupOutputOpts, useAssetsDir, outDir) {
|
|
2890
2890
|
if (Array.isArray(rollupOutputOpts)) {
|
|
2891
2891
|
rollupOutputOpts.length || rollupOutputOpts.push({});
|
|
2892
|
-
return rollupOutputOpts.map(
|
|
2892
|
+
return rollupOutputOpts.map(outputOptsObj => ({
|
|
2893
2893
|
...normalizeRollupOutputOptionsObject(qwikPlugin, outputOptsObj, useAssetsDir),
|
|
2894
2894
|
dir: outDir || outputOptsObj.dir
|
|
2895
|
-
}))
|
|
2895
|
+
}));
|
|
2896
2896
|
}
|
|
2897
2897
|
return {
|
|
2898
2898
|
...normalizeRollupOutputOptionsObject(qwikPlugin, rollupOutputOpts, useAssetsDir),
|
|
@@ -2914,10 +2914,10 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
2914
2914
|
let fileName;
|
|
2915
2915
|
fileName = "production" !== opts.buildMode || opts.debug ? chunkInfo => {
|
|
2916
2916
|
var _a, _b;
|
|
2917
|
-
if (null == (_a = chunkInfo.moduleIds) ? void 0 : _a.some(
|
|
2917
|
+
if (null == (_a = chunkInfo.moduleIds) ? void 0 : _a.some(id => id.endsWith("core.prod.mjs"))) {
|
|
2918
2918
|
return "build/core.js";
|
|
2919
2919
|
}
|
|
2920
|
-
if (null == (_b = chunkInfo.moduleIds) ? void 0 : _b.some(
|
|
2920
|
+
if (null == (_b = chunkInfo.moduleIds) ? void 0 : _b.some(id => id.endsWith("qwik-router/lib/index.qwik.mjs"))) {
|
|
2921
2921
|
return "build/qwik-router.js";
|
|
2922
2922
|
}
|
|
2923
2923
|
const path = optimizer.sys.path;
|
|
@@ -2958,7 +2958,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
2958
2958
|
});
|
|
2959
2959
|
return err;
|
|
2960
2960
|
}
|
|
2961
|
-
var QWIK_LOADER_DEFAULT_MINIFIED = 'const t=document,e=window,n=new Set,o=new Set([t]);let r;const s=(t,e)=>Array.from(t.querySelectorAll(e)),i=t=>{const e=[];return o.forEach(
|
|
2961
|
+
var QWIK_LOADER_DEFAULT_MINIFIED = 'const t=document,e=window,n=new Set,o=new Set([t]);let r;const s=(t,e)=>Array.from(t.querySelectorAll(e)),i=t=>{const e=[];return o.forEach(n=>e.push(...s(n,t))),e},a=t=>{v(t),s(t,"[q\\\\:shadowroot]").forEach(t=>{const e=t.shadowRoot;e&&a(e)})},c=t=>t&&"function"==typeof t.then;let l=!0;const f=(t,e,n=e.type)=>{let o=l;i("[on"+t+"\\\\:"+n+"]").forEach(r=>{o=!0,b(r,t,e,n)}),o||window[t.slice(1)].removeEventListener(n,"-window"===t?d:_)},p=e=>{if(void 0===e._qwikjson_){let n=(e===t.documentElement?t.body:e).lastElementChild;for(;n;){if("SCRIPT"===n.tagName&&"qwik/json"===n.getAttribute("type")){e._qwikjson_=JSON.parse(n.textContent.replace(/\\\\x3C(\\/?script)/gi,"<$1"));break}n=n.previousElementSibling}}},u=(t,e)=>new CustomEvent(t,{detail:e}),b=async(e,n,o,r=o.type)=>{const s="on"+n+":"+r;e.hasAttribute("preventdefault:"+r)&&o.preventDefault(),e.hasAttribute("stoppropagation:"+r)&&o.stopPropagation();const i=e._qc_,a=i&&i.li.filter(t=>t[0]===s);if(a&&a.length>0){for(const t of a){const n=t[1].getFn([e,o],()=>e.isConnected)(o,e),r=o.cancelBubble;c(n)&&await n,r&&o.stopPropagation()}return}const l=e.getAttribute(s),f=e.qDispatchEvent;if(f)return f(o,n);if(l){const n=e.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),r=n.getAttribute("q:base"),s=n.getAttribute("q:version")||"unknown",i=n.getAttribute("q:manifest-hash")||"dev",a=new URL(r,t.baseURI);for(const f of l.split("\\n")){const l=new URL(f,a),u=l.href,b=l.hash.replace(/^#?([^?[|]*).*$/,"$1")||"default",h=performance.now();let _,d,w;const m=f.startsWith("#"),y={qBase:r,qManifest:i,qVersion:s,href:u,symbol:b,element:e,reqTime:h};if(m){const e=n.getAttribute("q:instance");_=(t["qFuncs_"+e]||[])[Number.parseInt(b)],_||(d="sync",w=Error("sym:"+b))}else{q("qsymbol",y);const t=l.href.split("#")[0];try{const e=import(t);p(n),_=(await e)[b],_||(d="no-symbol",w=Error(`${b} not in ${t}`))}catch(t){d||(d="async"),w=t}}if(!_){q("qerror",{importError:d,error:w,...y}),console.error(w);break}const v=t.__q_context__;if(e.isConnected)try{t.__q_context__=[e,o,l];const n=_(o,e);c(n)&&await n}catch(t){q("qerror",{error:t,...y})}finally{t.__q_context__=v}}}},q=(e,n)=>{t.dispatchEvent(u(e,n))},h=t=>t.replace(/([A-Z])/g,t=>"-"+t.toLowerCase()),_=async t=>{let e=h(t.type),n=t.target;for(f("-document",t,e);n&&n.getAttribute;){const o=b(n,"",t,e);let r=t.cancelBubble;c(o)&&await o,r||(r=r||t.cancelBubble||n.hasAttribute("stoppropagation:"+t.type)),n=t.bubbles&&!0!==r?n.parentElement:null}},d=t=>{f("-window",t,h(t.type))},w=()=>{var s;const c=t.readyState;if(!r&&("interactive"==c||"complete"==c)&&(o.forEach(a),r=1,q("qinit"),(null!=(s=e.requestIdleCallback)?s:e.setTimeout).bind(e)(()=>q("qidle")),n.has("qvisible"))){const t=i("[on\\\\:qvisible]"),e=new IntersectionObserver(t=>{for(const n of t)n.isIntersecting&&(e.unobserve(n.target),b(n.target,"",u("qvisible",n)))});t.forEach(t=>e.observe(t))}},m=(t,e,n,o=!1)=>{t.addEventListener(e,n,{capture:o,passive:!1})};let y;const v=(...t)=>{l=!0,clearTimeout(y),y=setTimeout(()=>l=!1,2e4);for(const r of t)"string"==typeof r?n.has(r)||(o.forEach(t=>m(t,r,_,!0)),m(e,r,d,!0),n.add(r)):o.has(r)||(n.forEach(t=>m(r,t,_,!0)),o.add(r))};if(!("__q_context__"in t)){t.__q_context__=0;const r=e.qwikevents;r&&(Array.isArray(r)?v(...r):v("click","input")),e.qwikevents={events:n,roots:o,push:v},m(t,"readystatechange",w),w()}';
|
|
2962
2962
|
var QWIK_LOADER_DEFAULT_DEBUG = 'const doc = document;\nconst win = window;\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nlet hasInitialized;\nconst nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nconst querySelectorAll = (query) => {\n const elements = [];\n roots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n return elements;\n};\nconst findShadowRoots = (fragment) => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent) => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n });\n};\nconst isPromise = (promise) => promise && typeof promise.then === "function";\nlet doNotClean = true;\nconst broadcast = (infix, ev, type = ev.type) => {\n let found = doNotClean;\n querySelectorAll("[on" + infix + "\\\\:" + type + "]").forEach((el) => {\n found = true;\n dispatch(el, infix, ev, type);\n });\n if (!found) {\n window[infix.slice(1)].removeEventListener(\n type,\n infix === "-window" ? processWindowEvent : processDocumentEvent\n );\n }\n};\nconst resolveContainer = (containerEl) => {\n if (containerEl._qwikjson_ === void 0) {\n const parentJSON = containerEl === doc.documentElement ? doc.body : containerEl;\n let script = parentJSON.lastElementChild;\n while (script) {\n if (script.tagName === "SCRIPT" && script.getAttribute("type") === "qwik/json") {\n containerEl._qwikjson_ = JSON.parse(\n script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1")\n );\n break;\n }\n script = script.previousElementSibling;\n }\n }\n};\nconst createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail\n});\nconst dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = "on" + scope + ":" + eventName;\n if (element.hasAttribute("preventdefault:" + eventName)) {\n ev.preventDefault();\n }\n if (element.hasAttribute("stoppropagation:" + eventName)) {\n ev.stopPropagation();\n }\n const ctx = element._qc_;\n const relevantListeners = ctx && ctx.li.filter((li) => li[0] === attrName);\n if (relevantListeners && relevantListeners.length > 0) {\n for (const listener of relevantListeners) {\n const results = listener[1].getFn([element, ev], () => element.isConnected)(ev, element);\n const cancelBubble = ev.cancelBubble;\n if (isPromise(results)) {\n await results;\n }\n if (cancelBubble) {\n ev.stopPropagation();\n }\n }\n return;\n }\n const attrValue = element.getAttribute(attrName);\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n if (attrValue) {\n const container = element.closest(\n "[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"\n );\n const qBase = container.getAttribute("q:base");\n const qVersion = container.getAttribute("q:version") || "unknown";\n const qManifest = container.getAttribute("q:manifest-hash") || "dev";\n const base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split("\\n")) {\n const url = new URL(qrl, base);\n const href = url.href;\n const symbol = url.hash.replace(/^#?([^?[|]*).*$/, "$1") || "default";\n const reqTime = performance.now();\n let handler;\n let importError;\n let error;\n const isSync = qrl.startsWith("#");\n const eventData = {\n qBase,\n qManifest,\n qVersion,\n href,\n symbol,\n element,\n reqTime\n };\n if (isSync) {\n const hash = container.getAttribute("q:instance");\n handler = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];\n if (!handler) {\n importError = "sync";\n error = new Error("sym:" + symbol);\n }\n } else {\n emitEvent("qsymbol", eventData);\n const uri = url.href.split("#")[0];\n try {\n const module = import(\n uri\n );\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = "no-symbol";\n error = new Error(`${symbol} not in ${uri}`);\n }\n } catch (err) {\n importError || (importError = "async");\n error = err;\n }\n }\n if (!handler) {\n emitEvent("qerror", {\n importError,\n error,\n ...eventData\n });\n console.error(error);\n break;\n }\n const previousCtx = doc.__q_context__;\n if (element.isConnected) {\n try {\n doc.__q_context__ = [element, ev, url];\n const results = handler(ev, element);\n if (isPromise(results)) {\n await results;\n }\n } catch (error2) {\n emitEvent("qerror", { error: error2, ...eventData });\n } finally {\n doc.__q_context__ = previousCtx;\n }\n }\n }\n }\n};\nconst emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n};\nconst camelToKebab = (str) => str.replace(/([A-Z])/g, (a) => "-" + a.toLowerCase());\nconst processDocumentEvent = async (ev) => {\n let type = camelToKebab(ev.type);\n let element = ev.target;\n broadcast("-document", ev, type);\n while (element && element.getAttribute) {\n const results = dispatch(element, "", ev, type);\n let cancelBubble = ev.cancelBubble;\n if (isPromise(results)) {\n await results;\n }\n cancelBubble || (cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type));\n element = ev.bubbles && cancelBubble !== true ? element.parentElement : null;\n }\n};\nconst processWindowEvent = (ev) => {\n broadcast("-window", ev, camelToKebab(ev.type));\n};\nconst processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && (readyState == "interactive" || readyState == "complete")) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent("qinit");\n const riC = (_a = win.requestIdleCallback) != null ? _a : win.setTimeout;\n riC.bind(win)(() => emitEvent("qidle"));\n if (events.has("qvisible")) {\n const results = querySelectorAll("[on\\\\:qvisible]");\n const observer = new IntersectionObserver((entries) => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(entry.target, "", createEvent("qvisible", entry));\n }\n }\n });\n results.forEach((el) => observer.observe(el));\n }\n }\n};\nconst addEventListener = (el, eventName, handler, capture = false) => {\n el.addEventListener(eventName, handler, { capture, passive: false });\n};\nlet cleanTimer;\nconst processEventOrNode = (...eventNames) => {\n doNotClean = true;\n clearTimeout(cleanTimer);\n cleanTimer = setTimeout(() => doNotClean = false, 2e4);\n for (const eventNameOrNode of eventNames) {\n if (typeof eventNameOrNode === "string") {\n if (!events.has(eventNameOrNode)) {\n roots.forEach(\n (root) => addEventListener(root, eventNameOrNode, processDocumentEvent, true)\n );\n addEventListener(win, eventNameOrNode, processWindowEvent, true);\n events.add(eventNameOrNode);\n }\n } else {\n if (!roots.has(eventNameOrNode)) {\n events.forEach(\n (eventName) => addEventListener(eventNameOrNode, eventName, processDocumentEvent, true)\n );\n roots.add(eventNameOrNode);\n }\n }\n }\n};\nif (!("__q_context__" in doc)) {\n doc.__q_context__ = 0;\n const qwikevents = win.qwikevents;\n if (qwikevents) {\n if (Array.isArray(qwikevents)) {\n processEventOrNode(...qwikevents);\n } else {\n processEventOrNode("click", "input");\n }\n }\n win.qwikevents = {\n events,\n roots,\n push: processEventOrNode\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n}';
|
|
2963
2963
|
var import_bmp = __toESM(require_bmp(), 1);
|
|
2964
2964
|
var import_cur = __toESM(require_cur(), 1);
|
|
@@ -3013,7 +3013,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3013
3013
|
if (type && types[type].validate(buffer)) {
|
|
3014
3014
|
return type;
|
|
3015
3015
|
}
|
|
3016
|
-
return keys.find(
|
|
3016
|
+
return keys.find(key => types[key].validate(buffer));
|
|
3017
3017
|
}
|
|
3018
3018
|
function lookup(buffer) {
|
|
3019
3019
|
const type = detector(buffer);
|
|
@@ -3173,7 +3173,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3173
3173
|
return `Img${toPascalCase(value)}`;
|
|
3174
3174
|
}
|
|
3175
3175
|
function toPascalCase(string) {
|
|
3176
|
-
return `${string}`.toLowerCase().replace(new RegExp(/[-_]+/, "g"), " ").replace(new RegExp(/[^\w\s]/, "g"), "").replace(new RegExp(/\s+(.)(\w*)/, "g"), (
|
|
3176
|
+
return `${string}`.toLowerCase().replace(new RegExp(/[-_]+/, "g"), " ").replace(new RegExp(/[^\w\s]/, "g"), "").replace(new RegExp(/\s+(.)(\w*)/, "g"), ($1, $2, $3) => `${$2.toUpperCase() + $3}`).replace(new RegExp(/\w/), s => s.toUpperCase());
|
|
3177
3177
|
}
|
|
3178
3178
|
var FORCE_COLOR;
|
|
3179
3179
|
var NODE_DISABLE_COLORS;
|
|
@@ -3227,7 +3227,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3227
3227
|
var error_host_default = "<script>\n document.addEventListener('qerror', (ev) => {\n const ErrorOverlay = customElements.get('vite-error-overlay');\n if (!ErrorOverlay) {\n return;\n }\n const err = ev.detail.error;\n const overlay = new ErrorOverlay(err);\n document.body.appendChild(overlay);\n });\n<\/script>\n<script>\n /**\n * Usage:\n *\n * <errored-host></errored-host>\n */\n class ErroredHost extends HTMLElement {\n get _root() {\n return this.shadowRoot || this;\n }\n\n constructor() {\n super();\n const self = this;\n\n this.state = {};\n if (!this.props) {\n this.props = {};\n }\n\n this.componentProps = ['children', 'error'];\n\n // used to keep track of all nodes created by show/for\n this.nodesToDestroy = [];\n // batch updates\n this.pendingUpdate = false;\n\n this.attachShadow({ mode: 'open' });\n }\n\n destroyAnyNodes() {\n // destroy current view template refs before rendering again\n this.nodesToDestroy.forEach((el) => el.remove());\n this.nodesToDestroy = [];\n }\n\n connectedCallback() {\n this.getAttributeNames().forEach((attr) => {\n const jsVar = attr.replace(/-/g, '');\n const regexp = new RegExp(jsVar, 'i');\n this.componentProps.forEach((prop) => {\n if (regexp.test(prop)) {\n const attrValue = this.getAttribute(attr);\n if (this.props[prop] !== attrValue) {\n this.props[prop] = attrValue;\n }\n }\n });\n });\n\n this._root.innerHTML = `\n\n <template data-el=\"show-errored-host\">\n <div class=\"error\">\n <template data-el=\"div-errored-host-2\">\n \x3c!-- String(props.error) --\x3e\n </template>\n </div>\n </template>\n\n <div class=\"arrow\">👇 Uncaught error happened here 👇\n <span class=\"dev-tools\">DevTools: Cmd+Alt+I</span>\n </div>\n <div class=\"div\">\n <slot></slot>\n </div>\n\n <style>\n .error {\n border-radius: 5px 5px 0px 0;\n background: black;\n color: white;\n font-family: monospace;\n font-size: 12px;\n margin: 0;\n padding: 10px;\n }\n .arrow {\n background: #f47e81;\n color: black;\n font-size: 14px;\n padding: 10px;\n text-align: center;\n font-family: sans-serif;\n }\n .dev-tools {\n background: red;\n padding: 2px 5px;\n border-radius: 3px;\n font-weight: 800;\n }\n .div {\n outline: 5px solid red;\n border-radius: 10px;\n }\n </style>`;\n this.pendingUpdate = true;\n\n this.render();\n this.onMount();\n this.pendingUpdate = false;\n this.update();\n }\n\n showContent(el) {\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLTemplateElement/content\n // grabs the content of a node that is between <template> tags\n // iterates through child nodes to register all content including text elements\n // attaches the content after the template\n\n const elementFragment = el.content.cloneNode(true);\n const children = Array.from(elementFragment.childNodes);\n children.forEach((child) => {\n if (el?.scope) {\n child.scope = el.scope;\n }\n if (el?.context) {\n child.context = el.context;\n }\n this.nodesToDestroy.push(child);\n });\n el.after(elementFragment);\n }\n\n onMount() {}\n\n onUpdate() {}\n\n update() {\n if (this.pendingUpdate === true) {\n return;\n }\n this.pendingUpdate = true;\n this.render();\n this.onUpdate();\n this.pendingUpdate = false;\n }\n\n render() {\n // re-rendering needs to ensure that all nodes generated by for/show are refreshed\n this.destroyAnyNodes();\n this.updateBindings();\n }\n\n updateBindings() {\n this._root.querySelectorAll(\"[data-el='show-errored-host']\").forEach((el) => {\n const whenCondition = this.props.error;\n if (whenCondition) {\n this.showContent(el);\n }\n });\n\n this._root.querySelectorAll(\"[data-el='div-errored-host-2']\").forEach((el) => {\n this.renderTextNode(el, String(this.props.error));\n });\n }\n\n // Helper to render content\n renderTextNode(el, text) {\n const textNode = document.createTextNode(text);\n if (el?.scope) {\n textNode.scope = el.scope;\n }\n if (el?.context) {\n textNode.context = el.context;\n }\n el.after(textNode);\n this.nodesToDestroy.push(el.nextSibling);\n }\n }\n\n customElements.define('errored-host', ErroredHost);\n<\/script>\n";
|
|
3228
3228
|
var image_size_runtime_default = "<style>\n [data-qwik-cls] {\n outline: 2px solid red;\n }\n [data-qwik-cls]::after {\n position: absolute;\n font-size: 12px;\n content: 'CLS ' attr(data-qwik-cls);\n font-family: monospace;\n font-weight: bold;\n background: red;\n color: white;\n margin: -2px;\n padding: 1px;\n line-height: 1;\n pointer-events: none;\n }\n #qwik-image-warning-container {\n position: absolute !important;\n top: 0 !important;\n left: 0 !important;\n width: 0 !important;\n overflow: visible !important;\n height: 0 !important;\n pointer-events: none !important;\n contain: size layout style content;\n z-index: 1;\n }\n</style>\n<template id=\"qwik-image-warning-template\">\n <style>\n :host {\n position: absolute;\n border: 1px solid red;\n pointer-events: none;\n z-index: 1;\n contain: layout size;\n }\n\n #icon {\n border: 0;\n margin: 5px;\n color: black;\n max-width: 100%;\n width: 20px;\n background: yellow;\n border-radius: 100%;\n height: 20px;\n padding: 3px;\n pointer-events: all;\n cursor: pointer;\n }\n\n #icon svg {\n width: 100%;\n height: auto;\n pointer-events: none;\n }\n\n dialog {\n padding: 0;\n border: 0;\n margin: 0 5px;\n background: #ffffe8;\n color: black;\n width: 250px;\n font-size: 11px;\n position: absolute;\n inset-inline-start: unset;\n inset-inline-end: unset;\n border-radius: 5px;\n pointer-events: all;\n overflow: hidden;\n box-shadow: 0px -2px 20px 0px #0000002e;\n z-index: 10000;\n }\n\n .top {\n bottom: calc(100% + 5px);\n }\n .bottom {\n top: 40px;\n }\n .right {\n inset-inline-start: 0;\n inset-inline-end: unset;\n }\n .left {\n inset-inline-start: unset;\n inset-inline-end: calc(100% - 40px);\n }\n\n .content {\n padding: 5px;\n }\n\n #loc {\n background: #2e3801;\n color: #d2d2d2;\n font-family: monospace;\n padding: 3px 5px;\n pointer-events: all;\n margin: 0;\n border: 0;\n cursor: pointer;\n font-size: 11px;\n width: calc(100% - 24px);\n text-overflow: ellipsis;\n overflow: hidden;\n display: block;\n direction: rtl;\n text-align: right;\n }\n #loc:hover {\n background: #3a4a01;\n }\n\n pre {\n background: #f1fb8e;\n padding: 5px;\n margin: 5px 0;\n border-radius: 3px;\n user-select: none;\n }\n\n pre span {\n user-select: all;\n }\n\n a {\n text-decoration: underline;\n }\n\n #close {\n border: 0;\n width: 25px;\n height: 25px;\n position: absolute;\n right: 0;\n top: 0;\n background: #ffe14f;\n color: black;\n font-weight: 900;\n padding: 0;\n margin: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n line-height: 1;\n cursor: pointer;\n }\n #close:hover {\n background: #ffeb6f;\n }\n\n #action-btn {\n border: 2px solid #18ae00;\n padding: 2px 4px;\n background: #50ff50;\n border-radius: 5px;\n color: #0c5500;\n font-weight: 800;\n font-size: 10px;\n cursor: pointer;\n }\n\n p {\n margin: 5px 0;\n }\n\n h2 {\n font-weight: 900;\n margin: 10px 0;\n }\n </style>\n <button id=\"icon\" type=\"button\" aria-label=\"Open image dev dialog\">\n <svg width=\"32\" height=\"32\" viewBox=\"0 0 24 24\">\n <path\n fill=\"currentColor\"\n d=\"M2.725 21q-.275 0-.5-.138t-.35-.362q-.125-.225-.138-.488t.138-.512l9.25-16q.15-.25.388-.375T12 3q.25 0 .488.125t.387.375l9.25 16q.15.25.138.513t-.138.487q-.125.225-.35.363t-.5.137H2.725ZM12 18q.425 0 .713-.288T13 17q0-.425-.288-.713T12 16q-.425 0-.713.288T11 17q0 .425.288.713T12 18Zm0-3q.425 0 .713-.288T13 14v-3q0-.425-.288-.713T12 10q-.425 0-.713.288T11 11v3q0 .425.288.713T12 15Z\"\n />\n </svg>\n </button>\n <dialog>\n <form method=\"dialog\">\n <button id=\"close\" type=\"submit\" aria-label=\"Close\">X</button>\n </form>\n <button id=\"loc\"></button>\n <div class=\"content\">\n <h2 id=\"title\"></h2>\n <p id=\"message\"></p>\n <p class=\"action-container\"></p>\n </div>\n </dialog>\n</template>\n<div id=\"qwik-image-warning-container\"></div>\n<script>\n (function () {\n function getPositionClasses(target) {\n const { x, y } = target.getBoundingClientRect();\n const windowWidth = window.innerWidth;\n let horizontal = 'right';\n let vertical = 'bottom';\n if (x > windowWidth - 260) {\n horizontal = 'left';\n }\n return `${vertical} ${horizontal}`;\n }\n class ImageWarning extends HTMLElement {\n #actionFn = null;\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(\n document.importNode(document.getElementById('qwik-image-warning-template').content, true)\n );\n const dialog = this.shadowRoot.querySelector('dialog');\n\n this.shadowRoot.addEventListener('click', async (ev) => {\n const target = ev.target;\n if (target.nodeName === 'BUTTON') {\n if (target.id === 'action-btn') {\n if (this.#actionFn) {\n this.#actionFn();\n dialog.close();\n }\n } else if (target.id === 'icon') {\n if (dialog.open) {\n dialog.close();\n } else {\n dialog.className = getPositionClasses(target);\n dialog.show();\n }\n } else if (target.id === 'loc' && target.dataset.url) {\n globalThis.qwikOpenInEditor(target.dataset.url);\n }\n }\n });\n }\n\n set loc(value) {\n const anchor = this.shadowRoot.querySelector('#loc');\n anchor.textContent = value;\n if (globalThis.qwikOpenInEditor) {\n anchor.dataset.url = value;\n }\n }\n\n set header(value) {\n this.shadowRoot.querySelector('#title').textContent = value;\n }\n\n set message(value) {\n this.shadowRoot.querySelector('#message').innerHTML = value;\n }\n\n set actionFn(value) {\n this.#actionFn = value;\n }\n set actionName(value) {\n if (value) {\n this.shadowRoot.querySelector('.action-container').innerHTML =\n `<button id=\"action-btn\" type=\"button\">${value}</button>`;\n }\n }\n }\n customElements.define('image-warning', ImageWarning);\n\n const shiftsMap = new Map();\n const visibleNodes = new Map();\n const imageContainer = document.querySelector('#qwik-image-warning-container');\n let skip = false;\n\n async function _getInfo(originalSrc) {\n // Put all supported protocols here, see also packages/qwik/src/optimizer/src/plugins/image-size-server.ts\n if (!/^(https?|file|capacitor):/.test(originalSrc)) {\n return undefined;\n }\n const url = new URL('/__image_info', location.href);\n url.searchParams.set('url', originalSrc);\n const res = await fetch(url);\n if (res.ok) {\n return await res.json();\n } else {\n return null;\n }\n }\n\n const map = new Map();\n function getInfo(originalSrc) {\n let p = map.get(originalSrc);\n if (typeof p === 'undefined') {\n p = _getInfo(originalSrc);\n map.set(originalSrc, p);\n }\n return p;\n }\n function isDefinedUnit(value) {\n return value.endsWith('px');\n }\n async function doImg(node) {\n const scrollX = window.scrollX;\n const scrollY = window.scrollY;\n const rect = node.getBoundingClientRect();\n const originalSrc = node.currentSrc;\n const info = await getInfo(originalSrc);\n let overlay = visibleNodes.get(node);\n const wideScreen = window.innerWidth > 500;\n if (info && wideScreen) {\n let layoutInvalidation = false;\n const loc = node.getAttribute('data-qwik-inspector');\n const browserArea = rect.width * rect.height;\n if (!node.hasAttribute('width') || !node.hasAttribute('height')) {\n skip = true;\n const computedStyles = getComputedStyle(node);\n const hasAspect = computedStyles.getPropertyValue('aspect-ratio').toString() !== 'auto';\n const hasWidth = isDefinedUnit(computedStyles.getPropertyValue('width').toString());\n const hasHeight = isDefinedUnit(computedStyles.getPropertyValue('height').toString());\n const isAbsolute = computedStyles.getPropertyValue('position').toString() === 'absolute';\n layoutInvalidation =\n browserArea > 1000 && !isAbsolute && !hasAspect && (!hasWidth || !hasHeight);\n }\n const realArea = info.width && info.height;\n const threshholdArea = realArea * 0.5;\n const tooBig = browserArea < threshholdArea && info.type !== 'svg';\n skip = false;\n if (layoutInvalidation || tooBig) {\n if (!overlay) {\n overlay = document.createElement('image-warning');\n imageContainer.appendChild(overlay);\n visibleNodes.set(node, overlay);\n }\n overlay.style.top = rect.top + scrollY + 'px';\n overlay.style.left = rect.left + scrollX + 'px';\n overlay.style.width = rect.width + 'px';\n overlay.style.height = rect.height + 'px';\n overlay.info = info;\n overlay.loc = loc;\n if (layoutInvalidation) {\n const clipBoard = `width=\"${info.width}\" height=\"${info.height}\"`;\n overlay.header = 'Perf: layout shift';\n overlay.message = `Image\\'s size is unknown until it\\'s loaded, <a href=\"https://web.dev/cls/\" target=\"_blank\" rel=\"noopener noreferrer\">causing layout shift</a>.</p><p>To solve this problem set the width/height in the img tag:</p><pre><img <span>${clipBoard}</span></pre>`;\n const uniqueLoc =\n document.querySelectorAll('[data-qwik-inspector=\"' + loc + '\"]').length === 1;\n if (loc) {\n if (uniqueLoc) {\n overlay.actionName = 'Auto fix';\n overlay.actionFn = async () => {\n const url = new URL('/__image_fix', location.href);\n url.searchParams.set('loc', loc);\n url.searchParams.set('width', info.width);\n url.searchParams.set('height', info.height);\n if (!node.srcset) {\n url.searchParams.set('src', node.currentSrc);\n url.searchParams.set('currentHref', location.href);\n }\n await fetch(url, {\n method: 'POST',\n });\n };\n } else {\n overlay.actionName = 'Open in editor';\n overlay.actionFn = async () => {\n await navigator.clipboard.writeText(clipBoard);\n globalThis.qwikOpenInEditor(loc);\n };\n }\n }\n } else if (tooBig) {\n overlay.header = 'Perf: properly size image';\n overlay.message = `The image is too big, <a href=\"https://developer.chrome.com/en/docs/lighthouse/performance/uses-responsive-images/\" target=\"_blank\" rel=\"noopener noreferrer\">hurting performance</a>, it should be resized to the size it\\'s displayed at. The image dimensions are ${info.width} x ${info.height} but it\\'s displayed at ${rect.width}x${rect.height}.</p>`;\n }\n return;\n }\n }\n\n if (overlay) {\n overlay.remove();\n visibleNodes.delete(node);\n }\n }\n\n async function updateImg(node) {\n const overlay = visibleNodes.get(node);\n if (!node.isConnected) {\n if (overlay) {\n overlay.remove();\n visibleNodes.delete(node);\n }\n } else if (node.complete) {\n doImg(node);\n }\n }\n\n const resizeObserver = new ResizeObserver((entries) => {\n if (!skip) {\n for (const entry of entries) {\n updateImg(entry.target);\n }\n }\n });\n\n const observer = new MutationObserver((entry) => {\n for (const mutation of entry) {\n for (const node of mutation.addedNodes) {\n if (node.nodeName === 'IMG') {\n resizeObserver.observe(node);\n } else if (node.nodeType === 1) {\n node.querySelectorAll('img').forEach((img) => {\n resizeObserver.observe(img);\n });\n }\n }\n for (const node of mutation.removedNodes) {\n if (node.nodeName === 'IMG') {\n updateImg(node);\n resizeObserver.unobserve(node);\n } else if (node.nodeType === 1) {\n node.querySelectorAll('img').forEach((img) => {\n updateImg(img);\n resizeObserver.unobserve(img);\n });\n }\n }\n }\n });\n let perfObserver;\n let DCLS = 0;\n const activate = () => {\n setTimeout(() => {\n if (perfObserver) {\n perfObserver.disconnect();\n if (DCLS > 0.005) {\n console.error('Detected Layout Shift during page load', DCLS);\n }\n }\n observer.observe(document.body, {\n childList: true,\n subtree: true,\n });\n document.body.querySelectorAll('img').forEach((node) => {\n resizeObserver.observe(node);\n });\n }, 100);\n };\n if (document.readyState === 'complete') {\n activate();\n } else {\n window.addEventListener('load', activate);\n }\n const pageAccessedByReload =\n performance?.navigation.type === 1 ||\n performance\n .getEntriesByType('navigation')\n .map((nav) => nav.type)\n .includes('reload');\n if (typeof PerformanceObserver !== 'undefined' && !pageAccessedByReload) {\n const shiftsMap = new Map();\n perfObserver = new PerformanceObserver((list) => {\n list.getEntries().forEach((entry) => {\n if (entry.hadRecentInput) {\n return; // Ignore shifts after recent input.\n }\n if (entry.value > 0.006) {\n for (const source of entry.sources) {\n if (\n source.node &&\n source.node.nodeType === 1 &&\n source.node.nodeName !== 'IMAGE-WARNING'\n ) {\n source.node.setAttribute('data-qwik-cls', Number(entry.value).toFixed(3));\n }\n }\n }\n DCLS += entry.value;\n });\n });\n perfObserver.observe({ type: 'layout-shift', buffered: true });\n }\n })();\n<\/script>\n";
|
|
3229
3229
|
var perf_warning_default = "<script>\n if (!window.__qwikViteLog) {\n window.__qwikViteLog = true;\n console.debug(\n '%c⭐️ Qwik Dev SSR Mode',\n 'background: #0c75d2; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;',\n \"App is running in SSR development mode!\\n - Additional JS is loaded by Vite for debugging and live reloading\\n - Rendering performance might not be optimal\\n - Delayed interactivity because prefetching is disabled\\n - Vite dev bundles do not represent production output\\n\\nProduction build can be tested running 'npm run preview'\"\n );\n }\n<\/script>\n";
|
|
3230
|
-
var VITE_ERROR_OVERLAY_STYLES = "\nvite-error-overlay {\n --color-bright: rgba(255, 255, 255, 0.8);\n --color-yellow: rgba(255,246,85,0.8);\n --qwik-dark-blue: #006ce9;\n --qwik-light-blue: #3ec2f7;\n --qwik-light-purple: #ac7ff4;\n --qwik-dark-purple: #713fc2;\n --yellow: #fff; /* override vite yellow */\n --purple: var(--color-bright); /* override vite purple */\n --red: var(--qwik-light-blue); /* override vite red */\n\n --vertical-box-spacing: 15px;\n --box-padding: 20px;\n --box-margin: 0 0 var(--vertical-box-spacing) 0;\n --box-background: rgba(0, 0, 0, 0.5);\n --box-border-radius: 8px;\n}\n\nvite-error-overlay::part(backdrop) {\n background: rgb(2 11 17 / 60%);\n
|
|
3230
|
+
var VITE_ERROR_OVERLAY_STYLES = "\nvite-error-overlay {\n --color-bright: rgba(255, 255, 255, 0.8);\n --color-yellow: rgba(255,246,85,0.8);\n --qwik-dark-blue: #006ce9;\n --qwik-light-blue: #3ec2f7;\n --qwik-light-purple: #ac7ff4;\n --qwik-dark-purple: #713fc2;\n --yellow: #fff; /* override vite yellow */\n --purple: var(--color-bright); /* override vite purple */\n --red: var(--qwik-light-blue); /* override vite red */\n\n --vertical-box-spacing: 15px;\n --box-padding: 20px;\n --box-margin: 0 0 var(--vertical-box-spacing) 0;\n --box-background: rgba(0, 0, 0, 0.5);\n --box-border-radius: 8px;\n}\n\nvite-error-overlay::part(backdrop) {\n background: rgb(2 11 17 / 60%);\n}\n\nvite-error-overlay::part(window) {\n background: transparent;\n border: none;\n box-shadow: none;\n box-sizing: border-box;\n margin: 50px auto;\n max-width: 1200px;\n padding: var(--box-padding);\n width: 90%;\n}\n\nvite-error-overlay::part(message) {\n display: flex;\n flex-direction: column;\n font-size: 1.6rem;\n line-height: 1.7;\n margin-bottom: 30px;\n}\n\nvite-error-overlay::part(plugin) {\n font-size: 0.8rem;\n font-weight: 100;\n}\n\nvite-error-overlay::part(file),\nvite-error-overlay::part(frame),\nvite-error-overlay::part(stack),\nvite-error-overlay::part(tip) {\n background: var(--box-background);\n border-left: 5px solid transparent;\n border-radius: var(--box-border-radius);\n margin: var(--box-margin);\n min-height: 50px;\n padding: var(--box-padding);\n position: relative;\n}\n\nvite-error-overlay::part(file) {\n border-left-color: rgb(25 182 246);\n color: var(--color-bright);\n}\n\nvite-error-overlay::part(frame) {\n border-left-color: var(--color-yellow);\n color: var(--color-yellow);\n}\n\nvite-error-overlay::part(stack) {\n border-left-color: #FF5722;\n}\n\n\nvite-error-overlay::part(tip) {\n border-top: none;\n border-left-color: rgb(172, 127, 244);\n}\n\nvite-error-overlay::part(file):before,\nvite-error-overlay::part(frame):before,\nvite-error-overlay::part(stack):before {\n border-bottom: 1px solid #222;\n color: var(--color-bright);\n display: block;\n margin-bottom: 15px;\n padding-bottom: 5px;\n padding-left: 30px; /* space for icon */\n font-size: .8rem;\n}\n\nvite-error-overlay::part(file):before {\n content: 'File';\n}\n\nvite-error-overlay::part(frame):before {\n content: 'Frame';\n}\n\nvite-error-overlay::part(stack):before {\n content: 'Stack Trace';\n}\n\nvite-error-overlay::part(file):after,\nvite-error-overlay::part(frame):after,\nvite-error-overlay::part(stack):after {\n content: '';\n display: block;\n height: 20px;\n position: absolute;\n left: var(--box-padding);\n top: var(--box-padding);\n width: 20px;\n}\n\nvite-error-overlay::part(file):after {\n background-image: url(\"data:image/svg+xml,%3Csvg width='20px' height='20px' viewBox='0 0 24 24' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Ctitle%3EFile-Generic%3C/title%3E%3Cg id='Page-1' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E%3Cg id='File-Generic'%3E%3Crect id='Rectangle' fill-rule='nonzero' x='0' y='0' width='24' height='24'%3E%3C/rect%3E%3Cpath d='M4 5 C4 3.89543 4.89543 3 6 3 L15.1716 3 C15.702 3 16.2107 3.21071 16.5858 3.58579 L19.4142 6.41421 C19.7893 6.78929 20 7.29799 20 7.82843 L20 19 C20 20.1046 19.1046 21 18 21 L6 21 C4.89543 21 4 20.1046 4 19 L4 5 Z' id='Path' stroke='rgba(255,255,255,0.7)' stroke-width='1' stroke-linecap='round'%3E%3C/path%3E%3Cpath d='M15 4 L15 6 C15 7.10457 15.8954 8 17 8 L19 8' id='Path' stroke='rgba(255,255,255,0.7)' stroke-width='1' stroke-linecap='round'%3E%3C/path%3E%3C/g%3E%3C/g%3E%3C/svg%3E\");\n}\n\nvite-error-overlay::part(frame):after {\n background-image: url(\"data:image/svg+xml,%3Csvg width='20px' height='20px' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M15.6602 2.84952H19.1516C20.2555 2.84952 21.1504 3.74444 21.1504 4.84839V8.3398' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3Cpath d='M2.84949 8.33981L2.84949 4.8484C2.84949 3.74446 3.74441 2.84953 4.84836 2.84953L8.33977 2.84953' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3Cpath d='M21.1505 15.6602L21.1505 19.1516C21.1505 20.2555 20.2556 21.1505 19.1516 21.1505L15.6602 21.1505' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3Cpath d='M8.33984 21.1505L4.84843 21.1505C3.74449 21.1505 2.84956 20.2555 2.84956 19.1516L2.84956 15.6602' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3C/svg%3E\");\n}\n\nvite-error-overlay::part(stack):after {\n background-image: url(\"data:image/svg+xml,%3Csvg width='20px' height='20px' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.78 20H9.78C7.98 20 4.58 19.09 4.58 15.64C4.58 12.19 7.98 11.28 9.78 11.28H14.22C14.37 11.28 17.92 11.23 17.92 8.42C17.92 5.61 14.37 5.56 14.22 5.56H9.22C9.02109 5.56 8.83032 5.48098 8.68967 5.34033C8.54902 5.19968 8.47 5.00891 8.47 4.81C8.47 4.61109 8.54902 4.42032 8.68967 4.27967C8.83032 4.13902 9.02109 4.06 9.22 4.06H14.22C16.02 4.06 19.42 4.97 19.42 8.42C19.42 11.87 16.02 12.78 14.22 12.78H9.78C9.63 12.78 6.08 12.83 6.08 15.64C6.08 18.45 9.63 18.5 9.78 18.5H14.78C14.9789 18.5 15.1697 18.579 15.3103 18.7197C15.451 18.8603 15.53 19.0511 15.53 19.25C15.53 19.4489 15.451 19.6397 15.3103 19.7803C15.1697 19.921 14.9789 20 14.78 20Z' fill='rgba(255,255,255,0.7)'/%3E%3Cpath d='M6.44 8.31C5.74314 8.30407 5.06363 8.09202 4.48708 7.70056C3.91054 7.30909 3.46276 6.75573 3.20018 6.11021C2.93759 5.46469 2.87195 4.75589 3.01153 4.07312C3.1511 3.39036 3.48965 2.76418 3.9845 2.2735C4.47935 1.78281 5.10837 1.44958 5.79229 1.31579C6.47622 1.182 7.18444 1.25363 7.82771 1.52167C8.47099 1.78971 9.02054 2.24215 9.40711 2.82199C9.79368 3.40182 9.99998 4.08311 10 4.78C10 5.2461 9.90773 5.70759 9.72846 6.13783C9.54919 6.56808 9.28648 6.95856 8.95551 7.28675C8.62453 7.61494 8.23184 7.87433 7.80009 8.04995C7.36834 8.22558 6.90609 8.31396 6.44 8.31ZM6.44 2.75C6.04444 2.75 5.65776 2.86729 5.32886 3.08706C4.99996 3.30682 4.74362 3.61918 4.59224 3.98463C4.44087 4.35008 4.40126 4.75221 4.47843 5.14018C4.5556 5.52814 4.74609 5.8845 5.02579 6.16421C5.3055 6.44391 5.66186 6.6344 6.04982 6.71157C6.43779 6.78874 6.83992 6.74913 7.20537 6.59776C7.57082 6.44638 7.88318 6.19003 8.10294 5.86114C8.32271 5.53224 8.44 5.14556 8.44 4.75C8.44 4.48735 8.38827 4.22728 8.28776 3.98463C8.18725 3.74198 8.03993 3.5215 7.85422 3.33578C7.6685 3.15007 7.44802 3.00275 7.20537 2.90224C6.96272 2.80173 6.70265 2.75 6.44 2.75Z' fill='rgba(255,255,255,0.7)'/%3E%3Cpath d='M17.56 22.75C16.8614 22.752 16.1779 22.5466 15.5961 22.1599C15.0143 21.7733 14.5603 21.2227 14.2916 20.5778C14.0229 19.933 13.9515 19.2229 14.0866 18.5375C14.2217 17.8521 14.5571 17.2221 15.0504 16.7275C15.5437 16.2328 16.1726 15.8956 16.8577 15.7586C17.5427 15.6215 18.253 15.6909 18.8986 15.9577C19.5442 16.2246 20.0961 16.6771 20.4844 17.2578C20.8727 17.8385 21.08 18.5214 21.08 19.22C21.08 20.1545 20.7095 21.0508 20.0496 21.7125C19.3898 22.3743 18.4945 22.7473 17.56 22.75ZM17.56 17.19C17.1644 17.19 16.7778 17.3073 16.4489 17.5271C16.12 17.7468 15.8636 18.0592 15.7122 18.4246C15.5609 18.7901 15.5213 19.1922 15.5984 19.5802C15.6756 19.9681 15.8661 20.3245 16.1458 20.6042C16.4255 20.8839 16.7819 21.0744 17.1698 21.1516C17.5578 21.2287 17.9599 21.1891 18.3254 21.0377C18.6908 20.8864 19.0032 20.63 19.2229 20.3011C19.4427 19.9722 19.56 19.5856 19.56 19.19C19.56 18.6596 19.3493 18.1508 18.9742 17.7758C18.5991 17.4007 18.0904 17.19 17.56 17.19Z' fill='rgba(255,255,255,0.7)'/%3E%3C/svg%3E\");\n}\n\nvite-error-overlay::part(tip):before {\n content: \"Not sure how to solve this? Visit https://qwik.dev or connect with the community on Discord.\";\n display: block;\n margin-bottom: 1em;\n}\n";
|
|
3231
3231
|
var SYNC_QRL = "<sync>";
|
|
3232
3232
|
function getOrigin(req) {
|
|
3233
3233
|
const {PROTOCOL_HEADER: PROTOCOL_HEADER, HOST_HEADER: HOST_HEADER} = process.env;
|
|
@@ -3265,9 +3265,9 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3265
3265
|
if (!devSsrServer) {
|
|
3266
3266
|
return;
|
|
3267
3267
|
}
|
|
3268
|
-
const hasQwikRouter = null == (_a = server.config.plugins) ? void 0 : _a.some(
|
|
3268
|
+
const hasQwikRouter = null == (_a = server.config.plugins) ? void 0 : _a.some(plugin => "vite-plugin-qwik-router" === plugin.name);
|
|
3269
3269
|
const cssImportedByCSS = new Set;
|
|
3270
|
-
server.middlewares.use(
|
|
3270
|
+
server.middlewares.use(async (req, res, next) => {
|
|
3271
3271
|
try {
|
|
3272
3272
|
const {ORIGIN: ORIGIN} = process.env;
|
|
3273
3273
|
const domain = ORIGIN ?? getOrigin(req);
|
|
@@ -3312,26 +3312,26 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3312
3312
|
const added = new Set;
|
|
3313
3313
|
const CSS_EXTENSIONS = [ ".css", ".scss", ".sass", ".less", ".styl", ".stylus" ];
|
|
3314
3314
|
const JS_EXTENSIONS = /\.[mc]?[tj]sx?$/;
|
|
3315
|
-
Array.from(server.moduleGraph.fileToModulesMap.entries()).forEach(
|
|
3316
|
-
entry[1].forEach(
|
|
3315
|
+
Array.from(server.moduleGraph.fileToModulesMap.entries()).forEach(entry => {
|
|
3316
|
+
entry[1].forEach(v => {
|
|
3317
3317
|
var _a2, _b;
|
|
3318
3318
|
const segment = null == (_b = null == (_a2 = v.info) ? void 0 : _a2.meta) ? void 0 : _b.segment;
|
|
3319
3319
|
let url2 = v.url;
|
|
3320
3320
|
v.lastHMRTimestamp && (url2 += `?t=${v.lastHMRTimestamp}`);
|
|
3321
3321
|
segment && (manifest.mapping[segment.name] = relativeURL(url2, opts.rootDir));
|
|
3322
3322
|
const {pathId: pathId, query: query} = parseId(v.url);
|
|
3323
|
-
if ("" === query && CSS_EXTENSIONS.some(
|
|
3323
|
+
if ("" === query && CSS_EXTENSIONS.some(ext => pathId.endsWith(ext))) {
|
|
3324
3324
|
const isEntryCSS = 0 === v.importers.size;
|
|
3325
|
-
const hasCSSImporter = Array.from(v.importers).some(
|
|
3325
|
+
const hasCSSImporter = Array.from(v.importers).some(importer => {
|
|
3326
3326
|
const importerPath = importer.url || importer.file;
|
|
3327
|
-
const isCSS = importerPath && CSS_EXTENSIONS.some(
|
|
3327
|
+
const isCSS = importerPath && CSS_EXTENSIONS.some(ext => importerPath.endsWith(ext));
|
|
3328
3328
|
isCSS && v.url && cssImportedByCSS.add(v.url);
|
|
3329
3329
|
return isCSS;
|
|
3330
|
-
})
|
|
3331
|
-
const hasJSImporter = Array.from(v.importers).some(
|
|
3330
|
+
});
|
|
3331
|
+
const hasJSImporter = Array.from(v.importers).some(importer => {
|
|
3332
3332
|
const importerPath = importer.url || importer.file;
|
|
3333
3333
|
return importerPath && JS_EXTENSIONS.test(importerPath);
|
|
3334
|
-
})
|
|
3334
|
+
});
|
|
3335
3335
|
if ((isEntryCSS || hasJSImporter) && !hasCSSImporter && !cssImportedByCSS.has(v.url) && !added.has(v.url)) {
|
|
3336
3336
|
added.add(v.url);
|
|
3337
3337
|
manifest.injections.push({
|
|
@@ -3344,8 +3344,8 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3344
3344
|
});
|
|
3345
3345
|
}
|
|
3346
3346
|
}
|
|
3347
|
-
})
|
|
3348
|
-
})
|
|
3347
|
+
});
|
|
3348
|
+
});
|
|
3349
3349
|
const renderOpts = {
|
|
3350
3350
|
debug: true,
|
|
3351
3351
|
locale: serverData.locale,
|
|
@@ -3365,28 +3365,28 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3365
3365
|
res.writeHead(status);
|
|
3366
3366
|
const result = await render(renderOpts);
|
|
3367
3367
|
"html" in result && res.write(result.html);
|
|
3368
|
-
Array.from(server.moduleGraph.fileToModulesMap.entries()).forEach(
|
|
3369
|
-
entry[1].forEach(
|
|
3368
|
+
Array.from(server.moduleGraph.fileToModulesMap.entries()).forEach(entry => {
|
|
3369
|
+
entry[1].forEach(v => {
|
|
3370
3370
|
const {pathId: pathId, query: query} = parseId(v.url);
|
|
3371
|
-
if (!added.has(v.url) && "" === query && CSS_EXTENSIONS.some(
|
|
3371
|
+
if (!added.has(v.url) && "" === query && CSS_EXTENSIONS.some(ext => pathId.endsWith(ext))) {
|
|
3372
3372
|
const isEntryCSS = 0 === v.importers.size;
|
|
3373
|
-
const hasCSSImporter = Array.from(v.importers).some(
|
|
3373
|
+
const hasCSSImporter = Array.from(v.importers).some(importer => {
|
|
3374
3374
|
const importerPath = importer.url || importer.file;
|
|
3375
|
-
const isCSS = importerPath && CSS_EXTENSIONS.some(
|
|
3375
|
+
const isCSS = importerPath && CSS_EXTENSIONS.some(ext => importerPath.endsWith(ext));
|
|
3376
3376
|
isCSS && v.url && cssImportedByCSS.add(v.url);
|
|
3377
3377
|
return isCSS;
|
|
3378
|
-
})
|
|
3379
|
-
const hasJSImporter = Array.from(v.importers).some(
|
|
3378
|
+
});
|
|
3379
|
+
const hasJSImporter = Array.from(v.importers).some(importer => {
|
|
3380
3380
|
const importerPath = importer.url || importer.file;
|
|
3381
3381
|
return importerPath && JS_EXTENSIONS.test(importerPath);
|
|
3382
|
-
})
|
|
3382
|
+
});
|
|
3383
3383
|
if ((isEntryCSS || hasJSImporter) && !hasCSSImporter && !cssImportedByCSS.has(v.url)) {
|
|
3384
3384
|
res.write(`<link rel="stylesheet" href="${base}${v.url.slice(1)}">`);
|
|
3385
3385
|
added.add(v.url);
|
|
3386
3386
|
}
|
|
3387
3387
|
}
|
|
3388
|
-
})
|
|
3389
|
-
})
|
|
3388
|
+
});
|
|
3389
|
+
});
|
|
3390
3390
|
res.write(END_SSR_SCRIPT(opts, opts.srcDir ? opts.srcDir : path.join(opts.rootDir, "src")));
|
|
3391
3391
|
res.end();
|
|
3392
3392
|
} else {
|
|
@@ -3404,20 +3404,20 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3404
3404
|
} finally {
|
|
3405
3405
|
"function" === typeof res._qwikRenderResolve && res._qwikRenderResolve();
|
|
3406
3406
|
}
|
|
3407
|
-
})
|
|
3408
|
-
server.middlewares.use(
|
|
3407
|
+
});
|
|
3408
|
+
server.middlewares.use(function(err, _req, res, next) {
|
|
3409
3409
|
res.writableEnded || res.write(`<style>${VITE_ERROR_OVERLAY_STYLES}</style>`);
|
|
3410
3410
|
return next(err);
|
|
3411
|
-
})
|
|
3412
|
-
setTimeout((
|
|
3411
|
+
});
|
|
3412
|
+
setTimeout(() => {
|
|
3413
3413
|
console.log(`\n 🚧 ${magenta("Please note that development mode is slower than production.")}`);
|
|
3414
|
-
}
|
|
3414
|
+
}, 1e3);
|
|
3415
3415
|
}
|
|
3416
3416
|
async function configurePreviewServer(middlewares, ssrOutDir, sys, path) {
|
|
3417
3417
|
const fs = await sys.dynamicImport("node:fs");
|
|
3418
3418
|
const url = await sys.dynamicImport("node:url");
|
|
3419
|
-
const entryPreviewPaths = [ "mjs", "cjs", "js" ].map(
|
|
3420
|
-
const entryPreviewModulePath = entryPreviewPaths.find(
|
|
3419
|
+
const entryPreviewPaths = [ "mjs", "cjs", "js" ].map(ext => path.join(ssrOutDir, `entry.preview.${ext}`));
|
|
3420
|
+
const entryPreviewModulePath = entryPreviewPaths.find(p => fs.existsSync(p));
|
|
3421
3421
|
if (!entryPreviewModulePath) {
|
|
3422
3422
|
return invalidPreviewMessage(middlewares, `Unable to find output "${ssrOutDir}/entry.preview" module.\n\nPlease ensure "src/entry.preview.tsx" has been built before the "preview" command.`);
|
|
3423
3423
|
}
|
|
@@ -3445,12 +3445,12 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3445
3445
|
}
|
|
3446
3446
|
function invalidPreviewMessage(middlewares, msg) {
|
|
3447
3447
|
console.log(`\n❌ ${msg}\n`);
|
|
3448
|
-
middlewares.use((
|
|
3448
|
+
middlewares.use((_, res) => {
|
|
3449
3449
|
res.writeHead(400, {
|
|
3450
3450
|
"Content-Type": "text/plain"
|
|
3451
3451
|
});
|
|
3452
3452
|
res.end(msg);
|
|
3453
|
-
})
|
|
3453
|
+
});
|
|
3454
3454
|
}
|
|
3455
3455
|
var CYPRESS_DEV_SERVER_PATH = "/__cypress/src";
|
|
3456
3456
|
var FS_PREFIX = "/@fs/";
|
|
@@ -3482,7 +3482,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3482
3482
|
return false;
|
|
3483
3483
|
}
|
|
3484
3484
|
const acceptHeader = req.headers.accept || "";
|
|
3485
|
-
const accepts = acceptHeader.split(",").map(
|
|
3485
|
+
const accepts = acceptHeader.split(",").map(accept => accept.split(";")[0]);
|
|
3486
3486
|
if (1 == accepts.length && accepts.includes("*/*")) {
|
|
3487
3487
|
return true;
|
|
3488
3488
|
}
|
|
@@ -3597,7 +3597,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3597
3597
|
} else {
|
|
3598
3598
|
"object" === typeof (null == (_l = viteConfig.build) ? void 0 : _l.lib) && (pluginOpts.input = null == (_m = viteConfig.build) ? void 0 : _m.lib.entry);
|
|
3599
3599
|
}
|
|
3600
|
-
if ("node" === sys.env) {
|
|
3600
|
+
if ("node" === sys.env || "bun" === sys.env) {
|
|
3601
3601
|
const fs = await sys.dynamicImport("node:fs");
|
|
3602
3602
|
try {
|
|
3603
3603
|
const rootDir2 = pluginOpts.rootDir ?? sys.cwd();
|
|
@@ -3633,7 +3633,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3633
3633
|
clientDevInput = qwikPlugin.normalizePath(clientDevInput);
|
|
3634
3634
|
}
|
|
3635
3635
|
const vendorRoots = shouldFindVendors ? await findQwikRoots(sys, sys.cwd()) : [];
|
|
3636
|
-
const vendorIds = vendorRoots.map(
|
|
3636
|
+
const vendorIds = vendorRoots.map(v => v.id);
|
|
3637
3637
|
const isDevelopment = "development" === buildMode;
|
|
3638
3638
|
const qDevKey = "globalThis.qDev";
|
|
3639
3639
|
const qTestKey = "globalThis.qTest";
|
|
@@ -3743,12 +3743,12 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3743
3743
|
async buildStart() {
|
|
3744
3744
|
const resolver = this.resolve.bind(this);
|
|
3745
3745
|
await qwikPlugin.validateSource(resolver);
|
|
3746
|
-
qwikPlugin.onDiagnostics((
|
|
3747
|
-
diagnostics.forEach(
|
|
3746
|
+
qwikPlugin.onDiagnostics((diagnostics, optimizer, srcDir2) => {
|
|
3747
|
+
diagnostics.forEach(d => {
|
|
3748
3748
|
const id = qwikPlugin.normalizePath(optimizer.sys.path.join(srcDir2, d.file));
|
|
3749
3749
|
"error" === d.category ? this.error(createRollupError2(id, d)) : this.warn(createRollupError2(id, d));
|
|
3750
|
-
})
|
|
3751
|
-
})
|
|
3750
|
+
});
|
|
3751
|
+
});
|
|
3752
3752
|
await qwikPlugin.buildStart(this);
|
|
3753
3753
|
},
|
|
3754
3754
|
resolveId(id, importer, resolveIdOpts) {
|
|
@@ -3798,7 +3798,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3798
3798
|
for (const [fileName, b] of Object.entries(rollupBundle)) {
|
|
3799
3799
|
if ("asset" === b.type) {
|
|
3800
3800
|
const baseFilename = basePathname + fileName;
|
|
3801
|
-
if (STYLING.some(
|
|
3801
|
+
if (STYLING.some(ext => fileName.endsWith(ext))) {
|
|
3802
3802
|
"string" === typeof b.source && b.source.length < opts.inlineStylesUpToBytes ? injections.push({
|
|
3803
3803
|
tag: "style",
|
|
3804
3804
|
location: "head",
|
|
@@ -3815,7 +3815,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3815
3815
|
}
|
|
3816
3816
|
});
|
|
3817
3817
|
} else {
|
|
3818
|
-
const selectedFont = FONTS.find(
|
|
3818
|
+
const selectedFont = FONTS.find(ext => fileName.endsWith(ext));
|
|
3819
3819
|
selectedFont && !disableFontPreload && injections.unshift({
|
|
3820
3820
|
tag: "link",
|
|
3821
3821
|
location: "head",
|
|
@@ -3837,7 +3837,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3837
3837
|
}
|
|
3838
3838
|
});
|
|
3839
3839
|
const sys = qwikPlugin.getSys();
|
|
3840
|
-
if (tmpClientManifestPath && "node" === sys.env) {
|
|
3840
|
+
if (tmpClientManifestPath && ("node" === sys.env || "bun" === sys.env)) {
|
|
3841
3841
|
const fs = await sys.dynamicImport("node:fs");
|
|
3842
3842
|
await fs.promises.writeFile(tmpClientManifestPath, clientManifestStr);
|
|
3843
3843
|
}
|
|
@@ -3848,7 +3848,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3848
3848
|
const opts = qwikPlugin.getOptions();
|
|
3849
3849
|
if ("ssr" === opts.target) {
|
|
3850
3850
|
const sys = qwikPlugin.getSys();
|
|
3851
|
-
if ("node" === sys.env) {
|
|
3851
|
+
if ("node" === sys.env || "bun" === sys.env) {
|
|
3852
3852
|
const outputs = Object.keys(rollupBundle);
|
|
3853
3853
|
const patchModuleFormat = async bundeName => {
|
|
3854
3854
|
try {
|
|
@@ -3859,7 +3859,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3859
3859
|
const extlessName = sys.path.basename(bundleFileName, ext);
|
|
3860
3860
|
const js = `${extlessName}.js`;
|
|
3861
3861
|
const moduleName = extlessName + ext;
|
|
3862
|
-
const hasJsScript = outputs.some(
|
|
3862
|
+
const hasJsScript = outputs.some(f => sys.path.basename(f) === js);
|
|
3863
3863
|
if (!hasJsScript) {
|
|
3864
3864
|
const bundleOutDir = sys.path.dirname(bundeName);
|
|
3865
3865
|
const fs = await sys.dynamicImport("node:fs");
|
|
@@ -3890,7 +3890,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3890
3890
|
const path = qwikPlugin.getPath();
|
|
3891
3891
|
await configureDevServer(basePathname, server, opts, sys, path, isClientDevOnly, clientDevInput, devSsrServer);
|
|
3892
3892
|
};
|
|
3893
|
-
const isNEW = true === globalThis.__qwikRouterNew || true === globalThis.__qwikCityNew;
|
|
3893
|
+
const isNEW = true === globalThis.__qwikRouterNew || true === globalThis.__qwikCityNew || server.config.build.lib;
|
|
3894
3894
|
return isNEW ? plugin : plugin();
|
|
3895
3895
|
}
|
|
3896
3896
|
},
|
|
@@ -3909,7 +3909,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3909
3909
|
var _a, _b, _c;
|
|
3910
3910
|
if ("vite-plugin-qwik" == log.plugin) {
|
|
3911
3911
|
const color = LOG_COLOR[level] || ANSI_COLOR.White;
|
|
3912
|
-
const frames = (log.frame || "").split("\n").map(
|
|
3912
|
+
const frames = (log.frame || "").split("\n").map(line => (line.match(/^\s*\^\s*$/) ? ANSI_COLOR.BrightWhite : ANSI_COLOR.BrightBlack) + line);
|
|
3913
3913
|
console[level](`${color}%s\n${ANSI_COLOR.BrightWhite}%s\n%s${ANSI_COLOR.RESET}`, `[${log.plugin}](${level}): ${log.message}\n`, ` ${null == (_a = null == log ? void 0 : log.loc) ? void 0 : _a.file}:${null == (_b = null == log ? void 0 : log.loc) ? void 0 : _b.line}:${null == (_c = null == log ? void 0 : log.loc) ? void 0 : _c.column}\n`, ` ${frames.join("\n ")}\n`);
|
|
3914
3914
|
return false;
|
|
3915
3915
|
}
|
|
@@ -3968,7 +3968,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3968
3968
|
}
|
|
3969
3969
|
var findQwikRoots = async (sys, packageJsonDir) => {
|
|
3970
3970
|
const paths = new Map;
|
|
3971
|
-
if ("node" === sys.env) {
|
|
3971
|
+
if ("node" === sys.env || "bun" === sys.env) {
|
|
3972
3972
|
const fs = await sys.dynamicImport("node:fs");
|
|
3973
3973
|
let prevPackageJsonDir;
|
|
3974
3974
|
do {
|
|
@@ -3984,7 +3984,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3984
3984
|
"object" === typeof dependencies && packages.push(...Object.keys(dependencies));
|
|
3985
3985
|
"object" === typeof devDependencies && packages.push(...Object.keys(devDependencies));
|
|
3986
3986
|
const basedir = sys.cwd();
|
|
3987
|
-
await Promise.all(packages.map(
|
|
3987
|
+
await Promise.all(packages.map(async id => {
|
|
3988
3988
|
const pkgJsonPath = await findDepPkgJsonPath(sys, id, basedir);
|
|
3989
3989
|
if (pkgJsonPath) {
|
|
3990
3990
|
const pkgJsonContent = await fs.promises.readFile(pkgJsonPath, "utf-8");
|
|
@@ -3998,7 +3998,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3998
3998
|
paths.set(await fs.promises.realpath(sys.path.resolve(sys.path.dirname(pkgJsonPath), p)), id);
|
|
3999
3999
|
}
|
|
4000
4000
|
}
|
|
4001
|
-
}))
|
|
4001
|
+
}));
|
|
4002
4002
|
} catch (e) {
|
|
4003
4003
|
console.error(e);
|
|
4004
4004
|
}
|
|
@@ -4007,10 +4007,10 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
4007
4007
|
packageJsonDir = sys.path.dirname(packageJsonDir);
|
|
4008
4008
|
} while (packageJsonDir !== prevPackageJsonDir);
|
|
4009
4009
|
}
|
|
4010
|
-
return Array.from(paths).map((
|
|
4010
|
+
return Array.from(paths).map(([path, id]) => ({
|
|
4011
4011
|
path: path,
|
|
4012
4012
|
id: id
|
|
4013
|
-
}))
|
|
4013
|
+
}));
|
|
4014
4014
|
};
|
|
4015
4015
|
var VITE_CLIENT_MODULE = "@qwik.dev/core/vite-client";
|
|
4016
4016
|
var CLIENT_DEV_INPUT = "entry.dev";
|