@qwik.dev/core 2.0.0-beta.7 → 2.0.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.darwin-x64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/backpatch/index.cjs +6 -0
- package/dist/backpatch/index.d.ts +2 -0
- package/dist/backpatch/index.mjs +5 -0
- package/dist/backpatch/package.json +8 -0
- package/dist/backpatch-executor.debug.js +34 -0
- package/dist/backpatch-executor.js +1 -0
- package/dist/build/package.json +1 -1
- package/dist/cli.cjs +17 -17
- package/dist/core-internal.d.ts +112 -56
- package/dist/core.cjs +1022 -469
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +1018 -469
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +654 -361
- package/dist/core.prod.mjs +729 -373
- 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 +78 -76
- package/dist/optimizer.mjs +78 -78
- package/dist/qwikloader.debug.js +0 -13
- package/dist/qwikloader.js +1 -1
- package/dist/server.cjs +217 -63
- package/dist/server.d.ts +9 -0
- package/dist/server.mjs +213 -63
- package/dist/starters/features/auth/package.json +1 -1
- package/dist/starters/features/localize/package.json +3 -3
- package/dist/starters/features/pandacss/package.json +1 -1
- package/dist/starters/features/playwright/playwright-report/index.html +943 -903
- package/dist/starters/features/postcss/postcss.config.js +1 -1
- package/dist/starters/features/tailwind/package.json +2 -2
- package/dist/starters/features/tailwind/prettier.config.js +10 -0
- package/dist/starters/features/tailwind-v3/package.json +1 -1
- package/dist/starters/features/tailwind-v3/prettier.config.js +10 -0
- package/dist/testing/index.cjs +3826 -952
- package/dist/testing/index.d.ts +972 -1
- package/dist/testing/index.mjs +3811 -946
- package/dist/testing/package.json +1 -1
- package/package.json +8 -6
- package/dist/starters/features/tailwind/.prettierrc.js +0 -3
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.9-dev+6b582c7
|
|
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
|
|
@@ -1282,7 +1282,7 @@ var QWIK_BINDING_MAP = {
|
|
|
1282
1282
|
};
|
|
1283
1283
|
|
|
1284
1284
|
var versions = {
|
|
1285
|
-
qwik: "2.0.0-beta.
|
|
1285
|
+
qwik: "2.0.0-beta.9-dev+6b582c7"
|
|
1286
1286
|
};
|
|
1287
1287
|
|
|
1288
1288
|
async function getSystem() {
|
|
@@ -2979,9 +2979,9 @@ function createRollupError2(id, diagnostic) {
|
|
|
2979
2979
|
return err;
|
|
2980
2980
|
}
|
|
2981
2981
|
|
|
2982
|
-
var QWIK_LOADER_DEFAULT_MINIFIED = 'const t=document,e=window,n=new Set,o=new Set([t]);let r;const s=(t,e)=>Array.from(t.querySelectorAll(e)),
|
|
2982
|
+
var QWIK_LOADER_DEFAULT_MINIFIED = 'const t=document,e=window,n=new Set,o=new Set([t]);let r;const s=(t,e)=>Array.from(t.querySelectorAll(e)),a=t=>{const e=[];return o.forEach(n=>e.push(...s(n,t))),e},i=t=>{m(t),s(t,"[q\\\\:shadowroot]").forEach(t=>{const e=t.shadowRoot;e&&i(e)})},c=t=>t&&"function"==typeof t.then,l=(t,e,n=e.type)=>{a("[on"+t+"\\\\:"+n+"]").forEach(o=>{u(o,t,e,n)})},f=e=>{if(void 0===e._qwikjson_){let n=(e===t.documentElement?t.body:e).lastElementChild;for(;n;){if("SCRIPT"===n.tagName&&"qwik/json"===n.getAttribute("type")){e._qwikjson_=JSON.parse(n.textContent.replace(/\\\\x3C(\\/?script)/gi,"<$1"));break}n=n.previousElementSibling}}},p=(t,e)=>new CustomEvent(t,{detail:e}),u=async(e,n,o,r=o.type)=>{const s="on"+n+":"+r;e.hasAttribute("preventdefault:"+r)&&o.preventDefault(),e.hasAttribute("stoppropagation:"+r)&&o.stopPropagation();const a=e._qc_,i=a&&a.li.filter(t=>t[0]===s);if(i&&i.length>0){for(const t of i){const n=t[1].getFn([e,o],()=>e.isConnected)(o,e),r=o.cancelBubble;c(n)&&await n,r&&o.stopPropagation()}return}const l=e.getAttribute(s),p=e.qDispatchEvent;if(p)return p(o,n);if(l){const n=e.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),r=n.getAttribute("q:base"),s=n.getAttribute("q:version")||"unknown",a=n.getAttribute("q:manifest-hash")||"dev",i=new URL(r,t.baseURI);for(const p of l.split("\\n")){const l=new URL(p,i),u=l.href,q=l.hash.replace(/^#?([^?[|]*).*$/,"$1")||"default",h=performance.now();let _,d,y;const m=p.startsWith("#"),w={qBase:r,qManifest:a,qVersion:s,href:u,symbol:q,element:e,reqTime:h};if(m){const e=n.getAttribute("q:instance");_=(t["qFuncs_"+e]||[])[Number.parseInt(q)],_||(d="sync",y=Error("sym:"+q))}else{b("qsymbol",w);const t=l.href.split("#")[0];try{const e=import(t);f(n),_=(await e)[q],_||(d="no-symbol",y=Error(`${q} not in ${t}`))}catch(t){d||(d="async"),y=t}}if(!_){b("qerror",{importError:d,error:y,...w}),console.error(y);break}const g=t.__q_context__;if(e.isConnected)try{t.__q_context__=[e,o,l];const n=_(o,e);c(n)&&await n}catch(t){b("qerror",{error:t,...w})}finally{t.__q_context__=g}}}},b=(e,n)=>{t.dispatchEvent(p(e,n))},q=t=>t.replace(/([A-Z])/g,t=>"-"+t.toLowerCase()),h=async t=>{let e=q(t.type),n=t.target;for(l("-document",t,e);n&&n.getAttribute;){const o=u(n,"",t,e);let r=t.cancelBubble;c(o)&&await o,r||(r=r||t.cancelBubble||n.hasAttribute("stoppropagation:"+t.type)),n=t.bubbles&&!0!==r?n.parentElement:null}},_=t=>{l("-window",t,q(t.type))},d=()=>{var s;const c=t.readyState;if(!r&&("interactive"==c||"complete"==c)&&(o.forEach(i),r=1,b("qinit"),(null!=(s=e.requestIdleCallback)?s:e.setTimeout).bind(e)(()=>b("qidle")),n.has("qvisible"))){const t=a("[on\\\\:qvisible]"),e=new IntersectionObserver(t=>{for(const n of t)n.isIntersecting&&(e.unobserve(n.target),u(n.target,"",p("qvisible",n)))});t.forEach(t=>e.observe(t))}},y=(t,e,n,o=!1)=>{t.addEventListener(e,n,{capture:o,passive:!1})},m=(...t)=>{for(const r of t)"string"==typeof r?n.has(r)||(o.forEach(t=>y(t,r,h,!0)),y(e,r,_,!0),n.add(r)):o.has(r)||(n.forEach(t=>y(r,t,h,!0)),o.add(r))};if(!("__q_context__"in t)){t.__q_context__=0;const r=e.qwikevents;r&&(Array.isArray(r)?m(...r):m("click","input")),e.qwikevents={events:n,roots:o,push:m},y(t,"readystatechange",d),d()}';
|
|
2983
2983
|
|
|
2984
|
-
var QWIK_LOADER_DEFAULT_DEBUG = 'const doc = document;\nconst win = window;\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nlet hasInitialized;\nconst nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nconst querySelectorAll = (query) => {\n const elements = [];\n roots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n return elements;\n};\nconst findShadowRoots = (fragment) => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent) => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n });\n};\nconst isPromise = (promise) => promise && typeof promise.then === "function";\
|
|
2984
|
+
var QWIK_LOADER_DEFAULT_DEBUG = 'const doc = document;\nconst win = window;\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nlet hasInitialized;\nconst nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nconst querySelectorAll = (query) => {\n const elements = [];\n roots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n return elements;\n};\nconst findShadowRoots = (fragment) => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent) => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n });\n};\nconst isPromise = (promise) => promise && typeof promise.then === "function";\nconst broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll("[on" + infix + "\\\\:" + type + "]").forEach((el) => {\n dispatch(el, infix, ev, type);\n });\n};\nconst resolveContainer = (containerEl) => {\n if (containerEl._qwikjson_ === void 0) {\n const parentJSON = containerEl === doc.documentElement ? doc.body : containerEl;\n let script = parentJSON.lastElementChild;\n while (script) {\n if (script.tagName === "SCRIPT" && script.getAttribute("type") === "qwik/json") {\n containerEl._qwikjson_ = JSON.parse(\n script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1")\n );\n break;\n }\n script = script.previousElementSibling;\n }\n }\n};\nconst createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail\n});\nconst dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = "on" + scope + ":" + eventName;\n if (element.hasAttribute("preventdefault:" + eventName)) {\n ev.preventDefault();\n }\n if (element.hasAttribute("stoppropagation:" + eventName)) {\n ev.stopPropagation();\n }\n const ctx = element._qc_;\n const relevantListeners = ctx && ctx.li.filter((li) => li[0] === attrName);\n if (relevantListeners && relevantListeners.length > 0) {\n for (const listener of relevantListeners) {\n const results = listener[1].getFn([element, ev], () => element.isConnected)(ev, element);\n const cancelBubble = ev.cancelBubble;\n if (isPromise(results)) {\n await results;\n }\n if (cancelBubble) {\n ev.stopPropagation();\n }\n }\n return;\n }\n const attrValue = element.getAttribute(attrName);\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n if (attrValue) {\n const container = element.closest(\n "[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"\n );\n const qBase = container.getAttribute("q:base");\n const qVersion = container.getAttribute("q:version") || "unknown";\n const qManifest = container.getAttribute("q:manifest-hash") || "dev";\n const base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split("\\n")) {\n const url = new URL(qrl, base);\n const href = url.href;\n const symbol = url.hash.replace(/^#?([^?[|]*).*$/, "$1") || "default";\n const reqTime = performance.now();\n let handler;\n let importError;\n let error;\n const isSync = qrl.startsWith("#");\n const eventData = {\n qBase,\n qManifest,\n qVersion,\n href,\n symbol,\n element,\n reqTime\n };\n if (isSync) {\n const hash = container.getAttribute("q:instance");\n handler = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];\n if (!handler) {\n importError = "sync";\n error = new Error("sym:" + symbol);\n }\n } else {\n emitEvent("qsymbol", eventData);\n const uri = url.href.split("#")[0];\n try {\n const module = import(\n uri\n );\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = "no-symbol";\n error = new Error(`${symbol} not in ${uri}`);\n }\n } catch (err) {\n importError || (importError = "async");\n error = err;\n }\n }\n if (!handler) {\n emitEvent("qerror", {\n importError,\n error,\n ...eventData\n });\n console.error(error);\n break;\n }\n const previousCtx = doc.__q_context__;\n if (element.isConnected) {\n try {\n doc.__q_context__ = [element, ev, url];\n const results = handler(ev, element);\n if (isPromise(results)) {\n await results;\n }\n } catch (error2) {\n emitEvent("qerror", { error: error2, ...eventData });\n } finally {\n doc.__q_context__ = previousCtx;\n }\n }\n }\n }\n};\nconst emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n};\nconst camelToKebab = (str) => str.replace(/([A-Z])/g, (a) => "-" + a.toLowerCase());\nconst processDocumentEvent = async (ev) => {\n let type = camelToKebab(ev.type);\n let element = ev.target;\n broadcast("-document", ev, type);\n while (element && element.getAttribute) {\n const results = dispatch(element, "", ev, type);\n let cancelBubble = ev.cancelBubble;\n if (isPromise(results)) {\n await results;\n }\n cancelBubble || (cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type));\n element = ev.bubbles && cancelBubble !== true ? element.parentElement : null;\n }\n};\nconst processWindowEvent = (ev) => {\n broadcast("-window", ev, camelToKebab(ev.type));\n};\nconst processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && (readyState == "interactive" || readyState == "complete")) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent("qinit");\n const riC = (_a = win.requestIdleCallback) != null ? _a : win.setTimeout;\n riC.bind(win)(() => emitEvent("qidle"));\n if (events.has("qvisible")) {\n const results = querySelectorAll("[on\\\\:qvisible]");\n const observer = new IntersectionObserver((entries) => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(entry.target, "", createEvent("qvisible", entry));\n }\n }\n });\n results.forEach((el) => observer.observe(el));\n }\n }\n};\nconst addEventListener = (el, eventName, handler, capture = false) => {\n el.addEventListener(eventName, handler, { capture, passive: false });\n};\nconst processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if (typeof eventNameOrNode === "string") {\n if (!events.has(eventNameOrNode)) {\n roots.forEach(\n (root) => addEventListener(root, eventNameOrNode, processDocumentEvent, true)\n );\n addEventListener(win, eventNameOrNode, processWindowEvent, true);\n events.add(eventNameOrNode);\n }\n } else {\n if (!roots.has(eventNameOrNode)) {\n events.forEach(\n (eventName) => addEventListener(eventNameOrNode, eventName, processDocumentEvent, true)\n );\n roots.add(eventNameOrNode);\n }\n }\n }\n};\nif (!("__q_context__" in doc)) {\n doc.__q_context__ = 0;\n const qwikevents = win.qwikevents;\n if (qwikevents) {\n if (Array.isArray(qwikevents)) {\n processEventOrNode(...qwikevents);\n } else {\n processEventOrNode("click", "input");\n }\n }\n win.qwikevents = {\n events,\n roots,\n push: processEventOrNode\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n}';
|
|
2985
2985
|
|
|
2986
2986
|
var import_bmp = __toESM(require_bmp(), 1);
|
|
2987
2987
|
|
|
@@ -3306,7 +3306,7 @@ var bgCyan = init(46, 49);
|
|
|
3306
3306
|
|
|
3307
3307
|
var bgWhite = init(47, 49);
|
|
3308
3308
|
|
|
3309
|
-
var click_to_component_default = "<style>\n #qwik-inspector-overlay {\n position: fixed;\n background: rgba(24, 182, 246, 0.27);\n pointer-events: none;\n box-sizing: border-box;\n border: 2px solid rgba(172, 126, 244, 0.46);\n border-radius: 4px;\n contain: strict;\n cursor: pointer;\n z-index: 999999;\n }\n #qwik-inspector-info-popup {\n position: fixed;\n bottom: 10px;\n right: 10px;\n font-family: monospace;\n background: #000000c2;\n color: white;\n padding: 10px 20px;\n border-radius: 8px;\n box-shadow:\n 0 20px 25px -5px rgb(0 0 0 / 34%),\n 0 8px 10px -6px rgb(0 0 0 / 24%);\n backdrop-filter: blur(4px);\n -webkit-animation: fadeOut 0.3s 3s ease-in-out forwards;\n animation: fadeOut 0.3s 3s ease-in-out forwards;\n z-index: 999999;\n contain: layout;\n }\n #qwik-inspector-info-popup p {\n margin: 0px;\n }\n @-webkit-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n visibility: hidden;\n }\n }\n</style>\n<div id=\"qwik-inspector-info-popup\" aria-hidden=\"true\">Click-to-Source</div>\n<script>\n (function () {\n const inspectAttribute = 'data-qwik-inspector';\n const hotKeys = globalThis.qwikdevtools.hotKeys;\n const srcDir = globalThis.qwikdevtools.srcDir;\n document.querySelector('#qwik-inspector-info-popup').textContent =\n `Click-to-Source: ${hotKeys.join(' + ')}`;\n console.debug(\n '%c🔍 Qwik Click-To-Source',\n 'background: #564CE0; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;',\n `Hold-press the '${hotKeys.join(' + ')}' key${\n (hotKeys.length > 1 && 's') || ''\n } and click a component to jump directly to the source code in your IDE!`\n );\n window.__qwik_inspector_state = {\n pressedKeys: new Set(),\n };\n const origin = 'http://local.local';\n const body = document.body;\n const overlay = document.createElement('div');\n overlay.id = 'qwik-inspector-overlay';\n overlay.setAttribute('aria-hidden', 'true');\n body.appendChild(overlay);\n\n function findContainer(el) {\n if (el && el instanceof Element) {\n return el.closest(`[${inspectAttribute}]`);\n }\n return null;\n }\n\n document.addEventListener(\n 'keydown',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.add(event.code);\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'keyup',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.delete(event.code);\n updateOverlay();\n },\n { capture: true }\n );\n\n window.addEventListener(\n 'blur',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.clear();\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'mouseover',\n (event) => {\n const target = findContainer(event.target);\n if (target) {\n window.__qwik_inspector_state.hoveredElement = target;\n } else {\n window.__qwik_inspector_state.hoveredElement = undefined;\n }\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'click',\n (event) => {\n if (isActive()) {\n window.__qwik_inspector_state.pressedKeys.clear();\n const target = findContainer(event.target);\n if (target) {\n event.preventDefault();\n const inspectUrl = target.getAttribute(inspectAttribute);\n if (inspectUrl !== 'false') {\n body.style.setProperty('cursor', 'progress');\n qwikOpenInEditor(inspectUrl);\n }\n }\n }\n },\n { capture: true }\n );\n\n globalThis.qwikOpenInEditor = function (path) {\n const isWindows = navigator.platform.includes('Win');\n const resolvedURL = new URL(path, isWindows ? origin : srcDir);\n
|
|
3309
|
+
var click_to_component_default = "<style>\n #qwik-inspector-overlay {\n position: fixed;\n background: rgba(24, 182, 246, 0.27);\n pointer-events: none;\n box-sizing: border-box;\n border: 2px solid rgba(172, 126, 244, 0.46);\n border-radius: 4px;\n contain: strict;\n cursor: pointer;\n z-index: 999999;\n }\n\n #qwik-inspector-info-popup {\n position: fixed;\n bottom: 10px;\n right: 10px;\n font-family: monospace;\n background: #000000c2;\n color: white;\n padding: 10px 20px;\n border-radius: 8px;\n box-shadow:\n 0 20px 25px -5px rgb(0 0 0 / 34%),\n 0 8px 10px -6px rgb(0 0 0 / 24%);\n backdrop-filter: blur(4px);\n -webkit-animation: fadeOut 0.3s 3s ease-in-out forwards;\n animation: fadeOut 0.3s 3s ease-in-out forwards;\n z-index: 999999;\n contain: layout;\n }\n\n #qwik-inspector-info-popup p {\n margin: 0px;\n }\n\n @-webkit-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n\n 100% {\n opacity: 0;\n }\n }\n\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n\n 100% {\n opacity: 0;\n visibility: hidden;\n }\n }\n</style>\n<div id=\"qwik-inspector-info-popup\" aria-hidden=\"true\">Click-to-Source</div>\n<script>\n (function () {\n const inspectAttribute = 'data-qwik-inspector';\n const hotKeys = globalThis.qwikdevtools.hotKeys;\n const srcDir = globalThis.qwikdevtools.srcDir;\n document.querySelector('#qwik-inspector-info-popup').textContent =\n `Click-to-Source: ${hotKeys.join(' + ')}`;\n console.debug(\n '%c🔍 Qwik Click-To-Source',\n 'background: #564CE0; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;',\n `Hold-press the '${hotKeys.join(' + ')}' key${\n (hotKeys.length > 1 && 's') || ''\n } and click a component to jump directly to the source code in your IDE!`\n );\n window.__qwik_inspector_state = {\n pressedKeys: new Set(),\n };\n const origin = 'http://local.local';\n const body = document.body;\n const overlay = document.createElement('div');\n overlay.id = 'qwik-inspector-overlay';\n overlay.setAttribute('aria-hidden', 'true');\n body.appendChild(overlay);\n\n function findContainer(el) {\n if (el && el instanceof Element) {\n return el.closest(`[${inspectAttribute}]`);\n }\n return null;\n }\n\n document.addEventListener(\n 'keydown',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.add(event.code);\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'keyup',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.delete(event.code);\n updateOverlay();\n },\n { capture: true }\n );\n\n window.addEventListener(\n 'blur',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.clear();\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'mouseover',\n (event) => {\n const target = findContainer(event.target);\n if (target) {\n window.__qwik_inspector_state.hoveredElement = target;\n } else {\n window.__qwik_inspector_state.hoveredElement = undefined;\n }\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'click',\n (event) => {\n if (isActive()) {\n window.__qwik_inspector_state.pressedKeys.clear();\n const target = findContainer(event.target);\n if (target) {\n event.preventDefault();\n const inspectUrl = target.getAttribute(inspectAttribute);\n if (inspectUrl !== 'false') {\n body.style.setProperty('cursor', 'progress');\n qwikOpenInEditor(inspectUrl);\n }\n }\n }\n },\n { capture: true }\n );\n\n globalThis.qwikOpenInEditor = function (path) {\n const isWindows = navigator.platform.includes('Win');\n const resolvedURL = new URL(path, isWindows ? origin : srcDir);\n let filePath =\n resolvedURL.protocol === 'file:' && resolvedURL.pathname.startsWith('/')\n ? resolvedURL.pathname.slice(1)\n : resolvedURL.pathname.startsWith('/@fs/')\n ? resolvedURL.pathname.slice(isWindows ? 5 : 4)\n : resolvedURL.pathname;\n if (filePath.startsWith('/src/')) {\n const prefix = isWindows ? srcDir : srcDir.replace('http://local.local', '');\n filePath = prefix + filePath.slice(4);\n }\n const params = new URLSearchParams();\n params.set('file', filePath);\n fetch('/__open-in-editor?' + params.toString());\n };\n document.addEventListener(\n 'contextmenu',\n (event) => {\n if (isActive()) {\n window.__qwik_inspector_state.pressedKeys.clear();\n const target = findContainer(event.target);\n if (target) {\n event.preventDefault();\n }\n }\n },\n { capture: true }\n );\n\n function updateOverlay() {\n const hoverElement = window.__qwik_inspector_state.hoveredElement;\n if (hoverElement && isActive()) {\n const rect = hoverElement.getBoundingClientRect();\n overlay.style.setProperty('height', rect.height + 'px');\n overlay.style.setProperty('width', rect.width + 'px');\n overlay.style.setProperty('top', rect.top + 'px');\n overlay.style.setProperty('left', rect.left + 'px');\n overlay.style.setProperty('visibility', 'visible');\n body.style.setProperty('cursor', 'pointer');\n } else {\n overlay.style.setProperty('height', '0px');\n overlay.style.setProperty('width', '0px');\n overlay.style.setProperty('visibility', 'hidden');\n body.style.removeProperty('cursor');\n }\n }\n\n function checkKeysArePressed() {\n const activeKeys = Array.from(window.__qwik_inspector_state.pressedKeys).map((key) =>\n key ? key.replace(/(Left|Right)$/g, '') : undefined\n );\n return hotKeys.every((key) => activeKeys.includes(key));\n }\n\n function isActive() {\n return checkKeysArePressed();\n }\n window.addEventListener('resize', updateOverlay);\n document.addEventListener('scroll', updateOverlay);\n })();\n<\/script>\n";
|
|
3310
3310
|
|
|
3311
3311
|
var error_host_default = "<script>\n document.addEventListener('qerror', (ev) => {\n const ErrorOverlay = customElements.get('vite-error-overlay');\n if (!ErrorOverlay) {\n return;\n }\n const err = ev.detail.error;\n const overlay = new ErrorOverlay(err);\n document.body.appendChild(overlay);\n });\n<\/script>\n<script>\n /**\n * Usage:\n *\n * <errored-host></errored-host>\n */\n class ErroredHost extends HTMLElement {\n get _root() {\n return this.shadowRoot || this;\n }\n\n constructor() {\n super();\n const self = this;\n\n this.state = {};\n if (!this.props) {\n this.props = {};\n }\n\n this.componentProps = ['children', 'error'];\n\n // used to keep track of all nodes created by show/for\n this.nodesToDestroy = [];\n // batch updates\n this.pendingUpdate = false;\n\n this.attachShadow({ mode: 'open' });\n }\n\n destroyAnyNodes() {\n // destroy current view template refs before rendering again\n this.nodesToDestroy.forEach((el) => el.remove());\n this.nodesToDestroy = [];\n }\n\n connectedCallback() {\n this.getAttributeNames().forEach((attr) => {\n const jsVar = attr.replace(/-/g, '');\n const regexp = new RegExp(jsVar, 'i');\n this.componentProps.forEach((prop) => {\n if (regexp.test(prop)) {\n const attrValue = this.getAttribute(attr);\n if (this.props[prop] !== attrValue) {\n this.props[prop] = attrValue;\n }\n }\n });\n });\n\n this._root.innerHTML = `\n\n <template data-el=\"show-errored-host\">\n <div class=\"error\">\n <template data-el=\"div-errored-host-2\">\n \x3c!-- String(props.error) --\x3e\n </template>\n </div>\n </template>\n\n <div class=\"arrow\">👇 Uncaught error happened here 👇\n <span class=\"dev-tools\">DevTools: Cmd+Alt+I</span>\n </div>\n <div class=\"div\">\n <slot></slot>\n </div>\n\n <style>\n .error {\n border-radius: 5px 5px 0px 0;\n background: black;\n color: white;\n font-family: monospace;\n font-size: 12px;\n margin: 0;\n padding: 10px;\n }\n .arrow {\n background: #f47e81;\n color: black;\n font-size: 14px;\n padding: 10px;\n text-align: center;\n font-family: sans-serif;\n }\n .dev-tools {\n background: red;\n padding: 2px 5px;\n border-radius: 3px;\n font-weight: 800;\n }\n .div {\n outline: 5px solid red;\n border-radius: 10px;\n }\n </style>`;\n this.pendingUpdate = true;\n\n this.render();\n this.onMount();\n this.pendingUpdate = false;\n this.update();\n }\n\n showContent(el) {\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLTemplateElement/content\n // grabs the content of a node that is between <template> tags\n // iterates through child nodes to register all content including text elements\n // attaches the content after the template\n\n const elementFragment = el.content.cloneNode(true);\n const children = Array.from(elementFragment.childNodes);\n children.forEach((child) => {\n if (el?.scope) {\n child.scope = el.scope;\n }\n if (el?.context) {\n child.context = el.context;\n }\n this.nodesToDestroy.push(child);\n });\n el.after(elementFragment);\n }\n\n onMount() {}\n\n onUpdate() {}\n\n update() {\n if (this.pendingUpdate === true) {\n return;\n }\n this.pendingUpdate = true;\n this.render();\n this.onUpdate();\n this.pendingUpdate = false;\n }\n\n render() {\n // re-rendering needs to ensure that all nodes generated by for/show are refreshed\n this.destroyAnyNodes();\n this.updateBindings();\n }\n\n updateBindings() {\n this._root.querySelectorAll(\"[data-el='show-errored-host']\").forEach((el) => {\n const whenCondition = this.props.error;\n if (whenCondition) {\n this.showContent(el);\n }\n });\n\n this._root.querySelectorAll(\"[data-el='div-errored-host-2']\").forEach((el) => {\n this.renderTextNode(el, String(this.props.error));\n });\n }\n\n // Helper to render content\n renderTextNode(el, text) {\n const textNode = document.createTextNode(text);\n if (el?.scope) {\n textNode.scope = el.scope;\n }\n if (el?.context) {\n textNode.context = el.context;\n }\n el.after(textNode);\n this.nodesToDestroy.push(el.nextSibling);\n }\n }\n\n customElements.define('errored-host', ErroredHost);\n<\/script>\n";
|
|
3312
3312
|
|
|
@@ -3630,7 +3630,6 @@ function qwikVite(qwikViteOpts = {}) {
|
|
|
3630
3630
|
api: api,
|
|
3631
3631
|
async config(viteConfig, viteEnv) {
|
|
3632
3632
|
await qwikPlugin.init();
|
|
3633
|
-
const sys = qwikPlugin.getSys();
|
|
3634
3633
|
const path = qwikPlugin.getPath();
|
|
3635
3634
|
let target;
|
|
3636
3635
|
target = viteConfig.build?.ssr || "ssr" === viteEnv.mode ? "ssr" : "lib" === viteEnv.mode ? "lib" : "test" === viteEnv.mode ? "test" : "client";
|
|
@@ -3650,7 +3649,6 @@ function qwikVite(qwikViteOpts = {}) {
|
|
|
3650
3649
|
const clientInput = "client" === target ? qwikViteOpts.client?.input : void 0;
|
|
3651
3650
|
let input = viteConfig.build?.rollupOptions?.input || clientInput || ssrInput;
|
|
3652
3651
|
input && "string" === typeof input && (input = [ input ]);
|
|
3653
|
-
const shouldFindVendors = !qwikViteOpts.disableVendorScan && ("lib" !== target || "serve" === viteCommand);
|
|
3654
3652
|
viteAssetsDir = viteConfig.build?.assetsDir;
|
|
3655
3653
|
const useAssetsDir = "client" === target && !!viteAssetsDir && "_astro" !== viteAssetsDir;
|
|
3656
3654
|
const pluginOpts = {
|
|
@@ -3688,8 +3686,6 @@ function qwikVite(qwikViteOpts = {}) {
|
|
|
3688
3686
|
clientDevInput = "string" === typeof qwikViteOpts.client?.devInput ? path.resolve(opts.rootDir, qwikViteOpts.client.devInput) : opts.srcDir ? path.resolve(opts.srcDir, CLIENT_DEV_INPUT) : path.resolve(opts.rootDir, "src", CLIENT_DEV_INPUT);
|
|
3689
3687
|
clientDevInput = qwikPlugin.normalizePath(clientDevInput);
|
|
3690
3688
|
}
|
|
3691
|
-
const vendorRoots = shouldFindVendors ? await findQwikRoots(sys, sys.cwd()) : [];
|
|
3692
|
-
const vendorIds = vendorRoots.map(v => v.id);
|
|
3693
3689
|
const isDevelopment = "development" === buildMode;
|
|
3694
3690
|
const qDevKey = "globalThis.qDev";
|
|
3695
3691
|
const qTestKey = "globalThis.qTest";
|
|
@@ -3700,11 +3696,11 @@ function qwikVite(qwikViteOpts = {}) {
|
|
|
3700
3696
|
const qSerialize = viteConfig?.define?.[qSerializeKey] ?? isDevelopment;
|
|
3701
3697
|
const updatedViteConfig = {
|
|
3702
3698
|
ssr: {
|
|
3703
|
-
noExternal: [ QWIK_CORE_ID, QWIK_CORE_INTERNAL_ID, QWIK_CORE_SERVER, QWIK_BUILD_ID
|
|
3699
|
+
noExternal: [ QWIK_CORE_ID, QWIK_CORE_INTERNAL_ID, QWIK_CORE_SERVER, QWIK_BUILD_ID ]
|
|
3704
3700
|
},
|
|
3705
3701
|
envPrefix: [ "VITE_", "PUBLIC_" ],
|
|
3706
3702
|
resolve: {
|
|
3707
|
-
dedupe: [ ...DEDUPE
|
|
3703
|
+
dedupe: [ ...DEDUPE ],
|
|
3708
3704
|
conditions: "production" === buildMode && "client" === target ? [ "min" ] : [],
|
|
3709
3705
|
alias: {
|
|
3710
3706
|
"@builder.io/qwik": "@qwik.dev/core",
|
|
@@ -3715,6 +3711,7 @@ function qwikVite(qwikViteOpts = {}) {
|
|
|
3715
3711
|
"@builder.io/qwik/jsx-dev-runtime": "@qwik.dev/core/jsx-dev-runtime",
|
|
3716
3712
|
"@builder.io/qwik/optimizer": "@qwik.dev/core/optimizer",
|
|
3717
3713
|
"@builder.io/qwik/loader": "@qwik.dev/core/loader",
|
|
3714
|
+
"@builder.io/qwik/backpatch": "@qwik.dev/core/backpatch",
|
|
3718
3715
|
"@builder.io/qwik/cli": "@qwik.dev/core/cli",
|
|
3719
3716
|
"@builder.io/qwik/testing": "@qwik.dev/core/testing"
|
|
3720
3717
|
}
|
|
@@ -3724,7 +3721,7 @@ function qwikVite(qwikViteOpts = {}) {
|
|
|
3724
3721
|
jsx: "automatic"
|
|
3725
3722
|
},
|
|
3726
3723
|
optimizeDeps: {
|
|
3727
|
-
exclude: [ QWIK_CORE_ID, QWIK_CORE_INTERNAL_ID, QWIK_CORE_SERVER, QWIK_JSX_RUNTIME_ID, QWIK_JSX_DEV_RUNTIME_ID, QWIK_BUILD_ID, QWIK_CLIENT_MANIFEST_ID,
|
|
3724
|
+
exclude: [ QWIK_CORE_ID, QWIK_CORE_INTERNAL_ID, QWIK_CORE_SERVER, QWIK_JSX_RUNTIME_ID, QWIK_JSX_DEV_RUNTIME_ID, QWIK_BUILD_ID, QWIK_CLIENT_MANIFEST_ID, "@builder.io/qwik", "@builder.io/qwik-city" ]
|
|
3728
3725
|
},
|
|
3729
3726
|
build: {
|
|
3730
3727
|
modulePreload: false,
|
|
@@ -3966,7 +3963,75 @@ function qwikVite(qwikViteOpts = {}) {
|
|
|
3966
3963
|
}
|
|
3967
3964
|
}
|
|
3968
3965
|
};
|
|
3969
|
-
return [ vitePluginPre, vitePluginPost ];
|
|
3966
|
+
return [ vitePluginPre, vitePluginPost, checkExternals() ];
|
|
3967
|
+
}
|
|
3968
|
+
|
|
3969
|
+
async function checkExternals() {
|
|
3970
|
+
let fs;
|
|
3971
|
+
let path;
|
|
3972
|
+
try {
|
|
3973
|
+
fs = await import("node:fs").then(m => m.promises);
|
|
3974
|
+
path = await import("node:path");
|
|
3975
|
+
} catch {
|
|
3976
|
+
return;
|
|
3977
|
+
}
|
|
3978
|
+
const seen = new Set;
|
|
3979
|
+
let rootDir;
|
|
3980
|
+
const core2 = "@qwik-dev/core";
|
|
3981
|
+
const core1 = "@builder.io/qwik";
|
|
3982
|
+
async function isQwikDep(dep, dir) {
|
|
3983
|
+
while (dir) {
|
|
3984
|
+
const pkg = path.join(dir, "node_modules", dep, "package.json");
|
|
3985
|
+
try {
|
|
3986
|
+
await fs.access(pkg);
|
|
3987
|
+
const data = await fs.readFile(pkg, {
|
|
3988
|
+
encoding: "utf-8"
|
|
3989
|
+
});
|
|
3990
|
+
const json = JSON.parse(data);
|
|
3991
|
+
if (json.qwik || json.dependencies?.[core2] || json.peerDependencies?.[core2] || json.dependencies?.[core1] || json.peerDependencies?.[core1]) {
|
|
3992
|
+
return true;
|
|
3993
|
+
}
|
|
3994
|
+
return false;
|
|
3995
|
+
} catch {}
|
|
3996
|
+
const nextRoot = path.dirname(dir);
|
|
3997
|
+
if (nextRoot === dir) {
|
|
3998
|
+
break;
|
|
3999
|
+
}
|
|
4000
|
+
dir = nextRoot;
|
|
4001
|
+
}
|
|
4002
|
+
return false;
|
|
4003
|
+
}
|
|
4004
|
+
return {
|
|
4005
|
+
name: "checkQwikExternals",
|
|
4006
|
+
enforce: "pre",
|
|
4007
|
+
configResolved: config => {
|
|
4008
|
+
rootDir = config.root;
|
|
4009
|
+
},
|
|
4010
|
+
resolveId: {
|
|
4011
|
+
order: "pre",
|
|
4012
|
+
async handler(source, importer, options) {
|
|
4013
|
+
if (!options.ssr || /^([./]|node:|[^a-z])/.test(source) || seen.has(source)) {
|
|
4014
|
+
return;
|
|
4015
|
+
}
|
|
4016
|
+
const packageName = (source.startsWith("@") ? source.split("/").slice(0, 2).join("/") : source.split("/")[0]).split("?")[0];
|
|
4017
|
+
if (seen.has(packageName)) {
|
|
4018
|
+
return;
|
|
4019
|
+
}
|
|
4020
|
+
seen.add(source);
|
|
4021
|
+
seen.add(packageName);
|
|
4022
|
+
const result = await this.resolve(packageName, importer, {
|
|
4023
|
+
...options,
|
|
4024
|
+
skipSelf: true
|
|
4025
|
+
});
|
|
4026
|
+
if (result?.external && await isQwikDep(packageName, importer ? path.dirname(importer) : rootDir)) {
|
|
4027
|
+
throw new Error(`\n==============\n${packageName} is being treated as an external dependency, but it should be included in the server bundle, because it uses Qwik.\nPlease add the package to "ssr.noExternal" in the Vite config. \n==============`);
|
|
4028
|
+
}
|
|
4029
|
+
if (packageName === source) {
|
|
4030
|
+
return result;
|
|
4031
|
+
}
|
|
4032
|
+
}
|
|
4033
|
+
}
|
|
4034
|
+
};
|
|
3970
4035
|
}
|
|
3971
4036
|
|
|
3972
4037
|
var ANSI_COLOR = {
|
|
@@ -4005,71 +4070,6 @@ function getViteDevModule(opts) {
|
|
|
4005
4070
|
return `// Qwik Vite Dev Module\nimport { render as qwikRender } from '@qwik.dev/core';\n\nexport async function render(document, rootNode, opts) {\n\n await qwikRender(document, rootNode, opts);\n\n let qwikLoader = document.getElementById('qwikloader');\n if (!qwikLoader) {\n qwikLoader = document.createElement('script');\n qwikLoader.id = 'qwikloader';\n qwikLoader.innerHTML = ${qwikLoader};\n const parent = document.head ?? document.body ?? document.documentElement;\n parent.appendChild(qwikLoader);\n }\n\n if (!window.__qwikViteLog) {\n window.__qwikViteLog = true;\n console.debug("%c⭐️ Qwik Client Mode","background: #0c75d2; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;","Do not use this mode in production!\\n - No portion of the application is pre-rendered on the server\\n - All of the application is running eagerly in the browser\\n - Optimizer/Serialization/Deserialization code is not exercised!");\n }\n}`;
|
|
4006
4071
|
}
|
|
4007
4072
|
|
|
4008
|
-
async function findDepPkgJsonPath(sys, dep, parent) {
|
|
4009
|
-
const fs = await sys.dynamicImport("node:fs");
|
|
4010
|
-
let root = parent;
|
|
4011
|
-
while (root) {
|
|
4012
|
-
const pkg = sys.path.join(root, "node_modules", dep, "package.json");
|
|
4013
|
-
try {
|
|
4014
|
-
await fs.promises.access(pkg);
|
|
4015
|
-
return fs.promises.realpath(pkg);
|
|
4016
|
-
} catch {}
|
|
4017
|
-
const nextRoot = sys.path.dirname(root);
|
|
4018
|
-
if (nextRoot === root) {
|
|
4019
|
-
break;
|
|
4020
|
-
}
|
|
4021
|
-
root = nextRoot;
|
|
4022
|
-
}
|
|
4023
|
-
return;
|
|
4024
|
-
}
|
|
4025
|
-
|
|
4026
|
-
var findQwikRoots = async (sys, packageJsonDir) => {
|
|
4027
|
-
const paths = new Map;
|
|
4028
|
-
if ("node" === sys.env || "bun" === sys.env) {
|
|
4029
|
-
const fs = await sys.dynamicImport("node:fs");
|
|
4030
|
-
let prevPackageJsonDir;
|
|
4031
|
-
do {
|
|
4032
|
-
try {
|
|
4033
|
-
const data = await fs.promises.readFile(sys.path.join(packageJsonDir, "package.json"), {
|
|
4034
|
-
encoding: "utf-8"
|
|
4035
|
-
});
|
|
4036
|
-
try {
|
|
4037
|
-
const packageJson = JSON.parse(data);
|
|
4038
|
-
const dependencies = packageJson.dependencies;
|
|
4039
|
-
const devDependencies = packageJson.devDependencies;
|
|
4040
|
-
const packages = [];
|
|
4041
|
-
"object" === typeof dependencies && packages.push(...Object.keys(dependencies));
|
|
4042
|
-
"object" === typeof devDependencies && packages.push(...Object.keys(devDependencies));
|
|
4043
|
-
const basedir = sys.cwd();
|
|
4044
|
-
await Promise.all(packages.map(async id => {
|
|
4045
|
-
const pkgJsonPath = await findDepPkgJsonPath(sys, id, basedir);
|
|
4046
|
-
if (pkgJsonPath) {
|
|
4047
|
-
const pkgJsonContent = await fs.promises.readFile(pkgJsonPath, "utf-8");
|
|
4048
|
-
const pkgJson = JSON.parse(pkgJsonContent);
|
|
4049
|
-
const qwikPath = pkgJson.qwik;
|
|
4050
|
-
if (!qwikPath) {
|
|
4051
|
-
return;
|
|
4052
|
-
}
|
|
4053
|
-
const allPaths = Array.isArray(qwikPath) ? qwikPath : [ qwikPath ];
|
|
4054
|
-
for (const p of allPaths) {
|
|
4055
|
-
paths.set(await fs.promises.realpath(sys.path.resolve(sys.path.dirname(pkgJsonPath), p)), id);
|
|
4056
|
-
}
|
|
4057
|
-
}
|
|
4058
|
-
}));
|
|
4059
|
-
} catch (e) {
|
|
4060
|
-
console.error(e);
|
|
4061
|
-
}
|
|
4062
|
-
} catch {}
|
|
4063
|
-
prevPackageJsonDir = packageJsonDir;
|
|
4064
|
-
packageJsonDir = sys.path.dirname(packageJsonDir);
|
|
4065
|
-
} while (packageJsonDir !== prevPackageJsonDir);
|
|
4066
|
-
}
|
|
4067
|
-
return Array.from(paths).map(([path, id]) => ({
|
|
4068
|
-
path: path,
|
|
4069
|
-
id: id
|
|
4070
|
-
}));
|
|
4071
|
-
};
|
|
4072
|
-
|
|
4073
4073
|
var VITE_CLIENT_MODULE = "@qwik.dev/core/vite-client";
|
|
4074
4074
|
|
|
4075
4075
|
var CLIENT_DEV_INPUT = "entry.dev";
|
package/dist/qwikloader.debug.js
CHANGED
|
@@ -17,19 +17,10 @@ const findShadowRoots = (fragment) => {
|
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
19
|
const isPromise = (promise) => promise && typeof promise.then === "function";
|
|
20
|
-
let doNotClean = true;
|
|
21
20
|
const broadcast = (infix, ev, type = ev.type) => {
|
|
22
|
-
let found = doNotClean;
|
|
23
21
|
querySelectorAll("[on" + infix + "\\:" + type + "]").forEach((el) => {
|
|
24
|
-
found = true;
|
|
25
22
|
dispatch(el, infix, ev, type);
|
|
26
23
|
});
|
|
27
|
-
if (!found) {
|
|
28
|
-
window[infix.slice(1)].removeEventListener(
|
|
29
|
-
type,
|
|
30
|
-
infix === "-window" ? processWindowEvent : processDocumentEvent
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
24
|
};
|
|
34
25
|
const resolveContainer = (containerEl) => {
|
|
35
26
|
if (containerEl._qwikjson_ === void 0) {
|
|
@@ -202,11 +193,7 @@ const processReadyStateChange = () => {
|
|
|
202
193
|
const addEventListener = (el, eventName, handler, capture = false) => {
|
|
203
194
|
el.addEventListener(eventName, handler, { capture, passive: false });
|
|
204
195
|
};
|
|
205
|
-
let cleanTimer;
|
|
206
196
|
const processEventOrNode = (...eventNames) => {
|
|
207
|
-
doNotClean = true;
|
|
208
|
-
clearTimeout(cleanTimer);
|
|
209
|
-
cleanTimer = setTimeout(() => doNotClean = false, 2e4);
|
|
210
197
|
for (const eventNameOrNode of eventNames) {
|
|
211
198
|
if (typeof eventNameOrNode === "string") {
|
|
212
199
|
if (!events.has(eventNameOrNode)) {
|
package/dist/qwikloader.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=document,e=window,n=new Set,o=new Set([t]);let r;const s=(t,e)=>Array.from(t.querySelectorAll(e)),
|
|
1
|
+
const t=document,e=window,n=new Set,o=new Set([t]);let r;const s=(t,e)=>Array.from(t.querySelectorAll(e)),a=t=>{const e=[];return o.forEach(n=>e.push(...s(n,t))),e},i=t=>{m(t),s(t,"[q\\:shadowroot]").forEach(t=>{const e=t.shadowRoot;e&&i(e)})},c=t=>t&&"function"==typeof t.then,l=(t,e,n=e.type)=>{a("[on"+t+"\\:"+n+"]").forEach(o=>{u(o,t,e,n)})},f=e=>{if(void 0===e._qwikjson_){let n=(e===t.documentElement?t.body:e).lastElementChild;for(;n;){if("SCRIPT"===n.tagName&&"qwik/json"===n.getAttribute("type")){e._qwikjson_=JSON.parse(n.textContent.replace(/\\x3C(\/?script)/gi,"<$1"));break}n=n.previousElementSibling}}},p=(t,e)=>new CustomEvent(t,{detail:e}),u=async(e,n,o,r=o.type)=>{const s="on"+n+":"+r;e.hasAttribute("preventdefault:"+r)&&o.preventDefault(),e.hasAttribute("stoppropagation:"+r)&&o.stopPropagation();const a=e._qc_,i=a&&a.li.filter(t=>t[0]===s);if(i&&i.length>0){for(const t of i){const n=t[1].getFn([e,o],()=>e.isConnected)(o,e),r=o.cancelBubble;c(n)&&await n,r&&o.stopPropagation()}return}const l=e.getAttribute(s),p=e.qDispatchEvent;if(p)return p(o,n);if(l){const n=e.closest("[q\\:container]:not([q\\:container=html]):not([q\\:container=text])"),r=n.getAttribute("q:base"),s=n.getAttribute("q:version")||"unknown",a=n.getAttribute("q:manifest-hash")||"dev",i=new URL(r,t.baseURI);for(const p of l.split("\n")){const l=new URL(p,i),u=l.href,q=l.hash.replace(/^#?([^?[|]*).*$/,"$1")||"default",h=performance.now();let _,d,y;const m=p.startsWith("#"),w={qBase:r,qManifest:a,qVersion:s,href:u,symbol:q,element:e,reqTime:h};if(m){const e=n.getAttribute("q:instance");_=(t["qFuncs_"+e]||[])[Number.parseInt(q)],_||(d="sync",y=Error("sym:"+q))}else{b("qsymbol",w);const t=l.href.split("#")[0];try{const e=import(t);f(n),_=(await e)[q],_||(d="no-symbol",y=Error(`${q} not in ${t}`))}catch(t){d||(d="async"),y=t}}if(!_){b("qerror",{importError:d,error:y,...w}),console.error(y);break}const g=t.__q_context__;if(e.isConnected)try{t.__q_context__=[e,o,l];const n=_(o,e);c(n)&&await n}catch(t){b("qerror",{error:t,...w})}finally{t.__q_context__=g}}}},b=(e,n)=>{t.dispatchEvent(p(e,n))},q=t=>t.replace(/([A-Z])/g,t=>"-"+t.toLowerCase()),h=async t=>{let e=q(t.type),n=t.target;for(l("-document",t,e);n&&n.getAttribute;){const o=u(n,"",t,e);let r=t.cancelBubble;c(o)&&await o,r||(r=r||t.cancelBubble||n.hasAttribute("stoppropagation:"+t.type)),n=t.bubbles&&!0!==r?n.parentElement:null}},_=t=>{l("-window",t,q(t.type))},d=()=>{var s;const c=t.readyState;if(!r&&("interactive"==c||"complete"==c)&&(o.forEach(i),r=1,b("qinit"),(null!=(s=e.requestIdleCallback)?s:e.setTimeout).bind(e)(()=>b("qidle")),n.has("qvisible"))){const t=a("[on\\:qvisible]"),e=new IntersectionObserver(t=>{for(const n of t)n.isIntersecting&&(e.unobserve(n.target),u(n.target,"",p("qvisible",n)))});t.forEach(t=>e.observe(t))}},y=(t,e,n,o=!1)=>{t.addEventListener(e,n,{capture:o,passive:!1})},m=(...t)=>{for(const r of t)"string"==typeof r?n.has(r)||(o.forEach(t=>y(t,r,h,!0)),y(e,r,_,!0),n.add(r)):o.has(r)||(n.forEach(t=>y(r,t,h,!0)),o.add(r))};if(!("__q_context__"in t)){t.__q_context__=0;const r=e.qwikevents;r&&(Array.isArray(r)?m(...r):m("click","input")),e.qwikevents={events:n,roots:o,push:m},y(t,"readystatechange",d),d()}
|