@qwik.dev/core 2.0.0-beta.40 → 2.0.0-beta.42
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/backpatch/package.json +1 -1
- package/dist/build/package.json +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/core-internal.d.ts +97 -72
- package/dist/core.min.mjs +11 -9
- package/dist/core.mjs +733 -144
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +3895 -3334
- package/dist/error-swap-executor.debug.js +37 -0
- package/dist/error-swap-executor.js +1 -0
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.d.ts +3 -7
- package/dist/optimizer.mjs +52 -68
- package/dist/out-of-order-executor.debug.js +12 -12
- package/dist/qwikloader.debug.js +1 -1
- package/dist/qwikloader.js +1 -1
- package/dist/server.d.ts +27 -0
- package/dist/server.mjs +100 -40
- package/dist/server.prod.mjs +853 -785
- package/dist/starters/adapters/cloudflare-workers/adapters/cloudflare-workers/vite.config.ts +3 -3
- package/dist/starters/adapters/cloudflare-workers/src/entry.cloudflare-pages.tsx +4 -5
- package/dist/starters/features/compiled-i18n/src/components/locale-selector/locale-selector.tsx +1 -1
- package/dist/starters/features/compiled-i18n/src/routes/plugin@compiled-i18n.ts +1 -1
- package/dist/starters/features/cypress/src/actions/example.action.ts +1 -1
- package/dist/starters/features/cypress/src/components/example/example.cy.tsx +4 -4
- package/dist/starters/features/cypress/src/loaders/example.loader.ts +1 -1
- package/dist/testing/index.d.ts +11 -2
- package/dist/testing/index.mjs +6568 -6298
- package/dist/testing/package.json +1 -1
- package/dist/worker/package.json +1 -1
- package/handlers.mjs +3 -0
- package/package.json +3 -3
- package/public.d.ts +3 -3
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//#region packages/qwik/src/error-swap-executor-shared.ts
|
|
2
|
+
var Q_ERROR_CONTENT_SELECTOR = "[q\\:ebc=\"";
|
|
3
|
+
var Q_ERROR_FALLBACK_SELECTOR = "[q\\:ebf=\"";
|
|
4
|
+
var Q_CONTAINER_SELECTOR = "[q\\:container]:not([q\\:container=html]):not([q\\:container=text])";
|
|
5
|
+
/**
|
|
6
|
+
* Qwikloader broadcasts document/window events to every matching element in the document, and
|
|
7
|
+
* `display:none` still counts as connected, so a torn-down subtree keeps handling them.
|
|
8
|
+
*/
|
|
9
|
+
var stripBroadcastHandlers = (content) => {
|
|
10
|
+
const nodes = content.querySelectorAll("*");
|
|
11
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
12
|
+
const attrs = nodes[i].attributes;
|
|
13
|
+
for (let j = attrs.length - 1; j >= 0; j--) {
|
|
14
|
+
const name = attrs[j].name;
|
|
15
|
+
if (name.indexOf("q-d:") === 0 || name.indexOf("q-w:") === 0) nodes[i].removeAttribute(name);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var installErrorSwapExecutor = (doc) => {
|
|
20
|
+
const qErr = ((boundaryId) => {
|
|
21
|
+
var _doc$currentScript;
|
|
22
|
+
const scope = ((_doc$currentScript = doc.currentScript) === null || _doc$currentScript === void 0 ? void 0 : _doc$currentScript.closest(Q_CONTAINER_SELECTOR)) || doc;
|
|
23
|
+
const content = scope.querySelector(Q_ERROR_CONTENT_SELECTOR + boundaryId + "\"]");
|
|
24
|
+
const fallback = scope.querySelector(Q_ERROR_FALLBACK_SELECTOR + boundaryId + "\"]");
|
|
25
|
+
if (content && content.style) {
|
|
26
|
+
content.style.display = "none";
|
|
27
|
+
stripBroadcastHandlers(content);
|
|
28
|
+
}
|
|
29
|
+
if (fallback && fallback.style) fallback.style.display = "contents";
|
|
30
|
+
});
|
|
31
|
+
qErr.d = doc;
|
|
32
|
+
globalThis.qErr = qErr;
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region packages/qwik/src/error-swap-executor.ts
|
|
36
|
+
installErrorSwapExecutor(document);
|
|
37
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t='[q\\:ebc="',e='[q\\:ebf="',n="[q\\:container]:not([q\\:container=html]):not([q\\:container=text])",o=t=>{const e=t.querySelectorAll("*");for(let t=0;t<e.length;t++){const n=e[t].attributes;for(let o=n.length-1;o>=0;o--){const l=n[o].name;0!==l.indexOf("q-d:")&&0!==l.indexOf("q-w:")||e[t].removeAttribute(l)}}},l=l=>{const r=r=>{var c;const s=(null===(c=l.currentScript)||void 0===c?void 0:c.closest(n))||l,i=s.querySelector(t+r+'"]'),q=s.querySelector(e+r+'"]');i&&i.style&&(i.style.display="none",o(i)),q&&q.style&&(q.style.display="contents")};r.d=l,globalThis.qErr=r};l(document);
|
package/dist/loader/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const QWIK_LOADER = "var e,t,n,r=document,o=window,s=\"w\",i=\"wp\",a=\"d\",c=\"dp\",l=\"e\",p=\"ep\",u=\"capture:\",d=\"readystatechange\",f=0,h=new Set,q=new Set([r]),b=new Map,g={},m=(e,t)=>Array.from(e.querySelectorAll(t)),v=e=>{const t=[];return q.forEach(n=>t.push(...m(n,e))),t},w=(e,t,n,r=!1,o=!1)=>e.addEventListener(t,n,{capture:r,passive:o}),y=e=>{H(e);const t=m(e,\"[q\\\\:shadowroot]\");for(let e=0;e<t.length;e++){const n=t[e].shadowRoot;n&&y(n)}},A=e=>e&&\"function\"==typeof e.then,E=async e=>{for(let t=0;t<e.length;t++)await e[t]()},S=e=>{if(e.length){const t=()=>E(e);n=n?n.then(t,t):t()}},C=e=>{if(void 0===e._qwikjson_){let t=(e===r.documentElement?r.body:e).lastElementChild;for(;t;){if(\"SCRIPT\"===t.tagName&&\"qwik/json\"===t.getAttribute(\"type\")){e._qwikjson_=JSON.parse(t.textContent.replace(/\\\\x3C(\\/?script)/gi,\"<$1\"));break}t=t.previousElementSibling}}},_=e=>{g[e]=1,I(d)},k=e=>{const t=e.getAttribute(\"q:instance\");return\"paused\"===e.getAttribute(\"q:container\")&&\"loading\"===r.readyState&&!g[t]&&new Promise(e=>{w(r,d,()=>{(\"loading\"!==r.readyState||g[t])&&e()})})},$=(e,t)=>new CustomEvent(e,{detail:t}),I=(e,t)=>{r.dispatchEvent($(e,t))},N=e=>e.replace(/([A-Z-])/g,e=>\"-\"+e.toLowerCase()),R=e=>e.replace(/-./g,e=>e[1].toUpperCase()),T=e=>{const t=e.indexOf(\":\");return{scope:e.slice(0,t),eventName:R(e.slice(t+1))}},x=e=>2===e.length,B=e=>e.charAt(0),L=e=>!!e&&1===e.nodeType,U=(e,t,n)=>e.hasAttribute(n)&&(!!e._qDispatch?.[t]||e.hasAttribute(\"q-\"+t)),j=(e,t,n,o,s,i,a,c=!0)=>{const l={qBase:n,symbol:i,element:t,reqTime:a};if(!s){const t=(r[\"qFuncs_\"+e.getAttribute(\"q:instance\")]||[])[+i];if(!t&&c){const e=Error(\"sym:\"+i);I(\"qerror\",{importError:\"sync\",error:e,...l}),console.error(e)}return t}const p=`${i}|${n}|${s}`,u=b.get(p);if(u)return u;const d=new URL(s,o).href,f=import(d);return C(e),f.then(e=>{const t=e[i];if(t)b.set(p,t),I(\"qsymbol\",l);else{const e=Error(`${i} not in ${d}`);I(\"qerror\",{importError:\"no-symbol\",error:e,...l}),console.error(e)}return t},e=>{I(\"qerror\",{importError:\"async\",error:e,...l}),console.error(e)})},D=(e,t,n,o,s,i=!0)=>{let a=!1;s&&(i&&e.hasAttribute(\"preventdefault:\"+s)&&t.preventDefault(),e.hasAttribute(\"stoppropagation:\"+s)&&t.stopPropagation());const c=e._qDispatch?.[n];if(c){if(\"function\"==typeof c){const n=()=>c(t,e);if(a)o.push(async()=>{const e=n();A(e)&&await e});else{const e=n();A(e)&&(a=!0,o.push(()=>e))}}else if(c.length)for(let n=0;n<c.length;n++){const r=c[n];if(r){const n=()=>r(t,e);if(a)o.push(async()=>{const e=n();A(e)&&await e});else{const e=n();A(e)&&(a=!0,o.push(()=>e))}}}return}const l=e.getAttribute(\"q-\"+n);if(l){const n=e.closest(\"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\"),s=n.getAttribute(\"q:base\"),i=new URL(s,r.baseURI),c=l.split(\"|\"),p=k(n);for(let r=0;r<c.length;r++){const l=c[r],u=performance.now(),[d,f,h]=l.split(\"#\"),q=n=>{if(n&&e.isConnected){const r=t=>{I(\"qerror\",{error:t,qBase:s,symbol:f,element:e,reqTime:u})};try{const o=n.call(h,t,e);if(A(o))return o.catch(r)}catch(e){return r(e)}}},b=(t=!0)=>j(n,e,s,i,d,f,u,t),g=p?void 0:b();if(p)a=!0,o.push(async()=>{await p,await q(await b(!1)||await b())});else if(A(g))a=!0,o.push(()=>g.then(q));else if(a)a=!0,o.push(async()=>{await q(g||await b())});else{const e=q(g);A(e)&&(a=!0,o.push(()=>e))}}}},O=(e,t=l,n=!0)=>{const r=N(e.type),o=t+\":\"+r,s=u+r,i=[],a=[],c=[];let p=e.target;for(;p;)L(p)?(i.push(p),a.push(U(p,o,s)),p=p.parentElement):p=p.parentElement;for(let t=i.length-1;t>=0;t--)if(a[t]&&(D(i[t],e,o,c,r,n),e.cancelBubble))return void S(c);for(let t=0;t<i.length;t++)if(!a[t]&&(D(i[t],e,o,c,r,n),!e.bubbles||e.cancelBubble))return void S(c);S(c)},P=e=>O(e,p,!1),F=(e,t,n=!0)=>{const r=N(t.type),o=e+\":\"+r,s=v(\"[q-\"+CSS.escape(o)+\"]\"),i=[];for(let e=0;e<s.length;e++){const a=s[e];D(a,t,o,i,r,n)}S(i)},J=e=>{F(a,e)},M=e=>{F(c,e,!1)},Z=e=>{F(s,e)},z=e=>{F(i,e,!1)},G=()=>{const n=r.readyState;if(\"interactive\"==n||\"complete\"==n){if(t=1,q.forEach(y),h.has(\"d:qinit\")){h.delete(\"d:qinit\");const e=$(\"qinit\"),t=v(\"[q-d\\\\:qinit]\"),n=[];for(let r=0;r<t.length;r++){const o=t[r];D(o,e,\"d:qinit\",n),o.removeAttribute(\"q-d:qinit\")}S(n)}if(h.has(\"d:qidle\")&&(h.delete(\"d:qidle\"),(o.requestIdleCallback??o.setTimeout).bind(o)(()=>{const e=$(\"qidle\"),t=v(\"[q-d\\\\:qidle]\"),n=[];for(let r=0;r<t.length;r++){const o=t[r];D(o,e,\"d:qidle\",n),o.removeAttribute(\"q-d:qidle\")}S(n)})),h.has(\"e:qvisible\")){e||(e=new IntersectionObserver(t=>{const n=[];for(let r=0;r<t.length;r++){const o=t[r];o.isIntersecting&&(e.unobserve(o.target),D(o.target,$(\"qvisible\",o),\"e:qvisible\",n))}S(n)}));const t=v(\"[q-e\\\\:qvisible]:not([q\\\\:observed])\");for(let n=0;n<t.length;n++){const r=t[n];e.observe(r),r.setAttribute(\"q:observed\",\"true\")}}}},H=(...e)=>{for(let n=0;n<e.length;n++){const r=e[n];if(r===f)_(e[++n]);else if(\"string\"==typeof r){if(!h.has(r)){h.add(r);const{scope:e,eventName:n}=T(r),i=x(e),c=B(e);c===s?w(o,n,i?z:Z,!0,i):q.forEach(e=>w(e,n,c===a?i?M:J:i?P:O,!0,i)),1!==t||\"e:qvisible\"!==r&&\"d:qinit\"!==r&&\"d:qidle\"!==r||G()}}else q.has(r)||(h.forEach(e=>{const{scope:t,eventName:n}=T(e),o=x(t),i=B(t);i!==s&&w(r,n,i===a?o?M:J:o?P:O,!0,o)}),q.add(r))}},K=o._qwikEv;K?.roots||(Array.isArray(K)?H(...K):H(\"e:click\",\"e:input\"),o._qwikEv={events:h,roots:q,push:H},w(r,d,G),G())";
|
|
2
|
-
const QWIK_LOADER_DEBUG = "//#region packages/qwik/src/qwikloader.ts\nvar doc = document;\nvar win = window;\nvar windowPrefix = \"w\";\nvar passiveWindowPrefix = \"wp\";\nvar documentPrefix = \"d\";\nvar passiveDocumentPrefix = \"dp\";\nvar elementPrefix = \"e\";\nvar passiveElementPrefix = \"ep\";\nvar capturePrefix = \"capture:\";\nvar readyStateChange = \"readystatechange\";\nvar QwikEvContainerReady = 0;\nvar events = /* @__PURE__ */ new Set();\nvar roots = /* @__PURE__ */ new Set([doc]);\nvar symbols = /* @__PURE__ */ new Map();\nvar readyContainers = {};\nvar observer;\nvar hasInitialized;\nvar queuedTasks;\nvar nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nvar querySelectorAll = (query) => {\n\tconst elements = [];\n\troots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n\treturn elements;\n};\nvar addEventListener = (el, eventName, handler, capture = false, passive = false) => el.addEventListener(eventName, handler, {\n\tcapture,\n\tpassive\n});\nvar findShadowRoots = (fragment) => {\n\taddEventOrRoot(fragment);\n\tconst shadowRoots = nativeQuerySelectorAll(fragment, \"[q\\\\:shadowroot]\");\n\tfor (let i = 0; i < shadowRoots.length; i++) {\n\t\tconst shadowRoot = shadowRoots[i].shadowRoot;\n\t\tshadowRoot && findShadowRoots(shadowRoot);\n\t}\n};\nvar isPromise = (promise) => promise && typeof promise.then === \"function\";\nvar runTasks = async (tasks) => {\n\tfor (let i = 0; i < tasks.length; i++) await tasks[i]();\n};\nvar queueTasks = (tasks) => {\n\tif (tasks.length) {\n\t\tconst run = () => runTasks(tasks);\n\t\tqueuedTasks = queuedTasks ? queuedTasks.then(run, run) : run();\n\t}\n};\nvar resolveContainer = (containerEl) => {\n\tif (containerEl._qwikjson_ === void 0) {\n\t\tlet script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n\t\twhile (script) {\n\t\t\tif (script.tagName === \"SCRIPT\" && script.getAttribute(\"type\") === \"qwik/json\") {\n\t\t\t\tcontainerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, \"<$1\"));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tscript = script.previousElementSibling;\n\t\t}\n\t}\n};\nvar markContainerReady = (hash) => {\n\treadyContainers[hash] = 1;\n\temitEvent(readyStateChange);\n};\nvar waitForContainerReady = (container) => {\n\tconst hash = container.getAttribute(\"q:instance\");\n\treturn container.getAttribute(\"q:container\") === \"paused\" && doc.readyState === \"loading\" && !readyContainers[hash] && new Promise((resolve) => {\n\t\tconst ready = () => {\n\t\t\tif (doc.readyState !== \"loading\" || readyContainers[hash]) resolve();\n\t\t};\n\t\taddEventListener(doc, readyStateChange, ready);\n\t});\n};\nvar createEvent = (eventName, detail) => new CustomEvent(eventName, { detail });\nvar emitEvent = (eventName, detail) => {\n\tdoc.dispatchEvent(createEvent(eventName, detail));\n};\nvar camelToKebab = (str) => str.replace(/([A-Z-])/g, (a) => \"-\" + a.toLowerCase());\nvar kebabToCamel = (eventName) => eventName.replace(/-./g, (a) => a[1].toUpperCase());\nvar parseKebabEvent = (event) => {\n\tconst separatorIndex = event.indexOf(\":\");\n\treturn {\n\t\tscope: event.slice(0, separatorIndex),\n\t\teventName: kebabToCamel(event.slice(separatorIndex + 1))\n\t};\n};\nvar isPassiveScope = (scope) => scope.length === 2;\nvar getRootScope = (scope) => scope.charAt(0);\nvar isElementNode = (node) => !!node && node.nodeType === 1;\nvar isCaptureHandlerElement = (element, scopedKebabName, captureAttribute) => element.hasAttribute(captureAttribute) && (!!element._qDispatch?.[scopedKebabName] || element.hasAttribute(\"q-\" + scopedKebabName));\nvar resolveHandler = (container, element, qBase, base, chunk, symbol, reqTime, reportSyncError = true) => {\n\tconst eventData = {\n\t\tqBase,\n\t\tsymbol,\n\t\telement,\n\t\treqTime\n\t};\n\tif (!chunk) {\n\t\tconst handler = (doc[\"qFuncs_\" + container.getAttribute(\"q:instance\")] || [])[+symbol];\n\t\tif (!handler && reportSyncError) {\n\t\t\tconst error = /* @__PURE__ */ new Error(\"sym:\" + symbol);\n\t\t\temitEvent(\"qerror\", {\n\t\t\t\timportError: \"sync\",\n\t\t\t\terror,\n\t\t\t\t...eventData\n\t\t\t});\n\t\t\tconsole.error(error);\n\t\t}\n\t\treturn handler;\n\t}\n\tconst key = `${symbol}|${qBase}|${chunk}`;\n\tconst handler = symbols.get(key);\n\tif (handler) return handler;\n\tconst href = new URL(chunk, base).href;\n\tconst module = import(\n\t\t\t\thref\n);\n\tresolveContainer(container);\n\treturn module.then((module) => {\n\t\tconst handler = module[symbol];\n\t\tif (!handler) {\n\t\t\tconst error = /* @__PURE__ */ new Error(`${symbol} not in ${href}`);\n\t\t\temitEvent(\"qerror\", {\n\t\t\t\timportError: \"no-symbol\",\n\t\t\t\terror,\n\t\t\t\t...eventData\n\t\t\t});\n\t\t\tconsole.error(error);\n\t\t} else {\n\t\t\tsymbols.set(key, handler);\n\t\t\temitEvent(\"qsymbol\", eventData);\n\t\t}\n\t\treturn handler;\n\t}, (error) => {\n\t\temitEvent(\"qerror\", {\n\t\t\timportError: \"async\",\n\t\t\terror,\n\t\t\t...eventData\n\t\t});\n\t\tconsole.error(error);\n\t});\n};\n/**\n* Dispatch an event by invoking QRL handlers. If there are multiple handlers, they are awaited in\n* order.\n*/\nvar dispatch = (element, ev, scopedKebabName, tasks, kebabName, allowPreventDefault = true) => {\n\tlet defer = false;\n\tif (kebabName) {\n\t\tif (allowPreventDefault && element.hasAttribute(\"preventdefault:\" + kebabName)) ev.preventDefault();\n\t\tif (element.hasAttribute(\"stoppropagation:\" + kebabName)) ev.stopPropagation();\n\t}\n\tconst handlers = element._qDispatch?.[scopedKebabName];\n\tif (handlers) {\n\t\tif (typeof handlers === \"function\") {\n\t\t\tconst run = () => handlers(ev, element);\n\t\t\tif (defer) tasks.push(async () => {\n\t\t\t\tconst result = run();\n\t\t\t\tif (isPromise(result)) await result;\n\t\t\t});\n\t\t\telse {\n\t\t\t\tconst result = run();\n\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\tdefer = true;\n\t\t\t\t\ttasks.push(() => result);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (handlers.length) for (let i = 0; i < handlers.length; i++) {\n\t\t\tconst handler = handlers[i];\n\t\t\tif (handler) {\n\t\t\t\tconst run = () => handler(ev, element);\n\t\t\t\tif (defer) tasks.push(async () => {\n\t\t\t\t\tconst result = run();\n\t\t\t\t\tif (isPromise(result)) await result;\n\t\t\t\t});\n\t\t\t\telse {\n\t\t\t\t\tconst result = run();\n\t\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\t\tdefer = true;\n\t\t\t\t\t\ttasks.push(() => result);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\tconst attrValue = element.getAttribute(\"q-\" + scopedKebabName);\n\tif (attrValue) {\n\t\tconst container = element.closest(\"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\");\n\t\tconst qBase = container.getAttribute(\"q:base\");\n\t\tconst base = new URL(qBase, doc.baseURI);\n\t\tconst qrls = attrValue.split(\"|\");\n\t\tconst waitForReady = waitForContainerReady(container);\n\t\tfor (let i = 0; i < qrls.length; i++) {\n\t\t\tconst qrl = qrls[i];\n\t\t\tconst reqTime = performance.now();\n\t\t\tconst [chunk, symbol, capturedIds] = qrl.split(\"#\");\n\t\t\tconst run = (handler) => {\n\t\t\t\tif (handler && element.isConnected) {\n\t\t\t\t\tconst onError = (error) => {\n\t\t\t\t\t\temitEvent(\"qerror\", {\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\tqBase,\n\t\t\t\t\t\t\tsymbol,\n\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\treqTime\n\t\t\t\t\t\t});\n\t\t\t\t\t};\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = handler.call(capturedIds, ev, element);\n\t\t\t\t\t\tif (isPromise(result)) return result.catch(onError);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treturn onError(error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst resolve = (reportSyncError = true) => resolveHandler(container, element, qBase, base, chunk, symbol, reqTime, reportSyncError);\n\t\t\tconst handler = waitForReady ? void 0 : resolve();\n\t\t\tif (waitForReady) {\n\t\t\t\tdefer = true;\n\t\t\t\ttasks.push(async () => {\n\t\t\t\t\tawait waitForReady;\n\t\t\t\t\tawait run(await resolve(false) || await resolve());\n\t\t\t\t});\n\t\t\t} else if (isPromise(handler)) {\n\t\t\t\tdefer = true;\n\t\t\t\ttasks.push(() => handler.then(run));\n\t\t\t} else if (defer) {\n\t\t\t\tdefer = true;\n\t\t\t\ttasks.push(async () => {\n\t\t\t\t\tawait run(handler || await resolve());\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst result = run(handler);\n\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\tdefer = true;\n\t\t\t\t\ttasks.push(() => result);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n/**\n* Event handler responsible for processing element events.\n*\n* If browser emits an event, the `eventProcessor` walks the DOM tree looking for corresponding\n* `(${event.type})`. If found the event's URL is parsed and `import()`ed.\n*\n* @param ev - Browser event.\n*/\nvar processElementEvent = (ev, scope = elementPrefix, allowPreventDefault = true) => {\n\tconst kebabName = camelToKebab(ev.type);\n\tconst scopedKebabName = scope + \":\" + kebabName;\n\tconst captureAttribute = capturePrefix + kebabName;\n\tconst elements = [];\n\tconst captureHandlers = [];\n\tconst tasks = [];\n\tlet current = ev.target;\n\twhile (current) if (isElementNode(current)) {\n\t\telements.push(current);\n\t\tcaptureHandlers.push(isCaptureHandlerElement(current, scopedKebabName, captureAttribute));\n\t\tcurrent = current.parentElement;\n\t} else current = current.parentElement;\n\tfor (let i = elements.length - 1; i >= 0; i--) if (captureHandlers[i]) {\n\t\tdispatch(elements[i], ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n\t\tif (ev.cancelBubble) {\n\t\t\tqueueTasks(tasks);\n\t\t\treturn;\n\t\t}\n\t}\n\tfor (let i = 0; i < elements.length; i++) if (!captureHandlers[i]) {\n\t\tdispatch(elements[i], ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n\t\tif (!ev.bubbles || ev.cancelBubble) {\n\t\t\tqueueTasks(tasks);\n\t\t\treturn;\n\t\t}\n\t}\n\tqueueTasks(tasks);\n};\nvar processPassiveElementEvent = (ev) => processElementEvent(ev, passiveElementPrefix, false);\nvar broadcast = (scope, ev, allowPreventDefault = true) => {\n\tconst kebabName = camelToKebab(ev.type);\n\tconst scopedKebabName = scope + \":\" + kebabName;\n\tconst elements = querySelectorAll(\"[q-\" + CSS.escape(scopedKebabName) + \"]\");\n\tconst tasks = [];\n\tfor (let i = 0; i < elements.length; i++) {\n\t\tconst el = elements[i];\n\t\tdispatch(el, ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n\t}\n\tqueueTasks(tasks);\n};\n/**\n* Event handler responsible for processing browser events.\n*\n* If browser emits an event, the `eventProcessor` walks the DOM tree looking for corresponding\n* `(${event.type})`. If found the event's URL is parsed and `import()`ed.\n*\n* @param ev - Browser event.\n*/\nvar processDocumentEvent = (ev) => {\n\tbroadcast(documentPrefix, ev);\n};\nvar processPassiveDocumentEvent = (ev) => {\n\tbroadcast(passiveDocumentPrefix, ev, false);\n};\nvar processWindowEvent = (ev) => {\n\tbroadcast(windowPrefix, ev);\n};\nvar processPassiveWindowEvent = (ev) => {\n\tbroadcast(passiveWindowPrefix, ev, false);\n};\n/**\n* Called when the document is ready and whenever a container is added, so make this idempotent. For\n* qidle and qinit we remove the attributes immediately, and for qvisible we add an attribute\n*/\nvar processReadyStateChange = () => {\n\tconst readyState = doc.readyState;\n\tif (readyState == \"interactive\" || readyState == \"complete\") {\n\t\thasInitialized = 1;\n\t\troots.forEach(findShadowRoots);\n\t\tif (events.has(\"d:qinit\")) {\n\t\t\tevents.delete(\"d:qinit\");\n\t\t\tconst ev = createEvent(\"qinit\");\n\t\t\tconst elements = querySelectorAll(\"[q-d\\\\:qinit]\");\n\t\t\tconst tasks = [];\n\t\t\tfor (let i = 0; i < elements.length; i++) {\n\t\t\t\tconst el = elements[i];\n\t\t\t\tdispatch(el, ev, \"d:qinit\", tasks);\n\t\t\t\tel.removeAttribute(\"q-d:qinit\");\n\t\t\t}\n\t\t\tqueueTasks(tasks);\n\t\t}\n\t\tif (events.has(\"d:qidle\")) {\n\t\t\tevents.delete(\"d:qidle\");\n\t\t\t(win.requestIdleCallback ?? win.setTimeout).bind(win)(() => {\n\t\t\t\tconst ev = createEvent(\"qidle\");\n\t\t\t\tconst elements = querySelectorAll(\"[q-d\\\\:qidle]\");\n\t\t\t\tconst tasks = [];\n\t\t\t\tfor (let i = 0; i < elements.length; i++) {\n\t\t\t\t\tconst el = elements[i];\n\t\t\t\t\tdispatch(el, ev, \"d:qidle\", tasks);\n\t\t\t\t\tel.removeAttribute(\"q-d:qidle\");\n\t\t\t\t}\n\t\t\t\tqueueTasks(tasks);\n\t\t\t});\n\t\t}\n\t\tif (events.has(\"e:qvisible\")) {\n\t\t\tobserver || (observer = new IntersectionObserver((entries) => {\n\t\t\t\tconst tasks = [];\n\t\t\t\tfor (let i = 0; i < entries.length; i++) {\n\t\t\t\t\tconst entry = entries[i];\n\t\t\t\t\tif (entry.isIntersecting) {\n\t\t\t\t\t\tobserver.unobserve(entry.target);\n\t\t\t\t\t\tdispatch(entry.target, createEvent(\"qvisible\", entry), \"e:qvisible\", tasks);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tqueueTasks(tasks);\n\t\t\t}));\n\t\t\tconst elements = querySelectorAll(\"[q-e\\\\:qvisible]:not([q\\\\:observed])\");\n\t\t\tfor (let i = 0; i < elements.length; i++) {\n\t\t\t\tconst el = elements[i];\n\t\t\t\tobserver.observe(el);\n\t\t\t\tel.setAttribute(\"q:observed\", \"true\");\n\t\t\t}\n\t\t}\n\t}\n};\nvar addEventOrRoot = (...eventNames) => {\n\tfor (let i = 0; i < eventNames.length; i++) {\n\t\tconst eventNameOrRoot = eventNames[i];\n\t\tif (eventNameOrRoot === QwikEvContainerReady) markContainerReady(eventNames[++i]);\n\t\telse if (typeof eventNameOrRoot === \"string\") {\n\t\t\tif (!events.has(eventNameOrRoot)) {\n\t\t\t\tevents.add(eventNameOrRoot);\n\t\t\t\tconst { scope, eventName } = parseKebabEvent(eventNameOrRoot);\n\t\t\t\tconst passive = isPassiveScope(scope);\n\t\t\t\tconst rootScope = getRootScope(scope);\n\t\t\t\tif (rootScope === windowPrefix) addEventListener(win, eventName, passive ? processPassiveWindowEvent : processWindowEvent, true, passive);\n\t\t\t\telse roots.forEach((root) => addEventListener(root, eventName, rootScope === documentPrefix ? passive ? processPassiveDocumentEvent : processDocumentEvent : passive ? processPassiveElementEvent : processElementEvent, true, passive));\n\t\t\t\tif (hasInitialized === 1 && (eventNameOrRoot === \"e:qvisible\" || eventNameOrRoot === \"d:qinit\" || eventNameOrRoot === \"d:qidle\")) processReadyStateChange();\n\t\t\t}\n\t\t} else if (!roots.has(eventNameOrRoot)) {\n\t\t\tevents.forEach((kebabEventName) => {\n\t\t\t\tconst { scope, eventName } = parseKebabEvent(kebabEventName);\n\t\t\t\tconst passive = isPassiveScope(scope);\n\t\t\t\tconst rootScope = getRootScope(scope);\n\t\t\t\tif (rootScope !== windowPrefix) addEventListener(eventNameOrRoot, eventName, rootScope === documentPrefix ? passive ? processPassiveDocumentEvent : processDocumentEvent : passive ? processPassiveElementEvent : processElementEvent, true, passive);\n\t\t\t});\n\t\t\troots.add(eventNameOrRoot);\n\t\t}\n\t}\n};\nvar _qwikEv = win._qwikEv;\nif (!_qwikEv?.roots) {\n\tif (Array.isArray(_qwikEv)) addEventOrRoot(..._qwikEv);\n\telse addEventOrRoot(\"e:click\", \"e:input\");\n\twin._qwikEv = {\n\t\tevents,\n\t\troots,\n\t\tpush: addEventOrRoot\n\t};\n\taddEventListener(doc, readyStateChange, processReadyStateChange);\n\tprocessReadyStateChange();\n}\n//#endregion";
|
|
1
|
+
const QWIK_LOADER = "var e,t,n,r=document,o=window,s=\"w\",i=\"wp\",a=\"d\",c=\"dp\",l=\"e\",p=\"ep\",u=\"capture:\",d=\"readystatechange\",f=0,h=new Set,q=new Set([r]),b=new Map,g={},m=(e,t)=>Array.from(e.querySelectorAll(t)),v=e=>{const t=[];return q.forEach(n=>t.push(...m(n,e))),t},w=(e,t,n,r=!1,o=!1)=>e.addEventListener(t,n,{capture:r,passive:o}),y=e=>{H(e);const t=m(e,\"[q\\\\:shadowroot]\");for(let e=0;e<t.length;e++){const n=t[e].shadowRoot;n&&y(n)}},A=e=>e&&\"function\"==typeof e.then,E=async e=>{for(let t=0;t<e.length;t++)await e[t]()},S=e=>{if(e.length){const t=()=>E(e);n=n?n.then(t,t):t()}},C=e=>{if(void 0===e._qwikjson_){let t=(e===r.documentElement?r.body:e).lastElementChild;for(;t;){if(\"SCRIPT\"===t.tagName&&\"qwik/json\"===t.getAttribute(\"type\")){e._qwikjson_=JSON.parse(t.textContent.replace(/\\\\x3C(\\/?script)/gi,\"<$1\"));break}t=t.previousElementSibling}}},_=e=>{g[e]=1,I(d)},k=e=>{const t=e.getAttribute(\"q:instance\");return\"paused\"===e.getAttribute(\"q:container\")&&\"loading\"===r.readyState&&!g[t]&&new Promise(e=>{w(r,d,()=>{(\"loading\"!==r.readyState||g[t])&&e()})})},$=(e,t)=>new CustomEvent(e,{detail:t}),I=(e,t)=>{r.dispatchEvent($(e,t))},N=e=>e.replace(/([A-Z-])/g,e=>\"-\"+e.toLowerCase()),R=e=>e.replace(/-./g,e=>e[1].toUpperCase()),T=e=>{const t=e.indexOf(\":\");return{scope:e.slice(0,t),eventName:R(e.slice(t+1))}},x=e=>2===e.length,B=e=>e.charAt(0),L=e=>!!e&&1===e.nodeType,U=(e,t,n)=>e.hasAttribute(n)&&(!!e._qDispatch?.[t]||e.hasAttribute(\"q-\"+t)),j=(e,t,n,o,s,i,a,c=!0)=>{const l={qBase:n,symbol:i,element:t,reqTime:a};if(!s){const t=(r[\"qFuncs_\"+e.getAttribute(\"q:instance\")]||[])[+i];if(!t&&c){const e=Error(\"sym:\"+i);I(\"qerror\",{importError:\"sync\",error:e,...l}),console.error(e)}return t}const p=`${i}|${n}|${s}`,u=b.get(p);if(u)return u;const d=new URL(s,o).href,f=import(d);return C(e),f.then(e=>{const t=e[i];if(t)b.set(p,t),I(\"qsymbol\",l);else{const e=Error(`${i} not in ${d}`);I(\"qerror\",{importError:\"no-symbol\",error:e,...l}),console.error(e)}return t},e=>{I(\"qerror\",{importError:\"async\",error:e,...l}),console.error(e)})},D=(e,t,n,o,s,i=!0)=>{let a=!1;s&&(i&&e.hasAttribute(\"preventdefault:\"+s)&&t.preventDefault(),e.hasAttribute(\"stoppropagation:\"+s)&&t.stopPropagation());const c=e._qDispatch?.[n];if(c){if(\"function\"==typeof c){const n=()=>c(t,e);if(a)o.push(async()=>{const e=n();A(e)&&await e});else{const e=n();A(e)&&(a=!0,o.push(()=>e))}}else if(c.length)for(let n=0;n<c.length;n++){const r=c[n];if(r){const n=()=>r(t,e);if(a)o.push(async()=>{const e=n();A(e)&&await e});else{const e=n();A(e)&&(a=!0,o.push(()=>e))}}}return}const l=e.getAttribute(\"q-\"+n);if(l){const n=e.closest(\"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\"),s=n.getAttribute(\"q:base\"),i=new URL(s,r.baseURI),c=l.split(\"|\"),p=k(n);for(let r=0;r<c.length;r++){const l=c[r],u=performance.now(),[d,f,h]=l.split(\"#\"),q=n=>{if(n&&e.isConnected){const r=t=>{I(\"qerror\",{error:t,qBase:s,symbol:f,element:e,reqTime:u})};try{const o=n.call(h,t,e);if(A(o))return o.catch(r)}catch(e){return r(e)}}},b=(t=!0)=>j(n,e,s,i,d,f,u,t),g=p?void 0:b();if(p)a=!0,o.push(async()=>{await p,await q(d?await b():await b(!1)||await b())});else if(A(g))a=!0,o.push(()=>g.then(q));else if(a)a=!0,o.push(async()=>{await q(g||await b())});else{const e=q(g);A(e)&&(a=!0,o.push(()=>e))}}}},O=(e,t=l,n=!0)=>{const r=N(e.type),o=t+\":\"+r,s=u+r,i=[],a=[],c=[];let p=e.target;for(;p;)L(p)?(i.push(p),a.push(U(p,o,s)),p=p.parentElement):p=p.parentElement;for(let t=i.length-1;t>=0;t--)if(a[t]&&(D(i[t],e,o,c,r,n),e.cancelBubble))return void S(c);for(let t=0;t<i.length;t++)if(!a[t]&&(D(i[t],e,o,c,r,n),!e.bubbles||e.cancelBubble))return void S(c);S(c)},P=e=>O(e,p,!1),F=(e,t,n=!0)=>{const r=N(t.type),o=e+\":\"+r,s=v(\"[q-\"+CSS.escape(o)+\"]\"),i=[];for(let e=0;e<s.length;e++){const a=s[e];D(a,t,o,i,r,n)}S(i)},J=e=>{F(a,e)},M=e=>{F(c,e,!1)},Z=e=>{F(s,e)},z=e=>{F(i,e,!1)},G=()=>{const n=r.readyState;if(\"interactive\"==n||\"complete\"==n){if(t=1,q.forEach(y),h.has(\"d:qinit\")){h.delete(\"d:qinit\");const e=$(\"qinit\"),t=v(\"[q-d\\\\:qinit]\"),n=[];for(let r=0;r<t.length;r++){const o=t[r];D(o,e,\"d:qinit\",n),o.removeAttribute(\"q-d:qinit\")}S(n)}if(h.has(\"d:qidle\")&&(h.delete(\"d:qidle\"),(o.requestIdleCallback??o.setTimeout).bind(o)(()=>{const e=$(\"qidle\"),t=v(\"[q-d\\\\:qidle]\"),n=[];for(let r=0;r<t.length;r++){const o=t[r];D(o,e,\"d:qidle\",n),o.removeAttribute(\"q-d:qidle\")}S(n)})),h.has(\"e:qvisible\")){e||(e=new IntersectionObserver(t=>{const n=[];for(let r=0;r<t.length;r++){const o=t[r];o.isIntersecting&&(e.unobserve(o.target),D(o.target,$(\"qvisible\",o),\"e:qvisible\",n))}S(n)}));const t=v(\"[q-e\\\\:qvisible]:not([q\\\\:observed])\");for(let n=0;n<t.length;n++){const r=t[n];e.observe(r),r.setAttribute(\"q:observed\",\"true\")}}}},H=(...e)=>{for(let n=0;n<e.length;n++){const r=e[n];if(r===f)_(e[++n]);else if(\"string\"==typeof r){if(!h.has(r)){h.add(r);const{scope:e,eventName:n}=T(r),i=x(e),c=B(e);c===s?w(o,n,i?z:Z,!0,i):q.forEach(e=>w(e,n,c===a?i?M:J:i?P:O,!0,i)),1!==t||\"e:qvisible\"!==r&&\"d:qinit\"!==r&&\"d:qidle\"!==r||G()}}else q.has(r)||(h.forEach(e=>{const{scope:t,eventName:n}=T(e),o=x(t),i=B(t);i!==s&&w(r,n,i===a?o?M:J:o?P:O,!0,o)}),q.add(r))}},K=o._qwikEv;K?.roots||(Array.isArray(K)?H(...K):H(\"e:click\",\"e:input\"),o._qwikEv={events:h,roots:q,push:H},w(r,d,G),G())";
|
|
2
|
+
const QWIK_LOADER_DEBUG = "//#region packages/qwik/src/qwikloader.ts\nvar doc = document;\nvar win = window;\nvar windowPrefix = \"w\";\nvar passiveWindowPrefix = \"wp\";\nvar documentPrefix = \"d\";\nvar passiveDocumentPrefix = \"dp\";\nvar elementPrefix = \"e\";\nvar passiveElementPrefix = \"ep\";\nvar capturePrefix = \"capture:\";\nvar readyStateChange = \"readystatechange\";\nvar QwikEvContainerReady = 0;\nvar events = /* @__PURE__ */ new Set();\nvar roots = /* @__PURE__ */ new Set([doc]);\nvar symbols = /* @__PURE__ */ new Map();\nvar readyContainers = {};\nvar observer;\nvar hasInitialized;\nvar queuedTasks;\nvar nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nvar querySelectorAll = (query) => {\n\tconst elements = [];\n\troots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n\treturn elements;\n};\nvar addEventListener = (el, eventName, handler, capture = false, passive = false) => el.addEventListener(eventName, handler, {\n\tcapture,\n\tpassive\n});\nvar findShadowRoots = (fragment) => {\n\taddEventOrRoot(fragment);\n\tconst shadowRoots = nativeQuerySelectorAll(fragment, \"[q\\\\:shadowroot]\");\n\tfor (let i = 0; i < shadowRoots.length; i++) {\n\t\tconst shadowRoot = shadowRoots[i].shadowRoot;\n\t\tshadowRoot && findShadowRoots(shadowRoot);\n\t}\n};\nvar isPromise = (promise) => promise && typeof promise.then === \"function\";\nvar runTasks = async (tasks) => {\n\tfor (let i = 0; i < tasks.length; i++) await tasks[i]();\n};\nvar queueTasks = (tasks) => {\n\tif (tasks.length) {\n\t\tconst run = () => runTasks(tasks);\n\t\tqueuedTasks = queuedTasks ? queuedTasks.then(run, run) : run();\n\t}\n};\nvar resolveContainer = (containerEl) => {\n\tif (containerEl._qwikjson_ === void 0) {\n\t\tlet script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n\t\twhile (script) {\n\t\t\tif (script.tagName === \"SCRIPT\" && script.getAttribute(\"type\") === \"qwik/json\") {\n\t\t\t\tcontainerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, \"<$1\"));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tscript = script.previousElementSibling;\n\t\t}\n\t}\n};\nvar markContainerReady = (hash) => {\n\treadyContainers[hash] = 1;\n\temitEvent(readyStateChange);\n};\nvar waitForContainerReady = (container) => {\n\tconst hash = container.getAttribute(\"q:instance\");\n\treturn container.getAttribute(\"q:container\") === \"paused\" && doc.readyState === \"loading\" && !readyContainers[hash] && new Promise((resolve) => {\n\t\tconst ready = () => {\n\t\t\tif (doc.readyState !== \"loading\" || readyContainers[hash]) resolve();\n\t\t};\n\t\taddEventListener(doc, readyStateChange, ready);\n\t});\n};\nvar createEvent = (eventName, detail) => new CustomEvent(eventName, { detail });\nvar emitEvent = (eventName, detail) => {\n\tdoc.dispatchEvent(createEvent(eventName, detail));\n};\nvar camelToKebab = (str) => str.replace(/([A-Z-])/g, (a) => \"-\" + a.toLowerCase());\nvar kebabToCamel = (eventName) => eventName.replace(/-./g, (a) => a[1].toUpperCase());\nvar parseKebabEvent = (event) => {\n\tconst separatorIndex = event.indexOf(\":\");\n\treturn {\n\t\tscope: event.slice(0, separatorIndex),\n\t\teventName: kebabToCamel(event.slice(separatorIndex + 1))\n\t};\n};\nvar isPassiveScope = (scope) => scope.length === 2;\nvar getRootScope = (scope) => scope.charAt(0);\nvar isElementNode = (node) => !!node && node.nodeType === 1;\nvar isCaptureHandlerElement = (element, scopedKebabName, captureAttribute) => element.hasAttribute(captureAttribute) && (!!element._qDispatch?.[scopedKebabName] || element.hasAttribute(\"q-\" + scopedKebabName));\nvar resolveHandler = (container, element, qBase, base, chunk, symbol, reqTime, reportSyncError = true) => {\n\tconst eventData = {\n\t\tqBase,\n\t\tsymbol,\n\t\telement,\n\t\treqTime\n\t};\n\tif (!chunk) {\n\t\tconst handler = (doc[\"qFuncs_\" + container.getAttribute(\"q:instance\")] || [])[+symbol];\n\t\tif (!handler && reportSyncError) {\n\t\t\tconst error = /* @__PURE__ */ new Error(\"sym:\" + symbol);\n\t\t\temitEvent(\"qerror\", {\n\t\t\t\timportError: \"sync\",\n\t\t\t\terror,\n\t\t\t\t...eventData\n\t\t\t});\n\t\t\tconsole.error(error);\n\t\t}\n\t\treturn handler;\n\t}\n\tconst key = `${symbol}|${qBase}|${chunk}`;\n\tconst handler = symbols.get(key);\n\tif (handler) return handler;\n\tconst href = new URL(chunk, base).href;\n\tconst module = import(\n\t\t\t\thref\n);\n\tresolveContainer(container);\n\treturn module.then((module) => {\n\t\tconst handler = module[symbol];\n\t\tif (!handler) {\n\t\t\tconst error = /* @__PURE__ */ new Error(`${symbol} not in ${href}`);\n\t\t\temitEvent(\"qerror\", {\n\t\t\t\timportError: \"no-symbol\",\n\t\t\t\terror,\n\t\t\t\t...eventData\n\t\t\t});\n\t\t\tconsole.error(error);\n\t\t} else {\n\t\t\tsymbols.set(key, handler);\n\t\t\temitEvent(\"qsymbol\", eventData);\n\t\t}\n\t\treturn handler;\n\t}, (error) => {\n\t\temitEvent(\"qerror\", {\n\t\t\timportError: \"async\",\n\t\t\terror,\n\t\t\t...eventData\n\t\t});\n\t\tconsole.error(error);\n\t});\n};\n/**\n* Dispatch an event by invoking QRL handlers. If there are multiple handlers, they are awaited in\n* order.\n*/\nvar dispatch = (element, ev, scopedKebabName, tasks, kebabName, allowPreventDefault = true) => {\n\tlet defer = false;\n\tif (kebabName) {\n\t\tif (allowPreventDefault && element.hasAttribute(\"preventdefault:\" + kebabName)) ev.preventDefault();\n\t\tif (element.hasAttribute(\"stoppropagation:\" + kebabName)) ev.stopPropagation();\n\t}\n\tconst handlers = element._qDispatch?.[scopedKebabName];\n\tif (handlers) {\n\t\tif (typeof handlers === \"function\") {\n\t\t\tconst run = () => handlers(ev, element);\n\t\t\tif (defer) tasks.push(async () => {\n\t\t\t\tconst result = run();\n\t\t\t\tif (isPromise(result)) await result;\n\t\t\t});\n\t\t\telse {\n\t\t\t\tconst result = run();\n\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\tdefer = true;\n\t\t\t\t\ttasks.push(() => result);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (handlers.length) for (let i = 0; i < handlers.length; i++) {\n\t\t\tconst handler = handlers[i];\n\t\t\tif (handler) {\n\t\t\t\tconst run = () => handler(ev, element);\n\t\t\t\tif (defer) tasks.push(async () => {\n\t\t\t\t\tconst result = run();\n\t\t\t\t\tif (isPromise(result)) await result;\n\t\t\t\t});\n\t\t\t\telse {\n\t\t\t\t\tconst result = run();\n\t\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\t\tdefer = true;\n\t\t\t\t\t\ttasks.push(() => result);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\tconst attrValue = element.getAttribute(\"q-\" + scopedKebabName);\n\tif (attrValue) {\n\t\tconst container = element.closest(\"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\");\n\t\tconst qBase = container.getAttribute(\"q:base\");\n\t\tconst base = new URL(qBase, doc.baseURI);\n\t\tconst qrls = attrValue.split(\"|\");\n\t\tconst waitForReady = waitForContainerReady(container);\n\t\tfor (let i = 0; i < qrls.length; i++) {\n\t\t\tconst qrl = qrls[i];\n\t\t\tconst reqTime = performance.now();\n\t\t\tconst [chunk, symbol, capturedIds] = qrl.split(\"#\");\n\t\t\tconst run = (handler) => {\n\t\t\t\tif (handler && element.isConnected) {\n\t\t\t\t\tconst onError = (error) => {\n\t\t\t\t\t\temitEvent(\"qerror\", {\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\tqBase,\n\t\t\t\t\t\t\tsymbol,\n\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\treqTime\n\t\t\t\t\t\t});\n\t\t\t\t\t};\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = handler.call(capturedIds, ev, element);\n\t\t\t\t\t\tif (isPromise(result)) return result.catch(onError);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treturn onError(error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst resolve = (reportSyncError = true) => resolveHandler(container, element, qBase, base, chunk, symbol, reqTime, reportSyncError);\n\t\t\tconst handler = waitForReady ? void 0 : resolve();\n\t\t\tif (waitForReady) {\n\t\t\t\tdefer = true;\n\t\t\t\ttasks.push(async () => {\n\t\t\t\t\tawait waitForReady;\n\t\t\t\t\tawait run(chunk ? await resolve() : await resolve(false) || await resolve());\n\t\t\t\t});\n\t\t\t} else if (isPromise(handler)) {\n\t\t\t\tdefer = true;\n\t\t\t\ttasks.push(() => handler.then(run));\n\t\t\t} else if (defer) {\n\t\t\t\tdefer = true;\n\t\t\t\ttasks.push(async () => {\n\t\t\t\t\tawait run(handler || await resolve());\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst result = run(handler);\n\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\tdefer = true;\n\t\t\t\t\ttasks.push(() => result);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n/**\n* Event handler responsible for processing element events.\n*\n* If browser emits an event, the `eventProcessor` walks the DOM tree looking for corresponding\n* `(${event.type})`. If found the event's URL is parsed and `import()`ed.\n*\n* @param ev - Browser event.\n*/\nvar processElementEvent = (ev, scope = elementPrefix, allowPreventDefault = true) => {\n\tconst kebabName = camelToKebab(ev.type);\n\tconst scopedKebabName = scope + \":\" + kebabName;\n\tconst captureAttribute = capturePrefix + kebabName;\n\tconst elements = [];\n\tconst captureHandlers = [];\n\tconst tasks = [];\n\tlet current = ev.target;\n\twhile (current) if (isElementNode(current)) {\n\t\telements.push(current);\n\t\tcaptureHandlers.push(isCaptureHandlerElement(current, scopedKebabName, captureAttribute));\n\t\tcurrent = current.parentElement;\n\t} else current = current.parentElement;\n\tfor (let i = elements.length - 1; i >= 0; i--) if (captureHandlers[i]) {\n\t\tdispatch(elements[i], ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n\t\tif (ev.cancelBubble) {\n\t\t\tqueueTasks(tasks);\n\t\t\treturn;\n\t\t}\n\t}\n\tfor (let i = 0; i < elements.length; i++) if (!captureHandlers[i]) {\n\t\tdispatch(elements[i], ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n\t\tif (!ev.bubbles || ev.cancelBubble) {\n\t\t\tqueueTasks(tasks);\n\t\t\treturn;\n\t\t}\n\t}\n\tqueueTasks(tasks);\n};\nvar processPassiveElementEvent = (ev) => processElementEvent(ev, passiveElementPrefix, false);\nvar broadcast = (scope, ev, allowPreventDefault = true) => {\n\tconst kebabName = camelToKebab(ev.type);\n\tconst scopedKebabName = scope + \":\" + kebabName;\n\tconst elements = querySelectorAll(\"[q-\" + CSS.escape(scopedKebabName) + \"]\");\n\tconst tasks = [];\n\tfor (let i = 0; i < elements.length; i++) {\n\t\tconst el = elements[i];\n\t\tdispatch(el, ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n\t}\n\tqueueTasks(tasks);\n};\n/**\n* Event handler responsible for processing browser events.\n*\n* If browser emits an event, the `eventProcessor` walks the DOM tree looking for corresponding\n* `(${event.type})`. If found the event's URL is parsed and `import()`ed.\n*\n* @param ev - Browser event.\n*/\nvar processDocumentEvent = (ev) => {\n\tbroadcast(documentPrefix, ev);\n};\nvar processPassiveDocumentEvent = (ev) => {\n\tbroadcast(passiveDocumentPrefix, ev, false);\n};\nvar processWindowEvent = (ev) => {\n\tbroadcast(windowPrefix, ev);\n};\nvar processPassiveWindowEvent = (ev) => {\n\tbroadcast(passiveWindowPrefix, ev, false);\n};\n/**\n* Called when the document is ready and whenever a container is added, so make this idempotent. For\n* qidle and qinit we remove the attributes immediately, and for qvisible we add an attribute\n*/\nvar processReadyStateChange = () => {\n\tconst readyState = doc.readyState;\n\tif (readyState == \"interactive\" || readyState == \"complete\") {\n\t\thasInitialized = 1;\n\t\troots.forEach(findShadowRoots);\n\t\tif (events.has(\"d:qinit\")) {\n\t\t\tevents.delete(\"d:qinit\");\n\t\t\tconst ev = createEvent(\"qinit\");\n\t\t\tconst elements = querySelectorAll(\"[q-d\\\\:qinit]\");\n\t\t\tconst tasks = [];\n\t\t\tfor (let i = 0; i < elements.length; i++) {\n\t\t\t\tconst el = elements[i];\n\t\t\t\tdispatch(el, ev, \"d:qinit\", tasks);\n\t\t\t\tel.removeAttribute(\"q-d:qinit\");\n\t\t\t}\n\t\t\tqueueTasks(tasks);\n\t\t}\n\t\tif (events.has(\"d:qidle\")) {\n\t\t\tevents.delete(\"d:qidle\");\n\t\t\t(win.requestIdleCallback ?? win.setTimeout).bind(win)(() => {\n\t\t\t\tconst ev = createEvent(\"qidle\");\n\t\t\t\tconst elements = querySelectorAll(\"[q-d\\\\:qidle]\");\n\t\t\t\tconst tasks = [];\n\t\t\t\tfor (let i = 0; i < elements.length; i++) {\n\t\t\t\t\tconst el = elements[i];\n\t\t\t\t\tdispatch(el, ev, \"d:qidle\", tasks);\n\t\t\t\t\tel.removeAttribute(\"q-d:qidle\");\n\t\t\t\t}\n\t\t\t\tqueueTasks(tasks);\n\t\t\t});\n\t\t}\n\t\tif (events.has(\"e:qvisible\")) {\n\t\t\tobserver || (observer = new IntersectionObserver((entries) => {\n\t\t\t\tconst tasks = [];\n\t\t\t\tfor (let i = 0; i < entries.length; i++) {\n\t\t\t\t\tconst entry = entries[i];\n\t\t\t\t\tif (entry.isIntersecting) {\n\t\t\t\t\t\tobserver.unobserve(entry.target);\n\t\t\t\t\t\tdispatch(entry.target, createEvent(\"qvisible\", entry), \"e:qvisible\", tasks);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tqueueTasks(tasks);\n\t\t\t}));\n\t\t\tconst elements = querySelectorAll(\"[q-e\\\\:qvisible]:not([q\\\\:observed])\");\n\t\t\tfor (let i = 0; i < elements.length; i++) {\n\t\t\t\tconst el = elements[i];\n\t\t\t\tobserver.observe(el);\n\t\t\t\tel.setAttribute(\"q:observed\", \"true\");\n\t\t\t}\n\t\t}\n\t}\n};\nvar addEventOrRoot = (...eventNames) => {\n\tfor (let i = 0; i < eventNames.length; i++) {\n\t\tconst eventNameOrRoot = eventNames[i];\n\t\tif (eventNameOrRoot === QwikEvContainerReady) markContainerReady(eventNames[++i]);\n\t\telse if (typeof eventNameOrRoot === \"string\") {\n\t\t\tif (!events.has(eventNameOrRoot)) {\n\t\t\t\tevents.add(eventNameOrRoot);\n\t\t\t\tconst { scope, eventName } = parseKebabEvent(eventNameOrRoot);\n\t\t\t\tconst passive = isPassiveScope(scope);\n\t\t\t\tconst rootScope = getRootScope(scope);\n\t\t\t\tif (rootScope === windowPrefix) addEventListener(win, eventName, passive ? processPassiveWindowEvent : processWindowEvent, true, passive);\n\t\t\t\telse roots.forEach((root) => addEventListener(root, eventName, rootScope === documentPrefix ? passive ? processPassiveDocumentEvent : processDocumentEvent : passive ? processPassiveElementEvent : processElementEvent, true, passive));\n\t\t\t\tif (hasInitialized === 1 && (eventNameOrRoot === \"e:qvisible\" || eventNameOrRoot === \"d:qinit\" || eventNameOrRoot === \"d:qidle\")) processReadyStateChange();\n\t\t\t}\n\t\t} else if (!roots.has(eventNameOrRoot)) {\n\t\t\tevents.forEach((kebabEventName) => {\n\t\t\t\tconst { scope, eventName } = parseKebabEvent(kebabEventName);\n\t\t\t\tconst passive = isPassiveScope(scope);\n\t\t\t\tconst rootScope = getRootScope(scope);\n\t\t\t\tif (rootScope !== windowPrefix) addEventListener(eventNameOrRoot, eventName, rootScope === documentPrefix ? passive ? processPassiveDocumentEvent : processDocumentEvent : passive ? processPassiveElementEvent : processElementEvent, true, passive);\n\t\t\t});\n\t\t\troots.add(eventNameOrRoot);\n\t\t}\n\t}\n};\nvar _qwikEv = win._qwikEv;\nif (!_qwikEv?.roots) {\n\tif (Array.isArray(_qwikEv)) addEventOrRoot(..._qwikEv);\n\telse addEventOrRoot(\"e:click\", \"e:input\");\n\twin._qwikEv = {\n\t\tevents,\n\t\troots,\n\t\tpush: addEventOrRoot\n\t};\n\taddEventListener(doc, readyStateChange, processReadyStateChange);\n\tprocessReadyStateChange();\n}\n//#endregion";
|
|
3
3
|
export { QWIK_LOADER, QWIK_LOADER_DEBUG };
|
package/dist/loader/package.json
CHANGED
package/dist/optimizer.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ export declare enum ExperimentalFeatures {
|
|
|
31
31
|
show = "show",
|
|
32
32
|
/** Enable the Suspense fallback primitive */
|
|
33
33
|
suspense = "suspense",
|
|
34
|
+
/** Enable the ErrorBoundary primitive */
|
|
35
|
+
errorBoundary = "errorBoundary",
|
|
34
36
|
/** Enable the Valibot form validation */
|
|
35
37
|
valibot = "valibot",
|
|
36
38
|
/** Disable SPA navigation handler in Qwik Router */
|
|
@@ -456,13 +458,7 @@ declare interface QwikVitePluginCommonOptions {
|
|
|
456
458
|
* to be stable between releases
|
|
457
459
|
*/
|
|
458
460
|
experimental?: (keyof typeof ExperimentalFeatures)[];
|
|
459
|
-
/**
|
|
460
|
-
* Disables automatic preloading of font assets (WOFF/WOFF2/TTF) found in the build output. When
|
|
461
|
-
* enabled, the plugin will not add `<link rel="preload">` tags for font files in the document
|
|
462
|
-
* head.
|
|
463
|
-
*
|
|
464
|
-
* Disabling may impact Cumulative Layout Shift (CLS) metrics.
|
|
465
|
-
*/
|
|
461
|
+
/** @deprecated No longer used. Automatic font preloading has been removed. */
|
|
466
462
|
disableFontPreload?: boolean;
|
|
467
463
|
}
|
|
468
464
|
|
package/dist/optimizer.mjs
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.42-dev+3473a49
|
|
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
|
|
@@ -168,7 +168,9 @@ var o = /* @__PURE__ */ new Set([
|
|
|
168
168
|
"_suT",
|
|
169
169
|
"_reR",
|
|
170
170
|
"_reC",
|
|
171
|
-
"_reT"
|
|
171
|
+
"_reT",
|
|
172
|
+
"_ebC",
|
|
173
|
+
"_ebR"
|
|
172
174
|
]);
|
|
173
175
|
function s(e) {
|
|
174
176
|
let t = e.symbols;
|
|
@@ -1215,7 +1217,7 @@ var V = /\w/, Se = class {
|
|
|
1215
1217
|
"browser",
|
|
1216
1218
|
"event$"
|
|
1217
1219
|
], He = /* @__PURE__ */ function(e) {
|
|
1218
|
-
return e.each = "each", e.show = "show", e.suspense = "suspense", e.valibot = "valibot", e.noSPA = "noSPA", e.insights = "insights", e.blockSSR = "blockSSR", e;
|
|
1220
|
+
return e.each = "each", e.show = "show", e.suspense = "suspense", e.errorBoundary = "errorBoundary", e.valibot = "valibot", e.noSPA = "noSPA", e.insights = "insights", e.blockSSR = "blockSSR", e;
|
|
1219
1221
|
}({});
|
|
1220
1222
|
function Ue(t = {}) {
|
|
1221
1223
|
let n = `${Math.round(Math.random() * 899) + 100}`, i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), l = null, u, d = () => {}, f = {
|
|
@@ -2609,36 +2611,32 @@ var Xr = "@qwik-worker-core", Zr = "\nexport { setPlatform } from '@qwik.dev/cor
|
|
|
2609
2611
|
".less",
|
|
2610
2612
|
".styl",
|
|
2611
2613
|
".stylus"
|
|
2612
|
-
], ui =
|
|
2613
|
-
|
|
2614
|
-
"
|
|
2615
|
-
".ttf"
|
|
2616
|
-
], di = "@qwik-hmr-bridge", fi = "\n // HMR bridge: connects Vite HMR events to Qwik's component re-rendering.\n if (import.meta.hot) {\n let timeout;\n import.meta.hot.on(\"qwik:hmr\", (data) => {\n if (data.t === document.__hmrT) {\n console.log(\"Received duplicate HMR update, ignoring\", data.files);\n return;\n }\n clearTimeout(timeout);\n document.__hmrT = data.t;\n document.__hmrDone = 0;\n document.dispatchEvent(\n new CustomEvent(\"qHmr\", { detail: data })\n );\n timeout = setTimeout(() => {\n console.log(document.__hmrDone, document.__hmrT);\n if (document.__hmrDone !== document.__hmrT) {\n console.log(\"HMR update did not match active code, reloading the page\", location.href);\n location.reload();\n }\n }, 500);\n });\n }\n";
|
|
2617
|
-
function pi(e = {}) {
|
|
2618
|
-
let t = "serve", n = null, r = "/", i = null, a = null, o = null, s = null, c = "development", l, u, d = e.client?.outDir, f = null, p = e.fileFilter ? (t, n) => Je.test(t) || e.fileFilter(t, n) : () => !0, m = e.disableFontPreload ?? !1, h = [], g = Ue(e.optimizerOptions), _ = /* @__PURE__ */ new Set();
|
|
2614
|
+
], ui = "@qwik-hmr-bridge", di = "\n // HMR bridge: connects Vite HMR events to Qwik's component re-rendering.\n if (import.meta.hot) {\n let timeout;\n import.meta.hot.on(\"qwik:hmr\", (data) => {\n if (data.t === document.__hmrT) {\n console.log(\"Received duplicate HMR update, ignoring\", data.files);\n return;\n }\n clearTimeout(timeout);\n document.__hmrT = data.t;\n document.__hmrDone = 0;\n document.dispatchEvent(\n new CustomEvent(\"qHmr\", { detail: data })\n );\n timeout = setTimeout(() => {\n console.log(document.__hmrDone, document.__hmrT);\n if (document.__hmrDone !== document.__hmrT) {\n console.log(\"HMR update did not match active code, reloading the page\", location.href);\n location.reload();\n }\n }, 500);\n });\n }\n";
|
|
2615
|
+
function fi(e = {}) {
|
|
2616
|
+
let t = "serve", n = null, r = "/", i = null, a = null, o = null, s = null, c = "development", l, u, d = e.client?.outDir, f = null, p = e.fileFilter ? (t, n) => Je.test(t) || e.fileFilter(t, n) : () => !0, m = [], h = Ue(e.optimizerOptions), g = /* @__PURE__ */ new Set();
|
|
2619
2617
|
return [
|
|
2620
2618
|
{
|
|
2621
2619
|
name: "vite-plugin-qwik",
|
|
2622
2620
|
enforce: "pre",
|
|
2623
2621
|
api: {
|
|
2624
|
-
getOptimizer: () =>
|
|
2625
|
-
getOptions: () =>
|
|
2626
|
-
getManifest: () =>
|
|
2627
|
-
getRootDir: () =>
|
|
2622
|
+
getOptimizer: () => h.getOptimizer(),
|
|
2623
|
+
getOptions: () => h.getOptions(),
|
|
2624
|
+
getManifest: () => h.getOptions().manifestInput,
|
|
2625
|
+
getRootDir: () => h.getOptions().rootDir,
|
|
2628
2626
|
getClientOutDir: () => n,
|
|
2629
2627
|
getClientPublicOutDir: () => i,
|
|
2630
|
-
registerBundleGraphAdder: (e) =>
|
|
2628
|
+
registerBundleGraphAdder: (e) => g.add(e),
|
|
2631
2629
|
onSegment: (e) => {
|
|
2632
|
-
|
|
2630
|
+
h.segmentCallbacks.add(e);
|
|
2633
2631
|
},
|
|
2634
2632
|
_oldDevSsrServer: () => e.devSsrServer
|
|
2635
2633
|
},
|
|
2636
2634
|
async config(r, l) {
|
|
2637
|
-
await
|
|
2635
|
+
await h.init();
|
|
2638
2636
|
let u;
|
|
2639
|
-
u = l.mode === "lib" ? "lib" : r.build?.ssr || l.mode === "ssr" ? "ssr" : l.mode === "test" || l.mode === "benchmark" ? "test" : "client", t = l.command, c = l.mode === "production" ? "production" : l.mode === "development" ? "development" : t === "build" && u === "client" ? "production" : "development",
|
|
2640
|
-
let p = u === "ssr" ? typeof r.build?.ssr == "string" ? r.build.ssr : e.ssr?.input : void 0, m = u === "client" ? e.client?.input : void 0,
|
|
2641
|
-
|
|
2637
|
+
u = l.mode === "lib" ? "lib" : r.build?.ssr || l.mode === "ssr" ? "ssr" : l.mode === "test" || l.mode === "benchmark" ? "test" : "client", t = l.command, c = l.mode === "production" ? "production" : l.mode === "development" ? "development" : t === "build" && u === "client" ? "production" : "development", h.debug(`vite config(), command: ${t}, env.mode: ${l.mode}`), t === "serve" ? e.entryStrategy = { type: "segment" } : u === "ssr" ? e.entryStrategy = { type: "hoist" } : u === "lib" && (e.entryStrategy = { type: "inline" });
|
|
2638
|
+
let p = u === "ssr" ? typeof r.build?.ssr == "string" ? r.build.ssr : e.ssr?.input : void 0, m = u === "client" ? e.client?.input : void 0, g = r.build?.rolldownOptions?.input || m || p;
|
|
2639
|
+
g && typeof g == "string" && (g = [g]);
|
|
2642
2640
|
let _ = {
|
|
2643
2641
|
target: u,
|
|
2644
2642
|
buildMode: c,
|
|
@@ -2657,12 +2655,12 @@ function pi(e = {}) {
|
|
|
2657
2655
|
sourcemap: !!r.build?.sourcemap,
|
|
2658
2656
|
lint: e.lint,
|
|
2659
2657
|
experimental: e.experimental,
|
|
2660
|
-
input:
|
|
2658
|
+
input: g,
|
|
2661
2659
|
manifestInput: e.ssr?.manifestInput,
|
|
2662
2660
|
manifestInputPath: e.ssr?.manifestInputPath,
|
|
2663
2661
|
manifestOutput: e.client?.manifestOutput
|
|
2664
|
-
}, v = await
|
|
2665
|
-
|
|
2662
|
+
}, v = await h.normalizeOptions(_);
|
|
2663
|
+
g ||= v.input, f = _, a = v.srcDir, o = v.rootDir, e.csr || (n = v.clientOutDir, i = n, s = v.ssrOutDir);
|
|
2666
2664
|
let y = c === "development", b = "globalThis.qDev", x = "globalThis.qTest", S = "globalThis.qInspector", ee = r?.define?.[b] ?? y, C = r?.define?.[S] ?? y, w = {
|
|
2667
2665
|
ssr: { noExternal: [
|
|
2668
2666
|
G,
|
|
@@ -2698,14 +2696,14 @@ function pi(e = {}) {
|
|
|
2698
2696
|
J,
|
|
2699
2697
|
"@builder.io/qwik"
|
|
2700
2698
|
],
|
|
2701
|
-
entries:
|
|
2699
|
+
entries: g && (typeof g == "string" ? [g] : typeof g == "object" ? Object.values(g) : g)
|
|
2702
2700
|
},
|
|
2703
2701
|
build: {
|
|
2704
2702
|
modulePreload: !1,
|
|
2705
2703
|
dynamicImportVarsOptions: { exclude: [/./] },
|
|
2706
2704
|
rolldownOptions: {
|
|
2707
2705
|
external: ["node:async_hooks"],
|
|
2708
|
-
input:
|
|
2706
|
+
input: g,
|
|
2709
2707
|
experimental: { attachDebugInfo: r.build?.rolldownOptions?.experimental?.attachDebugInfo ?? "none" }
|
|
2710
2708
|
}
|
|
2711
2709
|
},
|
|
@@ -2718,7 +2716,7 @@ function pi(e = {}) {
|
|
|
2718
2716
|
};
|
|
2719
2717
|
return e.csr || (w.build.cssCodeSplit = !1, v.outDir && (w.build.outDir = v.outDir), w.build.rolldownOptions = {
|
|
2720
2718
|
...w.build.rolldownOptions,
|
|
2721
|
-
output: at(
|
|
2719
|
+
output: at(h, r.build?.rolldownOptions?.output),
|
|
2722
2720
|
preserveEntrySignatures: "allow-extension"
|
|
2723
2721
|
}, v.target === "ssr" ? t === "build" && (w.publicDir = !1, w.build.ssr = !0, r.build?.minify == null && c === "production" && (w.build.minify = !0)) : v.target === "client" || (v.target === "lib" ? (w.build.minify = !1, w.build.rolldownOptions.external = [
|
|
2724
2722
|
G,
|
|
@@ -2744,7 +2742,7 @@ function pi(e = {}) {
|
|
|
2744
2742
|
},
|
|
2745
2743
|
async configResolved(n) {
|
|
2746
2744
|
if (r = n.base, !(r.startsWith("/") && r.endsWith("/"))) throw Error("vite's config.base must begin and end with /");
|
|
2747
|
-
if (n.build.sourcemap && e.optimizerOptions?.sourcemap === void 0 &&
|
|
2745
|
+
if (n.build.sourcemap && e.optimizerOptions?.sourcemap === void 0 && h.setSourceMapSupport(!0), f ? h.normalizeOptions(f) : h.normalizeOptions(e), t === "build" && !e.csr && h.getOptions().target === "client") {
|
|
2748
2746
|
let e = ["vite:build-import-analysis", "native:import-analysis-build"], t = n.plugins;
|
|
2749
2747
|
for (let n of e) {
|
|
2750
2748
|
let e = t.findIndex((e) => e?.name === n);
|
|
@@ -2753,26 +2751,26 @@ function pi(e = {}) {
|
|
|
2753
2751
|
}
|
|
2754
2752
|
},
|
|
2755
2753
|
async buildStart() {
|
|
2756
|
-
|
|
2754
|
+
m.length = 0;
|
|
2757
2755
|
let e = this.resolve.bind(this);
|
|
2758
|
-
await
|
|
2756
|
+
await h.validateSource(e), h.onDiagnostics((e, t, n) => {
|
|
2759
2757
|
e.forEach((e) => {
|
|
2760
|
-
let r =
|
|
2758
|
+
let r = h.normalizePath(t.sys.path.join(n, e.file));
|
|
2761
2759
|
e.category === "error" ? this.error(ct(r, e)) : this.warn(ct(r, e));
|
|
2762
2760
|
});
|
|
2763
|
-
}), await
|
|
2761
|
+
}), await h.buildStart(this), u = void 0, t === "build" && h.getOptions().target === "client" && (u = ei(this));
|
|
2764
2762
|
},
|
|
2765
2763
|
resolveId(e, t, n) {
|
|
2766
|
-
if (e.endsWith(
|
|
2764
|
+
if (e.endsWith(ui)) return ui;
|
|
2767
2765
|
if (Qr(e)) return Xr;
|
|
2768
2766
|
let r = p(e, "resolveId");
|
|
2769
|
-
return A(e) || !r ? null :
|
|
2767
|
+
return A(e) || !r ? null : h.resolveId(this, e, t, n);
|
|
2770
2768
|
},
|
|
2771
2769
|
load(e, n) {
|
|
2772
|
-
if (e ===
|
|
2770
|
+
if (e === ui) return { code: di };
|
|
2773
2771
|
if (e === "@qwik-worker-core") return $r();
|
|
2774
2772
|
let r = p(e, "load");
|
|
2775
|
-
return A(e) || !r ? null : (e =
|
|
2773
|
+
return A(e) || !r ? null : (e = h.normalizePath(e), t === "serve" && e.endsWith("@qwik-client-manifest") ? { code: "export const manifest = undefined;" } : h.load(this, e, n));
|
|
2776
2774
|
},
|
|
2777
2775
|
transform(e, t, n) {
|
|
2778
2776
|
if (t.includes(".vite/deps/") && e.slice(0, 5e3).includes("qwik") && /import[^\n]*qwik[^\n]*\n/.test(e)) {
|
|
@@ -2787,7 +2785,7 @@ function pi(e = {}) {
|
|
|
2787
2785
|
👉 ${e}\n\n==============\n\n`);
|
|
2788
2786
|
}
|
|
2789
2787
|
let r = p(t, "transform"), i = t.includes("?raw");
|
|
2790
|
-
return A(t) || !r || i ? null :
|
|
2788
|
+
return A(t) || !r || i ? null : h.transform(this, e, t, n);
|
|
2791
2789
|
}
|
|
2792
2790
|
},
|
|
2793
2791
|
{
|
|
@@ -2798,52 +2796,38 @@ function pi(e = {}) {
|
|
|
2798
2796
|
async handler(e, t) {
|
|
2799
2797
|
let n = this.environment.config.consumer === "client", i = this.environment.config.consumer === "server";
|
|
2800
2798
|
if (n) {
|
|
2801
|
-
let e =
|
|
2799
|
+
let e = h.getOptions();
|
|
2802
2800
|
for (let [n, i] of Object.entries(t)) if (i.type === "asset") {
|
|
2803
2801
|
let t = r + n;
|
|
2804
|
-
|
|
2802
|
+
li.some((e) => n.endsWith(e)) && (typeof i.source == "string" && i.source.length < e.inlineStylesUpToBytes ? m.push({
|
|
2805
2803
|
tag: "style",
|
|
2806
2804
|
location: "head",
|
|
2807
2805
|
attributes: {
|
|
2808
2806
|
"data-src": t,
|
|
2809
2807
|
dangerouslySetInnerHTML: i.source
|
|
2810
2808
|
}
|
|
2811
|
-
}) :
|
|
2809
|
+
}) : m.push({
|
|
2812
2810
|
tag: "link",
|
|
2813
2811
|
location: "head",
|
|
2814
2812
|
attributes: {
|
|
2815
2813
|
rel: "stylesheet",
|
|
2816
2814
|
href: t
|
|
2817
2815
|
}
|
|
2818
|
-
});
|
|
2819
|
-
else {
|
|
2820
|
-
let e = ui.find((e) => n.endsWith(e));
|
|
2821
|
-
e && !m && h.unshift({
|
|
2822
|
-
tag: "link",
|
|
2823
|
-
location: "head",
|
|
2824
|
-
attributes: {
|
|
2825
|
-
rel: "preload",
|
|
2826
|
-
href: t,
|
|
2827
|
-
as: "font",
|
|
2828
|
-
type: `font/${e.slice(1)}`,
|
|
2829
|
-
crossorigin: ""
|
|
2830
|
-
}
|
|
2831
|
-
});
|
|
2832
|
-
}
|
|
2816
|
+
}));
|
|
2833
2817
|
}
|
|
2834
|
-
let n = je(await
|
|
2835
|
-
injections:
|
|
2818
|
+
let n = je(await h.generateManifest(this, t, g, {
|
|
2819
|
+
injections: m,
|
|
2836
2820
|
platform: { vite: "" }
|
|
2837
2821
|
}), r);
|
|
2838
2822
|
for (let e of Object.values(t)) e.type === "chunk" && (e.code = Ae(e.code, n));
|
|
2839
2823
|
ni(this, t, u);
|
|
2840
|
-
} else i && ri(t,
|
|
2824
|
+
} else i && ri(t, h.getOptions().manifestInput);
|
|
2841
2825
|
}
|
|
2842
2826
|
},
|
|
2843
2827
|
async writeBundle(e, t) {
|
|
2844
|
-
let n =
|
|
2828
|
+
let n = h.getOptions();
|
|
2845
2829
|
if (this.environment.config.consumer === "server") {
|
|
2846
|
-
let r =
|
|
2830
|
+
let r = h.getSys();
|
|
2847
2831
|
if (r.env === "node" || r.env === "bun" || r.env === "deno") {
|
|
2848
2832
|
let i = Object.keys(t);
|
|
2849
2833
|
await Promise.all(i.map(async (t) => {
|
|
@@ -2864,19 +2848,19 @@ function pi(e = {}) {
|
|
|
2864
2848
|
}
|
|
2865
2849
|
},
|
|
2866
2850
|
transformIndexHtml() {
|
|
2867
|
-
if (t === "serve") return bt(
|
|
2851
|
+
if (t === "serve") return bt(h.getOptions(), r);
|
|
2868
2852
|
},
|
|
2869
2853
|
configureServer(t) {
|
|
2870
|
-
l = t,
|
|
2854
|
+
l = t, h.configureServer(t), (e?.devTools?.imageDevTools ?? !0) && t.middlewares.use(qr(h.getSys(), o, a));
|
|
2871
2855
|
},
|
|
2872
2856
|
configurePreviewServer(e) {
|
|
2873
2857
|
return async () => {
|
|
2874
|
-
let t =
|
|
2858
|
+
let t = h.getSys(), n = h.getPath();
|
|
2875
2859
|
await vt(e.middlewares, s, t, n);
|
|
2876
2860
|
};
|
|
2877
2861
|
},
|
|
2878
2862
|
hotUpdate(t) {
|
|
2879
|
-
|
|
2863
|
+
h.hotUpdate(this.environment, t);
|
|
2880
2864
|
let n = e?.devTools?.hmr ?? !0;
|
|
2881
2865
|
if (this.environment.name === "ssr" && t.modules.length) {
|
|
2882
2866
|
if (n) {
|
|
@@ -2899,15 +2883,15 @@ function pi(e = {}) {
|
|
|
2899
2883
|
},
|
|
2900
2884
|
onLog(e, t) {
|
|
2901
2885
|
if (t.plugin == "vite-plugin-qwik") {
|
|
2902
|
-
let n =
|
|
2886
|
+
let n = mi[e] || $.White, r = (t.frame || "").split("\n").map((e) => (e.match(/^\s*\^\s*$/) ? $.BrightWhite : $.BrightBlack) + e);
|
|
2903
2887
|
return console[e](`${n}%s\n${$.BrightWhite}%s\n%s${$.RESET}`, `[${t.plugin}](${e}): ${t.message}\n`, ` ${t?.loc?.file}:${t?.loc?.line}:${t?.loc?.column}\n`, ` ${r.join("\n ")}\n`), !1;
|
|
2904
2888
|
}
|
|
2905
2889
|
}
|
|
2906
2890
|
},
|
|
2907
|
-
|
|
2891
|
+
pi()
|
|
2908
2892
|
];
|
|
2909
2893
|
}
|
|
2910
|
-
async function
|
|
2894
|
+
async function pi() {
|
|
2911
2895
|
let e, t, n = !1;
|
|
2912
2896
|
async function r() {
|
|
2913
2897
|
if (n) return !0;
|
|
@@ -3014,10 +2998,10 @@ var $ = {
|
|
|
3014
2998
|
BrightCyan: "\x1B[96m",
|
|
3015
2999
|
BrightWhite: "\x1B[97m",
|
|
3016
3000
|
RESET: "\x1B[0m"
|
|
3017
|
-
},
|
|
3001
|
+
}, mi = {
|
|
3018
3002
|
warn: $.Yellow,
|
|
3019
3003
|
info: $.Cyan,
|
|
3020
3004
|
debug: $.BrightBlack
|
|
3021
3005
|
};
|
|
3022
3006
|
//#endregion
|
|
3023
|
-
export { it as qwikRolldown, lt as qwikRollup,
|
|
3007
|
+
export { it as qwikRolldown, lt as qwikRollup, fi as qwikVite };
|
|
@@ -9,10 +9,10 @@ var Q_ORDER_ATTR = "q:o";
|
|
|
9
9
|
var Q_CONTAINER_SELECTOR = "[q\\:container]:not([q\\:container=html]):not([q\\:container=text])";
|
|
10
10
|
var installOutOfOrderExecutor = (doc) => {
|
|
11
11
|
const groups = /* @__PURE__ */ new WeakMap();
|
|
12
|
-
const process = (boundaryId,
|
|
12
|
+
const process = (boundaryId, revealNode) => {
|
|
13
13
|
var _executorDoc$qProcess;
|
|
14
14
|
const executorDoc = doc;
|
|
15
|
-
(_executorDoc$qProcess = executorDoc.qProcessOOOS) === null || _executorDoc$qProcess === void 0 || _executorDoc$qProcess.call(executorDoc, boundaryId,
|
|
15
|
+
(_executorDoc$qProcess = executorDoc.qProcessOOOS) === null || _executorDoc$qProcess === void 0 || _executorDoc$qProcess.call(executorDoc, boundaryId, revealNode);
|
|
16
16
|
};
|
|
17
17
|
const getScope = () => {
|
|
18
18
|
const script = doc.currentScript;
|
|
@@ -35,28 +35,28 @@ var installOutOfOrderExecutor = (doc) => {
|
|
|
35
35
|
const templates = scope.querySelectorAll(Q_RESOLVED_SELECTOR + boundaryId + "\"]");
|
|
36
36
|
return templates.length ? templates[templates.length - 1] : null;
|
|
37
37
|
};
|
|
38
|
-
const getPlaceholderTemplate = (
|
|
39
|
-
return
|
|
38
|
+
const getPlaceholderTemplate = (revealHost, boundaryId) => {
|
|
39
|
+
return revealHost.querySelector(Q_RESOLVED_SELECTOR + boundaryId + "\"]");
|
|
40
40
|
};
|
|
41
41
|
const getResultParent = (scope, boundaryId) => {
|
|
42
42
|
return scope.querySelector(Q_RESULT_PARENT_SELECTOR + boundaryId + "\"]");
|
|
43
43
|
};
|
|
44
|
-
const reveal = (
|
|
45
|
-
if (!
|
|
46
|
-
if (
|
|
47
|
-
if (
|
|
44
|
+
const reveal = (revealHost, hideHost) => {
|
|
45
|
+
if (!revealHost) return 0;
|
|
46
|
+
if (hideHost && hideHost.style) hideHost.style.display = "none";
|
|
47
|
+
if (revealHost.style) revealHost.style.display = "contents";
|
|
48
48
|
return 1;
|
|
49
49
|
};
|
|
50
50
|
const move = (scope, boundaryId, resolved) => {
|
|
51
51
|
if (!resolved) return null;
|
|
52
|
-
const
|
|
53
|
-
const placeholder =
|
|
52
|
+
const revealHost = getResultParent(scope, boundaryId);
|
|
53
|
+
const placeholder = revealHost ? getPlaceholderTemplate(revealHost, boundaryId) : null;
|
|
54
54
|
const parent = placeholder ? placeholder.parentNode : null;
|
|
55
|
-
if (!placeholder || !
|
|
55
|
+
if (!placeholder || !revealHost || !parent) return null;
|
|
56
56
|
parent.insertBefore(resolved.content, placeholder);
|
|
57
57
|
placeholder.remove();
|
|
58
58
|
resolved.remove();
|
|
59
|
-
return [
|
|
59
|
+
return [revealHost, revealHost.previousElementSibling];
|
|
60
60
|
};
|
|
61
61
|
const flush = (group) => {
|
|
62
62
|
const order = group.o;
|
package/dist/qwikloader.debug.js
CHANGED
|
@@ -220,7 +220,7 @@ var dispatch = (element, ev, scopedKebabName, tasks, kebabName, allowPreventDefa
|
|
|
220
220
|
defer = true;
|
|
221
221
|
tasks.push(async () => {
|
|
222
222
|
await waitForReady;
|
|
223
|
-
await run(await resolve(false) || await resolve());
|
|
223
|
+
await run(chunk ? await resolve() : await resolve(false) || await resolve());
|
|
224
224
|
});
|
|
225
225
|
} else if (isPromise(handler)) {
|
|
226
226
|
defer = true;
|
package/dist/qwikloader.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t,n,r=document,o=window,s="w",i="wp",a="d",c="dp",l="e",p="ep",u="capture:",d="readystatechange",f=0,h=new Set,q=new Set([r]),b=new Map,g={},m=(e,t)=>Array.from(e.querySelectorAll(t)),v=e=>{const t=[];return q.forEach(n=>t.push(...m(n,e))),t},w=(e,t,n,r=!1,o=!1)=>e.addEventListener(t,n,{capture:r,passive:o}),y=e=>{H(e);const t=m(e,"[q\\:shadowroot]");for(let e=0;e<t.length;e++){const n=t[e].shadowRoot;n&&y(n)}},A=e=>e&&"function"==typeof e.then,E=async e=>{for(let t=0;t<e.length;t++)await e[t]()},S=e=>{if(e.length){const t=()=>E(e);n=n?n.then(t,t):t()}},C=e=>{if(void 0===e._qwikjson_){let t=(e===r.documentElement?r.body:e).lastElementChild;for(;t;){if("SCRIPT"===t.tagName&&"qwik/json"===t.getAttribute("type")){e._qwikjson_=JSON.parse(t.textContent.replace(/\\x3C(\/?script)/gi,"<$1"));break}t=t.previousElementSibling}}},_=e=>{g[e]=1,I(d)},k=e=>{const t=e.getAttribute("q:instance");return"paused"===e.getAttribute("q:container")&&"loading"===r.readyState&&!g[t]&&new Promise(e=>{w(r,d,()=>{("loading"!==r.readyState||g[t])&&e()})})},$=(e,t)=>new CustomEvent(e,{detail:t}),I=(e,t)=>{r.dispatchEvent($(e,t))},N=e=>e.replace(/([A-Z-])/g,e=>"-"+e.toLowerCase()),R=e=>e.replace(/-./g,e=>e[1].toUpperCase()),T=e=>{const t=e.indexOf(":");return{scope:e.slice(0,t),eventName:R(e.slice(t+1))}},x=e=>2===e.length,B=e=>e.charAt(0),L=e=>!!e&&1===e.nodeType,U=(e,t,n)=>e.hasAttribute(n)&&(!!e._qDispatch?.[t]||e.hasAttribute("q-"+t)),j=(e,t,n,o,s,i,a,c=!0)=>{const l={qBase:n,symbol:i,element:t,reqTime:a};if(!s){const t=(r["qFuncs_"+e.getAttribute("q:instance")]||[])[+i];if(!t&&c){const e=Error("sym:"+i);I("qerror",{importError:"sync",error:e,...l}),console.error(e)}return t}const p=`${i}|${n}|${s}`,u=b.get(p);if(u)return u;const d=new URL(s,o).href,f=import(d);return C(e),f.then(e=>{const t=e[i];if(t)b.set(p,t),I("qsymbol",l);else{const e=Error(`${i} not in ${d}`);I("qerror",{importError:"no-symbol",error:e,...l}),console.error(e)}return t},e=>{I("qerror",{importError:"async",error:e,...l}),console.error(e)})},D=(e,t,n,o,s,i=!0)=>{let a=!1;s&&(i&&e.hasAttribute("preventdefault:"+s)&&t.preventDefault(),e.hasAttribute("stoppropagation:"+s)&&t.stopPropagation());const c=e._qDispatch?.[n];if(c){if("function"==typeof c){const n=()=>c(t,e);if(a)o.push(async()=>{const e=n();A(e)&&await e});else{const e=n();A(e)&&(a=!0,o.push(()=>e))}}else if(c.length)for(let n=0;n<c.length;n++){const r=c[n];if(r){const n=()=>r(t,e);if(a)o.push(async()=>{const e=n();A(e)&&await e});else{const e=n();A(e)&&(a=!0,o.push(()=>e))}}}return}const l=e.getAttribute("q-"+n);if(l){const n=e.closest("[q\\:container]:not([q\\:container=html]):not([q\\:container=text])"),s=n.getAttribute("q:base"),i=new URL(s,r.baseURI),c=l.split("|"),p=k(n);for(let r=0;r<c.length;r++){const l=c[r],u=performance.now(),[d,f,h]=l.split("#"),q=n=>{if(n&&e.isConnected){const r=t=>{I("qerror",{error:t,qBase:s,symbol:f,element:e,reqTime:u})};try{const o=n.call(h,t,e);if(A(o))return o.catch(r)}catch(e){return r(e)}}},b=(t=!0)=>j(n,e,s,i,d,f,u,t),g=p?void 0:b();if(p)a=!0,o.push(async()=>{await p,await q(await b(!1)||await b())});else if(A(g))a=!0,o.push(()=>g.then(q));else if(a)a=!0,o.push(async()=>{await q(g||await b())});else{const e=q(g);A(e)&&(a=!0,o.push(()=>e))}}}},O=(e,t=l,n=!0)=>{const r=N(e.type),o=t+":"+r,s=u+r,i=[],a=[],c=[];let p=e.target;for(;p;)L(p)?(i.push(p),a.push(U(p,o,s)),p=p.parentElement):p=p.parentElement;for(let t=i.length-1;t>=0;t--)if(a[t]&&(D(i[t],e,o,c,r,n),e.cancelBubble))return void S(c);for(let t=0;t<i.length;t++)if(!a[t]&&(D(i[t],e,o,c,r,n),!e.bubbles||e.cancelBubble))return void S(c);S(c)},P=e=>O(e,p,!1),F=(e,t,n=!0)=>{const r=N(t.type),o=e+":"+r,s=v("[q-"+CSS.escape(o)+"]"),i=[];for(let e=0;e<s.length;e++){const a=s[e];D(a,t,o,i,r,n)}S(i)},J=e=>{F(a,e)},M=e=>{F(c,e,!1)},Z=e=>{F(s,e)},z=e=>{F(i,e,!1)},G=()=>{const n=r.readyState;if("interactive"==n||"complete"==n){if(t=1,q.forEach(y),h.has("d:qinit")){h.delete("d:qinit");const e=$("qinit"),t=v("[q-d\\:qinit]"),n=[];for(let r=0;r<t.length;r++){const o=t[r];D(o,e,"d:qinit",n),o.removeAttribute("q-d:qinit")}S(n)}if(h.has("d:qidle")&&(h.delete("d:qidle"),(o.requestIdleCallback??o.setTimeout).bind(o)(()=>{const e=$("qidle"),t=v("[q-d\\:qidle]"),n=[];for(let r=0;r<t.length;r++){const o=t[r];D(o,e,"d:qidle",n),o.removeAttribute("q-d:qidle")}S(n)})),h.has("e:qvisible")){e||(e=new IntersectionObserver(t=>{const n=[];for(let r=0;r<t.length;r++){const o=t[r];o.isIntersecting&&(e.unobserve(o.target),D(o.target,$("qvisible",o),"e:qvisible",n))}S(n)}));const t=v("[q-e\\:qvisible]:not([q\\:observed])");for(let n=0;n<t.length;n++){const r=t[n];e.observe(r),r.setAttribute("q:observed","true")}}}},H=(...e)=>{for(let n=0;n<e.length;n++){const r=e[n];if(r===f)_(e[++n]);else if("string"==typeof r){if(!h.has(r)){h.add(r);const{scope:e,eventName:n}=T(r),i=x(e),c=B(e);c===s?w(o,n,i?z:Z,!0,i):q.forEach(e=>w(e,n,c===a?i?M:J:i?P:O,!0,i)),1!==t||"e:qvisible"!==r&&"d:qinit"!==r&&"d:qidle"!==r||G()}}else q.has(r)||(h.forEach(e=>{const{scope:t,eventName:n}=T(e),o=x(t),i=B(t);i!==s&&w(r,n,i===a?o?M:J:o?P:O,!0,o)}),q.add(r))}},K=o._qwikEv;K?.roots||(Array.isArray(K)?H(...K):H("e:click","e:input"),o._qwikEv={events:h,roots:q,push:H},w(r,d,G),G());
|
|
1
|
+
var e,t,n,r=document,o=window,s="w",i="wp",a="d",c="dp",l="e",p="ep",u="capture:",d="readystatechange",f=0,h=new Set,q=new Set([r]),b=new Map,g={},m=(e,t)=>Array.from(e.querySelectorAll(t)),v=e=>{const t=[];return q.forEach(n=>t.push(...m(n,e))),t},w=(e,t,n,r=!1,o=!1)=>e.addEventListener(t,n,{capture:r,passive:o}),y=e=>{H(e);const t=m(e,"[q\\:shadowroot]");for(let e=0;e<t.length;e++){const n=t[e].shadowRoot;n&&y(n)}},A=e=>e&&"function"==typeof e.then,E=async e=>{for(let t=0;t<e.length;t++)await e[t]()},S=e=>{if(e.length){const t=()=>E(e);n=n?n.then(t,t):t()}},C=e=>{if(void 0===e._qwikjson_){let t=(e===r.documentElement?r.body:e).lastElementChild;for(;t;){if("SCRIPT"===t.tagName&&"qwik/json"===t.getAttribute("type")){e._qwikjson_=JSON.parse(t.textContent.replace(/\\x3C(\/?script)/gi,"<$1"));break}t=t.previousElementSibling}}},_=e=>{g[e]=1,I(d)},k=e=>{const t=e.getAttribute("q:instance");return"paused"===e.getAttribute("q:container")&&"loading"===r.readyState&&!g[t]&&new Promise(e=>{w(r,d,()=>{("loading"!==r.readyState||g[t])&&e()})})},$=(e,t)=>new CustomEvent(e,{detail:t}),I=(e,t)=>{r.dispatchEvent($(e,t))},N=e=>e.replace(/([A-Z-])/g,e=>"-"+e.toLowerCase()),R=e=>e.replace(/-./g,e=>e[1].toUpperCase()),T=e=>{const t=e.indexOf(":");return{scope:e.slice(0,t),eventName:R(e.slice(t+1))}},x=e=>2===e.length,B=e=>e.charAt(0),L=e=>!!e&&1===e.nodeType,U=(e,t,n)=>e.hasAttribute(n)&&(!!e._qDispatch?.[t]||e.hasAttribute("q-"+t)),j=(e,t,n,o,s,i,a,c=!0)=>{const l={qBase:n,symbol:i,element:t,reqTime:a};if(!s){const t=(r["qFuncs_"+e.getAttribute("q:instance")]||[])[+i];if(!t&&c){const e=Error("sym:"+i);I("qerror",{importError:"sync",error:e,...l}),console.error(e)}return t}const p=`${i}|${n}|${s}`,u=b.get(p);if(u)return u;const d=new URL(s,o).href,f=import(d);return C(e),f.then(e=>{const t=e[i];if(t)b.set(p,t),I("qsymbol",l);else{const e=Error(`${i} not in ${d}`);I("qerror",{importError:"no-symbol",error:e,...l}),console.error(e)}return t},e=>{I("qerror",{importError:"async",error:e,...l}),console.error(e)})},D=(e,t,n,o,s,i=!0)=>{let a=!1;s&&(i&&e.hasAttribute("preventdefault:"+s)&&t.preventDefault(),e.hasAttribute("stoppropagation:"+s)&&t.stopPropagation());const c=e._qDispatch?.[n];if(c){if("function"==typeof c){const n=()=>c(t,e);if(a)o.push(async()=>{const e=n();A(e)&&await e});else{const e=n();A(e)&&(a=!0,o.push(()=>e))}}else if(c.length)for(let n=0;n<c.length;n++){const r=c[n];if(r){const n=()=>r(t,e);if(a)o.push(async()=>{const e=n();A(e)&&await e});else{const e=n();A(e)&&(a=!0,o.push(()=>e))}}}return}const l=e.getAttribute("q-"+n);if(l){const n=e.closest("[q\\:container]:not([q\\:container=html]):not([q\\:container=text])"),s=n.getAttribute("q:base"),i=new URL(s,r.baseURI),c=l.split("|"),p=k(n);for(let r=0;r<c.length;r++){const l=c[r],u=performance.now(),[d,f,h]=l.split("#"),q=n=>{if(n&&e.isConnected){const r=t=>{I("qerror",{error:t,qBase:s,symbol:f,element:e,reqTime:u})};try{const o=n.call(h,t,e);if(A(o))return o.catch(r)}catch(e){return r(e)}}},b=(t=!0)=>j(n,e,s,i,d,f,u,t),g=p?void 0:b();if(p)a=!0,o.push(async()=>{await p,await q(d?await b():await b(!1)||await b())});else if(A(g))a=!0,o.push(()=>g.then(q));else if(a)a=!0,o.push(async()=>{await q(g||await b())});else{const e=q(g);A(e)&&(a=!0,o.push(()=>e))}}}},O=(e,t=l,n=!0)=>{const r=N(e.type),o=t+":"+r,s=u+r,i=[],a=[],c=[];let p=e.target;for(;p;)L(p)?(i.push(p),a.push(U(p,o,s)),p=p.parentElement):p=p.parentElement;for(let t=i.length-1;t>=0;t--)if(a[t]&&(D(i[t],e,o,c,r,n),e.cancelBubble))return void S(c);for(let t=0;t<i.length;t++)if(!a[t]&&(D(i[t],e,o,c,r,n),!e.bubbles||e.cancelBubble))return void S(c);S(c)},P=e=>O(e,p,!1),F=(e,t,n=!0)=>{const r=N(t.type),o=e+":"+r,s=v("[q-"+CSS.escape(o)+"]"),i=[];for(let e=0;e<s.length;e++){const a=s[e];D(a,t,o,i,r,n)}S(i)},J=e=>{F(a,e)},M=e=>{F(c,e,!1)},Z=e=>{F(s,e)},z=e=>{F(i,e,!1)},G=()=>{const n=r.readyState;if("interactive"==n||"complete"==n){if(t=1,q.forEach(y),h.has("d:qinit")){h.delete("d:qinit");const e=$("qinit"),t=v("[q-d\\:qinit]"),n=[];for(let r=0;r<t.length;r++){const o=t[r];D(o,e,"d:qinit",n),o.removeAttribute("q-d:qinit")}S(n)}if(h.has("d:qidle")&&(h.delete("d:qidle"),(o.requestIdleCallback??o.setTimeout).bind(o)(()=>{const e=$("qidle"),t=v("[q-d\\:qidle]"),n=[];for(let r=0;r<t.length;r++){const o=t[r];D(o,e,"d:qidle",n),o.removeAttribute("q-d:qidle")}S(n)})),h.has("e:qvisible")){e||(e=new IntersectionObserver(t=>{const n=[];for(let r=0;r<t.length;r++){const o=t[r];o.isIntersecting&&(e.unobserve(o.target),D(o.target,$("qvisible",o),"e:qvisible",n))}S(n)}));const t=v("[q-e\\:qvisible]:not([q\\:observed])");for(let n=0;n<t.length;n++){const r=t[n];e.observe(r),r.setAttribute("q:observed","true")}}}},H=(...e)=>{for(let n=0;n<e.length;n++){const r=e[n];if(r===f)_(e[++n]);else if("string"==typeof r){if(!h.has(r)){h.add(r);const{scope:e,eventName:n}=T(r),i=x(e),c=B(e);c===s?w(o,n,i?z:Z,!0,i):q.forEach(e=>w(e,n,c===a?i?M:J:i?P:O,!0,i)),1!==t||"e:qvisible"!==r&&"d:qinit"!==r&&"d:qidle"!==r||G()}}else q.has(r)||(h.forEach(e=>{const{scope:t,eventName:n}=T(e),o=x(t),i=B(t);i!==s&&w(r,n,i===a?o?M:J:o?P:O,!0,o)}),q.add(r))}},K=o._qwikEv;K?.roots||(Array.isArray(K)?H(...K):H("e:click","e:input"),o._qwikEv={events:h,roots:q,push:H},w(r,d,G),G());
|
package/dist/server.d.ts
CHANGED
|
@@ -192,6 +192,17 @@ export declare interface RenderOptions extends SerializeDocumentOptions {
|
|
|
192
192
|
containerAttributes?: Record<string, string>;
|
|
193
193
|
/** Metadata that can be retrieved during SSR with `useServerData()`. */
|
|
194
194
|
serverData?: Record<string, any>;
|
|
195
|
+
/**
|
|
196
|
+
* Server-only. Projects a thrown error into the `Error` an `<ErrorBoundary>` fallback displays
|
|
197
|
+
* during SSR; `onError$` still receives the original. It never runs on the client, where a
|
|
198
|
+
* re-derived fallback shows the error as thrown.
|
|
199
|
+
*
|
|
200
|
+
* Return an `Error` to project it, or `undefined`/`null` to decline; any other return, or a
|
|
201
|
+
* throw, redacts to the generic error.
|
|
202
|
+
*
|
|
203
|
+
* It is called synchronously, so it cannot be `async`: a returned promise redacts every error.
|
|
204
|
+
*/
|
|
205
|
+
transformError?: (error: unknown) => Error | undefined | null | void;
|
|
195
206
|
}
|
|
196
207
|
|
|
197
208
|
/** @public */
|
|
@@ -217,12 +228,28 @@ export declare const renderToStream: (jsx: JSXOutput, opts: RenderToStreamOption
|
|
|
217
228
|
export declare interface RenderToStreamOptions extends RenderOptions {
|
|
218
229
|
stream: StreamWriter;
|
|
219
230
|
streaming?: StreamingOptions;
|
|
231
|
+
/**
|
|
232
|
+
* Called synchronously just before the first chunk is written — the last moment response headers
|
|
233
|
+
* can still change. `errorBoundaryCaught` is true when an `<ErrorBoundary>` already swapped in
|
|
234
|
+
* its fallback during SSR.
|
|
235
|
+
*
|
|
236
|
+
* @experimental
|
|
237
|
+
*/
|
|
238
|
+
onBeforeFirstFlush?: (info: {
|
|
239
|
+
errorBoundaryCaught: boolean;
|
|
240
|
+
}) => void;
|
|
220
241
|
}
|
|
221
242
|
|
|
222
243
|
/** @public */
|
|
223
244
|
export declare interface RenderToStreamResult extends RenderResult {
|
|
224
245
|
flushes: number;
|
|
225
246
|
size: number;
|
|
247
|
+
/**
|
|
248
|
+
* True when an `<ErrorBoundary>` caught during the render, no matter where in the stream.
|
|
249
|
+
*
|
|
250
|
+
* @experimental
|
|
251
|
+
*/
|
|
252
|
+
errorBoundaryCaught?: boolean;
|
|
226
253
|
timing: {
|
|
227
254
|
firstFlush: number;
|
|
228
255
|
render: number;
|