@qwik.dev/core 2.0.0-alpha.0 → 2.0.0-alpha.2
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 +1384 -761
- package/dist/core-internal.d.ts +15 -2
- package/dist/core.cjs +75 -61
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +75 -61
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +56 -46
- package/dist/core.prod.mjs +58 -49
- package/dist/insights/index.qwik.cjs +1 -1
- package/dist/insights/index.qwik.mjs +1 -1
- package/dist/loader/index.cjs +2 -2
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +57 -60
- package/dist/optimizer.mjs +59 -63
- package/dist/prefetch/package.json +1 -1
- package/dist/qwikloader.debug.js +1 -0
- package/dist/qwikloader.js +2 -2
- package/dist/server.cjs +81 -53
- package/dist/server.mjs +81 -53
- package/dist/starters/features/auth/package.json +3 -1
- package/dist/starters/features/drizzle/package.json +2 -1
- package/dist/starters/features/postcss/package.json +3 -0
- package/dist/starters/features/prisma/package.json +2 -1
- package/dist/starters/features/tailwind/package.json +3 -0
- package/dist/starters/features/turso/package.json +4 -1
- package/dist/testing/index.cjs +77 -49
- package/dist/testing/index.mjs +77 -49
- package/dist/testing/package.json +1 -1
- package/package.json +13 -11
- package/public.d.ts +2 -0
package/dist/server.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/server 2.0.0-alpha.
|
|
3
|
+
* @qwik.dev/core/server 2.0.0-alpha.2-dev+58b6f8d
|
|
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
|
|
@@ -691,6 +691,12 @@ var SsrNode = class {
|
|
|
691
691
|
return `SSRNode [<${this.id}> ${stringifiedAttrs}]`;
|
|
692
692
|
}
|
|
693
693
|
};
|
|
694
|
+
var DomRef = class {
|
|
695
|
+
/** @id is the same id as for SsrNode */
|
|
696
|
+
constructor(id) {
|
|
697
|
+
this.id = id;
|
|
698
|
+
}
|
|
699
|
+
};
|
|
694
700
|
var SsrComponentFrame = class {
|
|
695
701
|
constructor(componentNode) {
|
|
696
702
|
this.componentNode = componentNode;
|
|
@@ -990,7 +996,7 @@ function getBuildBase(opts) {
|
|
|
990
996
|
return `${import_meta.env.BASE_URL}build/`;
|
|
991
997
|
}
|
|
992
998
|
var versions = {
|
|
993
|
-
qwik: "2.0.0-alpha.
|
|
999
|
+
qwik: "2.0.0-alpha.2-dev+58b6f8d",
|
|
994
1000
|
qwikDom: "2.1.19"
|
|
995
1001
|
};
|
|
996
1002
|
|
|
@@ -1185,6 +1191,20 @@ var StoreHandler = class {
|
|
|
1185
1191
|
if (prop === STORE_TARGET) {
|
|
1186
1192
|
return true;
|
|
1187
1193
|
}
|
|
1194
|
+
if (typeof prop === "string") {
|
|
1195
|
+
const ctx = tryGetInvokeContext();
|
|
1196
|
+
if (ctx) {
|
|
1197
|
+
const effectSubscriber = ctx.$effectSubscriber$;
|
|
1198
|
+
if (effectSubscriber) {
|
|
1199
|
+
addEffect(
|
|
1200
|
+
target,
|
|
1201
|
+
Array.isArray(target) ? STORE_ARRAY_PROP : prop,
|
|
1202
|
+
this,
|
|
1203
|
+
effectSubscriber
|
|
1204
|
+
);
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1188
1208
|
return Object.prototype.hasOwnProperty.call(target, prop);
|
|
1189
1209
|
}
|
|
1190
1210
|
ownKeys(target) {
|
|
@@ -1607,6 +1627,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
|
|
|
1607
1627
|
iCtx.$container$ = container;
|
|
1608
1628
|
let componentFn;
|
|
1609
1629
|
container.ensureProjectionResolved(renderHost);
|
|
1630
|
+
let isInlineComponent = false;
|
|
1610
1631
|
if (componentQRL === null) {
|
|
1611
1632
|
componentQRL = componentQRL || container.getHostProp(renderHost, OnRenderProp);
|
|
1612
1633
|
assertDefined(componentQRL, "No Component found at this location");
|
|
@@ -1621,14 +1642,19 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
|
|
|
1621
1642
|
const qComponentFn = componentQRL;
|
|
1622
1643
|
componentFn = () => invokeApply(iCtx, qComponentFn, [props || EMPTY_OBJ, null, 0]);
|
|
1623
1644
|
} else {
|
|
1645
|
+
isInlineComponent = true;
|
|
1624
1646
|
const inlineComponent = componentQRL;
|
|
1625
1647
|
componentFn = () => invokeApply(iCtx, inlineComponent, [props || EMPTY_OBJ]);
|
|
1626
1648
|
}
|
|
1627
1649
|
const executeComponentWithPromiseExceptionRetry = (retryCount = 0) => safeCall(
|
|
1628
1650
|
() => {
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1651
|
+
if (!isInlineComponent) {
|
|
1652
|
+
container.setHostProp(renderHost, ELEMENT_SEQ_IDX, null);
|
|
1653
|
+
container.setHostProp(renderHost, USE_ON_LOCAL_SEQ_IDX, null);
|
|
1654
|
+
if (container.getHostProp(renderHost, ELEMENT_PROPS) !== props) {
|
|
1655
|
+
container.setHostProp(renderHost, ELEMENT_PROPS, props);
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1632
1658
|
if (vnode_isVNode(renderHost)) {
|
|
1633
1659
|
clearVNodeEffectDependencies(renderHost);
|
|
1634
1660
|
}
|
|
@@ -2867,7 +2893,10 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2867
2893
|
return hostDiff;
|
|
2868
2894
|
}
|
|
2869
2895
|
} else {
|
|
2870
|
-
const errorMessage =
|
|
2896
|
+
const errorMessage = `SERVER: during HTML streaming, re-running tasks on a different host is not allowed.
|
|
2897
|
+
You are attempting to change a state that has already been streamed to the client.
|
|
2898
|
+
This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
|
|
2899
|
+
Problematic Node: ${aHost.toString()}`;
|
|
2871
2900
|
if (shouldThrowOnHostMismatch) {
|
|
2872
2901
|
throwErrorAndStop(errorMessage);
|
|
2873
2902
|
}
|
|
@@ -3038,9 +3067,11 @@ var isTask = (value) => {
|
|
|
3038
3067
|
return value instanceof Task;
|
|
3039
3068
|
};
|
|
3040
3069
|
|
|
3070
|
+
// packages/qwik/src/core/signal/flags.ts
|
|
3071
|
+
var NEEDS_COMPUTATION = Symbol("invalid");
|
|
3072
|
+
|
|
3041
3073
|
// packages/qwik/src/core/signal/signal.ts
|
|
3042
3074
|
var DEBUG3 = false;
|
|
3043
|
-
var NEEDS_COMPUTATION = Symbol("invalid");
|
|
3044
3075
|
var log2 = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
|
|
3045
3076
|
var throwIfQRLNotResolved = (qrl) => {
|
|
3046
3077
|
const resolved = qrl.resolved;
|
|
@@ -3376,7 +3407,7 @@ var WrappedSignal = class extends Signal {
|
|
|
3376
3407
|
};
|
|
3377
3408
|
|
|
3378
3409
|
// packages/qwik/src/core/version.ts
|
|
3379
|
-
var version = "2.0.0-alpha.
|
|
3410
|
+
var version = "2.0.0-alpha.2-dev+58b6f8d";
|
|
3380
3411
|
|
|
3381
3412
|
// packages/qwik/src/core/shared/shared-container.ts
|
|
3382
3413
|
var _SharedContainer = class {
|
|
@@ -3403,9 +3434,10 @@ var _SharedContainer = class {
|
|
|
3403
3434
|
trackSignalValue(signal, subscriber, property, data) {
|
|
3404
3435
|
return trackSignal(() => signal.value, subscriber, property, this, data);
|
|
3405
3436
|
}
|
|
3406
|
-
serializationCtxFactory(NodeConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
3437
|
+
serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
3407
3438
|
return createSerializationContext(
|
|
3408
3439
|
NodeConstructor,
|
|
3440
|
+
DomRefConstructor,
|
|
3409
3441
|
symbolToChunkResolver,
|
|
3410
3442
|
this.getHostProp.bind(this),
|
|
3411
3443
|
this.setHostProp.bind(this),
|
|
@@ -6295,12 +6327,7 @@ function inflateQRL(container, qrl) {
|
|
|
6295
6327
|
}
|
|
6296
6328
|
return qrl;
|
|
6297
6329
|
}
|
|
6298
|
-
var
|
|
6299
|
-
constructor(id) {
|
|
6300
|
-
this.id = id;
|
|
6301
|
-
}
|
|
6302
|
-
};
|
|
6303
|
-
var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
|
|
6330
|
+
var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
|
|
6304
6331
|
if (!writer) {
|
|
6305
6332
|
const buffer = [];
|
|
6306
6333
|
writer = {
|
|
@@ -6324,11 +6351,13 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
|
|
|
6324
6351
|
return id;
|
|
6325
6352
|
};
|
|
6326
6353
|
const isSsrNode = NodeConstructor ? (obj) => obj instanceof NodeConstructor : () => false;
|
|
6354
|
+
const isDomRef = DomRefConstructor ? (obj) => obj instanceof DomRefConstructor : () => false;
|
|
6327
6355
|
return {
|
|
6328
6356
|
$serialize$() {
|
|
6329
6357
|
serialize(this);
|
|
6330
6358
|
},
|
|
6331
6359
|
$isSsrNode$: isSsrNode,
|
|
6360
|
+
$isDomRef$: isDomRef,
|
|
6332
6361
|
$symbolToChunkResolver$: symbolToChunkResolver,
|
|
6333
6362
|
$wasSeen$,
|
|
6334
6363
|
$roots$: roots,
|
|
@@ -6437,6 +6466,8 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
|
|
|
6437
6466
|
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
|
|
6438
6467
|
} else if (isSsrNode(obj)) {
|
|
6439
6468
|
discoveredValues.push(obj.vnodeData);
|
|
6469
|
+
} else if (isDomRef(obj)) {
|
|
6470
|
+
discoveredValues.push(obj.id);
|
|
6440
6471
|
} else if (isJSXNode2(obj)) {
|
|
6441
6472
|
discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
|
|
6442
6473
|
} else if (Array.isArray(obj)) {
|
|
@@ -6491,7 +6522,7 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
|
|
|
6491
6522
|
};
|
|
6492
6523
|
var promiseResults = /* @__PURE__ */ new WeakMap();
|
|
6493
6524
|
function serialize(serializationContext) {
|
|
6494
|
-
const { $writer$, $isSsrNode$, $setProp$, $storeProxyMap$ } = serializationContext;
|
|
6525
|
+
const { $writer$, $isSsrNode$, $isDomRef$, $setProp$, $storeProxyMap$ } = serializationContext;
|
|
6495
6526
|
let depth = -1;
|
|
6496
6527
|
let writeType = false;
|
|
6497
6528
|
const output = (type, value) => {
|
|
@@ -6660,14 +6691,10 @@ function serialize(serializationContext) {
|
|
|
6660
6691
|
}
|
|
6661
6692
|
output(13 /* Object */, out);
|
|
6662
6693
|
}
|
|
6663
|
-
} else if (value
|
|
6694
|
+
} else if ($isDomRef$(value)) {
|
|
6664
6695
|
output(9 /* RefVNode */, value.id);
|
|
6665
6696
|
} else if (value instanceof Signal) {
|
|
6666
|
-
|
|
6667
|
-
if ($isSsrNode$(v)) {
|
|
6668
|
-
serializationContext.$addRoot$(v);
|
|
6669
|
-
v = new DomVRef(v.id);
|
|
6670
|
-
}
|
|
6697
|
+
const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
|
|
6671
6698
|
if (value instanceof WrappedSignal) {
|
|
6672
6699
|
output(23 /* WrappedSignal */, [
|
|
6673
6700
|
...serializeWrappingFn(serializationContext, value),
|
|
@@ -7054,8 +7081,8 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
7054
7081
|
}
|
|
7055
7082
|
let _containerEl;
|
|
7056
7083
|
const qrl = async function(...args) {
|
|
7057
|
-
const
|
|
7058
|
-
const result = await
|
|
7084
|
+
const boundedFn = bindFnToContext.call(this, tryGetInvokeContext());
|
|
7085
|
+
const result = await boundedFn(...args);
|
|
7059
7086
|
return result;
|
|
7060
7087
|
};
|
|
7061
7088
|
const setContainer = (el) => {
|
|
@@ -7064,6 +7091,30 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
7064
7091
|
}
|
|
7065
7092
|
return _containerEl;
|
|
7066
7093
|
};
|
|
7094
|
+
function bindFnToContext(currentCtx, beforeFn) {
|
|
7095
|
+
return (...args) => maybeThen(resolveLazy(), (fn) => {
|
|
7096
|
+
if (!isFunction(fn)) {
|
|
7097
|
+
throw qError(QError_qrlIsNotFunction);
|
|
7098
|
+
}
|
|
7099
|
+
if (beforeFn && beforeFn() === false) {
|
|
7100
|
+
return;
|
|
7101
|
+
}
|
|
7102
|
+
const context = createOrReuseInvocationContext(currentCtx);
|
|
7103
|
+
const prevQrl = context.$qrl$;
|
|
7104
|
+
const prevEvent = context.$event$;
|
|
7105
|
+
context.$qrl$ = qrl;
|
|
7106
|
+
context.$event$ ||= this;
|
|
7107
|
+
try {
|
|
7108
|
+
return invoke.call(this, context, fn, ...args);
|
|
7109
|
+
} finally {
|
|
7110
|
+
context.$qrl$ = prevQrl;
|
|
7111
|
+
context.$event$ = prevEvent;
|
|
7112
|
+
}
|
|
7113
|
+
});
|
|
7114
|
+
}
|
|
7115
|
+
const resolveLazy = (containerEl) => {
|
|
7116
|
+
return symbolRef !== null ? symbolRef : resolve(containerEl);
|
|
7117
|
+
};
|
|
7067
7118
|
const wrapFn = (fn) => {
|
|
7068
7119
|
if (typeof fn !== "function" || !(capture == null ? void 0 : capture.length) && !(captureRef == null ? void 0 : captureRef.length)) {
|
|
7069
7120
|
return fn;
|
|
@@ -7113,30 +7164,6 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
7113
7164
|
}
|
|
7114
7165
|
return symbolRef;
|
|
7115
7166
|
};
|
|
7116
|
-
const resolveLazy = (containerEl) => {
|
|
7117
|
-
return symbolRef !== null ? symbolRef : resolve(containerEl);
|
|
7118
|
-
};
|
|
7119
|
-
function invokeFn(currentCtx, beforeFn) {
|
|
7120
|
-
return (...args) => maybeThen(resolveLazy(), (f) => {
|
|
7121
|
-
if (!isFunction(f)) {
|
|
7122
|
-
throw qError(QError_qrlIsNotFunction);
|
|
7123
|
-
}
|
|
7124
|
-
if (beforeFn && beforeFn() === false) {
|
|
7125
|
-
return;
|
|
7126
|
-
}
|
|
7127
|
-
const context = createOrReuseInvocationContext(currentCtx);
|
|
7128
|
-
const prevQrl = context.$qrl$;
|
|
7129
|
-
const prevEvent = context.$event$;
|
|
7130
|
-
context.$qrl$ = qrl;
|
|
7131
|
-
context.$event$ ||= this;
|
|
7132
|
-
try {
|
|
7133
|
-
return invoke.call(this, context, f, ...args);
|
|
7134
|
-
} finally {
|
|
7135
|
-
context.$qrl$ = prevQrl;
|
|
7136
|
-
context.$event$ = prevEvent;
|
|
7137
|
-
}
|
|
7138
|
-
});
|
|
7139
|
-
}
|
|
7140
7167
|
const createOrReuseInvocationContext = (invoke2) => {
|
|
7141
7168
|
if (invoke2 == null) {
|
|
7142
7169
|
return newInvokeContext();
|
|
@@ -7159,7 +7186,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
7159
7186
|
$symbol$: symbol,
|
|
7160
7187
|
$refSymbol$: refSymbol,
|
|
7161
7188
|
$hash$: hash2,
|
|
7162
|
-
getFn:
|
|
7189
|
+
getFn: bindFnToContext,
|
|
7163
7190
|
$capture$: capture,
|
|
7164
7191
|
$captureRef$: captureRef,
|
|
7165
7192
|
dev: null,
|
|
@@ -7861,6 +7888,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
|
|
|
7861
7888
|
};
|
|
7862
7889
|
this.serializationCtx = this.serializationCtxFactory(
|
|
7863
7890
|
SsrNode,
|
|
7891
|
+
DomRef,
|
|
7864
7892
|
this.symbolToChunkResolver,
|
|
7865
7893
|
opts.writer,
|
|
7866
7894
|
(vNodeData) => this.addVNodeToSerializationRoots(vNodeData)
|
|
@@ -8634,10 +8662,10 @@ var SSRContainer = class extends import_core3._SharedContainer {
|
|
|
8634
8662
|
if (key === "ref") {
|
|
8635
8663
|
const lastNode = this.getLastNode();
|
|
8636
8664
|
if ((0, import_core3.isSignal)(value)) {
|
|
8637
|
-
value.value = lastNode;
|
|
8665
|
+
value.value = new DomRef(lastNode.id);
|
|
8638
8666
|
continue;
|
|
8639
8667
|
} else if (typeof value === "function") {
|
|
8640
|
-
value(lastNode);
|
|
8668
|
+
value(new DomRef(lastNode.id));
|
|
8641
8669
|
continue;
|
|
8642
8670
|
}
|
|
8643
8671
|
}
|
|
@@ -8913,8 +8941,8 @@ function resolveManifest(manifest) {
|
|
|
8913
8941
|
var Q_FUNCS_PREFIX = 'document["qFuncs_HASH"]=';
|
|
8914
8942
|
|
|
8915
8943
|
// packages/qwik/src/server/scripts.ts
|
|
8916
|
-
var QWIK_LOADER_DEFAULT_MINIFIED = '(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,
|
|
8917
|
-
var QWIK_LOADER_DEFAULT_DEBUG = '(() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropSymbols = Object.getOwnPropertySymbols;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __propIsEnum = Object.prototype.propertyIsEnumerable;\n var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: value\n }) : obj[key] = value;\n var __spreadValues = (a, b) => {\n for (var prop in b || (b = {})) {\n __hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n if (__getOwnPropSymbols) {\n for (var prop of __getOwnPropSymbols(b)) {\n __propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n }\n return a;\n };\n ((doc, hasInitialized) => {\n const Q_CONTEXT = "__q_context__";\n const win = window;\n const events = new Set;\n const roots = new Set([ doc ]);\n const nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\n const querySelectorAll = query => {\n const elements = [];\n roots.forEach((root => elements.push(...nativeQuerySelectorAll(root, query))));\n return elements;\n };\n const findShadowRoots = fragment => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n }));\n };\n const isPromise = promise => promise && "function" == typeof promise.then;\n const broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll("[on" + infix + "\\\\:" + type + "]").forEach((el => dispatch(el, infix, ev, type)));\n };\n const resolveContainer = containerEl => {\n if (void 0 === containerEl._qwikjson_) {\n let script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n while (script) {\n if ("SCRIPT" === script.tagName && "qwik/json" === script.getAttribute("type")) {\n containerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1"));\n break;\n }\n script = script.previousElementSibling;\n }\n }\n };\n const createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail: detail\n });\n const dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = "on" + scope + ":" + eventName;\n element.hasAttribute("preventdefault:" + eventName) && ev.preventDefault();\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 isPromise(results) && await results;\n cancelBubble && ev.stopPropagation();\n }\n return;\n }\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n const attrValue = element.getAttribute(attrName);\n if (attrValue) {\n const container = element.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");\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: qBase,\n qManifest: qManifest,\n qVersion: qVersion,\n href: href,\n symbol: symbol,\n element: element,\n reqTime: 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("sync handler error for symbol: " + symbol);\n }\n } else {\n const uri = url.href.split("#")[0];\n try {\n const module = import(\n uri);\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", __spreadValues({\n importError: importError,\n error: error\n }, eventData));\n console.error(error);\n break;\n }\n const previousCtx = doc[Q_CONTEXT];\n if (element.isConnected) {\n const handleEvent = async (retryCount = 0) => {\n try {\n doc[Q_CONTEXT] = [ element, ev, url ];\n isSync || emitEvent("qsymbol", __spreadValues({}, eventData));\n const results = handler(ev, element);\n isPromise(results) && await results;\n } catch (error2) {\n isPromise(error2) && retryCount < 100 ? error2.then((() => handleEvent(retryCount++))) : emitEvent("qerror", __spreadValues({\n error: error2\n }, eventData));\n } finally {\n doc[Q_CONTEXT] = previousCtx;\n }\n };\n handleEvent();\n }\n }\n }\n };\n const emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n };\n const camelToKebab = str => str.replace(/([A-Z])/g, (a => "-" + a.toLowerCase()));\n const 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 isPromise(results) && await results;\n cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type);\n element = ev.bubbles && !0 !== cancelBubble ? element.parentElement : null;\n }\n };\n const processWindowEvent = ev => {\n broadcast("-window", ev, camelToKebab(ev.type));\n };\n const processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && ("interactive" == readyState || "complete" == readyState)) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent("qinit");\n (null != (_a = win.requestIdleCallback) ? _a : win.setTimeout).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 };\n const addEventListener = (el, eventName, handler, capture = !1) => el.addEventListener(eventName, handler, {\n capture: capture,\n passive: !1\n });\n const processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if ("string" == typeof eventNameOrNode) {\n if (!events.has(eventNameOrNode)) {\n roots.forEach((root => addEventListener(root, eventNameOrNode, processDocumentEvent, !0)));\n addEventListener(win, eventNameOrNode, processWindowEvent, !0);\n events.add(eventNameOrNode);\n }\n } else if (!roots.has(eventNameOrNode)) {\n events.forEach((eventName => addEventListener(eventNameOrNode, eventName, processDocumentEvent, !0)));\n roots.add(eventNameOrNode);\n }\n }\n };\n if (!(Q_CONTEXT in doc)) {\n doc[Q_CONTEXT] = 0;\n const qwikevents = win.qwikevents;\n Array.isArray(qwikevents) && processEventOrNode(...qwikevents);\n win.qwikevents = {\n events: events,\n roots: roots,\n push: processEventOrNode\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n }\n })(document);\n})()';
|
|
8944
|
+
var QWIK_LOADER_DEFAULT_MINIFIED = '(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,r=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,s=(e,s)=>{for(var a in s||(s={}))n.call(s,a)&&r(e,a,s[a]);if(t)for(var a of t(s))o.call(s,a)&&r(e,a,s[a]);return e};((e,t)=>{const n="__q_context__",o=window,r=new Set,a=new Set([e]),i="replace",c="forEach",l="target",f="getAttribute",p="isConnected",b="qvisible",u="_qwikjson_",h=(e,t)=>Array.from(e.querySelectorAll(t)),y=e=>{const t=[];return a.forEach((n=>t.push(...h(n,e)))),t},d=e=>{S(e),h(e,"[q\\\\:shadowroot]").forEach((e=>{const t=e.shadowRoot;t&&d(t)}))},q=e=>e&&"function"==typeof e.then,m=(e,t,n=t.type)=>{y("[on"+e+"\\\\:"+n+"]")[c]((o=>g(o,e,t,n)))},w=t=>{if(void 0===t[u]){let n=(t===e.documentElement?e.body:t).lastElementChild;for(;n;){if("SCRIPT"===n.tagName&&"qwik/json"===n[f]("type")){t[u]=JSON.parse(n.textContent[i](/\\\\x3C(\\/?script)/gi,"<$1"));break}n=n.previousElementSibling}}},v=(e,t)=>new CustomEvent(e,{detail:t}),g=async(t,o,r,a=r.type)=>{const c="on"+o+":"+a;t.hasAttribute("preventdefault:"+a)&&r.preventDefault(),t.hasAttribute("stoppropagation:"+a)&&r.stopPropagation();const l=t._qc_,b=l&&l.li.filter((e=>e[0]===c));if(b&&b.length>0){for(const e of b){const n=e[1].getFn([t,r],(()=>t[p]))(r,t),o=r.cancelBubble;q(n)&&await n,o&&r.stopPropagation()}return}const u=t.qDispatchEvent;if(u)return u(r,o);const h=t[f](c);if(h){const o=t.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),a=o[f]("q:base"),c=o[f]("q:version")||"unknown",l=o[f]("q:manifest-hash")||"dev",b=new URL(a,e.baseURI);for(const f of h.split("\\n")){const u=new URL(f,b),h=u.href,y=u.hash[i](/^#?([^?[|]*).*$/,"$1")||"default",d=performance.now();let m,v,g;const A=f.startsWith("#"),_={qBase:a,qManifest:l,qVersion:c,href:h,symbol:y,element:t,reqTime:d};if(A){const t=o.getAttribute("q:instance");m=(e["qFuncs_"+t]||[])[Number.parseInt(y)],m||(v="sync",g=Error("sync handler error for symbol: "+y))}else{const e=u.href.split("#")[0];try{const t=import(e);w(o),m=(await t)[y],m||(v="no-symbol",g=Error(`${y} not in ${e}`))}catch(e){v||(v="async"),g=e}}if(!m){E("qerror",s({importError:v,error:g},_)),console.error(g);break}const k=e[n];if(t[p]){const o=async(a=0)=>{try{e[n]=[t,r,u],A||E("qsymbol",s({},_));const o=m(r,t);q(o)&&await o}catch(e){q(e)&&a<100?e.then((()=>o(a++))):E("qerror",s({error:e},_))}finally{e[n]=k}};o()}}}},E=(t,n)=>{e.dispatchEvent(v(t,n))},A=e=>e[i](/([A-Z])/g,(e=>"-"+e.toLowerCase())),_=async e=>{let t=A(e.type),n=e[l];for(m("-document",e,t);n&&n[f];){const o=g(n,"",e,t);let r=e.cancelBubble;q(o)&&await o,r=r||e.cancelBubble||n.hasAttribute("stoppropagation:"+e.type),n=e.bubbles&&!0!==r?n.parentElement:null}},k=e=>{m("-window",e,A(e.type))},C=()=>{var n;const s=e.readyState;if(!t&&("interactive"==s||"complete"==s)&&(a.forEach(d),t=1,E("qinit"),(null!=(n=o.requestIdleCallback)?n:o.setTimeout).bind(o)((()=>E("qidle"))),r.has(b))){const e=y("[on\\\\:"+b+"]"),t=new IntersectionObserver((e=>{for(const n of e)n.isIntersecting&&(t.unobserve(n[l]),g(n[l],"",v(b,n)))}));e[c]((e=>t.observe(e)))}},O=(e,t,n,o=!1)=>e.addEventListener(t,n,{capture:o,passive:!1}),S=(...e)=>{for(const t of e)"string"==typeof t?r.has(t)||(a.forEach((e=>O(e,t,_,!0))),O(o,t,k,!0),r.add(t)):a.has(t)||(r.forEach((e=>O(t,e,_,!0))),a.add(t))};if(!(n in e)){e[n]=0;const t=o.qwikevents;Array.isArray(t)&&S(...t),o.qwikevents={events:r,roots:a,push:S},O(e,"readystatechange",C),C()}})(document)})()';
|
|
8945
|
+
var QWIK_LOADER_DEFAULT_DEBUG = '(() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropSymbols = Object.getOwnPropertySymbols;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __propIsEnum = Object.prototype.propertyIsEnumerable;\n var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: value\n }) : obj[key] = value;\n var __spreadValues = (a, b) => {\n for (var prop in b || (b = {})) {\n __hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n if (__getOwnPropSymbols) {\n for (var prop of __getOwnPropSymbols(b)) {\n __propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n }\n return a;\n };\n ((doc, hasInitialized) => {\n const Q_CONTEXT = "__q_context__";\n const win = window;\n const events = new Set;\n const roots = new Set([ doc ]);\n const nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\n const querySelectorAll = query => {\n const elements = [];\n roots.forEach((root => elements.push(...nativeQuerySelectorAll(root, query))));\n return elements;\n };\n const findShadowRoots = fragment => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n }));\n };\n const isPromise = promise => promise && "function" == typeof promise.then;\n const broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll("[on" + infix + "\\\\:" + type + "]").forEach((el => dispatch(el, infix, ev, type)));\n };\n const resolveContainer = containerEl => {\n if (void 0 === containerEl._qwikjson_) {\n let script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n while (script) {\n if ("SCRIPT" === script.tagName && "qwik/json" === script.getAttribute("type")) {\n containerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1"));\n break;\n }\n script = script.previousElementSibling;\n }\n }\n };\n const createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail: detail\n });\n const dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = "on" + scope + ":" + eventName;\n element.hasAttribute("preventdefault:" + eventName) && ev.preventDefault();\n element.hasAttribute("stoppropagation:" + eventName) && ev.stopPropagation();\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 isPromise(results) && await results;\n cancelBubble && ev.stopPropagation();\n }\n return;\n }\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n const attrValue = element.getAttribute(attrName);\n if (attrValue) {\n const container = element.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");\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: qBase,\n qManifest: qManifest,\n qVersion: qVersion,\n href: href,\n symbol: symbol,\n element: element,\n reqTime: 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("sync handler error for symbol: " + symbol);\n }\n } else {\n const uri = url.href.split("#")[0];\n try {\n const module = import(\n uri);\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", __spreadValues({\n importError: importError,\n error: error\n }, eventData));\n console.error(error);\n break;\n }\n const previousCtx = doc[Q_CONTEXT];\n if (element.isConnected) {\n const handleEvent = async (retryCount = 0) => {\n try {\n doc[Q_CONTEXT] = [ element, ev, url ];\n isSync || emitEvent("qsymbol", __spreadValues({}, eventData));\n const results = handler(ev, element);\n isPromise(results) && await results;\n } catch (error2) {\n isPromise(error2) && retryCount < 100 ? error2.then((() => handleEvent(retryCount++))) : emitEvent("qerror", __spreadValues({\n error: error2\n }, eventData));\n } finally {\n doc[Q_CONTEXT] = previousCtx;\n }\n };\n handleEvent();\n }\n }\n }\n };\n const emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n };\n const camelToKebab = str => str.replace(/([A-Z])/g, (a => "-" + a.toLowerCase()));\n const 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 isPromise(results) && await results;\n cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type);\n element = ev.bubbles && !0 !== cancelBubble ? element.parentElement : null;\n }\n };\n const processWindowEvent = ev => {\n broadcast("-window", ev, camelToKebab(ev.type));\n };\n const processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && ("interactive" == readyState || "complete" == readyState)) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent("qinit");\n (null != (_a = win.requestIdleCallback) ? _a : win.setTimeout).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 };\n const addEventListener = (el, eventName, handler, capture = !1) => el.addEventListener(eventName, handler, {\n capture: capture,\n passive: !1\n });\n const processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if ("string" == typeof eventNameOrNode) {\n if (!events.has(eventNameOrNode)) {\n roots.forEach((root => addEventListener(root, eventNameOrNode, processDocumentEvent, !0)));\n addEventListener(win, eventNameOrNode, processWindowEvent, !0);\n events.add(eventNameOrNode);\n }\n } else if (!roots.has(eventNameOrNode)) {\n events.forEach((eventName => addEventListener(eventNameOrNode, eventName, processDocumentEvent, !0)));\n roots.add(eventNameOrNode);\n }\n }\n };\n if (!(Q_CONTEXT in doc)) {\n doc[Q_CONTEXT] = 0;\n const qwikevents = win.qwikevents;\n Array.isArray(qwikevents) && processEventOrNode(...qwikevents);\n win.qwikevents = {\n events: events,\n roots: roots,\n push: processEventOrNode\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n }\n })(document);\n})()';
|
|
8918
8946
|
function getQwikLoaderScript(opts = {}) {
|
|
8919
8947
|
return opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
|
|
8920
8948
|
}
|