@qwik.dev/core 2.0.0-alpha.1 → 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/dist/build/package.json +1 -1
- package/dist/cli.cjs +1384 -761
- package/dist/core-internal.d.ts +14 -1
- package/dist/core.cjs +66 -58
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +66 -58
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +49 -42
- package/dist/core.prod.mjs +51 -45
- 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 +49 -47
- package/dist/optimizer.mjs +51 -50
- package/dist/prefetch/package.json +1 -1
- package/dist/qwikloader.debug.js +1 -0
- package/dist/qwikloader.js +2 -2
- package/dist/server.cjs +72 -50
- package/dist/server.mjs +72 -50
- 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 +68 -46
- package/dist/testing/index.mjs +68 -46
- package/dist/testing/package.json +1 -1
- package/package.json +4 -2
package/dist/qwikloader.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,
|
|
1
|
+
(()=>{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(
|
|
2
2
|
/* @vite-ignore */
|
|
3
|
-
e);w(
|
|
3
|
+
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)})();
|
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) {
|
|
@@ -2873,7 +2893,10 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
2873
2893
|
return hostDiff;
|
|
2874
2894
|
}
|
|
2875
2895
|
} else {
|
|
2876
|
-
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()}`;
|
|
2877
2900
|
if (shouldThrowOnHostMismatch) {
|
|
2878
2901
|
throwErrorAndStop(errorMessage);
|
|
2879
2902
|
}
|
|
@@ -3044,9 +3067,11 @@ var isTask = (value) => {
|
|
|
3044
3067
|
return value instanceof Task;
|
|
3045
3068
|
};
|
|
3046
3069
|
|
|
3070
|
+
// packages/qwik/src/core/signal/flags.ts
|
|
3071
|
+
var NEEDS_COMPUTATION = Symbol("invalid");
|
|
3072
|
+
|
|
3047
3073
|
// packages/qwik/src/core/signal/signal.ts
|
|
3048
3074
|
var DEBUG3 = false;
|
|
3049
|
-
var NEEDS_COMPUTATION = Symbol("invalid");
|
|
3050
3075
|
var log2 = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
|
|
3051
3076
|
var throwIfQRLNotResolved = (qrl) => {
|
|
3052
3077
|
const resolved = qrl.resolved;
|
|
@@ -3382,7 +3407,7 @@ var WrappedSignal = class extends Signal {
|
|
|
3382
3407
|
};
|
|
3383
3408
|
|
|
3384
3409
|
// packages/qwik/src/core/version.ts
|
|
3385
|
-
var version = "2.0.0-alpha.
|
|
3410
|
+
var version = "2.0.0-alpha.2-dev+58b6f8d";
|
|
3386
3411
|
|
|
3387
3412
|
// packages/qwik/src/core/shared/shared-container.ts
|
|
3388
3413
|
var _SharedContainer = class {
|
|
@@ -3409,9 +3434,10 @@ var _SharedContainer = class {
|
|
|
3409
3434
|
trackSignalValue(signal, subscriber, property, data) {
|
|
3410
3435
|
return trackSignal(() => signal.value, subscriber, property, this, data);
|
|
3411
3436
|
}
|
|
3412
|
-
serializationCtxFactory(NodeConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
3437
|
+
serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
3413
3438
|
return createSerializationContext(
|
|
3414
3439
|
NodeConstructor,
|
|
3440
|
+
DomRefConstructor,
|
|
3415
3441
|
symbolToChunkResolver,
|
|
3416
3442
|
this.getHostProp.bind(this),
|
|
3417
3443
|
this.setHostProp.bind(this),
|
|
@@ -6301,12 +6327,7 @@ function inflateQRL(container, qrl) {
|
|
|
6301
6327
|
}
|
|
6302
6328
|
return qrl;
|
|
6303
6329
|
}
|
|
6304
|
-
var
|
|
6305
|
-
constructor(id) {
|
|
6306
|
-
this.id = id;
|
|
6307
|
-
}
|
|
6308
|
-
};
|
|
6309
|
-
var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
|
|
6330
|
+
var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
|
|
6310
6331
|
if (!writer) {
|
|
6311
6332
|
const buffer = [];
|
|
6312
6333
|
writer = {
|
|
@@ -6330,11 +6351,13 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
|
|
|
6330
6351
|
return id;
|
|
6331
6352
|
};
|
|
6332
6353
|
const isSsrNode = NodeConstructor ? (obj) => obj instanceof NodeConstructor : () => false;
|
|
6354
|
+
const isDomRef = DomRefConstructor ? (obj) => obj instanceof DomRefConstructor : () => false;
|
|
6333
6355
|
return {
|
|
6334
6356
|
$serialize$() {
|
|
6335
6357
|
serialize(this);
|
|
6336
6358
|
},
|
|
6337
6359
|
$isSsrNode$: isSsrNode,
|
|
6360
|
+
$isDomRef$: isDomRef,
|
|
6338
6361
|
$symbolToChunkResolver$: symbolToChunkResolver,
|
|
6339
6362
|
$wasSeen$,
|
|
6340
6363
|
$roots$: roots,
|
|
@@ -6443,6 +6466,8 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
|
|
|
6443
6466
|
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
|
|
6444
6467
|
} else if (isSsrNode(obj)) {
|
|
6445
6468
|
discoveredValues.push(obj.vnodeData);
|
|
6469
|
+
} else if (isDomRef(obj)) {
|
|
6470
|
+
discoveredValues.push(obj.id);
|
|
6446
6471
|
} else if (isJSXNode2(obj)) {
|
|
6447
6472
|
discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
|
|
6448
6473
|
} else if (Array.isArray(obj)) {
|
|
@@ -6497,7 +6522,7 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
|
|
|
6497
6522
|
};
|
|
6498
6523
|
var promiseResults = /* @__PURE__ */ new WeakMap();
|
|
6499
6524
|
function serialize(serializationContext) {
|
|
6500
|
-
const { $writer$, $isSsrNode$, $setProp$, $storeProxyMap$ } = serializationContext;
|
|
6525
|
+
const { $writer$, $isSsrNode$, $isDomRef$, $setProp$, $storeProxyMap$ } = serializationContext;
|
|
6501
6526
|
let depth = -1;
|
|
6502
6527
|
let writeType = false;
|
|
6503
6528
|
const output = (type, value) => {
|
|
@@ -6666,14 +6691,10 @@ function serialize(serializationContext) {
|
|
|
6666
6691
|
}
|
|
6667
6692
|
output(13 /* Object */, out);
|
|
6668
6693
|
}
|
|
6669
|
-
} else if (value
|
|
6694
|
+
} else if ($isDomRef$(value)) {
|
|
6670
6695
|
output(9 /* RefVNode */, value.id);
|
|
6671
6696
|
} else if (value instanceof Signal) {
|
|
6672
|
-
|
|
6673
|
-
if ($isSsrNode$(v)) {
|
|
6674
|
-
serializationContext.$addRoot$(v);
|
|
6675
|
-
v = new DomVRef(v.id);
|
|
6676
|
-
}
|
|
6697
|
+
const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
|
|
6677
6698
|
if (value instanceof WrappedSignal) {
|
|
6678
6699
|
output(23 /* WrappedSignal */, [
|
|
6679
6700
|
...serializeWrappingFn(serializationContext, value),
|
|
@@ -7060,8 +7081,8 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
7060
7081
|
}
|
|
7061
7082
|
let _containerEl;
|
|
7062
7083
|
const qrl = async function(...args) {
|
|
7063
|
-
const
|
|
7064
|
-
const result = await
|
|
7084
|
+
const boundedFn = bindFnToContext.call(this, tryGetInvokeContext());
|
|
7085
|
+
const result = await boundedFn(...args);
|
|
7065
7086
|
return result;
|
|
7066
7087
|
};
|
|
7067
7088
|
const setContainer = (el) => {
|
|
@@ -7070,6 +7091,30 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
7070
7091
|
}
|
|
7071
7092
|
return _containerEl;
|
|
7072
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
|
+
};
|
|
7073
7118
|
const wrapFn = (fn) => {
|
|
7074
7119
|
if (typeof fn !== "function" || !(capture == null ? void 0 : capture.length) && !(captureRef == null ? void 0 : captureRef.length)) {
|
|
7075
7120
|
return fn;
|
|
@@ -7119,30 +7164,6 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
7119
7164
|
}
|
|
7120
7165
|
return symbolRef;
|
|
7121
7166
|
};
|
|
7122
|
-
const resolveLazy = (containerEl) => {
|
|
7123
|
-
return symbolRef !== null ? symbolRef : resolve(containerEl);
|
|
7124
|
-
};
|
|
7125
|
-
function invokeFn(currentCtx, beforeFn) {
|
|
7126
|
-
return (...args) => maybeThen(resolveLazy(), (f) => {
|
|
7127
|
-
if (!isFunction(f)) {
|
|
7128
|
-
throw qError(QError_qrlIsNotFunction);
|
|
7129
|
-
}
|
|
7130
|
-
if (beforeFn && beforeFn() === false) {
|
|
7131
|
-
return;
|
|
7132
|
-
}
|
|
7133
|
-
const context = createOrReuseInvocationContext(currentCtx);
|
|
7134
|
-
const prevQrl = context.$qrl$;
|
|
7135
|
-
const prevEvent = context.$event$;
|
|
7136
|
-
context.$qrl$ = qrl;
|
|
7137
|
-
context.$event$ ||= this;
|
|
7138
|
-
try {
|
|
7139
|
-
return invoke.call(this, context, f, ...args);
|
|
7140
|
-
} finally {
|
|
7141
|
-
context.$qrl$ = prevQrl;
|
|
7142
|
-
context.$event$ = prevEvent;
|
|
7143
|
-
}
|
|
7144
|
-
});
|
|
7145
|
-
}
|
|
7146
7167
|
const createOrReuseInvocationContext = (invoke2) => {
|
|
7147
7168
|
if (invoke2 == null) {
|
|
7148
7169
|
return newInvokeContext();
|
|
@@ -7165,7 +7186,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
7165
7186
|
$symbol$: symbol,
|
|
7166
7187
|
$refSymbol$: refSymbol,
|
|
7167
7188
|
$hash$: hash2,
|
|
7168
|
-
getFn:
|
|
7189
|
+
getFn: bindFnToContext,
|
|
7169
7190
|
$capture$: capture,
|
|
7170
7191
|
$captureRef$: captureRef,
|
|
7171
7192
|
dev: null,
|
|
@@ -7867,6 +7888,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
|
|
|
7867
7888
|
};
|
|
7868
7889
|
this.serializationCtx = this.serializationCtxFactory(
|
|
7869
7890
|
SsrNode,
|
|
7891
|
+
DomRef,
|
|
7870
7892
|
this.symbolToChunkResolver,
|
|
7871
7893
|
opts.writer,
|
|
7872
7894
|
(vNodeData) => this.addVNodeToSerializationRoots(vNodeData)
|
|
@@ -8640,10 +8662,10 @@ var SSRContainer = class extends import_core3._SharedContainer {
|
|
|
8640
8662
|
if (key === "ref") {
|
|
8641
8663
|
const lastNode = this.getLastNode();
|
|
8642
8664
|
if ((0, import_core3.isSignal)(value)) {
|
|
8643
|
-
value.value = lastNode;
|
|
8665
|
+
value.value = new DomRef(lastNode.id);
|
|
8644
8666
|
continue;
|
|
8645
8667
|
} else if (typeof value === "function") {
|
|
8646
|
-
value(lastNode);
|
|
8668
|
+
value(new DomRef(lastNode.id));
|
|
8647
8669
|
continue;
|
|
8648
8670
|
}
|
|
8649
8671
|
}
|
|
@@ -8919,8 +8941,8 @@ function resolveManifest(manifest) {
|
|
|
8919
8941
|
var Q_FUNCS_PREFIX = 'document["qFuncs_HASH"]=';
|
|
8920
8942
|
|
|
8921
8943
|
// packages/qwik/src/server/scripts.ts
|
|
8922
|
-
var QWIK_LOADER_DEFAULT_MINIFIED = '(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,
|
|
8923
|
-
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})()';
|
|
8924
8946
|
function getQwikLoaderScript(opts = {}) {
|
|
8925
8947
|
return opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
|
|
8926
8948
|
}
|