Skip to content

Commit ebbd679

Browse files
committed
solve building problem
1 parent a2b6288 commit ebbd679

8 files changed

Lines changed: 31 additions & 27 deletions

File tree

packages/docs/vite.config.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import type { ShikiTransformer } from '@shikijs/types';
1111
import tailwindcss from '@tailwindcss/vite';
1212
import path, { resolve } from 'node:path';
1313
import { qwikDevtools } from '@qwik.dev/devtools';
14-
import { defineConfig, loadEnv, type Plugin, type Rollup, type UserConfig } from 'vite';
14+
import type { ManualChunksOption, OutputOptions } from 'rollup';
15+
import { defineConfig, loadEnv, type Plugin, type UserConfig } from 'vite';
1516
import { compiledStringPlugin } from '../../scripts/compiled-string-plugin.js';
1617
import { examplesData, playgroundData, rawSource, tutorialData } from './vite.repl-apps';
1718
import { sourceResolver } from './vite.source-resolver';
@@ -103,9 +104,9 @@ function overrideManualChunksForRepl(): Plugin {
103104
enforce: 'post',
104105
config(userConfig) {
105106
const prevOutput = userConfig.build?.rollupOptions?.output;
106-
const prevManualChunks: Rollup.ManualChunksOption | undefined =
107+
const prevManualChunks: ManualChunksOption | undefined =
107108
prevOutput && !Array.isArray(prevOutput)
108-
? (prevOutput as Rollup.OutputOptions).manualChunks
109+
? (prevOutput as OutputOptions).manualChunks
109110
: undefined;
110111

111112
return {
@@ -122,7 +123,7 @@ function overrideManualChunksForRepl(): Plugin {
122123
}
123124

124125
if (typeof prevManualChunks === 'function') {
125-
return prevManualChunks(id, meta);
126+
return prevManualChunks(id, meta as any);
126127
}
127128
},
128129
},

packages/insights/adapters/netlify-edge/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default extendConfig(baseConfig, () => {
77
build: {
88
ssr: true,
99
rollupOptions: {
10-
input: ['src/entry.netlify-edge.tsx'],
10+
input: ['./src/entry.netlify-edge.tsx'],
1111
},
1212
outDir: '.netlify/edge-functions/entry.netlify-edge',
1313
},

packages/qwik/src/core/preloader/preloader.unit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ test('preloader script', async () => {
3333
const compressed = compress(Buffer.from(code), { mode: 1, quality: 11 });
3434
expect({ brotli: compressed.length, minified: code.length }).toMatchInlineSnapshot(`
3535
{
36-
"brotli": 1287,
37-
"minified": 2518,
36+
"brotli": 1273,
37+
"minified": 2466,
3838
}
3939
`);
4040
});

packages/qwik/src/optimizer/src/plugins/plugin.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { OutputOptions } from 'rollup';
12
import type { DevEnvironment, HotUpdateOptions, Plugin, Rollup, ViteDevServer } from 'vite';
23
import type { BundleGraphAdder } from '..';
34
import { hashCode } from '../../../core/shared/utils/hash_code';
@@ -1072,7 +1073,12 @@ export const manifest = ${serverManifest ? JSON.stringify(serverManifest) : 'glo
10721073
}
10731074
}
10741075

1075-
const manualChunks: Rollup.ManualChunksOption = (id: string, { getModuleInfo }) => {
1076+
type ManualChunksFn = Exclude<
1077+
NonNullable<OutputOptions['manualChunks']>,
1078+
Record<string, string[]>
1079+
>;
1080+
1081+
const manualChunks: ManualChunksFn = (id: string, { getModuleInfo }) => {
10761082
if (opts.target === 'client') {
10771083
if (
10781084
// The preloader has to stay in a separate chunk if it's a client build

packages/qwik/src/optimizer/src/plugins/vite.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { ResolvedId } from 'rollup';
21
import type {
32
BuildOptions,
43
ConfigEnv,
54
EnvironmentOptions,
65
UserConfig,
76
ViteDevServer,
87
Plugin as VitePlugin,
8+
Rollup,
99
} from 'vite';
1010
import type {
1111
EntryStrategy,
@@ -769,7 +769,7 @@ async function checkExternals() {
769769
// technically we should check for each importer, but this is ok
770770
seen.add(source);
771771
seen.add(packageName);
772-
let result: ResolvedId | null;
772+
let result: Rollup.ResolvedId | null;
773773
try {
774774
result = await this.resolve(packageName, importer, { ...options, skipSelf: true });
775775
} catch {

packages/qwik/src/qwikloader.unit.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ test('qwikloader script', () => {
2323
const compressed = compress(Buffer.from(qwikLoader), { mode: 1, quality: 11 });
2424
expect([compressed.length, qwikLoader.length]).toMatchInlineSnapshot(`
2525
[
26-
1509,
27-
3357,
26+
1507,
27+
3334,
2828
]
2929
`);
3030

3131
expect(qwikLoader).toMatchInlineSnapshot(
32-
`"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}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());"`
32+
String.raw`"var e,t,o=document,r=window,n="w",s="d",i=new Set,a=new Set([o]),c=new Map,l=(e,t)=>Array.from(e.querySelectorAll(t)),q=e=>{const t=[];return a.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=e=>{if(void 0===e._qwikjson_){let t=(e===o.documentElement?o.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}}},u=(e,t)=>new CustomEvent(e,{detail:t}),h=(e,t)=>{o.dispatchEvent(u(e,t))},v=e=>e.replace(/([A-Z-])/g,e=>"-"+e.toLowerCase()),m=e=>e.replace(/-./g,e=>e[1].toUpperCase()),w=e=>({scope:e.charAt(0),eventName:m(e.slice(2))}),y=async(e,t,r,n)=>{n&&(e.hasAttribute("preventdefault:"+n)&&t.preventDefault(),e.hasAttribute("stoppropagation:"+n)&&t.stopPropagation());const s=e._qDispatch?.[r];if(s){if(s.length)for(const o of s){const r=o?.(t,e);f(r)&&await r}return}const i=e.getAttribute("q-"+r);if(i){const r=e.closest("[q\\:container]:not([q\\:container=html]):not([q\\:container=text])"),n=r.getAttribute("q:base"),s=new URL(n,o.baseURI);for(const a of i.split("|")){const i=performance.now(),[l,q,d]=a.split("#"),b={qBase:n,symbol:q,element:e,reqTime:i};let u,v,m;if(""===l)u=(o["qFuncs_"+r.getAttribute("q:instance")]||[])[Number.parseInt(q)],u||(v="sync",m=Error("sym:"+q));else{const e=${'`'}${'${q}'}|${'${n}'}|${'${l}'}${'`'};if(u=c.get(e),!u){const t=new URL(l,s).href;try{const o=import(t);p(r),u=(await o)[q],u?(c.set(e,u),h("qsymbol",b)):(v="no-symbol",m=Error(${'`'}${'${q}'} not in ${'${t}'}${'`'}))}catch(e){v="async",m=e}}}if(u){if(e.isConnected)try{const o=u.call(d,t,e);f(o)&&await o}catch(e){h("qerror",{error:e,...b})}}else h("qerror",{importError:v,error:m,...b}),console.error(m)}}},E=async e=>{const t=v(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=v(t.type),r=e+":"+o;q("[q-"+e+"\\:"+o+"]").forEach(e=>y(e,t,r,o))},A=async e=>{g(s,e)},C=e=>{g(n,e)},k=()=>{const n=o.readyState;if("interactive"==n||"complete"==n){if(t=1,a.forEach(b),i.has("d:qinit")){i.delete("d:qinit");const e=u("qinit");q("[q-d\\:qinit]").forEach(t=>{y(t,e,"d:qinit"),t.removeAttribute("q-d:qinit")})}i.has("d:qidle")&&(i.delete("d:qidle"),(r.requestIdleCallback??r.setTimeout).bind(r)(()=>{const e=u("qidle");q("[q-d\\:qidle]").forEach(t=>{y(t,e,"d:qidle"),t.removeAttribute("q-d:qidle")})})),i.has("e:qvisible")&&(e||(e=new IntersectionObserver(t=>{for(const o of t)o.isIntersecting&&(e.unobserve(o.target),y(o.target,u("qvisible",o),"e:qvisible"))})),q("[q-e\\:qvisible]:not([q\\:observed])").forEach(t=>{e.observe(t),t.setAttribute("q:observed","true")}))}},_=(...e)=>{for(const o of e)if("string"==typeof o){if(!i.has(o)){i.add(o);const{scope:e,eventName:c}=w(o);e===n?d(r,c,C,!0):a.forEach(t=>d(t,c,e===s?A:E,!0)),1!==t||"e:qvisible"!==o&&"d:qinit"!==o&&"d:qidle"!==o||k()}}else a.has(o)||(i.forEach(e=>{const{scope:t,eventName:r}=w(e);t!==n&&d(o,r,t===s?A:E,!0)}),a.add(o))},S=r._qwikEv;S?.roots||(Array.isArray(S)?_(...S):_("e:click","e:input"),r._qwikEv={events:i,roots:a,push:_},d(o,"readystatechange",k),k());"`
3333
);
3434
});
3535

pnpm-lock.yaml

Lines changed: 2 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/create-qwik-cli.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,21 @@ export async function copyStartersDir(
147147
const distDir = join(distStartersDir, typeDir);
148148

149149
await rm(distDir, { force: true, recursive: true });
150+
await mkdir(distDir);
150151

151-
await copyDir(config, srcDir, distDir);
152+
const srcSubdirs = (await readdir(srcDir)).filter(
153+
(a) => a !== '.DS_Store' && existsSync(join(srcDir, a, 'package.json'))
154+
);
155+
await Promise.all(
156+
srcSubdirs.map((subdir) => copyDir(config, join(srcDir, subdir), join(distDir, subdir)))
157+
);
152158

153159
const distStartersDirs = await readdir(distDir);
154160
await Promise.all(
155161
distStartersDirs
156162
.filter((a) => a !== '.DS_Store')
157-
.map(async (distStartersDir) => {
158-
const pkgJsonPath = join(distDir, distStartersDir, 'package.json');
163+
.map(async (distStarterDir) => {
164+
const pkgJsonPath = join(distDir, distStarterDir, 'package.json');
159165
if (!existsSync(pkgJsonPath)) {
160166
throw new Error(`CLI starter missing package.json: ${pkgJsonPath}`);
161167
}

0 commit comments

Comments
 (0)