@qwik.dev/core 2.0.0-beta.2 → 2.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/backpatch/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 +39 -0
- package/dist/backpatch-executor.js +1 -0
- package/dist/build/package.json +1 -1
- package/dist/cli.mjs +5633 -0
- package/dist/core-internal.d.ts +673 -396
- package/dist/core.min.mjs +2 -1
- package/dist/core.mjs +10168 -8294
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +5745 -4592
- package/dist/insights/vite/index.mjs +10 -10
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.d.ts +16 -38
- package/dist/optimizer.mjs +2608 -3719
- package/dist/preloader.mjs +8 -11
- package/dist/qwikloader.debug.js +152 -132
- package/dist/qwikloader.js +1 -1
- package/dist/server.d.ts +38 -15
- package/dist/server.mjs +1209 -927
- package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/{vite.config.mts → vite.config.ts} +2 -2
- package/dist/starters/adapters/aws-lambda/package.json +3 -2
- package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +2 -6
- package/dist/starters/adapters/azure-swa/adapters/azure-swa/{vite.config.mts → vite.config.ts} +2 -2
- package/dist/starters/adapters/azure-swa/package.json +3 -2
- package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +2 -3
- package/dist/starters/adapters/bun/adapters/bun/{vite.config.mts → vite.config.ts} +3 -3
- package/dist/starters/adapters/bun/package.json +3 -2
- package/dist/starters/adapters/bun/src/entry.bun.ts +0 -2
- package/dist/starters/adapters/cloud-run/adapters/cloud-run/{vite.config.mts → vite.config.ts} +2 -2
- package/dist/starters/adapters/cloud-run/package.json +3 -2
- package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +1 -3
- package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/{vite.config.mts → vite.config.ts} +2 -2
- package/dist/starters/adapters/cloudflare-pages/package.json +3 -2
- package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +2 -3
- package/dist/starters/adapters/cloudflare-workers/README.md +52 -0
- package/dist/starters/adapters/cloudflare-workers/adapters/cloudflare-workers/vite.config.ts +15 -0
- package/dist/starters/adapters/cloudflare-workers/gitignore +3 -0
- package/dist/starters/adapters/cloudflare-workers/package.json +31 -0
- package/dist/starters/adapters/cloudflare-workers/public/.assetsignore +4 -0
- package/dist/starters/adapters/cloudflare-workers/public/_headers +11 -0
- package/dist/starters/adapters/cloudflare-workers/public/_redirects +1 -0
- package/dist/starters/adapters/cloudflare-workers/src/entry.cloudflare-pages.tsx +23 -0
- package/dist/starters/adapters/cloudflare-workers/worker-configuration.d.ts +5 -0
- package/dist/starters/adapters/cloudflare-workers/wrangler.jsonc +41 -0
- package/dist/starters/adapters/deno/adapters/deno/{vite.config.mts → vite.config.ts} +2 -2
- package/dist/starters/adapters/deno/package.json +3 -2
- package/dist/starters/adapters/deno/src/entry.deno.ts +0 -2
- package/dist/starters/adapters/express/adapters/express/{vite.config.mts → vite.config.ts} +2 -2
- package/dist/starters/adapters/express/package.json +4 -3
- package/dist/starters/adapters/express/src/entry.express.tsx +1 -3
- package/dist/starters/adapters/fastify/adapters/fastify/{vite.config.mts → vite.config.ts} +2 -2
- package/dist/starters/adapters/fastify/package.json +3 -2
- package/dist/starters/adapters/fastify/src/entry.fastify.tsx +1 -1
- package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +1 -2
- package/dist/starters/adapters/firebase/adapters/firebase/{vite.config.mts → vite.config.ts} +2 -2
- package/dist/starters/adapters/firebase/package.json +3 -2
- package/dist/starters/adapters/firebase/src/entry-firebase.tsx +2 -3
- package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/{vite.config.mts → vite.config.ts} +2 -2
- package/dist/starters/adapters/netlify-edge/package.json +3 -2
- package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +2 -3
- package/dist/starters/adapters/node-server/adapters/node-server/{vite.config.mts → vite.config.ts} +2 -2
- package/dist/starters/adapters/node-server/package.json +3 -2
- package/dist/starters/adapters/node-server/src/entry.node-server.tsx +0 -2
- package/dist/starters/adapters/{static/adapters/static/vite.config.mts → ssg/adapters/ssg/vite.config.ts} +3 -3
- package/dist/starters/adapters/ssg/package.json +20 -0
- package/dist/starters/adapters/vercel-edge/README.md +2 -2
- package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/{vite.config.mts → vite.config.ts} +2 -2
- package/dist/starters/adapters/vercel-edge/package.json +3 -2
- package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +2 -3
- package/dist/starters/adapters/vercel-edge/vercel.json +1 -1
- package/dist/starters/features/auth/package.json +1 -1
- package/dist/starters/features/compiled-i18n/package.json +37 -0
- package/dist/starters/features/compiled-i18n/src/components/locale-selector/locale-selector.tsx +30 -0
- package/dist/starters/features/compiled-i18n/src/entry.ssr.tsx +31 -0
- package/dist/starters/features/compiled-i18n/src/routes/plugin@compiled-i18n.ts +28 -0
- package/dist/starters/features/csr/index.html +23 -0
- package/dist/starters/features/csr/package.json +29 -0
- package/dist/starters/features/csr/src/root.tsx +15 -0
- package/dist/starters/features/csr/vite.config.ts +13 -0
- package/dist/starters/features/cypress/src/actions/example.action.ts +5 -0
- package/dist/starters/features/cypress/src/components/example/example.cy.tsx +50 -8
- package/dist/starters/features/cypress/src/components/example/example.tsx +13 -3
- package/dist/starters/features/cypress/src/loaders/example.loader.ts +5 -0
- package/dist/starters/features/pandacss/package.json +1 -1
- package/dist/starters/features/playwright/playwright-report/index.html +953 -930
- package/dist/starters/features/postcss/postcss.config.js +1 -1
- package/dist/starters/features/storybook/.storybook/tsconfig.json +0 -1
- package/dist/starters/features/styled-vanilla-extract/package.json +2 -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.d.ts +775 -6
- package/dist/testing/index.mjs +14298 -10837
- package/dist/testing/package.json +1 -1
- package/handlers.mjs +1 -1
- package/package.json +30 -55
- package/public.d.ts +3 -1
- package/{qwik-cli.cjs → qwik-cli.mjs} +1 -1
- package/server.d.ts +2 -0
- package/bindings/qwik.darwin-x64.node +0 -0
- package/bindings/qwik.wasm.cjs +0 -471
- package/dist/build/index.cjs +0 -35
- package/dist/build/index.cjs.map +0 -7
- package/dist/build/index.dev.cjs +0 -37
- package/dist/build/index.dev.cjs.map +0 -7
- package/dist/build/index.prod.cjs +0 -37
- package/dist/build/index.prod.cjs.map +0 -7
- package/dist/cli.cjs +0 -5545
- package/dist/core.cjs +0 -11754
- package/dist/core.cjs.map +0 -1
- package/dist/core.prod.cjs +0 -5647
- package/dist/insights/index.qwik.cjs +0 -1
- package/dist/insights/vite/index.cjs +0 -1
- package/dist/loader/index.cjs +0 -4
- package/dist/optimizer.cjs +0 -4020
- package/dist/preloader.cjs +0 -269
- package/dist/server.cjs +0 -3027
- package/dist/starters/adapters/static/package.json +0 -19
- package/dist/starters/features/localize/package.json +0 -37
- package/dist/starters/features/localize/src/entry.ssr.tsx +0 -30
- package/dist/starters/features/localize/src/locales/message.en.json +0 -8
- package/dist/starters/features/localize/src/locales/message.it.json +0 -8
- package/dist/starters/features/localize/src/routes/[locale]/i18n-utils.ts +0 -94
- package/dist/starters/features/localize/src/routes/[locale]/index.tsx +0 -52
- package/dist/starters/features/localize/src/routes/[locale]/layout.tsx +0 -12
- package/dist/starters/features/tailwind/.prettierrc.js +0 -3
- package/dist/testing/index.cjs +0 -33287
- /package/dist/starters/adapters/{static → ssg}/README.md +0 -0
|
@@ -7,14 +7,14 @@ const q = (r, ...o) => {
|
|
|
7
7
|
console.log("\x1B[35m%s\x1B[0m", `qwikInsight(): ${r}`);
|
|
8
8
|
};
|
|
9
9
|
async function F(r) {
|
|
10
|
-
const { publicApiKey: o, baseUrl: I = "https://insights.qwik.dev", outDir:
|
|
10
|
+
const { publicApiKey: o, baseUrl: I = "https://insights.qwik.dev", outDir: h = "" } = r;
|
|
11
11
|
if (!o) {
|
|
12
12
|
console.warn("qwikInsights: publicApiKey is required, skipping...");
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
let f = !1, u, n, i = null, l = null;
|
|
16
16
|
const g = `${I}/api/v1/${o}`, p = `${g}/post/`;
|
|
17
|
-
async function
|
|
17
|
+
async function m() {
|
|
18
18
|
return i || (w(n) ? (b("Reading Qwik Insight data from: " + n), i = JSON.parse(await y(n, "utf-8"))) : null);
|
|
19
19
|
}
|
|
20
20
|
return {
|
|
@@ -23,7 +23,7 @@ async function F(r) {
|
|
|
23
23
|
// Only activate in production builds
|
|
24
24
|
apply: "build",
|
|
25
25
|
async config(s) {
|
|
26
|
-
return u = k(s.root || ".",
|
|
26
|
+
return u = k(s.root || ".", h), n = $(u, "q-insights.json"), f = s.mode !== "ssr", {
|
|
27
27
|
define: {
|
|
28
28
|
"globalThis.__QI_KEY__": JSON.stringify(o),
|
|
29
29
|
"globalThis.__QI_URL__": JSON.stringify(p)
|
|
@@ -44,26 +44,26 @@ async function F(r) {
|
|
|
44
44
|
const t = { manual: {}, prefetch: [] }, a = await (await fetch(`${g}/bundles/strategy/`)).json();
|
|
45
45
|
Object.assign(t, a), i = t, _(u, { recursive: !0 }), b("Fetched latest Qwik Insight data into: " + n), await v(n, JSON.stringify(t));
|
|
46
46
|
} catch (t) {
|
|
47
|
-
q(`Failed to fetch manifest from Insights DB at ${g}/bundles/strategy/`, t), await
|
|
47
|
+
q(`Failed to fetch manifest from Insights DB at ${g}/bundles/strategy/`, t), await m();
|
|
48
48
|
}
|
|
49
49
|
else
|
|
50
|
-
await
|
|
50
|
+
await m();
|
|
51
51
|
i && (c.entryStrategy.manual = {
|
|
52
52
|
...i.manual,
|
|
53
53
|
...c.entryStrategy.manual
|
|
54
54
|
}, l.api.registerBundleGraphAdder((t) => {
|
|
55
|
-
const
|
|
56
|
-
for (const a of
|
|
55
|
+
const d = {};
|
|
56
|
+
for (const a of i?.prefetch || [])
|
|
57
57
|
if (a.symbols) {
|
|
58
58
|
let e = a.route;
|
|
59
|
-
e.startsWith("/") && (e = e.slice(1)), e.endsWith("/") || (e += "/"),
|
|
59
|
+
e.startsWith("/") && (e = e.slice(1)), e.endsWith("/") || (e += "/"), d[e] = { ...t.bundles[e], imports: a.symbols };
|
|
60
60
|
}
|
|
61
|
-
return
|
|
61
|
+
return d;
|
|
62
62
|
}));
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
closeBundle: async () => {
|
|
66
|
-
const s = k(
|
|
66
|
+
const s = k(h, "q-manifest.json");
|
|
67
67
|
if (f && w(s)) {
|
|
68
68
|
const c = await y(s, "utf-8");
|
|
69
69
|
try {
|
package/dist/loader/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const QWIK_LOADER = "const
|
|
2
|
-
const QWIK_LOADER_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
|
|
1
|
+
const QWIK_LOADER = "const e=document,t=window,o=\"w\",r=\"d\",n=new Set,s=new Set([e]),i=new Map;let a,c;const l=(e,t)=>Array.from(e.querySelectorAll(t)),q=e=>{const t=[];return s.forEach(o=>t.push(...l(o,e))),t},d=(e,t,o,r=!1)=>e.addEventListener(t,o,{capture:r,passive:!1}),b=e=>{_(e),l(e,\"[q\\\\:shadowroot]\").forEach(e=>{const t=e.shadowRoot;t&&b(t)})},f=e=>e&&\"function\"==typeof e.then,p=t=>{if(void 0===t._qwikjson_){let o=(t===e.documentElement?e.body:t).lastElementChild;for(;o;){if(\"SCRIPT\"===o.tagName&&\"qwik/json\"===o.getAttribute(\"type\")){t._qwikjson_=JSON.parse(o.textContent.replace(/\\\\x3C(\\/?script)/gi,\"<$1\"));break}o=o.previousElementSibling}}},u=(e,t)=>new CustomEvent(e,{detail:t}),h=(t,o)=>{e.dispatchEvent(u(t,o))},m=e=>e.replace(/([A-Z-])/g,e=>\"-\"+e.toLowerCase()),v=e=>e.replace(/-./g,e=>e[1].toUpperCase()),w=e=>({scope:e.charAt(0),eventName:v(e.slice(2))}),y=async(t,o,r,n)=>{n&&(t.hasAttribute(\"preventdefault:\"+n)&&o.preventDefault(),t.hasAttribute(\"stoppropagation:\"+n)&&o.stopPropagation());const s=t._qDispatch?.[r];if(s){if(s.length)for(const e of s){const r=e?.(o,t);f(r)&&await r}else await s(o,t);return}const a=t.getAttribute(\"q-\"+r);if(a){const r=t.closest(\"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\"),n=r.getAttribute(\"q:base\"),s=new URL(n,e.baseURI);for(const c of a.split(\"|\")){const a=performance.now(),[l,q,d]=c.split(\"#\"),b={qBase:n,symbol:q,element:t,reqTime:a};let u,m,v;if(\"\"===l){const t=r.getAttribute(\"q:instance\");u=(e[\"qFuncs_\"+t]||[])[Number.parseInt(q)],u||(m=\"sync\",v=Error(\"sym:\"+q))}else{const e=`${q}|${n}|${l}`;if(u=i.get(e),!u){const t=new URL(l,s).href;try{const o=import(t);p(r),u=(await o)[q],u?(i.set(e,u),h(\"qsymbol\",b)):(m=\"no-symbol\",v=Error(`${q} not in ${t}`))}catch(e){m=\"async\",v=e}}}if(u){if(t.isConnected)try{const e=u.call(d,o,t);f(e)&&await e}catch(e){h(\"qerror\",{error:e,...b})}}else h(\"qerror\",{importError:m,error:v,...b}),console.error(v)}}},E=async e=>{const t=m(e.type),o=\"e:\"+t;let r=e.target;for(;r&&r.getAttribute;){const n=y(r,e,o,t),s=e.bubbles&&!e.cancelBubble;f(n)&&await n,r=s&&e.bubbles&&!e.cancelBubble?r.parentElement:null}},g=(e,t)=>{const o=m(t.type),r=e+\":\"+o;q(\"[q-\"+e+\"\\\\:\"+o+\"]\").forEach(e=>y(e,t,r,o))},A=async e=>{g(r,e)},C=e=>{g(o,e)},k=()=>{const o=e.readyState;if(\"interactive\"==o||\"complete\"==o){if(c=1,s.forEach(b),n.has(\"d:qinit\")){n.delete(\"d:qinit\");const e=u(\"qinit\");q(\"[q-d\\\\:qinit]\").forEach(t=>{y(t,e,\"d:qinit\"),t.removeAttribute(\"q-d:qinit\")})}n.has(\"d:qidle\")&&(n.delete(\"d:qidle\"),(t.requestIdleCallback??t.setTimeout).bind(t)(()=>{const e=u(\"qidle\");q(\"[q-d\\\\:qidle]\").forEach(t=>{y(t,e,\"d:qidle\"),t.removeAttribute(\"q-d:qidle\")})})),n.has(\"e:qvisible\")&&(a||(a=new IntersectionObserver(e=>{for(const t of e)t.isIntersecting&&(a.unobserve(t.target),y(t.target,u(\"qvisible\",t),\"e:qvisible\"))})),q(\"[q-e\\\\:qvisible]:not([q\\\\:observed])\").forEach(e=>{a.observe(e),e.setAttribute(\"q:observed\",\"true\")}))}},_=(...e)=>{for(const i of e)if(\"string\"==typeof i){if(!n.has(i)){n.add(i);const{scope:e,eventName:a}=w(i);e===o?d(t,a,C,!0):s.forEach(t=>d(t,a,e===r?A:E,!0)),1!==c||\"e:qvisible\"!==i&&\"d:qinit\"!==i&&\"d:qidle\"!==i||k()}}else s.has(i)||(n.forEach(e=>{const{scope:t,eventName:n}=w(e);t!==o&&d(i,n,t===r?A:E,!0)}),s.add(i))},S=t._qwikEv;S?.roots||(Array.isArray(S)?_(...S):_(\"e:click\",\"e:input\"),t._qwikEv={events:n,roots:s,push:_},d(e,\"readystatechange\",k),k())";
|
|
2
|
+
const QWIK_LOADER_DEBUG = "const doc = document;\nconst win = window;\nconst windowPrefix = \"w\";\nconst documentPrefix = \"d\";\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nconst symbols = /* @__PURE__ */ new Map();\nlet observer;\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 addEventListener = (el, eventName, handler, capture = false) => el.addEventListener(eventName, handler, { capture, passive: false });\nconst findShadowRoots = (fragment) => {\n addEventOrRoot(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 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, { detail });\nconst emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n};\nconst camelToKebab = (str) => str.replace(/([A-Z-])/g, (a) => \"-\" + a.toLowerCase());\nconst kebabToCamel = (eventName) => eventName.replace(/-./g, (a) => a[1].toUpperCase());\nconst parseKebabEvent = (event) => ({\n scope: event.charAt(0),\n eventName: kebabToCamel(event.slice(2))\n});\nconst dispatch = async (element, ev, scopedKebabName, kebabName) => {\n if (kebabName) {\n if (element.hasAttribute(\"preventdefault:\" + kebabName)) {\n ev.preventDefault();\n }\n if (element.hasAttribute(\"stoppropagation:\" + kebabName)) {\n ev.stopPropagation();\n }\n }\n const handlers = element._qDispatch?.[scopedKebabName];\n if (handlers) {\n if (handlers.length) {\n for (const handler of handlers) {\n const result = handler?.(ev, element);\n if (isPromise(result)) {\n await result;\n }\n }\n } else {\n await handlers(ev, element);\n }\n return;\n }\n const attrValue = element.getAttribute(\"q-\" + scopedKebabName);\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 base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split(\"|\")) {\n const reqTime = performance.now();\n const [chunk, symbol, capturedIds] = qrl.split(\"#\");\n const eventData = {\n qBase,\n symbol,\n element,\n reqTime\n };\n let handler;\n let importError;\n let error;\n if (chunk === \"\") {\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 const key = `${symbol}|${qBase}|${chunk}`;\n handler = symbols.get(key);\n if (!handler) {\n const href = new URL(chunk, base).href;\n try {\n const module = import(\n href\n );\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = \"no-symbol\";\n error = new Error(`${symbol} not in ${href}`);\n } else {\n symbols.set(key, handler);\n emitEvent(\"qsymbol\", eventData);\n }\n } catch (err) {\n importError = \"async\";\n error = err;\n }\n }\n }\n if (!handler) {\n emitEvent(\"qerror\", {\n importError,\n error,\n ...eventData\n });\n console.error(error);\n continue;\n }\n if (element.isConnected) {\n try {\n const result = handler.call(capturedIds, ev, element);\n if (isPromise(result)) {\n await result;\n }\n } catch (error2) {\n emitEvent(\"qerror\", { error: error2, ...eventData });\n }\n }\n }\n }\n};\nconst processElementEvent = async (ev) => {\n const kebabName = camelToKebab(ev.type);\n const scopedKebabName = \"e:\" + kebabName;\n let element = ev.target;\n while (element && element.getAttribute) {\n const results = dispatch(element, ev, scopedKebabName, kebabName);\n const doBubble = ev.bubbles && !ev.cancelBubble;\n if (isPromise(results)) {\n await results;\n }\n element = doBubble && ev.bubbles && !ev.cancelBubble ? element.parentElement : null;\n }\n};\nconst broadcast = (infix, ev) => {\n const kebabName = camelToKebab(ev.type);\n const scopedKebabName = infix + \":\" + kebabName;\n querySelectorAll(\"[q-\" + infix + \"\\\\:\" + kebabName + \"]\").forEach(\n (el) => dispatch(el, ev, scopedKebabName, kebabName)\n );\n};\nconst processDocumentEvent = async (ev) => {\n broadcast(documentPrefix, ev);\n};\nconst processWindowEvent = (ev) => {\n broadcast(windowPrefix, ev);\n};\nconst processReadyStateChange = () => {\n const readyState = doc.readyState;\n if (readyState == \"interactive\" || readyState == \"complete\") {\n hasInitialized = 1;\n roots.forEach(findShadowRoots);\n if (events.has(\"d:qinit\")) {\n events.delete(\"d:qinit\");\n const ev = createEvent(\"qinit\");\n querySelectorAll(\"[q-d\\\\:qinit]\").forEach((el) => {\n dispatch(el, ev, \"d:qinit\");\n el.removeAttribute(\"q-d:qinit\");\n });\n }\n if (events.has(\"d:qidle\")) {\n events.delete(\"d:qidle\");\n const riC = win.requestIdleCallback ?? win.setTimeout;\n riC.bind(win)(() => {\n const ev = createEvent(\"qidle\");\n querySelectorAll(\"[q-d\\\\:qidle]\").forEach((el) => {\n dispatch(el, ev, \"d:qidle\");\n el.removeAttribute(\"q-d:qidle\");\n });\n });\n }\n if (events.has(\"e:qvisible\")) {\n observer || (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), \"e:qvisible\");\n }\n }\n }));\n querySelectorAll(\"[q-e\\\\:qvisible]:not([q\\\\:observed])\").forEach((el) => {\n observer.observe(el);\n el.setAttribute(\"q:observed\", \"true\");\n });\n }\n }\n};\nconst addEventOrRoot = (...eventNames) => {\n for (const eventNameOrRoot of eventNames) {\n if (typeof eventNameOrRoot === \"string\") {\n if (!events.has(eventNameOrRoot)) {\n events.add(eventNameOrRoot);\n const { scope, eventName } = parseKebabEvent(eventNameOrRoot);\n if (scope === windowPrefix) {\n addEventListener(win, eventName, processWindowEvent, true);\n } else {\n roots.forEach(\n (root) => addEventListener(\n root,\n eventName,\n scope === documentPrefix ? processDocumentEvent : processElementEvent,\n true\n )\n );\n }\n if (hasInitialized === 1 && (eventNameOrRoot === \"e:qvisible\" || eventNameOrRoot === \"d:qinit\" || eventNameOrRoot === \"d:qidle\")) {\n processReadyStateChange();\n }\n }\n } else {\n if (!roots.has(eventNameOrRoot)) {\n events.forEach((kebabEventName) => {\n const { scope, eventName } = parseKebabEvent(kebabEventName);\n if (scope !== windowPrefix) {\n addEventListener(\n eventNameOrRoot,\n eventName,\n scope === documentPrefix ? processDocumentEvent : processElementEvent,\n true\n );\n }\n });\n roots.add(eventNameOrRoot);\n }\n }\n }\n};\nconst _qwikEv = win._qwikEv;\nif (!_qwikEv?.roots) {\n if (Array.isArray(_qwikEv)) {\n addEventOrRoot(..._qwikEv);\n } else {\n addEventOrRoot(\"e:click\", \"e:input\");\n }\n win._qwikEv = {\n events,\n roots,\n push: addEventOrRoot\n };\n addEventListener(doc, \"readystatechange\", processReadyStateChange);\n processReadyStateChange();\n}";
|
|
3
3
|
export { QWIK_LOADER, QWIK_LOADER_DEBUG };
|
package/dist/loader/package.json
CHANGED
package/dist/optimizer.d.ts
CHANGED
|
@@ -19,8 +19,6 @@ export declare interface ComponentEntryStrategy {
|
|
|
19
19
|
/** @public */
|
|
20
20
|
export declare const createOptimizer: (optimizerOptions?: OptimizerOptions) => Promise<Optimizer>;
|
|
21
21
|
|
|
22
|
-
declare function createSymbolMapper(base: string): SymbolMapperFn;
|
|
23
|
-
|
|
24
22
|
/** @public */
|
|
25
23
|
export declare interface Diagnostic {
|
|
26
24
|
scope: string;
|
|
@@ -60,7 +58,7 @@ export declare enum ExperimentalFeatures {
|
|
|
60
58
|
enableRequestRewrite = "enableRequestRewrite",
|
|
61
59
|
/** Enable worker$ */
|
|
62
60
|
webWorker = "webWorker",
|
|
63
|
-
/** Enable the ability to use the Qwik Insights vite plugin and
|
|
61
|
+
/** Enable the ability to use the Qwik Insights vite plugin and `<Insights/>` component */
|
|
64
62
|
insights = "insights"
|
|
65
63
|
}
|
|
66
64
|
|
|
@@ -92,11 +90,11 @@ export declare interface InlineEntryStrategy {
|
|
|
92
90
|
/** @public */
|
|
93
91
|
export declare type MinifyMode = 'simplify' | 'none';
|
|
94
92
|
|
|
95
|
-
declare interface NormalizedQwikPluginOptions extends Omit<Required<QwikPluginOptions>, 'vendorRoots' | 'experimental'> {
|
|
93
|
+
declare interface NormalizedQwikPluginOptions extends Omit<Required<QwikPluginOptions>, 'input' | 'vendorRoots' | 'srcInputs' | 'experimental'> {
|
|
96
94
|
input: string[] | {
|
|
97
95
|
[entry: string]: string;
|
|
98
|
-
};
|
|
99
|
-
experimental
|
|
96
|
+
} | undefined;
|
|
97
|
+
experimental: Record<keyof typeof ExperimentalFeatures, boolean> | undefined;
|
|
100
98
|
}
|
|
101
99
|
|
|
102
100
|
/** @public */
|
|
@@ -281,13 +279,17 @@ declare interface QwikPluginOptions {
|
|
|
281
279
|
vendorRoots?: string[];
|
|
282
280
|
manifestOutput?: ((manifest: QwikManifest) => Promise<void> | void) | null;
|
|
283
281
|
manifestInput?: QwikManifest | null;
|
|
282
|
+
manifestInputPath?: string | null;
|
|
284
283
|
input?: string[] | string | {
|
|
285
284
|
[entry: string]: string;
|
|
286
285
|
};
|
|
287
286
|
outDir?: string;
|
|
287
|
+
ssrOutDir?: string;
|
|
288
|
+
clientOutDir?: string;
|
|
288
289
|
assetsDir?: string;
|
|
289
290
|
srcDir?: string | null;
|
|
290
291
|
scope?: string | null;
|
|
292
|
+
/** @deprecated Not used */
|
|
291
293
|
srcInputs?: TransformModuleInput[] | null;
|
|
292
294
|
sourcemap?: boolean;
|
|
293
295
|
resolveQwikBuild?: boolean;
|
|
@@ -422,12 +424,6 @@ export declare interface QwikSymbol {
|
|
|
422
424
|
*/
|
|
423
425
|
export declare function qwikVite(qwikViteOpts?: QwikVitePluginOptions): any;
|
|
424
426
|
|
|
425
|
-
/** @public */
|
|
426
|
-
export declare interface QwikViteDevResponse {
|
|
427
|
-
_qwikEnvData?: Record<string, any>;
|
|
428
|
-
_qwikRenderResolve?: () => void;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
427
|
/**
|
|
432
428
|
* This is the type of the "pre" Qwik Vite plugin. `qwikVite` actually returns a tuple of two
|
|
433
429
|
* plugins, but after Vite flattens them, you can find the plugin by name.
|
|
@@ -448,6 +444,8 @@ export declare interface QwikVitePluginApi {
|
|
|
448
444
|
getClientPublicOutDir: () => string | null;
|
|
449
445
|
getAssetsDir: () => string | undefined;
|
|
450
446
|
registerBundleGraphAdder: (adder: BundleGraphAdder) => void;
|
|
447
|
+
/** @internal */
|
|
448
|
+
_oldDevSsrServer: () => boolean | undefined;
|
|
451
449
|
}
|
|
452
450
|
|
|
453
451
|
declare interface QwikVitePluginCommonOptions {
|
|
@@ -523,7 +521,7 @@ declare interface QwikVitePluginCommonOptions {
|
|
|
523
521
|
* Predicate function to filter out files from the optimizer. hook for resolveId, load, and
|
|
524
522
|
* transform
|
|
525
523
|
*/
|
|
526
|
-
fileFilter?: (id: string, hook:
|
|
524
|
+
fileFilter?: (id: string, hook: keyof Plugin_2) => boolean;
|
|
527
525
|
/**
|
|
528
526
|
* Run eslint on the source files for the ssr build or dev server. This can slow down startup on
|
|
529
527
|
* large projects. Defaults to `true`
|
|
@@ -571,13 +569,6 @@ declare interface QwikVitePluginSSROptions extends QwikVitePluginCommonOptions {
|
|
|
571
569
|
* Default `src/components/app/app.tsx`
|
|
572
570
|
*/
|
|
573
571
|
input?: string[] | string;
|
|
574
|
-
/**
|
|
575
|
-
* Entry input for client-side only development with hot-module reloading. This is for Vite
|
|
576
|
-
* development only and does not use SSR.
|
|
577
|
-
*
|
|
578
|
-
* Default `src/entry.dev.tsx`
|
|
579
|
-
*/
|
|
580
|
-
devInput?: string;
|
|
581
572
|
/**
|
|
582
573
|
* Output directory for the client build.
|
|
583
574
|
*
|
|
@@ -592,15 +583,7 @@ declare interface QwikVitePluginSSROptions extends QwikVitePluginCommonOptions {
|
|
|
592
583
|
*/
|
|
593
584
|
manifestOutput?: (manifest: QwikManifest) => Promise<void> | void;
|
|
594
585
|
};
|
|
595
|
-
/**
|
|
596
|
-
* Qwik is SSR first framework. This means that Qwik requires either SSR or SSG. In dev mode the
|
|
597
|
-
* dev SSR server is responsible for rendering and pausing the application on the server.
|
|
598
|
-
*
|
|
599
|
-
* Under normal circumstances this should be on, unless you have your own SSR server which you
|
|
600
|
-
* would like to use instead and wish to disable this one.
|
|
601
|
-
*
|
|
602
|
-
* Default: true
|
|
603
|
-
*/
|
|
586
|
+
/** @deprecated Use the `devSsrServer` option of the qwikRouter() plugin instead. */
|
|
604
587
|
devSsrServer?: boolean;
|
|
605
588
|
/** Controls the SSR behavior. */
|
|
606
589
|
ssr?: {
|
|
@@ -626,6 +609,8 @@ declare interface QwikVitePluginSSROptions extends QwikVitePluginCommonOptions {
|
|
|
626
609
|
* Default `undefined`
|
|
627
610
|
*/
|
|
628
611
|
manifestInput?: QwikManifest;
|
|
612
|
+
/** Same as `manifestInput` but allows passing the path to the file. */
|
|
613
|
+
manifestInputPath?: string;
|
|
629
614
|
};
|
|
630
615
|
}
|
|
631
616
|
|
|
@@ -702,15 +687,8 @@ export declare type SourceMapsOption = 'external' | 'inline' | undefined | null;
|
|
|
702
687
|
/** @public */
|
|
703
688
|
export declare type SymbolMapper = Record<string, readonly [symbol: string, chunk: string]>;
|
|
704
689
|
|
|
705
|
-
/**
|
|
706
|
-
|
|
707
|
-
* For a given symbol (QRL such as `onKeydown$`) the server needs to know which bundle the symbol is in.
|
|
708
|
-
*
|
|
709
|
-
* Normally this is provided by Qwik's `q-manifest` . But `q-manifest` only exists after a full client build.
|
|
710
|
-
*
|
|
711
|
-
* This would be a problem in dev mode. So in dev mode the symbol is mapped to the expected URL using the symbolMapper function below. For Vite the given path is fixed for a given symbol.
|
|
712
|
-
*/
|
|
713
|
-
export declare let symbolMapper: ReturnType<typeof createSymbolMapper>;
|
|
690
|
+
/** @alpha @deprecated No longer needed, it is automatic now */
|
|
691
|
+
export declare const symbolMapper: undefined;
|
|
714
692
|
|
|
715
693
|
/** @public */
|
|
716
694
|
export declare type SymbolMapperFn = (symbolName: string, mapper: SymbolMapper | undefined, parent?: string) => readonly [symbol: string, chunk: string] | undefined;
|