@qwik.dev/core 2.0.0-beta.26 → 2.0.0-beta.28
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 +29 -5
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +624 -582
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +6105 -6063
- package/dist/insights/index.qwik.mjs +80 -57
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.d.ts +26 -19
- package/dist/optimizer.mjs +1278 -1234
- package/dist/server.mjs +29 -21
- package/dist/server.prod.mjs +3263 -0
- package/dist/starters/features/csr/index.html +4 -0
- package/dist/testing/index.d.ts +10 -1
- package/dist/testing/index.mjs +560 -563
- package/dist/testing/package.json +1 -1
- package/package.json +9 -5
|
@@ -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.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare interface Diagnostic {
|
|
|
34
34
|
export declare type DiagnosticCategory = 'error' | 'warning' | 'sourceError';
|
|
35
35
|
|
|
36
36
|
/** @public */
|
|
37
|
-
declare type EmitMode = 'dev' | 'prod' | 'lib';
|
|
37
|
+
declare type EmitMode = 'dev' | 'prod' | 'lib' | 'hmr';
|
|
38
38
|
|
|
39
39
|
/** @public */
|
|
40
40
|
export declare type EntryStrategy = InlineEntryStrategy | HoistEntryStrategy | SingleEntryStrategy | HookEntryStrategy_2 | SegmentEntryStrategy | ComponentEntryStrategy | SmartEntryStrategy;
|
|
@@ -263,9 +263,33 @@ export declare interface QwikManifest {
|
|
|
263
263
|
};
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
+
/** @public */
|
|
266
267
|
declare interface QwikPluginDevTools {
|
|
268
|
+
/**
|
|
269
|
+
* Validates image sizes for CLS issues during development. In case of issues, provides you with a
|
|
270
|
+
* correct image size resolutions. If set to `false`, image dev tool will be disabled.
|
|
271
|
+
*
|
|
272
|
+
* Default `true`
|
|
273
|
+
*/
|
|
267
274
|
imageDevTools?: boolean | true;
|
|
275
|
+
/**
|
|
276
|
+
* Press-hold the defined keys to enable qwik dev inspector. By default the behavior is activated
|
|
277
|
+
* by pressing the left or right `Alt` key. If set to `false`, qwik dev inspector will be
|
|
278
|
+
* disabled.
|
|
279
|
+
*
|
|
280
|
+
* Valid values are `KeyboardEvent.code` values. Please note that the 'Left' and 'Right' suffixes
|
|
281
|
+
* are ignored.
|
|
282
|
+
*/
|
|
268
283
|
clickToSource?: string[] | false;
|
|
284
|
+
/**
|
|
285
|
+
* Enable HMR for Qwik components. When enabled, editing a component file re-renders only that
|
|
286
|
+
* component without a full page reload, preserving client state.
|
|
287
|
+
*
|
|
288
|
+
* Set this to `false` for full page reloads on component edits.
|
|
289
|
+
*
|
|
290
|
+
* Default `true`
|
|
291
|
+
*/
|
|
292
|
+
hmr?: boolean;
|
|
269
293
|
}
|
|
270
294
|
|
|
271
295
|
declare interface QwikPluginOptions {
|
|
@@ -499,24 +523,7 @@ declare interface QwikVitePluginCommonOptions {
|
|
|
499
523
|
* before bundling.
|
|
500
524
|
*/
|
|
501
525
|
transformedModuleOutput?: ((transformedModules: TransformModule[]) => Promise<void> | void) | null;
|
|
502
|
-
devTools?:
|
|
503
|
-
/**
|
|
504
|
-
* Validates image sizes for CLS issues during development. In case of issues, provides you with
|
|
505
|
-
* a correct image size resolutions. If set to `false`, image dev tool will be disabled.
|
|
506
|
-
*
|
|
507
|
-
* Default `true`
|
|
508
|
-
*/
|
|
509
|
-
imageDevTools?: boolean | true;
|
|
510
|
-
/**
|
|
511
|
-
* Press-hold the defined keys to enable qwik dev inspector. By default the behavior is
|
|
512
|
-
* activated by pressing the left or right `Alt` key. If set to `false`, qwik dev inspector will
|
|
513
|
-
* be disabled.
|
|
514
|
-
*
|
|
515
|
-
* Valid values are `KeyboardEvent.code` values. Please note that the 'Left' and 'Right'
|
|
516
|
-
* suffixes are ignored.
|
|
517
|
-
*/
|
|
518
|
-
clickToSource?: string[] | false;
|
|
519
|
-
};
|
|
526
|
+
devTools?: QwikPluginDevTools;
|
|
520
527
|
/**
|
|
521
528
|
* Predicate function to filter out files from the optimizer. hook for resolveId, load, and
|
|
522
529
|
* transform
|